extern void __VERIFIER_error() __attribute__ ((__noreturn__)); /* Generated by CIL v. 1.3.7 */ /* print_CIL_Input is false */ typedef signed char __s8; typedef unsigned char __u8; typedef short __s16; typedef unsigned short __u16; typedef int __s32; typedef unsigned int __u32; typedef long long __s64; typedef unsigned long long __u64; typedef signed char s8; typedef unsigned char u8; typedef short s16; typedef unsigned short u16; typedef int s32; typedef unsigned int u32; typedef long long s64; typedef unsigned long long u64; typedef long __kernel_long_t; typedef unsigned long __kernel_ulong_t; typedef int __kernel_pid_t; typedef unsigned int __kernel_uid32_t; typedef unsigned int __kernel_gid32_t; typedef __kernel_ulong_t __kernel_size_t; typedef __kernel_long_t __kernel_ssize_t; typedef __kernel_long_t __kernel_off_t; typedef long long __kernel_loff_t; typedef __kernel_long_t __kernel_time_t; typedef __kernel_long_t __kernel_clock_t; typedef int __kernel_timer_t; typedef int __kernel_clockid_t; typedef __u16 __le16; typedef __u16 __be16; typedef __u32 __le32; typedef __u32 __be32; typedef __u64 __be64; typedef __u16 __sum16; typedef __u32 __wsum; typedef __u32 __kernel_dev_t; typedef __kernel_dev_t dev_t; typedef unsigned short umode_t; typedef __u32 nlink_t; typedef __kernel_off_t off_t; typedef __kernel_pid_t pid_t; typedef __kernel_clockid_t clockid_t; typedef _Bool bool; typedef __kernel_uid32_t uid_t; typedef __kernel_gid32_t gid_t; typedef __kernel_loff_t loff_t; typedef __kernel_size_t size_t; typedef __kernel_ssize_t ssize_t; typedef __kernel_time_t time_t; typedef __s32 int32_t; typedef __u8 uint8_t; typedef __u32 uint32_t; typedef __u64 uint64_t; typedef unsigned long sector_t; typedef unsigned long blkcnt_t; typedef u64 dma_addr_t; typedef unsigned int gfp_t; typedef unsigned int fmode_t; typedef unsigned int oom_flags_t; typedef u64 phys_addr_t; typedef phys_addr_t resource_size_t; struct __anonstruct_atomic_t_6 { int counter ; }; typedef struct __anonstruct_atomic_t_6 atomic_t; struct __anonstruct_atomic64_t_7 { long counter ; }; typedef struct __anonstruct_atomic64_t_7 atomic64_t; struct list_head { struct list_head *next ; struct list_head *prev ; }; struct hlist_node; struct hlist_head { struct hlist_node *first ; }; struct hlist_node { struct hlist_node *next ; struct hlist_node **pprev ; }; struct callback_head { struct callback_head *next ; void (*func)(struct callback_head * ) ; }; struct module; typedef void (*ctor_fn_t)(void); struct file_operations; struct device; struct net_device; struct completion; struct pt_regs; struct pid; typedef u16 __ticket_t; typedef u32 __ticketpair_t; struct __raw_tickets { __ticket_t head ; __ticket_t tail ; }; union __anonunion_ldv_2024_8 { __ticketpair_t head_tail ; struct __raw_tickets tickets ; }; struct arch_spinlock { union __anonunion_ldv_2024_8 ldv_2024 ; }; typedef struct arch_spinlock arch_spinlock_t; struct __anonstruct_ldv_2031_10 { u32 read ; s32 write ; }; union __anonunion_arch_rwlock_t_9 { s64 lock ; struct __anonstruct_ldv_2031_10 ldv_2031 ; }; typedef union __anonunion_arch_rwlock_t_9 arch_rwlock_t; struct task_struct; struct lockdep_map; struct mm_struct; 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 ; }; struct __anonstruct_ldv_2096_12 { unsigned int a ; unsigned int b ; }; struct __anonstruct_ldv_2111_13 { u16 limit0 ; u16 base0 ; unsigned char base1 ; unsigned char type : 4 ; unsigned char s : 1 ; unsigned char dpl : 2 ; unsigned char p : 1 ; unsigned char limit : 4 ; unsigned char avl : 1 ; unsigned char l : 1 ; unsigned char d : 1 ; unsigned char g : 1 ; unsigned char base2 ; }; union __anonunion_ldv_2112_11 { struct __anonstruct_ldv_2096_12 ldv_2096 ; struct __anonstruct_ldv_2111_13 ldv_2111 ; }; struct desc_struct { union __anonunion_ldv_2112_11 ldv_2112 ; }; typedef unsigned long pgdval_t; typedef unsigned long pgprotval_t; struct pgprot { pgprotval_t pgprot ; }; typedef struct pgprot pgprot_t; struct __anonstruct_pgd_t_15 { pgdval_t pgd ; }; typedef struct __anonstruct_pgd_t_15 pgd_t; struct page; typedef struct page *pgtable_t; struct file; struct seq_file; struct thread_struct; struct cpumask; struct paravirt_callee_save { void *func ; }; 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) ; void (*halt)(void) ; void (*adjust_exception_frame)(void) ; }; 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 ; }; union __anonunion_ldv_2767_18 { struct pt_regs *regs ; struct kernel_vm86_regs *vm86 ; }; struct math_emu_info { long ___orig_eip ; union __anonunion_ldv_2767_18 ldv_2767 ; }; struct bug_entry { int bug_addr_disp ; int file_disp ; unsigned short line ; unsigned short flags ; }; struct cpumask { unsigned long bits[64U] ; }; typedef struct cpumask cpumask_t; typedef struct cpumask *cpumask_var_t; struct static_key; struct seq_operations; struct i387_fsave_struct { u32 cwd ; u32 swd ; u32 twd ; u32 fip ; u32 fcs ; u32 foo ; u32 fos ; u32 st_space[20U] ; u32 status ; }; struct __anonstruct_ldv_5125_23 { u64 rip ; u64 rdp ; }; struct __anonstruct_ldv_5131_24 { u32 fip ; u32 fcs ; u32 foo ; u32 fos ; }; union __anonunion_ldv_5132_22 { struct __anonstruct_ldv_5125_23 ldv_5125 ; struct __anonstruct_ldv_5131_24 ldv_5131 ; }; union __anonunion_ldv_5141_25 { u32 padding1[12U] ; u32 sw_reserved[12U] ; }; struct i387_fxsave_struct { u16 cwd ; u16 swd ; u16 twd ; u16 fop ; union __anonunion_ldv_5132_22 ldv_5132 ; u32 mxcsr ; u32 mxcsr_mask ; u32 st_space[32U] ; u32 xmm_space[64U] ; u32 padding[12U] ; union __anonunion_ldv_5141_25 ldv_5141 ; }; 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 ; }; struct ymmh_struct { u32 ymmh_space[64U] ; }; struct xsave_hdr_struct { u64 xstate_bv ; u64 reserved1[2U] ; u64 reserved2[5U] ; }; struct xsave_struct { struct i387_fxsave_struct i387 ; struct xsave_hdr_struct xsave_hdr ; struct ymmh_struct ymmh ; }; union thread_xstate { struct i387_fsave_struct fsave ; struct i387_fxsave_struct fxsave ; struct i387_soft_struct soft ; struct xsave_struct xsave ; }; struct fpu { unsigned int last_cpu ; unsigned int has_fpu ; union thread_xstate *state ; }; struct kmem_cache; struct perf_event; 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 ; }; typedef atomic64_t atomic_long_t; struct stack_trace { unsigned int nr_entries ; unsigned int max_entries ; unsigned long *entries ; int skip ; }; struct lockdep_subclass_key { char __one_byte ; } __attribute__((__packed__)) ; struct lock_class_key { struct lockdep_subclass_key subkeys[8U] ; }; 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 ; char const *name ; int name_version ; unsigned long contention_point[4U] ; unsigned long contending_point[4U] ; }; struct lockdep_map { struct lock_class_key *key ; struct lock_class *class_cache[2U] ; char const *name ; int cpu ; unsigned long ip ; }; 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 : 13 ; unsigned char irq_context : 2 ; unsigned char trylock : 1 ; unsigned char read : 2 ; unsigned char check : 2 ; unsigned char hardirqs_off : 1 ; unsigned short references : 11 ; }; struct raw_spinlock { arch_spinlock_t raw_lock ; unsigned int magic ; unsigned int owner_cpu ; void *owner ; struct lockdep_map dep_map ; }; typedef struct raw_spinlock raw_spinlock_t; struct __anonstruct_ldv_5960_29 { u8 __padding[24U] ; struct lockdep_map dep_map ; }; union __anonunion_ldv_5961_28 { struct raw_spinlock rlock ; struct __anonstruct_ldv_5960_29 ldv_5960 ; }; struct spinlock { union __anonunion_ldv_5961_28 ldv_5961 ; }; typedef struct spinlock spinlock_t; struct __anonstruct_rwlock_t_30 { arch_rwlock_t raw_lock ; unsigned int magic ; unsigned int owner_cpu ; void *owner ; struct lockdep_map dep_map ; }; typedef struct __anonstruct_rwlock_t_30 rwlock_t; struct mutex { atomic_t count ; spinlock_t wait_lock ; struct list_head wait_list ; struct task_struct *owner ; char const *name ; void *magic ; struct lockdep_map dep_map ; }; struct mutex_waiter { struct list_head list ; struct task_struct *task ; void *magic ; }; struct timespec; struct __anonstruct_seqlock_t_35 { unsigned int sequence ; spinlock_t lock ; }; typedef struct __anonstruct_seqlock_t_35 seqlock_t; struct seqcount { unsigned int sequence ; }; typedef struct seqcount seqcount_t; struct timespec { __kernel_time_t tv_sec ; long tv_nsec ; }; struct user_namespace; typedef uid_t kuid_t; typedef gid_t kgid_t; 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 ; }; struct __wait_queue_head { spinlock_t lock ; struct list_head task_list ; }; typedef struct __wait_queue_head wait_queue_head_t; struct __anonstruct_nodemask_t_36 { unsigned long bits[16U] ; }; typedef struct __anonstruct_nodemask_t_36 nodemask_t; struct rw_semaphore; struct rw_semaphore { long count ; raw_spinlock_t wait_lock ; struct list_head wait_list ; struct lockdep_map dep_map ; }; struct completion { unsigned int done ; wait_queue_head_t wait ; }; struct notifier_block; union ktime { s64 tv64 ; }; typedef union ktime ktime_t; struct tvec_base; 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 ; }; struct hrtimer; enum hrtimer_restart; struct workqueue_struct; struct work_struct; struct work_struct { atomic_long_t data ; struct list_head entry ; void (*func)(struct work_struct * ) ; struct lockdep_map lockdep_map ; }; struct delayed_work { struct work_struct work ; struct timer_list timer ; int cpu ; }; struct notifier_block { int (*notifier_call)(struct notifier_block * , unsigned long , void * ) ; struct notifier_block *next ; int priority ; }; struct blocking_notifier_head { struct rw_semaphore rwsem ; struct notifier_block *head ; }; struct ctl_table; struct resource { resource_size_t start ; resource_size_t end ; char const *name ; unsigned long flags ; struct resource *parent ; struct resource *sibling ; struct resource *child ; }; struct pci_dev; struct pm_message { int event ; }; typedef struct pm_message pm_message_t; 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 * ) ; }; enum rpm_status { RPM_ACTIVE = 0, RPM_RESUMING = 1, RPM_SUSPENDED = 2, RPM_SUSPENDING = 3 } ; enum rpm_request { RPM_REQ_NONE = 0, RPM_REQ_IDLE = 1, RPM_REQ_SUSPEND = 2, RPM_REQ_AUTOSUSPEND = 3, RPM_REQ_RESUME = 4 } ; struct wakeup_source; struct pm_subsys_data { spinlock_t lock ; unsigned int refcount ; }; struct dev_pm_qos; struct dev_pm_info { pm_message_t power_state ; unsigned char can_wakeup : 1 ; unsigned char async_suspend : 1 ; 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 : 3 ; unsigned char idle_notification : 1 ; unsigned char request_pending : 1 ; unsigned char deferred_resume : 1 ; unsigned char run_wake : 1 ; unsigned char runtime_auto : 1 ; unsigned char no_callbacks : 1 ; unsigned char irq_safe : 1 ; unsigned char use_autosuspend : 1 ; unsigned char timer_autosuspends : 1 ; 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 ; }; struct dev_pm_domain { struct dev_pm_ops ops ; }; struct pci_bus; struct __anonstruct_mm_context_t_101 { void *ldt ; int size ; unsigned short ia32_compat ; struct mutex lock ; void *vdso ; }; typedef struct __anonstruct_mm_context_t_101 mm_context_t; struct vm_area_struct; struct rb_node { unsigned long __rb_parent_color ; struct rb_node *rb_right ; struct rb_node *rb_left ; }; struct rb_root { struct rb_node *rb_node ; }; struct nsproxy; struct ctl_table_root; struct ctl_table_header; struct ctl_dir; typedef int proc_handler(struct ctl_table * , int , void * , size_t * , loff_t * ); struct ctl_table_poll { atomic_t event ; wait_queue_head_t wait ; }; struct ctl_table { char const *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 ; }; struct ctl_node { struct rb_node node ; struct ctl_table_header *header ; }; struct __anonstruct_ldv_13049_129 { struct ctl_table *ctl_table ; int used ; int count ; int nreg ; }; union __anonunion_ldv_13051_128 { struct __anonstruct_ldv_13049_129 ldv_13049 ; struct callback_head rcu ; }; struct ctl_table_set; struct ctl_table_header { union __anonunion_ldv_13051_128 ldv_13051 ; 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 ; }; struct ctl_dir { struct ctl_table_header header ; struct rb_root root ; }; struct ctl_table_set { int (*is_seen)(struct ctl_table_set * ) ; struct ctl_dir dir ; }; 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 * ) ; }; struct cred; typedef __u64 Elf64_Addr; typedef __u16 Elf64_Half; typedef __u32 Elf64_Word; typedef __u64 Elf64_Xword; 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 ; }; typedef struct elf64_sym Elf64_Sym; struct sock; struct kobject; enum kobj_ns_type { KOBJ_NS_TYPE_NONE = 0, KOBJ_NS_TYPE_NET = 1, KOBJ_NS_TYPES = 2 } ; struct kobj_ns_type_operations { enum kobj_ns_type type ; void *(*grab_current_ns)(void) ; void const *(*netlink_ns)(struct sock * ) ; void const *(*initial_ns)(void) ; void (*drop_ns)(void * ) ; }; struct attribute { char const *name ; umode_t mode ; bool ignore_lockdep ; struct lock_class_key *key ; struct lock_class_key skey ; }; struct attribute_group { char const *name ; umode_t (*is_visible)(struct kobject * , struct attribute * , int ) ; struct attribute **attrs ; }; 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 * ) ; }; struct sysfs_ops { ssize_t (*show)(struct kobject * , struct attribute * , char * ) ; ssize_t (*store)(struct kobject * , struct attribute * , char const * , size_t ) ; void const *(*namespace)(struct kobject * , struct attribute const * ) ; }; struct sysfs_dirent; struct kref { atomic_t refcount ; }; struct kset; struct kobj_type; struct kobject { char const *name ; struct list_head entry ; struct kobject *parent ; struct kset *kset ; struct kobj_type *ktype ; struct sysfs_dirent *sd ; struct kref kref ; unsigned char state_initialized : 1 ; unsigned char state_in_sysfs : 1 ; unsigned char state_add_uevent_sent : 1 ; unsigned char state_remove_uevent_sent : 1 ; unsigned char uevent_suppress : 1 ; }; struct kobj_type { void (*release)(struct kobject * ) ; struct sysfs_ops const *sysfs_ops ; struct attribute **default_attrs ; struct kobj_ns_type_operations const *(*child_ns_type)(struct kobject * ) ; void const *(*namespace)(struct kobject * ) ; }; struct kobj_uevent_env { char *envp[32U] ; int envp_idx ; char buf[2048U] ; int buflen ; }; struct kset_uevent_ops { int (* const filter)(struct kset * , struct kobject * ) ; char const *(* const name)(struct kset * , struct kobject * ) ; int (* const uevent)(struct kset * , struct kobject * , struct kobj_uevent_env * ) ; }; struct kset { struct list_head list ; spinlock_t list_lock ; struct kobject kobj ; struct kset_uevent_ops const *uevent_ops ; }; struct kernel_param; struct kernel_param_ops { int (*set)(char const * , struct kernel_param const * ) ; int (*get)(char * , struct kernel_param const * ) ; void (*free)(void * ) ; }; struct kparam_string; struct kparam_array; union __anonunion_ldv_13829_134 { void *arg ; struct kparam_string const *str ; struct kparam_array const *arr ; }; struct kernel_param { char const *name ; struct kernel_param_ops const *ops ; u16 perm ; s16 level ; union __anonunion_ldv_13829_134 ldv_13829 ; }; struct kparam_string { unsigned int maxlen ; char *string ; }; struct kparam_array { unsigned int max ; unsigned int elemsize ; unsigned int *num ; struct kernel_param_ops const *ops ; void *elem ; }; struct static_key { atomic_t enabled ; }; struct tracepoint; struct tracepoint_func { void *func ; void *data ; }; struct tracepoint { char const *name ; struct static_key key ; void (*regfunc)(void) ; void (*unregfunc)(void) ; struct tracepoint_func *funcs ; }; struct kernel_symbol { unsigned long value ; char const *name ; }; struct mod_arch_specific { }; struct module_param_attrs; struct module_kobject { struct kobject kobj ; struct module *mod ; struct kobject *drivers_dir ; struct module_param_attrs *mp ; }; 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 * , char const * , size_t ) ; void (*setup)(struct module * , char const * ) ; int (*test)(struct module * ) ; void (*free)(struct module * ) ; }; struct exception_table_entry; enum module_state { MODULE_STATE_LIVE = 0, MODULE_STATE_COMING = 1, MODULE_STATE_GOING = 2 } ; struct module_ref { unsigned long incs ; unsigned long decs ; }; struct module_sect_attrs; struct module_notes_attrs; struct ftrace_event_call; struct module { enum module_state state ; struct list_head list ; char name[56U] ; struct module_kobject mkobj ; struct module_attribute *modinfo_attrs ; char const *version ; char const *srcversion ; struct kobject *holders_dir ; struct kernel_symbol const *syms ; unsigned long const *crcs ; unsigned int num_syms ; struct kernel_param *kp ; unsigned int num_kp ; unsigned int num_gpl_syms ; struct kernel_symbol const *gpl_syms ; unsigned long const *gpl_crcs ; struct kernel_symbol const *unused_syms ; unsigned long const *unused_crcs ; unsigned int num_unused_syms ; unsigned int num_unused_gpl_syms ; struct kernel_symbol const *unused_gpl_syms ; unsigned long const *unused_gpl_crcs ; bool sig_ok ; struct kernel_symbol const *gpl_future_syms ; unsigned long const *gpl_future_crcs ; unsigned int num_gpl_future_syms ; unsigned int num_exentries ; struct exception_table_entry *extable ; int (*init)(void) ; 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 ; struct tracepoint * const *tracepoints_ptrs ; unsigned int num_trace_bprintk_fmt ; char const **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 ; struct task_struct *waiter ; void (*exit)(void) ; struct module_ref *refptr ; ctor_fn_t (**ctors)(void) ; unsigned int num_ctors ; }; struct plist_head { struct list_head node_list ; }; struct plist_node { int prio ; struct list_head prio_list ; struct list_head node_list ; }; struct klist_node; struct klist_node { void *n_klist ; struct list_head n_node ; struct kref n_ref ; }; struct dma_map_ops; struct dev_archdata { struct dma_map_ops *dma_ops ; void *iommu ; }; struct device_private; struct device_driver; struct driver_private; struct class; struct subsys_private; struct bus_type; struct device_node; struct iommu_ops; struct iommu_group; struct bus_attribute { struct attribute attr ; ssize_t (*show)(struct bus_type * , char * ) ; ssize_t (*store)(struct bus_type * , char const * , size_t ) ; }; struct device_attribute; struct driver_attribute; struct bus_type { char const *name ; char const *dev_name ; struct device *dev_root ; struct bus_attribute *bus_attrs ; struct device_attribute *dev_attrs ; struct driver_attribute *drv_attrs ; 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 (*suspend)(struct device * , pm_message_t ) ; int (*resume)(struct device * ) ; struct dev_pm_ops const *pm ; struct iommu_ops *iommu_ops ; struct subsys_private *p ; }; struct device_type; struct of_device_id; struct acpi_device_id; struct device_driver { char const *name ; struct bus_type *bus ; struct module *owner ; char const *mod_name ; bool suppress_bind_attrs ; struct of_device_id const *of_match_table ; struct acpi_device_id const *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 * ) ; struct attribute_group const **groups ; struct dev_pm_ops const *pm ; struct driver_private *p ; }; struct driver_attribute { struct attribute attr ; ssize_t (*show)(struct device_driver * , char * ) ; ssize_t (*store)(struct device_driver * , char const * , size_t ) ; }; struct class_attribute; struct class { char const *name ; struct module *owner ; struct class_attribute *class_attrs ; struct device_attribute *dev_attrs ; struct bin_attribute *dev_bin_attrs ; 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 * ) ; struct kobj_ns_type_operations const *ns_type ; void const *(*namespace)(struct device * ) ; struct dev_pm_ops const *pm ; struct subsys_private *p ; }; struct class_attribute { struct attribute attr ; ssize_t (*show)(struct class * , struct class_attribute * , char * ) ; ssize_t (*store)(struct class * , struct class_attribute * , char const * , size_t ) ; void const *(*namespace)(struct class * , struct class_attribute const * ) ; }; struct device_type { char const *name ; struct attribute_group const **groups ; int (*uevent)(struct device * , struct kobj_uevent_env * ) ; char *(*devnode)(struct device * , umode_t * ) ; void (*release)(struct device * ) ; struct dev_pm_ops const *pm ; }; struct device_attribute { struct attribute attr ; ssize_t (*show)(struct device * , struct device_attribute * , char * ) ; ssize_t (*store)(struct device * , struct device_attribute * , char const * , size_t ) ; }; struct device_dma_parameters { unsigned int max_segment_size ; unsigned long segment_boundary_mask ; }; struct acpi_dev_node { void *handle ; }; struct dma_coherent_mem; struct device { struct device *parent ; struct device_private *p ; struct kobject kobj ; char const *init_name ; struct device_type const *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 ; 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 ; struct attribute_group const **groups ; void (*release)(struct device * ) ; struct iommu_group *iommu_group ; }; struct wakeup_source { char const *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 ; }; struct pm_qos_request { struct plist_node node ; int pm_qos_class ; struct delayed_work work ; }; struct pm_qos_flags_request { struct list_head node ; s32 flags ; }; enum dev_pm_qos_req_type { DEV_PM_QOS_LATENCY = 1, DEV_PM_QOS_FLAGS = 2 } ; union __anonunion_data_135 { struct plist_node pnode ; struct pm_qos_flags_request flr ; }; struct dev_pm_qos_request { enum dev_pm_qos_req_type type ; union __anonunion_data_135 data ; struct device *dev ; }; enum pm_qos_type { PM_QOS_UNITIALIZED = 0, PM_QOS_MAX = 1, PM_QOS_MIN = 2 } ; struct pm_qos_constraints { struct plist_head list ; s32 target_value ; s32 default_value ; enum pm_qos_type type ; struct blocking_notifier_head *notifiers ; }; struct pm_qos_flags { struct list_head list ; s32 effective_flags ; }; 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 ; }; struct iovec { void *iov_base ; __kernel_size_t iov_len ; }; struct inode; struct arch_uprobe_task { unsigned long saved_scratch_register ; unsigned int saved_trap_nr ; unsigned int saved_tf ; }; enum uprobe_task_state { UTASK_RUNNING = 0, UTASK_SSTEP = 1, UTASK_SSTEP_ACK = 2, UTASK_SSTEP_TRAPPED = 3 } ; struct uprobe; struct uprobe_task { enum uprobe_task_state state ; struct arch_uprobe_task autask ; struct uprobe *active_uprobe ; unsigned long xol_vaddr ; unsigned long vaddr ; }; struct xol_area { wait_queue_head_t wq ; atomic_t slot_count ; unsigned long *bitmap ; struct page *page ; unsigned long vaddr ; }; struct uprobes_state { struct xol_area *xol_area ; }; struct address_space; union __anonunion_ldv_15540_137 { unsigned long index ; void *freelist ; bool pfmemalloc ; }; struct __anonstruct_ldv_15550_141 { unsigned short inuse ; unsigned short objects : 15 ; unsigned char frozen : 1 ; }; union __anonunion_ldv_15552_140 { atomic_t _mapcount ; struct __anonstruct_ldv_15550_141 ldv_15550 ; int units ; }; struct __anonstruct_ldv_15554_139 { union __anonunion_ldv_15552_140 ldv_15552 ; atomic_t _count ; }; union __anonunion_ldv_15555_138 { unsigned long counters ; struct __anonstruct_ldv_15554_139 ldv_15554 ; }; struct __anonstruct_ldv_15556_136 { union __anonunion_ldv_15540_137 ldv_15540 ; union __anonunion_ldv_15555_138 ldv_15555 ; }; struct __anonstruct_ldv_15563_143 { struct page *next ; int pages ; int pobjects ; }; struct slab; union __anonunion_ldv_15567_142 { struct list_head lru ; struct __anonstruct_ldv_15563_143 ldv_15563 ; struct list_head list ; struct slab *slab_page ; }; union __anonunion_ldv_15572_144 { unsigned long private ; struct kmem_cache *slab_cache ; struct page *first_page ; }; struct page { unsigned long flags ; struct address_space *mapping ; struct __anonstruct_ldv_15556_136 ldv_15556 ; union __anonunion_ldv_15567_142 ldv_15567 ; union __anonunion_ldv_15572_144 ldv_15572 ; unsigned long debug_flags ; int _last_nid ; }; struct page_frag { struct page *page ; __u32 offset ; __u32 size ; }; struct __anonstruct_linear_146 { struct rb_node rb ; unsigned long rb_subtree_last ; }; union __anonunion_shared_145 { struct __anonstruct_linear_146 linear ; struct list_head nonlinear ; }; struct anon_vma; struct vm_operations_struct; struct mempolicy; 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_145 shared ; struct list_head anon_vma_chain ; struct anon_vma *anon_vma ; struct vm_operations_struct const *vm_ops ; unsigned long vm_pgoff ; struct file *vm_file ; void *vm_private_data ; struct mempolicy *vm_policy ; }; struct core_thread { struct task_struct *task ; struct core_thread *next ; }; struct core_state { atomic_t nr_threads ; struct core_thread dumper ; struct completion startup ; }; struct mm_rss_stat { atomic_long_t count[3U] ; }; struct linux_binfmt; struct mmu_notifier_mm; struct mm_struct { struct vm_area_struct *mmap ; struct rb_root mm_rb ; struct vm_area_struct *mmap_cache ; unsigned long (*get_unmapped_area)(struct file * , unsigned long , unsigned long , unsigned long , unsigned long ) ; void (*unmap_area)(struct mm_struct * , unsigned long ) ; unsigned long mmap_base ; unsigned long task_size ; unsigned long cached_hole_size ; unsigned long free_area_cache ; unsigned long highest_vm_end ; pgd_t *pgd ; atomic_t mm_users ; atomic_t mm_count ; 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 nr_ptes ; 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[44U] ; 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 hlist_head ioctx_list ; struct task_struct *owner ; struct file *exe_file ; struct mmu_notifier_mm *mmu_notifier_mm ; pgtable_t pmd_huge_pte ; struct cpumask cpumask_allocation ; unsigned long numa_next_scan ; unsigned long numa_next_reset ; unsigned long numa_scan_offset ; int numa_scan_seq ; int first_nid ; struct uprobes_state uprobes_state ; }; struct shrink_control { gfp_t gfp_mask ; unsigned long nr_to_scan ; }; struct shrinker { int (*shrink)(struct shrinker * , struct shrink_control * ) ; int seeks ; long batch ; struct list_head list ; atomic_long_t nr_in_batch ; }; struct file_ra_state; struct user_struct; struct writeback_control; struct vm_fault { unsigned int flags ; unsigned long pgoff ; void *virtual_address ; struct page *page ; }; 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 * , nodemask_t const * , nodemask_t const * , unsigned long ) ; int (*remap_pages)(struct vm_area_struct * , unsigned long , unsigned long , unsigned long ) ; }; 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 ; }; struct sg_table { struct scatterlist *sgl ; unsigned int nents ; unsigned int orig_nents ; }; typedef s32 dma_cookie_t; 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 ; }; struct sem_undo_list; struct sysv_sem { struct sem_undo_list *undo_list ; }; typedef unsigned short __kernel_sa_family_t; typedef __kernel_sa_family_t sa_family_t; struct sockaddr { sa_family_t sa_family ; char sa_data[14U] ; }; 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 ; }; struct __anonstruct_sync_serial_settings_148 { unsigned int clock_rate ; unsigned int clock_type ; unsigned short loopback ; }; typedef struct __anonstruct_sync_serial_settings_148 sync_serial_settings; struct __anonstruct_te1_settings_149 { unsigned int clock_rate ; unsigned int clock_type ; unsigned short loopback ; unsigned int slot_map ; }; typedef struct __anonstruct_te1_settings_149 te1_settings; struct __anonstruct_raw_hdlc_proto_150 { unsigned short encoding ; unsigned short parity ; }; typedef struct __anonstruct_raw_hdlc_proto_150 raw_hdlc_proto; struct __anonstruct_fr_proto_151 { unsigned int t391 ; unsigned int t392 ; unsigned int n391 ; unsigned int n392 ; unsigned int n393 ; unsigned short lmi ; unsigned short dce ; }; typedef struct __anonstruct_fr_proto_151 fr_proto; struct __anonstruct_fr_proto_pvc_152 { unsigned int dlci ; }; typedef struct __anonstruct_fr_proto_pvc_152 fr_proto_pvc; struct __anonstruct_fr_proto_pvc_info_153 { unsigned int dlci ; char master[16U] ; }; typedef struct __anonstruct_fr_proto_pvc_info_153 fr_proto_pvc_info; struct __anonstruct_cisco_proto_154 { unsigned int interval ; unsigned int timeout ; }; typedef struct __anonstruct_cisco_proto_154 cisco_proto; struct ifmap { unsigned long mem_start ; unsigned long mem_end ; unsigned short base_addr ; unsigned char irq ; unsigned char dma ; unsigned char port ; }; union __anonunion_ifs_ifsu_155 { 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 ; }; struct if_settings { unsigned int type ; unsigned int size ; union __anonunion_ifs_ifsu_155 ifs_ifsu ; }; union __anonunion_ifr_ifrn_156 { char ifrn_name[16U] ; }; union __anonunion_ifr_ifru_157 { 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 ; }; struct ifreq { union __anonunion_ifr_ifrn_156 ifr_ifrn ; union __anonunion_ifr_ifru_157 ifr_ifru ; }; struct hlist_bl_node; struct hlist_bl_head { struct hlist_bl_node *first ; }; struct hlist_bl_node { struct hlist_bl_node *next ; struct hlist_bl_node **pprev ; }; struct nameidata; struct path; struct vfsmount; struct __anonstruct_ldv_19335_160 { u32 hash ; u32 len ; }; union __anonunion_ldv_19337_159 { struct __anonstruct_ldv_19335_160 ldv_19335 ; u64 hash_len ; }; struct qstr { union __anonunion_ldv_19337_159 ldv_19337 ; unsigned char const *name ; }; struct dentry_operations; struct super_block; union __anonunion_d_u_161 { struct list_head d_child ; struct callback_head d_rcu ; }; 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] ; unsigned int d_count ; spinlock_t d_lock ; struct dentry_operations const *d_op ; struct super_block *d_sb ; unsigned long d_time ; void *d_fsdata ; struct list_head d_lru ; union __anonunion_d_u_161 d_u ; struct list_head d_subdirs ; struct hlist_node d_alias ; }; struct dentry_operations { int (*d_revalidate)(struct dentry * , unsigned int ) ; int (*d_hash)(struct dentry const * , struct inode const * , struct qstr * ) ; int (*d_compare)(struct dentry const * , struct inode const * , struct dentry const * , struct inode const * , unsigned int , char const * , struct qstr const * ) ; int (*d_delete)(struct dentry const * ) ; 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 ) ; }; struct path { struct vfsmount *mnt ; struct dentry *dentry ; }; struct radix_tree_node; struct radix_tree_root { unsigned int height ; gfp_t gfp_mask ; struct radix_tree_node *rnode ; }; enum pid_type { PIDTYPE_PID = 0, PIDTYPE_PGID = 1, PIDTYPE_SID = 2, PIDTYPE_MAX = 3 } ; struct pid_namespace; struct upid { int nr ; struct pid_namespace *ns ; struct hlist_node pid_chain ; }; struct pid { atomic_t count ; unsigned int level ; struct hlist_head tasks[3U] ; struct callback_head rcu ; struct upid numbers[1U] ; }; struct pid_link { struct hlist_node node ; struct pid *pid ; }; struct kernel_cap_struct { __u32 cap[2U] ; }; typedef struct kernel_cap_struct kernel_cap_t; struct fiemap_extent { __u64 fe_logical ; __u64 fe_physical ; __u64 fe_length ; __u64 fe_reserved64[2U] ; __u32 fe_flags ; __u32 fe_reserved[3U] ; }; enum migrate_mode { MIGRATE_ASYNC = 0, MIGRATE_SYNC_LIGHT = 1, MIGRATE_SYNC = 2 } ; struct block_device; struct io_context; struct cgroup_subsys_state; struct export_operations; struct kiocb; struct pipe_inode_info; struct poll_table_struct; struct kstatfs; struct swap_info_struct; 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 ; }; struct percpu_counter { raw_spinlock_t lock ; s64 count ; struct list_head list ; s32 *counters ; }; 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] ; }; struct fs_qfilestat { __u64 qfs_ino ; __u64 qfs_nblks ; __u32 qfs_nextents ; }; typedef struct fs_qfilestat fs_qfilestat_t; 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 ; }; struct dquot; typedef __kernel_uid32_t projid_t; typedef projid_t kprojid_t; struct if_dqinfo { __u64 dqi_bgrace ; __u64 dqi_igrace ; __u32 dqi_flags ; __u32 dqi_valid ; }; enum quota_type { USRQUOTA = 0, GRPQUOTA = 1, PRJQUOTA = 2 } ; typedef long long qsize_t; union __anonunion_ldv_20340_163 { kuid_t uid ; kgid_t gid ; kprojid_t projid ; }; struct kqid { union __anonunion_ldv_20340_163 ldv_20340 ; enum quota_type type ; }; 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 ; }; struct quota_format_type; 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 ; }; 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 ; }; 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 * ) ; }; 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 * ) ; }; 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 ) ; }; struct quota_format_type { int qf_fmt_id ; struct quota_format_ops const *qf_ops ; struct module *qf_owner ; struct quota_format_type *qf_next ; }; 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] ; struct quota_format_ops const *ops[2U] ; }; union __anonunion_arg_165 { char *buf ; void *data ; }; struct __anonstruct_read_descriptor_t_164 { size_t written ; size_t count ; union __anonunion_arg_165 arg ; int error ; }; typedef struct __anonstruct_read_descriptor_t_164 read_descriptor_t; 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 long ) ; int (*releasepage)(struct page * , gfp_t ) ; void (*freepage)(struct page * ) ; ssize_t (*direct_IO)(int , struct kiocb * , struct iovec const * , 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 ) ; 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 * ) ; }; struct backing_dev_info; 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 ; struct address_space_operations const *a_ops ; unsigned long flags ; struct backing_dev_info *backing_dev_info ; spinlock_t private_lock ; struct list_head private_list ; void *private_data ; }; struct request_queue; struct hd_struct; struct gendisk; 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 ; }; struct posix_acl; struct inode_operations; union __anonunion_ldv_20774_166 { unsigned int const i_nlink ; unsigned int __i_nlink ; }; union __anonunion_ldv_20794_167 { struct hlist_head i_dentry ; struct callback_head i_rcu ; }; struct file_lock; struct cdev; union __anonunion_ldv_20810_168 { struct pipe_inode_info *i_pipe ; struct block_device *i_bdev ; struct cdev *i_cdev ; }; 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 ; struct inode_operations const *i_op ; struct super_block *i_sb ; struct address_space *i_mapping ; void *i_security ; unsigned long i_ino ; union __anonunion_ldv_20774_166 ldv_20774 ; 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_ldv_20794_167 ldv_20794 ; u64 i_version ; atomic_t i_count ; atomic_t i_dio_count ; atomic_t i_writecount ; struct file_operations const *i_fop ; struct file_lock *i_flock ; struct address_space i_data ; struct dquot *i_dquot[2U] ; struct list_head i_devices ; union __anonunion_ldv_20810_168 ldv_20810 ; __u32 i_generation ; __u32 i_fsnotify_mask ; struct hlist_head i_fsnotify_marks ; atomic_t i_readcount ; void *i_private ; }; struct fown_struct { rwlock_t lock ; struct pid *pid ; enum pid_type pid_type ; kuid_t uid ; kuid_t euid ; int signum ; }; 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 ; }; union __anonunion_f_u_169 { struct list_head fu_list ; struct callback_head fu_rcuhead ; }; struct file { union __anonunion_f_u_169 f_u ; struct path f_path ; struct file_operations const *f_op ; spinlock_t f_lock ; int f_sb_list_cpu ; atomic_long_t f_count ; unsigned int f_flags ; fmode_t f_mode ; loff_t f_pos ; struct fown_struct f_owner ; struct cred const *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 ; }; struct files_struct; typedef struct files_struct *fl_owner_t; struct file_lock_operations { void (*fl_copy_lock)(struct file_lock * , struct file_lock * ) ; void (*fl_release_private)(struct file_lock * ) ; }; struct lock_manager_operations { int (*lm_compare_owner)(struct file_lock * , 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 ) ; }; struct net; struct nlm_lockowner; struct nfs_lock_info { u32 state ; struct nlm_lockowner *owner ; struct list_head list ; }; struct nfs4_lock_state; struct nfs4_lock_info { struct nfs4_lock_state *owner ; }; struct fasync_struct; struct __anonstruct_afs_171 { struct list_head link ; int state ; }; union __anonunion_fl_u_170 { struct nfs_lock_info nfs_fl ; struct nfs4_lock_info nfs4_fl ; struct __anonstruct_afs_171 afs ; }; struct file_lock { struct file_lock *fl_next ; struct list_head fl_link ; struct list_head fl_block ; fl_owner_t fl_owner ; unsigned int fl_flags ; unsigned char fl_type ; unsigned int fl_pid ; 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 ; struct file_lock_operations const *fl_ops ; struct lock_manager_operations const *fl_lmops ; union __anonunion_fl_u_170 fl_u ; }; 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 ; }; 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] ; }; struct file_system_type; struct super_operations; struct xattr_handler; struct mtd_info; 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 ; struct super_operations const *s_op ; struct dquot_operations const *dq_op ; struct quotactl_ops const *s_qcop ; struct export_operations const *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 ; struct xattr_handler const **s_xattr ; struct list_head s_inodes ; struct hlist_bl_head s_anon ; struct list_head *s_files ; struct list_head s_mounts ; struct list_head s_dentry_lru ; int s_nr_dentry_unused ; spinlock_t s_inode_lru_lock ; struct list_head s_inode_lru ; int s_nr_inodes_unused ; 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 ; struct dentry_operations const *s_d_op ; int cleancache_poolid ; struct shrinker s_shrink ; atomic_long_t s_remove_count ; int s_readonly_remount ; }; struct fiemap_extent_info { unsigned int fi_flags ; unsigned int fi_extents_mapped ; unsigned int fi_extents_max ; struct fiemap_extent *fi_extents_start ; }; 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 * , char const * , size_t , loff_t * ) ; ssize_t (*aio_read)(struct kiocb * , struct iovec const * , unsigned long , loff_t ) ; ssize_t (*aio_write)(struct kiocb * , struct iovec const * , unsigned long , loff_t ) ; int (*readdir)(struct file * , void * , int (*)(void * , char const * , int , loff_t , u64 , unsigned int ) ) ; unsigned int (*poll)(struct file * , struct poll_table_struct * ) ; long (*unlocked_ioctl)(struct file * , unsigned int , unsigned long ) ; long (*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 (*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 (*fallocate)(struct file * , int , loff_t , loff_t ) ; int (*show_fdinfo)(struct seq_file * , struct file * ) ; }; 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 * , char const * ) ; 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 * , char const * , void const * , size_t , int ) ; ssize_t (*getxattr)(struct dentry * , char const * , void * , size_t ) ; ssize_t (*listxattr)(struct dentry * , char * , size_t ) ; int (*removexattr)(struct dentry * , char const * ) ; 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 * ) ; }; 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 , char const * , size_t , loff_t ) ; int (*bdev_try_to_free_page)(struct super_block * , struct page * , gfp_t ) ; int (*nr_cached_objects)(struct super_block * ) ; void (*free_cached_objects)(struct super_block * , int ) ; }; struct file_system_type { char const *name ; int fs_flags ; struct dentry *(*mount)(struct file_system_type * , int , char const * , 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 ; }; struct io_event { __u64 data ; __u64 obj ; __s64 res ; __s64 res2 ; }; typedef unsigned long cputime_t; struct __anonstruct_sigset_t_172 { unsigned long sig[1U] ; }; typedef struct __anonstruct_sigset_t_172 sigset_t; struct siginfo; typedef void __signalfn_t(int ); typedef __signalfn_t *__sighandler_t; typedef void __restorefn_t(void); typedef __restorefn_t *__sigrestore_t; struct sigaction { __sighandler_t sa_handler ; unsigned long sa_flags ; __sigrestore_t sa_restorer ; sigset_t sa_mask ; }; struct k_sigaction { struct sigaction sa ; }; union sigval { int sival_int ; void *sival_ptr ; }; typedef union sigval sigval_t; struct __anonstruct__kill_174 { __kernel_pid_t _pid ; __kernel_uid32_t _uid ; }; struct __anonstruct__timer_175 { __kernel_timer_t _tid ; int _overrun ; char _pad[0U] ; sigval_t _sigval ; int _sys_private ; }; struct __anonstruct__rt_176 { __kernel_pid_t _pid ; __kernel_uid32_t _uid ; sigval_t _sigval ; }; struct __anonstruct__sigchld_177 { __kernel_pid_t _pid ; __kernel_uid32_t _uid ; int _status ; __kernel_clock_t _utime ; __kernel_clock_t _stime ; }; struct __anonstruct__sigfault_178 { void *_addr ; short _addr_lsb ; }; struct __anonstruct__sigpoll_179 { long _band ; int _fd ; }; struct __anonstruct__sigsys_180 { void *_call_addr ; int _syscall ; unsigned int _arch ; }; union __anonunion__sifields_173 { int _pad[28U] ; struct __anonstruct__kill_174 _kill ; struct __anonstruct__timer_175 _timer ; struct __anonstruct__rt_176 _rt ; struct __anonstruct__sigchld_177 _sigchld ; struct __anonstruct__sigfault_178 _sigfault ; struct __anonstruct__sigpoll_179 _sigpoll ; struct __anonstruct__sigsys_180 _sigsys ; }; struct siginfo { int si_signo ; int si_errno ; int si_code ; union __anonunion__sifields_173 _sifields ; }; typedef struct siginfo siginfo_t; struct sigpending { struct list_head list ; sigset_t signal ; }; struct seccomp_filter; struct seccomp { int mode ; struct seccomp_filter *filter ; }; struct rt_mutex_waiter; struct rlimit { unsigned long rlim_cur ; unsigned long rlim_max ; }; struct timerqueue_node { struct rb_node node ; ktime_t expires ; }; struct timerqueue_head { struct rb_root head ; struct timerqueue_node *next ; }; struct hrtimer_clock_base; struct hrtimer_cpu_base; enum hrtimer_restart { HRTIMER_NORESTART = 0, HRTIMER_RESTART = 1 } ; 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] ; }; 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)(void) ; ktime_t softirq_time ; ktime_t offset ; }; 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[3U] ; }; struct task_io_accounting { u64 rchar ; u64 wchar ; u64 syscr ; u64 syscw ; u64 read_bytes ; u64 write_bytes ; u64 cancelled_write_bytes ; }; struct latency_record { unsigned long backtrace[12U] ; unsigned int count ; unsigned long time ; unsigned long max ; }; typedef int32_t key_serial_t; typedef uint32_t key_perm_t; struct key; struct signal_struct; struct key_type; struct keyring_list; union __anonunion_ldv_23624_183 { struct list_head graveyard_link ; struct rb_node serial_node ; }; struct key_user; union __anonunion_ldv_23633_184 { time_t expiry ; time_t revoked_at ; }; union __anonunion_type_data_185 { struct list_head link ; unsigned long x[2U] ; void *p[2U] ; int reject_error ; }; union __anonunion_payload_186 { unsigned long value ; void *rcudata ; void *data ; struct keyring_list *subscriptions ; }; struct key { atomic_t usage ; key_serial_t serial ; union __anonunion_ldv_23624_183 ldv_23624 ; struct key_type *type ; struct rw_semaphore sem ; struct key_user *user ; void *security ; union __anonunion_ldv_23633_184 ldv_23633 ; time_t last_used_at ; kuid_t uid ; kgid_t gid ; key_perm_t perm ; unsigned short quotalen ; unsigned short datalen ; unsigned long flags ; char *description ; union __anonunion_type_data_185 type_data ; union __anonunion_payload_186 payload ; }; struct audit_context; struct group_info { atomic_t usage ; int ngroups ; int nblocks ; kgid_t small_block[32U] ; kgid_t *blocks[0U] ; }; struct thread_group_cred; 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 ; struct thread_group_cred *tgcred ; void *security ; struct user_struct *user ; struct user_namespace *user_ns ; struct group_info *group_info ; struct callback_head rcu ; }; struct llist_node; struct llist_node { struct llist_node *next ; }; struct futex_pi_state; struct robust_list_head; struct bio_list; struct fs_struct; struct perf_event_context; struct blk_plug; struct cfs_rq; struct task_group; struct kioctx; union __anonunion_ki_obj_187 { void *user ; struct task_struct *tsk ; }; struct eventfd_ctx; struct kiocb { struct list_head ki_run_list ; unsigned long ki_flags ; int ki_users ; unsigned int ki_key ; struct file *ki_filp ; struct kioctx *ki_ctx ; int (*ki_cancel)(struct kiocb * , struct io_event * ) ; ssize_t (*ki_retry)(struct kiocb * ) ; void (*ki_dtor)(struct kiocb * ) ; union __anonunion_ki_obj_187 ki_obj ; __u64 ki_user_data ; loff_t ki_pos ; void *private ; unsigned short ki_opcode ; size_t ki_nbytes ; char *ki_buf ; size_t ki_left ; struct iovec ki_inline_vec ; struct iovec *ki_iovec ; unsigned long ki_nr_segs ; unsigned long ki_cur_seg ; struct list_head ki_list ; struct list_head ki_batch ; struct eventfd_ctx *ki_eventfd ; }; struct aio_ring_info { unsigned long mmap_base ; unsigned long mmap_size ; struct page **ring_pages ; spinlock_t ring_lock ; long nr_pages ; unsigned int nr ; unsigned int tail ; struct page *internal_pages[8U] ; }; struct kioctx { atomic_t users ; int dead ; struct mm_struct *mm ; unsigned long user_id ; struct hlist_node list ; wait_queue_head_t wait ; spinlock_t ctx_lock ; int reqs_active ; struct list_head active_reqs ; struct list_head run_list ; unsigned int max_reqs ; struct aio_ring_info ring_info ; struct delayed_work wq ; struct callback_head callback_head ; }; struct sighand_struct { atomic_t count ; struct k_sigaction action[64U] ; spinlock_t siglock ; wait_queue_head_t signalfd_wqh ; }; 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 ; }; struct cpu_itimer { cputime_t expires ; cputime_t incr ; u32 error ; u32 incr_error ; }; struct cputime { cputime_t utime ; cputime_t stime ; }; struct task_cputime { cputime_t utime ; cputime_t stime ; unsigned long long sum_exec_runtime ; }; struct thread_group_cputimer { struct task_cputime cputime ; int running ; raw_spinlock_t lock ; }; struct autogroup; struct tty_struct; struct taskstats; struct tty_audit_buf; struct signal_struct { atomic_t sigcnt ; atomic_t live ; int nr_threads ; 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 : 1 ; unsigned char has_child_subreaper : 1 ; 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 ; 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 ; }; 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 ; }; struct reclaim_state; struct sched_info { unsigned long pcount ; unsigned long long run_delay ; unsigned long long last_arrival ; unsigned long long last_queued ; }; 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 ; }; struct uts_namespace; struct rq; struct sched_class { struct sched_class const *next ; void (*enqueue_task)(struct rq * , struct task_struct * , int ) ; void (*dequeue_task)(struct rq * , struct task_struct * , int ) ; void (*yield_task)(struct rq * ) ; bool (*yield_to_task)(struct rq * , struct task_struct * , bool ) ; void (*check_preempt_curr)(struct rq * , struct task_struct * , int ) ; struct task_struct *(*pick_next_task)(struct rq * ) ; void (*put_prev_task)(struct rq * , struct task_struct * ) ; int (*select_task_rq)(struct task_struct * , int , int ) ; void (*migrate_task_rq)(struct task_struct * , int ) ; void (*pre_schedule)(struct rq * , struct task_struct * ) ; void (*post_schedule)(struct rq * ) ; void (*task_waking)(struct task_struct * ) ; void (*task_woken)(struct rq * , struct task_struct * ) ; void (*set_cpus_allowed)(struct task_struct * , struct cpumask const * ) ; void (*rq_online)(struct rq * ) ; void (*rq_offline)(struct rq * ) ; void (*set_curr_task)(struct rq * ) ; void (*task_tick)(struct rq * , struct task_struct * , int ) ; void (*task_fork)(struct task_struct * ) ; void (*switched_from)(struct rq * , struct task_struct * ) ; void (*switched_to)(struct rq * , struct task_struct * ) ; void (*prio_changed)(struct rq * , struct task_struct * , int ) ; unsigned int (*get_rr_interval)(struct rq * , struct task_struct * ) ; void (*task_move_group)(struct task_struct * , int ) ; }; struct load_weight { unsigned long weight ; unsigned long inv_weight ; }; struct sched_avg { u32 runnable_avg_sum ; u32 runnable_avg_period ; u64 last_runnable_update ; s64 decay_count ; unsigned long load_avg_contrib ; }; 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 ; }; 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 ; }; struct rt_rq; struct sched_rt_entity { struct list_head run_list ; unsigned long timeout ; unsigned int time_slice ; struct sched_rt_entity *back ; struct sched_rt_entity *parent ; struct rt_rq *rt_rq ; struct rt_rq *my_q ; }; struct mem_cgroup; struct memcg_batch_info { int do_batch ; struct mem_cgroup *memcg ; unsigned long nr_pages ; unsigned long memsw_nr_pages ; }; struct css_set; struct compat_robust_list_head; struct task_struct { long volatile state ; void *stack ; atomic_t usage ; unsigned int flags ; unsigned int ptrace ; struct llist_node wake_entry ; int on_cpu ; int on_rq ; int prio ; int static_prio ; int normal_prio ; unsigned int rt_priority ; struct sched_class const *sched_class ; struct sched_entity se ; struct sched_rt_entity rt ; struct task_group *sched_task_group ; struct hlist_head preempt_notifiers ; unsigned char fpu_counter ; 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 mm_struct *mm ; struct mm_struct *active_mm ; unsigned char brk_randomized : 1 ; int exit_state ; int exit_code ; int exit_signal ; int pdeath_signal ; unsigned int jobctl ; unsigned int personality ; unsigned char did_exec : 1 ; unsigned char in_execve : 1 ; unsigned char in_iowait : 1 ; unsigned char no_new_privs : 1 ; unsigned char sched_reset_on_fork : 1 ; unsigned char sched_contributes_to_load : 1 ; pid_t pid ; pid_t tgid ; unsigned long stack_canary ; 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 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] ; struct cred const *real_cred ; struct cred const *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 plist_head pi_waiters ; struct rt_mutex_waiter *pi_blocked_on ; 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 ; int numa_migrate_seq ; unsigned int numa_scan_period ; u64 node_stamp ; struct callback_head numa_work ; 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 ; atomic_t ptrace_bp_refcnt ; struct uprobe_task *utask ; }; typedef s32 compat_long_t; typedef u32 compat_uptr_t; struct compat_robust_list { compat_uptr_t next ; }; struct compat_robust_list_head { struct compat_robust_list list ; compat_long_t futex_offset ; compat_uptr_t list_op_pending ; }; enum ldv_20879 { SS_FREE = 0, SS_UNCONNECTED = 1, SS_CONNECTING = 2, SS_CONNECTED = 3, SS_DISCONNECTING = 4 } ; typedef enum ldv_20879 socket_state; struct socket_wq { wait_queue_head_t wait ; struct fasync_struct *fasync_list ; struct callback_head rcu ; }; struct proto_ops; struct socket { socket_state state ; short type ; unsigned long flags ; struct socket_wq *wq ; struct file *file ; struct sock *sk ; struct proto_ops const *ops ; }; 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 ) ; void (*set_peek_off)(struct sock * , int ) ; }; struct __anonstruct_ldv_26914_204 { struct mem_cgroup *memcg ; struct list_head list ; struct kmem_cache *root_cache ; bool dead ; atomic_t nr_pages ; struct work_struct destroy ; }; union __anonunion_ldv_26915_203 { struct kmem_cache *memcg_caches[0U] ; struct __anonstruct_ldv_26914_204 ldv_26914 ; }; struct memcg_cache_params { bool is_root_cache ; union __anonunion_ldv_26915_203 ldv_26915 ; }; struct kmem_cache_cpu { void **freelist ; unsigned long tid ; struct page *page ; struct page *partial ; unsigned int stat[26U] ; }; struct kmem_cache_node { spinlock_t list_lock ; unsigned long nr_partial ; struct list_head partial ; atomic_long_t nr_slabs ; atomic_long_t total_objects ; struct list_head full ; }; struct kmem_cache_order_objects { unsigned long x ; }; 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 ; char const *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] ; }; struct exception_table_entry { int insn ; int fixup ; }; struct in6_addr; struct sk_buff; struct dma_attrs { unsigned long flags[1U] ; }; enum dma_data_direction { DMA_BIDIRECTIONAL = 0, DMA_TO_DEVICE = 1, DMA_FROM_DEVICE = 2, DMA_NONE = 3 } ; 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 ; }; typedef u64 netdev_features_t; struct nf_conntrack { atomic_t use ; }; struct nf_bridge_info { atomic_t use ; unsigned int mask ; struct net_device *physindev ; struct net_device *physoutdev ; unsigned long data[4U] ; }; struct sk_buff_head { struct sk_buff *next ; struct sk_buff *prev ; __u32 qlen ; spinlock_t lock ; }; struct skb_frag_struct; struct __anonstruct_page_205 { struct page *p ; }; struct skb_frag_struct { struct __anonstruct_page_205 page ; __u32 page_offset ; __u32 size ; }; typedef unsigned int sk_buff_data_t; struct sec_path; struct __anonstruct_ldv_28285_207 { __u16 csum_start ; __u16 csum_offset ; }; union __anonunion_ldv_28286_206 { __wsum csum ; struct __anonstruct_ldv_28285_207 ldv_28285 ; }; union __anonunion_ldv_28325_208 { __u32 mark ; __u32 dropcount ; __u32 avail_size ; }; 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_ldv_28286_206 ldv_28286 ; __u32 priority ; unsigned char local_df : 1 ; unsigned char cloned : 1 ; unsigned char ip_summed : 2 ; unsigned char nohdr : 1 ; unsigned char nfctinfo : 3 ; unsigned char pkt_type : 3 ; unsigned char fclone : 2 ; unsigned char ipvs_property : 1 ; unsigned char peeked : 1 ; unsigned char nf_trace : 1 ; __be16 protocol ; void (*destructor)(struct sk_buff * ) ; struct nf_conntrack *nfct ; struct sk_buff *nfct_reasm ; struct nf_bridge_info *nf_bridge ; int skb_iif ; __u32 rxhash ; __u16 vlan_tci ; __u16 tc_index ; __u16 tc_verd ; __u16 queue_mapping ; unsigned char ndisc_nodetype : 2 ; unsigned char pfmemalloc : 1 ; unsigned char ooo_okay : 1 ; unsigned char l4_rxhash : 1 ; unsigned char wifi_acked_valid : 1 ; unsigned char wifi_acked : 1 ; unsigned char no_fcs : 1 ; unsigned char head_frag : 1 ; unsigned char encapsulation : 1 ; dma_cookie_t dma_cookie ; __u32 secmark ; union __anonunion_ldv_28325_208 ldv_28325 ; sk_buff_data_t inner_transport_header ; sk_buff_data_t inner_network_header ; sk_buff_data_t transport_header ; sk_buff_data_t network_header ; sk_buff_data_t mac_header ; sk_buff_data_t tail ; sk_buff_data_t end ; unsigned char *head ; unsigned char *data ; unsigned int truesize ; atomic_t users ; }; struct dst_entry; struct rtable; struct ethhdr { unsigned char h_dest[6U] ; unsigned char h_source[6U] ; __be16 h_proto ; }; 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] ; }; 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 ; }; struct ethtool_wolinfo { __u32 cmd ; __u32 supported ; __u32 wolopts ; __u8 sopass[6U] ; }; struct ethtool_regs { __u32 cmd ; __u32 version ; __u32 len ; __u8 data[0U] ; }; struct ethtool_eeprom { __u32 cmd ; __u32 magic ; __u32 offset ; __u32 len ; __u8 data[0U] ; }; 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] ; }; struct ethtool_modinfo { __u32 cmd ; __u32 type ; __u32 eeprom_len ; __u32 reserved[8U] ; }; 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 ; }; 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 ; }; 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 ; }; struct ethtool_pauseparam { __u32 cmd ; __u32 autoneg ; __u32 rx_pause ; __u32 tx_pause ; }; struct ethtool_test { __u32 cmd ; __u32 flags ; __u32 reserved ; __u32 len ; __u64 data[0U] ; }; struct ethtool_stats { __u32 cmd ; __u32 n_stats ; __u64 data[0U] ; }; struct ethtool_tcpip4_spec { __be32 ip4src ; __be32 ip4dst ; __be16 psrc ; __be16 pdst ; __u8 tos ; }; struct ethtool_ah_espip4_spec { __be32 ip4src ; __be32 ip4dst ; __be32 spi ; __u8 tos ; }; struct ethtool_usrip4_spec { __be32 ip4src ; __be32 ip4dst ; __be32 l4_4_bytes ; __u8 tos ; __u8 ip_ver ; __u8 proto ; }; 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] ; }; struct ethtool_flow_ext { __u8 padding[2U] ; unsigned char h_dest[6U] ; __be16 vlan_etype ; __be16 vlan_tci ; __be32 data[2U] ; }; 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 ; }; struct ethtool_rxnfc { __u32 cmd ; __u32 flow_type ; __u64 data ; struct ethtool_rx_flow_spec fs ; __u32 rule_cnt ; __u32 rule_locs[0U] ; }; struct ethtool_flash { __u32 cmd ; __u32 region ; char data[128U] ; }; struct ethtool_dump { __u32 cmd ; __u32 version ; __u32 flag ; __u32 len ; __u8 data[0U] ; }; 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] ; }; enum ethtool_phys_id_state { ETHTOOL_ID_INACTIVE = 0, ETHTOOL_ID_ACTIVE = 1, ETHTOOL_ID_ON = 2, ETHTOOL_ID_OFF = 3 } ; 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 * , u32 const * ) ; 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 * ) ; }; struct prot_inuse; struct netns_core { struct ctl_table_header *sysctl_hdr ; int sysctl_somaxconn ; struct prot_inuse *inuse ; }; struct u64_stats_sync { }; struct ipstats_mib { u64 mibs[31U] ; struct u64_stats_sync syncp ; }; struct icmp_mib { unsigned long mibs[27U] ; }; struct icmpmsg_mib { atomic_long_t mibs[512U] ; }; struct icmpv6_mib { unsigned long mibs[5U] ; }; struct icmpv6_mib_device { atomic_long_t mibs[5U] ; }; struct icmpv6msg_mib { atomic_long_t mibs[512U] ; }; struct icmpv6msg_mib_device { atomic_long_t mibs[512U] ; }; struct tcp_mib { unsigned long mibs[15U] ; }; struct udp_mib { unsigned long mibs[7U] ; }; struct linux_mib { unsigned long mibs[92U] ; }; struct linux_xfrm_mib { unsigned long mibs[27U] ; }; struct proc_dir_entry; 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] ; }; struct netns_unix { int sysctl_max_dgram_qlen ; struct ctl_table_header *ctl ; }; struct netns_packet { struct mutex sklist_lock ; struct hlist_head sklist ; }; struct netns_frags { int nqueues ; atomic_t mem ; struct list_head lru_list ; int timeout ; int high_thresh ; int low_thresh ; }; struct tcpm_hash_bucket; struct ipv4_devconf; struct fib_rules_ops; struct fib_table; struct inet_peer_base; struct xt_table; 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 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 ; kgid_t sysctl_ping_group_range[2U] ; long sysctl_tcp_mem[3U] ; atomic_t dev_addr_genid ; struct list_head mr_tables ; struct fib_rules_ops *mr_rules_ops ; }; struct neighbour; 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)(struct dst_entry const * ) ; unsigned int (*mtu)(struct dst_entry const * ) ; 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)(struct dst_entry const * , struct sk_buff * , void const * ) ; struct kmem_cache *kmem_cachep ; struct percpu_counter pcpuc_entries ; }; 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 ; 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 icmpv6_time ; }; struct ipv6_devconf; struct rt6_info; struct rt6_statistics; struct fib6_table; 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 ; }; struct netns_nf_frag { struct netns_sysctl_ipv6 sysctl ; struct netns_frags frags ; }; struct sctp_mib; 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 ; }; struct netns_dccp { struct sock *v4_ctl_sk ; struct sock *v6_ctl_sk ; }; struct in_addr { __be32 s_addr ; }; struct sockaddr_in { __kernel_sa_family_t sin_family ; __be16 sin_port ; struct in_addr sin_addr ; unsigned char __pad[8U] ; }; union __anonunion_in6_u_211 { __u8 u6_addr8[16U] ; __be16 u6_addr16[8U] ; __be32 u6_addr32[4U] ; }; struct in6_addr { union __anonunion_in6_u_211 in6_u ; }; struct flowi; struct flowi_common { int flowic_oif ; int flowic_iif ; __u32 flowic_mark ; __u8 flowic_tos ; __u8 flowic_scope ; __u8 flowic_proto ; __u8 flowic_flags ; __u32 flowic_secid ; }; struct __anonstruct_ports_212 { __be16 dport ; __be16 sport ; }; struct __anonstruct_icmpt_213 { __u8 type ; __u8 code ; }; struct __anonstruct_dnports_214 { __le16 dport ; __le16 sport ; }; struct __anonstruct_mht_215 { __u8 type ; }; union flowi_uli { struct __anonstruct_ports_212 ports ; struct __anonstruct_icmpt_213 icmpt ; struct __anonstruct_dnports_214 dnports ; __be32 spi ; __be32 gre_key ; struct __anonstruct_mht_215 mht ; }; struct flowi4 { struct flowi_common __fl_common ; __be32 saddr ; __be32 daddr ; union flowi_uli uli ; }; struct flowi6 { struct flowi_common __fl_common ; struct in6_addr daddr ; struct in6_addr saddr ; __be32 flowlabel ; union flowi_uli uli ; }; struct flowidn { struct flowi_common __fl_common ; __le16 daddr ; __le16 saddr ; union flowi_uli uli ; }; union __anonunion_u_216 { struct flowi_common __fl_common ; struct flowi4 ip4 ; struct flowi6 ip6 ; struct flowidn dn ; }; struct flowi { union __anonunion_u_216 u ; }; typedef int read_proc_t(char * , char ** , off_t , int , int * , void * ); typedef int write_proc_t(struct file * , char const * , unsigned long , void * ); struct proc_dir_entry { unsigned int low_ino ; umode_t mode ; nlink_t nlink ; kuid_t uid ; kgid_t gid ; loff_t size ; struct inode_operations const *proc_iops ; struct file_operations const *proc_fops ; struct proc_dir_entry *next ; struct proc_dir_entry *parent ; struct proc_dir_entry *subdir ; void *data ; read_proc_t *read_proc ; write_proc_t *write_proc ; atomic_t count ; int pde_users ; struct completion *pde_unload_completion ; struct list_head pde_openers ; spinlock_t pde_unload_lock ; u8 namelen ; char name[] ; }; struct nlattr; struct ebt_table; struct netns_xt { struct list_head tables[13U] ; struct ebt_table *broute_table ; struct ebt_table *frame_filter ; struct ebt_table *frame_nat ; }; struct hlist_nulls_node; struct hlist_nulls_head { struct hlist_nulls_node *first ; }; struct hlist_nulls_node { struct hlist_nulls_node *next ; struct hlist_nulls_node **pprev ; }; 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 ; }; struct nf_generic_net { struct nf_proto_net pn ; unsigned int timeout ; }; 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 ; }; struct nf_udp_net { struct nf_proto_net pn ; unsigned int timeouts[2U] ; }; struct nf_icmp_net { struct nf_proto_net pn ; unsigned int timeout ; }; 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 ; }; struct ip_conntrack_stat; struct nf_ct_event_notifier; struct nf_exp_event_notifier; struct netns_ct { atomic_t count ; unsigned int expect_count ; 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 ip_conntrack_stat *stat ; struct nf_ct_event_notifier *nf_conntrack_event_cb ; struct nf_exp_event_notifier *nf_expect_event_cb ; int sysctl_events ; unsigned int sysctl_events_retry_timeout ; int sysctl_acct ; int sysctl_tstamp ; int sysctl_checksum ; unsigned int sysctl_log_invalid ; int sysctl_auto_assign_helper ; bool auto_assign_helper_warned ; struct nf_ip_net nf_ct_proto ; struct hlist_head *nat_bysource ; unsigned int nat_htable_size ; 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 ; }; struct xfrm_policy_hash { struct hlist_head *table ; unsigned int hmask ; }; 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 ; wait_queue_head_t km_waitq ; 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 ; }; struct net_generic; struct netns_ipvs; 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 ; 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_xt xt ; struct netns_ct ct ; 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 rt_genid ; }; struct seq_file { char *buf ; size_t size ; size_t from ; size_t count ; loff_t index ; loff_t read_pos ; u64 version ; struct mutex lock ; struct seq_operations const *op ; int poll_event ; void *private ; }; 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 * ) ; }; struct dsa_chip_data { struct device *mii_bus ; int sw_addr ; char *port_names[12U] ; s8 *rtable ; }; struct dsa_platform_data { struct device *netdev ; int nr_chips ; struct dsa_chip_data *chip ; }; struct dsa_switch; 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] ; }; struct dsa_switch_driver; struct mii_bus; 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] ; }; 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 * ) ; }; 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] ; }; struct ieee_maxrate { __u64 tc_maxrate[8U] ; }; struct ieee_pfc { __u8 pfc_cap ; __u8 pfc_en ; __u8 mbc ; __u16 delay ; __u64 requests[8U] ; __u64 indications[8U] ; }; struct cee_pg { __u8 willing ; __u8 error ; __u8 pg_en ; __u8 tcs_supported ; __u8 pg_bw[8U] ; __u8 prio_pg[8U] ; }; struct cee_pfc { __u8 willing ; __u8 error ; __u8 pfc_en ; __u8 tcs_supported ; }; struct dcb_app { __u8 selector ; __u8 priority ; __u16 protocol ; }; struct dcb_peer_app_info { __u8 willing ; __u8 error ; }; 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 * ) ; }; 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 ; }; struct idr_layer { unsigned long bitmap ; struct idr_layer *ary[64U] ; int count ; int layer ; struct callback_head callback_head ; }; struct idr { struct idr_layer *top ; struct idr_layer *id_free ; int layers ; int id_free_cnt ; spinlock_t lock ; }; struct xattr_handler { char const *prefix ; int flags ; size_t (*list)(struct dentry * , char * , size_t , char const * , size_t , int ) ; int (*get)(struct dentry * , char const * , void * , size_t , int ) ; int (*set)(struct dentry * , char const * , void const * , size_t , int , int ) ; }; struct simple_xattrs { struct list_head head ; spinlock_t lock ; }; struct cgroupfs_root; struct cgroup_subsys; struct cgroup; struct css_id; struct cgroup_subsys_state { struct cgroup *cgroup ; atomic_t refcnt ; unsigned long flags ; struct css_id *id ; struct work_struct dput_work ; }; struct cgroup { unsigned long flags ; atomic_t count ; int id ; struct list_head sibling ; struct list_head children ; struct list_head files ; struct cgroup *parent ; struct dentry *dentry ; struct cgroup_subsys_state *subsys[12U] ; struct cgroupfs_root *root ; struct cgroup *top_cgroup ; struct list_head css_sets ; struct list_head allcg_node ; struct list_head cft_q_node ; struct list_head release_list ; struct list_head pidlists ; struct mutex pidlist_mutex ; struct callback_head callback_head ; struct list_head event_list ; spinlock_t event_list_lock ; struct simple_xattrs xattrs ; }; struct css_set { atomic_t refcount ; struct hlist_node hlist ; struct list_head tasks ; struct list_head cg_links ; struct cgroup_subsys_state *subsys[12U] ; struct callback_head callback_head ; }; struct cgroup_map_cb { int (*fill)(struct cgroup_map_cb * , char const * , u64 ) ; void *state ; }; struct cftype { char name[64U] ; int private ; umode_t mode ; size_t max_write_len ; unsigned int flags ; struct simple_xattrs xattrs ; int (*open)(struct inode * , struct file * ) ; ssize_t (*read)(struct cgroup * , struct cftype * , struct file * , char * , size_t , loff_t * ) ; u64 (*read_u64)(struct cgroup * , struct cftype * ) ; s64 (*read_s64)(struct cgroup * , struct cftype * ) ; int (*read_map)(struct cgroup * , struct cftype * , struct cgroup_map_cb * ) ; int (*read_seq_string)(struct cgroup * , struct cftype * , struct seq_file * ) ; ssize_t (*write)(struct cgroup * , struct cftype * , struct file * , char const * , size_t , loff_t * ) ; int (*write_u64)(struct cgroup * , struct cftype * , u64 ) ; int (*write_s64)(struct cgroup * , struct cftype * , s64 ) ; int (*write_string)(struct cgroup * , struct cftype * , char const * ) ; int (*trigger)(struct cgroup * , unsigned int ) ; int (*release)(struct inode * , struct file * ) ; int (*register_event)(struct cgroup * , struct cftype * , struct eventfd_ctx * , char const * ) ; void (*unregister_event)(struct cgroup * , struct cftype * , struct eventfd_ctx * ) ; }; struct cftype_set { struct list_head node ; struct cftype *cfts ; }; struct cgroup_taskset; struct cgroup_subsys { struct cgroup_subsys_state *(*css_alloc)(struct cgroup * ) ; int (*css_online)(struct cgroup * ) ; void (*css_offline)(struct cgroup * ) ; void (*css_free)(struct cgroup * ) ; int (*can_attach)(struct cgroup * , struct cgroup_taskset * ) ; void (*cancel_attach)(struct cgroup * , struct cgroup_taskset * ) ; void (*attach)(struct cgroup * , struct cgroup_taskset * ) ; void (*fork)(struct task_struct * ) ; void (*exit)(struct cgroup * , struct cgroup * , struct task_struct * ) ; void (*bind)(struct cgroup * ) ; int subsys_id ; int active ; int disabled ; int early_init ; bool use_id ; bool broken_hierarchy ; bool warned_broken_hierarchy ; char const *name ; struct cgroupfs_root *root ; struct list_head sibling ; struct idr idr ; spinlock_t id_lock ; struct list_head cftsets ; struct cftype *base_cftypes ; struct cftype_set base_cftset ; struct module *module ; }; enum irqreturn { IRQ_NONE = 0, IRQ_HANDLED = 1, IRQ_WAKE_THREAD = 2 } ; typedef enum irqreturn irqreturn_t; struct netprio_map { struct callback_head rcu ; u32 priomap_len ; u32 priomap[] ; }; struct xfrm_policy; struct xfrm_state; struct request_sock; struct mnt_namespace; struct ipc_namespace; 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 ; struct net *net_ns ; }; struct nlmsghdr { __u32 nlmsg_len ; __u16 nlmsg_type ; __u16 nlmsg_flags ; __u32 nlmsg_seq ; __u32 nlmsg_pid ; }; struct nlattr { __u16 nla_len ; __u16 nla_type ; }; struct netlink_callback { struct sk_buff *skb ; struct nlmsghdr const *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] ; }; struct ndmsg { __u8 ndm_family ; __u8 ndm_pad1 ; __u16 ndm_pad2 ; __s32 ndm_ifindex ; __u16 ndm_state ; __u8 ndm_flags ; __u8 ndm_type ; }; 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 ; }; struct ifla_vf_info { __u32 vf ; __u8 mac[32U] ; __u32 vlan ; __u32 qos ; __u32 tx_rate ; __u32 spoofchk ; }; struct netpoll_info; struct phy_device; struct wireless_dev; enum netdev_tx { __NETDEV_TX_MIN = (-0x7FFFFFFF-1), NETDEV_TX_OK = 0, NETDEV_TX_BUSY = 16, NETDEV_TX_LOCKED = 32 } ; typedef enum netdev_tx netdev_tx_t; 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 ; }; struct neigh_parms; struct netdev_hw_addr_list { struct list_head list ; int count ; }; struct hh_cache { u16 hh_len ; u16 __pad ; seqlock_t hh_lock ; unsigned long hh_data[16U] ; }; struct header_ops { int (*create)(struct sk_buff * , struct net_device * , unsigned short , void const * , void const * , unsigned int ) ; int (*parse)(struct sk_buff const * , unsigned char * ) ; int (*rebuild)(struct sk_buff * ) ; int (*cache)(struct neighbour const * , struct hh_cache * , __be16 ) ; void (*cache_update)(struct hh_cache * , struct net_device const * , unsigned char const * ) ; }; 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 ; }; enum rx_handler_result { RX_HANDLER_CONSUMED = 0, RX_HANDLER_ANOTHER = 1, RX_HANDLER_EXACT = 2, RX_HANDLER_PASS = 3 } ; typedef enum rx_handler_result rx_handler_result_t; typedef rx_handler_result_t rx_handler_func_t(struct sk_buff ** ); struct Qdisc; 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 ; }; struct rps_map { unsigned int len ; struct callback_head rcu ; u16 cpus[0U] ; }; struct rps_dev_flow { u16 cpu ; u16 filter ; unsigned int last_qtail ; }; struct rps_dev_flow_table { unsigned int mask ; struct callback_head rcu ; struct work_struct free_work ; struct rps_dev_flow flows[0U] ; }; struct netdev_rx_queue { struct rps_map *rps_map ; struct rps_dev_flow_table *rps_flow_table ; struct kobject kobj ; struct net_device *dev ; }; struct xps_map { unsigned int len ; unsigned int alloc_len ; struct callback_head rcu ; u16 queues[0U] ; }; struct xps_dev_maps { struct callback_head rcu ; struct xps_map *cpu_map[0U] ; }; struct netdev_tc_txq { u16 count ; u16 offset ; }; 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] ; }; 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 (*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 * , unsigned short ) ; int (*ndo_vlan_rx_kill_vid)(struct net_device * , unsigned short ) ; 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_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_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 * , struct sk_buff const * , 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 * , unsigned char const * , u16 ) ; int (*ndo_fdb_del)(struct ndmsg * , struct net_device * , unsigned char const * ) ; 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 * ) ; }; struct iw_handler_def; struct iw_public_data; struct vlan_info; struct in_device; struct dn_dev; struct inet6_dev; struct cpu_rmap; struct pcpu_lstats; struct pcpu_tstats; struct pcpu_dstats; union __anonunion_ldv_36581_221 { void *ml_priv ; struct pcpu_lstats *lstats ; struct pcpu_tstats *tstats ; struct pcpu_dstats *dstats ; }; struct garp_port; struct rtnl_link_ops; 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 ; unsigned int irq ; unsigned long state ; struct list_head dev_list ; struct list_head napi_list ; struct list_head unreg_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 ; int ifindex ; int iflink ; struct net_device_stats stats ; atomic_long_t rx_dropped ; struct iw_handler_def const *wireless_handlers ; struct iw_public_data *wireless_data ; struct net_device_ops const *netdev_ops ; struct ethtool_ops const *ethtool_ops ; struct header_ops const *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 char neigh_priv_len ; unsigned short dev_id ; spinlock_t addr_list_lock ; struct netdev_hw_addr_list uc ; struct netdev_hw_addr_list mc ; bool uc_promisc ; unsigned int promiscuity ; unsigned int allmulti ; struct vlan_info *vlan_info ; struct dsa_switch_tree *dsa_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 ; struct net_device *master ; unsigned char *dev_addr ; struct netdev_hw_addr_list dev_addrs ; unsigned char broadcast[32U] ; struct kset *queues_kset ; struct netdev_rx_queue *_rx ; unsigned int num_rx_queues ; unsigned int real_num_rx_queues ; struct cpu_rmap *rx_cpu_rmap ; rx_handler_func_t *rx_handler ; void *rx_handler_data ; struct netdev_queue *ingress_queue ; 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 ; 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_ldv_36581_221 ldv_36581 ; struct garp_port *garp_port ; struct device dev ; struct attribute_group const *sysfs_groups[4U] ; struct rtnl_link_ops const *rtnl_link_ops ; unsigned int gso_max_size ; u16 gso_max_segs ; struct dcbnl_rtnl_ops const *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 ; }; struct __anonstruct_global_226 { __be64 subnet_prefix ; __be64 interface_id ; }; union ib_gid { u8 raw[16U] ; struct __anonstruct_global_226 global ; }; enum rdma_link_layer { IB_LINK_LAYER_UNSPECIFIED = 0, IB_LINK_LAYER_INFINIBAND = 1, IB_LINK_LAYER_ETHERNET = 2 } ; enum ib_atomic_cap { IB_ATOMIC_NONE = 0, IB_ATOMIC_HCA = 1, IB_ATOMIC_GLOB = 2 } ; struct ib_device_attr { u64 fw_ver ; __be64 sys_image_guid ; u64 max_mr_size ; u64 page_size_cap ; u32 vendor_id ; u32 vendor_part_id ; u32 hw_ver ; int max_qp ; int max_qp_wr ; int device_cap_flags ; int max_sge ; int max_sge_rd ; int max_cq ; int max_cqe ; int max_mr ; int max_pd ; int max_qp_rd_atom ; int max_ee_rd_atom ; int max_res_rd_atom ; int max_qp_init_rd_atom ; int max_ee_init_rd_atom ; enum ib_atomic_cap atomic_cap ; enum ib_atomic_cap masked_atomic_cap ; int max_ee ; int max_rdd ; int max_mw ; int max_raw_ipv6_qp ; int max_raw_ethy_qp ; int max_mcast_grp ; int max_mcast_qp_attach ; int max_total_mcast_qp_attach ; int max_ah ; int max_fmr ; int max_map_per_fmr ; int max_srq ; int max_srq_wr ; int max_srq_sge ; unsigned int max_fast_reg_page_list_len ; u16 max_pkeys ; u8 local_ca_ack_delay ; }; enum ib_mtu { IB_MTU_256 = 1, IB_MTU_512 = 2, IB_MTU_1024 = 3, IB_MTU_2048 = 4, IB_MTU_4096 = 5 } ; enum ib_port_state { IB_PORT_NOP = 0, IB_PORT_DOWN = 1, IB_PORT_INIT = 2, IB_PORT_ARMED = 3, IB_PORT_ACTIVE = 4, IB_PORT_ACTIVE_DEFER = 5 } ; struct ib_protocol_stats { }; struct iw_protocol_stats { u64 ipInReceives ; u64 ipInHdrErrors ; u64 ipInTooBigErrors ; u64 ipInNoRoutes ; u64 ipInAddrErrors ; u64 ipInUnknownProtos ; u64 ipInTruncatedPkts ; u64 ipInDiscards ; u64 ipInDelivers ; u64 ipOutForwDatagrams ; u64 ipOutRequests ; u64 ipOutDiscards ; u64 ipOutNoRoutes ; u64 ipReasmTimeout ; u64 ipReasmReqds ; u64 ipReasmOKs ; u64 ipReasmFails ; u64 ipFragOKs ; u64 ipFragFails ; u64 ipFragCreates ; u64 ipInMcastPkts ; u64 ipOutMcastPkts ; u64 ipInBcastPkts ; u64 ipOutBcastPkts ; u64 tcpRtoAlgorithm ; u64 tcpRtoMin ; u64 tcpRtoMax ; u64 tcpMaxConn ; u64 tcpActiveOpens ; u64 tcpPassiveOpens ; u64 tcpAttemptFails ; u64 tcpEstabResets ; u64 tcpCurrEstab ; u64 tcpInSegs ; u64 tcpOutSegs ; u64 tcpRetransSegs ; u64 tcpInErrs ; u64 tcpOutRsts ; }; union rdma_protocol_stats { struct ib_protocol_stats ib ; struct iw_protocol_stats iw ; }; struct ib_port_attr { enum ib_port_state state ; enum ib_mtu max_mtu ; enum ib_mtu active_mtu ; int gid_tbl_len ; u32 port_cap_flags ; u32 max_msg_sz ; u32 bad_pkey_cntr ; u32 qkey_viol_cntr ; u16 pkey_tbl_len ; u16 lid ; u16 sm_lid ; u8 lmc ; u8 max_vl_num ; u8 sm_sl ; u8 subnet_timeout ; u8 init_type_reply ; u8 active_width ; u8 active_speed ; u8 phys_state ; }; struct ib_device_modify { u64 sys_image_guid ; char node_desc[64U] ; }; struct ib_port_modify { u32 set_port_cap_mask ; u32 clr_port_cap_mask ; u8 init_type ; }; enum ib_event_type { IB_EVENT_CQ_ERR = 0, IB_EVENT_QP_FATAL = 1, IB_EVENT_QP_REQ_ERR = 2, IB_EVENT_QP_ACCESS_ERR = 3, IB_EVENT_COMM_EST = 4, IB_EVENT_SQ_DRAINED = 5, IB_EVENT_PATH_MIG = 6, IB_EVENT_PATH_MIG_ERR = 7, IB_EVENT_DEVICE_FATAL = 8, IB_EVENT_PORT_ACTIVE = 9, IB_EVENT_PORT_ERR = 10, IB_EVENT_LID_CHANGE = 11, IB_EVENT_PKEY_CHANGE = 12, IB_EVENT_SM_CHANGE = 13, IB_EVENT_SRQ_ERR = 14, IB_EVENT_SRQ_LIMIT_REACHED = 15, IB_EVENT_QP_LAST_WQE_REACHED = 16, IB_EVENT_CLIENT_REREGISTER = 17, IB_EVENT_GID_CHANGE = 18 } ; struct ib_device; struct ib_cq; struct ib_qp; struct ib_srq; union __anonunion_element_227 { struct ib_cq *cq ; struct ib_qp *qp ; struct ib_srq *srq ; u8 port_num ; }; struct ib_event { struct ib_device *device ; union __anonunion_element_227 element ; enum ib_event_type event ; }; struct ib_event_handler { struct ib_device *device ; void (*handler)(struct ib_event_handler * , struct ib_event * ) ; struct list_head list ; }; struct ib_global_route { union ib_gid dgid ; u32 flow_label ; u8 sgid_index ; u8 hop_limit ; u8 traffic_class ; }; struct ib_grh { __be32 version_tclass_flow ; __be16 paylen ; u8 next_hdr ; u8 hop_limit ; union ib_gid sgid ; union ib_gid dgid ; }; struct ib_ah_attr { struct ib_global_route grh ; u16 dlid ; u8 sl ; u8 src_path_bits ; u8 static_rate ; u8 ah_flags ; u8 port_num ; }; enum ib_wc_status { IB_WC_SUCCESS = 0, IB_WC_LOC_LEN_ERR = 1, IB_WC_LOC_QP_OP_ERR = 2, IB_WC_LOC_EEC_OP_ERR = 3, IB_WC_LOC_PROT_ERR = 4, IB_WC_WR_FLUSH_ERR = 5, IB_WC_MW_BIND_ERR = 6, IB_WC_BAD_RESP_ERR = 7, IB_WC_LOC_ACCESS_ERR = 8, IB_WC_REM_INV_REQ_ERR = 9, IB_WC_REM_ACCESS_ERR = 10, IB_WC_REM_OP_ERR = 11, IB_WC_RETRY_EXC_ERR = 12, IB_WC_RNR_RETRY_EXC_ERR = 13, IB_WC_LOC_RDD_VIOL_ERR = 14, IB_WC_REM_INV_RD_REQ_ERR = 15, IB_WC_REM_ABORT_ERR = 16, IB_WC_INV_EECN_ERR = 17, IB_WC_INV_EEC_STATE_ERR = 18, IB_WC_FATAL_ERR = 19, IB_WC_RESP_TIMEOUT_ERR = 20, IB_WC_GENERAL_ERR = 21 } ; enum ib_wc_opcode { IB_WC_SEND = 0, IB_WC_RDMA_WRITE = 1, IB_WC_RDMA_READ = 2, IB_WC_COMP_SWAP = 3, IB_WC_FETCH_ADD = 4, IB_WC_BIND_MW = 5, IB_WC_LSO = 6, IB_WC_LOCAL_INV = 7, IB_WC_FAST_REG_MR = 8, IB_WC_MASKED_COMP_SWAP = 9, IB_WC_MASKED_FETCH_ADD = 10, IB_WC_RECV = 128, IB_WC_RECV_RDMA_WITH_IMM = 129 } ; union __anonunion_ex_228 { __be32 imm_data ; u32 invalidate_rkey ; }; struct ib_wc { u64 wr_id ; enum ib_wc_status status ; enum ib_wc_opcode opcode ; u32 vendor_err ; u32 byte_len ; struct ib_qp *qp ; union __anonunion_ex_228 ex ; u32 src_qp ; int wc_flags ; u16 pkey_index ; u16 slid ; u8 sl ; u8 dlid_path_bits ; u8 port_num ; }; enum ib_cq_notify_flags { IB_CQ_SOLICITED = 1, IB_CQ_NEXT_COMP = 2, IB_CQ_SOLICITED_MASK = 3, IB_CQ_REPORT_MISSED_EVENTS = 4 } ; enum ib_srq_type { IB_SRQT_BASIC = 0, IB_SRQT_XRC = 1 } ; enum ib_srq_attr_mask { IB_SRQ_MAX_WR = 1, IB_SRQ_LIMIT = 2 } ; struct ib_srq_attr { u32 max_wr ; u32 max_sge ; u32 srq_limit ; }; struct ib_xrcd; struct __anonstruct_xrc_230 { struct ib_xrcd *xrcd ; struct ib_cq *cq ; }; union __anonunion_ext_229 { struct __anonstruct_xrc_230 xrc ; }; struct ib_srq_init_attr { void (*event_handler)(struct ib_event * , void * ) ; void *srq_context ; struct ib_srq_attr attr ; enum ib_srq_type srq_type ; union __anonunion_ext_229 ext ; }; struct ib_qp_cap { u32 max_send_wr ; u32 max_recv_wr ; u32 max_send_sge ; u32 max_recv_sge ; u32 max_inline_data ; }; enum ib_sig_type { IB_SIGNAL_ALL_WR = 0, IB_SIGNAL_REQ_WR = 1 } ; enum ib_qp_type { IB_QPT_SMI = 0, IB_QPT_GSI = 1, IB_QPT_RC = 2, IB_QPT_UC = 3, IB_QPT_UD = 4, IB_QPT_RAW_IPV6 = 5, IB_QPT_RAW_ETHERTYPE = 6, IB_QPT_RAW_PACKET = 8, IB_QPT_XRC_INI = 9, IB_QPT_XRC_TGT = 10, IB_QPT_MAX = 11 } ; enum ib_qp_create_flags { IB_QP_CREATE_IPOIB_UD_LSO = 1, IB_QP_CREATE_BLOCK_MULTICAST_LOOPBACK = 2, IB_QP_CREATE_RESERVED_START = 67108864, IB_QP_CREATE_RESERVED_END = (-0x7FFFFFFF-1) } ; struct ib_qp_init_attr { void (*event_handler)(struct ib_event * , void * ) ; void *qp_context ; struct ib_cq *send_cq ; struct ib_cq *recv_cq ; struct ib_srq *srq ; struct ib_xrcd *xrcd ; struct ib_qp_cap cap ; enum ib_sig_type sq_sig_type ; enum ib_qp_type qp_type ; enum ib_qp_create_flags create_flags ; u8 port_num ; }; enum ib_qp_state { IB_QPS_RESET = 0, IB_QPS_INIT = 1, IB_QPS_RTR = 2, IB_QPS_RTS = 3, IB_QPS_SQD = 4, IB_QPS_SQE = 5, IB_QPS_ERR = 6 } ; enum ib_mig_state { IB_MIG_MIGRATED = 0, IB_MIG_REARM = 1, IB_MIG_ARMED = 2 } ; struct ib_qp_attr { enum ib_qp_state qp_state ; enum ib_qp_state cur_qp_state ; enum ib_mtu path_mtu ; enum ib_mig_state path_mig_state ; u32 qkey ; u32 rq_psn ; u32 sq_psn ; u32 dest_qp_num ; int qp_access_flags ; struct ib_qp_cap cap ; struct ib_ah_attr ah_attr ; struct ib_ah_attr alt_ah_attr ; u16 pkey_index ; u16 alt_pkey_index ; u8 en_sqd_async_notify ; u8 sq_draining ; u8 max_rd_atomic ; u8 max_dest_rd_atomic ; u8 min_rnr_timer ; u8 port_num ; u8 timeout ; u8 retry_cnt ; u8 rnr_retry ; u8 alt_port_num ; u8 alt_timeout ; }; enum ib_wr_opcode { IB_WR_RDMA_WRITE = 0, IB_WR_RDMA_WRITE_WITH_IMM = 1, IB_WR_SEND = 2, IB_WR_SEND_WITH_IMM = 3, IB_WR_RDMA_READ = 4, IB_WR_ATOMIC_CMP_AND_SWP = 5, IB_WR_ATOMIC_FETCH_AND_ADD = 6, IB_WR_LSO = 7, IB_WR_SEND_WITH_INV = 8, IB_WR_RDMA_READ_WITH_INV = 9, IB_WR_LOCAL_INV = 10, IB_WR_FAST_REG_MR = 11, IB_WR_MASKED_ATOMIC_CMP_AND_SWP = 12, IB_WR_MASKED_ATOMIC_FETCH_AND_ADD = 13 } ; struct ib_sge { u64 addr ; u32 length ; u32 lkey ; }; struct ib_fast_reg_page_list { struct ib_device *device ; u64 *page_list ; unsigned int max_page_list_len ; }; union __anonunion_ex_231 { __be32 imm_data ; u32 invalidate_rkey ; }; struct __anonstruct_rdma_233 { u64 remote_addr ; u32 rkey ; }; struct __anonstruct_atomic_234 { u64 remote_addr ; u64 compare_add ; u64 swap ; u64 compare_add_mask ; u64 swap_mask ; u32 rkey ; }; struct ib_ah; struct __anonstruct_ud_235 { struct ib_ah *ah ; void *header ; int hlen ; int mss ; u32 remote_qpn ; u32 remote_qkey ; u16 pkey_index ; u8 port_num ; }; struct __anonstruct_fast_reg_236 { u64 iova_start ; struct ib_fast_reg_page_list *page_list ; unsigned int page_shift ; unsigned int page_list_len ; u32 length ; int access_flags ; u32 rkey ; }; union __anonunion_wr_232 { struct __anonstruct_rdma_233 rdma ; struct __anonstruct_atomic_234 atomic ; struct __anonstruct_ud_235 ud ; struct __anonstruct_fast_reg_236 fast_reg ; }; struct ib_send_wr { struct ib_send_wr *next ; u64 wr_id ; struct ib_sge *sg_list ; int num_sge ; enum ib_wr_opcode opcode ; int send_flags ; union __anonunion_ex_231 ex ; union __anonunion_wr_232 wr ; u32 xrc_remote_srq_num ; }; struct ib_recv_wr { struct ib_recv_wr *next ; u64 wr_id ; struct ib_sge *sg_list ; int num_sge ; }; struct ib_phys_buf { u64 addr ; u64 size ; }; struct ib_pd; struct ib_mr_attr { struct ib_pd *pd ; u64 device_virt_addr ; u64 size ; int mr_access_flags ; u32 lkey ; u32 rkey ; }; struct ib_mr; struct ib_mw_bind { struct ib_mr *mr ; u64 wr_id ; u64 addr ; u32 length ; int send_flags ; int mw_access_flags ; }; struct ib_fmr_attr { int max_pages ; int max_maps ; u8 page_shift ; }; struct ib_ucontext { struct ib_device *device ; struct list_head pd_list ; struct list_head mr_list ; struct list_head mw_list ; struct list_head cq_list ; struct list_head qp_list ; struct list_head srq_list ; struct list_head ah_list ; struct list_head xrcd_list ; int closing ; }; struct ib_uobject { u64 user_handle ; struct ib_ucontext *context ; void *object ; struct list_head list ; int id ; struct kref ref ; struct rw_semaphore mutex ; int live ; }; struct ib_udata { void *inbuf ; void *outbuf ; size_t inlen ; size_t outlen ; }; struct ib_pd { struct ib_device *device ; struct ib_uobject *uobject ; atomic_t usecnt ; }; struct ib_xrcd { struct ib_device *device ; atomic_t usecnt ; struct inode *inode ; struct mutex tgt_qp_mutex ; struct list_head tgt_qp_list ; }; struct ib_ah { struct ib_device *device ; struct ib_pd *pd ; struct ib_uobject *uobject ; }; struct ib_cq { struct ib_device *device ; struct ib_uobject *uobject ; void (*comp_handler)(struct ib_cq * , void * ) ; void (*event_handler)(struct ib_event * , void * ) ; void *cq_context ; int cqe ; atomic_t usecnt ; }; struct __anonstruct_xrc_238 { struct ib_xrcd *xrcd ; struct ib_cq *cq ; u32 srq_num ; }; union __anonunion_ext_237 { struct __anonstruct_xrc_238 xrc ; }; struct ib_srq { struct ib_device *device ; struct ib_pd *pd ; struct ib_uobject *uobject ; void (*event_handler)(struct ib_event * , void * ) ; void *srq_context ; enum ib_srq_type srq_type ; atomic_t usecnt ; union __anonunion_ext_237 ext ; }; struct ib_qp { struct ib_device *device ; struct ib_pd *pd ; struct ib_cq *send_cq ; struct ib_cq *recv_cq ; struct ib_srq *srq ; struct ib_xrcd *xrcd ; struct list_head xrcd_list ; atomic_t usecnt ; struct list_head open_list ; struct ib_qp *real_qp ; struct ib_uobject *uobject ; void (*event_handler)(struct ib_event * , void * ) ; void *qp_context ; u32 qp_num ; enum ib_qp_type qp_type ; }; struct ib_mr { struct ib_device *device ; struct ib_pd *pd ; struct ib_uobject *uobject ; u32 lkey ; u32 rkey ; atomic_t usecnt ; }; struct ib_mw { struct ib_device *device ; struct ib_pd *pd ; struct ib_uobject *uobject ; u32 rkey ; }; struct ib_fmr { struct ib_device *device ; struct ib_pd *pd ; struct list_head list ; u32 lkey ; u32 rkey ; }; struct ib_mad; struct ib_pkey_cache; struct ib_gid_cache; struct ib_cache { rwlock_t lock ; struct ib_event_handler event_handler ; struct ib_pkey_cache **pkey_cache ; struct ib_gid_cache **gid_cache ; u8 *lmc_cache ; }; struct ib_dma_mapping_ops { int (*mapping_error)(struct ib_device * , u64 ) ; u64 (*map_single)(struct ib_device * , void * , size_t , enum dma_data_direction ) ; void (*unmap_single)(struct ib_device * , u64 , size_t , enum dma_data_direction ) ; u64 (*map_page)(struct ib_device * , struct page * , unsigned long , size_t , enum dma_data_direction ) ; void (*unmap_page)(struct ib_device * , u64 , size_t , enum dma_data_direction ) ; int (*map_sg)(struct ib_device * , struct scatterlist * , int , enum dma_data_direction ) ; void (*unmap_sg)(struct ib_device * , struct scatterlist * , int , enum dma_data_direction ) ; u64 (*dma_address)(struct ib_device * , struct scatterlist * ) ; unsigned int (*dma_len)(struct ib_device * , struct scatterlist * ) ; void (*sync_single_for_cpu)(struct ib_device * , u64 , size_t , enum dma_data_direction ) ; void (*sync_single_for_device)(struct ib_device * , u64 , size_t , enum dma_data_direction ) ; void *(*alloc_coherent)(struct ib_device * , size_t , u64 * , gfp_t ) ; void (*free_coherent)(struct ib_device * , size_t , void * , u64 ) ; }; struct iw_cm_verbs; enum ldv_28240 { IB_DEV_UNINITIALIZED = 0, IB_DEV_REGISTERED = 1, IB_DEV_UNREGISTERED = 2 } ; struct ib_device { struct device *dma_device ; char name[64U] ; struct list_head event_handler_list ; spinlock_t event_handler_lock ; spinlock_t client_data_lock ; struct list_head core_list ; struct list_head client_data_list ; struct ib_cache cache ; int *pkey_tbl_len ; int *gid_tbl_len ; int num_comp_vectors ; struct iw_cm_verbs *iwcm ; int (*get_protocol_stats)(struct ib_device * , union rdma_protocol_stats * ) ; int (*query_device)(struct ib_device * , struct ib_device_attr * ) ; int (*query_port)(struct ib_device * , u8 , struct ib_port_attr * ) ; enum rdma_link_layer (*get_link_layer)(struct ib_device * , u8 ) ; int (*query_gid)(struct ib_device * , u8 , int , union ib_gid * ) ; int (*query_pkey)(struct ib_device * , u8 , u16 , u16 * ) ; int (*modify_device)(struct ib_device * , int , struct ib_device_modify * ) ; int (*modify_port)(struct ib_device * , u8 , int , struct ib_port_modify * ) ; struct ib_ucontext *(*alloc_ucontext)(struct ib_device * , struct ib_udata * ) ; int (*dealloc_ucontext)(struct ib_ucontext * ) ; int (*mmap)(struct ib_ucontext * , struct vm_area_struct * ) ; struct ib_pd *(*alloc_pd)(struct ib_device * , struct ib_ucontext * , struct ib_udata * ) ; int (*dealloc_pd)(struct ib_pd * ) ; struct ib_ah *(*create_ah)(struct ib_pd * , struct ib_ah_attr * ) ; int (*modify_ah)(struct ib_ah * , struct ib_ah_attr * ) ; int (*query_ah)(struct ib_ah * , struct ib_ah_attr * ) ; int (*destroy_ah)(struct ib_ah * ) ; struct ib_srq *(*create_srq)(struct ib_pd * , struct ib_srq_init_attr * , struct ib_udata * ) ; int (*modify_srq)(struct ib_srq * , struct ib_srq_attr * , enum ib_srq_attr_mask , struct ib_udata * ) ; int (*query_srq)(struct ib_srq * , struct ib_srq_attr * ) ; int (*destroy_srq)(struct ib_srq * ) ; int (*post_srq_recv)(struct ib_srq * , struct ib_recv_wr * , struct ib_recv_wr ** ) ; struct ib_qp *(*create_qp)(struct ib_pd * , struct ib_qp_init_attr * , struct ib_udata * ) ; int (*modify_qp)(struct ib_qp * , struct ib_qp_attr * , int , struct ib_udata * ) ; int (*query_qp)(struct ib_qp * , struct ib_qp_attr * , int , struct ib_qp_init_attr * ) ; int (*destroy_qp)(struct ib_qp * ) ; int (*post_send)(struct ib_qp * , struct ib_send_wr * , struct ib_send_wr ** ) ; int (*post_recv)(struct ib_qp * , struct ib_recv_wr * , struct ib_recv_wr ** ) ; struct ib_cq *(*create_cq)(struct ib_device * , int , int , struct ib_ucontext * , struct ib_udata * ) ; int (*modify_cq)(struct ib_cq * , u16 , u16 ) ; int (*destroy_cq)(struct ib_cq * ) ; int (*resize_cq)(struct ib_cq * , int , struct ib_udata * ) ; int (*poll_cq)(struct ib_cq * , int , struct ib_wc * ) ; int (*peek_cq)(struct ib_cq * , int ) ; int (*req_notify_cq)(struct ib_cq * , enum ib_cq_notify_flags ) ; int (*req_ncomp_notif)(struct ib_cq * , int ) ; struct ib_mr *(*get_dma_mr)(struct ib_pd * , int ) ; struct ib_mr *(*reg_phys_mr)(struct ib_pd * , struct ib_phys_buf * , int , int , u64 * ) ; struct ib_mr *(*reg_user_mr)(struct ib_pd * , u64 , u64 , u64 , int , struct ib_udata * ) ; int (*query_mr)(struct ib_mr * , struct ib_mr_attr * ) ; int (*dereg_mr)(struct ib_mr * ) ; struct ib_mr *(*alloc_fast_reg_mr)(struct ib_pd * , int ) ; struct ib_fast_reg_page_list *(*alloc_fast_reg_page_list)(struct ib_device * , int ) ; void (*free_fast_reg_page_list)(struct ib_fast_reg_page_list * ) ; int (*rereg_phys_mr)(struct ib_mr * , int , struct ib_pd * , struct ib_phys_buf * , int , int , u64 * ) ; struct ib_mw *(*alloc_mw)(struct ib_pd * ) ; int (*bind_mw)(struct ib_qp * , struct ib_mw * , struct ib_mw_bind * ) ; int (*dealloc_mw)(struct ib_mw * ) ; struct ib_fmr *(*alloc_fmr)(struct ib_pd * , int , struct ib_fmr_attr * ) ; int (*map_phys_fmr)(struct ib_fmr * , u64 * , int , u64 ) ; int (*unmap_fmr)(struct list_head * ) ; int (*dealloc_fmr)(struct ib_fmr * ) ; int (*attach_mcast)(struct ib_qp * , union ib_gid * , u16 ) ; int (*detach_mcast)(struct ib_qp * , union ib_gid * , u16 ) ; int (*process_mad)(struct ib_device * , int , u8 , struct ib_wc * , struct ib_grh * , struct ib_mad * , struct ib_mad * ) ; struct ib_xrcd *(*alloc_xrcd)(struct ib_device * , struct ib_ucontext * , struct ib_udata * ) ; int (*dealloc_xrcd)(struct ib_xrcd * ) ; struct ib_dma_mapping_ops *dma_ops ; struct module *owner ; struct device dev ; struct kobject *ports_parent ; struct list_head port_list ; enum ldv_28240 reg_state ; int uverbs_abi_ver ; u64 uverbs_cmd_mask ; char node_desc[64U] ; __be64 node_guid ; u32 local_dma_lkey ; u8 node_type ; u8 phys_port_cnt ; }; struct ib_mad_hdr { u8 base_version ; u8 mgmt_class ; u8 class_version ; u8 method ; __be16 status ; __be16 class_specific ; __be64 tid ; __be16 attr_id ; __be16 resv ; __be32 attr_mod ; }; struct ib_mad { struct ib_mad_hdr mad_hdr ; u8 data[232U] ; }; struct iw_cm_id; enum iw_cm_event_type { IW_CM_EVENT_CONNECT_REQUEST = 1, IW_CM_EVENT_CONNECT_REPLY = 2, IW_CM_EVENT_ESTABLISHED = 3, IW_CM_EVENT_DISCONNECT = 4, IW_CM_EVENT_CLOSE = 5 } ; struct iw_cm_event { enum iw_cm_event_type event ; int status ; struct sockaddr_in local_addr ; struct sockaddr_in remote_addr ; void *private_data ; void *provider_data ; u8 private_data_len ; u8 ord ; u8 ird ; }; struct iw_cm_id { int (*cm_handler)(struct iw_cm_id * , struct iw_cm_event * ) ; void *context ; struct ib_device *device ; struct sockaddr_in local_addr ; struct sockaddr_in remote_addr ; void *provider_data ; int (*event_handler)(struct iw_cm_id * , struct iw_cm_event * ) ; void (*add_ref)(struct iw_cm_id * ) ; void (*rem_ref)(struct iw_cm_id * ) ; }; struct iw_cm_conn_param { void const *private_data ; u16 private_data_len ; u32 ord ; u32 ird ; u32 qpn ; }; struct iw_cm_verbs { void (*add_ref)(struct ib_qp * ) ; void (*rem_ref)(struct ib_qp * ) ; struct ib_qp *(*get_qp)(struct ib_device * , int ) ; int (*connect)(struct iw_cm_id * , struct iw_cm_conn_param * ) ; int (*accept)(struct iw_cm_id * , struct iw_cm_conn_param * ) ; int (*reject)(struct iw_cm_id * , void const * , u8 ) ; int (*create_listen)(struct iw_cm_id * , int ) ; int (*destroy_listen)(struct iw_cm_id * ) ; }; struct ipv4_devconf { void *sysctl ; int data[26U] ; unsigned long state[1U] ; }; struct in_ifaddr; struct ip_mc_list; struct in_device { struct net_device *dev ; atomic_t refcnt ; int dead ; struct in_ifaddr *ifa_list ; struct ip_mc_list *mc_list ; int mc_count ; spinlock_t mc_tomb_lock ; struct ip_mc_list *mc_tomb ; unsigned long mr_v1_seen ; unsigned long mr_v2_seen ; unsigned long mr_maxdelay ; unsigned char mr_qrv ; unsigned char mr_gq_running ; unsigned char mr_ifc_count ; struct timer_list mr_gq_timer ; struct timer_list mr_ifc_timer ; struct neigh_parms *arp_parms ; struct ipv4_devconf cnf ; struct callback_head callback_head ; }; struct in_ifaddr { struct hlist_node hash ; struct in_ifaddr *ifa_next ; struct in_device *ifa_dev ; struct callback_head callback_head ; __be32 ifa_local ; __be32 ifa_address ; __be32 ifa_mask ; __be32 ifa_broadcast ; unsigned char ifa_scope ; unsigned char ifa_flags ; unsigned char ifa_prefixlen ; char ifa_label[16U] ; }; typedef unsigned long kernel_ulong_t; struct pci_device_id { __u32 vendor ; __u32 device ; __u32 subvendor ; __u32 subdevice ; __u32 class ; __u32 class_mask ; kernel_ulong_t driver_data ; }; struct acpi_device_id { __u8 id[16U] ; kernel_ulong_t driver_data ; }; struct of_device_id { char name[32U] ; char type[32U] ; char compatible[128U] ; void const *data ; }; struct hotplug_slot; struct pci_slot { struct pci_bus *bus ; struct list_head list ; struct hotplug_slot *hotplug ; unsigned char number ; struct kobject kobj ; }; typedef int pci_power_t; typedef unsigned int pci_channel_state_t; enum pci_channel_state { pci_channel_io_normal = 1, pci_channel_io_frozen = 2, pci_channel_io_perm_failure = 3 } ; typedef unsigned short pci_dev_flags_t; typedef unsigned short pci_bus_flags_t; struct pcie_link_state; struct pci_vpd; struct pci_sriov; struct pci_ats; struct pci_driver; union __anonunion_ldv_41777_241 { struct pci_sriov *sriov ; struct pci_dev *physfn ; }; 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 ; unsigned char pcie_mpss : 3 ; 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 ; int pm_cap ; unsigned char pme_support : 5 ; unsigned char pme_interrupt : 1 ; unsigned char pme_poll : 1 ; unsigned char d1_support : 1 ; unsigned char d2_support : 1 ; unsigned char no_d1d2 : 1 ; unsigned char no_d3cold : 1 ; unsigned char d3cold_allowed : 1 ; unsigned char mmio_always_on : 1 ; unsigned char wakeup_prepared : 1 ; unsigned char runtime_d3cold : 1 ; 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] ; unsigned char transparent : 1 ; unsigned char multifunction : 1 ; unsigned char is_added : 1 ; unsigned char is_busmaster : 1 ; unsigned char no_msi : 1 ; unsigned char block_cfg_access : 1 ; unsigned char broken_parity_status : 1 ; unsigned char irq_reroute_variant : 2 ; unsigned char msi_enabled : 1 ; unsigned char msix_enabled : 1 ; unsigned char ari_enabled : 1 ; unsigned char is_managed : 1 ; unsigned char is_pcie : 1 ; unsigned char needs_freset : 1 ; unsigned char state_saved : 1 ; unsigned char is_physfn : 1 ; unsigned char is_virtfn : 1 ; unsigned char reset_fn : 1 ; unsigned char is_hotplug_bridge : 1 ; unsigned char __aer_firmware_first_valid : 1 ; unsigned char __aer_firmware_first : 1 ; unsigned char broken_intx_masking : 1 ; unsigned char io_window_1k : 1 ; 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 ; struct kset *msi_kset ; struct pci_vpd *vpd ; union __anonunion_ldv_41777_241 ldv_41777 ; struct pci_ats *ats ; phys_addr_t rom ; size_t romlen ; }; struct pci_ops; 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 ; 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 : 1 ; }; struct pci_ops { int (*read)(struct pci_bus * , unsigned int , int , int , u32 * ) ; int (*write)(struct pci_bus * , unsigned int , int , int , u32 ) ; }; struct pci_dynids { spinlock_t lock ; struct list_head list ; }; typedef unsigned int pci_ers_result_t; 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 * ) ; }; struct pci_driver { struct list_head node ; char const *name ; struct pci_device_id const *id_table ; int (*probe)(struct pci_dev * , struct pci_device_id const * ) ; 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 ) ; struct pci_error_handlers const *err_handler ; struct device_driver driver ; struct pci_dynids dynids ; }; struct iphdr { unsigned char ihl : 4 ; unsigned char version : 4 ; __u8 tos ; __be16 tot_len ; __be16 id ; __be16 frag_off ; __u8 ttl ; __u8 protocol ; __sum16 check ; __be32 saddr ; __be32 daddr ; }; 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 ; }; struct sock_filter { __u16 code ; __u8 jt ; __u8 jf ; __u32 k ; }; struct sk_filter { atomic_t refcnt ; unsigned int len ; unsigned int (*bpf_func)(struct sk_buff const * , struct sock_filter const * ) ; struct callback_head rcu ; struct sock_filter insns[0U] ; }; struct poll_table_struct { void (*_qproc)(struct file * , wait_queue_head_t * , struct poll_table_struct * ) ; unsigned long _key ; }; struct nla_policy { u16 type ; u16 len ; }; struct rtnl_link_ops { struct list_head list ; char const *kind ; size_t priv_size ; void (*setup)(struct net_device * ) ; int maxtype ; struct nla_policy const *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)(struct net_device const * ) ; int (*fill_info)(struct sk_buff * , struct net_device const * ) ; size_t (*get_xstats_size)(struct net_device const * ) ; int (*fill_xstats)(struct sk_buff * , struct net_device const * ) ; unsigned int (*get_num_tx_queues)(void) ; unsigned int (*get_num_rx_queues)(void) ; }; struct neigh_table; 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 base_reachable_time ; int retrans_time ; int gc_staletime ; int reachable_time ; int delay_probe_time ; int queue_len_bytes ; int ucast_probes ; int app_probes ; int mcast_probes ; int anycast_delay ; int proxy_delay ; int proxy_qlen ; int locktime ; }; 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 ; }; struct neigh_ops; 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 * ) ; struct neigh_ops const *ops ; struct callback_head rcu ; struct net_device *dev ; u8 primary_key[0U] ; }; 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 * ) ; }; struct pneigh_entry { struct pneigh_entry *next ; struct net *net ; struct net_device *dev ; u8 flags ; u8 key[0U] ; }; struct neigh_hash_table { struct neighbour **hash_buckets ; unsigned int hash_shift ; __u32 hash_rnd[4U] ; struct callback_head rcu ; }; struct neigh_table { struct neigh_table *next ; int family ; int entry_size ; int key_len ; __u32 (*hash)(void const * , struct net_device const * , __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 ; }; union __anonunion_ldv_44879_244 { unsigned long expires ; struct dst_entry *from ; }; struct dn_route; union __anonunion_ldv_44904_245 { struct dst_entry *next ; struct rtable *rt_next ; struct rt6_info *rt6_next ; struct dn_route *dn_next ; }; struct dst_entry { struct callback_head callback_head ; struct dst_entry *child ; struct net_device *dev ; struct dst_ops *ops ; unsigned long _metrics ; union __anonunion_ldv_44879_244 ldv_44879 ; struct dst_entry *path ; void *__pad0 ; 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_ldv_44904_245 ldv_44904 ; }; struct __anonstruct_socket_lock_t_246 { spinlock_t slock ; int owned ; wait_queue_head_t wq ; struct lockdep_map dep_map ; }; typedef struct __anonstruct_socket_lock_t_246 socket_lock_t; struct proto; typedef __u32 __portpair; typedef __u64 __addrpair; struct __anonstruct_ldv_45121_248 { __be32 skc_daddr ; __be32 skc_rcv_saddr ; }; union __anonunion_ldv_45122_247 { __addrpair skc_addrpair ; struct __anonstruct_ldv_45121_248 ldv_45121 ; }; union __anonunion_ldv_45126_249 { unsigned int skc_hash ; __u16 skc_u16hashes[2U] ; }; struct __anonstruct_ldv_45132_251 { __be16 skc_dport ; __u16 skc_num ; }; union __anonunion_ldv_45133_250 { __portpair skc_portpair ; struct __anonstruct_ldv_45132_251 ldv_45132 ; }; union __anonunion_ldv_45141_252 { struct hlist_node skc_bind_node ; struct hlist_nulls_node skc_portaddr_node ; }; union __anonunion_ldv_45148_253 { struct hlist_node skc_node ; struct hlist_nulls_node skc_nulls_node ; }; struct sock_common { union __anonunion_ldv_45122_247 ldv_45122 ; union __anonunion_ldv_45126_249 ldv_45126 ; union __anonunion_ldv_45133_250 ldv_45133 ; unsigned short skc_family ; unsigned char volatile skc_state ; unsigned char skc_reuse ; int skc_bound_dev_if ; union __anonunion_ldv_45141_252 ldv_45141 ; struct proto *skc_prot ; struct net *skc_net ; int skc_dontcopy_begin[0U] ; union __anonunion_ldv_45148_253 ldv_45148 ; int skc_tx_queue_mapping ; atomic_t skc_refcnt ; int skc_dontcopy_end[0U] ; }; struct cg_proto; struct __anonstruct_sk_backlog_254 { atomic_t rmem_alloc ; int len ; struct sk_buff *head ; struct sk_buff *tail ; }; struct sock { struct sock_common __sk_common ; socket_lock_t sk_lock ; struct sk_buff_head sk_receive_queue ; struct __anonstruct_sk_backlog_254 sk_backlog ; int sk_forward_alloc ; __u32 sk_rxhash ; atomic_t sk_drops ; int sk_rcvbuf ; struct sk_filter *sk_filter ; struct socket_wq *sk_wq ; struct sk_buff_head sk_async_wait_queue ; 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 : 2 ; unsigned char sk_no_check : 2 ; unsigned char sk_userlocks : 4 ; unsigned char sk_protocol ; unsigned short sk_type ; int sk_wmem_queued ; gfp_t sk_allocation ; 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 ; struct cred const *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 * ) ; }; struct request_sock_ops; struct timewait_sock_ops; struct inet_hashinfo; struct raw_hashinfo; struct udp_table; union __anonunion_h_255 { struct inet_hashinfo *hashinfo ; struct udp_table *udp_table ; struct raw_hashinfo *raw_hash ; }; 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 ; 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_255 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 * ) ; }; struct cg_proto { void (*enter_memory_pressure)(struct sock * ) ; struct res_counter *memory_allocated ; struct percpu_counter *sockets_allocated ; int *memory_pressure ; long *sysctl_mem ; unsigned long flags ; struct mem_cgroup *memcg ; }; struct request_values { }; 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 * , struct request_values * ) ; 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 * ) ; }; struct request_sock { struct request_sock *dl_next ; u16 mss ; u8 num_retrans ; unsigned char cookie_ts : 1 ; unsigned char num_timeout : 7 ; u32 window_clamp ; u32 rcv_wnd ; u32 ts_recent ; unsigned long expires ; struct request_sock_ops const *rsk_ops ; struct sock *sk ; u32 secid ; u32 peer_secid ; }; struct ipv6_devconf { __s32 forwarding ; __s32 hop_limit ; __s32 mtu6 ; __s32 accept_ra ; __s32 accept_redirects ; __s32 autoconf ; __s32 dad_transmits ; __s32 rtr_solicits ; __s32 rtr_solicit_interval ; __s32 rtr_solicit_delay ; __s32 force_mld_version ; __s32 use_tempaddr ; __s32 temp_valid_lft ; __s32 temp_prefered_lft ; __s32 regen_max_retry ; __s32 max_desync_factor ; __s32 max_addresses ; __s32 accept_ra_defrtr ; __s32 accept_ra_pinfo ; __s32 accept_ra_rtr_pref ; __s32 rtr_probe_interval ; __s32 accept_ra_rt_info_max_plen ; __s32 proxy_ndp ; __s32 accept_source_route ; __s32 optimistic_dad ; __s32 mc_forwarding ; __s32 disable_ipv6 ; __s32 accept_dad ; __s32 force_tllao ; __s32 ndisc_notify ; void *sysctl ; }; 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 * ) ; }; struct tcphdr { __be16 source ; __be16 dest ; __be32 seq ; __be32 ack_seq ; unsigned char res1 : 4 ; unsigned char doff : 4 ; unsigned char fin : 1 ; unsigned char syn : 1 ; unsigned char rst : 1 ; unsigned char psh : 1 ; unsigned char ack : 1 ; unsigned char urg : 1 ; unsigned char ece : 1 ; unsigned char cwr : 1 ; __be16 window ; __sum16 check ; __be16 urg_ptr ; }; struct tasklet_struct { struct tasklet_struct *next ; unsigned long state ; atomic_t count ; void (*func)(unsigned long ) ; unsigned long data ; }; struct ip6_sf_list { struct ip6_sf_list *sf_next ; struct in6_addr sf_addr ; unsigned long sf_count[2U] ; unsigned char sf_gsresp ; unsigned char sf_oldin ; unsigned char sf_crcount ; }; struct ifmcaddr6 { struct in6_addr mca_addr ; struct inet6_dev *idev ; struct ifmcaddr6 *next ; struct ip6_sf_list *mca_sources ; struct ip6_sf_list *mca_tomb ; unsigned int mca_sfmode ; unsigned char mca_crcount ; unsigned long mca_sfcount[2U] ; struct timer_list mca_timer ; unsigned int mca_flags ; int mca_users ; atomic_t mca_refcnt ; spinlock_t mca_lock ; unsigned long mca_cstamp ; unsigned long mca_tstamp ; }; struct ifacaddr6 { struct in6_addr aca_addr ; struct inet6_dev *aca_idev ; struct rt6_info *aca_rt ; struct ifacaddr6 *aca_next ; int aca_users ; atomic_t aca_refcnt ; spinlock_t aca_lock ; unsigned long aca_cstamp ; unsigned long aca_tstamp ; }; struct ipv6_devstat { struct proc_dir_entry *proc_dir_entry ; struct ipstats_mib *ipv6[1U] ; struct icmpv6_mib_device *icmpv6dev ; struct icmpv6msg_mib_device *icmpv6msgdev ; }; struct inet6_dev { struct net_device *dev ; struct list_head addr_list ; struct ifmcaddr6 *mc_list ; struct ifmcaddr6 *mc_tomb ; spinlock_t mc_lock ; unsigned char mc_qrv ; unsigned char mc_gq_running ; unsigned char mc_ifc_count ; unsigned long mc_v1_seen ; unsigned long mc_maxdelay ; struct timer_list mc_gq_timer ; struct timer_list mc_ifc_timer ; struct ifacaddr6 *ac_list ; rwlock_t lock ; atomic_t refcnt ; __u32 if_flags ; int dead ; u8 rndid[8U] ; struct timer_list regen_timer ; struct list_head tempaddr_list ; struct neigh_parms *nd_parms ; struct inet6_dev *next ; struct ipv6_devconf cnf ; struct ipv6_devstat stats ; unsigned long tstamp ; struct callback_head rcu ; }; union __anonunion_ldv_49897_270 { __be32 a4 ; __be32 a6[4U] ; }; struct inetpeer_addr_base { union __anonunion_ldv_49897_270 ldv_49897 ; }; struct inetpeer_addr { struct inetpeer_addr_base addr ; __u16 family ; }; union __anonunion_ldv_49912_271 { struct list_head gc_list ; struct callback_head gc_rcu ; }; struct __anonstruct_ldv_49917_273 { atomic_t rid ; atomic_t ip_id_count ; }; union __anonunion_ldv_49920_272 { struct __anonstruct_ldv_49917_273 ldv_49917 ; struct callback_head rcu ; struct inet_peer *gc_next ; }; struct inet_peer { struct inet_peer *avl_left ; struct inet_peer *avl_right ; struct inetpeer_addr daddr ; __u32 avl_height ; u32 metrics[14U] ; u32 rate_tokens ; unsigned long rate_last ; union __anonunion_ldv_49912_271 ldv_49912 ; union __anonunion_ldv_49920_272 ldv_49920 ; __u32 dtime ; atomic_t refcnt ; }; struct inet_peer_base { struct inet_peer *root ; seqlock_t lock ; u32 flush_seq ; int total ; }; struct rtable { struct dst_entry dst ; int rt_genid ; unsigned int rt_flags ; __u16 rt_type ; __u8 rt_is_input ; __u8 rt_uses_gateway ; int rt_iif ; __be32 rt_gateway ; u32 rt_pmtu ; struct list_head rt_uncached ; }; struct inet_ehash_bucket { struct hlist_nulls_head chain ; struct hlist_nulls_head twchain ; }; struct inet_bind_hashbucket { spinlock_t lock ; struct hlist_head chain ; }; struct inet_listen_hashbucket { spinlock_t lock ; struct hlist_nulls_head head ; }; struct inet_hashinfo { struct inet_ehash_bucket *ehash ; spinlock_t *ehash_locks ; unsigned int ehash_mask ; unsigned int ehash_locks_mask ; struct inet_bind_hashbucket *bhash ; unsigned int bhash_size ; struct kmem_cache *bind_bucket_cachep ; struct inet_listen_hashbucket listening_hash[32U] ; atomic_t bsockets ; }; struct net_lro_stats { unsigned long aggregated ; unsigned long flushed ; unsigned long no_desc ; }; struct net_lro_desc { struct sk_buff *parent ; struct sk_buff *last_skb ; struct skb_frag_struct *next_frag ; struct iphdr *iph ; struct tcphdr *tcph ; __wsum data_csum ; __be32 tcp_rcv_tsecr ; __be32 tcp_rcv_tsval ; __be32 tcp_ack ; u32 tcp_next_seq ; u32 skb_tot_frags_len ; u16 ip_tot_len ; u16 tcp_saw_tstamp ; __be16 tcp_window ; int pkt_aggr_cnt ; int vlan_packet ; int mss ; int active ; }; struct net_lro_mgr { struct net_device *dev ; struct net_lro_stats stats ; unsigned long features ; u32 ip_summed ; u32 ip_summed_aggr ; int max_desc ; int max_aggr ; int frag_align_pad ; struct net_lro_desc *lro_arr ; int (*get_skb_header)(struct sk_buff * , void ** , void ** , u64 * , void * ) ; int (*get_frag_header)(struct skb_frag_struct * , void ** , void ** , void ** , u64 * , void * ) ; }; struct nes_device; struct nes_hw_nic_sq_wqe { __le32 wqe_words[16U] ; }; struct nes_hw_nic_rq_wqe { __le32 wqe_words[16U] ; }; struct nes_hw_nic_cqe { __le32 cqe_words[4U] ; }; struct nes_hw_cqp_wqe { __le32 wqe_words[16U] ; }; struct nes_hw_qp_wqe { __le32 wqe_words[32U] ; }; struct nes_hw_cqe { __le32 cqe_words[8U] ; }; struct nes_hw_ceqe { __le32 ceqe_words[2U] ; }; struct nes_hw_aeqe { __le32 aeqe_words[4U] ; }; union __anonunion_ldv_52469_275 { u64 cqp_callback_context ; void *cqp_callback_pointer ; }; struct nes_cqp_request { union __anonunion_ldv_52469_275 ldv_52469 ; wait_queue_head_t waitq ; struct nes_hw_cqp_wqe cqp_wqe ; struct list_head list ; atomic_t refcount ; void (*cqp_callback)(struct nes_device * , struct nes_cqp_request * ) ; u16 major_code ; u16 minor_code ; u8 waiting ; u8 request_done ; u8 dynamic ; u8 callback ; }; struct nes_hw_cqp { struct nes_hw_cqp_wqe *sq_vbase ; dma_addr_t sq_pbase ; spinlock_t lock ; wait_queue_head_t waitq ; u16 qp_id ; u16 sq_head ; u16 sq_tail ; u16 sq_size ; }; struct nes_first_frag { u8 buffer[128U] ; }; struct nes_hw_nic { struct nes_first_frag *first_frag_vbase ; struct nes_hw_nic_sq_wqe *sq_vbase ; struct nes_hw_nic_rq_wqe *rq_vbase ; struct sk_buff *tx_skb[512U] ; struct sk_buff *rx_skb[512U] ; dma_addr_t frag_paddr[512U] ; unsigned long first_frag_overflow[8U] ; dma_addr_t sq_pbase ; dma_addr_t rq_pbase ; u16 qp_id ; u16 sq_head ; u16 sq_tail ; u16 sq_size ; u16 rq_head ; u16 rq_tail ; u16 rq_size ; u8 replenishing_rq ; u8 reserved ; spinlock_t rq_lock ; }; struct nes_hw_nic_cq { struct nes_hw_nic_cqe volatile *cq_vbase ; void (*ce_handler)(struct nes_device * , struct nes_hw_nic_cq * ) ; dma_addr_t cq_pbase ; int rx_cqes_completed ; int cqe_allocs_pending ; int rx_pkts_indicated ; u16 cq_head ; u16 cq_size ; u16 cq_number ; u8 cqes_pending ; }; struct nes_hw_qp { struct nes_hw_qp_wqe *sq_vbase ; struct nes_hw_qp_wqe *rq_vbase ; void *q2_vbase ; dma_addr_t sq_pbase ; dma_addr_t rq_pbase ; dma_addr_t q2_pbase ; u32 qp_id ; u16 sq_head ; u16 sq_tail ; u16 sq_size ; u16 rq_head ; u16 rq_tail ; u16 rq_size ; u8 rq_encoded_size ; u8 sq_encoded_size ; }; struct nes_hw_cq { struct nes_hw_cqe *cq_vbase ; void (*ce_handler)(struct nes_device * , struct nes_hw_cq * ) ; dma_addr_t cq_pbase ; u16 cq_head ; u16 cq_size ; u16 cq_number ; }; struct nes_hw_ceq { struct nes_hw_ceqe volatile *ceq_vbase ; dma_addr_t ceq_pbase ; u16 ceq_head ; u16 ceq_size ; }; struct nes_hw_aeq { struct nes_hw_aeqe volatile *aeq_vbase ; dma_addr_t aeq_pbase ; u16 aeq_head ; u16 aeq_size ; }; struct nes_arp_entry { u32 ip_addr ; u8 mac_addr[6U] ; }; struct nes_hw_tune_timer { u16 threshold_low ; u16 threshold_target ; u16 threshold_high ; u16 timer_in_use ; u16 timer_in_use_old ; u16 timer_in_use_min ; u16 timer_in_use_max ; u8 timer_direction_upward ; u8 timer_direction_downward ; u16 cq_count_old ; u8 cq_direction_downward ; }; struct nes_qp; struct nes_adapter { u64 fw_ver ; unsigned long *allocated_qps ; unsigned long *allocated_cqs ; unsigned long *allocated_mrs ; unsigned long *allocated_pds ; unsigned long *allocated_arps ; struct nes_qp **qp_table ; struct workqueue_struct *work_q ; struct list_head list ; struct list_head active_listeners ; struct list_head nesvnic_list[4U] ; struct timer_list mh_timer ; struct timer_list lc_timer ; struct work_struct work ; spinlock_t resource_lock ; spinlock_t phy_lock ; spinlock_t pbl_lock ; spinlock_t periodic_timer_lock ; struct nes_arp_entry arp_table[4096U] ; struct nes_hw_ceq ceq[16U] ; struct nes_hw_aeq aeq[8U] ; struct nes_hw_tune_timer tune_timer ; unsigned long doorbell_start ; u32 hw_rev ; u32 vendor_id ; u32 vendor_part_id ; u32 device_cap_flags ; u32 tick_delta ; u32 timer_int_req ; u32 arp_table_size ; u32 next_arp_index ; u32 max_mr ; u32 max_256pbl ; u32 max_4kpbl ; u32 free_256pbl ; u32 free_4kpbl ; u32 max_mr_size ; u32 max_qp ; u32 next_qp ; u32 max_irrq ; u32 max_qp_wr ; u32 max_sge ; u32 max_cq ; u32 next_cq ; u32 max_cqe ; u32 max_pd ; u32 base_pd ; u32 next_pd ; u32 hte_index_mask ; u32 rx_pool_size ; u32 tx_pool_size ; u32 rx_threshold ; u32 tcp_timer_core_clk_divisor ; u32 iwarp_config ; u32 cm_config ; u32 sws_timer_config ; u32 tcp_config1 ; u32 wqm_wat ; u32 core_clock ; u32 firmware_version ; u32 eeprom_version ; u32 nic_rx_eth_route_err ; u32 et_rx_coalesce_usecs ; u32 et_rx_max_coalesced_frames ; u32 et_rx_coalesce_usecs_irq ; u32 et_rx_max_coalesced_frames_irq ; u32 et_pkt_rate_low ; u32 et_rx_coalesce_usecs_low ; u32 et_rx_max_coalesced_frames_low ; u32 et_pkt_rate_high ; u32 et_rx_coalesce_usecs_high ; u32 et_rx_max_coalesced_frames_high ; u32 et_rate_sample_interval ; u32 timer_int_limit ; u32 wqm_quanta ; u8 allow_unaligned_fpdus ; u32 mac_addr_low ; u16 mac_addr_high ; u16 firmware_eeprom_offset ; u16 software_eeprom_offset ; u16 max_irrq_wr ; u16 pd_config_size[4U] ; u16 pd_config_base[4U] ; u16 link_interrupt_count[4U] ; u8 crit_error_count[32U] ; u8 phy_index[4U] ; u8 mac_sw_state[4U] ; u8 mac_link_down[4U] ; u8 phy_type[4U] ; u8 log_port ; unsigned int devfn ; unsigned char bus_number ; unsigned char OneG_Mode ; unsigned char ref_count ; u8 netdev_count ; u8 netdev_max ; u8 port_count ; u8 virtwq ; u8 send_term_ok ; u8 et_use_adaptive_rx_coalesce ; u8 adapter_fcn_count ; u8 pft_mcast_map[48U] ; }; struct nes_vnic; struct nes_ib_device; struct nes_ucontext; struct nes_vnic_mgt; struct nes_vnic { struct nes_ib_device *nesibdev ; u64 sq_full ; u64 tso_requests ; u64 segmented_tso_requests ; u64 linearized_skbs ; u64 tx_sw_dropped ; u64 endnode_nstat_rx_discard ; u64 endnode_nstat_rx_octets ; u64 endnode_nstat_rx_frames ; u64 endnode_nstat_tx_octets ; u64 endnode_nstat_tx_frames ; u64 endnode_ipv4_tcp_retransmits ; struct nes_device *nesdev ; struct net_device *netdev ; atomic_t rx_skbs_needed ; atomic_t rx_skb_timer_running ; int budget ; u32 msg_enable ; __be32 local_ipaddr ; struct napi_struct napi ; spinlock_t tx_lock ; struct timer_list rq_wqes_timer ; u32 nic_mem_size ; void *nic_vbase ; dma_addr_t nic_pbase ; struct nes_hw_nic nic ; struct nes_hw_nic_cq nic_cq ; u32 mcrq_qp_id ; struct nes_ucontext *mcrq_ucontext ; struct nes_cqp_request *(*get_cqp_request)(struct nes_device * ) ; void (*post_cqp_request)(struct nes_device * , struct nes_cqp_request * ) ; int (*mcrq_mcast_filter)(struct nes_vnic * , __u8 * ) ; struct net_device_stats netstats ; struct list_head list ; u16 max_frame_size ; u8 netdev_open ; u8 linkup ; u8 logical_port ; u8 netdev_index ; u8 perfect_filter_index ; u8 nic_index ; u8 qp_nic_index[4U] ; u8 next_qp_nic_index ; u8 of_device_registered ; u8 rdma_enabled ; u32 lro_max_aggr ; struct net_lro_mgr lro_mgr ; struct net_lro_desc lro_desc[32U] ; struct timer_list event_timer ; enum ib_event_type delayed_event ; enum ib_event_type last_dispatched_event ; spinlock_t port_ibevent_lock ; u32 mgt_mem_size ; void *mgt_vbase ; dma_addr_t mgt_pbase ; struct nes_vnic_mgt *mgtvnic[4U] ; struct task_struct *mgt_thread ; wait_queue_head_t mgt_wait_queue ; struct sk_buff_head mgt_skb_list ; }; struct nes_ib_device { struct ib_device ibdev ; struct nes_vnic *nesvnic ; u32 max_mr ; u32 max_qp ; u32 max_cq ; u32 max_pd ; u32 num_mr ; u32 num_qp ; u32 num_cq ; u32 num_pd ; }; struct nes_ucontext { struct ib_ucontext ibucontext ; struct nes_device *nesdev ; unsigned long mmap_wq_offset ; unsigned long mmap_cq_offset ; int index ; unsigned long allocated_doorbells[64U] ; u16 mmap_db_index[4096U] ; u16 first_free_db ; unsigned long allocated_wqs[64U] ; struct nes_qp *mmap_nesqp[4096U] ; u16 first_free_wq ; struct list_head cq_reg_mem_list ; struct list_head qp_reg_mem_list ; u32 mcrqf ; atomic_t usecnt ; }; struct nes_pd { struct ib_pd ibpd ; u16 pd_id ; atomic_t sqp_count ; u16 mmap_db_index ; }; struct nes_cq { struct ib_cq ibcq ; struct nes_hw_cq hw_cq ; u32 polled_completions ; u32 cq_mem_size ; spinlock_t lock ; u8 virtual_cq ; u8 pad[3U] ; u32 mcrqf ; }; struct nes_qp_context; struct nes_qp { struct ib_qp ibqp ; void *allocated_buffer ; struct iw_cm_id *cm_id ; struct nes_cq *nesscq ; struct nes_cq *nesrcq ; struct nes_pd *nespd ; void *cm_node ; void *ietf_frame ; u8 ietf_frame_size ; dma_addr_t ietf_frame_pbase ; struct ib_mr *lsmm_mr ; struct nes_hw_qp hwqp ; struct work_struct work ; enum ib_qp_state ibqp_state ; u32 iwarp_state ; u32 hte_index ; u32 last_aeq ; u32 qp_mem_size ; atomic_t refcount ; atomic_t close_timer_started ; u32 mmap_sq_db_index ; u32 mmap_rq_db_index ; spinlock_t lock ; spinlock_t pau_lock ; struct nes_qp_context *nesqp_context ; dma_addr_t nesqp_context_pbase ; void *pbl_vbase ; dma_addr_t pbl_pbase ; struct page *page ; struct timer_list terminate_timer ; enum ib_event_type terminate_eventtype ; struct sk_buff_head pau_list ; u32 pau_rcv_nxt ; unsigned char active_conn : 1 ; unsigned char skip_lsmm : 1 ; unsigned char user_mode : 1 ; unsigned char hte_added : 1 ; unsigned char flush_issued : 1 ; unsigned char destroyed : 1 ; unsigned char sig_all : 1 ; unsigned char pau_mode : 1 ; unsigned char rsvd ; u16 private_data_len ; u16 term_sq_flush_code ; u16 term_rq_flush_code ; u8 hw_iwarp_state ; u8 hw_tcp_state ; u8 term_flags ; u8 sq_kmapped ; u8 pau_busy ; u8 pau_pending ; u8 pau_state ; }; struct nes_qp_context { __le32 misc ; __le32 cqs ; __le32 sq_addr_low ; __le32 sq_addr_high ; __le32 rq_addr_low ; __le32 rq_addr_high ; __le32 misc2 ; __le16 tcpPorts[2U] ; __le32 ip0 ; __le32 ip1 ; __le32 ip2 ; __le32 ip3 ; __le32 mss ; __le32 arp_index_vlan ; __le32 tcp_state_flow_label ; __le32 pd_index_wscale ; __le32 keepalive ; u32 ts_recent ; u32 ts_age ; __le32 snd_nxt ; __le32 snd_wnd ; __le32 rcv_nxt ; __le32 rcv_wnd ; __le32 snd_max ; __le32 snd_una ; u32 srtt ; __le32 rttvar ; __le32 ssthresh ; __le32 cwnd ; __le32 snd_wl1 ; __le32 snd_wl2 ; __le32 max_snd_wnd ; __le32 ts_val_delta ; u32 retransmit ; u32 probe_cnt ; u32 hte_index ; __le32 q2_addr_low ; __le32 q2_addr_high ; __le32 ird_index ; u32 Rsvd3 ; __le32 ird_ord_sizes ; u32 mrkr_offset ; __le32 aeq_token_low ; __le32 aeq_token_high ; }; struct nes_hw_mgt { struct nes_hw_nic_rq_wqe *rq_vbase ; dma_addr_t rq_pbase ; struct sk_buff *rx_skb[512U] ; u16 qp_id ; u16 sq_head ; u16 rq_head ; u16 rq_tail ; u16 rq_size ; u8 replenishing_rq ; u8 reserved ; spinlock_t rq_lock ; }; struct nes_vnic_mgt { struct nes_vnic *nesvnic ; struct nes_hw_mgt mgt ; struct nes_hw_nic_cq mgt_cq ; atomic_t rx_skbs_needed ; struct timer_list rq_wqes_timer ; atomic_t rx_skb_timer_running ; }; struct nes_device { struct nes_adapter *nesadapter ; void *regs ; void *index_reg ; struct pci_dev *pcidev ; struct net_device *netdev[16U] ; u64 link_status_interrupts ; struct tasklet_struct dpc_tasklet ; spinlock_t indexed_regs_lock ; unsigned long csr_start ; unsigned long doorbell_region ; unsigned long doorbell_start ; unsigned long mac_tx_errors ; unsigned long mac_pause_frames_sent ; unsigned long mac_pause_frames_received ; unsigned long mac_rx_errors ; unsigned long mac_rx_crc_errors ; unsigned long mac_rx_symbol_err_frames ; unsigned long mac_rx_jabber_frames ; unsigned long mac_rx_oversized_frames ; unsigned long mac_rx_short_frames ; unsigned long port_rx_discards ; unsigned long port_tx_discards ; unsigned int mac_index ; unsigned int nes_stack_start ; void *cqp_vbase ; dma_addr_t cqp_pbase ; u32 cqp_mem_size ; u8 ceq_index ; u8 nic_ceq_index ; struct nes_hw_cqp cqp ; struct nes_hw_cq ccq ; struct list_head cqp_avail_reqs ; struct list_head cqp_pending_reqs ; struct nes_cqp_request *nes_cqp_requests ; u32 int_req ; u32 int_stat ; u32 timer_int_req ; u32 timer_only_int_count ; u32 intf_int_req ; u32 last_mac_tx_pauses ; u32 last_used_chunks_tx ; struct list_head list ; u16 base_doorbell_index ; u16 currcq_count ; u16 deepcq_count ; u8 iw_status ; u8 msi_enabled ; u8 netdev_count ; u8 napi_isr_ran ; u8 disable_rx_flow_control ; u8 disable_tx_flow_control ; struct delayed_work work ; u8 link_recheck ; }; struct fib_rule_hdr { __u8 family ; __u8 dst_len ; __u8 src_len ; __u8 tos ; __u8 table ; __u8 res1 ; __u8 res2 ; __u8 action ; __u32 flags ; }; struct fib_rule { struct list_head list ; atomic_t refcnt ; int iifindex ; int oifindex ; u32 mark ; u32 mark_mask ; u32 pref ; u32 flags ; u32 table ; u8 action ; u32 target ; struct fib_rule *ctarget ; char iifname[16U] ; char oifname[16U] ; struct callback_head rcu ; struct net *fr_net ; }; struct fib_lookup_arg { void *lookup_ptr ; void *result ; struct fib_rule *rule ; int flags ; }; struct fib_rules_ops { int family ; struct list_head list ; int rule_size ; int addr_size ; int unresolved_rules ; int nr_goto_rules ; int (*action)(struct fib_rule * , struct flowi * , int , struct fib_lookup_arg * ) ; int (*match)(struct fib_rule * , struct flowi * , int ) ; int (*configure)(struct fib_rule * , struct sk_buff * , struct fib_rule_hdr * , struct nlattr ** ) ; void (*delete)(struct fib_rule * ) ; int (*compare)(struct fib_rule * , struct fib_rule_hdr * , struct nlattr ** ) ; int (*fill)(struct fib_rule * , struct sk_buff * , struct fib_rule_hdr * ) ; u32 (*default_pref)(struct fib_rules_ops * ) ; size_t (*nlmsg_payload)(struct fib_rule * ) ; void (*flush_cache)(struct fib_rules_ops * ) ; int nlgroup ; struct nla_policy const *policy ; struct list_head rules_list ; struct module *owner ; struct net *fro_net ; struct callback_head rcu ; }; struct fib_table { struct hlist_node tb_hlist ; u32 tb_id ; int tb_default ; int tb_num_default ; unsigned long tb_data[0U] ; }; typedef int ldv_func_ret_type___2; typedef int ldv_func_ret_type___6; typedef __kernel_long_t __kernel_suseconds_t; struct timeval { __kernel_time_t tv_sec ; __kernel_suseconds_t tv_usec ; }; struct __wait_queue; typedef struct __wait_queue wait_queue_t; struct __wait_queue { unsigned int flags ; void *private ; int (*func)(wait_queue_t * , unsigned int , int , void * ) ; struct list_head task_list ; }; enum hrtimer_restart; struct nes_hw_nic_qp_context { __le32 context_words[6U] ; }; struct nes_hw_cqp_qp_context { __le32 context_words[4U] ; }; struct nes_terminate_hdr { u8 layer_etype ; u8 error_code ; u8 hdrct ; u8 rsvd ; }; struct ietf_mpa_v1 { u8 key[16U] ; u8 flags ; u8 rev ; __be16 priv_data_len ; u8 priv_data[0U] ; }; struct ietf_rtr_msg { __be16 ctrl_ird ; __be16 ctrl_ord ; }; struct ietf_mpa_v2 { u8 key[16U] ; u8 flags ; u8 rev ; __be16 priv_data_len ; struct ietf_rtr_msg rtr_msg ; u8 priv_data[0U] ; }; struct nes_cm_node; enum nes_timer_type { NES_TIMER_TYPE_SEND = 0, NES_TIMER_TYPE_RECV = 1, NES_TIMER_NODE_CLEANUP = 2, NES_TIMER_TYPE_CLOSE = 3 } ; struct nes_timer_entry { struct list_head list ; unsigned long timetosend ; struct sk_buff *skb ; u32 type ; u32 retrycount ; u32 retranscount ; u32 context ; u32 seq_num ; u32 send_retrans ; int close_when_complete ; struct net_device *netdev ; }; typedef u32 nes_addr_t; enum nes_cm_node_state { NES_CM_STATE_UNKNOWN = 0, NES_CM_STATE_INITED = 1, NES_CM_STATE_LISTENING = 2, NES_CM_STATE_SYN_RCVD = 3, NES_CM_STATE_SYN_SENT = 4, NES_CM_STATE_ONE_SIDE_ESTABLISHED = 5, NES_CM_STATE_ESTABLISHED = 6, NES_CM_STATE_ACCEPTING = 7, NES_CM_STATE_MPAREQ_SENT = 8, NES_CM_STATE_MPAREQ_RCVD = 9, NES_CM_STATE_MPAREJ_RCVD = 10, NES_CM_STATE_TSA = 11, NES_CM_STATE_FIN_WAIT1 = 12, NES_CM_STATE_FIN_WAIT2 = 13, NES_CM_STATE_CLOSE_WAIT = 14, NES_CM_STATE_TIME_WAIT = 15, NES_CM_STATE_LAST_ACK = 16, NES_CM_STATE_CLOSING = 17, NES_CM_STATE_LISTENER_DESTROYED = 18, NES_CM_STATE_CLOSED = 19 } ; enum mpa_frame_version { IETF_MPA_V1 = 1, IETF_MPA_V2 = 2 } ; enum send_rdma0 { SEND_RDMA_READ_ZERO = 1, SEND_RDMA_WRITE_ZERO = 2 } ; enum nes_cm_conn_type { NES_CM_IWARP_CONN_TYPE = 0 } ; struct nes_cm_tcp_context { u8 client ; u32 loc_seq_num ; u32 loc_ack_num ; u32 rem_ack_num ; u32 rcv_nxt ; u32 loc_id ; u32 rem_id ; u32 snd_wnd ; u32 max_snd_wnd ; u32 rcv_wnd ; u32 mss ; u8 snd_wscale ; u8 rcv_wscale ; struct nes_qp_context tsa_cntxt ; struct timeval sent_ts ; }; enum nes_cm_listener_state { NES_CM_LISTENER_PASSIVE_STATE = 1, NES_CM_LISTENER_ACTIVE_STATE = 2, NES_CM_LISTENER_EITHER_STATE = 3 } ; struct nes_cm_core; struct nes_cm_listener { struct list_head list ; struct nes_cm_core *cm_core ; u8 loc_mac[6U] ; nes_addr_t loc_addr ; u16 loc_port ; struct iw_cm_id *cm_id ; enum nes_cm_conn_type conn_type ; atomic_t ref_count ; struct nes_vnic *nesvnic ; atomic_t pend_accepts_cnt ; int backlog ; enum nes_cm_listener_state listener_state ; u32 reused_node ; }; union __anonunion_ldv_52906_277 { struct ietf_mpa_v1 mpa_frame ; struct ietf_mpa_v2 mpa_v2_frame ; u8 mpa_frame_buf[536U] ; }; struct nes_cm_node { nes_addr_t loc_addr ; nes_addr_t rem_addr ; u16 loc_port ; u16 rem_port ; u8 loc_mac[6U] ; u8 rem_mac[6U] ; enum nes_cm_node_state state ; struct nes_cm_tcp_context tcp_cntxt ; struct nes_cm_core *cm_core ; struct sk_buff_head resend_list ; atomic_t ref_count ; struct net_device *netdev ; struct nes_cm_node *loopbackpartner ; struct nes_timer_entry *send_entry ; struct nes_timer_entry *recv_entry ; spinlock_t retrans_list_lock ; enum send_rdma0 send_rdma0_op ; union __anonunion_ldv_52906_277 ldv_52906 ; enum mpa_frame_version mpa_frame_rev ; u16 ird_size ; u16 ord_size ; u16 mpa_frame_size ; struct iw_cm_id *cm_id ; struct list_head list ; int accelerated ; struct nes_cm_listener *listener ; enum nes_cm_conn_type conn_type ; struct nes_vnic *nesvnic ; int apbvt_set ; int accept_pend ; struct list_head timer_entry ; struct list_head reset_entry ; struct nes_qp *nesqp ; atomic_t passive_state ; }; union __anonunion_ldv_52927_278 { struct iw_cm_id *cm_id ; struct net_device *netdev ; }; struct nes_cm_info { union __anonunion_ldv_52927_278 ldv_52927 ; u16 loc_port ; u16 rem_port ; nes_addr_t loc_addr ; nes_addr_t rem_addr ; enum nes_cm_conn_type conn_type ; int backlog ; }; enum nes_cm_event_type { NES_CM_EVENT_UNKNOWN = 0, NES_CM_EVENT_ESTABLISHED = 1, NES_CM_EVENT_MPA_REQ = 2, NES_CM_EVENT_MPA_CONNECT = 3, NES_CM_EVENT_MPA_ACCEPT = 4, NES_CM_EVENT_MPA_REJECT = 5, NES_CM_EVENT_MPA_ESTABLISHED = 6, NES_CM_EVENT_CONNECTED = 7, NES_CM_EVENT_CLOSED = 8, NES_CM_EVENT_RESET = 9, NES_CM_EVENT_DROPPED_PKT = 10, NES_CM_EVENT_CLOSE_IMMED = 11, NES_CM_EVENT_CLOSE_HARD = 12, NES_CM_EVENT_CLOSE_CLEAN = 13, NES_CM_EVENT_ABORTED = 14, NES_CM_EVENT_SEND_FIRST = 15 } ; struct nes_cm_event { enum nes_cm_event_type type ; struct nes_cm_info cm_info ; struct work_struct event_work ; struct nes_cm_node *cm_node ; }; struct nes_cm_ops; struct nes_cm_core { enum nes_cm_node_state state ; atomic_t listen_node_cnt ; struct nes_cm_node listen_list ; spinlock_t listen_list_lock ; u32 mtu ; u32 free_tx_pkt_max ; u32 rx_pkt_posted ; atomic_t ht_node_cnt ; struct list_head connected_nodes ; spinlock_t ht_lock ; struct timer_list tcp_timer ; struct nes_cm_ops *api ; int (*post_event)(struct nes_cm_event * ) ; atomic_t events_posted ; struct workqueue_struct *event_wq ; struct workqueue_struct *disconn_wq ; atomic_t node_cnt ; u64 aborted_connects ; u32 options ; struct nes_cm_node *current_listen_node ; }; struct nes_cm_ops { int (*accelerated)(struct nes_cm_core * , struct nes_cm_node * ) ; struct nes_cm_listener *(*listen)(struct nes_cm_core * , struct nes_vnic * , struct nes_cm_info * ) ; int (*stop_listener)(struct nes_cm_core * , struct nes_cm_listener * ) ; struct nes_cm_node *(*connect)(struct nes_cm_core * , struct nes_vnic * , u16 , void * , struct nes_cm_info * ) ; int (*close)(struct nes_cm_core * , struct nes_cm_node * ) ; int (*accept)(struct nes_cm_core * , struct nes_cm_node * ) ; int (*reject)(struct nes_cm_core * , struct nes_cm_node * ) ; int (*recv_pkt)(struct nes_cm_core * , struct nes_vnic * , struct sk_buff * ) ; int (*destroy_cm_core)(struct nes_cm_core * ) ; int (*get)(struct nes_cm_core * ) ; int (*set)(struct nes_cm_core * , u32 , u32 ) ; }; struct nes_rskb_cb { u64 busaddr ; u32 maplen ; u32 seqnum ; u8 *data_start ; struct nes_qp *nesqp ; }; enum hrtimer_restart; typedef struct skb_frag_struct skb_frag_t; struct skb_shared_hwtstamps { ktime_t hwtstamp ; ktime_t syststamp ; }; struct skb_shared_info { unsigned char nr_frags ; __u8 tx_flags ; unsigned short gso_size ; unsigned short gso_segs ; unsigned short gso_type ; struct sk_buff *frag_list ; struct skb_shared_hwtstamps hwtstamps ; __be32 ip6_frag_id ; atomic_t dataref ; void *destructor_arg ; skb_frag_t frags[17U] ; }; struct netdev_hw_addr { struct list_head list ; unsigned char addr[32U] ; unsigned char type ; bool synced ; bool global_use ; int refcount ; struct callback_head callback_head ; }; struct nic_qp_map { u8 qpid ; u8 nic_index ; u8 logical_port ; u8 is_hnic ; }; enum hrtimer_restart; enum nes_resource { NES_RESOURCE_MW = 1, NES_RESOURCE_FAST_MR = 2, NES_RESOURCE_PHYS_MR = 3, NES_RESOURCE_USER_MR = 4, NES_RESOURCE_PD = 5, NES_RESOURCE_QP = 6, NES_RESOURCE_CQ = 7, NES_RESOURCE_ARP = 8 } ; typedef __u64 __le64; typedef unsigned int uint; struct cpuinfo_x86; struct cpuinfo_x86 { __u8 x86 ; __u8 x86_vendor ; __u8 x86_model ; __u8 x86_mask ; int x86_tlbsize ; __u8 x86_virt_bits ; __u8 x86_phys_bits ; __u8 x86_coreid_bits ; __u32 extended_cpuid_level ; int cpuid_level ; __u32 x86_capability[10U] ; char x86_vendor_id[16U] ; char x86_model_id[64U] ; int x86_cache_size ; int x86_cache_alignment ; int x86_power ; unsigned long loops_per_jiffy ; u16 x86_max_cores ; u16 apicid ; u16 initial_apicid ; u16 x86_clflush_size ; u16 booted_cores ; u16 phys_proc_id ; u16 cpu_core_id ; u8 compute_unit_id ; u16 cpu_index ; u32 microcode ; }; enum hrtimer_restart; struct nes_pbl { u64 *pbl_vbase ; dma_addr_t pbl_pbase ; struct page *page ; unsigned long user_base ; u32 pbl_size ; struct list_head list ; }; struct nes_fast_mr_wqe_pbl { u64 *kva ; dma_addr_t paddr ; }; struct nes_ib_fast_reg_page_list { struct ib_fast_reg_page_list ibfrpl ; struct nes_fast_mr_wqe_pbl nes_wqe_pbl ; u64 pbl ; }; union __anonunion_ldv_53249_282 { struct ib_mr ibmr ; struct ib_mw ibmw ; struct ib_fmr ibfmr ; }; struct ib_umem; struct nes_mr { union __anonunion_ldv_53249_282 ldv_53249 ; struct ib_umem *region ; u16 pbls_used ; u8 mode ; u8 pbl_4k ; }; struct nes_hw_pb { __le32 pa_low ; __le32 pa_high ; }; struct nes_vpbl { dma_addr_t pbl_pbase ; struct nes_hw_pb *pbl_vbase ; }; struct nes_root_vpbl { dma_addr_t pbl_pbase ; struct nes_hw_pb *pbl_vbase ; struct nes_vpbl *leaf_vpbl ; }; struct nes_alloc_ucontext_req { __u32 reserved32 ; __u8 userspace_ver ; __u8 reserved8[3U] ; }; struct nes_alloc_ucontext_resp { __u32 max_pds ; __u32 max_qps ; __u32 wq_size ; __u8 virtwq ; __u8 kernel_ver ; __u8 reserved[2U] ; }; struct nes_alloc_pd_resp { __u32 pd_id ; __u32 mmap_db_index ; }; struct nes_create_cq_req { __u64 user_cq_buffer ; __u32 mcrqf ; __u8 reserved[4U] ; }; struct nes_create_qp_req { __u64 user_wqe_buffers ; }; struct nes_mem_reg_req { __u32 reg_type ; __u32 reserved ; }; struct nes_create_cq_resp { __u32 cq_id ; __u32 cq_size ; __u32 mmap_db_index ; __u32 reserved ; }; struct nes_create_qp_resp { __u32 qp_id ; __u32 actual_sq_size ; __u32 actual_rq_size ; __u32 mmap_sq_db_index ; __u32 mmap_rq_db_index ; __u32 nes_drv_opt ; }; struct ib_umem { struct ib_ucontext *context ; size_t length ; int offset ; int page_size ; int writable ; int hugetlb ; struct list_head chunk_list ; struct work_struct work ; struct mm_struct *mm ; unsigned long diff ; }; struct ib_umem_chunk { struct list_head list ; int nents ; int nmap ; struct scatterlist page_list[0U] ; }; struct exec_domain; struct map_segment; struct exec_domain { char const *name ; void (*handler)(int , struct pt_regs * ) ; unsigned char pers_low ; unsigned char pers_high ; unsigned long *signal_map ; unsigned long *signal_invmap ; struct map_segment *err_map ; struct map_segment *socktype_map ; struct map_segment *sockopt_map ; struct map_segment *af_map ; struct module *module ; struct exec_domain *next ; }; struct __anonstruct_mm_segment_t_27 { unsigned long seg ; }; typedef struct __anonstruct_mm_segment_t_27 mm_segment_t; struct compat_timespec; struct __anonstruct_futex_32 { u32 *uaddr ; u32 val ; u32 flags ; u32 bitset ; u64 time ; u32 *uaddr2 ; }; struct __anonstruct_nanosleep_33 { clockid_t clockid ; struct timespec *rmtp ; struct compat_timespec *compat_rmtp ; u64 expires ; }; struct pollfd; struct __anonstruct_poll_34 { struct pollfd *ufds ; int nfds ; int has_timeout ; unsigned long tv_sec ; unsigned long tv_nsec ; }; union __anonunion_ldv_6135_31 { struct __anonstruct_futex_32 futex ; struct __anonstruct_nanosleep_33 nanosleep ; struct __anonstruct_poll_34 poll ; }; struct restart_block { long (*fn)(struct restart_block * ) ; union __anonunion_ldv_6135_31 ldv_6135 ; }; struct thread_info { struct task_struct *task ; struct exec_domain *exec_domain ; __u32 flags ; __u32 status ; __u32 cpu ; int preempt_count ; mm_segment_t addr_limit ; struct restart_block restart_block ; void *sysenter_return ; unsigned char sig_on_uaccess_error : 1 ; unsigned char uaccess_err : 1 ; }; enum hrtimer_restart; typedef s32 compat_time_t; struct compat_timespec { compat_time_t tv_sec ; s32 tv_nsec ; }; struct pollfd { int fd ; short events ; short revents ; }; struct disconn_work { struct work_struct work ; struct nes_qp *nesqp ; }; struct nes_v4_quad { u32 rsvd0 ; __le32 DstIpAdrIndex ; __be32 SrcIpadr ; __be16 TcpPorts[2U] ; }; struct option_base { u8 optionnum ; u8 length ; }; struct option_mss { u8 optionnum ; u8 length ; __be16 mss ; }; struct option_windowscale { u8 optionnum ; u8 length ; u8 shiftcount ; }; union all_known_options { char as_end ; struct option_base as_base ; struct option_mss as_mss ; struct option_windowscale as_windowscale ; }; enum nes_tcpip_pkt_type { NES_PKT_TYPE_UNKNOWN = 0, NES_PKT_TYPE_SYN = 1, NES_PKT_TYPE_SYNACK = 2, NES_PKT_TYPE_ACK = 3, NES_PKT_TYPE_FIN = 4, NES_PKT_TYPE_RST = 5 } ; enum hrtimer_restart; struct pau_fpdu_frag { struct sk_buff *skb ; u64 physaddr ; u32 frag_len ; bool cmplt ; }; struct pau_fpdu_info { struct nes_qp *nesqp ; struct nes_cqp_request *cqp_request ; void *hdr_vbase ; dma_addr_t hdr_pbase ; int hdr_len ; u16 data_len ; u16 frag_cnt ; struct pau_fpdu_frag frags[4U] ; }; struct pau_qh_chg { struct nes_device *nesdev ; struct nes_vnic *nesvnic ; struct nes_qp *nesqp ; }; long ldv__builtin_expect(long exp , long c ) ; __inline static void set_bit(unsigned int nr , unsigned long volatile *addr ) { { __asm__ volatile (".pushsection .smp_locks,\"a\"\n.balign 4\n.long 671f - .\n.popsection\n671:\n\tlock; bts %1,%0": "+m" (*((long volatile *)addr)): "Ir" (nr): "memory"); return; } } __inline static void clear_bit(int nr , unsigned long volatile *addr ) { { __asm__ volatile (".pushsection .smp_locks,\"a\"\n.balign 4\n.long 671f - .\n.popsection\n671:\n\tlock; btr %1,%0": "+m" (*((long volatile *)addr)): "Ir" (nr)); return; } } __inline static int test_and_set_bit(int nr , unsigned long volatile *addr ) { int oldbit ; { __asm__ volatile (".pushsection .smp_locks,\"a\"\n.balign 4\n.long 671f - .\n.popsection\n671:\n\tlock; bts %2,%1\n\tsbb %0,%0": "=r" (oldbit), "+m" (*((long volatile *)addr)): "Ir" (nr): "memory"); return (oldbit); } } __inline static __u32 __arch_swab32(__u32 val ) { { __asm__ ("bswapl %0": "=r" (val): "0" (val)); return (val); } } __inline static __u32 __fswab32(__u32 val ) { __u32 tmp ; { tmp = __arch_swab32(val); return (tmp); } } extern int printk(char const * , ...) ; extern int kstrtoull(char const * , unsigned int , unsigned long long * ) ; __inline static int kstrtoul(char const *s , unsigned int base , unsigned long *res ) { int tmp ; { tmp = kstrtoull(s, base, (unsigned long long *)res); return (tmp); } } extern unsigned long simple_strtoul(char const * , char ** , unsigned int ) ; extern int snprintf(char * , size_t , char const * , ...) ; __inline static void INIT_LIST_HEAD(struct list_head *list ) { { list->next = list; list->prev = list; return; } } extern void __list_add(struct list_head * , struct list_head * , struct list_head * ) ; __inline static void list_add_tail(struct list_head *new , struct list_head *head ) { { __list_add(new, head->prev, head); return; } } extern void list_del(struct list_head * ) ; extern struct pv_irq_ops pv_irq_ops ; extern __kernel_size_t strnlen(char const * , __kernel_size_t ) ; extern void warn_slowpath_null(char const * , int const ) ; __inline static unsigned long arch_local_save_flags(void) { unsigned long __ret ; unsigned long __edi ; unsigned long __esi ; unsigned long __edx ; unsigned long __ecx ; unsigned long __eax ; long tmp ; { __edi = __edi; __esi = __esi; __edx = __edx; __ecx = __ecx; __eax = __eax; tmp = ldv__builtin_expect((unsigned long )pv_irq_ops.save_fl.func == (unsigned long )((void *)0), 0L); if (tmp != 0L) { __asm__ volatile ("1:\tud2\n.pushsection __bug_table,\"a\"\n2:\t.long 1b - 2b, %c0 - 2b\n\t.word %c1, 0\n\t.org 2b+%c2\n.popsection": : "i" ((char *)"/home/zakharov/workspace/benchmarks/bench_1/inst/current/envs/linux-3.8-rc1/linux-3.8-rc1/arch/x86/include/asm/paravirt.h"), "i" (825), "i" (12UL)); ldv_4725: ; goto ldv_4725; } else { } __asm__ volatile ("771:\n\tcall *%c2;\n772:\n.pushsection .parainstructions,\"a\"\n .balign 8 \n .quad 771b\n .byte %c1\n .byte 772b-771b\n .short %c3\n.popsection\n": "=a" (__eax): [paravirt_typenum] "i" (45UL), [paravirt_opptr] "i" (& pv_irq_ops.save_fl.func), [paravirt_clobber] "i" (1): "memory", "cc"); __ret = __eax; return (__ret); } } __inline static int arch_irqs_disabled_flags(unsigned long flags ) { { return ((flags & 512UL) == 0UL); } } __inline static int atomic_read(atomic_t const *v ) { { return ((int )*((int volatile *)(& v->counter))); } } __inline static void atomic_inc(atomic_t *v ) { { __asm__ volatile (".pushsection .smp_locks,\"a\"\n.balign 4\n.long 671f - .\n.popsection\n671:\n\tlock; incl %0": "+m" (v->counter)); return; } } __inline static int atomic_dec_and_test(atomic_t *v ) { unsigned char c ; { __asm__ volatile (".pushsection .smp_locks,\"a\"\n.balign 4\n.long 671f - .\n.popsection\n671:\n\tlock; decl %0; sete %1": "+m" (v->counter), "=qm" (c): : "memory"); return ((unsigned int )c != 0U); } } extern void lockdep_init_map(struct lockdep_map * , char const * , struct lock_class_key * , int ) ; extern int mutex_trylock(struct mutex * ) ; int ldv_mutex_trylock_4(struct mutex *ldv_func_arg1 ) ; extern void mutex_unlock(struct mutex * ) ; void ldv_mutex_unlock_2(struct mutex *ldv_func_arg1 ) ; void ldv_mutex_unlock_5(struct mutex *ldv_func_arg1 ) ; void ldv_mutex_unlock_7(struct mutex *ldv_func_arg1 ) ; extern void mutex_lock(struct mutex * ) ; void ldv_mutex_lock_1(struct mutex *ldv_func_arg1 ) ; void ldv_mutex_lock_3(struct mutex *ldv_func_arg1 ) ; void ldv_mutex_lock_6(struct mutex *ldv_func_arg1 ) ; void ldv_mutex_lock_cred_guard_mutex_of_signal_struct(struct mutex *lock ) ; void ldv_mutex_unlock_cred_guard_mutex_of_signal_struct(struct mutex *lock ) ; void ldv_mutex_lock_lock(struct mutex *lock ) ; void ldv_mutex_unlock_lock(struct mutex *lock ) ; void ldv_mutex_lock_mutex_of_device(struct mutex *lock ) ; int ldv_mutex_trylock_mutex_of_device(struct mutex *lock ) ; void ldv_mutex_unlock_mutex_of_device(struct mutex *lock ) ; int ldv_state_variable_3 ; int ldv_state_variable_2 ; int ref_cnt ; extern int __VERIFIER_nondet_int(void) ; int ldv_state_variable_1 ; int ldv_state_variable_4 ; int ldv_state_variable_0 ; int ldv_state_variable_5 ; extern void __raw_spin_lock_init(raw_spinlock_t * , char const * , struct lock_class_key * ) ; extern unsigned long _raw_spin_lock_irqsave(raw_spinlock_t * ) ; extern void _raw_spin_unlock_irqrestore(raw_spinlock_t * , unsigned long ) ; __inline static raw_spinlock_t *spinlock_check(spinlock_t *lock ) { { return (& lock->ldv_5961.rlock); } } __inline static void spin_unlock_irqrestore(spinlock_t *lock , unsigned long flags ) { { _raw_spin_unlock_irqrestore(& lock->ldv_5961.rlock, flags); return; } } extern void init_timer_key(struct timer_list * , unsigned int , char const * , struct lock_class_key * ) ; extern void delayed_work_timer_fn(unsigned long ) ; extern void __init_work(struct work_struct * , int ) ; extern bool cancel_delayed_work_sync(struct delayed_work * ) ; __inline static unsigned int readl(void const volatile *addr ) { unsigned int ret ; { __asm__ volatile ("movl %1,%0": "=r" (ret): "m" (*((unsigned int volatile *)addr)): "memory"); return (ret); } } __inline static void writel(unsigned int val , void volatile *addr ) { { __asm__ volatile ("movl %0,%1": : "r" (val), "m" (*((unsigned int volatile *)addr)): "memory"); return; } } extern void *ioremap_nocache(resource_size_t , unsigned long ) ; extern void iounmap(void volatile * ) ; __inline static char const *kobject_name(struct kobject const *kobj ) { { return ((char const *)kobj->name); } } extern struct module __this_module ; extern int driver_create_file(struct device_driver * , struct driver_attribute const * ) ; extern void driver_remove_file(struct device_driver * , struct driver_attribute const * ) ; __inline static char const *dev_name(struct device const *dev ) { char const *tmp ; { if ((unsigned long )dev->init_name != (unsigned long )((char const */* const */)0)) { return ((char const *)dev->init_name); } else { } tmp = kobject_name(& dev->kobj); return (tmp); } } extern void *dev_get_drvdata(struct device const * ) ; extern int dev_set_drvdata(struct device * , void * ) ; extern void kfree(void const * ) ; extern void *__kmalloc(size_t , gfp_t ) ; __inline static void *kmalloc(size_t size , gfp_t flags ) { void *tmp___2 ; { tmp___2 = __kmalloc(size, flags); return (tmp___2); } } __inline static void *kzalloc(size_t size , gfp_t flags ) { void *tmp ; { tmp = kmalloc(size, flags | 32768U); return (tmp); } } extern void debug_dma_free_coherent(struct device * , size_t , void * , dma_addr_t ) ; extern struct dma_map_ops *dma_ops ; __inline static struct dma_map_ops *get_dma_ops(struct device *dev ) { long tmp ; { tmp = ldv__builtin_expect((unsigned long )dev == (unsigned long )((struct device *)0), 0L); if (tmp != 0L || (unsigned long )dev->archdata.dma_ops == (unsigned long )((struct dma_map_ops *)0)) { return (dma_ops); } else { return (dev->archdata.dma_ops); } } } extern int dma_supported(struct device * , u64 ) ; extern int dma_set_mask(struct device * , u64 ) ; __inline static void dma_free_attrs(struct device *dev , size_t size , void *vaddr , dma_addr_t bus , struct dma_attrs *attrs ) { struct dma_map_ops *ops ; struct dma_map_ops *tmp ; int __ret_warn_on ; unsigned long _flags ; int tmp___0 ; long tmp___1 ; { tmp = get_dma_ops(dev); ops = tmp; _flags = arch_local_save_flags(); tmp___0 = arch_irqs_disabled_flags(_flags); __ret_warn_on = tmp___0 != 0; tmp___1 = ldv__builtin_expect(__ret_warn_on != 0, 0L); if (tmp___1 != 0L) { warn_slowpath_null("/home/zakharov/workspace/benchmarks/bench_1/inst/current/envs/linux-3.8-rc1/linux-3.8-rc1/arch/x86/include/asm/dma-mapping.h", 166); } else { } ldv__builtin_expect(__ret_warn_on != 0, 0L); debug_dma_free_coherent(dev, size, vaddr, bus); if ((unsigned long )ops->free != (unsigned long )((void (*)(struct device * , size_t , void * , dma_addr_t , struct dma_attrs * ))0)) { (*(ops->free))(dev, size, vaddr, bus, attrs); } else { } return; } } __inline static int dma_set_coherent_mask(struct device *dev , u64 mask ) { int tmp ; { tmp = dma_supported(dev, mask); if (tmp == 0) { return (-5); } else { } dev->coherent_dma_mask = mask; return (0); } } __inline static struct netdev_queue *netdev_get_tx_queue(struct net_device const *dev , unsigned int index ) { { return ((struct netdev_queue *)dev->_tx + (unsigned long )index); } } __inline static void *netdev_priv(struct net_device const *dev ) { { return ((void *)dev + 2816U); } } __inline static void netif_tx_stop_queue(struct netdev_queue *dev_queue ) { int __ret_warn_on ; long tmp ; long tmp___0 ; { __ret_warn_on = (unsigned long )dev_queue == (unsigned long )((struct netdev_queue *)0); tmp = ldv__builtin_expect(__ret_warn_on != 0, 0L); if (tmp != 0L) { warn_slowpath_null("include/linux/netdevice.h", 1880); } else { } tmp___0 = ldv__builtin_expect(__ret_warn_on != 0, 0L); if (tmp___0 != 0L) { printk("\016netif_stop_queue() cannot be called before register_netdev()\n"); return; } else { } set_bit(0U, (unsigned long volatile *)(& dev_queue->state)); return; } } __inline static void netif_stop_queue(struct net_device *dev ) { struct netdev_queue *tmp ; { tmp = netdev_get_tx_queue((struct net_device const *)dev, 0U); netif_tx_stop_queue(tmp); return; } } extern int register_netdev(struct net_device * ) ; int ldv_register_netdev_8(struct net_device *dev ) ; extern void unregister_netdev(struct net_device * ) ; void ldv_unregister_netdev_9(struct net_device *dev ) ; void ldv_unregister_netdev_10(struct net_device *dev ) ; __inline static bool netif_is_bond_slave(struct net_device *dev ) { { return ((bool )((dev->flags & 2048U) != 0U && (dev->priv_flags & 32U) != 0U)); } } extern int register_inetaddr_notifier(struct notifier_block * ) ; extern int unregister_inetaddr_notifier(struct notifier_block * ) ; extern int pci_bus_read_config_byte(struct pci_bus * , unsigned int , int , u8 * ) ; __inline static int pci_read_config_byte(struct pci_dev const *dev , int where , u8 *val ) { int tmp ; { tmp = pci_bus_read_config_byte(dev->bus, dev->devfn, where, val); return (tmp); } } extern int pci_enable_device(struct pci_dev * ) ; extern void pci_disable_device(struct pci_dev * ) ; extern void pci_set_master(struct pci_dev * ) ; extern int pcie_get_readrq(struct pci_dev * ) ; extern int pcie_set_readrq(struct pci_dev * , int ) ; extern int pci_request_regions(struct pci_dev * , char const * ) ; extern void pci_release_regions(struct pci_dev * ) ; extern int __pci_register_driver(struct pci_driver * , struct module * , char const * ) ; extern void pci_unregister_driver(struct pci_driver * ) ; extern int pci_enable_msi_block(struct pci_dev * , unsigned int ) ; extern void pci_disable_msi(struct pci_dev * ) ; __inline static void pci_free_consistent(struct pci_dev *hwdev , size_t size , void *vaddr , dma_addr_t dma_handle ) { struct device *tmp ; { if ((unsigned long )hwdev != (unsigned long )((struct pci_dev *)0)) { tmp = & hwdev->dev; } else { tmp = 0; } dma_free_attrs(tmp, size, vaddr, dma_handle, 0); return; } } __inline static int pci_set_dma_mask(struct pci_dev *dev , u64 mask ) { int tmp ; { tmp = dma_set_mask(& dev->dev, mask); return (tmp); } } __inline static int pci_set_consistent_dma_mask(struct pci_dev *dev , u64 mask ) { int tmp ; { tmp = dma_set_coherent_mask(& dev->dev, mask); return (tmp); } } __inline static void *pci_get_drvdata(struct pci_dev *pdev ) { void *tmp ; { tmp = dev_get_drvdata((struct device const *)(& pdev->dev)); return (tmp); } } __inline static void pci_set_drvdata(struct pci_dev *pdev , void *data ) { { dev_set_drvdata(& pdev->dev, data); return; } } __inline static char const *pci_name(struct pci_dev const *pdev ) { char const *tmp ; { tmp = dev_name(& pdev->dev); return (tmp); } } extern int request_threaded_irq(unsigned int , irqreturn_t (*)(int , void * ) , irqreturn_t (*)(int , void * ) , unsigned long , char const * , void * ) ; __inline static int request_irq(unsigned int irq , irqreturn_t (*handler)(int , void * ) , unsigned long flags , char const *name , void *dev ) { int tmp ; { tmp = request_threaded_irq(irq, handler, 0, flags, name, dev); return (tmp); } } extern void free_irq(unsigned int , void * ) ; extern void __tasklet_schedule(struct tasklet_struct * ) ; __inline static void tasklet_schedule(struct tasklet_struct *t ) { int tmp ; { tmp = test_and_set_bit(0, (unsigned long volatile *)(& t->state)); if (tmp == 0) { __tasklet_schedule(t); } else { } return; } } extern void tasklet_kill(struct tasklet_struct * ) ; extern void tasklet_init(struct tasklet_struct * , void (*)(unsigned long ) , unsigned long ) ; int nes_cm_start(void) ; int nes_cm_stop(void) ; void nes_destroy_pau_qp(struct nes_device *nesdev , struct nes_qp *nesqp ) ; int max_mtu ; int interrupt_mod_interval ; int mpa_version ; int disable_mpa_crc ; unsigned int nes_drv_opt ; unsigned int nes_debug_level ; unsigned int wqm_quanta ; struct list_head nes_adapter_list ; atomic_t qps_destroyed ; __inline static void set_wqe_64bit_value(__le32 *wqe_words , u32 index , u64 value ) { { *(wqe_words + (unsigned long )index) = (unsigned int )value; *(wqe_words + (unsigned long )(index + 1U)) = (unsigned int )(value >> 32ULL); return; } } __inline static void set_wqe_32bit_value(__le32 *wqe_words , u32 index , u32 value ) { { *(wqe_words + (unsigned long )index) = value; return; } } __inline static void nes_fill_init_cqp_wqe(struct nes_hw_cqp_wqe *cqp_wqe , struct nes_device *nesdev ) { { cqp_wqe->wqe_words[2] = 0U; cqp_wqe->wqe_words[3] = 0U; cqp_wqe->wqe_words[4] = 0U; cqp_wqe->wqe_words[5] = 0U; cqp_wqe->wqe_words[1] = 0U; cqp_wqe->wqe_words[14] = 0U; cqp_wqe->wqe_words[7] = 0U; cqp_wqe->wqe_words[12] = 0U; cqp_wqe->wqe_words[13] = 0U; return; } } __inline static u32 nes_read_indexed(struct nes_device *nesdev , u32 reg_index ) { unsigned long flags ; void *addr ; u32 value ; raw_spinlock_t *tmp ; { addr = nesdev->index_reg; tmp = spinlock_check(& nesdev->indexed_regs_lock); flags = _raw_spin_lock_irqsave(tmp); writel(reg_index, (void volatile *)addr); value = readl((void const volatile *)addr + 4U); spin_unlock_irqrestore(& nesdev->indexed_regs_lock, flags); return (value); } } __inline static u32 nes_read32(void const *addr ) { unsigned int tmp ; { tmp = readl((void const volatile *)addr); return (tmp); } } __inline static void nes_write_indexed(struct nes_device *nesdev , u32 reg_index , u32 val ) { unsigned long flags ; void *addr ; raw_spinlock_t *tmp ; { addr = nesdev->index_reg; tmp = spinlock_check(& nesdev->indexed_regs_lock); flags = _raw_spin_lock_irqsave(tmp); writel(reg_index, (void volatile *)addr); writel(val, (void volatile *)addr + 4U); spin_unlock_irqrestore(& nesdev->indexed_regs_lock, flags); return; } } __inline static void nes_write32(void *addr , u32 val ) { { writel(val, (void volatile *)addr); return; } } __inline static void nes_free_resource(struct nes_adapter *nesadapter , unsigned long *resource_array , u32 resource_num ) { unsigned long flags ; raw_spinlock_t *tmp ; { tmp = spinlock_check(& nesadapter->resource_lock); flags = _raw_spin_lock_irqsave(tmp); clear_bit((int )resource_num, (unsigned long volatile *)resource_array); spin_unlock_irqrestore(& nesadapter->resource_lock, flags); return; } } __inline static struct nes_vnic *to_nesvnic(struct ib_device *ibdev ) { struct ib_device const *__mptr ; { __mptr = (struct ib_device const *)ibdev; return (((struct nes_ib_device *)__mptr)->nesvnic); } } __inline static struct nes_qp *to_nesqp(struct ib_qp *ibqp ) { struct ib_qp const *__mptr ; { __mptr = (struct ib_qp const *)ibqp; return ((struct nes_qp *)__mptr); } } void nes_add_ref(struct ib_qp *ibqp ) ; void nes_rem_ref(struct ib_qp *ibqp ) ; struct ib_qp *nes_get_qp(struct ib_device *device , int qpn ) ; struct nes_adapter *nes_init_adapter(struct nes_device *nesdev , u8 hw_rev ) ; void nes_destroy_adapter(struct nes_adapter *nesadapter ) ; int nes_init_cqp(struct nes_device *nesdev ) ; int nes_napi_isr(struct nes_device *nesdev ) ; void nes_dpc(unsigned long param ) ; int nes_destroy_cqp(struct nes_device *nesdev ) ; void nes_recheck_link_status(struct work_struct *work ) ; struct net_device *nes_netdev_init(struct nes_device *nesdev , void *mmio_addr ) ; void nes_netdev_destroy(struct net_device *netdev ) ; void nes_manage_arp_cache(struct net_device *netdev , unsigned char *mac_addr , u32 ip_addr , u32 action ) ; struct nes_cqp_request *nes_get_cqp_request(struct nes_device *nesdev ) ; void nes_post_cqp_request(struct nes_device *nesdev , struct nes_cqp_request *cqp_request ) ; extern int register_netevent_notifier(struct notifier_block * ) ; extern int unregister_netevent_notifier(struct notifier_block * ) ; int max_mtu = 9000; int interrupt_mod_interval = 0; int mpa_version = 1; int disable_mpa_crc = 0; unsigned int nes_drv_opt = 1280U; unsigned int nes_debug_level = 0U; unsigned int wqm_quanta = 65536U; static bool limit_maxrdreqsz ; struct list_head nes_adapter_list = {& nes_adapter_list, & nes_adapter_list}; static struct list_head nes_dev_list = {& nes_dev_list, & nes_dev_list}; static unsigned int ee_flsh_adapter ; static unsigned int sysfs_nonidx_addr ; static unsigned int sysfs_idx_addr ; static struct pci_device_id nes_pci_table[3U] = { {5752U, 256U, 4294967295U, 4294967295U, 0U, 0U, 0UL}, {5752U, 272U, 4294967295U, 4294967295U, 0U, 0U, 0UL}, {0U, 0U, 0U, 0U, 0U, 0U, 0UL}}; struct pci_device_id const __mod_pci_device_table ; static int nes_inetaddr_event(struct notifier_block *notifier , unsigned long event , void *ptr ) ; static int nes_net_event(struct notifier_block *notifier , unsigned long event , void *ptr ) ; static int nes_notifiers_registered ; static struct notifier_block nes_inetaddr_notifier = {& nes_inetaddr_event, 0, 0}; static struct notifier_block nes_net_notifier = {& nes_net_event, 0, 0}; static int nes_inetaddr_event(struct notifier_block *notifier , unsigned long event , void *ptr ) { struct in_ifaddr *ifa ; struct net_device *event_netdev ; struct nes_device *nesdev ; struct net_device *netdev ; struct nes_vnic *nesvnic ; unsigned int is_bonded ; struct list_head const *__mptr ; void *tmp ; bool tmp___0 ; __u32 tmp___1 ; __u32 tmp___2 ; __u32 tmp___3 ; struct list_head const *__mptr___0 ; { ifa = (struct in_ifaddr *)ptr; event_netdev = (ifa->ifa_dev)->dev; if ((nes_debug_level & 16U) != 0U) { printk("\viw_nes: %s[%u]: nes_inetaddr_event: ip address %pI4, netmask %pI4.\n", "nes_inetaddr_event", 183, & ifa->ifa_address, & ifa->ifa_mask); } else { } __mptr = (struct list_head const *)nes_dev_list.next; nesdev = (struct nes_device *)__mptr + 0xfffffffffffffd38UL; goto ldv_54314; ldv_54313: ; if ((nes_debug_level & 16U) != 0U) { printk("\viw_nes: %s[%u]: Nesdev list entry = 0x%p. (%s)\n", "nes_inetaddr_event", 186, nesdev, (char *)(& (nesdev->netdev[0])->name)); } else { } netdev = nesdev->netdev[0]; tmp = netdev_priv((struct net_device const *)netdev); nesvnic = (struct nes_vnic *)tmp; tmp___0 = netif_is_bond_slave(netdev); is_bonded = (unsigned int )((int )tmp___0 && (unsigned long )netdev->master == (unsigned long )event_netdev); if ((unsigned long )netdev == (unsigned long )event_netdev || is_bonded != 0U) { if ((unsigned int )nesvnic->rdma_enabled == 0U) { if ((nes_debug_level & 16U) != 0U) { printk("\viw_nes: %s[%u]: Returning without processing event for %s since RDMA is not enabled.\n", "nes_inetaddr_event", 195, (char *)(& netdev->name)); } else { } return (1); } else { } switch (event) { case 2: ; if ((nes_debug_level & 16U) != 0U) { printk("\viw_nes: %s[%u]: event:DOWN\n", "nes_inetaddr_event", 201); } else { } nes_write_indexed(nesdev, (((nesdev->pcidev)->devfn & 7U) + 64U) * 16U, 0U); tmp___1 = __fswab32(nesvnic->local_ipaddr); nes_manage_arp_cache(netdev, netdev->dev_addr, tmp___1, 2U); nesvnic->local_ipaddr = 0U; if (is_bonded != 0U) { goto ldv_54308; } else { return (1); } case 1: ; if ((nes_debug_level & 16U) != 0U) { printk("\viw_nes: %s[%u]: event:UP\n", "nes_inetaddr_event", 214); } else { } if (nesvnic->local_ipaddr != 0U) { if ((nes_debug_level & 16U) != 0U) { printk("\viw_nes: %s[%u]: Interface already has local_ipaddr\n", "nes_inetaddr_event", 217); } else { } return (1); } else { } case 8: ; if ((unsigned long )netdev->master != (unsigned long )((struct net_device *)0)) { nesvnic->local_ipaddr = (((netdev->master)->ip_ptr)->ifa_list)->ifa_address; } else { nesvnic->local_ipaddr = ifa->ifa_address; } tmp___2 = __fswab32(nesvnic->local_ipaddr); nes_write_indexed(nesdev, (((nesdev->pcidev)->devfn & 7U) + 64U) * 16U, tmp___2); tmp___3 = __fswab32(nesvnic->local_ipaddr); nes_manage_arp_cache(netdev, netdev->dev_addr, tmp___3, 1U); if (is_bonded != 0U) { goto ldv_54308; } else { return (1); } default: ; goto ldv_54312; } ldv_54312: ; } else { } ldv_54308: __mptr___0 = (struct list_head const *)nesdev->list.next; nesdev = (struct nes_device *)__mptr___0 + 0xfffffffffffffd38UL; ldv_54314: ; if ((unsigned long )(& nesdev->list) != (unsigned long )(& nes_dev_list)) { goto ldv_54313; } else { goto ldv_54315; } ldv_54315: ; return (0); } } static int nes_net_event(struct notifier_block *notifier , unsigned long event , void *ptr ) { struct neighbour *neigh ; struct nes_device *nesdev ; struct net_device *netdev ; struct nes_vnic *nesvnic ; struct list_head const *__mptr ; void *tmp ; __u32 tmp___0 ; __u32 tmp___1 ; struct list_head const *__mptr___0 ; { neigh = (struct neighbour *)ptr; switch (event) { case 1: __mptr = (struct list_head const *)nes_dev_list.next; nesdev = (struct nes_device *)__mptr + 0xfffffffffffffd38UL; goto ldv_54332; ldv_54331: netdev = nesdev->netdev[0]; tmp = netdev_priv((struct net_device const *)netdev); nesvnic = (struct nes_vnic *)tmp; if ((unsigned long )neigh->dev == (unsigned long )netdev) { if ((unsigned int )nesvnic->rdma_enabled == 0U) { if ((nes_debug_level & 16U) != 0U) { printk("\viw_nes: %s[%u]: Skipping device %s since no RDMA\n", "nes_net_event", 269, (char *)(& netdev->name)); } else { } } else if (((int )neigh->nud_state & 222) != 0) { tmp___0 = __fswab32(*((__be32 *)(& neigh->primary_key))); nes_manage_arp_cache(neigh->dev, (unsigned char *)(& neigh->ha), tmp___0, 1U); } else { tmp___1 = __fswab32(*((__be32 *)(& neigh->primary_key))); nes_manage_arp_cache(neigh->dev, (unsigned char *)(& neigh->ha), tmp___1, 2U); } return (1); } else { } __mptr___0 = (struct list_head const *)nesdev->list.next; nesdev = (struct nes_device *)__mptr___0 + 0xfffffffffffffd38UL; ldv_54332: ; if ((unsigned long )(& nesdev->list) != (unsigned long )(& nes_dev_list)) { goto ldv_54331; } else { goto ldv_54333; } ldv_54333: ; goto ldv_54334; default: ; if ((nes_debug_level & 16U) != 0U) { printk("\viw_nes: %s[%u]: NETEVENT_ %lu undefined\n", "nes_net_event", 284, event); } else { } goto ldv_54334; } ldv_54334: ; return (0); } } void nes_add_ref(struct ib_qp *ibqp ) { struct nes_qp *nesqp ; int tmp ; { nesqp = to_nesqp(ibqp); if ((nes_debug_level & 16384U) != 0U) { tmp = atomic_read((atomic_t const *)(& nesqp->refcount)); printk("\viw_nes: %s[%u]: Bumping refcount for QP%u. Pre-inc value = %u\n", "nes_add_ref", 301, ibqp->qp_num, tmp); } else { } atomic_inc(& nesqp->refcount); return; } } static void nes_cqp_rem_ref_callback(struct nes_device *nesdev , struct nes_cqp_request *cqp_request ) { unsigned long flags ; struct nes_qp *nesqp ; struct nes_adapter *nesadapter ; raw_spinlock_t *tmp ; { nesqp = (struct nes_qp *)cqp_request->ldv_52469.cqp_callback_pointer; nesadapter = nesdev->nesadapter; atomic_inc(& qps_destroyed); if ((unsigned long )nesqp->pbl_vbase != (unsigned long )((void *)0)) { pci_free_consistent(nesdev->pcidev, (size_t )nesqp->qp_mem_size, nesqp->hwqp.q2_vbase, nesqp->hwqp.q2_pbase); tmp = spinlock_check(& nesadapter->pbl_lock); flags = _raw_spin_lock_irqsave(tmp); nesadapter->free_256pbl = nesadapter->free_256pbl + 1U; spin_unlock_irqrestore(& nesadapter->pbl_lock, flags); pci_free_consistent(nesdev->pcidev, 256UL, nesqp->pbl_vbase, nesqp->pbl_pbase); nesqp->pbl_vbase = 0; } else { pci_free_consistent(nesdev->pcidev, (size_t )nesqp->qp_mem_size, (void *)nesqp->hwqp.sq_vbase, nesqp->hwqp.sq_pbase); } nes_free_resource(nesadapter, nesadapter->allocated_qps, nesqp->hwqp.qp_id); *(nesadapter->qp_table + (unsigned long )(nesqp->hwqp.qp_id - 64U)) = 0; kfree((void const *)nesqp->allocated_buffer); return; } } void nes_rem_ref(struct ib_qp *ibqp ) { u64 u64temp ; struct nes_qp *nesqp ; struct nes_vnic *nesvnic ; struct nes_vnic *tmp ; struct nes_device *nesdev ; struct nes_hw_cqp_wqe *cqp_wqe ; struct nes_cqp_request *cqp_request ; u32 opcode ; int tmp___0 ; int tmp___1 ; { tmp = to_nesvnic(ibqp->device); nesvnic = tmp; nesdev = nesvnic->nesdev; nesqp = to_nesqp(ibqp); tmp___0 = atomic_read((atomic_t const *)(& nesqp->refcount)); if (tmp___0 == 0) { printk("\016iw_nes: %s: Reference count already 0 for QP%d, last aeq = 0x%04X.\n", "nes_rem_ref", ibqp->qp_num, nesqp->last_aeq); __asm__ volatile ("1:\tud2\n.pushsection __bug_table,\"a\"\n2:\t.long 1b - 2b, %c0 - 2b\n\t.word %c1, 0\n\t.org 2b+%c2\n.popsection": : "i" ((char *)"/home/zakharov/workspace/benchmarks/bench_1/work/current--X--drivers/infiniband/hw/nes/iw_nes.ko--X--deg2_cpalinux-3.8-rc1--X--32_7a--X--cpachecker/linux-3.8-rc1/csd_deg_dscv/18/dscv_tempdir/dscv/ri/32_7a/drivers/infiniband/hw/nes/nes.c.prepared"), "i" (353), "i" (12UL)); ldv_54362: ; goto ldv_54362; } else { } tmp___1 = atomic_dec_and_test(& nesqp->refcount); if (tmp___1 != 0) { if ((unsigned int )*((unsigned char *)nesqp + 820UL) != 0U) { nes_destroy_pau_qp(nesdev, nesqp); } else { } cqp_request = nes_get_cqp_request(nesdev); if ((unsigned long )cqp_request == (unsigned long )((struct nes_cqp_request *)0)) { if ((nes_debug_level & 16384U) != 0U) { printk("\viw_nes: %s[%u]: Failed to get a cqp_request.\n", "nes_rem_ref", 363); } else { } return; } else { } cqp_request->waiting = 0U; cqp_request->callback = 1U; cqp_request->cqp_callback = & nes_cqp_rem_ref_callback; cqp_request->ldv_52469.cqp_callback_pointer = (void *)nesqp; cqp_wqe = & cqp_request->cqp_wqe; nes_fill_init_cqp_wqe(cqp_wqe, nesdev); opcode = 65538U; if ((unsigned int )*((unsigned char *)nesqp + 820UL) != 0U) { opcode = opcode | 16384U; nesqp->hte_added = 0U; } else { } set_wqe_32bit_value((__le32 *)(& cqp_wqe->wqe_words), 0U, opcode); set_wqe_32bit_value((__le32 *)(& cqp_wqe->wqe_words), 1U, nesqp->hwqp.qp_id); u64temp = nesqp->nesqp_context_pbase; set_wqe_64bit_value((__le32 *)(& cqp_wqe->wqe_words), 6U, u64temp); nes_post_cqp_request(nesdev, cqp_request); } else { } return; } } struct ib_qp *nes_get_qp(struct ib_device *device , int qpn ) { struct nes_vnic *nesvnic ; struct nes_vnic *tmp ; struct nes_device *nesdev ; struct nes_adapter *nesadapter ; { tmp = to_nesvnic(device); nesvnic = tmp; nesdev = nesvnic->nesdev; nesadapter = nesdev->nesadapter; if (qpn <= 63 || (u32 )qpn >= nesadapter->max_qp + 64U) { return (0); } else { } return (& (*(nesadapter->qp_table + ((unsigned long )qpn + 0xffffffffffffffc0UL)))->ibqp); } } static void nes_print_macaddr(struct net_device *netdev ) { { if ((nes_debug_level & 2U) != 0U) { printk("\viw_nes: %s[%u]: %s: %pM, IRQ %u\n", "nes_print_macaddr", 410, (char *)(& netdev->name), netdev->dev_addr, netdev->irq); } else { } return; } } static irqreturn_t nes_interrupt(int irq , void *dev_id ) { struct nes_device *nesdev ; int handled ; u32 int_mask ; u32 int_req ; u32 int_stat ; u32 intf_int_stat ; u32 timer_stat ; u32 tmp ; long tmp___0 ; int tmp___1 ; { nesdev = (struct nes_device *)dev_id; handled = 0; if ((unsigned int )nesdev->msi_enabled != 0U) { handled = 1; } else { tmp___0 = ldv__builtin_expect((nesdev->nesadapter)->hw_rev == 4U, 0L); if (tmp___0 != 0L) { int_mask = nes_read32((void const *)nesdev->regs + 4U); if ((int )int_mask < 0) { int_stat = nes_read32((void const *)nesdev->regs); int_req = nesdev->int_req; if ((int_stat & int_req) != 0U) { if (((int_stat & int_req) & 2684354559U) != 0U) { handled = 1; } else { if (((int_stat & int_req) & 536870912U) != 0U) { timer_stat = nes_read32((void const *)nesdev->regs + 20U); if ((nesdev->timer_int_req & timer_stat) != 0U) { handled = 1; } else { } } else { } if (((int_stat & int_req) & 1073741824U) != 0U && handled == 0) { intf_int_stat = nes_read32((void const *)nesdev->regs + 12U); if ((nesdev->intf_int_req & intf_int_stat) != 0U) { handled = 1; } else { } } else { } } if (handled != 0) { nes_write32(nesdev->regs + 4UL, int_mask & 2147483647U); int_mask = nes_read32((void const *)nesdev->regs + 4U); nesdev->int_stat = int_stat; nesdev->napi_isr_ran = 1U; } else { } } else { } } else { } } else { tmp = nes_read32((void const *)nesdev->regs + 8U); handled = (int )tmp; } } if (handled != 0) { tmp___1 = nes_napi_isr(nesdev); if (tmp___1 == 0) { tasklet_schedule(& nesdev->dpc_tasklet); } else { } return (1); } else { return (0); } } } static int nes_probe(struct pci_dev *pcidev , struct pci_device_id const *ent ) { struct net_device *netdev ; struct nes_device *nesdev ; int ret ; void *mmio_regs ; u8 hw_rev ; char const *tmp ; char const *tmp___0 ; unsigned long tmp___1 ; unsigned long tmp___2 ; char const *tmp___3 ; void *tmp___4 ; char const *tmp___5 ; struct lock_class_key __key ; unsigned long tmp___6 ; char const *tmp___7 ; char const *tmp___8 ; int tmp___9 ; char const *tmp___10 ; int tmp___11 ; int tmp___12 ; int tmp___13 ; char const *tmp___14 ; struct lock_class_key __key___0 ; atomic_long_t __constr_expr_0 ; struct lock_class_key __key___1 ; char const *tmp___15 ; { netdev = 0; nesdev = 0; ret = 0; mmio_regs = 0; if ((unsigned long )pcidev == (unsigned long )((struct pci_dev *)0)) { printk("\viw_nes: Assertion failed! %s, %s, %s, line %d\n", (char *)"pcidev != NULL", (char *)"/home/zakharov/workspace/benchmarks/bench_1/work/current--X--drivers/infiniband/hw/nes/iw_nes.ko--X--deg2_cpalinux-3.8-rc1--X--32_7a--X--cpachecker/linux-3.8-rc1/csd_deg_dscv/18/dscv_tempdir/dscv/ri/32_7a/drivers/infiniband/hw/nes/nes.c.prepared", "nes_probe", 496); } else { } if ((unsigned long )ent == (unsigned long )((struct pci_device_id const *)0)) { printk("\viw_nes: Assertion failed! %s, %s, %s, line %d\n", (char *)"ent != NULL", (char *)"/home/zakharov/workspace/benchmarks/bench_1/work/current--X--drivers/infiniband/hw/nes/iw_nes.ko--X--deg2_cpalinux-3.8-rc1--X--32_7a--X--cpachecker/linux-3.8-rc1/csd_deg_dscv/18/dscv_tempdir/dscv/ri/32_7a/drivers/infiniband/hw/nes/nes.c.prepared", "nes_probe", 497); } else { } tmp = pci_name((struct pci_dev const *)pcidev); printk("\016iw_nes: NetEffect RNIC driver v%s loading. (%s)\n", (char *)"1.5.0.1", tmp); ret = pci_enable_device(pcidev); if (ret != 0) { tmp___0 = pci_name((struct pci_dev const *)pcidev); printk("\viw_nes: Unable to enable PCI device. (%s)\n", tmp___0); goto bail0; } else { } if ((nes_debug_level & 2U) != 0U) { if (pcidev->resource[0].start != 0ULL || pcidev->resource[0].end != pcidev->resource[0].start) { tmp___1 = (unsigned long )((pcidev->resource[0].end - pcidev->resource[0].start) + 1ULL); } else { tmp___1 = 0UL; } printk("\viw_nes: %s[%u]: BAR0 (@0x%08lX) size = 0x%lX bytes\n", "nes_probe", 510, (unsigned long )pcidev->resource[0].start, tmp___1); } else { } if ((nes_debug_level & 2U) != 0U) { if (pcidev->resource[2].start != 0ULL || pcidev->resource[2].end != pcidev->resource[2].start) { tmp___2 = (unsigned long )((pcidev->resource[2].end - pcidev->resource[2].start) + 1ULL); } else { tmp___2 = 0UL; } printk("\viw_nes: %s[%u]: BAR1 (@0x%08lX) size = 0x%lX bytes\n", "nes_probe", 513, (unsigned long )pcidev->resource[2].start, tmp___2); } else { } if ((pcidev->resource[0].flags & 512UL) == 0UL || (pcidev->resource[2].flags & 512UL) == 0UL) { printk("\viw_nes: PCI regions not an MMIO resource\n"); ret = -19; goto bail1; } else { } ret = pci_request_regions(pcidev, "iw_nes"); if (ret != 0) { tmp___3 = pci_name((struct pci_dev const *)pcidev); printk("\viw_nes: Unable to request regions. (%s)\n", tmp___3); goto bail1; } else { } ret = pci_set_dma_mask(pcidev, 0xffffffffffffffffULL); if (ret < 0) { printk("\viw_nes: 64b DMA mask configuration failed\n"); goto bail2; } else { } ret = pci_set_consistent_dma_mask(pcidev, 0xffffffffffffffffULL); if (ret != 0) { printk("\viw_nes: 64b DMA consistent mask configuration failed\n"); goto bail2; } else { } pci_set_master(pcidev); tmp___4 = kzalloc(968UL, 208U); nesdev = (struct nes_device *)tmp___4; if ((unsigned long )nesdev == (unsigned long )((struct nes_device *)0)) { tmp___5 = pci_name((struct pci_dev const *)pcidev); printk("\viw_nes: %s: Unable to alloc hardware struct\n", tmp___5); ret = -12; goto bail2; } else { } if ((nes_debug_level & 2U) != 0U) { printk("\viw_nes: %s[%u]: Allocated nes device at %p\n", "nes_probe", 564, nesdev); } else { } nesdev->pcidev = pcidev; pci_set_drvdata(pcidev, (void *)nesdev); pci_read_config_byte((struct pci_dev const *)pcidev, 8, & hw_rev); if ((nes_debug_level & 2U) != 0U) { printk("\viw_nes: %s[%u]: hw_rev=%u\n", "nes_probe", 569, (int )hw_rev); } else { } spinlock_check(& nesdev->indexed_regs_lock); __raw_spin_lock_init(& nesdev->indexed_regs_lock.ldv_5961.rlock, "&(&nesdev->indexed_regs_lock)->rlock", & __key); if (pcidev->resource[0].start != 0ULL || pcidev->resource[0].end != pcidev->resource[0].start) { tmp___6 = (unsigned long )((pcidev->resource[0].end - pcidev->resource[0].start) + 1ULL); } else { tmp___6 = 0UL; } mmio_regs = ioremap_nocache(pcidev->resource[0].start, tmp___6); if ((unsigned long )mmio_regs == (unsigned long )((void *)0)) { printk("\viw_nes: Unable to remap BAR0\n"); ret = -5; goto bail3; } else { } nesdev->regs = mmio_regs; nesdev->index_reg = mmio_regs + (unsigned long )(((pcidev->devfn & 7U) + 10U) * 8U); nes_write32(nesdev->regs + 4UL, 2147483647U); if ((nes_drv_opt & 16U) != 0U) { tmp___9 = pci_enable_msi_block(nesdev->pcidev, 1U); if (tmp___9 == 0) { nesdev->msi_enabled = 1U; if ((nes_debug_level & 2U) != 0U) { tmp___7 = pci_name((struct pci_dev const *)pcidev); printk("\viw_nes: %s[%u]: MSI is enabled for device %s\n", "nes_probe", 591, tmp___7); } else { } } else if ((nes_debug_level & 2U) != 0U) { tmp___8 = pci_name((struct pci_dev const *)pcidev); printk("\viw_nes: %s[%u]: MSI is disabled by linux for device %s\n", "nes_probe", 594, tmp___8); } else { } } else if ((nes_debug_level & 2U) != 0U) { tmp___10 = pci_name((struct pci_dev const *)pcidev); printk("\viw_nes: %s[%u]: MSI not requested due to driver options for device %s\n", "nes_probe", 598, tmp___10); } else { } nesdev->csr_start = (unsigned long )(nesdev->pcidev)->resource[0].start; nesdev->doorbell_region = (unsigned long )(nesdev->pcidev)->resource[2].start; nesdev->nesadapter = nes_init_adapter(nesdev, (int )hw_rev); if ((unsigned long )nesdev->nesadapter == (unsigned long )((struct nes_adapter *)0)) { printk("\viw_nes: Unable to initialize adapter.\n"); ret = -12; goto bail5; } else { } (nesdev->nesadapter)->et_rx_coalesce_usecs_irq = (u32 )interrupt_mod_interval; (nesdev->nesadapter)->wqm_quanta = wqm_quanta; nesdev->base_doorbell_index = 1U; nesdev->doorbell_start = (nesdev->nesadapter)->doorbell_start; if ((unsigned int )(nesdev->nesadapter)->phy_type[0] == 5U) { switch (((nesdev->pcidev)->devfn & 7U) % (unsigned int )(nesdev->nesadapter)->port_count) { case 1: nesdev->mac_index = 2U; goto ldv_54402; case 2: nesdev->mac_index = 1U; goto ldv_54402; case 3: nesdev->mac_index = 3U; goto ldv_54402; case 0: ; default: nesdev->mac_index = 0U; } ldv_54402: ; } else { nesdev->mac_index = ((nesdev->pcidev)->devfn & 7U) % (unsigned int )(nesdev->nesadapter)->port_count; } if ((int )limit_maxrdreqsz || ((unsigned int )(nesdev->nesadapter)->phy_type[0] == 7U && (unsigned int )hw_rev == 5U)) { tmp___12 = pcie_get_readrq(pcidev); if (tmp___12 > 256) { tmp___11 = pcie_set_readrq(pcidev, 256); if (tmp___11 != 0) { printk("\viw_nes: Unable to set max read request to 256 bytes\n"); } else if ((nes_debug_level & 2U) != 0U) { printk("\viw_nes: %s[%u]: Max read request size set to 256 bytes\n", "nes_probe", 648); } else { } } else { } } else { } tasklet_init(& nesdev->dpc_tasklet, & nes_dpc, (unsigned long )nesdev); tmp___13 = nes_init_cqp(nesdev); if (tmp___13 != 0) { ret = -19; goto bail6; } else { } nes_write32(nesdev->regs + 68UL, ((nesdev->pcidev)->devfn & 7U) | 536870912U); nes_read32((void const *)nesdev->regs + 68U); nesdev->int_req = (u32 )((257 << ((int )(nesdev->pcidev)->devfn & 7)) | (1 << (int )(((nesdev->pcidev)->devfn & 7U) + 16U))); if (((nesdev->pcidev)->devfn & 7U) <= 3U) { nesdev->int_req = nesdev->int_req | (u32 )(1 << (int )((nesdev->mac_index & 7U) + 24U)); } else { } if (((nesdev->pcidev)->devfn & 7U) == 0U) { nesdev->intf_int_req = 16385U; nesdev->int_req = nesdev->int_req | 1073741824U; } else { nesdev->intf_int_req = 0U; } nesdev->intf_int_req = nesdev->intf_int_req | (u32 )(1 << (int )(((nesdev->pcidev)->devfn & 7U) + 16U)); nes_write_indexed(nesdev, 37184U, 0U); nes_write_indexed(nesdev, 37188U, 0U); nes_write_indexed(nesdev, 37192U, 4709U); nes_write_indexed(nesdev, 37200U, 402790404U); nes_write_indexed(nesdev, 37196U, 394270608U); nesdev->timer_int_req = (u32 )(257 << ((int )(nesdev->pcidev)->devfn & 7)); (nesdev->nesadapter)->timer_int_req = (nesdev->nesadapter)->timer_int_req | nesdev->timer_int_req; if ((nes_debug_level & 2U) != 0U) { printk("\viw_nes: %s[%u]: setting int_req for function %u, nesdev = 0x%04X, adapter = 0x%04X\n", "nes_probe", 692, (nesdev->pcidev)->devfn & 7U, nesdev->timer_int_req, (nesdev->nesadapter)->timer_int_req); } else { } nes_write32(nesdev->regs + 16UL, ~ nesdev->intf_int_req); list_add_tail(& nesdev->list, & nes_dev_list); ret = request_irq(pcidev->irq, & nes_interrupt, 128UL, "iw_nes", (void *)nesdev); if (ret != 0) { tmp___14 = pci_name((struct pci_dev const *)pcidev); printk("\viw_nes: %s: requested IRQ %u is busy\n", tmp___14, pcidev->irq); goto bail65; } else { } nes_write32(nesdev->regs + 4UL, ~ nesdev->int_req); if (nes_notifiers_registered == 0) { register_inetaddr_notifier(& nes_inetaddr_notifier); register_netevent_notifier(& nes_net_notifier); } else { } nes_notifiers_registered = nes_notifiers_registered + 1; __init_work(& nesdev->work.work, 0); __constr_expr_0.counter = 4195328L; nesdev->work.work.data = __constr_expr_0; lockdep_init_map(& nesdev->work.work.lockdep_map, "(&(&nesdev->work)->work)", & __key___0, 0); INIT_LIST_HEAD(& nesdev->work.work.entry); nesdev->work.work.func = & nes_recheck_link_status; init_timer_key(& nesdev->work.timer, 2U, "(&(&nesdev->work)->timer)", & __key___1); nesdev->work.timer.function = & delayed_work_timer_fn; nesdev->work.timer.data = (unsigned long )(& nesdev->work); netdev = nes_netdev_init(nesdev, mmio_regs); if ((unsigned long )netdev == (unsigned long )((struct net_device *)0)) { goto bail7; } else { } ret = ldv_register_netdev_8(netdev); if (ret != 0) { printk("\viw_nes: Unable to register netdev, ret = %d\n", ret); nes_netdev_destroy(netdev); goto bail7; } else { } nes_print_macaddr(netdev); nesdev->netdev_count = (u8 )((int )nesdev->netdev_count + 1); (nesdev->nesadapter)->netdev_count = (u8 )((int )(nesdev->nesadapter)->netdev_count + 1); tmp___15 = pci_name((struct pci_dev const *)pcidev); printk("\016iw_nes: %s: NetEffect RNIC driver successfully loaded.\n", tmp___15); return (0); bail7: printk("\viw_nes: bail7\n"); goto ldv_54414; ldv_54413: nesdev->netdev_count = (u8 )((int )nesdev->netdev_count - 1); (nesdev->nesadapter)->netdev_count = (u8 )((int )(nesdev->nesadapter)->netdev_count - 1); ldv_unregister_netdev_9(nesdev->netdev[(int )nesdev->netdev_count]); nes_netdev_destroy(nesdev->netdev[(int )nesdev->netdev_count]); ldv_54414: ; if ((unsigned int )nesdev->netdev_count != 0U) { goto ldv_54413; } else { goto ldv_54415; } ldv_54415: ; if ((nes_debug_level & 2U) != 0U) { printk("\viw_nes: %s[%u]: netdev_count=%d, nesadapter->netdev_count=%d\n", "nes_probe", 748, (int )nesdev->netdev_count, (int )(nesdev->nesadapter)->netdev_count); } else { } nes_notifiers_registered = nes_notifiers_registered - 1; if (nes_notifiers_registered == 0) { unregister_netevent_notifier(& nes_net_notifier); unregister_inetaddr_notifier(& nes_inetaddr_notifier); } else { } list_del(& nesdev->list); nes_destroy_cqp(nesdev); bail65: printk("\viw_nes: bail65\n"); free_irq(pcidev->irq, (void *)nesdev); if ((unsigned int )nesdev->msi_enabled != 0U) { pci_disable_msi(pcidev); } else { } bail6: printk("\viw_nes: bail6\n"); tasklet_kill(& nesdev->dpc_tasklet); nes_destroy_adapter(nesdev->nesadapter); bail5: printk("\viw_nes: bail5\n"); iounmap((void volatile *)nesdev->regs); bail3: printk("\viw_nes: bail3\n"); kfree((void const *)nesdev); bail2: pci_release_regions(pcidev); bail1: pci_disable_device(pcidev); bail0: ; return (ret); } } static void nes_remove(struct pci_dev *pcidev ) { struct nes_device *nesdev ; void *tmp ; struct net_device *netdev ; int netdev_index ; unsigned long flags ; raw_spinlock_t *tmp___0 ; { tmp = pci_get_drvdata(pcidev); nesdev = (struct nes_device *)tmp; netdev_index = 0; if ((unsigned int )nesdev->netdev_count != 0U) { netdev = nesdev->netdev[netdev_index]; if ((unsigned long )netdev != (unsigned long )((struct net_device *)0)) { netif_stop_queue(netdev); ldv_unregister_netdev_10(netdev); nes_netdev_destroy(netdev); nesdev->netdev[netdev_index] = 0; nesdev->netdev_count = (u8 )((int )nesdev->netdev_count - 1); (nesdev->nesadapter)->netdev_count = (u8 )((int )(nesdev->nesadapter)->netdev_count - 1); } else { } } else { } nes_notifiers_registered = nes_notifiers_registered - 1; if (nes_notifiers_registered == 0) { unregister_netevent_notifier(& nes_net_notifier); unregister_inetaddr_notifier(& nes_inetaddr_notifier); } else { } list_del(& nesdev->list); nes_destroy_cqp(nesdev); free_irq(pcidev->irq, (void *)nesdev); tasklet_kill(& nesdev->dpc_tasklet); tmp___0 = spinlock_check(& (nesdev->nesadapter)->phy_lock); flags = _raw_spin_lock_irqsave(tmp___0); if ((unsigned int )nesdev->link_recheck != 0U) { spin_unlock_irqrestore(& (nesdev->nesadapter)->phy_lock, flags); cancel_delayed_work_sync(& nesdev->work); } else { spin_unlock_irqrestore(& (nesdev->nesadapter)->phy_lock, flags); } nes_destroy_adapter(nesdev->nesadapter); if ((unsigned int )nesdev->msi_enabled != 0U) { pci_disable_msi(pcidev); } else { } iounmap((void volatile *)nesdev->regs); kfree((void const *)nesdev); pci_release_regions(pcidev); pci_disable_device(pcidev); pci_set_drvdata(pcidev, 0); return; } } static struct pci_driver nes_pci_driver = {{0, 0}, "iw_nes", (struct pci_device_id const *)(& nes_pci_table), & nes_probe, & nes_remove, 0, 0, 0, 0, 0, 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}}}; static ssize_t nes_show_adapter(struct device_driver *ddp , char *buf ) { unsigned int devfn ; unsigned char bus_number ; unsigned int i ; struct nes_device *nesdev ; struct list_head const *__mptr ; struct list_head const *__mptr___0 ; int tmp ; { devfn = 4294967295U; bus_number = 255U; i = 0U; __mptr = (struct list_head const *)nes_dev_list.next; nesdev = (struct nes_device *)__mptr + 0xfffffffffffffd38UL; goto ldv_54441; ldv_54440: ; if (i == ee_flsh_adapter) { devfn = (nesdev->pcidev)->devfn; bus_number = ((nesdev->pcidev)->bus)->number; goto ldv_54439; } else { } i = i + 1U; __mptr___0 = (struct list_head const *)nesdev->list.next; nesdev = (struct nes_device *)__mptr___0 + 0xfffffffffffffd38UL; ldv_54441: ; if ((unsigned long )(& nesdev->list) != (unsigned long )(& nes_dev_list)) { goto ldv_54440; } else { goto ldv_54439; } ldv_54439: tmp = snprintf(buf, 4096UL, "%x:%x\n", (int )bus_number, devfn); return ((ssize_t )tmp); } } static ssize_t nes_store_adapter(struct device_driver *ddp , char const *buf , size_t count ) { char *p ; unsigned long tmp ; __kernel_size_t tmp___0 ; { p = (char *)buf; tmp = simple_strtoul((char const *)p, & p, 10U); ee_flsh_adapter = (unsigned int )tmp; tmp___0 = strnlen(buf, count); return ((ssize_t )tmp___0); } } static ssize_t nes_show_ee_cmd(struct device_driver *ddp , char *buf ) { u32 eeprom_cmd ; u32 i ; struct nes_device *nesdev ; struct list_head const *__mptr ; struct list_head const *__mptr___0 ; int tmp ; { eeprom_cmd = 57005U; i = 0U; __mptr = (struct list_head const *)nes_dev_list.next; nesdev = (struct nes_device *)__mptr + 0xfffffffffffffd38UL; goto ldv_54461; ldv_54460: ; if (i == ee_flsh_adapter) { eeprom_cmd = nes_read32((void const *)nesdev->regs + 32U); goto ldv_54459; } else { } i = i + 1U; __mptr___0 = (struct list_head const *)nesdev->list.next; nesdev = (struct nes_device *)__mptr___0 + 0xfffffffffffffd38UL; ldv_54461: ; if ((unsigned long )(& nesdev->list) != (unsigned long )(& nes_dev_list)) { goto ldv_54460; } else { goto ldv_54459; } ldv_54459: tmp = snprintf(buf, 4096UL, "0x%x\n", eeprom_cmd); return ((ssize_t )tmp); } } static ssize_t nes_store_ee_cmd(struct device_driver *ddp , char const *buf , size_t count ) { char *p ; u32 val ; u32 i ; struct nes_device *nesdev ; unsigned long tmp ; struct list_head const *__mptr ; struct list_head const *__mptr___0 ; __kernel_size_t tmp___0 ; { p = (char *)buf; i = 0U; if ((((int )((signed char )*(p + 1UL)) == 120 || (int )((signed char )*(p + 1UL)) == 88) || (int )((signed char )*p) == 120) || (int )((signed char )*p) == 88) { tmp = simple_strtoul((char const *)p, & p, 16U); val = (u32 )tmp; __mptr = (struct list_head const *)nes_dev_list.next; nesdev = (struct nes_device *)__mptr + 0xfffffffffffffd38UL; goto ldv_54477; ldv_54476: ; if (i == ee_flsh_adapter) { nes_write32(nesdev->regs + 32UL, val); goto ldv_54475; } else { } i = i + 1U; __mptr___0 = (struct list_head const *)nesdev->list.next; nesdev = (struct nes_device *)__mptr___0 + 0xfffffffffffffd38UL; ldv_54477: ; if ((unsigned long )(& nesdev->list) != (unsigned long )(& nes_dev_list)) { goto ldv_54476; } else { goto ldv_54475; } ldv_54475: ; } else { } tmp___0 = strnlen(buf, count); return ((ssize_t )tmp___0); } } static ssize_t nes_show_ee_data(struct device_driver *ddp , char *buf ) { u32 eeprom_data ; u32 i ; struct nes_device *nesdev ; struct list_head const *__mptr ; struct list_head const *__mptr___0 ; int tmp ; { eeprom_data = 57005U; i = 0U; __mptr = (struct list_head const *)nes_dev_list.next; nesdev = (struct nes_device *)__mptr + 0xfffffffffffffd38UL; goto ldv_54491; ldv_54490: ; if (i == ee_flsh_adapter) { eeprom_data = nes_read32((void const *)nesdev->regs + 36U); goto ldv_54489; } else { } i = i + 1U; __mptr___0 = (struct list_head const *)nesdev->list.next; nesdev = (struct nes_device *)__mptr___0 + 0xfffffffffffffd38UL; ldv_54491: ; if ((unsigned long )(& nesdev->list) != (unsigned long )(& nes_dev_list)) { goto ldv_54490; } else { goto ldv_54489; } ldv_54489: tmp = snprintf(buf, 4096UL, "0x%x\n", eeprom_data); return ((ssize_t )tmp); } } static ssize_t nes_store_ee_data(struct device_driver *ddp , char const *buf , size_t count ) { char *p ; u32 val ; u32 i ; struct nes_device *nesdev ; unsigned long tmp ; struct list_head const *__mptr ; struct list_head const *__mptr___0 ; __kernel_size_t tmp___0 ; { p = (char *)buf; i = 0U; if ((((int )((signed char )*(p + 1UL)) == 120 || (int )((signed char )*(p + 1UL)) == 88) || (int )((signed char )*p) == 120) || (int )((signed char )*p) == 88) { tmp = simple_strtoul((char const *)p, & p, 16U); val = (u32 )tmp; __mptr = (struct list_head const *)nes_dev_list.next; nesdev = (struct nes_device *)__mptr + 0xfffffffffffffd38UL; goto ldv_54507; ldv_54506: ; if (i == ee_flsh_adapter) { nes_write32(nesdev->regs + 36UL, val); goto ldv_54505; } else { } i = i + 1U; __mptr___0 = (struct list_head const *)nesdev->list.next; nesdev = (struct nes_device *)__mptr___0 + 0xfffffffffffffd38UL; ldv_54507: ; if ((unsigned long )(& nesdev->list) != (unsigned long )(& nes_dev_list)) { goto ldv_54506; } else { goto ldv_54505; } ldv_54505: ; } else { } tmp___0 = strnlen(buf, count); return ((ssize_t )tmp___0); } } static ssize_t nes_show_flash_cmd(struct device_driver *ddp , char *buf ) { u32 flash_cmd ; u32 i ; struct nes_device *nesdev ; struct list_head const *__mptr ; struct list_head const *__mptr___0 ; int tmp ; { flash_cmd = 57005U; i = 0U; __mptr = (struct list_head const *)nes_dev_list.next; nesdev = (struct nes_device *)__mptr + 0xfffffffffffffd38UL; goto ldv_54521; ldv_54520: ; if (i == ee_flsh_adapter) { flash_cmd = nes_read32((void const *)nesdev->regs + 40U); goto ldv_54519; } else { } i = i + 1U; __mptr___0 = (struct list_head const *)nesdev->list.next; nesdev = (struct nes_device *)__mptr___0 + 0xfffffffffffffd38UL; ldv_54521: ; if ((unsigned long )(& nesdev->list) != (unsigned long )(& nes_dev_list)) { goto ldv_54520; } else { goto ldv_54519; } ldv_54519: tmp = snprintf(buf, 4096UL, "0x%x\n", flash_cmd); return ((ssize_t )tmp); } } static ssize_t nes_store_flash_cmd(struct device_driver *ddp , char const *buf , size_t count ) { char *p ; u32 val ; u32 i ; struct nes_device *nesdev ; unsigned long tmp ; struct list_head const *__mptr ; struct list_head const *__mptr___0 ; __kernel_size_t tmp___0 ; { p = (char *)buf; i = 0U; if ((((int )((signed char )*(p + 1UL)) == 120 || (int )((signed char )*(p + 1UL)) == 88) || (int )((signed char )*p) == 120) || (int )((signed char )*p) == 88) { tmp = simple_strtoul((char const *)p, & p, 16U); val = (u32 )tmp; __mptr = (struct list_head const *)nes_dev_list.next; nesdev = (struct nes_device *)__mptr + 0xfffffffffffffd38UL; goto ldv_54537; ldv_54536: ; if (i == ee_flsh_adapter) { nes_write32(nesdev->regs + 40UL, val); goto ldv_54535; } else { } i = i + 1U; __mptr___0 = (struct list_head const *)nesdev->list.next; nesdev = (struct nes_device *)__mptr___0 + 0xfffffffffffffd38UL; ldv_54537: ; if ((unsigned long )(& nesdev->list) != (unsigned long )(& nes_dev_list)) { goto ldv_54536; } else { goto ldv_54535; } ldv_54535: ; } else { } tmp___0 = strnlen(buf, count); return ((ssize_t )tmp___0); } } static ssize_t nes_show_flash_data(struct device_driver *ddp , char *buf ) { u32 flash_data ; u32 i ; struct nes_device *nesdev ; struct list_head const *__mptr ; struct list_head const *__mptr___0 ; int tmp ; { flash_data = 57005U; i = 0U; __mptr = (struct list_head const *)nes_dev_list.next; nesdev = (struct nes_device *)__mptr + 0xfffffffffffffd38UL; goto ldv_54551; ldv_54550: ; if (i == ee_flsh_adapter) { flash_data = nes_read32((void const *)nesdev->regs + 44U); goto ldv_54549; } else { } i = i + 1U; __mptr___0 = (struct list_head const *)nesdev->list.next; nesdev = (struct nes_device *)__mptr___0 + 0xfffffffffffffd38UL; ldv_54551: ; if ((unsigned long )(& nesdev->list) != (unsigned long )(& nes_dev_list)) { goto ldv_54550; } else { goto ldv_54549; } ldv_54549: tmp = snprintf(buf, 4096UL, "0x%x\n", flash_data); return ((ssize_t )tmp); } } static ssize_t nes_store_flash_data(struct device_driver *ddp , char const *buf , size_t count ) { char *p ; u32 val ; u32 i ; struct nes_device *nesdev ; unsigned long tmp ; struct list_head const *__mptr ; struct list_head const *__mptr___0 ; __kernel_size_t tmp___0 ; { p = (char *)buf; i = 0U; if ((((int )((signed char )*(p + 1UL)) == 120 || (int )((signed char )*(p + 1UL)) == 88) || (int )((signed char )*p) == 120) || (int )((signed char )*p) == 88) { tmp = simple_strtoul((char const *)p, & p, 16U); val = (u32 )tmp; __mptr = (struct list_head const *)nes_dev_list.next; nesdev = (struct nes_device *)__mptr + 0xfffffffffffffd38UL; goto ldv_54567; ldv_54566: ; if (i == ee_flsh_adapter) { nes_write32(nesdev->regs + 44UL, val); goto ldv_54565; } else { } i = i + 1U; __mptr___0 = (struct list_head const *)nesdev->list.next; nesdev = (struct nes_device *)__mptr___0 + 0xfffffffffffffd38UL; ldv_54567: ; if ((unsigned long )(& nesdev->list) != (unsigned long )(& nes_dev_list)) { goto ldv_54566; } else { goto ldv_54565; } ldv_54565: ; } else { } tmp___0 = strnlen(buf, count); return ((ssize_t )tmp___0); } } static ssize_t nes_show_nonidx_addr(struct device_driver *ddp , char *buf ) { int tmp ; { tmp = snprintf(buf, 4096UL, "0x%x\n", sysfs_nonidx_addr); return ((ssize_t )tmp); } } static ssize_t nes_store_nonidx_addr(struct device_driver *ddp , char const *buf , size_t count ) { char *p ; unsigned long tmp ; __kernel_size_t tmp___0 ; { p = (char *)buf; if ((((int )((signed char )*(p + 1UL)) == 120 || (int )((signed char )*(p + 1UL)) == 88) || (int )((signed char )*p) == 120) || (int )((signed char )*p) == 88) { tmp = simple_strtoul((char const *)p, & p, 16U); sysfs_nonidx_addr = (unsigned int )tmp; } else { } tmp___0 = strnlen(buf, count); return ((ssize_t )tmp___0); } } static ssize_t nes_show_nonidx_data(struct device_driver *ddp , char *buf ) { u32 nonidx_data ; u32 i ; struct nes_device *nesdev ; struct list_head const *__mptr ; struct list_head const *__mptr___0 ; int tmp ; { nonidx_data = 57005U; i = 0U; __mptr = (struct list_head const *)nes_dev_list.next; nesdev = (struct nes_device *)__mptr + 0xfffffffffffffd38UL; goto ldv_54591; ldv_54590: ; if (i == ee_flsh_adapter) { nonidx_data = nes_read32((void const *)nesdev->regs + (unsigned long )sysfs_nonidx_addr); goto ldv_54589; } else { } i = i + 1U; __mptr___0 = (struct list_head const *)nesdev->list.next; nesdev = (struct nes_device *)__mptr___0 + 0xfffffffffffffd38UL; ldv_54591: ; if ((unsigned long )(& nesdev->list) != (unsigned long )(& nes_dev_list)) { goto ldv_54590; } else { goto ldv_54589; } ldv_54589: tmp = snprintf(buf, 4096UL, "0x%x\n", nonidx_data); return ((ssize_t )tmp); } } static ssize_t nes_store_nonidx_data(struct device_driver *ddp , char const *buf , size_t count ) { char *p ; u32 val ; u32 i ; struct nes_device *nesdev ; unsigned long tmp ; struct list_head const *__mptr ; struct list_head const *__mptr___0 ; __kernel_size_t tmp___0 ; { p = (char *)buf; i = 0U; if ((((int )((signed char )*(p + 1UL)) == 120 || (int )((signed char )*(p + 1UL)) == 88) || (int )((signed char )*p) == 120) || (int )((signed char )*p) == 88) { tmp = simple_strtoul((char const *)p, & p, 16U); val = (u32 )tmp; __mptr = (struct list_head const *)nes_dev_list.next; nesdev = (struct nes_device *)__mptr + 0xfffffffffffffd38UL; goto ldv_54607; ldv_54606: ; if (i == ee_flsh_adapter) { nes_write32(nesdev->regs + (unsigned long )sysfs_nonidx_addr, val); goto ldv_54605; } else { } i = i + 1U; __mptr___0 = (struct list_head const *)nesdev->list.next; nesdev = (struct nes_device *)__mptr___0 + 0xfffffffffffffd38UL; ldv_54607: ; if ((unsigned long )(& nesdev->list) != (unsigned long )(& nes_dev_list)) { goto ldv_54606; } else { goto ldv_54605; } ldv_54605: ; } else { } tmp___0 = strnlen(buf, count); return ((ssize_t )tmp___0); } } static ssize_t nes_show_idx_addr(struct device_driver *ddp , char *buf ) { int tmp ; { tmp = snprintf(buf, 4096UL, "0x%x\n", sysfs_idx_addr); return ((ssize_t )tmp); } } static ssize_t nes_store_idx_addr(struct device_driver *ddp , char const *buf , size_t count ) { char *p ; unsigned long tmp ; __kernel_size_t tmp___0 ; { p = (char *)buf; if ((((int )((signed char )*(p + 1UL)) == 120 || (int )((signed char )*(p + 1UL)) == 88) || (int )((signed char )*p) == 120) || (int )((signed char )*p) == 88) { tmp = simple_strtoul((char const *)p, & p, 16U); sysfs_idx_addr = (unsigned int )tmp; } else { } tmp___0 = strnlen(buf, count); return ((ssize_t )tmp___0); } } static ssize_t nes_show_idx_data(struct device_driver *ddp , char *buf ) { u32 idx_data ; u32 i ; struct nes_device *nesdev ; struct list_head const *__mptr ; struct list_head const *__mptr___0 ; int tmp ; { idx_data = 57005U; i = 0U; __mptr = (struct list_head const *)nes_dev_list.next; nesdev = (struct nes_device *)__mptr + 0xfffffffffffffd38UL; goto ldv_54631; ldv_54630: ; if (i == ee_flsh_adapter) { idx_data = nes_read_indexed(nesdev, sysfs_idx_addr); goto ldv_54629; } else { } i = i + 1U; __mptr___0 = (struct list_head const *)nesdev->list.next; nesdev = (struct nes_device *)__mptr___0 + 0xfffffffffffffd38UL; ldv_54631: ; if ((unsigned long )(& nesdev->list) != (unsigned long )(& nes_dev_list)) { goto ldv_54630; } else { goto ldv_54629; } ldv_54629: tmp = snprintf(buf, 4096UL, "0x%x\n", idx_data); return ((ssize_t )tmp); } } static ssize_t nes_store_idx_data(struct device_driver *ddp , char const *buf , size_t count ) { char *p ; u32 val ; u32 i ; struct nes_device *nesdev ; unsigned long tmp ; struct list_head const *__mptr ; struct list_head const *__mptr___0 ; __kernel_size_t tmp___0 ; { p = (char *)buf; i = 0U; if ((((int )((signed char )*(p + 1UL)) == 120 || (int )((signed char )*(p + 1UL)) == 88) || (int )((signed char )*p) == 120) || (int )((signed char )*p) == 88) { tmp = simple_strtoul((char const *)p, & p, 16U); val = (u32 )tmp; __mptr = (struct list_head const *)nes_dev_list.next; nesdev = (struct nes_device *)__mptr + 0xfffffffffffffd38UL; goto ldv_54647; ldv_54646: ; if (i == ee_flsh_adapter) { nes_write_indexed(nesdev, sysfs_idx_addr, val); goto ldv_54645; } else { } i = i + 1U; __mptr___0 = (struct list_head const *)nesdev->list.next; nesdev = (struct nes_device *)__mptr___0 + 0xfffffffffffffd38UL; ldv_54647: ; if ((unsigned long )(& nesdev->list) != (unsigned long )(& nes_dev_list)) { goto ldv_54646; } else { goto ldv_54645; } ldv_54645: ; } else { } tmp___0 = strnlen(buf, count); return ((ssize_t )tmp___0); } } static ssize_t nes_show_wqm_quanta(struct device_driver *ddp , char *buf ) { u32 wqm_quanta_value ; u32 i ; struct nes_device *nesdev ; struct list_head const *__mptr ; struct list_head const *__mptr___0 ; int tmp ; { wqm_quanta_value = 57005U; i = 0U; __mptr = (struct list_head const *)nes_dev_list.next; nesdev = (struct nes_device *)__mptr + 0xfffffffffffffd38UL; goto ldv_54661; ldv_54660: ; if (i == ee_flsh_adapter) { wqm_quanta_value = (nesdev->nesadapter)->wqm_quanta; goto ldv_54659; } else { } i = i + 1U; __mptr___0 = (struct list_head const *)nesdev->list.next; nesdev = (struct nes_device *)__mptr___0 + 0xfffffffffffffd38UL; ldv_54661: ; if ((unsigned long )(& nesdev->list) != (unsigned long )(& nes_dev_list)) { goto ldv_54660; } else { goto ldv_54659; } ldv_54659: tmp = snprintf(buf, 4096UL, "0x%X\n", wqm_quanta_value); return ((ssize_t )tmp); } } static ssize_t nes_store_wqm_quanta(struct device_driver *ddp , char const *buf , size_t count ) { unsigned long wqm_quanta_value ; u32 wqm_config1 ; u32 i ; struct nes_device *nesdev ; int tmp ; struct list_head const *__mptr ; struct list_head const *__mptr___0 ; __kernel_size_t tmp___0 ; { i = 0U; tmp = kstrtoul(buf, 0U, & wqm_quanta_value); if (tmp < 0) { return (-22L); } else { } __mptr = (struct list_head const *)nes_dev_list.next; nesdev = (struct nes_device *)__mptr + 0xfffffffffffffd38UL; goto ldv_54677; ldv_54676: ; if (i == ee_flsh_adapter) { (nesdev->nesadapter)->wqm_quanta = (u32 )wqm_quanta_value; wqm_config1 = nes_read_indexed(nesdev, 20484U); nes_write_indexed(nesdev, 20484U, ((u32 )wqm_quanta_value << 1U) | (wqm_config1 & 1U)); goto ldv_54675; } else { } i = i + 1U; __mptr___0 = (struct list_head const *)nesdev->list.next; nesdev = (struct nes_device *)__mptr___0 + 0xfffffffffffffd38UL; ldv_54677: ; if ((unsigned long )(& nesdev->list) != (unsigned long )(& nes_dev_list)) { goto ldv_54676; } else { goto ldv_54675; } ldv_54675: tmp___0 = strnlen(buf, count); return ((ssize_t )tmp___0); } } static struct driver_attribute driver_attr_adapter = {{"adapter", 384U, (_Bool)0, 0, {{{(char)0}, {(char)0}, {(char)0}, {(char)0}, {(char)0}, {(char)0}, {(char)0}, {(char)0}}}}, & nes_show_adapter, & nes_store_adapter}; static struct driver_attribute driver_attr_eeprom_cmd = {{"eeprom_cmd", 384U, (_Bool)0, 0, {{{(char)0}, {(char)0}, {(char)0}, {(char)0}, {(char)0}, {(char)0}, {(char)0}, {(char)0}}}}, & nes_show_ee_cmd, & nes_store_ee_cmd}; static struct driver_attribute driver_attr_eeprom_data = {{"eeprom_data", 384U, (_Bool)0, 0, {{{(char)0}, {(char)0}, {(char)0}, {(char)0}, {(char)0}, {(char)0}, {(char)0}, {(char)0}}}}, & nes_show_ee_data, & nes_store_ee_data}; static struct driver_attribute driver_attr_flash_cmd = {{"flash_cmd", 384U, (_Bool)0, 0, {{{(char)0}, {(char)0}, {(char)0}, {(char)0}, {(char)0}, {(char)0}, {(char)0}, {(char)0}}}}, & nes_show_flash_cmd, & nes_store_flash_cmd}; static struct driver_attribute driver_attr_flash_data = {{"flash_data", 384U, (_Bool)0, 0, {{{(char)0}, {(char)0}, {(char)0}, {(char)0}, {(char)0}, {(char)0}, {(char)0}, {(char)0}}}}, & nes_show_flash_data, & nes_store_flash_data}; static struct driver_attribute driver_attr_nonidx_addr = {{"nonidx_addr", 384U, (_Bool)0, 0, {{{(char)0}, {(char)0}, {(char)0}, {(char)0}, {(char)0}, {(char)0}, {(char)0}, {(char)0}}}}, & nes_show_nonidx_addr, & nes_store_nonidx_addr}; static struct driver_attribute driver_attr_nonidx_data = {{"nonidx_data", 384U, (_Bool)0, 0, {{{(char)0}, {(char)0}, {(char)0}, {(char)0}, {(char)0}, {(char)0}, {(char)0}, {(char)0}}}}, & nes_show_nonidx_data, & nes_store_nonidx_data}; static struct driver_attribute driver_attr_idx_addr = {{"idx_addr", 384U, (_Bool)0, 0, {{{(char)0}, {(char)0}, {(char)0}, {(char)0}, {(char)0}, {(char)0}, {(char)0}, {(char)0}}}}, & nes_show_idx_addr, & nes_store_idx_addr}; static struct driver_attribute driver_attr_idx_data = {{"idx_data", 384U, (_Bool)0, 0, {{{(char)0}, {(char)0}, {(char)0}, {(char)0}, {(char)0}, {(char)0}, {(char)0}, {(char)0}}}}, & nes_show_idx_data, & nes_store_idx_data}; static struct driver_attribute driver_attr_wqm_quanta = {{"wqm_quanta", 384U, (_Bool)0, 0, {{{(char)0}, {(char)0}, {(char)0}, {(char)0}, {(char)0}, {(char)0}, {(char)0}, {(char)0}}}}, & nes_show_wqm_quanta, & nes_store_wqm_quanta}; static int nes_create_driver_sysfs(struct pci_driver *drv ) { int error ; int tmp ; int tmp___0 ; int tmp___1 ; int tmp___2 ; int tmp___3 ; int tmp___4 ; int tmp___5 ; int tmp___6 ; int tmp___7 ; { error = driver_create_file(& drv->driver, (struct driver_attribute const *)(& driver_attr_adapter)); tmp = driver_create_file(& drv->driver, (struct driver_attribute const *)(& driver_attr_eeprom_cmd)); error = tmp | error; tmp___0 = driver_create_file(& drv->driver, (struct driver_attribute const *)(& driver_attr_eeprom_data)); error = tmp___0 | error; tmp___1 = driver_create_file(& drv->driver, (struct driver_attribute const *)(& driver_attr_flash_cmd)); error = tmp___1 | error; tmp___2 = driver_create_file(& drv->driver, (struct driver_attribute const *)(& driver_attr_flash_data)); error = tmp___2 | error; tmp___3 = driver_create_file(& drv->driver, (struct driver_attribute const *)(& driver_attr_nonidx_addr)); error = tmp___3 | error; tmp___4 = driver_create_file(& drv->driver, (struct driver_attribute const *)(& driver_attr_nonidx_data)); error = tmp___4 | error; tmp___5 = driver_create_file(& drv->driver, (struct driver_attribute const *)(& driver_attr_idx_addr)); error = tmp___5 | error; tmp___6 = driver_create_file(& drv->driver, (struct driver_attribute const *)(& driver_attr_idx_data)); error = tmp___6 | error; tmp___7 = driver_create_file(& drv->driver, (struct driver_attribute const *)(& driver_attr_wqm_quanta)); error = tmp___7 | error; return (error); } } static void nes_remove_driver_sysfs(struct pci_driver *drv ) { { driver_remove_file(& drv->driver, (struct driver_attribute const *)(& driver_attr_adapter)); driver_remove_file(& drv->driver, (struct driver_attribute const *)(& driver_attr_eeprom_cmd)); driver_remove_file(& drv->driver, (struct driver_attribute const *)(& driver_attr_eeprom_data)); driver_remove_file(& drv->driver, (struct driver_attribute const *)(& driver_attr_flash_cmd)); driver_remove_file(& drv->driver, (struct driver_attribute const *)(& driver_attr_flash_data)); driver_remove_file(& drv->driver, (struct driver_attribute const *)(& driver_attr_nonidx_addr)); driver_remove_file(& drv->driver, (struct driver_attribute const *)(& driver_attr_nonidx_data)); driver_remove_file(& drv->driver, (struct driver_attribute const *)(& driver_attr_idx_addr)); driver_remove_file(& drv->driver, (struct driver_attribute const *)(& driver_attr_idx_data)); driver_remove_file(& drv->driver, (struct driver_attribute const *)(& driver_attr_wqm_quanta)); return; } } static int nes_init_module(void) { int retval ; int retval1 ; { retval = nes_cm_start(); if (retval != 0) { printk("\viw_nes: Unable to start NetEffect iWARP CM.\n"); return (retval); } else { } retval = __pci_register_driver(& nes_pci_driver, & __this_module, "iw_nes"); if (retval >= 0) { retval1 = nes_create_driver_sysfs(& nes_pci_driver); if (retval1 < 0) { printk("\viw_nes: Unable to create NetEffect sys files.\n"); } else { } } else { } return (retval); } } static void nes_exit_module(void) { { nes_cm_stop(); nes_remove_driver_sysfs(& nes_pci_driver); pci_unregister_driver(& nes_pci_driver); return; } } void *ldvarg11 ; int ldv_retval_nes_init_module ; void *ldvarg7 ; unsigned long ldvarg12 ; struct notifier_block *ldvarg6 ; unsigned long ldvarg8 ; struct pci_dev *nes_pci_driver_group1 ; int ldv_retval_nes_probe ; void ldv_initialize(void) ; struct notifier_block *ldvarg10 ; void ldv_check_final_state(void) ; struct pci_device_id *ldvarg9 ; struct pci_dev *nes_pci_driver_group0 ; void ldv_main_exported_4(void) ; void ldv_main_exported_5(void) ; int main(void) { int tmp ; int tmp___0 ; int tmp___1 ; int tmp___2 ; int tmp___3 ; { ldv_initialize(); ldv_state_variable_4 = 0; ldv_state_variable_1 = 0; ref_cnt = 0; ldv_state_variable_0 = 1; ldv_state_variable_3 = 0; ldv_state_variable_2 = 0; ldv_state_variable_5 = 0; ldv_54758: tmp = __VERIFIER_nondet_int(); switch (tmp) { case 0: ; if (ldv_state_variable_4 != 0) { ldv_main_exported_4(); } else { } goto ldv_54736; case 1: ; if (ldv_state_variable_1 != 0) { tmp___0 = __VERIFIER_nondet_int(); switch (tmp___0) { case 0: ; if (ldv_state_variable_1 == 1) { nes_inetaddr_event(ldvarg6, ldvarg8, ldvarg7); ldv_state_variable_1 = 1; } else { } goto ldv_54739; default: ; goto ldv_54739; } ldv_54739: ; } else { } goto ldv_54736; case 2: ; if (ldv_state_variable_0 != 0) { tmp___1 = __VERIFIER_nondet_int(); switch (tmp___1) { case 0: ; if (ldv_state_variable_0 == 3 && ref_cnt == 0) { nes_exit_module(); ldv_state_variable_0 = 2; goto ldv_final; } else { } goto ldv_54744; case 1: ; if (ldv_state_variable_0 == 1) { ldv_retval_nes_init_module = nes_init_module(); if (ldv_retval_nes_init_module == 0) { ldv_state_variable_0 = 3; ldv_state_variable_2 = 1; ldv_state_variable_3 = 1; ldv_state_variable_1 = 1; ldv_state_variable_4 = 1; } else { } if (ldv_retval_nes_init_module != 0) { ldv_state_variable_0 = 2; goto ldv_final; } else { } } else { } goto ldv_54744; default: ; goto ldv_54744; } ldv_54744: ; } else { } goto ldv_54736; case 3: ; if (ldv_state_variable_3 != 0) { tmp___2 = __VERIFIER_nondet_int(); switch (tmp___2) { case 0: ; if (ldv_state_variable_3 == 2) { nes_remove(nes_pci_driver_group1); ldv_state_variable_3 = 1; ref_cnt = ref_cnt - 1; } else { } goto ldv_54749; case 1: ; if (ldv_state_variable_3 == 1) { ldv_retval_nes_probe = nes_probe(nes_pci_driver_group1, (struct pci_device_id const *)ldvarg9); if (ldv_retval_nes_probe == 0) { ldv_state_variable_3 = 2; ref_cnt = ref_cnt + 1; } else { } } else { } goto ldv_54749; default: ; goto ldv_54749; } ldv_54749: ; } else { } goto ldv_54736; case 4: ; if (ldv_state_variable_2 != 0) { tmp___3 = __VERIFIER_nondet_int(); switch (tmp___3) { case 0: ; if (ldv_state_variable_2 == 1) { nes_net_event(ldvarg10, ldvarg12, ldvarg11); ldv_state_variable_2 = 1; } else { } goto ldv_54754; default: ; goto ldv_54754; } ldv_54754: ; } else { } goto ldv_54736; case 5: ; if (ldv_state_variable_5 != 0) { ldv_main_exported_5(); } else { } goto ldv_54736; default: ; goto ldv_54736; } ldv_54736: ; goto ldv_54758; ldv_final: ldv_check_final_state(); return 0; } } void ldv_mutex_lock_1(struct mutex *ldv_func_arg1 ) { { ldv_mutex_lock_lock(ldv_func_arg1); mutex_lock(ldv_func_arg1); return; } } void ldv_mutex_unlock_2(struct mutex *ldv_func_arg1 ) { { ldv_mutex_unlock_lock(ldv_func_arg1); mutex_unlock(ldv_func_arg1); return; } } void ldv_mutex_lock_3(struct mutex *ldv_func_arg1 ) { { ldv_mutex_lock_mutex_of_device(ldv_func_arg1); mutex_lock(ldv_func_arg1); return; } } int ldv_mutex_trylock_4(struct mutex *ldv_func_arg1 ) { ldv_func_ret_type___2 ldv_func_res ; int tmp ; int tmp___0 ; { tmp = mutex_trylock(ldv_func_arg1); ldv_func_res = tmp; tmp___0 = ldv_mutex_trylock_mutex_of_device(ldv_func_arg1); return (tmp___0); return (ldv_func_res); } } void ldv_mutex_unlock_5(struct mutex *ldv_func_arg1 ) { { ldv_mutex_unlock_mutex_of_device(ldv_func_arg1); mutex_unlock(ldv_func_arg1); return; } } void ldv_mutex_lock_6(struct mutex *ldv_func_arg1 ) { { ldv_mutex_lock_cred_guard_mutex_of_signal_struct(ldv_func_arg1); mutex_lock(ldv_func_arg1); return; } } void ldv_mutex_unlock_7(struct mutex *ldv_func_arg1 ) { { ldv_mutex_unlock_cred_guard_mutex_of_signal_struct(ldv_func_arg1); mutex_unlock(ldv_func_arg1); return; } } int ldv_register_netdev_8(struct net_device *dev ) { ldv_func_ret_type___6 ldv_func_res ; int tmp ; { tmp = register_netdev(dev); ldv_func_res = tmp; ldv_state_variable_5 = 1; return (ldv_func_res); } } void ldv_unregister_netdev_9(struct net_device *dev ) { { unregister_netdev(dev); ldv_state_variable_5 = 0; return; } } void ldv_unregister_netdev_10(struct net_device *dev ) { { unregister_netdev(dev); ldv_state_variable_5 = 0; return; } } __inline static int test_and_clear_bit(int nr , unsigned long volatile *addr ) { int oldbit ; { __asm__ volatile (".pushsection .smp_locks,\"a\"\n.balign 4\n.long 671f - .\n.popsection\n671:\n\tlock; btr %2,%1\n\tsbb %0,%0": "=r" (oldbit), "+m" (*((long volatile *)addr)): "Ir" (nr): "memory"); return (oldbit); } } __inline static int constant_test_bit(unsigned int nr , unsigned long const volatile *addr ) { { return ((int )((unsigned long )*(addr + (unsigned long )(nr / 64U)) >> ((int )nr & 63)) & 1); } } __inline static int variable_test_bit(int nr , unsigned long const volatile *addr ) { int oldbit ; { __asm__ volatile ("bt %2,%1\n\tsbb %0,%0": "=r" (oldbit): "m" (*((unsigned long *)addr)), "Ir" (nr)); return (oldbit); } } __inline static __u16 __fswab16(__u16 val ) { { return ((__u16 )((int )((short )((int )val << 8)) | (int )((short )((int )val >> 8)))); } } extern void __list_del_entry(struct list_head * ) ; __inline static void list_del_init(struct list_head *entry ) { { __list_del_entry(entry); INIT_LIST_HEAD(entry); return; } } __inline static int list_empty(struct list_head const *head ) { { return ((unsigned long )((struct list_head const *)head->next) == (unsigned long )head); } } extern unsigned long __phys_addr(unsigned long ) ; extern void __bad_percpu_size(void) ; extern struct task_struct *current_task ; __inline static struct task_struct *get_current(void) { struct task_struct *pfo_ret__ ; { switch (8UL) { case 1: __asm__ ("movb %%gs:%P1,%0": "=q" (pfo_ret__): "p" (& current_task)); goto ldv_2861; case 2: __asm__ ("movw %%gs:%P1,%0": "=r" (pfo_ret__): "p" (& current_task)); goto ldv_2861; case 4: __asm__ ("movl %%gs:%P1,%0": "=r" (pfo_ret__): "p" (& current_task)); goto ldv_2861; case 8: __asm__ ("movq %%gs:%P1,%0": "=r" (pfo_ret__): "p" (& current_task)); goto ldv_2861; default: __bad_percpu_size(); } ldv_2861: ; return (pfo_ret__); } } extern void *__memcpy(void * , void const * , size_t ) ; extern void *memset(void * , int , size_t ) ; extern void __xadd_wrong_size(void) ; __inline static void atomic_set(atomic_t *v , int i ) { { v->counter = i; return; } } __inline static void atomic_dec(atomic_t *v ) { { __asm__ volatile (".pushsection .smp_locks,\"a\"\n.balign 4\n.long 671f - .\n.popsection\n671:\n\tlock; decl %0": "+m" (v->counter)); return; } } __inline static int atomic_add_return(int i , atomic_t *v ) { int __ret ; { __ret = i; switch (4UL) { case 1: __asm__ volatile (".pushsection .smp_locks,\"a\"\n.balign 4\n.long 671f - .\n.popsection\n671:\n\tlock; xaddb %b0, %1\n": "+q" (__ret), "+m" (v->counter): : "memory", "cc"); goto ldv_5474; case 2: __asm__ volatile (".pushsection .smp_locks,\"a\"\n.balign 4\n.long 671f - .\n.popsection\n671:\n\tlock; xaddw %w0, %1\n": "+r" (__ret), "+m" (v->counter): : "memory", "cc"); goto ldv_5474; case 4: __asm__ volatile (".pushsection .smp_locks,\"a\"\n.balign 4\n.long 671f - .\n.popsection\n671:\n\tlock; xaddl %0, %1\n": "+r" (__ret), "+m" (v->counter): : "memory", "cc"); goto ldv_5474; case 8: __asm__ volatile (".pushsection .smp_locks,\"a\"\n.balign 4\n.long 671f - .\n.popsection\n671:\n\tlock; xaddq %q0, %1\n": "+r" (__ret), "+m" (v->counter): : "memory", "cc"); goto ldv_5474; default: __xadd_wrong_size(); } ldv_5474: ; return (__ret + i); } } int ldv_mutex_trylock_24(struct mutex *ldv_func_arg1 ) ; void ldv_mutex_unlock_22(struct mutex *ldv_func_arg1 ) ; void ldv_mutex_unlock_25(struct mutex *ldv_func_arg1 ) ; void ldv_mutex_unlock_27(struct mutex *ldv_func_arg1 ) ; void ldv_mutex_lock_21(struct mutex *ldv_func_arg1 ) ; void ldv_mutex_lock_23(struct mutex *ldv_func_arg1 ) ; void ldv_mutex_lock_26(struct mutex *ldv_func_arg1 ) ; extern void _raw_spin_lock(raw_spinlock_t * ) ; extern void _raw_spin_unlock(raw_spinlock_t * ) ; __inline static void spin_lock(spinlock_t *lock ) { { _raw_spin_lock(& lock->ldv_5961.rlock); return; } } __inline static void spin_unlock(spinlock_t *lock ) { { _raw_spin_unlock(& lock->ldv_5961.rlock); return; } } extern void __init_waitqueue_head(wait_queue_head_t * , char const * , struct lock_class_key * ) ; extern void __wake_up(wait_queue_head_t * , unsigned int , int , void * ) ; extern void prepare_to_wait(wait_queue_head_t * , wait_queue_t * , int ) ; extern void finish_wait(wait_queue_head_t * , wait_queue_t * ) ; extern int autoremove_wake_function(wait_queue_t * , unsigned int , int , void * ) ; extern unsigned long volatile jiffies ; extern unsigned long msecs_to_jiffies(unsigned int const ) ; extern int del_timer(struct timer_list * ) ; extern int mod_timer(struct timer_list * , unsigned long ) ; extern void add_timer(struct timer_list * ) ; extern struct workqueue_struct *system_wq ; extern bool mod_delayed_work(struct workqueue_struct * , struct delayed_work * , unsigned long ) ; extern bool schedule_delayed_work(struct delayed_work * , unsigned long ) ; extern void __const_udelay(unsigned long ) ; extern void msleep(unsigned int ) ; extern long schedule_timeout(long ) ; __inline static void kmemcheck_mark_initialized(void *address , unsigned int n ) { { return; } } __inline static int valid_dma_direction(int dma_direction ) { { return ((dma_direction == 0 || dma_direction == 1) || dma_direction == 2); } } __inline static int is_device_dma_capable(struct device *dev ) { { return ((unsigned long )dev->dma_mask != (unsigned long )((u64 *)0) && *(dev->dma_mask) != 0ULL); } } extern void debug_dma_map_page(struct device * , struct page * , size_t , size_t , int , dma_addr_t , bool ) ; extern void debug_dma_unmap_page(struct device * , dma_addr_t , size_t , int , bool ) ; extern void debug_dma_alloc_coherent(struct device * , size_t , dma_addr_t , void * ) ; extern struct device x86_dma_fallback_dev ; __inline static dma_addr_t dma_map_single_attrs(struct device *dev , void *ptr , size_t size , enum dma_data_direction dir , struct dma_attrs *attrs ) { struct dma_map_ops *ops ; struct dma_map_ops *tmp ; dma_addr_t addr ; int tmp___0 ; long tmp___1 ; unsigned long tmp___2 ; unsigned long tmp___3 ; { tmp = get_dma_ops(dev); ops = tmp; kmemcheck_mark_initialized(ptr, (unsigned int )size); tmp___0 = valid_dma_direction((int )dir); tmp___1 = ldv__builtin_expect(tmp___0 == 0, 0L); if (tmp___1 != 0L) { __asm__ volatile ("1:\tud2\n.pushsection __bug_table,\"a\"\n2:\t.long 1b - 2b, %c0 - 2b\n\t.word %c1, 0\n\t.org 2b+%c2\n.popsection": : "i" ((char *)"include/asm-generic/dma-mapping-common.h"), "i" (19), "i" (12UL)); ldv_27854: ; goto ldv_27854; } else { } tmp___2 = __phys_addr((unsigned long )ptr); addr = (*(ops->map_page))(dev, 0xffffea0000000000UL + (tmp___2 >> 12), (unsigned long )ptr & 4095UL, size, dir, attrs); tmp___3 = __phys_addr((unsigned long )ptr); debug_dma_map_page(dev, 0xffffea0000000000UL + (tmp___3 >> 12), (unsigned long )ptr & 4095UL, size, (int )dir, addr, 1); return (addr); } } __inline static void dma_unmap_single_attrs(struct device *dev , dma_addr_t addr , size_t size , enum dma_data_direction dir , struct dma_attrs *attrs ) { struct dma_map_ops *ops ; struct dma_map_ops *tmp ; int tmp___0 ; long tmp___1 ; { tmp = get_dma_ops(dev); ops = tmp; tmp___0 = valid_dma_direction((int )dir); tmp___1 = ldv__builtin_expect(tmp___0 == 0, 0L); if (tmp___1 != 0L) { __asm__ volatile ("1:\tud2\n.pushsection __bug_table,\"a\"\n2:\t.long 1b - 2b, %c0 - 2b\n\t.word %c1, 0\n\t.org 2b+%c2\n.popsection": : "i" ((char *)"include/asm-generic/dma-mapping-common.h"), "i" (36), "i" (12UL)); ldv_27863: ; goto ldv_27863; } else { } if ((unsigned long )ops->unmap_page != (unsigned long )((void (*)(struct device * , dma_addr_t , size_t , enum dma_data_direction , struct dma_attrs * ))0)) { (*(ops->unmap_page))(dev, addr, size, dir, attrs); } else { } debug_dma_unmap_page(dev, addr, size, (int )dir, 1); return; } } __inline static void dma_unmap_page(struct device *dev , dma_addr_t addr , size_t size , enum dma_data_direction dir ) { struct dma_map_ops *ops ; struct dma_map_ops *tmp ; int tmp___0 ; long tmp___1 ; { tmp = get_dma_ops(dev); ops = tmp; tmp___0 = valid_dma_direction((int )dir); tmp___1 = ldv__builtin_expect(tmp___0 == 0, 0L); if (tmp___1 != 0L) { __asm__ volatile ("1:\tud2\n.pushsection __bug_table,\"a\"\n2:\t.long 1b - 2b, %c0 - 2b\n\t.word %c1, 0\n\t.org 2b+%c2\n.popsection": : "i" ((char *)"include/asm-generic/dma-mapping-common.h"), "i" (91), "i" (12UL)); ldv_27905: ; goto ldv_27905; } else { } if ((unsigned long )ops->unmap_page != (unsigned long )((void (*)(struct device * , dma_addr_t , size_t , enum dma_data_direction , struct dma_attrs * ))0)) { (*(ops->unmap_page))(dev, addr, size, dir, 0); } else { } debug_dma_unmap_page(dev, addr, size, (int )dir, 0); return; } } __inline static unsigned long dma_alloc_coherent_mask(struct device *dev , gfp_t gfp ) { unsigned long dma_mask ; { dma_mask = 0UL; dma_mask = (unsigned long )dev->coherent_dma_mask; if (dma_mask == 0UL) { if ((int )gfp & 1) { dma_mask = 16777215UL; } else { dma_mask = 4294967295UL; } } else { } return (dma_mask); } } __inline static gfp_t dma_alloc_coherent_gfp_flags(struct device *dev , gfp_t gfp ) { unsigned long dma_mask ; unsigned long tmp ; { tmp = dma_alloc_coherent_mask(dev, gfp); dma_mask = tmp; if ((unsigned long long )dma_mask <= 16777215ULL) { gfp = gfp | 1U; } else { } if ((unsigned long long )dma_mask <= 4294967295ULL && (gfp & 1U) == 0U) { gfp = gfp | 4U; } else { } return (gfp); } } __inline static void *dma_alloc_attrs(struct device *dev , size_t size , dma_addr_t *dma_handle , gfp_t gfp , struct dma_attrs *attrs ) { struct dma_map_ops *ops ; struct dma_map_ops *tmp ; void *memory ; int tmp___0 ; gfp_t tmp___1 ; { tmp = get_dma_ops(dev); ops = tmp; gfp = gfp & 4294967288U; if ((unsigned long )dev == (unsigned long )((struct device *)0)) { dev = & x86_dma_fallback_dev; } else { } tmp___0 = is_device_dma_capable(dev); if (tmp___0 == 0) { return (0); } else { } if ((unsigned long )ops->alloc == (unsigned long )((void *(*)(struct device * , size_t , dma_addr_t * , gfp_t , struct dma_attrs * ))0)) { return (0); } else { } tmp___1 = dma_alloc_coherent_gfp_flags(dev, gfp); memory = (*(ops->alloc))(dev, size, dma_handle, tmp___1, attrs); debug_dma_alloc_coherent(dev, size, *dma_handle, memory); return (memory); } } extern void consume_skb(struct sk_buff * ) ; extern unsigned char *skb_put(struct sk_buff * , unsigned int ) ; __inline static unsigned char *skb_transport_header(struct sk_buff const *skb ) { { return ((unsigned char *)skb->head + (unsigned long )skb->transport_header); } } __inline static void skb_reset_transport_header(struct sk_buff *skb ) { { skb->transport_header = (sk_buff_data_t )((long )skb->data) - (sk_buff_data_t )((long )skb->head); return; } } __inline static void skb_set_transport_header(struct sk_buff *skb , int const offset ) { { skb_reset_transport_header(skb); skb->transport_header = skb->transport_header + (sk_buff_data_t )offset; return; } } __inline static unsigned char *skb_network_header(struct sk_buff const *skb ) { { return ((unsigned char *)skb->head + (unsigned long )skb->network_header); } } __inline static void skb_reset_network_header(struct sk_buff *skb ) { { skb->network_header = (sk_buff_data_t )((long )skb->data) - (sk_buff_data_t )((long )skb->head); return; } } extern struct sk_buff *__netdev_alloc_skb(struct net_device * , unsigned int , gfp_t ) ; __inline static struct sk_buff *netdev_alloc_skb(struct net_device *dev , unsigned int length ) { struct sk_buff *tmp ; { tmp = __netdev_alloc_skb(dev, length, 32U); return (tmp); } } __inline static struct sk_buff *dev_alloc_skb(unsigned int length ) { struct sk_buff *tmp ; { tmp = netdev_alloc_skb(0, length); return (tmp); } } extern void __napi_schedule(struct napi_struct * ) ; __inline static bool napi_disable_pending(struct napi_struct *n ) { int tmp ; { tmp = constant_test_bit(1U, (unsigned long const volatile *)(& n->state)); return (tmp != 0); } } __inline static bool napi_schedule_prep(struct napi_struct *n ) { bool tmp ; int tmp___0 ; int tmp___1 ; int tmp___2 ; { tmp = napi_disable_pending(n); if (tmp) { tmp___0 = 0; } else { tmp___0 = 1; } if (tmp___0) { tmp___1 = test_and_set_bit(0, (unsigned long volatile *)(& n->state)); if (tmp___1 == 0) { tmp___2 = 1; } else { tmp___2 = 0; } } else { tmp___2 = 0; } return ((bool )tmp___2); } } __inline static void napi_schedule(struct napi_struct *n ) { bool tmp ; { tmp = napi_schedule_prep(n); if ((int )tmp) { __napi_schedule(n); } else { } return; } } extern int netpoll_trap(void) ; extern void __netif_schedule(struct Qdisc * ) ; __inline static void netif_tx_start_queue(struct netdev_queue *dev_queue ) { { clear_bit(0, (unsigned long volatile *)(& dev_queue->state)); return; } } __inline static void netif_start_queue(struct net_device *dev ) { struct netdev_queue *tmp ; { tmp = netdev_get_tx_queue((struct net_device const *)dev, 0U); netif_tx_start_queue(tmp); return; } } __inline static void netif_tx_wake_queue(struct netdev_queue *dev_queue ) { int tmp ; int tmp___0 ; { tmp = netpoll_trap(); if (tmp != 0) { netif_tx_start_queue(dev_queue); return; } else { } tmp___0 = test_and_clear_bit(0, (unsigned long volatile *)(& dev_queue->state)); if (tmp___0 != 0) { __netif_schedule(dev_queue->qdisc); } else { } return; } } __inline static void netif_wake_queue(struct net_device *dev ) { struct netdev_queue *tmp ; { tmp = netdev_get_tx_queue((struct net_device const *)dev, 0U); netif_tx_wake_queue(tmp); return; } } __inline static bool netif_tx_queue_stopped(struct netdev_queue const *dev_queue ) { int tmp ; { tmp = constant_test_bit(0U, (unsigned long const volatile *)(& dev_queue->state)); return (tmp != 0); } } __inline static bool netif_queue_stopped(struct net_device const *dev ) { struct netdev_queue *tmp ; bool tmp___0 ; { tmp = netdev_get_tx_queue(dev, 0U); tmp___0 = netif_tx_queue_stopped((struct netdev_queue const *)tmp); return (tmp___0); } } extern void dev_kfree_skb_any(struct sk_buff * ) ; extern int netif_receive_skb(struct sk_buff * ) ; extern void netif_carrier_on(struct net_device * ) ; extern void netif_carrier_off(struct net_device * ) ; extern __be16 eth_type_trans(struct sk_buff * , struct net_device * ) ; __inline static struct iphdr *ip_hdr(struct sk_buff const *skb ) { unsigned char *tmp ; { tmp = skb_network_header(skb); return ((struct iphdr *)tmp); } } __inline static struct tcphdr *tcp_hdr(struct sk_buff const *skb ) { unsigned char *tmp ; { tmp = skb_transport_header(skb); return ((struct tcphdr *)tmp); } } __inline static struct sk_buff *__vlan_hwaccel_put_tag(struct sk_buff *skb , u16 vlan_tci ) { { skb->vlan_tci = (__u16 )((unsigned int )vlan_tci | 4096U); return (skb); } } __inline static unsigned int ip_hdrlen(struct sk_buff const *skb ) { struct iphdr *tmp ; { tmp = ip_hdr(skb); return ((unsigned int )((int )tmp->ihl * 4)); } } extern void lro_receive_skb(struct net_lro_mgr * , struct sk_buff * , void * ) ; extern void lro_flush_all(struct net_lro_mgr * ) ; extern int pci_bus_read_config_word(struct pci_bus * , unsigned int , int , u16 * ) ; __inline static void *pci_alloc_consistent(struct pci_dev *hwdev , size_t size , dma_addr_t *dma_handle ) { struct device *tmp ; void *tmp___0 ; { if ((unsigned long )hwdev != (unsigned long )((struct pci_dev *)0)) { tmp = & hwdev->dev; } else { tmp = 0; } tmp___0 = dma_alloc_attrs(tmp, size, dma_handle, 32U, 0); return (tmp___0); } } __inline static dma_addr_t pci_map_single(struct pci_dev *hwdev , void *ptr , size_t size , int direction ) { struct device *tmp ; dma_addr_t tmp___0 ; { if ((unsigned long )hwdev != (unsigned long )((struct pci_dev *)0)) { tmp = & hwdev->dev; } else { tmp = 0; } tmp___0 = dma_map_single_attrs(tmp, ptr, size, (enum dma_data_direction )direction, 0); return (tmp___0); } } __inline static void pci_unmap_single(struct pci_dev *hwdev , dma_addr_t dma_addr , size_t size , int direction ) { struct device *tmp ; { if ((unsigned long )hwdev != (unsigned long )((struct pci_dev *)0)) { tmp = & hwdev->dev; } else { tmp = 0; } dma_unmap_single_attrs(tmp, dma_addr, size, (enum dma_data_direction )direction, 0); return; } } __inline static void pci_unmap_page(struct pci_dev *hwdev , dma_addr_t dma_address , size_t size , int direction ) { struct device *tmp ; { if ((unsigned long )hwdev != (unsigned long )((struct pci_dev *)0)) { tmp = & hwdev->dev; } else { tmp = 0; } dma_unmap_page(tmp, dma_address, size, (enum dma_data_direction )direction); return; } } int schedule_nes_timer(struct nes_cm_node *cm_node , struct sk_buff *skb , enum nes_timer_type type , int send_retrans , int close_when_complete ) ; int nes_cm_recv(struct sk_buff *skb , struct net_device *netdevice ) ; int nes_init_mgt_qp(struct nes_device *nesdev , struct net_device *netdev , struct nes_vnic *nesvnic ) ; void nes_destroy_mgt(struct nes_vnic *nesvnic ) ; u32 mh_detected ; u32 int_mod_timer_init ; u32 int_mod_cq_depth_256 ; u32 int_mod_cq_depth_128 ; u32 int_mod_cq_depth_32 ; u32 int_mod_cq_depth_24 ; u32 int_mod_cq_depth_16 ; u32 int_mod_cq_depth_4 ; u32 int_mod_cq_depth_1 ; __inline static int nes_is_resource_allocated(struct nes_adapter *nesadapter , unsigned long *resource_array , u32 resource_num ) { unsigned long flags ; int bit_is_set ; raw_spinlock_t *tmp ; char *tmp___0 ; { tmp = spinlock_check(& nesadapter->resource_lock); flags = _raw_spin_lock_irqsave(tmp); bit_is_set = variable_test_bit((int )resource_num, (unsigned long const volatile *)resource_array); if ((int )nes_debug_level & 1) { if (bit_is_set != 0) { tmp___0 = (char *)""; } else { tmp___0 = (char *)" not"; } printk("\viw_nes: %s[%u]: resource_num %u is%s allocated.\n", "nes_is_resource_allocated", 451, resource_num, tmp___0); } else { } spin_unlock_irqrestore(& nesadapter->resource_lock, flags); return (bit_is_set); } } void nes_nic_init_timer_defaults(struct nes_device *nesdev , u8 jumbomode ) ; int nes_init_phy(struct nes_device *nesdev ) ; int nes_init_nic_qp(struct nes_device *nesdev , struct net_device *netdev ) ; void nes_destroy_nic_qp(struct nes_vnic *nesvnic ) ; void nes_nic_ce_handler(struct nes_device *nesdev , struct nes_hw_nic_cq *cq ) ; void nes_iwarp_ce_handler(struct nes_device *nesdev , struct nes_hw_cq *hw_cq ) ; void nes_terminate_timeout(unsigned long context ) ; void flush_wqes(struct nes_device *nesdev , struct nes_qp *nesqp , u32 which_wq , u32 wait_completion ) ; int nes_manage_apbvt(struct nes_vnic *nesvnic , u32 accel_local_port , u32 nic_index , u32 add_port ) ; int nes_cm_disconn(struct nes_qp *nesqp ) ; int nes_hw_modify_qp(struct nes_device *nesdev , struct nes_qp *nesqp , u32 next_iwarp_state , u32 termlen , u32 wait_completion ) ; void nes_port_ibevent(struct nes_vnic *nesvnic ) ; int nes_read_eeprom_values(struct nes_device *nesdev , struct nes_adapter *nesadapter ) ; void nes_write_1G_phy_reg(struct nes_device *nesdev , u8 phy_reg , u8 phy_addr , u16 data ) ; void nes_read_1G_phy_reg(struct nes_device *nesdev , u8 phy_reg , u8 phy_addr , u16 *data ) ; void nes_write_10G_phy_reg(struct nes_device *nesdev , u16 phy_addr , u8 dev_addr , u16 phy_reg , u16 data ) ; void nes_read_10G_phy_reg(struct nes_device *nesdev , u8 phy_addr , u8 dev_addr , u16 phy_reg ) ; void nes_free_cqp_request(struct nes_device *nesdev , struct nes_cqp_request *cqp_request ) ; void nes_put_cqp_request(struct nes_device *nesdev , struct nes_cqp_request *cqp_request ) ; int nes_arp_table(struct nes_device *nesdev , u32 ip_addr , u8 *mac_addr , u32 action ) ; void nes_mh_fix(unsigned long parm ) ; void nes_clc(unsigned long parm ) ; static unsigned int nes_lro_max_aggr = 64U; static int wide_ppm_offset ; static u32 crit_err_count ; static unsigned char const nes_max_critical_error_count = 100U; static void nes_cqp_ce_handler(struct nes_device *nesdev , struct nes_hw_cq *cq ) ; static void nes_init_csr_ne020(struct nes_device *nesdev , u8 hw_rev , u8 port_count ) ; static int nes_init_serdes(struct nes_device *nesdev , u8 hw_rev , u8 port_count , struct nes_adapter *nesadapter , u8 OneG_Mode ) ; static void nes_nic_napi_ce_handler(struct nes_device *nesdev , struct nes_hw_nic_cq *cq ) ; static void nes_process_aeq(struct nes_device *nesdev , struct nes_hw_aeq *aeq ) ; static void nes_process_ceq(struct nes_device *nesdev , struct nes_hw_ceq *ceq ) ; static void nes_process_iwarp_aeqe(struct nes_device *nesdev , struct nes_hw_aeqe *aeqe ) ; static void process_critical_error(struct nes_device *nesdev ) ; static void nes_process_mac_intr(struct nes_device *nesdev , u32 mac_number ) ; static unsigned int nes_reset_adapter_ne020(struct nes_device *nesdev , u8 *OneG_Mode ) ; static void nes_terminate_start_timer(struct nes_qp *nesqp ) ; __inline static void print_ip(struct nes_cm_node *cm_node ) { unsigned char *rem_addr ; { if ((unsigned long )cm_node != (unsigned long )((struct nes_cm_node *)0)) { rem_addr = (unsigned char *)(& cm_node->rem_addr); printk("\viw_nes: Remote IP addr: %pI4\n", rem_addr); } else { } return; } } void nes_nic_init_timer_defaults(struct nes_device *nesdev , u8 jumbomode ) { unsigned long flags ; struct nes_adapter *nesadapter ; struct nes_hw_tune_timer *shared_timer ; raw_spinlock_t *tmp ; { nesadapter = nesdev->nesadapter; shared_timer = & nesadapter->tune_timer; tmp = spinlock_check(& nesadapter->periodic_timer_lock); flags = _raw_spin_lock_irqsave(tmp); shared_timer->timer_in_use_min = 40U; shared_timer->timer_in_use_max = 1000U; if ((unsigned int )jumbomode != 0U) { shared_timer->threshold_low = 12U; shared_timer->threshold_target = 40U; shared_timer->threshold_high = 128U; } else { shared_timer->threshold_low = 16U; shared_timer->threshold_target = 64U; shared_timer->threshold_high = 256U; } spin_unlock_irqrestore(& nesadapter->periodic_timer_lock, flags); return; } } static void nes_nic_init_timer(struct nes_device *nesdev ) { unsigned long flags ; struct nes_adapter *nesadapter ; struct nes_hw_tune_timer *shared_timer ; raw_spinlock_t *tmp ; { nesadapter = nesdev->nesadapter; shared_timer = & nesadapter->tune_timer; tmp = spinlock_check(& nesadapter->periodic_timer_lock); flags = _raw_spin_lock_irqsave(tmp); if ((unsigned int )shared_timer->timer_in_use_old == 0U) { nesdev->deepcq_count = 0U; shared_timer->timer_direction_upward = 0U; shared_timer->timer_direction_downward = 0U; shared_timer->timer_in_use = 96U; shared_timer->timer_in_use_old = 0U; } else { } if ((int )shared_timer->timer_in_use != (int )shared_timer->timer_in_use_old) { shared_timer->timer_in_use_old = shared_timer->timer_in_use; nes_write32(nesdev->regs + 24UL, (unsigned int )((int )shared_timer->timer_in_use * 8) | 2147483648U); } else { } spin_unlock_irqrestore(& nesadapter->periodic_timer_lock, flags); return; } } static void nes_nic_tune_timer(struct nes_device *nesdev ) { unsigned long flags ; struct nes_adapter *nesadapter ; struct nes_hw_tune_timer *shared_timer ; u16 cq_count ; raw_spinlock_t *tmp ; { nesadapter = nesdev->nesadapter; shared_timer = & nesadapter->tune_timer; cq_count = nesdev->currcq_count; tmp = spinlock_check(& nesadapter->periodic_timer_lock); flags = _raw_spin_lock_irqsave(tmp); if ((int )shared_timer->cq_count_old <= (int )cq_count) { shared_timer->cq_direction_downward = 0U; } else { shared_timer->cq_direction_downward = (u8 )((int )shared_timer->cq_direction_downward + 1); } shared_timer->cq_count_old = cq_count; if ((unsigned int )shared_timer->cq_direction_downward > 16U) { if ((int )shared_timer->threshold_low >= (int )cq_count && (unsigned int )shared_timer->threshold_low > 4U) { shared_timer->threshold_low = (u16 )((unsigned int )shared_timer->threshold_low / 2U); shared_timer->cq_direction_downward = 0U; nesdev->currcq_count = 0U; spin_unlock_irqrestore(& nesadapter->periodic_timer_lock, flags); return; } else { } } else { } if ((unsigned int )cq_count > 1U) { nesdev->deepcq_count = (int )nesdev->deepcq_count + (int )cq_count; if ((int )shared_timer->threshold_low >= (int )cq_count) { shared_timer->timer_direction_upward = (u8 )((int )shared_timer->timer_direction_upward + 1); shared_timer->timer_direction_downward = 0U; } else if ((int )shared_timer->threshold_target >= (int )cq_count) { shared_timer->timer_direction_upward = 0U; shared_timer->timer_direction_downward = 0U; } else if ((int )shared_timer->threshold_high >= (int )cq_count) { shared_timer->timer_direction_downward = (u8 )((int )shared_timer->timer_direction_downward + 1); shared_timer->timer_direction_upward = 0U; } else if ((int )cq_count <= (int )shared_timer->threshold_high * 2) { shared_timer->timer_in_use = (unsigned int )shared_timer->timer_in_use + 65534U; shared_timer->timer_direction_upward = 0U; shared_timer->timer_direction_downward = (u8 )((int )shared_timer->timer_direction_downward + 1); } else { shared_timer->timer_in_use = (unsigned int )shared_timer->timer_in_use + 65532U; shared_timer->timer_direction_upward = 0U; shared_timer->timer_direction_downward = (u8 )((int )shared_timer->timer_direction_downward + 1); } if ((unsigned int )shared_timer->timer_direction_upward > 3U) { shared_timer->timer_in_use = (unsigned int )shared_timer->timer_in_use + 3U; shared_timer->timer_direction_upward = 0U; shared_timer->timer_direction_downward = 0U; } else { } if ((unsigned int )shared_timer->timer_direction_downward > 5U) { shared_timer->timer_in_use = (unsigned int )shared_timer->timer_in_use + 65532U; shared_timer->timer_direction_downward = 0U; shared_timer->timer_direction_upward = 0U; } else { } } else { } if ((int )shared_timer->timer_in_use > (int )shared_timer->threshold_high) { shared_timer->timer_in_use = shared_timer->threshold_high; } else if ((int )shared_timer->timer_in_use < (int )shared_timer->threshold_low) { shared_timer->timer_in_use = shared_timer->threshold_low; } else { } nesdev->currcq_count = 0U; spin_unlock_irqrestore(& nesadapter->periodic_timer_lock, flags); return; } } struct nes_adapter *nes_init_adapter(struct nes_device *nesdev , u8 hw_rev ) { struct nes_adapter *nesadapter ; unsigned long num_pds ; u32 u32temp ; u32 port_count ; u16 max_rq_wrs ; u16 max_sq_wrs ; u32 max_mr ; u32 max_256pbl ; u32 max_4kpbl ; u32 max_qp ; u32 max_irrq ; u32 max_cq ; u32 hte_index_mask ; u32 adapter_size ; u32 arp_table_size ; u16 vendor_id ; u16 device_id ; u8 OneG_Mode ; u8 func_index ; struct list_head const *__mptr ; struct list_head const *__mptr___0 ; u32 tmp ; u32 tmp___0 ; u32 tmp___1 ; u32 tmp___2 ; void *tmp___3 ; int tmp___4 ; int tmp___5 ; u16 _min1 ; u16 _min2 ; int tmp___6 ; int tmp___7 ; u32 tmp___8 ; struct lock_class_key __key ; struct lock_class_key __key___0 ; struct lock_class_key __key___1 ; struct lock_class_key __key___2 ; u32 pcs_control_status0 ; u32 pcs_control_status1 ; u32 reset_value ; u32 i ; u32 int_cnt ; u32 ext_cnt ; unsigned long flags ; u32 j ; raw_spinlock_t *tmp___9 ; u32 tmp___10 ; u32 tmp___11 ; raw_spinlock_t *tmp___12 ; u32 tmp___13 ; u32 tmp___14 ; struct lock_class_key __key___3 ; struct lock_class_key __key___4 ; char const *tmp___15 ; { nesadapter = 0; __mptr = (struct list_head const *)nes_adapter_list.next; nesadapter = (struct nes_adapter *)__mptr + 0xffffffffffffffc0UL; goto ldv_53653; ldv_53652: ; if ((nes_debug_level & 2U) != 0U) { printk("\viw_nes: %s[%u]: Searching Adapter list for PCI devfn = 0x%X, adapter PCI slot/bus = %u/%u, pci devices PCI slot/bus = %u/%u, .\n", "nes_init_adapter", 323, (nesdev->pcidev)->devfn, (nesadapter->devfn >> 3) & 31U, (int )nesadapter->bus_number, ((nesdev->pcidev)->devfn >> 3) & 31U, (int )((nesdev->pcidev)->bus)->number); } else { } if ((((nesadapter->devfn >> 3) ^ ((nesdev->pcidev)->devfn >> 3)) & 31U) == 0U && (int )nesadapter->bus_number == (int )((nesdev->pcidev)->bus)->number) { nesadapter->ref_count = (unsigned char )((int )nesadapter->ref_count + 1); return (nesadapter); } else { } __mptr___0 = (struct list_head const *)nesadapter->list.next; nesadapter = (struct nes_adapter *)__mptr___0 + 0xffffffffffffffc0UL; ldv_53653: ; if ((unsigned long )(& nesadapter->list) != (unsigned long )(& nes_adapter_list)) { goto ldv_53652; } else { goto ldv_53654; } ldv_53654: ; if ((nesdev->pcidev)->resource[2].start != 0ULL || (nesdev->pcidev)->resource[2].end != (nesdev->pcidev)->resource[2].start) { num_pds = (unsigned long )((((nesdev->pcidev)->resource[2].end - (nesdev->pcidev)->resource[2].start) + 1ULL) >> 12); } else { num_pds = 0UL; } if ((unsigned int )hw_rev != 4U && (unsigned int )hw_rev != 5U) { if ((nes_debug_level & 2U) != 0U) { printk("\viw_nes: %s[%u]: NE020 driver detected unknown hardware revision 0x%x\n", "nes_init_adapter", 335, (int )hw_rev); } else { } return (0); } else { } if ((nes_debug_level & 2U) != 0U) { tmp = nes_read_indexed(nesdev, 168U); tmp___0 = nes_read_indexed(nesdev, 164U); tmp___1 = nes_read_indexed(nesdev, 160U); tmp___2 = nes_read_indexed(nesdev, (((nesdev->pcidev)->devfn & 7U) + 8U) * 8U); printk("\viw_nes: %s[%u]: Determine Soft Reset, QP_control=0x%x, CPU0=0x%x, CPU1=0x%x, CPU2=0x%x\n", "nes_init_adapter", 343, tmp___2, tmp___1, tmp___0, tmp); } else { } if ((nes_debug_level & 2U) != 0U) { printk("\viw_nes: %s[%u]: Reset and init NE020\n", "nes_init_adapter", 345); } else { } port_count = nes_reset_adapter_ne020(nesdev, & OneG_Mode); if (port_count == 0U) { return (0); } else { } max_qp = nes_read_indexed(nesdev, 536U); if ((nes_debug_level & 2U) != 0U) { printk("\viw_nes: %s[%u]: QP_CTX_SIZE=%u\n", "nes_init_adapter", 352, max_qp); } else { } u32temp = nes_read_indexed(nesdev, 24904U); if (1U << ((int )u32temp & 31) < max_qp) { if ((nes_debug_level & 2U) != 0U) { printk("\viw_nes: %s[%u]: Reducing Max QPs to %u due to hash table size = 0x%08X\n", "nes_init_adapter", 357, max_qp, u32temp); } else { } max_qp = 1U << ((int )u32temp & 31); } else { } hte_index_mask = (1U << (int )((u32temp & 31U) + 1U)) - 1U; if ((nes_debug_level & 2U) != 0U) { printk("\viw_nes: %s[%u]: Max QP = %u, hte_index_mask = 0x%08X.\n", "nes_init_adapter", 363, max_qp, hte_index_mask); } else { } u32temp = nes_read_indexed(nesdev, 688U); max_irrq = (u32 )(1 << ((int )u32temp & 31)); if (max_qp > max_irrq) { max_qp = max_irrq; if ((nes_debug_level & 2U) != 0U) { printk("\viw_nes: %s[%u]: Reducing Max QPs to %u due to Available Q1s.\n", "nes_init_adapter", 372, max_qp); } else { } } else { } if ((unsigned long )max_qp < num_pds) { num_pds = (unsigned long )max_qp; } else { } u32temp = nes_read_indexed(nesdev, 632U); max_mr = 8192U << ((int )u32temp & 7); u32temp = nes_read_indexed(nesdev, 640U); max_256pbl = 1U << ((int )u32temp & 31); max_4kpbl = 1U << ((int )(u32temp >> 16) & 31); max_cq = nes_read_indexed(nesdev, 608U); u32temp = nes_read_indexed(nesdev, 600U); arp_table_size = (u32 )(1 << (int )u32temp); adapter_size = 50912U; adapter_size = (u32 )(((unsigned long )max_qp + 63UL) / 64UL) * 8U + adapter_size; adapter_size = (u32 )(((unsigned long )max_mr + 63UL) / 64UL) * 8U + adapter_size; adapter_size = (u32 )(((unsigned long )max_cq + 63UL) / 64UL) * 8U + adapter_size; adapter_size = (u32 )((num_pds + 63UL) / 64UL) * 8U + adapter_size; adapter_size = (u32 )(((unsigned long )arp_table_size + 63UL) / 64UL) * 8U + adapter_size; adapter_size = max_qp * 8U + adapter_size; tmp___3 = kzalloc((size_t )adapter_size, 208U); nesadapter = (struct nes_adapter *)tmp___3; if ((unsigned long )nesadapter == (unsigned long )((struct nes_adapter *)0)) { return (0); } else { } if ((nes_debug_level & 2U) != 0U) { printk("\viw_nes: %s[%u]: Allocating new nesadapter @ %p, size = %u (actual size = %u).\n", "nes_init_adapter", 406, nesadapter, 50912U, adapter_size); } else { } tmp___4 = nes_read_eeprom_values(nesdev, nesadapter); if (tmp___4 != 0) { printk("\viw_nes: Unable to read EEPROM data.\n"); kfree((void const *)nesadapter); return (0); } else { } nesadapter->vendor_id = ((unsigned int )nesadapter->mac_addr_high << 8) | (nesadapter->mac_addr_low >> 24); pci_bus_read_config_word((nesdev->pcidev)->bus, (nesdev->pcidev)->devfn, 2, & device_id); nesadapter->vendor_part_id = (u32 )device_id; tmp___5 = nes_init_serdes(nesdev, (int )hw_rev, (int )((u8 )port_count), nesadapter, (int )OneG_Mode); if (tmp___5 != 0) { kfree((void const *)nesadapter); return (0); } else { } nes_init_csr_ne020(nesdev, (int )hw_rev, (int )((u8 )port_count)); memset((void *)(& nesadapter->pft_mcast_map), 255, 48UL); nesadapter->devfn = (nesdev->pcidev)->devfn; nesadapter->bus_number = ((nesdev->pcidev)->bus)->number; nesadapter->ref_count = 1U; nesadapter->timer_int_req = 4294901760U; nesadapter->OneG_Mode = OneG_Mode; nesadapter->doorbell_start = nesdev->doorbell_region; nesadapter->hw_rev = (u32 )hw_rev; nesadapter->port_count = (u8 )port_count; nesadapter->max_qp = max_qp; nesadapter->hte_index_mask = hte_index_mask; nesadapter->max_irrq = max_irrq; nesadapter->max_mr = max_mr; nesadapter->max_256pbl = max_256pbl - 1U; nesadapter->max_4kpbl = max_4kpbl - 1U; nesadapter->max_cq = max_cq; nesadapter->free_256pbl = max_256pbl - 1U; nesadapter->free_4kpbl = max_4kpbl - 1U; nesadapter->max_pd = (u32 )num_pds; nesadapter->arp_table_size = arp_table_size; nesadapter->et_pkt_rate_low = 4U; if ((nes_drv_opt & 256U) != 0U) { nesadapter->et_use_adaptive_rx_coalesce = 0U; nesadapter->timer_int_limit = 2U; nesadapter->et_rx_coalesce_usecs_irq = (u32 )interrupt_mod_interval; } else { nesadapter->et_use_adaptive_rx_coalesce = 1U; nesadapter->timer_int_limit = 10U; nesadapter->et_rx_coalesce_usecs_irq = 0U; printk("iw_nes: %s: Using Adaptive Interrupt Moderation\n", "nes_init_adapter"); } if (nesadapter->et_rx_coalesce_usecs_irq != 0U) { nes_write32(nesdev->regs + 24UL, nesadapter->et_rx_coalesce_usecs_irq * 8U | 2147483648U); } else { nes_write32(nesdev->regs + 24UL, 0U); } nesadapter->base_pd = 1U; nesadapter->device_cap_flags = 2260992U; nesadapter->allocated_qps = (unsigned long *)nesadapter + 50912U; nesadapter->allocated_cqs = nesadapter->allocated_qps + ((unsigned long )max_qp + 63UL) / 64UL; nesadapter->allocated_mrs = nesadapter->allocated_cqs + ((unsigned long )max_cq + 63UL) / 64UL; nesadapter->allocated_pds = nesadapter->allocated_mrs + ((unsigned long )max_mr + 63UL) / 64UL; nesadapter->allocated_arps = nesadapter->allocated_pds + (num_pds + 63UL) / 64UL; nesadapter->qp_table = (struct nes_qp **)(nesadapter->allocated_arps + ((unsigned long )arp_table_size + 63UL) / 64UL); u32temp = 0U; goto ldv_53656; ldv_53655: set_bit(u32temp, (unsigned long volatile *)nesadapter->allocated_qps); set_bit(u32temp, (unsigned long volatile *)nesadapter->allocated_cqs); u32temp = u32temp + 1U; ldv_53656: ; if (u32temp <= 63U) { goto ldv_53655; } else { goto ldv_53657; } ldv_53657: set_bit(0U, (unsigned long volatile *)nesadapter->allocated_mrs); u32temp = 0U; goto ldv_53659; ldv_53658: set_bit(u32temp, (unsigned long volatile *)nesadapter->allocated_pds); u32temp = u32temp + 1U; ldv_53659: ; if (u32temp <= 19U) { goto ldv_53658; } else { goto ldv_53660; } ldv_53660: u32temp = nes_read_indexed(nesdev, 512U); max_rq_wrs = (unsigned int )((u16 )(u32temp >> 8)) & 3U; switch ((int )max_rq_wrs) { case 0: max_rq_wrs = 4U; goto ldv_53662; case 1: max_rq_wrs = 16U; goto ldv_53662; case 2: max_rq_wrs = 32U; goto ldv_53662; case 3: max_rq_wrs = 512U; goto ldv_53662; } ldv_53662: max_sq_wrs = (unsigned int )((u16 )u32temp) & 3U; switch ((int )max_sq_wrs) { case 0: max_sq_wrs = 4U; goto ldv_53667; case 1: max_sq_wrs = 16U; goto ldv_53667; case 2: max_sq_wrs = 32U; goto ldv_53667; case 3: max_sq_wrs = 512U; goto ldv_53667; } ldv_53667: _min1 = max_rq_wrs; _min2 = max_sq_wrs; if ((int )_min1 < (int )_min2) { tmp___6 = _min1; } else { tmp___6 = _min2; } nesadapter->max_qp_wr = (u32 )tmp___6; nesadapter->max_irrq_wr = (unsigned int )((u16 )(u32temp >> 16)) & 3U; nesadapter->max_sge = 4U; nesadapter->max_cqe = 32766U; tmp___7 = nes_read_eeprom_values(nesdev, nesadapter); if (tmp___7 != 0) { printk("\viw_nes: Unable to read EEPROM data.\n"); kfree((void const *)nesadapter); return (0); } else { } u32temp = nes_read_indexed(nesdev, 492U); nes_write_indexed(nesdev, 492U, (u32temp & 4278190080U) | (nesadapter->tcp_timer_core_clk_divisor & 16777215U)); if ((unsigned int )nesadapter->port_count == 1U) { nesadapter->log_port = 0U; if ((nes_drv_opt & 32U) != 0U) { nes_write_indexed(nesdev, 24760U, 2U); } else { nes_write_indexed(nesdev, 24760U, 3U); } } else { if ((unsigned int )nesadapter->phy_type[0] == 5U) { nesadapter->log_port = 216U; } else if ((unsigned int )nesadapter->port_count == 2U) { nesadapter->log_port = 68U; } else { nesadapter->log_port = 228U; } nes_write_indexed(nesdev, 24760U, 3U); } nes_write_indexed(nesdev, 24576U, (u32 )nesadapter->log_port); if ((nes_debug_level & 2U) != 0U) { tmp___8 = nes_read_indexed(nesdev, 24576U); printk("\viw_nes: %s[%u]: Probe time, LOG2PHY=%u\n", "nes_init_adapter", 568, tmp___8); } else { } spinlock_check(& nesadapter->resource_lock); __raw_spin_lock_init(& nesadapter->resource_lock.ldv_5961.rlock, "&(&nesadapter->resource_lock)->rlock", & __key); spinlock_check(& nesadapter->phy_lock); __raw_spin_lock_init(& nesadapter->phy_lock.ldv_5961.rlock, "&(&nesadapter->phy_lock)->rlock", & __key___0); spinlock_check(& nesadapter->pbl_lock); __raw_spin_lock_init(& nesadapter->pbl_lock.ldv_5961.rlock, "&(&nesadapter->pbl_lock)->rlock", & __key___1); spinlock_check(& nesadapter->periodic_timer_lock); __raw_spin_lock_init(& nesadapter->periodic_timer_lock.ldv_5961.rlock, "&(&nesadapter->periodic_timer_lock)->rlock", & __key___2); INIT_LIST_HEAD((struct list_head *)(& nesadapter->nesvnic_list)); INIT_LIST_HEAD((struct list_head *)(& nesadapter->nesvnic_list) + 1UL); INIT_LIST_HEAD((struct list_head *)(& nesadapter->nesvnic_list) + 2UL); INIT_LIST_HEAD((struct list_head *)(& nesadapter->nesvnic_list) + 3UL); if ((unsigned int )nesadapter->OneG_Mode == 0U && (unsigned int )nesadapter->port_count == 2U) { i = 0U; int_cnt = 0U; ext_cnt = 0U; j = 0U; pcs_control_status0 = nes_read_indexed(nesdev, 10240U); pcs_control_status1 = nes_read_indexed(nesdev, 10752U); i = 0U; goto ldv_53687; ldv_53686: pcs_control_status0 = nes_read_indexed(nesdev, 10240U); pcs_control_status1 = nes_read_indexed(nesdev, 10752U); if ((pcs_control_status0 & 251658496U) == 251658496U || (pcs_control_status1 & 251658496U) == 251658496U) { int_cnt = int_cnt + 1U; } else { } msleep(1U); i = i + 1U; ldv_53687: ; if (i <= 199U) { goto ldv_53686; } else { goto ldv_53688; } ldv_53688: ; if (int_cnt > 1U) { tmp___9 = spinlock_check(& nesadapter->phy_lock); flags = _raw_spin_lock_irqsave(tmp___9); nes_write_indexed(nesdev, 10760U, 61640U); mh_detected = mh_detected + 1U; reset_value = nes_read32((void const *)nesdev->regs + 48U); reset_value = reset_value | 61U; nes_write32(nesdev->regs + 48UL, reset_value); goto ldv_53693; ldv_53692: ; ldv_53693: tmp___10 = nes_read32((void const *)nesdev->regs + 48U); if ((tmp___10 & 64U) == 0U) { tmp___11 = j; j = j + 1U; if (tmp___11 <= 4999U) { goto ldv_53692; } else { goto ldv_53694; } } else { goto ldv_53694; } ldv_53694: spin_unlock_irqrestore(& nesadapter->phy_lock, flags); pcs_control_status0 = nes_read_indexed(nesdev, 10240U); pcs_control_status1 = nes_read_indexed(nesdev, 10752U); i = 0U; goto ldv_53703; ldv_53702: pcs_control_status0 = nes_read_indexed(nesdev, 10240U); pcs_control_status1 = nes_read_indexed(nesdev, 10752U); if ((pcs_control_status0 & 251658496U) == 251658496U || (pcs_control_status1 & 251658496U) == 251658496U) { ext_cnt = ext_cnt + 1U; if (ext_cnt > int_cnt) { tmp___12 = spinlock_check(& nesadapter->phy_lock); flags = _raw_spin_lock_irqsave(tmp___12); nes_write_indexed(nesdev, 10760U, 61576U); mh_detected = mh_detected + 1U; reset_value = nes_read32((void const *)nesdev->regs + 48U); reset_value = reset_value | 61U; nes_write32(nesdev->regs + 48UL, reset_value); goto ldv_53699; ldv_53698: ; ldv_53699: tmp___13 = nes_read32((void const *)nesdev->regs + 48U); if ((tmp___13 & 64U) == 0U) { tmp___14 = j; j = j + 1U; if (tmp___14 <= 4999U) { goto ldv_53698; } else { goto ldv_53700; } } else { goto ldv_53700; } ldv_53700: spin_unlock_irqrestore(& nesadapter->phy_lock, flags); goto ldv_53701; } else { } } else { } msleep(1U); i = i + 1U; ldv_53703: ; if (i <= 199U) { goto ldv_53702; } else { goto ldv_53701; } ldv_53701: ; } else { } } else { } if (nesadapter->hw_rev == 4U) { init_timer_key(& nesadapter->mh_timer, 0U, "(&nesadapter->mh_timer)", & __key___3); nesadapter->mh_timer.function = & nes_mh_fix; nesadapter->mh_timer.expires = (unsigned long )jiffies + 50UL; nesadapter->mh_timer.data = (unsigned long )nesdev; add_timer(& nesadapter->mh_timer); } else { nes_write32(nesdev->regs + 12UL, 251658240U); } init_timer_key(& nesadapter->lc_timer, 0U, "(&nesadapter->lc_timer)", & __key___4); nesadapter->lc_timer.function = & nes_clc; nesadapter->lc_timer.expires = (unsigned long )jiffies + 900000UL; nesadapter->lc_timer.data = (unsigned long )nesdev; add_timer(& nesadapter->lc_timer); list_add_tail(& nesadapter->list, & nes_adapter_list); func_index = 0U; goto ldv_53708; ldv_53707: pci_bus_read_config_word((nesdev->pcidev)->bus, ((nesdev->pcidev)->devfn & 248U) | ((unsigned int )func_index & 7U), 0, & vendor_id); if ((unsigned int )vendor_id == 65535U) { goto ldv_53706; } else { } func_index = (u8 )((int )func_index + 1); ldv_53708: ; if ((unsigned int )func_index <= 7U) { goto ldv_53707; } else { goto ldv_53706; } ldv_53706: ; if ((nes_debug_level & 2U) != 0U) { tmp___15 = pci_name((struct pci_dev const *)nesdev->pcidev); printk("\viw_nes: %s[%u]: %s %d functions found for %s.\n", "nes_init_adapter", 674, "nes_init_adapter", (int )func_index, tmp___15); } else { } nesadapter->adapter_fcn_count = func_index; return (nesadapter); } } static unsigned int nes_reset_adapter_ne020(struct nes_device *nesdev , u8 *OneG_Mode ) { u32 port_count ; u32 u32temp ; u32 i ; unsigned long __ms ; unsigned long tmp ; u32 tmp___0 ; u32 tmp___1 ; unsigned long __ms___0 ; unsigned long tmp___2 ; u32 tmp___3 ; u32 tmp___4 ; u32 tmp___5 ; u32 tmp___6 ; unsigned long __ms___1 ; unsigned long tmp___7 ; u32 tmp___8 ; u32 tmp___9 ; unsigned long __ms___2 ; unsigned long tmp___10 ; u32 tmp___11 ; u32 tmp___12 ; unsigned long __ms___3 ; unsigned long tmp___13 ; u32 tmp___14 ; u32 tmp___15 ; { u32temp = nes_read32((void const *)nesdev->regs + 48U); port_count = ((u32temp & 768U) >> 8) + 1U; *OneG_Mode = (u32temp & 15360U) == 0U; if ((nes_debug_level & 2U) != 0U) { printk("\viw_nes: %s[%u]: Initial Software Reset = 0x%08X, port_count=%u\n", "nes_reset_adapter_ne020", 695, u32temp, port_count); } else { } if ((unsigned int )*OneG_Mode != 0U) { if ((nes_debug_level & 2U) != 0U) { printk("\viw_nes: %s[%u]: Running in 1G mode.\n", "nes_reset_adapter_ne020", 697); } else { } } else { } u32temp = u32temp & 4278255552U; switch (port_count) { case 1: u32temp = u32temp | 15597568U; goto ldv_53718; case 2: u32temp = u32temp | 13369344U; goto ldv_53718; case 4: u32temp = u32temp; goto ldv_53718; default: ; return (0U); } ldv_53718: tmp___6 = nes_read_indexed(nesdev, (((nesdev->pcidev)->devfn & 7U) + 8U) * 8U); if (tmp___6 != 0U) { if ((nes_debug_level & 2U) != 0U) { printk("\viw_nes: %s[%u]: Issuing Full Soft reset = 0x%08X\n", "nes_reset_adapter_ne020", 716, u32temp | 13U); } else { } nes_write32(nesdev->regs + 48UL, u32temp | 13U); i = 0U; goto ldv_53727; ldv_53726: ; if (1) { __const_udelay(4295000UL); } else { __ms = 1UL; goto ldv_53724; ldv_53723: __const_udelay(4295000UL); ldv_53724: tmp = __ms; __ms = __ms - 1UL; if (tmp != 0UL) { goto ldv_53723; } else { goto ldv_53725; } ldv_53725: ; } ldv_53727: tmp___0 = nes_read32((void const *)nesdev->regs + 48U); if ((tmp___0 & 64U) == 0U) { tmp___1 = i; i = i + 1U; if (tmp___1 <= 9999U) { goto ldv_53726; } else { goto ldv_53728; } } else { goto ldv_53728; } ldv_53728: ; if (i > 10000U) { if ((nes_debug_level & 2U) != 0U) { printk("\viw_nes: %s[%u]: Did not see full soft reset done.\n", "nes_reset_adapter_ne020", 723); } else { } return (0U); } else { } i = 0U; goto ldv_53734; ldv_53733: ; if (1) { __const_udelay(4295000UL); } else { __ms___0 = 1UL; goto ldv_53731; ldv_53730: __const_udelay(4295000UL); ldv_53731: tmp___2 = __ms___0; __ms___0 = __ms___0 - 1UL; if (tmp___2 != 0UL) { goto ldv_53730; } else { goto ldv_53732; } ldv_53732: ; } ldv_53734: tmp___3 = nes_read_indexed(nesdev, 160U); if (tmp___3 != 128U) { tmp___4 = i; i = i + 1U; if (tmp___4 <= 9999U) { goto ldv_53733; } else { goto ldv_53735; } } else { goto ldv_53735; } ldv_53735: ; if (i > 10000U) { tmp___5 = nes_read_indexed(nesdev, 160U); printk("\viw_nes: Internal CPU not ready, status = %02X\n", tmp___5); return (0U); } else { } } else { } switch (port_count) { case 1: u32temp = u32temp | 15597584U; goto ldv_53737; case 2: u32temp = u32temp | 13369392U; goto ldv_53737; case 4: u32temp = u32temp | 48U; goto ldv_53737; } ldv_53737: ; if ((nes_debug_level & 2U) != 0U) { printk("\viw_nes: %s[%u]: Issuing Port Soft reset = 0x%08X\n", "nes_reset_adapter_ne020", 750, u32temp | 13U); } else { } nes_write32(nesdev->regs + 48UL, u32temp | 13U); i = 0U; goto ldv_53745; ldv_53744: ; if (1) { __const_udelay(4295000UL); } else { __ms___1 = 1UL; goto ldv_53742; ldv_53741: __const_udelay(4295000UL); ldv_53742: tmp___7 = __ms___1; __ms___1 = __ms___1 - 1UL; if (tmp___7 != 0UL) { goto ldv_53741; } else { goto ldv_53743; } ldv_53743: ; } ldv_53745: tmp___8 = nes_read32((void const *)nesdev->regs + 48U); if ((tmp___8 & 64U) == 0U) { tmp___9 = i; i = i + 1U; if (tmp___9 <= 9999U) { goto ldv_53744; } else { goto ldv_53746; } } else { goto ldv_53746; } ldv_53746: ; if (i > 10000U) { if ((nes_debug_level & 2U) != 0U) { printk("\viw_nes: %s[%u]: Did not see port soft reset done.\n", "nes_reset_adapter_ne020", 757); } else { } return (0U); } else { } i = 0U; goto ldv_53752; ldv_53751: ; if (1) { __const_udelay(4295000UL); } else { __ms___2 = 1UL; goto ldv_53749; ldv_53748: __const_udelay(4295000UL); ldv_53749: tmp___10 = __ms___2; __ms___2 = __ms___2 - 1UL; if (tmp___10 != 0UL) { goto ldv_53748; } else { goto ldv_53750; } ldv_53750: ; } ldv_53752: tmp___11 = nes_read_indexed(nesdev, 10252U); u32temp = tmp___11 & 15U; if (u32temp != 15U) { tmp___12 = i; i = i + 1U; if (tmp___12 <= 4999U) { goto ldv_53751; } else { goto ldv_53753; } } else { goto ldv_53753; } ldv_53753: ; if (i > 5000U) { if ((nes_debug_level & 2U) != 0U) { printk("\viw_nes: %s[%u]: Serdes 0 not ready, status=%x\n", "nes_reset_adapter_ne020", 767, u32temp); } else { } return (0U); } else { } if (port_count > 1U) { i = 0U; goto ldv_53759; ldv_53758: ; if (1) { __const_udelay(4295000UL); } else { __ms___3 = 1UL; goto ldv_53756; ldv_53755: __const_udelay(4295000UL); ldv_53756: tmp___13 = __ms___3; __ms___3 = __ms___3 - 1UL; if (tmp___13 != 0UL) { goto ldv_53755; } else { goto ldv_53757; } ldv_53757: ; } ldv_53759: tmp___14 = nes_read_indexed(nesdev, 10764U); u32temp = tmp___14 & 15U; if (u32temp != 15U) { tmp___15 = i; i = i + 1U; if (tmp___15 <= 4999U) { goto ldv_53758; } else { goto ldv_53760; } } else { goto ldv_53760; } ldv_53760: ; if (i > 5000U) { if ((nes_debug_level & 2U) != 0U) { printk("\viw_nes: %s[%u]: Serdes 1 not ready, status=%x\n", "nes_reset_adapter_ne020", 778, u32temp); } else { } return (0U); } else { } } else { } return (port_count); } } static int nes_init_serdes(struct nes_device *nesdev , u8 hw_rev , u8 port_count , struct nes_adapter *nesadapter , u8 OneG_Mode ) { int i ; u32 u32temp ; u32 sds ; unsigned long __ms ; unsigned long tmp ; u32 tmp___0 ; int tmp___1 ; unsigned long __ms___0 ; unsigned long tmp___2 ; u32 tmp___3 ; int tmp___4 ; { if ((unsigned int )hw_rev != 4U) { switch ((int )nesadapter->phy_type[0]) { case 1: ; if (wide_ppm_offset != 0) { nes_write_indexed(nesdev, 10292U, 1048490U); } else { nes_write_indexed(nesdev, 10292U, 255U); } goto ldv_53772; case 9: nes_write_indexed(nesdev, 10292U, 255U); nes_write_indexed(nesdev, 10256U, 0U); goto ldv_53772; case 5: nes_write_indexed(nesdev, 10292U, 255U); sds = nes_read_indexed(nesdev, 10248U); sds = sds | 256U; nes_write_indexed(nesdev, 10248U, sds); goto ldv_53772; default: nes_write_indexed(nesdev, 10292U, 255U); goto ldv_53772; } ldv_53772: ; if ((unsigned int )OneG_Mode == 0U) { nes_write_indexed(nesdev, 10296U, 286326784U); } else { } if ((unsigned int )port_count <= 1U) { return (0); } else { } if ((unsigned int )OneG_Mode == 0U || (unsigned int )nesadapter->phy_type[1] == 5U) { nes_write_indexed(nesdev, 10804U, 255U); } else { } switch ((int )nesadapter->phy_type[1]) { case 4: ; case 8: nes_write_indexed(nesdev, 10256U, 0U); nes_write_indexed(nesdev, 10768U, 0U); goto ldv_53778; case 1: ; if (wide_ppm_offset != 0) { nes_write_indexed(nesdev, 10804U, 1048490U); } else { } goto ldv_53778; case 9: nes_write_indexed(nesdev, 10768U, 0U); goto ldv_53778; case 5: sds = nes_read_indexed(nesdev, 10760U); sds = sds | 256U; nes_write_indexed(nesdev, 10760U, sds); } ldv_53778: ; if ((unsigned int )OneG_Mode == 0U) { nes_write_indexed(nesdev, 10808U, 286326784U); sds = nes_read_indexed(nesdev, 10760U); sds = sds & 4294967231U; nes_write_indexed(nesdev, 10760U, sds); } else { } } else { nes_write_indexed(nesdev, 10248U, 8U); i = 0; goto ldv_53787; ldv_53786: ; if (1) { __const_udelay(4295000UL); } else { __ms = 1UL; goto ldv_53784; ldv_53783: __const_udelay(4295000UL); ldv_53784: tmp = __ms; __ms = __ms - 1UL; if (tmp != 0UL) { goto ldv_53783; } else { goto ldv_53785; } ldv_53785: ; } ldv_53787: tmp___0 = nes_read_indexed(nesdev, 10252U); u32temp = tmp___0 & 15U; if (u32temp != 15U) { tmp___1 = i; i = i + 1; if (tmp___1 <= 4999) { goto ldv_53786; } else { goto ldv_53788; } } else { goto ldv_53788; } ldv_53788: ; if (i > 5000) { if ((nes_debug_level & 8U) != 0U) { printk("\viw_nes: %s[%u]: Init: serdes 0 not ready, status=%x\n", "nes_init_serdes", 863, u32temp); } else { } return (1); } else { } nes_write_indexed(nesdev, 10256U, 777975U); nes_write_indexed(nesdev, 10260U, 2632396800U); nes_write_indexed(nesdev, 10264U, 267386880U); nes_write_indexed(nesdev, 10268U, 0U); nes_write_indexed(nesdev, 10272U, 0U); nes_write_indexed(nesdev, 10276U, 0U); if ((unsigned int )OneG_Mode != 0U) { nes_write_indexed(nesdev, 10280U, 4028113442U); } else { nes_write_indexed(nesdev, 10280U, 4026802722U); } nes_write_indexed(nesdev, 10292U, 255U); if ((unsigned int )port_count > 1U) { nes_write_indexed(nesdev, 10760U, 72U); i = 0; goto ldv_53795; ldv_53794: ; if (1) { __const_udelay(4295000UL); } else { __ms___0 = 1UL; goto ldv_53792; ldv_53791: __const_udelay(4295000UL); ldv_53792: tmp___2 = __ms___0; __ms___0 = __ms___0 - 1UL; if (tmp___2 != 0UL) { goto ldv_53791; } else { goto ldv_53793; } ldv_53793: ; } ldv_53795: tmp___3 = nes_read_indexed(nesdev, 10764U); u32temp = tmp___3 & 15U; if (u32temp != 15U) { tmp___4 = i; i = i + 1; if (tmp___4 <= 4999) { goto ldv_53794; } else { goto ldv_53796; } } else { goto ldv_53796; } ldv_53796: ; if (i > 5000) { printk("%s: Init: serdes 1 not ready, status=%x\n", "nes_init_serdes", u32temp); } else { } nes_write_indexed(nesdev, 10768U, 777975U); nes_write_indexed(nesdev, 10772U, 2632396800U); nes_write_indexed(nesdev, 10776U, 267386880U); nes_write_indexed(nesdev, 10780U, 0U); nes_write_indexed(nesdev, 10784U, 0U); nes_write_indexed(nesdev, 10788U, 0U); nes_write_indexed(nesdev, 10792U, 4026540578U); nes_write_indexed(nesdev, 10804U, 255U); } else { } } return (0); } } static void nes_init_csr_ne020(struct nes_device *nesdev , u8 hw_rev , u8 port_count ) { u32 u32temp ; { if ((nes_debug_level & 2U) != 0U) { printk("\viw_nes: %s[%u]: port_count=%d\n", "nes_init_csr_ne020", 911, (int )port_count); } else { } nes_write_indexed(nesdev, 484U, 7U); nes_write_indexed(nesdev, 488U, 133236U); nes_write_indexed(nesdev, 472U, 294914U); nes_write_indexed(nesdev, 508U, 327685U); nes_write_indexed(nesdev, 1536U, 1431655765U); nes_write_indexed(nesdev, 1540U, 1431655765U); nes_write_indexed(nesdev, 8192U, 1U); nes_write_indexed(nesdev, 8196U, 1U); nes_write_indexed(nesdev, 8200U, 65535U); nes_write_indexed(nesdev, 8204U, 1U); nes_write_indexed(nesdev, 8208U, 961U); nes_write_indexed(nesdev, 8220U, 1966364280U); if ((unsigned int )port_count > 1U) { nes_write_indexed(nesdev, 8704U, 1U); nes_write_indexed(nesdev, 8708U, 1U); nes_write_indexed(nesdev, 8712U, 65535U); nes_write_indexed(nesdev, 8716U, 1U); nes_write_indexed(nesdev, 8720U, 961U); nes_write_indexed(nesdev, 8732U, 1966364280U); nes_write_indexed(nesdev, 2312U, 536870913U); } else { } if ((unsigned int )port_count > 2U) { nes_write_indexed(nesdev, 9216U, 1U); nes_write_indexed(nesdev, 9220U, 1U); nes_write_indexed(nesdev, 9224U, 65535U); nes_write_indexed(nesdev, 9228U, 1U); nes_write_indexed(nesdev, 9232U, 961U); nes_write_indexed(nesdev, 9244U, 1966364280U); nes_write_indexed(nesdev, 2320U, 536870913U); nes_write_indexed(nesdev, 9728U, 1U); nes_write_indexed(nesdev, 9732U, 1U); nes_write_indexed(nesdev, 9736U, 65535U); nes_write_indexed(nesdev, 9740U, 1U); nes_write_indexed(nesdev, 9744U, 961U); nes_write_indexed(nesdev, 9756U, 1966364280U); nes_write_indexed(nesdev, 2328U, 536870913U); } else { } nes_write_indexed(nesdev, 20480U, 98304U); nes_write_indexed(nesdev, 20484U, (wqm_quanta << 1) | 1U); nes_write_indexed(nesdev, 20488U, 522133279U); nes_write_indexed(nesdev, 20496U, 522133279U); nes_write_indexed(nesdev, 20504U, 522133279U); nes_write_indexed(nesdev, 20512U, 522133279U); nes_write_indexed(nesdev, 24720U, 4294967295U); nes_write_indexed(nesdev, 2304U, 536870913U); nes_write_indexed(nesdev, 24768U, 654U); nes_write_indexed(nesdev, 24776U, 32U); nes_write_indexed(nesdev, 492U, 2066097568U); if ((unsigned int )hw_rev != 4U) { u32temp = nes_read_indexed(nesdev, 2280U); u32temp = u32temp | 2147483648U; nes_write_indexed(nesdev, 2280U, u32temp); u32temp = nes_read_indexed(nesdev, 8696U); u32temp = u32temp & 2147483647U; u32temp = u32temp | 2147418128U; nes_write_indexed(nesdev, 8696U, u32temp); if ((unsigned int )port_count > 1U) { u32temp = nes_read_indexed(nesdev, 9208U); u32temp = u32temp & 2147483647U; u32temp = u32temp | 2147418128U; nes_write_indexed(nesdev, 9208U, u32temp); } else { } } else { } return; } } void nes_destroy_adapter(struct nes_adapter *nesadapter ) { struct nes_adapter *tmp_adapter ; struct list_head const *__mptr ; struct list_head const *__mptr___0 ; { __mptr = (struct list_head const *)nes_adapter_list.next; tmp_adapter = (struct nes_adapter *)__mptr + 0xffffffffffffffc0UL; goto ldv_53814; ldv_53813: ; if ((nes_debug_level & 524288U) != 0U) { printk("\viw_nes: %s[%u]: Nes Adapter list entry = 0x%p.\n", "nes_destroy_adapter", 1001, tmp_adapter); } else { } __mptr___0 = (struct list_head const *)tmp_adapter->list.next; tmp_adapter = (struct nes_adapter *)__mptr___0 + 0xffffffffffffffc0UL; ldv_53814: ; if ((unsigned long )(& tmp_adapter->list) != (unsigned long )(& nes_adapter_list)) { goto ldv_53813; } else { goto ldv_53815; } ldv_53815: nesadapter->ref_count = (unsigned char )((int )nesadapter->ref_count - 1); if ((unsigned int )nesadapter->ref_count == 0U) { if (nesadapter->hw_rev == 4U) { del_timer(& nesadapter->mh_timer); } else { } del_timer(& nesadapter->lc_timer); list_del(& nesadapter->list); kfree((void const *)nesadapter); } else { } return; } } int nes_init_cqp(struct nes_device *nesdev ) { struct nes_adapter *nesadapter ; struct nes_hw_cqp_qp_context *cqp_qp_context ; struct nes_hw_cqp_wqe *cqp_wqe ; struct nes_hw_ceq *ceq ; struct nes_hw_ceq *nic_ceq ; struct nes_hw_aeq *aeq ; void *vmem ; dma_addr_t pmem ; u32 count ; u32 cqp_head ; u64 u64temp ; u32 u32temp ; unsigned int _max1 ; unsigned int _max2 ; unsigned int tmp ; unsigned int _max1___0 ; unsigned int _max2___0 ; unsigned int tmp___0 ; void *tmp___1 ; struct lock_class_key __key ; struct lock_class_key __key___0 ; unsigned int _max1___1 ; unsigned int _max2___1 ; unsigned int tmp___2 ; unsigned int _max1___2 ; unsigned int _max2___2 ; unsigned int tmp___3 ; unsigned int _max1___3 ; unsigned int _max2___3 ; unsigned int tmp___4 ; unsigned int _max1___4 ; unsigned int _max2___4 ; unsigned int tmp___5 ; struct lock_class_key __key___1 ; u16 tmp___6 ; u16 tmp___7 ; u16 tmp___8 ; u16 tmp___9 ; u32 tmp___10 ; u32 tmp___11 ; u32 tmp___12 ; u32 tmp___13 ; u32 tmp___14 ; u32 tmp___15 ; { nesadapter = nesdev->nesadapter; count = 0U; _max1 = (nesadapter->max_cq / (u32 )nesadapter->port_count + 536870880U) * 8U; _max2 = 256U; if (_max1 > _max2) { tmp = _max1; } else { tmp = _max2; } _max1___0 = 64U; _max2___0 = 256U; if (_max1___0 > _max2___0) { tmp___0 = _max1___0; } else { tmp___0 = _max2___0; } nesdev->cqp_mem_size = ((tmp + tmp___0) + nesadapter->max_qp * 16U) + 12816U; nesdev->cqp_vbase = pci_alloc_consistent(nesdev->pcidev, (size_t )nesdev->cqp_mem_size, & nesdev->cqp_pbase); if ((unsigned long )nesdev->cqp_vbase == (unsigned long )((void *)0)) { if ((nes_debug_level & 2U) != 0U) { printk("\viw_nes: %s[%u]: Unable to allocate memory for host descriptor rings\n", "nes_init_cqp", 1049); } else { } return (-12); } else { } memset(nesdev->cqp_vbase, 0, (size_t )nesdev->cqp_mem_size); tmp___1 = kzalloc(51200UL, 208U); nesdev->nes_cqp_requests = (struct nes_cqp_request *)tmp___1; if ((unsigned long )nesdev->nes_cqp_requests == (unsigned long )((struct nes_cqp_request *)0)) { if ((nes_debug_level & 2U) != 0U) { printk("\viw_nes: %s[%u]: Unable to allocate memory CQP request entries.\n", "nes_init_cqp", 1058); } else { } pci_free_consistent(nesdev->pcidev, (size_t )nesdev->cqp_mem_size, (void *)nesdev->cqp.sq_vbase, nesdev->cqp.sq_pbase); return (-12); } else { } if ((nes_debug_level & 2U) != 0U) { printk("\viw_nes: %s[%u]: Allocated CQP structures at %p (phys = %016lX), size = %u.\n", "nes_init_cqp", 1065, nesdev->cqp_vbase, (unsigned long )nesdev->cqp_pbase, nesdev->cqp_mem_size); } else { } spinlock_check(& nesdev->cqp.lock); __raw_spin_lock_init(& nesdev->cqp.lock.ldv_5961.rlock, "&(&nesdev->cqp.lock)->rlock", & __key); __init_waitqueue_head(& nesdev->cqp.waitq, "&nesdev->cqp.waitq", & __key___0); vmem = (void *)(((unsigned long )nesdev->cqp_vbase + 511UL) & 0xfffffffffffffe00UL); pmem = (nesdev->cqp_pbase + 511ULL) & 0xfffffffffffffe00ULL; nesdev->cqp.sq_vbase = (struct nes_hw_cqp_wqe *)vmem; nesdev->cqp.sq_pbase = pmem; nesdev->cqp.sq_size = 128U; nesdev->cqp.sq_head = 0U; nesdev->cqp.sq_tail = 0U; nesdev->cqp.qp_id = (unsigned int )((u16 )(nesdev->pcidev)->devfn) & 7U; vmem = vmem + (unsigned long )nesdev->cqp.sq_size * 64UL; pmem = (unsigned long long )((unsigned long )nesdev->cqp.sq_size * 64UL) + pmem; nesdev->ccq.cq_vbase = (struct nes_hw_cqe *)vmem; nesdev->ccq.cq_pbase = pmem; nesdev->ccq.cq_size = 128U; nesdev->ccq.cq_head = 0U; nesdev->ccq.ce_handler = & nes_cqp_ce_handler; nesdev->ccq.cq_number = (unsigned int )((u16 )(nesdev->pcidev)->devfn) & 7U; vmem = vmem + (unsigned long )nesdev->ccq.cq_size * 32UL; pmem = (unsigned long long )((unsigned long )nesdev->ccq.cq_size * 32UL) + pmem; nesdev->ceq_index = (unsigned int )((u8 )(nesdev->pcidev)->devfn) & 7U; ceq = (struct nes_hw_ceq *)(& nesadapter->ceq) + (unsigned long )nesdev->ceq_index; ceq->ceq_vbase = (struct nes_hw_ceqe volatile *)vmem; ceq->ceq_pbase = pmem; ceq->ceq_size = (unsigned int )((u16 )(nesadapter->max_cq / (u32 )nesadapter->port_count)) - 32U; ceq->ceq_head = 0U; _max1___1 = (unsigned int )ceq->ceq_size * 8U; _max2___1 = 256U; if (_max1___1 > _max2___1) { tmp___2 = _max1___1; } else { tmp___2 = _max2___1; } vmem = vmem + (unsigned long )tmp___2; _max1___2 = (unsigned int )ceq->ceq_size * 8U; _max2___2 = 256U; if (_max1___2 > _max2___2) { tmp___3 = _max1___2; } else { tmp___3 = _max2___2; } pmem = (dma_addr_t )tmp___3 + pmem; nesdev->nic_ceq_index = ((unsigned int )((u8 )(nesdev->pcidev)->devfn) & 7U) + 8U; nic_ceq = (struct nes_hw_ceq *)(& nesadapter->ceq) + (unsigned long )nesdev->nic_ceq_index; nic_ceq->ceq_vbase = (struct nes_hw_ceqe volatile *)vmem; nic_ceq->ceq_pbase = pmem; nic_ceq->ceq_size = 8U; nic_ceq->ceq_head = 0U; _max1___3 = (unsigned int )nic_ceq->ceq_size * 8U; _max2___3 = 256U; if (_max1___3 > _max2___3) { tmp___4 = _max1___3; } else { tmp___4 = _max2___3; } vmem = vmem + (unsigned long )tmp___4; _max1___4 = (unsigned int )nic_ceq->ceq_size * 8U; _max2___4 = 256U; if (_max1___4 > _max2___4) { tmp___5 = _max1___4; } else { tmp___5 = _max2___4; } pmem = (dma_addr_t )tmp___5 + pmem; aeq = (struct nes_hw_aeq *)(& nesadapter->aeq) + ((unsigned long )(nesdev->pcidev)->devfn & 7UL); aeq->aeq_vbase = (struct nes_hw_aeqe volatile *)vmem; aeq->aeq_pbase = pmem; aeq->aeq_size = (u16 )nesadapter->max_qp; aeq->aeq_head = 0U; vmem = vmem + (unsigned long )aeq->aeq_size * 16UL; pmem = (unsigned long long )((unsigned long )aeq->aeq_size * 16UL) + pmem; cqp_qp_context = (struct nes_hw_cqp_qp_context *)vmem; cqp_qp_context->context_words[0] = (((nesdev->pcidev)->devfn & 7U) << 12) + 2048U; cqp_qp_context->context_words[1] = 0U; cqp_qp_context->context_words[2] = (unsigned int )nesdev->cqp.sq_pbase; cqp_qp_context->context_words[3] = (unsigned int )(nesdev->cqp.sq_pbase >> 32); nes_write_indexed(nesdev, ((nesdev->pcidev)->devfn & 7U) * 8U + 4U, (u32 )(pmem >> 32)); nes_write_indexed(nesdev, ((nesdev->pcidev)->devfn & 7U) * 8U, (unsigned int )pmem); INIT_LIST_HEAD(& nesdev->cqp_avail_reqs); INIT_LIST_HEAD(& nesdev->cqp_pending_reqs); count = 0U; goto ldv_53854; ldv_53853: __init_waitqueue_head(& (nesdev->nes_cqp_requests + (unsigned long )count)->waitq, "&nesdev->nes_cqp_requests[count].waitq", & __key___1); list_add_tail(& (nesdev->nes_cqp_requests + (unsigned long )count)->list, & nesdev->cqp_avail_reqs); count = count + 1U; ldv_53854: ; if (count <= 255U) { goto ldv_53853; } else { goto ldv_53855; } ldv_53855: tmp___6 = nesdev->cqp.sq_head; nesdev->cqp.sq_head = (u16 )((int )nesdev->cqp.sq_head + 1); cqp_head = (u32 )tmp___6; cqp_wqe = nesdev->cqp.sq_vbase + (unsigned long )cqp_head; nes_fill_init_cqp_wqe(cqp_wqe, nesdev); set_wqe_32bit_value((__le32 *)(& cqp_wqe->wqe_words), 0U, ((unsigned int )nesdev->ccq.cq_size << 16) | 5123U); set_wqe_32bit_value((__le32 *)(& cqp_wqe->wqe_words), 1U, (unsigned int )nesdev->ccq.cq_number | ((unsigned int )nesdev->ceq_index << 16)); u64temp = nesdev->ccq.cq_pbase; set_wqe_64bit_value((__le32 *)(& cqp_wqe->wqe_words), 6U, u64temp); cqp_wqe->wqe_words[9] = 0U; u64temp = (u64 )(& nesdev->ccq); cqp_wqe->wqe_words[8] = (unsigned int )(u64temp >> 1); cqp_wqe->wqe_words[9] = (unsigned int )(u64temp >> 33) & 2147483647U; cqp_wqe->wqe_words[10] = 0U; tmp___7 = nesdev->cqp.sq_head; nesdev->cqp.sq_head = (u16 )((int )nesdev->cqp.sq_head + 1); cqp_head = (u32 )tmp___7; cqp_wqe = nesdev->cqp.sq_vbase + (unsigned long )cqp_head; nes_fill_init_cqp_wqe(cqp_wqe, nesdev); set_wqe_32bit_value((__le32 *)(& cqp_wqe->wqe_words), 0U, ((unsigned int )nesdev->ceq_index << 8) + 22U); set_wqe_32bit_value((__le32 *)(& cqp_wqe->wqe_words), 1U, (u32 )ceq->ceq_size); u64temp = ceq->ceq_pbase; set_wqe_64bit_value((__le32 *)(& cqp_wqe->wqe_words), 6U, u64temp); tmp___8 = nesdev->cqp.sq_head; nesdev->cqp.sq_head = (u16 )((int )nesdev->cqp.sq_head + 1); cqp_head = (u32 )tmp___8; cqp_wqe = nesdev->cqp.sq_vbase + (unsigned long )cqp_head; nes_fill_init_cqp_wqe(cqp_wqe, nesdev); set_wqe_32bit_value((__le32 *)(& cqp_wqe->wqe_words), 0U, (((nesdev->pcidev)->devfn & 7U) << 8) + 25U); set_wqe_32bit_value((__le32 *)(& cqp_wqe->wqe_words), 1U, (u32 )aeq->aeq_size); u64temp = aeq->aeq_pbase; set_wqe_64bit_value((__le32 *)(& cqp_wqe->wqe_words), 6U, u64temp); tmp___9 = nesdev->cqp.sq_head; nesdev->cqp.sq_head = (u16 )((int )nesdev->cqp.sq_head + 1); cqp_head = (u32 )tmp___9; cqp_wqe = nesdev->cqp.sq_vbase + (unsigned long )cqp_head; nes_fill_init_cqp_wqe(cqp_wqe, nesdev); set_wqe_32bit_value((__le32 *)(& cqp_wqe->wqe_words), 0U, ((unsigned int )nesdev->nic_ceq_index << 8) + 22U); set_wqe_32bit_value((__le32 *)(& cqp_wqe->wqe_words), 1U, (u32 )nic_ceq->ceq_size); u64temp = nic_ceq->ceq_pbase; set_wqe_64bit_value((__le32 *)(& cqp_wqe->wqe_words), 6U, u64temp); count = 0U; ldv_53856: tmp___10 = count; count = count + 1U; if (tmp___10 > 1000U) { printk("\viw_nes: Error creating CQP\n"); pci_free_consistent(nesdev->pcidev, (size_t )nesdev->cqp_mem_size, nesdev->cqp_vbase, nesdev->cqp_pbase); return (-1); } else { } __const_udelay(42950UL); tmp___11 = nes_read_indexed(nesdev, (((nesdev->pcidev)->devfn & 7U) + 8U) * 8U); if ((tmp___11 & 256U) == 0U) { goto ldv_53856; } else { goto ldv_53857; } ldv_53857: ; if ((nes_debug_level & 2U) != 0U) { tmp___12 = nes_read_indexed(nesdev, (((nesdev->pcidev)->devfn & 7U) + 8U) * 8U); printk("\viw_nes: %s[%u]: CQP Status = 0x%08X\n", "nes_init_cqp", 1219, tmp___12); } else { } u32temp = 75497472U; nes_write32(nesdev->regs + 64UL, (u32 )nesdev->cqp.qp_id | u32temp); count = 0U; ldv_53858: tmp___13 = count; count = count + 1U; if (tmp___13 > 1000U) { printk("\viw_nes: Error creating CCQ, CEQ, and AEQ\n"); pci_free_consistent(nesdev->pcidev, (size_t )nesdev->cqp_mem_size, nesdev->cqp_vbase, nesdev->cqp_pbase); return (-1); } else { } __const_udelay(42950UL); tmp___14 = nes_read_indexed(nesdev, (((nesdev->pcidev)->devfn & 7U) + 8U) * 8U); if ((tmp___14 & 3840U) != 3840U) { goto ldv_53858; } else { goto ldv_53859; } ldv_53859: ; if ((nes_debug_level & 2U) != 0U) { tmp___15 = nes_read_indexed(nesdev, (((nesdev->pcidev)->devfn & 7U) + 8U) * 8U); printk("\viw_nes: %s[%u]: QP Status = 0x%08X\n", "nes_init_cqp", 1239, tmp___15); } else { } nesdev->cqp.sq_tail = (u16 )((int )nesdev->cqp.sq_tail + 1); return (0); } } int nes_destroy_cqp(struct nes_device *nesdev ) { struct nes_hw_cqp_wqe *cqp_wqe ; u32 count ; u32 cqp_head ; unsigned long flags ; u32 tmp ; raw_spinlock_t *tmp___0 ; u16 tmp___1 ; u16 tmp___2 ; u16 tmp___3 ; u16 tmp___4 ; u16 tmp___5 ; u32 tmp___6 ; u32 tmp___7 ; u32 tmp___8 ; { count = 0U; ldv_53868: tmp = count; count = count + 1U; if (tmp > 1000U) { goto ldv_53867; } else { } __const_udelay(42950UL); if ((int )nesdev->cqp.sq_head != (int )nesdev->cqp.sq_tail) { goto ldv_53868; } else { goto ldv_53867; } ldv_53867: nes_write32(nesdev->regs + 68UL, (u32 )((int )nesdev->ccq.cq_number | (-0x7FFFFFFF-1))); nes_write32(nesdev->regs + 4UL, 2147483647U); tmp___0 = spinlock_check(& nesdev->cqp.lock); flags = _raw_spin_lock_irqsave(tmp___0); tmp___1 = nesdev->cqp.sq_head; nesdev->cqp.sq_head = (u16 )((int )nesdev->cqp.sq_head + 1); cqp_head = (u32 )tmp___1; nesdev->cqp.sq_head = (u16 )((int )((short )nesdev->cqp.sq_head) & (int )((short )((unsigned int )nesdev->cqp.sq_size + 65535U))); cqp_wqe = nesdev->cqp.sq_vbase + (unsigned long )cqp_head; cqp_wqe->wqe_words[0] = (((nesdev->pcidev)->devfn & 7U) << 8) | 27U; cqp_wqe->wqe_words[3] = 0U; tmp___2 = nesdev->cqp.sq_head; nesdev->cqp.sq_head = (u16 )((int )nesdev->cqp.sq_head + 1); cqp_head = (u32 )tmp___2; nesdev->cqp.sq_head = (u16 )((int )((short )nesdev->cqp.sq_head) & (int )((short )((unsigned int )nesdev->cqp.sq_size + 65535U))); cqp_wqe = nesdev->cqp.sq_vbase + (unsigned long )cqp_head; cqp_wqe->wqe_words[0] = ((unsigned int )nesdev->nic_ceq_index << 8) | 24U; tmp___3 = nesdev->cqp.sq_head; nesdev->cqp.sq_head = (u16 )((int )nesdev->cqp.sq_head + 1); cqp_head = (u32 )tmp___3; nesdev->cqp.sq_head = (u16 )((int )((short )nesdev->cqp.sq_head) & (int )((short )((unsigned int )nesdev->cqp.sq_size + 65535U))); cqp_wqe = nesdev->cqp.sq_vbase + (unsigned long )cqp_head; cqp_wqe->wqe_words[0] = (unsigned int )(((int )nesdev->ceq_index << 8) | 24); tmp___4 = nesdev->cqp.sq_head; nesdev->cqp.sq_head = (u16 )((int )nesdev->cqp.sq_head + 1); cqp_head = (u32 )tmp___4; nesdev->cqp.sq_head = (u16 )((int )((short )nesdev->cqp.sq_head) & (int )((short )((unsigned int )nesdev->cqp.sq_size + 65535U))); cqp_wqe = nesdev->cqp.sq_vbase + (unsigned long )cqp_head; cqp_wqe->wqe_words[0] = 5U; cqp_wqe->wqe_words[1] = (unsigned int )nesdev->ccq.cq_number | ((unsigned int )nesdev->ceq_index << 16); tmp___5 = nesdev->cqp.sq_head; nesdev->cqp.sq_head = (u16 )((int )nesdev->cqp.sq_head + 1); cqp_head = (u32 )tmp___5; nesdev->cqp.sq_head = (u16 )((int )((short )nesdev->cqp.sq_head) & (int )((short )((unsigned int )nesdev->cqp.sq_size + 65535U))); cqp_wqe = nesdev->cqp.sq_vbase + (unsigned long )cqp_head; cqp_wqe->wqe_words[0] = 262146U; cqp_wqe->wqe_words[1] = (unsigned int )nesdev->cqp.qp_id; __asm__ volatile ("": : : "memory"); nes_write32(nesdev->regs + 64UL, (u32 )((int )nesdev->cqp.qp_id | 92274688)); spin_unlock_irqrestore(& nesdev->cqp.lock, flags); count = 0U; ldv_53873: tmp___6 = count; count = count + 1U; if (tmp___6 > 1000U) { printk("\viw_nes: Function%d: Error destroying CCQ, CEQ, and AEQ\n", (nesdev->pcidev)->devfn & 7U); goto ldv_53872; } else { } __const_udelay(42950UL); tmp___7 = nes_read_indexed(nesdev, (((nesdev->pcidev)->devfn & 7U) + 8U) * 8U); if ((tmp___7 & 3840U) != 0U) { goto ldv_53873; } else { goto ldv_53872; } ldv_53872: ; if ((nes_debug_level & 524288U) != 0U) { tmp___8 = nes_read_indexed(nesdev, (((nesdev->pcidev)->devfn & 7U) + 8U) * 8U); printk("\viw_nes: %s[%u]: Function%d: QP Status = 0x%08X\n", "nes_destroy_cqp", 1332, (nesdev->pcidev)->devfn & 7U, tmp___8); } else { } kfree((void const *)nesdev->nes_cqp_requests); pci_free_consistent(nesdev->pcidev, (size_t )nesdev->cqp_mem_size, (void *)nesdev->cqp.sq_vbase, nesdev->cqp.sq_pbase); return (0); } } static int nes_init_1g_phy(struct nes_device *nesdev , u8 phy_type , u8 phy_index ) { u32 counter ; u16 phy_data ; int ret ; u32 tmp ; { counter = 0U; ret = 0; nes_read_1G_phy_reg(nesdev, 1, (int )phy_index, & phy_data); nes_write_1G_phy_reg(nesdev, 23, (int )phy_index, 45056); nes_write_1G_phy_reg(nesdev, 0, (int )phy_index, 32768); __const_udelay(429500UL); counter = 0U; ldv_53884: nes_read_1G_phy_reg(nesdev, 0, (int )phy_index, & phy_data); tmp = counter; counter = counter + 1U; if (tmp > 100U) { ret = -1; goto ldv_53883; } else { } if ((int )((short )phy_data) < 0) { goto ldv_53884; } else { goto ldv_53883; } ldv_53883: phy_data = (unsigned int )phy_data & 49151U; phy_data = (u16 )((unsigned int )phy_data | 4416U); nes_write_1G_phy_reg(nesdev, 0, (int )phy_index, (int )phy_data); nes_read_1G_phy_reg(nesdev, 0, (int )phy_index, & phy_data); nes_read_1G_phy_reg(nesdev, 23, (int )phy_index, & phy_data); nes_read_1G_phy_reg(nesdev, 30, (int )phy_index, & phy_data); nes_read_1G_phy_reg(nesdev, 25, (int )phy_index, & phy_data); nes_write_1G_phy_reg(nesdev, 25, (int )phy_index, 65518); nes_read_1G_phy_reg(nesdev, 25, (int )phy_index, & phy_data); nes_read_1G_phy_reg(nesdev, 4, (int )phy_index, & phy_data); nes_write_1G_phy_reg(nesdev, 4, (int )phy_index, (int )((u16 )(((int )((short )phy_data) & -4065) | 3072))); nes_read_1G_phy_reg(nesdev, 4, (int )phy_index, & phy_data); nes_read_1G_phy_reg(nesdev, 9, (int )phy_index, & phy_data); nes_write_1G_phy_reg(nesdev, 9, (int )phy_index, (int )phy_data & 65279); nes_read_1G_phy_reg(nesdev, 9, (int )phy_index, & phy_data); nes_read_1G_phy_reg(nesdev, 0, (int )phy_index, & phy_data); nes_write_1G_phy_reg(nesdev, 0, (int )phy_index, (int )((unsigned int )phy_data | 768U)); return (ret); } } static int nes_init_2025_phy(struct nes_device *nesdev , u8 phy_type , u8 phy_index ) { u32 temp_phy_data ; u32 temp_phy_data2 ; u32 counter ; u32 sds ; u32 mac_index ; int ret ; unsigned int first_attempt ; u32 tmp ; u32 tmp___0 ; u32 tmp___1 ; unsigned long __ms ; unsigned long tmp___2 ; u32 tmp___3 ; u32 tmp___4 ; unsigned long __ms___0 ; unsigned long tmp___5 ; u32 tmp___6 ; u32 tmp___7 ; u32 tmp___8 ; unsigned long __ms___1 ; unsigned long tmp___9 ; u32 tmp___10 ; u32 tmp___11 ; { temp_phy_data = 0U; temp_phy_data2 = 0U; counter = 0U; mac_index = nesdev->mac_index; ret = 0; first_attempt = 1U; nes_read_10G_phy_reg(nesdev, (int )phy_index, 3, 55278); tmp = nes_read_indexed(nesdev, 8324U); temp_phy_data = (u32 )((unsigned short )tmp); __const_udelay(6442500UL); nes_read_10G_phy_reg(nesdev, (int )phy_index, 3, 55278); tmp___0 = nes_read_indexed(nesdev, 8324U); temp_phy_data2 = (u32 )((unsigned short )tmp___0); if (temp_phy_data != temp_phy_data2) { nes_read_10G_phy_reg(nesdev, (int )phy_index, 3, 55293); tmp___1 = nes_read_indexed(nesdev, 8324U); temp_phy_data = (u32 )((unsigned short )tmp___1); if ((temp_phy_data & 255U) > 32U) { return (0); } else { } printk("iw_nes: Reinitialize external PHY\n"); } else { } nes_write_10G_phy_reg(nesdev, (int )phy_index, 1, 0, 32768); nes_write_10G_phy_reg(nesdev, (int )phy_index, 1, 49920, 0); nes_write_10G_phy_reg(nesdev, (int )phy_index, 1, 49942, 10); nes_write_10G_phy_reg(nesdev, (int )phy_index, 1, 49944, 82); switch ((int )phy_type) { case 4: nes_write_10G_phy_reg(nesdev, (int )phy_index, 1, 49942, 10); nes_write_10G_phy_reg(nesdev, (int )phy_index, 1, 49944, 82); nes_write_10G_phy_reg(nesdev, (int )phy_index, 1, 49922, 12); nes_write_10G_phy_reg(nesdev, (int )phy_index, 1, 49945, 8); nes_write_10G_phy_reg(nesdev, (int )phy_index, 3, 39, 1); nes_write_10G_phy_reg(nesdev, (int )phy_index, 1, 49946, 152); nes_write_10G_phy_reg(nesdev, (int )phy_index, 3, 38, 3584); nes_write_10G_phy_reg(nesdev, (int )phy_index, 1, 53254, 7); nes_write_10G_phy_reg(nesdev, (int )phy_index, 1, 53255, 10); nes_write_10G_phy_reg(nesdev, (int )phy_index, 1, 53256, 9); goto ldv_53898; case 8: nes_write_10G_phy_reg(nesdev, (int )phy_index, 1, 49942, 10); nes_write_10G_phy_reg(nesdev, (int )phy_index, 1, 49944, 82); nes_write_10G_phy_reg(nesdev, (int )phy_index, 1, 49922, 4); nes_write_10G_phy_reg(nesdev, (int )phy_index, 1, 49945, 56); nes_write_10G_phy_reg(nesdev, (int )phy_index, 3, 39, 19); nes_write_10G_phy_reg(nesdev, (int )phy_index, 1, 49946, 152); nes_write_10G_phy_reg(nesdev, (int )phy_index, 3, 38, 3584); nes_write_10G_phy_reg(nesdev, (int )phy_index, 1, 53254, 7); nes_write_10G_phy_reg(nesdev, (int )phy_index, 1, 53255, 10); nes_write_10G_phy_reg(nesdev, (int )phy_index, 1, 53256, 9); goto ldv_53898; case 9: nes_write_10G_phy_reg(nesdev, (int )phy_index, 1, 49942, 10); nes_write_10G_phy_reg(nesdev, (int )phy_index, 1, 49944, 82); nes_write_10G_phy_reg(nesdev, (int )phy_index, 1, 49922, 12); nes_write_10G_phy_reg(nesdev, (int )phy_index, 1, 49945, 16); nes_write_10G_phy_reg(nesdev, (int )phy_index, 3, 39, 19); nes_write_10G_phy_reg(nesdev, (int )phy_index, 1, 49946, 128); nes_write_10G_phy_reg(nesdev, (int )phy_index, 3, 38, 3584); nes_write_10G_phy_reg(nesdev, (int )phy_index, 1, 53254, 11); nes_write_10G_phy_reg(nesdev, (int )phy_index, 1, 53255, 3); nes_write_10G_phy_reg(nesdev, (int )phy_index, 1, 53256, 4); nes_write_10G_phy_reg(nesdev, (int )phy_index, 3, 34, 16493); nes_write_10G_phy_reg(nesdev, (int )phy_index, 3, 35, 32); goto ldv_53898; } ldv_53898: nes_write_10G_phy_reg(nesdev, (int )phy_index, 3, 40, 42280); nes_write_10G_phy_reg(nesdev, (int )phy_index, 1, 49920, 2); counter = 0U; __ms = 690UL; goto ldv_53903; ldv_53902: __const_udelay(4295000UL); ldv_53903: tmp___2 = __ms; __ms = __ms - 1UL; if (tmp___2 != 0UL) { goto ldv_53902; } else { goto ldv_53904; } ldv_53904: nes_read_10G_phy_reg(nesdev, (int )phy_index, 3, 55278); tmp___3 = nes_read_indexed(nesdev, 8324U); temp_phy_data = (u32 )((unsigned short )tmp___3); ldv_53910: tmp___4 = counter; counter = counter + 1U; if (tmp___4 > 150U) { printk("iw_nes: No PHY heartbeat\n"); goto ldv_53905; } else { } if (1) { __const_udelay(4295000UL); } else { __ms___0 = 1UL; goto ldv_53908; ldv_53907: __const_udelay(4295000UL); ldv_53908: tmp___5 = __ms___0; __ms___0 = __ms___0 - 1UL; if (tmp___5 != 0UL) { goto ldv_53907; } else { goto ldv_53909; } ldv_53909: ; } nes_read_10G_phy_reg(nesdev, (int )phy_index, 3, 55278); tmp___6 = nes_read_indexed(nesdev, 8324U); temp_phy_data2 = (u32 )((unsigned short )tmp___6); if (temp_phy_data2 == temp_phy_data) { goto ldv_53910; } else { goto ldv_53905; } ldv_53905: counter = 0U; ldv_53917: nes_read_10G_phy_reg(nesdev, (int )phy_index, 3, 55293); tmp___7 = nes_read_indexed(nesdev, 8324U); temp_phy_data = (u32 )((unsigned short )tmp___7); tmp___8 = counter; counter = counter + 1U; if (tmp___8 > 300U) { if ((temp_phy_data & 255U) == 0U && first_attempt != 0U) { first_attempt = 0U; counter = 0U; nes_write_10G_phy_reg(nesdev, (int )phy_index, 3, 59476, 192); nes_write_10G_phy_reg(nesdev, (int )phy_index, 3, 59476, 64); goto ldv_53911; } else { ret = 1; goto ldv_53912; } } else { } __ms___1 = 10UL; goto ldv_53915; ldv_53914: __const_udelay(4295000UL); ldv_53915: tmp___9 = __ms___1; __ms___1 = __ms___1 - 1UL; if (tmp___9 != 0UL) { goto ldv_53914; } else { goto ldv_53916; } ldv_53916: ; ldv_53911: ; if ((temp_phy_data & 255U) <= 47U) { goto ldv_53917; } else { goto ldv_53912; } ldv_53912: nes_write_10G_phy_reg(nesdev, (int )phy_index, 1, 53251, 0); nes_write_10G_phy_reg(nesdev, (int )phy_index, 1, 61453, 254); nes_write_10G_phy_reg(nesdev, (int )phy_index, 1, 61454, 50); if ((unsigned int )phy_type == 9U) { nes_write_10G_phy_reg(nesdev, (int )phy_index, 1, 61455, 12); } else { nes_write_10G_phy_reg(nesdev, (int )phy_index, 1, 61455, 2); nes_write_10G_phy_reg(nesdev, (int )phy_index, 1, 49940, 99); } sds = nes_read_indexed(nesdev, mac_index * 512U + 10248U); sds = sds | 1U; nes_write_indexed(nesdev, mac_index * 512U + 10248U, sds); sds = sds & 4294967294U; nes_write_indexed(nesdev, mac_index * 512U + 10248U, sds); counter = 0U; goto ldv_53919; ldv_53918: ; ldv_53919: tmp___10 = nes_read32((void const *)nesdev->regs + 48U); if ((tmp___10 & 64U) == 0U) { tmp___11 = counter; counter = counter + 1U; if (tmp___11 <= 4999U) { goto ldv_53918; } else { goto ldv_53920; } } else { goto ldv_53920; } ldv_53920: ; return (ret); } } int nes_init_phy(struct nes_device *nesdev ) { struct nes_adapter *nesadapter ; u32 mac_index ; u32 tx_config ; unsigned long flags ; u8 phy_type ; u8 phy_index ; int ret ; raw_spinlock_t *tmp ; { nesadapter = nesdev->nesadapter; mac_index = nesdev->mac_index; tx_config = 0U; phy_type = nesadapter->phy_type[mac_index]; phy_index = nesadapter->phy_index[mac_index]; ret = 0; tx_config = nes_read_indexed(nesdev, 8196U); if ((unsigned int )phy_type == 2U) { tx_config = tx_config & 4294967267U; tx_config = tx_config | 4U; } else { tx_config = tx_config & 4294967267U; tx_config = tx_config | 29U; } nes_write_indexed(nesdev, 8196U, tx_config); tmp = spinlock_check(& (nesdev->nesadapter)->phy_lock); flags = _raw_spin_lock_irqsave(tmp); switch ((int )phy_type) { case 2: ret = nes_init_1g_phy(nesdev, (int )phy_type, (int )phy_index); goto ldv_53935; case 4: ; case 8: ; case 9: ret = nes_init_2025_phy(nesdev, (int )phy_type, (int )phy_index); goto ldv_53935; } ldv_53935: spin_unlock_irqrestore(& (nesdev->nesadapter)->phy_lock, flags); return (ret); } } static void nes_replenish_nic_rq(struct nes_vnic *nesvnic ) { unsigned long flags ; dma_addr_t bus_address ; struct sk_buff *skb ; struct nes_hw_nic_rq_wqe *nic_rqe ; struct nes_hw_nic *nesnic ; struct nes_device *nesdev ; struct nes_rskb_cb *cb ; u32 rx_wqes_posted ; raw_spinlock_t *tmp ; int tmp___0 ; int tmp___1 ; raw_spinlock_t *tmp___2 ; int tmp___3 ; int tmp___4 ; int tmp___5 ; { rx_wqes_posted = 0U; nesnic = & nesvnic->nic; nesdev = nesvnic->nesdev; tmp = spinlock_check(& nesnic->rq_lock); flags = _raw_spin_lock_irqsave(tmp); if ((unsigned int )nesnic->replenishing_rq != 0U) { tmp___0 = atomic_read((atomic_t const *)(& nesvnic->rx_skbs_needed)); if ((int )nesnic->rq_size + -1 == tmp___0) { tmp___1 = atomic_read((atomic_t const *)(& nesvnic->rx_skb_timer_running)); if (tmp___1 == 0) { atomic_set(& nesvnic->rx_skb_timer_running, 1); spin_unlock_irqrestore(& nesnic->rq_lock, flags); nesvnic->rq_wqes_timer.expires = (unsigned long )jiffies + 125UL; add_timer(& nesvnic->rq_wqes_timer); } else { spin_unlock_irqrestore(& nesnic->rq_lock, flags); } } else { spin_unlock_irqrestore(& nesnic->rq_lock, flags); } return; } else { } nesnic->replenishing_rq = 1U; spin_unlock_irqrestore(& nesnic->rq_lock, flags); ldv_53957: skb = dev_alloc_skb((unsigned int )nesvnic->max_frame_size); if ((unsigned long )skb != (unsigned long )((struct sk_buff *)0)) { skb->dev = nesvnic->netdev; bus_address = pci_map_single(nesdev->pcidev, (void *)skb->data, (size_t )nesvnic->max_frame_size, 2); cb = (struct nes_rskb_cb *)(& skb->cb); cb->busaddr = bus_address; cb->maplen = (u32 )nesvnic->max_frame_size; nic_rqe = nesnic->rq_vbase + (unsigned long )nesvnic->nic.rq_head; nic_rqe->wqe_words[0] = (unsigned int )nesvnic->max_frame_size; nic_rqe->wqe_words[1] = 0U; nic_rqe->wqe_words[2] = (unsigned int )bus_address; nic_rqe->wqe_words[3] = (unsigned int )(bus_address >> 32); nesnic->rx_skb[(int )nesnic->rq_head] = skb; nesnic->rq_head = (u16 )((int )nesnic->rq_head + 1); nesnic->rq_head = (u16 )((int )((short )nesnic->rq_head) & (int )((short )((unsigned int )nesnic->rq_size + 65535U))); atomic_dec(& nesvnic->rx_skbs_needed); __asm__ volatile ("": : : "memory"); rx_wqes_posted = rx_wqes_posted + 1U; if (rx_wqes_posted == 255U) { nes_write32(nesdev->regs + 64UL, (rx_wqes_posted << 24) | (u32 )nesnic->qp_id); rx_wqes_posted = 0U; } else { } } else { tmp___2 = spinlock_check(& nesnic->rq_lock); flags = _raw_spin_lock_irqsave(tmp___2); tmp___3 = atomic_read((atomic_t const *)(& nesvnic->rx_skbs_needed)); if ((int )nesnic->rq_size + -1 == tmp___3) { tmp___4 = atomic_read((atomic_t const *)(& nesvnic->rx_skb_timer_running)); if (tmp___4 == 0) { atomic_set(& nesvnic->rx_skb_timer_running, 1); spin_unlock_irqrestore(& nesnic->rq_lock, flags); nesvnic->rq_wqes_timer.expires = (unsigned long )jiffies + 125UL; add_timer(& nesvnic->rq_wqes_timer); } else { spin_unlock_irqrestore(& nesnic->rq_lock, flags); } } else { spin_unlock_irqrestore(& nesnic->rq_lock, flags); } goto ldv_53956; } tmp___5 = atomic_read((atomic_t const *)(& nesvnic->rx_skbs_needed)); if (tmp___5 != 0) { goto ldv_53957; } else { goto ldv_53956; } ldv_53956: __asm__ volatile ("": : : "memory"); if (rx_wqes_posted != 0U) { nes_write32(nesdev->regs + 64UL, (rx_wqes_posted << 24) | (u32 )nesnic->qp_id); } else { } nesnic->replenishing_rq = 0U; return; } } static void nes_rq_wqes_timeout(unsigned long parm ) { struct nes_vnic *nesvnic ; int tmp ; { nesvnic = (struct nes_vnic *)parm; printk("%s: Timer fired.\n", "nes_rq_wqes_timeout"); atomic_set(& nesvnic->rx_skb_timer_running, 0); tmp = atomic_read((atomic_t const *)(& nesvnic->rx_skbs_needed)); if (tmp != 0) { nes_replenish_nic_rq(nesvnic); } else { } return; } } static int nes_lro_get_skb_hdr(struct sk_buff *skb , void **iphdr , void **tcph , u64 *hdr_flags , void *priv ) { unsigned int ip_len ; struct iphdr *iph ; struct tcphdr *tmp ; { skb_reset_network_header(skb); iph = ip_hdr((struct sk_buff const *)skb); if ((unsigned int )iph->protocol != 6U) { return (-1); } else { } ip_len = ip_hdrlen((struct sk_buff const *)skb); skb_set_transport_header(skb, (int const )ip_len); tmp = tcp_hdr((struct sk_buff const *)skb); *tcph = (void *)tmp; *hdr_flags = 3ULL; *iphdr = (void *)iph; return (0); } } int nes_init_nic_qp(struct nes_device *nesdev , struct net_device *netdev ) { struct nes_hw_cqp_wqe *cqp_wqe ; struct nes_hw_nic_sq_wqe *nic_sqe ; struct nes_hw_nic_qp_context *nic_context ; struct sk_buff *skb ; struct nes_hw_nic_rq_wqe *nic_rqe ; struct nes_vnic *nesvnic ; void *tmp ; unsigned long flags ; void *vmem ; dma_addr_t pmem ; u64 u64temp ; int ret ; u32 cqp_head ; u32 counter ; u32 wqe_count ; struct nes_rskb_cb *cb ; u8 jumbomode ; struct lock_class_key __key ; raw_spinlock_t *tmp___0 ; u32 tmp___1 ; u32 tmp___2 ; u32 tmp___3 ; long __ret ; wait_queue_t __wait ; struct task_struct *tmp___4 ; u32 _min1 ; unsigned int _min2 ; unsigned int tmp___5 ; struct lock_class_key __key___0 ; int tmp___6 ; { tmp = netdev_priv((struct net_device const *)netdev); nesvnic = (struct nes_vnic *)tmp; jumbomode = 0U; nesvnic->nic_mem_size = 147736U; nesvnic->nic_vbase = pci_alloc_consistent(nesdev->pcidev, (size_t )nesvnic->nic_mem_size, & nesvnic->nic_pbase); if ((unsigned long )nesvnic->nic_vbase == (unsigned long )((void *)0)) { if ((nes_debug_level & 2U) != 0U) { printk("\viw_nes: %s[%u]: Unable to allocate memory for NIC host descriptor rings\n", "nes_init_nic_qp", 1737); } else { } return (-12); } else { } memset(nesvnic->nic_vbase, 0, (size_t )nesvnic->nic_mem_size); if ((nes_debug_level & 2U) != 0U) { printk("\viw_nes: %s[%u]: Allocated NIC QP structures at %p (phys = %016lX), size = %u.\n", "nes_init_nic_qp", 1742, nesvnic->nic_vbase, (unsigned long )nesvnic->nic_pbase, nesvnic->nic_mem_size); } else { } vmem = (void *)(((unsigned long )nesvnic->nic_vbase + 255UL) & 0xffffffffffffff00UL); pmem = (nesvnic->nic_pbase + 255ULL) & 0xffffffffffffff00ULL; nesvnic->nic.first_frag_vbase = (struct nes_first_frag *)vmem; counter = 0U; goto ldv_53994; ldv_53993: nesvnic->nic.frag_paddr[counter] = pmem; pmem = pmem + 128ULL; counter = counter + 1U; ldv_53994: ; if (counter <= 511U) { goto ldv_53993; } else { goto ldv_53995; } ldv_53995: vmem = vmem + 65536UL; nesvnic->nic.sq_vbase = (struct nes_hw_nic_sq_wqe *)vmem; nesvnic->nic.sq_pbase = pmem; nesvnic->nic.sq_head = 0U; nesvnic->nic.sq_tail = 0U; nesvnic->nic.sq_size = 512U; counter = 0U; goto ldv_53997; ldv_53996: nic_sqe = nesvnic->nic.sq_vbase + (unsigned long )counter; nic_sqe->wqe_words[0] = 3221225472U; nic_sqe->wqe_words[3] = 8388608U; nic_sqe->wqe_words[6] = (unsigned int )nesvnic->nic.frag_paddr[counter]; nic_sqe->wqe_words[7] = (unsigned int )(nesvnic->nic.frag_paddr[counter] >> 32); counter = counter + 1U; ldv_53997: ; if (counter <= 511U) { goto ldv_53996; } else { goto ldv_53998; } ldv_53998: nesvnic->get_cqp_request = & nes_get_cqp_request; nesvnic->post_cqp_request = & nes_post_cqp_request; nesvnic->mcrq_mcast_filter = 0; spinlock_check(& nesvnic->nic.rq_lock); __raw_spin_lock_init(& nesvnic->nic.rq_lock.ldv_5961.rlock, "&(&nesvnic->nic.rq_lock)->rlock", & __key); vmem = vmem + 32768UL; pmem = pmem + 32768ULL; nesvnic->nic.rq_vbase = (struct nes_hw_nic_rq_wqe *)vmem; nesvnic->nic.rq_pbase = pmem; nesvnic->nic.rq_head = 0U; nesvnic->nic.rq_tail = 0U; nesvnic->nic.rq_size = 512U; vmem = vmem + 32768UL; pmem = pmem + 32768ULL; if ((unsigned int )(nesdev->nesadapter)->netdev_count > 2U) { nesvnic->mcrq_qp_id = (u32 )((int )nesvnic->nic_index + 32); } else { nesvnic->mcrq_qp_id = (u32 )((int )nesvnic->nic.qp_id + 4); } nesvnic->nic_cq.cq_vbase = (struct nes_hw_nic_cqe volatile *)vmem; nesvnic->nic_cq.cq_pbase = pmem; nesvnic->nic_cq.cq_head = 0U; nesvnic->nic_cq.cq_size = 1024U; nesvnic->nic_cq.ce_handler = & nes_nic_napi_ce_handler; tmp___0 = spinlock_check(& nesdev->cqp.lock); flags = _raw_spin_lock_irqsave(tmp___0); cqp_head = (u32 )nesdev->cqp.sq_head; cqp_wqe = nesdev->cqp.sq_vbase + (unsigned long )cqp_head; nes_fill_init_cqp_wqe(cqp_wqe, nesdev); cqp_wqe->wqe_words[0] = ((unsigned int )nesvnic->nic_cq.cq_size << 16) | 1027U; cqp_wqe->wqe_words[1] = (unsigned int )nesvnic->nic_cq.cq_number | ((unsigned int )nesdev->nic_ceq_index << 16); u64temp = nesvnic->nic_cq.cq_pbase; set_wqe_64bit_value((__le32 *)(& cqp_wqe->wqe_words), 6U, u64temp); cqp_wqe->wqe_words[9] = 0U; u64temp = (u64 )(& nesvnic->nic_cq); cqp_wqe->wqe_words[8] = (unsigned int )(u64temp >> 1); cqp_wqe->wqe_words[9] = (unsigned int )(u64temp >> 33) & 2147483647U; cqp_wqe->wqe_words[10] = 0U; cqp_head = cqp_head + 1U; if (cqp_head >= (u32 )nesdev->cqp.sq_size) { cqp_head = 0U; } else { } cqp_wqe = nesdev->cqp.sq_vbase + (unsigned long )cqp_head; nes_fill_init_cqp_wqe(cqp_wqe, nesdev); nic_context = (struct nes_hw_nic_qp_context *)nesvnic->nic_cq.cq_vbase + (unsigned long )nesvnic->nic_cq.cq_size; nic_context->context_words[0] = (((nesdev->pcidev)->devfn & 7U) << 12) | 3840U; if ((nes_debug_level & 2U) != 0U) { tmp___1 = nes_read_indexed(nesdev, 768U); tmp___2 = nes_read_indexed(nesdev, 752U); printk("\viw_nes: %s[%u]: RX_WINDOW_BUFFER_PAGE_TABLE_SIZE = 0x%08X, RX_WINDOW_BUFFER_SIZE = 0x%08X\n", "nes_init_nic_qp", 1843, tmp___2, tmp___1); } else { } tmp___3 = nes_read_indexed(nesdev, 768U); if (tmp___3 != 0U) { nic_context->context_words[0] = nic_context->context_words[0] | 229376U; } else { } u64temp = nesvnic->nic.sq_pbase; nic_context->context_words[2] = (unsigned int )u64temp; nic_context->context_words[3] = (unsigned int )(u64temp >> 32); u64temp = nesvnic->nic.rq_pbase; nic_context->context_words[4] = (unsigned int )u64temp; nic_context->context_words[5] = (unsigned int )(u64temp >> 32); cqp_wqe->wqe_words[0] = 327680U; cqp_wqe->wqe_words[1] = (unsigned int )nesvnic->nic.qp_id; u64temp = nesvnic->nic_cq.cq_pbase + (unsigned long long )((unsigned long )nesvnic->nic_cq.cq_size * 16UL); set_wqe_64bit_value((__le32 *)(& cqp_wqe->wqe_words), 6U, u64temp); cqp_head = cqp_head + 1U; if (cqp_head >= (u32 )nesdev->cqp.sq_size) { cqp_head = 0U; } else { } nesdev->cqp.sq_head = (u16 )cqp_head; __asm__ volatile ("": : : "memory"); nes_write32(nesdev->regs + 64UL, (u32 )((int )nesdev->cqp.qp_id | 41943040)); spin_unlock_irqrestore(& nesdev->cqp.lock, flags); if ((nes_debug_level & 2U) != 0U) { printk("\viw_nes: %s[%u]: Waiting for create NIC QP%u to complete.\n", "nes_init_nic_qp", 1873, (int )nesvnic->nic.qp_id); } else { } __ret = 1200000L; if ((u32 )nesdev->cqp.sq_tail != cqp_head) { tmp___4 = get_current(); __wait.flags = 0U; __wait.private = (void *)tmp___4; __wait.func = & autoremove_wake_function; __wait.task_list.next = & __wait.task_list; __wait.task_list.prev = & __wait.task_list; ldv_54006: prepare_to_wait(& nesdev->cqp.waitq, & __wait, 2); if ((u32 )nesdev->cqp.sq_tail == cqp_head) { goto ldv_54005; } else { } __ret = schedule_timeout(__ret); if (__ret == 0L) { goto ldv_54005; } else { } goto ldv_54006; ldv_54005: finish_wait(& nesdev->cqp.waitq, & __wait); } else { } ret = (int )__ret; if ((nes_debug_level & 2U) != 0U) { printk("\viw_nes: %s[%u]: Create NIC QP%u completed, wait_event_timeout ret = %u.\n", "nes_init_nic_qp", 1878, (int )nesvnic->nic.qp_id, ret); } else { } if (ret == 0) { if ((nes_debug_level & 2U) != 0U) { printk("\viw_nes: %s[%u]: NIC QP%u create timeout expired\n", "nes_init_nic_qp", 1880, (int )nesvnic->nic.qp_id); } else { } pci_free_consistent(nesdev->pcidev, (size_t )nesvnic->nic_mem_size, nesvnic->nic_vbase, nesvnic->nic_pbase); return (-5); } else { } counter = 0U; goto ldv_54009; ldv_54008: skb = dev_alloc_skb((unsigned int )nesvnic->max_frame_size); if ((unsigned long )skb == (unsigned long )((struct sk_buff *)0)) { if ((nes_debug_level & 2U) != 0U) { printk("\viw_nes: %s[%u]: %s: out of memory for receive skb\n", "nes_init_nic_qp", 1890, (char *)(& netdev->name)); } else { } nes_destroy_nic_qp(nesvnic); return (-12); } else { } skb->dev = netdev; pmem = pci_map_single(nesdev->pcidev, (void *)skb->data, (size_t )nesvnic->max_frame_size, 2); cb = (struct nes_rskb_cb *)(& skb->cb); cb->busaddr = pmem; cb->maplen = (u32 )nesvnic->max_frame_size; nic_rqe = nesvnic->nic.rq_vbase + (unsigned long )counter; nic_rqe->wqe_words[0] = (unsigned int )nesvnic->max_frame_size; nic_rqe->wqe_words[1] = 0U; nic_rqe->wqe_words[2] = (unsigned int )pmem; nic_rqe->wqe_words[3] = (unsigned int )(pmem >> 32); nesvnic->nic.rx_skb[counter] = skb; counter = counter + 1U; ldv_54009: ; if (counter <= 510U) { goto ldv_54008; } else { goto ldv_54010; } ldv_54010: wqe_count = 511U; nesvnic->nic.rq_head = (u16 )wqe_count; __asm__ volatile ("": : : "memory"); ldv_54014: _min1 = wqe_count; _min2 = 255U; if (_min1 < _min2) { tmp___5 = _min1; } else { tmp___5 = _min2; } counter = tmp___5; wqe_count = wqe_count - counter; nes_write32(nesdev->regs + 64UL, (counter << 24) | (u32 )nesvnic->nic.qp_id); if (wqe_count != 0U) { goto ldv_54014; } else { goto ldv_54015; } ldv_54015: init_timer_key(& nesvnic->rq_wqes_timer, 0U, "(&nesvnic->rq_wqes_timer)", & __key___0); nesvnic->rq_wqes_timer.function = & nes_rq_wqes_timeout; nesvnic->rq_wqes_timer.data = (unsigned long )nesvnic; if ((nes_debug_level & 2U) != 0U) { printk("\viw_nes: %s[%u]: NAPI support Enabled\n", "nes_init_nic_qp", 1923); } else { } if ((unsigned int )(nesdev->nesadapter)->et_use_adaptive_rx_coalesce != 0U) { nes_nic_init_timer(nesdev); if (netdev->mtu > 1500U) { jumbomode = 1U; } else { } nes_nic_init_timer_defaults(nesdev, (int )jumbomode); } else { } if ((unsigned int )(nesdev->nesadapter)->allow_unaligned_fpdus != 0U) { tmp___6 = nes_init_mgt_qp(nesdev, netdev, nesvnic); if (tmp___6 != 0) { if ((nes_debug_level & 2U) != 0U) { printk("\viw_nes: %s[%u]: %s: Out of memory for pau nic\n", "nes_init_nic_qp", 1933, (char *)(& netdev->name)); } else { } nes_destroy_nic_qp(nesvnic); return (-12); } else { } } else { } nesvnic->lro_mgr.max_aggr = (int )nes_lro_max_aggr; nesvnic->lro_mgr.max_desc = 32; nesvnic->lro_mgr.lro_arr = (struct net_lro_desc *)(& nesvnic->lro_desc); nesvnic->lro_mgr.get_skb_header = & nes_lro_get_skb_hdr; nesvnic->lro_mgr.features = 3UL; nesvnic->lro_mgr.dev = netdev; nesvnic->lro_mgr.ip_summed = 1U; nesvnic->lro_mgr.ip_summed_aggr = 1U; return (0); } } void nes_destroy_nic_qp(struct nes_vnic *nesvnic ) { u64 u64temp ; dma_addr_t bus_address ; struct nes_device *nesdev ; struct nes_hw_cqp_wqe *cqp_wqe ; struct nes_hw_nic_sq_wqe *nic_sqe ; __le16 *wqe_fragment_length ; u16 wqe_fragment_index ; u32 cqp_head ; u32 wqm_cfg0 ; unsigned long flags ; struct sk_buff *rx_skb ; struct nes_rskb_cb *cb ; int ret ; u16 tmp ; u16 tmp___0 ; int tmp___1 ; raw_spinlock_t *tmp___2 ; long __ret ; wait_queue_t __wait ; struct task_struct *tmp___3 ; { nesdev = nesvnic->nesdev; if ((unsigned int )(nesdev->nesadapter)->allow_unaligned_fpdus != 0U) { nes_destroy_mgt(nesvnic); } else { } wqm_cfg0 = nes_read_indexed(nesdev, 20480U); nes_write_indexed(nesdev, 20480U, wqm_cfg0 & 4294934527U); goto ldv_54034; ldv_54033: rx_skb = nesvnic->nic.rx_skb[(int )nesvnic->nic.rq_tail]; cb = (struct nes_rskb_cb *)(& rx_skb->cb); pci_unmap_single(nesdev->pcidev, cb->busaddr, (size_t )cb->maplen, 2); tmp = nesvnic->nic.rq_tail; nesvnic->nic.rq_tail = (u16 )((int )nesvnic->nic.rq_tail + 1); consume_skb(nesvnic->nic.rx_skb[tmp]); nesvnic->nic.rq_tail = (u16 )((int )((short )nesvnic->nic.rq_tail) & (int )((short )((unsigned int )nesvnic->nic.rq_size + 65535U))); ldv_54034: ; if ((int )nesvnic->nic.rq_head != (int )nesvnic->nic.rq_tail) { goto ldv_54033; } else { goto ldv_54035; } ldv_54035: ; goto ldv_54040; ldv_54039: nic_sqe = nesvnic->nic.sq_vbase + (unsigned long )nesvnic->nic.sq_tail; wqe_fragment_index = 1U; wqe_fragment_length = (__le16 *)(& nic_sqe->wqe_words) + 3U; wqe_fragment_length = wqe_fragment_length + 1; if ((unsigned int )*(wqe_fragment_length + (unsigned long )wqe_fragment_index) != 0U) { u64temp = (unsigned long long )nic_sqe->wqe_words[((int )wqe_fragment_index + 3) * 2]; u64temp = ((unsigned long long )nic_sqe->wqe_words[(int )wqe_fragment_index * 2 + 7] << 32) + u64temp; bus_address = u64temp; tmp___1 = test_and_clear_bit((int )nesvnic->nic.sq_tail, (unsigned long volatile *)(& nesvnic->nic.first_frag_overflow)); if (tmp___1 != 0) { tmp___0 = wqe_fragment_index; wqe_fragment_index = (u16 )((int )wqe_fragment_index + 1); pci_unmap_single(nesdev->pcidev, bus_address, (size_t )*(wqe_fragment_length + (unsigned long )tmp___0), 1); } else { } goto ldv_54038; ldv_54037: ; if ((unsigned int )*(wqe_fragment_length + (unsigned long )wqe_fragment_index) != 0U) { u64temp = (u64 )nic_sqe->wqe_words[((int )wqe_fragment_index + 3) * 2]; u64temp = ((unsigned long long )nic_sqe->wqe_words[(int )wqe_fragment_index * 2 + 7] << 32) + u64temp; bus_address = u64temp; pci_unmap_page(nesdev->pcidev, bus_address, (size_t )*(wqe_fragment_length + (unsigned long )wqe_fragment_index), 1); } else { goto ldv_54036; } wqe_fragment_index = (u16 )((int )wqe_fragment_index + 1); ldv_54038: ; if ((unsigned int )wqe_fragment_index <= 4U) { goto ldv_54037; } else { goto ldv_54036; } ldv_54036: ; } else { } if ((unsigned long )nesvnic->nic.tx_skb[(int )nesvnic->nic.sq_tail] != (unsigned long )((struct sk_buff *)0)) { consume_skb(nesvnic->nic.tx_skb[(int )nesvnic->nic.sq_tail]); } else { } nesvnic->nic.sq_tail = (u16 )((int )((short )((unsigned int )nesvnic->nic.sq_tail + 1U)) & (int )((short )((unsigned int )nesvnic->nic.sq_size + 65535U))); ldv_54040: ; if ((int )nesvnic->nic.sq_head != (int )nesvnic->nic.sq_tail) { goto ldv_54039; } else { goto ldv_54041; } ldv_54041: tmp___2 = spinlock_check(& nesdev->cqp.lock); flags = _raw_spin_lock_irqsave(tmp___2); cqp_head = (u32 )nesdev->cqp.sq_head; cqp_wqe = nesdev->cqp.sq_vbase + (unsigned long )cqp_head; nes_fill_init_cqp_wqe(cqp_wqe, nesdev); set_wqe_32bit_value((__le32 *)(& cqp_wqe->wqe_words), 0U, 327682U); set_wqe_32bit_value((__le32 *)(& cqp_wqe->wqe_words), 1U, (u32 )nesvnic->nic.qp_id); cqp_head = cqp_head + 1U; if (cqp_head >= (u32 )nesdev->cqp.sq_size) { cqp_head = 0U; } else { } cqp_wqe = nesdev->cqp.sq_vbase + (unsigned long )cqp_head; nes_fill_init_cqp_wqe(cqp_wqe, nesdev); set_wqe_32bit_value((__le32 *)(& cqp_wqe->wqe_words), 0U, ((unsigned int )nesvnic->nic_cq.cq_size << 16) | 5U); set_wqe_32bit_value((__le32 *)(& cqp_wqe->wqe_words), 1U, (unsigned int )nesvnic->nic_cq.cq_number | ((unsigned int )nesdev->nic_ceq_index << 16)); cqp_head = cqp_head + 1U; if (cqp_head >= (u32 )nesdev->cqp.sq_size) { cqp_head = 0U; } else { } nesdev->cqp.sq_head = (u16 )cqp_head; __asm__ volatile ("": : : "memory"); nes_write32(nesdev->regs + 64UL, (u32 )((int )nesdev->cqp.qp_id | 41943040)); spin_unlock_irqrestore(& nesdev->cqp.lock, flags); if ((nes_debug_level & 524288U) != 0U) { printk("\viw_nes: %s[%u]: Waiting for CQP, cqp_head=%u, cqp.sq_head=%u, cqp.sq_tail=%u, cqp.sq_size=%u\n", "nes_destroy_nic_qp", 2077, cqp_head, (int )nesdev->cqp.sq_head, (int )nesdev->cqp.sq_tail, (int )nesdev->cqp.sq_size); } else { } __ret = 1200000L; if ((u32 )nesdev->cqp.sq_tail != cqp_head) { tmp___3 = get_current(); __wait.flags = 0U; __wait.private = (void *)tmp___3; __wait.func = & autoremove_wake_function; __wait.task_list.next = & __wait.task_list; __wait.task_list.prev = & __wait.task_list; ldv_54049: prepare_to_wait(& nesdev->cqp.waitq, & __wait, 2); if ((u32 )nesdev->cqp.sq_tail == cqp_head) { goto ldv_54048; } else { } __ret = schedule_timeout(__ret); if (__ret == 0L) { goto ldv_54048; } else { } goto ldv_54049; ldv_54048: finish_wait(& nesdev->cqp.waitq, & __wait); } else { } ret = (int )__ret; if ((nes_debug_level & 524288U) != 0U) { printk("\viw_nes: %s[%u]: Destroy NIC QP returned, wait_event_timeout ret = %u, cqp_head=%u, cqp.sq_head=%u, cqp.sq_tail=%u\n", "nes_destroy_nic_qp", 2084, ret, cqp_head, (int )nesdev->cqp.sq_head, (int )nesdev->cqp.sq_tail); } else { } if (ret == 0) { if ((nes_debug_level & 524288U) != 0U) { printk("\viw_nes: %s[%u]: NIC QP%u destroy timeout expired\n", "nes_destroy_nic_qp", 2087, (int )nesvnic->nic.qp_id); } else { } } else { } pci_free_consistent(nesdev->pcidev, (size_t )nesvnic->nic_mem_size, nesvnic->nic_vbase, nesvnic->nic_pbase); nes_write_indexed(nesdev, 20480U, wqm_cfg0); return; } } int nes_napi_isr(struct nes_device *nesdev ) { struct nes_adapter *nesadapter ; u32 int_stat ; long tmp ; long tmp___0 ; long tmp___1 ; int tmp___2 ; long tmp___3 ; long tmp___4 ; int tmp___5 ; { nesadapter = nesdev->nesadapter; if ((unsigned int )nesdev->napi_isr_ran != 0U) { int_stat = nesdev->int_stat; } else { int_stat = nes_read32((void const *)nesdev->regs); nesdev->int_stat = int_stat; nesdev->napi_isr_ran = 1U; } int_stat = nesdev->int_req & int_stat; if (int_stat != 0U && (int_stat & 65280U) == int_stat) { nesdev->napi_isr_ran = 0U; nes_write32(nesdev->regs, int_stat & 2432696319U); nes_process_ceq(nesdev, (struct nes_hw_ceq *)(& (nesdev->nesadapter)->ceq) + (unsigned long )nesdev->nic_ceq_index); tmp___0 = ldv__builtin_expect(nesadapter->et_rx_coalesce_usecs_irq != 0U, 0L); if (tmp___0 != 0L) { tmp___1 = ldv__builtin_expect((unsigned int )nesadapter->et_use_adaptive_rx_coalesce == 0U, 0L); if (tmp___1 != 0L) { tmp___2 = 1; } else { tmp___2 = 0; } } else { tmp___2 = 0; } if (tmp___2 != 0) { goto _L; } else { tmp___3 = ldv__builtin_expect((unsigned int )nesadapter->et_use_adaptive_rx_coalesce != 0U, 0L); if (tmp___3 != 0L) { tmp___4 = ldv__builtin_expect((u32 )nesdev->deepcq_count > nesadapter->et_pkt_rate_low, 0L); if (tmp___4 != 0L) { tmp___5 = 1; } else { tmp___5 = 0; } } else { tmp___5 = 0; } if (tmp___5 != 0) { _L: /* CIL Label */ if ((nesdev->int_req & 536870912U) == 0U) { nesdev->int_req = nesdev->int_req | 536870912U; nes_write32(nesdev->regs + 20UL, nesdev->timer_int_req | ~ (nesdev->nesadapter)->timer_int_req); nes_write32(nesdev->regs + 16UL, ~ (nesdev->intf_int_req | 4U)); } else { } tmp = ldv__builtin_expect((unsigned int )nesadapter->et_use_adaptive_rx_coalesce != 0U, 0L); if (tmp != 0L) { nes_nic_init_timer(nesdev); } else { } nes_write32(nesdev->regs + 4UL, ~ nesdev->int_req | 65535U); } else { nesdev->int_req = nesdev->int_req & 3758096383U; nes_write32(nesdev->regs + 16UL, ~ nesdev->intf_int_req); nes_write32(nesdev->regs + 4UL, ~ nesdev->int_req); } } nesdev->deepcq_count = 0U; return (1); } else { return (0); } } } static void process_critical_error(struct nes_device *nesdev ) { u32 debug_error ; u32 nes_idx_debug_error_masks0 ; u16 error_module ; u32 tmp ; { nes_idx_debug_error_masks0 = 0U; error_module = 0U; debug_error = nes_read_indexed(nesdev, 37180U); printk("\viw_nes: Critical Error reported by device!!! 0x%02X\n", (int )((unsigned short )debug_error)); nes_write_indexed(nesdev, 37180U, (debug_error & 65535U) | 16842752U); tmp = crit_err_count; crit_err_count = crit_err_count + 1U; if (tmp > 10U) { nes_write_indexed(nesdev, 37188U, 8388608U); } else { } error_module = (u16 )(((int )((unsigned short )debug_error) & 7936) >> 8); (nesdev->nesadapter)->crit_error_count[(int )error_module + -1] = (u8 )((int )(nesdev->nesadapter)->crit_error_count[(int )error_module + -1] + 1); if ((int )((unsigned char )(nesdev->nesadapter)->crit_error_count[(int )error_module + -1]) >= (int )((unsigned char )nes_max_critical_error_count)) { printk("\viw_nes: Masking off critical error for module 0x%02X\n", (int )error_module); nes_idx_debug_error_masks0 = nes_read_indexed(nesdev, 37184U); nes_write_indexed(nesdev, 37184U, (u32 )(1 << (int )error_module) | nes_idx_debug_error_masks0); } else { } return; } } void nes_dpc(unsigned long param ) { struct nes_device *nesdev ; struct nes_adapter *nesadapter ; u32 counter ; u32 loop_counter ; u32 int_status_bit ; u32 int_stat ; u32 timer_stat ; u32 temp_int_stat ; u32 intf_int_stat ; u32 processed_intf_int ; u16 processed_timer_int ; u16 completion_ints ; u16 timer_ints ; u32 tmp ; long tmp___0 ; { nesdev = (struct nes_device *)param; nesadapter = nesdev->nesadapter; loop_counter = 0U; processed_intf_int = 0U; processed_timer_int = 0U; completion_ints = 0U; timer_ints = 0U; ldv_54083: timer_stat = 0U; if ((unsigned int )nesdev->napi_isr_ran != 0U) { nesdev->napi_isr_ran = 0U; int_stat = nesdev->int_stat; } else { int_stat = nes_read32((void const *)nesdev->regs); } if (processed_intf_int != 0U) { int_stat = (nesdev->int_req & int_stat) & 3221225471U; } else { int_stat = nesdev->int_req & int_stat; } if ((unsigned int )processed_timer_int == 0U) { processed_timer_int = 1U; if ((int_stat & 536870912U) != 0U) { timer_stat = nes_read32((void const *)nesdev->regs + 20U); if ((nesdev->timer_int_req & timer_stat) == 0U) { int_stat = int_stat & 3758096383U; } else { } } else { } } else { int_stat = int_stat & 3758096383U; } if (int_stat != 0U) { if ((int_stat & 2432696319U) != 0U) { nes_write32(nesdev->regs, int_stat & 2432696319U); } else { } temp_int_stat = int_stat; counter = 0U; int_status_bit = 1U; goto ldv_54080; ldv_54079: ; if ((int_stat & int_status_bit) != 0U) { nes_process_ceq(nesdev, (struct nes_hw_ceq *)(& nesadapter->ceq) + (unsigned long )counter); temp_int_stat = ~ int_status_bit & temp_int_stat; completion_ints = 1U; } else { } if ((temp_int_stat & 65535U) == 0U) { goto ldv_54078; } else { } int_status_bit = int_status_bit << 1; counter = counter + 1U; ldv_54080: ; if (counter <= 15U) { goto ldv_54079; } else { goto ldv_54078; } ldv_54078: int_status_bit = (u32 )(1 << (int )(((nesdev->pcidev)->devfn & 7U) + 16U)); if ((int_stat & int_status_bit) != 0U) { nes_process_aeq(nesdev, (struct nes_hw_aeq *)(& nesadapter->aeq) + ((unsigned long )(nesdev->pcidev)->devfn & 7UL)); } else { } int_status_bit = (u32 )(1 << (int )(nesdev->mac_index + 24U)); if ((int_stat & int_status_bit) != 0U) { nes_process_mac_intr(nesdev, nesdev->mac_index); } else { } if ((int_stat & 536870912U) != 0U) { if ((nesdev->timer_int_req & timer_stat) != 0U) { nes_write32(nesdev->regs + 20UL, (nesdev->timer_int_req & timer_stat) | ~ (nesdev->nesadapter)->timer_int_req); timer_ints = 1U; } else { } } else { } if ((int_stat & 1073741824U) != 0U) { processed_intf_int = 1U; intf_int_stat = nes_read32((void const *)nesdev->regs + 12U); intf_int_stat = nesdev->intf_int_req & intf_int_stat; if ((intf_int_stat & 16384U) != 0U) { process_critical_error(nesdev); } else { } if ((int )intf_int_stat & 1) { printk("\viw_nes: PCI Error reported by device!!!\n"); __asm__ volatile ("1:\tud2\n.pushsection __bug_table,\"a\"\n2:\t.long 1b - 2b, %c0 - 2b\n\t.word %c1, 0\n\t.org 2b+%c2\n.popsection": : "i" ((char *)"/home/zakharov/workspace/benchmarks/bench_1/work/current--X--drivers/infiniband/hw/nes/iw_nes.ko--X--deg2_cpalinux-3.8-rc1--X--32_7a--X--cpachecker/linux-3.8-rc1/csd_deg_dscv/18/dscv_tempdir/dscv/ri/32_7a/drivers/infiniband/hw/nes/nes_hw.c.prepared"), "i" (2278), "i" (12UL)); ldv_54081: ; goto ldv_54081; } else { } if ((intf_int_stat & 16711680U) != 0U) { printk("\viw_nes: AEQ Overflow reported by device!!!\n"); __asm__ volatile ("1:\tud2\n.pushsection __bug_table,\"a\"\n2:\t.long 1b - 2b, %c0 - 2b\n\t.word %c1, 0\n\t.org 2b+%c2\n.popsection": : "i" ((char *)"/home/zakharov/workspace/benchmarks/bench_1/work/current--X--drivers/infiniband/hw/nes/iw_nes.ko--X--deg2_cpalinux-3.8-rc1--X--32_7a--X--cpachecker/linux-3.8-rc1/csd_deg_dscv/18/dscv_tempdir/dscv/ri/32_7a/drivers/infiniband/hw/nes/nes_hw.c.prepared"), "i" (2282), "i" (12UL)); ldv_54082: ; goto ldv_54082; } else { } nes_write32(nesdev->regs + 12UL, intf_int_stat); } else { } } else { } int_stat = int_stat & 3221225471U; if (int_stat != 0U) { tmp = loop_counter; loop_counter = loop_counter + 1U; if (tmp <= 127U) { goto ldv_54083; } else { goto ldv_54084; } } else { goto ldv_54084; } ldv_54084: ; if ((unsigned int )timer_ints == 1U) { if (nesadapter->et_rx_coalesce_usecs_irq != 0U || (unsigned int )nesadapter->et_use_adaptive_rx_coalesce != 0U) { if ((unsigned int )completion_ints == 0U) { nesdev->timer_only_int_count = nesdev->timer_only_int_count + 1U; if (nesdev->timer_only_int_count >= nesadapter->timer_int_limit) { nesdev->timer_only_int_count = 0U; nesdev->int_req = nesdev->int_req & 3758096383U; nes_write32(nesdev->regs + 16UL, ~ nesdev->intf_int_req); nes_write32(nesdev->regs + 4UL, ~ nesdev->int_req); } else { nes_write32(nesdev->regs + 4UL, ~ nesdev->int_req | 65535U); } } else { tmp___0 = ldv__builtin_expect((unsigned int )nesadapter->et_use_adaptive_rx_coalesce != 0U, 0L); if (tmp___0 != 0L) { nes_nic_init_timer(nesdev); } else { } nesdev->timer_only_int_count = 0U; nes_write32(nesdev->regs + 4UL, ~ nesdev->int_req | 65535U); } } else { nesdev->timer_only_int_count = 0U; nesdev->int_req = nesdev->int_req & 3758096383U; nes_write32(nesdev->regs + 16UL, ~ nesdev->intf_int_req); nes_write32(nesdev->regs + 20UL, nesdev->timer_int_req | ~ (nesdev->nesadapter)->timer_int_req); nes_write32(nesdev->regs + 4UL, ~ nesdev->int_req); } } else if ((unsigned int )completion_ints == 1U && ((nesadapter->et_rx_coalesce_usecs_irq != 0U && (unsigned int )nesadapter->et_use_adaptive_rx_coalesce == 0U) || ((u32 )nesdev->deepcq_count > nesadapter->et_pkt_rate_low && (unsigned int )nesadapter->et_use_adaptive_rx_coalesce != 0U))) { nesdev->timer_only_int_count = 0U; nesdev->int_req = nesdev->int_req | 536870912U; nes_write32(nesdev->regs + 20UL, nesdev->timer_int_req | ~ (nesdev->nesadapter)->timer_int_req); nes_write32(nesdev->regs + 16UL, ~ (nesdev->intf_int_req | 4U)); nes_write32(nesdev->regs + 4UL, ~ nesdev->int_req | 65535U); } else { nes_write32(nesdev->regs + 4UL, ~ nesdev->int_req); } nesdev->deepcq_count = 0U; return; } } static void nes_process_ceq(struct nes_device *nesdev , struct nes_hw_ceq *ceq ) { u64 u64temp ; struct nes_hw_cq *cq ; u32 head ; u32 ceq_size ; { head = (u32 )ceq->ceq_head; ceq_size = (u32 )ceq->ceq_size; ldv_54094: ; if ((int )(ceq->ceq_vbase + (unsigned long )head)->ceqe_words[1] < 0) { u64temp = ((unsigned long long )(ceq->ceq_vbase + (unsigned long )head)->ceqe_words[1] << 32) | (unsigned long long )(ceq->ceq_vbase + (unsigned long )head)->ceqe_words[0]; u64temp = u64temp << 1; cq = *((struct nes_hw_cq **)(& u64temp)); __asm__ volatile ("": : : "memory"); (ceq->ceq_vbase + (unsigned long )head)->ceqe_words[1] = 0U; (*(cq->ce_handler))(nesdev, cq); head = head + 1U; if (head >= ceq_size) { head = 0U; } else { } } else { goto ldv_54093; } goto ldv_54094; ldv_54093: ceq->ceq_head = (u16 )head; return; } } static void nes_process_aeq(struct nes_device *nesdev , struct nes_hw_aeq *aeq ) { u32 head ; u32 aeq_size ; u32 aeqe_misc ; u32 aeqe_cq_id ; struct nes_hw_aeqe volatile *aeqe ; { head = (u32 )aeq->aeq_head; aeq_size = (u32 )aeq->aeq_size; ldv_54106: aeqe = aeq->aeq_vbase + (unsigned long )head; if ((int )aeqe->aeqe_words[3] >= 0) { goto ldv_54104; } else { } aeqe_misc = aeqe->aeqe_words[3]; aeqe_cq_id = aeqe->aeqe_words[2]; if ((aeqe_misc & 196608U) != 0U) { if (aeqe_cq_id > 63U) { nes_process_iwarp_aeqe(nesdev, (struct nes_hw_aeqe *)aeqe); } else if ((nes_debug_level & 65536U) != 0U) { printk("\viw_nes: %s[%u]: Processing CQP related AE, misc = 0x%04X\n", "nes_process_aeq", 2417, (int )((unsigned short )(aeqe_misc >> 16))); } else { } } else { } aeqe->aeqe_words[3] = 0U; head = head + 1U; if (head >= aeq_size) { head = 0U; } else { } nes_write32(nesdev->regs + 72UL, 65536U); goto ldv_54106; ldv_54104: aeq->aeq_head = (u16 )head; return; } } static void nes_reset_link(struct nes_device *nesdev , u32 mac_index ) { struct nes_adapter *nesadapter ; u32 reset_value ; u32 i ; u32 u32temp ; u32 tmp ; u32 tmp___0 ; u32 pcs_control_status0 ; u32 pcs_control_status1 ; u32 tmp___1 ; u32 tmp___2 ; { nesadapter = nesdev->nesadapter; i = 0U; if (nesadapter->hw_rev == 4U) { return; } else { } mh_detected = mh_detected + 1U; reset_value = nes_read32((void const *)nesdev->regs + 48U); if (mac_index == 0U || (mac_index == 1U && (unsigned int )nesadapter->OneG_Mode != 0U)) { reset_value = reset_value | 29U; } else { reset_value = reset_value | 45U; } if ((unsigned int )nesadapter->link_interrupt_count[mac_index] > 511U) { if ((unsigned int )nesadapter->OneG_Mode == 0U && (unsigned int )nesadapter->port_count == 2U) { nesadapter->link_interrupt_count[0] = 0U; nesadapter->link_interrupt_count[1] = 0U; u32temp = nes_read_indexed(nesdev, 10760U); if ((u32temp & 64U) != 0U) { nes_write_indexed(nesdev, 10760U, 61576U); } else { nes_write_indexed(nesdev, 10760U, 61640U); } reset_value = reset_value | 61U; } else { } nesadapter->link_interrupt_count[mac_index] = 0U; } else { } nes_write32(nesdev->regs + 48UL, reset_value); goto ldv_54116; ldv_54115: ; ldv_54116: tmp = nes_read32((void const *)nesdev->regs + 48U); if ((tmp & 64U) == 0U) { tmp___0 = i; i = i + 1U; if (tmp___0 <= 4999U) { goto ldv_54115; } else { goto ldv_54117; } } else { goto ldv_54117; } ldv_54117: ; if ((reset_value & 61U) == 61U) { i = 0U; goto ldv_54123; ldv_54122: pcs_control_status0 = nes_read_indexed(nesdev, 10240U); pcs_control_status1 = nes_read_indexed(nesdev, 10752U); if (((pcs_control_status0 & 251658240U) == 251658240U && (pcs_control_status0 & 1048576U) != 0U) || ((pcs_control_status1 & 251658240U) == 251658240U && (pcs_control_status1 & 1048576U) != 0U)) { goto ldv_54120; } else { goto ldv_54121; } ldv_54120: i = i + 1U; ldv_54123: ; if (i <= 9U) { goto ldv_54122; } else { goto ldv_54121; } ldv_54121: ; if (i == 10U) { u32temp = nes_read_indexed(nesdev, 10760U); if ((u32temp & 64U) != 0U) { nes_write_indexed(nesdev, 10760U, 61576U); } else { nes_write_indexed(nesdev, 10760U, 61640U); } nes_write32(nesdev->regs + 48UL, reset_value); goto ldv_54125; ldv_54124: ; ldv_54125: tmp___1 = nes_read32((void const *)nesdev->regs + 48U); if ((tmp___1 & 64U) == 0U) { tmp___2 = i; i = i + 1U; if (tmp___2 <= 4999U) { goto ldv_54124; } else { goto ldv_54126; } } else { goto ldv_54126; } ldv_54126: ; } else { } } else { } return; } } static void nes_process_mac_intr(struct nes_device *nesdev , u32 mac_number ) { unsigned long flags ; u32 pcs_control_status ; struct nes_adapter *nesadapter ; struct nes_vnic *nesvnic ; u32 mac_status ; u32 mac_index ; u32 u32temp ; u16 phy_data ; u16 temp_phy_data ; u32 pcs_val ; u32 pcs_mask ; u32 cdr_ctrl ; raw_spinlock_t *tmp ; u32 tmp___0 ; u32 tmp___1 ; u32 tmp___2 ; u32 tmp___3 ; char *tmp___4 ; struct list_head const *__mptr ; bool tmp___5 ; struct list_head const *__mptr___0 ; struct list_head const *__mptr___1 ; bool tmp___6 ; int tmp___7 ; struct list_head const *__mptr___2 ; unsigned long tmp___8 ; { nesadapter = nesdev->nesadapter; mac_index = nesdev->mac_index; pcs_val = 252641280U; pcs_mask = 253689856U; tmp = spinlock_check(& nesadapter->phy_lock); flags = _raw_spin_lock_irqsave(tmp); if ((unsigned int )nesadapter->mac_sw_state[mac_number] != 0U) { spin_unlock_irqrestore(& nesadapter->phy_lock, flags); return; } else { } nesadapter->mac_sw_state[mac_number] = 1U; mac_status = nes_read_indexed(nesdev, mac_index * 512U + 8688U); nes_write_indexed(nesdev, mac_index * 512U + 8688U, mac_status); if ((nes_debug_level & 8U) != 0U) { printk("\viw_nes: %s[%u]: MAC%u interrupt status = 0x%X.\n", "nes_process_mac_intr", 2530, mac_number, mac_status); } else { } if ((mac_status & 6U) != 0U) { nesdev->link_status_interrupts = nesdev->link_status_interrupts + 1ULL; nesadapter->link_interrupt_count[mac_index] = (u16 )((int )nesadapter->link_interrupt_count[mac_index] + 1); if (((unsigned int )((unsigned short )nesadapter->link_interrupt_count[mac_index]) & 127U) == 0U) { nes_reset_link(nesdev, mac_index); } else { } if ((unsigned int )nesadapter->OneG_Mode != 0U && (unsigned int )nesadapter->phy_type[mac_index] != 5U) { ldv_54147: nes_read_1G_phy_reg(nesdev, 26, (int )nesadapter->phy_index[mac_index], & phy_data); if ((nes_debug_level & 8U) != 0U) { printk("\viw_nes: %s[%u]: Phy%d data from register 0x1a = 0x%X.\n", "nes_process_mac_intr", 2544, (int )nesadapter->phy_index[mac_index], (int )phy_data); } else { } if ((int )((short )phy_data) < 0) { goto ldv_54147; } else { goto ldv_54148; } ldv_54148: temp_phy_data = 0U; ldv_54150: nes_read_1G_phy_reg(nesdev, 17, (int )nesadapter->phy_index[mac_index], & phy_data); if ((nes_debug_level & 8U) != 0U) { printk("\viw_nes: %s[%u]: Phy%d data from register 0x11 = 0x%X.\n", "nes_process_mac_intr", 2552, (int )nesadapter->phy_index[mac_index], (int )phy_data); } else { } if ((int )temp_phy_data == (int )phy_data) { goto ldv_54149; } else { } temp_phy_data = phy_data; goto ldv_54150; ldv_54149: nes_read_1G_phy_reg(nesdev, 30, (int )nesadapter->phy_index[mac_index], & phy_data); if ((nes_debug_level & 8U) != 0U) { printk("\viw_nes: %s[%u]: Phy%d data from register 0x1e = 0x%X.\n", "nes_process_mac_intr", 2561, (int )nesadapter->phy_index[mac_index], (int )phy_data); } else { } nes_read_1G_phy_reg(nesdev, 1, (int )nesadapter->phy_index[mac_index], & phy_data); if ((nes_debug_level & 8U) != 0U) { printk("\viw_nes: %s[%u]: 1G phy%u data from register 1 = 0x%X\n", "nes_process_mac_intr", 2566, (int )nesadapter->phy_index[mac_index], (int )phy_data); } else { } if (((int )temp_phy_data & 4096) != 0) { if ((nes_debug_level & 8U) != 0U) { printk("\viw_nes: %s[%u]: The Link is up according to the PHY\n", "nes_process_mac_intr", 2569); } else { } phy_data = 4U; } else if ((nes_debug_level & 8U) != 0U) { printk("\viw_nes: %s[%u]: The Link is down according to the PHY\n", "nes_process_mac_intr", 2572); } else { } } else { } if ((nes_debug_level & 8U) != 0U) { tmp___0 = nes_read_indexed(nesdev, 10764U); tmp___1 = nes_read_indexed(nesdev, 10252U); printk("\viw_nes: %s[%u]: Eth SERDES Common Status: 0=0x%08X, 1=0x%08X\n", "nes_process_mac_intr", 2577, tmp___1, tmp___0); } else { } if ((unsigned int )nesadapter->phy_type[mac_index] == 5U) { switch (mac_index) { case 1: ; case 3: pcs_control_status = nes_read_indexed(nesdev, 10752U); goto ldv_54153; default: pcs_control_status = nes_read_indexed(nesdev, 10240U); goto ldv_54153; } ldv_54153: ; } else { pcs_control_status = nes_read_indexed(nesdev, ((mac_index & 1U) + 20U) * 512U); pcs_control_status = nes_read_indexed(nesdev, ((mac_index & 1U) + 20U) * 512U); } if ((nes_debug_level & 8U) != 0U) { printk("\viw_nes: %s[%u]: PCS PHY Control/Status%u: 0x%08X\n", "nes_process_mac_intr", 2599, mac_index, pcs_control_status); } else { } if ((unsigned int )nesadapter->OneG_Mode != 0U && (unsigned int )nesadapter->phy_type[mac_index] != 5U) { u32temp = 16842752U; if ((unsigned int )nesadapter->port_count > 2U) { u32temp = u32temp | 33685504U; } else { } if ((pcs_control_status & u32temp) != u32temp) { phy_data = 0U; if ((nes_debug_level & 8U) != 0U) { printk("\viw_nes: %s[%u]: PCS says the link is down\n", "nes_process_mac_intr", 2608); } else { } } else { } } else { switch ((int )nesadapter->phy_type[mac_index]) { case 4: ; case 8: ; case 9: nes_read_10G_phy_reg(nesdev, (int )nesadapter->phy_index[mac_index], 4, 8); nes_read_10G_phy_reg(nesdev, (int )nesadapter->phy_index[mac_index], 4, 49153); nes_read_10G_phy_reg(nesdev, (int )nesadapter->phy_index[mac_index], 4, 49154); nes_read_10G_phy_reg(nesdev, (int )nesadapter->phy_index[mac_index], 4, 49157); nes_read_10G_phy_reg(nesdev, (int )nesadapter->phy_index[mac_index], 4, 49158); nes_read_10G_phy_reg(nesdev, (int )nesadapter->phy_index[mac_index], 1, 36867); nes_read_10G_phy_reg(nesdev, (int )nesadapter->phy_index[mac_index], 1, 36868); nes_read_10G_phy_reg(nesdev, (int )nesadapter->phy_index[mac_index], 1, 36869); nes_read_10G_phy_reg(nesdev, (int )nesadapter->phy_index[mac_index], 1, 36867); tmp___2 = nes_read_indexed(nesdev, 8324U); temp_phy_data = (unsigned short )tmp___2; nes_read_10G_phy_reg(nesdev, (int )nesadapter->phy_index[mac_index], 3, 33); nes_read_indexed(nesdev, 8324U); nes_read_10G_phy_reg(nesdev, (int )nesadapter->phy_index[mac_index], 3, 33); tmp___3 = nes_read_indexed(nesdev, 8324U); phy_data = (unsigned short )tmp___3; if ((unsigned int )temp_phy_data == 0U && (unsigned int )phy_data == 32768U) { phy_data = 4U; } else { phy_data = 0U; } if ((nes_debug_level & 8U) != 0U) { if ((unsigned int )nesadapter->mac_link_down[mac_index] != 0U) { tmp___4 = (char *)"DOWN"; } else { tmp___4 = (char *)"UP"; } printk("\viw_nes: %s[%u]: %s: Phy data = 0x%04X, link was %s.\n", "nes_process_mac_intr", 2636, "nes_process_mac_intr", (int )phy_data, tmp___4); } else { } goto ldv_54158; case 5: ; if (mac_index <= 1U) { pcs_mask = 16842752U; pcs_val = pcs_mask; } else { pcs_mask = 33685504U; pcs_val = pcs_mask; } default: ; if ((pcs_control_status & pcs_mask) == pcs_val) { phy_data = 4U; } else { phy_data = 0U; } goto ldv_54158; } ldv_54158: ; } if (((int )phy_data & 4) != 0) { if ((wide_ppm_offset != 0 && (unsigned int )nesadapter->phy_type[mac_index] == 1U) && nesadapter->hw_rev != 4U) { cdr_ctrl = nes_read_indexed(nesdev, mac_index * 512U + 10292U); nes_write_indexed(nesdev, mac_index * 512U + 10292U, cdr_ctrl | 983040U); } else { } nesadapter->mac_link_down[mac_index] = 0U; __mptr = (struct list_head const *)((struct list_head *)(& nesadapter->nesvnic_list) + (unsigned long )mac_index)->next; nesvnic = (struct nes_vnic *)__mptr + 0xffffffffffffcc28UL; goto ldv_54166; ldv_54165: ; if ((nes_debug_level & 8U) != 0U) { printk("\viw_nes: %s[%u]: The Link is UP!!. linkup was %d\n", "nes_process_mac_intr", 2666, (int )nesvnic->linkup); } else { } if ((unsigned int )nesvnic->linkup == 0U) { printk("iw_nes: The Link is now up for port %s, netdev %p.\n", (char *)(& (nesvnic->netdev)->name), nesvnic->netdev); tmp___5 = netif_queue_stopped((struct net_device const *)nesvnic->netdev); if ((int )tmp___5) { netif_start_queue(nesvnic->netdev); } else { } nesvnic->linkup = 1U; netif_carrier_on(nesvnic->netdev); spin_lock(& nesvnic->port_ibevent_lock); if ((unsigned int )nesvnic->of_device_registered != 0U) { if ((unsigned int )nesdev->iw_status == 0U) { nesdev->iw_status = 1U; nes_port_ibevent(nesvnic); } else { } } else { } spin_unlock(& nesvnic->port_ibevent_lock); } else { } __mptr___0 = (struct list_head const *)nesvnic->list.next; nesvnic = (struct nes_vnic *)__mptr___0 + 0xffffffffffffcc28UL; ldv_54166: ; if ((unsigned long )(& nesvnic->list) != (unsigned long )((struct list_head *)(& nesadapter->nesvnic_list) + (unsigned long )mac_index)) { goto ldv_54165; } else { goto ldv_54167; } ldv_54167: ; } else { if ((wide_ppm_offset != 0 && (unsigned int )nesadapter->phy_type[mac_index] == 1U) && nesadapter->hw_rev != 4U) { cdr_ctrl = nes_read_indexed(nesdev, mac_index * 512U + 10292U); nes_write_indexed(nesdev, mac_index * 512U + 10292U, cdr_ctrl & 4293984255U); } else { } nesadapter->mac_link_down[mac_index] = 1U; __mptr___1 = (struct list_head const *)((struct list_head *)(& nesadapter->nesvnic_list) + (unsigned long )mac_index)->next; nesvnic = (struct nes_vnic *)__mptr___1 + 0xffffffffffffcc28UL; goto ldv_54173; ldv_54172: ; if ((nes_debug_level & 8U) != 0U) { printk("\viw_nes: %s[%u]: The Link is Down!!. linkup was %d\n", "nes_process_mac_intr", 2700, (int )nesvnic->linkup); } else { } if ((unsigned int )nesvnic->linkup == 1U) { printk("iw_nes: The Link is now down for port %s, netdev %p.\n", (char *)(& (nesvnic->netdev)->name), nesvnic->netdev); tmp___6 = netif_queue_stopped((struct net_device const *)nesvnic->netdev); if (tmp___6) { tmp___7 = 0; } else { tmp___7 = 1; } if (tmp___7) { netif_stop_queue(nesvnic->netdev); } else { } nesvnic->linkup = 0U; netif_carrier_off(nesvnic->netdev); spin_lock(& nesvnic->port_ibevent_lock); if ((unsigned int )nesvnic->of_device_registered != 0U) { if ((unsigned int )nesdev->iw_status == 1U) { nesdev->iw_status = 0U; nes_port_ibevent(nesvnic); } else { } } else { } spin_unlock(& nesvnic->port_ibevent_lock); } else { } __mptr___2 = (struct list_head const *)nesvnic->list.next; nesvnic = (struct nes_vnic *)__mptr___2 + 0xffffffffffffcc28UL; ldv_54173: ; if ((unsigned long )(& nesvnic->list) != (unsigned long )((struct list_head *)(& nesadapter->nesvnic_list) + (unsigned long )mac_index)) { goto ldv_54172; } else { goto ldv_54174; } ldv_54174: ; } if ((unsigned int )nesadapter->phy_type[mac_index] == 8U) { nesdev->link_recheck = 1U; tmp___8 = msecs_to_jiffies(50U); mod_delayed_work(system_wq, & nesdev->work, tmp___8); } else { } } else { } spin_unlock_irqrestore(& nesadapter->phy_lock, flags); nesadapter->mac_sw_state[mac_number] = 0U; return; } } void nes_recheck_link_status(struct work_struct *work ) { unsigned long flags ; struct nes_device *nesdev ; struct work_struct const *__mptr ; struct nes_adapter *nesadapter ; struct nes_vnic *nesvnic ; u32 mac_index ; u16 phy_data ; u16 temp_phy_data ; raw_spinlock_t *tmp ; u32 tmp___0 ; u32 tmp___1 ; char *tmp___2 ; struct list_head const *__mptr___0 ; bool tmp___3 ; struct list_head const *__mptr___1 ; struct list_head const *__mptr___2 ; bool tmp___4 ; int tmp___5 ; struct list_head const *__mptr___3 ; unsigned long tmp___6 ; u8 tmp___7 ; { __mptr = (struct work_struct const *)work; nesdev = (struct nes_device *)__mptr + 0xfffffffffffffd18UL; nesadapter = nesdev->nesadapter; mac_index = nesdev->mac_index; tmp = spinlock_check(& nesadapter->phy_lock); flags = _raw_spin_lock_irqsave(tmp); nes_read_10G_phy_reg(nesdev, (int )nesadapter->phy_index[mac_index], 1, 36867); tmp___0 = nes_read_indexed(nesdev, 8324U); temp_phy_data = (unsigned short )tmp___0; nes_read_10G_phy_reg(nesdev, (int )nesadapter->phy_index[mac_index], 3, 33); nes_read_indexed(nesdev, 8324U); nes_read_10G_phy_reg(nesdev, (int )nesadapter->phy_index[mac_index], 3, 33); tmp___1 = nes_read_indexed(nesdev, 8324U); phy_data = (unsigned short )tmp___1; if ((unsigned int )temp_phy_data == 0U && (unsigned int )phy_data == 32768U) { phy_data = 4U; } else { phy_data = 0U; } if ((nes_debug_level & 8U) != 0U) { if ((unsigned int )nesadapter->mac_link_down[mac_index] != 0U) { tmp___2 = (char *)"DOWN"; } else { tmp___2 = (char *)"UP"; } printk("\viw_nes: %s[%u]: %s: Phy data = 0x%04X, link was %s.\n", "nes_recheck_link_status", 2757, "nes_recheck_link_status", (int )phy_data, tmp___2); } else { } if (((int )phy_data & 4) != 0) { nesadapter->mac_link_down[mac_index] = 0U; __mptr___0 = (struct list_head const *)((struct list_head *)(& nesadapter->nesvnic_list) + (unsigned long )mac_index)->next; nesvnic = (struct nes_vnic *)__mptr___0 + 0xffffffffffffcc28UL; goto ldv_54196; ldv_54195: ; if ((unsigned int )nesvnic->linkup == 0U) { printk("iw_nes: The Link is now up for port %s, netdev %p.\n", (char *)(& (nesvnic->netdev)->name), nesvnic->netdev); tmp___3 = netif_queue_stopped((struct net_device const *)nesvnic->netdev); if ((int )tmp___3) { netif_start_queue(nesvnic->netdev); } else { } nesvnic->linkup = 1U; netif_carrier_on(nesvnic->netdev); spin_lock(& nesvnic->port_ibevent_lock); if ((unsigned int )nesvnic->of_device_registered != 0U) { if ((unsigned int )nesdev->iw_status == 0U) { nesdev->iw_status = 1U; nes_port_ibevent(nesvnic); } else { } } else { } spin_unlock(& nesvnic->port_ibevent_lock); } else { } __mptr___1 = (struct list_head const *)nesvnic->list.next; nesvnic = (struct nes_vnic *)__mptr___1 + 0xffffffffffffcc28UL; ldv_54196: ; if ((unsigned long )(& nesvnic->list) != (unsigned long )((struct list_head *)(& nesadapter->nesvnic_list) + (unsigned long )mac_index)) { goto ldv_54195; } else { goto ldv_54197; } ldv_54197: ; } else { nesadapter->mac_link_down[mac_index] = 1U; __mptr___2 = (struct list_head const *)((struct list_head *)(& nesadapter->nesvnic_list) + (unsigned long )mac_index)->next; nesvnic = (struct nes_vnic *)__mptr___2 + 0xffffffffffffcc28UL; goto ldv_54203; ldv_54202: ; if ((unsigned int )nesvnic->linkup == 1U) { printk("iw_nes: The Link is now down for port %s, netdev %p.\n", (char *)(& (nesvnic->netdev)->name), nesvnic->netdev); tmp___4 = netif_queue_stopped((struct net_device const *)nesvnic->netdev); if (tmp___4) { tmp___5 = 0; } else { tmp___5 = 1; } if (tmp___5) { netif_stop_queue(nesvnic->netdev); } else { } nesvnic->linkup = 0U; netif_carrier_off(nesvnic->netdev); spin_lock(& nesvnic->port_ibevent_lock); if ((unsigned int )nesvnic->of_device_registered != 0U) { if ((unsigned int )nesdev->iw_status == 1U) { nesdev->iw_status = 0U; nes_port_ibevent(nesvnic); } else { } } else { } spin_unlock(& nesvnic->port_ibevent_lock); } else { } __mptr___3 = (struct list_head const *)nesvnic->list.next; nesvnic = (struct nes_vnic *)__mptr___3 + 0xffffffffffffcc28UL; ldv_54203: ; if ((unsigned long )(& nesvnic->list) != (unsigned long )((struct list_head *)(& nesadapter->nesvnic_list) + (unsigned long )mac_index)) { goto ldv_54202; } else { goto ldv_54204; } ldv_54204: ; } tmp___7 = nesdev->link_recheck; nesdev->link_recheck = (u8 )((int )nesdev->link_recheck + 1); if ((unsigned int )((unsigned char )tmp___7) <= 59U) { tmp___6 = msecs_to_jiffies(50U); schedule_delayed_work(& nesdev->work, tmp___6); } else { nesdev->link_recheck = 0U; } spin_unlock_irqrestore(& nesadapter->phy_lock, flags); return; } } static void nes_nic_napi_ce_handler(struct nes_device *nesdev , struct nes_hw_nic_cq *cq ) { struct nes_vnic *nesvnic ; struct nes_hw_nic_cq const *__mptr ; { __mptr = (struct nes_hw_nic_cq const *)cq; nesvnic = (struct nes_vnic *)__mptr + 0xffffffffffffcd38UL; napi_schedule(& nesvnic->napi); return; } } void nes_nic_ce_handler(struct nes_device *nesdev , struct nes_hw_nic_cq *cq ) { u64 u64temp ; dma_addr_t bus_address ; struct nes_hw_nic *nesnic ; struct nes_vnic *nesvnic ; struct nes_hw_nic_cq const *__mptr ; struct nes_adapter *nesadapter ; struct nes_hw_nic_rq_wqe *nic_rqe ; struct nes_hw_nic_sq_wqe *nic_sqe ; struct sk_buff *skb ; struct sk_buff *rx_skb ; struct nes_rskb_cb *cb ; __le16 *wqe_fragment_length ; u32 head ; u32 cq_size ; u32 rx_pkt_size ; u32 cqe_count ; u32 cqe_errv ; u32 cqe_misc ; u16 wqe_fragment_index ; u16 vlan_tag ; u16 pkt_type ; u16 rqes_processed ; u8 sq_cqes ; u8 nes_use_lro ; u16 tmp ; int tmp___0 ; bool tmp___1 ; int tmp___2 ; int tmp___3 ; bool tmp___4 ; long tmp___5 ; int tmp___6 ; { __mptr = (struct nes_hw_nic_cq const *)cq; nesvnic = (struct nes_vnic *)__mptr + 0xffffffffffffcd38UL; nesadapter = nesdev->nesadapter; cqe_count = 0U; wqe_fragment_index = 1U; rqes_processed = 0U; sq_cqes = 0U; nes_use_lro = 0U; head = (u32 )cq->cq_head; cq_size = (u32 )cq->cq_size; cq->cqes_pending = 1U; if (((nesvnic->netdev)->features & 32768ULL) != 0ULL) { nes_use_lro = 1U; } else { } ldv_54247: ; if ((int )(cq->cq_vbase + (unsigned long )head)->cqe_words[3] < 0) { nesnic = & nesvnic->nic; cqe_misc = (cq->cq_vbase + (unsigned long )head)->cqe_words[3]; if ((cqe_misc & 16777216U) != 0U) { sq_cqes = (u8 )((int )sq_cqes + 1); wqe_fragment_index = 1U; nic_sqe = nesnic->sq_vbase + (unsigned long )nesnic->sq_tail; skb = nesnic->tx_skb[(int )nesnic->sq_tail]; wqe_fragment_length = (__le16 *)(& nic_sqe->wqe_words) + 3U; wqe_fragment_length = wqe_fragment_length + 1; if ((unsigned int )*(wqe_fragment_length + (unsigned long )wqe_fragment_index) != 0U) { u64temp = (unsigned long long )nic_sqe->wqe_words[((int )wqe_fragment_index + 3) * 2]; u64temp = ((unsigned long long )nic_sqe->wqe_words[(int )wqe_fragment_index * 2 + 7] << 32) + u64temp; bus_address = u64temp; tmp___0 = test_and_clear_bit((int )nesnic->sq_tail, (unsigned long volatile *)(& nesnic->first_frag_overflow)); if (tmp___0 != 0) { tmp = wqe_fragment_index; wqe_fragment_index = (u16 )((int )wqe_fragment_index + 1); pci_unmap_single(nesdev->pcidev, bus_address, (size_t )*(wqe_fragment_length + (unsigned long )tmp), 1); } else { } goto ldv_54243; ldv_54242: ; if ((unsigned int )*(wqe_fragment_length + (unsigned long )wqe_fragment_index) != 0U) { u64temp = (u64 )nic_sqe->wqe_words[((int )wqe_fragment_index + 3) * 2]; u64temp = ((unsigned long long )nic_sqe->wqe_words[(int )wqe_fragment_index * 2 + 7] << 32) + u64temp; bus_address = u64temp; pci_unmap_page(nesdev->pcidev, bus_address, (size_t )*(wqe_fragment_length + (unsigned long )wqe_fragment_index), 1); } else { goto ldv_54241; } wqe_fragment_index = (u16 )((int )wqe_fragment_index + 1); ldv_54243: ; if ((unsigned int )wqe_fragment_index <= 4U) { goto ldv_54242; } else { goto ldv_54241; } ldv_54241: ; } else { } if ((unsigned long )skb != (unsigned long )((struct sk_buff *)0)) { dev_kfree_skb_any(skb); } else { } nesnic->sq_tail = (u16 )((int )nesnic->sq_tail + 1); nesnic->sq_tail = (u16 )((int )((short )nesnic->sq_tail) & (int )((short )((unsigned int )nesnic->sq_size + 65535U))); if ((unsigned int )sq_cqes > 128U) { __asm__ volatile ("": : : "memory"); tmp___1 = netif_queue_stopped((struct net_device const *)nesvnic->netdev); if ((int )tmp___1) { netif_wake_queue(nesvnic->netdev); } else { } sq_cqes = 0U; } else { } } else { rqes_processed = (u16 )((int )rqes_processed + 1); cq->rx_cqes_completed = cq->rx_cqes_completed + 1; cq->rx_pkts_indicated = cq->rx_pkts_indicated + 1; rx_pkt_size = cqe_misc & 65535U; nic_rqe = nesnic->rq_vbase + (unsigned long )nesnic->rq_tail; rx_skb = nesnic->rx_skb[(int )nesnic->rq_tail]; nic_rqe = nesnic->rq_vbase + (unsigned long )nesvnic->nic.rq_tail; bus_address = (unsigned long long )nic_rqe->wqe_words[2]; bus_address = ((unsigned long long )nic_rqe->wqe_words[3] << 32) + bus_address; pci_unmap_single(nesdev->pcidev, bus_address, (size_t )nesvnic->max_frame_size, 2); cb = (struct nes_rskb_cb *)(& rx_skb->cb); cb->busaddr = 0ULL; rx_skb->len = 0U; skb_put(rx_skb, rx_pkt_size); rx_skb->protocol = eth_type_trans(rx_skb, nesvnic->netdev); nesnic->rq_tail = (u16 )((int )nesnic->rq_tail + 1); nesnic->rq_tail = (u16 )((int )((short )nesnic->rq_tail) & (int )((short )((unsigned int )nesnic->rq_size + 65535U))); atomic_inc(& nesvnic->rx_skbs_needed); tmp___2 = atomic_read((atomic_t const *)(& nesvnic->rx_skbs_needed)); if (tmp___2 > (int )nesvnic->nic.rq_size >> 1) { nes_write32(nesdev->regs + 68UL, (u32 )cq->cq_number | (cqe_count << 16)); nesdev->currcq_count = (int )nesdev->currcq_count + (int )((u16 )cqe_count); cqe_count = 0U; nes_replenish_nic_rq(nesvnic); } else { } pkt_type = (unsigned short )(cq->cq_vbase + (unsigned long )head)->cqe_words[2]; cqe_errv = (cqe_misc & 16711680U) >> 16; rx_skb->ip_summed = 0U; if (((int )pkt_type & 16176) == 272 || ((int )pkt_type & 16176) == 528) { if ((cqe_errv & 30U) == 0U) { if (((nesvnic->netdev)->features & 536870912ULL) != 0ULL) { rx_skb->ip_summed = 1U; } else { } } else if ((nes_debug_level & 8192U) != 0U) { printk("\viw_nes: %s[%u]: %s: unsuccessfully checksummed TCP or UDP packet. errv = 0x%X, pkt_type = 0x%X.\n", "nes_nic_ce_handler", 2957, (char *)(& (nesvnic->netdev)->name), cqe_errv, (int )pkt_type); } else { } } else if (((int )pkt_type & 16176) == 16) { if ((cqe_errv & 26U) == 0U) { if (((nesvnic->netdev)->features & 536870912ULL) != 0ULL) { rx_skb->ip_summed = 1U; } else { } } else if ((nes_debug_level & 8192U) != 0U) { printk("\viw_nes: %s[%u]: %s: unsuccessfully checksummed TCP or UDP packet. errv = 0x%X, pkt_type = 0x%X.\n", "nes_nic_ce_handler", 2971, (char *)(& (nesvnic->netdev)->name), cqe_errv, (int )pkt_type); } else { } } else { } if (((int )pkt_type & 65342) == 49426) { tmp___3 = nes_cm_recv(rx_skb, nesvnic->netdev); if (tmp___3 != 0) { rx_skb = 0; } else { } } else { } if ((unsigned long )rx_skb == (unsigned long )((struct sk_buff *)0)) { goto skip_rx_indicate0; } else { } if ((cqe_misc & 1073741824U) != 0U) { vlan_tag = (unsigned short )((cq->cq_vbase + (unsigned long )head)->cqe_words[2] >> 16); if ((nes_debug_level & 8192U) != 0U) { printk("\viw_nes: %s[%u]: %s: Reporting stripped VLAN packet. Tag = 0x%04X\n", "nes_nic_ce_handler", 2989, (char *)(& (nesvnic->netdev)->name), (int )vlan_tag); } else { } __vlan_hwaccel_put_tag(rx_skb, (int )vlan_tag); } else { } if ((unsigned int )nes_use_lro != 0U) { lro_receive_skb(& nesvnic->lro_mgr, rx_skb, 0); } else { netif_receive_skb(rx_skb); } skip_rx_indicate0: ; } (cq->cq_vbase + (unsigned long )head)->cqe_words[3] = 0U; cqe_count = cqe_count + 1U; head = head + 1U; if (head >= cq_size) { head = 0U; } else { } if (cqe_count == 255U) { nes_write32(nesdev->regs + 68UL, (u32 )cq->cq_number | (cqe_count << 16)); nesdev->currcq_count = (int )nesdev->currcq_count + (int )((u16 )cqe_count); cqe_count = 0U; } else { } if (cq->rx_cqes_completed >= nesvnic->budget) { goto ldv_54246; } else { } } else { cq->cqes_pending = 0U; goto ldv_54246; } goto ldv_54247; ldv_54246: ; if ((unsigned int )nes_use_lro != 0U) { lro_flush_all(& nesvnic->lro_mgr); } else { } if ((unsigned int )sq_cqes != 0U) { __asm__ volatile ("": : : "memory"); tmp___4 = netif_queue_stopped((struct net_device const *)nesvnic->netdev); if ((int )tmp___4) { netif_wake_queue(nesvnic->netdev); } else { } } else { } cq->cq_head = (u16 )head; cq->cqe_allocs_pending = (int )cqe_count; tmp___5 = ldv__builtin_expect((unsigned int )nesadapter->et_use_adaptive_rx_coalesce != 0U, 0L); if (tmp___5 != 0L) { nesdev->currcq_count = (int )nesdev->currcq_count + (int )((u16 )cqe_count); nes_nic_tune_timer(nesdev); } else { } tmp___6 = atomic_read((atomic_t const *)(& nesvnic->rx_skbs_needed)); if (tmp___6 != 0) { nes_replenish_nic_rq(nesvnic); } else { } return; } } static void nes_cqp_ce_handler(struct nes_device *nesdev , struct nes_hw_cq *cq ) { u64 u64temp ; unsigned long flags ; struct nes_hw_cqp *cqp ; struct nes_cqp_request *cqp_request ; struct nes_hw_cqp_wqe *cqp_wqe ; u32 head ; u32 cq_size ; u32 cqe_count ; u32 error_code ; u32 opcode ; u32 ctx_index ; raw_spinlock_t *tmp ; struct list_head const *__mptr ; u16 tmp___0 ; size_t __len ; void *__ret ; int tmp___1 ; { cqp = 0; cqe_count = 0U; head = (u32 )cq->cq_head; cq_size = (u32 )cq->cq_size; ldv_54265: opcode = (cq->cq_vbase + (unsigned long )head)->cqe_words[7]; if ((int )opcode < 0) { cqp = & nesdev->cqp; error_code = (cq->cq_vbase + (unsigned long )head)->cqe_words[6]; if (error_code != 0U) { if ((nes_debug_level & 512U) != 0U) { printk("\viw_nes: %s[%u]: Bad Completion code for opcode 0x%02X from CQP, Major/Minor codes = 0x%04X:%04X.\n", "nes_cqp_ce_handler", 3087, (cq->cq_vbase + (unsigned long )head)->cqe_words[7] & 63U, (int )((unsigned short )(error_code >> 16)), (int )((unsigned short )error_code)); } else { } } else { } u64temp = ((unsigned long long )(cq->cq_vbase + (unsigned long )head)->cqe_words[3] << 32) | (unsigned long long )(cq->cq_vbase + (unsigned long )head)->cqe_words[2]; cqp_request = (struct nes_cqp_request *)u64temp; if ((unsigned long )cqp_request != (unsigned long )((struct nes_cqp_request *)0)) { if ((unsigned int )cqp_request->waiting != 0U) { cqp_request->major_code = (unsigned short )(error_code >> 16); cqp_request->minor_code = (unsigned short )error_code; __asm__ volatile ("": : : "memory"); cqp_request->request_done = 1U; __wake_up(& cqp_request->waitq, 3U, 1, 0); nes_put_cqp_request(nesdev, cqp_request); } else { if ((unsigned int )cqp_request->callback != 0U) { (*(cqp_request->cqp_callback))(nesdev, cqp_request); } else { } nes_free_cqp_request(nesdev, cqp_request); } } else { __wake_up(& nesdev->cqp.waitq, 3U, 1, 0); } (cq->cq_vbase + (unsigned long )head)->cqe_words[7] = 0U; nes_write32(nesdev->regs + 68UL, (u32 )((int )cq->cq_number | 65536)); cqp->sq_tail = (u16 )((int )cqp->sq_tail + 1); if ((int )((unsigned short )cqp->sq_tail) >= (int )cqp->sq_size) { cqp->sq_tail = 0U; } else { } cqe_count = cqe_count + 1U; head = head + 1U; if (head >= cq_size) { head = 0U; } else { } } else { goto ldv_54264; } goto ldv_54265; ldv_54264: cq->cq_head = (u16 )head; tmp = spinlock_check(& nesdev->cqp.lock); flags = _raw_spin_lock_irqsave(tmp); goto ldv_54275; ldv_54274: __mptr = (struct list_head const *)nesdev->cqp_pending_reqs.next; cqp_request = (struct nes_cqp_request *)__mptr + 0xffffffffffffff60UL; list_del_init(& cqp_request->list); tmp___0 = nesdev->cqp.sq_head; nesdev->cqp.sq_head = (u16 )((int )nesdev->cqp.sq_head + 1); head = (u32 )tmp___0; nesdev->cqp.sq_head = (u16 )((int )((short )nesdev->cqp.sq_head) & (int )((short )((unsigned int )nesdev->cqp.sq_size + 65535U))); cqp_wqe = nesdev->cqp.sq_vbase + (unsigned long )head; __len = 64UL; if (__len > 63UL) { __ret = __memcpy((void *)cqp_wqe, (void const *)(& cqp_request->cqp_wqe), __len); } else { __ret = __builtin_memcpy((void *)cqp_wqe, (void const *)(& cqp_request->cqp_wqe), __len); } __asm__ volatile ("": : : "memory"); opcode = cqp_wqe->wqe_words[0]; if ((opcode & 63U) == 16U) { ctx_index = 1U; } else { ctx_index = 2U; } cqp_wqe->wqe_words[ctx_index] = (unsigned int )((long )cqp_request); cqp_wqe->wqe_words[ctx_index + 1U] = (unsigned int )((unsigned long )cqp_request >> 32UL); if ((nes_debug_level & 512U) != 0U) { printk("\viw_nes: %s[%u]: CQP request %p (opcode 0x%02X) put on CQPs SQ wqe%u.\n", "nes_cqp_ce_handler", 3152, cqp_request, cqp_wqe->wqe_words[0] & 63U, head); } else { } __asm__ volatile ("": : : "memory"); nes_write32(nesdev->regs + 64UL, (u32 )((int )nesdev->cqp.qp_id | 25165824)); ldv_54275: tmp___1 = list_empty((struct list_head const *)(& nesdev->cqp_pending_reqs)); if (tmp___1 == 0 && ((((int )nesdev->cqp.sq_tail + (int )nesdev->cqp.sq_size) - (int )nesdev->cqp.sq_head) & ((int )nesdev->cqp.sq_size + -1)) != 1) { goto ldv_54274; } else { goto ldv_54276; } ldv_54276: spin_unlock_irqrestore(& nesdev->cqp.lock, flags); nes_write32(nesdev->regs + 68UL, (u32 )((int )cq->cq_number | 536870912)); nes_read32((void const *)nesdev->regs + 68U); return; } } static u8 *locate_mpa(u8 *pkt , u32 aeq_info ) { { if ((aeq_info & 268435456U) != 0U) { pkt = pkt + 14UL; pkt = pkt + (unsigned long )(((int )*pkt & 15) * 4); pkt = pkt + (unsigned long )((((int )*(pkt + 12UL) >> 4) & 15) * 4); } else { } return (pkt); } } static u32 iwarp_opcode(struct nes_qp *nesqp , u32 aeq_info ) { u8 *pkt ; u16 *mpa ; u32 opcode ; u8 *tmp ; __u16 tmp___0 ; { opcode = 4294967295U; if ((aeq_info & 805306368U) != 0U) { pkt = (u8 *)nesqp->hwqp.q2_vbase + 64U; tmp = locate_mpa(pkt, aeq_info); mpa = (u16 *)tmp; tmp___0 = __fswab16((int )*(mpa + 1UL)); opcode = (u32 )tmp___0 & 15U; } else { } return (opcode); } } static int nes_bld_terminate_hdr(struct nes_qp *nesqp , u16 async_event_id , u32 aeq_info ) { u8 *pkt ; u16 ddp_seg_len ; int copy_len ; u8 is_tagged ; u8 flush_code ; struct nes_terminate_hdr *termhdr ; __u16 tmp ; u32 tmp___0 ; u32 tmp___1 ; u32 tmp___2 ; size_t __len ; void *__ret ; { pkt = (u8 *)nesqp->hwqp.q2_vbase + 64U; copy_len = 0; is_tagged = 0U; flush_code = 0U; termhdr = (struct nes_terminate_hdr *)nesqp->hwqp.q2_vbase; memset((void *)termhdr, 0, 64UL); if ((aeq_info & 805306368U) != 0U) { pkt = locate_mpa(pkt, aeq_info); tmp = __fswab16((int )*((u16 *)pkt)); ddp_seg_len = tmp; if ((unsigned int )ddp_seg_len != 0U) { copy_len = 2; termhdr->hdrct = 128U; if ((int )((signed char )*(pkt + 2UL)) < 0) { is_tagged = 1U; if ((unsigned int )ddp_seg_len > 13U) { copy_len = copy_len + 14; termhdr->hdrct = (u8 )((unsigned int )termhdr->hdrct | 64U); } else { } } else { if ((unsigned int )ddp_seg_len > 17U) { copy_len = copy_len + 18; termhdr->hdrct = (u8 )((unsigned int )termhdr->hdrct | 64U); } else { } if ((unsigned int )ddp_seg_len > 45U) { if (((int )*(pkt + 3UL) & 15) == 1) { copy_len = copy_len + 28; termhdr->hdrct = (u8 )((unsigned int )termhdr->hdrct | 32U); } else { } } else { } } } else { } } else { } switch ((int )async_event_id) { case 258: tmp___0 = iwarp_opcode(nesqp, aeq_info); switch (tmp___0) { case 0: flush_code = 4U; termhdr->layer_etype = 17U; termhdr->error_code = 0U; goto ldv_54301; default: flush_code = 10U; termhdr->layer_etype = 1U; termhdr->error_code = 0U; } ldv_54301: ; goto ldv_54303; case 259: flush_code = 10U; termhdr->layer_etype = 1U; termhdr->error_code = 0U; goto ldv_54303; case 260: flush_code = 2U; termhdr->layer_etype = 18U; termhdr->error_code = 1U; goto ldv_54303; case 262: ; case 263: tmp___1 = iwarp_opcode(nesqp, aeq_info); switch (tmp___1) { case 4: ; case 6: flush_code = 11U; termhdr->layer_etype = 2U; termhdr->error_code = 9U; goto ldv_54310; default: flush_code = 10U; termhdr->layer_etype = 1U; termhdr->error_code = 0U; } ldv_54310: ; goto ldv_54303; case 264: ; if ((aeq_info & 805306368U) != 0U) { flush_code = 4U; termhdr->layer_etype = 17U; termhdr->error_code = 1U; } else { flush_code = 10U; termhdr->layer_etype = 1U; termhdr->error_code = 1U; } goto ldv_54303; case 265: ; case 274: ; case 516: flush_code = 10U; termhdr->layer_etype = 1U; termhdr->error_code = 2U; goto ldv_54303; case 266: flush_code = 10U; termhdr->layer_etype = 1U; termhdr->error_code = 4U; goto ldv_54303; case 261: tmp___2 = iwarp_opcode(nesqp, aeq_info); switch (tmp___2) { case 0: flush_code = 4U; termhdr->layer_etype = 17U; termhdr->error_code = 2U; goto ldv_54319; case 4: ; case 6: flush_code = 10U; termhdr->layer_etype = 1U; termhdr->error_code = 9U; goto ldv_54319; default: flush_code = 10U; termhdr->layer_etype = 1U; termhdr->error_code = 3U; } ldv_54319: ; goto ldv_54303; case 1284: flush_code = 1U; termhdr->layer_etype = 35U; termhdr->error_code = 3U; goto ldv_54303; case 1285: flush_code = 21U; termhdr->layer_etype = 35U; termhdr->error_code = 2U; goto ldv_54303; case 1286: ; case 1287: flush_code = 1U; termhdr->layer_etype = 16U; termhdr->error_code = 0U; goto ldv_54303; case 1792: ; case 776: flush_code = 19U; termhdr->layer_etype = 16U; termhdr->error_code = 0U; goto ldv_54303; case 769: ; case 770: flush_code = 21U; termhdr->layer_etype = 18U; termhdr->error_code = 3U; goto ldv_54303; case 771: flush_code = 1U; termhdr->layer_etype = 18U; termhdr->error_code = 5U; goto ldv_54303; case 772: flush_code = 21U; if ((unsigned int )is_tagged != 0U) { termhdr->layer_etype = 17U; termhdr->error_code = 4U; } else { termhdr->layer_etype = 18U; termhdr->error_code = 6U; } goto ldv_54303; case 773: flush_code = 21U; termhdr->layer_etype = 18U; termhdr->error_code = 4U; goto ldv_54303; case 774: flush_code = 11U; termhdr->layer_etype = 18U; termhdr->error_code = 2U; goto ldv_54303; case 775: flush_code = 21U; termhdr->layer_etype = 18U; termhdr->error_code = 1U; goto ldv_54303; case 785: flush_code = 21U; termhdr->layer_etype = 2U; termhdr->error_code = 5U; goto ldv_54303; case 786: flush_code = 2U; termhdr->layer_etype = 2U; termhdr->error_code = 6U; goto ldv_54303; default: flush_code = 19U; termhdr->layer_etype = 2U; termhdr->error_code = 255U; goto ldv_54303; } ldv_54303: ; if (copy_len != 0) { __len = (size_t )copy_len; __ret = __builtin_memcpy((void *)termhdr + 1U, (void const *)pkt, __len); } else { } if ((unsigned int )flush_code != 0U && (aeq_info & 524288U) == 0U) { if ((aeq_info & 262144U) != 0U) { nesqp->term_sq_flush_code = (u16 )flush_code; } else { nesqp->term_rq_flush_code = (u16 )flush_code; } } else { } return ((int )((unsigned int )copy_len + 4U)); } } static void nes_terminate_connection(struct nes_device *nesdev , struct nes_qp *nesqp , struct nes_hw_aeqe *aeqe , enum ib_event_type eventtype ) { u64 context ; unsigned long flags ; u32 aeq_info ; u16 async_event_id ; u8 tcp_state ; u8 iwarp_state ; u32 termlen ; u32 mod_qp_flags ; struct nes_adapter *nesadapter ; int __ret_warn_on ; long tmp ; raw_spinlock_t *tmp___0 ; int tmp___1 ; { termlen = 0U; mod_qp_flags = 1358954496U; nesadapter = nesdev->nesadapter; if ((int )nesqp->term_flags & 1) { return; } else { } aeq_info = aeqe->aeqe_words[3]; tcp_state = (u8 )((aeq_info & 251658240U) >> 24); iwarp_state = (u8 )((aeq_info & 7340032U) >> 20); async_event_id = (unsigned short )aeq_info; context = (u64 )*(nesadapter->qp_table + (unsigned long )(aeqe->aeqe_words[2] - 64U)); if (context == 0ULL) { __ret_warn_on = context == 0ULL; tmp = ldv__builtin_expect(__ret_warn_on != 0, 0L); if (tmp != 0L) { warn_slowpath_null("/home/zakharov/workspace/benchmarks/bench_1/work/current--X--drivers/infiniband/hw/nes/iw_nes.ko--X--deg2_cpalinux-3.8-rc1--X--32_7a--X--cpachecker/linux-3.8-rc1/csd_deg_dscv/18/dscv_tempdir/dscv/ri/32_7a/drivers/infiniband/hw/nes/nes_hw.c.prepared", 3431); } else { } ldv__builtin_expect(__ret_warn_on != 0, 0L); return; } else { } nesqp = (struct nes_qp *)context; tmp___0 = spinlock_check(& nesqp->lock); flags = _raw_spin_lock_irqsave(tmp___0); nesqp->hw_iwarp_state = iwarp_state; nesqp->hw_tcp_state = tcp_state; nesqp->last_aeq = (u32 )async_event_id; nesqp->terminate_eventtype = eventtype; spin_unlock_irqrestore(& nesqp->lock, flags); if ((unsigned int )nesadapter->send_term_ok != 0U) { tmp___1 = nes_bld_terminate_hdr(nesqp, (int )async_event_id, aeq_info); termlen = (u32 )tmp___1; } else { mod_qp_flags = mod_qp_flags | 33554432U; } if ((unsigned int )nesdev->iw_status == 0U) { nesqp->term_flags = 4U; nes_hw_modify_qp(nesdev, nesqp, 1610612736U, 0U, 0U); nes_cm_disconn(nesqp); } else { nes_terminate_start_timer(nesqp); nesqp->term_flags = (u8 )((unsigned int )nesqp->term_flags | 1U); nes_hw_modify_qp(nesdev, nesqp, mod_qp_flags, termlen, 0U); } return; } } static void nes_terminate_send_fin(struct nes_device *nesdev , struct nes_qp *nesqp , struct nes_hw_aeqe *aeqe ) { u32 aeq_info ; u16 async_event_id ; u8 tcp_state ; u8 iwarp_state ; unsigned long flags ; raw_spinlock_t *tmp ; { aeq_info = aeqe->aeqe_words[3]; tcp_state = (u8 )((aeq_info & 251658240U) >> 24); iwarp_state = (u8 )((aeq_info & 7340032U) >> 20); async_event_id = (unsigned short )aeq_info; tmp = spinlock_check(& nesqp->lock); flags = _raw_spin_lock_irqsave(tmp); nesqp->hw_iwarp_state = iwarp_state; nesqp->hw_tcp_state = tcp_state; nesqp->last_aeq = (u32 )async_event_id; spin_unlock_irqrestore(& nesqp->lock, flags); nes_hw_modify_qp(nesdev, nesqp, 1375731712U, 0U, 0U); return; } } static void nes_terminate_done(struct nes_qp *nesqp , int timeout_occurred ) { u32 next_iwarp_state ; unsigned long flags ; struct nes_vnic *nesvnic ; struct nes_vnic *tmp ; struct nes_device *nesdev ; u8 first_time ; raw_spinlock_t *tmp___0 ; { next_iwarp_state = 1610612736U; tmp = to_nesvnic(nesqp->ibqp.device); nesvnic = tmp; nesdev = nesvnic->nesdev; first_time = 0U; tmp___0 = spinlock_check(& nesqp->lock); flags = _raw_spin_lock_irqsave(tmp___0); if ((unsigned int )*((unsigned char *)nesqp + 820UL) != 0U) { nesqp->hte_added = 0U; next_iwarp_state = next_iwarp_state | 16384U; } else { } first_time = ((int )nesqp->term_flags & 4) == 0; nesqp->term_flags = (u8 )((unsigned int )nesqp->term_flags | 4U); spin_unlock_irqrestore(& nesqp->lock, flags); if ((unsigned int )first_time != 0U) { if (timeout_occurred == 0) { del_timer(& nesqp->terminate_timer); } else { next_iwarp_state = next_iwarp_state | 2147483648U; } nes_hw_modify_qp(nesdev, nesqp, next_iwarp_state, 0U, 0U); nes_cm_disconn(nesqp); } else { } return; } } static void nes_terminate_received(struct nes_device *nesdev , struct nes_qp *nesqp , struct nes_hw_aeqe *aeqe ) { u32 aeq_info ; u8 *pkt ; u32 *mpa ; u8 ddp_ctl ; u8 rdma_ctl ; u16 aeq_id ; u8 *tmp ; __u32 tmp___0 ; __u32 tmp___1 ; __u32 tmp___2 ; __u32 tmp___3 ; __u32 tmp___4 ; { aeq_id = 0U; aeq_info = aeqe->aeqe_words[3]; if ((aeq_info & 805306368U) != 0U) { pkt = (u8 *)nesqp->hwqp.q2_vbase + 64U; tmp = locate_mpa(pkt, aeq_info); mpa = (u32 *)tmp; tmp___0 = __fswab32(*mpa); ddp_ctl = (u8 )(tmp___0 >> 8); tmp___1 = __fswab32(*mpa); rdma_ctl = (u8 )tmp___1; if (((int )ddp_ctl & 192) != 64) { aeq_id = 1792U; } else if (((int )ddp_ctl & 3) != 1) { aeq_id = 772U; } else { tmp___4 = __fswab32(*(mpa + 2UL)); if (tmp___4 != 2U) { aeq_id = 775U; } else { tmp___3 = __fswab32(*(mpa + 3UL)); if (tmp___3 != 1U) { aeq_id = 769U; } else { tmp___2 = __fswab32(*(mpa + 4UL)); if (tmp___2 != 0U) { aeq_id = 773U; } else if (((int )rdma_ctl & 192) != 64) { aeq_id = 785U; } else { } } } } if ((unsigned int )aeq_id != 0U) { aeq_info = (aeq_info & 4294901760U) | (u32 )aeq_id; aeqe->aeqe_words[3] = aeq_info; nes_terminate_connection(nesdev, nesqp, aeqe, 1); return; } else { } } else { } nesqp->term_flags = (u8 )((unsigned int )nesqp->term_flags | 2U); nesqp->terminate_eventtype = 1; nes_terminate_start_timer(nesqp); nes_terminate_send_fin(nesdev, nesqp, aeqe); return; } } void nes_terminate_timeout(unsigned long context ) { struct nes_qp *nesqp ; { nesqp = (struct nes_qp *)context; nes_terminate_done(nesqp, 1); return; } } static void nes_terminate_start_timer(struct nes_qp *nesqp ) { { mod_timer(& nesqp->terminate_timer, (unsigned long )jiffies + 250UL); return; } } static void nes_process_iwarp_aeqe(struct nes_device *nesdev , struct nes_hw_aeqe *aeqe ) { u64 context ; unsigned long flags ; struct nes_qp *nesqp ; struct nes_hw_cq *hw_cq ; struct nes_cq *nescq ; int resource_allocated ; struct nes_adapter *nesadapter ; u32 aeq_info ; u32 next_iwarp_state ; u32 aeqe_cq_id ; u16 async_event_id ; u8 tcp_state ; u8 iwarp_state ; struct ib_event ibevent ; long tmp ; int tmp___0 ; raw_spinlock_t *tmp___1 ; int tmp___2 ; int tmp___3 ; raw_spinlock_t *tmp___4 ; raw_spinlock_t *tmp___5 ; int tmp___6 ; raw_spinlock_t *tmp___7 ; u32 tmp___8 ; int tmp___9 ; struct nes_hw_cq const *__mptr ; { nesadapter = nesdev->nesadapter; next_iwarp_state = 0U; if ((nes_debug_level & 65536U) != 0U) { printk("\viw_nes: %s[%u]: \n", "nes_process_iwarp_aeqe", 3596); } else { } aeq_info = aeqe->aeqe_words[3]; if ((aeq_info & 524288U) != 0U || (aeq_info & 65536U) == 0U) { context = (u64 )aeqe->aeqe_words[0]; context = ((unsigned long long )aeqe->aeqe_words[1] << 32) + context; } else { context = (u64 )*(nesadapter->qp_table + (unsigned long )(aeqe->aeqe_words[2] - 64U)); tmp = ldv__builtin_expect(context == 0ULL, 0L); if (tmp != 0L) { __asm__ volatile ("1:\tud2\n.pushsection __bug_table,\"a\"\n2:\t.long 1b - 2b, %c0 - 2b\n\t.word %c1, 0\n\t.org 2b+%c2\n.popsection": : "i" ((char *)"/home/zakharov/workspace/benchmarks/bench_1/work/current--X--drivers/infiniband/hw/nes/iw_nes.ko--X--deg2_cpalinux-3.8-rc1--X--32_7a--X--cpachecker/linux-3.8-rc1/csd_deg_dscv/18/dscv_tempdir/dscv/ri/32_7a/drivers/infiniband/hw/nes/nes_hw.c.prepared"), "i" (3604), "i" (12UL)); ldv_54424: ; goto ldv_54424; } else { } } nesqp = (struct nes_qp *)context; async_event_id = (unsigned short )aeq_info; tcp_state = (u8 )((aeq_info & 251658240U) >> 24); iwarp_state = (u8 )((aeq_info & 7340032U) >> 20); if ((nes_debug_level & 65536U) != 0U) { printk("\viw_nes: %s[%u]: aeid = 0x%04X, qp-cq id = %d, aeqe = %p, Tcp state = %d, iWARP state = %d\n", "nes_process_iwarp_aeqe", 3616, (int )async_event_id, aeqe->aeqe_words[2], aeqe, (int )tcp_state, (int )iwarp_state); } else { } aeqe_cq_id = aeqe->aeqe_words[2]; if ((aeq_info & 65536U) != 0U) { tmp___0 = nes_is_resource_allocated(nesadapter, nesadapter->allocated_qps, aeqe_cq_id); if (tmp___0 == 0) { return; } else { } } else { } switch ((int )async_event_id) { case 1283: ; if ((unsigned int )nesqp->term_flags != 0U) { return; } else { } tmp___3 = atomic_add_return(1, & nesqp->close_timer_started); if (tmp___3 == 1) { if ((unsigned int )tcp_state == 6U && (unsigned int )nesqp->ibqp_state == 3U) { tmp___1 = spinlock_check(& nesqp->lock); flags = _raw_spin_lock_irqsave(tmp___1); nesqp->hw_iwarp_state = iwarp_state; nesqp->hw_tcp_state = tcp_state; nesqp->last_aeq = (u32 )async_event_id; next_iwarp_state = 805306368U; nesqp->hw_iwarp_state = 3U; spin_unlock_irqrestore(& nesqp->lock, flags); nes_hw_modify_qp(nesdev, nesqp, next_iwarp_state, 0U, 0U); nes_cm_disconn(nesqp); } else { } (*((nesqp->cm_id)->add_ref))(nesqp->cm_id); schedule_nes_timer((struct nes_cm_node *)nesqp->cm_node, (struct sk_buff *)nesqp, 3, 1, 0); if ((nes_debug_level & 65536U) != 0U) { tmp___2 = atomic_read((atomic_t const *)(& nesqp->refcount)); printk("\viw_nes: %s[%u]: QP%u Not decrementing QP refcount (%d), need ae to finish up, original_last_aeq = 0x%04X. last_aeq = 0x%04X, scheduling timer. TCP state = %d\n", "nes_process_iwarp_aeqe", 3651, nesqp->hwqp.qp_id, tmp___2, (int )async_event_id, nesqp->last_aeq, (int )tcp_state); } else { } } else { } goto ldv_54429; case 1281: tmp___4 = spinlock_check(& nesqp->lock); flags = _raw_spin_lock_irqsave(tmp___4); nesqp->hw_iwarp_state = iwarp_state; nesqp->hw_tcp_state = tcp_state; nesqp->last_aeq = (u32 )async_event_id; spin_unlock_irqrestore(& nesqp->lock, flags); nes_cm_disconn(nesqp); goto ldv_54429; case 1537: tcp_state = 1U; tmp___5 = spinlock_check(& nesqp->lock); flags = _raw_spin_lock_irqsave(tmp___5); nesqp->hw_iwarp_state = iwarp_state; nesqp->hw_tcp_state = tcp_state; nesqp->last_aeq = (u32 )async_event_id; nesqp->hte_added = 0U; spin_unlock_irqrestore(& nesqp->lock, flags); next_iwarp_state = 1610629120U; nes_hw_modify_qp(nesdev, nesqp, next_iwarp_state, 0U, 0U); nes_cm_disconn(nesqp); goto ldv_54429; case 1282: tmp___6 = atomic_read((atomic_t const *)(& nesqp->close_timer_started)); if (tmp___6 != 0) { return; } else { } tmp___7 = spinlock_check(& nesqp->lock); flags = _raw_spin_lock_irqsave(tmp___7); nesqp->hw_iwarp_state = iwarp_state; nesqp->hw_tcp_state = tcp_state; nesqp->last_aeq = (u32 )async_event_id; spin_unlock_irqrestore(& nesqp->lock, flags); nes_cm_disconn(nesqp); goto ldv_54429; case 1538: nes_terminate_send_fin(nesdev, nesqp, aeqe); goto ldv_54429; case 1289: nes_terminate_received(nesdev, nesqp, aeqe); goto ldv_54429; case 262: ; case 263: ; case 258: ; case 259: ; case 265: ; case 274: ; case 516: ; case 771: ; case 264: ; case 266: printk("\viw_nes: QP[%u] async_event_id=0x%04X IB_EVENT_QP_ACCESS_ERR\n", nesqp->hwqp.qp_id, (int )async_event_id); nes_terminate_connection(nesdev, nesqp, aeqe, 3); goto ldv_54429; case 1286: ; case 1287: ; case 773: ; case 775: tmp___8 = iwarp_opcode(nesqp, aeq_info); if (tmp___8 > 7U) { aeq_info = aeq_info & 4294901760U; aeq_info = aeq_info | 786U; aeqe->aeqe_words[3] = aeq_info; } else { } case 514: ; case 1290: ; case 774: ; case 1285: ; case 260: ; case 1284: ; case 1792: ; case 776: ; case 769: ; case 770: ; case 772: ; case 785: ; case 786: ; case 261: ; case 267: ; case 268: ; case 269: ; case 270: ; case 271: ; case 272: ; case 273: ; case 275: ; case 276: ; case 277: ; case 278: ; case 279: ; case 280: ; case 281: ; case 282: ; case 283: ; case 513: ; case 517: ; case 518: ; case 787: ; case 788: printk("\viw_nes: QP[%u] async_event_id=0x%04X IB_EVENT_QP_FATAL\n", nesqp->hwqp.qp_id, (int )async_event_id); print_ip((struct nes_cm_node *)nesqp->cm_node); tmp___9 = atomic_read((atomic_t const *)(& nesqp->close_timer_started)); if (tmp___9 == 0) { nes_terminate_connection(nesdev, nesqp, aeqe, 1); } else { } goto ldv_54429; case 515: context = context << 1; if ((nes_debug_level & 65536U) != 0U) { printk("\viw_nes: %s[%u]: Processing an NES_AEQE_AEID_CQ_OPERATION_ERROR event on CQ%u, %p\n", "nes_process_iwarp_aeqe", 3765, aeqe->aeqe_words[2], (void *)context); } else { } resource_allocated = nes_is_resource_allocated(nesadapter, nesadapter->allocated_cqs, aeqe->aeqe_words[2]); if (resource_allocated != 0) { printk("\viw_nes: %s: Processing an NES_AEQE_AEID_CQ_OPERATION_ERROR event on CQ%u\n", "nes_process_iwarp_aeqe", aeqe->aeqe_words[2]); hw_cq = (struct nes_hw_cq *)context; if ((unsigned long )hw_cq != (unsigned long )((struct nes_hw_cq *)0)) { __mptr = (struct nes_hw_cq const *)hw_cq; nescq = (struct nes_cq *)__mptr + 0xffffffffffffffd0UL; if ((unsigned long )nescq->ibcq.event_handler != (unsigned long )((void (*)(struct ib_event * , void * ))0)) { ibevent.device = nescq->ibcq.device; ibevent.event = 0; ibevent.element.cq = & nescq->ibcq; (*(nescq->ibcq.event_handler))(& ibevent, nescq->ibcq.cq_context); } else { } } else { } } else { } goto ldv_54429; default: ; if ((nes_debug_level & 65536U) != 0U) { printk("\viw_nes: %s[%u]: Processing an iWARP related AE for QP, misc = 0x%04X\n", "nes_process_iwarp_aeqe", 3786, (int )async_event_id); } else { } goto ldv_54429; } ldv_54429: ; return; } } void nes_iwarp_ce_handler(struct nes_device *nesdev , struct nes_hw_cq *hw_cq ) { struct nes_cq *nescq ; struct nes_hw_cq const *__mptr ; { __mptr = (struct nes_hw_cq const *)hw_cq; nescq = (struct nes_cq *)__mptr + 0xffffffffffffffd0UL; nes_write32(nesdev->regs + 52UL, (u32 )nescq->hw_cq.cq_number); if ((unsigned long )nescq->ibcq.comp_handler != (unsigned long )((void (*)(struct ib_cq * , void * ))0)) { (*(nescq->ibcq.comp_handler))(& nescq->ibcq, nescq->ibcq.cq_context); } else { } return; } } int nes_manage_apbvt(struct nes_vnic *nesvnic , u32 accel_local_port , u32 nic_index , u32 add_port ) { struct nes_device *nesdev ; struct nes_hw_cqp_wqe *cqp_wqe ; struct nes_cqp_request *cqp_request ; int ret ; u16 major_code ; char *tmp ; unsigned int tmp___0 ; long __ret ; wait_queue_t __wait ; struct task_struct *tmp___1 ; { nesdev = nesvnic->nesdev; ret = 0; cqp_request = nes_get_cqp_request(nesdev); if ((unsigned long )cqp_request == (unsigned long )((struct nes_cqp_request *)0)) { if ((nes_debug_level & 16384U) != 0U) { printk("\viw_nes: %s[%u]: Failed to get a cqp_request.\n", "nes_manage_apbvt", 3825); } else { } return (-12); } else { } cqp_request->waiting = 1U; cqp_wqe = & cqp_request->cqp_wqe; if ((nes_debug_level & 16384U) != 0U) { if (add_port == 1U) { tmp = (char *)"ADD"; } else { tmp = (char *)"DEL"; } printk("\viw_nes: %s[%u]: %s APBV for local port=%u(0x%04x), nic_index=%u\n", "nes_manage_apbvt", 3833, tmp, accel_local_port, accel_local_port, nic_index); } else { } nes_fill_init_cqp_wqe(cqp_wqe, nesdev); if (add_port == 1U) { tmp___0 = 32803U; } else { tmp___0 = 35U; } set_wqe_32bit_value((__le32 *)(& cqp_wqe->wqe_words), 0U, tmp___0); set_wqe_32bit_value((__le32 *)(& cqp_wqe->wqe_words), 1U, (nic_index << 16) | accel_local_port); if ((nes_debug_level & 16384U) != 0U) { printk("\viw_nes: %s[%u]: Waiting for CQP completion for APBVT.\n", "nes_manage_apbvt", 3841); } else { } atomic_set(& cqp_request->refcount, 2); nes_post_cqp_request(nesdev, cqp_request); if (add_port == 1U) { __ret = 1200000L; if ((unsigned int )cqp_request->request_done == 0U) { tmp___1 = get_current(); __wait.flags = 0U; __wait.private = (void *)tmp___1; __wait.func = & autoremove_wake_function; __wait.task_list.next = & __wait.task_list; __wait.task_list.prev = & __wait.task_list; ldv_54519: prepare_to_wait(& cqp_request->waitq, & __wait, 2); if ((unsigned int )cqp_request->request_done != 0U) { goto ldv_54518; } else { } __ret = schedule_timeout(__ret); if (__ret == 0L) { goto ldv_54518; } else { } goto ldv_54519; ldv_54518: finish_wait(& cqp_request->waitq, & __wait); } else { } ret = (int )__ret; } else { } if ((nes_debug_level & 16384U) != 0U) { printk("\viw_nes: %s[%u]: Completed, ret=%u, CQP Major:Minor codes = 0x%04X:0x%04X\n", "nes_manage_apbvt", 3850, ret, (int )cqp_request->major_code, (int )cqp_request->minor_code); } else { } major_code = cqp_request->major_code; nes_put_cqp_request(nesdev, cqp_request); if (ret == 0) { return (-62); } else if ((unsigned int )major_code != 0U) { return (-5); } else { return (0); } } } void nes_manage_arp_cache(struct net_device *netdev , unsigned char *mac_addr , u32 ip_addr , u32 action ) { struct nes_hw_cqp_wqe *cqp_wqe ; struct nes_vnic *nesvnic ; void *tmp ; struct nes_device *nesdev ; struct nes_cqp_request *cqp_request ; int arp_index ; { tmp = netdev_priv((struct net_device const *)netdev); nesvnic = (struct nes_vnic *)tmp; nesdev = nesvnic->nesdev; arp_index = nes_arp_table(nesdev, ip_addr, mac_addr, action); if (arp_index == -1) { return; } else { } cqp_request = nes_get_cqp_request(nesdev); if ((unsigned long )cqp_request == (unsigned long )((struct nes_cqp_request *)0)) { if ((nes_debug_level & 16U) != 0U) { printk("\viw_nes: %s[%u]: Failed to get a cqp_request.\n", "nes_manage_arp_cache", 3885); } else { } return; } else { } cqp_request->waiting = 0U; cqp_wqe = & cqp_request->cqp_wqe; nes_fill_init_cqp_wqe(cqp_wqe, nesdev); cqp_wqe->wqe_words[0] = 527U; cqp_wqe->wqe_words[0] = cqp_wqe->wqe_words[0] | (((nesdev->pcidev)->devfn & 7U) << 16); cqp_wqe->wqe_words[1] = (unsigned int )arp_index; if (action == 1U) { cqp_wqe->wqe_words[0] = cqp_wqe->wqe_words[0] | 256U; cqp_wqe->wqe_words[6] = ((((unsigned int )*(mac_addr + 2UL) << 24) | ((unsigned int )*(mac_addr + 3UL) << 16)) | ((unsigned int )*(mac_addr + 4UL) << 8)) | (unsigned int )*(mac_addr + 5UL); cqp_wqe->wqe_words[7] = ((unsigned int )*mac_addr << 16) | (unsigned int )*(mac_addr + 1UL); } else { cqp_wqe->wqe_words[6] = 0U; cqp_wqe->wqe_words[7] = 0U; } if ((nes_debug_level & 16U) != 0U) { printk("\viw_nes: %s[%u]: Not waiting for CQP, cqp.sq_head=%u, cqp.sq_tail=%u\n", "nes_manage_arp_cache", 3911, (int )nesdev->cqp.sq_head, (int )nesdev->cqp.sq_tail); } else { } atomic_set(& cqp_request->refcount, 1); nes_post_cqp_request(nesdev, cqp_request); return; } } void flush_wqes(struct nes_device *nesdev , struct nes_qp *nesqp , u32 which_wq , u32 wait_completion ) { struct nes_cqp_request *cqp_request ; struct nes_hw_cqp_wqe *cqp_wqe ; u32 sq_code ; u32 rq_code ; int ret ; long __ret ; wait_queue_t __wait ; struct task_struct *tmp ; { sq_code = 65537U; rq_code = 65537U; cqp_request = nes_get_cqp_request(nesdev); if ((unsigned long )cqp_request == (unsigned long )((struct nes_cqp_request *)0)) { if ((nes_debug_level & 16384U) != 0U) { printk("\viw_nes: %s[%u]: Failed to get a cqp_request.\n", "flush_wqes", 3932); } else { } return; } else { } if (wait_completion != 0U) { cqp_request->waiting = 1U; atomic_set(& cqp_request->refcount, 2); } else { cqp_request->waiting = 0U; } cqp_wqe = & cqp_request->cqp_wqe; nes_fill_init_cqp_wqe(cqp_wqe, nesdev); if ((unsigned int )nesqp->term_sq_flush_code != 0U && (which_wq & 1073741824U) != 0U) { which_wq = which_wq | 268435456U; sq_code = (u32 )((int )nesqp->term_sq_flush_code | (-0x7FFFFFFF-1)); nesqp->term_sq_flush_code = 0U; } else { } if ((unsigned int )nesqp->term_rq_flush_code != 0U && (int )which_wq < 0) { which_wq = which_wq | 268435456U; rq_code = (u32 )((int )nesqp->term_rq_flush_code | (-0x7FFFFFFF-1)); nesqp->term_rq_flush_code = 0U; } else { } if ((which_wq & 268435456U) != 0U) { cqp_wqe->wqe_words[8] = sq_code; cqp_wqe->wqe_words[9] = rq_code; } else { } cqp_wqe->wqe_words[0] = which_wq | 34U; cqp_wqe->wqe_words[1] = nesqp->hwqp.qp_id; nes_post_cqp_request(nesdev, cqp_request); if (wait_completion != 0U) { __ret = 1200000L; if ((unsigned int )cqp_request->request_done == 0U) { tmp = get_current(); __wait.flags = 0U; __wait.private = (void *)tmp; __wait.func = & autoremove_wake_function; __wait.task_list.next = & __wait.task_list; __wait.task_list.prev = & __wait.task_list; ldv_54548: prepare_to_wait(& cqp_request->waitq, & __wait, 2); if ((unsigned int )cqp_request->request_done != 0U) { goto ldv_54547; } else { } __ret = schedule_timeout(__ret); if (__ret == 0L) { goto ldv_54547; } else { } goto ldv_54548; ldv_54547: finish_wait(& cqp_request->waitq, & __wait); } else { } ret = (int )__ret; if ((nes_debug_level & 16384U) != 0U) { printk("\viw_nes: %s[%u]: Flush SQ QP WQEs completed, ret=%u, CQP Major:Minor codes = 0x%04X:0x%04X\n", "flush_wqes", 3974, ret, (int )cqp_request->major_code, (int )cqp_request->minor_code); } else { } nes_put_cqp_request(nesdev, cqp_request); } else { } return; } } void ldv_mutex_lock_21(struct mutex *ldv_func_arg1 ) { { ldv_mutex_lock_lock(ldv_func_arg1); mutex_lock(ldv_func_arg1); return; } } void ldv_mutex_unlock_22(struct mutex *ldv_func_arg1 ) { { ldv_mutex_unlock_lock(ldv_func_arg1); mutex_unlock(ldv_func_arg1); return; } } void ldv_mutex_lock_23(struct mutex *ldv_func_arg1 ) { { ldv_mutex_lock_mutex_of_device(ldv_func_arg1); mutex_lock(ldv_func_arg1); return; } } int ldv_mutex_trylock_24(struct mutex *ldv_func_arg1 ) { ldv_func_ret_type___2 ldv_func_res ; int tmp ; int tmp___0 ; { tmp = mutex_trylock(ldv_func_arg1); ldv_func_res = tmp; tmp___0 = ldv_mutex_trylock_mutex_of_device(ldv_func_arg1); return (tmp___0); return (ldv_func_res); } } void ldv_mutex_unlock_25(struct mutex *ldv_func_arg1 ) { { ldv_mutex_unlock_mutex_of_device(ldv_func_arg1); mutex_unlock(ldv_func_arg1); return; } } void ldv_mutex_lock_26(struct mutex *ldv_func_arg1 ) { { ldv_mutex_lock_cred_guard_mutex_of_signal_struct(ldv_func_arg1); mutex_lock(ldv_func_arg1); return; } } void ldv_mutex_unlock_27(struct mutex *ldv_func_arg1 ) { { ldv_mutex_unlock_cred_guard_mutex_of_signal_struct(ldv_func_arg1); mutex_unlock(ldv_func_arg1); return; } } extern int sprintf(char * , char const * , ...) ; extern char *strcpy(char * , char const * ) ; int ldv_mutex_trylock_38(struct mutex *ldv_func_arg1 ) ; void ldv_mutex_unlock_36(struct mutex *ldv_func_arg1 ) ; void ldv_mutex_unlock_39(struct mutex *ldv_func_arg1 ) ; void ldv_mutex_unlock_41(struct mutex *ldv_func_arg1 ) ; void ldv_mutex_lock_35(struct mutex *ldv_func_arg1 ) ; void ldv_mutex_lock_37(struct mutex *ldv_func_arg1 ) ; void ldv_mutex_lock_40(struct mutex *ldv_func_arg1 ) ; extern int del_timer_sync(struct timer_list * ) ; __inline static void *lowmem_page_address(struct page const *page ) { { return ((void *)((unsigned long )((unsigned long long )(((long )page + 24189255811072L) / 80L) << 12) + 0xffff880000000000UL)); } } __inline static dma_addr_t dma_map_page(struct device *dev , struct page *page , size_t offset , size_t size , enum dma_data_direction dir ) { struct dma_map_ops *ops ; struct dma_map_ops *tmp ; dma_addr_t addr ; void *tmp___0 ; int tmp___1 ; long tmp___2 ; { tmp = get_dma_ops(dev); ops = tmp; tmp___0 = lowmem_page_address((struct page const *)page); kmemcheck_mark_initialized(tmp___0 + offset, (unsigned int )size); tmp___1 = valid_dma_direction((int )dir); tmp___2 = ldv__builtin_expect(tmp___1 == 0, 0L); if (tmp___2 != 0L) { __asm__ volatile ("1:\tud2\n.pushsection __bug_table,\"a\"\n2:\t.long 1b - 2b, %c0 - 2b\n\t.word %c1, 0\n\t.org 2b+%c2\n.popsection": : "i" ((char *)"include/asm-generic/dma-mapping-common.h"), "i" (79), "i" (12UL)); ldv_27897: ; goto ldv_27897; } else { } addr = (*(ops->map_page))(dev, page, offset, size, dir, 0); debug_dma_map_page(dev, page, offset, size, (int )dir, addr, 0); return (addr); } } __inline static unsigned int skb_frag_size(skb_frag_t const *frag ) { { return ((unsigned int )frag->size); } } extern void kfree_skb(struct sk_buff * ) ; __inline static unsigned char *skb_end_pointer(struct sk_buff const *skb ) { { return ((unsigned char *)skb->head + (unsigned long )skb->end); } } __inline static bool skb_is_nonlinear(struct sk_buff const *skb ) { { return ((unsigned int )skb->data_len != 0U); } } __inline static unsigned int skb_headlen(struct sk_buff const *skb ) { { return ((unsigned int )skb->len - (unsigned int )skb->data_len); } } extern unsigned char *__pskb_pull_tail(struct sk_buff * , int ) ; __inline static void skb_set_network_header(struct sk_buff *skb , int const offset ) { { skb_reset_network_header(skb); skb->network_header = skb->network_header + (sk_buff_data_t )offset; return; } } __inline static struct page *skb_frag_page(skb_frag_t const *frag ) { { return ((struct page *)frag->page.p); } } __inline static dma_addr_t skb_frag_dma_map(struct device *dev , skb_frag_t const *frag , size_t offset , size_t size , enum dma_data_direction dir ) { struct page *tmp ; dma_addr_t tmp___0 ; { tmp = skb_frag_page(frag); tmp___0 = dma_map_page(dev, tmp, (size_t )frag->page_offset + offset, size, dir); return (tmp___0); } } __inline static int __skb_linearize(struct sk_buff *skb ) { int tmp___0 ; unsigned char *tmp___1 ; { tmp___1 = __pskb_pull_tail(skb, (int )skb->data_len); if ((unsigned long )tmp___1 != (unsigned long )((unsigned char *)0)) { tmp___0 = 0; } else { tmp___0 = -12; } return (tmp___0); } } __inline static int skb_linearize(struct sk_buff *skb ) { int tmp___0 ; int tmp___1 ; bool tmp___2 ; { tmp___2 = skb_is_nonlinear((struct sk_buff const *)skb); if ((int )tmp___2) { tmp___0 = __skb_linearize(skb); tmp___1 = tmp___0; } else { tmp___1 = 0; } return (tmp___1); } } __inline static bool skb_is_gso(struct sk_buff const *skb ) { unsigned char *tmp ; { tmp = skb_end_pointer(skb); return ((unsigned int )((struct skb_shared_info *)tmp)->gso_size != 0U); } } __inline static void ethtool_cmd_speed_set(struct ethtool_cmd *ep , __u32 speed ) { { ep->speed = (unsigned short )speed; ep->speed_hi = (unsigned short )(speed >> 16); return; } } extern u32 ethtool_op_get_link(struct net_device * ) ; extern void napi_complete(struct napi_struct * ) ; __inline static void napi_disable(struct napi_struct *n ) { int tmp ; { set_bit(1U, (unsigned long volatile *)(& n->state)); goto ldv_36172; ldv_36171: msleep(1U); ldv_36172: tmp = test_and_set_bit(0, (unsigned long volatile *)(& n->state)); if (tmp != 0) { goto ldv_36171; } else { goto ldv_36173; } ldv_36173: clear_bit(1, (unsigned long volatile *)(& n->state)); return; } } __inline static void napi_enable(struct napi_struct *n ) { int tmp ; long tmp___0 ; { tmp = constant_test_bit(0U, (unsigned long const volatile *)(& n->state)); tmp___0 = ldv__builtin_expect(tmp == 0, 0L); if (tmp___0 != 0L) { __asm__ volatile ("1:\tud2\n.pushsection __bug_table,\"a\"\n2:\t.long 1b - 2b, %c0 - 2b\n\t.word %c1, 0\n\t.org 2b+%c2\n.popsection": : "i" ((char *)"include/linux/netdevice.h"), "i" (468), "i" (12UL)); ldv_36177: ; goto ldv_36177; } else { } __asm__ volatile ("": : : "memory"); clear_bit(0, (unsigned long volatile *)(& n->state)); return; } } extern void netif_napi_add(struct net_device * , struct napi_struct * , int (*)(struct napi_struct * , int ) , int ) ; extern int dev_queue_xmit(struct sk_buff * ) ; extern void free_netdev(struct net_device * ) ; void ldv_free_netdev_42(struct net_device *dev ) ; __inline static bool netif_running(struct net_device const *dev ) { int tmp ; { tmp = constant_test_bit(0U, (unsigned long const volatile *)(& dev->state)); return (tmp != 0); } } __inline static bool netif_carrier_ok(struct net_device const *dev ) { int tmp ; { tmp = constant_test_bit(2U, (unsigned long const volatile *)(& dev->state)); return (tmp == 0); } } __inline static u32 netif_msg_init(int debug_value , int default_msg_enable_bits ) { { if (debug_value < 0 || (unsigned int )debug_value > 31U) { return ((u32 )default_msg_enable_bits); } else { } if (debug_value == 0) { return (0U); } else { } return ((u32 )((1 << debug_value) + -1)); } } extern int eth_validate_addr(struct net_device * ) ; extern struct net_device *alloc_etherdev_mqs(int , unsigned int , unsigned int ) ; __inline static bool is_zero_ether_addr(u8 const *addr ) { { return ((unsigned int )((((((int )((unsigned char )*addr) | (int )((unsigned char )*(addr + 1UL))) | (int )((unsigned char )*(addr + 2UL))) | (int )((unsigned char )*(addr + 3UL))) | (int )((unsigned char )*(addr + 4UL))) | (int )((unsigned char )*(addr + 5UL))) == 0U); } } __inline static bool is_multicast_ether_addr(u8 const *addr ) { { return (((int )*addr & 1) != 0); } } __inline static bool is_valid_ether_addr(u8 const *addr ) { bool tmp ; int tmp___0 ; bool tmp___1 ; int tmp___2 ; int tmp___3 ; { tmp = is_multicast_ether_addr(addr); if (tmp) { tmp___0 = 0; } else { tmp___0 = 1; } if (tmp___0) { tmp___1 = is_zero_ether_addr(addr); if (tmp___1) { tmp___2 = 0; } else { tmp___2 = 1; } if (tmp___2) { tmp___3 = 1; } else { tmp___3 = 0; } } else { tmp___3 = 0; } return ((bool )tmp___3); } } atomic_t cm_connects ; atomic_t cm_accepts ; atomic_t cm_disconnects ; atomic_t cm_closes ; atomic_t cm_connecteds ; atomic_t cm_connect_reqs ; atomic_t cm_rejects ; atomic_t mod_qp_timouts ; atomic_t qps_created ; atomic_t sw_qps_destroyed ; u32 mh_pauses_sent ; u32 cm_packets_sent ; u32 cm_packets_bounced ; u32 cm_packets_created ; u32 cm_packets_received ; u32 cm_packets_dropped ; u32 cm_packets_retrans ; atomic_t cm_listens_created ; atomic_t cm_listens_destroyed ; u32 cm_backlog_drops ; atomic_t cm_loopbacks ; atomic_t cm_nodes_created ; atomic_t cm_nodes_destroyed ; atomic_t cm_accel_dropped_pkts ; atomic_t cm_resets_recvd ; atomic_t pau_qps_created ; atomic_t pau_qps_destroyed ; int nes_nic_cm_xmit(struct sk_buff *skb , struct net_device *netdev ) ; struct nes_ib_device *nes_init_ofa_device(struct net_device *netdev ) ; void nes_destroy_ofa_device(struct nes_ib_device *nesibdev ) ; int nes_register_ofa_device(struct nes_ib_device *nesibdev ) ; static struct nic_qp_map nic_qp_mapping_0[16U] = { {16U, 0U, 0U, 1U}, {24U, 4U, 0U, 0U}, {28U, 8U, 0U, 0U}, {32U, 12U, 0U, 0U}, {20U, 2U, 2U, 1U}, {26U, 6U, 2U, 0U}, {30U, 10U, 2U, 0U}, {34U, 14U, 2U, 0U}, {18U, 1U, 1U, 1U}, {25U, 5U, 1U, 0U}, {29U, 9U, 1U, 0U}, {33U, 13U, 1U, 0U}, {22U, 3U, 3U, 1U}, {27U, 7U, 3U, 0U}, {31U, 11U, 3U, 0U}, {35U, 15U, 3U, 0U}}; static struct nic_qp_map nic_qp_mapping_1[8U] = { {18U, 1U, 1U, 1U}, {25U, 5U, 1U, 0U}, {29U, 9U, 1U, 0U}, {33U, 13U, 1U, 0U}, {22U, 3U, 3U, 1U}, {27U, 7U, 3U, 0U}, {31U, 11U, 3U, 0U}, {35U, 15U, 3U, 0U}}; static struct nic_qp_map nic_qp_mapping_2[4U] = { {20U, 2U, 2U, 1U}, {26U, 6U, 2U, 0U}, {30U, 10U, 2U, 0U}, {34U, 14U, 2U, 0U}}; static struct nic_qp_map nic_qp_mapping_3[4U] = { {22U, 3U, 3U, 1U}, {27U, 7U, 3U, 0U}, {31U, 11U, 3U, 0U}, {35U, 15U, 3U, 0U}}; static struct nic_qp_map nic_qp_mapping_4[2U] = { {28U, 8U, 0U, 0U}, {32U, 12U, 0U, 0U}}; static struct nic_qp_map nic_qp_mapping_5[2U] = { {29U, 9U, 1U, 0U}, {33U, 13U, 1U, 0U}}; static struct nic_qp_map nic_qp_mapping_6[2U] = { {30U, 10U, 2U, 0U}, {34U, 14U, 2U, 0U}}; static struct nic_qp_map nic_qp_mapping_7[2U] = { {31U, 11U, 3U, 0U}, {35U, 15U, 3U, 0U}}; static struct nic_qp_map *nic_qp_mapping_per_function[8U] = { (struct nic_qp_map *)(& nic_qp_mapping_0), (struct nic_qp_map *)(& nic_qp_mapping_1), (struct nic_qp_map *)(& nic_qp_mapping_2), (struct nic_qp_map *)(& nic_qp_mapping_3), (struct nic_qp_map *)(& nic_qp_mapping_4), (struct nic_qp_map *)(& nic_qp_mapping_5), (struct nic_qp_map *)(& nic_qp_mapping_6), (struct nic_qp_map *)(& nic_qp_mapping_7)}; static unsigned int const default_msg = 55U; static int debug = -1; static int nics_per_function = 1; static int nes_netdev_poll(struct napi_struct *napi , int budget ) { struct nes_vnic *nesvnic ; struct napi_struct const *__mptr ; struct nes_device *nesdev ; struct nes_hw_nic_cq *nescq ; { __mptr = (struct napi_struct const *)napi; nesvnic = (struct nes_vnic *)__mptr + 0xffffffffffffff78UL; nesdev = nesvnic->nesdev; nescq = & nesvnic->nic_cq; nesvnic->budget = budget; nescq->cqes_pending = 0U; nescq->rx_cqes_completed = 0; nescq->cqe_allocs_pending = 0; nescq->rx_pkts_indicated = 0; nes_nic_ce_handler(nesdev, nescq); if ((unsigned int )nescq->cqes_pending == 0U) { napi_complete(napi); nes_write32(nesdev->regs + 68UL, (u32 )(((int )nescq->cq_number | 536870912) | (nescq->cqe_allocs_pending << 16))); nes_read32((void const *)nesdev->regs + 68U); } else { nes_write32(nesdev->regs + 68UL, (u32 )((int )nescq->cq_number | (nescq->cqe_allocs_pending << 16))); if ((nes_debug_level & 16U) != 0U) { printk("\viw_nes: %s[%u]: %s: exiting with work pending\n", "nes_netdev_poll", 166, (char *)(& (nesvnic->netdev)->name)); } else { } } return (nescq->rx_pkts_indicated); } } static int nes_netdev_open(struct net_device *netdev ) { u32 macaddr_low ; u16 macaddr_high ; struct nes_vnic *nesvnic ; void *tmp ; struct nes_device *nesdev ; int ret ; int i ; struct nes_vnic *first_nesvnic ; u32 nic_active_bit ; u32 nic_active ; struct list_head *list_pos ; struct list_head *list_temp ; unsigned long flags ; struct list_head const *__mptr ; raw_spinlock_t *tmp___0 ; unsigned long tmp___1 ; raw_spinlock_t *tmp___2 ; { tmp = netdev_priv((struct net_device const *)netdev); nesvnic = (struct nes_vnic *)tmp; nesdev = nesvnic->nesdev; first_nesvnic = 0; if ((unsigned long )nesdev == (unsigned long )((struct nes_device *)0)) { printk("\viw_nes: Assertion failed! %s, %s, %s, line %d\n", (char *)"nesdev != NULL", (char *)"/home/zakharov/workspace/benchmarks/bench_1/work/current--X--drivers/infiniband/hw/nes/iw_nes.ko--X--deg2_cpalinux-3.8-rc1--X--32_7a--X--cpachecker/linux-3.8-rc1/csd_deg_dscv/18/dscv_tempdir/dscv/ri/32_7a/drivers/infiniband/hw/nes/nes_nic.c.prepared", "nes_netdev_open", 190); } else { } if ((unsigned int )nesvnic->netdev_open == 1U) { return (0); } else { } if ((nesvnic->msg_enable & 32U) != 0U) { printk("\016iw_nes: %s: enabling interface\n", (char *)(& netdev->name)); } else { } ret = nes_init_nic_qp(nesdev, netdev); if (ret != 0) { return (ret); } else { } netif_carrier_off(netdev); netif_stop_queue(netdev); if ((unsigned int )nesvnic->of_device_registered == 0U && (unsigned int )nesvnic->rdma_enabled != 0U) { nesvnic->nesibdev = nes_init_ofa_device(netdev); if ((unsigned long )nesvnic->nesibdev == (unsigned long )((struct nes_ib_device *)0)) { printk("\viw_nes: %s: nesvnic->nesibdev alloc failed", (char *)(& netdev->name)); } else { (nesvnic->nesibdev)->nesvnic = nesvnic; ret = nes_register_ofa_device(nesvnic->nesibdev); if (ret != 0) { printk("\viw_nes: %s: Unable to register RDMA device, ret = %d\n", (char *)(& netdev->name), ret); } else { } } } else { } nic_active_bit = (u32 )(1 << (int )nesvnic->nic_index); nic_active = nes_read_indexed(nesdev, 24592U); nic_active = nic_active | nic_active_bit; nes_write_indexed(nesdev, 24592U, nic_active); nic_active = nes_read_indexed(nesdev, 24616U); nic_active = nic_active | nic_active_bit; nes_write_indexed(nesdev, 24616U, nic_active); nic_active = nes_read_indexed(nesdev, 24624U); nic_active = nic_active | nic_active_bit; nes_write_indexed(nesdev, 24624U, nic_active); macaddr_high = (int )((u16 )*(netdev->dev_addr)) << 8U; macaddr_high = (int )((u16 )*(netdev->dev_addr + 1UL)) + (int )macaddr_high; macaddr_low = (unsigned int )*(netdev->dev_addr + 2UL) << 24; macaddr_low = ((unsigned int )*(netdev->dev_addr + 3UL) << 16) + macaddr_low; macaddr_low = ((unsigned int )*(netdev->dev_addr + 4UL) << 8) + macaddr_low; macaddr_low = (u32 )*(netdev->dev_addr + 5UL) + macaddr_low; i = 0; goto ldv_53646; ldv_53645: ; if ((unsigned int )nesvnic->qp_nic_index[i] == 15U) { goto ldv_53644; } else { } if ((nes_debug_level & 16U) != 0U) { printk("\viw_nes: %s[%u]: i=%d, perfect filter table index= %d, PERF FILTER LOW (Addr:%08X) = %08X, HIGH = %08X.\n", "nes_netdev_open", 251, i, (int )nesvnic->qp_nic_index[i], ((int )nesvnic->qp_nic_index[i] + 3136) * 8, macaddr_low, ((unsigned int )macaddr_high | ((unsigned int )nesvnic->nic_index << 16)) | 1048576U); } else { } nes_write_indexed(nesdev, (u32 )(((int )nesvnic->qp_nic_index[i] + 3136) * 8), macaddr_low); nes_write_indexed(nesdev, (u32 )((int )nesvnic->qp_nic_index[i] * 8 + 25092), ((unsigned int )macaddr_high | ((unsigned int )nesvnic->nic_index << 16)) | 1048576U); i = i + 1; ldv_53646: ; if (i <= 3) { goto ldv_53645; } else { goto ldv_53644; } ldv_53644: nes_write32(nesdev->regs + 68UL, (u32 )((int )nesvnic->nic_cq.cq_number | 536870912)); nes_read32((void const *)nesdev->regs + 68U); list_pos = ((struct list_head *)(& (nesdev->nesadapter)->nesvnic_list) + (unsigned long )nesdev->mac_index)->next; list_temp = list_pos->next; goto ldv_53651; ldv_53650: __mptr = (struct list_head const *)list_pos; first_nesvnic = (struct nes_vnic *)__mptr + 0xffffffffffffcc28UL; if ((unsigned int )first_nesvnic->netdev_open == 1U) { goto ldv_53649; } else { } list_pos = list_temp; list_temp = list_pos->next; ldv_53651: ; if ((unsigned long )((struct list_head *)(& (nesdev->nesadapter)->nesvnic_list) + (unsigned long )nesdev->mac_index) != (unsigned long )list_pos) { goto ldv_53650; } else { goto ldv_53649; } ldv_53649: ; if ((unsigned int )first_nesvnic->netdev_open == 0U) { if ((nes_debug_level & 2U) != 0U) { printk("\viw_nes: %s[%u]: Setting up MAC interrupt mask.\n", "nes_netdev_open", 271); } else { } nes_write_indexed(nesdev, nesdev->mac_index * 512U + 8692U, 4294967097U); first_nesvnic = nesvnic; } else { } if ((unsigned int )first_nesvnic->linkup != 0U) { nesvnic->linkup = 1U; netif_start_queue(netdev); netif_carrier_on(netdev); } else { } tmp___0 = spinlock_check(& (nesdev->nesadapter)->phy_lock); flags = _raw_spin_lock_irqsave(tmp___0); if ((unsigned int )(nesdev->nesadapter)->phy_type[nesdev->mac_index] == 8U) { nesdev->link_recheck = 1U; tmp___1 = msecs_to_jiffies(50U); mod_delayed_work(system_wq, & nesdev->work, tmp___1); } else { } spin_unlock_irqrestore(& (nesdev->nesadapter)->phy_lock, flags); tmp___2 = spinlock_check(& nesvnic->port_ibevent_lock); flags = _raw_spin_lock_irqsave(tmp___2); if ((unsigned int )nesvnic->of_device_registered != 0U) { (nesdev->nesadapter)->send_term_ok = 1U; if ((unsigned int )nesvnic->linkup == 1U) { if ((unsigned int )nesdev->iw_status == 0U) { nesdev->iw_status = 1U; nes_port_ibevent(nesvnic); } else { } } else { nesdev->iw_status = 0U; } } else { } spin_unlock_irqrestore(& nesvnic->port_ibevent_lock, flags); napi_enable(& nesvnic->napi); nesvnic->netdev_open = 1U; return (0); } } static int nes_netdev_stop(struct net_device *netdev ) { struct nes_vnic *nesvnic ; void *tmp ; struct nes_device *nesdev ; u32 nic_active_mask ; u32 nic_active ; struct nes_vnic *first_nesvnic ; struct list_head *list_pos ; struct list_head *list_temp ; unsigned long flags ; struct list_head const *__mptr ; raw_spinlock_t *tmp___0 ; { tmp = netdev_priv((struct net_device const *)netdev); nesvnic = (struct nes_vnic *)tmp; nesdev = nesvnic->nesdev; first_nesvnic = 0; if ((nes_debug_level & 524288U) != 0U) { printk("\viw_nes: %s[%u]: nesvnic=%p, nesdev=%p, netdev=%p %s\n", "nes_netdev_stop", 328, nesvnic, nesdev, netdev, (char *)(& netdev->name)); } else { } if ((unsigned int )nesvnic->netdev_open == 0U) { return (0); } else { } if ((nesvnic->msg_enable & 16U) != 0U) { printk("\016iw_nes: %s: disabling interface\n", (char *)(& netdev->name)); } else { } netif_carrier_off(netdev); napi_disable(& nesvnic->napi); netif_stop_queue(netdev); list_pos = ((struct list_head *)(& (nesdev->nesadapter)->nesvnic_list) + (unsigned long )nesdev->mac_index)->next; list_temp = list_pos->next; goto ldv_53674; ldv_53673: __mptr = (struct list_head const *)list_pos; first_nesvnic = (struct nes_vnic *)__mptr + 0xffffffffffffcc28UL; if ((unsigned int )first_nesvnic->netdev_open == 1U && (unsigned long )first_nesvnic != (unsigned long )nesvnic) { goto ldv_53672; } else { } list_pos = list_temp; list_temp = list_pos->next; ldv_53674: ; if ((unsigned long )((struct list_head *)(& (nesdev->nesadapter)->nesvnic_list) + (unsigned long )nesdev->mac_index) != (unsigned long )list_pos) { goto ldv_53673; } else { goto ldv_53672; } ldv_53672: ; if (((unsigned int )first_nesvnic->netdev_open == 1U && (unsigned long )first_nesvnic != (unsigned long )nesvnic) && ((((first_nesvnic->nesdev)->pcidev)->devfn ^ ((nesvnic->nesdev)->pcidev)->devfn) & 7U) != 0U) { nes_write_indexed(nesdev, nesdev->mac_index * 512U + 8692U, 4294967295U); nes_write_indexed(first_nesvnic->nesdev, (first_nesvnic->nesdev)->mac_index * 512U + 8692U, 4294967097U); } else { nes_write_indexed(nesdev, nesdev->mac_index * 512U + 8692U, 4294967295U); } nic_active_mask = ~ ((unsigned int )(1 << (int )nesvnic->nic_index)); nes_write_indexed(nesdev, (u32 )((int )nesvnic->perfect_filter_index * 8 + 25092), 0U); nic_active = nes_read_indexed(nesdev, 24592U); nic_active = nic_active & nic_active_mask; nes_write_indexed(nesdev, 24592U, nic_active); nic_active = nes_read_indexed(nesdev, 24608U); nic_active = nic_active & nic_active_mask; nes_write_indexed(nesdev, 24608U, nic_active); nic_active = nes_read_indexed(nesdev, 24616U); nic_active = nic_active & nic_active_mask; nes_write_indexed(nesdev, 24616U, nic_active); nic_active = nes_read_indexed(nesdev, 24600U); nic_active = nic_active & nic_active_mask; nes_write_indexed(nesdev, 24600U, nic_active); nic_active = nes_read_indexed(nesdev, 24624U); nic_active = nic_active & nic_active_mask; nes_write_indexed(nesdev, 24624U, nic_active); tmp___0 = spinlock_check(& nesvnic->port_ibevent_lock); flags = _raw_spin_lock_irqsave(tmp___0); if ((unsigned int )nesvnic->of_device_registered != 0U) { (nesdev->nesadapter)->send_term_ok = 0U; nesdev->iw_status = 0U; if ((unsigned int )nesvnic->linkup == 1U) { nes_port_ibevent(nesvnic); } else { } } else { } del_timer_sync(& nesvnic->event_timer); nesvnic->event_timer.function = 0; spin_unlock_irqrestore(& nesvnic->port_ibevent_lock, flags); nes_destroy_nic_qp(nesvnic); nesvnic->netdev_open = 0U; return (0); } } static int nes_nic_send(struct sk_buff *skb , struct net_device *netdev ) { struct nes_vnic *nesvnic ; void *tmp ; struct nes_device *nesdev ; struct nes_hw_nic *nesnic ; struct nes_hw_nic_sq_wqe *nic_sqe ; struct tcphdr *tcph ; __le16 *wqe_fragment_length ; u32 wqe_misc ; u16 wqe_fragment_index ; u16 skb_fragment_index ; dma_addr_t bus_address ; unsigned char *tmp___0 ; bool tmp___1 ; size_t __len ; unsigned int _min1 ; unsigned int _min2 ; unsigned int tmp___2 ; unsigned int tmp___3 ; void *__ret ; unsigned int _min1___0 ; unsigned int _min2___0 ; unsigned int tmp___4 ; unsigned int tmp___5 ; unsigned int tmp___6 ; unsigned char *tmp___7 ; unsigned char *tmp___8 ; unsigned int tmp___9 ; u16 tmp___10 ; unsigned int tmp___11 ; unsigned int tmp___12 ; unsigned int tmp___13 ; skb_frag_t *frag ; unsigned char *tmp___14 ; unsigned int tmp___15 ; unsigned char *tmp___16 ; unsigned int tmp___17 ; unsigned char *tmp___18 ; unsigned int tmp___19 ; { tmp = netdev_priv((struct net_device const *)netdev); nesvnic = (struct nes_vnic *)tmp; nesdev = nesvnic->nesdev; nesnic = & nesvnic->nic; wqe_fragment_index = 1U; nic_sqe = nesnic->sq_vbase + (unsigned long )nesnic->sq_head; wqe_fragment_length = (__le16 *)(& nic_sqe->wqe_words) + 3U; if (((int )skb->vlan_tci & 4096) != 0) { if ((nes_debug_level & 256U) != 0U) { printk("\viw_nes: %s[%u]: %s: VLAN packet to send... VLAN = %08X\n", "nes_nic_send", 419, (char *)(& netdev->name), (int )skb->vlan_tci & -4097); } else { } wqe_misc = 8388608U; *wqe_fragment_length = (unsigned int )skb->vlan_tci & 61439U; } else { wqe_misc = 0U; } wqe_fragment_length = wqe_fragment_length + 1; wqe_misc = wqe_misc | 2147483648U; if ((unsigned int )*((unsigned char *)skb + 124UL) == 12U) { tmp___1 = skb_is_gso((struct sk_buff const *)skb); if ((int )tmp___1) { tcph = tcp_hdr((struct sk_buff const *)skb); tmp___0 = skb_end_pointer((struct sk_buff const *)skb); wqe_misc = ((u32 )((struct skb_shared_info *)tmp___0)->gso_size | wqe_misc) | 4194304U; set_wqe_32bit_value((__le32 *)(& nic_sqe->wqe_words), 2U, (unsigned int )tcph->doff | (((unsigned int )((long )tcph) - (unsigned int )((long )skb->data)) << 4)); } else { } } else { wqe_misc = wqe_misc | 1073741824U; } set_wqe_32bit_value((__le32 *)(& nic_sqe->wqe_words), 1U, skb->len); _min1 = 128U; tmp___2 = skb_headlen((struct sk_buff const *)skb); _min2 = tmp___2; if (_min1 < _min2) { tmp___3 = _min1; } else { tmp___3 = _min2; } __len = (size_t )tmp___3; __ret = __builtin_memcpy((void *)(& (nesnic->first_frag_vbase + (unsigned long )nesnic->sq_head)->buffer), (void const *)skb->data, __len); _min1___0 = 128U; tmp___4 = skb_headlen((struct sk_buff const *)skb); _min2___0 = tmp___4; if (_min1___0 < _min2___0) { tmp___5 = _min1___0; } else { tmp___5 = _min2___0; } *wqe_fragment_length = (unsigned short )tmp___5; *(wqe_fragment_length + 1UL) = 0U; tmp___12 = skb_headlen((struct sk_buff const *)skb); if (tmp___12 > 128U) { tmp___8 = skb_end_pointer((struct sk_buff const *)skb); if ((int )((struct skb_shared_info *)tmp___8)->nr_frags + 1 > 4) { if ((nes_debug_level & 256U) != 0U) { tmp___6 = skb_headlen((struct sk_buff const *)skb); tmp___7 = skb_end_pointer((struct sk_buff const *)skb); printk("\viw_nes: %s[%u]: %s: Packet with %u fragments not sent, skb_headlen=%u\n", "nes_nic_send", 454, (char *)(& netdev->name), (int )((struct skb_shared_info *)tmp___7)->nr_frags + 2, tmp___6); } else { } kfree_skb(skb); nesvnic->tx_sw_dropped = nesvnic->tx_sw_dropped + 1ULL; return (32); } else { } set_bit((unsigned int )nesnic->sq_head, (unsigned long volatile *)(& nesnic->first_frag_overflow)); tmp___9 = skb_headlen((struct sk_buff const *)skb); bus_address = pci_map_single(nesdev->pcidev, (void *)skb->data + 128U, (size_t )(tmp___9 - 128U), 1); tmp___10 = wqe_fragment_index; wqe_fragment_index = (u16 )((int )wqe_fragment_index + 1); tmp___11 = skb_headlen((struct sk_buff const *)skb); *(wqe_fragment_length + (unsigned long )tmp___10) = (unsigned int )((unsigned short )tmp___11) - 128U; *(wqe_fragment_length + (unsigned long )wqe_fragment_index) = 0U; set_wqe_64bit_value((__le32 *)(& nic_sqe->wqe_words), 8U, bus_address); nesnic->tx_skb[(int )nesnic->sq_head] = skb; } else { } tmp___19 = skb_headlen((struct sk_buff const *)skb); if (tmp___19 == skb->len) { tmp___13 = skb_headlen((struct sk_buff const *)skb); if (tmp___13 <= 128U) { nic_sqe->wqe_words[4] = 0U; nesnic->tx_skb[(int )nesnic->sq_head] = skb; } else { } } else { nesnic->tx_skb[(int )nesnic->sq_head] = skb; skb_fragment_index = 0U; goto ldv_53707; ldv_53706: tmp___14 = skb_end_pointer((struct sk_buff const *)skb); frag = (skb_frag_t *)(& ((struct skb_shared_info *)tmp___14)->frags) + (unsigned long )skb_fragment_index; tmp___15 = skb_frag_size((skb_frag_t const *)frag); bus_address = skb_frag_dma_map(& (nesdev->pcidev)->dev, (skb_frag_t const *)frag, 0UL, (size_t )tmp___15, 1); tmp___16 = skb_end_pointer((struct sk_buff const *)skb); tmp___17 = skb_frag_size((skb_frag_t const *)(& ((struct skb_shared_info *)tmp___16)->frags) + (unsigned long )skb_fragment_index); *(wqe_fragment_length + (unsigned long )wqe_fragment_index) = (unsigned short )tmp___17; set_wqe_64bit_value((__le32 *)(& nic_sqe->wqe_words), (u32 )(((int )wqe_fragment_index + 3) * 2), bus_address); wqe_fragment_index = (u16 )((int )wqe_fragment_index + 1); if ((unsigned int )wqe_fragment_index <= 4U) { *(wqe_fragment_length + (unsigned long )wqe_fragment_index) = 0U; } else { } skb_fragment_index = (u16 )((int )skb_fragment_index + 1); ldv_53707: tmp___18 = skb_end_pointer((struct sk_buff const *)skb); if ((int )((unsigned short )((struct skb_shared_info *)tmp___18)->nr_frags) > (int )skb_fragment_index) { goto ldv_53706; } else { goto ldv_53708; } ldv_53708: ; } set_wqe_32bit_value((__le32 *)(& nic_sqe->wqe_words), 0U, wqe_misc); nesnic->sq_head = (u16 )((int )nesnic->sq_head + 1); nesnic->sq_head = (u16 )((int )((short )nesnic->sq_head) & (int )((short )((unsigned int )nesnic->sq_size + 65535U))); return (0); } } static int nes_netdev_start_xmit(struct sk_buff *skb , struct net_device *netdev ) { struct nes_vnic *nesvnic ; void *tmp ; struct nes_device *nesdev ; struct nes_hw_nic *nesnic ; struct nes_hw_nic_sq_wqe *nic_sqe ; struct tcphdr *tcph ; dma_addr_t tso_bus_address[17U] ; dma_addr_t bus_address ; u32 tso_frag_index ; u32 tso_frag_count ; u32 tso_wqe_length ; u32 curr_tcp_seq ; u32 wqe_count ; u32 send_rc ; struct iphdr *iph ; __le16 *wqe_fragment_length ; u32 nr_frags ; u32 original_first_length ; u16 wqe_fragment_index ; u16 hoffset ; u16 nhoffset ; u16 wqes_needed ; u16 wqes_available ; u32 wqe_misc ; bool tmp___0 ; int tmp___1 ; bool tmp___2 ; bool tmp___3 ; int tmp___4 ; unsigned char *tmp___5 ; unsigned int tmp___6 ; bool tmp___7 ; int tmp___8 ; long tmp___9 ; skb_frag_t *frag ; unsigned char *tmp___10 ; unsigned int tmp___11 ; unsigned char *tmp___12 ; struct tcphdr *tmp___13 ; __u32 tmp___14 ; unsigned char *tmp___15 ; unsigned char *tmp___16 ; unsigned char *tmp___17 ; unsigned char *tmp___18 ; bool tmp___19 ; unsigned char *tmp___20 ; unsigned int tmp___21 ; size_t __len ; unsigned int _min1 ; u32 _min2 ; unsigned int tmp___22 ; void *__ret ; __u32 tmp___23 ; unsigned int _min1___0 ; u32 _min2___0 ; unsigned int tmp___24 ; unsigned int tmp___25 ; u16 tmp___26 ; unsigned int tmp___27 ; unsigned int tmp___28 ; unsigned int tmp___29 ; unsigned char *tmp___30 ; unsigned int tmp___31 ; unsigned char *tmp___32 ; u32 tmp___33 ; unsigned int tmp___34 ; unsigned char *tmp___35 ; __u16 tmp___36 ; unsigned char *tmp___37 ; unsigned char *tmp___38 ; unsigned char *tmp___39 ; int tmp___40 ; bool tmp___41 ; int tmp___42 ; long tmp___43 ; { tmp = netdev_priv((struct net_device const *)netdev); nesvnic = (struct nes_vnic *)tmp; nesdev = nesvnic->nesdev; nesnic = & nesvnic->nic; wqe_count = 1U; wqe_fragment_index = 1U; tmp___0 = netif_carrier_ok((struct net_device const *)netdev); if (tmp___0) { tmp___1 = 0; } else { tmp___1 = 1; } if (tmp___1) { return (0); } else { } tmp___2 = netif_queue_stopped((struct net_device const *)netdev); if ((int )tmp___2) { return (16); } else { } if (((((int )nesnic->sq_tail + (int )nesnic->sq_size * 2) - (int )nesnic->sq_head) & ((int )nesnic->sq_size + -1)) == 1) { tmp___3 = netif_queue_stopped((struct net_device const *)netdev); if (tmp___3) { tmp___4 = 0; } else { tmp___4 = 1; } if (tmp___4) { netif_stop_queue(netdev); __asm__ volatile ("": : : "memory"); if (((((int )nesnic->sq_tail + (int )nesnic->sq_size * 2) - (int )nesnic->sq_head) & ((int )nesnic->sq_size + -1)) != 1) { netif_start_queue(netdev); goto sq_no_longer_full; } else { } } else { } nesvnic->sq_full = nesvnic->sq_full + 1ULL; return (16); } else { } sq_no_longer_full: tmp___5 = skb_end_pointer((struct sk_buff const *)skb); nr_frags = (u32 )((struct skb_shared_info *)tmp___5)->nr_frags; tmp___6 = skb_headlen((struct sk_buff const *)skb); if (tmp___6 > 128U) { nr_frags = nr_frags + 1U; } else { } tmp___43 = ldv__builtin_expect(nr_frags > 4U, 0L); if (tmp___43 != 0L) { tmp___41 = skb_is_gso((struct sk_buff const *)skb); if ((int )tmp___41) { nesvnic->segmented_tso_requests = nesvnic->segmented_tso_requests + 1ULL; nesvnic->tso_requests = nesvnic->tso_requests + 1ULL; wqes_needed = (u16 )(nr_frags >> 2); wqes_needed = ((nr_frags & 3U) != 0U) + (int )wqes_needed; wqes_available = (u16 )((int )((short )((unsigned int )(((int )nesnic->sq_tail + (int )nesnic->sq_size) - (int )nesnic->sq_head) + 65535U)) & (int )((short )((unsigned int )nesnic->sq_size + 65535U))); tmp___9 = ldv__builtin_expect((int )wqes_needed > (int )wqes_available, 0L); if (tmp___9 != 0L) { tmp___7 = netif_queue_stopped((struct net_device const *)netdev); if (tmp___7) { tmp___8 = 0; } else { tmp___8 = 1; } if (tmp___8) { netif_stop_queue(netdev); __asm__ volatile ("": : : "memory"); wqes_available = (u16 )((int )((short )((unsigned int )(((int )nesnic->sq_tail + (int )nesnic->sq_size) - (int )nesnic->sq_head) + 65535U)) & (int )((short )((unsigned int )nesnic->sq_size + 65535U))); if ((int )wqes_needed <= (int )wqes_available) { netif_start_queue(netdev); goto tso_sq_no_longer_full; } else { } } else { } nesvnic->sq_full = nesvnic->sq_full + 1ULL; if ((nes_debug_level & 256U) != 0U) { printk("\viw_nes: %s[%u]: %s: HNIC SQ full- TSO request has too many frags!\n", "nes_netdev_start_xmit", 593, (char *)(& netdev->name)); } else { } return (16); } else { } tso_sq_no_longer_full: tso_frag_count = 0U; goto ldv_53741; ldv_53740: tmp___10 = skb_end_pointer((struct sk_buff const *)skb); frag = (skb_frag_t *)(& ((struct skb_shared_info *)tmp___10)->frags) + (unsigned long )tso_frag_count; tmp___11 = skb_frag_size((skb_frag_t const *)frag); tso_bus_address[tso_frag_count] = skb_frag_dma_map(& (nesdev->pcidev)->dev, (skb_frag_t const *)frag, 0UL, (size_t )tmp___11, 1); tso_frag_count = tso_frag_count + 1U; ldv_53741: tmp___12 = skb_end_pointer((struct sk_buff const *)skb); if ((u32 )((struct skb_shared_info *)tmp___12)->nr_frags > tso_frag_count) { goto ldv_53740; } else { goto ldv_53742; } ldv_53742: tso_frag_index = 0U; tmp___13 = tcp_hdr((struct sk_buff const *)skb); tmp___14 = __fswab32(tmp___13->seq); curr_tcp_seq = tmp___14; tmp___15 = skb_transport_header((struct sk_buff const *)skb); hoffset = (int )((u16 )((long )tmp___15)) - (int )((u16 )((long )skb->data)); tmp___16 = skb_network_header((struct sk_buff const *)skb); nhoffset = (int )((u16 )((long )tmp___16)) - (int )((u16 )((long )skb->data)); tmp___17 = skb_transport_header((struct sk_buff const *)skb); original_first_length = (u32 )((int )hoffset + ((int )((struct tcphdr *)tmp___17)->doff << 2)); wqe_count = 0U; goto ldv_53759; ldv_53758: tso_wqe_length = 0U; nic_sqe = nesnic->sq_vbase + (unsigned long )nesnic->sq_head; wqe_fragment_length = (__le16 *)(& nic_sqe->wqe_words) + 3U; if (((int )skb->vlan_tci & 4096) != 0) { if ((nes_debug_level & 256U) != 0U) { printk("\viw_nes: %s[%u]: %s: VLAN packet to send... VLAN = %08X\n", "nes_netdev_start_xmit", 622, (char *)(& netdev->name), (int )skb->vlan_tci & -4097); } else { } wqe_misc = 8388608U; *wqe_fragment_length = (unsigned int )skb->vlan_tci & 61439U; } else { wqe_misc = 0U; } wqe_fragment_length = wqe_fragment_length + 1; if (original_first_length > 128U) { if ((nes_debug_level & 256U) != 0U) { printk("\viw_nes: %s[%u]: ERROR: SKB header too big, headlen=%u, FIRST_FRAG_SIZE=%u\n", "nes_netdev_start_xmit", 634, original_first_length, 128); } else { } if ((nes_debug_level & 256U) != 0U) { tmp___18 = skb_end_pointer((struct sk_buff const *)skb); tmp___19 = skb_is_gso((struct sk_buff const *)skb); tmp___20 = skb_end_pointer((struct sk_buff const *)skb); tmp___21 = skb_headlen((struct sk_buff const *)skb); printk("\viw_nes: %s[%u]: %s Request to tx NIC packet length %u, headlen %u, (%u frags), is_gso = %u tso_size=%u\n", "nes_netdev_start_xmit", 639, (char *)(& netdev->name), skb->len, tmp___21, (int )((struct skb_shared_info *)tmp___20)->nr_frags, (int )tmp___19, (int )((struct skb_shared_info *)tmp___18)->gso_size); } else { } } else { } _min1 = 128U; _min2 = original_first_length; if (_min1 < _min2) { tmp___22 = _min1; } else { tmp___22 = _min2; } __len = (size_t )tmp___22; __ret = __builtin_memcpy((void *)(& (nesnic->first_frag_vbase + (unsigned long )nesnic->sq_head)->buffer), (void const *)skb->data, __len); iph = (struct iphdr *)(& (nesnic->first_frag_vbase + (unsigned long )nesnic->sq_head)->buffer) + (unsigned long )nhoffset; tcph = (struct tcphdr *)(& (nesnic->first_frag_vbase + (unsigned long )nesnic->sq_head)->buffer) + (unsigned long )hoffset; if (wqe_count + 1U != (u32 )wqes_needed) { tcph->fin = 0U; tcph->psh = 0U; tcph->rst = 0U; tcph->urg = 0U; } else { } if (wqe_count != 0U) { tcph->syn = 0U; } else { } tmp___23 = __fswab32(curr_tcp_seq); tcph->seq = tmp___23; _min1___0 = 128U; _min2___0 = original_first_length; if (_min1___0 < _min2___0) { tmp___24 = _min1___0; } else { tmp___24 = _min2___0; } *wqe_fragment_length = (unsigned short )tmp___24; wqe_fragment_index = 1U; if (wqe_count == 0U) { tmp___29 = skb_headlen((struct sk_buff const *)skb); if (tmp___29 > original_first_length) { set_bit((unsigned int )nesnic->sq_head, (unsigned long volatile *)(& nesnic->first_frag_overflow)); tmp___25 = skb_headlen((struct sk_buff const *)skb); bus_address = pci_map_single(nesdev->pcidev, (void *)skb->data + (unsigned long )original_first_length, (size_t )(tmp___25 - original_first_length), 1); tmp___26 = wqe_fragment_index; wqe_fragment_index = (u16 )((int )wqe_fragment_index + 1); tmp___27 = skb_headlen((struct sk_buff const *)skb); *(wqe_fragment_length + (unsigned long )tmp___26) = (int )((unsigned short )tmp___27) - (int )((unsigned short )original_first_length); *(wqe_fragment_length + (unsigned long )wqe_fragment_index) = 0U; set_wqe_64bit_value((__le32 *)(& nic_sqe->wqe_words), 8U, bus_address); tmp___28 = skb_headlen((struct sk_buff const *)skb); tso_wqe_length = (tmp___28 - original_first_length) + tso_wqe_length; } else { } } else { } goto ldv_53757; ldv_53756: tmp___30 = skb_end_pointer((struct sk_buff const *)skb); tmp___31 = skb_frag_size((skb_frag_t const *)(& ((struct skb_shared_info *)tmp___30)->frags) + (unsigned long )tso_frag_index); *(wqe_fragment_length + (unsigned long )wqe_fragment_index) = (unsigned short )tmp___31; set_wqe_64bit_value((__le32 *)(& nic_sqe->wqe_words), (u32 )(((int )wqe_fragment_index + 3) * 2), tso_bus_address[tso_frag_index]); wqe_fragment_index = (u16 )((int )wqe_fragment_index + 1); tmp___32 = skb_end_pointer((struct sk_buff const *)skb); tmp___33 = tso_frag_index; tso_frag_index = tso_frag_index + 1U; tmp___34 = skb_frag_size((skb_frag_t const *)(& ((struct skb_shared_info *)tmp___32)->frags) + (unsigned long )tmp___33); tso_wqe_length = tmp___34 + tso_wqe_length; if ((unsigned int )wqe_fragment_index <= 4U) { *(wqe_fragment_length + (unsigned long )wqe_fragment_index) = 0U; } else { } if (tso_frag_index == tso_frag_count) { goto ldv_53755; } else { } ldv_53757: ; if ((unsigned int )wqe_fragment_index <= 4U) { goto ldv_53756; } else { goto ldv_53755; } ldv_53755: ; if (wqe_count + 1U == (u32 )wqes_needed) { nesnic->tx_skb[(int )nesnic->sq_head] = skb; } else { nesnic->tx_skb[(int )nesnic->sq_head] = 0; } tmp___35 = skb_end_pointer((struct sk_buff const *)skb); wqe_misc = ((u32 )((struct skb_shared_info *)tmp___35)->gso_size | wqe_misc) | 2147483648U; tmp___37 = skb_end_pointer((struct sk_buff const *)skb); if (tso_wqe_length + original_first_length > (u32 )((struct skb_shared_info *)tmp___37)->gso_size) { wqe_misc = wqe_misc | 4194304U; } else { tmp___36 = __fswab16(((int )((__u16 )tso_wqe_length) + (int )((__u16 )original_first_length)) - (int )nhoffset); iph->tot_len = tmp___36; } set_wqe_32bit_value((__le32 *)(& nic_sqe->wqe_words), 0U, wqe_misc); set_wqe_32bit_value((__le32 *)(& nic_sqe->wqe_words), 2U, (unsigned int )tcph->doff | ((unsigned int )hoffset << 4)); set_wqe_32bit_value((__le32 *)(& nic_sqe->wqe_words), 1U, tso_wqe_length + original_first_length); curr_tcp_seq = curr_tcp_seq + tso_wqe_length; nesnic->sq_head = (u16 )((int )nesnic->sq_head + 1); nesnic->sq_head = (u16 )((int )((short )nesnic->sq_head) & (int )((short )((unsigned int )nesnic->sq_size + 65535U))); wqe_count = wqe_count + 1U; ldv_53759: ; if ((u32 )wqes_needed > wqe_count) { goto ldv_53758; } else { goto ldv_53760; } ldv_53760: ; } else { nesvnic->linearized_skbs = nesvnic->linearized_skbs + 1ULL; tmp___38 = skb_transport_header((struct sk_buff const *)skb); hoffset = (int )((u16 )((long )tmp___38)) - (int )((u16 )((long )skb->data)); tmp___39 = skb_network_header((struct sk_buff const *)skb); nhoffset = (int )((u16 )((long )tmp___39)) - (int )((u16 )((long )skb->data)); skb_linearize(skb); skb_set_transport_header(skb, (int const )hoffset); skb_set_network_header(skb, (int const )nhoffset); tmp___40 = nes_nic_send(skb, netdev); send_rc = (u32 )tmp___40; if (send_rc != 0U) { return (0); } else { } } } else { tmp___42 = nes_nic_send(skb, netdev); send_rc = (u32 )tmp___42; if (send_rc != 0U) { return (0); } else { } } __asm__ volatile ("": : : "memory"); if (wqe_count != 0U) { nes_write32(nesdev->regs + 64UL, ((wqe_count << 24) | (u32 )nesvnic->nic.qp_id) | 8388608U); } else { } netdev->trans_start = jiffies; return (0); } } static struct net_device_stats *nes_netdev_get_stats(struct net_device *netdev ) { struct nes_vnic *nesvnic ; void *tmp ; struct nes_device *nesdev ; u64 u64temp ; u32 u32temp ; u32 tmp___0 ; u32 tmp___1 ; u32 tmp___2 ; u32 tmp___3 ; u32 tmp___4 ; u32 tmp___5 ; u32 tmp___6 ; u32 tmp___7 ; { tmp = netdev_priv((struct net_device const *)netdev); nesvnic = (struct nes_vnic *)tmp; nesdev = nesvnic->nesdev; u32temp = nes_read_indexed(nesdev, (u32 )((int )nesvnic->nic_index * 512 + 12416)); nesvnic->netstats.rx_dropped = nesvnic->netstats.rx_dropped + (unsigned long )u32temp; nesvnic->endnode_nstat_rx_discard = nesvnic->endnode_nstat_rx_discard + (u64 )u32temp; tmp___0 = nes_read_indexed(nesdev, (u32 )(((int )nesvnic->nic_index + 24) * 512)); u64temp = (unsigned long long )tmp___0; tmp___1 = nes_read_indexed(nesdev, (u32 )((int )nesvnic->nic_index * 512 + 12292)); u64temp = ((unsigned long long )tmp___1 << 32) + u64temp; nesvnic->endnode_nstat_rx_octets = nesvnic->endnode_nstat_rx_octets + u64temp; nesvnic->netstats.rx_bytes = (unsigned long )((unsigned long long )nesvnic->netstats.rx_bytes + u64temp); tmp___2 = nes_read_indexed(nesdev, (u32 )((int )nesvnic->nic_index * 512 + 12296)); u64temp = (unsigned long long )tmp___2; tmp___3 = nes_read_indexed(nesdev, (u32 )((int )nesvnic->nic_index * 512 + 12300)); u64temp = ((unsigned long long )tmp___3 << 32) + u64temp; nesvnic->endnode_nstat_rx_frames = nesvnic->endnode_nstat_rx_frames + u64temp; nesvnic->netstats.rx_packets = (unsigned long )((unsigned long long )nesvnic->netstats.rx_packets + u64temp); tmp___4 = nes_read_indexed(nesdev, (u32 )(((int )nesvnic->nic_index + 56) * 512)); u64temp = (unsigned long long )tmp___4; tmp___5 = nes_read_indexed(nesdev, (u32 )((int )nesvnic->nic_index * 512 + 28676)); u64temp = ((unsigned long long )tmp___5 << 32) + u64temp; nesvnic->endnode_nstat_tx_octets = nesvnic->endnode_nstat_tx_octets + u64temp; nesvnic->netstats.tx_bytes = (unsigned long )((unsigned long long )nesvnic->netstats.tx_bytes + u64temp); tmp___6 = nes_read_indexed(nesdev, (u32 )((int )nesvnic->nic_index * 512 + 28680)); u64temp = (unsigned long long )tmp___6; tmp___7 = nes_read_indexed(nesdev, (u32 )((int )nesvnic->nic_index * 512 + 28684)); u64temp = ((unsigned long long )tmp___7 << 32) + u64temp; nesvnic->endnode_nstat_tx_frames = nesvnic->endnode_nstat_tx_frames + u64temp; nesvnic->netstats.tx_packets = (unsigned long )((unsigned long long )nesvnic->netstats.tx_packets + u64temp); u32temp = nes_read_indexed(nesdev, (nesvnic->nesdev)->mac_index * 512U + 8564U); nesvnic->netstats.rx_dropped = nesvnic->netstats.rx_dropped + (unsigned long )u32temp; (nesvnic->nesdev)->mac_rx_errors = (nesvnic->nesdev)->mac_rx_errors + (unsigned long )u32temp; (nesvnic->nesdev)->mac_rx_short_frames = (nesvnic->nesdev)->mac_rx_short_frames + (unsigned long )u32temp; u32temp = nes_read_indexed(nesdev, (nesvnic->nesdev)->mac_index * 512U + 8568U); nesvnic->netstats.rx_dropped = nesvnic->netstats.rx_dropped + (unsigned long )u32temp; (nesvnic->nesdev)->mac_rx_errors = (nesvnic->nesdev)->mac_rx_errors + (unsigned long )u32temp; (nesvnic->nesdev)->mac_rx_oversized_frames = (nesvnic->nesdev)->mac_rx_oversized_frames + (unsigned long )u32temp; u32temp = nes_read_indexed(nesdev, (nesvnic->nesdev)->mac_index * 512U + 8572U); nesvnic->netstats.rx_dropped = nesvnic->netstats.rx_dropped + (unsigned long )u32temp; (nesvnic->nesdev)->mac_rx_errors = (nesvnic->nesdev)->mac_rx_errors + (unsigned long )u32temp; (nesvnic->nesdev)->mac_rx_jabber_frames = (nesvnic->nesdev)->mac_rx_jabber_frames + (unsigned long )u32temp; u32temp = nes_read_indexed(nesdev, (nesvnic->nesdev)->mac_index * 512U + 8584U); nesvnic->netstats.rx_dropped = nesvnic->netstats.rx_dropped + (unsigned long )u32temp; (nesvnic->nesdev)->mac_rx_errors = (nesvnic->nesdev)->mac_rx_errors + (unsigned long )u32temp; (nesvnic->nesdev)->mac_rx_symbol_err_frames = (nesvnic->nesdev)->mac_rx_symbol_err_frames + (unsigned long )u32temp; u32temp = nes_read_indexed(nesdev, (nesvnic->nesdev)->mac_index * 512U + 8580U); nesvnic->netstats.rx_length_errors = nesvnic->netstats.rx_length_errors + (unsigned long )u32temp; (nesvnic->nesdev)->mac_rx_errors = (nesvnic->nesdev)->mac_rx_errors + (unsigned long )u32temp; u32temp = nes_read_indexed(nesdev, (nesvnic->nesdev)->mac_index * 512U + 8576U); (nesvnic->nesdev)->mac_rx_errors = (nesvnic->nesdev)->mac_rx_errors + (unsigned long )u32temp; (nesvnic->nesdev)->mac_rx_crc_errors = (nesvnic->nesdev)->mac_rx_crc_errors + (unsigned long )u32temp; nesvnic->netstats.rx_crc_errors = nesvnic->netstats.rx_crc_errors + (unsigned long )u32temp; u32temp = nes_read_indexed(nesdev, (nesvnic->nesdev)->mac_index * 512U + 8504U); (nesvnic->nesdev)->mac_tx_errors = (nesvnic->nesdev)->mac_tx_errors + (unsigned long )u32temp; nesvnic->netstats.tx_errors = nesvnic->netstats.tx_errors + (unsigned long )u32temp; return (& nesvnic->netstats); } } static void nes_netdev_tx_timeout(struct net_device *netdev ) { struct nes_vnic *nesvnic ; void *tmp ; { tmp = netdev_priv((struct net_device const *)netdev); nesvnic = (struct nes_vnic *)tmp; if ((nesvnic->msg_enable & 8U) != 0U) { if ((nes_debug_level & 256U) != 0U) { printk("\viw_nes: %s[%u]: %s: tx timeout\n", "nes_netdev_tx_timeout", 837, (char *)(& netdev->name)); } else { } } else { } return; } } static int nes_netdev_set_mac_address(struct net_device *netdev , void *p ) { struct nes_vnic *nesvnic ; void *tmp ; struct nes_device *nesdev ; struct sockaddr *mac_addr ; int i ; u32 macaddr_low ; u16 macaddr_high ; bool tmp___0 ; int tmp___1 ; size_t __len ; void *__ret ; { tmp = netdev_priv((struct net_device const *)netdev); nesvnic = (struct nes_vnic *)tmp; nesdev = nesvnic->nesdev; mac_addr = (struct sockaddr *)p; tmp___0 = is_valid_ether_addr((u8 const *)(& mac_addr->sa_data)); if (tmp___0) { tmp___1 = 0; } else { tmp___1 = 1; } if (tmp___1) { return (-99); } else { } __len = (size_t )netdev->addr_len; __ret = __builtin_memcpy((void *)netdev->dev_addr, (void const *)(& mac_addr->sa_data), __len); printk("iw_nes: %s: Address length = %d, Address = %pM\n", "nes_netdev_set_mac_address", (int )netdev->addr_len, (char *)(& mac_addr->sa_data)); macaddr_high = (int )((u16 )*(netdev->dev_addr)) << 8U; macaddr_high = (int )((u16 )*(netdev->dev_addr + 1UL)) + (int )macaddr_high; macaddr_low = (unsigned int )*(netdev->dev_addr + 2UL) << 24; macaddr_low = ((unsigned int )*(netdev->dev_addr + 3UL) << 16) + macaddr_low; macaddr_low = ((unsigned int )*(netdev->dev_addr + 4UL) << 8) + macaddr_low; macaddr_low = (u32 )*(netdev->dev_addr + 5UL) + macaddr_low; i = 0; goto ldv_53789; ldv_53788: ; if ((unsigned int )nesvnic->qp_nic_index[i] == 15U) { goto ldv_53787; } else { } nes_write_indexed(nesdev, (u32 )(((int )nesvnic->qp_nic_index[i] + 3136) * 8), macaddr_low); nes_write_indexed(nesdev, (u32 )((int )nesvnic->qp_nic_index[i] * 8 + 25092), ((unsigned int )macaddr_high | ((unsigned int )nesvnic->nic_index << 16)) | 1048576U); i = i + 1; ldv_53789: ; if (i <= 3) { goto ldv_53788; } else { goto ldv_53787; } ldv_53787: ; return (0); } } static void set_allmulti(struct nes_device *nesdev , u32 nic_active_bit ) { u32 nic_active ; { nic_active = nes_read_indexed(nesdev, 24608U); nic_active = nic_active | nic_active_bit; nes_write_indexed(nesdev, 24608U, nic_active); nic_active = nes_read_indexed(nesdev, 24600U); nic_active = ~ nic_active_bit & nic_active; nes_write_indexed(nesdev, 24600U, nic_active); return; } } static void nes_netdev_set_multicast_list(struct net_device *netdev ) { struct nes_vnic *nesvnic ; void *tmp ; struct nes_device *nesdev ; struct nes_adapter *nesadapter ; u32 nic_active_bit ; u32 nic_active ; u32 perfect_filter_register_address ; u32 macaddr_low ; u16 macaddr_high ; u8 mc_all_on ; u8 mc_index ; int mc_nic_index ; u8 pft_entries_preallocated ; int _max1 ; int _max2 ; int tmp___0 ; u8 max_pft_entries_avaiable ; unsigned long flags ; int mc_count ; raw_spinlock_t *tmp___1 ; char *addrs ; int i ; struct netdev_hw_addr *ha ; void *tmp___2 ; struct list_head const *__mptr ; size_t __len ; void *__ret ; int tmp___3 ; int tmp___4 ; struct list_head const *__mptr___0 ; int tmp___5 ; char *addr ; int tmp___6 ; { tmp = netdev_priv((struct net_device const *)netdev); nesvnic = (struct nes_vnic *)tmp; nesdev = nesvnic->nesdev; nesadapter = (nesvnic->nesdev)->nesadapter; mc_all_on = 0U; mc_nic_index = -1; _max1 = (int )nesadapter->adapter_fcn_count * nics_per_function; _max2 = 4; if (_max1 > _max2) { tmp___0 = _max1; } else { tmp___0 = _max2; } pft_entries_preallocated = (u8 )tmp___0; max_pft_entries_avaiable = 48U - (unsigned int )pft_entries_preallocated; mc_count = netdev->mc.count; tmp___1 = spinlock_check(& nesadapter->resource_lock); flags = _raw_spin_lock_irqsave(tmp___1); nic_active_bit = (u32 )(1 << (int )nesvnic->nic_index); if ((netdev->flags & 256U) != 0U) { nic_active = nes_read_indexed(nesdev, 24608U); nic_active = nic_active | nic_active_bit; nes_write_indexed(nesdev, 24608U, nic_active); nic_active = nes_read_indexed(nesdev, 24600U); nic_active = nic_active | nic_active_bit; nes_write_indexed(nesdev, 24600U, nic_active); mc_all_on = 1U; } else if ((netdev->flags & 512U) != 0U || (unsigned int )nesvnic->nic_index > 3U) { set_allmulti(nesdev, nic_active_bit); mc_all_on = 1U; } else { nic_active = nes_read_indexed(nesdev, 24608U); nic_active = ~ nic_active_bit & nic_active; nes_write_indexed(nesdev, 24608U, nic_active); nic_active = nes_read_indexed(nesdev, 24600U); nic_active = ~ nic_active_bit & nic_active; nes_write_indexed(nesdev, 24600U, nic_active); } if ((nes_debug_level & 128U) != 0U) { printk("\viw_nes: %s[%u]: Number of MC entries = %d, Promiscuous = %d, All Multicast = %d.\n", "nes_netdev_set_multicast_list", 944, mc_count, (netdev->flags & 256U) != 0U, (netdev->flags & 512U) != 0U); } else { } if ((unsigned int )mc_all_on == 0U) { tmp___2 = kmalloc((size_t )(mc_count * 6), 32U); addrs = (char *)tmp___2; if ((unsigned long )addrs == (unsigned long )((char *)0)) { set_allmulti(nesdev, nic_active_bit); goto unlock; } else { } i = 0; __mptr = (struct list_head const *)netdev->mc.list.next; ha = (struct netdev_hw_addr *)__mptr; goto ldv_53832; ldv_53831: __len = 6UL; if (__len > 63UL) { tmp___3 = i; i = i + 1; __ret = __memcpy((void *)addrs + (unsigned long )(tmp___3 * 6), (void const *)(& ha->addr), __len); } else { tmp___4 = i; i = i + 1; __ret = __builtin_memcpy((void *)addrs + (unsigned long )(tmp___4 * 6), (void const *)(& ha->addr), __len); } __mptr___0 = (struct list_head const *)ha->list.next; ha = (struct netdev_hw_addr *)__mptr___0; ldv_53832: ; if ((unsigned long )(& ha->list) != (unsigned long )(& netdev->mc.list)) { goto ldv_53831; } else { goto ldv_53833; } ldv_53833: perfect_filter_register_address = (u32 )(((int )pft_entries_preallocated + 3136) * 8); i = 0; mc_index = 0U; goto ldv_53843; ldv_53842: ; goto ldv_53835; ldv_53834: ; ldv_53835: ; if (i < mc_count && (unsigned long )nesvnic->mcrq_mcast_filter != (unsigned long )((int (*)(struct nes_vnic * , __u8 * ))0)) { tmp___5 = i; i = i + 1; mc_nic_index = (*(nesvnic->mcrq_mcast_filter))(nesvnic, (__u8 *)addrs + (unsigned long )(tmp___5 * 6)); if (mc_nic_index == 0) { goto ldv_53834; } else { goto ldv_53836; } } else { goto ldv_53836; } ldv_53836: ; if (mc_nic_index < 0) { mc_nic_index = (int )nesvnic->nic_index; } else { } goto ldv_53838; ldv_53837: ; if ((nes_debug_level & 128U) != 0U) { printk("\viw_nes: %s[%u]: mc_index=%d skipping nic_index=%d, used for=%d \n", "nes_netdev_set_multicast_list", 976, (int )mc_index, (int )nesvnic->nic_index, (int )nesadapter->pft_mcast_map[(int )mc_index]); } else { } mc_index = (u8 )((int )mc_index + 1); ldv_53838: ; if (((unsigned int )nesadapter->pft_mcast_map[(int )mc_index] <= 15U && (int )nesadapter->pft_mcast_map[(int )mc_index] != (int )nesvnic->nic_index) && (int )mc_index < (int )max_pft_entries_avaiable) { goto ldv_53837; } else { goto ldv_53839; } ldv_53839: ; if ((int )mc_index >= (int )max_pft_entries_avaiable) { goto ldv_53840; } else { } if (i < mc_count) { tmp___6 = i; i = i + 1; addr = addrs + (unsigned long )(tmp___6 * 6); if ((nes_debug_level & 128U) != 0U) { printk("\viw_nes: %s[%u]: Assigning MC Address %pM to register 0x%04X nic_idx=%d\n", "nes_netdev_set_multicast_list", 987, addr, (u32 )((int )mc_index * 8) + perfect_filter_register_address, mc_nic_index); } else { } macaddr_high = (int )((u16 )((unsigned char )*addr)) << 8U; macaddr_high = (int )((u16 )((unsigned char )*(addr + 1UL))) + (int )macaddr_high; macaddr_low = (u32 )((int )((unsigned char )*(addr + 2UL)) << 24); macaddr_low = (u32 )((int )((unsigned char )*(addr + 3UL)) << 16) + macaddr_low; macaddr_low = (u32 )((int )((unsigned char )*(addr + 4UL)) << 8) + macaddr_low; macaddr_low = (u32 )((unsigned char )*(addr + 5UL)) + macaddr_low; nes_write_indexed(nesdev, (u32 )((int )mc_index * 8) + perfect_filter_register_address, macaddr_low); nes_write_indexed(nesdev, ((u32 )((int )mc_index * 8) + perfect_filter_register_address) + 4U, ((unsigned int )macaddr_high | ((unsigned int )(1 << mc_nic_index) << 16)) | 1048576U); nesadapter->pft_mcast_map[(int )mc_index] = nesvnic->nic_index; } else { if ((nes_debug_level & 128U) != 0U) { printk("\viw_nes: %s[%u]: Clearing MC Address at register 0x%04X\n", "nes_netdev_set_multicast_list", 1006, (u32 )((int )mc_index * 8) + perfect_filter_register_address); } else { } nes_write_indexed(nesdev, ((u32 )((int )mc_index * 8) + perfect_filter_register_address) + 4U, 0U); nesadapter->pft_mcast_map[(int )mc_index] = 255U; } mc_index = (u8 )((int )mc_index + 1); ldv_53843: ; if ((int )mc_index < (int )max_pft_entries_avaiable) { goto ldv_53842; } else { goto ldv_53840; } ldv_53840: kfree((void const *)addrs); if (i < mc_count) { set_allmulti(nesdev, nic_active_bit); } else { } } else { } unlock: spin_unlock_irqrestore(& nesadapter->resource_lock, flags); return; } } static int nes_netdev_change_mtu(struct net_device *netdev , int new_mtu ) { struct nes_vnic *nesvnic ; void *tmp ; struct nes_device *nesdev ; int ret ; u8 jumbomode ; u32 nic_active ; u32 nic_active_bit ; u32 uc_all_active ; u32 mc_all_active ; u32 tmp___0 ; u32 tmp___1 ; bool tmp___2 ; { tmp = netdev_priv((struct net_device const *)netdev); nesvnic = (struct nes_vnic *)tmp; nesdev = nesvnic->nesdev; ret = 0; jumbomode = 0U; if (new_mtu <= 59 || new_mtu > max_mtu) { return (-22); } else { } netdev->mtu = (unsigned int )new_mtu; nesvnic->max_frame_size = (unsigned int )((u16 )new_mtu) + 18U; if (netdev->mtu > 1500U) { jumbomode = 1U; } else { } nes_nic_init_timer_defaults(nesdev, (int )jumbomode); tmp___2 = netif_running((struct net_device const *)netdev); if ((int )tmp___2) { nic_active_bit = (u32 )(1 << (int )nesvnic->nic_index); tmp___0 = nes_read_indexed(nesdev, 24608U); mc_all_active = tmp___0 & nic_active_bit; tmp___1 = nes_read_indexed(nesdev, 24600U); uc_all_active = tmp___1 & nic_active_bit; nes_netdev_stop(netdev); nes_netdev_open(netdev); nic_active = nes_read_indexed(nesdev, 24608U); nic_active = nic_active | mc_all_active; nes_write_indexed(nesdev, 24608U, nic_active); nic_active = nes_read_indexed(nesdev, 24600U); nic_active = nic_active | uc_all_active; nes_write_indexed(nesdev, 24600U, nic_active); } else { } return (ret); } } static char const nes_ethtool_stringset[58U][32U] = { { 'L', 'i', 'n', 'k', ' ', 'C', 'h', 'a', 'n', 'g', 'e', ' ', 'I', 'n', 't', 'e', 'r', 'r', 'u', 'p', 't', 's', '\000', (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, (char)0}, { 'L', 'i', 'n', 'e', 'a', 'r', 'i', 'z', 'e', 'd', ' ', 'S', 'K', 'B', 's', '\000', (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, (char)0}, { 'T', '/', 'G', 'S', 'O', ' ', 'R', 'e', 'q', 'u', 'e', 's', 't', 's', '\000'}, { 'P', 'a', 'u', 's', 'e', ' ', 'F', 'r', 'a', 'm', 'e', 's', ' ', 'S', 'e', 'n', 't', '\000', (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, (char)0}, { 'P', 'a', 'u', 's', 'e', ' ', 'F', 'r', 'a', 'm', 'e', 's', ' ', 'R', 'e', 'c', 'e', 'i', 'v', 'e', 'd', '\000', (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, (char)0}, { 'I', 'n', 't', 'e', 'r', 'n', 'a', 'l', ' ', 'R', 'o', 'u', 't', 'i', 'n', 'g', ' ', 'E', 'r', 'r', 'o', 'r', 's', '\000', (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, (char)0}, { 'S', 'Q', ' ', 'S', 'W', ' ', 'D', 'r', 'o', 'p', 'p', 'e', 'd', ' ', 'S', 'K', 'B', 's', '\000', (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, (char)0}, { 'S', 'Q', ' ', 'F', 'u', 'l', 'l', '\000'}, { 'S', 'e', 'g', 'm', 'e', 'n', 't', 'e', 'd', ' ', 'T', 'S', 'O', ' ', 'R', 'e', 'q', 'u', 'e', 's', 't', 's', '\000', (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, (char)0}, { 'R', 'x', ' ', 'S', 'y', 'm', 'b', 'o', 'l', ' ', 'E', 'r', 'r', 'o', 'r', 's', '\000', (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, (char)0}, { 'R', 'x', ' ', 'J', 'a', 'b', 'b', 'e', 'r', ' ', 'E', 'r', 'r', 'o', 'r', 's', '\000', (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, (char)0}, { 'R', 'x', ' ', 'O', 'v', 'e', 'r', 's', 'i', 'z', 'e', 'd', ' ', 'F', 'r', 'a', 'm', 'e', 's', '\000', (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, (char)0}, { 'R', 'x', ' ', 'S', 'h', 'o', 'r', 't', ' ', 'F', 'r', 'a', 'm', 'e', 's', '\000', (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, (char)0}, { 'R', 'x', ' ', 'L', 'e', 'n', 'g', 't', 'h', ' ', 'E', 'r', 'r', 'o', 'r', 's', '\000', (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, (char)0}, { 'R', 'x', ' ', 'C', 'R', 'C', ' ', 'E', 'r', 'r', 'o', 'r', 's', '\000'}, { 'R', 'x', ' ', 'P', 'o', 'r', 't', ' ', 'D', 'i', 's', 'c', 'a', 'r', 'd', '\000', (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, (char)0}, { 'E', 'n', 'd', 'n', 'o', 'd', 'e', ' ', 'R', 'x', ' ', 'D', 'i', 's', 'c', 'a', 'r', 'd', 's', '\000', (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, (char)0}, { 'E', 'n', 'd', 'n', 'o', 'd', 'e', ' ', 'R', 'x', ' ', 'O', 'c', 't', 'e', 't', 's', '\000', (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, (char)0}, { 'E', 'n', 'd', 'n', 'o', 'd', 'e', ' ', 'R', 'x', ' ', 'F', 'r', 'a', 'm', 'e', 's', '\000', (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, (char)0}, { 'E', 'n', 'd', 'n', 'o', 'd', 'e', ' ', 'T', 'x', ' ', 'O', 'c', 't', 'e', 't', 's', '\000', (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, (char)0}, { 'E', 'n', 'd', 'n', 'o', 'd', 'e', ' ', 'T', 'x', ' ', 'F', 'r', 'a', 'm', 'e', 's', '\000', (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, (char)0}, { 'T', 'x', ' ', 'E', 'r', 'r', 'o', 'r', 's', '\000'}, { 'm', 'h', ' ', 'd', 'e', 't', 'e', 'c', 't', 'e', 'd', '\000'}, { 'm', 'h', ' ', 'p', 'a', 'u', 's', 'e', 's', '\000'}, { 'R', 'e', 't', 'r', 'a', 'n', 's', 'm', 'i', 's', 's', 'i', 'o', 'n', ' ', 'C', 'o', 'u', 'n', 't', '\000', (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, (char)0}, { 'C', 'M', ' ', 'C', 'o', 'n', 'n', 'e', 'c', 't', 's', '\000'}, { 'C', 'M', ' ', 'A', 'c', 'c', 'e', 'p', 't', 's', '\000'}, { 'D', 'i', 's', 'c', 'o', 'n', 'n', 'e', 'c', 't', 's', '\000'}, { 'C', 'o', 'n', 'n', 'e', 'c', 't', 'e', 'd', ' ', 'E', 'v', 'e', 'n', 't', 's', '\000', (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, (char)0}, { 'C', 'o', 'n', 'n', 'e', 'c', 't', ' ', 'R', 'e', 'q', 'u', 'e', 's', 't', 's', '\000', (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, (char)0}, { 'C', 'M', ' ', 'R', 'e', 'j', 'e', 'c', 't', 's', '\000'}, { 'M', 'o', 'd', 'i', 'f', 'y', 'Q', 'P', ' ', 'T', 'i', 'm', 'e', 'o', 'u', 't', 's', '\000', (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, (char)0}, { 'C', 'r', 'e', 'a', 't', 'e', 'Q', 'P', 's', '\000'}, { 'S', 'W', ' ', 'D', 'e', 's', 't', 'r', 'o', 'y', 'Q', 'P', 's', '\000'}, { 'D', 'e', 's', 't', 'r', 'o', 'y', 'Q', 'P', 's', '\000'}, { 'C', 'M', ' ', 'C', 'l', 'o', 's', 'e', 's', '\000'}, { 'C', 'M', ' ', 'P', 'a', 'c', 'k', 'e', 't', 's', ' ', 'S', 'e', 'n', 't', '\000', (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, (char)0}, { 'C', 'M', ' ', 'P', 'a', 'c', 'k', 'e', 't', 's', ' ', 'B', 'o', 'u', 'n', 'c', 'e', 'd', '\000', (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, (char)0}, { 'C', 'M', ' ', 'P', 'a', 'c', 'k', 'e', 't', 's', ' ', 'C', 'r', 'e', 'a', 't', 'e', 'd', '\000', (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, (char)0}, { 'C', 'M', ' ', 'P', 'a', 'c', 'k', 'e', 't', 's', ' ', 'R', 'c', 'v', 'd', '\000', (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, (char)0}, { 'C', 'M', ' ', 'P', 'a', 'c', 'k', 'e', 't', 's', ' ', 'D', 'r', 'o', 'p', 'p', 'e', 'd', '\000', (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, (char)0}, { 'C', 'M', ' ', 'P', 'a', 'c', 'k', 'e', 't', 's', ' ', 'R', 'e', 't', 'r', 'a', 'n', 's', '\000', (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, (char)0}, { 'C', 'M', ' ', 'L', 'i', 's', 't', 'e', 'n', 's', ' ', 'C', 'r', 'e', 'a', 't', 'e', 'd', '\000', (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, (char)0}, { 'C', 'M', ' ', 'L', 'i', 's', 't', 'e', 'n', 's', ' ', 'D', 'e', 's', 't', 'r', 'o', 'y', 'e', 'd', '\000', (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, (char)0}, { 'C', 'M', ' ', 'B', 'a', 'c', 'k', 'l', 'o', 'g', ' ', 'D', 'r', 'o', 'p', 's', '\000', (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, (char)0}, { 'C', 'M', ' ', 'L', 'o', 'o', 'p', 'b', 'a', 'c', 'k', 's', '\000'}, { 'C', 'M', ' ', 'N', 'o', 'd', 'e', 's', ' ', 'C', 'r', 'e', 'a', 't', 'e', 'd', '\000', (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, (char)0}, { 'C', 'M', ' ', 'N', 'o', 'd', 'e', 's', ' ', 'D', 'e', 's', 't', 'r', 'o', 'y', 'e', 'd', '\000', (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, (char)0}, { 'C', 'M', ' ', 'A', 'c', 'c', 'e', 'l', ' ', 'D', 'r', 'o', 'p', 's', '\000'}, { 'C', 'M', ' ', 'R', 'e', 's', 'e', 't', 's', ' ', 'R', 'e', 'c', 'e', 'i', 'v', 'e', 'd', '\000', (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, (char)0}, { 'F', 'r', 'e', 'e', ' ', '4', 'K', 'p', 'b', 'l', 's', '\000'}, { 'F', 'r', 'e', 'e', ' ', '2', '5', '6', 'p', 'b', 'l', 's', '\000'}, { 'T', 'i', 'm', 'e', 'r', ' ', 'I', 'n', 'i', 't', 's', '\000'}, { 'L', 'R', 'O', ' ', 'a', 'g', 'g', 'r', 'e', 'g', 'a', 't', 'e', 'd', '\000'}, { 'L', 'R', 'O', ' ', 'f', 'l', 'u', 's', 'h', 'e', 'd', '\000'}, { 'L', 'R', 'O', ' ', 'n', 'o', '_', 'd', 'e', 's', 'c', '\000'}, { 'P', 'A', 'U', ' ', 'C', 'r', 'e', 'a', 't', 'e', 'Q', 'P', 's', '\000'}, { 'P', 'A', 'U', ' ', 'D', 'e', 's', 't', 'r', 'o', 'y', 'Q', 'P', 's', '\000'}}; static int nes_netdev_get_sset_count(struct net_device *netdev , int stringset ) { { if (stringset == 1) { return (58); } else { return (-22); } } } static void nes_netdev_get_strings(struct net_device *netdev , u32 stringset , u8 *ethtool_strings ) { size_t __len ; void *__ret ; { if (stringset == 1U) { __len = 1856UL; if (__len > 63UL) { __ret = __memcpy((void *)ethtool_strings, (void const *)(& nes_ethtool_stringset), __len); } else { __ret = __builtin_memcpy((void *)ethtool_strings, (void const *)(& nes_ethtool_stringset), __len); } } else { } return; } } static void nes_netdev_get_ethtool_stats(struct net_device *netdev , struct ethtool_stats *target_ethtool_stats , u64 *target_stat_values ) { u64 u64temp ; struct nes_vnic *nesvnic ; void *tmp ; struct nes_device *nesdev ; struct nes_adapter *nesadapter ; u32 nic_count ; u32 u32temp ; u32 index ; u32 tmp___0 ; u32 tmp___1 ; u32 tmp___2 ; u32 tmp___3 ; u32 tmp___4 ; u32 tmp___5 ; u32 tmp___6 ; u32 tmp___7 ; int tmp___8 ; int tmp___9 ; int tmp___10 ; int tmp___11 ; int tmp___12 ; int tmp___13 ; int tmp___14 ; int tmp___15 ; int tmp___16 ; int tmp___17 ; int tmp___18 ; int tmp___19 ; int tmp___20 ; int tmp___21 ; int tmp___22 ; int tmp___23 ; int tmp___24 ; int tmp___25 ; int tmp___26 ; int tmp___27 ; { tmp = netdev_priv((struct net_device const *)netdev); nesvnic = (struct nes_vnic *)tmp; nesdev = nesvnic->nesdev; nesadapter = nesdev->nesadapter; index = 0U; target_ethtool_stats->n_stats = 58U; *(target_stat_values + (unsigned long )index) = (nesvnic->nesdev)->link_status_interrupts; index = index + 1U; *(target_stat_values + (unsigned long )index) = nesvnic->linearized_skbs; index = index + 1U; *(target_stat_values + (unsigned long )index) = nesvnic->tso_requests; u32temp = nes_read_indexed(nesdev, (nesvnic->nesdev)->mac_index * 512U + 8472U); (nesvnic->nesdev)->mac_pause_frames_sent = (nesvnic->nesdev)->mac_pause_frames_sent + (unsigned long )u32temp; index = index + 1U; *(target_stat_values + (unsigned long )index) = (u64 )(nesvnic->nesdev)->mac_pause_frames_sent; u32temp = nes_read_indexed(nesdev, (nesvnic->nesdev)->mac_index * 512U + 8532U); (nesvnic->nesdev)->mac_pause_frames_received = (nesvnic->nesdev)->mac_pause_frames_received + (unsigned long )u32temp; u32temp = nes_read_indexed(nesdev, (nesvnic->nesdev)->mac_index * 64U + 2608U); (nesvnic->nesdev)->port_rx_discards = (nesvnic->nesdev)->port_rx_discards + (unsigned long )u32temp; nesvnic->netstats.rx_dropped = nesvnic->netstats.rx_dropped + (unsigned long )u32temp; u32temp = nes_read_indexed(nesdev, (nesvnic->nesdev)->mac_index * 64U + 2612U); (nesvnic->nesdev)->port_tx_discards = (nesvnic->nesdev)->port_tx_discards + (unsigned long )u32temp; nesvnic->netstats.tx_dropped = nesvnic->netstats.tx_dropped + (unsigned long )u32temp; u32temp = nes_read_indexed(nesdev, (nesvnic->nesdev)->mac_index * 512U + 8564U); nesvnic->netstats.rx_dropped = nesvnic->netstats.rx_dropped + (unsigned long )u32temp; (nesvnic->nesdev)->mac_rx_errors = (nesvnic->nesdev)->mac_rx_errors + (unsigned long )u32temp; (nesvnic->nesdev)->mac_rx_short_frames = (nesvnic->nesdev)->mac_rx_short_frames + (unsigned long )u32temp; u32temp = nes_read_indexed(nesdev, (nesvnic->nesdev)->mac_index * 512U + 8568U); nesvnic->netstats.rx_dropped = nesvnic->netstats.rx_dropped + (unsigned long )u32temp; (nesvnic->nesdev)->mac_rx_errors = (nesvnic->nesdev)->mac_rx_errors + (unsigned long )u32temp; (nesvnic->nesdev)->mac_rx_oversized_frames = (nesvnic->nesdev)->mac_rx_oversized_frames + (unsigned long )u32temp; u32temp = nes_read_indexed(nesdev, (nesvnic->nesdev)->mac_index * 512U + 8572U); nesvnic->netstats.rx_dropped = nesvnic->netstats.rx_dropped + (unsigned long )u32temp; (nesvnic->nesdev)->mac_rx_errors = (nesvnic->nesdev)->mac_rx_errors + (unsigned long )u32temp; (nesvnic->nesdev)->mac_rx_jabber_frames = (nesvnic->nesdev)->mac_rx_jabber_frames + (unsigned long )u32temp; u32temp = nes_read_indexed(nesdev, (nesvnic->nesdev)->mac_index * 512U + 8584U); nesvnic->netstats.rx_dropped = nesvnic->netstats.rx_dropped + (unsigned long )u32temp; (nesvnic->nesdev)->mac_rx_errors = (nesvnic->nesdev)->mac_rx_errors + (unsigned long )u32temp; (nesvnic->nesdev)->mac_rx_symbol_err_frames = (nesvnic->nesdev)->mac_rx_symbol_err_frames + (unsigned long )u32temp; u32temp = nes_read_indexed(nesdev, (nesvnic->nesdev)->mac_index * 512U + 8580U); nesvnic->netstats.rx_length_errors = nesvnic->netstats.rx_length_errors + (unsigned long )u32temp; (nesvnic->nesdev)->mac_rx_errors = (nesvnic->nesdev)->mac_rx_errors + (unsigned long )u32temp; u32temp = nes_read_indexed(nesdev, (nesvnic->nesdev)->mac_index * 512U + 8576U); (nesvnic->nesdev)->mac_rx_errors = (nesvnic->nesdev)->mac_rx_errors + (unsigned long )u32temp; (nesvnic->nesdev)->mac_rx_crc_errors = (nesvnic->nesdev)->mac_rx_crc_errors + (unsigned long )u32temp; nesvnic->netstats.rx_crc_errors = nesvnic->netstats.rx_crc_errors + (unsigned long )u32temp; u32temp = nes_read_indexed(nesdev, (nesvnic->nesdev)->mac_index * 512U + 8504U); (nesvnic->nesdev)->mac_tx_errors = (nesvnic->nesdev)->mac_tx_errors + (unsigned long )u32temp; nesvnic->netstats.tx_errors = nesvnic->netstats.tx_errors + (unsigned long )u32temp; nic_count = 0U; goto ldv_53887; ldv_53886: ; if ((unsigned int )nesvnic->qp_nic_index[nic_count] == 15U) { goto ldv_53885; } else { } u32temp = nes_read_indexed(nesdev, (u32 )((int )nesvnic->qp_nic_index[nic_count] * 512 + 12416)); nesvnic->netstats.rx_dropped = nesvnic->netstats.rx_dropped + (unsigned long )u32temp; nesvnic->endnode_nstat_rx_discard = nesvnic->endnode_nstat_rx_discard + (u64 )u32temp; tmp___0 = nes_read_indexed(nesdev, (u32 )(((int )nesvnic->qp_nic_index[nic_count] + 24) * 512)); u64temp = (unsigned long long )tmp___0; tmp___1 = nes_read_indexed(nesdev, (u32 )((int )nesvnic->qp_nic_index[nic_count] * 512 + 12292)); u64temp = ((unsigned long long )tmp___1 << 32) + u64temp; nesvnic->endnode_nstat_rx_octets = nesvnic->endnode_nstat_rx_octets + u64temp; nesvnic->netstats.rx_bytes = (unsigned long )((unsigned long long )nesvnic->netstats.rx_bytes + u64temp); tmp___2 = nes_read_indexed(nesdev, (u32 )((int )nesvnic->qp_nic_index[nic_count] * 512 + 12296)); u64temp = (unsigned long long )tmp___2; tmp___3 = nes_read_indexed(nesdev, (u32 )((int )nesvnic->qp_nic_index[nic_count] * 512 + 12300)); u64temp = ((unsigned long long )tmp___3 << 32) + u64temp; nesvnic->endnode_nstat_rx_frames = nesvnic->endnode_nstat_rx_frames + u64temp; nesvnic->netstats.rx_packets = (unsigned long )((unsigned long long )nesvnic->netstats.rx_packets + u64temp); tmp___4 = nes_read_indexed(nesdev, (u32 )(((int )nesvnic->qp_nic_index[nic_count] + 56) * 512)); u64temp = (unsigned long long )tmp___4; tmp___5 = nes_read_indexed(nesdev, (u32 )((int )nesvnic->qp_nic_index[nic_count] * 512 + 28676)); u64temp = ((unsigned long long )tmp___5 << 32) + u64temp; nesvnic->endnode_nstat_tx_octets = nesvnic->endnode_nstat_tx_octets + u64temp; nesvnic->netstats.tx_bytes = (unsigned long )((unsigned long long )nesvnic->netstats.tx_bytes + u64temp); tmp___6 = nes_read_indexed(nesdev, (u32 )((int )nesvnic->qp_nic_index[nic_count] * 512 + 28680)); u64temp = (unsigned long long )tmp___6; tmp___7 = nes_read_indexed(nesdev, (u32 )((int )nesvnic->qp_nic_index[nic_count] * 512 + 28684)); u64temp = ((unsigned long long )tmp___7 << 32) + u64temp; nesvnic->endnode_nstat_tx_frames = nesvnic->endnode_nstat_tx_frames + u64temp; nesvnic->netstats.tx_packets = (unsigned long )((unsigned long long )nesvnic->netstats.tx_packets + u64temp); u32temp = nes_read_indexed(nesdev, (u32 )((int )nesvnic->qp_nic_index[nic_count] * 512 + 28800)); nesvnic->endnode_ipv4_tcp_retransmits = nesvnic->endnode_ipv4_tcp_retransmits + (u64 )u32temp; nic_count = nic_count + 1U; ldv_53887: ; if (nic_count <= 3U) { goto ldv_53886; } else { goto ldv_53885; } ldv_53885: index = index + 1U; *(target_stat_values + (unsigned long )index) = (u64 )(nesvnic->nesdev)->mac_pause_frames_received; index = index + 1U; *(target_stat_values + (unsigned long )index) = (u64 )(nesdev->nesadapter)->nic_rx_eth_route_err; index = index + 1U; *(target_stat_values + (unsigned long )index) = nesvnic->tx_sw_dropped; index = index + 1U; *(target_stat_values + (unsigned long )index) = nesvnic->sq_full; index = index + 1U; *(target_stat_values + (unsigned long )index) = nesvnic->segmented_tso_requests; index = index + 1U; *(target_stat_values + (unsigned long )index) = (u64 )(nesvnic->nesdev)->mac_rx_symbol_err_frames; index = index + 1U; *(target_stat_values + (unsigned long )index) = (u64 )(nesvnic->nesdev)->mac_rx_jabber_frames; index = index + 1U; *(target_stat_values + (unsigned long )index) = (u64 )(nesvnic->nesdev)->mac_rx_oversized_frames; index = index + 1U; *(target_stat_values + (unsigned long )index) = (u64 )(nesvnic->nesdev)->mac_rx_short_frames; index = index + 1U; *(target_stat_values + (unsigned long )index) = (u64 )nesvnic->netstats.rx_length_errors; index = index + 1U; *(target_stat_values + (unsigned long )index) = (u64 )(nesvnic->nesdev)->mac_rx_crc_errors; index = index + 1U; *(target_stat_values + (unsigned long )index) = (u64 )(nesvnic->nesdev)->port_rx_discards; index = index + 1U; *(target_stat_values + (unsigned long )index) = nesvnic->endnode_nstat_rx_discard; index = index + 1U; *(target_stat_values + (unsigned long )index) = nesvnic->endnode_nstat_rx_octets; index = index + 1U; *(target_stat_values + (unsigned long )index) = nesvnic->endnode_nstat_rx_frames; index = index + 1U; *(target_stat_values + (unsigned long )index) = nesvnic->endnode_nstat_tx_octets; index = index + 1U; *(target_stat_values + (unsigned long )index) = nesvnic->endnode_nstat_tx_frames; index = index + 1U; *(target_stat_values + (unsigned long )index) = (u64 )(nesvnic->nesdev)->mac_tx_errors; index = index + 1U; *(target_stat_values + (unsigned long )index) = (u64 )mh_detected; index = index + 1U; *(target_stat_values + (unsigned long )index) = (u64 )mh_pauses_sent; index = index + 1U; *(target_stat_values + (unsigned long )index) = nesvnic->endnode_ipv4_tcp_retransmits; index = index + 1U; tmp___8 = atomic_read((atomic_t const *)(& cm_connects)); *(target_stat_values + (unsigned long )index) = (u64 )tmp___8; index = index + 1U; tmp___9 = atomic_read((atomic_t const *)(& cm_accepts)); *(target_stat_values + (unsigned long )index) = (u64 )tmp___9; index = index + 1U; tmp___10 = atomic_read((atomic_t const *)(& cm_disconnects)); *(target_stat_values + (unsigned long )index) = (u64 )tmp___10; index = index + 1U; tmp___11 = atomic_read((atomic_t const *)(& cm_connecteds)); *(target_stat_values + (unsigned long )index) = (u64 )tmp___11; index = index + 1U; tmp___12 = atomic_read((atomic_t const *)(& cm_connect_reqs)); *(target_stat_values + (unsigned long )index) = (u64 )tmp___12; index = index + 1U; tmp___13 = atomic_read((atomic_t const *)(& cm_rejects)); *(target_stat_values + (unsigned long )index) = (u64 )tmp___13; index = index + 1U; tmp___14 = atomic_read((atomic_t const *)(& mod_qp_timouts)); *(target_stat_values + (unsigned long )index) = (u64 )tmp___14; index = index + 1U; tmp___15 = atomic_read((atomic_t const *)(& qps_created)); *(target_stat_values + (unsigned long )index) = (u64 )tmp___15; index = index + 1U; tmp___16 = atomic_read((atomic_t const *)(& sw_qps_destroyed)); *(target_stat_values + (unsigned long )index) = (u64 )tmp___16; index = index + 1U; tmp___17 = atomic_read((atomic_t const *)(& qps_destroyed)); *(target_stat_values + (unsigned long )index) = (u64 )tmp___17; index = index + 1U; tmp___18 = atomic_read((atomic_t const *)(& cm_closes)); *(target_stat_values + (unsigned long )index) = (u64 )tmp___18; index = index + 1U; *(target_stat_values + (unsigned long )index) = (u64 )cm_packets_sent; index = index + 1U; *(target_stat_values + (unsigned long )index) = (u64 )cm_packets_bounced; index = index + 1U; *(target_stat_values + (unsigned long )index) = (u64 )cm_packets_created; index = index + 1U; *(target_stat_values + (unsigned long )index) = (u64 )cm_packets_received; index = index + 1U; *(target_stat_values + (unsigned long )index) = (u64 )cm_packets_dropped; index = index + 1U; *(target_stat_values + (unsigned long )index) = (u64 )cm_packets_retrans; index = index + 1U; tmp___19 = atomic_read((atomic_t const *)(& cm_listens_created)); *(target_stat_values + (unsigned long )index) = (u64 )tmp___19; index = index + 1U; tmp___20 = atomic_read((atomic_t const *)(& cm_listens_destroyed)); *(target_stat_values + (unsigned long )index) = (u64 )tmp___20; index = index + 1U; *(target_stat_values + (unsigned long )index) = (u64 )cm_backlog_drops; index = index + 1U; tmp___21 = atomic_read((atomic_t const *)(& cm_loopbacks)); *(target_stat_values + (unsigned long )index) = (u64 )tmp___21; index = index + 1U; tmp___22 = atomic_read((atomic_t const *)(& cm_nodes_created)); *(target_stat_values + (unsigned long )index) = (u64 )tmp___22; index = index + 1U; tmp___23 = atomic_read((atomic_t const *)(& cm_nodes_destroyed)); *(target_stat_values + (unsigned long )index) = (u64 )tmp___23; index = index + 1U; tmp___24 = atomic_read((atomic_t const *)(& cm_accel_dropped_pkts)); *(target_stat_values + (unsigned long )index) = (u64 )tmp___24; index = index + 1U; tmp___25 = atomic_read((atomic_t const *)(& cm_resets_recvd)); *(target_stat_values + (unsigned long )index) = (u64 )tmp___25; index = index + 1U; *(target_stat_values + (unsigned long )index) = (u64 )nesadapter->free_4kpbl; index = index + 1U; *(target_stat_values + (unsigned long )index) = (u64 )nesadapter->free_256pbl; index = index + 1U; *(target_stat_values + (unsigned long )index) = (u64 )int_mod_timer_init; index = index + 1U; *(target_stat_values + (unsigned long )index) = (u64 )nesvnic->lro_mgr.stats.aggregated; index = index + 1U; *(target_stat_values + (unsigned long )index) = (u64 )nesvnic->lro_mgr.stats.flushed; index = index + 1U; *(target_stat_values + (unsigned long )index) = (u64 )nesvnic->lro_mgr.stats.no_desc; index = index + 1U; tmp___26 = atomic_read((atomic_t const *)(& pau_qps_created)); *(target_stat_values + (unsigned long )index) = (u64 )tmp___26; index = index + 1U; tmp___27 = atomic_read((atomic_t const *)(& pau_qps_destroyed)); *(target_stat_values + (unsigned long )index) = (u64 )tmp___27; return; } } static void nes_netdev_get_drvinfo(struct net_device *netdev , struct ethtool_drvinfo *drvinfo ) { struct nes_vnic *nesvnic ; void *tmp ; struct nes_adapter *nesadapter ; char const *tmp___0 ; { tmp = netdev_priv((struct net_device const *)netdev); nesvnic = (struct nes_vnic *)tmp; nesadapter = (nesvnic->nesdev)->nesadapter; strcpy((char *)(& drvinfo->driver), "iw_nes"); tmp___0 = pci_name((struct pci_dev const *)(nesvnic->nesdev)->pcidev); strcpy((char *)(& drvinfo->bus_info), tmp___0); sprintf((char *)(& drvinfo->fw_version), "%u.%u", nesadapter->firmware_version >> 16, nesadapter->firmware_version & 255U); strcpy((char *)(& drvinfo->version), "1.5.0.1"); drvinfo->testinfo_len = 0U; drvinfo->eedump_len = 0U; drvinfo->regdump_len = 0U; return; } } static int nes_netdev_set_coalesce(struct net_device *netdev , struct ethtool_coalesce *et_coalesce ) { struct nes_vnic *nesvnic ; void *tmp ; struct nes_device *nesdev ; struct nes_adapter *nesadapter ; struct nes_hw_tune_timer *shared_timer ; unsigned long flags ; raw_spinlock_t *tmp___0 ; { tmp = netdev_priv((struct net_device const *)netdev); nesvnic = (struct nes_vnic *)tmp; nesdev = nesvnic->nesdev; nesadapter = nesdev->nesadapter; shared_timer = & nesadapter->tune_timer; tmp___0 = spinlock_check(& nesadapter->periodic_timer_lock); flags = _raw_spin_lock_irqsave(tmp___0); if (et_coalesce->rx_max_coalesced_frames_low != 0U) { shared_timer->threshold_low = (u16 )et_coalesce->rx_max_coalesced_frames_low; } else { } if (et_coalesce->rx_max_coalesced_frames_irq != 0U) { shared_timer->threshold_target = (u16 )et_coalesce->rx_max_coalesced_frames_irq; } else { } if (et_coalesce->rx_max_coalesced_frames_high != 0U) { shared_timer->threshold_high = (u16 )et_coalesce->rx_max_coalesced_frames_high; } else { } if (et_coalesce->rx_coalesce_usecs_low != 0U) { shared_timer->timer_in_use_min = (u16 )et_coalesce->rx_coalesce_usecs_low; } else { } if (et_coalesce->rx_coalesce_usecs_high != 0U) { shared_timer->timer_in_use_max = (u16 )et_coalesce->rx_coalesce_usecs_high; } else { } spin_unlock_irqrestore(& nesadapter->periodic_timer_lock, flags); nesadapter->et_rx_coalesce_usecs_irq = et_coalesce->rx_coalesce_usecs_irq; if (et_coalesce->use_adaptive_rx_coalesce != 0U) { nesadapter->et_use_adaptive_rx_coalesce = 1U; nesadapter->timer_int_limit = 10U; nesadapter->et_rx_coalesce_usecs_irq = 0U; if (et_coalesce->pkt_rate_low != 0U) { nesadapter->et_pkt_rate_low = et_coalesce->pkt_rate_low; } else { } } else { nesadapter->et_use_adaptive_rx_coalesce = 0U; nesadapter->timer_int_limit = 2U; if (nesadapter->et_rx_coalesce_usecs_irq != 0U) { nes_write32(nesdev->regs + 24UL, nesadapter->et_rx_coalesce_usecs_irq * 8U | 2147483648U); } else { } } return (0); } } static int nes_netdev_get_coalesce(struct net_device *netdev , struct ethtool_coalesce *et_coalesce ) { struct nes_vnic *nesvnic ; void *tmp ; struct nes_device *nesdev ; struct nes_adapter *nesadapter ; struct ethtool_coalesce temp_et_coalesce ; struct nes_hw_tune_timer *shared_timer ; unsigned long flags ; raw_spinlock_t *tmp___0 ; size_t __len ; void *__ret ; { tmp = netdev_priv((struct net_device const *)netdev); nesvnic = (struct nes_vnic *)tmp; nesdev = nesvnic->nesdev; nesadapter = nesdev->nesadapter; shared_timer = & nesadapter->tune_timer; memset((void *)(& temp_et_coalesce), 0, 92UL); temp_et_coalesce.rx_coalesce_usecs_irq = nesadapter->et_rx_coalesce_usecs_irq; temp_et_coalesce.use_adaptive_rx_coalesce = (__u32 )nesadapter->et_use_adaptive_rx_coalesce; temp_et_coalesce.rate_sample_interval = nesadapter->et_rate_sample_interval; temp_et_coalesce.pkt_rate_low = nesadapter->et_pkt_rate_low; tmp___0 = spinlock_check(& nesadapter->periodic_timer_lock); flags = _raw_spin_lock_irqsave(tmp___0); temp_et_coalesce.rx_max_coalesced_frames_low = (__u32 )shared_timer->threshold_low; temp_et_coalesce.rx_max_coalesced_frames_irq = (__u32 )shared_timer->threshold_target; temp_et_coalesce.rx_max_coalesced_frames_high = (__u32 )shared_timer->threshold_high; temp_et_coalesce.rx_coalesce_usecs_low = (__u32 )shared_timer->timer_in_use_min; temp_et_coalesce.rx_coalesce_usecs_high = (__u32 )shared_timer->timer_in_use_max; if ((unsigned int )nesadapter->et_use_adaptive_rx_coalesce != 0U) { temp_et_coalesce.rx_coalesce_usecs_irq = (__u32 )shared_timer->timer_in_use; } else { } spin_unlock_irqrestore(& nesadapter->periodic_timer_lock, flags); __len = 92UL; if (__len > 63UL) { __ret = __memcpy((void *)et_coalesce, (void const *)(& temp_et_coalesce), __len); } else { __ret = __builtin_memcpy((void *)et_coalesce, (void const *)(& temp_et_coalesce), __len); } return (0); } } static void nes_netdev_get_pauseparam(struct net_device *netdev , struct ethtool_pauseparam *et_pauseparam ) { struct nes_vnic *nesvnic ; void *tmp ; { tmp = netdev_priv((struct net_device const *)netdev); nesvnic = (struct nes_vnic *)tmp; et_pauseparam->autoneg = 0U; et_pauseparam->rx_pause = (unsigned int )(nesvnic->nesdev)->disable_rx_flow_control == 0U; et_pauseparam->tx_pause = (unsigned int )(nesvnic->nesdev)->disable_tx_flow_control == 0U; return; } } static int nes_netdev_set_pauseparam(struct net_device *netdev , struct ethtool_pauseparam *et_pauseparam ) { struct nes_vnic *nesvnic ; void *tmp ; struct nes_device *nesdev ; u32 u32temp ; { tmp = netdev_priv((struct net_device const *)netdev); nesvnic = (struct nes_vnic *)tmp; nesdev = nesvnic->nesdev; if (et_pauseparam->autoneg != 0U) { return (0); } else { } if (et_pauseparam->tx_pause == 1U && (unsigned int )nesdev->disable_tx_flow_control == 1U) { u32temp = nes_read_indexed(nesdev, nesdev->mac_index * 512U + 8196U); u32temp = u32temp | 1U; nes_write_indexed(nesdev, nesdev->mac_index * 512U + 8196U, u32temp); nesdev->disable_tx_flow_control = 0U; } else if (et_pauseparam->tx_pause == 0U && (unsigned int )nesdev->disable_tx_flow_control == 0U) { u32temp = nes_read_indexed(nesdev, nesdev->mac_index * 512U + 8196U); u32temp = u32temp & 4294967294U; nes_write_indexed(nesdev, nesdev->mac_index * 512U + 8196U, u32temp); nesdev->disable_tx_flow_control = 1U; } else { } if (et_pauseparam->rx_pause == 1U && (unsigned int )nesdev->disable_rx_flow_control == 1U) { u32temp = nes_read_indexed(nesdev, (nesdev->mac_index + 40U) * 64U); u32temp = u32temp & 4294836223U; nes_write_indexed(nesdev, (nesdev->mac_index + 40U) * 64U, u32temp); nesdev->disable_rx_flow_control = 0U; } else if (et_pauseparam->rx_pause == 0U && (unsigned int )nesdev->disable_rx_flow_control == 0U) { u32temp = nes_read_indexed(nesdev, (nesdev->mac_index + 40U) * 64U); u32temp = u32temp | 131072U; nes_write_indexed(nesdev, (nesdev->mac_index + 40U) * 64U, u32temp); nesdev->disable_rx_flow_control = 1U; } else { } return (0); } } static int nes_netdev_get_settings(struct net_device *netdev , struct ethtool_cmd *et_cmd ) { struct nes_vnic *nesvnic ; void *tmp ; struct nes_device *nesdev ; struct nes_adapter *nesadapter ; u32 mac_index ; u8 phy_type ; u8 phy_index ; u16 phy_data ; unsigned long flags ; raw_spinlock_t *tmp___0 ; { tmp = netdev_priv((struct net_device const *)netdev); nesvnic = (struct nes_vnic *)tmp; nesdev = nesvnic->nesdev; nesadapter = nesdev->nesadapter; mac_index = nesdev->mac_index; phy_type = nesadapter->phy_type[mac_index]; phy_index = nesadapter->phy_index[mac_index]; et_cmd->duplex = 1U; et_cmd->port = 2U; et_cmd->maxtxpkt = 511U; et_cmd->maxrxpkt = 511U; if ((unsigned int )nesadapter->OneG_Mode != 0U) { ethtool_cmd_speed_set(et_cmd, 1000U); if ((unsigned int )phy_type == 5U) { et_cmd->supported = 32U; et_cmd->advertising = 32U; et_cmd->autoneg = 0U; et_cmd->transceiver = 0U; et_cmd->phy_address = (__u8 )mac_index; } else { et_cmd->supported = 96U; et_cmd->advertising = 96U; tmp___0 = spinlock_check(& nesadapter->phy_lock); flags = _raw_spin_lock_irqsave(tmp___0); nes_read_1G_phy_reg(nesdev, 0, (int )phy_index, & phy_data); spin_unlock_irqrestore(& nesadapter->phy_lock, flags); if (((int )phy_data & 4096) != 0) { et_cmd->autoneg = 1U; } else { et_cmd->autoneg = 0U; } et_cmd->transceiver = 1U; et_cmd->phy_address = phy_index; } return (0); } else { } if (((unsigned int )phy_type == 4U || (unsigned int )phy_type == 8U) || (unsigned int )phy_type == 9U) { et_cmd->transceiver = 1U; et_cmd->port = 3U; et_cmd->supported = 1024U; et_cmd->advertising = 1024U; et_cmd->phy_address = phy_index; } else { et_cmd->transceiver = 0U; et_cmd->supported = 4096U; et_cmd->advertising = 4096U; et_cmd->phy_address = (__u8 )mac_index; } ethtool_cmd_speed_set(et_cmd, 10000U); et_cmd->autoneg = 0U; return (0); } } static int nes_netdev_set_settings(struct net_device *netdev , struct ethtool_cmd *et_cmd ) { struct nes_vnic *nesvnic ; void *tmp ; struct nes_device *nesdev ; struct nes_adapter *nesadapter ; unsigned long flags ; u16 phy_data ; u8 phy_index ; raw_spinlock_t *tmp___0 ; { tmp = netdev_priv((struct net_device const *)netdev); nesvnic = (struct nes_vnic *)tmp; nesdev = nesvnic->nesdev; nesadapter = nesdev->nesadapter; if ((unsigned int )nesadapter->OneG_Mode != 0U && (unsigned int )nesadapter->phy_type[nesdev->mac_index] != 5U) { phy_index = nesadapter->phy_index[nesdev->mac_index]; tmp___0 = spinlock_check(& nesadapter->phy_lock); flags = _raw_spin_lock_irqsave(tmp___0); nes_read_1G_phy_reg(nesdev, 0, (int )phy_index, & phy_data); if ((unsigned int )et_cmd->autoneg != 0U) { phy_data = (u16 )((unsigned int )phy_data | 4864U); } else { phy_data = (unsigned int )phy_data & 61439U; } nes_write_1G_phy_reg(nesdev, 0, (int )phy_index, (int )phy_data); spin_unlock_irqrestore(& nesadapter->phy_lock, flags); } else { } return (0); } } static struct ethtool_ops const nes_ethtool_ops = {& nes_netdev_get_settings, & nes_netdev_set_settings, & nes_netdev_get_drvinfo, 0, 0, 0, 0, 0, 0, 0, & ethtool_op_get_link, 0, 0, 0, & nes_netdev_get_coalesce, & nes_netdev_set_coalesce, 0, 0, & nes_netdev_get_pauseparam, & nes_netdev_set_pauseparam, 0, & nes_netdev_get_strings, 0, & nes_netdev_get_ethtool_stats, 0, 0, 0, 0, & nes_netdev_get_sset_count, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; static void nes_vlan_mode(struct net_device *netdev , struct nes_device *nesdev , netdev_features_t features ) { struct nes_adapter *nesadapter ; u32 u32temp ; unsigned long flags ; raw_spinlock_t *tmp ; { nesadapter = nesdev->nesadapter; tmp = spinlock_check(& nesadapter->phy_lock); flags = _raw_spin_lock_irqsave(tmp); if ((nes_debug_level & 16U) != 0U) { printk("\viw_nes: %s[%u]: %s: %s\n", "nes_vlan_mode", 1637, "nes_vlan_mode", (char *)(& netdev->name)); } else { } u32temp = nes_read_indexed(nesdev, 2280U); if ((features & 256ULL) != 0ULL) { u32temp = u32temp & 4261412863U; } else { u32temp = u32temp | 33554432U; } nes_write_indexed(nesdev, 2280U, u32temp); spin_unlock_irqrestore(& nesadapter->phy_lock, flags); return; } } static netdev_features_t nes_fix_features(struct net_device *netdev , netdev_features_t features ) { { if ((features & 256ULL) != 0ULL) { features = features | 128ULL; } else { features = features & 0xffffffffffffff7fULL; } return (features); } } static int nes_set_features(struct net_device *netdev , netdev_features_t features ) { struct nes_vnic *nesvnic ; void *tmp ; struct nes_device *nesdev ; u32 changed ; { tmp = netdev_priv((struct net_device const *)netdev); nesvnic = (struct nes_vnic *)tmp; nesdev = nesvnic->nesdev; changed = (u32 )netdev->features ^ (u32 )features; if (((unsigned long long )changed & 256ULL) != 0ULL) { nes_vlan_mode(netdev, nesdev, features); } else { } return (0); } } static struct net_device_ops const nes_netdev_ops = {0, 0, & nes_netdev_open, & nes_netdev_stop, (netdev_tx_t (*)(struct sk_buff * , struct net_device * ))(& nes_netdev_start_xmit), 0, 0, & nes_netdev_set_multicast_list, & nes_netdev_set_mac_address, & eth_validate_addr, 0, 0, & nes_netdev_change_mtu, 0, & nes_netdev_tx_timeout, 0, & nes_netdev_get_stats, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, & nes_fix_features, & nes_set_features, 0, 0, 0, 0, 0, 0, 0}; struct net_device *nes_netdev_init(struct nes_device *nesdev , void *mmio_addr ) { u64 u64temp ; struct nes_vnic *nesvnic ; struct net_device *netdev ; struct nic_qp_map *curr_qp_map ; u8 phy_type ; void *tmp ; size_t __len ; void *__ret ; struct lock_class_key __key ; struct lock_class_key __key___0 ; struct lock_class_key __key___1 ; u32 u32temp ; u32 link_mask ; u32 link_val ; u16 temp_phy_data ; u16 phy_data ; unsigned long flags ; raw_spinlock_t *tmp___0 ; u32 tmp___1 ; u32 tmp___2 ; { phy_type = (nesdev->nesadapter)->phy_type[nesdev->mac_index]; netdev = alloc_etherdev_mqs(16672, 1U, 1U); if ((unsigned long )netdev == (unsigned long )((struct net_device *)0)) { printk("\viw_nes: nesvnic etherdev alloc failed"); return (0); } else { } tmp = netdev_priv((struct net_device const *)netdev); nesvnic = (struct nes_vnic *)tmp; if ((nes_debug_level & 2U) != 0U) { printk("\viw_nes: %s[%u]: netdev = %p, %s\n", "nes_netdev_init", 1709, netdev, (char *)(& netdev->name)); } else { } netdev->dev.parent = & (nesdev->pcidev)->dev; netdev->watchdog_timeo = 1500; netdev->irq = (nesdev->pcidev)->irq; netdev->mtu = 1500U; netdev->hard_header_len = 14U; netdev->addr_len = 6U; netdev->type = 1U; netdev->netdev_ops = & nes_netdev_ops; netdev->ethtool_ops = & nes_ethtool_ops; netif_napi_add(netdev, & nesvnic->napi, & nes_netdev_poll, 128); if ((nes_debug_level & 2U) != 0U) { printk("\viw_nes: %s[%u]: Enabling VLAN Insert/Delete.\n", "nes_netdev_init", 1722); } else { } nesvnic->netdev = netdev; nesvnic->nesdev = nesdev; nesvnic->msg_enable = netif_msg_init(debug, (int )default_msg); nesvnic->netdev_index = nesdev->netdev_count; nesvnic->perfect_filter_index = (nesdev->nesadapter)->netdev_count; nesvnic->max_frame_size = (unsigned int )((int )((u16 )netdev->mtu) + (int )netdev->hard_header_len) + 4U; curr_qp_map = nic_qp_mapping_per_function[(nesdev->pcidev)->devfn & 7U]; nesvnic->nic.qp_id = (u16 )(curr_qp_map + (unsigned long )nesdev->netdev_count)->qpid; nesvnic->nic_index = (curr_qp_map + (unsigned long )nesdev->netdev_count)->nic_index; nesvnic->logical_port = (curr_qp_map + (unsigned long )nesdev->netdev_count)->logical_port; u64temp = (unsigned long long )(nesdev->nesadapter)->mac_addr_low; u64temp = ((unsigned long long )(nesdev->nesadapter)->mac_addr_high << 32) + u64temp; u64temp = (u64 )nesvnic->nic_index + u64temp; *(netdev->dev_addr) = (unsigned char )(u64temp >> 40); *(netdev->dev_addr + 1UL) = (unsigned char )(u64temp >> 32); *(netdev->dev_addr + 2UL) = (unsigned char )(u64temp >> 24); *(netdev->dev_addr + 3UL) = (unsigned char )(u64temp >> 16); *(netdev->dev_addr + 4UL) = (unsigned char )(u64temp >> 8); *(netdev->dev_addr + 5UL) = (unsigned char )u64temp; __len = 6UL; if (__len > 63UL) { __ret = __memcpy((void *)(& netdev->perm_addr), (void const *)netdev->dev_addr, __len); } else { __ret = __builtin_memcpy((void *)(& netdev->perm_addr), (void const *)netdev->dev_addr, __len); } netdev->hw_features = 536871171ULL; if ((unsigned int )nesvnic->logical_port <= 1U || (nesdev->nesadapter)->hw_rev != 4U) { netdev->hw_features = netdev->hw_features | 65536ULL; } else { } netdev->features = netdev->hw_features | 160ULL; netdev->hw_features = netdev->hw_features | 32768ULL; if ((nes_debug_level & 2U) != 0U) { printk("\viw_nes: %s[%u]: nesvnic = %p, reported features = 0x%lX, QPid = %d, nic_index = %d, logical_port = %d, mac_index = %d.\n", "nes_netdev_init", 1759, nesvnic, (unsigned long )netdev->features, (int )nesvnic->nic.qp_id, (int )nesvnic->nic_index, (int )nesvnic->logical_port, nesdev->mac_index); } else { } if ((unsigned int )((nesvnic->nesdev)->nesadapter)->port_count == 1U && (unsigned int )((nesvnic->nesdev)->nesadapter)->adapter_fcn_count == 1U) { nesvnic->qp_nic_index[0] = nesvnic->nic_index; nesvnic->qp_nic_index[1] = (unsigned int )nesvnic->nic_index + 1U; if ((nes_drv_opt & 32U) != 0U) { nesvnic->qp_nic_index[2] = 15U; nesvnic->qp_nic_index[3] = 15U; } else { nesvnic->qp_nic_index[2] = (unsigned int )nesvnic->nic_index + 2U; nesvnic->qp_nic_index[3] = (unsigned int )nesvnic->nic_index + 3U; } } else if ((unsigned int )((nesvnic->nesdev)->nesadapter)->port_count == 2U || ((unsigned int )((nesvnic->nesdev)->nesadapter)->port_count == 1U && (unsigned int )((nesvnic->nesdev)->nesadapter)->adapter_fcn_count == 2U)) { nesvnic->qp_nic_index[0] = nesvnic->nic_index; nesvnic->qp_nic_index[1] = (unsigned int )nesvnic->nic_index + 2U; nesvnic->qp_nic_index[2] = 15U; nesvnic->qp_nic_index[3] = 15U; } else { nesvnic->qp_nic_index[0] = nesvnic->nic_index; nesvnic->qp_nic_index[1] = 15U; nesvnic->qp_nic_index[2] = 15U; nesvnic->qp_nic_index[3] = 15U; } nesvnic->next_qp_nic_index = 0U; if ((unsigned int )nesdev->netdev_count == 0U) { nesvnic->rdma_enabled = 1U; } else { nesvnic->rdma_enabled = 0U; } nesvnic->nic_cq.cq_number = nesvnic->nic.qp_id; init_timer_key(& nesvnic->event_timer, 0U, "(&nesvnic->event_timer)", & __key); nesvnic->event_timer.function = 0; spinlock_check(& nesvnic->tx_lock); __raw_spin_lock_init(& nesvnic->tx_lock.ldv_5961.rlock, "&(&nesvnic->tx_lock)->rlock", & __key___0); spinlock_check(& nesvnic->port_ibevent_lock); __raw_spin_lock_init(& nesvnic->port_ibevent_lock.ldv_5961.rlock, "&(&nesvnic->port_ibevent_lock)->rlock", & __key___1); nesdev->netdev[(int )nesdev->netdev_count] = netdev; if ((nes_debug_level & 2U) != 0U) { printk("\viw_nes: %s[%u]: Adding nesvnic (%p) to the adapters nesvnic_list for MAC%d.\n", "nes_netdev_init", 1804, nesvnic, nesdev->mac_index); } else { } list_add_tail(& nesvnic->list, (struct list_head *)(& (nesdev->nesadapter)->nesvnic_list) + (unsigned long )nesdev->mac_index); if ((unsigned int )nesdev->netdev_count == 0U && (((nesdev->pcidev)->devfn & 7U) == nesdev->mac_index || ((unsigned int )phy_type == 5U && ((((nesdev->pcidev)->devfn & 7U) == 1U && nesdev->mac_index == 2U) || (((nesdev->pcidev)->devfn & 7U) == 2U && nesdev->mac_index == 1U))))) { link_mask = 0U; link_val = 0U; phy_data = 0U; u32temp = nes_read_indexed(nesdev, ((nesdev->mac_index & 1U) + 20U) * 512U); if ((unsigned int )phy_type != 5U) { u32temp = u32temp | 2097152U; nes_write_indexed(nesdev, ((nesdev->mac_index & 1U) + 20U) * 512U, u32temp); } else { } switch ((int )phy_type) { case 5: ; if (nesdev->mac_index <= 1U) { link_mask = 16842752U; link_val = 16842752U; } else { link_mask = 33685504U; link_val = 33685504U; } goto ldv_54010; case 8: tmp___0 = spinlock_check(& (nesdev->nesadapter)->phy_lock); flags = _raw_spin_lock_irqsave(tmp___0); nes_read_10G_phy_reg(nesdev, (int )(nesdev->nesadapter)->phy_index[nesdev->mac_index], 1, 36867); tmp___1 = nes_read_indexed(nesdev, 8324U); temp_phy_data = (unsigned short )tmp___1; nes_read_10G_phy_reg(nesdev, (int )(nesdev->nesadapter)->phy_index[nesdev->mac_index], 3, 33); nes_read_indexed(nesdev, 8324U); nes_read_10G_phy_reg(nesdev, (int )(nesdev->nesadapter)->phy_index[nesdev->mac_index], 3, 33); tmp___2 = nes_read_indexed(nesdev, 8324U); phy_data = (unsigned short )tmp___2; spin_unlock_irqrestore(& (nesdev->nesadapter)->phy_lock, flags); if ((unsigned int )temp_phy_data == 0U && (unsigned int )phy_data == 32768U) { phy_data = 4U; } else { phy_data = 0U; } goto ldv_54010; default: link_mask = 253689856U; link_val = 252641280U; goto ldv_54010; } ldv_54010: u32temp = nes_read_indexed(nesdev, ((nesdev->mac_index & 1U) + 20U) * 512U); if ((unsigned int )phy_type == 8U) { if (((int )phy_data & 4) != 0) { nesvnic->linkup = 1U; } else { } } else if ((u32temp & link_mask) == link_val) { nesvnic->linkup = 1U; } else { } u32temp = nes_read_indexed(nesdev, nesdev->mac_index * 512U + 8688U); if ((nes_debug_level & 2U) != 0U) { printk("\viw_nes: %s[%u]: Phy interrupt status = 0x%X.\n", "nes_netdev_init", 1876, u32temp); } else { } nes_write_indexed(nesdev, nesdev->mac_index * 512U + 8688U, u32temp); nes_init_phy(nesdev); } else { } nes_vlan_mode(netdev, nesdev, netdev->features); return (netdev); } } void nes_netdev_destroy(struct net_device *netdev ) { struct nes_vnic *nesvnic ; void *tmp ; { tmp = netdev_priv((struct net_device const *)netdev); nesvnic = (struct nes_vnic *)tmp; list_del(& nesvnic->list); if ((unsigned int )nesvnic->of_device_registered != 0U) { nes_destroy_ofa_device(nesvnic->nesibdev); } else { } ldv_free_netdev_42(netdev); return; } } int nes_nic_cm_xmit(struct sk_buff *skb , struct net_device *netdev ) { int ret ; { skb->dev = netdev; ret = dev_queue_xmit(skb); if (ret != 0) { if ((nes_debug_level & 32U) != 0U) { printk("\viw_nes: %s[%u]: Bad return code from dev_queue_xmit %d\n", "nes_nic_cm_xmit", 1918, ret); } else { } } else { } return (ret); } } struct net_device *ldvarg18 ; struct net_device *ldvarg20 ; extern int ldv_nes_netdev_ops_ndo_init(void) ; netdev_features_t ldvarg23 ; u64 *ldvarg3 ; int ldv_retval_nes_netdev_open ; u32 ldvarg1 ; struct ethtool_cmd *nes_ethtool_ops_group3 ; int ldv_retval_ldv_nes_netdev_ops_ndo_init ; struct sk_buff *ldvarg13 ; extern int ldv_nes_netdev_ops_ndo_uninit(void) ; struct ethtool_coalesce *nes_ethtool_ops_group1 ; struct net_device *nes_ethtool_ops_group0 ; u8 *ldvarg0 ; struct ethtool_drvinfo *ldvarg5 ; struct net_device *ldvarg16 ; struct net_device *ldvarg15 ; netdev_features_t ldvarg21 ; struct net_device *net_device_ops_group1 ; void *ldvarg17 ; struct net_device *ldvarg14 ; struct ethtool_stats *ldvarg4 ; struct net_device *ldvarg22 ; int ldvarg19 ; struct ethtool_pauseparam *nes_ethtool_ops_group2 ; int ldvarg2 ; void ldv_main_exported_4(void) { int tmp ; { tmp = __VERIFIER_nondet_int(); switch (tmp) { case 0: ; if (ldv_state_variable_4 == 1) { nes_netdev_set_pauseparam(nes_ethtool_ops_group0, nes_ethtool_ops_group2); ldv_state_variable_4 = 1; } else { } goto ldv_54058; case 1: ; if (ldv_state_variable_4 == 1) { nes_netdev_get_pauseparam(nes_ethtool_ops_group0, nes_ethtool_ops_group2); ldv_state_variable_4 = 1; } else { } goto ldv_54058; case 2: ; if (ldv_state_variable_4 == 1) { nes_netdev_set_coalesce(nes_ethtool_ops_group0, nes_ethtool_ops_group1); ldv_state_variable_4 = 1; } else { } goto ldv_54058; case 3: ; if (ldv_state_variable_4 == 1) { nes_netdev_get_coalesce(nes_ethtool_ops_group0, nes_ethtool_ops_group1); ldv_state_variable_4 = 1; } else { } goto ldv_54058; case 4: ; if (ldv_state_variable_4 == 1) { nes_netdev_get_drvinfo(nes_ethtool_ops_group0, ldvarg5); ldv_state_variable_4 = 1; } else { } goto ldv_54058; case 5: ; if (ldv_state_variable_4 == 1) { nes_netdev_get_ethtool_stats(nes_ethtool_ops_group0, ldvarg4, ldvarg3); ldv_state_variable_4 = 1; } else { } goto ldv_54058; case 6: ; if (ldv_state_variable_4 == 1) { nes_netdev_get_sset_count(nes_ethtool_ops_group0, ldvarg2); ldv_state_variable_4 = 1; } else { } goto ldv_54058; case 7: ; if (ldv_state_variable_4 == 1) { nes_netdev_get_strings(nes_ethtool_ops_group0, ldvarg1, ldvarg0); ldv_state_variable_4 = 1; } else { } goto ldv_54058; case 8: ; if (ldv_state_variable_4 == 1) { nes_netdev_set_settings(nes_ethtool_ops_group0, nes_ethtool_ops_group3); ldv_state_variable_4 = 1; } else { } goto ldv_54058; case 9: ; if (ldv_state_variable_4 == 1) { nes_netdev_get_settings(nes_ethtool_ops_group0, nes_ethtool_ops_group3); ldv_state_variable_4 = 1; } else { } goto ldv_54058; default: ; goto ldv_54058; } ldv_54058: ; return; } } void ldv_main_exported_5(void) { int tmp ; { tmp = __VERIFIER_nondet_int(); switch (tmp) { case 0: ; if (ldv_state_variable_5 == 1) { nes_set_features(ldvarg22, ldvarg23); ldv_state_variable_5 = 1; } else { } if (ldv_state_variable_5 == 3) { nes_set_features(ldvarg22, ldvarg23); ldv_state_variable_5 = 3; } else { } if (ldv_state_variable_5 == 2) { nes_set_features(ldvarg22, ldvarg23); ldv_state_variable_5 = 2; } else { } goto ldv_54073; case 1: ; if (ldv_state_variable_5 == 1) { nes_fix_features(ldvarg20, ldvarg21); ldv_state_variable_5 = 1; } else { } if (ldv_state_variable_5 == 3) { nes_fix_features(ldvarg20, ldvarg21); ldv_state_variable_5 = 3; } else { } if (ldv_state_variable_5 == 2) { nes_fix_features(ldvarg20, ldvarg21); ldv_state_variable_5 = 2; } else { } goto ldv_54073; case 2: ; if (ldv_state_variable_5 == 3) { nes_netdev_change_mtu(net_device_ops_group1, ldvarg19); ldv_state_variable_5 = 3; } else { } if (ldv_state_variable_5 == 2) { nes_netdev_change_mtu(net_device_ops_group1, ldvarg19); ldv_state_variable_5 = 2; } else { } goto ldv_54073; case 3: ; if (ldv_state_variable_5 == 1) { nes_netdev_set_multicast_list(ldvarg18); ldv_state_variable_5 = 1; } else { } if (ldv_state_variable_5 == 3) { nes_netdev_set_multicast_list(ldvarg18); ldv_state_variable_5 = 3; } else { } if (ldv_state_variable_5 == 2) { nes_netdev_set_multicast_list(ldvarg18); ldv_state_variable_5 = 2; } else { } goto ldv_54073; case 4: ; if (ldv_state_variable_5 == 1) { nes_netdev_set_mac_address(ldvarg16, ldvarg17); ldv_state_variable_5 = 1; } else { } if (ldv_state_variable_5 == 3) { nes_netdev_set_mac_address(ldvarg16, ldvarg17); ldv_state_variable_5 = 3; } else { } if (ldv_state_variable_5 == 2) { nes_netdev_set_mac_address(ldvarg16, ldvarg17); ldv_state_variable_5 = 2; } else { } goto ldv_54073; case 5: ; if (ldv_state_variable_5 == 1) { nes_netdev_tx_timeout(ldvarg15); ldv_state_variable_5 = 1; } else { } if (ldv_state_variable_5 == 3) { nes_netdev_tx_timeout(ldvarg15); ldv_state_variable_5 = 3; } else { } if (ldv_state_variable_5 == 2) { nes_netdev_tx_timeout(ldvarg15); ldv_state_variable_5 = 2; } else { } goto ldv_54073; case 6: ; if (ldv_state_variable_5 == 1) { nes_netdev_get_stats(ldvarg14); ldv_state_variable_5 = 1; } else { } if (ldv_state_variable_5 == 3) { nes_netdev_get_stats(ldvarg14); ldv_state_variable_5 = 3; } else { } if (ldv_state_variable_5 == 2) { nes_netdev_get_stats(ldvarg14); ldv_state_variable_5 = 2; } else { } goto ldv_54073; case 7: ; if (ldv_state_variable_5 == 3) { nes_netdev_start_xmit(ldvarg13, net_device_ops_group1); ldv_state_variable_5 = 3; } else { } goto ldv_54073; case 8: ; if (ldv_state_variable_5 == 3) { nes_netdev_stop(net_device_ops_group1); ldv_state_variable_5 = 2; } else { } goto ldv_54073; case 9: ; if (ldv_state_variable_5 == 2) { ldv_retval_nes_netdev_open = nes_netdev_open(net_device_ops_group1); if (ldv_retval_nes_netdev_open == 0) { ldv_state_variable_5 = 3; } else { } } else { } goto ldv_54073; case 10: ; if (ldv_state_variable_5 == 1) { ldv_retval_ldv_nes_netdev_ops_ndo_init = ldv_nes_netdev_ops_ndo_init(); if (ldv_retval_ldv_nes_netdev_ops_ndo_init == 0) { ldv_state_variable_5 = 2; ref_cnt = ref_cnt + 1; } else { } } else { } goto ldv_54073; case 11: ; if (ldv_state_variable_5 == 3) { ldv_nes_netdev_ops_ndo_uninit(); ldv_state_variable_5 = 1; ref_cnt = ref_cnt - 1; } else { } if (ldv_state_variable_5 == 2) { ldv_nes_netdev_ops_ndo_uninit(); ldv_state_variable_5 = 1; ref_cnt = ref_cnt - 1; } else { } goto ldv_54073; default: ; goto ldv_54073; } ldv_54073: ; return; } } void ldv_mutex_lock_35(struct mutex *ldv_func_arg1 ) { { ldv_mutex_lock_lock(ldv_func_arg1); mutex_lock(ldv_func_arg1); return; } } void ldv_mutex_unlock_36(struct mutex *ldv_func_arg1 ) { { ldv_mutex_unlock_lock(ldv_func_arg1); mutex_unlock(ldv_func_arg1); return; } } void ldv_mutex_lock_37(struct mutex *ldv_func_arg1 ) { { ldv_mutex_lock_mutex_of_device(ldv_func_arg1); mutex_lock(ldv_func_arg1); return; } } int ldv_mutex_trylock_38(struct mutex *ldv_func_arg1 ) { ldv_func_ret_type___2 ldv_func_res ; int tmp ; int tmp___0 ; { tmp = mutex_trylock(ldv_func_arg1); ldv_func_res = tmp; tmp___0 = ldv_mutex_trylock_mutex_of_device(ldv_func_arg1); return (tmp___0); return (ldv_func_res); } } void ldv_mutex_unlock_39(struct mutex *ldv_func_arg1 ) { { ldv_mutex_unlock_mutex_of_device(ldv_func_arg1); mutex_unlock(ldv_func_arg1); return; } } void ldv_mutex_lock_40(struct mutex *ldv_func_arg1 ) { { ldv_mutex_lock_cred_guard_mutex_of_signal_struct(ldv_func_arg1); mutex_lock(ldv_func_arg1); return; } } void ldv_mutex_unlock_41(struct mutex *ldv_func_arg1 ) { { ldv_mutex_unlock_cred_guard_mutex_of_signal_struct(ldv_func_arg1); mutex_unlock(ldv_func_arg1); return; } } void ldv_free_netdev_42(struct net_device *dev ) { { free_netdev(dev); ldv_state_variable_5 = 0; return; } } extern unsigned long find_next_zero_bit(unsigned long const * , unsigned long , unsigned long ) ; extern unsigned long find_first_zero_bit(unsigned long const * , unsigned long ) ; int ldv_mutex_trylock_54(struct mutex *ldv_func_arg1 ) ; void ldv_mutex_unlock_52(struct mutex *ldv_func_arg1 ) ; void ldv_mutex_unlock_55(struct mutex *ldv_func_arg1 ) ; void ldv_mutex_unlock_57(struct mutex *ldv_func_arg1 ) ; void ldv_mutex_lock_51(struct mutex *ldv_func_arg1 ) ; void ldv_mutex_lock_53(struct mutex *ldv_func_arg1 ) ; void ldv_mutex_lock_56(struct mutex *ldv_func_arg1 ) ; __inline static unsigned short readw(void const volatile *addr ) { unsigned short ret ; { __asm__ volatile ("movw %1,%0": "=r" (ret): "m" (*((unsigned short volatile *)addr)): "memory"); return (ret); } } u32 mh_detected ; u32 mh_pauses_sent ; __inline static int nes_alloc_resource(struct nes_adapter *nesadapter , unsigned long *resource_array , u32 max_resources , u32 *req_resource_num , u32 *next , enum nes_resource resource_type___0 ) { unsigned long flags ; u32 resource_num ; raw_spinlock_t *tmp ; unsigned long tmp___0 ; unsigned long tmp___1 ; { tmp = spinlock_check(& nesadapter->resource_lock); flags = _raw_spin_lock_irqsave(tmp); tmp___0 = find_next_zero_bit((unsigned long const *)resource_array, (unsigned long )max_resources, (unsigned long )*next); resource_num = (u32 )tmp___0; if (resource_num >= max_resources) { tmp___1 = find_first_zero_bit((unsigned long const *)resource_array, (unsigned long )max_resources); resource_num = (u32 )tmp___1; if (resource_num >= max_resources) { printk("\viw_nes: %s: No available resources [type=%u].\n", "nes_alloc_resource", (unsigned int )resource_type___0); spin_unlock_irqrestore(& nesadapter->resource_lock, flags); return (-24); } else { } } else { } set_bit(resource_num, (unsigned long volatile *)resource_array); *next = resource_num + 1U; if (*next == max_resources) { *next = 0U; } else { } spin_unlock_irqrestore(& nesadapter->resource_lock, flags); *req_resource_num = resource_num; return (0); } } void nes_dump_mem(unsigned int dump_debug_level , void *addr , int length ) ; static u16 nes_read16_eeprom(void *addr , u16 offset ) ; static u32 nes_set_pau(struct nes_device *nesdev ) { u32 ret ; u32 counter ; u32 tmp ; { ret = 0U; nes_write_indexed(nesdev, 268U, 117440513U); nes_write_indexed(nesdev, 188U, 1U); counter = 0U; goto ldv_53652; ldv_53651: __const_udelay(128850UL); tmp = nes_read_indexed(nesdev, 268U); if (tmp == 0U) { printk("\016iw_nes: PAU is supported.\n"); goto ldv_53650; } else { } nes_write_indexed(nesdev, 188U, 1U); counter = counter + 1U; ldv_53652: ; if (counter <= 9U) { goto ldv_53651; } else { goto ldv_53650; } ldv_53650: ; if (counter == 10U) { printk("\016iw_nes: PAU is not supported.\n"); return (4294967295U); } else { } return (ret); } } int nes_read_eeprom_values(struct nes_device *nesdev , struct nes_adapter *nesadapter ) { u32 mac_addr_low ; u16 mac_addr_high ; u16 eeprom_data ; u16 eeprom_offset ; u16 next_section_address ; u16 sw_section_ver ; u8 major_ver ; u8 minor_ver ; u32 tmp ; u16 tmp___0 ; u16 tmp___1 ; u16 tmp___2 ; u16 tmp___3 ; u16 tmp___4 ; u16 tmp___5 ; u16 tmp___6 ; u16 tmp___7 ; u16 tmp___8 ; u16 tmp___9 ; u16 tmp___10 ; u16 tmp___11 ; u16 tmp___12 ; { major_ver = 0U; minor_ver = 0U; if ((unsigned int )nesadapter->firmware_eeprom_offset == 0U) { eeprom_data = nes_read16_eeprom(nesdev->regs, 0); if ((int )nes_debug_level & 1) { printk("\viw_nes: %s[%u]: EEPROM Offset 0 = 0x%04X\n", "nes_read_eeprom_values", 140, (int )eeprom_data); } else { } eeprom_offset = (unsigned int )((u16 )((((int )eeprom_data & 127) << 3) << (((int )eeprom_data & 128) >> 7))) + 2U; if ((int )nes_debug_level & 1) { printk("\viw_nes: %s[%u]: Firmware Offset = 0x%04X\n", "nes_read_eeprom_values", 143, (int )eeprom_offset); } else { } nesadapter->firmware_eeprom_offset = eeprom_offset; eeprom_data = nes_read16_eeprom(nesdev->regs, (int )((unsigned int )eeprom_offset + 4U)); if ((unsigned int )eeprom_data != 22342U) { if ((int )nes_debug_level & 1) { printk("\viw_nes: %s[%u]: Not a valid Firmware Image = 0x%04X\n", "nes_read_eeprom_values", 147, (int )eeprom_data); } else { } return (-1); } else { } eeprom_data = nes_read16_eeprom(nesdev->regs, (int )((unsigned int )eeprom_offset + 2U)); if ((int )nes_debug_level & 1) { printk("\viw_nes: %s[%u]: EEPROM Offset %u = 0x%04X\n", "nes_read_eeprom_values", 153, (int )eeprom_offset + 2, (int )eeprom_data); } else { } eeprom_offset = (int )((u16 )((((int )eeprom_data & 255) << 3) << (((int )eeprom_data & 256) >> 8))) + (int )eeprom_offset; if ((int )nes_debug_level & 1) { printk("\viw_nes: %s[%u]: Software Offset = 0x%04X\n", "nes_read_eeprom_values", 155, (int )eeprom_offset); } else { } nesadapter->software_eeprom_offset = eeprom_offset; eeprom_data = nes_read16_eeprom(nesdev->regs, (int )((unsigned int )eeprom_offset + 4U)); if ((unsigned int )eeprom_data != 22355U) { printk("Not a valid Software Image = 0x%04X\n", (int )eeprom_data); return (-1); } else { } sw_section_ver = nes_read16_eeprom(nesdev->regs, (int )((unsigned int )nesadapter->software_eeprom_offset + 6U)); if ((int )nes_debug_level & 1) { printk("\viw_nes: %s[%u]: Software section version number = 0x%04X\n", "nes_read_eeprom_values", 164, (int )sw_section_ver); } else { } eeprom_data = nes_read16_eeprom(nesdev->regs, (int )((unsigned int )eeprom_offset + 2U)); if ((int )nes_debug_level & 1) { printk("\viw_nes: %s[%u]: EEPROM Offset %u (next section) = 0x%04X\n", "nes_read_eeprom_values", 168, (int )eeprom_offset + 2, (int )eeprom_data); } else { } next_section_address = (int )((u16 )((((int )eeprom_data & 255) << 3) << (((int )eeprom_data & 256) >> 8))) + (int )eeprom_offset; eeprom_data = nes_read16_eeprom(nesdev->regs, (int )((unsigned int )next_section_address + 4U)); if ((unsigned int )eeprom_data != 16717U) { if ((int )nes_debug_level & 1) { printk("\viw_nes: %s[%u]: EEPROM Changed offset should be 0x414d but was 0x%04X\n", "nes_read_eeprom_values", 174, (int )eeprom_data); } else { } goto no_fw_rev; } else { } eeprom_offset = next_section_address; eeprom_data = nes_read16_eeprom(nesdev->regs, (int )((unsigned int )eeprom_offset + 2U)); if ((int )nes_debug_level & 1) { printk("\viw_nes: %s[%u]: EEPROM Offset %u (next section) = 0x%04X\n", "nes_read_eeprom_values", 181, (int )eeprom_offset + 2, (int )eeprom_data); } else { } next_section_address = (int )((u16 )((((int )eeprom_data & 255) << 3) << (((int )eeprom_data & 256) >> 8))) + (int )eeprom_offset; eeprom_data = nes_read16_eeprom(nesdev->regs, (int )((unsigned int )next_section_address + 4U)); if ((unsigned int )eeprom_data != 20306U) { if ((int )nes_debug_level & 1) { printk("\viw_nes: %s[%u]: EEPROM Changed offset should be 0x4f52 but was 0x%04X\n", "nes_read_eeprom_values", 187, (int )eeprom_data); } else { } goto no_fw_rev; } else { } eeprom_offset = next_section_address; eeprom_data = nes_read16_eeprom(nesdev->regs, (int )((unsigned int )eeprom_offset + 2U)); if ((int )nes_debug_level & 1) { printk("\viw_nes: %s[%u]: EEPROM Offset %u (next section) = 0x%04X\n", "nes_read_eeprom_values", 194, (int )eeprom_offset + 2, (int )eeprom_data); } else { } next_section_address = (((unsigned int )eeprom_data & 255U) << 3U) + (unsigned int )eeprom_offset; eeprom_data = nes_read16_eeprom(nesdev->regs, (int )((unsigned int )next_section_address + 4U)); if ((unsigned int )eeprom_data != 22342U) { if ((int )nes_debug_level & 1) { printk("\viw_nes: %s[%u]: EEPROM Changed offset should be 0x5746 but was 0x%04X\n", "nes_read_eeprom_values", 199, (int )eeprom_data); } else { } goto no_fw_rev; } else { } eeprom_offset = next_section_address; eeprom_data = nes_read16_eeprom(nesdev->regs, (int )((unsigned int )eeprom_offset + 2U)); if ((int )nes_debug_level & 1) { printk("\viw_nes: %s[%u]: EEPROM Offset %u (next section) = 0x%04X\n", "nes_read_eeprom_values", 206, (int )eeprom_offset + 2, (int )eeprom_data); } else { } next_section_address = (((unsigned int )eeprom_data & 255U) << 3U) + (unsigned int )eeprom_offset; eeprom_data = nes_read16_eeprom(nesdev->regs, (int )((unsigned int )next_section_address + 4U)); if ((unsigned int )eeprom_data != 22355U) { if ((int )nes_debug_level & 1) { printk("\viw_nes: %s[%u]: EEPROM Changed offset should be 0x5753 but was 0x%04X\n", "nes_read_eeprom_values", 211, (int )eeprom_data); } else { } goto no_fw_rev; } else { } eeprom_offset = next_section_address; eeprom_data = nes_read16_eeprom(nesdev->regs, (int )((unsigned int )eeprom_offset + 2U)); if ((int )nes_debug_level & 1) { printk("\viw_nes: %s[%u]: EEPROM Offset %u (next section) = 0x%04X\n", "nes_read_eeprom_values", 218, (int )eeprom_offset + 2, (int )eeprom_data); } else { } next_section_address = (((unsigned int )eeprom_data & 255U) << 3U) + (unsigned int )eeprom_offset; eeprom_data = nes_read16_eeprom(nesdev->regs, (int )((unsigned int )next_section_address + 4U)); if ((unsigned int )eeprom_data != 16717U) { if ((int )nes_debug_level & 1) { printk("\viw_nes: %s[%u]: EEPROM Changed offset should be 0x414d but was 0x%04X\n", "nes_read_eeprom_values", 223, (int )eeprom_data); } else { } goto no_fw_rev; } else { } eeprom_offset = next_section_address; eeprom_data = nes_read16_eeprom(nesdev->regs, (int )((unsigned int )eeprom_offset + 2U)); if ((int )nes_debug_level & 1) { printk("\viw_nes: %s[%u]: EEPROM Offset %u (next section) = 0x%04X\n", "nes_read_eeprom_values", 230, (int )eeprom_offset + 2, (int )eeprom_data); } else { } next_section_address = (((unsigned int )eeprom_data & 255U) << 3U) + (unsigned int )eeprom_offset; eeprom_data = nes_read16_eeprom(nesdev->regs, (int )((unsigned int )next_section_address + 4U)); if ((unsigned int )eeprom_data != 17998U) { if ((int )nes_debug_level & 1) { printk("\viw_nes: %s[%u]: EEPROM Changed offset should be 0x464e but was 0x%04X\n", "nes_read_eeprom_values", 235, (int )eeprom_data); } else { } goto no_fw_rev; } else { } eeprom_data = nes_read16_eeprom(nesdev->regs, (int )((unsigned int )next_section_address + 8U)); printk("iw_nes: Firmware version %u.%u\n", (int )((unsigned char )((int )eeprom_data >> 8)), (int )((unsigned char )eeprom_data)); major_ver = (unsigned char )((int )eeprom_data >> 8); minor_ver = (unsigned char )eeprom_data; if ((nes_drv_opt & 512U) != 0U) { if ((int )nes_debug_level & 1) { printk("\viw_nes: %s[%u]: Virtual WQs have been disabled\n", "nes_read_eeprom_values", 244); } else { } } else if (((unsigned int )major_ver == 2U && (unsigned int )minor_ver > 21U) || ((unsigned int )major_ver > 2U && (unsigned int )major_ver != 255U)) { nesadapter->virtwq = 1U; } else { } if (((unsigned int )major_ver == 3U && (unsigned int )minor_ver > 15U) || (unsigned int )major_ver > 3U) { nesadapter->send_term_ok = 1U; } else { } if ((nes_drv_opt & 1024U) != 0U) { tmp = nes_set_pau(nesdev); if (tmp == 0U) { nesadapter->allow_unaligned_fpdus = 1U; } else { } } else { } nesadapter->firmware_version = ((unsigned int )((unsigned char )((int )eeprom_data >> 8)) << 16) + (unsigned int )((unsigned char )eeprom_data); eeprom_data = nes_read16_eeprom(nesdev->regs, (int )((unsigned int )next_section_address + 10U)); printk("iw_nes: EEPROM version %u.%u\n", (int )((unsigned char )((int )eeprom_data >> 8)), (int )((unsigned char )eeprom_data)); nesadapter->eeprom_version = ((unsigned int )((unsigned char )((int )eeprom_data >> 8)) << 16) + (unsigned int )((unsigned char )eeprom_data); no_fw_rev: eeprom_offset = nesadapter->software_eeprom_offset; eeprom_offset = (unsigned int )eeprom_offset + 8U; tmp___0 = nes_read16_eeprom(nesdev->regs, (int )eeprom_offset); nesadapter->netdev_max = (unsigned char )tmp___0; eeprom_offset = (unsigned int )eeprom_offset + 2U; mac_addr_high = nes_read16_eeprom(nesdev->regs, (int )eeprom_offset); eeprom_offset = (unsigned int )eeprom_offset + 2U; tmp___1 = nes_read16_eeprom(nesdev->regs, (int )eeprom_offset); mac_addr_low = (unsigned int )tmp___1; eeprom_offset = (unsigned int )eeprom_offset + 2U; mac_addr_low = mac_addr_low << 16; tmp___2 = nes_read16_eeprom(nesdev->regs, (int )eeprom_offset); mac_addr_low = (u32 )tmp___2 + mac_addr_low; if ((int )nes_debug_level & 1) { printk("\viw_nes: %s[%u]: Base MAC Address = 0x%04X%08X\n", "nes_read_eeprom_values", 277, (int )mac_addr_high, mac_addr_low); } else { } if ((int )nes_debug_level & 1) { printk("\viw_nes: %s[%u]: MAC Address count = %u\n", "nes_read_eeprom_values", 278, (int )nesadapter->netdev_max); } else { } nesadapter->mac_addr_low = mac_addr_low; nesadapter->mac_addr_high = mac_addr_high; eeprom_offset = (unsigned int )eeprom_offset + 10U; eeprom_data = nes_read16_eeprom(nesdev->regs, (int )eeprom_offset); nesadapter->phy_type[0] = (unsigned char )((int )eeprom_data >> 8); nesadapter->phy_type[1] = (unsigned char )eeprom_data; eeprom_offset = (unsigned int )eeprom_offset + 2U; eeprom_data = nes_read16_eeprom(nesdev->regs, (int )eeprom_offset); nesadapter->phy_type[2] = (unsigned char )((int )eeprom_data >> 8); nesadapter->phy_type[3] = (unsigned char )eeprom_data; if ((int )nes_debug_level & 1) { printk("\viw_nes: %s[%u]: port_count = %u, port 0 -> %u, port 1 -> %u, port 2 -> %u, port 3 -> %u\n", "nes_read_eeprom_values", 299, (int )nesadapter->port_count, (int )nesadapter->phy_type[0], (int )nesadapter->phy_type[1], (int )nesadapter->phy_type[2], (int )nesadapter->phy_type[3]); } else { } eeprom_offset = (unsigned int )eeprom_offset + 10U; eeprom_data = nes_read16_eeprom(nesdev->regs, (int )eeprom_offset); nesadapter->pd_config_size[0] = eeprom_data; eeprom_offset = (unsigned int )eeprom_offset + 2U; eeprom_data = nes_read16_eeprom(nesdev->regs, (int )eeprom_offset); nesadapter->pd_config_base[0] = eeprom_data; if ((int )nes_debug_level & 1) { printk("\viw_nes: %s[%u]: PD0 config, size=0x%04x, base=0x%04x\n", "nes_read_eeprom_values", 309, (int )nesadapter->pd_config_size[0], (int )nesadapter->pd_config_base[0]); } else { } eeprom_offset = (unsigned int )eeprom_offset + 2U; eeprom_data = nes_read16_eeprom(nesdev->regs, (int )eeprom_offset); nesadapter->pd_config_size[1] = eeprom_data; eeprom_offset = (unsigned int )eeprom_offset + 2U; eeprom_data = nes_read16_eeprom(nesdev->regs, (int )eeprom_offset); nesadapter->pd_config_base[1] = eeprom_data; if ((int )nes_debug_level & 1) { printk("\viw_nes: %s[%u]: PD1 config, size=0x%04x, base=0x%04x\n", "nes_read_eeprom_values", 318, (int )nesadapter->pd_config_size[1], (int )nesadapter->pd_config_base[1]); } else { } eeprom_offset = (unsigned int )eeprom_offset + 2U; eeprom_data = nes_read16_eeprom(nesdev->regs, (int )eeprom_offset); nesadapter->pd_config_size[2] = eeprom_data; eeprom_offset = (unsigned int )eeprom_offset + 2U; eeprom_data = nes_read16_eeprom(nesdev->regs, (int )eeprom_offset); nesadapter->pd_config_base[2] = eeprom_data; if ((int )nes_debug_level & 1) { printk("\viw_nes: %s[%u]: PD2 config, size=0x%04x, base=0x%04x\n", "nes_read_eeprom_values", 327, (int )nesadapter->pd_config_size[2], (int )nesadapter->pd_config_base[2]); } else { } eeprom_offset = (unsigned int )eeprom_offset + 2U; eeprom_data = nes_read16_eeprom(nesdev->regs, (int )eeprom_offset); nesadapter->pd_config_size[3] = eeprom_data; eeprom_offset = (unsigned int )eeprom_offset + 2U; eeprom_data = nes_read16_eeprom(nesdev->regs, (int )eeprom_offset); nesadapter->pd_config_base[3] = eeprom_data; if ((int )nes_debug_level & 1) { printk("\viw_nes: %s[%u]: PD3 config, size=0x%04x, base=0x%04x\n", "nes_read_eeprom_values", 336, (int )nesadapter->pd_config_size[3], (int )nesadapter->pd_config_base[3]); } else { } eeprom_offset = (unsigned int )eeprom_offset + 22U; eeprom_data = nes_read16_eeprom(nesdev->regs, (int )eeprom_offset); eeprom_offset = (unsigned int )eeprom_offset + 2U; tmp___3 = nes_read16_eeprom(nesdev->regs, (int )eeprom_offset); nesadapter->rx_pool_size = ((unsigned int )eeprom_data << 16) + (unsigned int )tmp___3; if ((int )nes_debug_level & 1) { printk("\viw_nes: %s[%u]: rx_pool_size = 0x%08X\n", "nes_read_eeprom_values", 344, nesadapter->rx_pool_size); } else { } eeprom_offset = (unsigned int )eeprom_offset + 2U; eeprom_data = nes_read16_eeprom(nesdev->regs, (int )eeprom_offset); eeprom_offset = (unsigned int )eeprom_offset + 2U; tmp___4 = nes_read16_eeprom(nesdev->regs, (int )eeprom_offset); nesadapter->tx_pool_size = ((unsigned int )eeprom_data << 16) + (unsigned int )tmp___4; if ((int )nes_debug_level & 1) { printk("\viw_nes: %s[%u]: tx_pool_size = 0x%08X\n", "nes_read_eeprom_values", 351, nesadapter->tx_pool_size); } else { } eeprom_offset = (unsigned int )eeprom_offset + 2U; eeprom_data = nes_read16_eeprom(nesdev->regs, (int )eeprom_offset); eeprom_offset = (unsigned int )eeprom_offset + 2U; tmp___5 = nes_read16_eeprom(nesdev->regs, (int )eeprom_offset); nesadapter->rx_threshold = ((unsigned int )eeprom_data << 16) + (unsigned int )tmp___5; if ((int )nes_debug_level & 1) { printk("\viw_nes: %s[%u]: rx_threshold = 0x%08X\n", "nes_read_eeprom_values", 358, nesadapter->rx_threshold); } else { } eeprom_offset = (unsigned int )eeprom_offset + 2U; eeprom_data = nes_read16_eeprom(nesdev->regs, (int )eeprom_offset); eeprom_offset = (unsigned int )eeprom_offset + 2U; tmp___6 = nes_read16_eeprom(nesdev->regs, (int )eeprom_offset); nesadapter->tcp_timer_core_clk_divisor = ((unsigned int )eeprom_data << 16) + (unsigned int )tmp___6; if ((int )nes_debug_level & 1) { printk("\viw_nes: %s[%u]: tcp_timer_core_clk_divisor = 0x%08X\n", "nes_read_eeprom_values", 366, nesadapter->tcp_timer_core_clk_divisor); } else { } eeprom_offset = (unsigned int )eeprom_offset + 2U; eeprom_data = nes_read16_eeprom(nesdev->regs, (int )eeprom_offset); eeprom_offset = (unsigned int )eeprom_offset + 2U; tmp___7 = nes_read16_eeprom(nesdev->regs, (int )eeprom_offset); nesadapter->iwarp_config = ((unsigned int )eeprom_data << 16) + (unsigned int )tmp___7; if ((int )nes_debug_level & 1) { printk("\viw_nes: %s[%u]: iwarp_config = 0x%08X\n", "nes_read_eeprom_values", 373, nesadapter->iwarp_config); } else { } eeprom_offset = (unsigned int )eeprom_offset + 2U; eeprom_data = nes_read16_eeprom(nesdev->regs, (int )eeprom_offset); eeprom_offset = (unsigned int )eeprom_offset + 2U; tmp___8 = nes_read16_eeprom(nesdev->regs, (int )eeprom_offset); nesadapter->cm_config = ((unsigned int )eeprom_data << 16) + (unsigned int )tmp___8; if ((int )nes_debug_level & 1) { printk("\viw_nes: %s[%u]: cm_config = 0x%08X\n", "nes_read_eeprom_values", 380, nesadapter->cm_config); } else { } eeprom_offset = (unsigned int )eeprom_offset + 2U; eeprom_data = nes_read16_eeprom(nesdev->regs, (int )eeprom_offset); eeprom_offset = (unsigned int )eeprom_offset + 2U; tmp___9 = nes_read16_eeprom(nesdev->regs, (int )eeprom_offset); nesadapter->sws_timer_config = ((unsigned int )eeprom_data << 16) + (unsigned int )tmp___9; if ((int )nes_debug_level & 1) { printk("\viw_nes: %s[%u]: sws_timer_config = 0x%08X\n", "nes_read_eeprom_values", 387, nesadapter->sws_timer_config); } else { } eeprom_offset = (unsigned int )eeprom_offset + 2U; eeprom_data = nes_read16_eeprom(nesdev->regs, (int )eeprom_offset); eeprom_offset = (unsigned int )eeprom_offset + 2U; tmp___10 = nes_read16_eeprom(nesdev->regs, (int )eeprom_offset); nesadapter->tcp_config1 = ((unsigned int )eeprom_data << 16) + (unsigned int )tmp___10; if ((int )nes_debug_level & 1) { printk("\viw_nes: %s[%u]: tcp_config1 = 0x%08X\n", "nes_read_eeprom_values", 394, nesadapter->tcp_config1); } else { } eeprom_offset = (unsigned int )eeprom_offset + 2U; eeprom_data = nes_read16_eeprom(nesdev->regs, (int )eeprom_offset); eeprom_offset = (unsigned int )eeprom_offset + 2U; tmp___11 = nes_read16_eeprom(nesdev->regs, (int )eeprom_offset); nesadapter->wqm_wat = ((unsigned int )eeprom_data << 16) + (unsigned int )tmp___11; if ((int )nes_debug_level & 1) { printk("\viw_nes: %s[%u]: wqm_wat = 0x%08X\n", "nes_read_eeprom_values", 401, nesadapter->wqm_wat); } else { } eeprom_offset = (unsigned int )eeprom_offset + 2U; eeprom_data = nes_read16_eeprom(nesdev->regs, (int )eeprom_offset); eeprom_offset = (unsigned int )eeprom_offset + 2U; tmp___12 = nes_read16_eeprom(nesdev->regs, (int )eeprom_offset); nesadapter->core_clock = ((unsigned int )eeprom_data << 16) + (unsigned int )tmp___12; if ((int )nes_debug_level & 1) { printk("\viw_nes: %s[%u]: core_clock = 0x%08X\n", "nes_read_eeprom_values", 408, nesadapter->core_clock); } else { } if ((unsigned int )sw_section_ver != 0U && nesadapter->hw_rev != 4U) { eeprom_offset = (unsigned int )eeprom_offset + 2U; eeprom_data = nes_read16_eeprom(nesdev->regs, (int )eeprom_offset); nesadapter->phy_index[0] = (u8 )((int )eeprom_data >> 8); nesadapter->phy_index[1] = (u8 )eeprom_data; eeprom_offset = (unsigned int )eeprom_offset + 2U; eeprom_data = nes_read16_eeprom(nesdev->regs, (int )eeprom_offset); nesadapter->phy_index[2] = (u8 )((int )eeprom_data >> 8); nesadapter->phy_index[3] = (u8 )eeprom_data; } else { nesadapter->phy_index[0] = 4U; nesadapter->phy_index[1] = 5U; nesadapter->phy_index[2] = 6U; nesadapter->phy_index[3] = 7U; } if ((int )nes_debug_level & 1) { printk("\viw_nes: %s[%u]: Phy address map = 0 > %u, 1 > %u, 2 > %u, 3 > %u\n", "nes_read_eeprom_values", 427, (int )nesadapter->phy_index[0], (int )nesadapter->phy_index[1], (int )nesadapter->phy_index[2], (int )nesadapter->phy_index[3]); } else { } } else { } return (0); } } static u16 nes_read16_eeprom(void *addr , u16 offset ) { unsigned int tmp ; unsigned short tmp___0 ; { writel((unsigned int )(((int )offset >> 1) + 65536), (void volatile *)addr + 32U); ldv_53671: tmp = readl((void const volatile *)addr + 32U); if ((tmp & 65536U) != 0U) { goto ldv_53671; } else { goto ldv_53672; } ldv_53672: tmp___0 = readw((void const volatile *)addr + 36U); return (tmp___0); } } void nes_write_1G_phy_reg(struct nes_device *nesdev , u8 phy_reg , u8 phy_addr , u16 data ) { u32 u32temp ; u32 counter ; { nes_write_indexed(nesdev, 8324U, (((unsigned int )data | ((unsigned int )phy_reg << 18)) | ((unsigned int )phy_addr << 23)) | 1342308352U); counter = 0U; goto ldv_53683; ldv_53682: __const_udelay(128850UL); u32temp = nes_read_indexed(nesdev, 8688U); if ((int )u32temp & 1) { nes_write_indexed(nesdev, 8688U, 1U); goto ldv_53681; } else { } counter = counter + 1U; ldv_53683: ; if (counter <= 99U) { goto ldv_53682; } else { goto ldv_53681; } ldv_53681: ; if ((u32temp & 1U) == 0U) { if ((nes_debug_level & 8U) != 0U) { printk("\viw_nes: %s[%u]: Phy is not responding. interrupt status = 0x%X.\n", "nes_write_1G_phy_reg", 471, u32temp); } else { } } else { } return; } } void nes_read_1G_phy_reg(struct nes_device *nesdev , u8 phy_reg , u8 phy_addr , u16 *data ) { u32 u32temp ; u32 counter ; u32 tmp ; { nes_write_indexed(nesdev, 8324U, (((unsigned int )phy_reg << 18) | ((unsigned int )phy_addr << 23)) | 1610743808U); counter = 0U; goto ldv_53695; ldv_53694: __const_udelay(128850UL); u32temp = nes_read_indexed(nesdev, 8688U); if ((int )u32temp & 1) { nes_write_indexed(nesdev, 8688U, 1U); goto ldv_53693; } else { } counter = counter + 1U; ldv_53695: ; if (counter <= 99U) { goto ldv_53694; } else { goto ldv_53693; } ldv_53693: ; if ((u32temp & 1U) == 0U) { if ((nes_debug_level & 8U) != 0U) { printk("\viw_nes: %s[%u]: Phy is not responding. interrupt status = 0x%X.\n", "nes_read_1G_phy_reg", 501, u32temp); } else { } *data = 65535U; } else { tmp = nes_read_indexed(nesdev, 8324U); *data = (unsigned short )tmp; } return; } } void nes_write_10G_phy_reg(struct nes_device *nesdev , u16 phy_addr , u8 dev_addr , u16 phy_reg , u16 data ) { u32 port_addr ; u32 u32temp ; u32 counter ; { port_addr = (u32 )phy_addr; nes_write_indexed(nesdev, 8324U, (((unsigned int )phy_reg | ((unsigned int )dev_addr << 18)) | (port_addr << 23)) | 131072U); counter = 0U; goto ldv_53709; ldv_53708: __const_udelay(128850UL); u32temp = nes_read_indexed(nesdev, 8688U); if ((int )u32temp & 1) { nes_write_indexed(nesdev, 8688U, 1U); goto ldv_53707; } else { } counter = counter + 1U; ldv_53709: ; if (counter <= 99U) { goto ldv_53708; } else { goto ldv_53707; } ldv_53707: ; if ((u32temp & 1U) == 0U) { if ((nes_debug_level & 8U) != 0U) { printk("\viw_nes: %s[%u]: Phy is not responding. interrupt status = 0x%X.\n", "nes_write_10G_phy_reg", 534, u32temp); } else { } } else { } nes_write_indexed(nesdev, 8324U, (((unsigned int )data | ((unsigned int )dev_addr << 18)) | (port_addr << 23)) | 268566528U); counter = 0U; goto ldv_53713; ldv_53712: __const_udelay(128850UL); u32temp = nes_read_indexed(nesdev, 8688U); if ((int )u32temp & 1) { nes_write_indexed(nesdev, 8688U, 1U); goto ldv_53711; } else { } counter = counter + 1U; ldv_53713: ; if (counter <= 99U) { goto ldv_53712; } else { goto ldv_53711; } ldv_53711: ; if ((u32temp & 1U) == 0U) { if ((nes_debug_level & 8U) != 0U) { printk("\viw_nes: %s[%u]: Phy is not responding. interrupt status = 0x%X.\n", "nes_write_10G_phy_reg", 549, u32temp); } else { } } else { } return; } } void nes_read_10G_phy_reg(struct nes_device *nesdev , u8 phy_addr , u8 dev_addr , u16 phy_reg ) { u32 port_addr ; u32 u32temp ; u32 counter ; { port_addr = (u32 )phy_addr; nes_write_indexed(nesdev, 8324U, (((unsigned int )phy_reg | ((unsigned int )dev_addr << 18)) | (port_addr << 23)) | 131072U); counter = 0U; goto ldv_53725; ldv_53724: __const_udelay(128850UL); u32temp = nes_read_indexed(nesdev, 8688U); if ((int )u32temp & 1) { nes_write_indexed(nesdev, 8688U, 1U); goto ldv_53723; } else { } counter = counter + 1U; ldv_53725: ; if (counter <= 99U) { goto ldv_53724; } else { goto ldv_53723; } ldv_53723: ; if ((u32temp & 1U) == 0U) { if ((nes_debug_level & 8U) != 0U) { printk("\viw_nes: %s[%u]: Phy is not responding. interrupt status = 0x%X.\n", "nes_read_10G_phy_reg", 579, u32temp); } else { } } else { } nes_write_indexed(nesdev, 8324U, (((unsigned int )dev_addr << 18) | (port_addr << 23)) | 805437440U); counter = 0U; goto ldv_53729; ldv_53728: __const_udelay(128850UL); u32temp = nes_read_indexed(nesdev, 8688U); if ((int )u32temp & 1) { nes_write_indexed(nesdev, 8688U, 1U); goto ldv_53727; } else { } counter = counter + 1U; ldv_53729: ; if (counter <= 99U) { goto ldv_53728; } else { goto ldv_53727; } ldv_53727: ; if ((u32temp & 1U) == 0U) { if ((nes_debug_level & 8U) != 0U) { printk("\viw_nes: %s[%u]: Phy is not responding. interrupt status = 0x%X.\n", "nes_read_10G_phy_reg", 594, u32temp); } else { } } else { } return; } } struct nes_cqp_request *nes_get_cqp_request(struct nes_device *nesdev ) { unsigned long flags ; struct nes_cqp_request *cqp_request ; raw_spinlock_t *tmp ; struct list_head const *__mptr ; int tmp___0 ; int tmp___1 ; void *tmp___2 ; struct lock_class_key __key ; struct lock_class_key __key___0 ; { cqp_request = 0; tmp___1 = list_empty((struct list_head const *)(& nesdev->cqp_avail_reqs)); if (tmp___1 == 0) { tmp = spinlock_check(& nesdev->cqp.lock); flags = _raw_spin_lock_irqsave(tmp); tmp___0 = list_empty((struct list_head const *)(& nesdev->cqp_avail_reqs)); if (tmp___0 == 0) { __mptr = (struct list_head const *)nesdev->cqp_avail_reqs.next; cqp_request = (struct nes_cqp_request *)__mptr + 0xffffffffffffff60UL; list_del_init(& cqp_request->list); } else { } spin_unlock_irqrestore(& nesdev->cqp.lock, flags); } else { } if ((unsigned long )cqp_request == (unsigned long )((struct nes_cqp_request *)0)) { tmp___2 = kzalloc(200UL, 32U); cqp_request = (struct nes_cqp_request *)tmp___2; if ((unsigned long )cqp_request != (unsigned long )((struct nes_cqp_request *)0)) { cqp_request->dynamic = 1U; INIT_LIST_HEAD(& cqp_request->list); } else { } } else { } if ((unsigned long )cqp_request != (unsigned long )((struct nes_cqp_request *)0)) { __init_waitqueue_head(& cqp_request->waitq, "&cqp_request->waitq", & __key); cqp_request->waiting = 0U; cqp_request->request_done = 0U; cqp_request->callback = 0U; __init_waitqueue_head(& cqp_request->waitq, "&cqp_request->waitq", & __key___0); if ((nes_debug_level & 512U) != 0U) { printk("\viw_nes: %s[%u]: Got cqp request %p from the available list \n", "nes_get_cqp_request", 630, cqp_request); } else { } } else { printk("\viw_nes: %s: Could not allocated a CQP request.\n", "nes_get_cqp_request"); } return (cqp_request); } } void nes_free_cqp_request(struct nes_device *nesdev , struct nes_cqp_request *cqp_request ) { unsigned long flags ; raw_spinlock_t *tmp ; { if ((nes_debug_level & 512U) != 0U) { printk("\viw_nes: %s[%u]: CQP request %p (opcode 0x%02X) freed.\n", "nes_free_cqp_request", 645, cqp_request, cqp_request->cqp_wqe.wqe_words[0] & 63U); } else { } if ((unsigned int )cqp_request->dynamic != 0U) { kfree((void const *)cqp_request); } else { tmp = spinlock_check(& nesdev->cqp.lock); flags = _raw_spin_lock_irqsave(tmp); list_add_tail(& cqp_request->list, & nesdev->cqp_avail_reqs); spin_unlock_irqrestore(& nesdev->cqp.lock, flags); } return; } } void nes_put_cqp_request(struct nes_device *nesdev , struct nes_cqp_request *cqp_request ) { int tmp ; { tmp = atomic_dec_and_test(& cqp_request->refcount); if (tmp != 0) { nes_free_cqp_request(nesdev, cqp_request); } else { } return; } } void nes_post_cqp_request(struct nes_device *nesdev , struct nes_cqp_request *cqp_request ) { struct nes_hw_cqp_wqe *cqp_wqe ; unsigned long flags ; u32 cqp_head ; u64 u64temp ; u32 opcode ; int ctx_index ; raw_spinlock_t *tmp ; u16 tmp___0 ; size_t __len ; void *__ret ; int tmp___1 ; int tmp___2 ; { ctx_index = 2; tmp = spinlock_check(& nesdev->cqp.lock); flags = _raw_spin_lock_irqsave(tmp); if (((((int )nesdev->cqp.sq_tail + (int )nesdev->cqp.sq_size * 2) - (int )nesdev->cqp.sq_head) & ((int )nesdev->cqp.sq_size + -1)) != 1) { tmp___2 = list_empty((struct list_head const *)(& nesdev->cqp_pending_reqs)); if (tmp___2 != 0) { tmp___0 = nesdev->cqp.sq_head; nesdev->cqp.sq_head = (u16 )((int )nesdev->cqp.sq_head + 1); cqp_head = (u32 )tmp___0; nesdev->cqp.sq_head = (u16 )((int )((short )nesdev->cqp.sq_head) & (int )((short )((unsigned int )nesdev->cqp.sq_size + 65535U))); cqp_wqe = nesdev->cqp.sq_vbase + (unsigned long )cqp_head; __len = 64UL; if (__len > 63UL) { __ret = __memcpy((void *)cqp_wqe, (void const *)(& cqp_request->cqp_wqe), __len); } else { __ret = __builtin_memcpy((void *)cqp_wqe, (void const *)(& cqp_request->cqp_wqe), __len); } opcode = cqp_wqe->wqe_words[0]; if ((opcode & 63U) == 16U) { ctx_index = 1; } else { } __asm__ volatile ("": : : "memory"); u64temp = (u64 )cqp_request; set_wqe_64bit_value((__le32 *)(& cqp_wqe->wqe_words), (u32 )ctx_index, u64temp); if ((nes_debug_level & 512U) != 0U) { tmp___1 = atomic_read((atomic_t const *)(& cqp_request->refcount)); printk("\viw_nes: %s[%u]: CQP request (opcode 0x%02X), line 1 = 0x%08X put on CQPs SQ, request = %p, cqp_head = %u, cqp_tail = %u, cqp_size = %u, waiting = %d, refcount = %d.\n", "nes_post_cqp_request", 698, opcode & 63U, cqp_wqe->wqe_words[1], cqp_request, (int )nesdev->cqp.sq_head, (int )nesdev->cqp.sq_tail, (int )nesdev->cqp.sq_size, (int )cqp_request->waiting, tmp___1); } else { } __asm__ volatile ("": : : "memory"); nes_write32(nesdev->regs + 64UL, (u32 )((int )nesdev->cqp.qp_id | 25165824)); __asm__ volatile ("": : : "memory"); } else { goto _L; } } else { _L: /* CIL Label */ if ((nes_debug_level & 512U) != 0U) { printk("\viw_nes: %s[%u]: CQP request %p (opcode 0x%02X), line 1 = 0x%08X put on the pending queue.\n", "nes_post_cqp_request", 711, cqp_request, cqp_request->cqp_wqe.wqe_words[0] & 63U, cqp_request->cqp_wqe.wqe_words[1]); } else { } list_add_tail(& cqp_request->list, & nesdev->cqp_pending_reqs); } spin_unlock_irqrestore(& nesdev->cqp.lock, flags); return; } } int nes_arp_table(struct nes_device *nesdev , u32 ip_addr , u8 *mac_addr , u32 action ) { struct nes_adapter *nesadapter ; int arp_index ; int err ; __be32 tmp_addr ; size_t __len ; void *__ret ; __u32 tmp ; char *tmp___0 ; { nesadapter = nesdev->nesadapter; err = 0; arp_index = 0; goto ldv_53785; ldv_53784: ; if (nesadapter->arp_table[arp_index].ip_addr == ip_addr) { goto ldv_53783; } else { } arp_index = arp_index + 1; ldv_53785: ; if ((unsigned int )arp_index < nesadapter->arp_table_size) { goto ldv_53784; } else { goto ldv_53783; } ldv_53783: ; if (action == 1U) { if ((u32 )arp_index != nesadapter->arp_table_size) { return (-1); } else { } arp_index = 0; err = nes_alloc_resource(nesadapter, nesadapter->allocated_arps, nesadapter->arp_table_size, (u32 *)(& arp_index), & nesadapter->next_arp_index, 8); if (err != 0) { if ((nes_debug_level & 16U) != 0U) { printk("\viw_nes: %s[%u]: nes_alloc_resource returned error = %u\n", "nes_arp_table", 744, err); } else { } return (err); } else { } if ((nes_debug_level & 16U) != 0U) { printk("\viw_nes: %s[%u]: ADD, arp_index=%d\n", "nes_arp_table", 747, arp_index); } else { } nesadapter->arp_table[arp_index].ip_addr = ip_addr; __len = 6UL; if (__len > 63UL) { __ret = __memcpy((void *)(& nesadapter->arp_table[arp_index].mac_addr), (void const *)mac_addr, __len); } else { __ret = __builtin_memcpy((void *)(& nesadapter->arp_table[arp_index].mac_addr), (void const *)mac_addr, __len); } return (arp_index); } else { } if ((u32 )arp_index == nesadapter->arp_table_size) { tmp = __fswab32(ip_addr); tmp_addr = tmp; if ((nes_debug_level & 16U) != 0U) { if (action == 3U) { tmp___0 = (char *)"resolve"; } else { tmp___0 = (char *)"delete"; } printk("\viw_nes: %s[%u]: MAC for %pI4 not in ARP table - cannot %s\n", "nes_arp_table", 758, & tmp_addr, tmp___0); } else { } return (-1); } else { } if (action == 3U) { if ((nes_debug_level & 16U) != 0U) { printk("\viw_nes: %s[%u]: RESOLVE, arp_index=%d\n", "nes_arp_table", 763, arp_index); } else { } return (arp_index); } else { } if (action == 2U) { if ((nes_debug_level & 16U) != 0U) { printk("\viw_nes: %s[%u]: DELETE, arp_index=%d\n", "nes_arp_table", 768, arp_index); } else { } nesadapter->arp_table[arp_index].ip_addr = 0U; memset((void *)(& nesadapter->arp_table[arp_index].mac_addr), 0, 6UL); nes_free_resource(nesadapter, nesadapter->allocated_arps, (u32 )arp_index); return (arp_index); } else { } return (-1); } } void nes_mh_fix(unsigned long parm ) { unsigned long flags ; struct nes_device *nesdev ; struct nes_adapter *nesadapter ; struct nes_vnic *nesvnic ; u32 used_chunks_tx ; u32 temp_used_chunks_tx ; u32 temp_last_used_chunks_tx ; u32 used_chunks_mask ; u32 mac_tx_frames_low ; u32 mac_tx_frames_high ; u32 mac_tx_pauses ; u32 serdes_status ; u32 reset_value ; u32 tx_control ; u32 tx_config ; u32 tx_pause_quanta ; u32 rx_control ; u32 rx_config ; u32 mac_exact_match ; u32 mpp_debug ; u32 i ; u32 chunks_tx_progress ; raw_spinlock_t *tmp ; void *tmp___0 ; u32 tmp___1 ; u32 tmp___2 ; { nesdev = (struct nes_device *)parm; nesadapter = nesdev->nesadapter; i = 0U; chunks_tx_progress = 0U; tmp = spinlock_check(& nesadapter->phy_lock); flags = _raw_spin_lock_irqsave(tmp); if ((unsigned int )nesadapter->mac_sw_state[0] != 0U || (unsigned int )nesadapter->mac_link_down[0] != 0U) { spin_unlock_irqrestore(& nesadapter->phy_lock, flags); goto no_mh_work; } else { } nesadapter->mac_sw_state[0] = 2U; spin_unlock_irqrestore(& nesadapter->phy_lock, flags); mac_tx_frames_low = nes_read_indexed(nesdev, 8456U); mac_tx_frames_high = nes_read_indexed(nesdev, 8460U); mac_tx_pauses = nes_read_indexed(nesdev, 8472U); used_chunks_tx = nes_read_indexed(nesdev, 24752U); nesdev->mac_pause_frames_sent = nesdev->mac_pause_frames_sent + (unsigned long )mac_tx_pauses; used_chunks_mask = 0U; temp_used_chunks_tx = used_chunks_tx; temp_last_used_chunks_tx = nesdev->last_used_chunks_tx; if ((unsigned long )nesdev->netdev[0] != (unsigned long )((struct net_device *)0)) { tmp___0 = netdev_priv((struct net_device const *)nesdev->netdev[0]); nesvnic = (struct nes_vnic *)tmp___0; } else { goto ldv_53819; } i = 0U; goto ldv_53821; ldv_53820: used_chunks_mask = used_chunks_mask << 8; if ((unsigned int )nesvnic->qp_nic_index[i] != 255U) { used_chunks_mask = used_chunks_mask | 255U; if ((temp_used_chunks_tx & 255U) < (temp_last_used_chunks_tx & 255U)) { chunks_tx_progress = 1U; } else { } } else { } temp_used_chunks_tx = temp_used_chunks_tx >> 8; temp_last_used_chunks_tx = temp_last_used_chunks_tx >> 8; i = i + 1U; ldv_53821: ; if (i <= 3U) { goto ldv_53820; } else { goto ldv_53822; } ldv_53822: ; if ((((mac_tx_frames_low != 0U || mac_tx_frames_high != 0U) || (used_chunks_tx & used_chunks_mask) == 0U) || (nesdev->last_used_chunks_tx & used_chunks_mask) == 0U) || chunks_tx_progress != 0U) { nesdev->last_used_chunks_tx = used_chunks_tx; goto ldv_53819; } else { } nesdev->last_used_chunks_tx = used_chunks_tx; __asm__ volatile ("": : : "memory"); nes_write_indexed(nesdev, 8192U, 5U); mh_pauses_sent = mh_pauses_sent + 1U; mac_tx_pauses = nes_read_indexed(nesdev, 8472U); if (mac_tx_pauses != 0U) { nesdev->mac_pause_frames_sent = nesdev->mac_pause_frames_sent + (unsigned long )mac_tx_pauses; goto ldv_53819; } else { } tx_control = nes_read_indexed(nesdev, 8192U); tx_config = nes_read_indexed(nesdev, 8196U); tx_pause_quanta = nes_read_indexed(nesdev, 8200U); rx_control = nes_read_indexed(nesdev, 8204U); rx_config = nes_read_indexed(nesdev, 8208U); mac_exact_match = nes_read_indexed(nesdev, 8220U); mpp_debug = nes_read_indexed(nesdev, 2560U); mac_tx_pauses = nes_read_indexed(nesdev, 8472U); if (mac_tx_pauses != 0U) { nesdev->last_mac_tx_pauses = (u32 )nesdev->mac_pause_frames_sent; if ((int )nes_debug_level & 1) { printk("\viw_nes: %s[%u]: failsafe caught slow outbound pause\n", "nes_mh_fix", 871); } else { } goto ldv_53819; } else { } mh_detected = mh_detected + 1U; nes_write_indexed(nesdev, 8192U, 0U); nes_write_indexed(nesdev, 8196U, 0U); reset_value = nes_read32((void const *)nesdev->regs + 48U); nes_write32(nesdev->regs + 48UL, reset_value | 29U); goto ldv_53825; ldv_53824: ; ldv_53825: tmp___1 = nes_read32((void const *)nesdev->regs + 48U); if ((tmp___1 & 64U) == 0U) { tmp___2 = i; i = i + 1U; if (tmp___2 <= 4999U) { goto ldv_53824; } else { goto ldv_53826; } } else { goto ldv_53826; } ldv_53826: nes_write_indexed(nesdev, 10248U, 8U); serdes_status = nes_read_indexed(nesdev, 10252U); nes_write_indexed(nesdev, 10256U, 777975U); nes_write_indexed(nesdev, 10260U, 2632396800U); nes_write_indexed(nesdev, 10264U, 267386880U); nes_write_indexed(nesdev, 10268U, 0U); nes_write_indexed(nesdev, 10272U, 0U); nes_write_indexed(nesdev, 10276U, 0U); if ((unsigned int )nesadapter->OneG_Mode != 0U) { nes_write_indexed(nesdev, 10280U, 4028113442U); } else { nes_write_indexed(nesdev, 10280U, 4026802722U); } serdes_status = nes_read_indexed(nesdev, 10284U); nes_write_indexed(nesdev, 10292U, 255U); nes_write_indexed(nesdev, 8192U, tx_control); nes_write_indexed(nesdev, 8196U, tx_config); nes_write_indexed(nesdev, 8200U, tx_pause_quanta); nes_write_indexed(nesdev, 8204U, rx_control); nes_write_indexed(nesdev, 8208U, rx_config); nes_write_indexed(nesdev, 8220U, mac_exact_match); nes_write_indexed(nesdev, 2560U, mpp_debug); ldv_53819: nesadapter->mac_sw_state[0] = 0U; no_mh_work: (nesdev->nesadapter)->mh_timer.expires = (unsigned long )jiffies + 50UL; add_timer(& (nesdev->nesadapter)->mh_timer); return; } } void nes_clc(unsigned long parm ) { unsigned long flags ; struct nes_device *nesdev ; struct nes_adapter *nesadapter ; raw_spinlock_t *tmp ; { nesdev = (struct nes_device *)parm; nesadapter = nesdev->nesadapter; tmp = spinlock_check(& nesadapter->phy_lock); flags = _raw_spin_lock_irqsave(tmp); nesadapter->link_interrupt_count[0] = 0U; nesadapter->link_interrupt_count[1] = 0U; nesadapter->link_interrupt_count[2] = 0U; nesadapter->link_interrupt_count[3] = 0U; spin_unlock_irqrestore(& nesadapter->phy_lock, flags); nesadapter->lc_timer.expires = (unsigned long )jiffies + 900000UL; add_timer(& nesadapter->lc_timer); return; } } void nes_dump_mem(unsigned int dump_debug_level , void *addr , int length ) { char xlate[16U] ; char *ptr ; char hex_buf[80U] ; char ascii_buf[20U] ; int num_char ; int num_ascii ; int num_hex ; int tmp ; int tmp___0 ; int tmp___1 ; int tmp___2 ; int tmp___3 ; int tmp___4 ; int tmp___5 ; int tmp___6 ; int tmp___7 ; int tmp___8 ; int tmp___9 ; int tmp___10 ; int tmp___11 ; { xlate[0] = 48; xlate[1] = 49; xlate[2] = 50; xlate[3] = 51; xlate[4] = 52; xlate[5] = 53; xlate[6] = 54; xlate[7] = 55; xlate[8] = 56; xlate[9] = 57; xlate[10] = 97; xlate[11] = 98; xlate[12] = 99; xlate[13] = 100; xlate[14] = 101; xlate[15] = 102; if ((nes_debug_level & dump_debug_level) == 0U) { return; } else { } ptr = (char *)addr; if (length > 256) { if ((dump_debug_level & nes_debug_level) != 0U) { printk("\viw_nes: %s[%u]: Length truncated from %x to %x\n", "nes_dump_mem", 961, length, 256); } else { } length = 256; } else { } if ((dump_debug_level & nes_debug_level) != 0U) { printk("\viw_nes: %s[%u]: Address=0x%p, length=0x%x (%d)\n", "nes_dump_mem", 964, ptr, length, length); } else { } memset((void *)(& ascii_buf), 0, 20UL); memset((void *)(& hex_buf), 0, 80UL); num_ascii = 0; num_hex = 0; num_char = 0; goto ldv_53850; ldv_53849: ; if (num_ascii == 8) { tmp = num_ascii; num_ascii = num_ascii + 1; ascii_buf[tmp] = 32; tmp___0 = num_hex; num_hex = num_hex + 1; hex_buf[tmp___0] = 45; tmp___1 = num_hex; num_hex = num_hex + 1; hex_buf[tmp___1] = 32; } else { } if ((int )((signed char )*ptr) <= 31 || (int )((signed char )*ptr) == 127) { tmp___2 = num_ascii; num_ascii = num_ascii + 1; ascii_buf[tmp___2] = 46; } else { tmp___3 = num_ascii; num_ascii = num_ascii + 1; ascii_buf[tmp___3] = *ptr; } tmp___4 = num_hex; num_hex = num_hex + 1; hex_buf[tmp___4] = xlate[((int )*ptr & 240) >> 4]; tmp___5 = num_hex; num_hex = num_hex + 1; hex_buf[tmp___5] = xlate[(int )*ptr & 15]; tmp___6 = num_hex; num_hex = num_hex + 1; hex_buf[tmp___6] = 32; ptr = ptr + 1; if (num_ascii > 16) { if ((dump_debug_level & nes_debug_level) != 0U) { printk("\viw_nes: %s[%u]: %s | %s\n", "nes_dump_mem", 989, (char *)(& hex_buf), (char *)(& ascii_buf)); } else { } memset((void *)(& ascii_buf), 0, 20UL); memset((void *)(& hex_buf), 0, 80UL); num_ascii = 0; num_hex = 0; } else { } num_char = num_char + 1; ldv_53850: ; if (num_char < length) { goto ldv_53849; } else { goto ldv_53851; } ldv_53851: ; if (num_ascii != 0) { goto ldv_53853; ldv_53852: ; if (num_ascii == 8) { tmp___7 = num_hex; num_hex = num_hex + 1; hex_buf[tmp___7] = 32; tmp___8 = num_hex; num_hex = num_hex + 1; hex_buf[tmp___8] = 32; } else { } tmp___9 = num_hex; num_hex = num_hex + 1; hex_buf[tmp___9] = 32; tmp___10 = num_hex; num_hex = num_hex + 1; hex_buf[tmp___10] = 32; tmp___11 = num_hex; num_hex = num_hex + 1; hex_buf[tmp___11] = 32; num_ascii = num_ascii + 1; ldv_53853: ; if (num_ascii <= 16) { goto ldv_53852; } else { goto ldv_53854; } ldv_53854: ; if ((dump_debug_level & nes_debug_level) != 0U) { printk("\viw_nes: %s[%u]: %s | %s\n", "nes_dump_mem", 1010, (char *)(& hex_buf), (char *)(& ascii_buf)); } else { } } else { } return; } } void ldv_mutex_lock_51(struct mutex *ldv_func_arg1 ) { { ldv_mutex_lock_lock(ldv_func_arg1); mutex_lock(ldv_func_arg1); return; } } void ldv_mutex_unlock_52(struct mutex *ldv_func_arg1 ) { { ldv_mutex_unlock_lock(ldv_func_arg1); mutex_unlock(ldv_func_arg1); return; } } void ldv_mutex_lock_53(struct mutex *ldv_func_arg1 ) { { ldv_mutex_lock_mutex_of_device(ldv_func_arg1); mutex_lock(ldv_func_arg1); return; } } int ldv_mutex_trylock_54(struct mutex *ldv_func_arg1 ) { ldv_func_ret_type___2 ldv_func_res ; int tmp ; int tmp___0 ; { tmp = mutex_trylock(ldv_func_arg1); ldv_func_res = tmp; tmp___0 = ldv_mutex_trylock_mutex_of_device(ldv_func_arg1); return (tmp___0); return (ldv_func_res); } } void ldv_mutex_unlock_55(struct mutex *ldv_func_arg1 ) { { ldv_mutex_unlock_mutex_of_device(ldv_func_arg1); mutex_unlock(ldv_func_arg1); return; } } void ldv_mutex_lock_56(struct mutex *ldv_func_arg1 ) { { ldv_mutex_lock_cred_guard_mutex_of_signal_struct(ldv_func_arg1); mutex_lock(ldv_func_arg1); return; } } void ldv_mutex_unlock_57(struct mutex *ldv_func_arg1 ) { { ldv_mutex_unlock_cred_guard_mutex_of_signal_struct(ldv_func_arg1); mutex_unlock(ldv_func_arg1); return; } } extern void __might_sleep(char const * , int , int ) ; extern void might_fault(void) ; extern size_t strlcpy(char * , char const * , size_t ) ; extern void warn_slowpath_fmt(char const * , int const , char const * , ...) ; __inline static void *ERR_PTR(long error ) { { return ((void *)error); } } __inline static long IS_ERR(void const *ptr ) { long tmp ; { tmp = ldv__builtin_expect((unsigned long )ptr > 0xfffffffffffff000UL, 0L); return (tmp); } } extern struct cpuinfo_x86 boot_cpu_data ; int ldv_mutex_trylock_68(struct mutex *ldv_func_arg1 ) ; void ldv_mutex_unlock_66(struct mutex *ldv_func_arg1 ) ; void ldv_mutex_unlock_69(struct mutex *ldv_func_arg1 ) ; void ldv_mutex_unlock_71(struct mutex *ldv_func_arg1 ) ; void ldv_mutex_lock_65(struct mutex *ldv_func_arg1 ) ; void ldv_mutex_lock_67(struct mutex *ldv_func_arg1 ) ; void ldv_mutex_lock_70(struct mutex *ldv_func_arg1 ) ; __inline static phys_addr_t virt_to_phys(void volatile *address ) { unsigned long tmp ; { tmp = __phys_addr((unsigned long )address); return ((phys_addr_t )tmp); } } extern void get_random_bytes(void * , int ) ; extern int remap_pfn_range(struct vm_area_struct * , unsigned long , unsigned long , unsigned long , pgprot_t ) ; extern unsigned long _copy_to_user(void * , void const * , unsigned int ) ; extern unsigned long _copy_from_user(void * , void const * , unsigned int ) ; __inline static unsigned long copy_from_user(void *to , void const *from , unsigned long n ) { int sz ; unsigned long tmp ; int __ret_warn_on ; long tmp___0 ; long tmp___1 ; long tmp___2 ; { tmp = __builtin_object_size((void const *)to, 0); sz = (int )tmp; might_fault(); tmp___1 = ldv__builtin_expect(sz == -1, 1L); if (tmp___1 != 0L) { n = _copy_from_user(to, from, (unsigned int )n); } else { tmp___2 = ldv__builtin_expect((unsigned long )sz >= n, 1L); if (tmp___2 != 0L) { n = _copy_from_user(to, from, (unsigned int )n); } else { __ret_warn_on = 1; tmp___0 = ldv__builtin_expect(__ret_warn_on != 0, 0L); if (tmp___0 != 0L) { warn_slowpath_fmt("/home/zakharov/workspace/benchmarks/bench_1/inst/current/envs/linux-3.8-rc1/linux-3.8-rc1/arch/x86/include/asm/uaccess_64.h", 66, "Buffer overflow detected!\n"); } else { } ldv__builtin_expect(__ret_warn_on != 0, 0L); } } return (n); } } __inline static int copy_to_user(void *dst , void const *src , unsigned int size ) { unsigned long tmp ; { might_fault(); tmp = _copy_to_user(dst, src, size); return ((int )tmp); } } __inline static void *kmap(struct page *page ) { void *tmp ; { __might_sleep("include/linux/highmem.h", 58, 0); tmp = lowmem_page_address((struct page const *)page); return (tmp); } } __inline static void kunmap(struct page *page ) { { return; } } extern int device_create_file(struct device * , struct device_attribute const * ) ; extern void device_remove_file(struct device * , struct device_attribute const * ) ; __inline static struct page *sg_page(struct scatterlist *sg ) { long tmp ; long tmp___0 ; { tmp = ldv__builtin_expect(sg->sg_magic != 2271560481UL, 0L); if (tmp != 0L) { __asm__ volatile ("1:\tud2\n.pushsection __bug_table,\"a\"\n2:\t.long 1b - 2b, %c0 - 2b\n\t.word %c1, 0\n\t.org 2b+%c2\n.popsection": : "i" ((char *)"include/linux/scatterlist.h"), "i" (98), "i" (12UL)); ldv_23348: ; goto ldv_23348; } else { } tmp___0 = ldv__builtin_expect((long )((int )sg->page_link) & 1L, 0L); if (tmp___0 != 0L) { __asm__ volatile ("1:\tud2\n.pushsection __bug_table,\"a\"\n2:\t.long 1b - 2b, %c0 - 2b\n\t.word %c1, 0\n\t.org 2b+%c2\n.popsection": : "i" ((char *)"include/linux/scatterlist.h"), "i" (99), "i" (12UL)); ldv_23349: ; goto ldv_23349; } else { } return ((struct page *)(sg->page_link & 0xfffffffffffffffcUL)); } } extern struct ib_device *ib_alloc_device(size_t ) ; extern void ib_dealloc_device(struct ib_device * ) ; extern int ib_register_device(struct ib_device * , int (*)(struct ib_device * , u8 , struct kobject * ) ) ; extern void ib_unregister_device(struct ib_device * ) ; __inline static int ib_copy_from_udata(void *dest , struct ib_udata *udata , size_t len ) { int tmp___0 ; unsigned long tmp___1 ; { tmp___1 = copy_from_user(dest, (void const *)udata->inbuf, len); if (tmp___1 != 0UL) { tmp___0 = -14; } else { tmp___0 = 0; } return (tmp___0); } } __inline static int ib_copy_to_udata(struct ib_udata *udata , void *src , size_t len ) { int tmp___0 ; int tmp___1 ; { tmp___1 = copy_to_user(udata->outbuf, (void const *)src, (unsigned int )len); if (tmp___1 != 0) { tmp___0 = -14; } else { tmp___0 = 0; } return (tmp___0); } } extern void ib_dispatch_event(struct ib_event * ) ; extern int netdev_refcnt_read(struct net_device const * ) ; int nes_accept(struct iw_cm_id *cm_id , struct iw_cm_conn_param *conn_param ) ; int nes_reject(struct iw_cm_id *cm_id , void const *pdata , u8 pdata_len ) ; int nes_connect(struct iw_cm_id *cm_id , struct iw_cm_conn_param *conn_param ) ; int nes_create_listen(struct iw_cm_id *cm_id , int backlog ) ; int nes_destroy_listen(struct iw_cm_id *cm_id ) ; atomic_t mod_qp_timouts ; atomic_t qps_created ; atomic_t sw_qps_destroyed ; __inline static void nes_fill_init_qp_wqe(struct nes_hw_qp_wqe *wqe , struct nes_qp *nesqp , u32 head ) { u32 value ; { value = (unsigned int )((long )nesqp) | head; set_wqe_32bit_value((__le32 *)(& wqe->wqe_words), 3U, (unsigned int )((unsigned long )nesqp >> 32UL)); set_wqe_32bit_value((__le32 *)(& wqe->wqe_words), 2U, value); return; } } __inline static struct nes_pd *to_nespd(struct ib_pd *ibpd ) { struct ib_pd const *__mptr ; { __mptr = (struct ib_pd const *)ibpd; return ((struct nes_pd *)__mptr); } } __inline static struct nes_ucontext *to_nesucontext(struct ib_ucontext *ibucontext ) { struct ib_ucontext const *__mptr ; { __mptr = (struct ib_ucontext const *)ibucontext; return ((struct nes_ucontext *)__mptr); } } __inline static struct nes_mr *to_nesmr(struct ib_mr *ibmr ) { struct ib_mr const *__mptr ; { __mptr = (struct ib_mr const *)ibmr; return ((struct nes_mr *)__mptr); } } __inline static struct nes_mr *to_nesmw(struct ib_mw *ibmw ) { struct ib_mw const *__mptr ; { __mptr = (struct ib_mw const *)ibmw; return ((struct nes_mr *)__mptr); } } __inline static struct nes_cq *to_nescq(struct ib_cq *ibcq ) { struct ib_cq const *__mptr ; { __mptr = (struct ib_cq const *)ibcq; return ((struct nes_cq *)__mptr); } } int nes_modify_qp(struct ib_qp *ibqp , struct ib_qp_attr *attr , int attr_mask , struct ib_udata *udata ) ; extern struct ib_umem *ib_umem_get(struct ib_ucontext * , unsigned long , size_t , int , int ) ; extern void ib_umem_release(struct ib_umem * ) ; static void nes_unregister_ofa_device(struct nes_ib_device *nesibdev ) ; static struct ib_mw *nes_alloc_mw(struct ib_pd *ibpd ) { struct nes_pd *nespd ; struct nes_pd *tmp ; struct nes_vnic *nesvnic ; struct nes_vnic *tmp___0 ; struct nes_device *nesdev ; struct nes_adapter *nesadapter ; struct nes_cqp_request *cqp_request ; struct nes_mr *nesmr ; struct ib_mw *ibmw ; struct nes_hw_cqp_wqe *cqp_wqe ; int ret ; u32 stag ; u32 stag_index ; u32 next_stag_index ; u32 driver_key ; u8 stag_key ; void *tmp___1 ; void *tmp___2 ; void *tmp___3 ; void *tmp___4 ; long __ret ; wait_queue_t __wait ; struct task_struct *tmp___5 ; void *tmp___6 ; void *tmp___7 ; { tmp = to_nespd(ibpd); nespd = tmp; tmp___0 = to_nesvnic(ibpd->device); nesvnic = tmp___0; nesdev = nesvnic->nesdev; nesadapter = nesdev->nesadapter; stag_index = 0U; next_stag_index = 0U; driver_key = 0U; stag_key = 0U; get_random_bytes((void *)(& next_stag_index), 4); stag_key = (unsigned char )next_stag_index; driver_key = 0U; next_stag_index = next_stag_index >> 8; next_stag_index = next_stag_index % nesadapter->max_mr; ret = nes_alloc_resource(nesadapter, nesadapter->allocated_mrs, nesadapter->max_mr, & stag_index, & next_stag_index, 1); if (ret != 0) { tmp___1 = ERR_PTR((long )ret); return ((struct ib_mw *)tmp___1); } else { } tmp___2 = kzalloc(56UL, 208U); nesmr = (struct nes_mr *)tmp___2; if ((unsigned long )nesmr == (unsigned long )((struct nes_mr *)0)) { nes_free_resource(nesadapter, nesadapter->allocated_mrs, stag_index); tmp___3 = ERR_PTR(-12L); return ((struct ib_mw *)tmp___3); } else { } stag = stag_index << 8; stag = stag | driver_key; stag = (u32 )stag_key + stag; if ((nes_debug_level & 2048U) != 0U) { printk("\viw_nes: %s[%u]: Registering STag 0x%08X, index = 0x%08X\n", "nes_alloc_mw", 139, stag, stag_index); } else { } cqp_request = nes_get_cqp_request(nesdev); if ((unsigned long )cqp_request == (unsigned long )((struct nes_cqp_request *)0)) { kfree((void const *)nesmr); nes_free_resource(nesadapter, nesadapter->allocated_mrs, stag_index); tmp___4 = ERR_PTR(-12L); return ((struct ib_mw *)tmp___4); } else { } cqp_request->waiting = 1U; cqp_wqe = & cqp_request->cqp_wqe; cqp_wqe->wqe_words[0] = 2884105U; nes_fill_init_cqp_wqe(cqp_wqe, nesdev); set_wqe_32bit_value((__le32 *)(& cqp_wqe->wqe_words), 6U, (u32 )nespd->pd_id & 32767U); set_wqe_32bit_value((__le32 *)(& cqp_wqe->wqe_words), 8U, stag); atomic_set(& cqp_request->refcount, 2); nes_post_cqp_request(nesdev, cqp_request); __ret = 1200000L; if ((unsigned int )cqp_request->request_done == 0U) { tmp___5 = get_current(); __wait.flags = 0U; __wait.private = (void *)tmp___5; __wait.func = & autoremove_wake_function; __wait.task_list.next = & __wait.task_list; __wait.task_list.prev = & __wait.task_list; ldv_54291: prepare_to_wait(& cqp_request->waitq, & __wait, 2); if ((unsigned int )cqp_request->request_done != 0U) { goto ldv_54290; } else { } __ret = schedule_timeout(__ret); if (__ret == 0L) { goto ldv_54290; } else { } goto ldv_54291; ldv_54290: finish_wait(& cqp_request->waitq, & __wait); } else { } ret = (int )__ret; if ((nes_debug_level & 2048U) != 0U) { printk("\viw_nes: %s[%u]: Register STag 0x%08X completed, wait_event_timeout ret = %u, CQP Major:Minor codes = 0x%04X:0x%04X.\n", "nes_alloc_mw", 169, stag, ret, (int )cqp_request->major_code, (int )cqp_request->minor_code); } else { } if (ret == 0 || (unsigned int )cqp_request->major_code != 0U) { nes_put_cqp_request(nesdev, cqp_request); kfree((void const *)nesmr); nes_free_resource(nesadapter, nesadapter->allocated_mrs, stag_index); if (ret == 0) { tmp___6 = ERR_PTR(-62L); return ((struct ib_mw *)tmp___6); } else { tmp___7 = ERR_PTR(-12L); return ((struct ib_mw *)tmp___7); } } else { } nes_put_cqp_request(nesdev, cqp_request); nesmr->ldv_53249.ibmw.rkey = stag; nesmr->mode = 3U; ibmw = & nesmr->ldv_53249.ibmw; nesmr->pbl_4k = 0U; nesmr->pbls_used = 0U; return (ibmw); } } static int nes_dealloc_mw(struct ib_mw *ibmw ) { struct nes_mr *nesmr ; struct nes_mr *tmp ; struct nes_vnic *nesvnic ; struct nes_vnic *tmp___0 ; struct nes_device *nesdev ; struct nes_adapter *nesadapter ; struct nes_hw_cqp_wqe *cqp_wqe ; struct nes_cqp_request *cqp_request ; int err ; int ret ; long __ret ; wait_queue_t __wait ; struct task_struct *tmp___1 ; { tmp = to_nesmw(ibmw); nesmr = tmp; tmp___0 = to_nesvnic(ibmw->device); nesvnic = tmp___0; nesdev = nesvnic->nesdev; nesadapter = nesdev->nesadapter; err = 0; cqp_request = nes_get_cqp_request(nesdev); if ((unsigned long )cqp_request == (unsigned long )((struct nes_cqp_request *)0)) { if ((nes_debug_level & 2048U) != 0U) { printk("\viw_nes: %s[%u]: Failed to get a cqp_request.\n", "nes_dealloc_mw", 209); } else { } return (-12); } else { } cqp_request->waiting = 1U; cqp_wqe = & cqp_request->cqp_wqe; nes_fill_init_cqp_wqe(cqp_wqe, nesdev); set_wqe_32bit_value((__le32 *)(& cqp_wqe->wqe_words), 0U, 13U); set_wqe_32bit_value((__le32 *)(& cqp_wqe->wqe_words), 8U, ibmw->rkey); atomic_set(& cqp_request->refcount, 2); nes_post_cqp_request(nesdev, cqp_request); if ((nes_debug_level & 2048U) != 0U) { printk("\viw_nes: %s[%u]: Waiting for deallocate STag 0x%08X to complete.\n", "nes_dealloc_mw", 223, ibmw->rkey); } else { } __ret = 1200000L; if ((unsigned int )cqp_request->request_done == 0U) { tmp___1 = get_current(); __wait.flags = 0U; __wait.private = (void *)tmp___1; __wait.func = & autoremove_wake_function; __wait.task_list.next = & __wait.task_list; __wait.task_list.prev = & __wait.task_list; ldv_54308: prepare_to_wait(& cqp_request->waitq, & __wait, 2); if ((unsigned int )cqp_request->request_done != 0U) { goto ldv_54307; } else { } __ret = schedule_timeout(__ret); if (__ret == 0L) { goto ldv_54307; } else { } goto ldv_54308; ldv_54307: finish_wait(& cqp_request->waitq, & __wait); } else { } ret = (int )__ret; if ((nes_debug_level & 2048U) != 0U) { printk("\viw_nes: %s[%u]: Deallocate STag completed, wait_event_timeout ret = %u, CQP Major:Minor codes = 0x%04X:0x%04X.\n", "nes_dealloc_mw", 228, ret, (int )cqp_request->major_code, (int )cqp_request->minor_code); } else { } if (ret == 0) { err = -62; } else if ((unsigned int )cqp_request->major_code != 0U) { err = -5; } else { } nes_put_cqp_request(nesdev, cqp_request); nes_free_resource(nesadapter, nesadapter->allocated_mrs, (ibmw->rkey & 268435200U) >> 8); kfree((void const *)nesmr); return (err); } } static int nes_bind_mw(struct ib_qp *ibqp , struct ib_mw *ibmw , struct ib_mw_bind *ibmw_bind ) { u64 u64temp ; struct nes_vnic *nesvnic ; struct nes_vnic *tmp ; struct nes_device *nesdev ; struct nes_qp *nesqp ; struct nes_qp *tmp___0 ; struct nes_hw_qp_wqe *wqe ; unsigned long flags ; u32 head ; u32 wqe_misc ; u32 qsize ; raw_spinlock_t *tmp___1 ; { tmp = to_nesvnic(ibqp->device); nesvnic = tmp; nesdev = nesvnic->nesdev; tmp___0 = to_nesqp(ibqp); nesqp = tmp___0; flags = 0UL; wqe_misc = 0U; if ((unsigned int )nesqp->ibqp_state > 3U) { return (-22); } else { } tmp___1 = spinlock_check(& nesqp->lock); flags = _raw_spin_lock_irqsave(tmp___1); head = (u32 )nesqp->hwqp.sq_head; qsize = (u32 )nesqp->hwqp.sq_tail; if (((qsize * 2U + head) - (u32 )nesqp->hwqp.sq_tail) % qsize == qsize - 1U) { spin_unlock_irqrestore(& nesqp->lock, flags); return (-12); } else { } wqe = nesqp->hwqp.sq_vbase + (unsigned long )head; nes_fill_init_qp_wqe(wqe, nesqp, head); u64temp = ibmw_bind->wr_id; set_wqe_64bit_value((__le32 *)(& wqe->wqe_words), 4U, u64temp); wqe_misc = 8U; wqe_misc = wqe_misc | 1073741824U; if ((ibmw_bind->send_flags & 2) != 0) { wqe_misc = wqe_misc | 2147483648U; } else { } if ((ibmw_bind->mw_access_flags & 2) != 0) { wqe_misc = wqe_misc | 524288U; } else { } if ((ibmw_bind->mw_access_flags & 4) != 0) { wqe_misc = wqe_misc | 262144U; } else { } set_wqe_32bit_value((__le32 *)(& wqe->wqe_words), 0U, wqe_misc); set_wqe_32bit_value((__le32 *)(& wqe->wqe_words), 6U, (ibmw_bind->mr)->lkey); set_wqe_32bit_value((__le32 *)(& wqe->wqe_words), 7U, ibmw->rkey); set_wqe_32bit_value((__le32 *)(& wqe->wqe_words), 8U, ibmw_bind->length); wqe->wqe_words[9] = 0U; u64temp = ibmw_bind->addr; set_wqe_64bit_value((__le32 *)(& wqe->wqe_words), 10U, u64temp); head = head + 1U; if (head >= qsize) { head = 0U; } else { } nesqp->hwqp.sq_head = (u16 )head; __asm__ volatile ("": : : "memory"); nes_write32(nesdev->regs + 64UL, nesqp->hwqp.qp_id | 25165824U); spin_unlock_irqrestore(& nesqp->lock, flags); return (0); } } static int alloc_fast_reg_mr(struct nes_device *nesdev , struct nes_pd *nespd , u32 stag , u32 page_count___0 ) { struct nes_hw_cqp_wqe *cqp_wqe ; struct nes_cqp_request *cqp_request ; unsigned long flags ; int ret ; struct nes_adapter *nesadapter ; u32 opcode ; u16 major_code ; u64 region_length ; raw_spinlock_t *tmp ; long __ret ; wait_queue_t __wait ; struct task_struct *tmp___0 ; raw_spinlock_t *tmp___1 ; { nesadapter = nesdev->nesadapter; opcode = 0U; region_length = (u64 )((unsigned long )page_count___0 * 4096UL); cqp_request = nes_get_cqp_request(nesdev); if ((unsigned long )cqp_request == (unsigned long )((struct nes_cqp_request *)0)) { if ((nes_debug_level & 2048U) != 0U) { printk("\viw_nes: %s[%u]: Failed to get a cqp_request.\n", "alloc_fast_reg_mr", 337); } else { } return (-12); } else { } if ((nes_debug_level & 2048U) != 0U) { printk("\viw_nes: %s[%u]: alloc_fast_reg_mr: page_count = %d, region_length = %llu\n", "alloc_fast_reg_mr", 342, page_count___0, region_length); } else { } cqp_request->waiting = 1U; cqp_wqe = & cqp_request->cqp_wqe; tmp = spinlock_check(& nesadapter->pbl_lock); flags = _raw_spin_lock_irqsave(tmp); if (nesadapter->free_4kpbl != 0U) { nesadapter->free_4kpbl = nesadapter->free_4kpbl - 1U; spin_unlock_irqrestore(& nesadapter->pbl_lock, flags); } else { spin_unlock_irqrestore(& nesadapter->pbl_lock, flags); if ((nes_debug_level & 2048U) != 0U) { printk("\viw_nes: %s[%u]: Out of Pbls\n", "alloc_fast_reg_mr", 353); } else { } nes_free_cqp_request(nesdev, cqp_request); return (-12); } opcode = 2107913U; nes_fill_init_cqp_wqe(cqp_wqe, nesdev); set_wqe_32bit_value((__le32 *)(& cqp_wqe->wqe_words), 0U, opcode); set_wqe_32bit_value((__le32 *)(& cqp_wqe->wqe_words), 1U, 1U); cqp_wqe->wqe_words[6] = (unsigned int )(region_length >> 8) & 4278190080U; cqp_wqe->wqe_words[6] = cqp_wqe->wqe_words[6] | ((__le32 )nespd->pd_id & 32767U); set_wqe_32bit_value((__le32 *)(& cqp_wqe->wqe_words), 8U, stag); set_wqe_64bit_value((__le32 *)(& cqp_wqe->wqe_words), 10U, 0ULL); set_wqe_32bit_value((__le32 *)(& cqp_wqe->wqe_words), 7U, 0U); set_wqe_64bit_value((__le32 *)(& cqp_wqe->wqe_words), 12U, 0ULL); set_wqe_32bit_value((__le32 *)(& cqp_wqe->wqe_words), 14U, page_count___0 * 8U); cqp_wqe->wqe_words[0] = cqp_wqe->wqe_words[0] | 2048U; __asm__ volatile ("": : : "memory"); atomic_set(& cqp_request->refcount, 2); nes_post_cqp_request(nesdev, cqp_request); __ret = 1200000L; if ((unsigned int )cqp_request->request_done == 0U) { tmp___0 = get_current(); __wait.flags = 0U; __wait.private = (void *)tmp___0; __wait.func = & autoremove_wake_function; __wait.task_list.next = & __wait.task_list; __wait.task_list.prev = & __wait.task_list; ldv_54348: prepare_to_wait(& cqp_request->waitq, & __wait, 2); if ((unsigned int )cqp_request->request_done != 0U) { goto ldv_54347; } else { } __ret = schedule_timeout(__ret); if (__ret == 0L) { goto ldv_54347; } else { } goto ldv_54348; ldv_54347: finish_wait(& cqp_request->waitq, & __wait); } else { } ret = (int )__ret; if ((nes_debug_level & 2048U) != 0U) { printk("\viw_nes: %s[%u]: Allocate STag 0x%08X completed, wait_event_timeout ret = %u, CQP Major:Minor codes = 0x%04X:0x%04X.\n", "alloc_fast_reg_mr", 397, stag, ret, (int )cqp_request->major_code, (int )cqp_request->minor_code); } else { } major_code = cqp_request->major_code; nes_put_cqp_request(nesdev, cqp_request); if (ret == 0 || (unsigned int )major_code != 0U) { tmp___1 = spinlock_check(& nesadapter->pbl_lock); flags = _raw_spin_lock_irqsave(tmp___1); nesadapter->free_4kpbl = nesadapter->free_4kpbl + 1U; spin_unlock_irqrestore(& nesadapter->pbl_lock, flags); } else { } if (ret == 0) { return (-62); } else if ((unsigned int )major_code != 0U) { return (-5); } else { } return (0); } } static struct ib_mr *nes_alloc_fast_reg_mr(struct ib_pd *ibpd , int max_page_list_len ) { struct nes_pd *nespd ; struct nes_pd *tmp ; struct nes_vnic *nesvnic ; struct nes_vnic *tmp___0 ; struct nes_device *nesdev ; struct nes_adapter *nesadapter ; u32 next_stag_index ; u8 stag_key ; u32 driver_key ; int err ; u32 stag_index ; struct nes_mr *nesmr ; u32 stag ; int ret ; struct ib_mr *ibmr ; void *tmp___1 ; void *tmp___2 ; void *tmp___3 ; void *tmp___4 ; void *tmp___5 ; { tmp = to_nespd(ibpd); nespd = tmp; tmp___0 = to_nesvnic(ibpd->device); nesvnic = tmp___0; nesdev = nesvnic->nesdev; nesadapter = nesdev->nesadapter; stag_key = 0U; driver_key = 0U; err = 0; stag_index = 0U; if ((unsigned int )max_page_list_len > 512U) { tmp___1 = ERR_PTR(-7L); return ((struct ib_mr *)tmp___1); } else { } get_random_bytes((void *)(& next_stag_index), 4); stag_key = (unsigned char )next_stag_index; next_stag_index = next_stag_index >> 8; next_stag_index = next_stag_index % nesadapter->max_mr; err = nes_alloc_resource(nesadapter, nesadapter->allocated_mrs, nesadapter->max_mr, & stag_index, & next_stag_index, 2); if (err != 0) { tmp___2 = ERR_PTR((long )err); return ((struct ib_mr *)tmp___2); } else { } tmp___3 = kzalloc(56UL, 208U); nesmr = (struct nes_mr *)tmp___3; if ((unsigned long )nesmr == (unsigned long )((struct nes_mr *)0)) { nes_free_resource(nesadapter, nesadapter->allocated_mrs, stag_index); tmp___4 = ERR_PTR(-12L); return ((struct ib_mr *)tmp___4); } else { } stag = stag_index << 8; stag = stag | driver_key; stag = (u32 )stag_key + stag; if ((nes_debug_level & 2048U) != 0U) { printk("\viw_nes: %s[%u]: Allocating STag 0x%08X index = 0x%08X\n", "nes_alloc_fast_reg_mr", 462, stag, stag_index); } else { } ret = alloc_fast_reg_mr(nesdev, nespd, stag, (u32 )max_page_list_len); if (ret == 0) { nesmr->ldv_53249.ibmr.rkey = stag; nesmr->ldv_53249.ibmr.lkey = stag; nesmr->mode = 5U; ibmr = & nesmr->ldv_53249.ibmr; } else { kfree((void const *)nesmr); nes_free_resource(nesadapter, nesadapter->allocated_mrs, stag_index); tmp___5 = ERR_PTR(-12L); ibmr = (struct ib_mr *)tmp___5; } return (ibmr); } } static struct ib_fast_reg_page_list *nes_alloc_fast_reg_page_list(struct ib_device *ibdev , int page_list_len ) { struct nes_vnic *nesvnic ; struct nes_vnic *tmp ; struct nes_device *nesdev ; struct ib_fast_reg_page_list *pifrpl ; struct nes_ib_fast_reg_page_list *pnesfrpl ; void *tmp___0 ; void *tmp___1 ; void *tmp___2 ; void *tmp___3 ; void *tmp___4 ; { tmp = to_nesvnic(ibdev); nesvnic = tmp; nesdev = nesvnic->nesdev; if ((unsigned int )page_list_len > 512U) { tmp___0 = ERR_PTR(-7L); return ((struct ib_fast_reg_page_list *)tmp___0); } else { } tmp___1 = kmalloc(((unsigned long )page_list_len + 6UL) * 8UL, 208U); pnesfrpl = (struct nes_ib_fast_reg_page_list *)tmp___1; if ((unsigned long )pnesfrpl == (unsigned long )((struct nes_ib_fast_reg_page_list *)0)) { tmp___2 = ERR_PTR(-12L); return ((struct ib_fast_reg_page_list *)tmp___2); } else { } pifrpl = & pnesfrpl->ibfrpl; pifrpl->page_list = & pnesfrpl->pbl; pifrpl->max_page_list_len = (unsigned int )page_list_len; tmp___3 = pci_alloc_consistent(nesdev->pcidev, (unsigned long )page_list_len * 8UL, & pnesfrpl->nes_wqe_pbl.paddr); pnesfrpl->nes_wqe_pbl.kva = (u64 *)tmp___3; if ((unsigned long )pnesfrpl->nes_wqe_pbl.kva == (unsigned long )((u64 *)0)) { kfree((void const *)pnesfrpl); tmp___4 = ERR_PTR(-12L); return ((struct ib_fast_reg_page_list *)tmp___4); } else { } if ((nes_debug_level & 2048U) != 0U) { printk("\viw_nes: %s[%u]: nes_alloc_fast_reg_pbl: nes_frpl = %p, ibfrpl = %p, ibfrpl.page_list = %p, pbl.kva = %p, pbl.paddr = %llx\n", "nes_alloc_fast_reg_page_list", 521, pnesfrpl, & pnesfrpl->ibfrpl, pnesfrpl->ibfrpl.page_list, pnesfrpl->nes_wqe_pbl.kva, pnesfrpl->nes_wqe_pbl.paddr); } else { } return (pifrpl); } } static void nes_free_fast_reg_page_list(struct ib_fast_reg_page_list *pifrpl ) { struct nes_vnic *nesvnic ; struct nes_vnic *tmp ; struct nes_device *nesdev ; struct nes_ib_fast_reg_page_list *pnesfrpl ; struct ib_fast_reg_page_list const *__mptr ; { tmp = to_nesvnic(pifrpl->device); nesvnic = tmp; nesdev = nesvnic->nesdev; __mptr = (struct ib_fast_reg_page_list const *)pifrpl; pnesfrpl = (struct nes_ib_fast_reg_page_list *)__mptr; pci_free_consistent(nesdev->pcidev, (unsigned long )pifrpl->max_page_list_len * 8UL, (void *)pnesfrpl->nes_wqe_pbl.kva, pnesfrpl->nes_wqe_pbl.paddr); kfree((void const *)pnesfrpl); return; } } static int nes_query_device(struct ib_device *ibdev , struct ib_device_attr *props ) { struct nes_vnic *nesvnic ; struct nes_vnic *tmp ; struct nes_device *nesdev ; struct nes_ib_device *nesibdev ; size_t __len ; void *__ret ; { tmp = to_nesvnic(ibdev); nesvnic = tmp; nesdev = nesvnic->nesdev; nesibdev = nesvnic->nesibdev; memset((void *)props, 0, 176UL); __len = 6UL; if (__len > 63UL) { __ret = __memcpy((void *)(& props->sys_image_guid), (void const *)(nesvnic->netdev)->dev_addr, __len); } else { __ret = __builtin_memcpy((void *)(& props->sys_image_guid), (void const *)(nesvnic->netdev)->dev_addr, __len); } props->fw_ver = (u64 )(nesdev->nesadapter)->firmware_version; props->device_cap_flags = (int )(nesdev->nesadapter)->device_cap_flags; props->vendor_id = (nesdev->nesadapter)->vendor_id; props->vendor_part_id = (nesdev->nesadapter)->vendor_part_id; props->hw_ver = (nesdev->nesadapter)->hw_rev; props->max_mr_size = 2147483648ULL; props->max_qp = (int )nesibdev->max_qp; props->max_qp_wr = (int )((nesdev->nesadapter)->max_qp_wr - 2U); props->max_sge = (int )(nesdev->nesadapter)->max_sge; props->max_cq = (int )nesibdev->max_cq; props->max_cqe = (int )(nesdev->nesadapter)->max_cqe; props->max_mr = (int )nesibdev->max_mr; props->max_mw = (int )nesibdev->max_mr; props->max_pd = (int )nesibdev->max_pd; props->max_sge_rd = 1; switch ((int )(nesdev->nesadapter)->max_irrq_wr) { case 0: props->max_qp_rd_atom = 2; goto ldv_54399; case 1: props->max_qp_rd_atom = 8; goto ldv_54399; case 2: props->max_qp_rd_atom = 32; goto ldv_54399; case 3: props->max_qp_rd_atom = 64; goto ldv_54399; default: props->max_qp_rd_atom = 0; } ldv_54399: props->max_qp_init_rd_atom = props->max_qp_rd_atom; props->atomic_cap = 0; props->max_map_per_fmr = 1; return (0); } } static int nes_query_port(struct ib_device *ibdev , u8 port , struct ib_port_attr *props ) { struct nes_vnic *nesvnic ; struct nes_vnic *tmp ; struct net_device *netdev ; bool tmp___0 ; { tmp = to_nesvnic(ibdev); nesvnic = tmp; netdev = nesvnic->netdev; memset((void *)props, 0, 48UL); props->max_mtu = 5; if (netdev->mtu > 4095U) { props->active_mtu = 5; } else if (netdev->mtu > 2047U) { props->active_mtu = 4; } else if (netdev->mtu > 1023U) { props->active_mtu = 3; } else if (netdev->mtu > 511U) { props->active_mtu = 2; } else { props->active_mtu = 1; } props->lid = 1U; props->lmc = 0U; props->sm_lid = 0U; props->sm_sl = 0U; tmp___0 = netif_queue_stopped((struct net_device const *)netdev); if ((int )tmp___0) { props->state = 1; } else if ((unsigned int )nesvnic->linkup != 0U) { props->state = 4; } else { props->state = 1; } props->phys_state = 0U; props->port_cap_flags = 9764864U; props->gid_tbl_len = 1; props->pkey_tbl_len = 1U; props->qkey_viol_cntr = 0U; props->active_width = 2U; props->active_speed = 1U; props->max_msg_sz = 2147483648U; return (0); } } static int nes_query_pkey(struct ib_device *ibdev , u8 port , u16 index , u16 *pkey ) { { *pkey = 0U; return (0); } } static int nes_query_gid(struct ib_device *ibdev , u8 port , int index , union ib_gid *gid ) { struct nes_vnic *nesvnic ; struct nes_vnic *tmp ; size_t __len ; void *__ret ; { tmp = to_nesvnic(ibdev); nesvnic = tmp; memset((void *)(& gid->raw), 0, 16UL); __len = 6UL; if (__len > 63UL) { __ret = __memcpy((void *)(& gid->raw), (void const *)(nesvnic->netdev)->dev_addr, __len); } else { __ret = __builtin_memcpy((void *)(& gid->raw), (void const *)(nesvnic->netdev)->dev_addr, __len); } return (0); } } static struct ib_ucontext *nes_alloc_ucontext(struct ib_device *ibdev , struct ib_udata *udata ) { struct nes_vnic *nesvnic ; struct nes_vnic *tmp ; struct nes_device *nesdev ; struct nes_adapter *nesadapter ; struct nes_alloc_ucontext_req req ; struct nes_alloc_ucontext_resp uresp ; struct nes_ucontext *nes_ucontext ; struct nes_ib_device *nesibdev ; void *tmp___0 ; int tmp___1 ; void *tmp___2 ; void *tmp___3 ; void *tmp___4 ; void *tmp___5 ; int tmp___6 ; { tmp = to_nesvnic(ibdev); nesvnic = tmp; nesdev = nesvnic->nesdev; nesadapter = nesdev->nesadapter; nesibdev = nesvnic->nesibdev; tmp___1 = ib_copy_from_udata((void *)(& req), udata, 8UL); if (tmp___1 != 0) { printk("\viw_nes: Invalid structure size on allocate user context.\n"); tmp___0 = ERR_PTR(-22L); return ((struct ib_ucontext *)tmp___0); } else { } if ((unsigned int )req.userspace_ver != 1U) { printk("\viw_nes: Invalid userspace driver version detected. Detected version %d, should be %d\n", (int )req.userspace_ver, 1); tmp___2 = ERR_PTR(-22L); return ((struct ib_ucontext *)tmp___2); } else { } memset((void *)(& uresp), 0, 16UL); uresp.max_qps = nesibdev->max_qp; uresp.max_pds = nesibdev->max_pd; uresp.wq_size = (nesdev->nesadapter)->max_qp_wr * 2U; uresp.virtwq = nesadapter->virtwq; uresp.kernel_ver = 1U; tmp___3 = kzalloc(42216UL, 208U); nes_ucontext = (struct nes_ucontext *)tmp___3; if ((unsigned long )nes_ucontext == (unsigned long )((struct nes_ucontext *)0)) { tmp___4 = ERR_PTR(-12L); return ((struct ib_ucontext *)tmp___4); } else { } nes_ucontext->nesdev = nesdev; nes_ucontext->mmap_wq_offset = (unsigned long )uresp.max_pds; nes_ucontext->mmap_cq_offset = nes_ucontext->mmap_wq_offset + (((unsigned long )uresp.max_qps + 16UL) * 256UL - 1UL) / 4096UL; tmp___6 = ib_copy_to_udata(udata, (void *)(& uresp), 16UL); if (tmp___6 != 0) { kfree((void const *)nes_ucontext); tmp___5 = ERR_PTR(-14L); return ((struct ib_ucontext *)tmp___5); } else { } INIT_LIST_HEAD(& nes_ucontext->cq_reg_mem_list); INIT_LIST_HEAD(& nes_ucontext->qp_reg_mem_list); atomic_set(& nes_ucontext->usecnt, 1); return (& nes_ucontext->ibucontext); } } static int nes_dealloc_ucontext(struct ib_ucontext *context ) { struct nes_ucontext *nes_ucontext ; struct nes_ucontext *tmp ; int tmp___0 ; { tmp = to_nesucontext(context); nes_ucontext = tmp; tmp___0 = atomic_dec_and_test(& nes_ucontext->usecnt); if (tmp___0 == 0) { return (0); } else { } kfree((void const *)nes_ucontext); return (0); } } static int nes_mmap(struct ib_ucontext *context , struct vm_area_struct *vma ) { unsigned long index ; struct nes_vnic *nesvnic ; struct nes_vnic *tmp ; struct nes_device *nesdev ; struct nes_ucontext *nes_ucontext ; struct nes_qp *nesqp ; int tmp___0 ; phys_addr_t tmp___1 ; int tmp___2 ; int tmp___3 ; pgprot_t __constr_expr_0 ; int tmp___4 ; { tmp = to_nesvnic(context->device); nesvnic = tmp; nesdev = nesvnic->nesdev; nes_ucontext = to_nesucontext(context); if (vma->vm_pgoff >= nes_ucontext->mmap_wq_offset) { index = (vma->vm_pgoff - nes_ucontext->mmap_wq_offset) * 4096UL; index = index / ((((unsigned long )(nesdev->nesadapter)->max_qp_wr + 16UL) * 256UL - 1UL) & 0xfffffffffffff000UL); tmp___0 = variable_test_bit((int )index, (unsigned long const volatile *)(& nes_ucontext->allocated_wqs)); if (tmp___0 == 0) { if ((nes_debug_level & 1024U) != 0U) { printk("\viw_nes: %s[%u]: wq %lu not allocated\n", "nes_mmap", 767, index); } else { } return (-14); } else { } nesqp = nes_ucontext->mmap_nesqp[index]; if ((unsigned long )nesqp == (unsigned long )((struct nes_qp *)0)) { if ((nes_debug_level & 1024U) != 0U) { printk("\viw_nes: %s[%u]: wq %lu has a NULL QP base.\n", "nes_mmap", 772, index); } else { } return (-14); } else { } tmp___1 = virt_to_phys((void volatile *)nesqp->hwqp.sq_vbase); tmp___2 = remap_pfn_range(vma, vma->vm_start, (unsigned long )(tmp___1 >> 12), vma->vm_end - vma->vm_start, vma->vm_page_prot); if (tmp___2 != 0) { if ((nes_debug_level & 1024U) != 0U) { printk("\viw_nes: %s[%u]: remap_pfn_range failed.\n", "nes_mmap", 779); } else { } return (-11); } else { } vma->vm_private_data = (void *)nesqp; return (0); } else { index = vma->vm_pgoff; tmp___3 = variable_test_bit((int )index, (unsigned long const volatile *)(& nes_ucontext->allocated_doorbells)); if (tmp___3 == 0) { return (-14); } else { } if ((unsigned int )boot_cpu_data.x86 > 3U) { __constr_expr_0.pgprot = vma->vm_page_prot.pgprot | 16UL; vma->vm_page_prot = __constr_expr_0; } else { vma->vm_page_prot = vma->vm_page_prot; } tmp___4 = remap_pfn_range(vma, vma->vm_start, (nesdev->doorbell_start + (unsigned long )(((int )nes_ucontext->mmap_db_index[index] - (int )nesdev->base_doorbell_index) * 4096)) >> 12, 4096UL, vma->vm_page_prot); if (tmp___4 != 0) { return (-11); } else { } vma->vm_private_data = (void *)nes_ucontext; return (0); } return (-38); } } static struct ib_pd *nes_alloc_pd(struct ib_device *ibdev , struct ib_ucontext *context , struct ib_udata *udata ) { struct nes_pd *nespd ; struct nes_vnic *nesvnic ; struct nes_vnic *tmp ; struct nes_device *nesdev ; struct nes_adapter *nesadapter ; struct nes_ucontext *nesucontext ; struct nes_alloc_pd_resp uresp ; u32 pd_num ; int err ; int tmp___0 ; void *tmp___1 ; void *tmp___2 ; void *tmp___3 ; unsigned long tmp___4 ; void *tmp___5 ; void *tmp___6 ; int tmp___7 ; { tmp = to_nesvnic(ibdev); nesvnic = tmp; nesdev = nesvnic->nesdev; nesadapter = nesdev->nesadapter; pd_num = 0U; if ((nes_debug_level & 4096U) != 0U) { tmp___0 = netdev_refcnt_read((struct net_device const *)nesvnic->netdev); printk("\viw_nes: %s[%u]: nesvnic=%p, netdev=%p %s, ibdev=%p, context=%p, netdev refcnt=%u\n", "nes_alloc_pd", 820, nesvnic, nesdev->netdev[0], (char *)(& (nesdev->netdev[0])->name), ibdev, context, tmp___0); } else { } err = nes_alloc_resource(nesadapter, nesadapter->allocated_pds, nesadapter->max_pd, & pd_num, & nesadapter->next_pd, 5); if (err != 0) { tmp___1 = ERR_PTR((long )err); return ((struct ib_pd *)tmp___1); } else { } tmp___2 = kzalloc(40UL, 208U); nespd = (struct nes_pd *)tmp___2; if ((unsigned long )nespd == (unsigned long )((struct nes_pd *)0)) { nes_free_resource(nesadapter, nesadapter->allocated_pds, pd_num); tmp___3 = ERR_PTR(-12L); return ((struct ib_pd *)tmp___3); } else { } if ((nes_debug_level & 4096U) != 0U) { printk("\viw_nes: %s[%u]: Allocating PD (%p) for ib device %s\n", "nes_alloc_pd", 835, nespd, (char *)(& (nesvnic->nesibdev)->ibdev.name)); } else { } nespd->pd_id = (int )((u16 )nesadapter->base_pd) + (int )((u16 )pd_num); if ((unsigned long )context != (unsigned long )((struct ib_ucontext *)0)) { nesucontext = to_nesucontext(context); tmp___4 = find_next_zero_bit((unsigned long const *)(& nesucontext->allocated_doorbells), 4096UL, (unsigned long )nesucontext->first_free_db); nespd->mmap_db_index = (u16 )tmp___4; if ((nes_debug_level & 4096U) != 0U) { printk("\viw_nes: %s[%u]: find_first_zero_biton doorbells returned %u, mapping pd_id %u.\n", "nes_alloc_pd", 844, (int )nespd->mmap_db_index, (int )nespd->pd_id); } else { } if ((unsigned int )nespd->mmap_db_index > 4095U) { if ((nes_debug_level & 4096U) != 0U) { printk("\viw_nes: %s[%u]: mmap_db_index > MAX\n", "nes_alloc_pd", 846); } else { } nes_free_resource(nesadapter, nesadapter->allocated_pds, pd_num); kfree((void const *)nespd); tmp___5 = ERR_PTR(-12L); return ((struct ib_pd *)tmp___5); } else { } uresp.pd_id = (__u32 )nespd->pd_id; uresp.mmap_db_index = (__u32 )nespd->mmap_db_index; tmp___7 = ib_copy_to_udata(udata, (void *)(& uresp), 8UL); if (tmp___7 != 0) { nes_free_resource(nesadapter, nesadapter->allocated_pds, pd_num); kfree((void const *)nespd); tmp___6 = ERR_PTR(-14L); return ((struct ib_pd *)tmp___6); } else { } set_bit((unsigned int )nespd->mmap_db_index, (unsigned long volatile *)(& nesucontext->allocated_doorbells)); nesucontext->mmap_db_index[(int )nespd->mmap_db_index] = nespd->pd_id; nesucontext->first_free_db = (unsigned int )nespd->mmap_db_index + 1U; } else { } if ((nes_debug_level & 4096U) != 0U) { printk("\viw_nes: %s[%u]: PD%u structure located @%p.\n", "nes_alloc_pd", 865, (int )nespd->pd_id, nespd); } else { } return (& nespd->ibpd); } } static int nes_dealloc_pd(struct ib_pd *ibpd ) { struct nes_ucontext *nesucontext ; struct nes_pd *nespd ; struct nes_pd *tmp ; struct nes_vnic *nesvnic ; struct nes_vnic *tmp___0 ; struct nes_device *nesdev ; struct nes_adapter *nesadapter ; { tmp = to_nespd(ibpd); nespd = tmp; tmp___0 = to_nesvnic(ibpd->device); nesvnic = tmp___0; nesdev = nesvnic->nesdev; nesadapter = nesdev->nesadapter; if ((unsigned long )ibpd->uobject != (unsigned long )((struct ib_uobject *)0) && (unsigned long )(ibpd->uobject)->context != (unsigned long )((struct ib_ucontext *)0)) { nesucontext = to_nesucontext((ibpd->uobject)->context); if ((nes_debug_level & 4096U) != 0U) { printk("\viw_nes: %s[%u]: Clearing bit %u from allocated doorbells\n", "nes_dealloc_pd", 884, (int )nespd->mmap_db_index); } else { } clear_bit((int )nespd->mmap_db_index, (unsigned long volatile *)(& nesucontext->allocated_doorbells)); nesucontext->mmap_db_index[(int )nespd->mmap_db_index] = 0U; if ((int )nesucontext->first_free_db > (int )nespd->mmap_db_index) { nesucontext->first_free_db = nespd->mmap_db_index; } else { } } else { } if ((nes_debug_level & 4096U) != 0U) { printk("\viw_nes: %s[%u]: Deallocating PD%u structure located @%p.\n", "nes_dealloc_pd", 893, (int )nespd->pd_id, nespd); } else { } nes_free_resource(nesadapter, nesadapter->allocated_pds, (u32 )nespd->pd_id - nesadapter->base_pd); kfree((void const *)nespd); return (0); } } static struct ib_ah *nes_create_ah(struct ib_pd *pd , struct ib_ah_attr *ah_attr ) { void *tmp ; { tmp = ERR_PTR(-38L); return ((struct ib_ah *)tmp); } } static int nes_destroy_ah(struct ib_ah *ah ) { { return (-38); } } __inline static u8 nes_get_encoded_size(int *size ) { u8 encoded_size ; { encoded_size = 0U; if (*size <= 32) { *size = 32; encoded_size = 1U; } else if (*size <= 128) { *size = 128; encoded_size = 2U; } else if (*size <= 512) { *size = 512; encoded_size = 3U; } else { } return (encoded_size); } } static int nes_setup_virt_qp(struct nes_qp *nesqp , struct nes_pbl *nespbl , struct nes_vnic *nesvnic , int sq_size , int rq_size ) { unsigned long flags ; void *mem ; __le64 *pbl ; __le64 *tpbl ; __le64 *pblbuffer ; struct nes_device *nesdev ; struct nes_adapter *nesadapter ; u32 pbl_entries ; u8 rq_pbl_entries ; u8 sq_pbl_entries ; void *tmp ; raw_spinlock_t *tmp___0 ; raw_spinlock_t *tmp___1 ; __le64 *tmp___2 ; __le64 *tmp___3 ; u8 tmp___4 ; __le64 *tmp___5 ; __le64 *tmp___6 ; u8 tmp___7 ; unsigned int _max1 ; unsigned int _max2 ; unsigned int tmp___8 ; raw_spinlock_t *tmp___9 ; { pbl = 0; nesdev = nesvnic->nesdev; nesadapter = nesdev->nesadapter; pbl_entries = nespbl->pbl_size >> 3; if ((nes_debug_level & 16384U) != 0U) { printk("\viw_nes: %s[%u]: Userspace PBL, pbl_size=%u, pbl_entries = %d pbl_vbase=%p, pbl_pbase=%lx\n", "nes_setup_virt_qp", 962, nespbl->pbl_size, pbl_entries, (void *)nespbl->pbl_vbase, (unsigned long )nespbl->pbl_pbase); } else { } pbl = nespbl->pbl_vbase; rq_pbl_entries = (u8 )((unsigned long )rq_size * 128UL >> 12); sq_pbl_entries = (u8 )((unsigned long )sq_size * 128UL >> 12); nesqp->hwqp.sq_pbase = (unsigned long long )*((__le32 *)pbl) | ((unsigned long long )*((__le32 *)pbl + 1UL) << 32); if ((unsigned long )nespbl->page == (unsigned long )((struct page *)0)) { if ((nes_debug_level & 16384U) != 0U) { printk("\viw_nes: %s[%u]: QP nespbl->page is NULL \n", "nes_setup_virt_qp", 970); } else { } kfree((void const *)nespbl); return (-12); } else { } tmp = kmap(nespbl->page); nesqp->hwqp.sq_vbase = (struct nes_hw_qp_wqe *)tmp; nesqp->page = nespbl->page; if ((unsigned long )nesqp->hwqp.sq_vbase == (unsigned long )((struct nes_hw_qp_wqe *)0)) { if ((nes_debug_level & 16384U) != 0U) { printk("\viw_nes: %s[%u]: QP sq_vbase kmap failed\n", "nes_setup_virt_qp", 978); } else { } kfree((void const *)nespbl); return (-12); } else { } pbl = pbl + (unsigned long )sq_pbl_entries; nesqp->hwqp.rq_pbase = (unsigned long long )*((__le32 *)pbl) | ((unsigned long long )*((__le32 *)pbl + 1UL) << 32); if ((nes_debug_level & 16384U) != 0U) { printk("\viw_nes: %s[%u]: QP sq_vbase= %p sq_pbase=%lx rq_vbase=%p rq_pbase=%lx\n", "nes_setup_virt_qp", 992, nesqp->hwqp.sq_vbase, (unsigned long )nesqp->hwqp.sq_pbase, nesqp->hwqp.rq_vbase, (unsigned long )nesqp->hwqp.rq_pbase); } else { } tmp___0 = spinlock_check(& nesadapter->pbl_lock); flags = _raw_spin_lock_irqsave(tmp___0); if (nesadapter->free_256pbl == 0U) { pci_free_consistent(nesdev->pcidev, (size_t )nespbl->pbl_size, (void *)nespbl->pbl_vbase, nespbl->pbl_pbase); spin_unlock_irqrestore(& nesadapter->pbl_lock, flags); kunmap(nesqp->page); kfree((void const *)nespbl); return (-12); } else { } nesadapter->free_256pbl = nesadapter->free_256pbl - 1U; spin_unlock_irqrestore(& nesadapter->pbl_lock, flags); nesqp->pbl_vbase = pci_alloc_consistent(nesdev->pcidev, 256UL, & nesqp->pbl_pbase); pblbuffer = (__le64 *)nesqp->pbl_vbase; if ((unsigned long )nesqp->pbl_vbase == (unsigned long )((void *)0)) { pci_free_consistent(nesdev->pcidev, (size_t )nespbl->pbl_size, (void *)nespbl->pbl_vbase, nespbl->pbl_pbase); kfree((void const *)nespbl); tmp___1 = spinlock_check(& nesadapter->pbl_lock); flags = _raw_spin_lock_irqsave(tmp___1); nesadapter->free_256pbl = nesadapter->free_256pbl + 1U; spin_unlock_irqrestore(& nesadapter->pbl_lock, flags); kunmap(nesqp->page); return (-12); } else { } memset(nesqp->pbl_vbase, 0, 256UL); tpbl = pblbuffer + 16UL; pbl = nespbl->pbl_vbase; goto ldv_54512; ldv_54511: tmp___2 = tpbl; tpbl = tpbl + 1; tmp___3 = pbl; pbl = pbl + 1; *tmp___2 = *tmp___3; ldv_54512: tmp___4 = sq_pbl_entries; sq_pbl_entries = (u8 )((int )sq_pbl_entries - 1); if ((unsigned int )((unsigned char )tmp___4) != 0U) { goto ldv_54511; } else { goto ldv_54513; } ldv_54513: tpbl = pblbuffer; goto ldv_54515; ldv_54514: tmp___5 = tpbl; tpbl = tpbl + 1; tmp___6 = pbl; pbl = pbl + 1; *tmp___5 = *tmp___6; ldv_54515: tmp___7 = rq_pbl_entries; rq_pbl_entries = (u8 )((int )rq_pbl_entries - 1); if ((unsigned int )((unsigned char )tmp___7) != 0U) { goto ldv_54514; } else { goto ldv_54516; } ldv_54516: pci_free_consistent(nesdev->pcidev, (size_t )nespbl->pbl_size, (void *)nespbl->pbl_vbase, nespbl->pbl_pbase); kfree((void const *)nespbl); _max1 = 176U; _max2 = 256U; if (_max1 > _max2) { tmp___8 = _max1; } else { tmp___8 = _max2; } nesqp->qp_mem_size = tmp___8 + 256U; nesqp->qp_mem_size = nesqp->qp_mem_size + 4095U; nesqp->qp_mem_size = nesqp->qp_mem_size & 4294963200U; mem = pci_alloc_consistent(nesdev->pcidev, (size_t )nesqp->qp_mem_size, & nesqp->hwqp.q2_pbase); if ((unsigned long )mem == (unsigned long )((void *)0)) { pci_free_consistent(nesdev->pcidev, 256UL, nesqp->pbl_vbase, nesqp->pbl_pbase); nesqp->pbl_vbase = 0; tmp___9 = spinlock_check(& nesadapter->pbl_lock); flags = _raw_spin_lock_irqsave(tmp___9); nesadapter->free_256pbl = nesadapter->free_256pbl + 1U; spin_unlock_irqrestore(& nesadapter->pbl_lock, flags); kunmap(nesqp->page); return (-12); } else { } nesqp->sq_kmapped = 1U; nesqp->hwqp.q2_vbase = mem; mem = mem + 256UL; memset(nesqp->hwqp.q2_vbase, 0, 256UL); nesqp->nesqp_context = (struct nes_qp_context *)mem; memset((void *)nesqp->nesqp_context, 0, 176UL); nesqp->nesqp_context_pbase = nesqp->hwqp.q2_pbase + 256ULL; return (0); } } static int nes_setup_mmap_qp(struct nes_qp *nesqp , struct nes_vnic *nesvnic , int sq_size , int rq_size ) { void *mem ; struct nes_device *nesdev ; unsigned int _max1 ; unsigned int _max2 ; unsigned int tmp ; { nesdev = nesvnic->nesdev; _max1 = 176U; _max2 = 256U; if (_max1 > _max2) { tmp = _max1; } else { tmp = _max2; } nesqp->qp_mem_size = ((u32 )((unsigned long )sq_size + (unsigned long )rq_size) * 128U + tmp) + 256U; nesqp->qp_mem_size = nesqp->qp_mem_size + 4095U; nesqp->qp_mem_size = nesqp->qp_mem_size & 4294963200U; mem = pci_alloc_consistent(nesdev->pcidev, (size_t )nesqp->qp_mem_size, & nesqp->hwqp.sq_pbase); if ((unsigned long )mem == (unsigned long )((void *)0)) { return (-12); } else { } if ((nes_debug_level & 16384U) != 0U) { printk("\viw_nes: %s[%u]: PCI consistent memory for host descriptor rings located @ %p (pa = 0x%08lX.) size = %u.\n", "nes_setup_mmap_qp", 1086, mem, (unsigned long )nesqp->hwqp.sq_pbase, nesqp->qp_mem_size); } else { } memset(mem, 0, (size_t )nesqp->qp_mem_size); nesqp->hwqp.sq_vbase = (struct nes_hw_qp_wqe *)mem; mem = mem + (unsigned long )sq_size * 128UL; nesqp->hwqp.rq_vbase = (struct nes_hw_qp_wqe *)mem; nesqp->hwqp.rq_pbase = nesqp->hwqp.sq_pbase + (unsigned long long )((unsigned long )sq_size * 128UL); mem = mem + (unsigned long )rq_size * 128UL; nesqp->hwqp.q2_vbase = mem; nesqp->hwqp.q2_pbase = nesqp->hwqp.rq_pbase + (unsigned long long )((unsigned long )rq_size * 128UL); mem = mem + 256UL; memset(nesqp->hwqp.q2_vbase, 0, 256UL); nesqp->nesqp_context = (struct nes_qp_context *)mem; nesqp->nesqp_context_pbase = nesqp->hwqp.q2_pbase + 256ULL; memset((void *)nesqp->nesqp_context, 0, 176UL); return (0); } } __inline static void nes_free_qp_mem(struct nes_device *nesdev , struct nes_qp *nesqp , int virt_wqs ) { unsigned long flags ; struct nes_adapter *nesadapter ; raw_spinlock_t *tmp ; { nesadapter = nesdev->nesadapter; if (virt_wqs == 0) { pci_free_consistent(nesdev->pcidev, (size_t )nesqp->qp_mem_size, (void *)nesqp->hwqp.sq_vbase, nesqp->hwqp.sq_pbase); } else { tmp = spinlock_check(& nesadapter->pbl_lock); flags = _raw_spin_lock_irqsave(tmp); nesadapter->free_256pbl = nesadapter->free_256pbl + 1U; spin_unlock_irqrestore(& nesadapter->pbl_lock, flags); pci_free_consistent(nesdev->pcidev, (size_t )nesqp->qp_mem_size, nesqp->hwqp.q2_vbase, nesqp->hwqp.q2_pbase); pci_free_consistent(nesdev->pcidev, 256UL, nesqp->pbl_vbase, nesqp->pbl_pbase); nesqp->pbl_vbase = 0; if ((unsigned int )nesqp->sq_kmapped != 0U) { nesqp->sq_kmapped = 0U; kunmap(nesqp->page); } else { } } return; } } static struct ib_qp *nes_create_qp(struct ib_pd *ibpd , struct ib_qp_init_attr *init_attr , struct ib_udata *udata ) { u64 u64temp ; u64 u64nesqp ; struct nes_pd *nespd ; struct nes_pd *tmp ; struct nes_vnic *nesvnic ; struct nes_vnic *tmp___0 ; struct nes_device *nesdev ; struct nes_adapter *nesadapter ; struct nes_qp *nesqp ; struct nes_cq *nescq ; struct nes_ucontext *nes_ucontext ; struct nes_hw_cqp_wqe *cqp_wqe ; struct nes_cqp_request *cqp_request ; struct nes_create_qp_req req ; struct nes_create_qp_resp uresp ; struct nes_pbl *nespbl ; u32 qp_num ; u32 opcode ; void *mem ; unsigned long flags ; int ret ; int err ; int virt_wqs ; int sq_size ; int rq_size ; u8 sq_encoded_size ; u8 rq_encoded_size ; void *tmp___1 ; void *tmp___2 ; void *tmp___3 ; void *tmp___4 ; int tmp___5 ; struct list_head const *__mptr ; struct list_head const *__mptr___0 ; void *tmp___6 ; unsigned long tmp___7 ; void *tmp___8 ; void *tmp___9 ; int tmp___10 ; int tmp___11 ; void *tmp___12 ; raw_spinlock_t *tmp___13 ; void *tmp___14 ; long __ret ; wait_queue_t __wait ; struct task_struct *tmp___15 ; void *tmp___16 ; void *tmp___17 ; void *tmp___18 ; int tmp___19 ; struct lock_class_key __key ; void *tmp___20 ; struct lock_class_key __key___0 ; int tmp___21 ; { u64temp = 0ULL; u64nesqp = 0ULL; tmp = to_nespd(ibpd); nespd = tmp; tmp___0 = to_nesvnic(ibpd->device); nesvnic = tmp___0; nesdev = nesvnic->nesdev; nesadapter = nesdev->nesadapter; nespbl = 0; qp_num = 0U; opcode = 0U; virt_wqs = 0; if ((int )init_attr->create_flags != 0) { tmp___1 = ERR_PTR(-22L); return ((struct ib_qp *)tmp___1); } else { } atomic_inc(& qps_created); switch ((unsigned int )init_attr->qp_type) { case 2: ; if ((nes_drv_opt & 128U) != 0U) { init_attr->cap.max_inline_data = 0U; } else { init_attr->cap.max_inline_data = 64U; } sq_size = (int )init_attr->cap.max_send_wr; rq_size = (int )init_attr->cap.max_recv_wr; sq_encoded_size = nes_get_encoded_size(& sq_size); rq_encoded_size = nes_get_encoded_size(& rq_size); if ((unsigned int )sq_encoded_size == 0U || (unsigned int )rq_encoded_size == 0U) { if ((nes_debug_level & 16384U) != 0U) { printk("\viw_nes: %s[%u]: ERROR bad rq (%u) or sq (%u) size\n", "nes_create_qp", 1191, rq_size, sq_size); } else { } tmp___2 = ERR_PTR(-22L); return ((struct ib_qp *)tmp___2); } else { } init_attr->cap.max_send_wr = (u32 )(sq_size + -2); init_attr->cap.max_recv_wr = (u32 )(rq_size + -1); if ((nes_debug_level & 16384U) != 0U) { printk("\viw_nes: %s[%u]: RQ size=%u, SQ Size=%u\n", "nes_create_qp", 1197, rq_size, sq_size); } else { } ret = nes_alloc_resource(nesadapter, nesadapter->allocated_qps, nesadapter->max_qp, & qp_num, & nesadapter->next_qp, 6); if (ret != 0) { tmp___3 = ERR_PTR((long )ret); return ((struct ib_qp *)tmp___3); } else { } mem = kzalloc(1863UL, 208U); if ((unsigned long )mem == (unsigned long )((void *)0)) { nes_free_resource(nesadapter, nesadapter->allocated_qps, qp_num); if ((nes_debug_level & 16384U) != 0U) { printk("\viw_nes: %s[%u]: Unable to allocate QP\n", "nes_create_qp", 1209); } else { } tmp___4 = ERR_PTR(-12L); return ((struct ib_qp *)tmp___4); } else { } u64nesqp = (u64 )mem; u64nesqp = u64nesqp + 1023ULL; u64temp = 1023ULL; u64nesqp = ~ u64temp & u64nesqp; nesqp = (struct nes_qp *)u64nesqp; nesqp->allocated_buffer = mem; if ((unsigned long )udata != (unsigned long )((struct ib_udata *)0)) { tmp___5 = ib_copy_from_udata((void *)(& req), udata, 8UL); if (tmp___5 != 0) { nes_free_resource(nesadapter, nesadapter->allocated_qps, qp_num); kfree((void const *)nesqp->allocated_buffer); if ((nes_debug_level & 16384U) != 0U) { printk("\viw_nes: %s[%u]: ib_copy_from_udata() Failed \n", "nes_create_qp", 1225); } else { } return (0); } else { } if (req.user_wqe_buffers != 0ULL) { virt_wqs = 1; } else { } if ((unsigned long )ibpd->uobject != (unsigned long )((struct ib_uobject *)0) && (unsigned long )(ibpd->uobject)->context != (unsigned long )((struct ib_ucontext *)0)) { nesqp->user_mode = 1U; nes_ucontext = to_nesucontext((ibpd->uobject)->context); if (virt_wqs != 0) { err = 1; __mptr = (struct list_head const *)nes_ucontext->qp_reg_mem_list.next; nespbl = (struct nes_pbl *)__mptr + 0xffffffffffffffd8UL; goto ldv_54583; ldv_54582: ; if (nespbl->user_base == (unsigned long )req.user_wqe_buffers) { list_del(& nespbl->list); err = 0; if ((nes_debug_level & 16384U) != 0U) { printk("\viw_nes: %s[%u]: Found PBL for virtual QP. nespbl=%p. user_base=0x%lx\n", "nes_create_qp", 1241, nespbl, nespbl->user_base); } else { } goto ldv_54581; } else { } __mptr___0 = (struct list_head const *)nespbl->list.next; nespbl = (struct nes_pbl *)__mptr___0 + 0xffffffffffffffd8UL; ldv_54583: ; if ((unsigned long )(& nespbl->list) != (unsigned long )(& nes_ucontext->qp_reg_mem_list)) { goto ldv_54582; } else { goto ldv_54581; } ldv_54581: ; if (err != 0) { if ((nes_debug_level & 16384U) != 0U) { printk("\viw_nes: %s[%u]: Didn\'t Find PBL for virtual QP. address = %llx.\n", "nes_create_qp", 1247, req.user_wqe_buffers); } else { } nes_free_resource(nesadapter, nesadapter->allocated_qps, qp_num); kfree((void const *)nesqp->allocated_buffer); tmp___6 = ERR_PTR(-14L); return ((struct ib_qp *)tmp___6); } else { } } else { } nes_ucontext = to_nesucontext((ibpd->uobject)->context); tmp___7 = find_next_zero_bit((unsigned long const *)(& nes_ucontext->allocated_wqs), 4096UL, (unsigned long )nes_ucontext->first_free_wq); nesqp->mmap_sq_db_index = (u32 )tmp___7; if (nesqp->mmap_sq_db_index > 4095U) { if ((nes_debug_level & 16384U) != 0U) { printk("\viw_nes: %s[%u]: db index > max user regions, failing create QP\n", "nes_create_qp", 1262); } else { } nes_free_resource(nesadapter, nesadapter->allocated_qps, qp_num); if (virt_wqs != 0) { pci_free_consistent(nesdev->pcidev, (size_t )nespbl->pbl_size, (void *)nespbl->pbl_vbase, nespbl->pbl_pbase); kfree((void const *)nespbl); } else { } kfree((void const *)nesqp->allocated_buffer); tmp___8 = ERR_PTR(-12L); return ((struct ib_qp *)tmp___8); } else { } set_bit(nesqp->mmap_sq_db_index, (unsigned long volatile *)(& nes_ucontext->allocated_wqs)); nes_ucontext->mmap_nesqp[nesqp->mmap_sq_db_index] = nesqp; nes_ucontext->first_free_wq = (unsigned int )((u16 )nesqp->mmap_sq_db_index) + 1U; } else { nes_free_resource(nesadapter, nesadapter->allocated_qps, qp_num); kfree((void const *)nesqp->allocated_buffer); tmp___9 = ERR_PTR(-14L); return ((struct ib_qp *)tmp___9); } } else { } if (virt_wqs == 0) { tmp___10 = nes_setup_mmap_qp(nesqp, nesvnic, sq_size, rq_size); err = tmp___10; } else { tmp___11 = nes_setup_virt_qp(nesqp, nespbl, nesvnic, sq_size, rq_size); err = tmp___11; } if (err != 0) { if ((nes_debug_level & 16384U) != 0U) { printk("\viw_nes: %s[%u]: error geting qp mem code = %d\n", "nes_create_qp", 1285, err); } else { } nes_free_resource(nesadapter, nesadapter->allocated_qps, qp_num); kfree((void const *)nesqp->allocated_buffer); tmp___12 = ERR_PTR(-12L); return ((struct ib_qp *)tmp___12); } else { } nesqp->hwqp.sq_size = (u16 )sq_size; nesqp->hwqp.sq_encoded_size = sq_encoded_size; nesqp->hwqp.sq_head = 1U; nesqp->hwqp.rq_size = (u16 )rq_size; nesqp->hwqp.rq_encoded_size = rq_encoded_size; nesqp->hwqp.qp_id = qp_num; nesqp->ibqp.qp_num = nesqp->hwqp.qp_id; nesqp->nespd = nespd; nescq = to_nescq(init_attr->send_cq); nesqp->nesscq = nescq; nescq = to_nescq(init_attr->recv_cq); nesqp->nesrcq = nescq; (nesqp->nesqp_context)->misc = (nesqp->nesqp_context)->misc | (((nesdev->pcidev)->devfn & 7U) << 12); (nesqp->nesqp_context)->misc = (nesqp->nesqp_context)->misc | ((unsigned int )nesqp->hwqp.rq_encoded_size << 8); (nesqp->nesqp_context)->misc = (nesqp->nesqp_context)->misc | ((unsigned int )nesqp->hwqp.sq_encoded_size << 10); if ((unsigned long )udata == (unsigned long )((struct ib_udata *)0)) { (nesqp->nesqp_context)->misc = (nesqp->nesqp_context)->misc | 1073741824U; (nesqp->nesqp_context)->misc = (nesqp->nesqp_context)->misc | 536870912U; } else { } (nesqp->nesqp_context)->cqs = (unsigned int )(nesqp->nesscq)->hw_cq.cq_number + ((unsigned int )(nesqp->nesrcq)->hw_cq.cq_number << 16); u64temp = nesqp->hwqp.sq_pbase; (nesqp->nesqp_context)->sq_addr_low = (unsigned int )u64temp; (nesqp->nesqp_context)->sq_addr_high = (unsigned int )(u64temp >> 32); if (virt_wqs == 0) { u64temp = nesqp->hwqp.sq_pbase; (nesqp->nesqp_context)->sq_addr_low = (unsigned int )u64temp; (nesqp->nesqp_context)->sq_addr_high = (unsigned int )(u64temp >> 32); u64temp = nesqp->hwqp.rq_pbase; (nesqp->nesqp_context)->rq_addr_low = (unsigned int )u64temp; (nesqp->nesqp_context)->rq_addr_high = (unsigned int )(u64temp >> 32); } else { u64temp = nesqp->pbl_pbase; (nesqp->nesqp_context)->rq_addr_low = (unsigned int )u64temp; (nesqp->nesqp_context)->rq_addr_high = (unsigned int )(u64temp >> 32); } tmp___13 = spinlock_check(& nesdev->cqp.lock); flags = _raw_spin_lock_irqsave(tmp___13); (nesqp->nesqp_context)->misc2 = (nesqp->nesqp_context)->misc2 | ((unsigned int )nesvnic->qp_nic_index[(int )nesvnic->next_qp_nic_index] << 10); nesvnic->next_qp_nic_index = (u8 )((int )nesvnic->next_qp_nic_index + 1); if ((unsigned int )nesvnic->next_qp_nic_index > 3U || (unsigned int )nesvnic->qp_nic_index[(int )nesvnic->next_qp_nic_index] == 15U) { nesvnic->next_qp_nic_index = 0U; } else { } spin_unlock_irqrestore(& nesdev->cqp.lock, flags); (nesqp->nesqp_context)->pd_index_wscale = (nesqp->nesqp_context)->pd_index_wscale | ((unsigned int )(nesqp->nespd)->pd_id << 16); u64temp = nesqp->hwqp.q2_pbase; (nesqp->nesqp_context)->q2_addr_low = (unsigned int )u64temp; (nesqp->nesqp_context)->q2_addr_high = (unsigned int )(u64temp >> 32); (nesqp->nesqp_context)->aeq_token_low = (unsigned int )((long )nesqp); (nesqp->nesqp_context)->aeq_token_high = (unsigned int )((unsigned long )nesqp >> 32UL); (nesqp->nesqp_context)->ird_ord_sizes = (((unsigned int )nesadapter->max_irrq_wr << 16) & 196608U) | 1207959552U; if (disable_mpa_crc != 0) { if ((nes_debug_level & 16384U) != 0U) { printk("\viw_nes: %s[%u]: Disabling MPA crc checking due to module option.\n", "nes_create_qp", 1363); } else { } (nesqp->nesqp_context)->ird_ord_sizes = (nesqp->nesqp_context)->ird_ord_sizes | 2147483648U; } else { } cqp_request = nes_get_cqp_request(nesdev); if ((unsigned long )cqp_request == (unsigned long )((struct nes_cqp_request *)0)) { if ((nes_debug_level & 16384U) != 0U) { printk("\viw_nes: %s[%u]: Failed to get a cqp_request\n", "nes_create_qp", 1371); } else { } nes_free_resource(nesadapter, nesadapter->allocated_qps, qp_num); nes_free_qp_mem(nesdev, nesqp, virt_wqs); kfree((void const *)nesqp->allocated_buffer); tmp___14 = ERR_PTR(-12L); return ((struct ib_qp *)tmp___14); } else { } cqp_request->waiting = 1U; cqp_wqe = & cqp_request->cqp_wqe; if (virt_wqs == 0) { opcode = 268500992U; } else { opcode = 268509184U; } opcode = opcode | 32768U; nes_fill_init_cqp_wqe(cqp_wqe, nesdev); set_wqe_32bit_value((__le32 *)(& cqp_wqe->wqe_words), 0U, opcode); set_wqe_32bit_value((__le32 *)(& cqp_wqe->wqe_words), 1U, nesqp->hwqp.qp_id); u64temp = nesqp->nesqp_context_pbase; set_wqe_64bit_value((__le32 *)(& cqp_wqe->wqe_words), 6U, u64temp); atomic_set(& cqp_request->refcount, 2); nes_post_cqp_request(nesdev, cqp_request); if ((nes_debug_level & 16384U) != 0U) { printk("\viw_nes: %s[%u]: Waiting for create iWARP QP%u to complete.\n", "nes_create_qp", 1400, nesqp->hwqp.qp_id); } else { } __ret = 1200000L; if ((unsigned int )cqp_request->request_done == 0U) { tmp___15 = get_current(); __wait.flags = 0U; __wait.private = (void *)tmp___15; __wait.func = & autoremove_wake_function; __wait.task_list.next = & __wait.task_list; __wait.task_list.prev = & __wait.task_list; ldv_54590: prepare_to_wait(& cqp_request->waitq, & __wait, 2); if ((unsigned int )cqp_request->request_done != 0U) { goto ldv_54589; } else { } __ret = schedule_timeout(__ret); if (__ret == 0L) { goto ldv_54589; } else { } goto ldv_54590; ldv_54589: finish_wait(& cqp_request->waitq, & __wait); } else { } ret = (int )__ret; if ((nes_debug_level & 16384U) != 0U) { printk("\viw_nes: %s[%u]: Create iwarp QP%u completed, wait_event_timeout ret=%u, nesdev->cqp_head = %u, nesdev->cqp.sq_tail = %u, CQP Major:Minor codes = 0x%04X:0x%04X.\n", "nes_create_qp", 1407, nesqp->hwqp.qp_id, ret, (int )nesdev->cqp.sq_head, (int )nesdev->cqp.sq_tail, (int )cqp_request->major_code, (int )cqp_request->minor_code); } else { } if (ret == 0 || (unsigned int )cqp_request->major_code != 0U) { nes_put_cqp_request(nesdev, cqp_request); nes_free_resource(nesadapter, nesadapter->allocated_qps, qp_num); nes_free_qp_mem(nesdev, nesqp, virt_wqs); kfree((void const *)nesqp->allocated_buffer); if (ret == 0) { tmp___16 = ERR_PTR(-62L); return ((struct ib_qp *)tmp___16); } else { tmp___17 = ERR_PTR(-5L); return ((struct ib_qp *)tmp___17); } } else { } nes_put_cqp_request(nesdev, cqp_request); if ((unsigned long )ibpd->uobject != (unsigned long )((struct ib_uobject *)0)) { uresp.mmap_sq_db_index = nesqp->mmap_sq_db_index; uresp.actual_sq_size = (__u32 )sq_size; uresp.actual_rq_size = (__u32 )rq_size; uresp.qp_id = nesqp->hwqp.qp_id; uresp.nes_drv_opt = nes_drv_opt; tmp___19 = ib_copy_to_udata(udata, (void *)(& uresp), 24UL); if (tmp___19 != 0) { nes_free_resource(nesadapter, nesadapter->allocated_qps, qp_num); nes_free_qp_mem(nesdev, nesqp, virt_wqs); kfree((void const *)nesqp->allocated_buffer); tmp___18 = ERR_PTR(-14L); return ((struct ib_qp *)tmp___18); } else { } } else { } if ((nes_debug_level & 16384U) != 0U) { printk("\viw_nes: %s[%u]: QP%u structure located @%p.Size = %u.\n", "nes_create_qp", 1437, nesqp->hwqp.qp_id, nesqp, 840U); } else { } spinlock_check(& nesqp->lock); __raw_spin_lock_init(& nesqp->lock.ldv_5961.rlock, "&(&nesqp->lock)->rlock", & __key); nes_add_ref(& nesqp->ibqp); goto ldv_54593; default: ; if ((nes_debug_level & 16384U) != 0U) { printk("\viw_nes: %s[%u]: Invalid QP type: %d\n", "nes_create_qp", 1442, (unsigned int )init_attr->qp_type); } else { } tmp___20 = ERR_PTR(-22L); return ((struct ib_qp *)tmp___20); } ldv_54593: nesqp->sig_all = (unsigned int )init_attr->sq_sig_type == 0U; init_timer_key(& nesqp->terminate_timer, 0U, "(&nesqp->terminate_timer)", & __key___0); nesqp->terminate_timer.function = & nes_terminate_timeout; nesqp->terminate_timer.data = (unsigned long )nesqp; *((nesdev->nesadapter)->qp_table + (unsigned long )(nesqp->hwqp.qp_id - 64U)) = nesqp; if ((nes_debug_level & 16384U) != 0U) { tmp___21 = netdev_refcnt_read((struct net_device const *)nesvnic->netdev); printk("\viw_nes: %s[%u]: netdev refcnt=%u\n", "nes_create_qp", 1454, tmp___21); } else { } return (& nesqp->ibqp); } } static void nes_clean_cq(struct nes_qp *nesqp , struct nes_cq *nescq ) { u32 cq_head ; u32 lo ; u32 hi ; u64 u64temp ; unsigned long flags ; raw_spinlock_t *tmp ; { flags = 0UL; tmp = spinlock_check(& nescq->lock); flags = _raw_spin_lock_irqsave(tmp); cq_head = (u32 )nescq->hw_cq.cq_head; goto ldv_54609; ldv_54608: __asm__ volatile ("lfence": : : "memory"); lo = (nescq->hw_cq.cq_vbase + (unsigned long )cq_head)->cqe_words[2]; hi = (nescq->hw_cq.cq_vbase + (unsigned long )cq_head)->cqe_words[3]; u64temp = ((unsigned long long )hi << 32) | (unsigned long long )lo; u64temp = u64temp & 0xfffffffffffffc00ULL; if ((unsigned long long )nesqp == u64temp) { (nescq->hw_cq.cq_vbase + (unsigned long )cq_head)->cqe_words[2] = 0U; (nescq->hw_cq.cq_vbase + (unsigned long )cq_head)->cqe_words[3] = 0U; } else { } cq_head = cq_head + 1U; if (cq_head >= (u32 )nescq->hw_cq.cq_size) { cq_head = 0U; } else { } ldv_54609: ; if ((int )(nescq->hw_cq.cq_vbase + (unsigned long )cq_head)->cqe_words[7] < 0) { goto ldv_54608; } else { goto ldv_54610; } ldv_54610: spin_unlock_irqrestore(& nescq->lock, flags); return; } } static int nes_destroy_qp(struct ib_qp *ibqp ) { struct nes_qp *nesqp ; struct nes_qp *tmp ; struct nes_ucontext *nes_ucontext ; struct ib_qp_attr attr ; struct iw_cm_id *cm_id ; struct iw_cm_event cm_event ; int ret ; int tmp___0 ; { tmp = to_nesqp(ibqp); nesqp = tmp; ret = 0; atomic_inc(& sw_qps_destroyed); nesqp->destroyed = 1U; if ((unsigned int )nesqp->ibqp_state != 0U && (unsigned int )nesqp->ibqp_state <= 3U) { attr.qp_state = 6; nes_modify_qp(& nesqp->ibqp, & attr, 1, 0); } else { } if (((unsigned int )nesqp->ibqp_state == 1U || (unsigned int )nesqp->ibqp_state == 2U) && (unsigned long )nesqp->cm_id != (unsigned long )((struct iw_cm_id *)0)) { cm_id = nesqp->cm_id; cm_event.event = 2; cm_event.status = -110; cm_event.local_addr = cm_id->local_addr; cm_event.remote_addr = cm_id->remote_addr; cm_event.private_data = 0; cm_event.private_data_len = 0U; if ((nes_debug_level & 16384U) != 0U) { tmp___0 = atomic_read((atomic_t const *)(& nesqp->refcount)); printk("\viw_nes: %s[%u]: Generating a CM Timeout Event for QP%u. cm_id = %p, refcount = %u. \n", "nes_destroy_qp", 1527, nesqp->hwqp.qp_id, cm_id, tmp___0); } else { } (*(cm_id->rem_ref))(cm_id); ret = (*(cm_id->event_handler))(cm_id, & cm_event); if (ret != 0) { if ((nes_debug_level & 16384U) != 0U) { printk("\viw_nes: %s[%u]: OFA CM event_handler returned, ret=%d\n", "nes_destroy_qp", 1532, ret); } else { } } else { } } else { } if ((unsigned int )*((unsigned char *)nesqp + 820UL) != 0U) { if ((unsigned long )ibqp->uobject != (unsigned long )((struct ib_uobject *)0) && (unsigned long )(ibqp->uobject)->context != (unsigned long )((struct ib_ucontext *)0)) { nes_ucontext = to_nesucontext((ibqp->uobject)->context); clear_bit((int )nesqp->mmap_sq_db_index, (unsigned long volatile *)(& nes_ucontext->allocated_wqs)); nes_ucontext->mmap_nesqp[nesqp->mmap_sq_db_index] = 0; if ((u32 )nes_ucontext->first_free_wq > nesqp->mmap_sq_db_index) { nes_ucontext->first_free_wq = (u16 )nesqp->mmap_sq_db_index; } else { } } else { } if (nesqp->pbl_pbase != 0ULL && (unsigned int )nesqp->sq_kmapped != 0U) { nesqp->sq_kmapped = 0U; kunmap(nesqp->page); } else { } } else { if ((unsigned long )nesqp->nesscq != (unsigned long )((struct nes_cq *)0)) { nes_clean_cq(nesqp, nesqp->nesscq); } else { } if ((unsigned long )nesqp->nesrcq != (unsigned long )((struct nes_cq *)0) && (unsigned long )nesqp->nesrcq != (unsigned long )nesqp->nesscq) { nes_clean_cq(nesqp, nesqp->nesrcq); } else { } } nes_rem_ref(& nesqp->ibqp); return (0); } } static struct ib_cq *nes_create_cq(struct ib_device *ibdev , int entries , int comp_vector , struct ib_ucontext *context , struct ib_udata *udata ) { u64 u64temp ; struct nes_vnic *nesvnic ; struct nes_vnic *tmp ; struct nes_device *nesdev ; struct nes_adapter *nesadapter ; struct nes_cq *nescq ; struct nes_ucontext *nes_ucontext ; struct nes_cqp_request *cqp_request ; void *mem ; struct nes_hw_cqp_wqe *cqp_wqe ; struct nes_pbl *nespbl ; struct nes_create_cq_req req ; struct nes_create_cq_resp resp ; u32 cq_num ; u32 opcode ; u32 pbl_entries ; int err ; unsigned long flags ; int ret ; void *tmp___0 ; void *tmp___1 ; void *tmp___2 ; void *tmp___3 ; int _max1 ; int _max2 ; int tmp___4 ; void *tmp___5 ; int tmp___6 ; struct list_head const *__mptr ; struct list_head const *__mptr___0 ; void *tmp___7 ; void *tmp___8 ; struct lock_class_key __key ; void *tmp___9 ; raw_spinlock_t *tmp___10 ; void *tmp___11 ; void *tmp___12 ; long __ret ; wait_queue_t __wait ; struct task_struct *tmp___13 ; void *tmp___14 ; void *tmp___15 ; int tmp___16 ; { tmp = to_nesvnic(ibdev); nesvnic = tmp; nesdev = nesvnic->nesdev; nesadapter = nesdev->nesadapter; nes_ucontext = 0; mem = 0; nespbl = 0; cq_num = 0U; opcode = 0U; pbl_entries = 1U; if ((u32 )entries > nesadapter->max_cqe) { tmp___0 = ERR_PTR(-22L); return ((struct ib_cq *)tmp___0); } else { } err = nes_alloc_resource(nesadapter, nesadapter->allocated_cqs, nesadapter->max_cq, & cq_num, & nesadapter->next_cq, 7); if (err != 0) { tmp___1 = ERR_PTR((long )err); return ((struct ib_cq *)tmp___1); } else { } tmp___2 = kzalloc(168UL, 208U); nescq = (struct nes_cq *)tmp___2; if ((unsigned long )nescq == (unsigned long )((struct nes_cq *)0)) { nes_free_resource(nesadapter, nesadapter->allocated_cqs, cq_num); if ((nes_debug_level & 8192U) != 0U) { printk("\viw_nes: %s[%u]: Unable to allocate nes_cq struct\n", "nes_create_cq", 1599); } else { } tmp___3 = ERR_PTR(-12L); return ((struct ib_cq *)tmp___3); } else { } _max1 = entries + 1; _max2 = 5; if (_max1 > _max2) { tmp___4 = _max1; } else { tmp___4 = _max2; } nescq->hw_cq.cq_size = (u16 )tmp___4; nescq->hw_cq.cq_number = (u16 )cq_num; nescq->ibcq.cqe = (int )nescq->hw_cq.cq_size + -1; if ((unsigned long )context != (unsigned long )((struct ib_ucontext *)0)) { nes_ucontext = to_nesucontext(context); tmp___6 = ib_copy_from_udata((void *)(& req), udata, 16UL); if (tmp___6 != 0) { nes_free_resource(nesadapter, nesadapter->allocated_cqs, cq_num); kfree((void const *)nescq); tmp___5 = ERR_PTR(-14L); return ((struct ib_cq *)tmp___5); } else { } nesvnic->mcrq_ucontext = nes_ucontext; nes_ucontext->mcrqf = req.mcrqf; if (nes_ucontext->mcrqf != 0U) { if ((int )nes_ucontext->mcrqf < 0) { nescq->hw_cq.cq_number = ((unsigned int )nesvnic->nic.qp_id + (unsigned int )((u16 )((nes_ucontext->mcrqf & 15U) + 2147483647U)) * 2U) + 28U; } else if ((nes_ucontext->mcrqf & 1073741824U) != 0U) { nescq->hw_cq.cq_number = (u16 )nes_ucontext->mcrqf; } else { nescq->hw_cq.cq_number = (unsigned int )((int )((u16 )nesvnic->mcrq_qp_id) + (int )((u16 )nes_ucontext->mcrqf)) - 1U; } nescq->mcrqf = nes_ucontext->mcrqf; nes_free_resource(nesadapter, nesadapter->allocated_cqs, cq_num); } else { } if ((nes_debug_level & 8192U) != 0U) { printk("\viw_nes: %s[%u]: CQ Virtual Address = %08lX, size = %u.\n", "nes_create_cq", 1628, (unsigned long )req.user_cq_buffer, entries); } else { } err = 1; __mptr = (struct list_head const *)nes_ucontext->cq_reg_mem_list.next; nespbl = (struct nes_pbl *)__mptr + 0xffffffffffffffd8UL; goto ldv_54656; ldv_54655: ; if (nespbl->user_base == (unsigned long )req.user_cq_buffer) { list_del(& nespbl->list); err = 0; if ((nes_debug_level & 8192U) != 0U) { printk("\viw_nes: %s[%u]: Found PBL for virtual CQ. nespbl=%p.\n", "nes_create_cq", 1635, nespbl); } else { } goto ldv_54654; } else { } __mptr___0 = (struct list_head const *)nespbl->list.next; nespbl = (struct nes_pbl *)__mptr___0 + 0xffffffffffffffd8UL; ldv_54656: ; if ((unsigned long )(& nespbl->list) != (unsigned long )(& nes_ucontext->cq_reg_mem_list)) { goto ldv_54655; } else { goto ldv_54654; } ldv_54654: ; if (err != 0) { nes_free_resource(nesadapter, nesadapter->allocated_cqs, cq_num); kfree((void const *)nescq); tmp___7 = ERR_PTR(-14L); return ((struct ib_cq *)tmp___7); } else { } pbl_entries = nespbl->pbl_size >> 3; nescq->cq_mem_size = 0U; } else { nescq->cq_mem_size = (u32 )nescq->hw_cq.cq_size * 32U; if ((nes_debug_level & 8192U) != 0U) { printk("\viw_nes: %s[%u]: Attempting to allocate pci memory (%u entries, %u bytes) for CQ%u.\n", "nes_create_cq", 1650, entries, nescq->cq_mem_size, (int )nescq->hw_cq.cq_number); } else { } mem = pci_alloc_consistent(nesdev->pcidev, (size_t )nescq->cq_mem_size, & nescq->hw_cq.cq_pbase); if ((unsigned long )mem == (unsigned long )((void *)0)) { printk("\viw_nes: Unable to allocate pci memory for cq\n"); nes_free_resource(nesadapter, nesadapter->allocated_cqs, cq_num); kfree((void const *)nescq); tmp___8 = ERR_PTR(-12L); return ((struct ib_cq *)tmp___8); } else { } memset(mem, 0, (size_t )nescq->cq_mem_size); nescq->hw_cq.cq_vbase = (struct nes_hw_cqe *)mem; nescq->hw_cq.cq_head = 0U; if ((nes_debug_level & 8192U) != 0U) { printk("\viw_nes: %s[%u]: CQ%u virtual address @ %p, phys = 0x%08X\n", "nes_create_cq", 1667, (int )nescq->hw_cq.cq_number, nescq->hw_cq.cq_vbase, (unsigned int )nescq->hw_cq.cq_pbase); } else { } } nescq->hw_cq.ce_handler = & nes_iwarp_ce_handler; spinlock_check(& nescq->lock); __raw_spin_lock_init(& nescq->lock.ldv_5961.rlock, "&(&nescq->lock)->rlock", & __key); cqp_request = nes_get_cqp_request(nesdev); if ((unsigned long )cqp_request == (unsigned long )((struct nes_cqp_request *)0)) { if ((nes_debug_level & 8192U) != 0U) { printk("\viw_nes: %s[%u]: Failed to get a cqp_request.\n", "nes_create_cq", 1676); } else { } if ((unsigned long )context == (unsigned long )((struct ib_ucontext *)0)) { pci_free_consistent(nesdev->pcidev, (size_t )nescq->cq_mem_size, mem, nescq->hw_cq.cq_pbase); } else { pci_free_consistent(nesdev->pcidev, (size_t )nespbl->pbl_size, (void *)nespbl->pbl_vbase, nespbl->pbl_pbase); kfree((void const *)nespbl); } nes_free_resource(nesadapter, nesadapter->allocated_cqs, cq_num); kfree((void const *)nescq); tmp___9 = ERR_PTR(-12L); return ((struct ib_cq *)tmp___9); } else { } cqp_request->waiting = 1U; cqp_wqe = & cqp_request->cqp_wqe; opcode = ((unsigned int )nescq->hw_cq.cq_size << 16) | 5635U; tmp___10 = spinlock_check(& nesadapter->pbl_lock); flags = _raw_spin_lock_irqsave(tmp___10); if (pbl_entries != 1U) { if (pbl_entries > 32U) { if ((nes_debug_level & 8192U) != 0U) { printk("\viw_nes: %s[%u]: pbl_entries=%u, use a 4k PBL\n", "nes_create_cq", 1702, pbl_entries); } else { } if (nesadapter->free_4kpbl == 0U) { spin_unlock_irqrestore(& nesadapter->pbl_lock, flags); nes_free_cqp_request(nesdev, cqp_request); if ((unsigned long )context == (unsigned long )((struct ib_ucontext *)0)) { pci_free_consistent(nesdev->pcidev, (size_t )nescq->cq_mem_size, mem, nescq->hw_cq.cq_pbase); } else { pci_free_consistent(nesdev->pcidev, (size_t )nespbl->pbl_size, (void *)nespbl->pbl_vbase, nespbl->pbl_pbase); kfree((void const *)nespbl); } nes_free_resource(nesadapter, nesadapter->allocated_cqs, cq_num); kfree((void const *)nescq); tmp___11 = ERR_PTR(-12L); return ((struct ib_cq *)tmp___11); } else { opcode = opcode | 49152U; nescq->virtual_cq = 2U; nesadapter->free_4kpbl = nesadapter->free_4kpbl - 1U; } } else { if ((nes_debug_level & 8192U) != 0U) { printk("\viw_nes: %s[%u]: pbl_entries=%u, use a 256 byte PBL\n", "nes_create_cq", 1724, pbl_entries); } else { } if (nesadapter->free_256pbl == 0U) { spin_unlock_irqrestore(& nesadapter->pbl_lock, flags); nes_free_cqp_request(nesdev, cqp_request); if ((unsigned long )context == (unsigned long )((struct ib_ucontext *)0)) { pci_free_consistent(nesdev->pcidev, (size_t )nescq->cq_mem_size, mem, nescq->hw_cq.cq_pbase); } else { pci_free_consistent(nesdev->pcidev, (size_t )nespbl->pbl_size, (void *)nespbl->pbl_vbase, nespbl->pbl_pbase); kfree((void const *)nespbl); } nes_free_resource(nesadapter, nesadapter->allocated_cqs, cq_num); kfree((void const *)nescq); tmp___12 = ERR_PTR(-12L); return ((struct ib_cq *)tmp___12); } else { opcode = opcode | 32768U; nescq->virtual_cq = 1U; nesadapter->free_256pbl = nesadapter->free_256pbl - 1U; } } } else { } spin_unlock_irqrestore(& nesadapter->pbl_lock, flags); nes_fill_init_cqp_wqe(cqp_wqe, nesdev); set_wqe_32bit_value((__le32 *)(& cqp_wqe->wqe_words), 0U, opcode); set_wqe_32bit_value((__le32 *)(& cqp_wqe->wqe_words), 1U, (unsigned int )nescq->hw_cq.cq_number | ((unsigned int )nesdev->ceq_index << 16)); if ((unsigned long )context != (unsigned long )((struct ib_ucontext *)0)) { if (pbl_entries != 1U) { u64temp = nespbl->pbl_pbase; } else { u64temp = *(nespbl->pbl_vbase); } set_wqe_32bit_value((__le32 *)(& cqp_wqe->wqe_words), 10U, (u32 )nes_ucontext->mmap_db_index[0]); } else { u64temp = nescq->hw_cq.cq_pbase; cqp_wqe->wqe_words[10] = 0U; } set_wqe_64bit_value((__le32 *)(& cqp_wqe->wqe_words), 6U, u64temp); cqp_wqe->wqe_words[9] = 0U; u64temp = (unsigned long long )(& nescq->hw_cq); cqp_wqe->wqe_words[8] = (unsigned int )(u64temp >> 1); cqp_wqe->wqe_words[9] = (unsigned int )(u64temp >> 33) & 2147483647U; atomic_set(& cqp_request->refcount, 2); nes_post_cqp_request(nesdev, cqp_request); if ((nes_debug_level & 8192U) != 0U) { printk("\viw_nes: %s[%u]: Waiting for create iWARP CQ%u to complete.\n", "nes_create_cq", 1778, (int )nescq->hw_cq.cq_number); } else { } __ret = 2400000L; if ((unsigned int )cqp_request->request_done == 0U) { tmp___13 = get_current(); __wait.flags = 0U; __wait.private = (void *)tmp___13; __wait.func = & autoremove_wake_function; __wait.task_list.next = & __wait.task_list; __wait.task_list.prev = & __wait.task_list; ldv_54664: prepare_to_wait(& cqp_request->waitq, & __wait, 2); if ((unsigned int )cqp_request->request_done != 0U) { goto ldv_54663; } else { } __ret = schedule_timeout(__ret); if (__ret == 0L) { goto ldv_54663; } else { } goto ldv_54664; ldv_54663: finish_wait(& cqp_request->waitq, & __wait); } else { } ret = (int )__ret; if ((nes_debug_level & 8192U) != 0U) { printk("\viw_nes: %s[%u]: Create iWARP CQ%u completed, wait_event_timeout ret = %d.\n", "nes_create_cq", 1782, (int )nescq->hw_cq.cq_number, ret); } else { } if (ret == 0 || (unsigned int )cqp_request->major_code != 0U) { nes_put_cqp_request(nesdev, cqp_request); if ((unsigned long )context == (unsigned long )((struct ib_ucontext *)0)) { pci_free_consistent(nesdev->pcidev, (size_t )nescq->cq_mem_size, mem, nescq->hw_cq.cq_pbase); } else { pci_free_consistent(nesdev->pcidev, (size_t )nespbl->pbl_size, (void *)nespbl->pbl_vbase, nespbl->pbl_pbase); kfree((void const *)nespbl); } nes_free_resource(nesadapter, nesadapter->allocated_cqs, cq_num); kfree((void const *)nescq); tmp___14 = ERR_PTR(-5L); return ((struct ib_cq *)tmp___14); } else { } nes_put_cqp_request(nesdev, cqp_request); if ((unsigned long )context != (unsigned long )((struct ib_ucontext *)0)) { pci_free_consistent(nesdev->pcidev, (size_t )nespbl->pbl_size, (void *)nespbl->pbl_vbase, nespbl->pbl_pbase); kfree((void const *)nespbl); resp.cq_id = (__u32 )nescq->hw_cq.cq_number; resp.cq_size = (__u32 )nescq->hw_cq.cq_size; resp.mmap_db_index = 0U; tmp___16 = ib_copy_to_udata(udata, (void *)(& resp), 16UL); if (tmp___16 != 0) { nes_free_resource(nesadapter, nesadapter->allocated_cqs, cq_num); kfree((void const *)nescq); tmp___15 = ERR_PTR(-14L); return ((struct ib_cq *)tmp___15); } else { } } else { } return (& nescq->ibcq); } } static int nes_destroy_cq(struct ib_cq *ib_cq ) { struct nes_cq *nescq ; struct nes_device *nesdev ; struct nes_vnic *nesvnic ; struct nes_adapter *nesadapter ; struct nes_hw_cqp_wqe *cqp_wqe ; struct nes_cqp_request *cqp_request ; unsigned long flags ; u32 opcode ; int ret ; raw_spinlock_t *tmp ; long __ret ; wait_queue_t __wait ; struct task_struct *tmp___0 ; { opcode = 0U; if ((unsigned long )ib_cq == (unsigned long )((struct ib_cq *)0)) { return (0); } else { } nescq = to_nescq(ib_cq); nesvnic = to_nesvnic(ib_cq->device); nesdev = nesvnic->nesdev; nesadapter = nesdev->nesadapter; if ((nes_debug_level & 8192U) != 0U) { printk("\viw_nes: %s[%u]: Destroy CQ%u\n", "nes_destroy_cq", 1841, (int )nescq->hw_cq.cq_number); } else { } cqp_request = nes_get_cqp_request(nesdev); if ((unsigned long )cqp_request == (unsigned long )((struct nes_cqp_request *)0)) { if ((nes_debug_level & 8192U) != 0U) { printk("\viw_nes: %s[%u]: Failed to get a cqp_request.\n", "nes_destroy_cq", 1846); } else { } return (-12); } else { } cqp_request->waiting = 1U; cqp_wqe = & cqp_request->cqp_wqe; opcode = (u32 )(((int )nescq->hw_cq.cq_size << 16) | 5); tmp = spinlock_check(& nesadapter->pbl_lock); flags = _raw_spin_lock_irqsave(tmp); if ((unsigned int )nescq->virtual_cq == 1U) { nesadapter->free_256pbl = nesadapter->free_256pbl + 1U; if (nesadapter->free_256pbl > nesadapter->max_256pbl) { printk("\viw_nes: %s: free 256B PBLs(%u) has exceeded the max(%u)\n", "nes_destroy_cq", nesadapter->free_256pbl, nesadapter->max_256pbl); } else { } } else if ((unsigned int )nescq->virtual_cq == 2U) { nesadapter->free_4kpbl = nesadapter->free_4kpbl + 1U; if (nesadapter->free_4kpbl > nesadapter->max_4kpbl) { printk("\viw_nes: %s: free 4K PBLs(%u) has exceeded the max(%u)\n", "nes_destroy_cq", nesadapter->free_4kpbl, nesadapter->max_4kpbl); } else { } opcode = opcode | 16384U; } else { } spin_unlock_irqrestore(& nesadapter->pbl_lock, flags); nes_fill_init_cqp_wqe(cqp_wqe, nesdev); set_wqe_32bit_value((__le32 *)(& cqp_wqe->wqe_words), 0U, opcode); set_wqe_32bit_value((__le32 *)(& cqp_wqe->wqe_words), 1U, (unsigned int )nescq->hw_cq.cq_number | (((nesdev->pcidev)->devfn & 7U) << 16)); if (nescq->mcrqf == 0U) { nes_free_resource(nesadapter, nesadapter->allocated_cqs, (u32 )nescq->hw_cq.cq_number); } else { } atomic_set(& cqp_request->refcount, 2); nes_post_cqp_request(nesdev, cqp_request); if ((nes_debug_level & 8192U) != 0U) { printk("\viw_nes: %s[%u]: Waiting for destroy iWARP CQ%u to complete.\n", "nes_destroy_cq", 1882, (int )nescq->hw_cq.cq_number); } else { } __ret = 1200000L; if ((unsigned int )cqp_request->request_done == 0U) { tmp___0 = get_current(); __wait.flags = 0U; __wait.private = (void *)tmp___0; __wait.func = & autoremove_wake_function; __wait.task_list.next = & __wait.task_list; __wait.task_list.prev = & __wait.task_list; ldv_54685: prepare_to_wait(& cqp_request->waitq, & __wait, 2); if ((unsigned int )cqp_request->request_done != 0U) { goto ldv_54684; } else { } __ret = schedule_timeout(__ret); if (__ret == 0L) { goto ldv_54684; } else { } goto ldv_54685; ldv_54684: finish_wait(& cqp_request->waitq, & __wait); } else { } ret = (int )__ret; if ((nes_debug_level & 8192U) != 0U) { printk("\viw_nes: %s[%u]: Destroy iWARP CQ%u completed, wait_event_timeout ret = %u, CQP Major:Minor codes = 0x%04X:0x%04X.\n", "nes_destroy_cq", 1888, (int )nescq->hw_cq.cq_number, ret, (int )cqp_request->major_code, (int )cqp_request->minor_code); } else { } if (ret == 0) { if ((nes_debug_level & 8192U) != 0U) { printk("\viw_nes: %s[%u]: iWARP CQ%u destroy timeout expired\n", "nes_destroy_cq", 1891, (int )nescq->hw_cq.cq_number); } else { } ret = -62; } else if ((unsigned int )cqp_request->major_code != 0U) { if ((nes_debug_level & 8192U) != 0U) { printk("\viw_nes: %s[%u]: iWARP CQ%u destroy failed\n", "nes_destroy_cq", 1895, (int )nescq->hw_cq.cq_number); } else { } ret = -5; } else { ret = 0; } nes_put_cqp_request(nesdev, cqp_request); if (nescq->cq_mem_size != 0U) { pci_free_consistent(nesdev->pcidev, (size_t )nescq->cq_mem_size, (void *)nescq->hw_cq.cq_vbase, nescq->hw_cq.cq_pbase); } else { } kfree((void const *)nescq); return (ret); } } static u32 root_256(struct nes_device *nesdev , struct nes_root_vpbl *root_vpbl , struct nes_root_vpbl *new_root , u16 pbl_count_4k ) { u64 leaf_pbl ; int i ; int j ; int k ; void *tmp ; { if ((unsigned int )pbl_count_4k == 1U) { tmp = pci_alloc_consistent(nesdev->pcidev, 512UL, & new_root->pbl_pbase); new_root->pbl_vbase = (struct nes_hw_pb *)tmp; if ((unsigned long )new_root->pbl_vbase == (unsigned long )((struct nes_hw_pb *)0)) { return (0U); } else { } leaf_pbl = root_vpbl->pbl_pbase; i = 0; goto ldv_54698; ldv_54697: (new_root->pbl_vbase + (unsigned long )i)->pa_low = (unsigned int )leaf_pbl; (new_root->pbl_vbase + (unsigned long )i)->pa_high = (unsigned int )(leaf_pbl >> 32); leaf_pbl = leaf_pbl + 256ULL; i = i + 1; ldv_54698: ; if (i <= 15) { goto ldv_54697; } else { goto ldv_54699; } ldv_54699: ; } else { i = 3; goto ldv_54704; ldv_54703: j = i * 16; *(root_vpbl->pbl_vbase + (unsigned long )j) = *(root_vpbl->pbl_vbase + (unsigned long )i); leaf_pbl = (unsigned long long )(root_vpbl->pbl_vbase + (unsigned long )j)->pa_low + ((unsigned long long )(root_vpbl->pbl_vbase + (unsigned long )j)->pa_high << 32); k = 1; goto ldv_54701; ldv_54700: leaf_pbl = leaf_pbl + 256ULL; (root_vpbl->pbl_vbase + (unsigned long )(j + k))->pa_low = (unsigned int )leaf_pbl; (root_vpbl->pbl_vbase + (unsigned long )(j + k))->pa_high = (unsigned int )(leaf_pbl >> 32); k = k + 1; ldv_54701: ; if (k <= 15) { goto ldv_54700; } else { goto ldv_54702; } ldv_54702: i = i - 1; ldv_54704: ; if (i >= 0) { goto ldv_54703; } else { goto ldv_54705; } ldv_54705: ; } return (1U); } } static int nes_reg_mr(struct nes_device *nesdev , struct nes_pd *nespd , u32 stag , u64 region_length , struct nes_root_vpbl *root_vpbl , dma_addr_t single_buffer , u16 pbl_count_4k , u16 residual_page_count_4k , int acc , u64 *iova_start , u16 *actual_pbl_cnt , u8 *used_4k_pbls ) { struct nes_hw_cqp_wqe *cqp_wqe ; struct nes_cqp_request *cqp_request ; unsigned long flags ; int ret ; struct nes_adapter *nesadapter ; uint pg_cnt ; u16 pbl_count_256 ; u16 pbl_count ; u8 use_256_pbls ; u8 use_4k_pbls ; u16 use_two_level ; struct nes_root_vpbl new_root ; u32 opcode ; u16 major_code ; raw_spinlock_t *tmp ; raw_spinlock_t *tmp___0 ; u32 tmp___1 ; long __ret ; wait_queue_t __wait ; struct task_struct *tmp___2 ; raw_spinlock_t *tmp___3 ; { nesadapter = nesdev->nesadapter; pg_cnt = 0U; pbl_count_256 = 0U; pbl_count = 0U; use_256_pbls = 0U; use_4k_pbls = 0U; use_two_level = (unsigned int )pbl_count_4k > 1U; new_root.pbl_pbase = 0ULL; new_root.pbl_vbase = 0; new_root.leaf_vpbl = 0; opcode = 0U; cqp_request = nes_get_cqp_request(nesdev); if ((unsigned long )cqp_request == (unsigned long )((struct nes_cqp_request *)0)) { if ((nes_debug_level & 2048U) != 0U) { printk("\viw_nes: %s[%u]: Failed to get a cqp_request.\n", "nes_reg_mr", 1984); } else { } return (-12); } else { } cqp_request->waiting = 1U; cqp_wqe = & cqp_request->cqp_wqe; if ((unsigned int )pbl_count_4k != 0U) { tmp = spinlock_check(& nesadapter->pbl_lock); flags = _raw_spin_lock_irqsave(tmp); pg_cnt = (uint )(((int )pbl_count_4k + -1) * 512 + (int )residual_page_count_4k); pbl_count_256 = (u16 )((pg_cnt + 31U) / 32U); if (pg_cnt <= 32U) { if ((u32 )pbl_count_256 <= nesadapter->free_256pbl) { use_256_pbls = 1U; } else if ((u32 )pbl_count_4k <= nesadapter->free_4kpbl) { use_4k_pbls = 1U; } else { } } else if (pg_cnt <= 2048U) { if ((u32 )((int )pbl_count_4k + (int )use_two_level) <= nesadapter->free_4kpbl && nesadapter->free_4kpbl > nesadapter->max_4kpbl >> 1) { use_4k_pbls = 1U; } else if ((u32 )((int )pbl_count_256 + 1) <= nesadapter->free_256pbl) { use_256_pbls = 1U; use_two_level = 1U; } else if ((u32 )((int )pbl_count_4k + (int )use_two_level) <= nesadapter->free_4kpbl) { use_4k_pbls = 1U; } else { } } else if ((u32 )((int )pbl_count_4k + 1) <= nesadapter->free_4kpbl) { use_4k_pbls = 1U; } else { } if ((unsigned int )use_256_pbls != 0U) { pbl_count = pbl_count_256; nesadapter->free_256pbl = nesadapter->free_256pbl - (u32 )((int )pbl_count + (int )use_two_level); } else if ((unsigned int )use_4k_pbls != 0U) { pbl_count = pbl_count_4k; nesadapter->free_4kpbl = nesadapter->free_4kpbl - (u32 )((int )pbl_count + (int )use_two_level); } else { spin_unlock_irqrestore(& nesadapter->pbl_lock, flags); if ((nes_debug_level & 2048U) != 0U) { printk("\viw_nes: %s[%u]: Out of Pbls\n", "nes_reg_mr", 2023); } else { } nes_free_cqp_request(nesdev, cqp_request); return (-12); } spin_unlock_irqrestore(& nesadapter->pbl_lock, flags); } else { } if ((unsigned int )use_256_pbls != 0U && (unsigned int )use_two_level != 0U) { tmp___1 = root_256(nesdev, root_vpbl, & new_root, (int )pbl_count_4k); if (tmp___1 == 1U) { if (new_root.pbl_pbase != 0ULL) { root_vpbl = & new_root; } else { } } else { tmp___0 = spinlock_check(& nesadapter->pbl_lock); flags = _raw_spin_lock_irqsave(tmp___0); nesadapter->free_256pbl = nesadapter->free_256pbl + (u32 )((int )pbl_count_256 + (int )use_two_level); use_256_pbls = 0U; if ((unsigned int )pbl_count_4k == 1U) { use_two_level = 0U; } else { } pbl_count = pbl_count_4k; if ((u32 )((int )pbl_count_4k + (int )use_two_level) <= nesadapter->free_4kpbl) { nesadapter->free_4kpbl = nesadapter->free_4kpbl - (u32 )((int )pbl_count + (int )use_two_level); use_4k_pbls = 1U; } else { } spin_unlock_irqrestore(& nesadapter->pbl_lock, flags); if ((unsigned int )use_4k_pbls == 0U) { return (-12); } else { } } } else { } opcode = 74250U; if (acc & 1) { opcode = opcode | 131072U; } else { } if ((acc & 2) != 0) { opcode = opcode | 2621440U; } else { } if ((acc & 4) != 0) { opcode = opcode | 2359296U; } else { } if ((acc & 16) != 0) { opcode = opcode | 3145728U; } else { } nes_fill_init_cqp_wqe(cqp_wqe, nesdev); set_wqe_32bit_value((__le32 *)(& cqp_wqe->wqe_words), 0U, opcode); set_wqe_64bit_value((__le32 *)(& cqp_wqe->wqe_words), 10U, *iova_start); set_wqe_32bit_value((__le32 *)(& cqp_wqe->wqe_words), 7U, (u32 )region_length); cqp_wqe->wqe_words[6] = (unsigned int )(region_length >> 8) & 4278190080U; cqp_wqe->wqe_words[6] = cqp_wqe->wqe_words[6] | ((__le32 )nespd->pd_id & 32767U); set_wqe_32bit_value((__le32 *)(& cqp_wqe->wqe_words), 8U, stag); if ((unsigned int )pbl_count == 0U) { set_wqe_64bit_value((__le32 *)(& cqp_wqe->wqe_words), 12U, single_buffer); } else { set_wqe_64bit_value((__le32 *)(& cqp_wqe->wqe_words), 12U, root_vpbl->pbl_pbase); set_wqe_32bit_value((__le32 *)(& cqp_wqe->wqe_words), 1U, (u32 )pbl_count); set_wqe_32bit_value((__le32 *)(& cqp_wqe->wqe_words), 14U, pg_cnt * 8U); if ((unsigned int )use_4k_pbls != 0U) { cqp_wqe->wqe_words[0] = cqp_wqe->wqe_words[0] | 2048U; } else { } } __asm__ volatile ("": : : "memory"); atomic_set(& cqp_request->refcount, 2); nes_post_cqp_request(nesdev, cqp_request); __ret = 1200000L; if ((unsigned int )cqp_request->request_done == 0U) { tmp___2 = get_current(); __wait.flags = 0U; __wait.private = (void *)tmp___2; __wait.func = & autoremove_wake_function; __wait.task_list.next = & __wait.task_list; __wait.task_list.prev = & __wait.task_list; ldv_54744: prepare_to_wait(& cqp_request->waitq, & __wait, 2); if ((unsigned int )cqp_request->request_done != 0U) { goto ldv_54743; } else { } __ret = schedule_timeout(__ret); if (__ret == 0L) { goto ldv_54743; } else { } goto ldv_54744; ldv_54743: finish_wait(& cqp_request->waitq, & __wait); } else { } ret = (int )__ret; if ((nes_debug_level & 2048U) != 0U) { printk("\viw_nes: %s[%u]: Register STag 0x%08X completed, wait_event_timeout ret = %u, CQP Major:Minor codes = 0x%04X:0x%04X.\n", "nes_reg_mr", 2097, stag, ret, (int )cqp_request->major_code, (int )cqp_request->minor_code); } else { } major_code = cqp_request->major_code; nes_put_cqp_request(nesdev, cqp_request); if ((ret == 0 || (unsigned int )major_code != 0U) && (unsigned int )pbl_count != 0U) { tmp___3 = spinlock_check(& nesadapter->pbl_lock); flags = _raw_spin_lock_irqsave(tmp___3); if ((unsigned int )use_256_pbls != 0U) { nesadapter->free_256pbl = nesadapter->free_256pbl + (u32 )((int )pbl_count + (int )use_two_level); } else if ((unsigned int )use_4k_pbls != 0U) { nesadapter->free_4kpbl = nesadapter->free_4kpbl + (u32 )((int )pbl_count + (int )use_two_level); } else { } spin_unlock_irqrestore(& nesadapter->pbl_lock, flags); } else { } if (new_root.pbl_pbase != 0ULL) { pci_free_consistent(nesdev->pcidev, 512UL, (void *)new_root.pbl_vbase, new_root.pbl_pbase); } else { } if (ret == 0) { return (-62); } else if ((unsigned int )major_code != 0U) { return (-5); } else { } *actual_pbl_cnt = (int )pbl_count + (int )use_two_level; *used_4k_pbls = use_4k_pbls; return (0); } } static struct ib_mr *nes_reg_phys_mr(struct ib_pd *ib_pd , struct ib_phys_buf *buffer_list , int num_phys_buf , int acc , u64 *iova_start ) { u64 region_length ; struct nes_pd *nespd ; struct nes_pd *tmp ; struct nes_vnic *nesvnic ; struct nes_vnic *tmp___0 ; struct nes_device *nesdev ; struct nes_adapter *nesadapter ; struct nes_mr *nesmr ; struct ib_mr *ibmr ; struct nes_vpbl vpbl ; struct nes_root_vpbl root_vpbl ; u32 stag ; u32 i ; unsigned long mask ; u32 stag_index ; u32 next_stag_index ; u32 driver_key ; u32 root_pbl_index ; u32 cur_pbl_index ; int err ; int ret ; u16 pbl_count ; u8 single_page ; u8 stag_key ; void *tmp___1 ; void *tmp___2 ; void *tmp___3 ; void *tmp___4 ; void *tmp___5 ; void *tmp___6 ; void *tmp___7 ; void *tmp___8 ; void *tmp___9 ; void *tmp___10 ; void *tmp___11 ; void *tmp___12 ; u32 tmp___13 ; void *tmp___14 ; { tmp = to_nespd(ib_pd); nespd = tmp; tmp___0 = to_nesvnic(ib_pd->device); nesvnic = tmp___0; nesdev = nesvnic->nesdev; nesadapter = nesdev->nesadapter; stag_index = 0U; next_stag_index = 0U; driver_key = 0U; root_pbl_index = 0U; cur_pbl_index = 0U; err = 0; ret = 0; pbl_count = 0U; single_page = 1U; stag_key = 0U; region_length = 0ULL; vpbl.pbl_vbase = 0; root_vpbl.pbl_vbase = 0; root_vpbl.pbl_pbase = 0ULL; get_random_bytes((void *)(& next_stag_index), 4); stag_key = (unsigned char )next_stag_index; driver_key = 0U; next_stag_index = next_stag_index >> 8; next_stag_index = next_stag_index % nesadapter->max_mr; if (num_phys_buf > 524288) { tmp___1 = ERR_PTR(-7L); return ((struct ib_mr *)tmp___1); } else { } if (((buffer_list->addr ^ *iova_start) & 4095ULL) != 0ULL) { tmp___2 = ERR_PTR(-22L); return ((struct ib_mr *)tmp___2); } else { } err = nes_alloc_resource(nesadapter, nesadapter->allocated_mrs, nesadapter->max_mr, & stag_index, & next_stag_index, 3); if (err != 0) { tmp___3 = ERR_PTR((long )err); return ((struct ib_mr *)tmp___3); } else { } tmp___4 = kzalloc(56UL, 208U); nesmr = (struct nes_mr *)tmp___4; if ((unsigned long )nesmr == (unsigned long )((struct nes_mr *)0)) { nes_free_resource(nesadapter, nesadapter->allocated_mrs, stag_index); tmp___5 = ERR_PTR(-12L); return ((struct ib_mr *)tmp___5); } else { } i = 0U; goto ldv_54781; ldv_54780: ; if ((i & 511U) == 0U) { if (root_pbl_index == 1U) { tmp___6 = pci_alloc_consistent(nesdev->pcidev, 8192UL, & root_vpbl.pbl_pbase); root_vpbl.pbl_vbase = (struct nes_hw_pb *)tmp___6; if ((nes_debug_level & 2048U) != 0U) { printk("\viw_nes: %s[%u]: Allocating root PBL, va = %p, pa = 0x%08X\n", "nes_reg_phys_mr", 2193, root_vpbl.pbl_vbase, (unsigned int )root_vpbl.pbl_pbase); } else { } if ((unsigned long )root_vpbl.pbl_vbase == (unsigned long )((struct nes_hw_pb *)0)) { pci_free_consistent(nesdev->pcidev, 4096UL, (void *)vpbl.pbl_vbase, vpbl.pbl_pbase); nes_free_resource(nesadapter, nesadapter->allocated_mrs, stag_index); kfree((void const *)nesmr); tmp___7 = ERR_PTR(-12L); return ((struct ib_mr *)tmp___7); } else { } tmp___8 = kzalloc(16384UL, 208U); root_vpbl.leaf_vpbl = (struct nes_vpbl *)tmp___8; if ((unsigned long )root_vpbl.leaf_vpbl == (unsigned long )((struct nes_vpbl *)0)) { pci_free_consistent(nesdev->pcidev, 8192UL, (void *)root_vpbl.pbl_vbase, root_vpbl.pbl_pbase); pci_free_consistent(nesdev->pcidev, 4096UL, (void *)vpbl.pbl_vbase, vpbl.pbl_pbase); nes_free_resource(nesadapter, nesadapter->allocated_mrs, stag_index); kfree((void const *)nesmr); tmp___9 = ERR_PTR(-12L); return ((struct ib_mr *)tmp___9); } else { } (root_vpbl.pbl_vbase)->pa_low = (unsigned int )vpbl.pbl_pbase; (root_vpbl.pbl_vbase)->pa_high = (unsigned int )(vpbl.pbl_pbase >> 32); *(root_vpbl.leaf_vpbl) = vpbl; } else { } tmp___10 = pci_alloc_consistent(nesdev->pcidev, 4096UL, & vpbl.pbl_pbase); vpbl.pbl_vbase = (struct nes_hw_pb *)tmp___10; if ((nes_debug_level & 2048U) != 0U) { printk("\viw_nes: %s[%u]: Allocating leaf PBL, va = %p, pa = 0x%016lX\n", "nes_reg_phys_mr", 2220, vpbl.pbl_vbase, (unsigned long )vpbl.pbl_pbase); } else { } if ((unsigned long )vpbl.pbl_vbase == (unsigned long )((struct nes_hw_pb *)0)) { nes_free_resource(nesadapter, nesadapter->allocated_mrs, stag_index); tmp___11 = ERR_PTR(-12L); ibmr = (struct ib_mr *)tmp___11; kfree((void const *)nesmr); goto reg_phys_err; } else { } if (root_pbl_index != 0U) { (root_vpbl.pbl_vbase + (unsigned long )root_pbl_index)->pa_low = (unsigned int )vpbl.pbl_pbase; (root_vpbl.pbl_vbase + (unsigned long )root_pbl_index)->pa_high = (unsigned int )(vpbl.pbl_pbase >> 32); *(root_vpbl.leaf_vpbl + (unsigned long )root_pbl_index) = vpbl; } else { } root_pbl_index = root_pbl_index + 1U; cur_pbl_index = 0U; } else { } mask = (buffer_list + (unsigned long )i)->size == 0ULL; if (i != 0U) { mask = (unsigned long )((buffer_list + (unsigned long )i)->addr | (unsigned long long )mask); } else { } if ((u32 )(num_phys_buf + -1) != i) { mask = (unsigned long )(((buffer_list + (unsigned long )i)->addr + (buffer_list + (unsigned long )i)->size) | (unsigned long long )mask); } else { } if ((mask & 4095UL) != 0UL) { nes_free_resource(nesadapter, nesadapter->allocated_mrs, stag_index); if ((nes_debug_level & 2048U) != 0U) { printk("\viw_nes: %s[%u]: Invalid buffer addr or size\n", "nes_reg_phys_mr", 2247); } else { } tmp___12 = ERR_PTR(-22L); ibmr = (struct ib_mr *)tmp___12; kfree((void const *)nesmr); goto reg_phys_err; } else { } region_length = (buffer_list + (unsigned long )i)->size + region_length; if (i != 0U && (unsigned int )single_page != 0U) { if ((buffer_list + (unsigned long )(i - 1U))->addr + 4096ULL != (buffer_list + (unsigned long )i)->addr) { single_page = 0U; } else { } } else { } (vpbl.pbl_vbase + (unsigned long )cur_pbl_index)->pa_low = (unsigned int )(buffer_list + (unsigned long )i)->addr & 4294963200U; tmp___13 = cur_pbl_index; cur_pbl_index = cur_pbl_index + 1U; (vpbl.pbl_vbase + (unsigned long )tmp___13)->pa_high = (unsigned int )((buffer_list + (unsigned long )i)->addr >> 32); i = i + 1U; ldv_54781: ; if ((u32 )num_phys_buf > i) { goto ldv_54780; } else { goto ldv_54782; } ldv_54782: stag = stag_index << 8; stag = stag | driver_key; stag = (u32 )stag_key + stag; if ((nes_debug_level & 2048U) != 0U) { printk("\viw_nes: %s[%u]: Registering STag 0x%08X, VA = 0x%016lX, length = 0x%016lX, index = 0x%08X\n", "nes_reg_phys_mr", 2269, stag, (unsigned long )*iova_start, (unsigned long )region_length, stag_index); } else { } if (root_pbl_index == 1U) { root_vpbl.pbl_pbase = vpbl.pbl_pbase; } else { } if ((unsigned int )single_page != 0U) { pbl_count = 0U; } else { pbl_count = (u16 )root_pbl_index; } ret = nes_reg_mr(nesdev, nespd, stag, region_length, & root_vpbl, buffer_list->addr, (int )pbl_count, (int )((unsigned short )cur_pbl_index), acc, iova_start, & nesmr->pbls_used, & nesmr->pbl_4k); if (ret == 0) { nesmr->ldv_53249.ibmr.rkey = stag; nesmr->ldv_53249.ibmr.lkey = stag; nesmr->mode = 0U; ibmr = & nesmr->ldv_53249.ibmr; } else { kfree((void const *)nesmr); tmp___14 = ERR_PTR(-12L); ibmr = (struct ib_mr *)tmp___14; } reg_phys_err: ; if (root_pbl_index == 1U) { pci_free_consistent(nesdev->pcidev, 4096UL, (void *)vpbl.pbl_vbase, vpbl.pbl_pbase); } else { i = 0U; goto ldv_54784; ldv_54783: pci_free_consistent(nesdev->pcidev, 4096UL, (void *)(root_vpbl.leaf_vpbl + (unsigned long )i)->pbl_vbase, (root_vpbl.leaf_vpbl + (unsigned long )i)->pbl_pbase); i = i + 1U; ldv_54784: ; if (i < root_pbl_index) { goto ldv_54783; } else { goto ldv_54785; } ldv_54785: kfree((void const *)root_vpbl.leaf_vpbl); pci_free_consistent(nesdev->pcidev, 8192UL, (void *)root_vpbl.pbl_vbase, root_vpbl.pbl_pbase); } return (ibmr); } } static struct ib_mr *nes_get_dma_mr(struct ib_pd *pd , int acc ) { struct ib_phys_buf bl ; u64 kva ; struct ib_mr *tmp ; { kva = 0ULL; if ((nes_debug_level & 2048U) != 0U) { printk("\viw_nes: %s[%u]: \n", "nes_get_dma_mr", 2322); } else { } bl.size = 1099511627775ULL; bl.addr = 0ULL; tmp = nes_reg_phys_mr(pd, & bl, 1, acc, & kva); return (tmp); } } static struct ib_mr *nes_reg_user_mr(struct ib_pd *pd , u64 start , u64 length , u64 virt , int acc , struct ib_udata *udata ) { u64 iova_start ; __le64 *pbl ; u64 region_length ; dma_addr_t last_dma_addr ; dma_addr_t first_dma_addr ; struct nes_pd *nespd ; struct nes_pd *tmp ; struct nes_vnic *nesvnic ; struct nes_vnic *tmp___0 ; struct nes_device *nesdev ; struct nes_adapter *nesadapter ; struct ib_mr *ibmr ; void *tmp___1 ; struct ib_umem_chunk *chunk ; struct nes_ucontext *nes_ucontext ; struct nes_pbl *nespbl ; struct nes_mr *nesmr ; struct ib_umem *region ; struct nes_mem_reg_req req ; struct nes_vpbl vpbl ; struct nes_root_vpbl root_vpbl ; int nmap_index ; int page_index___0 ; int page_count___0 ; int err ; int pbl_depth ; int chunk_pages ; int ret ; u32 stag ; u32 stag_index ; u32 next_stag_index ; u32 driver_key ; u32 root_pbl_index ; u32 cur_pbl_index ; u32 skip_pages ; u16 pbl_count ; u8 single_page ; u8 stag_key ; long tmp___2 ; void *tmp___3 ; int tmp___4 ; void *tmp___5 ; void *tmp___6 ; void *tmp___7 ; struct list_head const *__mptr ; void *tmp___8 ; void *tmp___9 ; void *tmp___10 ; void *tmp___11 ; void *tmp___12 ; void *tmp___13 ; void *tmp___14 ; void *tmp___15 ; void *tmp___16 ; struct list_head const *__mptr___0 ; void *tmp___17 ; void *tmp___18 ; void *tmp___19 ; void *tmp___20 ; void *tmp___21 ; void *tmp___22 ; void *tmp___23 ; void *tmp___24 ; struct list_head const *__mptr___1 ; struct list_head const *__mptr___2 ; void *tmp___25 ; { last_dma_addr = 0ULL; first_dma_addr = 0ULL; tmp = to_nespd(pd); nespd = tmp; tmp___0 = to_nesvnic(pd->device); nesvnic = tmp___0; nesdev = nesvnic->nesdev; nesadapter = nesdev->nesadapter; tmp___1 = ERR_PTR(-22L); ibmr = (struct ib_mr *)tmp___1; page_count___0 = 0; pbl_depth = 0; stag_index = 0U; root_pbl_index = 0U; cur_pbl_index = 0U; single_page = 1U; region = ib_umem_get((pd->uobject)->context, (unsigned long )start, (size_t )length, acc, 0); tmp___2 = IS_ERR((void const *)region); if (tmp___2 != 0L) { return ((struct ib_mr *)region); } else { } if ((nes_debug_level & 2048U) != 0U) { printk("\viw_nes: %s[%u]: User base = 0x%lX, Virt base = 0x%lX, length = %u, offset = %u, page size = %u.\n", "nes_reg_user_mr", 2378, (unsigned long )start, (unsigned long )virt, (unsigned int )length, region->offset, region->page_size); } else { } skip_pages = (unsigned int )region->offset >> 12; tmp___4 = ib_copy_from_udata((void *)(& req), udata, 8UL); if (tmp___4 != 0) { ib_umem_release(region); tmp___3 = ERR_PTR(-14L); return ((struct ib_mr *)tmp___3); } else { } if ((nes_debug_level & 2048U) != 0U) { printk("\viw_nes: %s[%u]: Memory Registration type = %08X.\n", "nes_reg_user_mr", 2386, req.reg_type); } else { } switch (req.reg_type) { case 0: pbl_depth = 0; region_length = 0ULL; vpbl.pbl_vbase = 0; root_vpbl.pbl_vbase = 0; root_vpbl.pbl_pbase = 0ULL; get_random_bytes((void *)(& next_stag_index), 4); stag_key = (unsigned char )next_stag_index; driver_key = next_stag_index & 1879048192U; next_stag_index = next_stag_index >> 8; next_stag_index = next_stag_index % nesadapter->max_mr; err = nes_alloc_resource(nesadapter, nesadapter->allocated_mrs, nesadapter->max_mr, & stag_index, & next_stag_index, 4); if (err != 0) { ib_umem_release(region); tmp___5 = ERR_PTR((long )err); return ((struct ib_mr *)tmp___5); } else { } tmp___6 = kzalloc(56UL, 208U); nesmr = (struct nes_mr *)tmp___6; if ((unsigned long )nesmr == (unsigned long )((struct nes_mr *)0)) { ib_umem_release(region); nes_free_resource(nesadapter, nesadapter->allocated_mrs, stag_index); tmp___7 = ERR_PTR(-12L); return ((struct ib_mr *)tmp___7); } else { } nesmr->region = region; __mptr = (struct list_head const *)region->chunk_list.next; chunk = (struct ib_umem_chunk *)__mptr; goto ldv_54851; ldv_54850: ; if ((nes_debug_level & 2048U) != 0U) { printk("\viw_nes: %s[%u]: Chunk: nents = %u, nmap = %u .\n", "nes_reg_user_mr", 2421, chunk->nents, chunk->nmap); } else { } nmap_index = 0; goto ldv_54848; ldv_54847: ; if ((((struct scatterlist *)(& chunk->page_list) + (unsigned long )nmap_index)->dma_address & 4095ULL) != 0ULL) { ib_umem_release(region); nes_free_resource(nesadapter, nesadapter->allocated_mrs, stag_index); if ((nes_debug_level & 2048U) != 0U) { printk("\viw_nes: %s[%u]: Unaligned Memory Buffer: 0x%x\n", "nes_reg_user_mr", 2427, (unsigned int )((struct scatterlist *)(& chunk->page_list) + (unsigned long )nmap_index)->dma_address); } else { } tmp___8 = ERR_PTR(-22L); ibmr = (struct ib_mr *)tmp___8; kfree((void const *)nesmr); goto reg_user_mr_err; } else { } if (((struct scatterlist *)(& chunk->page_list) + (unsigned long )nmap_index)->dma_length == 0U) { ib_umem_release(region); nes_free_resource(nesadapter, nesadapter->allocated_mrs, stag_index); if ((nes_debug_level & 2048U) != 0U) { printk("\viw_nes: %s[%u]: Invalid Buffer Size\n", "nes_reg_user_mr", 2437); } else { } tmp___9 = ERR_PTR(-22L); ibmr = (struct ib_mr *)tmp___9; kfree((void const *)nesmr); goto reg_user_mr_err; } else { } region_length = (u64 )((struct scatterlist *)(& chunk->page_list) + (unsigned long )nmap_index)->dma_length + region_length; chunk_pages = (int )(((struct scatterlist *)(& chunk->page_list) + (unsigned long )nmap_index)->dma_length >> 12); region_length = region_length - (u64 )(skip_pages << 12); page_index___0 = (int )skip_pages; goto ldv_54845; ldv_54844: skip_pages = 0U; if (page_count___0 != 0 && (size_t )((page_count___0 << 12) - (region->offset & 4095)) >= region->length) { goto enough_pages; } else { } if ((page_count___0 & 511) == 0) { if (page_count___0 > 524287) { ib_umem_release(region); nes_free_resource(nesadapter, nesadapter->allocated_mrs, stag_index); kfree((void const *)nesmr); tmp___10 = ERR_PTR(-7L); ibmr = (struct ib_mr *)tmp___10; goto reg_user_mr_err; } else { } if (root_pbl_index == 1U) { tmp___11 = pci_alloc_consistent(nesdev->pcidev, 8192UL, & root_vpbl.pbl_pbase); root_vpbl.pbl_vbase = (struct nes_hw_pb *)tmp___11; if ((nes_debug_level & 2048U) != 0U) { printk("\viw_nes: %s[%u]: Allocating root PBL, va = %p, pa = 0x%08X\n", "nes_reg_user_mr", 2463, root_vpbl.pbl_vbase, (unsigned int )root_vpbl.pbl_pbase); } else { } if ((unsigned long )root_vpbl.pbl_vbase == (unsigned long )((struct nes_hw_pb *)0)) { ib_umem_release(region); pci_free_consistent(nesdev->pcidev, 4096UL, (void *)vpbl.pbl_vbase, vpbl.pbl_pbase); nes_free_resource(nesadapter, nesadapter->allocated_mrs, stag_index); kfree((void const *)nesmr); tmp___12 = ERR_PTR(-12L); ibmr = (struct ib_mr *)tmp___12; goto reg_user_mr_err; } else { } tmp___13 = kzalloc(16384UL, 208U); root_vpbl.leaf_vpbl = (struct nes_vpbl *)tmp___13; if ((unsigned long )root_vpbl.leaf_vpbl == (unsigned long )((struct nes_vpbl *)0)) { ib_umem_release(region); pci_free_consistent(nesdev->pcidev, 8192UL, (void *)root_vpbl.pbl_vbase, root_vpbl.pbl_pbase); pci_free_consistent(nesdev->pcidev, 4096UL, (void *)vpbl.pbl_vbase, vpbl.pbl_pbase); nes_free_resource(nesadapter, nesadapter->allocated_mrs, stag_index); kfree((void const *)nesmr); tmp___14 = ERR_PTR(-12L); ibmr = (struct ib_mr *)tmp___14; goto reg_user_mr_err; } else { } (root_vpbl.pbl_vbase)->pa_low = (unsigned int )vpbl.pbl_pbase; (root_vpbl.pbl_vbase)->pa_high = (unsigned int )(vpbl.pbl_pbase >> 32); *(root_vpbl.leaf_vpbl) = vpbl; } else { } tmp___15 = pci_alloc_consistent(nesdev->pcidev, 4096UL, & vpbl.pbl_pbase); vpbl.pbl_vbase = (struct nes_hw_pb *)tmp___15; if ((nes_debug_level & 2048U) != 0U) { printk("\viw_nes: %s[%u]: Allocating leaf PBL, va = %p, pa = 0x%08X\n", "nes_reg_user_mr", 2497, vpbl.pbl_vbase, (unsigned int )vpbl.pbl_pbase); } else { } if ((unsigned long )vpbl.pbl_vbase == (unsigned long )((struct nes_hw_pb *)0)) { ib_umem_release(region); nes_free_resource(nesadapter, nesadapter->allocated_mrs, stag_index); tmp___16 = ERR_PTR(-12L); ibmr = (struct ib_mr *)tmp___16; kfree((void const *)nesmr); goto reg_user_mr_err; } else { } if (root_pbl_index != 0U) { (root_vpbl.pbl_vbase + (unsigned long )root_pbl_index)->pa_low = (unsigned int )vpbl.pbl_pbase; (root_vpbl.pbl_vbase + (unsigned long )root_pbl_index)->pa_high = (unsigned int )(vpbl.pbl_pbase >> 32); *(root_vpbl.leaf_vpbl + (unsigned long )root_pbl_index) = vpbl; } else { } root_pbl_index = root_pbl_index + 1U; cur_pbl_index = 0U; } else { } if ((unsigned int )single_page != 0U) { if (page_count___0 != 0) { if (last_dma_addr + 4096ULL != ((struct scatterlist *)(& chunk->page_list) + (unsigned long )nmap_index)->dma_address + (dma_addr_t )(page_index___0 * 4096)) { single_page = 0U; } else { } last_dma_addr = ((struct scatterlist *)(& chunk->page_list) + (unsigned long )nmap_index)->dma_address + (dma_addr_t )(page_index___0 * 4096); } else { first_dma_addr = ((struct scatterlist *)(& chunk->page_list) + (unsigned long )nmap_index)->dma_address + (dma_addr_t )(page_index___0 * 4096); last_dma_addr = first_dma_addr; } } else { } (vpbl.pbl_vbase + (unsigned long )cur_pbl_index)->pa_low = (unsigned int )((struct scatterlist *)(& chunk->page_list) + (unsigned long )nmap_index)->dma_address + (unsigned int )(page_index___0 * 4096); (vpbl.pbl_vbase + (unsigned long )cur_pbl_index)->pa_high = (unsigned int )((((struct scatterlist *)(& chunk->page_list) + (unsigned long )nmap_index)->dma_address + (dma_addr_t )(page_index___0 * 4096)) >> 32); cur_pbl_index = cur_pbl_index + 1U; page_count___0 = page_count___0 + 1; page_index___0 = page_index___0 + 1; ldv_54845: ; if (page_index___0 < chunk_pages) { goto ldv_54844; } else { goto ldv_54846; } ldv_54846: nmap_index = nmap_index + 1; ldv_54848: ; if (chunk->nmap > nmap_index) { goto ldv_54847; } else { goto ldv_54849; } ldv_54849: __mptr___0 = (struct list_head const *)chunk->list.next; chunk = (struct ib_umem_chunk *)__mptr___0; ldv_54851: ; if ((unsigned long )(& chunk->list) != (unsigned long )(& region->chunk_list)) { goto ldv_54850; } else { goto ldv_54852; } ldv_54852: ; enough_pages: ; if ((nes_debug_level & 2048U) != 0U) { printk("\viw_nes: %s[%u]: calculating stag, stag_index=0x%08x, driver_key=0x%08x, stag_key=0x%08x\n", "nes_reg_user_mr", 2544, stag_index, driver_key, (int )stag_key); } else { } stag = stag_index << 8; stag = stag | driver_key; stag = (u32 )stag_key + stag; iova_start = virt; if (root_pbl_index == 1U) { root_vpbl.pbl_pbase = vpbl.pbl_pbase; } else { } if ((unsigned int )single_page != 0U) { pbl_count = 0U; } else { pbl_count = (u16 )root_pbl_index; first_dma_addr = 0ULL; } if ((nes_debug_level & 2048U) != 0U) { printk("\viw_nes: %s[%u]: Registering STag 0x%08X, VA = 0x%08X, length = 0x%08X, index = 0x%08X, region->length=0x%08llx, pbl_count = %u\n", "nes_reg_user_mr", 2565, stag, (unsigned int )iova_start, (unsigned int )region_length, stag_index, (unsigned long long )region->length, (int )pbl_count); } else { } ret = nes_reg_mr(nesdev, nespd, stag, (u64 )region->length, & root_vpbl, first_dma_addr, (int )pbl_count, (int )((unsigned short )cur_pbl_index), acc, & iova_start, & nesmr->pbls_used, & nesmr->pbl_4k); if ((nes_debug_level & 2048U) != 0U) { printk("\viw_nes: %s[%u]: ret=%d\n", "nes_reg_user_mr", 2570, ret); } else { } if (ret == 0) { nesmr->ldv_53249.ibmr.rkey = stag; nesmr->ldv_53249.ibmr.lkey = stag; nesmr->mode = 0U; ibmr = & nesmr->ldv_53249.ibmr; } else { ib_umem_release(region); kfree((void const *)nesmr); tmp___17 = ERR_PTR(-12L); ibmr = (struct ib_mr *)tmp___17; } reg_user_mr_err: ; if (root_pbl_index == 1U) { pci_free_consistent(nesdev->pcidev, 4096UL, (void *)vpbl.pbl_vbase, vpbl.pbl_pbase); } else { page_index___0 = 0; goto ldv_54854; ldv_54853: pci_free_consistent(nesdev->pcidev, 4096UL, (void *)(root_vpbl.leaf_vpbl + (unsigned long )page_index___0)->pbl_vbase, (root_vpbl.leaf_vpbl + (unsigned long )page_index___0)->pbl_pbase); page_index___0 = page_index___0 + 1; ldv_54854: ; if ((u32 )page_index___0 < root_pbl_index) { goto ldv_54853; } else { goto ldv_54855; } ldv_54855: kfree((void const *)root_vpbl.leaf_vpbl); pci_free_consistent(nesdev->pcidev, 8192UL, (void *)root_vpbl.pbl_vbase, root_vpbl.pbl_pbase); } if ((nes_debug_level & 2048U) != 0U) { printk("\viw_nes: %s[%u]: Leaving, ibmr=%p", "nes_reg_user_mr", 2599, ibmr); } else { } return (ibmr); case 1: ; case 2: ; if (region->length == 0UL) { if ((nes_debug_level & 2048U) != 0U) { printk("\viw_nes: %s[%u]: Unable to register zero length region for CQ\n", "nes_reg_user_mr", 2605); } else { } ib_umem_release(region); tmp___18 = ERR_PTR(-22L); return ((struct ib_mr *)tmp___18); } else { } tmp___19 = kzalloc(56UL, 208U); nespbl = (struct nes_pbl *)tmp___19; if ((unsigned long )nespbl == (unsigned long )((struct nes_pbl *)0)) { if ((nes_debug_level & 2048U) != 0U) { printk("\viw_nes: %s[%u]: Unable to allocate PBL\n", "nes_reg_user_mr", 2611); } else { } ib_umem_release(region); tmp___20 = ERR_PTR(-12L); return ((struct ib_mr *)tmp___20); } else { } tmp___21 = kzalloc(56UL, 208U); nesmr = (struct nes_mr *)tmp___21; if ((unsigned long )nesmr == (unsigned long )((struct nes_mr *)0)) { ib_umem_release(region); kfree((void const *)nespbl); if ((nes_debug_level & 2048U) != 0U) { printk("\viw_nes: %s[%u]: Unable to allocate nesmr\n", "nes_reg_user_mr", 2619); } else { } tmp___22 = ERR_PTR(-12L); return ((struct ib_mr *)tmp___22); } else { } nesmr->region = region; nes_ucontext = to_nesucontext((pd->uobject)->context); pbl_depth = (int )(region->length >> 12); pbl_depth = ((region->length & 4095UL) != 0UL) + pbl_depth; nespbl->pbl_size = (u32 )((unsigned long )pbl_depth) * 8U; if (req.reg_type == 1U) { if ((nes_debug_level & 2048U) != 0U) { printk("\viw_nes: %s[%u]: Attempting to allocate QP PBL memory", "nes_reg_user_mr", 2628); } else { } } else if ((nes_debug_level & 2048U) != 0U) { printk("\viw_nes: %s[%u]: Attempting to allocate CP PBL memory", "nes_reg_user_mr", 2630); } else { } if ((nes_debug_level & 2048U) != 0U) { printk("\viw_nes: %s[%u]: %u bytes, %u entries.\n", "nes_reg_user_mr", 2634, nespbl->pbl_size, pbl_depth); } else { } tmp___23 = pci_alloc_consistent(nesdev->pcidev, (size_t )nespbl->pbl_size, & nespbl->pbl_pbase); pbl = (__le64 *)tmp___23; if ((unsigned long )pbl == (unsigned long )((__le64 *)0)) { ib_umem_release(region); kfree((void const *)nesmr); kfree((void const *)nespbl); if ((nes_debug_level & 2048U) != 0U) { printk("\viw_nes: %s[%u]: Unable to allocate PBL memory\n", "nes_reg_user_mr", 2641); } else { } tmp___24 = ERR_PTR(-12L); return ((struct ib_mr *)tmp___24); } else { } nespbl->pbl_vbase = pbl; nespbl->user_base = (unsigned long )start; if ((nes_debug_level & 2048U) != 0U) { printk("\viw_nes: %s[%u]: Allocated PBL memory, %u bytes, pbl_pbase=%lx, pbl_vbase=%p user_base=0x%lx\n", "nes_reg_user_mr", 2650, nespbl->pbl_size, (unsigned long )nespbl->pbl_pbase, (void *)nespbl->pbl_vbase, nespbl->user_base); } else { } __mptr___1 = (struct list_head const *)region->chunk_list.next; chunk = (struct ib_umem_chunk *)__mptr___1; goto ldv_54869; ldv_54868: nmap_index = 0; goto ldv_54866; ldv_54865: chunk_pages = (int )(((struct scatterlist *)(& chunk->page_list) + (unsigned long )nmap_index)->dma_length >> 12); chunk_pages = ((((struct scatterlist *)(& chunk->page_list) + (unsigned long )nmap_index)->dma_length & 4095U) != 0U) + chunk_pages; nespbl->page = sg_page((struct scatterlist *)(& chunk->page_list)); page_index___0 = 0; goto ldv_54863; ldv_54862: *((__le32 *)pbl) = (unsigned int )((struct scatterlist *)(& chunk->page_list) + (unsigned long )nmap_index)->dma_address + (unsigned int )(page_index___0 * 4096); *((__le32 *)pbl + 1UL) = (unsigned int )((((struct scatterlist *)(& chunk->page_list) + (unsigned long )nmap_index)->dma_address + (dma_addr_t )(page_index___0 * 4096)) >> 32); if ((nes_debug_level & 2048U) != 0U) { printk("\viw_nes: %s[%u]: pbl=%p, *pbl=0x%016llx, 0x%08x%08x\n", "nes_reg_user_mr", 2666, pbl, *pbl, *((__le32 *)pbl + 1UL), *((__le32 *)pbl)); } else { } pbl = pbl + 1; page_index___0 = page_index___0 + 1; ldv_54863: ; if (page_index___0 < chunk_pages) { goto ldv_54862; } else { goto ldv_54864; } ldv_54864: nmap_index = nmap_index + 1; ldv_54866: ; if (chunk->nmap > nmap_index) { goto ldv_54865; } else { goto ldv_54867; } ldv_54867: __mptr___2 = (struct list_head const *)chunk->list.next; chunk = (struct ib_umem_chunk *)__mptr___2; ldv_54869: ; if ((unsigned long )(& chunk->list) != (unsigned long )(& region->chunk_list)) { goto ldv_54868; } else { goto ldv_54870; } ldv_54870: ; if (req.reg_type == 1U) { list_add_tail(& nespbl->list, & nes_ucontext->qp_reg_mem_list); } else { list_add_tail(& nespbl->list, & nes_ucontext->cq_reg_mem_list); } nesmr->ldv_53249.ibmr.rkey = 4294967295U; nesmr->ldv_53249.ibmr.lkey = 4294967295U; nesmr->mode = (u8 )req.reg_type; return (& nesmr->ldv_53249.ibmr); } ib_umem_release(region); tmp___25 = ERR_PTR(-38L); return ((struct ib_mr *)tmp___25); } } static int nes_dereg_mr(struct ib_mr *ib_mr ) { struct nes_mr *nesmr ; struct nes_mr *tmp ; struct nes_vnic *nesvnic ; struct nes_vnic *tmp___0 ; struct nes_device *nesdev ; struct nes_adapter *nesadapter ; struct nes_hw_cqp_wqe *cqp_wqe ; struct nes_cqp_request *cqp_request ; unsigned long flags ; int ret ; u16 major_code ; u16 minor_code ; long __ret ; wait_queue_t __wait ; struct task_struct *tmp___1 ; raw_spinlock_t *tmp___2 ; { tmp = to_nesmr(ib_mr); nesmr = tmp; tmp___0 = to_nesvnic(ib_mr->device); nesvnic = tmp___0; nesdev = nesvnic->nesdev; nesadapter = nesdev->nesadapter; if ((unsigned long )nesmr->region != (unsigned long )((struct ib_umem *)0)) { ib_umem_release(nesmr->region); } else { } if ((unsigned int )nesmr->mode != 0U) { kfree((void const *)nesmr); return (0); } else { } cqp_request = nes_get_cqp_request(nesdev); if ((unsigned long )cqp_request == (unsigned long )((struct nes_cqp_request *)0)) { if ((nes_debug_level & 2048U) != 0U) { printk("\viw_nes: %s[%u]: Failed to get a cqp_request.\n", "nes_dereg_mr", 2715); } else { } return (-12); } else { } cqp_request->waiting = 1U; cqp_wqe = & cqp_request->cqp_wqe; nes_fill_init_cqp_wqe(cqp_wqe, nesdev); set_wqe_32bit_value((__le32 *)(& cqp_wqe->wqe_words), 0U, 9741U); set_wqe_32bit_value((__le32 *)(& cqp_wqe->wqe_words), 8U, ib_mr->rkey); atomic_set(& cqp_request->refcount, 2); nes_post_cqp_request(nesdev, cqp_request); if ((nes_debug_level & 2048U) != 0U) { printk("\viw_nes: %s[%u]: Waiting for deallocate STag 0x%08X completed\n", "nes_dereg_mr", 2731, ib_mr->rkey); } else { } __ret = 1200000L; if ((unsigned int )cqp_request->request_done == 0U) { tmp___1 = get_current(); __wait.flags = 0U; __wait.private = (void *)tmp___1; __wait.func = & autoremove_wake_function; __wait.task_list.next = & __wait.task_list; __wait.task_list.prev = & __wait.task_list; ldv_54888: prepare_to_wait(& cqp_request->waitq, & __wait, 2); if ((unsigned int )cqp_request->request_done != 0U) { goto ldv_54887; } else { } __ret = schedule_timeout(__ret); if (__ret == 0L) { goto ldv_54887; } else { } goto ldv_54888; ldv_54887: finish_wait(& cqp_request->waitq, & __wait); } else { } ret = (int )__ret; if ((nes_debug_level & 2048U) != 0U) { printk("\viw_nes: %s[%u]: Deallocate STag 0x%08X completed, wait_event_timeout ret = %u, CQP Major:Minor codes = 0x%04X:0x%04X\n", "nes_dereg_mr", 2736, ib_mr->rkey, ret, (int )cqp_request->major_code, (int )cqp_request->minor_code); } else { } major_code = cqp_request->major_code; minor_code = cqp_request->minor_code; nes_put_cqp_request(nesdev, cqp_request); if (ret == 0) { if ((nes_debug_level & 2048U) != 0U) { printk("\viw_nes: %s[%u]: Timeout waiting to destroy STag, ib_mr=%p, rkey = 0x%08X\n", "nes_dereg_mr", 2746, ib_mr, ib_mr->rkey); } else { } return (-62); } else if ((unsigned int )major_code != 0U) { if ((nes_debug_level & 2048U) != 0U) { printk("\viw_nes: %s[%u]: Error (0x%04X:0x%04X) while attempting to destroy STag, ib_mr=%p, rkey = 0x%08X\n", "nes_dereg_mr", 2751, (int )major_code, (int )minor_code, ib_mr, ib_mr->rkey); } else { } return (-5); } else { } if ((unsigned int )nesmr->pbls_used != 0U) { tmp___2 = spinlock_check(& nesadapter->pbl_lock); flags = _raw_spin_lock_irqsave(tmp___2); if ((unsigned int )nesmr->pbl_4k != 0U) { nesadapter->free_4kpbl = nesadapter->free_4kpbl + (u32 )nesmr->pbls_used; if (nesadapter->free_4kpbl > nesadapter->max_4kpbl) { printk("\viw_nes: free 4KB PBLs(%u) has exceeded the max(%u)\n", nesadapter->free_4kpbl, nesadapter->max_4kpbl); } else { } } else { nesadapter->free_256pbl = nesadapter->free_256pbl + (u32 )nesmr->pbls_used; if (nesadapter->free_256pbl > nesadapter->max_256pbl) { printk("\viw_nes: free 256B PBLs(%u) has exceeded the max(%u)\n", nesadapter->free_256pbl, nesadapter->max_256pbl); } else { } } spin_unlock_irqrestore(& nesadapter->pbl_lock, flags); } else { } nes_free_resource(nesadapter, nesadapter->allocated_mrs, (ib_mr->rkey & 268435200U) >> 8); kfree((void const *)nesmr); return (0); } } static ssize_t show_rev(struct device *dev , struct device_attribute *attr , char *buf ) { struct nes_ib_device *nesibdev ; struct device const *__mptr ; struct nes_vnic *nesvnic ; int tmp ; { __mptr = (struct device const *)dev; nesibdev = (struct nes_ib_device *)__mptr + 0xfffffffffffffc80UL; nesvnic = nesibdev->nesvnic; if ((nes_debug_level & 2U) != 0U) { printk("\viw_nes: %s[%u]: \n", "show_rev", 2793); } else { } tmp = sprintf(buf, "%x\n", ((nesvnic->nesdev)->nesadapter)->hw_rev); return ((ssize_t )tmp); } } static ssize_t show_fw_ver(struct device *dev , struct device_attribute *attr , char *buf ) { struct nes_ib_device *nesibdev ; struct device const *__mptr ; struct nes_vnic *nesvnic ; int tmp ; { __mptr = (struct device const *)dev; nesibdev = (struct nes_ib_device *)__mptr + 0xfffffffffffffc80UL; nesvnic = nesibdev->nesvnic; if ((nes_debug_level & 2U) != 0U) { printk("\viw_nes: %s[%u]: \n", "show_fw_ver", 2808); } else { } tmp = sprintf(buf, "%u.%u\n", ((nesvnic->nesdev)->nesadapter)->firmware_version >> 16, ((nesvnic->nesdev)->nesadapter)->firmware_version & 255U); return ((ssize_t )tmp); } } static ssize_t show_hca(struct device *dev , struct device_attribute *attr , char *buf ) { int tmp ; { if ((nes_debug_level & 2U) != 0U) { printk("\viw_nes: %s[%u]: \n", "show_hca", 2821); } else { } tmp = sprintf(buf, "NES020\n"); return ((ssize_t )tmp); } } static ssize_t show_board(struct device *dev , struct device_attribute *attr , char *buf ) { int tmp ; { if ((nes_debug_level & 2U) != 0U) { printk("\viw_nes: %s[%u]: \n", "show_board", 2832); } else { } tmp = sprintf(buf, "%.*s\n", 32, (char *)"NES020 Board ID"); return ((ssize_t )tmp); } } static struct device_attribute dev_attr_hw_rev = {{"hw_rev", 292U, (_Bool)0, 0, {{{(char)0}, {(char)0}, {(char)0}, {(char)0}, {(char)0}, {(char)0}, {(char)0}, {(char)0}}}}, & show_rev, 0}; static struct device_attribute dev_attr_fw_ver = {{"fw_ver", 292U, (_Bool)0, 0, {{{(char)0}, {(char)0}, {(char)0}, {(char)0}, {(char)0}, {(char)0}, {(char)0}, {(char)0}}}}, & show_fw_ver, 0}; static struct device_attribute dev_attr_hca_type = {{"hca_type", 292U, (_Bool)0, 0, {{{(char)0}, {(char)0}, {(char)0}, {(char)0}, {(char)0}, {(char)0}, {(char)0}, {(char)0}}}}, & show_hca, 0}; static struct device_attribute dev_attr_board_id = {{"board_id", 292U, (_Bool)0, 0, {{{(char)0}, {(char)0}, {(char)0}, {(char)0}, {(char)0}, {(char)0}, {(char)0}, {(char)0}}}}, & show_board, 0}; static struct device_attribute *nes_dev_attributes[4U] = { & dev_attr_hw_rev, & dev_attr_fw_ver, & dev_attr_hca_type, & dev_attr_board_id}; static int nes_query_qp(struct ib_qp *ibqp , struct ib_qp_attr *attr , int attr_mask , struct ib_qp_init_attr *init_attr ) { struct nes_qp *nesqp ; struct nes_qp *tmp ; struct ib_srq *tmp___0 ; { tmp = to_nesqp(ibqp); nesqp = tmp; if ((nes_debug_level & 16384U) != 0U) { printk("\viw_nes: %s[%u]: \n", "nes_query_qp", 2858); } else { } attr->qp_access_flags = 0; attr->cap.max_send_wr = (u32 )nesqp->hwqp.sq_size; attr->cap.max_recv_wr = (u32 )nesqp->hwqp.rq_size; attr->cap.max_recv_sge = 1U; if ((nes_drv_opt & 128U) != 0U) { attr->cap.max_inline_data = 0U; } else { attr->cap.max_inline_data = 64U; } init_attr->event_handler = nesqp->ibqp.event_handler; init_attr->qp_context = nesqp->ibqp.qp_context; init_attr->send_cq = nesqp->ibqp.send_cq; init_attr->recv_cq = nesqp->ibqp.recv_cq; tmp___0 = nesqp->ibqp.srq; nesqp->ibqp.srq = tmp___0; init_attr->srq = tmp___0; init_attr->cap = attr->cap; return (0); } } int nes_hw_modify_qp(struct nes_device *nesdev , struct nes_qp *nesqp , u32 next_iwarp_state , u32 termlen , u32 wait_completion ) { struct nes_hw_cqp_wqe *cqp_wqe ; struct nes_cqp_request *cqp_request ; int ret ; u16 major_code ; int tmp ; long __ret ; wait_queue_t __wait ; struct task_struct *tmp___0 ; { if ((nes_debug_level & 32768U) != 0U) { tmp = atomic_read((atomic_t const *)(& nesqp->refcount)); printk("\viw_nes: %s[%u]: QP%u, refcount=%d\n", "nes_hw_modify_qp", 2894, nesqp->hwqp.qp_id, tmp); } else { } cqp_request = nes_get_cqp_request(nesdev); if ((unsigned long )cqp_request == (unsigned long )((struct nes_cqp_request *)0)) { if ((nes_debug_level & 32768U) != 0U) { printk("\viw_nes: %s[%u]: Failed to get a cqp_request.\n", "nes_hw_modify_qp", 2898); } else { } return (-12); } else { } if (wait_completion != 0U) { cqp_request->waiting = 1U; } else { cqp_request->waiting = 0U; } cqp_wqe = & cqp_request->cqp_wqe; set_wqe_32bit_value((__le32 *)(& cqp_wqe->wqe_words), 0U, next_iwarp_state | 65537U); if ((nes_debug_level & 32768U) != 0U) { printk("\viw_nes: %s[%u]: using next_iwarp_state=%08x, wqe_words=%08x\n", "nes_hw_modify_qp", 2911, next_iwarp_state, cqp_wqe->wqe_words[0]); } else { } nes_fill_init_cqp_wqe(cqp_wqe, nesdev); set_wqe_32bit_value((__le32 *)(& cqp_wqe->wqe_words), 1U, nesqp->hwqp.qp_id); set_wqe_64bit_value((__le32 *)(& cqp_wqe->wqe_words), 6U, nesqp->nesqp_context_pbase); if ((next_iwarp_state & 1879048192U) == 1342177280U && (next_iwarp_state & 33554432U) == 0U) { termlen = ((termlen + 3U) >> 2) << 28; set_wqe_32bit_value((__le32 *)(& cqp_wqe->wqe_words), 15U, termlen); } else { } atomic_set(& cqp_request->refcount, 2); nes_post_cqp_request(nesdev, cqp_request); if (wait_completion != 0U) { __ret = 1200000L; if ((unsigned int )cqp_request->request_done == 0U) { tmp___0 = get_current(); __wait.flags = 0U; __wait.private = (void *)tmp___0; __wait.func = & autoremove_wake_function; __wait.task_list.next = & __wait.task_list; __wait.task_list.prev = & __wait.task_list; ldv_54953: prepare_to_wait(& cqp_request->waitq, & __wait, 2); if ((unsigned int )cqp_request->request_done != 0U) { goto ldv_54952; } else { } __ret = schedule_timeout(__ret); if (__ret == 0L) { goto ldv_54952; } else { } goto ldv_54953; ldv_54952: finish_wait(& cqp_request->waitq, & __wait); } else { } ret = (int )__ret; if ((nes_debug_level & 32768U) != 0U) { printk("\viw_nes: %s[%u]: Modify iwarp QP%u completed, wait_event_timeout ret=%u, CQP Major:Minor codes = 0x%04X:0x%04X.\n", "nes_hw_modify_qp", 2934, nesqp->hwqp.qp_id, ret, (int )cqp_request->major_code, (int )cqp_request->minor_code); } else { } major_code = cqp_request->major_code; if ((unsigned int )major_code != 0U) { if ((nes_debug_level & 32768U) != 0U) { printk("\viw_nes: %s[%u]: Modify iwarp QP%u failedCQP Major:Minor codes = 0x%04X:0x%04X, intended next state = 0x%08X.\n", "nes_hw_modify_qp", 2940, nesqp->hwqp.qp_id, (int )cqp_request->major_code, (int )cqp_request->minor_code, next_iwarp_state); } else { } } else { } nes_put_cqp_request(nesdev, cqp_request); if (ret == 0) { return (-62); } else if ((unsigned int )major_code != 0U) { return (-5); } else { return (0); } } else { return (0); } } } int nes_modify_qp(struct ib_qp *ibqp , struct ib_qp_attr *attr , int attr_mask , struct ib_udata *udata ) { struct nes_qp *nesqp ; struct nes_qp *tmp ; struct nes_vnic *nesvnic ; struct nes_vnic *tmp___0 ; struct nes_device *nesdev ; u32 next_iwarp_state ; int err ; unsigned long qplockflags ; int ret ; u16 original_last_aeq ; u8 issue_modify_qp ; u8 dont_wait ; int tmp___1 ; raw_spinlock_t *tmp___2 ; int tmp___3 ; int tmp___4 ; raw_spinlock_t *tmp___5 ; int tmp___6 ; raw_spinlock_t *tmp___7 ; int tmp___8 ; int tmp___9 ; int tmp___10 ; int tmp___11 ; int tmp___12 ; int tmp___13 ; { tmp = to_nesqp(ibqp); nesqp = tmp; tmp___0 = to_nesvnic(ibqp->device); nesvnic = tmp___0; nesdev = nesvnic->nesdev; next_iwarp_state = 0U; issue_modify_qp = 0U; dont_wait = 0U; if ((nes_debug_level & 32768U) != 0U) { tmp___1 = atomic_read((atomic_t const *)(& nesqp->refcount)); printk("\viw_nes: %s[%u]: QP%u: QP State=%u, cur QP State=%u, iwarp_state=0x%X, refcount=%d\n", "nes_modify_qp", 2979, nesqp->hwqp.qp_id, (unsigned int )attr->qp_state, (unsigned int )nesqp->ibqp_state, nesqp->iwarp_state, tmp___1); } else { } tmp___2 = spinlock_check(& nesqp->lock); qplockflags = _raw_spin_lock_irqsave(tmp___2); if ((nes_debug_level & 32768U) != 0U) { printk("\viw_nes: %s[%u]: QP%u: hw_iwarp_state=0x%X, hw_tcp_state=0x%X, QP Access Flags=0x%X, attr_mask = 0x%0x\n", "nes_modify_qp", 2986, nesqp->hwqp.qp_id, (int )nesqp->hw_iwarp_state, (int )nesqp->hw_tcp_state, attr->qp_access_flags, attr_mask); } else { } if (attr_mask & 1) { switch ((unsigned int )attr->qp_state) { case 1: ; if ((nes_debug_level & 32768U) != 0U) { printk("\viw_nes: %s[%u]: QP%u: new state = init\n", "nes_modify_qp", 2992, nesqp->hwqp.qp_id); } else { } if (nesqp->iwarp_state > 268435456U) { spin_unlock_irqrestore(& nesqp->lock, qplockflags); return (-22); } else { } next_iwarp_state = 268435456U; issue_modify_qp = 1U; goto ldv_54976; case 2: ; if ((nes_debug_level & 32768U) != 0U) { printk("\viw_nes: %s[%u]: QP%u: new state = rtr\n", "nes_modify_qp", 3002, nesqp->hwqp.qp_id); } else { } if (nesqp->iwarp_state > 268435456U) { spin_unlock_irqrestore(& nesqp->lock, qplockflags); return (-22); } else { } next_iwarp_state = 268435456U; issue_modify_qp = 1U; goto ldv_54976; case 3: ; if ((nes_debug_level & 32768U) != 0U) { printk("\viw_nes: %s[%u]: QP%u: new state = rts\n", "nes_modify_qp", 3012, nesqp->hwqp.qp_id); } else { } if (nesqp->iwarp_state > 536870912U) { spin_unlock_irqrestore(& nesqp->lock, qplockflags); return (-22); } else { } if ((unsigned long )nesqp->cm_id == (unsigned long )((struct iw_cm_id *)0)) { if ((nes_debug_level & 32768U) != 0U) { printk("\viw_nes: %s[%u]: QP%u: Failing attempt to move QP to RTS without a CM_ID. \n", "nes_modify_qp", 3019, nesqp->hwqp.qp_id); } else { } spin_unlock_irqrestore(& nesqp->lock, qplockflags); return (-22); } else { } next_iwarp_state = 536870912U; if (nesqp->iwarp_state != 536870912U) { next_iwarp_state = next_iwarp_state | 3328U; } else { } issue_modify_qp = 1U; nesqp->hw_tcp_state = 5U; nesqp->hw_iwarp_state = 2U; nesqp->hte_added = 1U; goto ldv_54976; case 4: issue_modify_qp = 1U; if ((nes_debug_level & 32768U) != 0U) { printk("\viw_nes: %s[%u]: QP%u: new state=closing. SQ head=%u, SQ tail=%u\n", "nes_modify_qp", 3035, nesqp->hwqp.qp_id, (int )nesqp->hwqp.sq_head, (int )nesqp->hwqp.sq_tail); } else { } if (nesqp->iwarp_state == 805306368U) { spin_unlock_irqrestore(& nesqp->lock, qplockflags); return (0); } else { if (nesqp->iwarp_state > 805306368U) { if ((nes_debug_level & 32768U) != 0U) { printk("\viw_nes: %s[%u]: QP%u: State change to closing ignored due to current iWARP state\n", "nes_modify_qp", 3043, nesqp->hwqp.qp_id); } else { } spin_unlock_irqrestore(& nesqp->lock, qplockflags); return (-22); } else { } if ((unsigned int )nesqp->hw_iwarp_state != 2U) { if ((nes_debug_level & 32768U) != 0U) { printk("\viw_nes: %s[%u]: QP%u: State change to closing already done based on hw state.\n", "nes_modify_qp", 3050, nesqp->hwqp.qp_id); } else { } issue_modify_qp = 0U; } else { } switch ((int )nesqp->hw_iwarp_state) { case 3: next_iwarp_state = 805306368U; goto ldv_54981; case 5: next_iwarp_state = 1342177280U; goto ldv_54981; case 6: next_iwarp_state = 1610612736U; goto ldv_54981; default: next_iwarp_state = 805306368U; nesqp->hw_iwarp_state = 3U; goto ldv_54981; } ldv_54981: ; } goto ldv_54976; case 5: ; if ((nes_debug_level & 32768U) != 0U) { printk("\viw_nes: %s[%u]: QP%u: new state = terminate\n", "nes_modify_qp", 3072, nesqp->hwqp.qp_id); } else { } if (nesqp->iwarp_state > 1342177279U) { spin_unlock_irqrestore(& nesqp->lock, qplockflags); return (-22); } else { } next_iwarp_state = 1342177280U; nesqp->hw_iwarp_state = 5U; issue_modify_qp = 1U; goto ldv_54976; case 6: ; case 0: ; if (nesqp->iwarp_state == 1610612736U) { spin_unlock_irqrestore(& nesqp->lock, qplockflags); return (-22); } else { } if ((nes_debug_level & 32768U) != 0U) { printk("\viw_nes: %s[%u]: QP%u: new state = error\n", "nes_modify_qp", 3089, nesqp->hwqp.qp_id); } else { } if ((unsigned int )nesqp->term_flags != 0U) { del_timer(& nesqp->terminate_timer); } else { } next_iwarp_state = 1610612736U; if ((unsigned int )*((unsigned char *)nesqp + 820UL) != 0U) { if ((nes_debug_level & 32768U) != 0U) { printk("\viw_nes: %s[%u]: set CQP_QP_DEL_HTE\n", "nes_modify_qp", 3096); } else { } next_iwarp_state = next_iwarp_state | 16384U; nesqp->hte_added = 0U; } else { } if (((unsigned int )nesqp->hw_tcp_state > 1U && (unsigned int )nesdev->iw_status != 0U) && (unsigned int )nesqp->hw_tcp_state != 11U) { next_iwarp_state = next_iwarp_state | 2147483648U; } else { if ((nes_debug_level & 32768U) != 0U) { printk("\viw_nes: %s[%u]: QP%u NOT setting NES_CQP_QP_RESET since TCP state = %u\n", "nes_modify_qp", 3106, nesqp->hwqp.qp_id, (int )nesqp->hw_tcp_state); } else { } dont_wait = 1U; } issue_modify_qp = 1U; nesqp->hw_iwarp_state = 6U; goto ldv_54976; default: spin_unlock_irqrestore(& nesqp->lock, qplockflags); return (-22); } ldv_54976: nesqp->ibqp_state = attr->qp_state; nesqp->iwarp_state = next_iwarp_state & 1879048192U; if ((nes_debug_level & 32768U) != 0U) { printk("\viw_nes: %s[%u]: Change nesqp->iwarp_state=%08x\n", "nes_modify_qp", 3121, nesqp->iwarp_state); } else { } } else { } if ((attr_mask & 8) != 0) { if (attr->qp_access_flags & 1) { (nesqp->nesqp_context)->misc = (nesqp->nesqp_context)->misc | 25165824U; issue_modify_qp = 1U; } else { } if ((attr->qp_access_flags & 2) != 0) { (nesqp->nesqp_context)->misc = (nesqp->nesqp_context)->misc | 8388608U; issue_modify_qp = 1U; } else { } if ((attr->qp_access_flags & 4) != 0) { (nesqp->nesqp_context)->misc = (nesqp->nesqp_context)->misc | 16777216U; issue_modify_qp = 1U; } else { } if ((attr->qp_access_flags & 16) != 0) { (nesqp->nesqp_context)->misc = (nesqp->nesqp_context)->misc | 268435456U; issue_modify_qp = 1U; } else { } if ((unsigned int )*((unsigned char *)nesqp + 820UL) != 0U) { (nesqp->nesqp_context)->misc = (nesqp->nesqp_context)->misc | 25165824U; issue_modify_qp = 1U; } else { } } else { } original_last_aeq = (u16 )nesqp->last_aeq; spin_unlock_irqrestore(& nesqp->lock, qplockflags); if ((nes_debug_level & 32768U) != 0U) { printk("\viw_nes: %s[%u]: issue_modify_qp=%u\n", "nes_modify_qp", 3153, (int )issue_modify_qp); } else { } ret = 0; if ((unsigned int )issue_modify_qp != 0U) { if ((nes_debug_level & 32768U) != 0U) { printk("\viw_nes: %s[%u]: call nes_hw_modify_qp\n", "nes_modify_qp", 3159); } else { } ret = nes_hw_modify_qp(nesdev, nesqp, next_iwarp_state, 0U, 1U); if (ret != 0) { if ((nes_debug_level & 32768U) != 0U) { printk("\viw_nes: %s[%u]: nes_hw_modify_qp (next_iwarp_state = 0x%08X) failed for QP%u.\n", "nes_modify_qp", 3164, next_iwarp_state, nesqp->hwqp.qp_id); } else { } } else { } } else { } if ((unsigned int )issue_modify_qp != 0U && (unsigned int )nesqp->ibqp_state > 3U) { if ((nes_debug_level & 32768U) != 0U) { tmp___3 = atomic_read((atomic_t const *)(& nesqp->refcount)); printk("\viw_nes: %s[%u]: QP%u Issued ModifyQP refcount (%d), original_last_aeq = 0x%04X. last_aeq = 0x%04X.\n", "nes_modify_qp", 3172, nesqp->hwqp.qp_id, tmp___3, (int )original_last_aeq, nesqp->last_aeq); } else { } if (ret == 0 || ((unsigned int )original_last_aeq != 514U && ret != 0)) { if ((unsigned int )dont_wait != 0U) { if ((unsigned long )nesqp->cm_id != (unsigned long )((struct iw_cm_id *)0) && (unsigned int )nesqp->hw_tcp_state != 0U) { if ((nes_debug_level & 32768U) != 0U) { tmp___4 = atomic_read((atomic_t const *)(& nesqp->refcount)); printk("\viw_nes: %s[%u]: QP%u Queuing fake disconnect for QP refcount (%d), original_last_aeq = 0x%04X. last_aeq = 0x%04X.\n", "nes_modify_qp", 3181, nesqp->hwqp.qp_id, tmp___4, (int )original_last_aeq, nesqp->last_aeq); } else { } tmp___5 = spinlock_check(& nesqp->lock); qplockflags = _raw_spin_lock_irqsave(tmp___5); nesqp->hw_tcp_state = 1U; nesqp->last_aeq = 1537U; spin_unlock_irqrestore(& nesqp->lock, qplockflags); nes_cm_disconn(nesqp); } else if ((nes_debug_level & 32768U) != 0U) { tmp___6 = atomic_read((atomic_t const *)(& nesqp->refcount)); printk("\viw_nes: %s[%u]: QP%u No fake disconnect, QP refcount=%d\n", "nes_modify_qp", 3190, nesqp->hwqp.qp_id, tmp___6); } else { } } else { tmp___7 = spinlock_check(& nesqp->lock); qplockflags = _raw_spin_lock_irqsave(tmp___7); if ((unsigned long )nesqp->cm_id != (unsigned long )((struct iw_cm_id *)0)) { tmp___9 = atomic_add_return(1, & nesqp->close_timer_started); if (tmp___9 == 1) { (*((nesqp->cm_id)->add_ref))(nesqp->cm_id); if ((nes_debug_level & 32768U) != 0U) { tmp___8 = atomic_read((atomic_t const *)(& nesqp->refcount)); printk("\viw_nes: %s[%u]: QP%u Not decrementing QP refcount (%d), need ae to finish up, original_last_aeq = 0x%04X. last_aeq = 0x%04X, scheduling timer.\n", "nes_modify_qp", 3202, nesqp->hwqp.qp_id, tmp___8, (int )original_last_aeq, nesqp->last_aeq); } else { } schedule_nes_timer((struct nes_cm_node *)nesqp->cm_node, (struct sk_buff *)nesqp, 3, 1, 0); } else { } spin_unlock_irqrestore(& nesqp->lock, qplockflags); } else { spin_unlock_irqrestore(& nesqp->lock, qplockflags); if ((nes_debug_level & 32768U) != 0U) { tmp___10 = atomic_read((atomic_t const *)(& nesqp->refcount)); printk("\viw_nes: %s[%u]: QP%u Not decrementing QP refcount (%d), need ae to finish up, original_last_aeq = 0x%04X. last_aeq = 0x%04X.\n", "nes_modify_qp", 3212, nesqp->hwqp.qp_id, tmp___10, (int )original_last_aeq, nesqp->last_aeq); } else { } } } } else if ((nes_debug_level & 32768U) != 0U) { tmp___11 = atomic_read((atomic_t const *)(& nesqp->refcount)); printk("\viw_nes: %s[%u]: QP%u Decrementing QP refcount (%d), No ae to finish up, original_last_aeq = 0x%04X. last_aeq = 0x%04X.\n", "nes_modify_qp", 3219, nesqp->hwqp.qp_id, tmp___11, (int )original_last_aeq, nesqp->last_aeq); } else { } } else if ((nes_debug_level & 32768U) != 0U) { tmp___12 = atomic_read((atomic_t const *)(& nesqp->refcount)); printk("\viw_nes: %s[%u]: QP%u Decrementing QP refcount (%d), No ae to finish up, original_last_aeq = 0x%04X. last_aeq = 0x%04X.\n", "nes_modify_qp", 3225, nesqp->hwqp.qp_id, tmp___12, (int )original_last_aeq, nesqp->last_aeq); } else { } err = 0; if ((nes_debug_level & 32768U) != 0U) { tmp___13 = atomic_read((atomic_t const *)(& nesqp->refcount)); printk("\viw_nes: %s[%u]: QP%u Leaving, refcount=%d\n", "nes_modify_qp", 3231, nesqp->hwqp.qp_id, tmp___13); } else { } return (err); } } static int nes_multicast_attach(struct ib_qp *ibqp , union ib_gid *gid , u16 lid ) { { if ((nes_debug_level & 2U) != 0U) { printk("\viw_nes: %s[%u]: \n", "nes_multicast_attach", 3242); } else { } return (-38); } } static int nes_multicast_detach(struct ib_qp *ibqp , union ib_gid *gid , u16 lid ) { { if ((nes_debug_level & 2U) != 0U) { printk("\viw_nes: %s[%u]: \n", "nes_multicast_detach", 3252); } else { } return (-38); } } static int nes_process_mad(struct ib_device *ibdev , int mad_flags , u8 port_num , struct ib_wc *in_wc , struct ib_grh *in_grh , struct ib_mad *in_mad , struct ib_mad *out_mad ) { { if ((nes_debug_level & 2U) != 0U) { printk("\viw_nes: %s[%u]: \n", "nes_process_mad", 3264); } else { } return (-38); } } __inline static void fill_wqe_sg_send(struct nes_hw_qp_wqe *wqe , struct ib_send_wr *ib_wr , u32 uselkey ) { int sge_index ; int total_payload_length ; { total_payload_length = 0; sge_index = 0; goto ldv_55025; ldv_55024: set_wqe_64bit_value((__le32 *)(& wqe->wqe_words), (u32 )((sge_index + 4) * 4), (ib_wr->sg_list + (unsigned long )sge_index)->addr); set_wqe_32bit_value((__le32 *)(& wqe->wqe_words), (u32 )(sge_index * 4 + 18), (ib_wr->sg_list + (unsigned long )sge_index)->length); if (uselkey != 0U) { set_wqe_32bit_value((__le32 *)(& wqe->wqe_words), (u32 )(sge_index * 4 + 19), (ib_wr->sg_list + (unsigned long )sge_index)->lkey); } else { set_wqe_32bit_value((__le32 *)(& wqe->wqe_words), (u32 )(sge_index * 4 + 19), 0U); } total_payload_length = (int )((ib_wr->sg_list + (unsigned long )sge_index)->length + (u32 )total_payload_length); sge_index = sge_index + 1; ldv_55025: ; if (ib_wr->num_sge > sge_index) { goto ldv_55024; } else { goto ldv_55026; } ldv_55026: ; if ((nes_debug_level & 262144U) != 0U) { printk("\viw_nes: %s[%u]: UC UC UC, sending total_payload_length=%u \n", "fill_wqe_sg_send", 3287, total_payload_length); } else { } set_wqe_32bit_value((__le32 *)(& wqe->wqe_words), 1U, (u32 )total_payload_length); return; } } static int nes_post_send(struct ib_qp *ibqp , struct ib_send_wr *ib_wr , struct ib_send_wr **bad_wr ) { u64 u64temp ; unsigned long flags ; struct nes_vnic *nesvnic ; struct nes_vnic *tmp ; struct nes_device *nesdev ; struct nes_qp *nesqp ; struct nes_qp *tmp___0 ; struct nes_hw_qp_wqe *wqe ; int err ; u32 qsize ; u32 head ; u32 wqe_misc ; u32 wqe_count ; u32 counter ; raw_spinlock_t *tmp___1 ; size_t __len ; void *__ret ; size_t __len___0 ; void *__ret___0 ; int i ; int flags___0 ; struct nes_ib_fast_reg_page_list *pnesfrpl ; struct ib_fast_reg_page_list const *__mptr ; u64 *src_page_list ; u64 *dst_page_list ; u32 _min1 ; unsigned int _min2 ; unsigned int tmp___2 ; { flags = 0UL; tmp = to_nesvnic(ibqp->device); nesvnic = tmp; nesdev = nesvnic->nesdev; tmp___0 = to_nesqp(ibqp); nesqp = tmp___0; err = 0; qsize = (u32 )nesqp->hwqp.sq_size; wqe_misc = 0U; wqe_count = 0U; if ((unsigned int )nesqp->ibqp_state > 3U) { err = -22; goto out; } else { } tmp___1 = spinlock_check(& nesqp->lock); flags = _raw_spin_lock_irqsave(tmp___1); head = (u32 )nesqp->hwqp.sq_head; goto ldv_55077; ldv_55076: ; if ((unsigned int )nesqp->term_flags != 0U) { err = -22; goto ldv_55049; } else { } if (((qsize * 2U + head) - (u32 )nesqp->hwqp.sq_tail) % qsize == qsize - 1U) { err = -12; goto ldv_55049; } else { } wqe = nesqp->hwqp.sq_vbase + (unsigned long )head; nes_fill_init_qp_wqe(wqe, nesqp, head); u64temp = ib_wr->wr_id; set_wqe_64bit_value((__le32 *)(& wqe->wqe_words), 4U, u64temp); switch ((unsigned int )ib_wr->opcode) { case 2: ; case 8: ; if ((unsigned int )ib_wr->opcode == 2U) { if ((ib_wr->send_flags & 4) != 0) { wqe_misc = 5U; } else { wqe_misc = 3U; } } else { if ((ib_wr->send_flags & 4) != 0) { wqe_misc = 6U; } else { wqe_misc = 4U; } set_wqe_32bit_value((__le32 *)(& wqe->wqe_words), 7U, ib_wr->ex.invalidate_rkey); } if ((u32 )ib_wr->num_sge > (nesdev->nesadapter)->max_sge) { err = -22; goto ldv_55052; } else { } if (ib_wr->send_flags & 1) { wqe_misc = wqe_misc | 1073741824U; } else { } if (((ib_wr->send_flags & 8) != 0 && (nes_drv_opt & 128U) == 0U) && (ib_wr->sg_list)->length <= 64U) { __len = (size_t )(ib_wr->sg_list)->length; __ret = __builtin_memcpy((void *)(& wqe->wqe_words) + 12U, (void const *)(ib_wr->sg_list)->addr, __len); set_wqe_32bit_value((__le32 *)(& wqe->wqe_words), 1U, (ib_wr->sg_list)->length); wqe_misc = wqe_misc | 268435456U; } else { fill_wqe_sg_send(wqe, ib_wr, 1U); } goto ldv_55052; case 0: wqe_misc = 0U; if ((u32 )ib_wr->num_sge > (nesdev->nesadapter)->max_sge) { if ((nes_debug_level & 262144U) != 0U) { printk("\viw_nes: %s[%u]: Exceeded max sge, ib_wr=%u, max=%u\n", "nes_post_send", 3383, ib_wr->num_sge, (nesdev->nesadapter)->max_sge); } else { } err = -22; goto ldv_55052; } else { } if (ib_wr->send_flags & 1) { wqe_misc = wqe_misc | 1073741824U; } else { } set_wqe_32bit_value((__le32 *)(& wqe->wqe_words), 11U, ib_wr->wr.rdma.rkey); set_wqe_64bit_value((__le32 *)(& wqe->wqe_words), 8U, ib_wr->wr.rdma.remote_addr); if (((ib_wr->send_flags & 8) != 0 && (nes_drv_opt & 128U) == 0U) && (ib_wr->sg_list)->length <= 64U) { __len___0 = (size_t )(ib_wr->sg_list)->length; __ret___0 = __builtin_memcpy((void *)(& wqe->wqe_words) + 12U, (void const *)(ib_wr->sg_list)->addr, __len___0); set_wqe_32bit_value((__le32 *)(& wqe->wqe_words), 1U, (ib_wr->sg_list)->length); wqe_misc = wqe_misc | 268435456U; } else { fill_wqe_sg_send(wqe, ib_wr, 1U); } wqe->wqe_words[10] = wqe->wqe_words[1]; goto ldv_55052; case 4: ; case 9: ; if (ib_wr->num_sge > 1) { if ((nes_debug_level & 262144U) != 0U) { printk("\viw_nes: %s[%u]: Exceeded max sge, ib_wr=%u, max=1\n", "nes_post_send", 3416, ib_wr->num_sge); } else { } err = -22; goto ldv_55052; } else { } if ((unsigned int )ib_wr->opcode == 4U) { wqe_misc = 1U; } else { wqe_misc = 11U; set_wqe_32bit_value((__le32 *)(& wqe->wqe_words), 7U, ib_wr->ex.invalidate_rkey); } set_wqe_64bit_value((__le32 *)(& wqe->wqe_words), 8U, ib_wr->wr.rdma.remote_addr); set_wqe_32bit_value((__le32 *)(& wqe->wqe_words), 11U, ib_wr->wr.rdma.rkey); set_wqe_32bit_value((__le32 *)(& wqe->wqe_words), 10U, (ib_wr->sg_list)->length); set_wqe_64bit_value((__le32 *)(& wqe->wqe_words), 16U, (ib_wr->sg_list)->addr); set_wqe_32bit_value((__le32 *)(& wqe->wqe_words), 19U, (ib_wr->sg_list)->lkey); goto ldv_55052; case 10: wqe_misc = 10U; set_wqe_32bit_value((__le32 *)(& wqe->wqe_words), 6U, ib_wr->ex.invalidate_rkey); goto ldv_55052; case 11: flags___0 = ib_wr->wr.fast_reg.access_flags; __mptr = (struct ib_fast_reg_page_list const *)ib_wr->wr.fast_reg.page_list; pnesfrpl = (struct nes_ib_fast_reg_page_list *)__mptr; src_page_list = pnesfrpl->ibfrpl.page_list; dst_page_list = pnesfrpl->nes_wqe_pbl.kva; if (ib_wr->wr.fast_reg.page_list_len > 512U) { if ((nes_debug_level & 262144U) != 0U) { printk("\viw_nes: %s[%u]: SQ_FMR: bad page_list_len\n", "nes_post_send", 3458); } else { } err = -22; goto ldv_55052; } else { } wqe_misc = 9U; set_wqe_64bit_value((__le32 *)(& wqe->wqe_words), 10U, ib_wr->wr.fast_reg.iova_start); set_wqe_32bit_value((__le32 *)(& wqe->wqe_words), 8U, ib_wr->wr.fast_reg.length); set_wqe_32bit_value((__le32 *)(& wqe->wqe_words), 9U, 0U); set_wqe_32bit_value((__le32 *)(& wqe->wqe_words), 7U, ib_wr->wr.fast_reg.rkey); if (ib_wr->wr.fast_reg.page_shift == 12U) { wqe_misc = wqe_misc; } else if (ib_wr->wr.fast_reg.page_shift == 21U) { wqe_misc = wqe_misc | 128U; } else { if ((nes_debug_level & 262144U) != 0U) { printk("\viw_nes: %s[%u]: Invalid page shift, ib_wr=%u, max=1\n", "nes_post_send", 3481, ib_wr->num_sge); } else { } err = -22; goto ldv_55052; } wqe_misc = wqe_misc | 65536U; if (flags___0 & 1) { wqe_misc = wqe_misc | 131072U; } else { } if ((flags___0 & 2) != 0) { wqe_misc = wqe_misc | 524288U; } else { } if ((flags___0 & 4) != 0) { wqe_misc = wqe_misc | 262144U; } else { } if ((flags___0 & 16) != 0) { wqe_misc = wqe_misc | 1048576U; } else { } if (ib_wr->wr.fast_reg.page_list_len > pnesfrpl->ibfrpl.max_page_list_len) { if ((nes_debug_level & 262144U) != 0U) { printk("\viw_nes: %s[%u]: Invalid page list length, ib_wr=%p, value=%u, max=%u\n", "nes_post_send", 3505, ib_wr, ib_wr->wr.fast_reg.page_list_len, pnesfrpl->ibfrpl.max_page_list_len); } else { } err = -22; goto ldv_55052; } else { } set_wqe_64bit_value((__le32 *)(& wqe->wqe_words), 12U, pnesfrpl->nes_wqe_pbl.paddr); set_wqe_32bit_value((__le32 *)(& wqe->wqe_words), 14U, ib_wr->wr.fast_reg.page_list_len * 8U); i = 0; goto ldv_55073; ldv_55072: *(dst_page_list + (unsigned long )i) = *(src_page_list + (unsigned long )i); i = i + 1; ldv_55073: ; if ((unsigned int )i < ib_wr->wr.fast_reg.page_list_len) { goto ldv_55072; } else { goto ldv_55074; } ldv_55074: ; if ((nes_debug_level & 262144U) != 0U) { printk("\viw_nes: %s[%u]: SQ_FMR: iova_start: %llx, length: %d, rkey: %0x, pgl_paddr: %llx, page_list_len: %u, wqe_misc: %x\n", "nes_post_send", 3529, ib_wr->wr.fast_reg.iova_start, ib_wr->wr.fast_reg.length, ib_wr->wr.fast_reg.rkey, pnesfrpl->nes_wqe_pbl.paddr, ib_wr->wr.fast_reg.page_list_len, wqe_misc); } else { } goto ldv_55052; default: err = -22; goto ldv_55052; } ldv_55052: ; if (err != 0) { goto ldv_55049; } else { } if ((ib_wr->send_flags & 2) != 0 || (unsigned int )*((unsigned char *)nesqp + 820UL) != 0U) { wqe_misc = wqe_misc | 2147483648U; } else { } wqe->wqe_words[0] = wqe_misc; ib_wr = ib_wr->next; head = head + 1U; wqe_count = wqe_count + 1U; if (head >= qsize) { head = 0U; } else { } ldv_55077: ; if ((unsigned long )ib_wr != (unsigned long )((struct ib_send_wr *)0)) { goto ldv_55076; } else { goto ldv_55049; } ldv_55049: nesqp->hwqp.sq_head = (u16 )head; __asm__ volatile ("": : : "memory"); goto ldv_55082; ldv_55081: _min1 = wqe_count; _min2 = 255U; if (_min1 < _min2) { tmp___2 = _min1; } else { tmp___2 = _min2; } counter = tmp___2; wqe_count = wqe_count - counter; nes_write32(nesdev->regs + 64UL, ((counter << 24) | nesqp->hwqp.qp_id) | 8388608U); ldv_55082: ; if (wqe_count != 0U) { goto ldv_55081; } else { goto ldv_55083; } ldv_55083: spin_unlock_irqrestore(& nesqp->lock, flags); out: ; if (err != 0) { *bad_wr = ib_wr; } else { } return (err); } } static int nes_post_recv(struct ib_qp *ibqp , struct ib_recv_wr *ib_wr , struct ib_recv_wr **bad_wr ) { u64 u64temp ; unsigned long flags ; struct nes_vnic *nesvnic ; struct nes_vnic *tmp ; struct nes_device *nesdev ; struct nes_qp *nesqp ; struct nes_qp *tmp___0 ; struct nes_hw_qp_wqe *wqe ; int err ; int sge_index ; u32 qsize ; u32 head ; u32 wqe_count ; u32 counter ; u32 total_payload_length ; raw_spinlock_t *tmp___1 ; u32 _min1 ; unsigned int _min2 ; unsigned int tmp___2 ; { flags = 0UL; tmp = to_nesvnic(ibqp->device); nesvnic = tmp; nesdev = nesvnic->nesdev; tmp___0 = to_nesqp(ibqp); nesqp = tmp___0; err = 0; qsize = (u32 )nesqp->hwqp.rq_size; wqe_count = 0U; if ((unsigned int )nesqp->ibqp_state > 3U) { err = -22; goto out; } else { } tmp___1 = spinlock_check(& nesqp->lock); flags = _raw_spin_lock_irqsave(tmp___1); head = (u32 )nesqp->hwqp.rq_head; goto ldv_55112; ldv_55111: ; if ((unsigned int )nesqp->term_flags != 0U) { err = -22; goto ldv_55106; } else { } if ((u32 )ib_wr->num_sge > (nesdev->nesadapter)->max_sge) { err = -22; goto ldv_55106; } else { } if (((qsize * 2U + head) - (u32 )nesqp->hwqp.rq_tail) % qsize == qsize - 1U) { err = -12; goto ldv_55106; } else { } if ((nes_debug_level & 131072U) != 0U) { printk("\viw_nes: %s[%u]: ibwr sge count = %u.\n", "nes_post_recv", 3618, ib_wr->num_sge); } else { } wqe = nesqp->hwqp.rq_vbase + (unsigned long )head; nes_fill_init_qp_wqe(wqe, nesqp, head); u64temp = ib_wr->wr_id; set_wqe_64bit_value((__le32 *)(& wqe->wqe_words), 4U, u64temp); total_payload_length = 0U; sge_index = 0; goto ldv_55109; ldv_55108: set_wqe_64bit_value((__le32 *)(& wqe->wqe_words), (u32 )((sge_index + 2) * 4), (ib_wr->sg_list + (unsigned long )sge_index)->addr); set_wqe_32bit_value((__le32 *)(& wqe->wqe_words), (u32 )(sge_index * 4 + 10), (ib_wr->sg_list + (unsigned long )sge_index)->length); set_wqe_32bit_value((__le32 *)(& wqe->wqe_words), (u32 )(sge_index * 4 + 11), (ib_wr->sg_list + (unsigned long )sge_index)->lkey); total_payload_length = (ib_wr->sg_list + (unsigned long )sge_index)->length + total_payload_length; sge_index = sge_index + 1; ldv_55109: ; if (ib_wr->num_sge > sge_index) { goto ldv_55108; } else { goto ldv_55110; } ldv_55110: set_wqe_32bit_value((__le32 *)(& wqe->wqe_words), 1U, total_payload_length); ib_wr = ib_wr->next; head = head + 1U; wqe_count = wqe_count + 1U; if (head >= qsize) { head = 0U; } else { } ldv_55112: ; if ((unsigned long )ib_wr != (unsigned long )((struct ib_recv_wr *)0)) { goto ldv_55111; } else { goto ldv_55106; } ldv_55106: nesqp->hwqp.rq_head = (u16 )head; __asm__ volatile ("": : : "memory"); goto ldv_55117; ldv_55116: _min1 = wqe_count; _min2 = 255U; if (_min1 < _min2) { tmp___2 = _min1; } else { tmp___2 = _min2; } counter = tmp___2; wqe_count = wqe_count - counter; nes_write32(nesdev->regs + 64UL, (counter << 24) | nesqp->hwqp.qp_id); ldv_55117: ; if (wqe_count != 0U) { goto ldv_55116; } else { goto ldv_55118; } ldv_55118: spin_unlock_irqrestore(& nesqp->lock, flags); out: ; if (err != 0) { *bad_wr = ib_wr; } else { } return (err); } } static int nes_poll_cq(struct ib_cq *ibcq , int num_entries , struct ib_wc *entry ) { u64 u64temp ; u64 wrid ; unsigned long flags ; struct nes_vnic *nesvnic ; struct nes_vnic *tmp ; struct nes_device *nesdev ; struct nes_cq *nescq ; struct nes_cq *tmp___0 ; struct nes_qp *nesqp ; struct nes_hw_cqe cqe ; u32 head ; u32 wq_tail ; u32 cq_size ; u32 cqe_count ; u32 wqe_index ; u32 u32temp ; u32 move_cq_head ; u32 err_code ; raw_spinlock_t *tmp___1 ; { flags = 0UL; tmp = to_nesvnic(ibcq->device); nesvnic = tmp; nesdev = nesvnic->nesdev; tmp___0 = to_nescq(ibcq); nescq = tmp___0; wq_tail = 0U; cqe_count = 0U; move_cq_head = 1U; if ((nes_debug_level & 8192U) != 0U) { printk("\viw_nes: %s[%u]: \n", "nes_poll_cq", 3687); } else { } tmp___1 = spinlock_check(& nescq->lock); flags = _raw_spin_lock_irqsave(tmp___1); head = (u32 )nescq->hw_cq.cq_head; cq_size = (u32 )nescq->hw_cq.cq_size; goto ldv_55155; ldv_55154: ; if ((int )(nescq->hw_cq.cq_vbase + (unsigned long )head)->cqe_words[7] >= 0) { goto ldv_55144; } else { } __asm__ volatile ("lfence": : : "memory"); cqe = *(nescq->hw_cq.cq_vbase + (unsigned long )head); u32temp = cqe.cqe_words[2]; wqe_index = ((nesdev->nesadapter)->max_qp_wr - 1U) & u32temp; u32temp = u32temp & 4294966272U; u64temp = ((unsigned long long )cqe.cqe_words[3] << 32) | (unsigned long long )u32temp; if (u64temp != 0ULL) { nesqp = (struct nes_qp *)u64temp; memset((void *)entry, 0, 56UL); if (cqe.cqe_words[6] == 0U) { entry->status = 0; } else { err_code = cqe.cqe_words[6]; if (err_code >> 16 == 32768U) { entry->status = (enum ib_wc_status )(err_code & 65535U); (nescq->hw_cq.cq_vbase + (unsigned long )head)->cqe_words[6] = 65537U; } else { entry->status = 5; } } entry->qp = & nesqp->ibqp; entry->src_qp = nesqp->hwqp.qp_id; if ((cqe.cqe_words[7] & 256U) != 0U) { if ((unsigned int )*((unsigned char *)nesqp + 820UL) != 0U) { nesqp->skip_lsmm = 0U; nesqp->hwqp.sq_tail = (u16 )((int )nesqp->hwqp.sq_tail + 1); } else { } wrid = ((unsigned long long )(nesqp->hwqp.sq_vbase + (unsigned long )wqe_index)->wqe_words[5] << 32) | (unsigned long long )(nesqp->hwqp.sq_vbase + (unsigned long )wqe_index)->wqe_words[4]; entry->byte_len = (nesqp->hwqp.sq_vbase + (unsigned long )wqe_index)->wqe_words[1]; switch ((nesqp->hwqp.sq_vbase + (unsigned long )wqe_index)->wqe_words[0] & 63U) { case 0: ; if ((nes_debug_level & 8192U) != 0U) { printk("\viw_nes: %s[%u]: Operation = RDMA WRITE.\n", "nes_poll_cq", 3751); } else { } entry->opcode = 1; goto ldv_55146; case 1: ; if ((nes_debug_level & 8192U) != 0U) { printk("\viw_nes: %s[%u]: Operation = RDMA READ.\n", "nes_poll_cq", 3755); } else { } entry->opcode = 2; entry->byte_len = (nesqp->hwqp.sq_vbase + (unsigned long )wqe_index)->wqe_words[10]; goto ldv_55146; case 4: ; case 6: ; case 3: ; case 5: ; if ((nes_debug_level & 8192U) != 0U) { printk("\viw_nes: %s[%u]: Operation = Send.\n", "nes_poll_cq", 3764); } else { } entry->opcode = 0; goto ldv_55146; case 10: entry->opcode = 7; goto ldv_55146; case 9: entry->opcode = 8; goto ldv_55146; } ldv_55146: nesqp->hwqp.sq_tail = ((unsigned int )((u16 )wqe_index) + 1U) & ((unsigned int )nesqp->hwqp.sq_size + 65535U); if ((unsigned int )entry->status != 0U && (int )nesqp->hwqp.sq_tail != (int )nesqp->hwqp.sq_head) { move_cq_head = 0U; wq_tail = (u32 )nesqp->hwqp.sq_tail; } else { } } else { entry->byte_len = cqe.cqe_words[0]; wrid = (unsigned long long )(nesqp->hwqp.rq_vbase + (unsigned long )wqe_index)->wqe_words[4] | ((unsigned long long )(nesqp->hwqp.rq_vbase + (unsigned long )wqe_index)->wqe_words[5] << 32); entry->opcode = 128; nesqp->hwqp.rq_tail = ((unsigned int )((u16 )wqe_index) + 1U) & ((unsigned int )nesqp->hwqp.rq_size + 65535U); if ((unsigned int )entry->status != 0U && (int )nesqp->hwqp.rq_tail != (int )nesqp->hwqp.rq_head) { move_cq_head = 0U; wq_tail = (u32 )nesqp->hwqp.rq_tail; } else { } } entry->wr_id = wrid; entry = entry + 1; cqe_count = cqe_count + 1U; } else { } if (move_cq_head != 0U) { (nescq->hw_cq.cq_vbase + (unsigned long )head)->cqe_words[7] = 0U; head = head + 1U; if (head >= cq_size) { head = 0U; } else { } nescq->polled_completions = nescq->polled_completions + 1U; if (nescq->polled_completions > cq_size / 2U || nescq->polled_completions == 255U) { if ((nes_debug_level & 8192U) != 0U) { printk("\viw_nes: %s[%u]: CQ%u Issuing CQE Allocate since more than half of cqes are pending %u of %u.\n", "nes_poll_cq", 3809, (int )nescq->hw_cq.cq_number, nescq->polled_completions, cq_size); } else { } nes_write32(nesdev->regs + 68UL, (u32 )nescq->hw_cq.cq_number | (nescq->polled_completions << 16)); nescq->polled_completions = 0U; } else { } } else { wqe_index = cqe.cqe_words[2]; wqe_index = (- (nesdev->nesadapter)->max_qp_wr & wqe_index) | wq_tail; (nescq->hw_cq.cq_vbase + (unsigned long )head)->cqe_words[2] = wqe_index; move_cq_head = 1U; } ldv_55155: ; if ((u32 )num_entries > cqe_count) { goto ldv_55154; } else { goto ldv_55144; } ldv_55144: ; if (nescq->polled_completions != 0U) { nes_write32(nesdev->regs + 68UL, (u32 )nescq->hw_cq.cq_number | (nescq->polled_completions << 16)); nescq->polled_completions = 0U; } else { } nescq->hw_cq.cq_head = (u16 )head; if ((nes_debug_level & 8192U) != 0U) { printk("\viw_nes: %s[%u]: Reporting %u completions for CQ%u.\n", "nes_poll_cq", 3832, cqe_count, (int )nescq->hw_cq.cq_number); } else { } spin_unlock_irqrestore(& nescq->lock, flags); return ((int )cqe_count); } } static int nes_req_notify_cq(struct ib_cq *ibcq , enum ib_cq_notify_flags notify_flags ) { struct nes_vnic *nesvnic ; struct nes_vnic *tmp ; struct nes_device *nesdev ; struct nes_cq *nescq ; struct nes_cq *tmp___0 ; u32 cq_arm ; { tmp = to_nesvnic(ibcq->device); nesvnic = tmp; nesdev = nesvnic->nesdev; tmp___0 = to_nescq(ibcq); nescq = tmp___0; if ((nes_debug_level & 8192U) != 0U) { printk("\viw_nes: %s[%u]: Requesting notification for CQ%u.\n", "nes_req_notify_cq", 3851, (int )nescq->hw_cq.cq_number); } else { } cq_arm = (u32 )nescq->hw_cq.cq_number; if (((unsigned int )notify_flags & 3U) == 2U) { cq_arm = cq_arm | 536870912U; } else if (((unsigned int )notify_flags & 3U) == 1U) { cq_arm = cq_arm | 1073741824U; } else { return (-22); } nes_write32(nesdev->regs + 68UL, cq_arm); nes_read32((void const *)nesdev->regs + 68U); return (0); } } struct nes_ib_device *nes_init_ofa_device(struct net_device *netdev ) { struct nes_ib_device *nesibdev ; struct nes_vnic *nesvnic ; void *tmp ; struct nes_device *nesdev ; struct ib_device *tmp___0 ; size_t __len ; void *__ret ; void *tmp___1 ; { tmp = netdev_priv((struct net_device const *)netdev); nesvnic = (struct nes_vnic *)tmp; nesdev = nesvnic->nesdev; tmp___0 = ib_alloc_device(2192UL); nesibdev = (struct nes_ib_device *)tmp___0; if ((unsigned long )nesibdev == (unsigned long )((struct nes_ib_device *)0)) { return (0); } else { } strlcpy((char *)(& nesibdev->ibdev.name), "nes%d", 64UL); nesibdev->ibdev.owner = & __this_module; nesibdev->ibdev.node_type = 4U; memset((void *)(& nesibdev->ibdev.node_guid), 0, 8UL); __len = 6UL; if (__len > 63UL) { __ret = __memcpy((void *)(& nesibdev->ibdev.node_guid), (void const *)netdev->dev_addr, __len); } else { __ret = __builtin_memcpy((void *)(& nesibdev->ibdev.node_guid), (void const *)netdev->dev_addr, __len); } nesibdev->ibdev.uverbs_cmd_mask = 1035461439ULL; nesibdev->ibdev.phys_port_cnt = 1U; nesibdev->ibdev.num_comp_vectors = 1; nesibdev->ibdev.dma_device = & (nesdev->pcidev)->dev; nesibdev->ibdev.dev.parent = & (nesdev->pcidev)->dev; nesibdev->ibdev.query_device = & nes_query_device; nesibdev->ibdev.query_port = & nes_query_port; nesibdev->ibdev.query_pkey = & nes_query_pkey; nesibdev->ibdev.query_gid = & nes_query_gid; nesibdev->ibdev.alloc_ucontext = & nes_alloc_ucontext; nesibdev->ibdev.dealloc_ucontext = & nes_dealloc_ucontext; nesibdev->ibdev.mmap = & nes_mmap; nesibdev->ibdev.alloc_pd = & nes_alloc_pd; nesibdev->ibdev.dealloc_pd = & nes_dealloc_pd; nesibdev->ibdev.create_ah = & nes_create_ah; nesibdev->ibdev.destroy_ah = & nes_destroy_ah; nesibdev->ibdev.create_qp = & nes_create_qp; nesibdev->ibdev.modify_qp = & nes_modify_qp; nesibdev->ibdev.query_qp = & nes_query_qp; nesibdev->ibdev.destroy_qp = & nes_destroy_qp; nesibdev->ibdev.create_cq = & nes_create_cq; nesibdev->ibdev.destroy_cq = & nes_destroy_cq; nesibdev->ibdev.poll_cq = & nes_poll_cq; nesibdev->ibdev.get_dma_mr = & nes_get_dma_mr; nesibdev->ibdev.reg_phys_mr = & nes_reg_phys_mr; nesibdev->ibdev.reg_user_mr = & nes_reg_user_mr; nesibdev->ibdev.dereg_mr = & nes_dereg_mr; nesibdev->ibdev.alloc_mw = & nes_alloc_mw; nesibdev->ibdev.dealloc_mw = & nes_dealloc_mw; nesibdev->ibdev.bind_mw = & nes_bind_mw; nesibdev->ibdev.alloc_fast_reg_mr = & nes_alloc_fast_reg_mr; nesibdev->ibdev.alloc_fast_reg_page_list = & nes_alloc_fast_reg_page_list; nesibdev->ibdev.free_fast_reg_page_list = & nes_free_fast_reg_page_list; nesibdev->ibdev.attach_mcast = & nes_multicast_attach; nesibdev->ibdev.detach_mcast = & nes_multicast_detach; nesibdev->ibdev.process_mad = & nes_process_mad; nesibdev->ibdev.req_notify_cq = & nes_req_notify_cq; nesibdev->ibdev.post_send = & nes_post_send; nesibdev->ibdev.post_recv = & nes_post_recv; tmp___1 = kzalloc(64UL, 208U); nesibdev->ibdev.iwcm = (struct iw_cm_verbs *)tmp___1; if ((unsigned long )nesibdev->ibdev.iwcm == (unsigned long )((struct iw_cm_verbs *)0)) { ib_dealloc_device(& nesibdev->ibdev); return (0); } else { } (nesibdev->ibdev.iwcm)->add_ref = & nes_add_ref; (nesibdev->ibdev.iwcm)->rem_ref = & nes_rem_ref; (nesibdev->ibdev.iwcm)->get_qp = & nes_get_qp; (nesibdev->ibdev.iwcm)->connect = & nes_connect; (nesibdev->ibdev.iwcm)->accept = & nes_accept; (nesibdev->ibdev.iwcm)->reject = & nes_reject; (nesibdev->ibdev.iwcm)->create_listen = & nes_create_listen; (nesibdev->ibdev.iwcm)->destroy_listen = & nes_destroy_listen; return (nesibdev); } } static void nes_handle_delayed_event(unsigned long data ) { struct nes_vnic *nesvnic ; struct ib_event event ; { nesvnic = (struct nes_vnic *)data; if ((unsigned int )nesvnic->delayed_event != (unsigned int )nesvnic->last_dispatched_event) { event.device = & (nesvnic->nesibdev)->ibdev; if ((unsigned long )event.device == (unsigned long )((struct ib_device *)0)) { goto stop_timer; } else { } event.event = nesvnic->delayed_event; event.element.port_num = (unsigned int )nesvnic->logical_port + 1U; ib_dispatch_event(& event); } else { } stop_timer: nesvnic->event_timer.function = 0; return; } } void nes_port_ibevent(struct nes_vnic *nesvnic ) { struct nes_ib_device *nesibdev ; struct nes_device *nesdev ; struct ib_event event ; unsigned long tmp ; unsigned long tmp___0 ; { nesibdev = nesvnic->nesibdev; nesdev = nesvnic->nesdev; event.device = & nesibdev->ibdev; event.element.port_num = (unsigned int )nesvnic->logical_port + 1U; if ((unsigned int )nesdev->iw_status != 0U) { event.event = 9; } else { event.event = 10; } if ((unsigned long )nesvnic->event_timer.function == (unsigned long )((void (*)(unsigned long ))0)) { ib_dispatch_event(& event); nesvnic->last_dispatched_event = event.event; nesvnic->event_timer.function = & nes_handle_delayed_event; nesvnic->event_timer.data = (unsigned long )nesvnic; tmp = msecs_to_jiffies(100U); nesvnic->event_timer.expires = tmp + (unsigned long )jiffies; add_timer(& nesvnic->event_timer); } else { tmp___0 = msecs_to_jiffies(100U); mod_timer(& nesvnic->event_timer, tmp___0 + (unsigned long )jiffies); } nesvnic->delayed_event = event.event; return; } } void nes_destroy_ofa_device(struct nes_ib_device *nesibdev ) { { if ((unsigned long )nesibdev == (unsigned long )((struct nes_ib_device *)0)) { return; } else { } nes_unregister_ofa_device(nesibdev); kfree((void const *)nesibdev->ibdev.iwcm); ib_dealloc_device(& nesibdev->ibdev); return; } } int nes_register_ofa_device(struct nes_ib_device *nesibdev ) { struct nes_vnic *nesvnic ; struct nes_device *nesdev ; struct nes_adapter *nesadapter ; int i ; int ret ; { nesvnic = nesibdev->nesvnic; nesdev = nesvnic->nesdev; nesadapter = nesdev->nesadapter; ret = ib_register_device(& (nesvnic->nesibdev)->ibdev, 0); if (ret != 0) { return (ret); } else { } nesibdev->max_cq = (nesadapter->max_cq - 64U) / (u32 )nesadapter->port_count; nesibdev->max_mr = nesadapter->max_mr / (u32 )nesadapter->port_count; nesibdev->max_qp = (nesadapter->max_qp - 64U) / (u32 )nesadapter->port_count; nesibdev->max_pd = nesadapter->max_pd / (u32 )nesadapter->port_count; i = 0; goto ldv_55203; ldv_55202: ret = device_create_file(& nesibdev->ibdev.dev, (struct device_attribute const *)nes_dev_attributes[i]); if (ret != 0) { goto ldv_55200; ldv_55199: i = i - 1; device_remove_file(& nesibdev->ibdev.dev, (struct device_attribute const *)nes_dev_attributes[i]); ldv_55200: ; if (i > 0) { goto ldv_55199; } else { goto ldv_55201; } ldv_55201: ib_unregister_device(& nesibdev->ibdev); return (ret); } else { } i = i + 1; ldv_55203: ; if ((unsigned int )i <= 3U) { goto ldv_55202; } else { goto ldv_55204; } ldv_55204: nesvnic->of_device_registered = 1U; return (0); } } static void nes_unregister_ofa_device(struct nes_ib_device *nesibdev ) { struct nes_vnic *nesvnic ; int i ; { nesvnic = nesibdev->nesvnic; i = 0; goto ldv_55213; ldv_55212: device_remove_file(& nesibdev->ibdev.dev, (struct device_attribute const *)nes_dev_attributes[i]); i = i + 1; ldv_55213: ; if ((unsigned int )i <= 3U) { goto ldv_55212; } else { goto ldv_55214; } ldv_55214: ; if ((unsigned int )nesvnic->of_device_registered != 0U) { ib_unregister_device(& nesibdev->ibdev); } else { } nesvnic->of_device_registered = 0U; return; } } void ldv_mutex_lock_65(struct mutex *ldv_func_arg1 ) { { ldv_mutex_lock_lock(ldv_func_arg1); mutex_lock(ldv_func_arg1); return; } } void ldv_mutex_unlock_66(struct mutex *ldv_func_arg1 ) { { ldv_mutex_unlock_lock(ldv_func_arg1); mutex_unlock(ldv_func_arg1); return; } } void ldv_mutex_lock_67(struct mutex *ldv_func_arg1 ) { { ldv_mutex_lock_mutex_of_device(ldv_func_arg1); mutex_lock(ldv_func_arg1); return; } } int ldv_mutex_trylock_68(struct mutex *ldv_func_arg1 ) { ldv_func_ret_type___2 ldv_func_res ; int tmp ; int tmp___0 ; { tmp = mutex_trylock(ldv_func_arg1); ldv_func_res = tmp; tmp___0 = ldv_mutex_trylock_mutex_of_device(ldv_func_arg1); return (tmp___0); return (ldv_func_res); } } void ldv_mutex_unlock_69(struct mutex *ldv_func_arg1 ) { { ldv_mutex_unlock_mutex_of_device(ldv_func_arg1); mutex_unlock(ldv_func_arg1); return; } } void ldv_mutex_lock_70(struct mutex *ldv_func_arg1 ) { { ldv_mutex_lock_cred_guard_mutex_of_signal_struct(ldv_func_arg1); mutex_lock(ldv_func_arg1); return; } } void ldv_mutex_unlock_71(struct mutex *ldv_func_arg1 ) { { ldv_mutex_unlock_cred_guard_mutex_of_signal_struct(ldv_func_arg1); mutex_unlock(ldv_func_arg1); return; } } __inline static void list_add(struct list_head *new , struct list_head *head ) { { __list_add(new, head, head->next); return; } } extern int memcmp(void const * , void const * , size_t ) ; __inline static int atomic_sub_return(int i , atomic_t *v ) { int tmp ; { tmp = atomic_add_return(- i, v); return (tmp); } } extern void lock_acquire(struct lockdep_map * , unsigned int , int , int , int , struct lockdep_map * , unsigned long ) ; extern void lock_release(struct lockdep_map * , int , unsigned long ) ; extern void lockdep_rcu_suspicious(char const * , int const , char const * ) ; int ldv_mutex_trylock_82(struct mutex *ldv_func_arg1 ) ; void ldv_mutex_unlock_80(struct mutex *ldv_func_arg1 ) ; void ldv_mutex_unlock_83(struct mutex *ldv_func_arg1 ) ; void ldv_mutex_unlock_85(struct mutex *ldv_func_arg1 ) ; void ldv_mutex_lock_79(struct mutex *ldv_func_arg1 ) ; void ldv_mutex_lock_81(struct mutex *ldv_func_arg1 ) ; void ldv_mutex_lock_84(struct mutex *ldv_func_arg1 ) ; extern unsigned long kernel_stack ; __inline static struct thread_info *current_thread_info(void) { struct thread_info *ti ; unsigned long pfo_ret__ ; { switch (8UL) { case 1: __asm__ ("movb %%gs:%P1,%0": "=q" (pfo_ret__): "p" (& kernel_stack)); goto ldv_6158; case 2: __asm__ ("movw %%gs:%P1,%0": "=r" (pfo_ret__): "p" (& kernel_stack)); goto ldv_6158; case 4: __asm__ ("movl %%gs:%P1,%0": "=r" (pfo_ret__): "p" (& kernel_stack)); goto ldv_6158; case 8: __asm__ ("movq %%gs:%P1,%0": "=r" (pfo_ret__): "p" (& kernel_stack)); goto ldv_6158; default: __bad_percpu_size(); } ldv_6158: ti = (struct thread_info *)(pfo_ret__ - 8152UL); return (ti); } } __inline static void __rcu_read_lock(void) { struct thread_info *tmp ; { tmp = current_thread_info(); tmp->preempt_count = tmp->preempt_count + 1; __asm__ volatile ("": : : "memory"); return; } } __inline static void __rcu_read_unlock(void) { struct thread_info *tmp ; { __asm__ volatile ("": : : "memory"); tmp = current_thread_info(); tmp->preempt_count = tmp->preempt_count + -1; __asm__ volatile ("": : : "memory"); return; } } extern int rcu_is_cpu_idle(void) ; __inline static void rcu_lock_acquire(struct lockdep_map *map ) { { lock_acquire(map, 0U, 0, 2, 1, 0, (unsigned long )((void *)0)); return; } } __inline static void rcu_lock_release(struct lockdep_map *map ) { { lock_release(map, 1, (unsigned long )((void *)0)); return; } } extern struct lockdep_map rcu_lock_map ; extern int debug_lockdep_rcu_enabled(void) ; __inline static void rcu_read_lock(void) { bool __warned ; int tmp ; int tmp___0 ; { __rcu_read_lock(); rcu_lock_acquire(& rcu_lock_map); tmp = debug_lockdep_rcu_enabled(); if (tmp != 0 && ! __warned) { tmp___0 = rcu_is_cpu_idle(); if (tmp___0 != 0) { __warned = 1; lockdep_rcu_suspicious("include/linux/rcupdate.h", 763, "rcu_read_lock() used illegally while idle"); } else { } } else { } return; } } __inline static void rcu_read_unlock(void) { bool __warned ; int tmp ; int tmp___0 ; { tmp = debug_lockdep_rcu_enabled(); if (tmp != 0 && ! __warned) { tmp___0 = rcu_is_cpu_idle(); if (tmp___0 != 0) { __warned = 1; lockdep_rcu_suspicious("include/linux/rcupdate.h", 784, "rcu_read_unlock() used illegally while idle"); } else { } } else { } rcu_lock_release(& rcu_lock_map); __rcu_read_unlock(); return; } } extern struct timespec current_kernel_time(void) ; __inline static int timer_pending(struct timer_list const *timer ) { { return ((unsigned long )timer->entry.next != (unsigned long )((struct list_head */* const */)0)); } } extern struct workqueue_struct *__alloc_workqueue_key(char const * , unsigned int , int , struct lock_class_key * , char const * , ...) ; extern void destroy_workqueue(struct workqueue_struct * ) ; extern bool queue_work(struct workqueue_struct * , struct work_struct * ) ; extern unsigned char *skb_pull(struct sk_buff * , unsigned int ) ; __inline static void skb_reset_mac_header(struct sk_buff *skb ) { { skb->mac_header = (sk_buff_data_t )((long )skb->data) - (sk_buff_data_t )((long )skb->head); return; } } extern void skb_trim(struct sk_buff * , unsigned int ) ; extern struct net init_net ; extern struct neighbour *neigh_lookup(struct neigh_table * , void const * , struct net_device * ) ; extern void neigh_destroy(struct neighbour * ) ; extern int __neigh_event_send(struct neighbour * , struct sk_buff * ) ; __inline static void neigh_release(struct neighbour *neigh ) { int tmp ; { tmp = atomic_dec_and_test(& neigh->refcnt); if (tmp != 0) { neigh_destroy(neigh); } else { } return; } } __inline static int neigh_event_send(struct neighbour *neigh , struct sk_buff *skb ) { unsigned long now ; int tmp ; { now = jiffies; if (neigh->used != now) { neigh->used = now; } else { } if (((int )neigh->nud_state & 218) == 0) { tmp = __neigh_event_send(neigh, skb); return (tmp); } else { } return (0); } } extern void dst_release(struct dst_entry * ) ; extern struct neigh_table arp_tbl ; extern struct rtable *ip_route_output_flow(struct net * , struct flowi4 * , struct sock * ) ; __inline static struct rtable *ip_route_output_key(struct net *net , struct flowi4 *flp ) { struct rtable *tmp ; { tmp = ip_route_output_flow(net, flp, 0); return (tmp); } } __inline static struct rtable *ip_route_output(struct net *net , __be32 daddr , __be32 saddr , u8 tos , int oif ) { struct flowi4 fl4 ; struct rtable *tmp ; { fl4.__fl_common.flowic_oif = oif; fl4.__fl_common.flowic_iif = 0; fl4.__fl_common.flowic_mark = 0U; fl4.__fl_common.flowic_tos = tos; fl4.__fl_common.flowic_scope = (unsigned char)0; fl4.__fl_common.flowic_proto = (unsigned char)0; fl4.__fl_common.flowic_flags = (unsigned char)0; fl4.__fl_common.flowic_secid = 0U; fl4.saddr = saddr; fl4.daddr = daddr; fl4.uli.ports.dport = (unsigned short)0; fl4.uli.ports.sport = (unsigned short)0; tmp = ip_route_output_key(net, & fl4); return (tmp); } } __inline static void ip_rt_put(struct rtable *rt ) { { dst_release(& rt->dst); return; } } __inline static bool between(__u32 seq1 , __u32 seq2 , __u32 seq3 ) { { return (seq3 - seq2 >= seq1 - seq2); } } extern u32 crc32c(u32 , void const * , unsigned int ) ; int nes_add_ref_cm_node(struct nes_cm_node *cm_node ) ; int nes_rem_ref_cm_node(struct nes_cm_node *cm_node ) ; void nes_queue_mgt_skbs(struct sk_buff *skb , struct nes_vnic *nesvnic , struct nes_qp *nesqp ) ; atomic_t cm_connects ; atomic_t cm_accepts ; atomic_t cm_disconnects ; atomic_t cm_closes ; atomic_t cm_connecteds ; atomic_t cm_connect_reqs ; atomic_t cm_rejects ; u32 cm_packets_sent ; u32 cm_packets_bounced ; u32 cm_packets_created ; u32 cm_packets_received ; u32 cm_packets_dropped ; u32 cm_packets_retrans ; atomic_t cm_listens_created ; atomic_t cm_listens_destroyed ; u32 cm_backlog_drops ; atomic_t cm_loopbacks ; atomic_t cm_nodes_created ; atomic_t cm_nodes_destroyed ; atomic_t cm_accel_dropped_pkts ; atomic_t cm_resets_recvd ; __inline static __le32 get_crc_value(struct nes_v4_quad *nes_quad ) { u32 crc_value ; { crc_value = crc32c(4294967295U, (void const *)nes_quad, 16U); return (crc_value); } } __inline static int mini_cm_accelerated(struct nes_cm_core *cm_core , struct nes_cm_node *cm_node ) ; static struct nes_cm_listener *mini_cm_listen(struct nes_cm_core *cm_core , struct nes_vnic *nesvnic , struct nes_cm_info *cm_info ) ; static int mini_cm_del_listen(struct nes_cm_core *cm_core , struct nes_cm_listener *listener ) ; static struct nes_cm_node *mini_cm_connect(struct nes_cm_core *cm_core , struct nes_vnic *nesvnic , u16 private_data_len , void *private_data , struct nes_cm_info *cm_info ) ; static int mini_cm_close(struct nes_cm_core *cm_core , struct nes_cm_node *cm_node ) ; static int mini_cm_accept(struct nes_cm_core *cm_core , struct nes_cm_node *cm_node ) ; static int mini_cm_reject(struct nes_cm_core *cm_core , struct nes_cm_node *cm_node ) ; static int mini_cm_recv_pkt(struct nes_cm_core *cm_core , struct nes_vnic *nesvnic , struct sk_buff *skb ) ; static int mini_cm_dealloc_core(struct nes_cm_core *cm_core ) ; static int mini_cm_get(struct nes_cm_core *cm_core ) ; static int mini_cm_set(struct nes_cm_core *cm_core , u32 type , u32 value ) ; static void form_cm_frame(struct sk_buff *skb , struct nes_cm_node *cm_node , void *options , u32 optionsize , void *data , u32 datasize , u8 flags ) ; static int add_ref_cm_node(struct nes_cm_node *cm_node ) ; static int rem_ref_cm_node(struct nes_cm_core *cm_core , struct nes_cm_node *cm_node ) ; static int nes_cm_disconn_true(struct nes_qp *nesqp ) ; static int nes_cm_post_event(struct nes_cm_event *event ) ; static int nes_disconnect(struct nes_qp *nesqp , int abrupt ) ; static void nes_disconnect_worker(struct work_struct *work ) ; static int send_mpa_request(struct nes_cm_node *cm_node , struct sk_buff *skb ) ; static int send_mpa_reject(struct nes_cm_node *cm_node ) ; static int send_syn(struct nes_cm_node *cm_node , u32 sendack , struct sk_buff *skb ) ; static int send_reset(struct nes_cm_node *cm_node , struct sk_buff *skb ) ; static int send_ack(struct nes_cm_node *cm_node , struct sk_buff *skb ) ; static int send_fin(struct nes_cm_node *cm_node , struct sk_buff *skb ) ; static void process_packet(struct nes_cm_node *cm_node , struct sk_buff *skb , struct nes_cm_core *cm_core ) ; static void active_open_err(struct nes_cm_node *cm_node , struct sk_buff *skb , int reset ) ; static void passive_open_err(struct nes_cm_node *cm_node , struct sk_buff *skb , int reset ) ; static void cleanup_retrans_entry(struct nes_cm_node *cm_node ) ; static void handle_rcv_mpa(struct nes_cm_node *cm_node , struct sk_buff *skb ) ; static void free_retrans_entry(struct nes_cm_node *cm_node ) ; static int handle_tcp_options(struct nes_cm_node *cm_node , struct tcphdr *tcph , struct sk_buff *skb , int optionsize , int passive ) ; static void cm_event_connected(struct nes_cm_event *event ) ; static void cm_event_connect_error(struct nes_cm_event *event ) ; static void cm_event_reset(struct nes_cm_event *event ) ; static void cm_event_mpa_req(struct nes_cm_event *event ) ; static void cm_event_mpa_reject(struct nes_cm_event *event ) ; static void handle_recv_entry(struct nes_cm_node *cm_node , u32 rem_node ) ; static int cm_build_mpa_frame(struct nes_cm_node *cm_node , u8 **start_buff , u16 *buff_len , u8 *pci_mem , u8 mpa_key ) ; static void build_mpa_v2(struct nes_cm_node *cm_node , void *start_addr , u8 mpa_key ) ; static void build_mpa_v1(struct nes_cm_node *cm_node , void *start_addr , u8 mpa_key ) ; static void build_rdma0_msg(struct nes_cm_node *cm_node , struct nes_qp **nesqp_addr ) ; static void print_core(struct nes_cm_core *core ) ; static struct nes_cm_ops nes_cm_api = {& mini_cm_accelerated, & mini_cm_listen, & mini_cm_del_listen, & mini_cm_connect, & mini_cm_close, & mini_cm_accept, & mini_cm_reject, & mini_cm_recv_pkt, & mini_cm_dealloc_core, & mini_cm_get, & mini_cm_set}; static struct nes_cm_core *g_cm_core ; int nes_add_ref_cm_node(struct nes_cm_node *cm_node ) { int tmp ; { tmp = add_ref_cm_node(cm_node); return (tmp); } } int nes_rem_ref_cm_node(struct nes_cm_node *cm_node ) { int tmp ; { tmp = rem_ref_cm_node(cm_node->cm_core, cm_node); return (tmp); } } static struct nes_cm_event *create_event(struct nes_cm_node *cm_node , enum nes_cm_event_type type ) { struct nes_cm_event *event ; void *tmp ; { if ((unsigned long )cm_node->cm_id == (unsigned long )((struct iw_cm_id *)0)) { return (0); } else { } tmp = kzalloc(128UL, 32U); event = (struct nes_cm_event *)tmp; if ((unsigned long )event == (unsigned long )((struct nes_cm_event *)0)) { return (0); } else { } event->type = type; event->cm_node = cm_node; event->cm_info.rem_addr = cm_node->rem_addr; event->cm_info.loc_addr = cm_node->loc_addr; event->cm_info.rem_port = cm_node->rem_port; event->cm_info.loc_port = cm_node->loc_port; event->cm_info.ldv_52927.cm_id = cm_node->cm_id; if ((nes_debug_level & 32U) != 0U) { printk("\viw_nes: %s[%u]: cm_node=%p Created event=%p, type=%u, dst_addr=%08x[%x], src_addr=%08x[%x]\n", "create_event", 238, cm_node, event, (unsigned int )type, event->cm_info.loc_addr, (int )event->cm_info.loc_port, event->cm_info.rem_addr, (int )event->cm_info.rem_port); } else { } nes_cm_post_event(event); return (event); } } static int send_mpa_request(struct nes_cm_node *cm_node , struct sk_buff *skb ) { u8 start_addr ; u8 *start_ptr ; u8 **start_buff ; u16 buff_len ; int tmp ; { start_addr = 0U; start_ptr = & start_addr; start_buff = & start_ptr; buff_len = 0U; if ((unsigned long )skb == (unsigned long )((struct sk_buff *)0)) { if ((nes_debug_level & 32U) != 0U) { printk("\viw_nes: %s[%u]: skb set to NULL\n", "send_mpa_request", 256); } else { } return (-1); } else { } cm_build_mpa_frame(cm_node, start_buff, & buff_len, 0, 0); form_cm_frame(skb, cm_node, 0, 0U, (void *)*start_buff, (u32 )buff_len, 1); tmp = schedule_nes_timer(cm_node, skb, 0, 1, 0); return (tmp); } } static int send_mpa_reject(struct nes_cm_node *cm_node ) { struct sk_buff *skb ; u8 start_addr ; u8 *start_ptr ; u8 **start_buff ; u16 buff_len ; struct ietf_mpa_v1 *mpa_frame ; int tmp ; { skb = 0; start_addr = 0U; start_ptr = & start_addr; start_buff = & start_ptr; buff_len = 0U; skb = dev_alloc_skb(536U); if ((unsigned long )skb == (unsigned long )((struct sk_buff *)0)) { if ((nes_debug_level & 32U) != 0U) { printk("\viw_nes: %s[%u]: Failed to get a Free pkt\n", "send_mpa_reject", 280); } else { } return (-12); } else { } cm_build_mpa_frame(cm_node, start_buff, & buff_len, 0, 1); mpa_frame = (struct ietf_mpa_v1 *)*start_buff; mpa_frame->flags = (u8 )((unsigned int )mpa_frame->flags | 32U); form_cm_frame(skb, cm_node, 0, 0U, (void *)*start_buff, (u32 )buff_len, 5); cm_node->state = 12; tmp = schedule_nes_timer(cm_node, skb, 0, 1, 0); return (tmp); } } static int parse_mpa(struct nes_cm_node *cm_node , u8 *buffer , u32 *type , u32 len ) { struct ietf_mpa_v1 *mpa_frame ; struct ietf_mpa_v2 *mpa_v2_frame ; struct ietf_rtr_msg *rtr_msg ; int mpa_hdr_len ; int priv_data_len ; __u16 tmp ; int tmp___0 ; int tmp___1 ; u16 ird_size ; u16 ord_size ; u16 rtr_ctrl_ird ; u16 rtr_ctrl_ord ; __u16 tmp___2 ; __u16 tmp___3 ; size_t __len ; void *__ret ; { *type = 1U; if (len <= 19U) { if ((nes_debug_level & 32U) != 0U) { printk("\viw_nes: %s[%u]: The received ietf buffer was too small (%x)\n", "parse_mpa", 312, len); } else { } return (-22); } else { } mpa_frame = (struct ietf_mpa_v1 *)buffer; mpa_hdr_len = 20; tmp = __fswab16((int )mpa_frame->priv_data_len); priv_data_len = (int )tmp; if (priv_data_len > 512) { if ((nes_debug_level & 32U) != 0U) { printk("\viw_nes: %s[%u]: The received Length of Private Data field exceeds 512 octets\n", "parse_mpa", 324); } else { } return (-22); } else { } if ((unsigned int )mpa_frame->rev != 1U && (unsigned int )mpa_frame->rev != 2U) { if ((nes_debug_level & 32U) != 0U) { printk("\viw_nes: %s[%u]: The received mpa version is not supported\n", "parse_mpa", 334); } else { } return (-22); } else { } if ((unsigned int )mpa_frame->rev > (unsigned int )cm_node->mpa_frame_rev) { if ((nes_debug_level & 32U) != 0U) { printk("\viw_nes: %s[%u]: The received mpa version can not be interoperated\n", "parse_mpa", 342); } else { } return (-22); } else { cm_node->mpa_frame_rev = (enum mpa_frame_version )mpa_frame->rev; } if ((unsigned int )cm_node->state != 8U) { tmp___0 = memcmp((void const *)(& mpa_frame->key), (void const *)"MPA ID Req Frame", 16UL); if (tmp___0 != 0) { if ((nes_debug_level & 32U) != 0U) { printk("\viw_nes: %s[%u]: Unexpected MPA Key received \n", "parse_mpa", 350); } else { } return (-22); } else { } } else { tmp___1 = memcmp((void const *)(& mpa_frame->key), (void const *)"MPA ID Rep Frame", 16UL); if (tmp___1 != 0) { if ((nes_debug_level & 32U) != 0U) { printk("\viw_nes: %s[%u]: Unexpected MPA Key received \n", "parse_mpa", 355); } else { } return (-22); } else { } } if ((u32 )(priv_data_len + mpa_hdr_len) != len) { if ((nes_debug_level & 32U) != 0U) { printk("\viw_nes: %s[%u]: The received ietf buffer was not right complete (%x + %x != %x)\n", "parse_mpa", 364, priv_data_len, mpa_hdr_len, len); } else { } return (-22); } else { } if (len > 536U) { if ((nes_debug_level & 32U) != 0U) { printk("\viw_nes: %s[%u]: The received ietf buffer was too large (%x + %x != %x)\n", "parse_mpa", 371, priv_data_len, mpa_hdr_len, len); } else { } return (-22); } else { } cm_node->mpa_frame_size = (u16 )priv_data_len; switch ((int )mpa_frame->rev) { case 2: mpa_v2_frame = (struct ietf_mpa_v2 *)buffer; mpa_hdr_len = mpa_hdr_len + 4; cm_node->mpa_frame_size = (unsigned int )cm_node->mpa_frame_size + 65532U; rtr_msg = & mpa_v2_frame->rtr_msg; tmp___2 = __fswab16((int )rtr_msg->ctrl_ird); rtr_ctrl_ird = tmp___2; tmp___3 = __fswab16((int )rtr_msg->ctrl_ord); rtr_ctrl_ord = tmp___3; ird_size = (unsigned int )rtr_ctrl_ird & 16383U; ord_size = (unsigned int )rtr_ctrl_ord & 16383U; if ((int )((short )rtr_ctrl_ird) >= 0) { return (-22); } else { } if ((unsigned int )cm_node->state != 8U) { if ((int )cm_node->ord_size > (int )ird_size) { cm_node->ord_size = ird_size; } else { } } else { if ((int )cm_node->ord_size > (int )ird_size) { cm_node->ord_size = ird_size; } else { } if ((int )cm_node->ird_size < (int )ord_size) { return (-22); } else { } } if (((int )rtr_ctrl_ord & 16384) != 0) { cm_node->send_rdma0_op = 1; } else if ((int )((short )rtr_ctrl_ord) < 0) { cm_node->send_rdma0_op = 2; } else { return (-22); } goto ldv_53527; case 1: ; default: ; goto ldv_53527; } ldv_53527: __len = (size_t )cm_node->mpa_frame_size; __ret = __builtin_memcpy((void *)(& cm_node->ldv_52906.mpa_frame_buf), (void const *)buffer + (unsigned long )mpa_hdr_len, __len); if (((int )mpa_frame->flags & 32) != 0) { *type = 2U; } else { } return (0); } } static void form_cm_frame(struct sk_buff *skb , struct nes_cm_node *cm_node , void *options , u32 optionsize , void *data , u32 datasize , u8 flags ) { struct tcphdr *tcph ; struct iphdr *iph ; struct ethhdr *ethh ; u8 *buf ; u16 packetsize ; unsigned char *tmp ; size_t __len ; void *__ret ; size_t __len___0 ; void *__ret___0 ; __u16 tmp___0 ; __u16 tmp___1 ; __u32 tmp___2 ; __u32 tmp___3 ; __u16 tmp___4 ; __u16 tmp___5 ; __u32 tmp___6 ; __u32 tmp___7 ; __u16 tmp___8 ; size_t __len___1 ; void *__ret___1 ; size_t __len___2 ; void *__ret___2 ; unsigned char *tmp___9 ; { packetsize = 20U; packetsize = (unsigned int )packetsize + 20U; packetsize = ((int )((u16 )optionsize) + (int )((u16 )datasize)) + (int )packetsize; skb_trim(skb, 0U); memset((void *)skb->data, 0, 54UL); tmp = skb_put(skb, (unsigned int )((int )packetsize + 14)); buf = tmp; ethh = (struct ethhdr *)buf; buf = buf + 14UL; iph = (struct iphdr *)buf; buf = buf + 20UL; tcph = (struct tcphdr *)buf; skb_reset_mac_header(skb); skb_set_network_header(skb, 14); skb_set_transport_header(skb, 34); buf = buf + 20UL; skb->ip_summed = 3U; if (((cm_node->netdev)->features & 2ULL) == 0ULL) { skb->ip_summed = 0U; } else { } skb->protocol = 8U; skb->data_len = 0U; skb->mac_len = 14U; __len = 6UL; if (__len > 63UL) { __ret = __memcpy((void *)(& ethh->h_dest), (void const *)(& cm_node->rem_mac), __len); } else { __ret = __builtin_memcpy((void *)(& ethh->h_dest), (void const *)(& cm_node->rem_mac), __len); } __len___0 = 6UL; if (__len___0 > 63UL) { __ret___0 = __memcpy((void *)(& ethh->h_source), (void const *)(& cm_node->loc_mac), __len___0); } else { __ret___0 = __builtin_memcpy((void *)(& ethh->h_source), (void const *)(& cm_node->loc_mac), __len___0); } ethh->h_proto = 8U; iph->version = 4U; iph->ihl = 5U; iph->tos = 0U; tmp___0 = __fswab16((int )packetsize); iph->tot_len = tmp___0; cm_node->tcp_cntxt.loc_id = cm_node->tcp_cntxt.loc_id + 1U; tmp___1 = __fswab16((int )((__u16 )cm_node->tcp_cntxt.loc_id)); iph->id = tmp___1; iph->frag_off = 64U; iph->ttl = 64U; iph->protocol = 6U; tmp___2 = __fswab32(cm_node->loc_addr); iph->saddr = tmp___2; tmp___3 = __fswab32(cm_node->rem_addr); iph->daddr = tmp___3; tmp___4 = __fswab16((int )cm_node->loc_port); tcph->source = tmp___4; tmp___5 = __fswab16((int )cm_node->rem_port); tcph->dest = tmp___5; tmp___6 = __fswab32(cm_node->tcp_cntxt.loc_seq_num); tcph->seq = tmp___6; if ((int )flags & 1) { cm_node->tcp_cntxt.loc_ack_num = cm_node->tcp_cntxt.rcv_nxt; tmp___7 = __fswab32(cm_node->tcp_cntxt.loc_ack_num); tcph->ack_seq = tmp___7; tcph->ack = 1U; } else { tcph->ack_seq = 0U; } if (((int )flags & 2) != 0) { cm_node->tcp_cntxt.loc_seq_num = cm_node->tcp_cntxt.loc_seq_num + 1U; tcph->syn = 1U; } else { cm_node->tcp_cntxt.loc_seq_num = cm_node->tcp_cntxt.loc_seq_num + datasize; } if (((int )flags & 4) != 0) { cm_node->tcp_cntxt.loc_seq_num = cm_node->tcp_cntxt.loc_seq_num + 1U; tcph->fin = 1U; } else { } if (((int )flags & 8) != 0) { tcph->rst = 1U; } else { } tcph->doff = (unsigned char )(((unsigned long )optionsize + 23UL) >> 2); tmp___8 = __fswab16((int )((__u16 )cm_node->tcp_cntxt.rcv_wnd)); tcph->window = tmp___8; tcph->urg_ptr = 0U; if (optionsize != 0U) { __len___1 = (size_t )optionsize; __ret___1 = __builtin_memcpy((void *)buf, (void const *)options, __len___1); } else { } buf = buf + (unsigned long )optionsize; if (datasize != 0U) { __len___2 = (size_t )datasize; __ret___2 = __builtin_memcpy((void *)buf, (void const *)data, __len___2); } else { } tmp___9 = skb_end_pointer((struct sk_buff const *)skb); ((struct skb_shared_info *)tmp___9)->nr_frags = 0U; cm_packets_created = cm_packets_created + 1U; return; } } static void print_core(struct nes_cm_core *core ) { int tmp ; int tmp___0 ; { if ((nes_debug_level & 32U) != 0U) { printk("\viw_nes: %s[%u]: ---------------------------------------------\n", "print_core", 541); } else { } if ((nes_debug_level & 32U) != 0U) { printk("\viw_nes: %s[%u]: CM Core -- (core = %p )\n", "print_core", 542, core); } else { } if ((unsigned long )core == (unsigned long )((struct nes_cm_core *)0)) { return; } else { } if ((nes_debug_level & 32U) != 0U) { printk("\viw_nes: %s[%u]: ---------------------------------------------\n", "print_core", 545); } else { } if ((nes_debug_level & 32U) != 0U) { printk("\viw_nes: %s[%u]: State : %u \n", "print_core", 547, (unsigned int )core->state); } else { } if ((nes_debug_level & 32U) != 0U) { tmp = atomic_read((atomic_t const *)(& core->listen_node_cnt)); printk("\viw_nes: %s[%u]: Listen Nodes : %u \n", "print_core", 549, tmp); } else { } if ((nes_debug_level & 32U) != 0U) { tmp___0 = atomic_read((atomic_t const *)(& core->node_cnt)); printk("\viw_nes: %s[%u]: Active Nodes : %u \n", "print_core", 550, tmp___0); } else { } if ((nes_debug_level & 32U) != 0U) { printk("\viw_nes: %s[%u]: core : %p \n", "print_core", 552, core); } else { } if ((nes_debug_level & 32U) != 0U) { printk("\viw_nes: %s[%u]: -------------- end core ---------------\n", "print_core", 554); } else { } return; } } static int cm_build_mpa_frame(struct nes_cm_node *cm_node , u8 **start_buff , u16 *buff_len , u8 *pci_mem , u8 mpa_key ) { int ret ; { ret = 0; if ((unsigned long )pci_mem == (unsigned long )((u8 *)0)) { *start_buff = (u8 *)(& cm_node->ldv_52906.mpa_frame_buf); } else { *start_buff = pci_mem; } switch ((unsigned int )cm_node->mpa_frame_rev) { case 1: *start_buff = *start_buff + 4UL; *buff_len = (unsigned int )cm_node->mpa_frame_size + 20U; build_mpa_v1(cm_node, (void *)*start_buff, (int )mpa_key); goto ldv_53572; case 2: *buff_len = (unsigned int )cm_node->mpa_frame_size + 24U; build_mpa_v2(cm_node, (void *)*start_buff, (int )mpa_key); goto ldv_53572; default: ret = -22; } ldv_53572: ; return (ret); } } static void build_mpa_v2(struct nes_cm_node *cm_node , void *start_addr , u8 mpa_key ) { struct ietf_mpa_v2 *mpa_frame ; struct ietf_rtr_msg *rtr_msg ; u16 ctrl_ird ; u16 ctrl_ord ; __u16 tmp ; __u16 tmp___0 ; { mpa_frame = (struct ietf_mpa_v2 *)start_addr; rtr_msg = & mpa_frame->rtr_msg; build_mpa_v1(cm_node, start_addr, (int )mpa_key); mpa_frame->flags = (u8 )((unsigned int )mpa_frame->flags | 16U); mpa_frame->priv_data_len = (unsigned int )mpa_frame->priv_data_len + 1024U; if (16383U < (unsigned int )cm_node->ird_size) { ctrl_ird = 16383U; } else { ctrl_ird = cm_node->ird_size; } if (16383U < (unsigned int )cm_node->ord_size) { ctrl_ord = 16383U; } else { ctrl_ord = cm_node->ord_size; } ctrl_ird = (u16 )((unsigned int )ctrl_ird | 32768U); ctrl_ird = (u16 )((unsigned int )ctrl_ird | 16384U); switch ((int )mpa_key) { case 0: ctrl_ord = (u16 )((unsigned int )ctrl_ord | 32768U); ctrl_ord = (u16 )((unsigned int )ctrl_ord | 16384U); goto ldv_53585; case 1: ; switch ((unsigned int )cm_node->send_rdma0_op) { case 2: ctrl_ord = (u16 )((unsigned int )ctrl_ord | 32768U); goto ldv_53588; case 1: ctrl_ord = (u16 )((unsigned int )ctrl_ord | 16384U); goto ldv_53588; } ldv_53588: ; } ldv_53585: tmp = __fswab16((int )ctrl_ird); rtr_msg->ctrl_ird = tmp; tmp___0 = __fswab16((int )ctrl_ord); rtr_msg->ctrl_ord = tmp___0; return; } } static void build_mpa_v1(struct nes_cm_node *cm_node , void *start_addr , u8 mpa_key ) { struct ietf_mpa_v1 *mpa_frame ; size_t __len ; void *__ret ; size_t __len___0 ; void *__ret___0 ; __u16 tmp ; { mpa_frame = (struct ietf_mpa_v1 *)start_addr; switch ((int )mpa_key) { case 0: __len = 16UL; if (__len > 63UL) { __ret = __memcpy((void *)(& mpa_frame->key), (void const *)"MPA ID Req Frame", __len); } else { __ret = __builtin_memcpy((void *)(& mpa_frame->key), (void const *)"MPA ID Req Frame", __len); } goto ldv_53600; case 1: __len___0 = 16UL; if (__len___0 > 63UL) { __ret___0 = __memcpy((void *)(& mpa_frame->key), (void const *)"MPA ID Rep Frame", __len___0); } else { __ret___0 = __builtin_memcpy((void *)(& mpa_frame->key), (void const *)"MPA ID Rep Frame", __len___0); } goto ldv_53600; } ldv_53600: mpa_frame->flags = 64U; mpa_frame->rev = (u8 )cm_node->mpa_frame_rev; tmp = __fswab16((int )cm_node->mpa_frame_size); mpa_frame->priv_data_len = tmp; return; } } static void build_rdma0_msg(struct nes_cm_node *cm_node , struct nes_qp **nesqp_addr ) { u64 u64temp ; struct nes_qp *nesqp ; struct nes_hw_qp_wqe *wqe ; int __ret_warn_on ; long tmp ; { nesqp = *nesqp_addr; wqe = nesqp->hwqp.sq_vbase; u64temp = (u64 )nesqp; u64temp = u64temp | 512ULL; set_wqe_64bit_value((__le32 *)(& wqe->wqe_words), 2U, u64temp); wqe->wqe_words[16] = 0U; wqe->wqe_words[17] = 0U; switch ((unsigned int )cm_node->send_rdma0_op) { case 2: ; if ((nes_debug_level & 32U) != 0U) { printk("\viw_nes: %s[%u]: Sending first write.\n", "build_rdma0_msg", 662); } else { } wqe->wqe_words[0] = 0U; wqe->wqe_words[1] = 0U; wqe->wqe_words[18] = 0U; wqe->wqe_words[19] = 0U; goto ldv_53614; case 1: ; default: ; if ((unsigned int )cm_node->send_rdma0_op != 1U) { __ret_warn_on = 1; tmp = ldv__builtin_expect(__ret_warn_on != 0, 0L); if (tmp != 0L) { warn_slowpath_fmt("/home/zakharov/workspace/benchmarks/bench_1/work/current--X--drivers/infiniband/hw/nes/iw_nes.ko--X--deg2_cpalinux-3.8-rc1--X--32_7a--X--cpachecker/linux-3.8-rc1/csd_deg_dscv/18/dscv_tempdir/dscv/ri/32_7a/drivers/infiniband/hw/nes/nes_cm.c.prepared", 674, "Unsupported RDMA0 len operation=%u\n", (unsigned int )cm_node->send_rdma0_op); } else { } ldv__builtin_expect(__ret_warn_on != 0, 0L); } else { } if ((nes_debug_level & 32U) != 0U) { printk("\viw_nes: %s[%u]: Sending first rdma operation.\n", "build_rdma0_msg", 675); } else { } wqe->wqe_words[0] = 1U; wqe->wqe_words[8] = 1U; wqe->wqe_words[9] = 0U; wqe->wqe_words[10] = 0U; wqe->wqe_words[11] = 1U; wqe->wqe_words[19] = 1U; goto ldv_53614; } ldv_53614: ; if ((unsigned int )nesqp->sq_kmapped != 0U) { nesqp->sq_kmapped = 0U; kunmap(nesqp->page); } else { } (nesqp->nesqp_context)->ird_ord_sizes = (nesqp->nesqp_context)->ird_ord_sizes & 4060086271U; nesqp->skip_lsmm = 1U; nesqp->hwqp.sq_tail = 0U; return; } } int schedule_nes_timer(struct nes_cm_node *cm_node , struct sk_buff *skb , enum nes_timer_type type , int send_retrans , int close_when_complete ) { unsigned long flags ; struct nes_cm_core *cm_core ; struct nes_timer_entry *new_send ; int ret ; void *tmp ; int __ret_warn_on ; long tmp___0 ; struct tcphdr *tmp___1 ; __u32 tmp___2 ; raw_spinlock_t *tmp___3 ; int tmp___4 ; { cm_core = cm_node->cm_core; ret = 0; tmp = kzalloc(72UL, 32U); new_send = (struct nes_timer_entry *)tmp; if ((unsigned long )new_send == (unsigned long )((struct nes_timer_entry *)0)) { return (-12); } else { } new_send->retrycount = 64U; new_send->retranscount = 8U; new_send->skb = skb; new_send->timetosend = jiffies; new_send->type = (u32 )type; new_send->netdev = cm_node->netdev; new_send->send_retrans = (u32 )send_retrans; new_send->close_when_complete = close_when_complete; if ((unsigned int )type == 3U) { new_send->timetosend = new_send->timetosend + 25UL; if ((unsigned long )cm_node->recv_entry != (unsigned long )((struct nes_timer_entry *)0)) { kfree((void const *)new_send); __ret_warn_on = 1; tmp___0 = ldv__builtin_expect(__ret_warn_on != 0, 0L); if (tmp___0 != 0L) { warn_slowpath_null("/home/zakharov/workspace/benchmarks/bench_1/work/current--X--drivers/infiniband/hw/nes/iw_nes.ko--X--deg2_cpalinux-3.8-rc1--X--32_7a--X--cpachecker/linux-3.8-rc1/csd_deg_dscv/18/dscv_tempdir/dscv/ri/32_7a/drivers/infiniband/hw/nes/nes_cm.c.prepared", 731); } else { } ldv__builtin_expect(__ret_warn_on != 0, 0L); return (-22); } else { } cm_node->recv_entry = new_send; } else { } if ((unsigned int )type == 0U) { tmp___1 = tcp_hdr((struct sk_buff const *)skb); tmp___2 = __fswab32(tmp___1->seq); new_send->seq_num = tmp___2; atomic_inc(& (new_send->skb)->users); tmp___3 = spinlock_check(& cm_node->retrans_list_lock); flags = _raw_spin_lock_irqsave(tmp___3); cm_node->send_entry = new_send; add_ref_cm_node(cm_node); spin_unlock_irqrestore(& cm_node->retrans_list_lock, flags); new_send->timetosend = (unsigned long )jiffies + 250UL; ret = nes_nic_cm_xmit(new_send->skb, cm_node->netdev); if (ret != 0) { if ((nes_debug_level & 32U) != 0U) { printk("\viw_nes: %s[%u]: Error sending packet %p (jiffies = %lu)\n", "schedule_nes_timer", 749, new_send, jiffies); } else { } new_send->timetosend = jiffies; ret = 0; } else { cm_packets_sent = cm_packets_sent + 1U; if (send_retrans == 0) { cleanup_retrans_entry(cm_node); if (close_when_complete != 0) { rem_ref_cm_node(cm_core, cm_node); } else { } return (ret); } else { } } } else { } tmp___4 = timer_pending((struct timer_list const *)(& cm_core->tcp_timer)); if (tmp___4 == 0) { mod_timer(& cm_core->tcp_timer, new_send->timetosend); } else { } return (ret); } } static void nes_retrans_expired(struct nes_cm_node *cm_node ) { struct iw_cm_id *cm_id ; enum nes_cm_node_state state ; { cm_id = cm_node->cm_id; state = cm_node->state; cm_node->state = 19; switch ((unsigned int )state) { case 3: ; case 17: rem_ref_cm_node(cm_node->cm_core, cm_node); goto ldv_53643; case 16: ; case 12: ; if ((unsigned long )cm_node->cm_id != (unsigned long )((struct iw_cm_id *)0)) { (*(cm_id->rem_ref))(cm_id); } else { } send_reset(cm_node, 0); goto ldv_53643; default: add_ref_cm_node(cm_node); send_reset(cm_node, 0); create_event(cm_node, 14); } ldv_53643: ; return; } } static void handle_recv_entry(struct nes_cm_node *cm_node , u32 rem_node ) { struct nes_timer_entry *recv_entry ; struct iw_cm_id *cm_id ; struct nes_qp *nesqp ; unsigned long qplockflags ; raw_spinlock_t *tmp ; int tmp___0 ; int tmp___1 ; { recv_entry = cm_node->recv_entry; cm_id = cm_node->cm_id; if ((unsigned long )recv_entry == (unsigned long )((struct nes_timer_entry *)0)) { return; } else { } nesqp = (struct nes_qp *)recv_entry->skb; if ((unsigned long )nesqp != (unsigned long )((struct nes_qp *)0)) { tmp = spinlock_check(& nesqp->lock); qplockflags = _raw_spin_lock_irqsave(tmp); if ((unsigned long )nesqp->cm_id != (unsigned long )((struct iw_cm_id *)0)) { if ((nes_debug_level & 32U) != 0U) { tmp___0 = atomic_read((atomic_t const *)(& nesqp->refcount)); printk("\viw_nes: %s[%u]: QP%u: cm_id = %p, refcount = %d: HIT A NES_TIMER_TYPE_CLOSE with something to do!!!\n", "handle_recv_entry", 810, nesqp->hwqp.qp_id, cm_id, tmp___0); } else { } nesqp->hw_tcp_state = 1U; nesqp->last_aeq = 1537U; nesqp->ibqp_state = 6; spin_unlock_irqrestore(& nesqp->lock, qplockflags); nes_cm_disconn(nesqp); } else { spin_unlock_irqrestore(& nesqp->lock, qplockflags); if ((nes_debug_level & 32U) != 0U) { tmp___1 = atomic_read((atomic_t const *)(& nesqp->refcount)); printk("\viw_nes: %s[%u]: QP%u: cm_id = %p, refcount = %d: HIT A NES_TIMER_TYPE_CLOSE with nothing to do!!!\n", "handle_recv_entry", 822, nesqp->hwqp.qp_id, cm_id, tmp___1); } else { } } } else if (rem_node != 0U) { rem_ref_cm_node(cm_node->cm_core, cm_node); } else { } if ((unsigned long )cm_node->cm_id != (unsigned long )((struct iw_cm_id *)0)) { (*(cm_id->rem_ref))(cm_id); } else { } kfree((void const *)recv_entry); cm_node->recv_entry = 0; return; } } static void nes_cm_timer_tick(unsigned long pass ) { unsigned long flags ; unsigned long nexttimeout ; struct nes_cm_node *cm_node ; struct nes_timer_entry *send_entry ; struct nes_timer_entry *recv_entry ; struct list_head *list_core_temp ; struct list_head *list_node ; struct nes_cm_core *cm_core ; u32 settimer ; unsigned long timetosend ; int ret ; struct list_head timer_list ; raw_spinlock_t *tmp ; struct list_head const *__mptr ; struct list_head const *__mptr___0 ; raw_spinlock_t *tmp___0 ; raw_spinlock_t *tmp___1 ; raw_spinlock_t *tmp___2 ; unsigned long _min1 ; unsigned long _min2 ; unsigned long tmp___3 ; int close_when_complete ; int tmp___4 ; { nexttimeout = (unsigned long )jiffies + 500UL; cm_core = g_cm_core; settimer = 0U; ret = 0; INIT_LIST_HEAD(& timer_list); tmp = spinlock_check(& cm_core->ht_lock); flags = _raw_spin_lock_irqsave(tmp); list_node = cm_core->connected_nodes.next; list_core_temp = list_node->next; goto ldv_53680; ldv_53679: __mptr = (struct list_head const *)list_node; cm_node = (struct nes_cm_node *)__mptr + 0xfffffffffffffbe8UL; if ((unsigned long )cm_node->recv_entry != (unsigned long )((struct nes_timer_entry *)0) || (unsigned long )cm_node->send_entry != (unsigned long )((struct nes_timer_entry *)0)) { add_ref_cm_node(cm_node); list_add(& cm_node->timer_entry, & timer_list); } else { } list_node = list_core_temp; list_core_temp = list_node->next; ldv_53680: ; if ((unsigned long )(& cm_core->connected_nodes) != (unsigned long )list_node) { goto ldv_53679; } else { goto ldv_53681; } ldv_53681: spin_unlock_irqrestore(& cm_core->ht_lock, flags); list_node = timer_list.next; list_core_temp = list_node->next; goto ldv_53712; ldv_53711: __mptr___0 = (struct list_head const *)list_node; cm_node = (struct nes_cm_node *)__mptr___0 + 0xfffffffffffffbb0UL; recv_entry = cm_node->recv_entry; if ((unsigned long )recv_entry != (unsigned long )((struct nes_timer_entry *)0)) { if ((long )jiffies - (long )recv_entry->timetosend < 0L) { if (recv_entry->timetosend < nexttimeout || settimer == 0U) { nexttimeout = recv_entry->timetosend; settimer = 1U; } else { } } else { handle_recv_entry(cm_node, 1U); } } else { } tmp___0 = spinlock_check(& cm_node->retrans_list_lock); flags = _raw_spin_lock_irqsave(tmp___0); send_entry = cm_node->send_entry; if ((unsigned long )send_entry == (unsigned long )((struct nes_timer_entry *)0)) { goto ldv_53693; } else { } if ((long )jiffies - (long )send_entry->timetosend < 0L) { if ((unsigned int )cm_node->state != 11U) { if (send_entry->timetosend < nexttimeout || settimer == 0U) { nexttimeout = send_entry->timetosend; settimer = 1U; } else { } } else { free_retrans_entry(cm_node); } goto ldv_53693; } else { } if ((unsigned int )cm_node->state == 11U || (unsigned int )cm_node->state == 19U) { free_retrans_entry(cm_node); goto ldv_53693; } else { } if (send_entry->retranscount == 0U || send_entry->retrycount == 0U) { cm_packets_dropped = cm_packets_dropped + 1U; free_retrans_entry(cm_node); spin_unlock_irqrestore(& cm_node->retrans_list_lock, flags); nes_retrans_expired(cm_node); cm_node->state = 19; tmp___1 = spinlock_check(& cm_node->retrans_list_lock); flags = _raw_spin_lock_irqsave(tmp___1); goto ldv_53693; } else { } atomic_inc(& (send_entry->skb)->users); cm_packets_retrans = cm_packets_retrans + 1U; if ((nes_debug_level & 32U) != 0U) { printk("\viw_nes: %s[%u]: Retransmitting send_entry %p for node %p, jiffies = %lu, time to send = %lu, retranscount = %u, send_entry->seq_num = 0x%08X, cm_node->tcp_cntxt.rem_ack_num = 0x%08X\n", "nes_cm_timer_tick", 931, send_entry, cm_node, jiffies, send_entry->timetosend, send_entry->retranscount, send_entry->seq_num, cm_node->tcp_cntxt.rem_ack_num); } else { } spin_unlock_irqrestore(& cm_node->retrans_list_lock, flags); ret = nes_nic_cm_xmit(send_entry->skb, cm_node->netdev); tmp___2 = spinlock_check(& cm_node->retrans_list_lock); flags = _raw_spin_lock_irqsave(tmp___2); if (ret != 0) { if ((nes_debug_level & 32U) != 0U) { printk("\viw_nes: %s[%u]: rexmit failed for node=%p\n", "nes_cm_timer_tick", 939, cm_node); } else { } cm_packets_bounced = cm_packets_bounced + 1U; send_entry->retrycount = send_entry->retrycount - 1U; nexttimeout = (unsigned long )jiffies + 10UL; settimer = 1U; goto ldv_53693; } else { cm_packets_sent = cm_packets_sent + 1U; } if ((nes_debug_level & 32U) != 0U) { printk("\viw_nes: %s[%u]: Packet Sent: retrans count = %u, retry count = %u.\n", "nes_cm_timer_tick", 951, send_entry->retranscount, send_entry->retrycount); } else { } if (send_entry->send_retrans != 0U) { send_entry->retranscount = send_entry->retranscount - 1U; timetosend = (unsigned long )(250 << (int )(8U - send_entry->retranscount)); _min1 = timetosend; _min2 = 3000UL; if (_min1 < _min2) { tmp___3 = _min1; } else { tmp___3 = _min2; } send_entry->timetosend = tmp___3 + (unsigned long )jiffies; if (send_entry->timetosend < nexttimeout || settimer == 0U) { nexttimeout = send_entry->timetosend; settimer = 1U; } else { } } else { close_when_complete = send_entry->close_when_complete; if ((nes_debug_level & 32U) != 0U) { printk("\viw_nes: %s[%u]: cm_node=%p state=%d\n", "nes_cm_timer_tick", 969, cm_node, (unsigned int )cm_node->state); } else { } free_retrans_entry(cm_node); if (close_when_complete != 0) { rem_ref_cm_node(cm_node->cm_core, cm_node); } else { } } ldv_53693: spin_unlock_irqrestore(& cm_node->retrans_list_lock, flags); rem_ref_cm_node(cm_node->cm_core, cm_node); list_node = list_core_temp; list_core_temp = list_node->next; ldv_53712: ; if ((unsigned long )(& timer_list) != (unsigned long )list_node) { goto ldv_53711; } else { goto ldv_53713; } ldv_53713: ; if (settimer != 0U) { tmp___4 = timer_pending((struct timer_list const *)(& cm_core->tcp_timer)); if (tmp___4 == 0) { mod_timer(& cm_core->tcp_timer, nexttimeout); } else { } } else { } return; } } static int send_syn(struct nes_cm_node *cm_node , u32 sendack , struct sk_buff *skb ) { int ret ; int flags ; char optionsbuffer[12U] ; int optionssize ; union all_known_options *options ; __u16 tmp ; { flags = 2; optionssize = 0; if ((unsigned long )cm_node == (unsigned long )((struct nes_cm_node *)0)) { return (-22); } else { } options = (union all_known_options *)(& optionsbuffer) + (unsigned long )optionssize; options->as_mss.optionnum = 2U; options->as_mss.length = 4U; tmp = __fswab16((int )((__u16 )cm_node->tcp_cntxt.mss)); options->as_mss.mss = tmp; optionssize = (int )((unsigned int )optionssize + 4U); options = (union all_known_options *)(& optionsbuffer) + (unsigned long )optionssize; options->as_windowscale.optionnum = 3U; options->as_windowscale.length = 3U; options->as_windowscale.shiftcount = cm_node->tcp_cntxt.rcv_wscale; optionssize = (int )((unsigned int )optionssize + 3U); if (sendack != 0U && (nes_drv_opt & 64U) == 0U) { options = (union all_known_options *)(& optionsbuffer) + (unsigned long )optionssize; options->as_base.optionnum = 188U; options->as_base.length = 2U; optionssize = (int )((unsigned int )optionssize + 2U); options = (union all_known_options *)(& optionsbuffer) + (unsigned long )optionssize; options->as_end = 1; optionssize = optionssize + 1; options = (union all_known_options *)(& optionsbuffer) + (unsigned long )optionssize; options->as_end = 1; optionssize = optionssize + 1; } else { } options = (union all_known_options *)(& optionsbuffer) + (unsigned long )optionssize; options->as_end = 0; optionssize = optionssize + 1; if ((unsigned long )skb == (unsigned long )((struct sk_buff *)0)) { skb = dev_alloc_skb(536U); } else { } if ((unsigned long )skb == (unsigned long )((struct sk_buff *)0)) { if ((nes_debug_level & 32U) != 0U) { printk("\viw_nes: %s[%u]: Failed to get a Free pkt\n", "send_syn", 1040); } else { } return (-1); } else { } if (sendack != 0U) { flags = flags | 1; } else { } form_cm_frame(skb, cm_node, (void *)(& optionsbuffer), (u32 )optionssize, 0, 0U, (int )((u8 )flags)); ret = schedule_nes_timer(cm_node, skb, 0, 1, 0); return (ret); } } static int send_reset(struct nes_cm_node *cm_node , struct sk_buff *skb ) { int ret ; int flags ; { flags = 9; if ((unsigned long )skb == (unsigned long )((struct sk_buff *)0)) { skb = dev_alloc_skb(536U); } else { } if ((unsigned long )skb == (unsigned long )((struct sk_buff *)0)) { if ((nes_debug_level & 32U) != 0U) { printk("\viw_nes: %s[%u]: Failed to get a Free pkt\n", "send_reset", 1065); } else { } return (-12); } else { } form_cm_frame(skb, cm_node, 0, 0U, 0, 0U, (int )((u8 )flags)); ret = schedule_nes_timer(cm_node, skb, 0, 0, 1); return (ret); } } static int send_ack(struct nes_cm_node *cm_node , struct sk_buff *skb ) { int ret ; { if ((unsigned long )skb == (unsigned long )((struct sk_buff *)0)) { skb = dev_alloc_skb(536U); } else { } if ((unsigned long )skb == (unsigned long )((struct sk_buff *)0)) { if ((nes_debug_level & 32U) != 0U) { printk("\viw_nes: %s[%u]: Failed to get a Free pkt\n", "send_ack", 1087); } else { } return (-1); } else { } form_cm_frame(skb, cm_node, 0, 0U, 0, 0U, 1); ret = schedule_nes_timer(cm_node, skb, 0, 0, 0); return (ret); } } static int send_fin(struct nes_cm_node *cm_node , struct sk_buff *skb ) { int ret ; { if ((unsigned long )skb == (unsigned long )((struct sk_buff *)0)) { skb = dev_alloc_skb(536U); } else { } if ((unsigned long )skb == (unsigned long )((struct sk_buff *)0)) { if ((nes_debug_level & 32U) != 0U) { printk("\viw_nes: %s[%u]: Failed to get a Free pkt\n", "send_fin", 1110); } else { } return (-1); } else { } form_cm_frame(skb, cm_node, 0, 0U, 0, 0U, 5); ret = schedule_nes_timer(cm_node, skb, 0, 1, 0); return (ret); } } static struct nes_cm_node *find_node(struct nes_cm_core *cm_core , u16 rem_port , nes_addr_t rem_addr , u16 loc_port , nes_addr_t loc_addr ) { unsigned long flags ; struct list_head *hte ; struct nes_cm_node *cm_node ; raw_spinlock_t *tmp ; struct list_head const *__mptr ; struct list_head const *__mptr___0 ; { hte = & cm_core->connected_nodes; tmp = spinlock_check(& cm_core->ht_lock); flags = _raw_spin_lock_irqsave(tmp); __mptr = (struct list_head const *)hte->next; cm_node = (struct nes_cm_node *)__mptr + 0xfffffffffffffbe8UL; goto ldv_53763; ldv_53762: ; if ((nes_debug_level & 32U) != 0U) { printk("\viw_nes: %s[%u]: finding node %x:%x =? %x:%x ^ %x:%x =? %x:%x\n", "find_node", 1142, cm_node->loc_addr, (int )cm_node->loc_port, loc_addr, (int )loc_port, cm_node->rem_addr, (int )cm_node->rem_port, rem_addr, (int )rem_port); } else { } if (((cm_node->loc_addr == loc_addr && (int )cm_node->loc_port == (int )loc_port) && cm_node->rem_addr == rem_addr) && (int )cm_node->rem_port == (int )rem_port) { add_ref_cm_node(cm_node); spin_unlock_irqrestore(& cm_core->ht_lock, flags); return (cm_node); } else { } __mptr___0 = (struct list_head const *)cm_node->list.next; cm_node = (struct nes_cm_node *)__mptr___0 + 0xfffffffffffffbe8UL; ldv_53763: ; if ((unsigned long )(& cm_node->list) != (unsigned long )hte) { goto ldv_53762; } else { goto ldv_53764; } ldv_53764: spin_unlock_irqrestore(& cm_core->ht_lock, flags); return (0); } } static struct nes_cm_listener *find_listener(struct nes_cm_core *cm_core , nes_addr_t dst_addr , u16 dst_port , enum nes_cm_listener_state listener_state ) { unsigned long flags ; struct nes_cm_listener *listen_node ; raw_spinlock_t *tmp ; struct list_head const *__mptr ; struct list_head const *__mptr___0 ; { tmp = spinlock_check(& cm_core->listen_list_lock); flags = _raw_spin_lock_irqsave(tmp); __mptr = (struct list_head const *)cm_core->listen_list.list.next; listen_node = (struct nes_cm_listener *)__mptr; goto ldv_53781; ldv_53780: ; if (((listen_node->loc_addr == dst_addr || listen_node->loc_addr == 0U) && (int )listen_node->loc_port == (int )dst_port) && ((unsigned int )listen_node->listener_state & (unsigned int )listener_state) != 0U) { atomic_inc(& listen_node->ref_count); spin_unlock_irqrestore(& cm_core->listen_list_lock, flags); return (listen_node); } else { } __mptr___0 = (struct list_head const *)listen_node->list.next; listen_node = (struct nes_cm_listener *)__mptr___0; ldv_53781: ; if ((unsigned long )(& listen_node->list) != (unsigned long )(& cm_core->listen_list.list)) { goto ldv_53780; } else { goto ldv_53782; } ldv_53782: spin_unlock_irqrestore(& cm_core->listen_list_lock, flags); return (0); } } static int add_hte_node(struct nes_cm_core *cm_core , struct nes_cm_node *cm_node ) { unsigned long flags ; struct list_head *hte ; raw_spinlock_t *tmp ; { if ((unsigned long )cm_node == (unsigned long )((struct nes_cm_node *)0) || (unsigned long )cm_core == (unsigned long )((struct nes_cm_core *)0)) { return (-22); } else { } if ((nes_debug_level & 32U) != 0U) { printk("\viw_nes: %s[%u]: Adding Node %p to Active Connection HT\n", "add_hte_node", 1198, cm_node); } else { } tmp = spinlock_check(& cm_core->ht_lock); flags = _raw_spin_lock_irqsave(tmp); hte = & cm_core->connected_nodes; list_add_tail(& cm_node->list, hte); atomic_inc(& cm_core->ht_node_cnt); spin_unlock_irqrestore(& cm_core->ht_lock, flags); return (0); } } static int mini_cm_dec_refcnt_listen(struct nes_cm_core *cm_core , struct nes_cm_listener *listener , int free_hanging_nodes ) { int ret ; int err ; unsigned long flags ; struct list_head *list_pos ; struct list_head *list_temp ; struct nes_cm_node *cm_node ; struct list_head reset_list ; int tmp ; raw_spinlock_t *tmp___0 ; struct list_head const *__mptr ; struct list_head const *__mptr___0 ; struct nes_cm_node *loopback ; enum nes_cm_node_state old_state ; int __ret_warn_on ; long tmp___1 ; struct nes_cm_event event ; raw_spinlock_t *tmp___2 ; int tmp___3 ; int tmp___4 ; int tmp___5 ; { ret = -22; err = 0; list_pos = 0; list_temp = 0; cm_node = 0; if ((nes_debug_level & 32U) != 0U) { tmp = atomic_read((atomic_t const *)(& listener->ref_count)); printk("\viw_nes: %s[%u]: attempting listener= %p free_nodes= %d, refcnt=%d\n", "mini_cm_dec_refcnt_listen", 1229, listener, free_hanging_nodes, tmp); } else { } INIT_LIST_HEAD(& reset_list); if (free_hanging_nodes != 0) { tmp___0 = spinlock_check(& cm_core->ht_lock); flags = _raw_spin_lock_irqsave(tmp___0); list_pos = g_cm_core->connected_nodes.next; list_temp = list_pos->next; goto ldv_53812; ldv_53811: __mptr = (struct list_head const *)list_pos; cm_node = (struct nes_cm_node *)__mptr + 0xfffffffffffffbe8UL; if ((unsigned long )cm_node->listener == (unsigned long )listener && cm_node->accelerated == 0) { add_ref_cm_node(cm_node); list_add(& cm_node->reset_entry, & reset_list); } else { } list_pos = list_temp; list_temp = list_pos->next; ldv_53812: ; if ((unsigned long )(& g_cm_core->connected_nodes) != (unsigned long )list_pos) { goto ldv_53811; } else { goto ldv_53813; } ldv_53813: spin_unlock_irqrestore(& cm_core->ht_lock, flags); } else { } list_pos = reset_list.next; list_temp = list_pos->next; goto ldv_53822; ldv_53821: __mptr___0 = (struct list_head const *)list_pos; cm_node = (struct nes_cm_node *)__mptr___0 + 0xfffffffffffffba0UL; loopback = cm_node->loopbackpartner; if ((unsigned int )cm_node->state > 11U) { rem_ref_cm_node(cm_node->cm_core, cm_node); } else if ((unsigned long )loopback == (unsigned long )((struct nes_cm_node *)0)) { cleanup_retrans_entry(cm_node); err = send_reset(cm_node, 0); if (err != 0) { cm_node->state = 19; __ret_warn_on = 1; tmp___1 = ldv__builtin_expect(__ret_warn_on != 0, 0L); if (tmp___1 != 0L) { warn_slowpath_null("/home/zakharov/workspace/benchmarks/bench_1/work/current--X--drivers/infiniband/hw/nes/iw_nes.ko--X--deg2_cpalinux-3.8-rc1--X--32_7a--X--cpachecker/linux-3.8-rc1/csd_deg_dscv/18/dscv_tempdir/dscv/ri/32_7a/drivers/infiniband/hw/nes/nes_cm.c.prepared", 1262); } else { } ldv__builtin_expect(__ret_warn_on != 0, 0L); } else { old_state = cm_node->state; cm_node->state = 18; if ((unsigned int )old_state != 9U) { rem_ref_cm_node(cm_node->cm_core, cm_node); } else { } } } else { event.cm_node = loopback; event.cm_info.rem_addr = loopback->rem_addr; event.cm_info.loc_addr = loopback->loc_addr; event.cm_info.rem_port = loopback->rem_port; event.cm_info.loc_port = loopback->loc_port; event.cm_info.ldv_52927.cm_id = loopback->cm_id; add_ref_cm_node(loopback); loopback->state = 19; cm_event_connect_error(& event); cm_node->state = 18; rem_ref_cm_node(cm_node->cm_core, cm_node); } list_pos = list_temp; list_temp = list_pos->next; ldv_53822: ; if ((unsigned long )(& reset_list) != (unsigned long )list_pos) { goto ldv_53821; } else { goto ldv_53823; } ldv_53823: tmp___2 = spinlock_check(& cm_core->listen_list_lock); flags = _raw_spin_lock_irqsave(tmp___2); tmp___3 = atomic_sub_return(1, & listener->ref_count); if (tmp___3 == 0) { list_del(& listener->list); atomic_dec(& cm_core->listen_node_cnt); spin_unlock_irqrestore(& cm_core->listen_list_lock, flags); if ((unsigned long )listener->nesvnic != (unsigned long )((struct nes_vnic *)0)) { nes_manage_apbvt(listener->nesvnic, (u32 )listener->loc_port, (((listener->nesvnic)->nesdev)->pcidev)->devfn & 7U, 0U); } else { } if ((nes_debug_level & 32U) != 0U) { printk("\viw_nes: %s[%u]: destroying listener (%p)\n", "mini_cm_dec_refcnt_listen", 1310, listener); } else { } kfree((void const *)listener); listener = 0; ret = 0; atomic_inc(& cm_listens_destroyed); } else { spin_unlock_irqrestore(& cm_core->listen_list_lock, flags); } if ((unsigned long )listener != (unsigned long )((struct nes_cm_listener *)0)) { tmp___5 = atomic_read((atomic_t const *)(& listener->pend_accepts_cnt)); if (tmp___5 > 0) { if ((nes_debug_level & 32U) != 0U) { tmp___4 = atomic_read((atomic_t const *)(& listener->pend_accepts_cnt)); printk("\viw_nes: %s[%u]: destroying listener (%p) with non-zero pending accepts=%u\n", "mini_cm_dec_refcnt_listen", 1323, listener, tmp___4); } else { } } else { } } else { } return (ret); } } static int mini_cm_del_listen(struct nes_cm_core *cm_core , struct nes_cm_listener *listener ) { int tmp ; { listener->listener_state = 1; listener->cm_id = 0; tmp = mini_cm_dec_refcnt_listen(cm_core, listener, 1); return (tmp); } } __inline static int mini_cm_accelerated(struct nes_cm_core *cm_core , struct nes_cm_node *cm_node ) { long tmp ; int tmp___0 ; long tmp___1 ; int tmp___2 ; { cm_node->accelerated = 1; if (cm_node->accept_pend != 0) { tmp = ldv__builtin_expect((unsigned long )cm_node->listener == (unsigned long )((struct nes_cm_listener *)0), 0L); if (tmp != 0L) { __asm__ volatile ("1:\tud2\n.pushsection __bug_table,\"a\"\n2:\t.long 1b - 2b, %c0 - 2b\n\t.word %c1, 0\n\t.org 2b+%c2\n.popsection": : "i" ((char *)"/home/zakharov/workspace/benchmarks/bench_1/work/current--X--drivers/infiniband/hw/nes/iw_nes.ko--X--deg2_cpalinux-3.8-rc1--X--32_7a--X--cpachecker/linux-3.8-rc1/csd_deg_dscv/18/dscv_tempdir/dscv/ri/32_7a/drivers/infiniband/hw/nes/nes_cm.c.prepared"), "i" (1351), "i" (12UL)); ldv_53835: ; goto ldv_53835; } else { } atomic_dec(& (cm_node->listener)->pend_accepts_cnt); cm_node->accept_pend = 0; tmp___0 = atomic_read((atomic_t const *)(& (cm_node->listener)->pend_accepts_cnt)); tmp___1 = ldv__builtin_expect(tmp___0 < 0, 0L); if (tmp___1 != 0L) { __asm__ volatile ("1:\tud2\n.pushsection __bug_table,\"a\"\n2:\t.long 1b - 2b, %c0 - 2b\n\t.word %c1, 0\n\t.org 2b+%c2\n.popsection": : "i" ((char *)"/home/zakharov/workspace/benchmarks/bench_1/work/current--X--drivers/infiniband/hw/nes/iw_nes.ko--X--deg2_cpalinux-3.8-rc1--X--32_7a--X--cpachecker/linux-3.8-rc1/csd_deg_dscv/18/dscv_tempdir/dscv/ri/32_7a/drivers/infiniband/hw/nes/nes_cm.c.prepared"), "i" (1354), "i" (12UL)); ldv_53836: ; goto ldv_53836; } else { } } else { } tmp___2 = timer_pending((struct timer_list const *)(& cm_core->tcp_timer)); if (tmp___2 == 0) { mod_timer(& cm_core->tcp_timer, (unsigned long )jiffies + 10UL); } else { } return (0); } } static int nes_addr_resolve_neigh(struct nes_vnic *nesvnic , u32 dst_ip , int arpindex ) { struct rtable *rt ; struct neighbour *neigh ; int rc ; struct net_device *netdev ; struct nes_adapter *nesadapter ; __u32 tmp ; long tmp___0 ; bool tmp___1 ; __u32 tmp___2 ; int tmp___3 ; { rc = arpindex; nesadapter = (nesvnic->nesdev)->nesadapter; tmp = __fswab32(dst_ip); rt = ip_route_output(& init_net, tmp, 0U, 0, 0); tmp___0 = IS_ERR((void const *)rt); if (tmp___0 != 0L) { printk("\v%s: ip_route_output_key failed for 0x%08X\n", "nes_addr_resolve_neigh", dst_ip); return (rc); } else { } tmp___1 = netif_is_bond_slave(nesvnic->netdev); if ((int )tmp___1) { netdev = (nesvnic->netdev)->master; } else { netdev = nesvnic->netdev; } neigh = neigh_lookup(& arp_tbl, (void const *)(& rt->rt_gateway), netdev); rcu_read_lock(); if ((unsigned long )neigh != (unsigned long )((struct neighbour *)0)) { if (((int )neigh->nud_state & 222) != 0) { if ((nes_debug_level & 32U) != 0U) { tmp___2 = __fswab32(rt->rt_gateway); printk("\viw_nes: %s[%u]: Neighbor MAC address for 0x%08X is %pM, Gateway is 0x%08X \n", "nes_addr_resolve_neigh", 1394, dst_ip, (unsigned char *)(& neigh->ha), tmp___2); } else { } if (arpindex >= 0) { tmp___3 = memcmp((void const *)(& nesadapter->arp_table[arpindex].mac_addr), (void const *)(& neigh->ha), 6UL); if (tmp___3 == 0) { goto out; } else { } nes_manage_arp_cache(nesvnic->netdev, (unsigned char *)(& nesadapter->arp_table[arpindex].mac_addr), dst_ip, 2U); } else { } nes_manage_arp_cache(nesvnic->netdev, (unsigned char *)(& neigh->ha), dst_ip, 1U); rc = nes_arp_table(nesvnic->nesdev, dst_ip, 0, 3U); } else { neigh_event_send(neigh, 0); } } else { } out: rcu_read_unlock(); if ((unsigned long )neigh != (unsigned long )((struct neighbour *)0)) { neigh_release(neigh); } else { } ip_rt_put(rt); return (rc); } } static struct nes_cm_node *make_cm_node(struct nes_cm_core *cm_core , struct nes_vnic *nesvnic , struct nes_cm_info *cm_info , struct nes_cm_listener *listener ) { struct nes_cm_node *cm_node ; struct timespec ts ; int oldarpindex ; int arpindex ; struct nes_device *nesdev ; struct nes_adapter *nesadapter ; void *tmp ; size_t __len ; void *__ret ; struct lock_class_key __key ; __u32 tmp___0 ; size_t __len___0 ; void *__ret___0 ; { oldarpindex = 0; arpindex = 0; tmp = kzalloc(1152UL, 32U); cm_node = (struct nes_cm_node *)tmp; if ((unsigned long )cm_node == (unsigned long )((struct nes_cm_node *)0)) { return (0); } else { } cm_node->loc_addr = cm_info->loc_addr; cm_node->rem_addr = cm_info->rem_addr; cm_node->loc_port = cm_info->loc_port; cm_node->rem_port = cm_info->rem_port; cm_node->mpa_frame_rev = (enum mpa_frame_version )mpa_version; cm_node->send_rdma0_op = 1; cm_node->ird_size = 16383U; cm_node->ord_size = 16383U; if ((nes_debug_level & 32U) != 0U) { printk("\viw_nes: %s[%u]: Make node addresses : loc = %pI4:%x, rem = %pI4:%x\n", "make_cm_node", 1458, & cm_node->loc_addr, (int )cm_node->loc_port, & cm_node->rem_addr, (int )cm_node->rem_port); } else { } cm_node->listener = listener; cm_node->netdev = nesvnic->netdev; cm_node->cm_id = cm_info->ldv_52927.cm_id; __len = 6UL; if (__len > 63UL) { __ret = __memcpy((void *)(& cm_node->loc_mac), (void const *)(nesvnic->netdev)->dev_addr, __len); } else { __ret = __builtin_memcpy((void *)(& cm_node->loc_mac), (void const *)(nesvnic->netdev)->dev_addr, __len); } if ((nes_debug_level & 32U) != 0U) { printk("\viw_nes: %s[%u]: listener=%p, cm_id=%p\n", "make_cm_node", 1465, cm_node->listener, cm_node->cm_id); } else { } spinlock_check(& cm_node->retrans_list_lock); __raw_spin_lock_init(& cm_node->retrans_list_lock.ldv_5961.rlock, "&(&cm_node->retrans_list_lock)->rlock", & __key); cm_node->loopbackpartner = 0; atomic_set(& cm_node->ref_count, 1); cm_node->cm_core = cm_core; cm_node->tcp_cntxt.loc_id = 15175U; cm_node->tcp_cntxt.rcv_wscale = 2U; cm_node->tcp_cntxt.rcv_wnd = 64240U; ts = current_kernel_time(); tmp___0 = __fswab32((__u32 )ts.tv_nsec); cm_node->tcp_cntxt.loc_seq_num = tmp___0; cm_node->tcp_cntxt.mss = (u32 )nesvnic->max_frame_size - 58U; cm_node->tcp_cntxt.rcv_nxt = 0U; atomic_inc(& cm_core->node_cnt); cm_node->conn_type = cm_info->conn_type; cm_node->apbvt_set = 0; cm_node->accept_pend = 0; cm_node->nesvnic = nesvnic; nesdev = nesvnic->nesdev; nesadapter = nesdev->nesadapter; cm_node->loopbackpartner = 0; oldarpindex = nes_arp_table(nesdev, cm_node->rem_addr, 0, 3U); arpindex = nes_addr_resolve_neigh(nesvnic, cm_info->rem_addr, oldarpindex); if (arpindex < 0) { kfree((void const *)cm_node); return (0); } else { } __len___0 = 6UL; if (__len___0 > 63UL) { __ret___0 = __memcpy((void *)(& cm_node->rem_mac), (void const *)(& nesadapter->arp_table[arpindex].mac_addr), __len___0); } else { __ret___0 = __builtin_memcpy((void *)(& cm_node->rem_mac), (void const *)(& nesadapter->arp_table[arpindex].mac_addr), __len___0); } if ((nes_debug_level & 32U) != 0U) { printk("\viw_nes: %s[%u]: Remote mac addr from arp table: %pM\n", "make_cm_node", 1506, (u8 *)(& cm_node->rem_mac)); } else { } add_hte_node(cm_core, cm_node); atomic_inc(& cm_nodes_created); return (cm_node); } } static int add_ref_cm_node(struct nes_cm_node *cm_node ) { { atomic_inc(& cm_node->ref_count); return (0); } } static int rem_ref_cm_node(struct nes_cm_core *cm_core , struct nes_cm_node *cm_node ) { unsigned long flags ; struct nes_qp *nesqp ; raw_spinlock_t *tmp ; int tmp___0 ; long tmp___1 ; int tmp___2 ; long tmp___3 ; int __ret_warn_on ; long tmp___4 ; { if ((unsigned long )cm_node == (unsigned long )((struct nes_cm_node *)0)) { return (-22); } else { } tmp = spinlock_check(& (cm_node->cm_core)->ht_lock); flags = _raw_spin_lock_irqsave(tmp); tmp___0 = atomic_sub_return(1, & cm_node->ref_count); if (tmp___0 != 0) { spin_unlock_irqrestore(& (cm_node->cm_core)->ht_lock, flags); return (0); } else { } list_del(& cm_node->list); atomic_dec(& cm_core->ht_node_cnt); spin_unlock_irqrestore(& (cm_node->cm_core)->ht_lock, flags); if (cm_node->accelerated == 0 && cm_node->accept_pend != 0) { tmp___1 = ldv__builtin_expect((unsigned long )cm_node->listener == (unsigned long )((struct nes_cm_listener *)0), 0L); if (tmp___1 != 0L) { __asm__ volatile ("1:\tud2\n.pushsection __bug_table,\"a\"\n2:\t.long 1b - 2b, %c0 - 2b\n\t.word %c1, 0\n\t.org 2b+%c2\n.popsection": : "i" ((char *)"/home/zakharov/workspace/benchmarks/bench_1/work/current--X--drivers/infiniband/hw/nes/iw_nes.ko--X--deg2_cpalinux-3.8-rc1--X--32_7a--X--cpachecker/linux-3.8-rc1/csd_deg_dscv/18/dscv_tempdir/dscv/ri/32_7a/drivers/infiniband/hw/nes/nes_cm.c.prepared"), "i" (1548), "i" (12UL)); ldv_53881: ; goto ldv_53881; } else { } atomic_dec(& (cm_node->listener)->pend_accepts_cnt); tmp___2 = atomic_read((atomic_t const *)(& (cm_node->listener)->pend_accepts_cnt)); tmp___3 = ldv__builtin_expect(tmp___2 < 0, 0L); if (tmp___3 != 0L) { __asm__ volatile ("1:\tud2\n.pushsection __bug_table,\"a\"\n2:\t.long 1b - 2b, %c0 - 2b\n\t.word %c1, 0\n\t.org 2b+%c2\n.popsection": : "i" ((char *)"/home/zakharov/workspace/benchmarks/bench_1/work/current--X--drivers/infiniband/hw/nes/iw_nes.ko--X--deg2_cpalinux-3.8-rc1--X--32_7a--X--cpachecker/linux-3.8-rc1/csd_deg_dscv/18/dscv_tempdir/dscv/ri/32_7a/drivers/infiniband/hw/nes/nes_cm.c.prepared"), "i" (1550), "i" (12UL)); ldv_53882: ; goto ldv_53882; } else { } } else { } __ret_warn_on = (unsigned long )cm_node->send_entry != (unsigned long )((struct nes_timer_entry *)0); tmp___4 = ldv__builtin_expect(__ret_warn_on != 0, 0L); if (tmp___4 != 0L) { warn_slowpath_null("/home/zakharov/workspace/benchmarks/bench_1/work/current--X--drivers/infiniband/hw/nes/iw_nes.ko--X--deg2_cpalinux-3.8-rc1--X--32_7a--X--cpachecker/linux-3.8-rc1/csd_deg_dscv/18/dscv_tempdir/dscv/ri/32_7a/drivers/infiniband/hw/nes/nes_cm.c.prepared", 1552); } else { } ldv__builtin_expect(__ret_warn_on != 0, 0L); if ((unsigned long )cm_node->recv_entry != (unsigned long )((struct nes_timer_entry *)0)) { handle_recv_entry(cm_node, 0U); } else { } if ((unsigned long )cm_node->listener != (unsigned long )((struct nes_cm_listener *)0)) { mini_cm_dec_refcnt_listen(cm_core, cm_node->listener, 0); } else if (cm_node->apbvt_set != 0 && (unsigned long )cm_node->nesvnic != (unsigned long )((struct nes_vnic *)0)) { nes_manage_apbvt(cm_node->nesvnic, (u32 )cm_node->loc_port, (((cm_node->nesvnic)->nesdev)->pcidev)->devfn & 7U, 0U); } else { } atomic_dec(& cm_core->node_cnt); atomic_inc(& cm_nodes_destroyed); nesqp = cm_node->nesqp; if ((unsigned long )nesqp != (unsigned long )((struct nes_qp *)0)) { nesqp->cm_node = 0; nes_rem_ref(& nesqp->ibqp); cm_node->nesqp = 0; } else { } kfree((void const *)cm_node); return (0); } } static int process_options(struct nes_cm_node *cm_node , u8 *optionsloc , u32 optionsize , u32 syn_packet ) { u32 tmp ; u32 offset ; union all_known_options *all_options ; char got_mss_option ; __u16 tmp___0 ; { offset = 0U; got_mss_option = 0; goto ldv_53898; ldv_53903: all_options = (union all_known_options *)optionsloc + (unsigned long )offset; switch ((int )all_options->as_base.optionnum) { case 0: offset = optionsize; goto ldv_53896; case 1: offset = offset + 1U; goto ldv_53898; case 2: ; if ((nes_debug_level & 32U) != 0U) { printk("\viw_nes: %s[%u]: %s: MSS Length: %d Offset: %d Size: %d\n", "process_options", 1602, "process_options", (int )all_options->as_mss.length, offset, optionsize); } else { } got_mss_option = 1; if ((unsigned int )all_options->as_mss.length != 4U) { return (1); } else { tmp___0 = __fswab16((int )all_options->as_mss.mss); tmp = (u32 )tmp___0; if (tmp != 0U && cm_node->tcp_cntxt.mss > tmp) { cm_node->tcp_cntxt.mss = tmp; } else { } } goto ldv_53896; case 3: cm_node->tcp_cntxt.snd_wscale = all_options->as_windowscale.shiftcount; goto ldv_53896; default: ; if ((nes_debug_level & 32U) != 0U) { printk("\viw_nes: %s[%u]: TCP Option not understood: %x\n", "process_options", 1619, (int )all_options->as_base.optionnum); } else { } goto ldv_53896; } ldv_53896: offset = (u32 )all_options->as_base.length + offset; ldv_53898: ; if (offset < optionsize) { goto ldv_53903; } else { goto ldv_53904; } ldv_53904: ; if ((int )((signed char )got_mss_option) == 0 && syn_packet != 0U) { cm_node->tcp_cntxt.mss = 536U; } else { } return (0); } } static void drop_packet(struct sk_buff *skb ) { { atomic_inc(& cm_accel_dropped_pkts); dev_kfree_skb_any(skb); return; } } static void handle_fin_pkt(struct nes_cm_node *cm_node ) { int tmp ; { if ((nes_debug_level & 32U) != 0U) { tmp = atomic_read((atomic_t const *)(& cm_node->ref_count)); printk("\viw_nes: %s[%u]: Received FIN, cm_node = %p, state = %u. refcnt=%d\n", "handle_fin_pkt", 1639, cm_node, (unsigned int )cm_node->state, tmp); } else { } switch ((unsigned int )cm_node->state) { case 3: ; case 4: ; case 6: ; case 10: cm_node->tcp_cntxt.rcv_nxt = cm_node->tcp_cntxt.rcv_nxt + 1U; cleanup_retrans_entry(cm_node); cm_node->state = 16; send_fin(cm_node, 0); goto ldv_53916; case 8: create_event(cm_node, 14); cm_node->tcp_cntxt.rcv_nxt = cm_node->tcp_cntxt.rcv_nxt + 1U; cleanup_retrans_entry(cm_node); cm_node->state = 19; add_ref_cm_node(cm_node); send_reset(cm_node, 0); goto ldv_53916; case 12: cm_node->tcp_cntxt.rcv_nxt = cm_node->tcp_cntxt.rcv_nxt + 1U; cleanup_retrans_entry(cm_node); cm_node->state = 17; send_ack(cm_node, 0); goto ldv_53916; case 13: cm_node->tcp_cntxt.rcv_nxt = cm_node->tcp_cntxt.rcv_nxt + 1U; cleanup_retrans_entry(cm_node); cm_node->state = 15; send_ack(cm_node, 0); schedule_nes_timer(cm_node, 0, 3, 1, 0); goto ldv_53916; case 15: cm_node->tcp_cntxt.rcv_nxt = cm_node->tcp_cntxt.rcv_nxt + 1U; cleanup_retrans_entry(cm_node); cm_node->state = 19; rem_ref_cm_node(cm_node->cm_core, cm_node); goto ldv_53916; case 11: ; default: ; if ((nes_debug_level & 32U) != 0U) { printk("\viw_nes: %s[%u]: Error Rcvd FIN for node-%p state = %d\n", "handle_fin_pkt", 1683, cm_node, (unsigned int )cm_node->state); } else { } goto ldv_53916; } ldv_53916: ; return; } } static void handle_rst_pkt(struct nes_cm_node *cm_node , struct sk_buff *skb , struct tcphdr *tcph ) { int reset ; int tmp ; int tmp___0 ; { reset = 0; atomic_inc(& cm_resets_recvd); if ((nes_debug_level & 32U) != 0U) { tmp = atomic_read((atomic_t const *)(& cm_node->ref_count)); printk("\viw_nes: %s[%u]: Received Reset, cm_node = %p, state = %u. refcnt=%d\n", "handle_rst_pkt", 1697, cm_node, (unsigned int )cm_node->state, tmp); } else { } cleanup_retrans_entry(cm_node); switch ((unsigned int )cm_node->state) { case 4: ; case 8: ; if ((nes_debug_level & 32U) != 0U) { printk("\viw_nes: %s[%u]: %s[%u] create abort for cm_node=%p listener=%p state=%d\n", "handle_rst_pkt", 1704, "handle_rst_pkt", 1704, cm_node, cm_node->listener, (unsigned int )cm_node->state); } else { } switch ((unsigned int )cm_node->mpa_frame_rev) { case 2: cm_node->mpa_frame_rev = 1; cm_node->state = 4; tmp___0 = send_syn(cm_node, 0U, 0); if (tmp___0 != 0) { active_open_err(cm_node, skb, reset); } else { } goto ldv_53933; case 1: ; default: active_open_err(cm_node, skb, reset); goto ldv_53933; } ldv_53933: ; goto ldv_53936; case 9: atomic_inc(& cm_node->passive_state); dev_kfree_skb_any(skb); goto ldv_53936; case 6: ; case 3: ; case 2: ; if ((nes_debug_level & 32U) != 0U) { printk("\viw_nes: %s[%u]: Bad state %s[%u]\n", "handle_rst_pkt", 1727, "handle_rst_pkt", 1727); } else { } passive_open_err(cm_node, skb, reset); goto ldv_53936; case 11: active_open_err(cm_node, skb, reset); goto ldv_53936; case 19: drop_packet(skb); goto ldv_53936; case 13: ; case 12: ; case 16: (*((cm_node->cm_id)->rem_ref))(cm_node->cm_id); case 15: cm_node->state = 19; rem_ref_cm_node(cm_node->cm_core, cm_node); drop_packet(skb); goto ldv_53936; default: drop_packet(skb); goto ldv_53936; } ldv_53936: ; return; } } static void handle_rcv_mpa(struct nes_cm_node *cm_node , struct sk_buff *skb ) { int ret ; int datasize ; u8 *dataloc ; enum nes_cm_event_type type ; u32 res_type ; int __ret_warn_on ; long tmp ; int __ret_warn_on___0 ; long tmp___0 ; { ret = 0; datasize = (int )skb->len; dataloc = skb->data; type = 0; ret = parse_mpa(cm_node, dataloc, & res_type, (u32 )datasize); if (ret != 0) { if ((nes_debug_level & 32U) != 0U) { printk("\viw_nes: %s[%u]: didn\'t like MPA Request\n", "handle_rcv_mpa", 1763); } else { } if ((unsigned int )cm_node->state == 8U) { if ((nes_debug_level & 32U) != 0U) { printk("\viw_nes: %s[%u]: %s[%u] create abort for cm_node=%p listener=%p state=%d\n", "handle_rcv_mpa", 1768, "handle_rcv_mpa", 1768, cm_node, cm_node->listener, (unsigned int )cm_node->state); } else { } active_open_err(cm_node, skb, 1); } else { passive_open_err(cm_node, skb, 1); } return; } else { } switch ((unsigned int )cm_node->state) { case 6: ; if (res_type == 2U) { __ret_warn_on = 1; tmp = ldv__builtin_expect(__ret_warn_on != 0, 0L); if (tmp != 0L) { warn_slowpath_null("/home/zakharov/workspace/benchmarks/bench_1/work/current--X--drivers/infiniband/hw/nes/iw_nes.ko--X--deg2_cpalinux-3.8-rc1--X--32_7a--X--cpachecker/linux-3.8-rc1/csd_deg_dscv/18/dscv_tempdir/dscv/ri/32_7a/drivers/infiniband/hw/nes/nes_cm.c.prepared", 1782); } else { } ldv__builtin_expect(__ret_warn_on != 0, 0L); } else { } cm_node->state = 9; type = 2; atomic_set(& cm_node->passive_state, 0); goto ldv_53961; case 8: cleanup_retrans_entry(cm_node); if (res_type == 2U) { type = 5; cm_node->state = 10; } else { type = 7; cm_node->state = 11; } goto ldv_53961; default: __ret_warn_on___0 = 1; tmp___0 = ldv__builtin_expect(__ret_warn_on___0 != 0, 0L); if (tmp___0 != 0L) { warn_slowpath_null("/home/zakharov/workspace/benchmarks/bench_1/work/current--X--drivers/infiniband/hw/nes/iw_nes.ko--X--deg2_cpalinux-3.8-rc1--X--32_7a--X--cpachecker/linux-3.8-rc1/csd_deg_dscv/18/dscv_tempdir/dscv/ri/32_7a/drivers/infiniband/hw/nes/nes_cm.c.prepared", 1800); } else { } ldv__builtin_expect(__ret_warn_on___0 != 0, 0L); goto ldv_53961; } ldv_53961: dev_kfree_skb_any(skb); create_event(cm_node, type); return; } } static void indicate_pkt_err(struct nes_cm_node *cm_node , struct sk_buff *skb ) { { switch ((unsigned int )cm_node->state) { case 4: ; case 8: ; if ((nes_debug_level & 32U) != 0U) { printk("\viw_nes: %s[%u]: %s[%u] create abort for cm_node=%p listener=%p state=%d\n", "indicate_pkt_err", 1814, "indicate_pkt_err", 1814, cm_node, cm_node->listener, (unsigned int )cm_node->state); } else { } active_open_err(cm_node, skb, 1); goto ldv_53973; case 6: ; case 3: passive_open_err(cm_node, skb, 1); goto ldv_53973; case 11: ; default: drop_packet(skb); } ldv_53973: ; return; } } static int check_syn(struct nes_cm_node *cm_node , struct tcphdr *tcph , struct sk_buff *skb ) { int err ; __u32 tmp ; { tmp = __fswab32(tcph->ack_seq); err = tmp != cm_node->tcp_cntxt.loc_seq_num; if (err != 0) { active_open_err(cm_node, skb, 1); } else { } return (err); } } static int check_seq(struct nes_cm_node *cm_node , struct tcphdr *tcph , struct sk_buff *skb ) { int err ; u32 seq ; u32 ack_seq ; u32 loc_seq_num ; u32 rcv_nxt ; u32 rcv_wnd ; __u32 tmp ; __u32 tmp___0 ; bool tmp___1 ; int tmp___2 ; { err = 0; loc_seq_num = cm_node->tcp_cntxt.loc_seq_num; rcv_nxt = cm_node->tcp_cntxt.rcv_nxt; tmp = __fswab32(tcph->seq); seq = tmp; tmp___0 = __fswab32(tcph->ack_seq); ack_seq = tmp___0; rcv_wnd = cm_node->tcp_cntxt.rcv_wnd; if (ack_seq != loc_seq_num) { err = 1; } else { tmp___1 = between(seq, rcv_nxt, rcv_nxt + rcv_wnd); if (tmp___1) { tmp___2 = 0; } else { tmp___2 = 1; } if (tmp___2) { err = 1; } else { } } if (err != 0) { if ((nes_debug_level & 32U) != 0U) { printk("\viw_nes: %s[%u]: %s[%u] create abort for cm_node=%p listener=%p state=%d\n", "check_seq", 1859, "check_seq", 1859, cm_node, cm_node->listener, (unsigned int )cm_node->state); } else { } indicate_pkt_err(cm_node, skb); if ((nes_debug_level & 32U) != 0U) { printk("\viw_nes: %s[%u]: seq ERROR cm_node =%p seq=0x%08X rcv_nxt=0x%08X rcv_wnd=0x%x\n", "check_seq", 1863, cm_node, seq, rcv_nxt, rcv_wnd); } else { } } else { } return (err); } } static void handle_syn_pkt(struct nes_cm_node *cm_node , struct sk_buff *skb , struct tcphdr *tcph ) { int ret ; u32 inc_sequence ; int optionsize ; __u32 tmp ; int tmp___0 ; long tmp___1 ; { optionsize = (int )((unsigned int )((int )tcph->doff << 2) - 20U); skb_trim(skb, 0U); tmp = __fswab32(tcph->seq); inc_sequence = tmp; switch ((unsigned int )cm_node->state) { case 4: ; case 8: active_open_err(cm_node, skb, 1); goto ldv_54006; case 2: tmp___0 = atomic_read((atomic_t const *)(& (cm_node->listener)->pend_accepts_cnt)); if (tmp___0 > (cm_node->listener)->backlog) { if ((nes_debug_level & 32U) != 0U) { printk("\viw_nes: %s[%u]: drop syn due to backlog pressure \n", "handle_syn_pkt", 1895); } else { } cm_backlog_drops = cm_backlog_drops + 1U; passive_open_err(cm_node, skb, 0); goto ldv_54006; } else { } ret = handle_tcp_options(cm_node, tcph, skb, optionsize, 1); if (ret != 0) { passive_open_err(cm_node, skb, 0); goto ldv_54006; } else { } cm_node->tcp_cntxt.rcv_nxt = inc_sequence + 1U; tmp___1 = ldv__builtin_expect((unsigned long )cm_node->send_entry != (unsigned long )((struct nes_timer_entry *)0), 0L); if (tmp___1 != 0L) { __asm__ volatile ("1:\tud2\n.pushsection __bug_table,\"a\"\n2:\t.long 1b - 2b, %c0 - 2b\n\t.word %c1, 0\n\t.org 2b+%c2\n.popsection": : "i" ((char *)"/home/zakharov/workspace/benchmarks/bench_1/work/current--X--drivers/infiniband/hw/nes/iw_nes.ko--X--deg2_cpalinux-3.8-rc1--X--32_7a--X--cpachecker/linux-3.8-rc1/csd_deg_dscv/18/dscv_tempdir/dscv/ri/32_7a/drivers/infiniband/hw/nes/nes_cm.c.prepared"), "i" (1908), "i" (12UL)); ldv_54009: ; goto ldv_54009; } else { } cm_node->accept_pend = 1; atomic_inc(& (cm_node->listener)->pend_accepts_cnt); cm_node->state = 3; send_syn(cm_node, 1U, skb); goto ldv_54006; case 19: cleanup_retrans_entry(cm_node); add_ref_cm_node(cm_node); send_reset(cm_node, skb); goto ldv_54006; case 11: ; case 6: ; case 12: ; case 13: ; case 9: ; case 16: ; case 17: ; case 0: ; default: drop_packet(skb); goto ldv_54006; } ldv_54006: ; return; } } static void handle_synack_pkt(struct nes_cm_node *cm_node , struct sk_buff *skb , struct tcphdr *tcph ) { int ret ; u32 inc_sequence ; int optionsize ; __u32 tmp ; int tmp___0 ; __u32 tmp___1 ; __u32 tmp___2 ; __u32 tmp___3 ; { optionsize = (int )((unsigned int )((int )tcph->doff << 2) - 20U); skb_trim(skb, 0U); tmp = __fswab32(tcph->seq); inc_sequence = tmp; switch ((unsigned int )cm_node->state) { case 4: cleanup_retrans_entry(cm_node); tmp___0 = check_syn(cm_node, tcph, skb); if (tmp___0 != 0) { return; } else { } tmp___1 = __fswab32(tcph->ack_seq); cm_node->tcp_cntxt.rem_ack_num = tmp___1; ret = handle_tcp_options(cm_node, tcph, skb, optionsize, 0); if (ret != 0) { if ((nes_debug_level & 32U) != 0U) { printk("\viw_nes: %s[%u]: cm_node=%p tcp_options failed\n", "handle_synack_pkt", 1955, cm_node); } else { } goto ldv_54030; } else { } cleanup_retrans_entry(cm_node); cm_node->tcp_cntxt.rcv_nxt = inc_sequence + 1U; send_mpa_request(cm_node, skb); cm_node->state = 8; goto ldv_54030; case 9: passive_open_err(cm_node, skb, 1); goto ldv_54030; case 2: tmp___2 = __fswab32(tcph->ack_seq); cm_node->tcp_cntxt.loc_seq_num = tmp___2; cleanup_retrans_entry(cm_node); cm_node->state = 19; send_reset(cm_node, skb); goto ldv_54030; case 19: tmp___3 = __fswab32(tcph->ack_seq); cm_node->tcp_cntxt.loc_seq_num = tmp___3; cleanup_retrans_entry(cm_node); add_ref_cm_node(cm_node); send_reset(cm_node, skb); goto ldv_54030; case 6: ; case 12: ; case 13: ; case 16: ; case 11: ; case 17: ; case 0: ; case 8: ; default: drop_packet(skb); goto ldv_54030; } ldv_54030: ; return; } } static int handle_ack_pkt(struct nes_cm_node *cm_node , struct sk_buff *skb , struct tcphdr *tcph ) { int datasize ; u32 inc_sequence ; int ret ; int optionsize ; int tmp ; __u32 tmp___0 ; __u32 tmp___1 ; __u32 tmp___2 ; { datasize = 0; ret = 0; optionsize = (int )((unsigned int )((int )tcph->doff << 2) - 20U); tmp = check_seq(cm_node, tcph, skb); if (tmp != 0) { return (-22); } else { } skb_pull(skb, (unsigned int )((int )tcph->doff << 2)); tmp___0 = __fswab32(tcph->seq); inc_sequence = tmp___0; datasize = (int )skb->len; switch ((unsigned int )cm_node->state) { case 3: cleanup_retrans_entry(cm_node); ret = handle_tcp_options(cm_node, tcph, skb, optionsize, 1); if (ret != 0) { goto ldv_54053; } else { } tmp___1 = __fswab32(tcph->ack_seq); cm_node->tcp_cntxt.rem_ack_num = tmp___1; cm_node->state = 6; if (datasize != 0) { cm_node->tcp_cntxt.rcv_nxt = inc_sequence + (u32 )datasize; handle_rcv_mpa(cm_node, skb); } else { dev_kfree_skb_any(skb); } goto ldv_54053; case 6: cleanup_retrans_entry(cm_node); if (datasize != 0) { cm_node->tcp_cntxt.rcv_nxt = inc_sequence + (u32 )datasize; handle_rcv_mpa(cm_node, skb); } else { drop_packet(skb); } goto ldv_54053; case 8: tmp___2 = __fswab32(tcph->ack_seq); cm_node->tcp_cntxt.rem_ack_num = tmp___2; if (datasize != 0) { cm_node->tcp_cntxt.rcv_nxt = inc_sequence + (u32 )datasize; handle_rcv_mpa(cm_node, skb); } else { dev_kfree_skb_any(skb); } goto ldv_54053; case 2: cleanup_retrans_entry(cm_node); cm_node->state = 19; send_reset(cm_node, skb); goto ldv_54053; case 19: cleanup_retrans_entry(cm_node); add_ref_cm_node(cm_node); send_reset(cm_node, skb); goto ldv_54053; case 16: ; case 17: cleanup_retrans_entry(cm_node); cm_node->state = 19; (*((cm_node->cm_id)->rem_ref))(cm_node->cm_id); rem_ref_cm_node(cm_node->cm_core, cm_node); drop_packet(skb); goto ldv_54053; case 12: cleanup_retrans_entry(cm_node); drop_packet(skb); cm_node->state = 13; goto ldv_54053; case 4: ; case 13: ; case 11: ; case 9: ; case 0: ; default: cleanup_retrans_entry(cm_node); drop_packet(skb); goto ldv_54053; } ldv_54053: ; return (ret); } } static int handle_tcp_options(struct nes_cm_node *cm_node , struct tcphdr *tcph , struct sk_buff *skb , int optionsize , int passive ) { u8 *optionsloc ; int tmp ; __u16 tmp___0 ; { optionsloc = (u8 *)tcph + 1U; if (optionsize != 0) { tmp = process_options(cm_node, optionsloc, (u32 )optionsize, (unsigned int )tcph->syn); if (tmp != 0) { if ((nes_debug_level & 32U) != 0U) { printk("\viw_nes: %s[%u]: %s: Node %p, Sending RESET\n", "handle_tcp_options", 2091, "handle_tcp_options", cm_node); } else { } if (passive != 0) { passive_open_err(cm_node, skb, 1); } else { active_open_err(cm_node, skb, 1); } return (1); } else { } } else { } tmp___0 = __fswab16((int )tcph->window); cm_node->tcp_cntxt.snd_wnd = (u32 )((int )tmp___0 << (int )cm_node->tcp_cntxt.snd_wscale); if (cm_node->tcp_cntxt.snd_wnd > cm_node->tcp_cntxt.max_snd_wnd) { cm_node->tcp_cntxt.max_snd_wnd = cm_node->tcp_cntxt.snd_wnd; } else { } return (0); } } static void active_open_err(struct nes_cm_node *cm_node , struct sk_buff *skb , int reset ) { { cleanup_retrans_entry(cm_node); if (reset != 0) { if ((nes_debug_level & 32U) != 0U) { printk("\viw_nes: %s[%u]: ERROR active err called for cm_node=%p, state=%d\n", "active_open_err", 2118, cm_node, (unsigned int )cm_node->state); } else { } add_ref_cm_node(cm_node); send_reset(cm_node, skb); } else { dev_kfree_skb_any(skb); } cm_node->state = 19; create_event(cm_node, 14); return; } } static void passive_open_err(struct nes_cm_node *cm_node , struct sk_buff *skb , int reset ) { { cleanup_retrans_entry(cm_node); cm_node->state = 19; if (reset != 0) { if ((nes_debug_level & 32U) != 0U) { printk("\viw_nes: %s[%u]: passive_open_err sending RST for cm_node=%p state =%d\n", "passive_open_err", 2140, cm_node, (unsigned int )cm_node->state); } else { } send_reset(cm_node, skb); } else { dev_kfree_skb_any(skb); rem_ref_cm_node(cm_node->cm_core, cm_node); } return; } } static void free_retrans_entry(struct nes_cm_node *cm_node ) { struct nes_timer_entry *send_entry ; { send_entry = cm_node->send_entry; if ((unsigned long )send_entry != (unsigned long )((struct nes_timer_entry *)0)) { cm_node->send_entry = 0; dev_kfree_skb_any(send_entry->skb); kfree((void const *)send_entry); rem_ref_cm_node(cm_node->cm_core, cm_node); } else { } return; } } static void cleanup_retrans_entry(struct nes_cm_node *cm_node ) { unsigned long flags ; raw_spinlock_t *tmp ; { tmp = spinlock_check(& cm_node->retrans_list_lock); flags = _raw_spin_lock_irqsave(tmp); free_retrans_entry(cm_node); spin_unlock_irqrestore(& cm_node->retrans_list_lock, flags); return; } } static void process_packet(struct nes_cm_node *cm_node , struct sk_buff *skb , struct nes_cm_core *cm_core ) { enum nes_tcpip_pkt_type pkt_type ; struct tcphdr *tcph ; struct tcphdr *tmp ; u32 fin_set ; int ret ; struct iphdr *tmp___0 ; int tmp___1 ; { pkt_type = 0; tmp = tcp_hdr((struct sk_buff const *)skb); tcph = tmp; fin_set = 0U; ret = 0; tmp___0 = ip_hdr((struct sk_buff const *)skb); skb_pull(skb, (unsigned int )((int )tmp___0->ihl << 2)); if ((nes_debug_level & 32U) != 0U) { printk("\viw_nes: %s[%u]: process_packet: cm_node=%p state =%d syn=%d ack=%d rst=%d fin=%d\n", "process_packet", 2190, cm_node, (unsigned int )cm_node->state, (int )tcph->syn, (int )tcph->ack, (int )tcph->rst, (int )tcph->fin); } else { } if ((unsigned int )*((unsigned char *)tcph + 13UL) != 0U) { pkt_type = 5; } else if ((unsigned int )*((unsigned char *)tcph + 13UL) != 0U) { pkt_type = 1; if ((unsigned int )*((unsigned char *)tcph + 13UL) != 0U) { pkt_type = 2; } else { } } else if ((unsigned int )*((unsigned char *)tcph + 13UL) != 0U) { pkt_type = 3; } else { } if ((unsigned int )*((unsigned char *)tcph + 13UL) != 0U) { fin_set = 1U; } else { } switch ((unsigned int )pkt_type) { case 1: handle_syn_pkt(cm_node, skb, tcph); goto ldv_54110; case 2: handle_synack_pkt(cm_node, skb, tcph); goto ldv_54110; case 3: ret = handle_ack_pkt(cm_node, skb, tcph); if (fin_set != 0U && ret == 0) { handle_fin_pkt(cm_node); } else { } goto ldv_54110; case 5: handle_rst_pkt(cm_node, skb, tcph); goto ldv_54110; default: ; if (fin_set != 0U) { tmp___1 = check_seq(cm_node, tcph, skb); if (tmp___1 == 0) { handle_fin_pkt(cm_node); } else { } } else { } drop_packet(skb); goto ldv_54110; } ldv_54110: ; return; } } static struct nes_cm_listener *mini_cm_listen(struct nes_cm_core *cm_core , struct nes_vnic *nesvnic , struct nes_cm_info *cm_info ) { struct nes_cm_listener *listener ; unsigned long flags ; __u16 tmp ; __u32 tmp___0 ; void *tmp___1 ; __u32 tmp___2 ; __u16 tmp___3 ; raw_spinlock_t *tmp___4 ; { if ((nes_debug_level & 32U) != 0U) { printk("\viw_nes: %s[%u]: Search for 0x%08x : 0x%04x\n", "mini_cm_listen", 2237, cm_info->loc_addr, (int )cm_info->loc_port); } else { } tmp = __fswab16((int )cm_info->loc_port); tmp___0 = __fswab32(cm_info->loc_addr); listener = find_listener(cm_core, tmp___0, (int )tmp, 3); if ((unsigned long )listener != (unsigned long )((struct nes_cm_listener *)0) && (unsigned int )listener->listener_state == 2U) { atomic_dec(& listener->ref_count); if ((nes_debug_level & 32U) != 0U) { printk("\viw_nes: %s[%u]: Not creating listener since it already exists\n", "mini_cm_listen", 2245); } else { } return (0); } else { } if ((unsigned long )listener == (unsigned long )((struct nes_cm_listener *)0)) { tmp___1 = kzalloc(80UL, 32U); listener = (struct nes_cm_listener *)tmp___1; if ((unsigned long )listener == (unsigned long )((struct nes_cm_listener *)0)) { if ((nes_debug_level & 32U) != 0U) { printk("\viw_nes: %s[%u]: Not creating listener memory allocation failed\n", "mini_cm_listen", 2253); } else { } return (0); } else { } tmp___2 = __fswab32(cm_info->loc_addr); listener->loc_addr = tmp___2; tmp___3 = __fswab16((int )cm_info->loc_port); listener->loc_port = tmp___3; listener->reused_node = 0U; atomic_set(& listener->ref_count, 1); } else { listener->reused_node = 1U; } listener->cm_id = cm_info->ldv_52927.cm_id; atomic_set(& listener->pend_accepts_cnt, 0); listener->cm_core = cm_core; listener->nesvnic = nesvnic; atomic_inc(& cm_core->node_cnt); listener->conn_type = cm_info->conn_type; listener->backlog = cm_info->backlog; listener->listener_state = 2; if (listener->reused_node == 0U) { tmp___4 = spinlock_check(& cm_core->listen_list_lock); flags = _raw_spin_lock_irqsave(tmp___4); list_add(& listener->list, & cm_core->listen_list.list); spin_unlock_irqrestore(& cm_core->listen_list_lock, flags); atomic_inc(& cm_core->listen_node_cnt); } else { } if ((nes_debug_level & 32U) != 0U) { printk("\viw_nes: %s[%u]: Api - listen(): addr=0x%08X, port=0x%04x, listener = %p, backlog = %d, cm_id = %p.\n", "mini_cm_listen", 2289, cm_info->loc_addr, (int )cm_info->loc_port, listener, listener->backlog, listener->cm_id); } else { } return (listener); } } static struct nes_cm_node *mini_cm_connect(struct nes_cm_core *cm_core , struct nes_vnic *nesvnic , u16 private_data_len , void *private_data , struct nes_cm_info *cm_info ) { int ret ; struct nes_cm_node *cm_node ; struct nes_cm_listener *loopbackremotelistener ; struct nes_cm_node *loopbackremotenode ; struct nes_cm_info loopback_cm_info ; u8 *start_buff ; __u32 tmp ; size_t __len ; void *__ret ; size_t __len___0 ; void *__ret___0 ; { ret = 0; cm_node = make_cm_node(cm_core, nesvnic, cm_info, 0); if ((unsigned long )cm_node == (unsigned long )((struct nes_cm_node *)0)) { return (0); } else { } cm_node->tcp_cntxt.client = 1U; cm_node->tcp_cntxt.rcv_wscale = 2U; if (cm_info->loc_addr == cm_info->rem_addr) { tmp = __fswab32(nesvnic->local_ipaddr); loopbackremotelistener = find_listener(cm_core, tmp, (int )cm_node->rem_port, 2); if ((unsigned long )loopbackremotelistener == (unsigned long )((struct nes_cm_listener *)0)) { create_event(cm_node, 14); } else { loopback_cm_info = *cm_info; loopback_cm_info.loc_port = cm_info->rem_port; loopback_cm_info.rem_port = cm_info->loc_port; loopback_cm_info.ldv_52927.cm_id = loopbackremotelistener->cm_id; loopbackremotenode = make_cm_node(cm_core, nesvnic, & loopback_cm_info, loopbackremotelistener); if ((unsigned long )loopbackremotenode == (unsigned long )((struct nes_cm_node *)0)) { rem_ref_cm_node(cm_node->cm_core, cm_node); return (0); } else { } atomic_inc(& cm_loopbacks); loopbackremotenode->loopbackpartner = cm_node; loopbackremotenode->tcp_cntxt.rcv_wscale = 2U; cm_node->loopbackpartner = loopbackremotenode; __len = (size_t )private_data_len; __ret = __builtin_memcpy((void *)(& loopbackremotenode->ldv_52906.mpa_frame_buf), (void const *)private_data, __len); loopbackremotenode->mpa_frame_size = private_data_len; cm_node->state = 11; cm_node->tcp_cntxt.rcv_nxt = loopbackremotenode->tcp_cntxt.loc_seq_num; loopbackremotenode->tcp_cntxt.rcv_nxt = cm_node->tcp_cntxt.loc_seq_num; cm_node->tcp_cntxt.max_snd_wnd = loopbackremotenode->tcp_cntxt.rcv_wnd; loopbackremotenode->tcp_cntxt.max_snd_wnd = cm_node->tcp_cntxt.rcv_wnd; cm_node->tcp_cntxt.snd_wnd = loopbackremotenode->tcp_cntxt.rcv_wnd; loopbackremotenode->tcp_cntxt.snd_wnd = cm_node->tcp_cntxt.rcv_wnd; cm_node->tcp_cntxt.snd_wscale = loopbackremotenode->tcp_cntxt.rcv_wscale; loopbackremotenode->tcp_cntxt.snd_wscale = cm_node->tcp_cntxt.rcv_wscale; loopbackremotenode->state = 9; create_event(loopbackremotenode, 2); } return (cm_node); } else { } start_buff = (u8 *)(& cm_node->ldv_52906.mpa_frame_buf) + 24UL; cm_node->mpa_frame_size = private_data_len; __len___0 = (size_t )private_data_len; __ret___0 = __builtin_memcpy((void *)start_buff, (void const *)private_data, __len___0); cm_node->state = 4; ret = send_syn(cm_node, 0U, 0); if (ret != 0) { if ((nes_debug_level & 32U) != 0U) { printk("\viw_nes: %s[%u]: Api - connect() FAILED: dest addr=0x%08X, port=0x%04x, cm_node=%p, cm_id = %p.\n", "mini_cm_connect", 2383, cm_node->rem_addr, (int )cm_node->rem_port, cm_node, cm_node->cm_id); } else { } rem_ref_cm_node(cm_node->cm_core, cm_node); cm_node = 0; } else { } if ((unsigned long )cm_node != (unsigned long )((struct nes_cm_node *)0)) { if ((nes_debug_level & 32U) != 0U) { printk("\viw_nes: %s[%u]: Api - connect(): dest addr=0x%08X,port=0x%04x, cm_node=%p, cm_id = %p.\n", "mini_cm_connect", 2392, cm_node->rem_addr, (int )cm_node->rem_port, cm_node, cm_node->cm_id); } else { } } else { } return (cm_node); } } static int mini_cm_accept(struct nes_cm_core *cm_core , struct nes_cm_node *cm_node ) { { return (0); } } static int mini_cm_reject(struct nes_cm_core *cm_core , struct nes_cm_node *cm_node ) { int ret ; int err ; int passive_state ; struct nes_cm_event event ; struct iw_cm_id *cm_id ; struct nes_cm_node *loopback ; int __ret_warn_on ; long tmp ; { ret = 0; err = 0; cm_id = cm_node->cm_id; loopback = cm_node->loopbackpartner; if ((nes_debug_level & 32U) != 0U) { printk("\viw_nes: %s[%u]: %s cm_node=%p type=%d state=%d\n", "mini_cm_reject", 2422, "mini_cm_reject", cm_node, (int )cm_node->tcp_cntxt.client, (unsigned int )cm_node->state); } else { } if ((unsigned int )cm_node->tcp_cntxt.client != 0U) { return (ret); } else { } cleanup_retrans_entry(cm_node); if ((unsigned long )loopback == (unsigned long )((struct nes_cm_node *)0)) { passive_state = atomic_add_return(1, & cm_node->passive_state); if (passive_state == 2) { cm_node->state = 19; rem_ref_cm_node(cm_core, cm_node); } else if ((unsigned int )cm_node->state == 18U) { rem_ref_cm_node(cm_core, cm_node); } else { ret = send_mpa_reject(cm_node); if (ret != 0) { cm_node->state = 19; err = send_reset(cm_node, 0); if (err != 0) { __ret_warn_on = 1; tmp = ldv__builtin_expect(__ret_warn_on != 0, 0L); if (tmp != 0L) { warn_slowpath_null("/home/zakharov/workspace/benchmarks/bench_1/work/current--X--drivers/infiniband/hw/nes/iw_nes.ko--X--deg2_cpalinux-3.8-rc1--X--32_7a--X--cpachecker/linux-3.8-rc1/csd_deg_dscv/18/dscv_tempdir/dscv/ri/32_7a/drivers/infiniband/hw/nes/nes_cm.c.prepared", 2442); } else { } ldv__builtin_expect(__ret_warn_on != 0, 0L); } else { } } else { (*(cm_id->add_ref))(cm_id); } } } else { cm_node->cm_id = 0; if ((unsigned int )cm_node->state == 18U) { rem_ref_cm_node(cm_core, cm_node); rem_ref_cm_node(cm_core, loopback); } else { event.cm_node = loopback; event.cm_info.rem_addr = loopback->rem_addr; event.cm_info.loc_addr = loopback->loc_addr; event.cm_info.rem_port = loopback->rem_port; event.cm_info.loc_port = loopback->loc_port; event.cm_info.ldv_52927.cm_id = loopback->cm_id; cm_event_mpa_reject(& event); rem_ref_cm_node(cm_core, cm_node); loopback->state = 17; cm_id = loopback->cm_id; rem_ref_cm_node(cm_core, loopback); (*(cm_id->rem_ref))(cm_id); } } return (ret); } } static int mini_cm_close(struct nes_cm_core *cm_core , struct nes_cm_node *cm_node ) { int ret ; { ret = 0; if ((unsigned long )cm_core == (unsigned long )((struct nes_cm_core *)0) || (unsigned long )cm_node == (unsigned long )((struct nes_cm_node *)0)) { return (-22); } else { } switch ((unsigned int )cm_node->state) { case 3: ; case 4: ; case 5: ; case 6: ; case 7: ; case 8: ; case 9: cleanup_retrans_entry(cm_node); send_reset(cm_node, 0); goto ldv_54175; case 14: cm_node->state = 16; send_fin(cm_node, 0); goto ldv_54175; case 12: ; case 13: ; case 16: ; case 15: ; case 17: ret = -1; goto ldv_54175; case 2: cleanup_retrans_entry(cm_node); send_reset(cm_node, 0); goto ldv_54175; case 10: ; case 0: ; case 1: ; case 19: ; case 18: ret = rem_ref_cm_node(cm_core, cm_node); goto ldv_54175; case 11: ; if ((unsigned long )cm_node->send_entry != (unsigned long )((struct nes_timer_entry *)0)) { printk("\vERROR Close got called from STATE_TSA send_entry=%p\n", cm_node->send_entry); } else { } ret = rem_ref_cm_node(cm_core, cm_node); goto ldv_54175; } ldv_54175: ; return (ret); } } static int mini_cm_recv_pkt(struct nes_cm_core *cm_core , struct nes_vnic *nesvnic , struct sk_buff *skb ) { struct nes_cm_node *cm_node ; struct nes_cm_listener *listener ; struct iphdr *iph ; struct tcphdr *tcph ; struct nes_cm_info nfo ; int skb_handled ; __be32 tmp_daddr ; __be32 tmp_saddr ; __u32 tmp ; __u16 tmp___0 ; __u32 tmp___1 ; __u16 tmp___2 ; __u32 tmp___3 ; __u32 tmp___4 ; __u16 tmp___5 ; { cm_node = 0; listener = 0; skb_handled = 1; if ((unsigned long )skb == (unsigned long )((struct sk_buff *)0)) { return (0); } else { } if (skb->len <= 39U) { return (0); } else { } iph = (struct iphdr *)skb->data; tcph = (struct tcphdr *)skb->data + 20U; tmp = __fswab32(iph->daddr); nfo.loc_addr = tmp; tmp___0 = __fswab16((int )tcph->dest); nfo.loc_port = tmp___0; tmp___1 = __fswab32(iph->saddr); nfo.rem_addr = tmp___1; tmp___2 = __fswab16((int )tcph->source); nfo.rem_port = tmp___2; tmp___3 = __fswab32(iph->daddr); tmp_daddr = tmp___3; tmp___4 = __fswab32(iph->saddr); tmp_saddr = tmp___4; if ((nes_debug_level & 32U) != 0U) { printk("\viw_nes: %s[%u]: Received packet: dest=%pI4:0x%04X src=%pI4:0x%04X\n", "mini_cm_recv_pkt", 2560, & tmp_daddr, (int )tcph->dest, & tmp_saddr, (int )tcph->source); } else { } cm_node = find_node(cm_core, (int )nfo.rem_port, nfo.rem_addr, (int )nfo.loc_port, nfo.loc_addr); if ((unsigned long )cm_node == (unsigned long )((struct nes_cm_node *)0)) { if ((unsigned int )*((unsigned char *)tcph + 13UL) == 0U || (unsigned int )*((unsigned char *)tcph + 13UL) != 0U) { skb_handled = 0; goto ldv_54203; } else { } listener = find_listener(cm_core, nfo.loc_addr, (int )nfo.loc_port, 2); if ((unsigned long )listener == (unsigned long )((struct nes_cm_listener *)0)) { nfo.ldv_52927.cm_id = 0; nfo.conn_type = 0; if ((nes_debug_level & 32U) != 0U) { printk("\viw_nes: %s[%u]: Unable to find listener for the pkt\n", "mini_cm_recv_pkt", 2580); } else { } skb_handled = 0; goto ldv_54203; } else { } nfo.ldv_52927.cm_id = listener->cm_id; nfo.conn_type = listener->conn_type; cm_node = make_cm_node(cm_core, nesvnic, & nfo, listener); if ((unsigned long )cm_node == (unsigned long )((struct nes_cm_node *)0)) { if ((nes_debug_level & 32U) != 0U) { printk("\viw_nes: %s[%u]: Unable to allocate node\n", "mini_cm_recv_pkt", 2590); } else { } cm_packets_dropped = cm_packets_dropped + 1U; atomic_dec(& listener->ref_count); dev_kfree_skb_any(skb); goto ldv_54203; } else { } if ((unsigned int )*((unsigned char *)tcph + 13UL) == 0U && (unsigned int )*((unsigned char *)tcph + 13UL) == 0U) { cm_node->state = 2; } else { cm_packets_dropped = cm_packets_dropped + 1U; rem_ref_cm_node(cm_core, cm_node); dev_kfree_skb_any(skb); goto ldv_54203; } add_ref_cm_node(cm_node); } else if ((unsigned int )cm_node->state == 11U) { if ((unsigned int )*((unsigned char *)cm_node->nesqp + 820UL) != 0U) { nes_queue_mgt_skbs(skb, nesvnic, cm_node->nesqp); } else { rem_ref_cm_node(cm_core, cm_node); atomic_inc(& cm_accel_dropped_pkts); dev_kfree_skb_any(skb); } goto ldv_54203; } else { } skb_reset_network_header(skb); skb_set_transport_header(skb, 20); tmp___5 = __fswab16((int )iph->tot_len); skb->len = (unsigned int )tmp___5; process_packet(cm_node, skb, cm_core); rem_ref_cm_node(cm_core, cm_node); ldv_54203: ; return (skb_handled); } } static struct nes_cm_core *nes_cm_alloc_core(void) { struct nes_cm_core *cm_core ; void *tmp ; struct lock_class_key __key ; struct lock_class_key __key___0 ; struct lock_class_key __key___1 ; struct lock_class_key __key___2 ; char const *__lock_name ; struct workqueue_struct *tmp___0 ; struct lock_class_key __key___3 ; char const *__lock_name___0 ; struct workqueue_struct *tmp___1 ; { tmp = kzalloc(1536UL, 208U); cm_core = (struct nes_cm_core *)tmp; if ((unsigned long )cm_core == (unsigned long )((struct nes_cm_core *)0)) { return (0); } else { } INIT_LIST_HEAD(& cm_core->connected_nodes); init_timer_key(& cm_core->tcp_timer, 0U, "(&cm_core->tcp_timer)", & __key); cm_core->tcp_timer.function = & nes_cm_timer_tick; cm_core->mtu = 1540U; cm_core->state = 1; cm_core->free_tx_pkt_max = 10U; atomic_set(& cm_core->events_posted, 0); cm_core->api = & nes_cm_api; spinlock_check(& cm_core->ht_lock); __raw_spin_lock_init(& cm_core->ht_lock.ldv_5961.rlock, "&(&cm_core->ht_lock)->rlock", & __key___0); spinlock_check(& cm_core->listen_list_lock); __raw_spin_lock_init(& cm_core->listen_list_lock.ldv_5961.rlock, "&(&cm_core->listen_list_lock)->rlock", & __key___1); INIT_LIST_HEAD(& cm_core->listen_list.list); if ((nes_debug_level & 32U) != 0U) { printk("\viw_nes: %s[%u]: Init CM Core completed -- cm_core=%p\n", "nes_cm_alloc_core", 2655, cm_core); } else { } if ((nes_debug_level & 32U) != 0U) { printk("\viw_nes: %s[%u]: Enable QUEUE EVENTS\n", "nes_cm_alloc_core", 2657); } else { } __lock_name = "nesewq"; tmp___0 = __alloc_workqueue_key("nesewq", 10U, 1, & __key___2, __lock_name); cm_core->event_wq = tmp___0; cm_core->post_event = & nes_cm_post_event; if ((nes_debug_level & 32U) != 0U) { printk("\viw_nes: %s[%u]: Enable QUEUE DISCONNECTS\n", "nes_cm_alloc_core", 2660); } else { } __lock_name___0 = "nesdwq"; tmp___1 = __alloc_workqueue_key("nesdwq", 10U, 1, & __key___3, __lock_name___0); cm_core->disconn_wq = tmp___1; print_core(cm_core); return (cm_core); } } static int mini_cm_dealloc_core(struct nes_cm_core *cm_core ) { int tmp ; { if ((nes_debug_level & 32U) != 0U) { printk("\viw_nes: %s[%u]: De-Alloc CM Core (%p)\n", "mini_cm_dealloc_core", 2673, cm_core); } else { } if ((unsigned long )cm_core == (unsigned long )((struct nes_cm_core *)0)) { return (-22); } else { } __asm__ volatile ("": : : "memory"); tmp = timer_pending((struct timer_list const *)(& cm_core->tcp_timer)); if (tmp != 0) { del_timer(& cm_core->tcp_timer); } else { } destroy_workqueue(cm_core->event_wq); destroy_workqueue(cm_core->disconn_wq); if ((nes_debug_level & 32U) != 0U) { printk("\viw_nes: %s[%u]: \n", "mini_cm_dealloc_core", 2685); } else { } kfree((void const *)cm_core); return (0); } } static int mini_cm_get(struct nes_cm_core *cm_core ) { { return ((int )cm_core->state); } } static int mini_cm_set(struct nes_cm_core *cm_core , u32 type , u32 value ) { int ret ; { ret = 0; switch (type) { case 2: cm_core->mtu = value; goto ldv_54232; case 4: cm_core->free_tx_pkt_max = value; goto ldv_54232; default: ret = -22; } ldv_54232: ; return (ret); } } static int nes_cm_init_tsa_conn(struct nes_qp *nesqp , struct nes_cm_node *cm_node ) { int ret ; { ret = 0; if ((unsigned long )nesqp == (unsigned long )((struct nes_qp *)0)) { return (-22); } else { } (nesqp->nesqp_context)->misc = (nesqp->nesqp_context)->misc | 2147516440U; if ((unsigned int )cm_node->tcp_cntxt.snd_wscale != 0U || (unsigned int )cm_node->tcp_cntxt.rcv_wscale != 0U) { (nesqp->nesqp_context)->misc = (nesqp->nesqp_context)->misc | 524288U; } else { } (nesqp->nesqp_context)->misc2 = (nesqp->nesqp_context)->misc2 | 64U; (nesqp->nesqp_context)->mss = (nesqp->nesqp_context)->mss | (cm_node->tcp_cntxt.mss << 16); (nesqp->nesqp_context)->tcp_state_flow_label = (nesqp->nesqp_context)->tcp_state_flow_label | 1342177280U; (nesqp->nesqp_context)->pd_index_wscale = (nesqp->nesqp_context)->pd_index_wscale | ((__le32 )((int )cm_node->tcp_cntxt.snd_wscale << 8) & 3840U); (nesqp->nesqp_context)->pd_index_wscale = (nesqp->nesqp_context)->pd_index_wscale | ((__le32 )cm_node->tcp_cntxt.rcv_wscale & 15U); (nesqp->nesqp_context)->keepalive = 128U; (nesqp->nesqp_context)->ts_recent = 0U; (nesqp->nesqp_context)->ts_age = 0U; (nesqp->nesqp_context)->snd_nxt = cm_node->tcp_cntxt.loc_seq_num; (nesqp->nesqp_context)->snd_wnd = cm_node->tcp_cntxt.snd_wnd; (nesqp->nesqp_context)->rcv_nxt = cm_node->tcp_cntxt.rcv_nxt; (nesqp->nesqp_context)->rcv_wnd = cm_node->tcp_cntxt.rcv_wnd << (int )cm_node->tcp_cntxt.rcv_wscale; (nesqp->nesqp_context)->snd_max = cm_node->tcp_cntxt.loc_seq_num; (nesqp->nesqp_context)->snd_una = cm_node->tcp_cntxt.loc_seq_num; (nesqp->nesqp_context)->srtt = 0U; (nesqp->nesqp_context)->rttvar = 6U; (nesqp->nesqp_context)->ssthresh = 1073725440U; (nesqp->nesqp_context)->cwnd = cm_node->tcp_cntxt.mss * 2U; (nesqp->nesqp_context)->snd_wl1 = cm_node->tcp_cntxt.rcv_nxt; (nesqp->nesqp_context)->snd_wl2 = cm_node->tcp_cntxt.loc_seq_num; (nesqp->nesqp_context)->max_snd_wnd = cm_node->tcp_cntxt.max_snd_wnd; if ((nes_debug_level & 32U) != 0U) { printk("\viw_nes: %s[%u]: QP%u: rcv_nxt = 0x%08X, snd_nxt = 0x%08X, Setting MSS to %u, PDWscale = 0x%08X, rcv_wnd = %u, context misc = 0x%08X.\n", "nes_cm_init_tsa_conn", 2781, nesqp->hwqp.qp_id, (nesqp->nesqp_context)->rcv_nxt, (nesqp->nesqp_context)->snd_nxt, cm_node->tcp_cntxt.mss, (nesqp->nesqp_context)->pd_index_wscale, (nesqp->nesqp_context)->rcv_wnd, (nesqp->nesqp_context)->misc); } else { } if ((nes_debug_level & 32U) != 0U) { printk("\viw_nes: %s[%u]: snd_wnd = 0x%08X.\n", "nes_cm_init_tsa_conn", 2782, (nesqp->nesqp_context)->snd_wnd); } else { } if ((nes_debug_level & 32U) != 0U) { printk("\viw_nes: %s[%u]: snd_cwnd = 0x%08X.\n", "nes_cm_init_tsa_conn", 2783, (nesqp->nesqp_context)->cwnd); } else { } if ((nes_debug_level & 32U) != 0U) { printk("\viw_nes: %s[%u]: max_swnd = 0x%08X.\n", "nes_cm_init_tsa_conn", 2784, (nesqp->nesqp_context)->max_snd_wnd); } else { } if ((nes_debug_level & 32U) != 0U) { printk("\viw_nes: %s[%u]: Change cm_node state to TSA\n", "nes_cm_init_tsa_conn", 2786); } else { } cm_node->state = 11; return (ret); } } int nes_cm_disconn(struct nes_qp *nesqp ) { struct disconn_work *work ; void *tmp ; struct lock_class_key __key ; atomic_long_t __constr_expr_0 ; { tmp = kzalloc(88UL, 32U); work = (struct disconn_work *)tmp; if ((unsigned long )work == (unsigned long )((struct disconn_work *)0)) { return (-12); } else { } nes_add_ref(& nesqp->ibqp); work->nesqp = nesqp; __init_work(& work->work, 0); __constr_expr_0.counter = 4195328L; work->work.data = __constr_expr_0; lockdep_init_map(& work->work.lockdep_map, "(&work->work)", & __key, 0); INIT_LIST_HEAD(& work->work.entry); work->work.func = & nes_disconnect_worker; queue_work(g_cm_core->disconn_wq, & work->work); return (0); } } static void nes_disconnect_worker(struct work_struct *work ) { struct disconn_work *dwork ; struct work_struct const *__mptr ; struct nes_qp *nesqp ; { __mptr = (struct work_struct const *)work; dwork = (struct disconn_work *)__mptr; nesqp = dwork->nesqp; kfree((void const *)dwork); if ((nes_debug_level & 32U) != 0U) { printk("\viw_nes: %s[%u]: processing AEQE id 0x%04X for QP%u.\n", "nes_disconnect_worker", 2822, nesqp->last_aeq, nesqp->hwqp.qp_id); } else { } nes_cm_disconn_true(nesqp); nes_rem_ref(& nesqp->ibqp); return; } } static int nes_cm_disconn_true(struct nes_qp *nesqp ) { unsigned long flags ; int ret ; struct iw_cm_id *cm_id ; struct iw_cm_event cm_event ; struct nes_vnic *nesvnic ; u16 last_ae ; u8 original_hw_tcp_state ; u8 original_ibqp_state ; int disconn_status ; int issue_disconn ; int issue_close ; int issue_flush ; u32 flush_q ; struct ib_event ibevent ; raw_spinlock_t *tmp ; int tmp___0 ; { ret = 0; disconn_status = 0; issue_disconn = 0; issue_close = 0; issue_flush = 0; flush_q = 2147483648U; if ((unsigned long )nesqp == (unsigned long )((struct nes_qp *)0)) { if ((nes_debug_level & 32U) != 0U) { printk("\viw_nes: %s[%u]: disconnect_worker nesqp is NULL\n", "nes_cm_disconn_true", 2849); } else { } return (-1); } else { } tmp = spinlock_check(& nesqp->lock); flags = _raw_spin_lock_irqsave(tmp); cm_id = nesqp->cm_id; if ((unsigned long )cm_id == (unsigned long )((struct iw_cm_id *)0)) { if ((nes_debug_level & 32U) != 0U) { printk("\viw_nes: %s[%u]: QP%u disconnect_worker cmid is NULL\n", "nes_cm_disconn_true", 2858, nesqp->hwqp.qp_id); } else { } spin_unlock_irqrestore(& nesqp->lock, flags); return (-1); } else { } nesvnic = to_nesvnic(nesqp->ibqp.device); if ((nes_debug_level & 32U) != 0U) { printk("\viw_nes: %s[%u]: Disconnecting QP%u\n", "nes_cm_disconn_true", 2864, nesqp->hwqp.qp_id); } else { } original_hw_tcp_state = nesqp->hw_tcp_state; original_ibqp_state = (u8 )nesqp->ibqp_state; last_ae = (u16 )nesqp->last_aeq; if ((unsigned int )nesqp->term_flags != 0U) { issue_disconn = 1; issue_close = 1; nesqp->cm_id = 0; del_timer(& nesqp->terminate_timer); if ((unsigned int )*((unsigned char *)nesqp + 820UL) == 0U) { nesqp->flush_issued = 1U; issue_flush = 1; } else { } } else if ((unsigned int )original_hw_tcp_state == 6U || ((unsigned int )original_ibqp_state == 3U && (unsigned int )last_ae == 1282U)) { issue_disconn = 1; if ((unsigned int )last_ae == 1282U) { disconn_status = -104; } else { } } else { } if ((((unsigned int )original_hw_tcp_state == 1U || (unsigned int )original_hw_tcp_state == 11U) || (unsigned int )last_ae == 514U) || (unsigned int )last_ae == 1282U) { issue_close = 1; nesqp->cm_id = 0; if ((unsigned int )*((unsigned char *)nesqp + 820UL) == 0U) { nesqp->flush_issued = 1U; issue_flush = 1; } else { } } else { } spin_unlock_irqrestore(& nesqp->lock, flags); if (issue_flush != 0 && (unsigned int )*((unsigned char *)nesqp + 820UL) == 0U) { if ((unsigned int )nesqp->hw_iwarp_state > 4U) { flush_q = flush_q | 1073741824U; } else { } flush_wqes(nesvnic->nesdev, nesqp, flush_q, 1U); if ((unsigned int )nesqp->term_flags != 0U) { ibevent.device = nesqp->ibqp.device; ibevent.event = nesqp->terminate_eventtype; ibevent.element.qp = & nesqp->ibqp; if ((unsigned long )nesqp->ibqp.event_handler != (unsigned long )((void (*)(struct ib_event * , void * ))0)) { (*(nesqp->ibqp.event_handler))(& ibevent, nesqp->ibqp.qp_context); } else { } } else { } } else { } if ((unsigned long )cm_id != (unsigned long )((struct iw_cm_id *)0) && (unsigned long )cm_id->event_handler != (unsigned long )((int (*)(struct iw_cm_id * , struct iw_cm_event * ))0)) { if (issue_disconn != 0) { atomic_inc(& cm_disconnects); cm_event.event = 4; cm_event.status = disconn_status; cm_event.local_addr = cm_id->local_addr; cm_event.remote_addr = cm_id->remote_addr; cm_event.private_data = 0; cm_event.private_data_len = 0U; if ((nes_debug_level & 32U) != 0U) { tmp___0 = atomic_read((atomic_t const *)(& nesqp->refcount)); printk("\viw_nes: %s[%u]: Generating a CM Disconnect Event for QP%u, SQ Head = %u, SQ Tail = %u. cm_id = %p, refcount = %u.\n", "nes_cm_disconn_true", 2931, nesqp->hwqp.qp_id, (int )nesqp->hwqp.sq_head, (int )nesqp->hwqp.sq_tail, cm_id, tmp___0); } else { } ret = (*(cm_id->event_handler))(cm_id, & cm_event); if (ret != 0) { if ((nes_debug_level & 32U) != 0U) { printk("\viw_nes: %s[%u]: OFA CM event_handler returned, ret=%d\n", "nes_cm_disconn_true", 2936, ret); } else { } } else { } } else { } if (issue_close != 0) { atomic_inc(& cm_closes); nes_disconnect(nesqp, 1); cm_id->provider_data = (void *)nesqp; cm_event.event = 5; cm_event.status = 0; cm_event.provider_data = cm_id->provider_data; cm_event.local_addr = cm_id->local_addr; cm_event.remote_addr = cm_id->remote_addr; cm_event.private_data = 0; cm_event.private_data_len = 0U; ret = (*(cm_id->event_handler))(cm_id, & cm_event); if (ret != 0) { if ((nes_debug_level & 32U) != 0U) { printk("\viw_nes: %s[%u]: OFA CM event_handler returned, ret=%d\n", "nes_cm_disconn_true", 2955, ret); } else { } } else { } (*(cm_id->rem_ref))(cm_id); } else { } } else { } return (0); } } static int nes_disconnect(struct nes_qp *nesqp , int abrupt ) { int ret ; struct nes_vnic *nesvnic ; struct nes_device *nesdev ; struct nes_ib_device *nesibdev ; int tmp ; { ret = 0; nesvnic = to_nesvnic(nesqp->ibqp.device); if ((unsigned long )nesvnic == (unsigned long )((struct nes_vnic *)0)) { return (-22); } else { } nesdev = nesvnic->nesdev; nesibdev = nesvnic->nesibdev; if ((nes_debug_level & 32U) != 0U) { tmp = netdev_refcnt_read((struct net_device const *)nesvnic->netdev); printk("\viw_nes: %s[%u]: netdev refcnt = %u.\n", "nes_disconnect", 2983, tmp); } else { } if ((unsigned int )*((unsigned char *)nesqp + 820UL) != 0U) { nesqp->active_conn = 0U; } else if ((unsigned long )nesqp->ietf_frame != (unsigned long )((void *)0)) { if ((unsigned long )nesqp->lsmm_mr != (unsigned long )((struct ib_mr *)0)) { (*(nesibdev->ibdev.dereg_mr))(nesqp->lsmm_mr); } else { } pci_free_consistent(nesdev->pcidev, (size_t )((int )nesqp->private_data_len + (int )nesqp->ietf_frame_size), nesqp->ietf_frame, nesqp->ietf_frame_pbase); } else { } if ((unsigned long )nesqp->cm_node != (unsigned long )((void *)0)) { if ((nes_debug_level & 32U) != 0U) { printk("\viw_nes: %s[%u]: Call close API\n", "nes_disconnect", 3002); } else { } (*((g_cm_core->api)->close))(g_cm_core, (struct nes_cm_node *)nesqp->cm_node); } else { } return (ret); } } int nes_accept(struct iw_cm_id *cm_id , struct iw_cm_conn_param *conn_param ) { u64 u64temp ; struct ib_qp *ibqp ; struct nes_qp *nesqp ; struct nes_vnic *nesvnic ; struct nes_device *nesdev ; struct nes_cm_node *cm_node ; struct nes_adapter *adapter ; struct ib_qp_attr attr ; struct iw_cm_event cm_event ; struct nes_hw_qp_wqe *wqe ; struct nes_v4_quad nes_quad ; u32 crc_value ; int ret ; int passive_state ; struct nes_ib_device *nesibdev ; struct ib_mr *ibmr ; struct ib_phys_buf ibphysbuf ; struct nes_pd *nespd ; u64 tagged_offset ; u8 mpa_frame_offset ; struct ietf_mpa_v2 *mpa_v2_frame ; u8 start_addr ; u8 *start_ptr ; u8 **start_buff ; u16 buff_len ; int tmp ; size_t __len ; void *__ret ; __u16 tmp___0 ; __u16 tmp___1 ; __u32 tmp___2 ; int tmp___3 ; u32 tmp___4 ; __u32 tmp___5 ; __u16 tmp___6 ; __u32 tmp___7 ; __u16 tmp___8 ; __u32 tmp___9 ; size_t __len___0 ; void *__ret___0 ; { ibmr = 0; mpa_frame_offset = 0U; start_addr = 0U; start_ptr = & start_addr; start_buff = & start_ptr; buff_len = 0U; ibqp = nes_get_qp(cm_id->device, (int )conn_param->qpn); if ((unsigned long )ibqp == (unsigned long )((struct ib_qp *)0)) { return (-22); } else { } nesqp = to_nesqp(ibqp); nesvnic = to_nesvnic(nesqp->ibqp.device); nesdev = nesvnic->nesdev; adapter = nesdev->nesadapter; cm_node = (struct nes_cm_node *)cm_id->provider_data; if ((nes_debug_level & 32U) != 0U) { printk("\viw_nes: %s[%u]: nes_accept: cm_node= %p nesvnic=%p, netdev=%p,%s\n", "nes_accept", 3055, cm_node, nesvnic, nesvnic->netdev, (char *)(& (nesvnic->netdev)->name)); } else { } if ((unsigned int )cm_node->state == 18U) { if ((unsigned long )cm_node->loopbackpartner != (unsigned long )((struct nes_cm_node *)0)) { rem_ref_cm_node(cm_node->cm_core, cm_node->loopbackpartner); } else { } rem_ref_cm_node(cm_node->cm_core, cm_node); return (-22); } else { } passive_state = atomic_add_return(1, & cm_node->passive_state); if (passive_state == 2) { rem_ref_cm_node(cm_node->cm_core, cm_node); return (-104); } else { } nesqp->cm_node = (void *)cm_node; cm_node->nesqp = nesqp; if ((nes_debug_level & 32U) != 0U) { printk("\viw_nes: %s[%u]: QP%u, cm_node=%p, jiffies = %lu listener = %p\n", "nes_accept", 3075, nesqp->hwqp.qp_id, cm_node, jiffies, cm_node->listener); } else { } atomic_inc(& cm_accepts); if ((nes_debug_level & 32U) != 0U) { tmp = netdev_refcnt_read((struct net_device const *)nesvnic->netdev); printk("\viw_nes: %s[%u]: netdev refcnt = %u.\n", "nes_accept", 3079, tmp); } else { } nesqp->ietf_frame_size = 24U; nesqp->ietf_frame = pci_alloc_consistent(nesdev->pcidev, (size_t )((int )nesqp->ietf_frame_size + (int )conn_param->private_data_len), & nesqp->ietf_frame_pbase); if ((unsigned long )nesqp->ietf_frame == (unsigned long )((void *)0)) { if ((nes_debug_level & 32U) != 0U) { printk("\viw_nes: %s[%u]: Unable to allocate memory for private data\n", "nes_accept", 3088); } else { } return (-12); } else { } mpa_v2_frame = (struct ietf_mpa_v2 *)nesqp->ietf_frame; if ((unsigned int )cm_node->mpa_frame_rev == 1U) { mpa_frame_offset = 4U; } else { } __len = (size_t )conn_param->private_data_len; __ret = __builtin_memcpy((void *)(& mpa_v2_frame->priv_data), conn_param->private_data, __len); cm_build_mpa_frame(cm_node, start_buff, & buff_len, (u8 *)nesqp->ietf_frame, 1); nesqp->private_data_len = conn_param->private_data_len; wqe = nesqp->hwqp.sq_vbase; if (cm_id->remote_addr.sin_addr.s_addr != cm_id->local_addr.sin_addr.s_addr) { u64temp = (u64 )nesqp; nesibdev = nesvnic->nesibdev; nespd = nesqp->nespd; ibphysbuf.addr = nesqp->ietf_frame_pbase + (dma_addr_t )mpa_frame_offset; ibphysbuf.size = (u64 )buff_len; tagged_offset = (unsigned long long )*start_buff; ibmr = (*(nesibdev->ibdev.reg_phys_mr))((struct ib_pd *)nespd, & ibphysbuf, 1, 1, & tagged_offset); if ((unsigned long )ibmr == (unsigned long )((struct ib_mr *)0)) { if ((nes_debug_level & 32U) != 0U) { printk("\viw_nes: %s[%u]: Unable to register memory regionfor lSMM for cm_node = %p \n", "nes_accept", 3120, cm_node); } else { } pci_free_consistent(nesdev->pcidev, (size_t )((int )nesqp->private_data_len + (int )nesqp->ietf_frame_size), nesqp->ietf_frame, nesqp->ietf_frame_pbase); return (-12); } else { } ibmr->pd = & nespd->ibpd; ibmr->device = nespd->ibpd.device; nesqp->lsmm_mr = ibmr; u64temp = u64temp | 512ULL; set_wqe_64bit_value((__le32 *)(& wqe->wqe_words), 2U, u64temp); wqe->wqe_words[0] = 8421376U; wqe->wqe_words[1] = (unsigned int )buff_len; set_wqe_64bit_value((__le32 *)(& wqe->wqe_words), 16U, (unsigned long long )*start_buff); wqe->wqe_words[18] = (unsigned int )buff_len; wqe->wqe_words[19] = ibmr->lkey; if ((unsigned int )nesqp->sq_kmapped != 0U) { nesqp->sq_kmapped = 0U; kunmap(nesqp->page); } else { } (nesqp->nesqp_context)->ird_ord_sizes = (nesqp->nesqp_context)->ird_ord_sizes | 100663296U; } else { (nesqp->nesqp_context)->ird_ord_sizes = (nesqp->nesqp_context)->ird_ord_sizes | 33554432U; } nesqp->skip_lsmm = 1U; nesqp->cm_id = cm_id; cm_node->cm_id = cm_id; cm_id->provider_data = (void *)nesqp; nesqp->active_conn = 0U; if ((unsigned int )cm_node->state == 11U) { if ((nes_debug_level & 32U) != 0U) { printk("\viw_nes: %s[%u]: Already state = TSA for cm_node=%p\n", "nes_accept", 3171, cm_node); } else { } } else { } nes_cm_init_tsa_conn(nesqp, cm_node); tmp___0 = __fswab16((int )cm_id->local_addr.sin_port); (nesqp->nesqp_context)->tcpPorts[0] = tmp___0; tmp___1 = __fswab16((int )cm_id->remote_addr.sin_port); (nesqp->nesqp_context)->tcpPorts[1] = tmp___1; tmp___2 = __fswab32(cm_id->remote_addr.sin_addr.s_addr); (nesqp->nesqp_context)->ip0 = tmp___2; (nesqp->nesqp_context)->misc2 = (nesqp->nesqp_context)->misc2 | (((nesdev->pcidev)->devfn & 7U) << 16); tmp___3 = nes_arp_table(nesdev, (nesqp->nesqp_context)->ip0, 0, 3U); (nesqp->nesqp_context)->arp_index_vlan = (nesqp->nesqp_context)->arp_index_vlan | (__le32 )(tmp___3 << 16); tmp___4 = nes_read_indexed(nesdev, 496U); (nesqp->nesqp_context)->ts_val_delta = (unsigned int )jiffies - tmp___4; (nesqp->nesqp_context)->ird_index = nesqp->hwqp.qp_id; (nesqp->nesqp_context)->ird_ord_sizes = (nesqp->nesqp_context)->ird_ord_sizes | 268435456U; (nesqp->nesqp_context)->ird_ord_sizes = (nesqp->nesqp_context)->ird_ord_sizes | conn_param->ord; memset((void *)(& nes_quad), 0, 16UL); nes_quad.DstIpAdrIndex = ((nesdev->pcidev)->devfn & 7U) << 24; nes_quad.SrcIpadr = cm_id->remote_addr.sin_addr.s_addr; nes_quad.TcpPorts[0] = cm_id->remote_addr.sin_port; nes_quad.TcpPorts[1] = cm_id->local_addr.sin_port; crc_value = get_crc_value(& nes_quad); tmp___5 = __fswab32(~ crc_value); nesqp->hte_index = tmp___5; if ((nes_debug_level & 32U) != 0U) { printk("\viw_nes: %s[%u]: HTE Index = 0x%08X, CRC = 0x%08X\n", "nes_accept", 3213, nesqp->hte_index, nesqp->hte_index & adapter->hte_index_mask); } else { } nesqp->hte_index = nesqp->hte_index & adapter->hte_index_mask; (nesqp->nesqp_context)->hte_index = nesqp->hte_index; (*(((cm_node->cm_core)->api)->accelerated))(cm_node->cm_core, cm_node); if ((nes_debug_level & 32U) != 0U) { tmp___6 = __fswab16((int )cm_id->local_addr.sin_port); tmp___7 = __fswab32(cm_id->local_addr.sin_addr.s_addr); tmp___8 = __fswab16((int )cm_id->remote_addr.sin_port); tmp___9 = __fswab32(cm_id->remote_addr.sin_addr.s_addr); printk("\viw_nes: %s[%u]: QP%u, Destination IP = 0x%08X:0x%04X, local = 0x%08X:0x%04X, rcv_nxt=0x%08X, snd_nxt=0x%08X, mpa + private data length=%u.\n", "nes_accept", 3229, nesqp->hwqp.qp_id, tmp___9, (int )tmp___8, tmp___7, (int )tmp___6, (nesqp->nesqp_context)->rcv_nxt, (nesqp->nesqp_context)->snd_nxt, (int )buff_len); } else { } (*(cm_id->add_ref))(cm_id); nes_add_ref(& nesqp->ibqp); cm_event.event = 3; cm_event.status = 0; cm_event.provider_data = (void *)nesqp; cm_event.local_addr = cm_id->local_addr; cm_event.remote_addr = cm_id->remote_addr; cm_event.private_data = 0; cm_event.private_data_len = 0U; ret = (*(cm_id->event_handler))(cm_id, & cm_event); attr.qp_state = 3; nes_modify_qp(& nesqp->ibqp, & attr, 1, 0); if ((unsigned long )cm_node->loopbackpartner != (unsigned long )((struct nes_cm_node *)0)) { (cm_node->loopbackpartner)->mpa_frame_size = nesqp->private_data_len; __len___0 = (size_t )conn_param->private_data_len; __ret___0 = __builtin_memcpy((void *)(& (cm_node->loopbackpartner)->ldv_52906.mpa_frame_buf), conn_param->private_data, __len___0); create_event(cm_node->loopbackpartner, 7); } else { } if (ret != 0) { printk("\v%s[%u] OFA CM event_handler returned, ret=%d\n", "nes_accept", 3255, ret); } else { } return (0); } } int nes_reject(struct iw_cm_id *cm_id , void const *pdata , u8 pdata_len ) { struct nes_cm_node *cm_node ; struct nes_cm_node *loopback ; struct nes_cm_core *cm_core ; u8 *start_buff ; size_t __len ; void *__ret ; size_t __len___0 ; void *__ret___0 ; int tmp ; { atomic_inc(& cm_rejects); cm_node = (struct nes_cm_node *)cm_id->provider_data; loopback = cm_node->loopbackpartner; cm_core = cm_node->cm_core; cm_node->cm_id = cm_id; if ((unsigned long )pdata_len + 24UL > 536UL) { return (-22); } else { } if ((unsigned long )loopback != (unsigned long )((struct nes_cm_node *)0)) { __len = (size_t )pdata_len; __ret = __builtin_memcpy((void *)(& loopback->ldv_52906.mpa_frame.priv_data), pdata, __len); loopback->ldv_52906.mpa_frame.priv_data_len = (__be16 )pdata_len; loopback->mpa_frame_size = (u16 )pdata_len; } else { start_buff = (u8 *)(& cm_node->ldv_52906.mpa_frame_buf) + 24UL; cm_node->mpa_frame_size = (u16 )pdata_len; __len___0 = (size_t )pdata_len; __ret___0 = __builtin_memcpy((void *)start_buff, pdata, __len___0); } tmp = (*((cm_core->api)->reject))(cm_core, cm_node); return (tmp); } } int nes_connect(struct iw_cm_id *cm_id , struct iw_cm_conn_param *conn_param ) { struct ib_qp *ibqp ; struct nes_qp *nesqp ; struct nes_vnic *nesvnic ; struct nes_device *nesdev ; struct nes_cm_node *cm_node ; struct nes_cm_info cm_info ; int apbvt_set ; __u16 tmp ; __u32 tmp___0 ; __u16 tmp___1 ; __u32 tmp___2 ; __u32 tmp___3 ; __u16 tmp___4 ; __u32 tmp___5 ; __u16 tmp___6 ; __u32 tmp___7 ; __u16 tmp___8 ; __u16 tmp___9 ; { apbvt_set = 0; ibqp = nes_get_qp(cm_id->device, (int )conn_param->qpn); if ((unsigned long )ibqp == (unsigned long )((struct ib_qp *)0)) { return (-22); } else { } nesqp = to_nesqp(ibqp); if ((unsigned long )nesqp == (unsigned long )((struct nes_qp *)0)) { return (-22); } else { } nesvnic = to_nesvnic(nesqp->ibqp.device); if ((unsigned long )nesvnic == (unsigned long )((struct nes_vnic *)0)) { return (-22); } else { } nesdev = nesvnic->nesdev; if ((unsigned long )nesdev == (unsigned long )((struct nes_device *)0)) { return (-22); } else { } if ((unsigned int )cm_id->local_addr.sin_port == 0U || (unsigned int )cm_id->remote_addr.sin_port == 0U) { return (-22); } else { } if ((nes_debug_level & 32U) != 0U) { tmp = __fswab16((int )cm_id->local_addr.sin_port); tmp___0 = __fswab32(cm_id->local_addr.sin_addr.s_addr); tmp___1 = __fswab16((int )cm_id->remote_addr.sin_port); tmp___2 = __fswab32(cm_id->remote_addr.sin_addr.s_addr); tmp___3 = __fswab32(nesvnic->local_ipaddr); printk("\viw_nes: %s[%u]: QP%u, current IP = 0x%08X, Destination IP = 0x%08X:0x%04X, local = 0x%08X:0x%04X.\n", "nes_connect", 3329, nesqp->hwqp.qp_id, tmp___3, tmp___2, (int )tmp___1, tmp___0, (int )tmp); } else { } atomic_inc(& cm_connects); nesqp->active_conn = 1U; nesqp->cm_id = cm_id; cm_id->provider_data = (void *)nesqp; nesqp->private_data_len = conn_param->private_data_len; (nesqp->nesqp_context)->ird_ord_sizes = (nesqp->nesqp_context)->ird_ord_sizes | conn_param->ord; if (conn_param->ord == 0U) { (nesqp->nesqp_context)->ird_ord_sizes = (nesqp->nesqp_context)->ird_ord_sizes | 1U; } else { } if ((nes_debug_level & 32U) != 0U) { printk("\viw_nes: %s[%u]: requested ord = 0x%08X.\n", "nes_connect", 3345, conn_param->ord); } else { } if ((nes_debug_level & 32U) != 0U) { printk("\viw_nes: %s[%u]: mpa private data len =%u\n", "nes_connect", 3347, (int )conn_param->private_data_len); } else { } if (cm_id->local_addr.sin_addr.s_addr != cm_id->remote_addr.sin_addr.s_addr) { tmp___4 = __fswab16((int )cm_id->local_addr.sin_port); nes_manage_apbvt(nesvnic, (u32 )tmp___4, (nesdev->pcidev)->devfn & 7U, 1U); apbvt_set = 1; } else { } tmp___5 = __fswab32(cm_id->local_addr.sin_addr.s_addr); cm_info.loc_addr = tmp___5; tmp___6 = __fswab16((int )cm_id->local_addr.sin_port); cm_info.loc_port = tmp___6; tmp___7 = __fswab32(cm_id->remote_addr.sin_addr.s_addr); cm_info.rem_addr = tmp___7; tmp___8 = __fswab16((int )cm_id->remote_addr.sin_port); cm_info.rem_port = tmp___8; cm_info.ldv_52927.cm_id = cm_id; cm_info.conn_type = 0; (*(cm_id->add_ref))(cm_id); cm_node = (*((g_cm_core->api)->connect))(g_cm_core, nesvnic, (int )conn_param->private_data_len, (void *)conn_param->private_data, & cm_info); if ((unsigned long )cm_node == (unsigned long )((struct nes_cm_node *)0)) { if (apbvt_set != 0) { tmp___9 = __fswab16((int )cm_id->local_addr.sin_port); nes_manage_apbvt(nesvnic, (u32 )tmp___9, (nesdev->pcidev)->devfn & 7U, 0U); } else { } (*(cm_id->rem_ref))(cm_id); return (-12); } else { } cm_node->apbvt_set = apbvt_set; nesqp->cm_node = (void *)cm_node; cm_node->nesqp = nesqp; nes_add_ref(& nesqp->ibqp); return (0); } } int nes_create_listen(struct iw_cm_id *cm_id , int backlog ) { struct nes_vnic *nesvnic ; struct nes_cm_listener *cm_node ; struct nes_cm_info cm_info ; int err ; __u16 tmp ; __u16 tmp___0 ; { if ((nes_debug_level & 32U) != 0U) { tmp = __fswab16((int )cm_id->local_addr.sin_port); printk("\viw_nes: %s[%u]: cm_id = %p, local port = 0x%04X.\n", "nes_create_listen", 3400, cm_id, (int )tmp); } else { } nesvnic = to_nesvnic(cm_id->device); if ((unsigned long )nesvnic == (unsigned long )((struct nes_vnic *)0)) { return (-22); } else { } if ((nes_debug_level & 32U) != 0U) { printk("\viw_nes: %s[%u]: nesvnic=%p, netdev=%p, %s\n", "nes_create_listen", 3407, nesvnic, nesvnic->netdev, (char *)(& (nesvnic->netdev)->name)); } else { } if ((nes_debug_level & 32U) != 0U) { printk("\viw_nes: %s[%u]: nesvnic->local_ipaddr=0x%08x, sin_addr.s_addr=0x%08x\n", "nes_create_listen", 3410, nesvnic->local_ipaddr, cm_id->local_addr.sin_addr.s_addr); } else { } cm_info.loc_addr = nesvnic->local_ipaddr; cm_info.loc_port = cm_id->local_addr.sin_port; cm_info.backlog = backlog; cm_info.ldv_52927.cm_id = cm_id; cm_info.conn_type = 0; cm_node = (*((g_cm_core->api)->listen))(g_cm_core, nesvnic, & cm_info); if ((unsigned long )cm_node == (unsigned long )((struct nes_cm_listener *)0)) { printk("\v%s[%u] Error returned from listen API call\n", "nes_create_listen", 3424); return (-12); } else { } cm_id->provider_data = (void *)cm_node; if (cm_node->reused_node == 0U) { tmp___0 = __fswab16((int )cm_id->local_addr.sin_port); err = nes_manage_apbvt(nesvnic, (u32 )tmp___0, ((nesvnic->nesdev)->pcidev)->devfn & 7U, 1U); if (err != 0) { printk("\vnes_manage_apbvt call returned %d.\n", err); (*((g_cm_core->api)->stop_listener))(g_cm_core, cm_node); return (err); } else { } atomic_inc(& cm_listens_created); } else { } (*(cm_id->add_ref))(cm_id); cm_id->provider_data = (void *)cm_node; return (0); } } int nes_destroy_listen(struct iw_cm_id *cm_id ) { { if ((unsigned long )cm_id->provider_data != (unsigned long )((void *)0)) { (*((g_cm_core->api)->stop_listener))(g_cm_core, (struct nes_cm_listener *)cm_id->provider_data); } else if ((nes_debug_level & 32U) != 0U) { printk("\viw_nes: %s[%u]: cm_id->provider_data was NULL\n", "nes_destroy_listen", 3460); } else { } (*(cm_id->rem_ref))(cm_id); return (0); } } int nes_cm_recv(struct sk_buff *skb , struct net_device *netdevice ) { int rc ; void *tmp ; { rc = 0; cm_packets_received = cm_packets_received + 1U; if ((unsigned long )g_cm_core != (unsigned long )((struct nes_cm_core *)0) && (unsigned long )g_cm_core->api != (unsigned long )((struct nes_cm_ops *)0)) { tmp = netdev_priv((struct net_device const *)netdevice); rc = (*((g_cm_core->api)->recv_pkt))(g_cm_core, (struct nes_vnic *)tmp, skb); } else if ((nes_debug_level & 32U) != 0U) { printk("\viw_nes: %s[%u]: Unable to process packet for CM, cm is not setup properly.\n", "nes_cm_recv", 3480); } else { } return (rc); } } int nes_cm_start(void) { { if ((nes_debug_level & 32U) != 0U) { printk("\viw_nes: %s[%u]: \n", "nes_cm_start", 3492); } else { } g_cm_core = nes_cm_alloc_core(); if ((unsigned long )g_cm_core != (unsigned long )((struct nes_cm_core *)0)) { return (0); } else { return (-12); } } } int nes_cm_stop(void) { { (*((g_cm_core->api)->destroy_cm_core))(g_cm_core); return (0); } } static void cm_event_connected(struct nes_cm_event *event ) { struct nes_qp *nesqp ; struct nes_vnic *nesvnic ; struct nes_device *nesdev ; struct nes_cm_node *cm_node ; struct nes_adapter *nesadapter ; struct ib_qp_attr attr ; struct iw_cm_id *cm_id ; struct iw_cm_event cm_event ; struct nes_v4_quad nes_quad ; u32 crc_value ; int ret ; __u16 tmp ; __u16 tmp___0 ; __u32 tmp___1 ; __u16 tmp___2 ; __u16 tmp___3 ; __u32 tmp___4 ; int tmp___5 ; u32 tmp___6 ; __u32 tmp___7 ; { cm_node = event->cm_node; cm_id = cm_node->cm_id; if ((nes_debug_level & 32U) != 0U) { printk("\viw_nes: %s[%u]: cm_event_connected - %p - cm_id = %p\n", "cm_event_connected", 3534, cm_node, cm_id); } else { } nesqp = (struct nes_qp *)cm_id->provider_data; nesvnic = to_nesvnic(nesqp->ibqp.device); nesdev = nesvnic->nesdev; nesadapter = nesdev->nesadapter; if ((unsigned int )*((unsigned char *)nesqp + 820UL) != 0U) { return; } else { } atomic_inc(& cm_connecteds); if ((nes_debug_level & 32U) != 0U) { tmp = __fswab16((int )cm_id->local_addr.sin_port); tmp___0 = __fswab16((int )cm_id->remote_addr.sin_port); tmp___1 = __fswab32(cm_id->remote_addr.sin_addr.s_addr); printk("\viw_nes: %s[%u]: QP%u attempting to connect to 0x%08X:0x%04X on local port 0x%04X. jiffies = %lu.\n", "cm_event_connected", 3549, nesqp->hwqp.qp_id, tmp___1, (int )tmp___0, (int )tmp, jiffies); } else { } nes_cm_init_tsa_conn(nesqp, cm_node); tmp___2 = __fswab16((int )cm_id->local_addr.sin_port); (nesqp->nesqp_context)->tcpPorts[0] = tmp___2; tmp___3 = __fswab16((int )cm_id->remote_addr.sin_port); (nesqp->nesqp_context)->tcpPorts[1] = tmp___3; tmp___4 = __fswab32(cm_id->remote_addr.sin_addr.s_addr); (nesqp->nesqp_context)->ip0 = tmp___4; (nesqp->nesqp_context)->misc2 = (nesqp->nesqp_context)->misc2 | (((nesdev->pcidev)->devfn & 7U) << 16); tmp___5 = nes_arp_table(nesdev, (nesqp->nesqp_context)->ip0, 0, 3U); (nesqp->nesqp_context)->arp_index_vlan = (nesqp->nesqp_context)->arp_index_vlan | (__le32 )(tmp___5 << 16); tmp___6 = nes_read_indexed(nesdev, 496U); (nesqp->nesqp_context)->ts_val_delta = (unsigned int )jiffies - tmp___6; (nesqp->nesqp_context)->ird_index = nesqp->hwqp.qp_id; (nesqp->nesqp_context)->ird_ord_sizes = (nesqp->nesqp_context)->ird_ord_sizes | 268435456U; build_rdma0_msg(cm_node, & nesqp); nes_write32(nesdev->regs + 64UL, nesqp->hwqp.qp_id | 25165824U); memset((void *)(& nes_quad), 0, 16UL); nes_quad.DstIpAdrIndex = ((nesdev->pcidev)->devfn & 7U) << 24; nes_quad.SrcIpadr = cm_id->remote_addr.sin_addr.s_addr; nes_quad.TcpPorts[0] = cm_id->remote_addr.sin_port; nes_quad.TcpPorts[1] = cm_id->local_addr.sin_port; crc_value = get_crc_value(& nes_quad); tmp___7 = __fswab32(~ crc_value); nesqp->hte_index = tmp___7; if ((nes_debug_level & 32U) != 0U) { printk("\viw_nes: %s[%u]: HTE Index = 0x%08X, After CRC = 0x%08X\n", "cm_event_connected", 3595, nesqp->hte_index, nesqp->hte_index & nesadapter->hte_index_mask); } else { } nesqp->hte_index = nesqp->hte_index & nesadapter->hte_index_mask; (nesqp->nesqp_context)->hte_index = nesqp->hte_index; nesqp->ietf_frame = (void *)(& cm_node->ldv_52906.mpa_frame); nesqp->private_data_len = (u16 )((unsigned char )cm_node->mpa_frame_size); (*(((cm_node->cm_core)->api)->accelerated))(cm_node->cm_core, cm_node); cm_event.event = 2; cm_event.status = 0; cm_event.provider_data = cm_id->provider_data; cm_event.local_addr.sin_family = 2U; cm_event.local_addr.sin_port = cm_id->local_addr.sin_port; cm_event.remote_addr = cm_id->remote_addr; cm_event.private_data = (void *)(& (event->cm_node)->ldv_52906.mpa_frame_buf); cm_event.private_data_len = (unsigned char )(event->cm_node)->mpa_frame_size; cm_event.ird = (u8 )cm_node->ird_size; cm_event.ord = (u8 )cm_node->ord_size; cm_event.local_addr.sin_addr.s_addr = event->cm_info.rem_addr; ret = (*(cm_id->event_handler))(cm_id, & cm_event); if ((nes_debug_level & 32U) != 0U) { printk("\viw_nes: %s[%u]: OFA CM event_handler returned, ret=%d\n", "cm_event_connected", 3619, ret); } else { } if (ret != 0) { printk("\v%s[%u] OFA CM event_handler returned, ret=%d\n", "cm_event_connected", 3623, ret); } else { } attr.qp_state = 3; nes_modify_qp(& nesqp->ibqp, & attr, 1, 0); if ((nes_debug_level & 32U) != 0U) { printk("\viw_nes: %s[%u]: Exiting connect thread for QP%u. jiffies = %lu\n", "cm_event_connected", 3628, nesqp->hwqp.qp_id, jiffies); } else { } return; } } static void cm_event_connect_error(struct nes_cm_event *event ) { struct nes_qp *nesqp ; struct iw_cm_id *cm_id ; struct iw_cm_event cm_event ; int ret ; { if ((unsigned long )event->cm_node == (unsigned long )((struct nes_cm_node *)0)) { return; } else { } cm_id = (event->cm_node)->cm_id; if ((unsigned long )cm_id == (unsigned long )((struct iw_cm_id *)0)) { return; } else { } if ((nes_debug_level & 32U) != 0U) { printk("\viw_nes: %s[%u]: cm_node=%p, cm_id=%p\n", "cm_event_connect_error", 3652, event->cm_node, cm_id); } else { } nesqp = (struct nes_qp *)cm_id->provider_data; if ((unsigned long )nesqp == (unsigned long )((struct nes_qp *)0)) { return; } else { } nesqp->cm_id = 0; cm_id->provider_data = 0; cm_event.event = 2; cm_event.status = -104; cm_event.provider_data = cm_id->provider_data; cm_event.local_addr = cm_id->local_addr; cm_event.remote_addr = cm_id->remote_addr; cm_event.private_data = 0; cm_event.private_data_len = 0U; if ((nes_debug_level & 32U) != 0U) { printk("\viw_nes: %s[%u]: call CM_EVENT REJECTED, local_addr=%08x, remove_addr=%08x\n", "cm_event_connect_error", 3672, cm_event.local_addr.sin_addr.s_addr, cm_event.remote_addr.sin_addr.s_addr); } else { } ret = (*(cm_id->event_handler))(cm_id, & cm_event); if ((nes_debug_level & 32U) != 0U) { printk("\viw_nes: %s[%u]: OFA CM event_handler returned, ret=%d\n", "cm_event_connect_error", 3675, ret); } else { } if (ret != 0) { printk("\v%s[%u] OFA CM event_handler returned, ret=%d\n", "cm_event_connect_error", 3678, ret); } else { } (*(cm_id->rem_ref))(cm_id); rem_ref_cm_node((event->cm_node)->cm_core, event->cm_node); return; } } static void cm_event_reset(struct nes_cm_event *event ) { struct nes_qp *nesqp ; struct iw_cm_id *cm_id ; struct iw_cm_event cm_event ; int ret ; { if ((unsigned long )event->cm_node == (unsigned long )((struct nes_cm_node *)0)) { return; } else { } if ((unsigned long )(event->cm_node)->cm_id == (unsigned long )((struct iw_cm_id *)0)) { return; } else { } cm_id = (event->cm_node)->cm_id; if ((nes_debug_level & 32U) != 0U) { printk("\viw_nes: %s[%u]: %p - cm_id = %p\n", "cm_event_reset", 3705, event->cm_node, cm_id); } else { } nesqp = (struct nes_qp *)cm_id->provider_data; if ((unsigned long )nesqp == (unsigned long )((struct nes_qp *)0)) { return; } else { } nesqp->cm_id = 0; cm_event.event = 4; cm_event.status = -104; cm_event.provider_data = cm_id->provider_data; cm_event.local_addr = cm_id->local_addr; cm_event.remote_addr = cm_id->remote_addr; cm_event.private_data = 0; cm_event.private_data_len = 0U; (*(cm_id->add_ref))(cm_id); ret = (*(cm_id->event_handler))(cm_id, & cm_event); atomic_inc(& cm_closes); cm_event.event = 5; cm_event.status = 0; cm_event.provider_data = cm_id->provider_data; cm_event.local_addr = cm_id->local_addr; cm_event.remote_addr = cm_id->remote_addr; cm_event.private_data = 0; cm_event.private_data_len = 0U; if ((nes_debug_level & 32U) != 0U) { printk("\viw_nes: %s[%u]: NODE %p Generating CLOSE\n", "cm_event_reset", 3730, event->cm_node); } else { } ret = (*(cm_id->event_handler))(cm_id, & cm_event); if ((nes_debug_level & 32U) != 0U) { printk("\viw_nes: %s[%u]: OFA CM event_handler returned, ret=%d\n", "cm_event_reset", 3733, ret); } else { } (*(cm_id->rem_ref))(cm_id); return; } } static void cm_event_mpa_req(struct nes_cm_event *event ) { struct iw_cm_id *cm_id ; struct iw_cm_event cm_event ; int ret ; struct nes_cm_node *cm_node ; __u16 tmp ; __u32 tmp___0 ; __u16 tmp___1 ; __u32 tmp___2 ; { cm_node = event->cm_node; if ((unsigned long )cm_node == (unsigned long )((struct nes_cm_node *)0)) { return; } else { } cm_id = cm_node->cm_id; atomic_inc(& cm_connect_reqs); if ((nes_debug_level & 32U) != 0U) { printk("\viw_nes: %s[%u]: cm_node = %p - cm_id = %p, jiffies = %lu\n", "cm_event_mpa_req", 3760, cm_node, cm_id, jiffies); } else { } cm_event.event = 1; cm_event.status = 0; cm_event.provider_data = (void *)cm_node; cm_event.local_addr.sin_family = 2U; tmp = __fswab16((int )event->cm_info.loc_port); cm_event.local_addr.sin_port = tmp; tmp___0 = __fswab32(event->cm_info.loc_addr); cm_event.local_addr.sin_addr.s_addr = tmp___0; cm_event.remote_addr.sin_family = 2U; tmp___1 = __fswab16((int )event->cm_info.rem_port); cm_event.remote_addr.sin_port = tmp___1; tmp___2 = __fswab32(event->cm_info.rem_addr); cm_event.remote_addr.sin_addr.s_addr = tmp___2; cm_event.private_data = (void *)(& cm_node->ldv_52906.mpa_frame_buf); cm_event.private_data_len = (unsigned char )cm_node->mpa_frame_size; cm_event.ird = (u8 )cm_node->ird_size; cm_event.ord = (u8 )cm_node->ord_size; ret = (*(cm_id->event_handler))(cm_id, & cm_event); if (ret != 0) { printk("\v%s[%u] OFA CM event_handler returned, ret=%d\n", "cm_event_mpa_req", 3781, ret); } else { } return; } } static void cm_event_mpa_reject(struct nes_cm_event *event ) { struct iw_cm_id *cm_id ; struct iw_cm_event cm_event ; struct nes_cm_node *cm_node ; int ret ; __u16 tmp ; __u32 tmp___0 ; __u16 tmp___1 ; __u32 tmp___2 ; { cm_node = event->cm_node; if ((unsigned long )cm_node == (unsigned long )((struct nes_cm_node *)0)) { return; } else { } cm_id = cm_node->cm_id; atomic_inc(& cm_connect_reqs); if ((nes_debug_level & 32U) != 0U) { printk("\viw_nes: %s[%u]: cm_node = %p - cm_id = %p, jiffies = %lu\n", "cm_event_mpa_reject", 3800, cm_node, cm_id, jiffies); } else { } cm_event.event = 2; cm_event.status = -111; cm_event.provider_data = cm_id->provider_data; cm_event.local_addr.sin_family = 2U; tmp = __fswab16((int )event->cm_info.loc_port); cm_event.local_addr.sin_port = tmp; tmp___0 = __fswab32(event->cm_info.loc_addr); cm_event.local_addr.sin_addr.s_addr = tmp___0; cm_event.remote_addr.sin_family = 2U; tmp___1 = __fswab16((int )event->cm_info.rem_port); cm_event.remote_addr.sin_port = tmp___1; tmp___2 = __fswab32(event->cm_info.rem_addr); cm_event.remote_addr.sin_addr.s_addr = tmp___2; cm_event.private_data = (void *)(& cm_node->ldv_52906.mpa_frame_buf); cm_event.private_data_len = (unsigned char )cm_node->mpa_frame_size; if ((nes_debug_level & 32U) != 0U) { printk("\viw_nes: %s[%u]: call CM_EVENT_MPA_REJECTED, local_addr=%08x, remove_addr=%08x\n", "cm_event_mpa_reject", 3820, cm_event.local_addr.sin_addr.s_addr, cm_event.remote_addr.sin_addr.s_addr); } else { } ret = (*(cm_id->event_handler))(cm_id, & cm_event); if (ret != 0) { printk("\v%s[%u] OFA CM event_handler returned, ret=%d\n", "cm_event_mpa_reject", 3825, ret); } else { } return; } } static void nes_cm_event_handler(struct work_struct *work ) ; static int nes_cm_post_event(struct nes_cm_event *event ) { struct lock_class_key __key ; atomic_long_t __constr_expr_0 ; { atomic_inc(& ((event->cm_node)->cm_core)->events_posted); add_ref_cm_node(event->cm_node); (*((event->cm_info.ldv_52927.cm_id)->add_ref))(event->cm_info.ldv_52927.cm_id); __init_work(& event->event_work, 0); __constr_expr_0.counter = 4195328L; event->event_work.data = __constr_expr_0; lockdep_init_map(& event->event_work.lockdep_map, "(&event->event_work)", & __key, 0); INIT_LIST_HEAD(& event->event_work.entry); event->event_work.func = & nes_cm_event_handler; if ((nes_debug_level & 32U) != 0U) { printk("\viw_nes: %s[%u]: cm_node=%p queue_work, event=%p\n", "nes_cm_post_event", 3844, event->cm_node, event); } else { } queue_work(((event->cm_node)->cm_core)->event_wq, & event->event_work); if ((nes_debug_level & 32U) != 0U) { printk("\viw_nes: %s[%u]: Exit\n", "nes_cm_post_event", 3848); } else { } return (0); } } static void nes_cm_event_handler(struct work_struct *work ) { struct nes_cm_event *event ; struct work_struct const *__mptr ; struct nes_cm_core *cm_core ; int tmp ; { __mptr = (struct work_struct const *)work; event = (struct nes_cm_event *)__mptr + 0xffffffffffffffd8UL; if (((unsigned long )event == (unsigned long )((struct nes_cm_event *)0) || (unsigned long )event->cm_node == (unsigned long )((struct nes_cm_node *)0)) || (unsigned long )(event->cm_node)->cm_core == (unsigned long )((struct nes_cm_core *)0)) { return; } else { } cm_core = (event->cm_node)->cm_core; if ((nes_debug_level & 32U) != 0U) { tmp = atomic_read((atomic_t const *)(& cm_core->events_posted)); printk("\viw_nes: %s[%u]: event=%p, event->type=%u, events posted=%u\n", "nes_cm_event_handler", 3869, event, (unsigned int )event->type, tmp); } else { } switch ((unsigned int )event->type) { case 2: cm_event_mpa_req(event); if ((nes_debug_level & 32U) != 0U) { printk("\viw_nes: %s[%u]: cm_node=%p CM Event: MPA REQUEST\n", "nes_cm_event_handler", 3875, event->cm_node); } else { } goto ldv_54438; case 9: ; if ((nes_debug_level & 32U) != 0U) { printk("\viw_nes: %s[%u]: cm_node = %p CM Event: RESET\n", "nes_cm_event_handler", 3879, event->cm_node); } else { } cm_event_reset(event); goto ldv_54438; case 7: ; if ((unsigned long )(event->cm_node)->cm_id == (unsigned long )((struct iw_cm_id *)0) || (unsigned int )(event->cm_node)->state != 11U) { goto ldv_54438; } else { } cm_event_connected(event); if ((nes_debug_level & 32U) != 0U) { printk("\viw_nes: %s[%u]: CM Event: CONNECTED\n", "nes_cm_event_handler", 3887); } else { } goto ldv_54438; case 5: ; if ((unsigned long )(event->cm_node)->cm_id == (unsigned long )((struct iw_cm_id *)0) || (unsigned int )(event->cm_node)->state == 11U) { goto ldv_54438; } else { } cm_event_mpa_reject(event); if ((nes_debug_level & 32U) != 0U) { printk("\viw_nes: %s[%u]: CM Event: REJECT\n", "nes_cm_event_handler", 3894); } else { } goto ldv_54438; case 14: ; if ((unsigned long )(event->cm_node)->cm_id == (unsigned long )((struct iw_cm_id *)0) || (unsigned int )(event->cm_node)->state == 11U) { goto ldv_54438; } else { } cm_event_connect_error(event); if ((nes_debug_level & 32U) != 0U) { printk("\viw_nes: %s[%u]: CM Event: ABORTED\n", "nes_cm_event_handler", 3902); } else { } goto ldv_54438; case 10: ; if ((nes_debug_level & 32U) != 0U) { printk("\viw_nes: %s[%u]: CM Event: DROPPED PKT\n", "nes_cm_event_handler", 3905); } else { } goto ldv_54438; default: ; if ((nes_debug_level & 32U) != 0U) { printk("\viw_nes: %s[%u]: CM Event: UNKNOWN EVENT TYPE\n", "nes_cm_event_handler", 3908); } else { } goto ldv_54438; } ldv_54438: atomic_dec(& cm_core->events_posted); (*((event->cm_info.ldv_52927.cm_id)->rem_ref))(event->cm_info.ldv_52927.cm_id); rem_ref_cm_node(cm_core, event->cm_node); kfree((void const *)event); return; } } void ldv_mutex_lock_79(struct mutex *ldv_func_arg1 ) { { ldv_mutex_lock_lock(ldv_func_arg1); mutex_lock(ldv_func_arg1); return; } } void ldv_mutex_unlock_80(struct mutex *ldv_func_arg1 ) { { ldv_mutex_unlock_lock(ldv_func_arg1); mutex_unlock(ldv_func_arg1); return; } } void ldv_mutex_lock_81(struct mutex *ldv_func_arg1 ) { { ldv_mutex_lock_mutex_of_device(ldv_func_arg1); mutex_lock(ldv_func_arg1); return; } } int ldv_mutex_trylock_82(struct mutex *ldv_func_arg1 ) { ldv_func_ret_type___2 ldv_func_res ; int tmp ; int tmp___0 ; { tmp = mutex_trylock(ldv_func_arg1); ldv_func_res = tmp; tmp___0 = ldv_mutex_trylock_mutex_of_device(ldv_func_arg1); return (tmp___0); return (ldv_func_res); } } void ldv_mutex_unlock_83(struct mutex *ldv_func_arg1 ) { { ldv_mutex_unlock_mutex_of_device(ldv_func_arg1); mutex_unlock(ldv_func_arg1); return; } } void ldv_mutex_lock_84(struct mutex *ldv_func_arg1 ) { { ldv_mutex_lock_cred_guard_mutex_of_signal_struct(ldv_func_arg1); mutex_lock(ldv_func_arg1); return; } } void ldv_mutex_unlock_85(struct mutex *ldv_func_arg1 ) { { ldv_mutex_unlock_cred_guard_mutex_of_signal_struct(ldv_func_arg1); mutex_unlock(ldv_func_arg1); return; } } int ldv_mutex_trylock_96(struct mutex *ldv_func_arg1 ) ; void ldv_mutex_unlock_94(struct mutex *ldv_func_arg1 ) ; void ldv_mutex_unlock_97(struct mutex *ldv_func_arg1 ) ; void ldv_mutex_unlock_99(struct mutex *ldv_func_arg1 ) ; void ldv_mutex_lock_93(struct mutex *ldv_func_arg1 ) ; void ldv_mutex_lock_95(struct mutex *ldv_func_arg1 ) ; void ldv_mutex_lock_98(struct mutex *ldv_func_arg1 ) ; __inline static int test_ti_thread_flag(struct thread_info *ti , int flag ) { int tmp ; { tmp = variable_test_bit(flag, (unsigned long const volatile *)(& ti->flags)); return (tmp); } } __inline static dma_addr_t dma_map_single_attrs___1(struct device *dev , void *ptr , size_t size , enum dma_data_direction dir , struct dma_attrs *attrs ) { struct dma_map_ops *ops ; struct dma_map_ops *tmp ; dma_addr_t addr ; int tmp___0 ; long tmp___1 ; unsigned long tmp___2 ; unsigned long tmp___3 ; { tmp = get_dma_ops(dev); ops = tmp; kmemcheck_mark_initialized(ptr, (unsigned int )size); tmp___0 = valid_dma_direction((int )dir); tmp___1 = ldv__builtin_expect(tmp___0 == 0, 0L); if (tmp___1 != 0L) { __asm__ volatile ("1:\tud2\n.pushsection __bug_table,\"a\"\n2:\t.long 1b - 2b, %c0 - 2b\n\t.word %c1, 0\n\t.org 2b+%c2\n.popsection": : "i" ((char *)"include/asm-generic/dma-mapping-common.h"), "i" (19), "i" (12UL)); ldv_18540: ; goto ldv_18540; } else { } tmp___2 = __phys_addr((unsigned long )ptr); addr = (*(ops->map_page))(dev, 0xffffea0000000000UL + (tmp___2 >> 12), (unsigned long )ptr & 4095UL, size, dir, attrs); tmp___3 = __phys_addr((unsigned long )ptr); debug_dma_map_page(dev, 0xffffea0000000000UL + (tmp___3 >> 12), (unsigned long )ptr & 4095UL, size, (int )dir, addr, 1); return (addr); } } __inline static void dma_unmap_single_attrs___0(struct device *dev , dma_addr_t addr , size_t size , enum dma_data_direction dir , struct dma_attrs *attrs ) { struct dma_map_ops *ops ; struct dma_map_ops *tmp ; int tmp___0 ; long tmp___1 ; { tmp = get_dma_ops(dev); ops = tmp; tmp___0 = valid_dma_direction((int )dir); tmp___1 = ldv__builtin_expect(tmp___0 == 0, 0L); if (tmp___1 != 0L) { __asm__ volatile ("1:\tud2\n.pushsection __bug_table,\"a\"\n2:\t.long 1b - 2b, %c0 - 2b\n\t.word %c1, 0\n\t.org 2b+%c2\n.popsection": : "i" ((char *)"include/asm-generic/dma-mapping-common.h"), "i" (36), "i" (12UL)); ldv_18549: ; goto ldv_18549; } else { } if ((unsigned long )ops->unmap_page != (unsigned long )((void (*)(struct device * , dma_addr_t , size_t , enum dma_data_direction , struct dma_attrs * ))0)) { (*(ops->unmap_page))(dev, addr, size, dir, attrs); } else { } debug_dma_unmap_page(dev, addr, size, (int )dir, 1); return; } } __inline static int skb_queue_empty(struct sk_buff_head const *list ) { { return ((unsigned long )((struct sk_buff *)list->next) == (unsigned long )((struct sk_buff *)list)); } } __inline static struct sk_buff *skb_peek(struct sk_buff_head const *list_ ) { struct sk_buff *skb ; { skb = list_->next; if ((unsigned long )skb == (unsigned long )((struct sk_buff *)list_)) { skb = 0; } else { } return (skb); } } __inline static __u32 skb_queue_len(struct sk_buff_head const *list_ ) { { return ((__u32 )list_->qlen); } } __inline static void __skb_queue_head_init(struct sk_buff_head *list ) { struct sk_buff *tmp ; { tmp = (struct sk_buff *)list; list->next = tmp; list->prev = tmp; list->qlen = 0U; return; } } __inline static void skb_queue_head_init(struct sk_buff_head *list ) { struct lock_class_key __key ; { spinlock_check(& list->lock); __raw_spin_lock_init(& list->lock.ldv_5961.rlock, "&(&list->lock)->rlock", & __key); __skb_queue_head_init(list); return; } } extern void skb_insert(struct sk_buff * , struct sk_buff * , struct sk_buff_head * ) ; extern void skb_queue_head(struct sk_buff_head * , struct sk_buff * ) ; extern void skb_queue_tail(struct sk_buff_head * , struct sk_buff * ) ; extern void skb_unlink(struct sk_buff * , struct sk_buff_head * ) ; extern struct sk_buff *skb_dequeue(struct sk_buff_head * ) ; extern void schedule(void) ; extern int wake_up_process(struct task_struct * ) ; __inline static int test_tsk_thread_flag(struct task_struct *tsk , int flag ) { int tmp ; { tmp = test_ti_thread_flag((struct thread_info *)tsk->stack, flag); return (tmp); } } __inline static int signal_pending(struct task_struct *p ) { int tmp ; long tmp___0 ; { tmp = test_tsk_thread_flag(p, 2); tmp___0 = ldv__builtin_expect(tmp != 0, 0L); return ((int )tmp___0); } } extern struct task_struct *kthread_create_on_node(int (*)(void * ) , void * , int , char const * , ...) ; extern int kthread_stop(struct task_struct * ) ; extern bool kthread_should_stop(void) ; __inline static bool before(__u32 seq1 , __u32 seq2 ) { { return ((int )(seq1 - seq2) < 0); } } __inline static dma_addr_t pci_map_single___1(struct pci_dev *hwdev , void *ptr , size_t size , int direction ) { struct device *tmp ; dma_addr_t tmp___0 ; { if ((unsigned long )hwdev != (unsigned long )((struct pci_dev *)0)) { tmp = & hwdev->dev; } else { tmp = 0; } tmp___0 = dma_map_single_attrs___1(tmp, ptr, size, (enum dma_data_direction )direction, 0); return (tmp___0); } } __inline static void pci_unmap_single___0(struct pci_dev *hwdev , dma_addr_t dma_addr , size_t size , int direction ) { struct device *tmp ; { if ((unsigned long )hwdev != (unsigned long )((struct pci_dev *)0)) { tmp = & hwdev->dev; } else { tmp = 0; } dma_unmap_single_attrs___0(tmp, dma_addr, size, (enum dma_data_direction )direction, 0); return; } } atomic_t pau_qps_created ; atomic_t pau_qps_destroyed ; static void nes_replenish_mgt_rq(struct nes_vnic_mgt *mgtvnic ) { unsigned long flags ; dma_addr_t bus_address ; struct sk_buff *skb ; struct nes_hw_nic_rq_wqe *nic_rqe ; struct nes_hw_mgt *nesmgt ; struct nes_device *nesdev ; struct nes_rskb_cb *cb ; u32 rx_wqes_posted ; raw_spinlock_t *tmp ; int tmp___0 ; int tmp___1 ; raw_spinlock_t *tmp___2 ; int tmp___3 ; int tmp___4 ; int tmp___5 ; { rx_wqes_posted = 0U; nesmgt = & mgtvnic->mgt; nesdev = (mgtvnic->nesvnic)->nesdev; tmp = spinlock_check(& nesmgt->rq_lock); flags = _raw_spin_lock_irqsave(tmp); if ((unsigned int )nesmgt->replenishing_rq != 0U) { tmp___0 = atomic_read((atomic_t const *)(& mgtvnic->rx_skbs_needed)); if ((int )nesmgt->rq_size + -1 == tmp___0) { tmp___1 = atomic_read((atomic_t const *)(& mgtvnic->rx_skb_timer_running)); if (tmp___1 == 0) { atomic_set(& mgtvnic->rx_skb_timer_running, 1); spin_unlock_irqrestore(& nesmgt->rq_lock, flags); mgtvnic->rq_wqes_timer.expires = (unsigned long )jiffies + 125UL; add_timer(& mgtvnic->rq_wqes_timer); } else { spin_unlock_irqrestore(& nesmgt->rq_lock, flags); } } else { spin_unlock_irqrestore(& nesmgt->rq_lock, flags); } return; } else { } nesmgt->replenishing_rq = 1U; spin_unlock_irqrestore(& nesmgt->rq_lock, flags); ldv_52813: skb = dev_alloc_skb((unsigned int )(mgtvnic->nesvnic)->max_frame_size); if ((unsigned long )skb != (unsigned long )((struct sk_buff *)0)) { skb->dev = (mgtvnic->nesvnic)->netdev; bus_address = pci_map_single___1(nesdev->pcidev, (void *)skb->data, (size_t )(mgtvnic->nesvnic)->max_frame_size, 2); cb = (struct nes_rskb_cb *)(& skb->cb); cb->busaddr = bus_address; cb->maplen = (u32 )(mgtvnic->nesvnic)->max_frame_size; nic_rqe = nesmgt->rq_vbase + (unsigned long )mgtvnic->mgt.rq_head; nic_rqe->wqe_words[0] = (unsigned int )(mgtvnic->nesvnic)->max_frame_size; nic_rqe->wqe_words[1] = 0U; nic_rqe->wqe_words[2] = (unsigned int )bus_address; nic_rqe->wqe_words[3] = (unsigned int )(bus_address >> 32); nesmgt->rx_skb[(int )nesmgt->rq_head] = skb; nesmgt->rq_head = (u16 )((int )nesmgt->rq_head + 1); nesmgt->rq_head = (u16 )((int )((short )nesmgt->rq_head) & (int )((short )((unsigned int )nesmgt->rq_size + 65535U))); atomic_dec(& mgtvnic->rx_skbs_needed); __asm__ volatile ("": : : "memory"); rx_wqes_posted = rx_wqes_posted + 1U; if (rx_wqes_posted == 255U) { nes_write32(nesdev->regs + 64UL, (rx_wqes_posted << 24) | (u32 )nesmgt->qp_id); rx_wqes_posted = 0U; } else { } } else { tmp___2 = spinlock_check(& nesmgt->rq_lock); flags = _raw_spin_lock_irqsave(tmp___2); tmp___3 = atomic_read((atomic_t const *)(& mgtvnic->rx_skbs_needed)); if ((int )nesmgt->rq_size + -1 == tmp___3) { tmp___4 = atomic_read((atomic_t const *)(& mgtvnic->rx_skb_timer_running)); if (tmp___4 == 0) { atomic_set(& mgtvnic->rx_skb_timer_running, 1); spin_unlock_irqrestore(& nesmgt->rq_lock, flags); mgtvnic->rq_wqes_timer.expires = (unsigned long )jiffies + 125UL; add_timer(& mgtvnic->rq_wqes_timer); } else { spin_unlock_irqrestore(& nesmgt->rq_lock, flags); } } else { spin_unlock_irqrestore(& nesmgt->rq_lock, flags); } goto ldv_52812; } tmp___5 = atomic_read((atomic_t const *)(& mgtvnic->rx_skbs_needed)); if (tmp___5 != 0) { goto ldv_52813; } else { goto ldv_52812; } ldv_52812: __asm__ volatile ("": : : "memory"); if (rx_wqes_posted != 0U) { nes_write32(nesdev->regs + 64UL, (rx_wqes_posted << 24) | (u32 )nesmgt->qp_id); } else { } nesmgt->replenishing_rq = 0U; return; } } static void nes_mgt_rq_wqes_timeout(unsigned long parm ) { struct nes_vnic_mgt *mgtvnic ; int tmp ; { mgtvnic = (struct nes_vnic_mgt *)parm; atomic_set(& mgtvnic->rx_skb_timer_running, 0); tmp = atomic_read((atomic_t const *)(& mgtvnic->rx_skbs_needed)); if (tmp != 0) { nes_replenish_mgt_rq(mgtvnic); } else { } return; } } static void nes_mgt_free_skb(struct nes_device *nesdev , struct sk_buff *skb , u32 dir ) { struct nes_rskb_cb *cb ; { cb = (struct nes_rskb_cb *)(& skb->cb); pci_unmap_single___0(nesdev->pcidev, cb->busaddr, (size_t )cb->maplen, (int )dir); cb->busaddr = 0ULL; dev_kfree_skb_any(skb); return; } } static void nes_download_callback(struct nes_device *nesdev , struct nes_cqp_request *cqp_request ) { struct pau_fpdu_info *fpdu_info ; struct nes_qp *nesqp ; struct sk_buff *skb ; int i ; { fpdu_info = (struct pau_fpdu_info *)cqp_request->ldv_52469.cqp_callback_pointer; nesqp = fpdu_info->nesqp; i = 0; goto ldv_52833; ldv_52832: skb = fpdu_info->frags[i].skb; if ((int )fpdu_info->frags[i].cmplt) { nes_mgt_free_skb(nesdev, skb, 1U); nes_rem_ref_cm_node((struct nes_cm_node *)nesqp->cm_node); } else { } i = i + 1; ldv_52833: ; if ((int )fpdu_info->frag_cnt > i) { goto ldv_52832; } else { goto ldv_52834; } ldv_52834: ; if ((unsigned long )fpdu_info->hdr_vbase != (unsigned long )((void *)0)) { pci_free_consistent(nesdev->pcidev, (size_t )fpdu_info->hdr_len, fpdu_info->hdr_vbase, fpdu_info->hdr_pbase); } else { } kfree((void const *)fpdu_info); return; } } static u32 nes_get_seq(struct sk_buff *skb , u32 *ack , u16 *wnd , u32 *fin_rcvd , u32 *rst_rcvd ) { struct nes_rskb_cb *cb ; struct iphdr *iph ; struct tcphdr *tcph ; __u32 tmp ; __u16 tmp___0 ; __u32 tmp___1 ; { cb = (struct nes_rskb_cb *)(& skb->cb); iph = (struct iphdr *)cb->data_start + 14U; tcph = (struct tcphdr *)iph + (unsigned long )((int )iph->ihl * 4); tmp = __fswab32(tcph->ack_seq); *ack = tmp; tmp___0 = __fswab16((int )tcph->window); *wnd = tmp___0; *fin_rcvd = (u32 )tcph->fin; *rst_rcvd = (u32 )tcph->rst; tmp___1 = __fswab32(tcph->seq); return (tmp___1); } } static struct sk_buff *nes_get_next_skb(struct nes_device *nesdev , struct nes_qp *nesqp , struct sk_buff *skb , u32 nextseq , u32 *ack , u16 *wnd , u32 *fin_rcvd , u32 *rst_rcvd ) { u32 seq ; bool processacks ; struct sk_buff *old_skb ; int tmp ; int tmp___0 ; bool tmp___1 ; { if ((unsigned long )skb != (unsigned long )((struct sk_buff *)0)) { if ((unsigned long )skb->next == (unsigned long )((struct sk_buff *)(& nesqp->pau_list))) { goto out; } else { } skb = skb->next; processacks = 0; } else { tmp = skb_queue_empty((struct sk_buff_head const *)(& nesqp->pau_list)); if (tmp != 0) { goto out; } else { } skb = skb_peek((struct sk_buff_head const *)(& nesqp->pau_list)); processacks = 1; } ldv_52860: tmp___0 = skb_queue_empty((struct sk_buff_head const *)(& nesqp->pau_list)); if (tmp___0 != 0) { goto out; } else { } seq = nes_get_seq(skb, ack, wnd, fin_rcvd, rst_rcvd); if (seq == nextseq) { if (skb->len != 0U || (int )processacks) { goto ldv_52859; } else { } } else { tmp___1 = before(nextseq, seq); if ((int )tmp___1) { goto out; } else { } } old_skb = skb; skb = skb->next; skb_unlink(old_skb, & nesqp->pau_list); nes_mgt_free_skb(nesdev, old_skb, 1U); nes_rem_ref_cm_node((struct nes_cm_node *)nesqp->cm_node); if ((unsigned long )((struct sk_buff *)(& nesqp->pau_list)) == (unsigned long )skb) { goto out; } else { } goto ldv_52860; ldv_52859: ; return (skb); out: ; return (0); } } static int get_fpdu_info(struct nes_device *nesdev , struct nes_qp *nesqp , struct pau_fpdu_info **pau_fpdu_info ) { struct sk_buff *skb ; struct iphdr *iph ; struct tcphdr *tcph ; struct nes_rskb_cb *cb ; struct pau_fpdu_info *fpdu_info ; struct pau_fpdu_frag frags[4U] ; u32 fpdu_len ; u32 tmp_len ; int frag_cnt ; u32 tot_len ; u32 frag_tot ; u32 ack ; u32 fin_rcvd ; u32 rst_rcvd ; u16 wnd ; int i ; int rc ; __u16 tmp ; u32 _min1 ; unsigned int _min2 ; unsigned int tmp___0 ; void *tmp___1 ; size_t __len ; void *__ret ; __u16 tmp___2 ; __u32 tmp___3 ; __u32 tmp___4 ; __u16 tmp___5 ; size_t __len___0 ; void *__ret___0 ; int tmp___6 ; __u32 tmp___7 ; { fpdu_info = 0; fpdu_len = 0U; frag_cnt = 0; rc = 0; *pau_fpdu_info = 0; skb = nes_get_next_skb(nesdev, nesqp, 0, nesqp->pau_rcv_nxt, & ack, & wnd, & fin_rcvd, & rst_rcvd); if ((unsigned long )skb == (unsigned long )((struct sk_buff *)0)) { goto out; } else { } cb = (struct nes_rskb_cb *)(& skb->cb); if (skb->len != 0U) { tmp = __fswab16((int )*((__be16 *)skb->data)); fpdu_len = (u32 )((int )tmp + 6); fpdu_len = (fpdu_len + 3U) & 4294967292U; tmp_len = fpdu_len; frag_tot = 0U; memset((void *)(& frags), 0, 96UL); i = 0; goto ldv_52892; ldv_52891: frags[i].physaddr = cb->busaddr; frags[i].physaddr = frags[i].physaddr + (unsigned long long )((long )skb->data - (long )cb->data_start); _min1 = tmp_len; _min2 = skb->len; if (_min1 < _min2) { tmp___0 = _min1; } else { tmp___0 = _min2; } frags[i].frag_len = tmp___0; frags[i].skb = skb; frags[i].cmplt = skb->len == frags[i].frag_len; frag_tot = frags[i].frag_len + frag_tot; frag_cnt = frag_cnt + 1; tmp_len = tmp_len - frags[i].frag_len; if (tmp_len == 0U) { goto ldv_52887; } else { } skb = nes_get_next_skb(nesdev, nesqp, skb, nesqp->pau_rcv_nxt + frag_tot, & ack, & wnd, & fin_rcvd, & rst_rcvd); if ((unsigned long )skb == (unsigned long )((struct sk_buff *)0)) { goto out; } else { } if (rst_rcvd != 0U) { goto ldv_52889; ldv_52888: skb_unlink(frags[i].skb, & nesqp->pau_list); nes_mgt_free_skb(nesdev, frags[i].skb, 1U); i = i - 1; ldv_52889: ; if (i >= 0) { goto ldv_52888; } else { goto ldv_52890; } ldv_52890: cb = (struct nes_rskb_cb *)(& skb->cb); frags[0].physaddr = cb->busaddr; frags[0].physaddr = frags[0].physaddr + (unsigned long long )((long )skb->data - (long )cb->data_start); frags[0].frag_len = skb->len; frags[0].skb = skb; frags[0].cmplt = 1; frag_cnt = 1; goto ldv_52887; } else { } cb = (struct nes_rskb_cb *)(& skb->cb); i = i + 1; ldv_52892: ; if (i <= 3) { goto ldv_52891; } else { goto ldv_52887; } ldv_52887: ; } else { frags[0].physaddr = cb->busaddr; frags[0].frag_len = 0U; frags[0].skb = skb; frags[0].cmplt = 1; frag_cnt = 1; } tmp___1 = kzalloc(136UL, 32U); fpdu_info = (struct pau_fpdu_info *)tmp___1; if ((unsigned long )fpdu_info == (unsigned long )((struct pau_fpdu_info *)0)) { if ((nes_debug_level & 1048576U) != 0U) { printk("\viw_nes: %s[%u]: Failed to alloc a fpdu_info.\n", "get_fpdu_info", 364); } else { } rc = -12; goto out; } else { } fpdu_info->cqp_request = nes_get_cqp_request(nesdev); if ((unsigned long )fpdu_info->cqp_request == (unsigned long )((struct nes_cqp_request *)0)) { if ((nes_debug_level & 1048576U) != 0U) { printk("\viw_nes: %s[%u]: Failed to get a cqp_request.\n", "get_fpdu_info", 371); } else { } rc = -12; goto out; } else { } cb = (struct nes_rskb_cb *)(& (frags[0].skb)->cb); iph = (struct iphdr *)cb->data_start + 14U; tcph = (struct tcphdr *)iph + (unsigned long )((int )iph->ihl * 4); fpdu_info->hdr_len = (int )((unsigned int )((long )((unsigned char *)tcph + (unsigned long )((int )tcph->doff * 4))) - (unsigned int )((long )cb->data_start)); fpdu_info->data_len = (u16 )fpdu_len; tot_len = ((u32 )fpdu_info->hdr_len + fpdu_len) - 14U; if ((int )frags[0].cmplt) { fpdu_info->hdr_pbase = cb->busaddr; fpdu_info->hdr_vbase = 0; } else { fpdu_info->hdr_vbase = pci_alloc_consistent(nesdev->pcidev, (size_t )fpdu_info->hdr_len, & fpdu_info->hdr_pbase); if ((unsigned long )fpdu_info->hdr_vbase == (unsigned long )((void *)0)) { if ((nes_debug_level & 1048576U) != 0U) { printk("\viw_nes: %s[%u]: Unable to allocate memory for pau first frag\n", "get_fpdu_info", 390); } else { } rc = -12; goto out; } else { } __len = (size_t )fpdu_info->hdr_len; __ret = __builtin_memcpy(fpdu_info->hdr_vbase, (void const *)cb->data_start, __len); iph = (struct iphdr *)fpdu_info->hdr_vbase + 14U; tcph = (struct tcphdr *)iph + (unsigned long )((int )iph->ihl * 4); } tmp___2 = __fswab16((int )((__u16 )tot_len)); iph->tot_len = tmp___2; iph->saddr = 16777343U; tmp___3 = __fswab32(nesqp->pau_rcv_nxt); tcph->seq = tmp___3; tmp___4 = __fswab32(ack); tcph->ack_seq = tmp___4; tmp___5 = __fswab16((int )wnd); tcph->window = tmp___5; nesqp->pau_rcv_nxt = nesqp->pau_rcv_nxt + (fpdu_len + fin_rcvd); __len___0 = 96UL; if (__len___0 > 63UL) { __ret___0 = __memcpy((void *)(& fpdu_info->frags), (void const *)(& frags), __len___0); } else { __ret___0 = __builtin_memcpy((void *)(& fpdu_info->frags), (void const *)(& frags), __len___0); } fpdu_info->frag_cnt = (u16 )frag_cnt; fpdu_info->nesqp = nesqp; *pau_fpdu_info = fpdu_info; i = 0; goto ldv_52901; ldv_52900: cb = (struct nes_rskb_cb *)(& (frags[i].skb)->cb); skb_pull(frags[i].skb, frags[i].frag_len); if ((frags[i].skb)->len == 0U) { tmp___6 = skb_queue_empty((struct sk_buff_head const *)(& nesqp->pau_list)); if (tmp___6 == 0) { skb_unlink(frags[i].skb, & nesqp->pau_list); } else { } } else { iph = (struct iphdr *)cb->data_start + 14U; tcph = (struct tcphdr *)iph + (unsigned long )((int )iph->ihl * 4); tmp___7 = __fswab32(nesqp->pau_rcv_nxt); tcph->seq = tmp___7; } i = i + 1; ldv_52901: ; if (i < frag_cnt) { goto ldv_52900; } else { goto ldv_52902; } ldv_52902: ; out: ; if (rc != 0) { if ((unsigned long )fpdu_info != (unsigned long )((struct pau_fpdu_info *)0)) { if ((unsigned long )fpdu_info->cqp_request != (unsigned long )((struct nes_cqp_request *)0)) { nes_put_cqp_request(nesdev, fpdu_info->cqp_request); } else { } kfree((void const *)fpdu_info); } else { } } else { } return (rc); } } static int forward_fpdus(struct nes_vnic *nesvnic , struct nes_qp *nesqp ) { struct nes_device *nesdev ; struct pau_fpdu_info *fpdu_info ; struct nes_hw_cqp_wqe *cqp_wqe ; struct nes_cqp_request *cqp_request ; unsigned long flags ; u64 u64tmp ; u32 u32tmp ; int rc ; raw_spinlock_t *tmp ; { nesdev = nesvnic->nesdev; ldv_52918: tmp = spinlock_check(& nesqp->pau_lock); flags = _raw_spin_lock_irqsave(tmp); rc = get_fpdu_info(nesdev, nesqp, & fpdu_info); if (rc != 0 || (unsigned long )fpdu_info == (unsigned long )((struct pau_fpdu_info *)0)) { spin_unlock_irqrestore(& nesqp->pau_lock, flags); return (rc); } else { } cqp_request = fpdu_info->cqp_request; cqp_wqe = & cqp_request->cqp_wqe; nes_fill_init_cqp_wqe(cqp_wqe, nesdev); set_wqe_32bit_value((__le32 *)(& cqp_wqe->wqe_words), 0U, ((unsigned int )nesvnic->logical_port << 26) | 16U); u32tmp = (u32 )(fpdu_info->hdr_len << 16); u32tmp = ((unsigned int )fpdu_info->hdr_len + (unsigned int )fpdu_info->data_len) | u32tmp; set_wqe_32bit_value((__le32 *)(& cqp_wqe->wqe_words), 3U, u32tmp); u32tmp = (fpdu_info->frags[1].frag_len << 16) | fpdu_info->frags[0].frag_len; set_wqe_32bit_value((__le32 *)(& cqp_wqe->wqe_words), 4U, u32tmp); u32tmp = (fpdu_info->frags[3].frag_len << 16) | fpdu_info->frags[2].frag_len; set_wqe_32bit_value((__le32 *)(& cqp_wqe->wqe_words), 5U, u32tmp); u64tmp = fpdu_info->hdr_pbase; set_wqe_32bit_value((__le32 *)(& cqp_wqe->wqe_words), 6U, (unsigned int )u64tmp); set_wqe_32bit_value((__le32 *)(& cqp_wqe->wqe_words), 7U, (unsigned int )(u64tmp >> 32ULL)); set_wqe_32bit_value((__le32 *)(& cqp_wqe->wqe_words), 8U, (unsigned int )fpdu_info->frags[0].physaddr); set_wqe_32bit_value((__le32 *)(& cqp_wqe->wqe_words), 9U, (unsigned int )(fpdu_info->frags[0].physaddr >> 32ULL)); set_wqe_32bit_value((__le32 *)(& cqp_wqe->wqe_words), 10U, (unsigned int )fpdu_info->frags[1].physaddr); set_wqe_32bit_value((__le32 *)(& cqp_wqe->wqe_words), 11U, (unsigned int )(fpdu_info->frags[1].physaddr >> 32ULL)); set_wqe_32bit_value((__le32 *)(& cqp_wqe->wqe_words), 12U, (unsigned int )fpdu_info->frags[2].physaddr); set_wqe_32bit_value((__le32 *)(& cqp_wqe->wqe_words), 13U, (unsigned int )(fpdu_info->frags[2].physaddr >> 32ULL)); set_wqe_32bit_value((__le32 *)(& cqp_wqe->wqe_words), 14U, (unsigned int )fpdu_info->frags[3].physaddr); set_wqe_32bit_value((__le32 *)(& cqp_wqe->wqe_words), 15U, (unsigned int )(fpdu_info->frags[3].physaddr >> 32ULL)); cqp_request->ldv_52469.cqp_callback_pointer = (void *)fpdu_info; cqp_request->callback = 1U; cqp_request->cqp_callback = & nes_download_callback; atomic_set(& cqp_request->refcount, 1); nes_post_cqp_request(nesdev, cqp_request); spin_unlock_irqrestore(& nesqp->pau_lock, flags); goto ldv_52918; return (0); } } static void process_fpdus(struct nes_vnic *nesvnic , struct nes_qp *nesqp ) { int again ; unsigned long flags ; raw_spinlock_t *tmp ; { again = 1; ldv_52928: forward_fpdus(nesvnic, nesqp); tmp = spinlock_check(& nesqp->pau_lock); flags = _raw_spin_lock_irqsave(tmp); if ((unsigned int )nesqp->pau_pending != 0U) { nesqp->pau_pending = 0U; } else { nesqp->pau_busy = 0U; again = 0; } spin_unlock_irqrestore(& nesqp->pau_lock, flags); if (again != 0) { goto ldv_52928; } else { goto ldv_52929; } ldv_52929: ; return; } } static void queue_fpdus(struct sk_buff *skb , struct nes_vnic *nesvnic , struct nes_qp *nesqp ) { struct sk_buff *tmpskb ; struct nes_rskb_cb *cb ; struct iphdr *iph ; struct tcphdr *tcph ; unsigned char *tcph_end ; u32 rcv_nxt ; u32 rcv_wnd ; u32 seqnum ; u32 len ; bool process_it ; unsigned long flags ; __u32 tmp ; __u16 tmp___0 ; bool tmp___1 ; int tmp___2 ; raw_spinlock_t *tmp___3 ; bool tmp___4 ; __u32 tmp___5 ; { process_it = 0; iph = (struct iphdr *)skb->data; tcph = (struct tcphdr *)iph + (unsigned long )((int )iph->ihl * 4); tmp = __fswab32(tcph->seq); seqnum = tmp; tcph_end = (unsigned char *)tcph + (unsigned long )((int )tcph->doff * 4); tmp___0 = __fswab16((int )iph->tot_len); len = (u32 )tmp___0; if (skb->len > len) { skb_trim(skb, len); } else { } skb_pull(skb, (unsigned int )((long )tcph_end) - (unsigned int )((long )skb->data)); cb = (struct nes_rskb_cb *)(& skb->cb); cb->seqnum = seqnum; rcv_nxt = nesqp->pau_rcv_nxt; rcv_wnd = (nesqp->nesqp_context)->rcv_wnd; tmp___1 = between(seqnum, rcv_nxt, rcv_nxt + rcv_wnd); if (tmp___1) { tmp___2 = 0; } else { tmp___2 = 1; } if (tmp___2) { nes_mgt_free_skb(nesvnic->nesdev, skb, 1U); nes_rem_ref_cm_node((struct nes_cm_node *)nesqp->cm_node); return; } else { } tmp___3 = spinlock_check(& nesqp->pau_lock); flags = _raw_spin_lock_irqsave(tmp___3); if ((unsigned int )nesqp->pau_busy != 0U) { nesqp->pau_pending = 1U; } else { nesqp->pau_busy = 1U; } tmp___5 = skb_queue_len((struct sk_buff_head const *)(& nesqp->pau_list)); if (tmp___5 == 0U) { skb_queue_head(& nesqp->pau_list, skb); } else { tmpskb = nesqp->pau_list.next; goto ldv_52951; ldv_52950: cb = (struct nes_rskb_cb *)(& tmpskb->cb); tmp___4 = before(seqnum, cb->seqnum); if ((int )tmp___4) { goto ldv_52949; } else { } tmpskb = tmpskb->next; ldv_52951: ; if ((unsigned long )((struct sk_buff *)(& nesqp->pau_list)) != (unsigned long )tmpskb) { goto ldv_52950; } else { goto ldv_52949; } ldv_52949: skb_insert(tmpskb, skb, & nesqp->pau_list); } if ((unsigned int )nesqp->pau_state == 2U) { process_it = 1; } else { } spin_unlock_irqrestore(& nesqp->pau_lock, flags); if ((int )process_it) { process_fpdus(nesvnic, nesqp); } else { } return; } } static int mgt_thread(void *context ) { struct nes_vnic *nesvnic ; struct sk_buff *skb ; struct nes_rskb_cb *cb ; int __ret ; wait_queue_t __wait ; struct task_struct *tmp ; __u32 tmp___0 ; bool tmp___1 ; struct task_struct *tmp___2 ; int tmp___3 ; __u32 tmp___4 ; bool tmp___5 ; int tmp___6 ; __u32 tmp___7 ; bool tmp___8 ; int tmp___9 ; bool tmp___10 ; int tmp___11 ; __u32 tmp___12 ; { nesvnic = (struct nes_vnic *)context; goto ldv_52968; ldv_52967: __ret = 0; tmp___4 = skb_queue_len((struct sk_buff_head const *)(& nesvnic->mgt_skb_list)); if (tmp___4 == 0U) { tmp___5 = kthread_should_stop(); if (tmp___5) { tmp___6 = 0; } else { tmp___6 = 1; } if (tmp___6) { tmp = get_current(); __wait.flags = 0U; __wait.private = (void *)tmp; __wait.func = & autoremove_wake_function; __wait.task_list.next = & __wait.task_list; __wait.task_list.prev = & __wait.task_list; ldv_52962: prepare_to_wait(& nesvnic->mgt_wait_queue, & __wait, 1); tmp___0 = skb_queue_len((struct sk_buff_head const *)(& nesvnic->mgt_skb_list)); if (tmp___0 != 0U) { goto ldv_52960; } else { tmp___1 = kthread_should_stop(); if ((int )tmp___1) { goto ldv_52960; } else { } } tmp___2 = get_current(); tmp___3 = signal_pending(tmp___2); if (tmp___3 == 0) { schedule(); goto ldv_52961; } else { } __ret = -512; goto ldv_52960; ldv_52961: ; goto ldv_52962; ldv_52960: finish_wait(& nesvnic->mgt_wait_queue, & __wait); } else { } } else { } goto ldv_52965; ldv_52964: skb = skb_dequeue(& nesvnic->mgt_skb_list); cb = (struct nes_rskb_cb *)(& skb->cb); cb->data_start = skb->data + 0xfffffffffffffff2UL; cb->busaddr = pci_map_single___1((nesvnic->nesdev)->pcidev, (void *)cb->data_start, (size_t )nesvnic->max_frame_size, 1); queue_fpdus(skb, nesvnic, cb->nesqp); ldv_52965: tmp___7 = skb_queue_len((struct sk_buff_head const *)(& nesvnic->mgt_skb_list)); if (tmp___7 != 0U) { tmp___8 = kthread_should_stop(); if (tmp___8) { tmp___9 = 0; } else { tmp___9 = 1; } if (tmp___9) { goto ldv_52964; } else { goto ldv_52966; } } else { goto ldv_52966; } ldv_52966: ; ldv_52968: tmp___10 = kthread_should_stop(); if (tmp___10) { tmp___11 = 0; } else { tmp___11 = 1; } if (tmp___11) { goto ldv_52967; } else { goto ldv_52969; } ldv_52969: ; goto ldv_52971; ldv_52970: skb = skb_dequeue(& nesvnic->mgt_skb_list); cb = (struct nes_rskb_cb *)(& skb->cb); nes_rem_ref_cm_node((struct nes_cm_node *)(cb->nesqp)->cm_node); dev_kfree_skb_any(skb); ldv_52971: tmp___12 = skb_queue_len((struct sk_buff_head const *)(& nesvnic->mgt_skb_list)); if (tmp___12 != 0U) { goto ldv_52970; } else { goto ldv_52972; } ldv_52972: ; return (0); } } void nes_queue_mgt_skbs(struct sk_buff *skb , struct nes_vnic *nesvnic , struct nes_qp *nesqp ) { struct nes_rskb_cb *cb ; { cb = (struct nes_rskb_cb *)(& skb->cb); cb->nesqp = nesqp; skb_queue_tail(& nesvnic->mgt_skb_list, skb); __wake_up(& nesvnic->mgt_wait_queue, 1U, 1, 0); return; } } void nes_destroy_pau_qp(struct nes_device *nesdev , struct nes_qp *nesqp ) { struct sk_buff *skb ; unsigned long flags ; raw_spinlock_t *tmp ; __u32 tmp___0 ; { atomic_inc(& pau_qps_destroyed); tmp = spinlock_check(& nesqp->pau_lock); flags = _raw_spin_lock_irqsave(tmp); goto ldv_52989; ldv_52988: skb = skb_dequeue(& nesqp->pau_list); nes_mgt_free_skb(nesdev, skb, 1U); nes_rem_ref_cm_node((struct nes_cm_node *)nesqp->cm_node); ldv_52989: tmp___0 = skb_queue_len((struct sk_buff_head const *)(& nesqp->pau_list)); if (tmp___0 != 0U) { goto ldv_52988; } else { goto ldv_52990; } ldv_52990: spin_unlock_irqrestore(& nesqp->pau_lock, flags); return; } } static void nes_chg_qh_handler(struct nes_device *nesdev , struct nes_cqp_request *cqp_request ) { struct pau_qh_chg *qh_chg ; struct nes_cqp_request *new_request ; struct nes_hw_cqp_wqe *cqp_wqe ; struct nes_adapter *nesadapter ; struct nes_qp *nesqp ; struct nes_v4_quad nes_quad ; u32 crc_value ; u64 u64temp ; int __ret_warn_on ; long tmp ; int __ret_warn_on___0 ; long tmp___0 ; __u16 tmp___1 ; __u16 tmp___2 ; __u32 tmp___3 ; { qh_chg = (struct pau_qh_chg *)cqp_request->ldv_52469.cqp_callback_pointer; nesadapter = nesdev->nesadapter; nesqp = qh_chg->nesqp; if ((unsigned int )cqp_request->major_code != 0U) { __ret_warn_on = 1; tmp = ldv__builtin_expect(__ret_warn_on != 0, 0L); if (tmp != 0L) { warn_slowpath_fmt("/home/zakharov/workspace/benchmarks/bench_1/work/current--X--drivers/infiniband/hw/nes/iw_nes.ko--X--deg2_cpalinux-3.8-rc1--X--32_7a--X--cpachecker/linux-3.8-rc1/csd_deg_dscv/18/dscv_tempdir/dscv/ri/32_7a/drivers/infiniband/hw/nes/nes_mgt.c.prepared", 694, "iw_nes: Invalid cqp_request major_code=0x%x\n", (int )cqp_request->major_code); } else { } ldv__builtin_expect(__ret_warn_on != 0, 0L); } else { } switch ((int )nesqp->pau_state) { case 0: nesqp->pau_state = 1U; new_request = nes_get_cqp_request(nesdev); if ((unsigned long )new_request == (unsigned long )((struct nes_cqp_request *)0)) { if ((nes_debug_level & 1048576U) != 0U) { printk("\viw_nes: %s[%u]: Failed to get a new_request.\n", "nes_chg_qh_handler", 702); } else { } __ret_warn_on___0 = 1; tmp___0 = ldv__builtin_expect(__ret_warn_on___0 != 0, 0L); if (tmp___0 != 0L) { warn_slowpath_null("/home/zakharov/workspace/benchmarks/bench_1/work/current--X--drivers/infiniband/hw/nes/iw_nes.ko--X--deg2_cpalinux-3.8-rc1--X--32_7a--X--cpachecker/linux-3.8-rc1/csd_deg_dscv/18/dscv_tempdir/dscv/ri/32_7a/drivers/infiniband/hw/nes/nes_mgt.c.prepared", 703); } else { } ldv__builtin_expect(__ret_warn_on___0 != 0, 0L); return; } else { } memset((void *)(& nes_quad), 0, 16UL); nes_quad.DstIpAdrIndex = ((nesdev->pcidev)->devfn & 7U) << 24; nes_quad.SrcIpadr = 16777343U; tmp___1 = __fswab16((int )(nesqp->nesqp_context)->tcpPorts[1]); nes_quad.TcpPorts[0] = tmp___1; tmp___2 = __fswab16((int )(nesqp->nesqp_context)->tcpPorts[0]); nes_quad.TcpPorts[1] = tmp___2; crc_value = get_crc_value(& nes_quad); tmp___3 = __fswab32(~ crc_value); nesqp->hte_index = tmp___3; if ((nes_debug_level & 1048576U) != 0U) { printk("\viw_nes: %s[%u]: new HTE Index = 0x%08X, CRC = 0x%08X\n", "nes_chg_qh_handler", 718, nesqp->hte_index, nesqp->hte_index & nesadapter->hte_index_mask); } else { } nesqp->hte_index = nesqp->hte_index & nesadapter->hte_index_mask; (nesqp->nesqp_context)->hte_index = nesqp->hte_index; (nesqp->nesqp_context)->ip0 = 2130706433U; (nesqp->nesqp_context)->rcv_nxt = nesqp->pau_rcv_nxt; cqp_wqe = & new_request->cqp_wqe; nes_fill_init_cqp_wqe(cqp_wqe, nesdev); set_wqe_32bit_value((__le32 *)(& cqp_wqe->wqe_words), 0U, 536937509U); set_wqe_32bit_value((__le32 *)(& cqp_wqe->wqe_words), 1U, nesqp->hwqp.qp_id); u64temp = nesqp->nesqp_context_pbase; set_wqe_64bit_value((__le32 *)(& cqp_wqe->wqe_words), 6U, u64temp); if ((nes_debug_level & 1048576U) != 0U) { printk("\viw_nes: %s[%u]: Waiting for CQP completion for adding the quad hash.\n", "nes_chg_qh_handler", 734); } else { } new_request->ldv_52469.cqp_callback_pointer = (void *)qh_chg; new_request->callback = 1U; new_request->cqp_callback = & nes_chg_qh_handler; atomic_set(& new_request->refcount, 1); nes_post_cqp_request(nesdev, new_request); goto ldv_53009; case 1: nesqp->pau_state = 2U; process_fpdus(qh_chg->nesvnic, qh_chg->nesqp); kfree((void const *)qh_chg); goto ldv_53009; } ldv_53009: ; return; } } static int nes_change_quad_hash(struct nes_device *nesdev , struct nes_vnic *nesvnic , struct nes_qp *nesqp ) { struct nes_cqp_request *cqp_request ; struct pau_qh_chg *qh_chg ; u64 u64temp ; struct nes_hw_cqp_wqe *cqp_wqe ; int ret ; void *tmp ; { cqp_request = 0; qh_chg = 0; ret = 0; cqp_request = nes_get_cqp_request(nesdev); if ((unsigned long )cqp_request == (unsigned long )((struct nes_cqp_request *)0)) { if ((nes_debug_level & 1048576U) != 0U) { printk("\viw_nes: %s[%u]: Failed to get a cqp_request.\n", "nes_change_quad_hash", 766); } else { } ret = -12; goto chg_qh_err; } else { } tmp = kmalloc(24UL, 32U); qh_chg = (struct pau_qh_chg *)tmp; if ((unsigned long )qh_chg == (unsigned long )((struct pau_qh_chg *)0)) { if ((nes_debug_level & 1048576U) != 0U) { printk("\viw_nes: %s[%u]: Failed to get a cqp_request.\n", "nes_change_quad_hash", 773); } else { } ret = -12; goto chg_qh_err; } else { } qh_chg->nesdev = nesdev; qh_chg->nesvnic = nesvnic; qh_chg->nesqp = nesqp; nesqp->pau_state = 0U; cqp_wqe = & cqp_request->cqp_wqe; nes_fill_init_cqp_wqe(cqp_wqe, nesdev); set_wqe_32bit_value((__le32 *)(& cqp_wqe->wqe_words), 0U, 536953893U); set_wqe_32bit_value((__le32 *)(& cqp_wqe->wqe_words), 1U, nesqp->hwqp.qp_id); u64temp = nesqp->nesqp_context_pbase; set_wqe_64bit_value((__le32 *)(& cqp_wqe->wqe_words), 6U, u64temp); if ((nes_debug_level & 1048576U) != 0U) { printk("\viw_nes: %s[%u]: Waiting for CQP completion for deleting the quad hash.\n", "nes_change_quad_hash", 791); } else { } cqp_request->ldv_52469.cqp_callback_pointer = (void *)qh_chg; cqp_request->callback = 1U; cqp_request->cqp_callback = & nes_chg_qh_handler; atomic_set(& cqp_request->refcount, 1); nes_post_cqp_request(nesdev, cqp_request); return (ret); chg_qh_err: kfree((void const *)qh_chg); if ((unsigned long )cqp_request != (unsigned long )((struct nes_cqp_request *)0)) { nes_put_cqp_request(nesdev, cqp_request); } else { } return (ret); } } static void nes_mgt_ce_handler(struct nes_device *nesdev , struct nes_hw_nic_cq *cq ) { struct nes_vnic_mgt *mgtvnic ; struct nes_hw_nic_cq const *__mptr ; struct nes_adapter *nesadapter ; u32 head ; u32 cq_size ; u32 cqe_count ; u32 cqe_misc ; u32 qp_id ; u32 skbs_needed ; unsigned long context ; struct nes_qp *nesqp ; struct sk_buff *rx_skb ; struct nes_rskb_cb *cb ; struct lock_class_key __key ; int tmp ; { __mptr = (struct nes_hw_nic_cq const *)cq; mgtvnic = (struct nes_vnic_mgt *)__mptr + 0xffffffffffffef90UL; nesadapter = nesdev->nesadapter; cqe_count = 0U; qp_id = 0U; head = (u32 )cq->cq_head; cq_size = (u32 )cq->cq_size; ldv_53043: cqe_misc = (cq->cq_vbase + (unsigned long )head)->cqe_words[3]; if ((int )cqe_misc >= 0) { goto ldv_53041; } else { } nesqp = 0; if ((cqe_misc & 536870912U) != 0U) { qp_id = (cq->cq_vbase + (unsigned long )head)->cqe_words[0]; qp_id = qp_id & 2097151U; if (nesadapter->max_qp > qp_id) { context = (unsigned long )*(nesadapter->qp_table + (unsigned long )(qp_id - 64U)); nesqp = (struct nes_qp *)context; } else { } } else { } if ((unsigned long )nesqp != (unsigned long )((struct nes_qp *)0)) { if ((unsigned int )*((unsigned char *)nesqp + 820UL) == 0U) { nesqp->pau_mode = 1U; nesqp->pau_rcv_nxt = (cq->cq_vbase + (unsigned long )head)->cqe_words[1]; skb_queue_head_init(& nesqp->pau_list); spinlock_check(& nesqp->pau_lock); __raw_spin_lock_init(& nesqp->pau_lock.ldv_5961.rlock, "&(&nesqp->pau_lock)->rlock", & __key); atomic_inc(& pau_qps_created); nes_change_quad_hash(nesdev, mgtvnic->nesvnic, nesqp); } else { } rx_skb = mgtvnic->mgt.rx_skb[(int )mgtvnic->mgt.rq_tail]; rx_skb->len = 0U; skb_put(rx_skb, cqe_misc & 65535U); rx_skb->protocol = eth_type_trans(rx_skb, (mgtvnic->nesvnic)->netdev); cb = (struct nes_rskb_cb *)(& rx_skb->cb); pci_unmap_single___0(nesdev->pcidev, cb->busaddr, (size_t )cb->maplen, 2); cb->busaddr = 0ULL; mgtvnic->mgt.rq_tail = (u16 )((int )mgtvnic->mgt.rq_tail + 1); mgtvnic->mgt.rq_tail = (u16 )((int )((short )mgtvnic->mgt.rq_tail) & (int )((short )((unsigned int )mgtvnic->mgt.rq_size + 65535U))); nes_add_ref_cm_node((struct nes_cm_node *)nesqp->cm_node); nes_queue_mgt_skbs(rx_skb, mgtvnic->nesvnic, nesqp); } else { printk("\viw_nes: Invalid QP %d for packed/unaligned handling\n", qp_id); } (cq->cq_vbase + (unsigned long )head)->cqe_words[3] = 0U; cqe_count = cqe_count + 1U; head = head + 1U; if (head >= cq_size) { head = 0U; } else { } if (cqe_count == 255U) { nes_write32(nesdev->regs + 68UL, (u32 )cq->cq_number | (cqe_count << 16)); nesdev->currcq_count = (int )nesdev->currcq_count + (int )((u16 )cqe_count); cqe_count = 0U; } else { } tmp = atomic_add_return(1, & mgtvnic->rx_skbs_needed); skbs_needed = (u32 )tmp; if ((u32 )((int )mgtvnic->mgt.rq_size >> 1) < skbs_needed) { nes_replenish_mgt_rq(mgtvnic); } else { } goto ldv_53043; ldv_53041: cq->cq_head = (u16 )head; nes_write32(nesdev->regs + 68UL, ((u32 )cq->cq_number | (cqe_count << 16)) | 536870912U); nes_read32((void const *)nesdev->regs + 68U); nesdev->currcq_count = (int )nesdev->currcq_count + (int )((u16 )cqe_count); return; } } int nes_init_mgt_qp(struct nes_device *nesdev , struct net_device *netdev , struct nes_vnic *nesvnic ) { struct nes_vnic_mgt *mgtvnic ; u32 counter ; void *vmem ; dma_addr_t pmem ; struct nes_hw_cqp_wqe *cqp_wqe ; u32 cqp_head ; unsigned long flags ; struct nes_hw_nic_qp_context *mgt_context ; u64 u64temp ; struct nes_hw_nic_rq_wqe *mgt_rqe ; struct sk_buff *skb ; u32 wqe_count ; struct nes_rskb_cb *cb ; u32 mgt_mem_size ; void *mgt_vbase ; dma_addr_t mgt_pbase ; int i ; int ret ; void *tmp ; struct lock_class_key __key ; struct task_struct *__k ; struct task_struct *tmp___0 ; long tmp___1 ; struct lock_class_key __key___0 ; raw_spinlock_t *tmp___2 ; u32 tmp___3 ; u32 tmp___4 ; u32 tmp___5 ; long __ret ; wait_queue_t __wait ; struct task_struct *tmp___6 ; struct lock_class_key __key___1 ; u32 _min1 ; unsigned int _min2 ; unsigned int tmp___7 ; struct nes_vnic_mgt *tmp___8 ; { tmp = kzalloc(17600UL, 208U); mgtvnic = (struct nes_vnic_mgt *)tmp; if ((unsigned long )mgtvnic == (unsigned long )((struct nes_vnic_mgt *)0)) { if ((nes_debug_level & 2U) != 0U) { printk("\viw_nes: %s[%u]: Unable to allocate memory for mgt structure\n", "nes_init_mgt_qp", 924); } else { } return (-12); } else { } mgt_mem_size = 2840U; mgt_mem_size = (mgt_mem_size + 4095U) & 4294963200U; mgt_vbase = pci_alloc_consistent(nesdev->pcidev, (size_t )(mgt_mem_size * 4U), & mgt_pbase); if ((unsigned long )mgt_vbase == (unsigned long )((void *)0)) { kfree((void const *)mgtvnic); if ((nes_debug_level & 2U) != 0U) { printk("\viw_nes: %s[%u]: Unable to allocate memory for mgt host descriptor rings\n", "nes_init_mgt_qp", 938); } else { } return (-12); } else { } nesvnic->mgt_mem_size = mgt_mem_size * 4U; nesvnic->mgt_vbase = mgt_vbase; nesvnic->mgt_pbase = mgt_pbase; skb_queue_head_init(& nesvnic->mgt_skb_list); __init_waitqueue_head(& nesvnic->mgt_wait_queue, "&nesvnic->mgt_wait_queue", & __key); tmp___0 = kthread_create_on_node(& mgt_thread, (void *)nesvnic, -1, "nes_mgt_thread"); __k = tmp___0; tmp___1 = IS_ERR((void const *)__k); if (tmp___1 == 0L) { wake_up_process(__k); } else { } nesvnic->mgt_thread = __k; i = 0; goto ldv_53090; ldv_53089: mgtvnic->nesvnic = nesvnic; mgtvnic->mgt.qp_id = (unsigned int )((int )((u16 )nesdev->mac_index) + (int )((u16 )i)) + 36U; memset(mgt_vbase, 0, (size_t )mgt_mem_size); if ((nes_debug_level & 2U) != 0U) { printk("\viw_nes: %s[%u]: Allocated mgt QP structures at %p (phys = %016lX), size = %u.\n", "nes_init_mgt_qp", 955, mgt_vbase, (unsigned long )mgt_pbase, mgt_mem_size); } else { } vmem = (void *)(((unsigned long )mgt_vbase + 255UL) & 0xffffffffffffff00UL); pmem = (mgt_pbase + 255ULL) & 0xffffffffffffff00ULL; spinlock_check(& mgtvnic->mgt.rq_lock); __raw_spin_lock_init(& mgtvnic->mgt.rq_lock.ldv_5961.rlock, "&(&mgtvnic->mgt.rq_lock)->rlock", & __key___0); mgtvnic->mgt.rq_vbase = (struct nes_hw_nic_rq_wqe *)vmem; mgtvnic->mgt.rq_pbase = pmem; mgtvnic->mgt.rq_head = 0U; mgtvnic->mgt.rq_tail = 0U; mgtvnic->mgt.rq_size = 32U; vmem = vmem + 2048UL; pmem = pmem + 2048ULL; mgtvnic->mgt_cq.cq_number = mgtvnic->mgt.qp_id; mgtvnic->mgt_cq.cq_vbase = (struct nes_hw_nic_cqe volatile *)vmem; mgtvnic->mgt_cq.cq_pbase = pmem; mgtvnic->mgt_cq.cq_head = 0U; mgtvnic->mgt_cq.cq_size = 32U; mgtvnic->mgt_cq.ce_handler = & nes_mgt_ce_handler; tmp___2 = spinlock_check(& nesdev->cqp.lock); flags = _raw_spin_lock_irqsave(tmp___2); cqp_head = (u32 )nesdev->cqp.sq_head; cqp_wqe = nesdev->cqp.sq_vbase + (unsigned long )cqp_head; nes_fill_init_cqp_wqe(cqp_wqe, nesdev); cqp_wqe->wqe_words[0] = ((unsigned int )mgtvnic->mgt_cq.cq_size << 16) | 1027U; cqp_wqe->wqe_words[1] = (unsigned int )mgtvnic->mgt_cq.cq_number | ((unsigned int )nesdev->ceq_index << 16); u64temp = mgtvnic->mgt_cq.cq_pbase; set_wqe_64bit_value((__le32 *)(& cqp_wqe->wqe_words), 6U, u64temp); cqp_wqe->wqe_words[9] = 0U; u64temp = (u64 )(& mgtvnic->mgt_cq); cqp_wqe->wqe_words[8] = (unsigned int )(u64temp >> 1); cqp_wqe->wqe_words[9] = (unsigned int )(u64temp >> 33) & 2147483647U; cqp_wqe->wqe_words[10] = 0U; cqp_head = cqp_head + 1U; if (cqp_head >= (u32 )nesdev->cqp.sq_size) { cqp_head = 0U; } else { } cqp_wqe = nesdev->cqp.sq_vbase + (unsigned long )cqp_head; nes_fill_init_cqp_wqe(cqp_wqe, nesdev); mgt_context = (struct nes_hw_nic_qp_context *)mgtvnic->mgt_cq.cq_vbase + (unsigned long )mgtvnic->mgt_cq.cq_size; mgt_context->context_words[0] = (((nesdev->pcidev)->devfn & 7U) << 12) | 1792U; if ((nes_debug_level & 2U) != 0U) { tmp___3 = nes_read_indexed(nesdev, 768U); tmp___4 = nes_read_indexed(nesdev, 752U); printk("\viw_nes: %s[%u]: RX_WINDOW_BUFFER_PAGE_TABLE_SIZE = 0x%08X, RX_WINDOW_BUFFER_SIZE = 0x%08X\n", "nes_init_mgt_qp", 1016, tmp___4, tmp___3); } else { } tmp___5 = nes_read_indexed(nesdev, 768U); if (tmp___5 != 0U) { mgt_context->context_words[0] = mgt_context->context_words[0] | 229376U; } else { } u64temp = mgtvnic->mgt.rq_pbase; mgt_context->context_words[2] = (unsigned int )u64temp; mgt_context->context_words[3] = (unsigned int )(u64temp >> 32); u64temp = mgtvnic->mgt.rq_pbase; mgt_context->context_words[4] = (unsigned int )u64temp; mgt_context->context_words[5] = (unsigned int )(u64temp >> 32); cqp_wqe->wqe_words[0] = 327680U; cqp_wqe->wqe_words[1] = (unsigned int )mgtvnic->mgt.qp_id; u64temp = mgtvnic->mgt_cq.cq_pbase + (unsigned long long )((unsigned long )mgtvnic->mgt_cq.cq_size * 16UL); set_wqe_64bit_value((__le32 *)(& cqp_wqe->wqe_words), 6U, u64temp); cqp_head = cqp_head + 1U; if (cqp_head >= (u32 )nesdev->cqp.sq_size) { cqp_head = 0U; } else { } nesdev->cqp.sq_head = (u16 )cqp_head; __asm__ volatile ("": : : "memory"); nes_write32(nesdev->regs + 64UL, (u32 )((int )nesdev->cqp.qp_id | 41943040)); spin_unlock_irqrestore(& nesdev->cqp.lock, flags); if ((nes_debug_level & 2U) != 0U) { printk("\viw_nes: %s[%u]: Waiting for create MGT QP%u to complete.\n", "nes_init_mgt_qp", 1045, (int )mgtvnic->mgt.qp_id); } else { } __ret = 1200000L; if ((u32 )nesdev->cqp.sq_tail != cqp_head) { tmp___6 = get_current(); __wait.flags = 0U; __wait.private = (void *)tmp___6; __wait.func = & autoremove_wake_function; __wait.task_list.next = & __wait.task_list; __wait.task_list.prev = & __wait.task_list; ldv_53078: prepare_to_wait(& nesdev->cqp.waitq, & __wait, 2); if ((u32 )nesdev->cqp.sq_tail == cqp_head) { goto ldv_53077; } else { } __ret = schedule_timeout(__ret); if (__ret == 0L) { goto ldv_53077; } else { } goto ldv_53078; ldv_53077: finish_wait(& nesdev->cqp.waitq, & __wait); } else { } ret = (int )__ret; if ((nes_debug_level & 2U) != 0U) { printk("\viw_nes: %s[%u]: Create MGT QP%u completed, wait_event_timeout ret = %u.\n", "nes_init_mgt_qp", 1050, (int )mgtvnic->mgt.qp_id, ret); } else { } if (ret == 0) { if ((nes_debug_level & 2U) != 0U) { printk("\viw_nes: %s[%u]: MGT QP%u create timeout expired\n", "nes_init_mgt_qp", 1052, (int )mgtvnic->mgt.qp_id); } else { } if (i == 0) { pci_free_consistent(nesdev->pcidev, (size_t )nesvnic->mgt_mem_size, nesvnic->mgt_vbase, nesvnic->mgt_pbase); kfree((void const *)mgtvnic); } else { nes_destroy_mgt(nesvnic); } return (-5); } else { } counter = 0U; goto ldv_53081; ldv_53080: skb = dev_alloc_skb((unsigned int )nesvnic->max_frame_size); if ((unsigned long )skb == (unsigned long )((struct sk_buff *)0)) { if ((nes_debug_level & 2U) != 0U) { printk("\viw_nes: %s[%u]: %s: out of memory for receive skb\n", "nes_init_mgt_qp", 1067, (char *)(& netdev->name)); } else { } return (-12); } else { } skb->dev = netdev; pmem = pci_map_single___1(nesdev->pcidev, (void *)skb->data, (size_t )nesvnic->max_frame_size, 2); cb = (struct nes_rskb_cb *)(& skb->cb); cb->busaddr = pmem; cb->maplen = (u32 )nesvnic->max_frame_size; mgt_rqe = mgtvnic->mgt.rq_vbase + (unsigned long )counter; mgt_rqe->wqe_words[0] = (unsigned int )nesvnic->max_frame_size; mgt_rqe->wqe_words[1] = 0U; mgt_rqe->wqe_words[2] = (unsigned int )pmem; mgt_rqe->wqe_words[3] = (unsigned int )(pmem >> 32); mgtvnic->mgt.rx_skb[counter] = skb; counter = counter + 1U; ldv_53081: ; if (counter <= 30U) { goto ldv_53080; } else { goto ldv_53082; } ldv_53082: init_timer_key(& mgtvnic->rq_wqes_timer, 0U, "(&mgtvnic->rq_wqes_timer)", & __key___1); mgtvnic->rq_wqes_timer.function = & nes_mgt_rq_wqes_timeout; mgtvnic->rq_wqes_timer.data = (unsigned long )mgtvnic; wqe_count = 31U; mgtvnic->mgt.rq_head = (u16 )wqe_count; __asm__ volatile ("": : : "memory"); ldv_53087: _min1 = wqe_count; _min2 = 255U; if (_min1 < _min2) { tmp___7 = _min1; } else { tmp___7 = _min2; } counter = tmp___7; wqe_count = wqe_count - counter; nes_write32(nesdev->regs + 64UL, (counter << 24) | (u32 )mgtvnic->mgt.qp_id); if (wqe_count != 0U) { goto ldv_53087; } else { goto ldv_53088; } ldv_53088: nes_write32(nesdev->regs + 68UL, (u32 )((int )mgtvnic->mgt_cq.cq_number | 536870912)); nes_read32((void const *)nesdev->regs + 68U); mgt_vbase = mgt_vbase + (unsigned long )mgt_mem_size; mgt_pbase = (dma_addr_t )mgt_mem_size + mgt_pbase; tmp___8 = mgtvnic; mgtvnic = mgtvnic + 1; nesvnic->mgtvnic[i] = tmp___8; i = i + 1; ldv_53090: ; if (i <= 3) { goto ldv_53089; } else { goto ldv_53091; } ldv_53091: ; return (0); } } void nes_destroy_mgt(struct nes_vnic *nesvnic ) { struct nes_device *nesdev ; struct nes_vnic_mgt *mgtvnic ; struct nes_vnic_mgt *first_mgtvnic ; unsigned long flags ; struct nes_hw_cqp_wqe *cqp_wqe ; u32 cqp_head ; struct sk_buff *rx_skb ; int i ; int ret ; raw_spinlock_t *tmp ; long __ret ; wait_queue_t __wait ; struct task_struct *tmp___0 ; { nesdev = nesvnic->nesdev; kthread_stop(nesvnic->mgt_thread); first_mgtvnic = nesvnic->mgtvnic[0]; i = 0; goto ldv_53118; ldv_53117: mgtvnic = nesvnic->mgtvnic[i]; if ((unsigned long )mgtvnic == (unsigned long )((struct nes_vnic_mgt *)0)) { goto ldv_53104; } else { } goto ldv_53106; ldv_53105: rx_skb = mgtvnic->mgt.rx_skb[(int )mgtvnic->mgt.rq_tail]; nes_mgt_free_skb(nesdev, rx_skb, 2U); mgtvnic->mgt.rq_tail = (u16 )((int )mgtvnic->mgt.rq_tail + 1); mgtvnic->mgt.rq_tail = (u16 )((int )((short )mgtvnic->mgt.rq_tail) & (int )((short )((unsigned int )mgtvnic->mgt.rq_size + 65535U))); ldv_53106: ; if ((int )mgtvnic->mgt.rq_head != (int )mgtvnic->mgt.rq_tail) { goto ldv_53105; } else { goto ldv_53107; } ldv_53107: tmp = spinlock_check(& nesdev->cqp.lock); flags = _raw_spin_lock_irqsave(tmp); cqp_head = (u32 )nesdev->cqp.sq_head; cqp_wqe = nesdev->cqp.sq_vbase + (unsigned long )cqp_head; nes_fill_init_cqp_wqe(cqp_wqe, nesdev); set_wqe_32bit_value((__le32 *)(& cqp_wqe->wqe_words), 0U, 327682U); set_wqe_32bit_value((__le32 *)(& cqp_wqe->wqe_words), 1U, (u32 )mgtvnic->mgt.qp_id); cqp_head = cqp_head + 1U; if (cqp_head >= (u32 )nesdev->cqp.sq_size) { cqp_head = 0U; } else { } cqp_wqe = nesdev->cqp.sq_vbase + (unsigned long )cqp_head; nes_fill_init_cqp_wqe(cqp_wqe, nesdev); set_wqe_32bit_value((__le32 *)(& cqp_wqe->wqe_words), 0U, ((unsigned int )mgtvnic->mgt_cq.cq_size << 16) | 5U); set_wqe_32bit_value((__le32 *)(& cqp_wqe->wqe_words), 1U, (unsigned int )mgtvnic->mgt_cq.cq_number | ((unsigned int )nesdev->ceq_index << 16)); cqp_head = cqp_head + 1U; if (cqp_head >= (u32 )nesdev->cqp.sq_size) { cqp_head = 0U; } else { } nesdev->cqp.sq_head = (u16 )cqp_head; __asm__ volatile ("": : : "memory"); nes_write32(nesdev->regs + 64UL, (u32 )((int )nesdev->cqp.qp_id | 41943040)); spin_unlock_irqrestore(& nesdev->cqp.lock, flags); if ((nes_debug_level & 524288U) != 0U) { printk("\viw_nes: %s[%u]: Waiting for CQP, cqp_head=%u, cqp.sq_head=%u, cqp.sq_tail=%u, cqp.sq_size=%u\n", "nes_destroy_mgt", 1177, cqp_head, (int )nesdev->cqp.sq_head, (int )nesdev->cqp.sq_tail, (int )nesdev->cqp.sq_size); } else { } __ret = 1200000L; if ((u32 )nesdev->cqp.sq_tail != cqp_head) { tmp___0 = get_current(); __wait.flags = 0U; __wait.private = (void *)tmp___0; __wait.func = & autoremove_wake_function; __wait.task_list.next = & __wait.task_list; __wait.task_list.prev = & __wait.task_list; ldv_53115: prepare_to_wait(& nesdev->cqp.waitq, & __wait, 2); if ((u32 )nesdev->cqp.sq_tail == cqp_head) { goto ldv_53114; } else { } __ret = schedule_timeout(__ret); if (__ret == 0L) { goto ldv_53114; } else { } goto ldv_53115; ldv_53114: finish_wait(& nesdev->cqp.waitq, & __wait); } else { } ret = (int )__ret; if ((nes_debug_level & 524288U) != 0U) { printk("\viw_nes: %s[%u]: Destroy MGT QP returned, wait_event_timeout ret = %u, cqp_head=%u, cqp.sq_head=%u, cqp.sq_tail=%u\n", "nes_destroy_mgt", 1184, ret, cqp_head, (int )nesdev->cqp.sq_head, (int )nesdev->cqp.sq_tail); } else { } if (ret == 0) { if ((nes_debug_level & 524288U) != 0U) { printk("\viw_nes: %s[%u]: MGT QP%u destroy timeout expired\n", "nes_destroy_mgt", 1187, (int )mgtvnic->mgt.qp_id); } else { } } else { } nesvnic->mgtvnic[i] = 0; ldv_53104: i = i + 1; ldv_53118: ; if (i <= 3) { goto ldv_53117; } else { goto ldv_53119; } ldv_53119: ; if ((unsigned long )nesvnic->mgt_vbase != (unsigned long )((void *)0)) { pci_free_consistent(nesdev->pcidev, (size_t )nesvnic->mgt_mem_size, nesvnic->mgt_vbase, nesvnic->mgt_pbase); nesvnic->mgt_vbase = 0; nesvnic->mgt_pbase = 0ULL; } else { } kfree((void const *)first_mgtvnic); return; } } void ldv_mutex_lock_93(struct mutex *ldv_func_arg1 ) { { ldv_mutex_lock_lock(ldv_func_arg1); mutex_lock(ldv_func_arg1); return; } } void ldv_mutex_unlock_94(struct mutex *ldv_func_arg1 ) { { ldv_mutex_unlock_lock(ldv_func_arg1); mutex_unlock(ldv_func_arg1); return; } } void ldv_mutex_lock_95(struct mutex *ldv_func_arg1 ) { { ldv_mutex_lock_mutex_of_device(ldv_func_arg1); mutex_lock(ldv_func_arg1); return; } } int ldv_mutex_trylock_96(struct mutex *ldv_func_arg1 ) { ldv_func_ret_type___2 ldv_func_res ; int tmp ; int tmp___0 ; { tmp = mutex_trylock(ldv_func_arg1); ldv_func_res = tmp; tmp___0 = ldv_mutex_trylock_mutex_of_device(ldv_func_arg1); return (tmp___0); return (ldv_func_res); } } void ldv_mutex_unlock_97(struct mutex *ldv_func_arg1 ) { { ldv_mutex_unlock_mutex_of_device(ldv_func_arg1); mutex_unlock(ldv_func_arg1); return; } } void ldv_mutex_lock_98(struct mutex *ldv_func_arg1 ) { { ldv_mutex_lock_cred_guard_mutex_of_signal_struct(ldv_func_arg1); mutex_lock(ldv_func_arg1); return; } } void ldv_mutex_unlock_99(struct mutex *ldv_func_arg1 ) { { ldv_mutex_unlock_cred_guard_mutex_of_signal_struct(ldv_func_arg1); mutex_unlock(ldv_func_arg1); return; } } __inline static void ldv_error(void) __attribute__((__no_instrument_function__)) ; __inline static void ldv_error(void) { { ERROR: __VERIFIER_error(); } } extern int __VERIFIER_nondet_int(void) ; long ldv__builtin_expect(long exp , long c ) { { return (exp); } } void ldv__builtin_trap(void) { { ldv_error(); return; } } static int ldv_mutex_cred_guard_mutex_of_signal_struct ; int ldv_mutex_lock_interruptible_cred_guard_mutex_of_signal_struct(struct mutex *lock ) { int nondetermined ; { if (ldv_mutex_cred_guard_mutex_of_signal_struct == 1) { } else { ldv_error(); } nondetermined = __VERIFIER_nondet_int(); if (nondetermined) { ldv_mutex_cred_guard_mutex_of_signal_struct = 2; return (0); } else { return (-4); } } } int ldv_mutex_lock_killable_cred_guard_mutex_of_signal_struct(struct mutex *lock ) { int nondetermined ; { if (ldv_mutex_cred_guard_mutex_of_signal_struct == 1) { } else { ldv_error(); } nondetermined = __VERIFIER_nondet_int(); if (nondetermined) { ldv_mutex_cred_guard_mutex_of_signal_struct = 2; return (0); } else { return (-4); } } } void ldv_mutex_lock_cred_guard_mutex_of_signal_struct(struct mutex *lock ) { { if (ldv_mutex_cred_guard_mutex_of_signal_struct == 1) { } else { ldv_error(); } ldv_mutex_cred_guard_mutex_of_signal_struct = 2; return; } } int ldv_mutex_trylock_cred_guard_mutex_of_signal_struct(struct mutex *lock ) { int is_mutex_held_by_another_thread ; { if (ldv_mutex_cred_guard_mutex_of_signal_struct == 1) { } else { ldv_error(); } is_mutex_held_by_another_thread = __VERIFIER_nondet_int(); if (is_mutex_held_by_another_thread) { return (0); } else { ldv_mutex_cred_guard_mutex_of_signal_struct = 2; return (1); } } } int ldv_atomic_dec_and_mutex_lock_cred_guard_mutex_of_signal_struct(atomic_t *cnt , struct mutex *lock ) { int atomic_value_after_dec ; { if (ldv_mutex_cred_guard_mutex_of_signal_struct == 1) { } else { ldv_error(); } atomic_value_after_dec = __VERIFIER_nondet_int(); if (atomic_value_after_dec == 0) { ldv_mutex_cred_guard_mutex_of_signal_struct = 2; return (1); } else { } return (0); } } int ldv_mutex_is_locked_cred_guard_mutex_of_signal_struct(struct mutex *lock ) { int nondetermined ; { if (ldv_mutex_cred_guard_mutex_of_signal_struct == 1) { nondetermined = __VERIFIER_nondet_int(); if (nondetermined) { return (0); } else { return (1); } } else { return (1); } } } void ldv_mutex_unlock_cred_guard_mutex_of_signal_struct(struct mutex *lock ) { { if (ldv_mutex_cred_guard_mutex_of_signal_struct == 2) { } else { ldv_error(); } ldv_mutex_cred_guard_mutex_of_signal_struct = 1; return; } } static int ldv_mutex_lock ; int ldv_mutex_lock_interruptible_lock(struct mutex *lock ) { int nondetermined ; { if (ldv_mutex_lock == 1) { } else { ldv_error(); } nondetermined = __VERIFIER_nondet_int(); if (nondetermined) { ldv_mutex_lock = 2; return (0); } else { return (-4); } } } int ldv_mutex_lock_killable_lock(struct mutex *lock ) { int nondetermined ; { if (ldv_mutex_lock == 1) { } else { ldv_error(); } nondetermined = __VERIFIER_nondet_int(); if (nondetermined) { ldv_mutex_lock = 2; return (0); } else { return (-4); } } } void ldv_mutex_lock_lock(struct mutex *lock ) { { if (ldv_mutex_lock == 1) { } else { ldv_error(); } ldv_mutex_lock = 2; return; } } int ldv_mutex_trylock_lock(struct mutex *lock ) { int is_mutex_held_by_another_thread ; { if (ldv_mutex_lock == 1) { } else { ldv_error(); } is_mutex_held_by_another_thread = __VERIFIER_nondet_int(); if (is_mutex_held_by_another_thread) { return (0); } else { ldv_mutex_lock = 2; return (1); } } } int ldv_atomic_dec_and_mutex_lock_lock(atomic_t *cnt , struct mutex *lock ) { int atomic_value_after_dec ; { if (ldv_mutex_lock == 1) { } else { ldv_error(); } atomic_value_after_dec = __VERIFIER_nondet_int(); if (atomic_value_after_dec == 0) { ldv_mutex_lock = 2; return (1); } else { } return (0); } } int ldv_mutex_is_locked_lock(struct mutex *lock ) { int nondetermined ; { if (ldv_mutex_lock == 1) { nondetermined = __VERIFIER_nondet_int(); if (nondetermined) { return (0); } else { return (1); } } else { return (1); } } } void ldv_mutex_unlock_lock(struct mutex *lock ) { { if (ldv_mutex_lock == 2) { } else { ldv_error(); } ldv_mutex_lock = 1; return; } } static int ldv_mutex_mutex_of_device ; int ldv_mutex_lock_interruptible_mutex_of_device(struct mutex *lock ) { int nondetermined ; { if (ldv_mutex_mutex_of_device == 1) { } else { ldv_error(); } nondetermined = __VERIFIER_nondet_int(); if (nondetermined) { ldv_mutex_mutex_of_device = 2; return (0); } else { return (-4); } } } int ldv_mutex_lock_killable_mutex_of_device(struct mutex *lock ) { int nondetermined ; { if (ldv_mutex_mutex_of_device == 1) { } else { ldv_error(); } nondetermined = __VERIFIER_nondet_int(); if (nondetermined) { ldv_mutex_mutex_of_device = 2; return (0); } else { return (-4); } } } void ldv_mutex_lock_mutex_of_device(struct mutex *lock ) { { if (ldv_mutex_mutex_of_device == 1) { } else { ldv_error(); } ldv_mutex_mutex_of_device = 2; return; } } int ldv_mutex_trylock_mutex_of_device(struct mutex *lock ) { int is_mutex_held_by_another_thread ; { if (ldv_mutex_mutex_of_device == 1) { } else { ldv_error(); } is_mutex_held_by_another_thread = __VERIFIER_nondet_int(); if (is_mutex_held_by_another_thread) { return (0); } else { ldv_mutex_mutex_of_device = 2; return (1); } } } int ldv_atomic_dec_and_mutex_lock_mutex_of_device(atomic_t *cnt , struct mutex *lock ) { int atomic_value_after_dec ; { if (ldv_mutex_mutex_of_device == 1) { } else { ldv_error(); } atomic_value_after_dec = __VERIFIER_nondet_int(); if (atomic_value_after_dec == 0) { ldv_mutex_mutex_of_device = 2; return (1); } else { } return (0); } } int ldv_mutex_is_locked_mutex_of_device(struct mutex *lock ) { int nondetermined ; { if (ldv_mutex_mutex_of_device == 1) { nondetermined = __VERIFIER_nondet_int(); if (nondetermined) { return (0); } else { return (1); } } else { return (1); } } } void ldv_mutex_unlock_mutex_of_device(struct mutex *lock ) { { if (ldv_mutex_mutex_of_device == 2) { } else { ldv_error(); } ldv_mutex_mutex_of_device = 1; return; } } void ldv_initialize(void) { { ldv_mutex_cred_guard_mutex_of_signal_struct = 1; ldv_mutex_lock = 1; ldv_mutex_mutex_of_device = 1; return; } } void ldv_check_final_state(void) { { if (ldv_mutex_cred_guard_mutex_of_signal_struct == 1) { } else { ldv_error(); } if (ldv_mutex_lock == 1) { } else { ldv_error(); } if (ldv_mutex_mutex_of_device == 1) { } else { ldv_error(); } return; } }