extern void __VERIFIER_error() __attribute__ ((__noreturn__)); /* Generated by CIL v. 1.5.1 */ /* print_CIL_Input is false */ struct kernel_symbol { unsigned long value ; char const *name ; }; struct module; 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 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 __u32 __wsum; typedef __u32 __kernel_dev_t; typedef __kernel_dev_t dev_t; typedef unsigned short umode_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 unsigned int uint; 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 * ) ; }; 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_2043_8 { __ticketpair_t head_tail ; struct __raw_tickets tickets ; }; struct arch_spinlock { union __anonunion_ldv_2043_8 ldv_2043 ; }; typedef struct arch_spinlock arch_spinlock_t; struct __anonstruct_ldv_2050_10 { u32 read ; s32 write ; }; union __anonunion_arch_rwlock_t_9 { s64 lock ; struct __anonstruct_ldv_2050_10 ldv_2050 ; }; 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_2103_12 { unsigned int a ; unsigned int b ; }; struct __anonstruct_ldv_2118_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_2119_11 { struct __anonstruct_ldv_2103_12 ldv_2103 ; struct __anonstruct_ldv_2118_13 ldv_2118 ; }; struct desc_struct { union __anonunion_ldv_2119_11 ldv_2119 ; }; 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_2775_18 { struct pt_regs *regs ; struct kernel_vm86_regs *vm86 ; }; struct math_emu_info { long ___orig_eip ; union __anonunion_ldv_2775_18 ldv_2775 ; }; 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 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 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_5181_23 { u64 rip ; u64 rdp ; }; struct __anonstruct_ldv_5187_24 { u32 fip ; u32 fcs ; u32 foo ; u32 fos ; }; union __anonunion_ldv_5188_22 { struct __anonstruct_ldv_5181_23 ldv_5181 ; struct __anonstruct_ldv_5187_24 ldv_5187 ; }; union __anonunion_ldv_5197_25 { u32 padding1[12U] ; u32 sw_reserved[12U] ; }; struct i387_fxsave_struct { u16 cwd ; u16 swd ; u16 twd ; u16 fop ; union __anonunion_ldv_5188_22 ldv_5188 ; u32 mxcsr ; u32 mxcsr_mask ; u32 st_space[32U] ; u32 xmm_space[64U] ; u32 padding[12U] ; union __anonunion_ldv_5197_25 ldv_5197 ; }; 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 ; }; struct __anonstruct_mm_segment_t_27 { unsigned long seg ; }; typedef struct __anonstruct_mm_segment_t_27 mm_segment_t; 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_6013_29 { u8 __padding[24U] ; struct lockdep_map dep_map ; }; union __anonunion_ldv_6014_28 { struct raw_spinlock rlock ; struct __anonstruct_ldv_6013_29 ldv_6013 ; }; struct spinlock { union __anonunion_ldv_6014_28 ldv_6014 ; }; 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 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_6331_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_6331_31 ldv_6331 ; }; 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 ; }; struct seqcount { unsigned int sequence ; }; typedef struct seqcount seqcount_t; struct __anonstruct_seqlock_t_35 { struct seqcount seqcount ; spinlock_t lock ; }; typedef struct __anonstruct_seqlock_t_35 seqlock_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 ; struct workqueue_struct *wq ; 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 list_head clock_list ; }; 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 ; unsigned char memalloc_noio : 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 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 vm_area_struct; struct device_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_13397_129 { struct ctl_table *ctl_table ; int used ; int count ; int nreg ; }; union __anonunion_ldv_13399_128 { struct __anonstruct_ldv_13397_129 ldv_13397 ; struct callback_head rcu ; }; struct ctl_table_set; struct ctl_table_header { union __anonunion_ldv_13399_128 ldv_13399 ; 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_14191_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_14191_134 ldv_14191 ; }; 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 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, MODULE_STATE_UNFORMED = 3 } ; 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 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 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 lock_class_key lock_key ; }; 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 * , kuid_t * , kgid_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 mem_cgroup; struct kmem_cache_cpu { void **freelist ; unsigned long tid ; struct page *page ; struct page *partial ; unsigned int stat[26U] ; }; struct kmem_cache_order_objects { unsigned long x ; }; struct memcg_cache_params; struct kmem_cache_node; 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 __anonstruct_ldv_15730_136 { 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_15731_135 { struct kmem_cache *memcg_caches[0U] ; struct __anonstruct_ldv_15730_136 ldv_15730 ; }; struct memcg_cache_params { bool is_root_cache ; union __anonunion_ldv_15731_135 ldv_15731 ; }; enum irqreturn { IRQ_NONE = 0, IRQ_HANDLED = 1, IRQ_WAKE_THREAD = 2 } ; typedef enum irqreturn irqreturn_t; struct proc_dir_entry; struct exception_table_entry { int insn ; int fixup ; }; 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[4U] ; }; 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[9U] ; 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_17935_142 { 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 ; u8 msi_cap ; u8 msix_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 ; u8 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] ; bool match_driver ; 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_17935_142 ldv_17935 ; 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 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 msix_entry { u32 vector ; u16 entry ; }; 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 return_instance; struct uprobe; struct uprobe_task { enum uprobe_task_state state ; struct arch_uprobe_task autask ; struct return_instance *return_instances ; unsigned int depth ; 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_19002_144 { unsigned long index ; void *freelist ; bool pfmemalloc ; }; struct __anonstruct_ldv_19012_148 { unsigned short inuse ; unsigned short objects : 15 ; unsigned char frozen : 1 ; }; union __anonunion_ldv_19014_147 { atomic_t _mapcount ; struct __anonstruct_ldv_19012_148 ldv_19012 ; int units ; }; struct __anonstruct_ldv_19016_146 { union __anonunion_ldv_19014_147 ldv_19014 ; atomic_t _count ; }; union __anonunion_ldv_19017_145 { unsigned long counters ; struct __anonstruct_ldv_19016_146 ldv_19016 ; }; struct __anonstruct_ldv_19018_143 { union __anonunion_ldv_19002_144 ldv_19002 ; union __anonunion_ldv_19017_145 ldv_19017 ; }; struct __anonstruct_ldv_19025_150 { struct page *next ; int pages ; int pobjects ; }; struct slab; union __anonunion_ldv_19029_149 { struct list_head lru ; struct __anonstruct_ldv_19025_150 ldv_19025 ; struct list_head list ; struct slab *slab_page ; }; union __anonunion_ldv_19034_151 { unsigned long private ; struct kmem_cache *slab_cache ; struct page *first_page ; }; struct page { unsigned long flags ; struct address_space *mapping ; struct __anonstruct_ldv_19018_143 ldv_19018 ; union __anonunion_ldv_19029_149 ldv_19029 ; union __anonunion_ldv_19034_151 ldv_19034 ; unsigned long debug_flags ; }; struct page_frag { struct page *page ; __u32 offset ; __u32 size ; }; struct __anonstruct_linear_153 { struct rb_node rb ; unsigned long rb_subtree_last ; }; union __anonunion_shared_152 { struct __anonstruct_linear_153 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_152 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 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 sg_table { struct scatterlist *sgl ; unsigned int nents ; unsigned int orig_nents ; }; 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 ; }; struct plist_head { struct list_head node_list ; }; struct plist_node { int prio ; struct list_head prio_list ; struct list_head node_list ; }; 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_154 { 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_154 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 ; }; 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_156 { unsigned int clock_rate ; unsigned int clock_type ; unsigned short loopback ; }; typedef struct __anonstruct_sync_serial_settings_156 sync_serial_settings; struct __anonstruct_te1_settings_157 { unsigned int clock_rate ; unsigned int clock_type ; unsigned short loopback ; unsigned int slot_map ; }; typedef struct __anonstruct_te1_settings_157 te1_settings; struct __anonstruct_raw_hdlc_proto_158 { unsigned short encoding ; unsigned short parity ; }; typedef struct __anonstruct_raw_hdlc_proto_158 raw_hdlc_proto; struct __anonstruct_fr_proto_159 { 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_159 fr_proto; struct __anonstruct_fr_proto_pvc_160 { unsigned int dlci ; }; typedef struct __anonstruct_fr_proto_pvc_160 fr_proto_pvc; struct __anonstruct_fr_proto_pvc_info_161 { unsigned int dlci ; char master[16U] ; }; typedef struct __anonstruct_fr_proto_pvc_info_161 fr_proto_pvc_info; struct __anonstruct_cisco_proto_162 { unsigned int interval ; unsigned int timeout ; }; typedef struct __anonstruct_cisco_proto_162 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_163 { 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_163 ifs_ifsu ; }; union __anonunion_ifr_ifrn_164 { char ifrn_name[16U] ; }; union __anonunion_ifr_ifru_165 { 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_164 ifr_ifrn ; union __anonunion_ifr_ifru_165 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_24254_168 { u32 hash ; u32 len ; }; union __anonunion_ldv_24256_167 { struct __anonstruct_ldv_24254_168 ldv_24254 ; u64 hash_len ; }; struct qstr { union __anonunion_ldv_24256_167 ldv_24256 ; unsigned char const *name ; }; struct dentry_operations; struct super_block; union __anonunion_d_u_169 { 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_169 d_u ; struct list_head d_subdirs ; struct hlist_node d_alias ; }; struct dentry_operations { int (*d_revalidate)(struct dentry * , unsigned int ) ; int (*d_weak_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 semaphore { raw_spinlock_t lock ; unsigned int count ; struct list_head wait_list ; }; 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_25265_171 { kuid_t uid ; kgid_t gid ; kprojid_t projid ; }; struct kqid { union __anonunion_ldv_25265_171 ldv_25265 ; 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_173 { char *buf ; void *data ; }; struct __anonstruct_read_descriptor_t_172 { size_t written ; size_t count ; union __anonunion_arg_173 arg ; int error ; }; typedef struct __anonstruct_read_descriptor_t_172 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_25699_174 { unsigned int const i_nlink ; unsigned int __i_nlink ; }; union __anonunion_ldv_25719_175 { struct hlist_head i_dentry ; struct callback_head i_rcu ; }; struct file_lock; struct cdev; union __anonunion_ldv_25735_176 { 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_25699_174 ldv_25699 ; 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_25719_175 ldv_25719 ; 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_25735_176 ldv_25735 ; __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_177 { struct list_head fu_list ; struct callback_head fu_rcuhead ; }; struct file { union __anonunion_f_u_177 f_u ; struct path f_path ; struct inode *f_inode ; 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_179 { struct list_head link ; int state ; }; union __anonunion_fl_u_178 { struct nfs_lock_info nfs_fl ; struct nfs4_lock_info nfs4_fl ; struct __anonstruct_afs_179 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_178 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_180 { unsigned long sig[1U] ; }; typedef struct __anonstruct_sigset_t_180 sigset_t; struct siginfo; typedef void __signalfn_t(int ); typedef __signalfn_t *__sighandler_t; typedef void __restorefn_t(void); typedef __restorefn_t *__sigrestore_t; union sigval { int sival_int ; void *sival_ptr ; }; typedef union sigval sigval_t; struct __anonstruct__kill_182 { __kernel_pid_t _pid ; __kernel_uid32_t _uid ; }; struct __anonstruct__timer_183 { __kernel_timer_t _tid ; int _overrun ; char _pad[0U] ; sigval_t _sigval ; int _sys_private ; }; struct __anonstruct__rt_184 { __kernel_pid_t _pid ; __kernel_uid32_t _uid ; sigval_t _sigval ; }; struct __anonstruct__sigchld_185 { __kernel_pid_t _pid ; __kernel_uid32_t _uid ; int _status ; __kernel_clock_t _utime ; __kernel_clock_t _stime ; }; struct __anonstruct__sigfault_186 { void *_addr ; short _addr_lsb ; }; struct __anonstruct__sigpoll_187 { long _band ; int _fd ; }; struct __anonstruct__sigsys_188 { void *_call_addr ; int _syscall ; unsigned int _arch ; }; union __anonunion__sifields_181 { int _pad[28U] ; struct __anonstruct__kill_182 _kill ; struct __anonstruct__timer_183 _timer ; struct __anonstruct__rt_184 _rt ; struct __anonstruct__sigchld_185 _sigchld ; struct __anonstruct__sigfault_186 _sigfault ; struct __anonstruct__sigpoll_187 _sigpoll ; struct __anonstruct__sigsys_188 _sigsys ; }; struct siginfo { int si_signo ; int si_errno ; int si_code ; union __anonunion__sifields_181 _sifields ; }; typedef struct siginfo siginfo_t; struct sigpending { struct list_head list ; sigset_t signal ; }; struct sigaction { __sighandler_t sa_handler ; unsigned long sa_flags ; __sigrestore_t sa_restorer ; sigset_t sa_mask ; }; struct k_sigaction { struct sigaction sa ; }; 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 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_28321_191 { struct list_head graveyard_link ; struct rb_node serial_node ; }; struct key_user; union __anonunion_ldv_28330_192 { time_t expiry ; time_t revoked_at ; }; union __anonunion_type_data_193 { struct list_head link ; unsigned long x[2U] ; void *p[2U] ; int reject_error ; }; union __anonunion_payload_194 { unsigned long value ; void *rcudata ; void *data ; struct keyring_list *subscriptions ; }; struct key { atomic_t usage ; key_serial_t serial ; union __anonunion_ldv_28321_191 ldv_28321 ; struct key_type *type ; struct rw_semaphore sem ; struct key_user *user ; void *security ; union __anonunion_ldv_28330_192 ldv_28330 ; 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_193 type_data ; union __anonunion_payload_194 payload ; }; struct audit_context; struct group_info { atomic_t usage ; int ngroups ; int nblocks ; kgid_t small_block[32U] ; kgid_t *blocks[0U] ; }; struct cred { atomic_t usage ; atomic_t subscribers ; void *put_addr ; unsigned int magic ; kuid_t uid ; kgid_t gid ; kuid_t suid ; kgid_t sgid ; kuid_t euid ; kgid_t egid ; kuid_t fsuid ; kgid_t fsgid ; unsigned int securebits ; kernel_cap_t cap_inheritable ; kernel_cap_t cap_permitted ; kernel_cap_t cap_effective ; kernel_cap_t cap_bset ; unsigned char jit_keyring ; struct key *session_keyring ; struct key *process_keyring ; struct key *thread_keyring ; struct key *request_key_auth ; void *security ; struct user_struct *user ; struct user_namespace *user_ns ; struct group_info *group_info ; struct callback_head rcu ; }; 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 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 ; int posix_timer_id ; struct list_head posix_timers ; struct hrtimer real_timer ; struct pid *leader_pid ; ktime_t it_real_incr ; struct cpu_itimer it[2U] ; struct thread_group_cputimer cputimer ; struct task_cputime cputime_expires ; struct list_head cpu_timers[3U] ; struct pid *tty_old_pgrp ; int leader ; struct tty_struct *tty ; struct autogroup *autogroup ; cputime_t utime ; cputime_t stime ; cputime_t cutime ; cputime_t cstime ; cputime_t gtime ; cputime_t cgtime ; struct cputime prev_cputime ; unsigned long nvcsw ; unsigned long nivcsw ; unsigned long cnvcsw ; unsigned long cnivcsw ; unsigned long min_flt ; unsigned long maj_flt ; unsigned long cmin_flt ; unsigned long cmaj_flt ; unsigned long inblock ; unsigned long oublock ; unsigned long cinblock ; unsigned long coublock ; unsigned long maxrss ; unsigned long cmaxrss ; struct task_io_accounting ioac ; unsigned long long sum_sched_runtime ; struct rlimit rlim[16U] ; struct pacct_struct pacct ; struct taskstats *stats ; unsigned int audit_tty ; unsigned int audit_tty_log_passwd ; struct tty_audit_buf *tty_audit_buf ; struct rw_semaphore group_rwsem ; oom_flags_t oom_flags ; short oom_score_adj ; short oom_score_adj_min ; struct mutex cred_guard_mutex ; }; 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 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 long watchdog_stamp ; unsigned int time_slice ; struct sched_rt_entity *back ; struct sched_rt_entity *parent ; struct rt_rq *rt_rq ; struct rt_rq *my_q ; }; struct memcg_batch_info { int do_batch ; struct mem_cgroup *memcg ; unsigned long nr_pages ; unsigned long memsw_nr_pages ; }; struct sched_class; 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 ; unsigned int sequential_io ; unsigned int sequential_io_avg ; }; typedef s32 compat_time_t; typedef s32 compat_long_t; typedef u32 compat_uptr_t; struct compat_timespec { compat_time_t tv_sec ; s32 tv_nsec ; }; 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_23649 { SS_FREE = 0, SS_UNCONNECTED = 1, SS_CONNECTING = 2, SS_CONNECTED = 3, SS_DISCONNECTING = 4 } ; typedef enum ldv_23649 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 in6_addr; struct sk_buff; 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 ; }; typedef unsigned int sk_buff_data_t; struct sec_path; struct __anonstruct_ldv_31655_213 { __u16 csum_start ; __u16 csum_offset ; }; union __anonunion_ldv_31656_212 { __wsum csum ; struct __anonstruct_ldv_31655_213 ldv_31655 ; }; union __anonunion_ldv_31696_214 { __u32 mark ; __u32 dropcount ; __u32 reserved_tailroom ; }; 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_31656_212 ldv_31656 ; __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 ; __be16 vlan_proto ; __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_31696_214 ldv_31696 ; sk_buff_data_t inner_transport_header ; sk_buff_data_t inner_network_header ; sk_buff_data_t inner_mac_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[32U] ; struct u64_stats_sync syncp ; }; struct icmp_mib { unsigned long mibs[28U] ; }; struct icmpmsg_mib { atomic_long_t mibs[512U] ; }; struct icmpv6_mib { unsigned long mibs[6U] ; }; struct icmpv6_mib_device { atomic_long_t mibs[6U] ; }; struct icmpv6msg_mib { atomic_long_t mibs[512U] ; }; struct icmpv6msg_mib_device { atomic_long_t mibs[512U] ; }; struct tcp_mib { unsigned long mibs[16U] ; }; struct udp_mib { unsigned long mibs[8U] ; }; struct linux_mib { unsigned long mibs[95U] ; }; struct linux_xfrm_mib { unsigned long mibs[28U] ; }; 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 ; struct list_head lru_list ; spinlock_t lru_lock ; struct percpu_counter mem ; 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 ctl_table_header *xfrm4_hdr ; struct ipv4_devconf *devconf_all ; struct ipv4_devconf *devconf_dflt ; struct fib_rules_ops *rules_ops ; bool fib_has_custom_rules ; struct fib_table *fib_local ; struct fib_table *fib_main ; struct fib_table *fib_default ; int fib_num_tclassid_users ; struct hlist_head *fib_table_hash ; struct sock *fibnl ; struct sock **icmp_sk ; struct inet_peer_base *peers ; struct tcpm_hash_bucket *tcp_metrics_hash ; unsigned int tcp_metrics_hash_log ; struct netns_frags frags ; struct xt_table *iptable_filter ; struct xt_table *iptable_mangle ; struct xt_table *iptable_raw ; struct xt_table *arptable_filter ; struct xt_table *iptable_security ; struct xt_table *nat_table ; int sysctl_icmp_echo_ignore_all ; int sysctl_icmp_echo_ignore_broadcasts ; int sysctl_icmp_ignore_bogus_error_responses ; int sysctl_icmp_ratelimit ; int sysctl_icmp_ratemask ; int sysctl_icmp_errors_use_inbound_ifaddr ; int sysctl_tcp_ecn ; 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 ; struct ctl_table_header *xfrm6_hdr ; int bindv6only ; int flush_delay ; int ip6_rt_max_size ; int ip6_rt_gc_min_interval ; int ip6_rt_gc_timeout ; int ip6_rt_gc_interval ; int ip6_rt_gc_elasticity ; int ip6_rt_mtu_expires ; int ip6_rt_min_advmss ; int 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 ; atomic_t dev_addr_genid ; }; 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 ; }; union __anonunion_in6_u_217 { __u8 u6_addr8[16U] ; __be16 u6_addr16[8U] ; __be32 u6_addr32[4U] ; }; struct in6_addr { union __anonunion_in6_u_217 in6_u ; }; struct nlattr; struct nf_logger; struct netns_nf { struct proc_dir_entry *proc_netfilter ; struct nf_logger const *nf_loggers[13U] ; struct ctl_table_header *nf_log_dir_header ; }; struct ebt_table; struct netns_xt { struct list_head tables[13U] ; bool notrack_deprecated_warning ; struct ebt_table *broute_table ; struct ebt_table *frame_filter ; struct ebt_table *frame_nat ; }; 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 hlist_nulls_head tmpl ; struct ip_conntrack_stat *stat ; struct nf_ct_event_notifier *nf_conntrack_event_cb ; struct nf_exp_event_notifier *nf_expect_event_cb ; 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 ; unsigned int labels_used ; u8 label_words ; 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_nf nf ; 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 { int prefix ; unsigned long bitmap[4U] ; struct idr_layer *ary[256U] ; int count ; int layer ; struct callback_head callback_head ; }; struct idr { struct idr_layer *hint ; struct idr_layer *top ; struct idr_layer *id_free ; int layers ; int id_free_cnt ; int cur ; spinlock_t lock ; }; struct ida_bitmap { long nr_busy ; unsigned long bitmap[15U] ; }; struct ida { struct idr idr ; struct ida_bitmap *free_bitmap ; }; 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 eventfd_ctx; struct cgroup_subsys_state { struct cgroup *cgroup ; atomic_t refcnt ; unsigned long flags ; struct css_id *id ; struct work_struct dput_work ; }; struct cgroup_name { struct callback_head callback_head ; char name[] ; }; 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_name *name ; struct cgroup_subsys_state *subsys[12U] ; struct cgroupfs_root *root ; 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 work_struct free_work ; struct list_head event_list ; spinlock_t event_list_lock ; struct simple_xattrs xattrs ; }; struct cgroupfs_root { struct super_block *sb ; unsigned long subsys_mask ; int hierarchy_id ; unsigned long actual_subsys_mask ; struct list_head subsys_list ; struct cgroup top_cgroup ; int number_of_cgroups ; struct list_head root_list ; struct list_head allcg_list ; unsigned long flags ; struct ida cgroup_ida ; char release_agent_path[4096U] ; char name[64U] ; }; 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 ; 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 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 ; }; 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 { struct list_head list ; unsigned char addr[32U] ; unsigned char type ; bool global_use ; int sync_cnt ; int refcount ; int synced ; struct callback_head callback_head ; }; 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 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 * , __be16 , u16 ) ; int (*ndo_vlan_rx_kill_vid)(struct net_device * , __be16 , u16 ) ; void (*ndo_poll_controller)(struct net_device * ) ; int (*ndo_netpoll_setup)(struct net_device * , struct netpoll_info * , gfp_t ) ; void (*ndo_netpoll_cleanup)(struct net_device * ) ; int (*ndo_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 nlattr ** , 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 * , u32 ) ; int (*ndo_bridge_dellink)(struct net_device * , struct nlmsghdr * ) ; int (*ndo_change_carrier)(struct net_device * , bool ) ; }; 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; struct pcpu_vstats; union __anonunion_ldv_39147_226 { void *ml_priv ; struct pcpu_lstats *lstats ; struct pcpu_tstats *tstats ; struct pcpu_dstats *dstats ; struct pcpu_vstats *vstats ; }; struct garp_port; struct mrp_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 ; struct list_head upper_dev_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 ; struct netdev_hw_addr_list dev_addrs ; struct kset *queues_kset ; bool uc_promisc ; unsigned int promiscuity ; unsigned int allmulti ; struct vlan_info *vlan_info ; struct dsa_switch_tree *dsa_ptr ; void *atalk_ptr ; struct in_device *ip_ptr ; struct dn_dev *dn_ptr ; struct inet6_dev *ip6_ptr ; void *ax25_ptr ; struct wireless_dev *ieee80211_ptr ; unsigned long last_rx ; unsigned char *dev_addr ; struct netdev_rx_queue *_rx ; unsigned int num_rx_queues ; unsigned int real_num_rx_queues ; rx_handler_func_t *rx_handler ; void *rx_handler_data ; struct netdev_queue *ingress_queue ; unsigned char broadcast[32U] ; struct netdev_queue *_tx ; unsigned int num_tx_queues ; unsigned int real_num_tx_queues ; struct Qdisc *qdisc ; unsigned long tx_queue_len ; spinlock_t tx_global_lock ; struct xps_dev_maps *xps_maps ; struct cpu_rmap *rx_cpu_rmap ; unsigned long trans_start ; int watchdog_timeo ; struct timer_list watchdog_timer ; int *pcpu_refcnt ; struct list_head todo_list ; struct hlist_node index_hlist ; struct list_head link_watch_list ; unsigned char reg_state ; bool dismantle ; unsigned short rtnl_link_state ; void (*destructor)(struct net_device * ) ; struct netpoll_info *npinfo ; struct net *nd_net ; union __anonunion_ldv_39147_226 ldv_39147 ; struct garp_port *garp_port ; struct mrp_port *mrp_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 mii_ioctl_data { __u16 phy_id ; __u16 reg_num ; __u16 val_in ; __u16 val_out ; }; 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 kioctx; typedef int kiocb_cancel_fn(struct kiocb * , struct io_event * ); union __anonunion_ki_obj_231 { void *user ; struct task_struct *tsk ; }; struct kiocb { atomic_t ki_users ; struct file *ki_filp ; struct kioctx *ki_ctx ; kiocb_cancel_fn *ki_cancel ; void (*ki_dtor)(struct kiocb * ) ; union __anonunion_ki_obj_231 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 eventfd_ctx *ki_eventfd ; }; 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 pollfd { int fd ; short events ; short revents ; }; 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 ; }; struct dn_route; union __anonunion_ldv_42737_233 { 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 ; unsigned long expires ; struct dst_entry *path ; struct dst_entry *from ; struct xfrm_state *xfrm ; int (*input)(struct sk_buff * ) ; int (*output)(struct sk_buff * ) ; unsigned short flags ; unsigned short pending_confirm ; short error ; short obsolete ; unsigned short header_len ; unsigned short trailer_len ; __u32 tclassid ; long __pad_to_align_refcnt[2U] ; atomic_t __refcnt ; int __use ; unsigned long lastuse ; union __anonunion_ldv_42737_233 ldv_42737 ; }; struct __anonstruct_socket_lock_t_234 { spinlock_t slock ; int owned ; wait_queue_head_t wq ; struct lockdep_map dep_map ; }; typedef struct __anonstruct_socket_lock_t_234 socket_lock_t; struct proto; typedef __u32 __portpair; typedef __u64 __addrpair; struct __anonstruct_ldv_42956_236 { __be32 skc_daddr ; __be32 skc_rcv_saddr ; }; union __anonunion_ldv_42957_235 { __addrpair skc_addrpair ; struct __anonstruct_ldv_42956_236 ldv_42956 ; }; union __anonunion_ldv_42961_237 { unsigned int skc_hash ; __u16 skc_u16hashes[2U] ; }; struct __anonstruct_ldv_42967_239 { __be16 skc_dport ; __u16 skc_num ; }; union __anonunion_ldv_42968_238 { __portpair skc_portpair ; struct __anonstruct_ldv_42967_239 ldv_42967 ; }; union __anonunion_ldv_42977_240 { struct hlist_node skc_bind_node ; struct hlist_nulls_node skc_portaddr_node ; }; union __anonunion_ldv_42984_241 { struct hlist_node skc_node ; struct hlist_nulls_node skc_nulls_node ; }; struct sock_common { union __anonunion_ldv_42957_235 ldv_42957 ; union __anonunion_ldv_42961_237 ldv_42961 ; union __anonunion_ldv_42968_238 ldv_42968 ; unsigned short skc_family ; unsigned char volatile skc_state ; unsigned char skc_reuse : 4 ; unsigned char skc_reuseport : 4 ; int skc_bound_dev_if ; union __anonunion_ldv_42977_240 ldv_42977 ; struct proto *skc_prot ; struct net *skc_net ; int skc_dontcopy_begin[0U] ; union __anonunion_ldv_42984_241 ldv_42984 ; int skc_tx_queue_mapping ; atomic_t skc_refcnt ; int skc_dontcopy_end[0U] ; }; struct cg_proto; struct __anonstruct_sk_backlog_242 { 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_242 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_243 { 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_243 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_sock_ops { int family ; int obj_size ; struct kmem_cache *slab ; char *slab_name ; int (*rtx_syn_ack)(struct sock * , struct request_sock * ) ; void (*send_ack)(struct sock * , struct sk_buff * , struct request_sock * ) ; void (*send_reset)(struct sock * , struct sk_buff * ) ; void (*destructor)(struct request_sock * ) ; void (*syn_ack_timeout)(struct sock * , struct request_sock * ) ; }; 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 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 in6_addr token ; 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_47463_258 { __be32 a4 ; __be32 a6[4U] ; }; struct inetpeer_addr_base { union __anonunion_ldv_47463_258 ldv_47463 ; }; struct inetpeer_addr { struct inetpeer_addr_base addr ; __u16 family ; }; union __anonunion_ldv_47478_259 { struct list_head gc_list ; struct callback_head gc_rcu ; }; struct __anonstruct_ldv_47483_261 { atomic_t rid ; atomic_t ip_id_count ; }; union __anonunion_ldv_47486_260 { struct __anonstruct_ldv_47483_261 ldv_47483 ; 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_47478_259 ldv_47478 ; union __anonunion_ldv_47486_260 ldv_47486 ; __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 ; }; typedef unsigned char Byte; typedef unsigned int uInt; typedef unsigned long uLong; struct internal_state; struct z_stream_s { Byte const *next_in ; uInt avail_in ; uLong total_in ; Byte *next_out ; uInt avail_out ; uLong total_out ; char *msg ; struct internal_state *state ; void *workspace ; int data_type ; uLong adler ; uLong reserved ; }; typedef struct z_stream_s z_stream; typedef z_stream *z_streamp; struct internal_state { int dummy ; }; struct fcoe_capabilities { u32 capability1 ; u32 capability2 ; u32 capability3 ; u32 capability4 ; }; enum drv_info_opcode { ETH_STATS_OPCODE = 0, FCOE_STATS_OPCODE = 1, ISCSI_STATS_OPCODE = 2 } ; struct eth_stats_info { u8 version[12U] ; u8 mac_local[8U] ; u8 mac_add1[8U] ; u8 mac_add2[8U] ; u32 mtu_size ; u32 feature_flags ; u32 lso_max_size ; u32 lso_min_seg_cnt ; u32 ipv4_ofld_cnt ; u32 ipv6_ofld_cnt ; u32 promiscuous_mode ; u32 txq_size ; u32 rxq_size ; u32 txq_avg_depth ; u32 rxq_avg_depth ; u32 iov_offload ; u32 netq_cnt ; u32 vf_cnt ; }; struct fcoe_stats_info { u8 version[12U] ; u8 mac_local[8U] ; u8 mac_add1[8U] ; u8 mac_add2[8U] ; u32 qos_priority ; u32 txq_size ; u32 rxq_size ; u32 txq_avg_depth ; u32 rxq_avg_depth ; u32 rx_frames_lo ; u32 rx_frames_hi ; u32 rx_bytes_lo ; u32 rx_bytes_hi ; u32 tx_frames_lo ; u32 tx_frames_hi ; u32 tx_bytes_lo ; u32 tx_bytes_hi ; }; struct iscsi_stats_info { u8 version[12U] ; u8 mac_local[8U] ; u8 mac_add1[8U] ; u32 qos_priority ; u8 initiator_name[64U] ; u8 ww_port_name[64U] ; u8 boot_target_name[64U] ; u8 boot_target_ip[16U] ; u32 boot_target_portal ; u8 boot_init_ip[16U] ; u32 max_frame_size ; u32 txq_size ; u32 rxq_size ; u32 txq_avg_depth ; u32 rxq_avg_depth ; u32 rx_pdus_lo ; u32 rx_pdus_hi ; u32 rx_bytes_lo ; u32 rx_bytes_hi ; u32 tx_pdus_lo ; u32 tx_pdus_hi ; u32 tx_bytes_lo ; u32 tx_bytes_hi ; u32 pcp_prior_map_tbl ; }; union drv_info_to_mcp { struct eth_stats_info ether_stat ; struct fcoe_stats_info fcoe_stat ; struct iscsi_stats_info iscsi_stat ; }; enum mf_cfg_afex_vlan_mode { FUNC_MF_CFG_AFEX_VLAN_TRUNK_MODE = 0, FUNC_MF_CFG_AFEX_VLAN_ACCESS_MODE = 1, FUNC_MF_CFG_AFEX_VLAN_TRUNK_TAG_NATIVE_MODE = 2 } ; struct dcbx_ets_feature { u32 enabled ; u32 pg_bw_tbl[2U] ; u32 pri_pg_tbl[1U] ; }; struct dcbx_pfc_feature { u8 enabled ; u8 reserved ; u8 pfc_caps ; u8 pri_en_bitmap ; }; struct dcbx_app_priority_entry { u8 appBitfield ; u8 pri_bitmap ; u16 app_id ; }; struct dcbx_app_priority_feature { u8 enabled ; u8 tc_supported ; u8 default_pri ; u8 reserved ; struct dcbx_app_priority_entry app_pri_tbl[16U] ; }; struct dcbx_features { struct dcbx_ets_feature ets ; struct dcbx_pfc_feature pfc ; struct dcbx_app_priority_feature app ; }; struct emac_stats { u32 rx_stat_ifhcinoctets ; u32 rx_stat_ifhcinbadoctets ; u32 rx_stat_etherstatsfragments ; u32 rx_stat_ifhcinucastpkts ; u32 rx_stat_ifhcinmulticastpkts ; u32 rx_stat_ifhcinbroadcastpkts ; u32 rx_stat_dot3statsfcserrors ; u32 rx_stat_dot3statsalignmenterrors ; u32 rx_stat_dot3statscarriersenseerrors ; u32 rx_stat_xonpauseframesreceived ; u32 rx_stat_xoffpauseframesreceived ; u32 rx_stat_maccontrolframesreceived ; u32 rx_stat_xoffstateentered ; u32 rx_stat_dot3statsframestoolong ; u32 rx_stat_etherstatsjabbers ; u32 rx_stat_etherstatsundersizepkts ; u32 rx_stat_etherstatspkts64octets ; u32 rx_stat_etherstatspkts65octetsto127octets ; u32 rx_stat_etherstatspkts128octetsto255octets ; u32 rx_stat_etherstatspkts256octetsto511octets ; u32 rx_stat_etherstatspkts512octetsto1023octets ; u32 rx_stat_etherstatspkts1024octetsto1522octets ; u32 rx_stat_etherstatspktsover1522octets ; u32 rx_stat_falsecarriererrors ; u32 tx_stat_ifhcoutoctets ; u32 tx_stat_ifhcoutbadoctets ; u32 tx_stat_etherstatscollisions ; u32 tx_stat_outxonsent ; u32 tx_stat_outxoffsent ; u32 tx_stat_flowcontroldone ; u32 tx_stat_dot3statssinglecollisionframes ; u32 tx_stat_dot3statsmultiplecollisionframes ; u32 tx_stat_dot3statsdeferredtransmissions ; u32 tx_stat_dot3statsexcessivecollisions ; u32 tx_stat_dot3statslatecollisions ; u32 tx_stat_ifhcoutucastpkts ; u32 tx_stat_ifhcoutmulticastpkts ; u32 tx_stat_ifhcoutbroadcastpkts ; u32 tx_stat_etherstatspkts64octets ; u32 tx_stat_etherstatspkts65octetsto127octets ; u32 tx_stat_etherstatspkts128octetsto255octets ; u32 tx_stat_etherstatspkts256octetsto511octets ; u32 tx_stat_etherstatspkts512octetsto1023octets ; u32 tx_stat_etherstatspkts1024octetsto1522octets ; u32 tx_stat_etherstatspktsover1522octets ; u32 tx_stat_dot3statsinternalmactransmiterrors ; }; struct bmac1_stats { u32 tx_stat_gtpkt_lo ; u32 tx_stat_gtpkt_hi ; u32 tx_stat_gtxpf_lo ; u32 tx_stat_gtxpf_hi ; u32 tx_stat_gtfcs_lo ; u32 tx_stat_gtfcs_hi ; u32 tx_stat_gtmca_lo ; u32 tx_stat_gtmca_hi ; u32 tx_stat_gtbca_lo ; u32 tx_stat_gtbca_hi ; u32 tx_stat_gtfrg_lo ; u32 tx_stat_gtfrg_hi ; u32 tx_stat_gtovr_lo ; u32 tx_stat_gtovr_hi ; u32 tx_stat_gt64_lo ; u32 tx_stat_gt64_hi ; u32 tx_stat_gt127_lo ; u32 tx_stat_gt127_hi ; u32 tx_stat_gt255_lo ; u32 tx_stat_gt255_hi ; u32 tx_stat_gt511_lo ; u32 tx_stat_gt511_hi ; u32 tx_stat_gt1023_lo ; u32 tx_stat_gt1023_hi ; u32 tx_stat_gt1518_lo ; u32 tx_stat_gt1518_hi ; u32 tx_stat_gt2047_lo ; u32 tx_stat_gt2047_hi ; u32 tx_stat_gt4095_lo ; u32 tx_stat_gt4095_hi ; u32 tx_stat_gt9216_lo ; u32 tx_stat_gt9216_hi ; u32 tx_stat_gt16383_lo ; u32 tx_stat_gt16383_hi ; u32 tx_stat_gtmax_lo ; u32 tx_stat_gtmax_hi ; u32 tx_stat_gtufl_lo ; u32 tx_stat_gtufl_hi ; u32 tx_stat_gterr_lo ; u32 tx_stat_gterr_hi ; u32 tx_stat_gtbyt_lo ; u32 tx_stat_gtbyt_hi ; u32 rx_stat_gr64_lo ; u32 rx_stat_gr64_hi ; u32 rx_stat_gr127_lo ; u32 rx_stat_gr127_hi ; u32 rx_stat_gr255_lo ; u32 rx_stat_gr255_hi ; u32 rx_stat_gr511_lo ; u32 rx_stat_gr511_hi ; u32 rx_stat_gr1023_lo ; u32 rx_stat_gr1023_hi ; u32 rx_stat_gr1518_lo ; u32 rx_stat_gr1518_hi ; u32 rx_stat_gr2047_lo ; u32 rx_stat_gr2047_hi ; u32 rx_stat_gr4095_lo ; u32 rx_stat_gr4095_hi ; u32 rx_stat_gr9216_lo ; u32 rx_stat_gr9216_hi ; u32 rx_stat_gr16383_lo ; u32 rx_stat_gr16383_hi ; u32 rx_stat_grmax_lo ; u32 rx_stat_grmax_hi ; u32 rx_stat_grpkt_lo ; u32 rx_stat_grpkt_hi ; u32 rx_stat_grfcs_lo ; u32 rx_stat_grfcs_hi ; u32 rx_stat_grmca_lo ; u32 rx_stat_grmca_hi ; u32 rx_stat_grbca_lo ; u32 rx_stat_grbca_hi ; u32 rx_stat_grxcf_lo ; u32 rx_stat_grxcf_hi ; u32 rx_stat_grxpf_lo ; u32 rx_stat_grxpf_hi ; u32 rx_stat_grxuo_lo ; u32 rx_stat_grxuo_hi ; u32 rx_stat_grjbr_lo ; u32 rx_stat_grjbr_hi ; u32 rx_stat_grovr_lo ; u32 rx_stat_grovr_hi ; u32 rx_stat_grflr_lo ; u32 rx_stat_grflr_hi ; u32 rx_stat_grmeg_lo ; u32 rx_stat_grmeg_hi ; u32 rx_stat_grmeb_lo ; u32 rx_stat_grmeb_hi ; u32 rx_stat_grbyt_lo ; u32 rx_stat_grbyt_hi ; u32 rx_stat_grund_lo ; u32 rx_stat_grund_hi ; u32 rx_stat_grfrg_lo ; u32 rx_stat_grfrg_hi ; u32 rx_stat_grerb_lo ; u32 rx_stat_grerb_hi ; u32 rx_stat_grfre_lo ; u32 rx_stat_grfre_hi ; u32 rx_stat_gripj_lo ; u32 rx_stat_gripj_hi ; }; struct bmac2_stats { u32 tx_stat_gtpk_lo ; u32 tx_stat_gtpk_hi ; u32 tx_stat_gtxpf_lo ; u32 tx_stat_gtxpf_hi ; u32 tx_stat_gtpp_lo ; u32 tx_stat_gtpp_hi ; u32 tx_stat_gtfcs_lo ; u32 tx_stat_gtfcs_hi ; u32 tx_stat_gtuca_lo ; u32 tx_stat_gtuca_hi ; u32 tx_stat_gtmca_lo ; u32 tx_stat_gtmca_hi ; u32 tx_stat_gtbca_lo ; u32 tx_stat_gtbca_hi ; u32 tx_stat_gtovr_lo ; u32 tx_stat_gtovr_hi ; u32 tx_stat_gtfrg_lo ; u32 tx_stat_gtfrg_hi ; u32 tx_stat_gtpkt1_lo ; u32 tx_stat_gtpkt1_hi ; u32 tx_stat_gt64_lo ; u32 tx_stat_gt64_hi ; u32 tx_stat_gt127_lo ; u32 tx_stat_gt127_hi ; u32 tx_stat_gt255_lo ; u32 tx_stat_gt255_hi ; u32 tx_stat_gt511_lo ; u32 tx_stat_gt511_hi ; u32 tx_stat_gt1023_lo ; u32 tx_stat_gt1023_hi ; u32 tx_stat_gt1518_lo ; u32 tx_stat_gt1518_hi ; u32 tx_stat_gt2047_lo ; u32 tx_stat_gt2047_hi ; u32 tx_stat_gt4095_lo ; u32 tx_stat_gt4095_hi ; u32 tx_stat_gt9216_lo ; u32 tx_stat_gt9216_hi ; u32 tx_stat_gt16383_lo ; u32 tx_stat_gt16383_hi ; u32 tx_stat_gtmax_lo ; u32 tx_stat_gtmax_hi ; u32 tx_stat_gtufl_lo ; u32 tx_stat_gtufl_hi ; u32 tx_stat_gterr_lo ; u32 tx_stat_gterr_hi ; u32 tx_stat_gtbyt_lo ; u32 tx_stat_gtbyt_hi ; u32 rx_stat_gr64_lo ; u32 rx_stat_gr64_hi ; u32 rx_stat_gr127_lo ; u32 rx_stat_gr127_hi ; u32 rx_stat_gr255_lo ; u32 rx_stat_gr255_hi ; u32 rx_stat_gr511_lo ; u32 rx_stat_gr511_hi ; u32 rx_stat_gr1023_lo ; u32 rx_stat_gr1023_hi ; u32 rx_stat_gr1518_lo ; u32 rx_stat_gr1518_hi ; u32 rx_stat_gr2047_lo ; u32 rx_stat_gr2047_hi ; u32 rx_stat_gr4095_lo ; u32 rx_stat_gr4095_hi ; u32 rx_stat_gr9216_lo ; u32 rx_stat_gr9216_hi ; u32 rx_stat_gr16383_lo ; u32 rx_stat_gr16383_hi ; u32 rx_stat_grmax_lo ; u32 rx_stat_grmax_hi ; u32 rx_stat_grpkt_lo ; u32 rx_stat_grpkt_hi ; u32 rx_stat_grfcs_lo ; u32 rx_stat_grfcs_hi ; u32 rx_stat_gruca_lo ; u32 rx_stat_gruca_hi ; u32 rx_stat_grmca_lo ; u32 rx_stat_grmca_hi ; u32 rx_stat_grbca_lo ; u32 rx_stat_grbca_hi ; u32 rx_stat_grxpf_lo ; u32 rx_stat_grxpf_hi ; u32 rx_stat_grpp_lo ; u32 rx_stat_grpp_hi ; u32 rx_stat_grxuo_lo ; u32 rx_stat_grxuo_hi ; u32 rx_stat_grjbr_lo ; u32 rx_stat_grjbr_hi ; u32 rx_stat_grovr_lo ; u32 rx_stat_grovr_hi ; u32 rx_stat_grxcf_lo ; u32 rx_stat_grxcf_hi ; u32 rx_stat_grflr_lo ; u32 rx_stat_grflr_hi ; u32 rx_stat_grpok_lo ; u32 rx_stat_grpok_hi ; u32 rx_stat_grmeg_lo ; u32 rx_stat_grmeg_hi ; u32 rx_stat_grmeb_lo ; u32 rx_stat_grmeb_hi ; u32 rx_stat_grbyt_lo ; u32 rx_stat_grbyt_hi ; u32 rx_stat_grund_lo ; u32 rx_stat_grund_hi ; u32 rx_stat_grfrg_lo ; u32 rx_stat_grfrg_hi ; u32 rx_stat_grerb_lo ; u32 rx_stat_grerb_hi ; u32 rx_stat_grfre_lo ; u32 rx_stat_grfre_hi ; u32 rx_stat_gripj_lo ; u32 rx_stat_gripj_hi ; }; struct __anonstruct_stats_tx_263 { u32 tx_gtxpok_lo ; u32 tx_gtxpok_hi ; u32 tx_gtxpf_lo ; u32 tx_gtxpf_hi ; u32 tx_gtxpp_lo ; u32 tx_gtxpp_hi ; u32 tx_gtfcs_lo ; u32 tx_gtfcs_hi ; u32 tx_gtuca_lo ; u32 tx_gtuca_hi ; u32 tx_gtmca_lo ; u32 tx_gtmca_hi ; u32 tx_gtgca_lo ; u32 tx_gtgca_hi ; u32 tx_gtpkt_lo ; u32 tx_gtpkt_hi ; u32 tx_gt64_lo ; u32 tx_gt64_hi ; u32 tx_gt127_lo ; u32 tx_gt127_hi ; u32 tx_gt255_lo ; u32 tx_gt255_hi ; u32 tx_gt511_lo ; u32 tx_gt511_hi ; u32 tx_gt1023_lo ; u32 tx_gt1023_hi ; u32 tx_gt1518_lo ; u32 tx_gt1518_hi ; u32 tx_gt2047_lo ; u32 tx_gt2047_hi ; u32 tx_gt4095_lo ; u32 tx_gt4095_hi ; u32 tx_gt9216_lo ; u32 tx_gt9216_hi ; u32 tx_gt16383_lo ; u32 tx_gt16383_hi ; u32 tx_gtufl_lo ; u32 tx_gtufl_hi ; u32 tx_gterr_lo ; u32 tx_gterr_hi ; u32 tx_gtbyt_lo ; u32 tx_gtbyt_hi ; u32 tx_collisions_lo ; u32 tx_collisions_hi ; u32 tx_singlecollision_lo ; u32 tx_singlecollision_hi ; u32 tx_multiplecollisions_lo ; u32 tx_multiplecollisions_hi ; u32 tx_deferred_lo ; u32 tx_deferred_hi ; u32 tx_excessivecollisions_lo ; u32 tx_excessivecollisions_hi ; u32 tx_latecollisions_lo ; u32 tx_latecollisions_hi ; }; struct __anonstruct_stats_rx_264 { u32 rx_gr64_lo ; u32 rx_gr64_hi ; u32 rx_gr127_lo ; u32 rx_gr127_hi ; u32 rx_gr255_lo ; u32 rx_gr255_hi ; u32 rx_gr511_lo ; u32 rx_gr511_hi ; u32 rx_gr1023_lo ; u32 rx_gr1023_hi ; u32 rx_gr1518_lo ; u32 rx_gr1518_hi ; u32 rx_gr2047_lo ; u32 rx_gr2047_hi ; u32 rx_gr4095_lo ; u32 rx_gr4095_hi ; u32 rx_gr9216_lo ; u32 rx_gr9216_hi ; u32 rx_gr16383_lo ; u32 rx_gr16383_hi ; u32 rx_grpkt_lo ; u32 rx_grpkt_hi ; u32 rx_grfcs_lo ; u32 rx_grfcs_hi ; u32 rx_gruca_lo ; u32 rx_gruca_hi ; u32 rx_grmca_lo ; u32 rx_grmca_hi ; u32 rx_grbca_lo ; u32 rx_grbca_hi ; u32 rx_grxpf_lo ; u32 rx_grxpf_hi ; u32 rx_grxpp_lo ; u32 rx_grxpp_hi ; u32 rx_grxuo_lo ; u32 rx_grxuo_hi ; u32 rx_grovr_lo ; u32 rx_grovr_hi ; u32 rx_grxcf_lo ; u32 rx_grxcf_hi ; u32 rx_grflr_lo ; u32 rx_grflr_hi ; u32 rx_grpok_lo ; u32 rx_grpok_hi ; u32 rx_grbyt_lo ; u32 rx_grbyt_hi ; u32 rx_grund_lo ; u32 rx_grund_hi ; u32 rx_grfrg_lo ; u32 rx_grfrg_hi ; u32 rx_grerb_lo ; u32 rx_grerb_hi ; u32 rx_grfre_lo ; u32 rx_grfre_hi ; u32 rx_alignmenterrors_lo ; u32 rx_alignmenterrors_hi ; u32 rx_falsecarrier_lo ; u32 rx_falsecarrier_hi ; u32 rx_llfcmsgcnt_lo ; u32 rx_llfcmsgcnt_hi ; }; struct mstat_stats { struct __anonstruct_stats_tx_263 stats_tx ; struct __anonstruct_stats_rx_264 stats_rx ; }; union mac_stats { struct emac_stats emac_stats ; struct bmac1_stats bmac1_stats ; struct bmac2_stats bmac2_stats ; struct mstat_stats mstat_stats ; }; struct mac_stx { u32 rx_stat_ifhcinbadoctets_hi ; u32 rx_stat_ifhcinbadoctets_lo ; u32 tx_stat_ifhcoutbadoctets_hi ; u32 tx_stat_ifhcoutbadoctets_lo ; u32 rx_stat_dot3statsfcserrors_hi ; u32 rx_stat_dot3statsfcserrors_lo ; u32 rx_stat_dot3statsalignmenterrors_hi ; u32 rx_stat_dot3statsalignmenterrors_lo ; u32 rx_stat_dot3statscarriersenseerrors_hi ; u32 rx_stat_dot3statscarriersenseerrors_lo ; u32 rx_stat_falsecarriererrors_hi ; u32 rx_stat_falsecarriererrors_lo ; u32 rx_stat_etherstatsundersizepkts_hi ; u32 rx_stat_etherstatsundersizepkts_lo ; u32 rx_stat_dot3statsframestoolong_hi ; u32 rx_stat_dot3statsframestoolong_lo ; u32 rx_stat_etherstatsfragments_hi ; u32 rx_stat_etherstatsfragments_lo ; u32 rx_stat_etherstatsjabbers_hi ; u32 rx_stat_etherstatsjabbers_lo ; u32 rx_stat_maccontrolframesreceived_hi ; u32 rx_stat_maccontrolframesreceived_lo ; u32 rx_stat_mac_xpf_hi ; u32 rx_stat_mac_xpf_lo ; u32 rx_stat_mac_xcf_hi ; u32 rx_stat_mac_xcf_lo ; u32 rx_stat_xoffstateentered_hi ; u32 rx_stat_xoffstateentered_lo ; u32 rx_stat_xonpauseframesreceived_hi ; u32 rx_stat_xonpauseframesreceived_lo ; u32 rx_stat_xoffpauseframesreceived_hi ; u32 rx_stat_xoffpauseframesreceived_lo ; u32 tx_stat_outxonsent_hi ; u32 tx_stat_outxonsent_lo ; u32 tx_stat_outxoffsent_hi ; u32 tx_stat_outxoffsent_lo ; u32 tx_stat_flowcontroldone_hi ; u32 tx_stat_flowcontroldone_lo ; u32 tx_stat_etherstatscollisions_hi ; u32 tx_stat_etherstatscollisions_lo ; u32 tx_stat_dot3statssinglecollisionframes_hi ; u32 tx_stat_dot3statssinglecollisionframes_lo ; u32 tx_stat_dot3statsmultiplecollisionframes_hi ; u32 tx_stat_dot3statsmultiplecollisionframes_lo ; u32 tx_stat_dot3statsdeferredtransmissions_hi ; u32 tx_stat_dot3statsdeferredtransmissions_lo ; u32 tx_stat_dot3statsexcessivecollisions_hi ; u32 tx_stat_dot3statsexcessivecollisions_lo ; u32 tx_stat_dot3statslatecollisions_hi ; u32 tx_stat_dot3statslatecollisions_lo ; u32 tx_stat_etherstatspkts64octets_hi ; u32 tx_stat_etherstatspkts64octets_lo ; u32 tx_stat_etherstatspkts65octetsto127octets_hi ; u32 tx_stat_etherstatspkts65octetsto127octets_lo ; u32 tx_stat_etherstatspkts128octetsto255octets_hi ; u32 tx_stat_etherstatspkts128octetsto255octets_lo ; u32 tx_stat_etherstatspkts256octetsto511octets_hi ; u32 tx_stat_etherstatspkts256octetsto511octets_lo ; u32 tx_stat_etherstatspkts512octetsto1023octets_hi ; u32 tx_stat_etherstatspkts512octetsto1023octets_lo ; u32 tx_stat_etherstatspkts1024octetsto1522octets_hi ; u32 tx_stat_etherstatspkts1024octetsto1522octets_lo ; u32 tx_stat_etherstatspktsover1522octets_hi ; u32 tx_stat_etherstatspktsover1522octets_lo ; u32 tx_stat_mac_2047_hi ; u32 tx_stat_mac_2047_lo ; u32 tx_stat_mac_4095_hi ; u32 tx_stat_mac_4095_lo ; u32 tx_stat_mac_9216_hi ; u32 tx_stat_mac_9216_lo ; u32 tx_stat_mac_16383_hi ; u32 tx_stat_mac_16383_lo ; u32 tx_stat_dot3statsinternalmactransmiterrors_hi ; u32 tx_stat_dot3statsinternalmactransmiterrors_lo ; u32 tx_stat_mac_ufl_hi ; u32 tx_stat_mac_ufl_lo ; }; struct host_port_stats { u32 host_port_stats_counter ; struct mac_stx mac_stx[2U] ; u32 brb_drop_hi ; u32 brb_drop_lo ; u32 not_used ; u32 pfc_frames_tx_hi ; u32 pfc_frames_tx_lo ; u32 pfc_frames_rx_hi ; u32 pfc_frames_rx_lo ; u32 eee_lpi_count_hi ; u32 eee_lpi_count_lo ; }; struct host_func_stats { u32 host_func_stats_start ; u32 total_bytes_received_hi ; u32 total_bytes_received_lo ; u32 total_bytes_transmitted_hi ; u32 total_bytes_transmitted_lo ; u32 total_unicast_packets_received_hi ; u32 total_unicast_packets_received_lo ; u32 total_multicast_packets_received_hi ; u32 total_multicast_packets_received_lo ; u32 total_broadcast_packets_received_hi ; u32 total_broadcast_packets_received_lo ; u32 total_unicast_packets_transmitted_hi ; u32 total_unicast_packets_transmitted_lo ; u32 total_multicast_packets_transmitted_hi ; u32 total_multicast_packets_transmitted_lo ; u32 total_broadcast_packets_transmitted_hi ; u32 total_broadcast_packets_transmitted_lo ; u32 valid_bytes_received_hi ; u32 valid_bytes_received_lo ; u32 host_func_stats_end ; }; struct afex_stats { u32 tx_unicast_frames_hi ; u32 tx_unicast_frames_lo ; u32 tx_unicast_bytes_hi ; u32 tx_unicast_bytes_lo ; u32 tx_multicast_frames_hi ; u32 tx_multicast_frames_lo ; u32 tx_multicast_bytes_hi ; u32 tx_multicast_bytes_lo ; u32 tx_broadcast_frames_hi ; u32 tx_broadcast_frames_lo ; u32 tx_broadcast_bytes_hi ; u32 tx_broadcast_bytes_lo ; u32 tx_frames_discarded_hi ; u32 tx_frames_discarded_lo ; u32 tx_frames_dropped_hi ; u32 tx_frames_dropped_lo ; u32 rx_unicast_frames_hi ; u32 rx_unicast_frames_lo ; u32 rx_unicast_bytes_hi ; u32 rx_unicast_bytes_lo ; u32 rx_multicast_frames_hi ; u32 rx_multicast_frames_lo ; u32 rx_multicast_bytes_hi ; u32 rx_multicast_bytes_lo ; u32 rx_broadcast_frames_hi ; u32 rx_broadcast_frames_lo ; u32 rx_broadcast_bytes_hi ; u32 rx_broadcast_bytes_lo ; u32 rx_frames_discarded_hi ; u32 rx_frames_discarded_lo ; u32 rx_frames_dropped_hi ; u32 rx_frames_dropped_lo ; }; struct atten_sp_status_block { __le32 attn_bits ; __le32 attn_bits_ack ; u8 status_block_id ; u8 reserved0 ; __le16 attn_bits_index ; __le32 reserved1 ; }; struct cstorm_eth_ag_context { u32 __reserved0[10U] ; }; struct dmae_command { u32 opcode ; u32 src_addr_lo ; u32 src_addr_hi ; u32 dst_addr_lo ; u32 dst_addr_hi ; u16 len ; u16 opcode_iov ; u32 comp_addr_lo ; u32 comp_addr_hi ; u32 comp_val ; u32 crc32 ; u32 crc32_c ; u16 crc16 ; u16 crc16_c ; u16 crc_t10 ; u16 reserved3 ; u16 xsum16 ; u16 xsum8 ; }; struct doorbell_hdr { u8 header ; }; struct hc_status_block_e1x { __le16 index_values[8U] ; __le16 running_index[2U] ; __le32 rsrv[11U] ; }; struct host_hc_status_block_e1x { struct hc_status_block_e1x sb ; }; struct hc_status_block_e2 { __le16 index_values[8U] ; __le16 running_index[2U] ; __le32 reserved[11U] ; }; struct host_hc_status_block_e2 { struct hc_status_block_e2 sb ; }; struct hc_sp_status_block { __le16 index_values[16U] ; __le16 running_index ; __le16 rsrv ; u32 rsrv1 ; }; struct host_sp_status_block { struct atten_sp_status_block atten_status_block ; struct hc_sp_status_block sp_sb ; }; struct igu_ack_register { u16 status_block_index ; u16 sb_id_and_flags ; }; struct igu_regular { u32 sb_id_and_flags ; u32 reserved_2 ; }; struct parsing_flags { __le16 flags ; }; struct timers_block_context { u32 __reserved_0 ; u32 __reserved_1 ; u32 __reserved_2 ; u32 flags ; }; struct tstorm_eth_ag_context { u32 __reserved0[14U] ; }; struct ustorm_eth_ag_context { u32 __reserved0 ; u16 __reserved1 ; u8 __reserved2 ; u8 cdu_usage ; u32 __reserved3[6U] ; }; struct xstorm_eth_ag_context { u32 reserved0 ; u16 reserved1 ; u8 reserved2 ; u8 cdu_reserved ; u32 reserved3[30U] ; }; struct doorbell_set_prod { struct doorbell_hdr header ; u8 zero_fill1 ; u16 prod ; }; struct regpair { __le32 lo ; __le32 hi ; }; struct regpair_native { u32 lo ; u32 hi ; }; struct client_init_general_data { u8 client_id ; u8 statistics_counter_id ; u8 statistics_en_flg ; u8 is_fcoe_flg ; u8 activate_flg ; u8 sp_client_id ; __le16 mtu ; u8 statistics_zero_flg ; u8 func_id ; u8 cos ; u8 traffic_type ; u32 reserved0 ; }; struct client_init_rx_data { u8 tpa_en ; u8 vmqueue_mode_en_flg ; u8 extra_data_over_sgl_en_flg ; u8 cache_line_alignment_log_size ; u8 enable_dynamic_hc ; u8 max_sges_for_packet ; u8 client_qzone_id ; u8 drop_ip_cs_err_flg ; u8 drop_tcp_cs_err_flg ; u8 drop_ttl0_flg ; u8 drop_udp_cs_err_flg ; u8 inner_vlan_removal_enable_flg ; u8 outer_vlan_removal_enable_flg ; u8 status_block_id ; u8 rx_sb_index_number ; u8 dont_verify_rings_pause_thr_flg ; u8 max_tpa_queues ; u8 silent_vlan_removal_flg ; __le16 max_bytes_on_bd ; __le16 sge_buff_size ; u8 approx_mcast_engine_id ; u8 rss_engine_id ; struct regpair bd_page_base ; struct regpair sge_page_base ; struct regpair cqe_page_base ; u8 is_leading_rss ; u8 is_approx_mcast ; __le16 max_agg_size ; __le16 state ; __le16 cqe_pause_thr_low ; __le16 cqe_pause_thr_high ; __le16 bd_pause_thr_low ; __le16 bd_pause_thr_high ; __le16 sge_pause_thr_low ; __le16 sge_pause_thr_high ; __le16 rx_cos_mask ; __le16 silent_vlan_value ; __le16 silent_vlan_mask ; __le32 reserved6[2U] ; }; struct client_init_tx_data { u8 enforce_security_flg ; u8 tx_status_block_id ; u8 tx_sb_index_number ; u8 tss_leading_client_id ; u8 tx_switching_flg ; u8 anti_spoofing_flg ; __le16 default_vlan ; struct regpair tx_bd_page_base ; __le16 state ; u8 default_vlan_flg ; u8 force_default_pri_flg ; u8 tunnel_lso_inc_ip_id ; u8 refuse_outband_vlan_flg ; u8 tunnel_non_lso_pcsum_location ; u8 reserved1 ; }; struct client_init_ramrod_data { struct client_init_general_data general ; struct client_init_rx_data rx ; struct client_init_tx_data tx ; }; struct client_update_ramrod_data { u8 client_id ; u8 func_id ; u8 inner_vlan_removal_enable_flg ; u8 inner_vlan_removal_change_flg ; u8 outer_vlan_removal_enable_flg ; u8 outer_vlan_removal_change_flg ; u8 anti_spoofing_enable_flg ; u8 anti_spoofing_change_flg ; u8 activate_flg ; u8 activate_change_flg ; __le16 default_vlan ; u8 default_vlan_enable_flg ; u8 default_vlan_change_flg ; __le16 silent_vlan_value ; __le16 silent_vlan_mask ; u8 silent_vlan_removal_flg ; u8 silent_vlan_change_flg ; u8 refuse_outband_vlan_flg ; u8 refuse_outband_vlan_change_flg ; u8 tx_switching_flg ; u8 tx_switching_change_flg ; __le32 reserved1 ; __le32 echo ; }; struct cstorm_eth_st_context { u32 __reserved0[4U] ; }; struct eth_classify_cmd_header { u8 cmd_general_data ; u8 func_id ; u8 client_id ; u8 reserved1 ; }; struct eth_classify_header { u8 rule_cnt ; u8 reserved0 ; __le16 reserved1 ; __le32 echo ; }; struct eth_classify_mac_cmd { struct eth_classify_cmd_header header ; __le16 reserved0 ; __le16 inner_mac ; __le16 mac_lsb ; __le16 mac_mid ; __le16 mac_msb ; __le16 reserved1 ; }; struct eth_classify_pair_cmd { struct eth_classify_cmd_header header ; __le16 reserved0 ; __le16 inner_mac ; __le16 mac_lsb ; __le16 mac_mid ; __le16 mac_msb ; __le16 vlan ; }; struct eth_classify_vlan_cmd { struct eth_classify_cmd_header header ; __le32 reserved0 ; __le32 reserved1 ; __le16 reserved2 ; __le16 vlan ; }; union eth_classify_rule_cmd { struct eth_classify_mac_cmd mac ; struct eth_classify_vlan_cmd vlan ; struct eth_classify_pair_cmd pair ; }; struct eth_classify_rules_ramrod_data { struct eth_classify_header header ; union eth_classify_rule_cmd rules[16U] ; }; struct eth_common_ramrod_data { __le32 client_id ; __le32 reserved1 ; }; struct ustorm_eth_st_context { u32 reserved0[52U] ; }; struct tstorm_eth_st_context { u32 __reserved0[28U] ; }; struct xstorm_eth_st_context { u32 reserved0[60U] ; }; struct eth_context { struct ustorm_eth_st_context ustorm_st_context ; struct tstorm_eth_st_context tstorm_st_context ; struct xstorm_eth_ag_context xstorm_ag_context ; struct tstorm_eth_ag_context tstorm_ag_context ; struct cstorm_eth_ag_context cstorm_ag_context ; struct ustorm_eth_ag_context ustorm_ag_context ; struct timers_block_context timers_context ; struct xstorm_eth_st_context xstorm_st_context ; struct cstorm_eth_st_context cstorm_st_context ; }; union eth_sgl_or_raw_data { __le16 sgl[8U] ; u32 raw_data[4U] ; }; struct eth_end_agg_rx_cqe { u8 type_error_flags ; u8 reserved1 ; u8 queue_index ; u8 reserved2 ; __le32 timestamp_delta ; __le16 num_of_coalesced_segs ; __le16 pkt_len ; u8 pure_ack_count ; u8 reserved3 ; __le16 reserved4 ; union eth_sgl_or_raw_data sgl_or_raw_data ; __le32 reserved5[8U] ; }; struct eth_fast_path_rx_cqe { u8 type_error_flags ; u8 status_flags ; u8 queue_index ; u8 placement_offset ; __le32 rss_hash_result ; __le16 vlan_tag ; __le16 pkt_len_or_gro_seg_len ; __le16 len_on_bd ; struct parsing_flags pars_flags ; union eth_sgl_or_raw_data sgl_or_raw_data ; __le32 reserved1[8U] ; }; struct eth_filter_rules_cmd { u8 cmd_general_data ; u8 func_id ; u8 client_id ; u8 reserved1 ; __le16 state ; __le16 reserved3 ; struct regpair reserved4 ; }; struct eth_filter_rules_ramrod_data { struct eth_classify_header header ; struct eth_filter_rules_cmd rules[16U] ; }; struct eth_halt_ramrod_data { __le32 client_id ; __le32 reserved0 ; }; struct eth_mac_addresses { __le16 dst_lo ; __le16 dst_mid ; __le16 dst_hi ; __le16 src_lo ; __le16 src_mid ; __le16 src_hi ; }; struct eth_tunnel_data { __le16 dst_lo ; __le16 dst_mid ; __le16 dst_hi ; __le16 reserved0 ; __le16 pseudo_csum ; u8 ip_hdr_start_inner_w ; u8 reserved1 ; }; union eth_mac_addr_or_tunnel_data { struct eth_mac_addresses mac_addr ; struct eth_tunnel_data tunnel_data ; }; struct eth_multicast_rules_cmd { u8 cmd_general_data ; u8 func_id ; u8 bin_id ; u8 engine_id ; __le32 reserved2 ; struct regpair reserved3 ; }; struct eth_multicast_rules_ramrod_data { struct eth_classify_header header ; struct eth_multicast_rules_cmd rules[16U] ; }; struct ramrod_data { __le32 data_lo ; __le32 data_hi ; }; struct eth_rss_update_ramrod_data { u8 rss_engine_id ; u8 capabilities ; u8 rss_result_mask ; u8 rss_mode ; __le16 udp_4tuple_dst_port_mask ; __le16 udp_4tuple_dst_port_value ; u8 indirection_table[128U] ; __le32 rss_key[10U] ; __le32 echo ; __le32 reserved3 ; }; struct eth_rx_bd { __le32 addr_lo ; __le32 addr_hi ; }; struct common_ramrod_eth_rx_cqe { u8 ramrod_type ; u8 conn_type ; __le16 reserved1 ; __le32 conn_and_cmd_data ; struct ramrod_data protocol_data ; __le32 echo ; __le32 reserved2[11U] ; }; struct eth_rx_cqe_next_page { __le32 addr_lo ; __le32 addr_hi ; __le32 reserved[14U] ; }; union eth_rx_cqe { struct eth_fast_path_rx_cqe fast_path_cqe ; struct common_ramrod_eth_rx_cqe ramrod_cqe ; struct eth_rx_cqe_next_page next_page_cqe ; struct eth_end_agg_rx_cqe end_agg_cqe ; }; struct eth_rx_sge { __le32 addr_lo ; __le32 addr_hi ; }; struct spe_hdr { __le32 conn_and_cmd_data ; __le16 type ; __le16 reserved1 ; }; union eth_specific_data { u8 protocol_data[8U] ; struct regpair client_update_ramrod_data ; struct regpair client_init_ramrod_init_data ; struct eth_halt_ramrod_data halt_ramrod_data ; struct regpair update_data_addr ; struct eth_common_ramrod_data common_ramrod_data ; struct regpair classify_cfg_addr ; struct regpair filter_cfg_addr ; struct regpair mcast_cfg_addr ; }; struct eth_spe { struct spe_hdr hdr ; union eth_specific_data data ; }; struct eth_tx_bd { __le32 addr_lo ; __le32 addr_hi ; __le16 total_pkt_bytes ; __le16 nbytes ; u8 reserved[4U] ; }; struct eth_tx_bd_flags { u8 as_bitfield ; }; struct eth_tx_start_bd { __le32 addr_lo ; __le32 addr_hi ; __le16 nbd ; __le16 nbytes ; __le16 vlan_or_ethertype ; struct eth_tx_bd_flags bd_flags ; u8 general_data ; }; struct eth_tx_parse_bd_e1x { __le16 global_data ; u8 tcp_flags ; u8 ip_hlen_w ; __le16 total_hlen_w ; __le16 tcp_pseudo_csum ; __le16 lso_mss ; __le16 ip_id ; __le32 tcp_send_seq ; }; struct eth_tx_parse_bd_e2 { union eth_mac_addr_or_tunnel_data data ; __le32 parsing_data ; }; struct eth_tx_parse_2nd_bd { __le16 global_data ; __le16 reserved1 ; u8 tcp_flags ; u8 reserved2 ; u8 tunnel_udp_hdr_start_w ; u8 fw_ip_hdr_to_payload_w ; __le16 fw_ip_csum_wo_len_flags_frag ; __le16 hw_ip_id ; __le32 tcp_send_seq ; }; struct eth_tx_next_bd { __le32 addr_lo ; __le32 addr_hi ; u8 reserved[8U] ; }; union eth_tx_bd_types { struct eth_tx_start_bd start_bd ; struct eth_tx_bd reg_bd ; struct eth_tx_parse_bd_e1x parse_bd_e1x ; struct eth_tx_parse_bd_e2 parse_bd_e2 ; struct eth_tx_parse_2nd_bd parse_2nd_bd ; struct eth_tx_next_bd next_bd ; }; struct mac_configuration_hdr { u8 length ; u8 offset ; __le16 client_id ; __le32 echo ; }; struct mac_configuration_entry { __le16 lsb_mac_addr ; __le16 middle_mac_addr ; __le16 msb_mac_addr ; __le16 vlan_id ; u8 pf_id ; u8 flags ; __le16 reserved0 ; __le32 clients_bit_vector ; }; struct mac_configuration_cmd { struct mac_configuration_hdr hdr ; struct mac_configuration_entry config_table[64U] ; }; struct tstorm_eth_function_common_config { __le16 config_flags ; u8 rss_result_mask ; u8 reserved1 ; __le16 vlan_id[2U] ; }; struct tstorm_eth_mac_filter_config { u32 ucast_drop_all ; u32 ucast_accept_all ; u32 mcast_drop_all ; u32 mcast_accept_all ; u32 bcast_accept_all ; u32 vlan_filter[2U] ; u32 unmatched_unicast ; }; struct fcoe_rx_stat_params_section0 { __le32 fcoe_rx_pkt_cnt ; __le32 fcoe_rx_byte_cnt ; }; struct fcoe_rx_stat_params_section1 { __le32 fcoe_ver_cnt ; __le32 fcoe_rx_drop_pkt_cnt ; }; struct fcoe_rx_stat_params_section2 { __le32 fc_crc_cnt ; __le32 eofa_del_cnt ; __le32 miss_frame_cnt ; __le32 seq_timeout_cnt ; __le32 drop_seq_cnt ; __le32 fcoe_rx_drop_pkt_cnt ; __le32 fcp_rx_pkt_cnt ; __le32 reserved0 ; }; struct fcoe_tx_stat_params { __le32 fcoe_tx_pkt_cnt ; __le32 fcoe_tx_byte_cnt ; __le32 fcp_tx_pkt_cnt ; __le32 reserved0 ; }; struct fcoe_statistics_params { struct fcoe_tx_stat_params tx_stat ; struct fcoe_rx_stat_params_section0 rx_stat0 ; struct fcoe_rx_stat_params_section1 rx_stat1 ; struct fcoe_rx_stat_params_section2 rx_stat2 ; }; struct afex_vif_list_ramrod_data { u8 afex_vif_list_command ; u8 func_bit_map ; __le16 vif_list_index ; u8 func_to_clear ; u8 echo ; __le16 reserved1 ; }; struct cfc_del_event_data { u32 cid ; u32 reserved0 ; u32 reserved1 ; }; struct cmng_flags_per_port { u32 cmng_enables ; u32 __reserved1 ; }; struct rate_shaping_vars_per_port { u32 rs_periodic_timeout ; u32 rs_threshold ; }; struct fairness_vars_per_port { u32 upper_bound ; u32 fair_threshold ; u32 fairness_timeout ; u32 reserved0 ; }; struct safc_struct_per_port { u8 safc_timeout_usec ; u8 __reserved0 ; u16 __reserved1 ; u8 cos_to_traffic_types[4U] ; u16 cos_to_pause_mask[16U] ; }; struct cmng_struct_per_port { struct rate_shaping_vars_per_port rs_vars ; struct fairness_vars_per_port fair_vars ; struct safc_struct_per_port safc_vars ; struct cmng_flags_per_port flags ; }; struct rate_shaping_counter { u32 quota ; u16 rate ; u16 __reserved0 ; }; struct rate_shaping_vars_per_vn { struct rate_shaping_counter vn_counter ; }; struct fairness_vars_per_vn { u32 cos_credit_delta[4U] ; u32 vn_credit_delta ; u32 __reserved0 ; }; struct cmng_vnic { struct rate_shaping_vars_per_vn vnic_max_rate[4U] ; struct fairness_vars_per_vn vnic_min_rate[4U] ; }; struct cmng_init { struct cmng_struct_per_port port ; struct cmng_vnic vnic ; }; struct cmng_init_input { u32 port_rate ; u16 vnic_min_rate[4U] ; u16 vnic_max_rate[4U] ; u16 cos_min_rate[4U] ; u16 cos_to_pause_mask[4U] ; struct cmng_flags_per_port flags ; }; struct eth_event_data { u32 echo ; u32 reserved0 ; u32 reserved1 ; }; struct vf_pf_event_data { u8 vf_id ; u8 reserved0 ; u16 reserved1 ; u32 msg_addr_lo ; u32 msg_addr_hi ; }; struct vf_flr_event_data { u8 vf_id ; u8 reserved0 ; u16 reserved1 ; u32 reserved2 ; u32 reserved3 ; }; struct malicious_vf_event_data { u8 vf_id ; u8 err_id ; u16 reserved1 ; u32 reserved2 ; u32 reserved3 ; }; struct vif_list_event_data { u8 func_bit_map ; u8 echo ; __le16 reserved0 ; __le32 reserved1 ; __le32 reserved2 ; }; struct function_update_event_data { u8 echo ; u8 reserved ; __le16 reserved0 ; __le32 reserved1 ; __le32 reserved2 ; }; union event_data { struct vf_pf_event_data vf_pf_event ; struct eth_event_data eth_event ; struct cfc_del_event_data cfc_del_event ; struct vf_flr_event_data vf_flr_event ; struct malicious_vf_event_data malicious_vf_event ; struct vif_list_event_data vif_list_event ; struct function_update_event_data function_update_event ; }; struct event_ring_data { struct regpair_native base_addr ; u16 producer ; u8 sb_id ; u8 index_id ; u32 reserved0 ; }; struct event_ring_msg { u8 opcode ; u8 error ; u16 reserved1 ; union event_data data ; }; struct event_ring_next { struct regpair addr ; u32 reserved[2U] ; }; union event_ring_elem { struct event_ring_msg message ; struct event_ring_next next_page ; }; struct priority_cos { u8 priority ; u8 cos ; __le16 reserved1 ; }; struct flow_control_configuration { struct priority_cos traffic_type_to_priority_cos[8U] ; u8 dcb_enabled ; u8 dcb_version ; u8 dont_add_pri_0_en ; u8 reserved1 ; __le32 reserved2 ; }; struct function_start_data { u8 function_mode ; u8 allow_npar_tx_switching ; __le16 sd_vlan_tag ; __le16 vif_id ; u8 path_id ; u8 network_cos_mode ; u8 dmae_cmd_id ; u8 gre_tunnel_mode ; u8 gre_tunnel_rss ; u8 nvgre_clss_en ; __le16 reserved1[2U] ; }; struct hc_index_data { u8 timeout ; u8 flags ; }; struct hc_status_block_sm { u8 __flags ; u8 timer_value ; u8 igu_sb_id ; u8 igu_seg_id ; u32 time_to_expire ; }; struct pci_entity { u8 pf_id ; u8 vnic_id ; u8 vf_id ; u8 vf_valid ; }; struct hc_sb_data { struct regpair_native host_sb_addr ; struct hc_status_block_sm state_machine[2U] ; struct pci_entity p_func ; u8 same_igu_sb_1b ; u8 dhc_qzone_id ; u8 state ; u8 rsrv0 ; struct regpair_native rsrv1[2U] ; }; struct hc_sp_status_block_data { struct regpair_native host_sb_addr ; u8 igu_sb_id ; u8 igu_seg_id ; u8 state ; u8 rsrv1 ; struct pci_entity p_func ; }; struct hc_status_block_data_e1x { struct hc_index_data index_data[8U] ; struct hc_sb_data common ; }; struct hc_status_block_data_e2 { struct hc_index_data index_data[8U] ; struct hc_sb_data common ; }; struct tstorm_per_pf_stats { struct regpair rcv_error_bytes ; }; struct per_pf_stats { struct tstorm_per_pf_stats tstorm_pf_statistics ; }; struct tstorm_per_port_stats { __le32 mac_discard ; __le32 mac_filter_discard ; __le32 brb_truncate_discard ; __le32 mf_tag_discard ; __le32 packet_drop ; __le32 reserved ; }; struct per_port_stats { struct tstorm_per_port_stats tstorm_port_statistics ; }; struct tstorm_per_queue_stats { struct regpair rcv_ucast_bytes ; __le32 rcv_ucast_pkts ; __le32 checksum_discard ; struct regpair rcv_bcast_bytes ; __le32 rcv_bcast_pkts ; __le32 pkts_too_big_discard ; struct regpair rcv_mcast_bytes ; __le32 rcv_mcast_pkts ; __le32 ttl0_discard ; __le16 no_buff_discard ; __le16 reserved0 ; __le32 reserved1 ; }; struct ustorm_per_queue_stats { struct regpair ucast_no_buff_bytes ; struct regpair mcast_no_buff_bytes ; struct regpair bcast_no_buff_bytes ; __le32 ucast_no_buff_pkts ; __le32 mcast_no_buff_pkts ; __le32 bcast_no_buff_pkts ; __le32 coalesced_pkts ; struct regpair coalesced_bytes ; __le32 coalesced_events ; __le32 coalesced_aborts ; }; struct xstorm_per_queue_stats { struct regpair ucast_bytes_sent ; struct regpair mcast_bytes_sent ; struct regpair bcast_bytes_sent ; __le32 ucast_pkts_sent ; __le32 mcast_pkts_sent ; __le32 bcast_pkts_sent ; __le32 error_drop_pkts ; }; struct per_queue_stats { struct tstorm_per_queue_stats tstorm_queue_statistics ; struct ustorm_per_queue_stats ustorm_queue_statistics ; struct xstorm_per_queue_stats xstorm_queue_statistics ; }; struct stats_counter { __le16 xstats_counter ; __le16 reserved0 ; __le32 reserved1 ; __le16 tstats_counter ; __le16 reserved2 ; __le32 reserved3 ; __le16 ustats_counter ; __le16 reserved4 ; __le32 reserved5 ; __le16 cstats_counter ; __le16 reserved6 ; __le32 reserved7 ; }; struct stats_query_entry { u8 kind ; u8 index ; __le16 funcID ; __le32 reserved ; struct regpair address ; }; struct stats_query_header { u8 cmd_num ; u8 reserved0 ; __le16 drv_stats_counter ; __le32 reserved1 ; struct regpair stats_counters_addrs ; }; struct kwqe { u32 kwqe_op_flag ; u32 kwqe_info0 ; u32 kwqe_info1 ; u32 kwqe_info2 ; u32 kwqe_info3 ; u32 kwqe_info4 ; u32 kwqe_info5 ; u32 kwqe_info6 ; }; struct kwqe_16 { u32 kwqe_info0 ; u32 kwqe_info1 ; u32 kwqe_info2 ; u32 kwqe_info3 ; }; struct cnic_ctl_completion { u32 cid ; u8 opcode ; u8 error ; }; union __anonunion_data_265 { struct cnic_ctl_completion comp ; char bytes[64U] ; }; struct cnic_ctl_info { int cmd ; union __anonunion_data_265 data ; }; struct drv_ctl_spq_credit { u32 credit_count ; }; struct drv_ctl_io { u32 cid_addr ; u32 offset ; u32 data ; dma_addr_t dma_addr ; }; struct drv_ctl_l2_ring { u32 client_id ; u32 cid ; }; struct drv_ctl_register_data { int ulp_type ; struct fcoe_capabilities fcoe_features ; }; union __anonunion_data_266 { struct drv_ctl_spq_credit credit ; struct drv_ctl_io io ; struct drv_ctl_l2_ring ring ; int ulp_type ; struct drv_ctl_register_data register_data ; char bytes[64U] ; }; struct drv_ctl_info { int cmd ; union __anonunion_data_266 data ; }; struct cnic_ops { struct module *cnic_owner ; int (*cnic_handler)(void * , void * ) ; int (*cnic_ctl)(void * , struct cnic_ctl_info * ) ; }; struct cnic_irq { unsigned int vector ; void *status_blk ; u32 status_blk_num ; u32 status_blk_num2 ; u32 irq_flags ; }; struct cnic_eth_dev { struct module *drv_owner ; u32 drv_state ; u32 chip_id ; u32 max_kwqe_pending ; struct pci_dev *pdev ; void *io_base ; void *io_base2 ; void const *iro_arr ; u32 ctx_tbl_offset ; u32 ctx_tbl_len ; int ctx_blk_size ; u32 starting_cid ; u32 max_iscsi_conn ; u32 max_fcoe_conn ; u32 max_rdma_conn ; u32 fcoe_init_cid ; u32 max_fcoe_exchanges ; u32 fcoe_wwn_port_name_hi ; u32 fcoe_wwn_port_name_lo ; u32 fcoe_wwn_node_name_hi ; u32 fcoe_wwn_node_name_lo ; u16 iscsi_l2_client_id ; u16 iscsi_l2_cid ; u8 iscsi_mac[6U] ; int num_irq ; struct cnic_irq irq_arr[8U] ; int (*drv_register_cnic)(struct net_device * , struct cnic_ops * , void * ) ; int (*drv_unregister_cnic)(struct net_device * ) ; int (*drv_submit_kwqes_32)(struct net_device * , struct kwqe ** , u32 ) ; int (*drv_submit_kwqes_16)(struct net_device * , struct kwqe_16 ** , u32 ) ; int (*drv_ctl)(struct net_device * , struct drv_ctl_info * ) ; unsigned long reserved1[2U] ; union drv_info_to_mcp *addr_drv_info_to_mcp ; }; struct mdio_if_info { int prtad ; u32 mmds ; unsigned int mode_support ; struct net_device *dev ; int (*mdio_read)(struct net_device * , int , int , u16 ) ; int (*mdio_write)(struct net_device * , int , int , u16 , u16 ) ; }; struct link_vars; struct link_params; struct bnx2x_phy; struct bnx2x_phy { u32 type ; u8 addr ; u8 def_md_devad ; u16 flags ; u16 rx_preemphasis[4U] ; u16 tx_preemphasis[4U] ; u32 mdio_ctrl ; u32 supported ; u32 media_type ; u32 ver_addr ; u16 req_flow_ctrl ; u16 req_line_speed ; u32 speed_cap_mask ; u16 req_duplex ; u16 rsrv ; u8 (*config_init)(struct bnx2x_phy * , struct link_params * , struct link_vars * ) ; u8 (*read_status)(struct bnx2x_phy * , struct link_params * , struct link_vars * ) ; void (*link_reset)(struct bnx2x_phy * , struct link_params * ) ; void (*config_loopback)(struct bnx2x_phy * , struct link_params * ) ; u8 (*format_fw_ver)(u32 , u8 * , u16 * ) ; void (*hw_reset)(struct bnx2x_phy * , struct link_params * ) ; void (*set_link_led)(struct bnx2x_phy * , struct link_params * , u8 ) ; void (*phy_specific_func)(struct bnx2x_phy * , struct link_params * , u32 ) ; }; struct bnx2x; struct link_params { u8 port ; u8 loopback_mode ; u8 mac_addr[6U] ; u16 req_duplex[2U] ; u16 req_flow_ctrl[2U] ; u16 req_line_speed[2U] ; u32 shmem_base ; u32 shmem2_base ; u32 speed_cap_mask[2U] ; u32 switch_cfg ; u32 lane_config ; u32 chip_id ; u32 feature_config_flags ; struct bnx2x_phy phy[3U] ; u8 num_phys ; u8 rsrv ; u32 eee_mode ; u16 hw_led_mode ; u32 multi_phy_config ; struct bnx2x *bp ; u16 req_fc_auto_adv ; u16 link_flags ; u32 lfa_base ; }; struct link_vars { u8 phy_flags ; u8 mac_type ; u8 phy_link_up ; u8 link_up ; u16 line_speed ; u16 duplex ; u16 flow_ctrl ; u16 ieee_fc ; u32 link_status ; u32 eee_status ; u8 fault_detected ; u8 check_kr2_recovery_cnt ; u16 periodic_flags ; u32 aeu_int_mask ; u8 rx_tx_asic_rst ; u8 turn_to_run_wc_rt ; u16 rsrv2 ; u32 link_attr_sync ; }; enum ldv_34410 { BNX2X_OBJ_TYPE_RX = 0, BNX2X_OBJ_TYPE_TX = 1, BNX2X_OBJ_TYPE_RX_TX = 2 } ; typedef enum ldv_34410 bnx2x_obj_type; struct bnx2x_raw_obj { u8 func_id ; u8 cl_id ; u32 cid ; void *rdata ; dma_addr_t rdata_mapping ; int state ; unsigned long *pstate ; bnx2x_obj_type obj_type ; int (*wait_comp)(struct bnx2x * , struct bnx2x_raw_obj * ) ; bool (*check_pending)(struct bnx2x_raw_obj * ) ; void (*clear_pending)(struct bnx2x_raw_obj * ) ; void (*set_pending)(struct bnx2x_raw_obj * ) ; }; struct bnx2x_mac_ramrod_data { u8 mac[6U] ; u8 is_inner_mac ; }; struct bnx2x_vlan_ramrod_data { u16 vlan ; }; struct bnx2x_vlan_mac_ramrod_data { u8 mac[6U] ; u8 is_inner_mac ; u16 vlan ; }; union bnx2x_classification_ramrod_data { struct bnx2x_mac_ramrod_data mac ; struct bnx2x_vlan_ramrod_data vlan ; struct bnx2x_vlan_mac_ramrod_data vlan_mac ; }; enum bnx2x_vlan_mac_cmd { BNX2X_VLAN_MAC_ADD = 0, BNX2X_VLAN_MAC_DEL = 1, BNX2X_VLAN_MAC_MOVE = 2 } ; struct bnx2x_vlan_mac_obj; struct bnx2x_vlan_mac_data { enum bnx2x_vlan_mac_cmd cmd ; unsigned long vlan_mac_flags ; struct bnx2x_vlan_mac_obj *target_obj ; union bnx2x_classification_ramrod_data u ; }; struct __anonstruct_mcast_270 { }; union bnx2x_exe_queue_cmd_data { struct bnx2x_vlan_mac_data vlan_mac ; struct __anonstruct_mcast_270 mcast ; }; struct bnx2x_exeq_elem { struct list_head link ; int cmd_len ; union bnx2x_exe_queue_cmd_data cmd_data ; }; union bnx2x_qable_obj; struct bnx2x_exe_queue_obj; struct bnx2x_exe_queue_obj { struct list_head exe_queue ; struct list_head pending_comp ; spinlock_t lock ; int exe_chunk_len ; union bnx2x_qable_obj *owner ; int (*validate)(struct bnx2x * , union bnx2x_qable_obj * , struct bnx2x_exeq_elem * ) ; int (*remove)(struct bnx2x * , union bnx2x_qable_obj * , struct bnx2x_exeq_elem * ) ; int (*optimize)(struct bnx2x * , union bnx2x_qable_obj * , struct bnx2x_exeq_elem * ) ; int (*execute)(struct bnx2x * , union bnx2x_qable_obj * , struct list_head * , unsigned long * ) ; struct bnx2x_exeq_elem *(*get)(struct bnx2x_exe_queue_obj * , struct bnx2x_exeq_elem * ) ; }; struct bnx2x_vlan_mac_registry_elem { struct list_head link ; int cam_offset ; unsigned long vlan_mac_flags ; union bnx2x_classification_ramrod_data u ; }; struct bnx2x_vlan_mac_ramrod_params { struct bnx2x_vlan_mac_obj *vlan_mac_obj ; unsigned long ramrod_flags ; struct bnx2x_vlan_mac_data user_req ; }; struct bnx2x_credit_pool_obj; struct bnx2x_vlan_mac_obj { struct bnx2x_raw_obj raw ; struct list_head head ; struct bnx2x_exe_queue_obj exe_queue ; struct bnx2x_credit_pool_obj *macs_pool ; struct bnx2x_credit_pool_obj *vlans_pool ; int ramrod_cmd ; int (*get_n_elements)(struct bnx2x * , struct bnx2x_vlan_mac_obj * , int , u8 * , u8 , u8 ) ; int (*check_add)(struct bnx2x * , struct bnx2x_vlan_mac_obj * , union bnx2x_classification_ramrod_data * ) ; struct bnx2x_vlan_mac_registry_elem *(*check_del)(struct bnx2x * , struct bnx2x_vlan_mac_obj * , union bnx2x_classification_ramrod_data * ) ; bool (*check_move)(struct bnx2x * , struct bnx2x_vlan_mac_obj * , struct bnx2x_vlan_mac_obj * , union bnx2x_classification_ramrod_data * ) ; bool (*get_credit)(struct bnx2x_vlan_mac_obj * ) ; bool (*put_credit)(struct bnx2x_vlan_mac_obj * ) ; bool (*get_cam_offset)(struct bnx2x_vlan_mac_obj * , int * ) ; bool (*put_cam_offset)(struct bnx2x_vlan_mac_obj * , int ) ; void (*set_one_rule)(struct bnx2x * , struct bnx2x_vlan_mac_obj * , struct bnx2x_exeq_elem * , int , int ) ; int (*delete_all)(struct bnx2x * , struct bnx2x_vlan_mac_obj * , unsigned long * , unsigned long * ) ; int (*restore)(struct bnx2x * , struct bnx2x_vlan_mac_ramrod_params * , struct bnx2x_vlan_mac_registry_elem ** ) ; int (*complete)(struct bnx2x * , struct bnx2x_vlan_mac_obj * , union event_ring_elem * , unsigned long * ) ; int (*wait)(struct bnx2x * , struct bnx2x_vlan_mac_obj * ) ; }; struct bnx2x_rx_mode_obj; struct bnx2x_rx_mode_ramrod_params { struct bnx2x_rx_mode_obj *rx_mode_obj ; unsigned long *pstate ; int state ; u8 cl_id ; u32 cid ; u8 func_id ; unsigned long ramrod_flags ; unsigned long rx_mode_flags ; void *rdata ; dma_addr_t rdata_mapping ; unsigned long rx_accept_flags ; unsigned long tx_accept_flags ; }; struct bnx2x_rx_mode_obj { int (*config_rx_mode)(struct bnx2x * , struct bnx2x_rx_mode_ramrod_params * ) ; int (*wait_comp)(struct bnx2x * , struct bnx2x_rx_mode_ramrod_params * ) ; }; struct bnx2x_mcast_list_elem { struct list_head link ; u8 *mac ; }; union bnx2x_mcast_config_data { u8 *mac ; u8 bin ; }; struct bnx2x_mcast_obj; struct bnx2x_mcast_ramrod_params { struct bnx2x_mcast_obj *mcast_obj ; unsigned long ramrod_flags ; struct list_head mcast_list ; int mcast_list_len ; }; enum bnx2x_mcast_cmd { BNX2X_MCAST_CMD_ADD = 0, BNX2X_MCAST_CMD_CONT = 1, BNX2X_MCAST_CMD_DEL = 2, BNX2X_MCAST_CMD_RESTORE = 3 } ; struct __anonstruct_aprox_match_272 { u64 vec[4U] ; int num_bins_set ; }; struct __anonstruct_exact_match_273 { struct list_head macs ; int num_macs_set ; }; union __anonunion_registry_271 { struct __anonstruct_aprox_match_272 aprox_match ; struct __anonstruct_exact_match_273 exact_match ; }; struct bnx2x_mcast_obj { struct bnx2x_raw_obj raw ; union __anonunion_registry_271 registry ; struct list_head pending_cmds_head ; int sched_state ; int max_cmd_len ; int total_pending_num ; u8 engine_id ; int (*config_mcast)(struct bnx2x * , struct bnx2x_mcast_ramrod_params * , enum bnx2x_mcast_cmd ) ; int (*hdl_restore)(struct bnx2x * , struct bnx2x_mcast_obj * , int , int * ) ; int (*enqueue_cmd)(struct bnx2x * , struct bnx2x_mcast_obj * , struct bnx2x_mcast_ramrod_params * , enum bnx2x_mcast_cmd ) ; void (*set_one_rule)(struct bnx2x * , struct bnx2x_mcast_obj * , int , union bnx2x_mcast_config_data * , enum bnx2x_mcast_cmd ) ; bool (*check_pending)(struct bnx2x_mcast_obj * ) ; void (*set_sched)(struct bnx2x_mcast_obj * ) ; void (*clear_sched)(struct bnx2x_mcast_obj * ) ; bool (*check_sched)(struct bnx2x_mcast_obj * ) ; int (*wait_comp)(struct bnx2x * , struct bnx2x_mcast_obj * ) ; int (*validate)(struct bnx2x * , struct bnx2x_mcast_ramrod_params * , enum bnx2x_mcast_cmd ) ; void (*revert)(struct bnx2x * , struct bnx2x_mcast_ramrod_params * , int ) ; int (*get_registry_size)(struct bnx2x_mcast_obj * ) ; void (*set_registry_size)(struct bnx2x_mcast_obj * , int ) ; }; struct bnx2x_credit_pool_obj { atomic_t credit ; int pool_sz ; u64 pool_mirror[4U] ; int base_pool_offset ; bool (*get_entry)(struct bnx2x_credit_pool_obj * , int * ) ; bool (*put_entry)(struct bnx2x_credit_pool_obj * , int ) ; bool (*get)(struct bnx2x_credit_pool_obj * , int ) ; bool (*put)(struct bnx2x_credit_pool_obj * , int ) ; int (*check)(struct bnx2x_credit_pool_obj * ) ; }; struct bnx2x_rss_config_obj; struct bnx2x_config_rss_params { struct bnx2x_rss_config_obj *rss_obj ; unsigned long ramrod_flags ; unsigned long rss_flags ; u8 rss_result_mask ; u8 ind_table[128U] ; u32 rss_key[10U] ; u16 toe_rss_bitmap ; }; struct bnx2x_rss_config_obj { struct bnx2x_raw_obj raw ; u8 engine_id ; u8 ind_table[128U] ; u8 udp_rss_v4 ; u8 udp_rss_v6 ; int (*config_rss)(struct bnx2x * , struct bnx2x_config_rss_params * ) ; }; enum bnx2x_q_state { BNX2X_Q_STATE_RESET = 0, BNX2X_Q_STATE_INITIALIZED = 1, BNX2X_Q_STATE_ACTIVE = 2, BNX2X_Q_STATE_MULTI_COS = 3, BNX2X_Q_STATE_MCOS_TERMINATED = 4, BNX2X_Q_STATE_INACTIVE = 5, BNX2X_Q_STATE_STOPPED = 6, BNX2X_Q_STATE_TERMINATED = 7, BNX2X_Q_STATE_FLRED = 8, BNX2X_Q_STATE_MAX = 9 } ; enum bnx2x_queue_cmd { BNX2X_Q_CMD_INIT = 0, BNX2X_Q_CMD_SETUP = 1, BNX2X_Q_CMD_SETUP_TX_ONLY = 2, BNX2X_Q_CMD_DEACTIVATE = 3, BNX2X_Q_CMD_ACTIVATE = 4, BNX2X_Q_CMD_UPDATE = 5, BNX2X_Q_CMD_UPDATE_TPA = 6, BNX2X_Q_CMD_HALT = 7, BNX2X_Q_CMD_CFC_DEL = 8, BNX2X_Q_CMD_TERMINATE = 9, BNX2X_Q_CMD_EMPTY = 10, BNX2X_Q_CMD_MAX = 11 } ; struct __anonstruct_tx_274 { unsigned long flags ; u16 hc_rate ; u8 fw_sb_id ; u8 sb_cq_index ; }; struct __anonstruct_rx_275 { unsigned long flags ; u16 hc_rate ; u8 fw_sb_id ; u8 sb_cq_index ; }; struct bnx2x_queue_init_params { struct __anonstruct_tx_274 tx ; struct __anonstruct_rx_275 rx ; struct eth_context *cxts[3U] ; u8 max_cos ; }; struct bnx2x_queue_terminate_params { u8 cid_index ; }; struct bnx2x_queue_cfc_del_params { u8 cid_index ; }; struct bnx2x_queue_update_params { unsigned long update_flags ; u16 def_vlan ; u16 silent_removal_value ; u16 silent_removal_mask ; u8 cid_index ; }; struct rxq_pause_params { u16 bd_th_lo ; u16 bd_th_hi ; u16 rcq_th_lo ; u16 rcq_th_hi ; u16 sge_th_lo ; u16 sge_th_hi ; u16 pri_map ; }; struct bnx2x_general_setup_params { u8 stat_id ; u8 spcl_id ; u16 mtu ; u8 cos ; }; struct bnx2x_rxq_setup_params { dma_addr_t dscr_map ; dma_addr_t sge_map ; dma_addr_t rcq_map ; dma_addr_t rcq_np_map ; u16 drop_flags ; u16 buf_sz ; u8 fw_sb_id ; u8 cl_qzone_id ; u16 tpa_agg_sz ; u16 sge_buf_sz ; u8 max_sges_pkt ; u8 max_tpa_queues ; u8 rss_engine_id ; u8 mcast_engine_id ; u8 cache_line_log ; u8 sb_cq_index ; u16 silent_removal_value ; u16 silent_removal_mask ; }; struct bnx2x_txq_setup_params { dma_addr_t dscr_map ; u8 fw_sb_id ; u8 sb_cq_index ; u8 cos ; u16 traffic_type ; u8 tss_leading_cl_id ; u16 default_vlan ; }; struct bnx2x_queue_setup_params { struct bnx2x_general_setup_params gen_params ; struct bnx2x_txq_setup_params txq_params ; struct bnx2x_rxq_setup_params rxq_params ; struct rxq_pause_params pause_params ; unsigned long flags ; }; struct bnx2x_queue_setup_tx_only_params { struct bnx2x_general_setup_params gen_params ; struct bnx2x_txq_setup_params txq_params ; unsigned long flags ; u8 cid_index ; }; struct bnx2x_queue_sp_obj; union __anonunion_params_276 { struct bnx2x_queue_update_params update ; struct bnx2x_queue_setup_params setup ; struct bnx2x_queue_init_params init ; struct bnx2x_queue_setup_tx_only_params tx_only ; struct bnx2x_queue_terminate_params terminate ; struct bnx2x_queue_cfc_del_params cfc_del ; }; struct bnx2x_queue_state_params { struct bnx2x_queue_sp_obj *q_obj ; enum bnx2x_queue_cmd cmd ; unsigned long ramrod_flags ; union __anonunion_params_276 params ; }; struct bnx2x_queue_sp_obj { u32 cids[3U] ; u8 cl_id ; u8 func_id ; u8 max_cos ; u8 num_tx_only ; u8 next_tx_only ; enum bnx2x_q_state state ; enum bnx2x_q_state next_state ; unsigned long type ; unsigned long pending ; void *rdata ; dma_addr_t rdata_mapping ; int (*send_cmd)(struct bnx2x * , struct bnx2x_queue_state_params * ) ; int (*set_pending)(struct bnx2x_queue_sp_obj * , struct bnx2x_queue_state_params * ) ; int (*check_transition)(struct bnx2x * , struct bnx2x_queue_sp_obj * , struct bnx2x_queue_state_params * ) ; int (*complete_cmd)(struct bnx2x * , struct bnx2x_queue_sp_obj * , enum bnx2x_queue_cmd ) ; int (*wait_comp)(struct bnx2x * , struct bnx2x_queue_sp_obj * , enum bnx2x_queue_cmd ) ; }; enum bnx2x_func_state { BNX2X_F_STATE_RESET = 0, BNX2X_F_STATE_INITIALIZED = 1, BNX2X_F_STATE_STARTED = 2, BNX2X_F_STATE_TX_STOPPED = 3, BNX2X_F_STATE_MAX = 4 } ; enum bnx2x_func_cmd { BNX2X_F_CMD_HW_INIT = 0, BNX2X_F_CMD_START = 1, BNX2X_F_CMD_STOP = 2, BNX2X_F_CMD_HW_RESET = 3, BNX2X_F_CMD_AFEX_UPDATE = 4, BNX2X_F_CMD_AFEX_VIFLISTS = 5, BNX2X_F_CMD_TX_STOP = 6, BNX2X_F_CMD_TX_START = 7, BNX2X_F_CMD_SWITCH_UPDATE = 8, BNX2X_F_CMD_MAX = 9 } ; struct bnx2x_func_hw_init_params { u32 load_phase ; }; struct bnx2x_func_hw_reset_params { u32 reset_phase ; }; struct bnx2x_func_start_params { u16 mf_mode ; u16 sd_vlan_tag ; u8 network_cos_mode ; u8 nvgre_clss_en ; u8 gre_tunnel_mode ; u8 gre_tunnel_rss ; }; struct bnx2x_func_switch_update_params { u8 suspend ; }; struct bnx2x_func_afex_update_params { u16 vif_id ; u16 afex_default_vlan ; u8 allowed_priorities ; }; struct bnx2x_func_afex_viflists_params { u16 vif_list_index ; u8 func_bit_map ; u8 afex_vif_list_command ; u8 func_to_clear ; }; struct bnx2x_func_tx_start_params { struct priority_cos traffic_type_to_priority_cos[8U] ; u8 dcb_enabled ; u8 dcb_version ; u8 dont_add_pri_0_en ; }; struct bnx2x_func_sp_obj; union __anonunion_params_277 { struct bnx2x_func_hw_init_params hw_init ; struct bnx2x_func_hw_reset_params hw_reset ; struct bnx2x_func_start_params start ; struct bnx2x_func_switch_update_params switch_update ; struct bnx2x_func_afex_update_params afex_update ; struct bnx2x_func_afex_viflists_params afex_viflists ; struct bnx2x_func_tx_start_params tx_start ; }; struct bnx2x_func_state_params { struct bnx2x_func_sp_obj *f_obj ; enum bnx2x_func_cmd cmd ; unsigned long ramrod_flags ; union __anonunion_params_277 params ; }; struct bnx2x_func_sp_drv_ops { int (*init_hw_cmn_chip)(struct bnx2x * ) ; int (*init_hw_cmn)(struct bnx2x * ) ; int (*init_hw_port)(struct bnx2x * ) ; int (*init_hw_func)(struct bnx2x * ) ; void (*reset_hw_cmn)(struct bnx2x * ) ; void (*reset_hw_port)(struct bnx2x * ) ; void (*reset_hw_func)(struct bnx2x * ) ; int (*gunzip_init)(struct bnx2x * ) ; void (*gunzip_end)(struct bnx2x * ) ; int (*init_fw)(struct bnx2x * ) ; void (*release_fw)(struct bnx2x * ) ; }; struct bnx2x_func_sp_obj { enum bnx2x_func_state state ; enum bnx2x_func_state next_state ; unsigned long pending ; void *rdata ; dma_addr_t rdata_mapping ; void *afex_rdata ; dma_addr_t afex_rdata_mapping ; struct mutex one_pending_mutex ; struct bnx2x_func_sp_drv_ops *drv ; int (*send_cmd)(struct bnx2x * , struct bnx2x_func_state_params * ) ; int (*check_transition)(struct bnx2x * , struct bnx2x_func_sp_obj * , struct bnx2x_func_state_params * ) ; int (*complete_cmd)(struct bnx2x * , struct bnx2x_func_sp_obj * , enum bnx2x_func_cmd ) ; int (*wait_comp)(struct bnx2x * , struct bnx2x_func_sp_obj * , enum bnx2x_func_cmd ) ; }; union bnx2x_qable_obj { struct bnx2x_vlan_mac_obj vlan_mac ; }; struct bnx2x_dcbx_app_params { u32 enabled ; u32 traffic_type_priority[3U] ; }; struct bnx2x_dcbx_cos_params { u32 bw_tbl ; u32 pri_bitmask ; u8 strict ; u8 pauseable ; }; struct bnx2x_dcbx_pg_params { u32 enabled ; u8 num_of_cos ; struct bnx2x_dcbx_cos_params cos_params[3U] ; }; struct bnx2x_dcbx_pfc_params { u32 enabled ; u32 priority_non_pauseable_mask ; }; struct bnx2x_dcbx_port_params { struct bnx2x_dcbx_pfc_params pfc ; struct bnx2x_dcbx_pg_params ets ; struct bnx2x_dcbx_app_params app ; }; struct bnx2x_admin_priority_app_table { u32 valid ; u32 priority ; u32 traffic_type ; u32 app_id ; }; struct bnx2x_config_dcbx_params { u32 overwrite_settings ; u32 admin_dcbx_version ; u32 admin_ets_enable ; u32 admin_pfc_enable ; u32 admin_tc_supported_tx_enable ; u32 admin_ets_configuration_tx_enable ; u32 admin_ets_recommendation_tx_enable ; u32 admin_pfc_tx_enable ; u32 admin_application_priority_tx_enable ; u32 admin_ets_willing ; u32 admin_ets_reco_valid ; u32 admin_pfc_willing ; u32 admin_app_priority_willing ; u32 admin_configuration_bw_precentage[8U] ; u32 admin_configuration_ets_pg[8U] ; u32 admin_recommendation_bw_precentage[8U] ; u32 admin_recommendation_ets_pg[8U] ; u32 admin_pfc_bitmap ; struct bnx2x_admin_priority_app_table admin_priority_app_table[4U] ; u32 admin_default_priority ; }; struct nig_stats { u32 brb_discard ; u32 brb_packet ; u32 brb_truncate ; u32 flow_ctrl_discard ; u32 flow_ctrl_octets ; u32 flow_ctrl_packet ; u32 mng_discard ; u32 mng_octet_inp ; u32 mng_octet_out ; u32 mng_packet_inp ; u32 mng_packet_out ; u32 pbf_octets ; u32 pbf_packet ; u32 safc_inp ; u32 egress_mac_pkt0_lo ; u32 egress_mac_pkt0_hi ; u32 egress_mac_pkt1_lo ; u32 egress_mac_pkt1_hi ; }; enum bnx2x_stats_event { STATS_EVENT_PMF = 0, STATS_EVENT_LINK_UP = 1, STATS_EVENT_UPDATE = 2, STATS_EVENT_STOP = 3, STATS_EVENT_MAX = 4 } ; struct bnx2x_eth_stats { u32 total_bytes_received_hi ; u32 total_bytes_received_lo ; u32 total_bytes_transmitted_hi ; u32 total_bytes_transmitted_lo ; u32 total_unicast_packets_received_hi ; u32 total_unicast_packets_received_lo ; u32 total_multicast_packets_received_hi ; u32 total_multicast_packets_received_lo ; u32 total_broadcast_packets_received_hi ; u32 total_broadcast_packets_received_lo ; u32 total_unicast_packets_transmitted_hi ; u32 total_unicast_packets_transmitted_lo ; u32 total_multicast_packets_transmitted_hi ; u32 total_multicast_packets_transmitted_lo ; u32 total_broadcast_packets_transmitted_hi ; u32 total_broadcast_packets_transmitted_lo ; u32 valid_bytes_received_hi ; u32 valid_bytes_received_lo ; u32 error_bytes_received_hi ; u32 error_bytes_received_lo ; u32 etherstatsoverrsizepkts_hi ; u32 etherstatsoverrsizepkts_lo ; u32 no_buff_discard_hi ; u32 no_buff_discard_lo ; u32 rx_stat_ifhcinbadoctets_hi ; u32 rx_stat_ifhcinbadoctets_lo ; u32 tx_stat_ifhcoutbadoctets_hi ; u32 tx_stat_ifhcoutbadoctets_lo ; u32 rx_stat_dot3statsfcserrors_hi ; u32 rx_stat_dot3statsfcserrors_lo ; u32 rx_stat_dot3statsalignmenterrors_hi ; u32 rx_stat_dot3statsalignmenterrors_lo ; u32 rx_stat_dot3statscarriersenseerrors_hi ; u32 rx_stat_dot3statscarriersenseerrors_lo ; u32 rx_stat_falsecarriererrors_hi ; u32 rx_stat_falsecarriererrors_lo ; u32 rx_stat_etherstatsundersizepkts_hi ; u32 rx_stat_etherstatsundersizepkts_lo ; u32 rx_stat_dot3statsframestoolong_hi ; u32 rx_stat_dot3statsframestoolong_lo ; u32 rx_stat_etherstatsfragments_hi ; u32 rx_stat_etherstatsfragments_lo ; u32 rx_stat_etherstatsjabbers_hi ; u32 rx_stat_etherstatsjabbers_lo ; u32 rx_stat_maccontrolframesreceived_hi ; u32 rx_stat_maccontrolframesreceived_lo ; u32 rx_stat_bmac_xpf_hi ; u32 rx_stat_bmac_xpf_lo ; u32 rx_stat_bmac_xcf_hi ; u32 rx_stat_bmac_xcf_lo ; u32 rx_stat_xoffstateentered_hi ; u32 rx_stat_xoffstateentered_lo ; u32 rx_stat_xonpauseframesreceived_hi ; u32 rx_stat_xonpauseframesreceived_lo ; u32 rx_stat_xoffpauseframesreceived_hi ; u32 rx_stat_xoffpauseframesreceived_lo ; u32 tx_stat_outxonsent_hi ; u32 tx_stat_outxonsent_lo ; u32 tx_stat_outxoffsent_hi ; u32 tx_stat_outxoffsent_lo ; u32 tx_stat_flowcontroldone_hi ; u32 tx_stat_flowcontroldone_lo ; u32 tx_stat_etherstatscollisions_hi ; u32 tx_stat_etherstatscollisions_lo ; u32 tx_stat_dot3statssinglecollisionframes_hi ; u32 tx_stat_dot3statssinglecollisionframes_lo ; u32 tx_stat_dot3statsmultiplecollisionframes_hi ; u32 tx_stat_dot3statsmultiplecollisionframes_lo ; u32 tx_stat_dot3statsdeferredtransmissions_hi ; u32 tx_stat_dot3statsdeferredtransmissions_lo ; u32 tx_stat_dot3statsexcessivecollisions_hi ; u32 tx_stat_dot3statsexcessivecollisions_lo ; u32 tx_stat_dot3statslatecollisions_hi ; u32 tx_stat_dot3statslatecollisions_lo ; u32 tx_stat_etherstatspkts64octets_hi ; u32 tx_stat_etherstatspkts64octets_lo ; u32 tx_stat_etherstatspkts65octetsto127octets_hi ; u32 tx_stat_etherstatspkts65octetsto127octets_lo ; u32 tx_stat_etherstatspkts128octetsto255octets_hi ; u32 tx_stat_etherstatspkts128octetsto255octets_lo ; u32 tx_stat_etherstatspkts256octetsto511octets_hi ; u32 tx_stat_etherstatspkts256octetsto511octets_lo ; u32 tx_stat_etherstatspkts512octetsto1023octets_hi ; u32 tx_stat_etherstatspkts512octetsto1023octets_lo ; u32 tx_stat_etherstatspkts1024octetsto1522octets_hi ; u32 tx_stat_etherstatspkts1024octetsto1522octets_lo ; u32 tx_stat_etherstatspktsover1522octets_hi ; u32 tx_stat_etherstatspktsover1522octets_lo ; u32 tx_stat_bmac_2047_hi ; u32 tx_stat_bmac_2047_lo ; u32 tx_stat_bmac_4095_hi ; u32 tx_stat_bmac_4095_lo ; u32 tx_stat_bmac_9216_hi ; u32 tx_stat_bmac_9216_lo ; u32 tx_stat_bmac_16383_hi ; u32 tx_stat_bmac_16383_lo ; u32 tx_stat_dot3statsinternalmactransmiterrors_hi ; u32 tx_stat_dot3statsinternalmactransmiterrors_lo ; u32 tx_stat_bmac_ufl_hi ; u32 tx_stat_bmac_ufl_lo ; u32 pause_frames_received_hi ; u32 pause_frames_received_lo ; u32 pause_frames_sent_hi ; u32 pause_frames_sent_lo ; u32 etherstatspkts1024octetsto1522octets_hi ; u32 etherstatspkts1024octetsto1522octets_lo ; u32 etherstatspktsover1522octets_hi ; u32 etherstatspktsover1522octets_lo ; u32 brb_drop_hi ; u32 brb_drop_lo ; u32 brb_truncate_hi ; u32 brb_truncate_lo ; u32 mac_filter_discard ; u32 mf_tag_discard ; u32 brb_truncate_discard ; u32 mac_discard ; u32 driver_xoff ; u32 rx_err_discard_pkt ; u32 rx_skb_alloc_failed ; u32 hw_csum_err ; u32 nig_timer_max ; u32 total_tpa_aggregations_hi ; u32 total_tpa_aggregations_lo ; u32 total_tpa_aggregated_frames_hi ; u32 total_tpa_aggregated_frames_lo ; u32 total_tpa_bytes_hi ; u32 total_tpa_bytes_lo ; u32 pfc_frames_received_hi ; u32 pfc_frames_received_lo ; u32 pfc_frames_sent_hi ; u32 pfc_frames_sent_lo ; u32 recoverable_error ; u32 unrecoverable_error ; u32 driver_filtered_tx_pkt ; u32 eee_tx_lpi ; }; struct bnx2x_eth_q_stats { u32 total_unicast_bytes_received_hi ; u32 total_unicast_bytes_received_lo ; u32 total_broadcast_bytes_received_hi ; u32 total_broadcast_bytes_received_lo ; u32 total_multicast_bytes_received_hi ; u32 total_multicast_bytes_received_lo ; u32 total_bytes_received_hi ; u32 total_bytes_received_lo ; u32 total_unicast_bytes_transmitted_hi ; u32 total_unicast_bytes_transmitted_lo ; u32 total_broadcast_bytes_transmitted_hi ; u32 total_broadcast_bytes_transmitted_lo ; u32 total_multicast_bytes_transmitted_hi ; u32 total_multicast_bytes_transmitted_lo ; u32 total_bytes_transmitted_hi ; u32 total_bytes_transmitted_lo ; u32 total_unicast_packets_received_hi ; u32 total_unicast_packets_received_lo ; u32 total_multicast_packets_received_hi ; u32 total_multicast_packets_received_lo ; u32 total_broadcast_packets_received_hi ; u32 total_broadcast_packets_received_lo ; u32 total_unicast_packets_transmitted_hi ; u32 total_unicast_packets_transmitted_lo ; u32 total_multicast_packets_transmitted_hi ; u32 total_multicast_packets_transmitted_lo ; u32 total_broadcast_packets_transmitted_hi ; u32 total_broadcast_packets_transmitted_lo ; u32 valid_bytes_received_hi ; u32 valid_bytes_received_lo ; u32 etherstatsoverrsizepkts_hi ; u32 etherstatsoverrsizepkts_lo ; u32 no_buff_discard_hi ; u32 no_buff_discard_lo ; u32 driver_xoff ; u32 rx_err_discard_pkt ; u32 rx_skb_alloc_failed ; u32 hw_csum_err ; u32 total_packets_received_checksum_discarded_hi ; u32 total_packets_received_checksum_discarded_lo ; u32 total_packets_received_ttl0_discarded_hi ; u32 total_packets_received_ttl0_discarded_lo ; u32 total_transmitted_dropped_packets_error_hi ; u32 total_transmitted_dropped_packets_error_lo ; u32 total_tpa_aggregations_hi ; u32 total_tpa_aggregations_lo ; u32 total_tpa_aggregated_frames_hi ; u32 total_tpa_aggregated_frames_lo ; u32 total_tpa_bytes_hi ; u32 total_tpa_bytes_lo ; u32 driver_filtered_tx_pkt ; }; struct bnx2x_eth_stats_old { u32 rx_stat_dot3statsframestoolong_hi ; u32 rx_stat_dot3statsframestoolong_lo ; }; struct bnx2x_eth_q_stats_old { u32 total_unicast_bytes_received_hi ; u32 total_unicast_bytes_received_lo ; u32 total_broadcast_bytes_received_hi ; u32 total_broadcast_bytes_received_lo ; u32 total_multicast_bytes_received_hi ; u32 total_multicast_bytes_received_lo ; u32 total_unicast_bytes_transmitted_hi ; u32 total_unicast_bytes_transmitted_lo ; u32 total_broadcast_bytes_transmitted_hi ; u32 total_broadcast_bytes_transmitted_lo ; u32 total_multicast_bytes_transmitted_hi ; u32 total_multicast_bytes_transmitted_lo ; u32 total_tpa_bytes_hi ; u32 total_tpa_bytes_lo ; u32 total_bytes_received_hi ; u32 total_bytes_received_lo ; u32 total_bytes_transmitted_hi ; u32 total_bytes_transmitted_lo ; u32 total_unicast_packets_received_hi ; u32 total_unicast_packets_received_lo ; u32 total_multicast_packets_received_hi ; u32 total_multicast_packets_received_lo ; u32 total_broadcast_packets_received_hi ; u32 total_broadcast_packets_received_lo ; u32 total_unicast_packets_transmitted_hi ; u32 total_unicast_packets_transmitted_lo ; u32 total_multicast_packets_transmitted_hi ; u32 total_multicast_packets_transmitted_lo ; u32 total_broadcast_packets_transmitted_hi ; u32 total_broadcast_packets_transmitted_lo ; u32 valid_bytes_received_hi ; u32 valid_bytes_received_lo ; u32 total_tpa_bytes_hi_old ; u32 total_tpa_bytes_lo_old ; u32 driver_xoff_old ; u32 rx_err_discard_pkt_old ; u32 rx_skb_alloc_failed_old ; u32 hw_csum_err_old ; u32 driver_filtered_tx_pkt_old ; }; struct bnx2x_net_stats_old { u32 rx_dropped ; }; struct bnx2x_fw_port_stats_old { u32 mac_filter_discard ; u32 mf_tag_discard ; u32 brb_truncate_discard ; u32 mac_discard ; }; struct vf_pf_resc_request { u8 num_rxqs ; u8 num_txqs ; u8 num_sbs ; u8 num_mac_filters ; u8 num_vlan_filters ; u8 num_mc_filters ; }; struct hw_sb_info { u8 hw_sb_id ; u8 sb_qid ; }; struct channel_tlv { u16 type ; u16 length ; }; struct vfpf_first_tlv { struct channel_tlv tl ; u32 resp_msg_offset ; }; struct pfvf_tlv { struct channel_tlv tl ; u8 status ; u8 padding[3U] ; }; struct pfvf_general_resp_tlv { struct pfvf_tlv hdr ; }; struct channel_list_end_tlv { struct channel_tlv tl ; u8 padding[4U] ; }; struct vf_pf_vfdev_info { u8 vf_id ; u8 vf_os ; u8 padding[2U] ; }; struct vfpf_acquire_tlv { struct vfpf_first_tlv first_tlv ; struct vf_pf_vfdev_info vfdev_info ; struct vf_pf_resc_request resc_request ; __u64 bulletin_addr ; }; struct vfpf_q_op_tlv { struct vfpf_first_tlv first_tlv ; u8 vf_qid ; u8 padding[3U] ; }; struct pf_vf_pfdev_info { u32 chip_num ; u32 pf_cap ; char fw_ver[32U] ; u16 db_size ; u8 indices_per_sb ; u8 padding ; }; struct pf_vf_resc { struct hw_sb_info hw_sbs[16U] ; u8 hw_qid[16U] ; u8 num_rxqs ; u8 num_txqs ; u8 num_sbs ; u8 num_mac_filters ; u8 num_vlan_filters ; u8 num_mc_filters ; u8 permanent_mac_addr[6U] ; u8 current_mac_addr[6U] ; u8 padding[2U] ; }; struct pfvf_acquire_resp_tlv { struct pfvf_tlv hdr ; struct pf_vf_pfdev_info pfdev_info ; struct pf_vf_resc resc ; }; struct vfpf_init_tlv { struct vfpf_first_tlv first_tlv ; __u64 sb_addr[16U] ; __u64 spq_addr ; __u64 stats_addr ; }; struct vf_pf_rxq_params { __u64 rcq_addr ; __u64 rcq_np_addr ; __u64 rxq_addr ; __u64 sge_addr ; u8 vf_sb ; u8 sb_index ; u16 hc_rate ; u16 mtu ; u16 buf_sz ; u16 flags ; u16 stat_id ; u16 sge_buf_sz ; u16 tpa_agg_sz ; u8 max_sge_pkt ; u8 drop_flags ; u8 cache_line_log ; u8 padding ; }; struct vf_pf_txq_params { __u64 txq_addr ; u8 vf_sb ; u8 sb_index ; u16 hc_rate ; u32 flags ; u16 stat_id ; u8 traffic_type ; u8 padding ; }; struct vfpf_setup_q_tlv { struct vfpf_first_tlv first_tlv ; struct vf_pf_rxq_params rxq ; struct vf_pf_txq_params txq ; u8 vf_qid ; u8 param_valid ; u8 padding[2U] ; }; struct vfpf_q_mac_vlan_filter { u32 flags ; u8 mac[6U] ; u16 vlan_tag ; }; struct vfpf_set_q_filters_tlv { struct vfpf_first_tlv first_tlv ; u32 flags ; u8 vf_qid ; u8 n_mac_vlan_filters ; u8 n_multicast ; u8 padding ; struct vfpf_q_mac_vlan_filter filters[32U] ; u8 multicast[32U][6U] ; u32 rx_mask ; }; struct vfpf_close_tlv { struct vfpf_first_tlv first_tlv ; u16 vf_id ; u8 padding[2U] ; }; struct vfpf_release_tlv { struct vfpf_first_tlv first_tlv ; u16 vf_id ; u8 padding[2U] ; }; struct tlv_buffer_size { u8 tlv_buffer[1024U] ; }; union vfpf_tlvs { struct vfpf_first_tlv first_tlv ; struct vfpf_acquire_tlv acquire ; struct vfpf_init_tlv init ; struct vfpf_close_tlv close ; struct vfpf_q_op_tlv q_op ; struct vfpf_setup_q_tlv setup_q ; struct vfpf_set_q_filters_tlv set_q_filters ; struct vfpf_release_tlv release ; struct channel_list_end_tlv list_end ; struct tlv_buffer_size tlv_buf_size ; }; union pfvf_tlvs { struct pfvf_general_resp_tlv general_resp ; struct pfvf_acquire_resp_tlv acquire_resp ; struct channel_list_end_tlv list_end ; struct tlv_buffer_size tlv_buf_size ; }; struct pf_vf_bulletin_size { u8 size[512U] ; }; struct pf_vf_bulletin_content { u32 crc ; u16 version ; u16 length ; __u64 valid_bitmap ; u8 mac[6U] ; u8 mac_padding[2U] ; u16 vlan ; u8 vlan_padding[6U] ; }; union pf_vf_bulletin { struct pf_vf_bulletin_content content ; struct pf_vf_bulletin_size size ; }; enum channel_tlvs { CHANNEL_TLV_NONE = 0, CHANNEL_TLV_ACQUIRE = 1, CHANNEL_TLV_INIT = 2, CHANNEL_TLV_SETUP_Q = 3, CHANNEL_TLV_SET_Q_FILTERS = 4, CHANNEL_TLV_TEARDOWN_Q = 5, CHANNEL_TLV_CLOSE = 6, CHANNEL_TLV_RELEASE = 7, CHANNEL_TLV_PF_RELEASE_VF = 8, CHANNEL_TLV_LIST_END = 9, CHANNEL_TLV_FLR = 10, CHANNEL_TLV_PF_SET_MAC = 11, CHANNEL_TLV_PF_SET_VLAN = 12, CHANNEL_TLV_MAX = 13 } ; struct sw_rx_bd { u8 *data ; dma_addr_t mapping ; }; struct sw_tx_bd { struct sk_buff *skb ; u16 first_bd ; u8 flags ; }; struct sw_rx_page { struct page *page ; dma_addr_t mapping ; }; union db_prod { struct doorbell_set_prod data ; u32 raw ; }; union host_hc_status_block { struct host_hc_status_block_e1x *e1x_sb ; struct host_hc_status_block_e2 *e2_sb ; }; struct bnx2x_agg_info { struct sw_rx_bd first_buf ; u8 tpa_state ; u8 placement_offset ; u16 parsing_flags ; u16 vlan_tag ; u16 len_on_bd ; u32 rxhash ; bool l4_rxhash ; u16 gro_size ; u16 full_page ; }; struct bnx2x_fastpath; struct bnx2x_fp_txdata { struct sw_tx_bd *tx_buf_ring ; union eth_tx_bd_types *tx_desc_ring ; dma_addr_t tx_desc_mapping ; u32 cid ; union db_prod tx_db ; u16 tx_pkt_prod ; u16 tx_pkt_cons ; u16 tx_bd_prod ; u16 tx_bd_cons ; unsigned long tx_pkt ; __le16 *tx_cons_sb ; int txq_index ; struct bnx2x_fastpath *parent_fp ; int tx_ring_size ; }; enum bnx2x_tpa_mode_t { TPA_MODE_LRO = 0, TPA_MODE_GRO = 1 } ; struct bnx2x_fastpath { struct bnx2x *bp ; struct napi_struct napi ; union host_hc_status_block status_blk ; __le16 *sb_index_values ; __le16 *sb_running_index ; u32 ustorm_rx_prods_offset ; u32 rx_buf_size ; u32 rx_frag_size ; dma_addr_t status_blk_mapping ; enum bnx2x_tpa_mode_t mode ; u8 max_cos ; struct bnx2x_fp_txdata *txdata_ptr[3U] ; struct sw_rx_bd *rx_buf_ring ; struct sw_rx_page *rx_page_ring ; struct eth_rx_bd *rx_desc_ring ; dma_addr_t rx_desc_mapping ; union eth_rx_cqe *rx_comp_ring ; dma_addr_t rx_comp_mapping ; struct eth_rx_sge *rx_sge_ring ; dma_addr_t rx_sge_mapping ; u64 sge_mask[16U] ; u32 cid ; __le16 fp_hc_idx ; u8 index ; u8 rx_queue ; u8 cl_id ; u8 cl_qzone_id ; u8 fw_sb_id ; u8 igu_sb_id ; u16 rx_bd_prod ; u16 rx_bd_cons ; u16 rx_comp_prod ; u16 rx_comp_cons ; u16 rx_sge_prod ; u16 last_max_sge ; __le16 *rx_cons_sb ; unsigned long rx_pkt ; unsigned long rx_calls ; struct bnx2x_agg_info *tpa_info ; u8 disable_tpa ; char name[24U] ; }; struct bnx2x_common { u32 chip_id ; int flash_size ; u32 shmem_base ; u32 shmem2_base ; u32 mf_cfg_base ; u32 mf2_cfg_base ; u32 hw_config ; u32 bc_ver ; u8 int_block ; u8 chip_port_mode ; u32 boot_mode ; }; struct bnx2x_port { u32 pmf ; u32 link_config[2U] ; u32 supported[2U] ; u32 advertising[2U] ; u32 phy_addr ; struct mutex phy_mutex ; u32 port_stx ; struct nig_stats old_nig_stats ; }; union cdu_context { struct eth_context eth ; char pad[1024U] ; }; union __anonunion_mac_rdata_278 { struct mac_configuration_cmd e1x ; struct eth_classify_rules_ramrod_data e2 ; }; union __anonunion_rx_mode_rdata_279 { struct tstorm_eth_mac_filter_config e1x ; struct eth_filter_rules_ramrod_data e2 ; }; union __anonunion_mcast_rdata_280 { struct mac_configuration_cmd e1 ; struct eth_multicast_rules_ramrod_data e2 ; }; union __anonunion_q_rdata_281 { struct client_init_ramrod_data init_data ; struct client_update_ramrod_data update_data ; }; union __anonunion_func_rdata_282 { struct function_start_data func_start ; struct flow_control_configuration pfc_config ; }; struct bnx2x_slowpath { union __anonunion_mac_rdata_278 mac_rdata ; union __anonunion_rx_mode_rdata_279 rx_mode_rdata ; union __anonunion_mcast_rdata_280 mcast_rdata ; struct eth_rss_update_ramrod_data rss_rdata ; union __anonunion_q_rdata_281 q_rdata ; union __anonunion_func_rdata_282 func_rdata ; struct afex_vif_list_ramrod_data func_afex_rdata ; struct dmae_command dmae[8U] ; u32 stats_comp ; union mac_stats mac_stats ; struct nig_stats nig_stats ; struct host_port_stats port_stats ; struct host_func_stats func_stats ; u32 wb_comp ; u32 wb_data[4U] ; union drv_info_to_mcp drv_info_to_mcp ; }; struct attn_route { u32 sig[5U] ; }; struct iro { u32 base ; u16 m1 ; u16 m2 ; u16 m3 ; u16 size ; }; struct hw_context { union cdu_context *vcxt ; dma_addr_t cxt_mapping ; size_t size ; }; struct bnx2x_ilt; struct bnx2x_vfdb; enum bnx2x_recovery_state { BNX2X_RECOVERY_DONE = 0, BNX2X_RECOVERY_INIT = 1, BNX2X_RECOVERY_WAIT = 2, BNX2X_RECOVERY_FAILED = 3, BNX2X_RECOVERY_NIC_LOADING = 4 } ; struct bnx2x_link_report_data { u16 line_speed ; unsigned long link_report_flags ; }; struct bnx2x_fw_stats_req { struct stats_query_header hdr ; struct stats_query_entry query[19U] ; }; struct bnx2x_fw_stats_data { struct stats_counter storm_counters ; struct per_port_stats port ; struct per_pf_stats pf ; struct fcoe_statistics_params fcoe ; struct per_queue_stats queue_stats[1U] ; }; struct bnx2x_prev_path_list { struct list_head list ; u8 bus ; u8 slot ; u8 path ; u8 aer ; u8 undi ; }; struct bnx2x_sp_objs { struct bnx2x_vlan_mac_obj mac_obj ; struct bnx2x_queue_sp_obj q_obj ; }; struct bnx2x_fp_stats { struct tstorm_per_queue_stats old_tclient ; struct ustorm_per_queue_stats old_uclient ; struct xstorm_per_queue_stats old_xclient ; struct bnx2x_eth_q_stats eth_q_stats ; struct bnx2x_eth_q_stats_old eth_q_stats_old ; }; struct bnx2x_vf_mbx_msg; struct raw_op; struct firmware; struct bnx2x { struct bnx2x_fastpath *fp ; struct bnx2x_sp_objs *sp_objs ; struct bnx2x_fp_stats *fp_stats ; struct bnx2x_fp_txdata *bnx2x_txq ; void *regview ; void *doorbells ; u16 db_size ; u8 pf_num ; u8 pfid ; int base_fw_ndsb ; struct mutex vf2pf_mutex ; struct bnx2x_vf_mbx_msg *vf2pf_mbox ; dma_addr_t vf2pf_mbox_mapping ; struct pfvf_acquire_resp_tlv acquire_resp ; union pf_vf_bulletin *pf2vf_bulletin ; dma_addr_t pf2vf_bulletin_mapping ; struct pf_vf_bulletin_content old_bulletin ; u16 requested_nr_virtfn ; struct net_device *dev ; struct pci_dev *pdev ; struct iro const *iro_arr ; enum bnx2x_recovery_state recovery_state ; int is_leader ; struct msix_entry *msix_table ; int tx_ring_size ; struct host_sp_status_block *def_status_blk ; __le16 def_idx ; __le16 def_att_idx ; u32 attn_state ; struct attn_route attn_group[8U] ; struct eth_spe *spq ; dma_addr_t spq_mapping ; u16 spq_prod_idx ; struct eth_spe *spq_prod_bd ; struct eth_spe *spq_last_bd ; __le16 *dsb_sp_prod ; atomic_t cq_spq_left ; spinlock_t spq_lock ; union event_ring_elem *eq_ring ; dma_addr_t eq_mapping ; u16 eq_prod ; u16 eq_cons ; __le16 *eq_cons_sb ; atomic_t eq_spq_left ; u16 stats_pending ; u16 stats_comp ; int panic ; int msg_enable ; u32 flags ; u8 cnic_support ; bool cnic_enabled ; bool cnic_loaded ; struct cnic_eth_dev *(*cnic_probe)(struct net_device * ) ; bool fcoe_init ; int pm_cap ; int mrrs ; struct delayed_work sp_task ; atomic_t interrupt_occurred ; struct delayed_work sp_rtnl_task ; struct delayed_work period_task ; struct timer_list timer ; int current_interval ; u16 fw_seq ; u16 fw_drv_pulse_wr_seq ; u32 func_stx ; struct link_params link_params ; struct link_vars link_vars ; u32 link_cnt ; struct bnx2x_link_report_data last_reported_link ; struct mdio_if_info mdio ; struct bnx2x_common common ; struct bnx2x_port port ; struct cmng_init cmng ; u32 mf_config[4U] ; u32 mf_ext_config ; u32 path_has_ovlan ; u16 mf_ov ; u8 mf_mode ; u8 wol ; int rx_ring_size ; u16 tx_quick_cons_trip_int ; u16 tx_quick_cons_trip ; u16 tx_ticks_int ; u16 tx_ticks ; u16 rx_quick_cons_trip_int ; u16 rx_quick_cons_trip ; u16 rx_ticks_int ; u16 rx_ticks ; u32 lin_cnt ; u16 state ; int num_queues ; uint num_ethernet_queues ; uint num_cnic_queues ; int num_napi_queues ; int disable_tpa ; u32 rx_mode ; u8 igu_dsb_id ; u8 igu_base_sb ; u8 igu_sb_cnt ; u8 min_msix_vec_cnt ; u32 igu_base_addr ; dma_addr_t def_status_blk_mapping ; struct bnx2x_slowpath *slowpath ; dma_addr_t slowpath_mapping ; u8 fw_stats_num ; void *fw_stats ; dma_addr_t fw_stats_mapping ; struct bnx2x_fw_stats_req *fw_stats_req ; dma_addr_t fw_stats_req_mapping ; int fw_stats_req_sz ; struct bnx2x_fw_stats_data *fw_stats_data ; dma_addr_t fw_stats_data_mapping ; int fw_stats_data_sz ; struct hw_context context[8U] ; struct bnx2x_ilt *ilt ; int qm_cid_count ; bool dropless_fc ; void *t2 ; dma_addr_t t2_mapping ; struct cnic_ops *cnic_ops ; void *cnic_data ; u32 cnic_tag ; struct cnic_eth_dev cnic_eth_dev ; union host_hc_status_block cnic_sb ; dma_addr_t cnic_sb_mapping ; struct eth_spe *cnic_kwq ; struct eth_spe *cnic_kwq_prod ; struct eth_spe *cnic_kwq_cons ; struct eth_spe *cnic_kwq_last ; u16 cnic_kwq_pending ; u16 cnic_spq_pending ; u8 fip_mac[6U] ; struct mutex cnic_mutex ; struct bnx2x_vlan_mac_obj iscsi_l2_mac_obj ; u8 cnic_base_cl_id ; int dmae_ready ; spinlock_t dmae_lock ; struct mutex fw_mb_mutex ; int stats_state ; spinlock_t stats_lock ; struct dmae_command stats_dmae ; int executer_idx ; u16 stats_counter ; struct bnx2x_eth_stats eth_stats ; struct host_func_stats func_stats ; struct bnx2x_eth_stats_old eth_stats_old ; struct bnx2x_net_stats_old net_stats_old ; struct bnx2x_fw_port_stats_old fw_stats_old ; bool stats_init ; struct z_stream_s *strm ; void *gunzip_buf ; dma_addr_t gunzip_mapping ; int gunzip_outlen ; struct raw_op *init_ops ; u16 *init_ops_offsets ; u32 *init_data ; u32 init_mode_flags ; u8 const *tsem_int_table_data ; u8 const *tsem_pram_data ; u8 const *usem_int_table_data ; u8 const *usem_pram_data ; u8 const *xsem_int_table_data ; u8 const *xsem_pram_data ; u8 const *csem_int_table_data ; u8 const *csem_pram_data ; char fw_ver[32U] ; struct firmware const *firmware ; struct bnx2x_vfdb *vfdb ; u16 dcb_state ; int dcbx_enabled ; bool dcbx_mode_uset ; struct bnx2x_config_dcbx_params dcbx_config_params ; struct bnx2x_dcbx_port_params dcbx_port_params ; int dcb_version ; struct bnx2x_credit_pool_obj vlans_pool ; struct bnx2x_credit_pool_obj macs_pool ; struct bnx2x_rx_mode_obj rx_mode_obj ; struct bnx2x_mcast_obj mcast_obj ; struct bnx2x_rss_config_obj rss_conf_obj ; struct bnx2x_func_sp_obj func_obj ; unsigned long sp_state ; unsigned long sp_rtnl_state ; struct dcbx_features dcbx_local_feat ; u32 dcbx_error ; struct dcbx_features dcbx_remote_feat ; u32 dcbx_remote_flags ; int afex_def_vlan_tag ; enum mf_cfg_afex_vlan_mode afex_vlan_mode ; u32 pending_max ; u8 max_cos ; u8 prio_to_cos[8U] ; int fp_array_size ; u32 dump_preset_idx ; }; struct bnx2x_func_init_params { dma_addr_t fw_stat_map ; dma_addr_t spq_map ; u16 func_flgs ; u16 func_id ; u16 pf_id ; u16 spq_prod ; }; struct raw_op { unsigned char op ; unsigned int offset : 24 ; u32 raw_data ; }; struct op_read { unsigned char op ; unsigned int offset : 24 ; u32 val ; }; struct op_write { unsigned char op ; unsigned int offset : 24 ; u32 val ; }; struct op_arr_write { unsigned char op ; unsigned int offset : 24 ; u16 data_off ; u16 data_len ; }; struct op_zero { unsigned char op ; unsigned int offset : 24 ; u32 len ; }; struct op_if_mode { unsigned char op ; unsigned int cmd_offset : 24 ; u32 mode_bit_map ; }; union init_op { struct op_read read ; struct op_write write ; struct op_arr_write arr_wr ; struct op_zero zero ; struct raw_op raw ; struct op_if_mode if_mode ; }; struct ilt_line { dma_addr_t page_mapping ; void *page ; u32 size ; }; struct ilt_client_info { u32 page_size ; u16 start ; u16 end ; u16 client_num ; u16 flags ; }; struct bnx2x_ilt { u32 start_line ; struct ilt_line *lines ; struct ilt_client_info clients[4U] ; }; struct src_ent { u8 opaque[56U] ; u64 next ; }; struct __anonstruct_reg_mask_284 { u32 e1 ; u32 e1h ; u32 e2 ; u32 e3 ; }; struct __anonstruct_bnx2x_blocks_parity_data_283 { u32 mask_addr ; u32 sts_clr_addr ; u32 en_mask ; struct __anonstruct_reg_mask_284 reg_mask ; char name[8U] ; }; struct arb_line { int l ; int add ; int ubound ; }; enum sample_bulletin_result { PFVF_BULLETIN_UNCHANGED = 0, PFVF_BULLETIN_UPDATED = 1, PFVF_BULLETIN_CRC_ERR = 2 } ; struct bnx2x_sriov { u32 first_vf_in_pf ; int pos ; int nres ; u32 cap ; u16 ctrl ; u16 total ; u16 initial ; u16 nr_virtfn ; u16 offset ; u16 stride ; u32 pgsz ; u8 link ; }; struct bnx2x_vf_bar { u64 bar ; u32 size ; }; struct bnx2x_vf_queue { struct eth_context *cxt ; struct bnx2x_vlan_mac_obj mac_obj ; struct bnx2x_vlan_mac_obj vlan_obj ; atomic_t vlan_count ; struct bnx2x_queue_sp_obj sp_obj ; u32 cid ; u16 index ; u16 sb_idx ; }; struct bnx2x_vfop_qctor_params { struct bnx2x_queue_state_params qstate ; struct bnx2x_queue_setup_params prep_qsetup ; }; union bnx2x_vfop_params { struct bnx2x_vlan_mac_ramrod_params vlan_mac ; struct bnx2x_rx_mode_ramrod_params rx_mode ; struct bnx2x_mcast_ramrod_params mcast ; struct bnx2x_config_rss_params rss ; struct bnx2x_vfop_qctor_params qctor ; }; struct bnx2x_virtf; struct bnx2x_virtf { u16 cfg_flags ; u8 state ; u8 flr_clnup_stage ; dma_addr_t fw_stat_map ; dma_addr_t spq_map ; dma_addr_t bulletin_map ; struct vf_pf_resc_request alloc_resc ; u8 sb_count ; u8 igu_base_id ; struct bnx2x_vf_queue *vfqs ; u8 index ; u8 abs_vfid ; u8 sp_cl_id ; u32 error ; unsigned int bus ; unsigned int devfn ; struct bnx2x_vf_bar bars[6U] ; unsigned long filter_state ; int leading_rss ; struct bnx2x_mcast_obj mcast_obj ; struct bnx2x_rss_config_obj rss_conf_obj ; atomic_t op_in_progress ; int op_rc ; bool op_wait_blocking ; struct list_head op_list_head ; union bnx2x_vfop_params op_params ; struct mutex op_mutex ; enum channel_tlvs op_current ; }; struct bnx2x_vf_mbx_msg { union vfpf_tlvs req ; union pfvf_tlvs resp ; }; struct bnx2x_vf_mbx { struct bnx2x_vf_mbx_msg *msg ; dma_addr_t msg_mapping ; u32 vf_addr_lo ; u32 vf_addr_hi ; struct vfpf_first_tlv first_tlv ; u8 flags ; }; struct hw_dma { void *addr ; dma_addr_t mapping ; size_t size ; }; struct bnx2x_vfdb { struct bnx2x_virtf *vfs ; struct bnx2x_vf_queue *vfqs ; struct hw_dma context[2U] ; struct bnx2x_sriov sriov ; struct hw_dma mbx_dma ; struct bnx2x_vf_mbx mbxs[64U] ; struct hw_dma bulletin_dma ; struct hw_dma sp_dma ; u32 flrd_vfs[2U] ; }; struct firmware { size_t size ; u8 const *data ; struct page **pages ; void *priv ; }; struct bnx2x_fw_file_section { __be32 len ; __be32 offset ; }; struct bnx2x_fw_file_hdr { struct bnx2x_fw_file_section init_ops ; struct bnx2x_fw_file_section init_ops_offsets ; struct bnx2x_fw_file_section init_data ; struct bnx2x_fw_file_section tsem_int_table_data ; struct bnx2x_fw_file_section tsem_pram_data ; struct bnx2x_fw_file_section usem_int_table_data ; struct bnx2x_fw_file_section usem_pram_data ; struct bnx2x_fw_file_section csem_int_table_data ; struct bnx2x_fw_file_section csem_pram_data ; struct bnx2x_fw_file_section xsem_int_table_data ; struct bnx2x_fw_file_section xsem_pram_data ; struct bnx2x_fw_file_section iro_arr ; struct bnx2x_fw_file_section fw_version ; }; struct bnx2x_mac_vals { u32 xmac_addr ; u32 xmac_val ; u32 emac_addr ; u32 emac_val ; u32 umac_addr ; u32 umac_val ; u32 bmac_addr ; u32 bmac_val[2U] ; }; struct __anonstruct_board_info_294 { char *name ; }; struct pbf_pN_buf_regs { int pN ; u32 init_crd ; u32 crd ; u32 crd_freed ; }; struct pbf_pN_cmd_regs { int pN ; u32 lines_occup ; u32 lines_freed ; }; typedef int ldv_func_ret_type___2; enum hrtimer_restart; struct bnx2x_reg_set { u8 devad ; u16 reg ; u16 val ; }; struct bnx2x_nig_brb_pfc_port_params { u32 pause_enable ; u32 llfc_out_en ; u32 llfc_enable ; u32 pkt_priority_to_cos ; u8 num_of_rx_cos_priority_mask ; u32 rx_cos_priority_mask[6U] ; u32 llfc_high_priority_classes ; u32 llfc_low_priority_classes ; }; struct bnx2x_ets_bw_params { u8 bw ; }; struct bnx2x_ets_sp_params { u8 pri ; }; enum bnx2x_cos_state { bnx2x_cos_state_strict = 0, bnx2x_cos_state_bw = 1 } ; union __anonunion_params_228 { struct bnx2x_ets_bw_params bw_params ; struct bnx2x_ets_sp_params sp_params ; }; struct bnx2x_ets_cos_params { enum bnx2x_cos_state state ; union __anonunion_params_228 params ; }; struct bnx2x_ets_params { u8 num_of_cos ; struct bnx2x_ets_cos_params cos[6U] ; }; typedef __u16 __sum16; enum hrtimer_restart; struct skb_frag_struct; typedef struct skb_frag_struct skb_frag_t; struct __anonstruct_page_143 { struct page *p ; }; struct skb_frag_struct { struct __anonstruct_page_143 page ; __u32 page_offset ; __u32 size ; }; 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] ; }; enum gro_result { GRO_MERGED = 0, GRO_MERGED_FREE = 1, GRO_HELD = 2, GRO_NORMAL = 3, GRO_DROP = 4 } ; typedef enum gro_result gro_result_t; struct napi_gro_cb { void *frag0 ; unsigned int frag0_len ; int data_offset ; int flush ; u16 count ; u8 same_flow ; u8 free ; unsigned long age ; int proto ; struct sk_buff *last ; }; struct vlan_ethhdr { unsigned char h_dest[6U] ; unsigned char h_source[6U] ; __be16 h_vlan_proto ; __be16 h_vlan_TCI ; __be16 h_vlan_encapsulated_proto ; }; 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 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 ; }; union tcp_word_hdr { struct tcphdr hdr ; __be32 words[5U] ; }; struct ipv6hdr { unsigned char priority : 4 ; unsigned char version : 4 ; __u8 flow_lbl[3U] ; __be16 payload_len ; __u8 nexthdr ; __u8 hop_limit ; struct in6_addr saddr ; struct in6_addr daddr ; }; enum eth_rss_hash_type { DEFAULT_HASH_TYPE = 0, IPV4_HASH_TYPE = 1, TCP_IPV4_HASH_TYPE = 2, IPV6_HASH_TYPE = 3, TCP_IPV6_HASH_TYPE = 4, VLAN_PRI_HASH_TYPE = 5, E1HOV_PRI_HASH_TYPE = 6, DSCP_HASH_TYPE = 7, MAX_ETH_RSS_HASH_TYPE = 8 } ; enum eth_rx_cqe_type { RX_ETH_CQE_TYPE_ETH_FASTPATH = 0, RX_ETH_CQE_TYPE_ETH_RAMROD = 1, RX_ETH_CQE_TYPE_ETH_START_AGG = 2, RX_ETH_CQE_TYPE_ETH_STOP_AGG = 3, MAX_ETH_RX_CQE_TYPE = 4 } ; struct ustorm_eth_rx_producers { u16 cqe_prod ; u16 bd_prod ; u16 sge_prod ; u16 reserved ; }; enum hrtimer_restart; struct dump_header { u32 header_size ; u32 version ; u32 preset ; u32 dump_meta_data ; }; struct reg_addr { u32 addr ; u32 size ; u32 chips ; u32 presets ; }; struct wreg_addr { u32 addr ; u32 size ; u32 read_regs_count ; u32 const *read_regs ; u32 chips ; u32 presets ; }; struct __anonstruct_reg_mask_248 { u32 e1 ; u32 e1h ; u32 e2 ; u32 e3 ; }; struct __anonstruct_bnx2x_blocks_parity_data_247 { u32 mask_addr ; u32 sts_clr_addr ; u32 en_mask ; struct __anonstruct_reg_mask_248 reg_mask ; char name[8U] ; }; struct __anonstruct_bnx2x_q_stats_arr_253 { long offset ; int size ; char string[32U] ; }; struct __anonstruct_bnx2x_stats_arr_254 { long offset ; int size ; u32 flags ; char string[32U] ; }; struct __anonstruct_reg_tbl_259 { u32 hw ; u32 offset0 ; u32 offset1 ; u32 mask ; }; struct __anonstruct_mem_tbl_261 { u32 offset ; int size ; }; struct __anonstruct_prty_tbl_263 { char *name ; u32 offset ; u32 hw_mask[5U] ; }; struct code_entry { u32 sram_start_addr ; u32 code_attribute ; u32 nvm_start_addr ; }; struct crc_pair { int offset ; int size ; }; struct _ddebug { char const *modname ; char const *function ; char const *filename ; char const *format ; unsigned int lineno : 18 ; unsigned char flags ; }; enum bnx2x_stats_state { STATS_STATE_DISABLED = 0, STATS_STATE_ENABLED = 1, STATS_STATE_MAX = 2 } ; enum hrtimer_restart; struct __anonstruct_diff_248 { u32 lo ; u32 hi ; }; struct __anonstruct_diff_250 { u32 lo ; u32 hi ; }; struct __anonstruct_bnx2x_stats_stm_251 { void (*action)(struct bnx2x * ) ; enum bnx2x_stats_state next_state ; }; enum hrtimer_restart; struct lldp_admin_mib { u32 ver_cfg_flags ; struct dcbx_features features ; }; struct lldp_remote_mib { u32 prefix_seq_num ; u32 flags ; struct dcbx_features features ; u32 suffix_seq_num ; }; struct lldp_local_mib { u32 prefix_seq_num ; u32 error ; struct dcbx_features features ; u32 suffix_seq_num ; }; struct cos_entry_help_data { u32 pri_join_mask ; u32 cos_bw ; u8 strict ; bool pausable ; }; struct cos_help_data { struct cos_entry_help_data data[3U] ; u8 num_of_cos ; }; struct pg_entry_help_data { u8 num_of_dif_pri ; u8 pg ; u32 pg_priority ; }; struct pg_help_data { struct pg_entry_help_data data[3U] ; u8 num_of_pg ; }; enum hrtimer_restart; struct tx_queue_init_ramrod_data { struct client_init_general_data general ; struct client_init_tx_data tx ; }; struct function_update_data { u8 vif_id_change_flg ; u8 afex_default_vlan_change_flg ; u8 allowed_priorities_change_flg ; u8 network_cos_mode_change_flg ; __le16 vif_id ; __le16 afex_default_vlan ; u8 allowed_priorities ; u8 network_cos_mode ; u8 lb_mode_en_change_flg ; u8 lb_mode_en ; u8 tx_switch_suspend_change_flg ; u8 tx_switch_suspend ; u8 echo ; u8 reserved1 ; u8 update_gre_cfg_flg ; u8 gre_tunnel_mode ; u8 gre_tunnel_rss ; u8 nvgre_clss_en ; u32 reserved3 ; }; struct bnx2x_mcast_mac_elem { struct list_head link ; u8 mac[6U] ; u8 pad[2U] ; }; union __anonunion_data_252 { struct list_head macs_head ; u32 macs_num ; int next_bin ; }; struct bnx2x_pending_mcast_cmd { struct list_head link ; int type ; union __anonunion_data_252 data ; bool done ; }; enum hrtimer_restart; struct vf_pf_channel_zone_data { u32 msg_addr_lo ; u32 msg_addr_hi ; }; struct non_trigger_vf_zone { struct vf_pf_channel_zone_data vf_pf_channel ; }; struct vf_pf_channel_zone_trigger { u8 addr_valid ; }; struct trigger_vf_zone { struct vf_pf_channel_zone_trigger vf_pf_channel ; u8 reserved0 ; u16 reserved1 ; u32 reserved2 ; }; struct cstorm_vf_zone_data { struct non_trigger_vf_zone non_trigger ; struct trigger_vf_zone trigger ; }; struct bnx2x_vfop_cmd { void (*done)(struct bnx2x * , struct bnx2x_virtf * ) ; bool block ; }; struct bnx2x_vfop_filter { struct list_head link ; int type ; bool add ; u8 *mac ; u16 vid ; }; struct bnx2x_vfop_filters { int add_cnt ; struct list_head head ; struct bnx2x_vfop_filter filters[] ; }; struct bnx2x_vfop_args_mcast { int mc_num ; struct bnx2x_mcast_list_elem *mc ; }; struct bnx2x_vfop_args_qctor { int qid ; u16 sb_idx ; }; struct bnx2x_vfop_args_qdtor { int qid ; struct eth_context *cxt ; }; struct bnx2x_vfop_args_defvlan { int qid ; bool enable ; u16 vid ; u8 prio ; }; struct bnx2x_vfop_args_qx { int qid ; bool en_add ; }; struct bnx2x_vfop_args_filters { struct bnx2x_vfop_filters *multi_filter ; atomic_t *credit ; }; union bnx2x_vfop_args { struct bnx2x_vfop_args_mcast mc_list ; struct bnx2x_vfop_args_qctor qctor ; struct bnx2x_vfop_args_qdtor qdtor ; struct bnx2x_vfop_args_defvlan defvlan ; struct bnx2x_vfop_args_qx qx ; struct bnx2x_vfop_args_filters filters ; }; struct bnx2x_vfop { struct list_head link ; int rc ; int state ; union bnx2x_vfop_args args ; union bnx2x_vfop_params *op_p ; void (*transition)(struct bnx2x * , struct bnx2x_virtf * ) ; void (*done)(struct bnx2x * , struct bnx2x_virtf * ) ; }; typedef u8 bnx2x_mac_addr_t[6U]; enum bnx2x_vfop_filters_state { BNX2X_VFOP_MBX_Q_FILTERS_MACS = 0, BNX2X_VFOP_MBX_Q_FILTERS_VLANS = 1, BNX2X_VFOP_MBX_Q_FILTERS_RXMODE = 2, BNX2X_VFOP_MBX_Q_FILTERS_MCAST = 3, BNX2X_VFOP_MBX_Q_FILTERS_DONE = 4 } ; typedef int ldv_func_ret_type___4; typedef int ldv_func_ret_type___5; typedef int ldv_func_ret_type___6; enum hrtimer_restart; enum bnx2x_vfop_qctor_state { BNX2X_VFOP_QCTOR_INIT = 0, BNX2X_VFOP_QCTOR_SETUP = 1, BNX2X_VFOP_QCTOR_INT_EN = 2 } ; enum bnx2x_vfop_qdtor_state { BNX2X_VFOP_QDTOR_HALT = 0, BNX2X_VFOP_QDTOR_TERMINATE = 1, BNX2X_VFOP_QDTOR_CFCDEL = 2, BNX2X_VFOP_QDTOR_DONE = 3 } ; enum bnx2x_vfop_vlan_mac_state { BNX2X_VFOP_VLAN_MAC_CONFIG_SINGLE = 0, BNX2X_VFOP_VLAN_MAC_CLEAR = 1, BNX2X_VFOP_VLAN_MAC_CHK_DONE = 2, BNX2X_VFOP_MAC_CONFIG_LIST = 3, BNX2X_VFOP_VLAN_CONFIG_LIST = 4, BNX2X_VFOP_VLAN_CONFIG_LIST_0 = 5 } ; enum bnx2x_vfop_qsetup_state { BNX2X_VFOP_QSETUP_CTOR = 0, BNX2X_VFOP_QSETUP_VLAN0 = 1, BNX2X_VFOP_QSETUP_DONE = 2 } ; enum bnx2x_vfop_mcast_state { BNX2X_VFOP_MCAST_DEL = 0, BNX2X_VFOP_MCAST_ADD = 1, BNX2X_VFOP_MCAST_CHK_DONE = 2 } ; enum bnx2x_vfop_qflr_state { BNX2X_VFOP_QFLR_CLR_VLAN = 0, BNX2X_VFOP_QFLR_CLR_MAC = 1, BNX2X_VFOP_QFLR_TERMINATE = 2, BNX2X_VFOP_QFLR_DONE = 3 } ; enum bnx2x_vfop_flr_state { BNX2X_VFOP_FLR_QUEUES = 0, BNX2X_VFOP_FLR_HW = 1 } ; enum bnx2x_vfop_close_state { BNX2X_VFOP_CLOSE_QUEUES = 0, BNX2X_VFOP_CLOSE_HW = 1 } ; enum bnx2x_vfop_rxmode_state { BNX2X_VFOP_RXMODE_CONFIG = 0, BNX2X_VFOP_RXMODE_DONE = 1 } ; enum bnx2x_vfop_qteardown_state { BNX2X_VFOP_QTEARDOWN_RXMODE = 0, BNX2X_VFOP_QTEARDOWN_CLR_VLAN = 1, BNX2X_VFOP_QTEARDOWN_CLR_MAC = 2, BNX2X_VFOP_QTEARDOWN_QDTOR = 3, BNX2X_VFOP_QTEARDOWN_DONE = 4 } ; struct bnx2x_vfop_vlan_mac_flags { bool drv_only ; bool dont_consume ; bool single_cmd ; bool add ; }; long ldv__builtin_expect(long exp , long c ) ; extern struct module __this_module ; __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 __set_bit(int nr , unsigned long volatile *addr ) { { __asm__ volatile ("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 void __clear_bit(int nr , unsigned long volatile *addr ) { { __asm__ volatile ("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 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 fls(int x ) { int r ; { __asm__ ("bsrl %1,%0": "=r" (r): "rm" (x), "0" (-1)); return (r + 1); } } __inline static __u32 __arch_swab32(__u32 val ) { { __asm__ ("bswapl %0": "=r" (val): "0" (val)); return (val); } } __inline static __u16 __fswab16(__u16 val ) { { return ((__u16 )((int )((short )((int )val << 8)) | (int )((short )((int )val >> 8)))); } } __inline static __u32 __fswab32(__u32 val ) { __u32 tmp ; { tmp = __arch_swab32(val); return (tmp); } } __inline static int __ilog2_u32(u32 n ) { int tmp ; { tmp = fls((int )n); return (tmp + -1); } } extern int printk(char const * , ...) ; extern void __might_sleep(char const * , int , 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(struct list_head *new , struct list_head *head ) { { __list_add(new, head, head->next); return; } } __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 void __bad_percpu_size(void) ; extern void *__memcpy(void * , void const * , size_t ) ; extern void *memset(void * , int , size_t ) ; extern size_t strlcpy(char * , char const * , size_t ) ; extern int strncmp(char const * , 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 *)"/work/ldvuser/exper_fp/inst/current/envs/linux-3.10-rc1.tar/linux-3.10-rc1/arch/x86/include/asm/paravirt.h"), "i" (824), "i" (12UL)); ldv_4781: ; goto ldv_4781; } 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" (44UL), [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_set(atomic_t *v , int i ) { { v->counter = i; return; } } __inline static void atomic_add(int i , atomic_t *v ) { { __asm__ volatile (".pushsection .smp_locks,\"a\"\n.balign 4\n.long 671f - .\n.popsection\n671:\n\tlock; addl %1,%0": "+m" (v->counter): "ir" (i)); return; } } __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 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; } } extern void lockdep_init_map(struct lockdep_map * , char const * , struct lock_class_key * , int ) ; 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 int lock_is_held(struct lockdep_map * ) ; extern void lockdep_rcu_suspicious(char const * , int const , char const * ) ; extern void __mutex_init(struct mutex * , char const * , struct lock_class_key * ) ; 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_10(struct mutex *ldv_func_arg1 ) ; void ldv_mutex_unlock_12(struct mutex *ldv_func_arg1 ) ; void ldv_mutex_unlock_14(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_9(struct mutex *ldv_func_arg1 ) ; void ldv_mutex_lock_11(struct mutex *ldv_func_arg1 ) ; void ldv_mutex_lock_13(struct mutex *ldv_func_arg1 ) ; void ldv_mutex_lock_cnic_mutex_of_bnx2x(struct mutex *lock ) ; void ldv_mutex_unlock_cnic_mutex_of_bnx2x(struct mutex *lock ) ; void ldv_mutex_lock_fw_mb_mutex_of_bnx2x(struct mutex *lock ) ; void ldv_mutex_unlock_fw_mb_mutex_of_bnx2x(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 ) ; 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 1UL: __asm__ ("movb %%gs:%P1,%0": "=q" (pfo_ret__): "p" (& kernel_stack)); goto ldv_6354; case 2UL: __asm__ ("movw %%gs:%P1,%0": "=r" (pfo_ret__): "p" (& kernel_stack)); goto ldv_6354; case 4UL: __asm__ ("movl %%gs:%P1,%0": "=r" (pfo_ret__): "p" (& kernel_stack)); goto ldv_6354; case 8UL: __asm__ ("movq %%gs:%P1,%0": "=r" (pfo_ret__): "p" (& kernel_stack)); goto ldv_6354; default: __bad_percpu_size(); } ldv_6354: ti = (struct thread_info *)(pfo_ret__ - 8152UL); return (ti); } } extern void local_bh_disable(void) ; extern void local_bh_enable(void) ; extern void __raw_spin_lock_init(raw_spinlock_t * , char const * , struct lock_class_key * ) ; extern void _raw_spin_lock(raw_spinlock_t * ) ; extern void _raw_spin_lock_bh(raw_spinlock_t * ) ; extern void _raw_spin_unlock(raw_spinlock_t * ) ; extern void _raw_spin_unlock_bh(raw_spinlock_t * ) ; __inline static raw_spinlock_t *spinlock_check(spinlock_t *lock ) { { return (& lock->ldv_6014.rlock); } } __inline static void spin_lock(spinlock_t *lock ) { { _raw_spin_lock(& lock->ldv_6014.rlock); return; } } __inline static void spin_lock_bh(spinlock_t *lock ) { { _raw_spin_lock_bh(& lock->ldv_6014.rlock); return; } } __inline static void spin_unlock(spinlock_t *lock ) { { _raw_spin_unlock(& lock->ldv_6014.rlock); return; } } __inline static void spin_unlock_bh(spinlock_t *lock ) { { _raw_spin_unlock_bh(& lock->ldv_6014.rlock); return; } } extern void synchronize_sched(void) ; __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; } } __inline static void synchronize_rcu(void) { { synchronize_sched(); return; } } extern int rcu_is_cpu_idle(void) ; extern bool rcu_lockdep_current_cpu_online(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 int rcu_read_lock_held(void) { int tmp ; int tmp___0 ; bool tmp___1 ; int tmp___2 ; int tmp___3 ; { tmp = debug_lockdep_rcu_enabled(); if (tmp == 0) { return (1); } else { } tmp___0 = rcu_is_cpu_idle(); if (tmp___0 != 0) { return (0); } else { } tmp___1 = rcu_lockdep_current_cpu_online(); if (tmp___1) { tmp___2 = 0; } else { tmp___2 = 1; } if (tmp___2) { return (0); } else { } tmp___3 = lock_is_held(& rcu_lock_map); return (tmp___3); } } __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", 771, "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", 792, "rcu_read_unlock() used illegally while idle"); } else { } } else { } rcu_lock_release(& rcu_lock_map); __rcu_read_unlock(); return; } } extern unsigned long volatile jiffies ; extern void init_timer_key(struct timer_list * , unsigned int , char const * , struct lock_class_key * ) ; extern int mod_timer(struct timer_list * , unsigned long ) ; extern int del_timer_sync(struct timer_list * ) ; extern void delayed_work_timer_fn(unsigned long ) ; extern void __init_work(struct work_struct * , int ) ; extern struct workqueue_struct *system_wq ; 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_delayed_work_on(int , struct workqueue_struct * , struct delayed_work * , unsigned long ) ; extern void flush_workqueue(struct workqueue_struct * ) ; extern bool cancel_delayed_work(struct delayed_work * ) ; extern bool cancel_delayed_work_sync(struct delayed_work * ) ; __inline static bool queue_delayed_work(struct workqueue_struct *wq , struct delayed_work *dwork , unsigned long delay ) { bool tmp ; { tmp = queue_delayed_work_on(4096, wq, dwork, delay); return (tmp); } } __inline static bool schedule_delayed_work(struct delayed_work *dwork , unsigned long delay ) { bool tmp ; { tmp = queue_delayed_work(system_wq, dwork, delay); return (tmp); } } __inline static unsigned char readb(void const volatile *addr ) { unsigned char ret ; { __asm__ volatile ("movb %1,%0": "=q" (ret): "m" (*((unsigned char volatile *)addr)): "memory"); return (ret); } } __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 writeb(unsigned char val , void volatile *addr ) { { __asm__ volatile ("movb %0,%1": : "q" (val), "m" (*((unsigned char volatile *)addr)): "memory"); return; } } __inline static void writew(unsigned short val , void volatile *addr ) { { __asm__ volatile ("movw %0,%1": : "r" (val), "m" (*((unsigned short volatile *)addr)): "memory"); return; } } __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 * ) ; extern void *vmalloc(unsigned long ) ; extern void vfree(void const * ) ; extern int cpu_number ; extern void __bad_size_call_parameter(void) ; extern void __free_pages(struct page * , unsigned int ) ; extern void *dev_get_drvdata(struct device const * ) ; extern int dev_set_drvdata(struct device * , void * ) ; extern int dev_err(struct device const * , char const * , ...) ; extern int _dev_info(struct device const * , char const * , ...) ; 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 synchronize_irq(unsigned int ) ; extern int pci_find_capability(struct pci_dev * , int ) ; extern int pci_bus_read_config_word(struct pci_bus * , unsigned int , int , u16 * ) ; extern int pci_bus_read_config_dword(struct pci_bus * , unsigned int , int , u32 * ) ; extern int pci_bus_write_config_word(struct pci_bus * , unsigned int , int , u16 ) ; extern int pci_bus_write_config_dword(struct pci_bus * , unsigned int , int , u32 ) ; __inline static int pci_read_config_word(struct pci_dev const *dev , int where , u16 *val ) { int tmp ; { tmp = pci_bus_read_config_word(dev->bus, dev->devfn, where, val); return (tmp); } } __inline static int pci_read_config_dword(struct pci_dev const *dev , int where , u32 *val ) { int tmp ; { tmp = pci_bus_read_config_dword(dev->bus, dev->devfn, where, val); return (tmp); } } __inline static int pci_write_config_word(struct pci_dev const *dev , int where , u16 val ) { int tmp ; { tmp = pci_bus_write_config_word(dev->bus, dev->devfn, where, (int )val); return (tmp); } } __inline static int pci_write_config_dword(struct pci_dev const *dev , int where , u32 val ) { int tmp ; { tmp = pci_bus_write_config_dword(dev->bus, dev->devfn, where, val); return (tmp); } } extern int pcie_capability_read_word(struct pci_dev * , int , u16 * ) ; 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 void pci_intx(struct pci_dev * , int ) ; extern int pci_save_state(struct pci_dev * ) ; extern void pci_restore_state(struct pci_dev * ) ; extern ssize_t pci_read_vpd(struct pci_dev * , loff_t , size_t , void * ) ; 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 void pci_disable_msi(struct pci_dev * ) ; extern void pci_disable_msix(struct pci_dev * ) ; __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_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 void debug_dma_free_coherent(struct device * , size_t , void * , dma_addr_t ) ; extern struct device x86_dma_fallback_dev ; 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); } } } __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_22506: ; goto ldv_22506; } 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; } } extern int dma_supported(struct device * , u64 ) ; extern int dma_set_mask(struct device * , u64 ) ; __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) { dma_mask = (int )gfp & 1 ? 16777215UL : 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); } } __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("/work/ldvuser/exper_fp/inst/current/envs/linux-3.10-rc1.tar/linux-3.10-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 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; } } extern void *pci_ioremap_bar(struct pci_dev * , int ) ; __inline static int pci_pcie_cap(struct pci_dev *dev ) { { return ((int )dev->pcie_cap); } } __inline static bool pci_is_pcie(struct pci_dev *dev ) { int tmp ; { tmp = pci_pcie_cap(dev); return (tmp != 0); } } __inline static u16 pci_vpd_lrdt_size(u8 const *lrdt ) { { return ((int )((u16 )*(lrdt + 1UL)) + ((int )((u16 )*(lrdt + 2UL)) << 8U)); } } __inline static u8 pci_vpd_info_field_size(u8 const *info_field ) { { return ((u8 )*(info_field + 2UL)); } } extern int pci_vpd_find_tag(u8 const * , unsigned int , unsigned int , u8 ) ; extern int pci_vpd_find_info_keyword(u8 const * , unsigned int , unsigned int , char const * ) ; extern void __const_udelay(unsigned long ) ; extern void msleep(unsigned int ) ; extern void usleep_range(unsigned long , unsigned long ) ; extern int down_interruptible(struct semaphore * ) ; extern int down_trylock(struct semaphore * ) ; extern void up(struct semaphore * ) ; extern void get_random_bytes(void * , int ) ; 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; } } __inline static void netdev_reset_tc(struct net_device *dev ) { { dev->num_tc = 0U; memset((void *)(& dev->tc_to_txq), 0, 64UL); memset((void *)(& dev->prio_tc_map), 0, 16UL); return; } } __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); } } extern void netif_napi_del(struct napi_struct * ) ; extern void free_netdev(struct net_device * ) ; 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_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_tx_wake_all_queues(struct net_device *dev ) { unsigned int i ; struct netdev_queue *txq ; struct netdev_queue *tmp ; { i = 0U; goto ldv_39524; ldv_39523: tmp = netdev_get_tx_queue((struct net_device const *)dev, i); txq = tmp; netif_tx_wake_queue(txq); i = i + 1U; ldv_39524: ; if (dev->num_tx_queues > i) { goto ldv_39523; } else { } return; } } __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", 1907); } else { } tmp___0 = ldv__builtin_expect(__ret_warn_on != 0, 0L); if (tmp___0 != 0L) { printk("\016bnx2x: netif_stop_queue() cannot be called before register_netdev()\n"); return; } else { } set_bit(0U, (unsigned long volatile *)(& dev_queue->state)); return; } } __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); } } extern void netif_carrier_off(struct net_device * ) ; extern void netif_device_detach(struct net_device * ) ; extern void netif_device_attach(struct net_device * ) ; __inline static void __netif_tx_lock(struct netdev_queue *txq , int cpu ) { { spin_lock(& txq->_xmit_lock); txq->xmit_lock_owner = cpu; return; } } __inline static void __netif_tx_unlock(struct netdev_queue *txq ) { { txq->xmit_lock_owner = -1; spin_unlock(& txq->_xmit_lock); return; } } __inline static void netif_tx_disable(struct net_device *dev ) { unsigned int i ; int cpu ; int pscr_ret__ ; void const *__vpp_verify ; int pfo_ret__ ; int pfo_ret_____0 ; int pfo_ret_____1 ; int pfo_ret_____2 ; struct netdev_queue *txq ; struct netdev_queue *tmp ; { local_bh_disable(); __vpp_verify = 0; switch (4UL) { case 1UL: ; switch (4UL) { case 1UL: __asm__ ("movb %%gs:%P1,%0": "=q" (pfo_ret__): "m" (cpu_number)); goto ldv_40035; case 2UL: __asm__ ("movw %%gs:%P1,%0": "=r" (pfo_ret__): "m" (cpu_number)); goto ldv_40035; case 4UL: __asm__ ("movl %%gs:%P1,%0": "=r" (pfo_ret__): "m" (cpu_number)); goto ldv_40035; case 8UL: __asm__ ("movq %%gs:%P1,%0": "=r" (pfo_ret__): "m" (cpu_number)); goto ldv_40035; default: __bad_percpu_size(); } ldv_40035: pscr_ret__ = pfo_ret__; goto ldv_40041; case 2UL: ; switch (4UL) { case 1UL: __asm__ ("movb %%gs:%P1,%0": "=q" (pfo_ret_____0): "m" (cpu_number)); goto ldv_40045; case 2UL: __asm__ ("movw %%gs:%P1,%0": "=r" (pfo_ret_____0): "m" (cpu_number)); goto ldv_40045; case 4UL: __asm__ ("movl %%gs:%P1,%0": "=r" (pfo_ret_____0): "m" (cpu_number)); goto ldv_40045; case 8UL: __asm__ ("movq %%gs:%P1,%0": "=r" (pfo_ret_____0): "m" (cpu_number)); goto ldv_40045; default: __bad_percpu_size(); } ldv_40045: pscr_ret__ = pfo_ret_____0; goto ldv_40041; case 4UL: ; switch (4UL) { case 1UL: __asm__ ("movb %%gs:%P1,%0": "=q" (pfo_ret_____1): "m" (cpu_number)); goto ldv_40054; case 2UL: __asm__ ("movw %%gs:%P1,%0": "=r" (pfo_ret_____1): "m" (cpu_number)); goto ldv_40054; case 4UL: __asm__ ("movl %%gs:%P1,%0": "=r" (pfo_ret_____1): "m" (cpu_number)); goto ldv_40054; case 8UL: __asm__ ("movq %%gs:%P1,%0": "=r" (pfo_ret_____1): "m" (cpu_number)); goto ldv_40054; default: __bad_percpu_size(); } ldv_40054: pscr_ret__ = pfo_ret_____1; goto ldv_40041; case 8UL: ; switch (4UL) { case 1UL: __asm__ ("movb %%gs:%P1,%0": "=q" (pfo_ret_____2): "m" (cpu_number)); goto ldv_40063; case 2UL: __asm__ ("movw %%gs:%P1,%0": "=r" (pfo_ret_____2): "m" (cpu_number)); goto ldv_40063; case 4UL: __asm__ ("movl %%gs:%P1,%0": "=r" (pfo_ret_____2): "m" (cpu_number)); goto ldv_40063; case 8UL: __asm__ ("movq %%gs:%P1,%0": "=r" (pfo_ret_____2): "m" (cpu_number)); goto ldv_40063; default: __bad_percpu_size(); } ldv_40063: pscr_ret__ = pfo_ret_____2; goto ldv_40041; default: __bad_size_call_parameter(); goto ldv_40041; } ldv_40041: cpu = pscr_ret__; i = 0U; goto ldv_40073; ldv_40072: tmp = netdev_get_tx_queue((struct net_device const *)dev, i); txq = tmp; __netif_tx_lock(txq, cpu); netif_tx_stop_queue(txq); __netif_tx_unlock(txq); i = i + 1U; ldv_40073: ; if (dev->num_tx_queues > i) { goto ldv_40072; } else { } local_bh_enable(); return; } } __inline static void netif_addr_lock_bh(struct net_device *dev ) { { spin_lock_bh(& dev->addr_list_lock); return; } } __inline static void netif_addr_unlock_bh(struct net_device *dev ) { { spin_unlock_bh(& dev->addr_list_lock); return; } } extern int register_netdev(struct net_device * ) ; extern void unregister_netdev(struct net_device * ) ; extern int dev_addr_add(struct net_device * , unsigned char const * , unsigned char ) ; extern int dev_addr_del(struct net_device * , unsigned char const * , unsigned char ) ; extern int netdev_printk(char const * , struct net_device const * , char const * , ...) ; extern int netdev_err(struct net_device const * , char const * , ...) ; extern int netdev_info(struct net_device const * , char const * , ...) ; 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); } } __inline static void eth_random_addr(u8 *addr ) { { get_random_bytes((void *)addr, 6); *addr = (unsigned int )*addr & 254U; *addr = (u8 )((unsigned int )*addr | 2U); return; } } __inline static void eth_hw_addr_random(struct net_device *dev ) { { dev->addr_assign_type = 1U; eth_random_addr(dev->dev_addr); return; } } __inline static struct mii_ioctl_data *if_mii(struct ifreq *rq ) { { return ((struct mii_ioctl_data *)(& rq->ifr_ifru)); } } extern void rtnl_lock(void) ; extern void rtnl_unlock(void) ; extern int zlib_inflate_workspacesize(void) ; extern int zlib_inflate(z_streamp , int ) ; extern int zlib_inflateEnd(z_streamp ) ; extern int zlib_inflateInit2(z_streamp , int ) ; extern int mdio_mii_ioctl(struct mdio_if_info const * , struct mii_ioctl_data * , int ) ; int bnx2x_phy_init(struct link_params *params , struct link_vars *vars ) ; int bnx2x_link_reset(struct link_params *params , struct link_vars *vars , u8 reset_ext_phy ) ; int bnx2x_lfa_reset(struct link_params *params , struct link_vars *vars ) ; int bnx2x_link_update(struct link_params *params , struct link_vars *vars ) ; int bnx2x_phy_read(struct link_params *params , u8 phy_addr , u8 devad , u16 reg , u16 *ret_val ) ; int bnx2x_phy_write(struct link_params *params , u8 phy_addr , u8 devad , u16 reg , u16 val ) ; void bnx2x_link_status_update(struct link_params *params , struct link_vars *vars ) ; void bnx2x_handle_module_detect_int(struct link_params *params ) ; int bnx2x_test_link(struct link_params *params , struct link_vars *vars , u8 is_serdes ) ; int bnx2x_common_init_phy(struct bnx2x *bp , u32 *shmem_base_path , u32 *shmem2_base_path , u32 chip_id ) ; void bnx2x_hw_reset_phy(struct link_params *params ) ; int bnx2x_phy_probe(struct link_params *params ) ; u8 bnx2x_fan_failure_det_req(struct bnx2x *bp , u32 shmem_base , u32 shmem2_base , u8 port ) ; void bnx2x_set_rx_filter(struct link_params *params , u8 en ) ; void bnx2x_init_mod_abs_int(struct bnx2x *bp , struct link_vars *vars , u32 chip_id , u32 shmem_base , u32 shmem2_base , u8 port ) ; void bnx2x_period_func(struct link_params *params , struct link_vars *vars ) ; void bnx2x_init_func_obj(struct bnx2x *bp , struct bnx2x_func_sp_obj *obj , void *rdata , dma_addr_t rdata_mapping , void *afex_rdata , dma_addr_t afex_rdata_mapping , struct bnx2x_func_sp_drv_ops *drv_iface ) ; int bnx2x_func_state_change(struct bnx2x *bp , struct bnx2x_func_state_params *params ) ; enum bnx2x_func_state bnx2x_func_get_state(struct bnx2x *bp , struct bnx2x_func_sp_obj *o ) ; void bnx2x_init_queue_obj(struct bnx2x *bp , struct bnx2x_queue_sp_obj *obj , u8 cl_id , u32 *cids , u8 cid_cnt , u8 func_id , void *rdata , dma_addr_t rdata_mapping , unsigned long type ) ; int bnx2x_queue_state_change(struct bnx2x *bp , struct bnx2x_queue_state_params *params ) ; void bnx2x_init_mac_obj(struct bnx2x *bp , struct bnx2x_vlan_mac_obj *mac_obj , u8 cl_id , u32 cid , u8 func_id , void *rdata , dma_addr_t rdata_mapping , int state , unsigned long *pstate , bnx2x_obj_type type , struct bnx2x_credit_pool_obj *macs_pool ) ; int bnx2x_config_vlan_mac(struct bnx2x *bp , struct bnx2x_vlan_mac_ramrod_params *p ) ; int bnx2x_config_rx_mode(struct bnx2x *bp , struct bnx2x_rx_mode_ramrod_params *p ) ; int bnx2x_config_mcast(struct bnx2x *bp , struct bnx2x_mcast_ramrod_params *p , enum bnx2x_mcast_cmd cmd ) ; void bnx2x_dcbx_init_params(struct bnx2x *bp ) ; void bnx2x_dcbx_set_state(struct bnx2x *bp , bool dcb_on , u32 dcbx_enabled ) ; void bnx2x_dcbx_set_params(struct bnx2x *bp , u32 state ) ; void bnx2x_dcbx_pmf_update(struct bnx2x *bp ) ; struct dcbnl_rtnl_ops const bnx2x_dcbnl_ops ; int bnx2x_dcbnl_update_applist(struct bnx2x *bp , bool delall ) ; void bnx2x_memset_stats(struct bnx2x *bp ) ; void bnx2x_stats_init(struct bnx2x *bp ) ; void bnx2x_stats_handle(struct bnx2x *bp , enum bnx2x_stats_event event ) ; void bnx2x_save_statistics(struct bnx2x *bp ) ; void bnx2x_afex_collect_stats(struct bnx2x *bp , void *void_afex_stats , u32 stats_type ) ; void bnx2x_panic_dump(struct bnx2x *bp , bool disable_int ) ; struct workqueue_struct *bnx2x_wq ; int num_queues ; int bnx2x_set_mac_one(struct bnx2x *bp , u8 *mac , struct bnx2x_vlan_mac_obj *obj , bool set , int mac_type , unsigned long *ramrod_flags ) ; int bnx2x_del_all_macs(struct bnx2x *bp , struct bnx2x_vlan_mac_obj *mac_obj , int mac_type , bool wait_for_comp ) ; void bnx2x_func_init(struct bnx2x *bp , struct bnx2x_func_init_params *p ) ; void bnx2x_init_sb(struct bnx2x *bp , dma_addr_t mapping , int vfid , u8 vf_valid , int fw_sb_id , int igu_sb_id ) ; u32 bnx2x_get_pretend_reg(struct bnx2x *bp ) ; int bnx2x_get_gpio(struct bnx2x *bp , int gpio_num , u8 port ) ; int bnx2x_set_gpio(struct bnx2x *bp , int gpio_num , u32 mode , u8 port ) ; int bnx2x_set_mult_gpio(struct bnx2x *bp , u8 pins , u32 mode ) ; int bnx2x_set_gpio_int(struct bnx2x *bp , int gpio_num , u32 mode , u8 port ) ; void bnx2x_read_mf_cfg(struct bnx2x *bp ) ; int bnx2x_pretend_func(struct bnx2x *bp , u16 pretend_func_val ) ; void bnx2x_read_dmae(struct bnx2x *bp , u32 src_addr , u32 len32 ) ; void bnx2x_write_dmae(struct bnx2x *bp , dma_addr_t dma_addr , u32 dst_addr , u32 len32 ) ; void bnx2x_post_dmae(struct bnx2x *bp , struct dmae_command *dmae , int idx ) ; u32 bnx2x_dmae_opcode_add_comp(u32 opcode , u8 comp_type ) ; u32 bnx2x_dmae_opcode_clr_src_reset(u32 opcode ) ; u32 bnx2x_dmae_opcode(struct bnx2x *bp , u8 src_type , u8 dst_type , bool with_comp , u8 comp_type ) ; void bnx2x_prep_dmae_with_comp(struct bnx2x *bp , struct dmae_command *dmae , u8 src_type , u8 dst_type ) ; int bnx2x_issue_dmae_with_comp(struct bnx2x *bp , struct dmae_command *dmae ) ; void bnx2x_dp_dmae(struct bnx2x *bp , struct dmae_command *dmae , int msglvl ) ; u32 bnx2x_flr_clnup_poll_count(struct bnx2x *bp ) ; void bnx2x_tx_hw_flushed(struct bnx2x *bp , u32 poll_count ) ; int bnx2x_send_final_clnup(struct bnx2x *bp , u8 clnup_func , u32 poll_cnt ) ; u8 bnx2x_is_pcie_pending(struct pci_dev *dev ) ; int bnx2x_flr_clnup_poll_hw_counter(struct bnx2x *bp , u32 reg , char *msg , u32 poll_cnt ) ; void bnx2x_calc_fc_adv(struct bnx2x *bp ) ; int bnx2x_sp_post(struct bnx2x *bp , int command , int cid , u32 data_hi , u32 data_lo , int cmd_type ) ; void bnx2x_update_coalesce(struct bnx2x *bp ) ; __inline static u32 reg_poll(struct bnx2x *bp , u32 reg , u32 expected , int ms , int wait ) { u32 val ; { ldv_53824: val = readl((void const volatile *)bp->regview + (unsigned long )reg); if (val == expected) { goto ldv_53823; } else { } ms = ms - wait; msleep((unsigned int )wait); if (ms > 0) { goto ldv_53824; } else { } ldv_53823: ; return (val); } } void bnx2x_igu_clear_sb_gen(struct bnx2x *bp , u8 func , u8 idu_sb_id , bool is_pf ) ; int bnx2x_nic_load_analyze_req(struct bnx2x *bp , u32 load_code ) ; static u32 const dmae_reg_go_c[16U] = { 1056896U, 1056900U, 1056928U, 1056932U, 1056936U, 1056940U, 1056944U, 1056948U, 1056952U, 1056956U, 1056904U, 1056908U, 1056912U, 1056916U, 1056920U, 1056924U}; void bnx2x_set_ethtool_ops(struct bnx2x *bp , struct net_device *netdev ) ; void bnx2x_notify_link_changed(struct bnx2x *bp ) ; __inline static void bnx2x_init_max(struct cmng_init_input const *input_data , u32 r_param , struct cmng_init *ram_data ) { u32 vnic ; struct cmng_vnic *vdata ; struct cmng_struct_per_port *pdata ; { vdata = & ram_data->vnic; pdata = & ram_data->port; pdata->rs_vars.rs_periodic_timeout = 100U; pdata->rs_vars.rs_threshold = (r_param * 2000U) / 4U; vnic = 0U; goto ldv_53985; ldv_53984: vdata->vnic_max_rate[vnic].vn_counter.rate = input_data->vnic_max_rate[vnic]; vdata->vnic_max_rate[vnic].vn_counter.quota = ((unsigned int )vdata->vnic_max_rate[vnic].vn_counter.rate * 400U) / 8U; vnic = vnic + 1U; ldv_53985: ; if (vnic <= 3U) { goto ldv_53984; } else { } return; } } __inline static void bnx2x_init_min(struct cmng_init_input const *input_data , u32 r_param , struct cmng_init *ram_data ) { u32 vnic ; u32 fair_periodic_timeout_usec ; u32 vnicWeightSum ; u32 tFair ; struct cmng_vnic *vdata ; struct cmng_struct_per_port *pdata ; { vdata = & ram_data->vnic; pdata = & ram_data->port; fair_periodic_timeout_usec = 160000U / r_param; tFair = 154214400U / (unsigned int )input_data->port_rate; pdata->fair_vars.fair_threshold = 160000U; pdata->fair_vars.upper_bound = (r_param * tFair) * 2U; pdata->fair_vars.fairness_timeout = fair_periodic_timeout_usec / 4U; vnicWeightSum = 0U; vnic = 0U; goto ldv_53999; ldv_53998: vnicWeightSum = (u32 )input_data->vnic_min_rate[vnic] + vnicWeightSum; vnic = vnic + 1U; ldv_53999: ; if (vnic <= 3U) { goto ldv_53998; } else { } if (vnicWeightSum != 0U) { vnic = 0U; goto ldv_54002; ldv_54001: vdata->vnic_min_rate[vnic].vn_credit_delta = ((unsigned int )input_data->vnic_min_rate[vnic] * (154214400U / (vnicWeightSum * 800U))) * 100U; if (vdata->vnic_min_rate[vnic].vn_credit_delta < pdata->fair_vars.fair_threshold + 32768U) { vdata->vnic_min_rate[vnic].vn_credit_delta = pdata->fair_vars.fair_threshold + 32768U; } else { } vnic = vnic + 1U; ldv_54002: ; if (vnic <= 3U) { goto ldv_54001; } else { } } else { } return; } } __inline static void bnx2x_init_fw_wrr(struct cmng_init_input const *input_data , u32 r_param , struct cmng_init *ram_data ) { u32 vnic ; u32 cos ; u32 cosWeightSum ; struct cmng_vnic *vdata ; struct cmng_struct_per_port *pdata ; u32 *ccd ; { cosWeightSum = 0U; vdata = & ram_data->vnic; pdata = & ram_data->port; cos = 0U; goto ldv_54015; ldv_54014: cosWeightSum = (u32 )input_data->cos_min_rate[cos] + cosWeightSum; cos = cos + 1U; ldv_54015: ; if (cos <= 3U) { goto ldv_54014; } else { } if (cosWeightSum != 0U) { vnic = 0U; goto ldv_54022; ldv_54021: ccd = (u32 *)(& vdata->vnic_min_rate[vnic].cos_credit_delta); cos = 0U; goto ldv_54019; ldv_54018: *(ccd + (unsigned long )cos) = ((unsigned int )input_data->cos_min_rate[cos] * (154214400U / (cosWeightSum * 800U))) * 100U; if (*(ccd + (unsigned long )cos) < pdata->fair_vars.fair_threshold + 32768U) { *(ccd + (unsigned long )cos) = pdata->fair_vars.fair_threshold + 32768U; } else { } cos = cos + 1U; ldv_54019: ; if (cos <= 3U) { goto ldv_54018; } else { } vnic = vnic + 1U; ldv_54022: ; if (vnic <= 3U) { goto ldv_54021; } else { } } else { } return; } } __inline static void bnx2x_init_safc(struct cmng_init_input const *input_data , struct cmng_init *ram_data ) { { ram_data->port.safc_vars.safc_timeout_usec = 52U; return; } } __inline static void bnx2x_init_cmng(struct cmng_init_input const *input_data , struct cmng_init *ram_data ) { u32 r_param ; { memset((void *)ram_data, 0, 200UL); ram_data->port.flags = input_data->flags; r_param = (unsigned int )input_data->port_rate / 8U; bnx2x_init_max(input_data, r_param, ram_data); bnx2x_init_min(input_data, r_param, ram_data); bnx2x_init_fw_wrr(input_data, r_param, ram_data); bnx2x_init_safc(input_data, ram_data); return; } } static struct __anonstruct_bnx2x_blocks_parity_data_283 const bnx2x_blocks_parity_data[40U] = { {1061012U, 1061004U, 134217727U, {67108863U, 67108863U, 134217727U, 134217727U}, {'P', 'X', 'P', '\000'}}, {1181064U, 1181056U, 4294967295U, {4294967295U, 4294967295U, 4294967295U, 4294967295U}, {'P', 'X', 'P', '2', '_', '0', '\000'}}, {1181080U, 1181072U, 33554431U, {127U, 127U, 2047U, 33554431U}, {'P', 'X', 'P', '2', '_', '1', '\000'}}, {1081504U, 1081496U, 7U, {7U, 7U, 0U, 0U}, {'H', 'C', '\000'}}, {66524U, 66516U, 4294967295U, {1073741823U, 4294967295U, 0U, 0U}, {'N', 'I', 'G', '\000'}}, {99272U, 99264U, 4294967295U, {0U, 0U, 4294967295U, 4294967295U}, {'N', 'I', 'G', '_', '0', '\000'}}, {99288U, 99280U, 65535U, {0U, 0U, 255U, 65535U}, {'N', 'I', 'G', '_', '1', '\000'}}, {1245352U, 1245344U, 2047U, {0U, 0U, 2047U, 2047U}, {'I', 'G', 'U', '\000'}}, {41880U, 41872U, 1U, {1U, 1U, 1U, 1U}, {'M', 'I', 'S', 'C', '\000'}}, {1475668U, 1475660U, 0U, {511U, 4095U, 4095U, 4095U}, {'Q', 'M', '\000'}}, {1114584U, 1114576U, 31U, {0U, 0U, 31U, 31U}, {'A', 'T', 'C', '\000'}}, {37556U, 37548U, 3U, {0U, 0U, 3U, 3U}, {'P', 'G', 'L', 'U', 'E', '_', 'B', '\000'}}, {1507728U, 1507720U, 0U, {3U, 3U, 3U, 3U}, {'D', 'O', 'R', 'Q', '\000'}}, {790584U, 790576U, 15U, {15U, 15U, 15U, 15U}, {'U', 'P', 'B', '\000'}}, {1445944U, 1445936U, 0U, {15U, 15U, 15U, 15U}, {'X', 'P', 'B', '\000'}}, {263368U, 263360U, 4U, {7U, 7U, 7U, 7U}, {'S', 'R', 'C', '\000'}}, {1052748U, 1052740U, 0U, {31U, 31U, 31U, 31U}, {'C', 'D', 'U', '\000'}}, {1065240U, 1065232U, 0U, {15U, 15U, 15U, 63U}, {'C', 'F', 'C', '\000'}}, {49320U, 49312U, 0U, {1U, 1U, 1U, 1U}, {'D', 'B', 'G', '\000'}}, {1056868U, 1056860U, 0U, {15U, 15U, 15U, 15U}, {'D', 'M', 'A', 'E', '\000'}}, {393528U, 393520U, 0U, {15U, 15U, 15U, 15U}, {'B', 'R', 'B', '1', '\000'}}, {262564U, 262556U, 64U, {255U, 255U, 255U, 255U}, {'P', 'R', 'S', '\000'}}, {1311204U, 1311196U, 0U, {0U, 262143U, 1048575U, 268435455U}, {'P', 'B', 'F', '\000'}}, {1458444U, 1458436U, 0U, {0U, 127U, 127U, 127U}, {'T', 'M', '\000'}}, {271036U, 271028U, 24U, {2047U, 2047U, 2047U, 2047U}, {'T', 'S', 'D', 'M', '\000'}}, {795324U, 795316U, 8U, {2047U, 2047U, 2047U, 2047U}, {'C', 'S', 'D', 'M', '\000'}}, {803520U, 803512U, 56U, {2047U, 2047U, 2047U, 2047U}, {'U', 'S', 'D', 'M', '\000'}}, {1467068U, 1467060U, 8U, {2047U, 2047U, 2047U, 2047U}, {'X', 'S', 'D', 'M', '\000'}}, {328172U, 328164U, 0U, {0U, 134217727U, 134217727U, 134217727U}, {'T', 'C', 'M', '\000'}}, {852468U, 852460U, 0U, {0U, 134217727U, 134217727U, 134217727U}, {'C', 'C', 'M', '\000'}}, {917988U, 917980U, 0U, {0U, 134217727U, 134217727U, 134217727U}, {'U', 'C', 'M', '\000'}}, {131780U, 131772U, 0U, {0U, 1073741823U, 1073741823U, 1073741823U}, {'X', 'C', 'M', '\000'}}, {1573152U, 1573144U, 0U, {4294967295U, 4294967295U, 4294967295U, 4294967295U}, {'T', 'S', 'E', 'M', '_', '0', '\000'}}, {1573168U, 1573160U, 0U, {3U, 31U, 63U, 63U}, {'T', 'S', 'E', 'M', '_', '1', '\000'}}, {3146032U, 3146024U, 0U, {4294967295U, 4294967295U, 4294967295U, 4294967295U}, {'U', 'S', 'E', 'M', '_', '0', '\000'}}, {3146048U, 3146040U, 0U, {3U, 31U, 31U, 31U}, {'U', 'S', 'E', 'M', '_', '1', '\000'}}, {2097456U, 2097448U, 0U, {4294967295U, 4294967295U, 4294967295U, 4294967295U}, {'C', 'S', 'E', 'M', '_', '0', '\000'}}, {2097472U, 2097464U, 0U, {3U, 31U, 31U, 31U}, {'C', 'S', 'E', 'M', '_', '1', '\000'}}, {2621744U, 2621736U, 0U, {4294967295U, 4294967295U, 4294967295U, 4294967295U}, {'X', 'S', 'E', 'M', '_', '0', '\000'}}, {2621760U, 2621752U, 0U, {3U, 31U, 63U, 63U}, {'X', 'S', 'E', 'M', '_', '1', '\000'}}}; static u32 const mcp_attn_ctl_regs[6U] = { 41080U, 41208U, 41224U, 41240U, 41368U, 41384U}; __inline static void bnx2x_set_mcp_parity(struct bnx2x *bp , u8 enable ) { int i ; u32 reg_val ; { i = 0; goto ldv_54071; ldv_54070: reg_val = readl((void const volatile *)bp->regview + (unsigned long )mcp_attn_ctl_regs[i]); if ((unsigned int )enable != 0U) { reg_val = reg_val | 4026531840U; } else { reg_val = reg_val & 268435455U; } writel(reg_val, (void volatile *)bp->regview + (unsigned long )mcp_attn_ctl_regs[i]); i = i + 1; ldv_54071: ; if ((unsigned int )i <= 5U) { goto ldv_54070; } else { } return; } } __inline static u32 bnx2x_parity_reg_mask(struct bnx2x *bp , int idx ) { { if (bp->common.chip_id >> 16 == 5710U) { return ((u32 )bnx2x_blocks_parity_data[idx].reg_mask.e1); } else if (bp->common.chip_id >> 16 == 5711U || bp->common.chip_id >> 16 == 5712U) { return ((u32 )bnx2x_blocks_parity_data[idx].reg_mask.e1h); } else if ((bp->common.chip_id >> 16 == 5730U || bp->common.chip_id >> 16 == 5731U) || bp->common.chip_id >> 16 == 5743U) { return ((u32 )bnx2x_blocks_parity_data[idx].reg_mask.e2); } else { return ((u32 )bnx2x_blocks_parity_data[idx].reg_mask.e3); } } } __inline static void bnx2x_enable_blocks_parity(struct bnx2x *bp ) { int i ; u32 reg_mask ; u32 tmp ; { i = 0; goto ldv_54109; ldv_54108: tmp = bnx2x_parity_reg_mask(bp, i); reg_mask = tmp; if (reg_mask != 0U) { writel((unsigned int )bnx2x_blocks_parity_data[i].en_mask & reg_mask, (void volatile *)bp->regview + (unsigned long )bnx2x_blocks_parity_data[i].mask_addr); } else { } i = i + 1; ldv_54109: ; if ((unsigned int )i <= 39U) { goto ldv_54108; } else { } bnx2x_set_mcp_parity(bp, 1); return; } } static int bnx2x_gunzip(struct bnx2x *bp , u8 const *zbuf , int len ) ; static void bnx2x_reg_wr_ind(struct bnx2x *bp , u32 addr , u32 val ) ; static void bnx2x_write_dmae_phys_len(struct bnx2x *bp , dma_addr_t phys_addr , u32 addr , u32 len ) ; static void bnx2x_init_str_wr(struct bnx2x *bp , u32 addr , u32 const *data , u32 len ) { u32 i ; { i = 0U; goto ldv_54132; ldv_54131: writel(*(data + (unsigned long )i), (void volatile *)bp->regview + (unsigned long )(i * 4U + addr)); i = i + 1U; ldv_54132: ; if (i < len) { goto ldv_54131; } else { } return; } } static void bnx2x_init_ind_wr(struct bnx2x *bp , u32 addr , u32 const *data , u32 len ) { u32 i ; { i = 0U; goto ldv_54142; ldv_54141: bnx2x_reg_wr_ind(bp, i * 4U + addr, *(data + (unsigned long )i)); i = i + 1U; ldv_54142: ; if (i < len) { goto ldv_54141; } else { } return; } } static void bnx2x_write_big_buf(struct bnx2x *bp , u32 addr , u32 len , u8 wb ) { { if (bp->dmae_ready != 0) { bnx2x_write_dmae_phys_len(bp, bp->gunzip_mapping, addr, len); } else if ((unsigned int )wb != 0U && bp->common.chip_id >> 16 == 5710U) { bnx2x_init_ind_wr(bp, addr, (u32 const *)bp->gunzip_buf, len); } else { bnx2x_init_str_wr(bp, addr, (u32 const *)bp->gunzip_buf, len); } return; } } static void bnx2x_init_fill(struct bnx2x *bp , u32 addr , int fill , u32 len , u8 wb ) { u32 buf_len ; u32 buf_len32 ; u32 i ; u32 cur_len ; u32 _min1 ; u32 _min2 ; { buf_len = 32768U < len * 4U ? 32768U : len * 4U; buf_len32 = buf_len / 4U; memset(bp->gunzip_buf, (int )((unsigned char )fill), (size_t )buf_len); i = 0U; goto ldv_54165; ldv_54164: _min1 = buf_len32; _min2 = len - i; cur_len = _min1 < _min2 ? _min1 : _min2; bnx2x_write_big_buf(bp, i * 4U + addr, cur_len, (int )wb); i = i + buf_len32; ldv_54165: ; if (i < len) { goto ldv_54164; } else { } return; } } static void bnx2x_write_big_buf_wb(struct bnx2x *bp , u32 addr , u32 len ) { { if (bp->dmae_ready != 0) { bnx2x_write_dmae_phys_len(bp, bp->gunzip_mapping, addr, len); } else if (bp->common.chip_id >> 16 == 5710U) { bnx2x_init_ind_wr(bp, addr, (u32 const *)bp->gunzip_buf, len); } else { bnx2x_init_str_wr(bp, addr, (u32 const *)bp->gunzip_buf, len); } return; } } static void bnx2x_init_wr_64(struct bnx2x *bp , u32 addr , u32 const *data , u32 len64 ) { u32 buf_len32 ; u32 len ; u64 data64 ; u32 i ; unsigned int _min1 ; u32 _min2 ; u64 *pdata ; u32 cur_len ; u32 _min1___0 ; u32 _min2___0 ; { buf_len32 = 8192U; len = len64 * 2U; data64 = 0ULL; data64 = ((unsigned long long )*(data + 1UL) << 32) + (unsigned long long )*data; _min1 = 4096U; _min2 = len64; len64 = _min1 < _min2 ? _min1 : _min2; i = 0U; goto ldv_54187; ldv_54186: pdata = (u64 *)bp->gunzip_buf + (unsigned long )i; *pdata = data64; i = i + 1U; ldv_54187: ; if (i < len64) { goto ldv_54186; } else { } i = 0U; goto ldv_54194; ldv_54193: _min1___0 = buf_len32; _min2___0 = len - i; cur_len = _min1___0 < _min2___0 ? _min1___0 : _min2___0; bnx2x_write_big_buf_wb(bp, i * 4U + addr, cur_len); i = i + buf_len32; ldv_54194: ; if (i < len) { goto ldv_54193; } else { } return; } } static u8 const *bnx2x_sel_blob(struct bnx2x *bp , u32 addr , u8 const *data ) { { if (addr > 1573887U && addr <= 1574912U) { data = bp->tsem_int_table_data; } else if (addr > 2098175U && addr <= 2099200U) { data = bp->csem_int_table_data; } else if (addr > 3146751U && addr <= 3147776U) { data = bp->usem_int_table_data; } else if (addr > 2622463U && addr <= 2623488U) { data = bp->xsem_int_table_data; } else if (addr > 1835007U && addr <= 2097152U) { data = bp->tsem_pram_data; } else if (addr > 2359295U && addr <= 2621440U) { data = bp->csem_pram_data; } else if (addr > 3407871U && addr <= 3670016U) { data = bp->usem_pram_data; } else if (addr > 2883583U && addr <= 3145728U) { data = bp->xsem_pram_data; } else { } return (data); } } static void bnx2x_init_wr_wb(struct bnx2x *bp , u32 addr , u32 const *data , u32 len ) { size_t __len ; void *__ret ; { if (bp->dmae_ready != 0) { __len = (size_t )(len * 4U); __ret = __builtin_memcpy(bp->gunzip_buf, (void const *)data, __len); bnx2x_write_big_buf_wb(bp, addr, len); } else if (bp->common.chip_id >> 16 == 5710U) { bnx2x_init_ind_wr(bp, addr, data, len); } else { bnx2x_init_str_wr(bp, addr, data, len); } return; } } static void bnx2x_wr_64(struct bnx2x *bp , u32 reg , u32 val_lo , u32 val_hi ) { u32 wb_write[2U] ; size_t __len ; void *__ret ; { wb_write[0] = val_lo; wb_write[1] = val_hi; __len = 8UL; if (__len > 63UL) { __ret = __memcpy((void *)(& (bp->slowpath)->wb_data), (void const *)(& wb_write), __len); } else { __ret = __builtin_memcpy((void *)(& (bp->slowpath)->wb_data), (void const *)(& wb_write), __len); } bnx2x_write_dmae(bp, bp->slowpath_mapping + 4392ULL, reg, 2U); return; } } static void bnx2x_init_wr_zp(struct bnx2x *bp , u32 addr , u32 len , u32 blob_off ) { u8 const *data ; int rc ; u32 i ; u8 const *tmp ; { data = 0; tmp = bnx2x_sel_blob(bp, addr, data); data = tmp + (unsigned long )(blob_off * 4U); rc = bnx2x_gunzip(bp, data, (int )len); if (rc != 0) { return; } else { } len = (u32 )bp->gunzip_outlen; i = 0U; goto ldv_54230; ldv_54229: *((u32 *)bp->gunzip_buf + (unsigned long )i) = *((u32 *)bp->gunzip_buf + (unsigned long )i); i = i + 1U; ldv_54230: ; if (i < len) { goto ldv_54229; } else { } bnx2x_write_big_buf_wb(bp, addr, len); return; } } static void bnx2x_init_block(struct bnx2x *bp , u32 block , u32 stage ) { u16 op_start ; u16 op_end ; union init_op const *op ; u32 op_idx ; u32 op_type ; u32 addr ; u32 len ; u32 const *data ; u32 const *data_base ; { op_start = *(bp->init_ops_offsets + (unsigned long )((block * 11U + stage) * 2U)); op_end = *(bp->init_ops_offsets + (unsigned long )((block * 11U + stage) * 2U + 1U)); if ((int )op_start == (int )op_end) { return; } else { } data_base = (u32 const *)bp->init_data; op_idx = (u32 )op_start; goto ldv_54259; ldv_54258: op = (union init_op const *)bp->init_ops + (unsigned long )op_idx; op_type = (u32 )op->raw.op; addr = (u32 )op->raw.offset; len = (u32 )op->arr_wr.data_len; data = data_base + (unsigned long )op->arr_wr.data_off; switch (op_type) { case 1U: readl((void const volatile *)bp->regview + (unsigned long )addr); goto ldv_54247; case 2U: writel(op->write.val, (void volatile *)bp->regview + (unsigned long )addr); goto ldv_54247; case 3U: bnx2x_init_str_wr(bp, addr, data, len); goto ldv_54247; case 7U: bnx2x_init_wr_wb(bp, addr, data, len); goto ldv_54247; case 4U: bnx2x_init_fill(bp, addr, 0, op->zero.len, 0); goto ldv_54247; case 8U: bnx2x_init_fill(bp, addr, 0, op->zero.len, 1); goto ldv_54247; case 5U: bnx2x_init_wr_zp(bp, addr, len, (u32 )op->arr_wr.data_off); goto ldv_54247; case 6U: bnx2x_init_wr_64(bp, addr, data, len); goto ldv_54247; case 10U: ; if ((bp->init_mode_flags & (u32 )op->if_mode.mode_bit_map) != (u32 )op->if_mode.mode_bit_map) { op_idx = (u32 )op->if_mode.cmd_offset + op_idx; } else { } goto ldv_54247; case 9U: ; if ((bp->init_mode_flags & (u32 )op->if_mode.mode_bit_map) == 0U) { op_idx = (u32 )op->if_mode.cmd_offset + op_idx; } else { } goto ldv_54247; default: ; goto ldv_54247; } ldv_54247: op_idx = op_idx + 1U; ldv_54259: ; if ((u32 )op_end > op_idx) { goto ldv_54258; } else { } return; } } static struct arb_line const read_arb_data[29U][4U] = { { {8, 64, 25}, {16, 64, 25}, {32, 64, 25}, {64, 64, 41}}, { {4, 8, 4}, {4, 8, 4}, {4, 8, 4}, {4, 8, 4}}, { {4, 3, 3}, {4, 3, 3}, {4, 3, 3}, {4, 3, 3}}, { {8, 3, 6}, {16, 3, 11}, {16, 3, 11}, {16, 3, 11}}, { {8, 64, 25}, {16, 64, 25}, {32, 64, 25}, {64, 64, 41}}, { {8, 3, 6}, {16, 3, 11}, {32, 3, 21}, {64, 3, 41}}, { {8, 3, 6}, {16, 3, 11}, {32, 3, 21}, {64, 3, 41}}, { {8, 3, 6}, {16, 3, 11}, {32, 3, 21}, {64, 3, 41}}, { {8, 3, 6}, {16, 3, 11}, {32, 3, 21}, {64, 3, 41}}, { {8, 3, 6}, {16, 3, 11}, {32, 3, 21}, {32, 3, 21}}, { {8, 3, 6}, {16, 3, 11}, {32, 3, 21}, {32, 3, 21}}, { {8, 3, 6}, {16, 3, 11}, {32, 3, 21}, {32, 3, 21}}, { {8, 3, 6}, {16, 3, 11}, {32, 3, 21}, {32, 3, 21}}, { {8, 3, 6}, {16, 3, 11}, {32, 3, 21}, {32, 3, 21}}, { {8, 3, 6}, {16, 3, 11}, {32, 3, 21}, {32, 3, 21}}, { {8, 3, 6}, {16, 3, 11}, {32, 3, 21}, {32, 3, 21}}, { {8, 64, 6}, {16, 64, 11}, {32, 64, 21}, {32, 64, 21}}, { {8, 3, 6}, {16, 3, 11}, {32, 3, 21}, {32, 3, 21}}, { {8, 3, 6}, {16, 3, 11}, {32, 3, 21}, {32, 3, 21}}, { {8, 3, 6}, {16, 3, 11}, {32, 3, 21}, {32, 3, 21}}, { {8, 3, 6}, {16, 3, 11}, {32, 3, 21}, {32, 3, 21}}, { {8, 3, 6}, {16, 3, 11}, {32, 3, 21}, {32, 3, 21}}, { {8, 3, 6}, {16, 3, 11}, {32, 3, 21}, {32, 3, 21}}, { {8, 3, 6}, {16, 3, 11}, {32, 3, 21}, {32, 3, 21}}, { {8, 3, 6}, {16, 3, 11}, {32, 3, 21}, {32, 3, 21}}, { {8, 3, 6}, {16, 3, 11}, {32, 3, 21}, {32, 3, 21}}, { {8, 3, 6}, {16, 3, 11}, {32, 3, 21}, {32, 3, 21}}, { {8, 3, 6}, {16, 3, 11}, {32, 3, 21}, {32, 3, 21}}, { {8, 64, 25}, {16, 64, 41}, {32, 64, 81}, {64, 64, 120}}}; static struct arb_line const write_arb_data[13U][3U] = { { {4, 6, 3}, {4, 6, 3}, {4, 6, 3}}, { {4, 2, 3}, {4, 2, 3}, {4, 2, 3}}, { {8, 2, 6}, {16, 2, 11}, {16, 2, 11}}, { {8, 2, 6}, {16, 2, 11}, {32, 2, 21}}, { {8, 2, 6}, {16, 2, 11}, {32, 2, 21}}, { {8, 2, 6}, {16, 2, 11}, {32, 2, 21}}, { {8, 64, 25}, {16, 64, 25}, {32, 64, 25}}, { {8, 2, 6}, {16, 2, 11}, {16, 2, 11}}, { {8, 2, 6}, {16, 2, 11}, {16, 2, 11}}, { {8, 9, 6}, {16, 9, 11}, {32, 9, 21}}, { {8, 47, 19}, {16, 47, 19}, {32, 47, 21}}, { {8, 9, 6}, {16, 9, 11}, {16, 9, 11}}, { {8, 64, 25}, {16, 64, 41}, {32, 64, 81}}}; static struct arb_line const read_arb_addr[28U] = { {1180332, 1180092, 1180212}, {1180336, 1180096, 1180216}, {1180340, 1180100, 1180220}, {1180344, 1180104, 1180224}, {1180348, 1180108, 1180228}, {1180352, 1180112, 1180232}, {1180356, 1180116, 1180236}, {1180360, 1180120, 1180240}, {1180364, 1180124, 1180244}, {1180368, 1180128, 1180248}, {1180372, 1180132, 1180252}, {1180376, 1180136, 1180256}, {1180380, 1180140, 1180260}, {1180384, 1180144, 1180264}, {1180388, 1180148, 1180268}, {1180392, 1180152, 1180272}, {1180396, 1180156, 1180276}, {1180400, 1180160, 1180280}, {1180404, 1180164, 1180284}, {1180408, 1180168, 1180288}, {1180412, 1180172, 1180292}, {1180416, 1180176, 1180296}, {1180420, 1180180, 1180300}, {1180424, 1180184, 1180304}, {1180428, 1180188, 1180308}, {1180432, 1180192, 1180312}, {1180436, 1180196, 1180316}, {1180440, 1180200, 1180320}}; static struct arb_line const write_arb_addr[12U] = { {1180336, 1180096, 1180216}, {1180340, 1180100, 1180220}, {1180344, 1180104, 1180224}, {1180356, 1180116, 1180236}, {1180360, 1180120, 1180240}, {1180364, 1180124, 1180244}, {1180368, 1180128, 1180248}, {1180372, 1180132, 1180252}, {1180376, 1180136, 1180256}, {1180440, 1180200, 1180320}, {1180444, 1180204, 1180324}, {1180448, 1180208, 1180328}}; static void bnx2x_init_pxp_arb(struct bnx2x *bp , int r_order , int w_order ) { u32 val ; u32 i ; long tmp ; long tmp___0 ; long tmp___1 ; long tmp___2 ; { if (r_order > 3) { tmp = ldv__builtin_expect((bp->msg_enable & 8192) != 0, 0L); if (tmp != 0L) { printk("\rbnx2x: [%s:%d(%s)]read order of %d order adjusted to %d\n", "bnx2x_init_pxp_arb", 480, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", r_order, 3); } else { } r_order = 3; } else { } if (w_order > 2) { tmp___0 = ldv__builtin_expect((bp->msg_enable & 8192) != 0, 0L); if (tmp___0 != 0L) { printk("\rbnx2x: [%s:%d(%s)]write order of %d order adjusted to %d\n", "bnx2x_init_pxp_arb", 485, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", w_order, 2); } else { } w_order = 2; } else { } if ((bp->common.chip_id & 61440U) > 20480U && (bp->common.chip_id & 4096U) != 0U) { tmp___1 = ldv__builtin_expect((bp->msg_enable & 8192) != 0, 0L); if (tmp___1 != 0L) { printk("\rbnx2x: [%s:%d(%s)]write order adjusted to 1 for FPGA\n", "bnx2x_init_pxp_arb", 489, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } w_order = 0; } else { } tmp___2 = ldv__builtin_expect((bp->msg_enable & 8192) != 0, 0L); if (tmp___2 != 0L) { printk("\rbnx2x: [%s:%d(%s)]read order %d write order %d\n", "bnx2x_init_pxp_arb", 492, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", r_order, w_order); } else { } i = 0U; goto ldv_54278; ldv_54277: writel((unsigned int )read_arb_data[i][r_order].l, (void volatile *)bp->regview + (unsigned long )read_arb_addr[i].l); writel((unsigned int )read_arb_data[i][r_order].add, (void volatile *)bp->regview + (unsigned long )read_arb_addr[i].add); writel((unsigned int )read_arb_data[i][r_order].ubound, (void volatile *)bp->regview + (unsigned long )read_arb_addr[i].ubound); i = i + 1U; ldv_54278: ; if (i <= 27U) { goto ldv_54277; } else { } i = 0U; goto ldv_54281; ldv_54280: ; if ((int )write_arb_addr[i].l == 1180444 || (int )write_arb_addr[i].l == 1180448) { writel((unsigned int )write_arb_data[i][w_order].l, (void volatile *)bp->regview + (unsigned long )write_arb_addr[i].l); writel((unsigned int )write_arb_data[i][w_order].add, (void volatile *)bp->regview + (unsigned long )write_arb_addr[i].add); writel((unsigned int )write_arb_data[i][w_order].ubound, (void volatile *)bp->regview + (unsigned long )write_arb_addr[i].ubound); } else { val = readl((void const volatile *)bp->regview + (unsigned long )write_arb_addr[i].l); writel((u32 )(write_arb_data[i][w_order].l << 10) | val, (void volatile *)bp->regview + (unsigned long )write_arb_addr[i].l); val = readl((void const volatile *)bp->regview + (unsigned long )write_arb_addr[i].add); writel((u32 )(write_arb_data[i][w_order].add << 10) | val, (void volatile *)bp->regview + (unsigned long )write_arb_addr[i].add); val = readl((void const volatile *)bp->regview + (unsigned long )write_arb_addr[i].ubound); writel((u32 )(write_arb_data[i][w_order].ubound << 7) | val, (void volatile *)bp->regview + (unsigned long )write_arb_addr[i].ubound); } i = i + 1U; ldv_54281: ; if (i <= 11U) { goto ldv_54280; } else { } val = (u32 )write_arb_data[12][w_order].add; val = (u32 )(write_arb_data[12][w_order].ubound << 10) + val; val = (u32 )(write_arb_data[12][w_order].l << 17) + val; writel(val, (void volatile *)bp->regview + 1180452U); val = (u32 )read_arb_data[28][r_order].add; val = (u32 )(read_arb_data[28][r_order].ubound << 10) + val; val = (u32 )(read_arb_data[28][r_order].l << 17) + val; writel(val, (void volatile *)bp->regview + 1180456U); writel((unsigned int )w_order, (void volatile *)bp->regview + 1179996U); writel((unsigned int )w_order, (void volatile *)bp->regview + 1180004U); writel((unsigned int )r_order, (void volatile *)bp->regview + 1180000U); writel((unsigned int )r_order, (void volatile *)bp->regview + 1180008U); if ((bp->common.chip_id >> 16 == 5710U || (bp->common.chip_id >> 16 == 5711U || bp->common.chip_id >> 16 == 5712U)) && r_order == 3) { writel(3584U, (void volatile *)bp->regview + 1180476U); } else { } if (((((((((bp->common.chip_id >> 16 == 5770U || bp->common.chip_id >> 16 == 5797U) || bp->common.chip_id >> 16 == 5801U) || bp->common.chip_id >> 16 == 5774U) || bp->common.chip_id >> 16 == 5806U) || bp->common.chip_id >> 16 == 5807U) || ((bp->common.chip_id >> 16 == 5693U || bp->common.chip_id >> 16 == 5694U) || bp->common.chip_id >> 16 == 5695U)) || ((bp->common.chip_id >> 16 == 5793U || bp->common.chip_id >> 16 == 5794U) || bp->common.chip_id >> 16 == 5773U)) || (bp->common.chip_id >> 16 == 5796U || bp->common.chip_id >> 16 == 5803U)) || bp->common.chip_id >> 16 == 5805U) { writel((unsigned int )(4 << w_order), (void volatile *)bp->regview + 1180488U); } else if ((bp->common.chip_id >> 16 == 5730U || bp->common.chip_id >> 16 == 5731U) || bp->common.chip_id >> 16 == 5743U) { writel((unsigned int )(8 << w_order), (void volatile *)bp->regview + 1180488U); } else { writel((unsigned int )(24 << w_order), (void volatile *)bp->regview + 1180488U); } if (bp->common.chip_id >> 16 != 5710U) { if (bp->common.chip_id >> 16 != 5711U && bp->common.chip_id >> 16 != 5712U) { val = (u32 )w_order; writel(val, (void volatile *)bp->regview + 1181164U); } else { val = w_order == 0 ? 2U : 3U; writel(2U, (void volatile *)bp->regview + 1181164U); } writel(val, (void volatile *)bp->regview + 1181128U); writel(val, (void volatile *)bp->regview + 1181132U); writel(val, (void volatile *)bp->regview + 1181136U); writel(val, (void volatile *)bp->regview + 1181140U); writel(val, (void volatile *)bp->regview + 1181144U); writel(val, (void volatile *)bp->regview + 1181148U); writel(val, (void volatile *)bp->regview + 1181152U); writel(val, (void volatile *)bp->regview + 1181156U); writel(val, (void volatile *)bp->regview + 1181160U); writel(val, (void volatile *)bp->regview + 1181168U); } else { } val = readl((void const volatile *)bp->regview + 10624U); val = val & 255U; if (val <= 32U) { writel(32U, (void volatile *)bp->regview + 1181096U); } else { } return; } } static int bnx2x_ilt_line_mem_op(struct bnx2x *bp , struct ilt_line *line , u32 size , u8 memop ) { { if ((unsigned int )memop == 1U) { if ((unsigned long )line->page != (unsigned long )((void *)0)) { dma_free_attrs(& (bp->pdev)->dev, (size_t )line->size, line->page, line->page_mapping, 0); line->page = 0; line->page_mapping = 0ULL; } else { } return (0); } else { } line->page = dma_alloc_attrs(& (bp->pdev)->dev, (size_t )size, & line->page_mapping, 32976U, 0); if ((unsigned long )line->page == (unsigned long )((void *)0)) { return (-1); } else { } line->size = size; return (0); } } static int bnx2x_ilt_client_mem_op(struct bnx2x *bp , int cli_num , u8 memop ) { int i ; int rc ; struct bnx2x_ilt *ilt ; struct ilt_client_info *ilt_cli ; { ilt = bp->ilt; ilt_cli = (struct ilt_client_info *)(& ilt->clients) + (unsigned long )cli_num; if ((unsigned long )ilt == (unsigned long )((struct bnx2x_ilt *)0) || (unsigned long )ilt->lines == (unsigned long )((struct ilt_line *)0)) { return (-1); } else { } if (((int )ilt_cli->flags & 3) != 0) { return (0); } else { } rc = 0; i = (int )ilt_cli->start; goto ldv_54299; ldv_54298: rc = bnx2x_ilt_line_mem_op(bp, ilt->lines + (unsigned long )i, ilt_cli->page_size, (int )memop); i = i + 1; ldv_54299: ; if ((int )ilt_cli->end >= i && rc == 0) { goto ldv_54298; } else { } return (rc); } } static int bnx2x_ilt_mem_op_cnic(struct bnx2x *bp , u8 memop ) { int rc ; { rc = 0; if ((bp->common.chip_id >> 16 != 5710U && (bp->common.chip_id >> 16 != 5711U && bp->common.chip_id >> 16 != 5712U)) && ! bp->cnic_enabled) { rc = bnx2x_ilt_client_mem_op(bp, 2, (int )memop); } else { } if (rc == 0) { rc = bnx2x_ilt_client_mem_op(bp, 3, (int )memop); } else { } return (rc); } } static int bnx2x_ilt_mem_op(struct bnx2x *bp , u8 memop ) { int rc ; int tmp ; { tmp = bnx2x_ilt_client_mem_op(bp, 0, (int )memop); rc = tmp; if (rc == 0) { rc = bnx2x_ilt_client_mem_op(bp, 1, (int )memop); } else { } if ((rc == 0 && (unsigned int )bp->cnic_support != 0U) && ((bp->common.chip_id >> 16 == 5710U || (bp->common.chip_id >> 16 == 5711U || bp->common.chip_id >> 16 == 5712U)) || (int )bp->cnic_enabled)) { rc = bnx2x_ilt_client_mem_op(bp, 2, (int )memop); } else { } return (rc); } } static void bnx2x_ilt_line_wr(struct bnx2x *bp , int abs_idx , dma_addr_t page_mapping___0 ) { u32 reg ; { if (bp->common.chip_id >> 16 == 5710U) { reg = (u32 )((abs_idx + 148480) * 8); } else { reg = (u32 )((abs_idx + 151552) * 8); } bnx2x_wr_64(bp, reg, (unsigned int )(page_mapping___0 >> 12), (unsigned int )(page_mapping___0 >> 44) | 1048576U); return; } } static void bnx2x_ilt_line_init_op(struct bnx2x *bp , struct bnx2x_ilt *ilt , int idx , u8 initop ) { dma_addr_t null_mapping ; int abs_idx ; { abs_idx = (int )(ilt->start_line + (u32 )idx); switch ((int )initop) { case 2: ; case 0: bnx2x_ilt_line_wr(bp, abs_idx, (ilt->lines + (unsigned long )idx)->page_mapping); goto ldv_54327; case 1: null_mapping = 0ULL; bnx2x_ilt_line_wr(bp, abs_idx, null_mapping); goto ldv_54327; } ldv_54327: ; return; } } static void bnx2x_ilt_boundry_init_op(struct bnx2x *bp , struct ilt_client_info *ilt_cli , u32 ilt_start , u8 initop ) { u32 start_reg ; u32 end_reg ; { start_reg = 0U; end_reg = 0U; if (bp->common.chip_id >> 16 == 5710U) { switch ((int )ilt_cli->client_num) { case 0: start_reg = 1179648U; goto ldv_54338; case 1: start_reg = 1179704U; goto ldv_54338; case 2: start_reg = 1179732U; goto ldv_54338; case 3: start_reg = 1179676U; goto ldv_54338; } ldv_54338: writel((((u32 )ilt_cli->end + ilt_start) << 10) | ((u32 )ilt_cli->start + ilt_start), (void volatile *)bp->regview + (unsigned long )((u32 )((int )bp->pfid * 4) + start_reg)); } else { switch ((int )ilt_cli->client_num) { case 0: start_reg = 1181212U; end_reg = 1181216U; goto ldv_54343; case 1: start_reg = 1181236U; end_reg = 1181240U; goto ldv_54343; case 2: start_reg = 1181244U; end_reg = 1181248U; goto ldv_54343; case 3: start_reg = 1181252U; end_reg = 1181256U; goto ldv_54343; } ldv_54343: writel((u32 )ilt_cli->start + ilt_start, (void volatile *)bp->regview + (unsigned long )start_reg); writel((u32 )ilt_cli->end + ilt_start, (void volatile *)bp->regview + (unsigned long )end_reg); } return; } } static void bnx2x_ilt_client_init_op_ilt(struct bnx2x *bp , struct bnx2x_ilt *ilt , struct ilt_client_info *ilt_cli , u8 initop ) { int i ; { if ((int )ilt_cli->flags & 1) { return; } else { } i = (int )ilt_cli->start; goto ldv_54355; ldv_54354: bnx2x_ilt_line_init_op(bp, ilt, i, (int )initop); i = i + 1; ldv_54355: ; if ((int )ilt_cli->end >= i) { goto ldv_54354; } else { } bnx2x_ilt_boundry_init_op(bp, ilt_cli, ilt->start_line, (int )initop); return; } } static void bnx2x_ilt_client_init_op(struct bnx2x *bp , struct ilt_client_info *ilt_cli , u8 initop ) { struct bnx2x_ilt *ilt ; { ilt = bp->ilt; bnx2x_ilt_client_init_op_ilt(bp, ilt, ilt_cli, (int )initop); return; } } static void bnx2x_ilt_client_id_init_op(struct bnx2x *bp , int cli_num , u8 initop ) { struct bnx2x_ilt *ilt ; struct ilt_client_info *ilt_cli ; { ilt = bp->ilt; ilt_cli = (struct ilt_client_info *)(& ilt->clients) + (unsigned long )cli_num; bnx2x_ilt_client_init_op(bp, ilt_cli, (int )initop); return; } } static void bnx2x_ilt_init_op_cnic(struct bnx2x *bp , u8 initop ) { { if ((bp->common.chip_id >> 16 != 5710U && (bp->common.chip_id >> 16 != 5711U && bp->common.chip_id >> 16 != 5712U)) && ! bp->cnic_enabled) { bnx2x_ilt_client_id_init_op(bp, 2, (int )initop); } else { } bnx2x_ilt_client_id_init_op(bp, 3, (int )initop); return; } } static void bnx2x_ilt_init_op(struct bnx2x *bp , u8 initop ) { { bnx2x_ilt_client_id_init_op(bp, 0, (int )initop); bnx2x_ilt_client_id_init_op(bp, 1, (int )initop); if ((unsigned int )bp->cnic_support != 0U && ((bp->common.chip_id >> 16 == 5710U || (bp->common.chip_id >> 16 == 5711U || bp->common.chip_id >> 16 == 5712U)) || (int )bp->cnic_enabled)) { bnx2x_ilt_client_id_init_op(bp, 2, (int )initop); } else { } return; } } static void bnx2x_ilt_init_client_psz(struct bnx2x *bp , int cli_num , u32 psz_reg , u8 initop ) { struct bnx2x_ilt *ilt ; struct ilt_client_info *ilt_cli ; int tmp ; { ilt = bp->ilt; ilt_cli = (struct ilt_client_info *)(& ilt->clients) + (unsigned long )cli_num; if ((int )ilt_cli->flags & 1) { return; } else { } switch ((int )initop) { case 2: ; case 0: tmp = __ilog2_u32(ilt_cli->page_size >> 12); writel((unsigned int )tmp, (void volatile *)bp->regview + (unsigned long )psz_reg); goto ldv_54388; case 1: ; goto ldv_54388; } ldv_54388: ; return; } } static void bnx2x_ilt_init_page_size(struct bnx2x *bp , u8 initop ) { { bnx2x_ilt_init_client_psz(bp, 0, 1179672U, (int )initop); bnx2x_ilt_init_client_psz(bp, 1, 1179728U, (int )initop); bnx2x_ilt_init_client_psz(bp, 2, 1179756U, (int )initop); bnx2x_ilt_init_client_psz(bp, 3, 1179700U, (int )initop); return; } } static void bnx2x_qm_init_cid_count(struct bnx2x *bp , int qm_cid_count , u8 initop ) { int port ; { port = (int )bp->pfid & 1; if (qm_cid_count > 31) { switch ((int )initop) { case 2: ; case 0: writel((unsigned int )qm_cid_count / 16U - 1U, (void volatile *)bp->regview + (unsigned long )((port + 368648) * 4)); goto ldv_54402; case 1: ; goto ldv_54402; } ldv_54402: ; } else { } return; } } static void bnx2x_qm_set_ptr_table(struct bnx2x *bp , int qm_cid_count , u32 base_reg , u32 reg ) { int i ; u32 wb_data[2U] ; { wb_data[0] = 0U; wb_data[1] = 0U; i = 0; goto ldv_54413; ldv_54412: writel(((unsigned int )(i % 16) * (unsigned int )qm_cid_count) * 4U, (void volatile *)bp->regview + (unsigned long )((u32 )(i * 4) + base_reg)); bnx2x_init_wr_wb(bp, (u32 )(i * 8) + reg, (u32 const *)(& wb_data), 2U); i = i + 1; ldv_54413: ; if (i <= 63) { goto ldv_54412; } else { } return; } } static void bnx2x_qm_init_ptr_table(struct bnx2x *bp , int qm_cid_count , u8 initop ) { { if (qm_cid_count <= 31) { return; } else { } switch ((int )initop) { case 2: ; case 0: bnx2x_qm_set_ptr_table(bp, qm_cid_count, 1476864U, 1477120U); if (bp->common.chip_id >> 16 == 5711U || bp->common.chip_id >> 16 == 5712U) { bnx2x_qm_set_ptr_table(bp, qm_cid_count, 1499392U, 1499648U); } else { } goto ldv_54422; case 1: ; goto ldv_54422; } ldv_54422: ; return; } } static void bnx2x_src_init_t2(struct bnx2x *bp , struct src_ent *t2 , dma_addr_t t2_mapping , int src_cid_count ) { int i ; int port ; { port = (int )bp->pfid & 1; i = 0; goto ldv_54433; ldv_54432: (t2 + (unsigned long )i)->next = (unsigned long long )((unsigned long )(i + 1) * 64UL) + t2_mapping; i = i + 1; ldv_54433: ; if (src_cid_count + -1 > i) { goto ldv_54432; } else { } writel((unsigned int )src_cid_count, (void volatile *)bp->regview + (unsigned long )((port + 65856) * 4)); bnx2x_wr_64(bp, (u32 )((port + 16465) * 16), (unsigned int )t2_mapping, (unsigned int )(t2_mapping >> 32)); bnx2x_wr_64(bp, (u32 )((port + 16467) * 16), (unsigned int )t2_mapping + (unsigned int )((unsigned long )(src_cid_count + -1)) * 64U, (unsigned int )(((unsigned long long )((unsigned long )(src_cid_count + -1) * 64UL) + t2_mapping) >> 32)); return; } } int bnx2x_iov_init_ilt(struct bnx2x *bp , u16 line ) ; int bnx2x_iov_init_one(struct bnx2x *bp , int int_mode_param , int num_vfs_param ) ; void bnx2x_iov_remove_one(struct bnx2x *bp ) ; void bnx2x_iov_free_mem(struct bnx2x *bp ) ; int bnx2x_iov_alloc_mem(struct bnx2x *bp ) ; int bnx2x_iov_chip_cleanup(struct bnx2x *bp ) ; void bnx2x_iov_init_dq(struct bnx2x *bp ) ; void bnx2x_iov_init_dmae(struct bnx2x *bp ) ; void bnx2x_iov_set_queue_sp_obj(struct bnx2x *bp , int vf_cid , struct bnx2x_queue_sp_obj **q_obj ) ; void bnx2x_iov_sp_event(struct bnx2x *bp , int vf_cid , bool queue_work___0 ) ; int bnx2x_iov_eq_sp_event(struct bnx2x *bp , union event_ring_elem *elem ) ; void bnx2x_iov_sp_task(struct bnx2x *bp ) ; void bnx2x_vf_mbx(struct bnx2x *bp , struct vf_pf_event_data *vfpf_event ) ; void bnx2x_vf_handle_flr_event(struct bnx2x *bp ) ; enum sample_bulletin_result bnx2x_sample_bulletin(struct bnx2x *bp ) ; int bnx2x_vfpf_acquire(struct bnx2x *bp , u8 tx_count , u8 rx_count ) ; int bnx2x_vfpf_release(struct bnx2x *bp ) ; int bnx2x_vfpf_config_mac(struct bnx2x *bp , u8 *addr , u8 vf_qid , bool set ) ; int bnx2x_vfpf_set_mcast(struct net_device *dev ) ; int bnx2x_vfpf_storm_rx_mode(struct bnx2x *bp ) ; __inline static int bnx2x_vf_ustorm_prods_offset(struct bnx2x *bp , struct bnx2x_fastpath *fp ) { { return ((int )((unsigned int )((unsigned long )bp->acquire_resp.resc.hw_qid[(int )fp->index] + 384UL) * 32U)); } } void *bnx2x_vf_doorbells(struct bnx2x *bp ) ; int bnx2x_vf_pci_alloc(struct bnx2x *bp ) ; int bnx2x_enable_sriov(struct bnx2x *bp ) ; void bnx2x_disable_sriov(struct bnx2x *bp ) ; void bnx2x_pf_set_vfs_vlan(struct bnx2x *bp ) ; int bnx2x_sriov_configure(struct pci_dev *dev , int num_vfs_param ) ; int bnx2x_open_epilog(struct bnx2x *bp ) ; int load_count[2U][3U] ; int int_mode ; u32 bnx2x_send_unload_req(struct bnx2x *bp , int unload_mode ) ; void bnx2x_send_unload_done(struct bnx2x *bp , bool keep_link ) ; void bnx2x__init_func_obj(struct bnx2x *bp ) ; int bnx2x_setup_queue(struct bnx2x *bp , struct bnx2x_fastpath *fp , bool leading ) ; int bnx2x_setup_leading(struct bnx2x *bp ) ; u32 bnx2x_fw_command(struct bnx2x *bp , u32 command , u32 param ) ; int bnx2x_initial_phy_init(struct bnx2x *bp , int load_mode ) ; void bnx2x_link_set(struct bnx2x *bp ) ; void bnx2x_force_link_reset(struct bnx2x *bp ) ; u8 bnx2x_link_test(struct bnx2x *bp , u8 is_serdes ) ; void bnx2x_drv_pulse(struct bnx2x *bp ) ; void bnx2x_igu_ack_sb(struct bnx2x *bp , u8 igu_sb_id , u8 segment , u16 index , u8 op , u8 update ) ; void bnx2x_pf_disable(struct bnx2x *bp ) ; void bnx2x__link_status_update(struct bnx2x *bp ) ; void bnx2x_link_report(struct bnx2x *bp ) ; void __bnx2x_link_report(struct bnx2x *bp ) ; irqreturn_t bnx2x_msix_sp_int(int irq , void *dev_instance ) ; irqreturn_t bnx2x_interrupt(int irq , void *dev_instance ) ; int bnx2x_cnic_notify(struct bnx2x *bp , int cmd ) ; void bnx2x_setup_cnic_irq_info(struct bnx2x *bp ) ; void bnx2x_setup_cnic_info(struct bnx2x *bp ) ; void bnx2x_int_enable(struct bnx2x *bp ) ; void bnx2x_int_disable_sync(struct bnx2x *bp , int disable_hw ) ; void bnx2x_nic_init_cnic(struct bnx2x *bp ) ; void bnx2x_pre_irq_nic_init(struct bnx2x *bp ) ; void bnx2x_post_irq_nic_init(struct bnx2x *bp , u32 load_code ) ; int bnx2x_alloc_mem_cnic(struct bnx2x *bp ) ; int bnx2x_alloc_mem(struct bnx2x *bp ) ; void bnx2x_free_mem_cnic(struct bnx2x *bp ) ; void bnx2x_free_mem(struct bnx2x *bp ) ; void bnx2x_set_num_queues(struct bnx2x *bp ) ; void bnx2x_chip_cleanup(struct bnx2x *bp , int unload_mode , bool keep_link ) ; int bnx2x_acquire_hw_lock(struct bnx2x *bp , u32 resource ) ; int bnx2x_release_hw_lock(struct bnx2x *bp , u32 resource ) ; int bnx2x_release_leader_lock(struct bnx2x *bp ) ; int bnx2x_set_eth_mac(struct bnx2x *bp , bool set ) ; void bnx2x_set_rx_mode(struct net_device *dev ) ; int bnx2x_set_storm_rx_mode(struct bnx2x *bp ) ; int bnx2x_set_q_rx_mode(struct bnx2x *bp , u8 cl_id , unsigned long rx_mode_flags , unsigned long rx_accept_flags , unsigned long tx_accept_flags , unsigned long ramrod_flags ) ; void bnx2x_set_pf_load(struct bnx2x *bp ) ; bool bnx2x_clear_pf_load(struct bnx2x *bp ) ; bool bnx2x_chk_parity_attn(struct bnx2x *bp , bool *global , bool print ) ; bool bnx2x_reset_is_done(struct bnx2x *bp , int engine ) ; void bnx2x_set_reset_in_progress(struct bnx2x *bp ) ; void bnx2x_set_reset_global(struct bnx2x *bp ) ; void bnx2x_disable_close_the_gate(struct bnx2x *bp ) ; int bnx2x_init_hw_func_cnic(struct bnx2x *bp ) ; void bnx2x_sp_event(struct bnx2x_fastpath *fp , union eth_rx_cqe *rr_cqe ) ; void bnx2x_ilt_set_info(struct bnx2x *bp ) ; int bnx2x_set_power_state(struct bnx2x *bp , pci_power_t state ) ; void bnx2x_fw_dump_lvl(struct bnx2x *bp , char const *lvl ) ; int bnx2x_nic_unload(struct bnx2x *bp , int unload_mode , bool keep_link ) ; int bnx2x_nic_load(struct bnx2x *bp , int load_mode ) ; netdev_tx_t bnx2x_start_xmit(struct sk_buff *skb , struct net_device *dev ) ; int bnx2x_setup_tc(struct net_device *dev , u8 num_tc ) ; int bnx2x_get_vf_config(struct net_device *dev , int vfidx , struct ifla_vf_info *ivi ) ; int bnx2x_set_vf_mac(struct net_device *dev , int vfidx , u8 *mac ) ; int bnx2x_set_vf_vlan(struct net_device *dev , int vfidx , u16 vlan , u8 qos ) ; u16 bnx2x_select_queue(struct net_device *dev , struct sk_buff *skb ) ; int bnx2x_change_mac_addr(struct net_device *dev , void *p ) ; int bnx2x_suspend(struct pci_dev *pdev , pm_message_t state ) ; int bnx2x_resume(struct pci_dev *pdev ) ; void bnx2x_free_irq(struct bnx2x *bp ) ; void bnx2x_free_fp_mem(struct bnx2x *bp ) ; void bnx2x_init_rx_rings(struct bnx2x *bp ) ; void bnx2x_init_rx_rings_cnic(struct bnx2x *bp ) ; void bnx2x_free_skbs(struct bnx2x *bp ) ; void bnx2x_netif_stop(struct bnx2x *bp , int disable_hw ) ; int bnx2x_load_cnic(struct bnx2x *bp ) ; int bnx2x_enable_msix(struct bnx2x *bp ) ; int bnx2x_enable_msi(struct bnx2x *bp ) ; int bnx2x_alloc_mem_bp(struct bnx2x *bp ) ; void bnx2x_free_mem_bp(struct bnx2x *bp ) ; int bnx2x_change_mtu(struct net_device *dev , int new_mtu ) ; int bnx2x_fcoe_get_wwn(struct net_device *dev , u64 *wwn , int type ) ; netdev_features_t bnx2x_fix_features(struct net_device *dev , netdev_features_t features ) ; int bnx2x_set_features(struct net_device *dev , netdev_features_t features ) ; void bnx2x_tx_timeout(struct net_device *dev ) ; __inline static void bnx2x_update_fpsb_idx(struct bnx2x_fastpath *fp ) { { __asm__ volatile ("": : : "memory"); fp->fp_hc_idx = *(fp->sb_running_index); return; } } __inline static void bnx2x_igu_ack_sb_gen(struct bnx2x *bp , u8 igu_sb_id , u8 segment , u16 index , u8 op , u8 update , u32 igu_addr ) { struct igu_regular cmd_data ; long tmp ; { cmd_data.sb_id_and_flags = 0U; cmd_data.reserved_2 = 0U; cmd_data.sb_id_and_flags = (u32 )((((int )index | ((int )segment << 21)) | ((int )update << 24)) | ((int )op << 25)); tmp = ldv__builtin_expect((bp->msg_enable & 512) != 0, 0L); if (tmp != 0L) { printk("\rbnx2x: [%s:%d(%s)]write 0x%08x to IGU addr 0x%x\n", "bnx2x_igu_ack_sb_gen", 676, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", cmd_data.sb_id_and_flags, igu_addr); } else { } writel(cmd_data.sb_id_and_flags, (void volatile *)bp->regview + (unsigned long )igu_addr); __asm__ volatile ("": : : "memory"); __asm__ volatile ("": : : "memory"); return; } } __inline static void bnx2x_hc_ack_sb(struct bnx2x *bp , u8 sb_id , u8 storm , u16 index , u8 op , u8 update ) { u32 hc_addr ; struct igu_ack_register igu_ack ; { hc_addr = (u32 )((((int )bp->pfid & 1) + 33804) * 32); igu_ack.status_block_index = index; igu_ack.sb_id_and_flags = (u16 )((((int )((short )sb_id) | (int )((short )((int )storm << 5))) | (int )((short )((int )update << 8))) | (int )((short )((int )op << 9))); writel(*((u32 *)(& igu_ack)), (void volatile *)bp->regview + (unsigned long )hc_addr); __asm__ volatile ("": : : "memory"); __asm__ volatile ("": : : "memory"); return; } } __inline static void bnx2x_ack_sb(struct bnx2x *bp , u8 igu_sb_id , u8 storm , u16 index , u8 op , u8 update ) { u8 segment ; { if ((unsigned int )bp->common.int_block == 0U) { bnx2x_hc_ack_sb(bp, (int )igu_sb_id, (int )storm, (int )index, (int )op, (int )update); } else { if ((bp->common.chip_id >> 16 == 5710U || (bp->common.chip_id >> 16 == 5711U || bp->common.chip_id >> 16 == 5712U)) || ((int )bp->common.int_block & 2) != 0) { segment = storm; } else if ((int )bp->igu_dsb_id != (int )igu_sb_id) { segment = 1U; } else if ((unsigned int )storm == 4U) { segment = 2U; } else { segment = 1U; } bnx2x_igu_ack_sb(bp, (int )igu_sb_id, (int )segment, (int )index, (int )op, (int )update); } return; } } __inline static u16 bnx2x_hc_ack_int(struct bnx2x *bp ) { u32 hc_addr ; u32 result ; unsigned int tmp ; { hc_addr = (u32 )((((int )bp->pfid & 1) + 33804) * 32 + 24); tmp = readl((void const volatile *)bp->regview + (unsigned long )hc_addr); result = tmp; __asm__ volatile ("": : : "memory"); return ((u16 )result); } } __inline static u16 bnx2x_igu_ack_int(struct bnx2x *bp ) { u32 igu_addr ; u32 result ; unsigned int tmp ; long tmp___0 ; { igu_addr = 4468000U; tmp = readl((void const volatile *)bp->regview + (unsigned long )igu_addr); result = tmp; tmp___0 = ldv__builtin_expect((bp->msg_enable & 512) != 0, 0L); if (tmp___0 != 0L) { printk("\rbnx2x: [%s:%d(%s)]read 0x%08x from IGU addr 0x%x\n", "bnx2x_igu_ack_int", 741, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", result, igu_addr); } else { } __asm__ volatile ("": : : "memory"); return ((u16 )result); } } __inline static u16 bnx2x_ack_int(struct bnx2x *bp ) { u16 tmp ; u16 tmp___0 ; { __asm__ volatile ("": : : "memory"); if ((unsigned int )bp->common.int_block == 0U) { tmp = bnx2x_hc_ack_int(bp); return (tmp); } else { tmp___0 = bnx2x_igu_ack_int(bp); return (tmp___0); } } } __inline static int bnx2x_has_tx_work_unload(struct bnx2x_fp_txdata *txdata ) { { __asm__ volatile ("": : : "memory"); return ((int )txdata->tx_pkt_prod != (int )txdata->tx_pkt_cons); } } __inline static int bnx2x_tx_queue_has_work(struct bnx2x_fp_txdata *txdata ) { u16 hw_cons ; { __asm__ volatile ("": : : "memory"); hw_cons = *(txdata->tx_cons_sb); return ((int )txdata->tx_pkt_cons != (int )hw_cons); } } __inline static bool bnx2x_has_tx_work(struct bnx2x_fastpath *fp ) { u8 cos ; int tmp ; { cos = 0U; goto ldv_55234; ldv_55233: tmp = bnx2x_tx_queue_has_work(fp->txdata_ptr[(int )cos]); if (tmp != 0) { return (1); } else { } cos = (u8 )((int )cos + 1); ldv_55234: ; if ((int )fp->max_cos > (int )cos) { goto ldv_55233; } else { } return (0); } } __inline static int bnx2x_has_rx_work(struct bnx2x_fastpath *fp ) { u16 rx_cons_sb ; { __asm__ volatile ("": : : "memory"); rx_cons_sb = *(fp->rx_cons_sb); if (((unsigned long )rx_cons_sb & 63UL) == 63UL) { rx_cons_sb = (u16 )((int )rx_cons_sb + 1); } else { } return ((int )fp->rx_comp_cons != (int )rx_cons_sb); } } __inline static void bnx2x_tx_disable(struct bnx2x *bp ) { { netif_tx_disable(bp->dev); netif_carrier_off(bp->dev); return; } } __inline static void bnx2x_free_rx_sge(struct bnx2x *bp , struct bnx2x_fastpath *fp , u16 index ) { struct sw_rx_page *sw_buf ; struct page *page ; struct eth_rx_sge *sge ; { sw_buf = fp->rx_page_ring + (unsigned long )index; page = sw_buf->page; sge = fp->rx_sge_ring + (unsigned long )index; if ((unsigned long )page == (unsigned long )((struct page *)0)) { return; } else { } dma_unmap_page(& (bp->pdev)->dev, sw_buf->mapping, 4096UL, 2); __free_pages(page, 0U); sw_buf->page = 0; sge->addr_hi = 0U; sge->addr_lo = 0U; return; } } __inline static void bnx2x_del_all_napi_cnic(struct bnx2x *bp ) { int i ; { i = (int )bp->num_ethernet_queues; goto ldv_55272; ldv_55271: ; if ((bp->flags & 32768U) != 0U && (uint )i == (uint )bp->num_queues - bp->num_cnic_queues) { } else { netif_napi_del(& (bp->fp + (unsigned long )i)->napi); } i = i + 1; ldv_55272: ; if (bp->num_queues > i) { goto ldv_55271; } else { } return; } } __inline static void bnx2x_del_all_napi(struct bnx2x *bp ) { int i ; { i = 0; goto ldv_55279; ldv_55278: netif_napi_del(& (bp->fp + (unsigned long )i)->napi); i = i + 1; ldv_55279: ; if ((uint )i < bp->num_ethernet_queues) { goto ldv_55278; } else { } return; } } int bnx2x_set_int_mode(struct bnx2x *bp ) ; __inline static void bnx2x_disable_msi(struct bnx2x *bp ) { { if ((bp->flags & 32U) != 0U) { pci_disable_msix(bp->pdev); bp->flags = bp->flags & 4293918687U; } else if ((bp->flags & 64U) != 0U) { pci_disable_msi(bp->pdev); bp->flags = bp->flags & 4294967231U; } else { } return; } } __inline static int func_by_vn(struct bnx2x *bp , int vn ) { { return (vn * 2 + ((int )bp->pfid & 1)); } } __inline static void bnx2x_free_rx_sge_range(struct bnx2x *bp , struct bnx2x_fastpath *fp , int last ) { int i ; { if ((unsigned int )fp->disable_tpa != 0U) { return; } else { } i = 0; goto ldv_55345; ldv_55344: bnx2x_free_rx_sge(bp, fp, (int )((u16 )i)); i = i + 1; ldv_55345: ; if (i < last) { goto ldv_55344; } else { } return; } } __inline static u8 bnx2x_stats_id(struct bnx2x_fastpath *fp ) { struct bnx2x *bp ; { bp = fp->bp; if (bp->common.chip_id >> 16 != 5710U && (bp->common.chip_id >> 16 != 5711U && bp->common.chip_id >> 16 != 5712U)) { if ((uint )fp->index == (uint )(fp->bp)->num_queues - (fp->bp)->num_cnic_queues) { return ((int )bp->cnic_base_cl_id + (int )((u8 )((int )bp->pf_num >> 1))); } else { } return (fp->cl_id); } else { } return ((unsigned int )fp->cl_id + ((unsigned int )bp->pfid & 1U) * 16U); } } __inline static void bnx2x_init_vlan_mac_fp_objs(struct bnx2x_fastpath *fp , bnx2x_obj_type obj_type ) { struct bnx2x *bp ; { bp = fp->bp; bnx2x_init_mac_obj(bp, & (bp->sp_objs + (unsigned long )fp->index)->mac_obj, (int )fp->cl_id, fp->cid, (int )bp->pfid, (void *)(& (bp->slowpath)->mac_rdata), bp->slowpath_mapping, 0, & bp->sp_state, obj_type, & bp->macs_pool); return; } } __inline static u8 bnx2x_fp_qzone_id(struct bnx2x_fastpath *fp ) { { if ((fp->bp)->common.chip_id >> 16 == 5710U || ((fp->bp)->common.chip_id >> 16 == 5711U || (fp->bp)->common.chip_id >> 16 == 5712U)) { return ((unsigned int )fp->cl_id + ((unsigned int )(fp->bp)->pfid & 1U) * 28U); } else { return (fp->cl_id); } } } u32 bnx2x_rx_ustorm_prods_offset(struct bnx2x_fastpath *fp ) ; __inline static void bnx2x_init_txdata(struct bnx2x *bp , struct bnx2x_fp_txdata *txdata , u32 cid , int txq_index , __le16 *tx_cons_sb , struct bnx2x_fastpath *fp ) { long tmp ; { txdata->cid = cid; txdata->txq_index = txq_index; txdata->tx_cons_sb = tx_cons_sb; txdata->parent_fp = fp; txdata->tx_ring_size = (uint )fp->index != (uint )(fp->bp)->num_queues - (fp->bp)->num_cnic_queues ? bp->tx_ring_size : 4078; tmp = ldv__builtin_expect((bp->msg_enable & 32) != 0, 0L); if (tmp != 0L) { printk("\rbnx2x: [%s:%d(%s)]created tx data cid %d, txq %d\n", "bnx2x_init_txdata", 1163, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", txdata->cid, txdata->txq_index); } else { } return; } } __inline static u8 bnx2x_cnic_eth_cl_id(struct bnx2x *bp , u8 cl_idx ) { { return ((unsigned int )((int )bp->cnic_base_cl_id + (int )cl_idx) + (unsigned int )((u8 )((int )bp->pf_num >> 1)) * 2U); } } __inline static u8 bnx2x_cnic_fw_sb_id(struct bnx2x *bp ) { { return ((u8 )bp->base_fw_ndsb); } } __inline static u8 bnx2x_cnic_igu_sb_id(struct bnx2x *bp ) { { return (bp->igu_base_sb); } } __inline static void bnx2x_init_fcoe_fp(struct bnx2x *bp ) { struct bnx2x_fastpath *fp ; unsigned long q_type ; long tmp ; long tmp___0 ; long tmp___1 ; { fp = bp->fp + (unsigned long )((uint )bp->num_queues - bp->num_cnic_queues); q_type = 0UL; (bp->fp + (unsigned long )((uint )bp->num_queues - bp->num_cnic_queues))->rx_queue = (u8 )bp->num_ethernet_queues; (bp->fp + (unsigned long )((uint )bp->num_queues - bp->num_cnic_queues))->cl_id = bnx2x_cnic_eth_cl_id(bp, 1); (bp->fp + (unsigned long )((uint )bp->num_queues - bp->num_cnic_queues))->cid = ((uint )bp->num_queues - bp->num_cnic_queues) * (uint )bp->max_cos + 1U; (bp->fp + (unsigned long )((uint )bp->num_queues - bp->num_cnic_queues))->fw_sb_id = 222U; (bp->fp + (unsigned long )((uint )bp->num_queues - bp->num_cnic_queues))->igu_sb_id = bp->igu_dsb_id; (bp->fp + (unsigned long )((uint )bp->num_queues - bp->num_cnic_queues))->rx_cons_sb = (__le16 *)(& (bp->def_status_blk)->sp_sb.index_values) + 4UL; bnx2x_init_txdata(bp, (bp->fp + (unsigned long )((uint )bp->num_queues - bp->num_cnic_queues))->txdata_ptr[0], fp->cid, (int )(((uint )bp->num_queues - bp->num_cnic_queues) * (uint )bp->max_cos), (__le16 *)(& (bp->def_status_blk)->sp_sb.index_values) + 6UL, fp); tmp = ldv__builtin_expect((bp->msg_enable & 32) != 0, 0L); if (tmp != 0L) { printk("\rbnx2x: [%s:%d(%s)]created fcoe tx data (fp index %d)\n", "bnx2x_init_fcoe_fp", 1201, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )fp->index); } else { } (bp->fp + (unsigned long )((uint )bp->num_queues - bp->num_cnic_queues))->cl_qzone_id = bnx2x_fp_qzone_id(fp); (bp->fp + (unsigned long )((uint )bp->num_queues - bp->num_cnic_queues))->ustorm_rx_prods_offset = bnx2x_rx_ustorm_prods_offset(fp); __set_bit(0, (unsigned long volatile *)(& q_type)); __set_bit(1, (unsigned long volatile *)(& q_type)); tmp___0 = ldv__builtin_expect((unsigned int )fp->max_cos != 1U, 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 *)"/work/ldvuser/exper_fp/inst/current/envs/linux-3.10-rc1.tar/linux-3.10-rc1/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.h"), "i" (1214), "i" (12UL)); ldv_55408: ; goto ldv_55408; } else { } bnx2x_init_queue_obj(bp, & (bp->sp_objs + (unsigned long )fp->index)->q_obj, (int )fp->cl_id, & fp->cid, 1, (int )bp->pfid, (void *)(& (bp->slowpath)->q_rdata), bp->slowpath_mapping + 2512ULL, q_type); tmp___1 = ldv__builtin_expect((bp->msg_enable & 32) != 0, 0L); if (tmp___1 != 0L) { printk("\rbnx2x: [%s:%d(%s)]queue[%d]: bnx2x_init_sb(%p,%p) cl_id %d fw_sb %d igu_sb %d\n", "bnx2x_init_fcoe_fp", 1223, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )fp->index, bp, fp->status_blk.e2_sb, (int )fp->cl_id, (int )fp->fw_sb_id, (int )fp->igu_sb_id); } else { } return; } } __inline static int bnx2x_clean_tx_queue(struct bnx2x *bp , struct bnx2x_fp_txdata *txdata ) { int cnt ; int tmp ; { cnt = 1000; goto ldv_55417; ldv_55416: ; if (cnt == 0) { printk("\vbnx2x: [%s:%d(%s)]timeout waiting for queue[%d]: txdata->tx_pkt_prod(%d) != txdata->tx_pkt_cons(%d)\n", "bnx2x_clean_tx_queue", 1235, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", txdata->txq_index, (int )txdata->tx_pkt_prod, (int )txdata->tx_pkt_cons); goto ldv_55415; } else { } cnt = cnt - 1; usleep_range(1000UL, 2000UL); ldv_55417: tmp = bnx2x_has_tx_work_unload(txdata); if (tmp != 0) { goto ldv_55416; } else { } ldv_55415: ; return (0); } } int bnx2x_get_link_cfg_idx(struct bnx2x *bp ) ; __inline static void __storm_memset_struct(struct bnx2x *bp , u32 addr , size_t size , u32 *data ) { int i ; { i = 0; goto ldv_55428; ldv_55427: writel(*(data + (unsigned long )i), (void volatile *)bp->regview + (unsigned long )((u32 )(i * 4) + addr)); i = i + 1; ldv_55428: ; if ((size_t )i < size / 4UL) { goto ldv_55427; } else { } return; } } __inline static bool bnx2x_wait_sp_comp(struct bnx2x *bp , unsigned long mask ) { int tout ; int tmp ; { tout = 5000; goto ldv_55436; ldv_55435: __asm__ volatile ("mfence": : : "memory"); netif_addr_lock_bh(bp->dev); if ((bp->sp_state & mask) == 0UL) { netif_addr_unlock_bh(bp->dev); return (1); } else { } netif_addr_unlock_bh(bp->dev); usleep_range(1000UL, 2000UL); ldv_55436: tmp = tout; tout = tout - 1; if (tmp != 0) { goto ldv_55435; } else { } __asm__ volatile ("mfence": : : "memory"); netif_addr_lock_bh(bp->dev); if ((bp->sp_state & mask) != 0UL) { printk("\vbnx2x: [%s:%d(%s)]Filtering completion timed out. sp_state 0x%lx, mask 0x%lx\n", "bnx2x_wait_sp_comp", 1287, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", bp->sp_state, mask); netif_addr_unlock_bh(bp->dev); return (0); } else { } netif_addr_unlock_bh(bp->dev); return (1); } } void bnx2x_set_ctx_validation(struct bnx2x *bp , struct eth_context *cxt , u32 cid ) ; void bnx2x_update_coalesce_sb_index(struct bnx2x *bp , u8 fw_sb_id , u8 sb_index , u8 disable , u16 usec ) ; void bnx2x_acquire_phy_lock(struct bnx2x *bp ) ; void bnx2x_release_phy_lock(struct bnx2x *bp ) ; __inline static u16 bnx2x_extract_max_cfg(struct bnx2x *bp , u32 mf_cfg ) { u16 max_cfg ; long tmp ; { max_cfg = (u16 )(mf_cfg >> 24); if ((unsigned int )max_cfg == 0U) { tmp = ldv__builtin_expect((bp->msg_enable & 67108896) != 0, 0L); if (tmp != 0L) { printk("\rbnx2x: [%s:%d(%s)]Max BW configured to 0 - using 100 instead\n", "bnx2x_extract_max_cfg", 1324, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } max_cfg = 100U; } else { } return (max_cfg); } } void bnx2x_get_iscsi_info(struct bnx2x *bp ) ; __inline static void bnx2x_link_sync_notify(struct bnx2x *bp ) { int func ; int vn ; { vn = 0; goto ldv_55472; ldv_55471: ; if ((int )bp->pfid >> 1 == vn) { goto ldv_55470; } else { } func = func_by_vn(bp, vn); writel(1U, (void volatile *)bp->regview + (unsigned long )((func + 10252) * 4)); ldv_55470: vn = vn + 1; ldv_55472: ; if (((unsigned int )bp->common.chip_port_mode == 0U ? 2 : 4) > vn) { goto ldv_55471; } else { } return; } } __inline static bool bnx2x_is_valid_ether_addr(struct bnx2x *bp , u8 *addr ) { bool tmp ; bool tmp___0 ; { tmp = is_valid_ether_addr((u8 const *)addr); if ((int )tmp) { return (1); } else { tmp___0 = is_zero_ether_addr((u8 const *)addr); if ((int )tmp___0 && (((unsigned int )bp->mf_mode == 1U && ((bp->mf_config[(int )bp->pfid >> 1] & 6U) == 6U || (bp->mf_config[(int )bp->pfid >> 1] & 6U) == 0U)) || ((unsigned int )bp->mf_mode == 3U && (bp->mf_ext_config & 8U) != 0U))) { return (1); } else { } } return (0); } } int bnx2x_drain_tx_queues(struct bnx2x *bp ) ; void bnx2x_squeeze_objects(struct bnx2x *bp ) ; extern int request_firmware(struct firmware const ** , char const * , struct device * ) ; extern void release_firmware(struct firmware const * ) ; static char version[94U] = { 'B', 'r', 'o', 'a', 'd', 'c', 'o', 'm', ' ', 'N', 'e', 't', 'X', 't', 'r', 'e', 'm', 'e', ' ', 'I', 'I', ' ', '5', '7', '7', '1', 'x', '/', '5', '7', '8', 'x', 'x', ' ', '1', '0', '/', '2', '0', '-', 'G', 'i', 'g', 'a', 'b', 'i', 't', ' ', 'E', 't', 'h', 'e', 'r', 'n', 'e', 't', ' ', 'D', 'r', 'i', 'v', 'e', 'r', ' ', 'b', 'n', 'x', '2', 'x', ' ', '1', '.', '7', '8', '.', '1', '7', '-', '0', ' ', '(', '2', '0', '1', '3', '/', '0', '4', '/', '1', '1', ')', '\n', '\000'}; static int disable_tpa ; static int dropless_fc ; static int mrrs = -1; static int debug ; static struct __anonstruct_board_info_294 board_info[21U] = { {(char *)"Broadcom NetXtreme II BCM57710 10 Gigabit PCIe [Everest]"}, {(char *)"Broadcom NetXtreme II BCM57711 10 Gigabit PCIe"}, {(char *)"Broadcom NetXtreme II BCM57711E 10 Gigabit PCIe"}, {(char *)"Broadcom NetXtreme II BCM57712 10 Gigabit Ethernet"}, {(char *)"Broadcom NetXtreme II BCM57712 10 Gigabit Ethernet Multi Function"}, {(char *)"Broadcom NetXtreme II BCM57712 10 Gigabit Ethernet Virtual Function"}, {(char *)"Broadcom NetXtreme II BCM57800 10 Gigabit Ethernet"}, {(char *)"Broadcom NetXtreme II BCM57800 10 Gigabit Ethernet Multi Function"}, {(char *)"Broadcom NetXtreme II BCM57800 10 Gigabit Ethernet Virtual Function"}, {(char *)"Broadcom NetXtreme II BCM57810 10 Gigabit Ethernet"}, {(char *)"Broadcom NetXtreme II BCM57810 10 Gigabit Ethernet Multi Function"}, {(char *)"Broadcom NetXtreme II BCM57810 10 Gigabit Ethernet Virtual Function"}, {(char *)"Broadcom NetXtreme II BCM57840 10 Gigabit Ethernet"}, {(char *)"Broadcom NetXtreme II BCM57840 20 Gigabit Ethernet"}, {(char *)"Broadcom NetXtreme II BCM57840 10/20 Gigabit Ethernet Multi Function"}, {(char *)"Broadcom NetXtreme II BCM57840 10/20 Gigabit Ethernet Virtual Function"}, {(char *)"Broadcom NetXtreme II BCM57811 10 Gigabit Ethernet"}, {(char *)"Broadcom NetXtreme II BCM57811 10 Gigabit Ethernet Multi Function"}, {(char *)"Broadcom NetXtreme II BCM57840 10/20 Gigabit Ethernet"}, {(char *)"Broadcom NetXtreme II BCM57840 10/20 Gigabit Ethernet Multi Function"}, {(char *)"Broadcom NetXtreme II BCM57840 10/20 Gigabit Ethernet Virtual Function"}}; static struct pci_device_id const bnx2x_pci_tbl[22U] = { {5348U, 5710U, 4294967295U, 4294967295U, 0U, 0U, 0UL}, {5348U, 5711U, 4294967295U, 4294967295U, 0U, 0U, 1UL}, {5348U, 5712U, 4294967295U, 4294967295U, 0U, 0U, 2UL}, {5348U, 5730U, 4294967295U, 4294967295U, 0U, 0U, 3UL}, {5348U, 5731U, 4294967295U, 4294967295U, 0U, 0U, 4UL}, {5348U, 5743U, 4294967295U, 4294967295U, 0U, 0U, 5UL}, {5348U, 5770U, 4294967295U, 4294967295U, 0U, 0U, 6UL}, {5348U, 5797U, 4294967295U, 4294967295U, 0U, 0U, 7UL}, {5348U, 5801U, 4294967295U, 4294967295U, 0U, 0U, 8UL}, {5348U, 5774U, 4294967295U, 4294967295U, 0U, 0U, 9UL}, {5348U, 5806U, 4294967295U, 4294967295U, 0U, 0U, 10UL}, {5348U, 5773U, 4294967295U, 4294967295U, 0U, 0U, 18UL}, {5348U, 5793U, 4294967295U, 4294967295U, 0U, 0U, 12UL}, {5348U, 5794U, 4294967295U, 4294967295U, 0U, 0U, 13UL}, {5348U, 5807U, 4294967295U, 4294967295U, 0U, 0U, 11UL}, {5348U, 5803U, 4294967295U, 4294967295U, 0U, 0U, 19UL}, {5348U, 5796U, 4294967295U, 4294967295U, 0U, 0U, 14UL}, {5348U, 5805U, 4294967295U, 4294967295U, 0U, 0U, 15UL}, {5348U, 5693U, 4294967295U, 4294967295U, 0U, 0U, 16UL}, {5348U, 5694U, 4294967295U, 4294967295U, 0U, 0U, 17UL}, {5348U, 5695U, 4294967295U, 4294967295U, 0U, 0U, 20UL}, {0U, 0U, 0U, 0U, 0U, 0U, 0UL}}; struct pci_device_id const __mod_pci_device_table ; static struct semaphore bnx2x_prev_sem = {{{{0U}}, 3735899821U, 4294967295U, 0xffffffffffffffffUL, {0, {0, 0}, "(bnx2x_prev_sem).lock", 0, 0UL}}, 1U, {& bnx2x_prev_sem.wait_list, & bnx2x_prev_sem.wait_list}}; static struct list_head bnx2x_prev_list = {& bnx2x_prev_list, & bnx2x_prev_list}; static void __storm_memset_dma_mapping(struct bnx2x *bp , u32 addr , dma_addr_t mapping ) { { writel((unsigned int )mapping, (void volatile *)bp->regview + (unsigned long )addr); writel((unsigned int )(mapping >> 32), (void volatile *)bp->regview + (unsigned long )(addr + 4U)); return; } } static void storm_memset_spq_addr(struct bnx2x *bp , dma_addr_t mapping , u16 abs_fid ) { u32 addr ; { addr = ((unsigned int )(bp->iro_arr + 30UL)->base + (unsigned int )((int )abs_fid * (int )(bp->iro_arr + 30UL)->m1)) + 2752512U; __storm_memset_dma_mapping(bp, addr, mapping); return; } } static void storm_memset_vf_to_pf(struct bnx2x *bp , u16 abs_fid , u16 pf_id ) { { writeb((int )((unsigned char )pf_id), (void volatile *)bp->regview + (unsigned long )(((unsigned int )(bp->iro_arr + 48UL)->base + (unsigned int )((int )abs_fid * (int )(bp->iro_arr + 48UL)->m1)) + 4325376U)); writeb((int )((unsigned char )pf_id), (void volatile *)bp->regview + (unsigned long )(((unsigned int )(bp->iro_arr + 150UL)->base + (unsigned int )((int )abs_fid * (int )(bp->iro_arr + 150UL)->m1)) + 4259840U)); writeb((int )((unsigned char )pf_id), (void volatile *)bp->regview + (unsigned long )(((unsigned int )(bp->iro_arr + 104UL)->base + (unsigned int )((int )abs_fid * (int )(bp->iro_arr + 104UL)->m1)) + 4390912U)); writeb((int )((unsigned char )pf_id), (void volatile *)bp->regview + (unsigned long )(((unsigned int )(bp->iro_arr + 179UL)->base + (unsigned int )((int )abs_fid * (int )(bp->iro_arr + 179UL)->m1)) + 4194304U)); return; } } static void storm_memset_func_en(struct bnx2x *bp , u16 abs_fid , u8 enable ) { { writeb((int )enable, (void volatile *)bp->regview + (unsigned long )(((unsigned int )(bp->iro_arr + 47UL)->base + (unsigned int )((int )abs_fid * (int )(bp->iro_arr + 47UL)->m1)) + 4325376U)); writeb((int )enable, (void volatile *)bp->regview + (unsigned long )(((unsigned int )(bp->iro_arr + 149UL)->base + (unsigned int )((int )abs_fid * (int )(bp->iro_arr + 149UL)->m1)) + 4259840U)); writeb((int )enable, (void volatile *)bp->regview + (unsigned long )(((unsigned int )(bp->iro_arr + 103UL)->base + (unsigned int )((int )abs_fid * (int )(bp->iro_arr + 103UL)->m1)) + 4390912U)); writeb((int )enable, (void volatile *)bp->regview + (unsigned long )(((unsigned int )(bp->iro_arr + 178UL)->base + (unsigned int )((int )abs_fid * (int )(bp->iro_arr + 178UL)->m1)) + 4194304U)); return; } } static void storm_memset_eq_data(struct bnx2x *bp , struct event_ring_data *eq_data , u16 pfid ) { size_t size ; u32 addr ; { size = 16UL; addr = ((unsigned int )(bp->iro_arr + 153UL)->base + ((unsigned int )(((int )pfid & 1) * (int )(bp->iro_arr + 153UL)->m2) + (unsigned int )(((int )pfid >> 1) * (int )(bp->iro_arr + 153UL)->m1))) + 4259840U; __storm_memset_struct(bp, addr, size, (u32 *)eq_data); return; } } static void storm_memset_eq_prod(struct bnx2x *bp , u16 eq_prod , u16 pfid ) { u32 addr ; { addr = ((unsigned int )(bp->iro_arr + 154UL)->base + ((unsigned int )(((int )pfid & 1) * (int )(bp->iro_arr + 154UL)->m2) + (unsigned int )(((int )pfid >> 1) * (int )(bp->iro_arr + 154UL)->m1))) + 4259840U; writew((int )eq_prod, (void volatile *)bp->regview + (unsigned long )addr); return; } } static void bnx2x_reg_wr_ind(struct bnx2x *bp , u32 addr , u32 val ) { { pci_write_config_dword((struct pci_dev const *)bp->pdev, 120, addr); pci_write_config_dword((struct pci_dev const *)bp->pdev, 128, val); pci_write_config_dword((struct pci_dev const *)bp->pdev, 120, 0U); return; } } static u32 bnx2x_reg_rd_ind(struct bnx2x *bp , u32 addr ) { u32 val ; { pci_write_config_dword((struct pci_dev const *)bp->pdev, 120, addr); pci_read_config_dword((struct pci_dev const *)bp->pdev, 128, & val); pci_write_config_dword((struct pci_dev const *)bp->pdev, 120, 0U); return (val); } } void bnx2x_dp_dmae(struct bnx2x *bp , struct dmae_command *dmae , int msglvl ) { u32 src_type ; long tmp ; long tmp___0 ; long tmp___1 ; long tmp___2 ; long tmp___3 ; long tmp___4 ; { src_type = dmae->opcode & 1U; switch (dmae->opcode & 6U) { case 2U: ; if (src_type == 0U) { tmp = ldv__builtin_expect((bp->msg_enable & msglvl) != 0, 0L); if (tmp != 0L) { printk("\rbnx2x: [%s:%d(%s)]DMAE: opcode 0x%08x\nsrc [%x:%08x], len [%d*4], dst [%x:%08x]\ncomp_addr [%x:%08x], comp_val 0x%08x\n", "bnx2x_dp_dmae", 464, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", dmae->opcode, dmae->src_addr_hi, dmae->src_addr_lo, (int )dmae->len, dmae->dst_addr_hi, dmae->dst_addr_lo, dmae->comp_addr_hi, dmae->comp_addr_lo, dmae->comp_val); } else { } } else { tmp___0 = ldv__builtin_expect((bp->msg_enable & msglvl) != 0, 0L); if (tmp___0 != 0L) { printk("\rbnx2x: [%s:%d(%s)]DMAE: opcode 0x%08x\nsrc [%08x], len [%d*4], dst [%x:%08x]\ncomp_addr [%x:%08x], comp_val 0x%08x\n", "bnx2x_dp_dmae", 472, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", dmae->opcode, dmae->src_addr_lo >> 2, (int )dmae->len, dmae->dst_addr_hi, dmae->dst_addr_lo, dmae->comp_addr_hi, dmae->comp_addr_lo, dmae->comp_val); } else { } } goto ldv_55716; case 4U: ; if (src_type == 0U) { tmp___1 = ldv__builtin_expect((bp->msg_enable & msglvl) != 0, 0L); if (tmp___1 != 0L) { printk("\rbnx2x: [%s:%d(%s)]DMAE: opcode 0x%08x\nsrc [%x:%08x], len [%d*4], dst_addr [%08x]\ncomp_addr [%x:%08x], comp_val 0x%08x\n", "bnx2x_dp_dmae", 482, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", dmae->opcode, dmae->src_addr_hi, dmae->src_addr_lo, (int )dmae->len, dmae->dst_addr_lo >> 2, dmae->comp_addr_hi, dmae->comp_addr_lo, dmae->comp_val); } else { } } else { tmp___2 = ldv__builtin_expect((bp->msg_enable & msglvl) != 0, 0L); if (tmp___2 != 0L) { printk("\rbnx2x: [%s:%d(%s)]DMAE: opcode 0x%08x\nsrc [%08x], len [%d*4], dst [%08x]\ncomp_addr [%x:%08x], comp_val 0x%08x\n", "bnx2x_dp_dmae", 490, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", dmae->opcode, dmae->src_addr_lo >> 2, (int )dmae->len, dmae->dst_addr_lo >> 2, dmae->comp_addr_hi, dmae->comp_addr_lo, dmae->comp_val); } else { } } goto ldv_55716; default: ; if (src_type == 0U) { tmp___3 = ldv__builtin_expect((bp->msg_enable & msglvl) != 0, 0L); if (tmp___3 != 0L) { printk("\rbnx2x: [%s:%d(%s)]DMAE: opcode 0x%08x\nsrc_addr [%x:%08x] len [%d * 4] dst_addr [none]\ncomp_addr [%x:%08x] comp_val 0x%08x\n", "bnx2x_dp_dmae", 499, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", dmae->opcode, dmae->src_addr_hi, dmae->src_addr_lo, (int )dmae->len, dmae->comp_addr_hi, dmae->comp_addr_lo, dmae->comp_val); } else { } } else { tmp___4 = ldv__builtin_expect((bp->msg_enable & msglvl) != 0, 0L); if (tmp___4 != 0L) { printk("\rbnx2x: [%s:%d(%s)]DMAE: opcode 0x%08x\nsrc_addr [%08x] len [%d * 4] dst_addr [none]\ncomp_addr [%x:%08x] comp_val 0x%08x\n", "bnx2x_dp_dmae", 506, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", dmae->opcode, dmae->src_addr_lo >> 2, (int )dmae->len, dmae->comp_addr_hi, dmae->comp_addr_lo, dmae->comp_val); } else { } } goto ldv_55716; } ldv_55716: ; return; } } void bnx2x_post_dmae(struct bnx2x *bp , struct dmae_command *dmae , int idx ) { u32 cmd_offset ; int i ; { cmd_offset = (u32 )((unsigned long )idx) * 56U + 1057792U; i = 0; goto ldv_55727; ldv_55726: writel(*((u32 *)dmae + (unsigned long )i), (void volatile *)bp->regview + (unsigned long )((u32 )(i * 4) + cmd_offset)); i = i + 1; ldv_55727: ; if ((unsigned int )i <= 13U) { goto ldv_55726; } else { } writel(1U, (void volatile *)bp->regview + (unsigned long )dmae_reg_go_c[idx]); return; } } u32 bnx2x_dmae_opcode_add_comp(u32 opcode , u8 comp_type ) { { return (((u32 )((int )comp_type << 3) | opcode) | 16U); } } u32 bnx2x_dmae_opcode_clr_src_reset(u32 opcode ) { { return (opcode & 4294959103U); } } u32 bnx2x_dmae_opcode(struct bnx2x *bp , u8 src_type , u8 dst_type , bool with_comp , u8 comp_type ) { u32 opcode ; { opcode = 0U; opcode = (u32 )((int )src_type | ((int )dst_type << 1)) | opcode; opcode = opcode | 24576U; opcode = ((int )bp->pfid & 1 ? 2048U : 0U) | opcode; opcode = (u32 )((((int )bp->pfid >> 1) << 15) | (((int )bp->pfid >> 1) << 17)) | opcode; opcode = opcode | 1048576U; opcode = opcode | 1024U; if ((int )with_comp) { opcode = bnx2x_dmae_opcode_add_comp(opcode, (int )comp_type); } else { } return (opcode); } } void bnx2x_prep_dmae_with_comp(struct bnx2x *bp , struct dmae_command *dmae , u8 src_type , u8 dst_type ) { { memset((void *)dmae, 0, 56UL); dmae->opcode = bnx2x_dmae_opcode(bp, (int )src_type, (int )dst_type, 1, 0); dmae->comp_addr_lo = (unsigned int )bp->slowpath_mapping + 4388U; dmae->comp_addr_hi = (unsigned int )((bp->slowpath_mapping + 4388ULL) >> 32); dmae->comp_val = 1624297646U; return; } } int bnx2x_issue_dmae_with_comp(struct bnx2x *bp , struct dmae_command *dmae ) { u32 *wb_comp ; int cnt ; int rc ; { wb_comp = & (bp->slowpath)->wb_comp; cnt = (bp->common.chip_id & 61440U) > 20480U ? 400000 : 4000; rc = 0; spin_lock_bh(& bp->dmae_lock); *wb_comp = 0U; bnx2x_post_dmae(bp, dmae, ((int )bp->pfid & 1) * 8 + ((int )bp->pfid >> 1)); __const_udelay(21475UL); goto ldv_55760; ldv_55759: ; if (cnt == 0 || ((unsigned int )bp->recovery_state != 0U && (unsigned int )bp->recovery_state != 4U)) { printk("\vbnx2x: [%s:%d(%s)]DMAE timeout!\n", "bnx2x_issue_dmae_with_comp", 603, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); rc = -1; goto unlock; } else { } cnt = cnt - 1; __const_udelay(214750UL); ldv_55760: ; if ((*wb_comp & 2147483647U) != 1624297646U) { goto ldv_55759; } else { } if ((int )*wb_comp < 0) { printk("\vbnx2x: [%s:%d(%s)]DMAE PCI error!\n", "bnx2x_issue_dmae_with_comp", 611, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); rc = -2; } else { } unlock: spin_unlock_bh(& bp->dmae_lock); return (rc); } } void bnx2x_write_dmae(struct bnx2x *bp , dma_addr_t dma_addr , u32 dst_addr , u32 len32 ) { struct dmae_command dmae ; u32 *data ; { if (bp->dmae_ready == 0) { data = (u32 *)(& (bp->slowpath)->wb_data); if (bp->common.chip_id >> 16 == 5710U) { bnx2x_init_ind_wr(bp, dst_addr, (u32 const *)data, len32); } else { bnx2x_init_str_wr(bp, dst_addr, (u32 const *)data, len32); } return; } else { } bnx2x_prep_dmae_with_comp(bp, & dmae, 0, 2); dmae.src_addr_lo = (unsigned int )dma_addr; dmae.src_addr_hi = (unsigned int )(dma_addr >> 32); dmae.dst_addr_lo = dst_addr >> 2; dmae.dst_addr_hi = 0U; dmae.len = (u16 )len32; bnx2x_issue_dmae_with_comp(bp, & dmae); return; } } void bnx2x_read_dmae(struct bnx2x *bp , u32 src_addr , u32 len32 ) { struct dmae_command dmae ; u32 *data ; int i ; { if (bp->dmae_ready == 0) { data = (u32 *)(& (bp->slowpath)->wb_data); if (bp->common.chip_id >> 16 == 5710U) { i = 0; goto ldv_55779; ldv_55778: *(data + (unsigned long )i) = bnx2x_reg_rd_ind(bp, (u32 )(i * 4) + src_addr); i = i + 1; ldv_55779: ; if ((u32 )i < len32) { goto ldv_55778; } else { } } else { i = 0; goto ldv_55782; ldv_55781: *(data + (unsigned long )i) = readl((void const volatile *)bp->regview + (unsigned long )((u32 )(i * 4) + src_addr)); i = i + 1; ldv_55782: ; if ((u32 )i < len32) { goto ldv_55781; } else { } } return; } else { } bnx2x_prep_dmae_with_comp(bp, & dmae, 1, 1); dmae.src_addr_lo = src_addr >> 2; dmae.src_addr_hi = 0U; dmae.dst_addr_lo = (unsigned int )bp->slowpath_mapping + 4392U; dmae.dst_addr_hi = (unsigned int )((bp->slowpath_mapping + 4392ULL) >> 32); dmae.len = (u16 )len32; bnx2x_issue_dmae_with_comp(bp, & dmae); return; } } static void bnx2x_write_dmae_phys_len(struct bnx2x *bp , dma_addr_t phys_addr , u32 addr , u32 len ) { int dmae_wr_max ; int offset ; { dmae_wr_max = bp->common.chip_id >> 16 == 5710U ? 1024 : 8192; offset = 0; goto ldv_55793; ldv_55792: bnx2x_write_dmae(bp, (dma_addr_t )offset + phys_addr, addr + (u32 )offset, (u32 )dmae_wr_max); offset = dmae_wr_max * 4 + offset; len = len - (u32 )dmae_wr_max; ldv_55793: ; if ((u32 )dmae_wr_max < len) { goto ldv_55792; } else { } bnx2x_write_dmae(bp, (dma_addr_t )offset + phys_addr, addr + (u32 )offset, len); return; } } static int bnx2x_mc_assert(struct bnx2x *bp ) { char last_idx ; int i ; int rc ; u32 row0 ; u32 row1 ; u32 row2 ; u32 row3 ; unsigned char tmp ; unsigned char tmp___0 ; unsigned char tmp___1 ; unsigned char tmp___2 ; { rc = 0; tmp = readb((void const volatile *)bp->regview + (unsigned long )((unsigned int )(bp->iro_arr + 51UL)->base + 4325376U)); last_idx = (char )tmp; if ((int )((signed char )last_idx) != 0) { printk("\vbnx2x: [%s:%d(%s)]XSTORM_ASSERT_LIST_INDEX 0x%x\n", "bnx2x_mc_assert", 707, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )last_idx); } else { } i = 0; goto ldv_55808; ldv_55807: row0 = readl((void const volatile *)bp->regview + (unsigned long )(((unsigned int )(bp->iro_arr + 50UL)->base + (unsigned int )((int )(bp->iro_arr + 50UL)->m1 * i)) + 4325376U)); row1 = readl((void const volatile *)bp->regview + (unsigned long )(((unsigned int )(bp->iro_arr + 50UL)->base + (unsigned int )((int )(bp->iro_arr + 50UL)->m1 * i)) + 4325380U)); row2 = readl((void const volatile *)bp->regview + (unsigned long )(((unsigned int )(bp->iro_arr + 50UL)->base + (unsigned int )((int )(bp->iro_arr + 50UL)->m1 * i)) + 4325384U)); row3 = readl((void const volatile *)bp->regview + (unsigned long )(((unsigned int )(bp->iro_arr + 50UL)->base + (unsigned int )((int )(bp->iro_arr + 50UL)->m1 * i)) + 4325388U)); if (row0 != 0U) { printk("\vbnx2x: [%s:%d(%s)]XSTORM_ASSERT_INDEX 0x%x = 0x%08x 0x%08x 0x%08x 0x%08x\n", "bnx2x_mc_assert", 723, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", i, row3, row2, row1, row0); rc = rc + 1; } else { goto ldv_55806; } i = i + 1; ldv_55808: ; if (i <= 49) { goto ldv_55807; } else { } ldv_55806: tmp___0 = readb((void const volatile *)bp->regview + (unsigned long )((unsigned int )(bp->iro_arr + 102UL)->base + 4390912U)); last_idx = (char )tmp___0; if ((int )((signed char )last_idx) != 0) { printk("\vbnx2x: [%s:%d(%s)]TSTORM_ASSERT_LIST_INDEX 0x%x\n", "bnx2x_mc_assert", 734, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )last_idx); } else { } i = 0; goto ldv_55811; ldv_55810: row0 = readl((void const volatile *)bp->regview + (unsigned long )(((unsigned int )(bp->iro_arr + 101UL)->base + (unsigned int )((int )(bp->iro_arr + 101UL)->m1 * i)) + 4390912U)); row1 = readl((void const volatile *)bp->regview + (unsigned long )(((unsigned int )(bp->iro_arr + 101UL)->base + (unsigned int )((int )(bp->iro_arr + 101UL)->m1 * i)) + 4390916U)); row2 = readl((void const volatile *)bp->regview + (unsigned long )(((unsigned int )(bp->iro_arr + 101UL)->base + (unsigned int )((int )(bp->iro_arr + 101UL)->m1 * i)) + 4390920U)); row3 = readl((void const volatile *)bp->regview + (unsigned long )(((unsigned int )(bp->iro_arr + 101UL)->base + (unsigned int )((int )(bp->iro_arr + 101UL)->m1 * i)) + 4390924U)); if (row0 != 0U) { printk("\vbnx2x: [%s:%d(%s)]TSTORM_ASSERT_INDEX 0x%x = 0x%08x 0x%08x 0x%08x 0x%08x\n", "bnx2x_mc_assert", 750, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", i, row3, row2, row1, row0); rc = rc + 1; } else { goto ldv_55809; } i = i + 1; ldv_55811: ; if (i <= 49) { goto ldv_55810; } else { } ldv_55809: tmp___1 = readb((void const volatile *)bp->regview + (unsigned long )((unsigned int )(bp->iro_arr + 148UL)->base + 4259840U)); last_idx = (char )tmp___1; if ((int )((signed char )last_idx) != 0) { printk("\vbnx2x: [%s:%d(%s)]CSTORM_ASSERT_LIST_INDEX 0x%x\n", "bnx2x_mc_assert", 761, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )last_idx); } else { } i = 0; goto ldv_55814; ldv_55813: row0 = readl((void const volatile *)bp->regview + (unsigned long )(((unsigned int )(bp->iro_arr + 147UL)->base + (unsigned int )((int )(bp->iro_arr + 147UL)->m1 * i)) + 4259840U)); row1 = readl((void const volatile *)bp->regview + (unsigned long )(((unsigned int )(bp->iro_arr + 147UL)->base + (unsigned int )((int )(bp->iro_arr + 147UL)->m1 * i)) + 4259844U)); row2 = readl((void const volatile *)bp->regview + (unsigned long )(((unsigned int )(bp->iro_arr + 147UL)->base + (unsigned int )((int )(bp->iro_arr + 147UL)->m1 * i)) + 4259848U)); row3 = readl((void const volatile *)bp->regview + (unsigned long )(((unsigned int )(bp->iro_arr + 147UL)->base + (unsigned int )((int )(bp->iro_arr + 147UL)->m1 * i)) + 4259852U)); if (row0 != 0U) { printk("\vbnx2x: [%s:%d(%s)]CSTORM_ASSERT_INDEX 0x%x = 0x%08x 0x%08x 0x%08x 0x%08x\n", "bnx2x_mc_assert", 777, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", i, row3, row2, row1, row0); rc = rc + 1; } else { goto ldv_55812; } i = i + 1; ldv_55814: ; if (i <= 49) { goto ldv_55813; } else { } ldv_55812: tmp___2 = readb((void const volatile *)bp->regview + (unsigned long )((unsigned int )(bp->iro_arr + 177UL)->base + 4194304U)); last_idx = (char )tmp___2; if ((int )((signed char )last_idx) != 0) { printk("\vbnx2x: [%s:%d(%s)]USTORM_ASSERT_LIST_INDEX 0x%x\n", "bnx2x_mc_assert", 788, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )last_idx); } else { } i = 0; goto ldv_55817; ldv_55816: row0 = readl((void const volatile *)bp->regview + (unsigned long )(((unsigned int )(bp->iro_arr + 176UL)->base + (unsigned int )((int )(bp->iro_arr + 176UL)->m1 * i)) + 4194304U)); row1 = readl((void const volatile *)bp->regview + (unsigned long )(((unsigned int )(bp->iro_arr + 176UL)->base + (unsigned int )((int )(bp->iro_arr + 176UL)->m1 * i)) + 4194308U)); row2 = readl((void const volatile *)bp->regview + (unsigned long )(((unsigned int )(bp->iro_arr + 176UL)->base + (unsigned int )((int )(bp->iro_arr + 176UL)->m1 * i)) + 4194312U)); row3 = readl((void const volatile *)bp->regview + (unsigned long )(((unsigned int )(bp->iro_arr + 176UL)->base + (unsigned int )((int )(bp->iro_arr + 176UL)->m1 * i)) + 4194316U)); if (row0 != 0U) { printk("\vbnx2x: [%s:%d(%s)]USTORM_ASSERT_INDEX 0x%x = 0x%08x 0x%08x 0x%08x 0x%08x\n", "bnx2x_mc_assert", 804, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", i, row3, row2, row1, row0); rc = rc + 1; } else { goto ldv_55815; } i = i + 1; ldv_55817: ; if (i <= 49) { goto ldv_55816; } else { } ldv_55815: ; return (rc); } } void bnx2x_fw_dump_lvl(struct bnx2x *bp , char const *lvl ) { u32 addr ; u32 val ; u32 mark ; u32 offset ; __be32 data[9U] ; int word ; u32 trace_shmem_base ; unsigned int tmp ; unsigned int tmp___0 ; __u32 tmp___1 ; unsigned int tmp___2 ; __u32 tmp___3 ; { if ((bp->flags & 512U) != 0U) { printk("\vbnx2x: [%s:%d(%s)]NO MCP - can not dump\n", "bnx2x_fw_dump_lvl", 822, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); return; } else { } netdev_printk(lvl, (struct net_device const *)bp->dev, "bc %d.%d.%d\n", (bp->common.bc_ver & 16711680U) >> 16, (bp->common.bc_ver & 65280U) >> 8, bp->common.bc_ver & 255U); val = readl((void const volatile *)bp->regview + 544796U); tmp = readl((void const volatile *)bp->regview + 544796U); if (tmp == val) { printk("\vbnx2x: [%s:%d(%s)]%sMCP PC at 0x%x\n", "bnx2x_fw_dump_lvl", 832, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", lvl, val); } else { } if ((bp->common.chip_id >> 16 == 5710U || (bp->common.chip_id >> 16 == 5711U || bp->common.chip_id >> 16 == 5712U)) || ((int )bp->pf_num & 1) == 0) { trace_shmem_base = bp->common.shmem_base; } else { trace_shmem_base = readl((void const volatile *)(bp->regview + ((unsigned long )bp->common.shmem2_base + 52UL))); } addr = trace_shmem_base - 2048U; mark = readl((void const volatile *)bp->regview + (unsigned long )addr); if (mark != 1414677314U) { printk("\vbnx2x: [%s:%d(%s)]Trace buffer signature is missing.", "bnx2x_fw_dump_lvl", 843, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); return; } else { } addr = addr + 4U; mark = readl((void const volatile *)bp->regview + (unsigned long )addr); mark = ((bp->common.chip_id >> 16 == 5710U || (bp->common.chip_id >> 16 == 5711U || bp->common.chip_id >> 16 == 5712U) ? 655360U : 3801088U) + ((mark + 3U) & 4294967292U)) - 134217728U; printk("%sbegin fw dump (mark 0x%x)\n", lvl, mark); printk("%s", lvl); offset = mark; goto ldv_55834; ldv_55833: word = 0; goto ldv_55831; ldv_55830: tmp___0 = readl((void const volatile *)bp->regview + (unsigned long )((u32 )(word * 4) + offset)); tmp___1 = __fswab32(tmp___0); data[word] = tmp___1; word = word + 1; ldv_55831: ; if (word <= 7) { goto ldv_55830; } else { } data[8] = 0U; printk("%s", (char *)(& data)); offset = offset + 32U; ldv_55834: ; if (offset <= trace_shmem_base) { goto ldv_55833; } else { } offset = addr + 4U; goto ldv_55840; ldv_55839: word = 0; goto ldv_55837; ldv_55836: tmp___2 = readl((void const volatile *)bp->regview + (unsigned long )((u32 )(word * 4) + offset)); tmp___3 = __fswab32(tmp___2); data[word] = tmp___3; word = word + 1; ldv_55837: ; if (word <= 7) { goto ldv_55836; } else { } data[8] = 0U; printk("%s", (char *)(& data)); offset = offset + 32U; ldv_55840: ; if (offset <= mark) { goto ldv_55839; } else { } printk("%send of fw dump\n", lvl); return; } } static void bnx2x_fw_dump(struct bnx2x *bp ) { { bnx2x_fw_dump_lvl(bp, "\v"); return; } } static void bnx2x_hc_int_disable(struct bnx2x *bp ) { int port ; u32 addr ; u32 val ; unsigned int tmp ; long tmp___0 ; unsigned int tmp___1 ; { port = (int )bp->pfid & 1; addr = port != 0 ? 1081348U : 1081344U; tmp = readl((void const volatile *)bp->regview + (unsigned long )addr); val = tmp; if (bp->common.chip_id >> 16 == 5710U) { writel(0U, (void volatile *)bp->regview + (unsigned long )((port + 270402) * 4)); val = val & 4294967269U; } else { val = val & 4294967265U; } tmp___0 = ldv__builtin_expect((bp->msg_enable & 16) != 0, 0L); if (tmp___0 != 0L) { printk("\rbnx2x: [%s:%d(%s)]write %x to HC %d (addr 0x%x)\n", "bnx2x_hc_int_disable", 907, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", val, port, addr); } else { } __asm__ volatile ("": : : "memory"); writel(val, (void volatile *)bp->regview + (unsigned long )addr); tmp___1 = readl((void const volatile *)bp->regview + (unsigned long )addr); if (tmp___1 != val) { printk("\vbnx2x: [%s:%d(%s)]BUG! proper val not read from IGU!\n", "bnx2x_hc_int_disable", 914, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } return; } } static void bnx2x_igu_int_disable(struct bnx2x *bp ) { u32 val ; unsigned int tmp ; long tmp___0 ; unsigned int tmp___1 ; { tmp = readl((void const volatile *)bp->regview + 1245524U); val = tmp; val = val & 4294967281U; tmp___0 = ldv__builtin_expect((bp->msg_enable & 16) != 0, 0L); if (tmp___0 != 0L) { printk("\rbnx2x: [%s:%d(%s)]write %x to IGU\n", "bnx2x_igu_int_disable", 925, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", val); } else { } __asm__ volatile ("": : : "memory"); writel(val, (void volatile *)bp->regview + 1245524U); tmp___1 = readl((void const volatile *)bp->regview + 1245524U); if (tmp___1 != val) { printk("\vbnx2x: [%s:%d(%s)]BUG! proper val not read from IGU!\n", "bnx2x_igu_int_disable", 932, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } return; } } static void bnx2x_int_disable(struct bnx2x *bp ) { { if ((unsigned int )bp->common.int_block == 0U) { bnx2x_hc_int_disable(bp); } else { bnx2x_igu_int_disable(bp); } return; } } void bnx2x_panic_dump(struct bnx2x *bp , bool disable_int ) { int i ; u16 j ; struct hc_sp_status_block_data sp_sb_data ; int func ; long tmp ; struct bnx2x_fastpath *fp ; int loop ; struct hc_status_block_data_e2 sb_data_e2 ; struct hc_status_block_data_e1x sb_data_e1x ; struct hc_status_block_sm *hc_sm_p ; struct hc_index_data *hc_index_p ; u8 data_size ; u8 cos ; u32 *sb_data_p ; struct bnx2x_fp_txdata txdata ; { func = (int )bp->pfid; if ((int )disable_int) { bnx2x_int_disable(bp); } else { } bp->stats_state = 0; bp->eth_stats.unrecoverable_error = bp->eth_stats.unrecoverable_error + 1U; tmp = ldv__builtin_expect((bp->msg_enable & 131072) != 0, 0L); if (tmp != 0L) { printk("\rbnx2x: [%s:%d(%s)]stats_state - DISABLED\n", "bnx2x_panic_dump", 958, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } printk("\vbnx2x: [%s:%d(%s)]begin crash dump -----------------\n", "bnx2x_panic_dump", 960, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); printk("\vbnx2x: [%s:%d(%s)]def_idx(0x%x) def_att_idx(0x%x) attn_state(0x%x) spq_prod_idx(0x%x) next_stats_cnt(0x%x)\n", "bnx2x_panic_dump", 966, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )bp->def_idx, (int )bp->def_att_idx, bp->attn_state, (int )bp->spq_prod_idx, (int )bp->stats_counter); printk("\vbnx2x: [%s:%d(%s)]DSB: attn bits(0x%x) ack(0x%x) id(0x%x) idx(0x%x)\n", "bnx2x_panic_dump", 971, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (bp->def_status_blk)->atten_status_block.attn_bits, (bp->def_status_blk)->atten_status_block.attn_bits_ack, (int )(bp->def_status_blk)->atten_status_block.status_block_id, (int )(bp->def_status_blk)->atten_status_block.attn_bits_index); printk("\vbnx2x: [%s:%d(%s)] def (", "bnx2x_panic_dump", 972, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); i = 0; goto ldv_55870; ldv_55869: printk("0x%x%s", (int )(bp->def_status_blk)->sp_sb.index_values[i], i == 15 ? (char *)") " : (char *)" "); i = i + 1; ldv_55870: ; if (i <= 15) { goto ldv_55869; } else { } i = 0; goto ldv_55873; ldv_55872: *((u32 *)(& sp_sb_data) + (unsigned long )i) = readl((void const volatile *)(bp->regview + ((unsigned long )(((unsigned int )(bp->iro_arr + 142UL)->base + (unsigned int )((int )(bp->iro_arr + 142UL)->m1 * func)) + 4259840U) + (unsigned long )i * 4UL))); i = i + 1; ldv_55873: ; if ((unsigned int )i <= 3U) { goto ldv_55872; } else { } printk("igu_sb_id(0x%x) igu_seg_id(0x%x) pf_id(0x%x) vnic_id(0x%x) vf_id(0x%x) vf_valid (0x%x) state(0x%x)\n", (int )sp_sb_data.igu_sb_id, (int )sp_sb_data.igu_seg_id, (int )sp_sb_data.p_func.pf_id, (int )sp_sb_data.p_func.vnic_id, (int )sp_sb_data.p_func.vf_id, (int )sp_sb_data.p_func.vf_valid, (int )sp_sb_data.state); i = 0; goto ldv_55905; ldv_55904: fp = bp->fp + (unsigned long )i; hc_sm_p = bp->common.chip_id >> 16 == 5710U || (bp->common.chip_id >> 16 == 5711U || bp->common.chip_id >> 16 == 5712U) ? (struct hc_status_block_sm *)(& sb_data_e1x.common.state_machine) : (struct hc_status_block_sm *)(& sb_data_e2.common.state_machine); hc_index_p = bp->common.chip_id >> 16 == 5710U || (bp->common.chip_id >> 16 == 5711U || bp->common.chip_id >> 16 == 5712U) ? (struct hc_index_data *)(& sb_data_e1x.index_data) : (struct hc_index_data *)(& sb_data_e2.index_data); printk("\vbnx2x: [%s:%d(%s)]fp%d: rx_bd_prod(0x%x) rx_bd_cons(0x%x) rx_comp_prod(0x%x) rx_comp_cons(0x%x) *rx_cons_sb(0x%x)\n", "bnx2x_panic_dump", 1014, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", i, (int )fp->rx_bd_prod, (int )fp->rx_bd_cons, (int )fp->rx_comp_prod, (int )fp->rx_comp_cons, (int )*(fp->rx_cons_sb)); printk("\vbnx2x: [%s:%d(%s)] rx_sge_prod(0x%x) last_max_sge(0x%x) fp_hc_idx(0x%x)\n", "bnx2x_panic_dump", 1017, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )fp->rx_sge_prod, (int )fp->last_max_sge, (int )fp->fp_hc_idx); cos = 0U; goto ldv_55886; ldv_55885: txdata = *(fp->txdata_ptr[(int )cos]); printk("\vbnx2x: [%s:%d(%s)]fp%d: tx_pkt_prod(0x%x) tx_pkt_cons(0x%x) tx_bd_prod(0x%x) tx_bd_cons(0x%x) *tx_cons_sb(0x%x)\n", "bnx2x_panic_dump", 1027, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", i, (int )txdata.tx_pkt_prod, (int )txdata.tx_pkt_cons, (int )txdata.tx_bd_prod, (int )txdata.tx_bd_cons, (int )*(txdata.tx_cons_sb)); cos = (u8 )((int )cos + 1); ldv_55886: ; if ((int )fp->max_cos > (int )cos) { goto ldv_55885; } else { } loop = 8; if ((uint )fp->index == (uint )(fp->bp)->num_queues - (fp->bp)->num_cnic_queues) { goto ldv_55888; } else { } printk("\vbnx2x: [%s:%d(%s)] run indexes (", "bnx2x_panic_dump", 1038, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); j = 0U; goto ldv_55890; ldv_55889: printk("0x%x%s", (int )*(fp->sb_running_index + (unsigned long )j), (unsigned int )j == 1U ? (char *)")" : (char *)" "); j = (u16 )((int )j + 1); ldv_55890: ; if ((unsigned int )j <= 1U) { goto ldv_55889; } else { } printk("\vbnx2x: [%s:%d(%s)] indexes (", "bnx2x_panic_dump", 1044, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); j = 0U; goto ldv_55893; ldv_55892: printk("0x%x%s", (int )*(fp->sb_index_values + (unsigned long )j), (int )j == loop + -1 ? (char *)")" : (char *)" "); j = (u16 )((int )j + 1); ldv_55893: ; if ((int )j < loop) { goto ldv_55892; } else { } data_size = 64U; data_size = (u8 )((unsigned int )data_size / 4U); sb_data_p = bp->common.chip_id >> 16 == 5710U || (bp->common.chip_id >> 16 == 5711U || bp->common.chip_id >> 16 == 5712U) ? (u32 *)(& sb_data_e1x) : (u32 *)(& sb_data_e2); j = 0U; goto ldv_55896; ldv_55895: *(sb_data_p + (unsigned long )j) = readl((void const volatile *)(bp->regview + ((unsigned long )(((unsigned int )(bp->iro_arr + 133UL)->base + (unsigned int )((int )fp->fw_sb_id * (int )(bp->iro_arr + 133UL)->m1)) + 4259840U) + (unsigned long )j * 4UL))); j = (u16 )((int )j + 1); ldv_55896: ; if ((int )((unsigned short )data_size) > (int )j) { goto ldv_55895; } else { } if (bp->common.chip_id >> 16 != 5710U && (bp->common.chip_id >> 16 != 5711U && bp->common.chip_id >> 16 != 5712U)) { printk("pf_id(0x%x) vf_id(0x%x) vf_valid(0x%x) vnic_id(0x%x) same_igu_sb_1b(0x%x) state(0x%x)\n", (int )sb_data_e2.common.p_func.pf_id, (int )sb_data_e2.common.p_func.vf_id, (int )sb_data_e2.common.p_func.vf_valid, (int )sb_data_e2.common.p_func.vnic_id, (int )sb_data_e2.common.same_igu_sb_1b, (int )sb_data_e2.common.state); } else { printk("pf_id(0x%x) vf_id(0x%x) vf_valid(0x%x) vnic_id(0x%x) same_igu_sb_1b(0x%x) state(0x%x)\n", (int )sb_data_e1x.common.p_func.pf_id, (int )sb_data_e1x.common.p_func.vf_id, (int )sb_data_e1x.common.p_func.vf_valid, (int )sb_data_e1x.common.p_func.vnic_id, (int )sb_data_e1x.common.same_igu_sb_1b, (int )sb_data_e1x.common.state); } j = 0U; goto ldv_55899; ldv_55898: printk("SM[%d] __flags (0x%x) igu_sb_id (0x%x) igu_seg_id(0x%x) time_to_expire (0x%x) timer_value(0x%x)\n", (int )j, (int )(hc_sm_p + (unsigned long )j)->__flags, (int )(hc_sm_p + (unsigned long )j)->igu_sb_id, (int )(hc_sm_p + (unsigned long )j)->igu_seg_id, (hc_sm_p + (unsigned long )j)->time_to_expire, (int )(hc_sm_p + (unsigned long )j)->timer_value); j = (u16 )((int )j + 1); ldv_55899: ; if ((unsigned int )j <= 1U) { goto ldv_55898; } else { } j = 0U; goto ldv_55902; ldv_55901: printk("INDEX[%d] flags (0x%x) timeout (0x%x)\n", (int )j, (int )(hc_index_p + (unsigned long )j)->flags, (int )(hc_index_p + (unsigned long )j)->timeout); j = (u16 )((int )j + 1); ldv_55902: ; if ((int )j < loop) { goto ldv_55901; } else { } ldv_55888: i = i + 1; ldv_55905: ; if ((uint )i < bp->num_ethernet_queues) { goto ldv_55904; } else { } bnx2x_fw_dump(bp); bnx2x_mc_assert(bp); printk("\vbnx2x: [%s:%d(%s)]end crash dump -----------------\n", "bnx2x_panic_dump", 1177, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); return; } } static void bnx2x_pbf_pN_buf_flushed(struct bnx2x *bp , struct pbf_pN_buf_regs *regs , u32 poll_count ) { u32 init_crd ; u32 crd ; u32 crd_start ; u32 crd_freed ; u32 crd_freed_start ; u32 cur_cnt ; long tmp ; long tmp___0 ; long tmp___1 ; long tmp___2 ; long tmp___3 ; long tmp___4 ; u32 tmp___5 ; long tmp___6 ; { cur_cnt = poll_count; crd_freed_start = readl((void const volatile *)bp->regview + (unsigned long )regs->crd_freed); crd_freed = crd_freed_start; crd_start = readl((void const volatile *)bp->regview + (unsigned long )regs->crd); crd = crd_start; init_crd = readl((void const volatile *)bp->regview + (unsigned long )regs->init_crd); tmp = ldv__builtin_expect((bp->msg_enable & 1048576) != 0, 0L); if (tmp != 0L) { printk("\rbnx2x: [%s:%d(%s)]INIT CREDIT[%d] : %x\n", "bnx2x_pbf_pN_buf_flushed", 1214, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", regs->pN, init_crd); } else { } tmp___0 = ldv__builtin_expect((bp->msg_enable & 1048576) != 0, 0L); if (tmp___0 != 0L) { printk("\rbnx2x: [%s:%d(%s)]CREDIT[%d] : s:%x\n", "bnx2x_pbf_pN_buf_flushed", 1215, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", regs->pN, crd); } else { } tmp___1 = ldv__builtin_expect((bp->msg_enable & 1048576) != 0, 0L); if (tmp___1 != 0L) { printk("\rbnx2x: [%s:%d(%s)]CREDIT_FREED[%d]: s:%x\n", "bnx2x_pbf_pN_buf_flushed", 1216, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", regs->pN, crd_freed); } else { } goto ldv_55930; ldv_55929: tmp___5 = cur_cnt; cur_cnt = cur_cnt - 1U; if (tmp___5 != 0U) { __const_udelay(214750UL); crd = readl((void const volatile *)bp->regview + (unsigned long )regs->crd); crd_freed = readl((void const volatile *)bp->regview + (unsigned long )regs->crd_freed); } else { tmp___2 = ldv__builtin_expect((bp->msg_enable & 1048576) != 0, 0L); if (tmp___2 != 0L) { printk("\rbnx2x: [%s:%d(%s)]PBF tx buffer[%d] timed out\n", "bnx2x_pbf_pN_buf_flushed", 1226, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", regs->pN); } else { } tmp___3 = ldv__builtin_expect((bp->msg_enable & 1048576) != 0, 0L); if (tmp___3 != 0L) { printk("\rbnx2x: [%s:%d(%s)]CREDIT[%d] : c:%x\n", "bnx2x_pbf_pN_buf_flushed", 1228, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", regs->pN, crd); } else { } tmp___4 = ldv__builtin_expect((bp->msg_enable & 1048576) != 0, 0L); if (tmp___4 != 0L) { printk("\rbnx2x: [%s:%d(%s)]CREDIT_FREED[%d]: c:%x\n", "bnx2x_pbf_pN_buf_flushed", 1230, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", regs->pN, crd_freed); } else { } goto ldv_55928; } ldv_55930: ; if (crd != init_crd && (unsigned int )((int )crd_freed - (int )crd_freed_start) < init_crd - crd_start) { goto ldv_55929; } else { } ldv_55928: tmp___6 = ldv__builtin_expect((bp->msg_enable & 1048576) != 0, 0L); if (tmp___6 != 0L) { printk("\rbnx2x: [%s:%d(%s)]Waited %d*%d usec for PBF tx buffer[%d]\n", "bnx2x_pbf_pN_buf_flushed", 1235, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", poll_count - cur_cnt, 50, regs->pN); } else { } return; } } static void bnx2x_pbf_pN_cmd_flushed(struct bnx2x *bp , struct pbf_pN_cmd_regs *regs , u32 poll_count ) { u32 occup ; u32 to_free ; u32 freed ; u32 freed_start ; u32 cur_cnt ; long tmp ; long tmp___0 ; long tmp___1 ; long tmp___2 ; long tmp___3 ; u32 tmp___4 ; long tmp___5 ; { cur_cnt = poll_count; to_free = readl((void const volatile *)bp->regview + (unsigned long )regs->lines_occup); occup = to_free; freed_start = readl((void const volatile *)bp->regview + (unsigned long )regs->lines_freed); freed = freed_start; tmp = ldv__builtin_expect((bp->msg_enable & 1048576) != 0, 0L); if (tmp != 0L) { printk("\rbnx2x: [%s:%d(%s)]OCCUPANCY[%d] : s:%x\n", "bnx2x_pbf_pN_cmd_flushed", 1248, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", regs->pN, occup); } else { } tmp___0 = ldv__builtin_expect((bp->msg_enable & 1048576) != 0, 0L); if (tmp___0 != 0L) { printk("\rbnx2x: [%s:%d(%s)]LINES_FREED[%d] : s:%x\n", "bnx2x_pbf_pN_cmd_flushed", 1249, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", regs->pN, freed); } else { } goto ldv_55944; ldv_55943: tmp___4 = cur_cnt; cur_cnt = cur_cnt - 1U; if (tmp___4 != 0U) { __const_udelay(214750UL); occup = readl((void const volatile *)bp->regview + (unsigned long )regs->lines_occup); freed = readl((void const volatile *)bp->regview + (unsigned long )regs->lines_freed); } else { tmp___1 = ldv__builtin_expect((bp->msg_enable & 1048576) != 0, 0L); if (tmp___1 != 0L) { printk("\rbnx2x: [%s:%d(%s)]PBF cmd queue[%d] timed out\n", "bnx2x_pbf_pN_cmd_flushed", 1258, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", regs->pN); } else { } tmp___2 = ldv__builtin_expect((bp->msg_enable & 1048576) != 0, 0L); if (tmp___2 != 0L) { printk("\rbnx2x: [%s:%d(%s)]OCCUPANCY[%d] : s:%x\n", "bnx2x_pbf_pN_cmd_flushed", 1260, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", regs->pN, occup); } else { } tmp___3 = ldv__builtin_expect((bp->msg_enable & 1048576) != 0, 0L); if (tmp___3 != 0L) { printk("\rbnx2x: [%s:%d(%s)]LINES_FREED[%d] : s:%x\n", "bnx2x_pbf_pN_cmd_flushed", 1262, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", regs->pN, freed); } else { } goto ldv_55942; } ldv_55944: ; if (occup != 0U && (unsigned int )((int )freed - (int )freed_start) < to_free) { goto ldv_55943; } else { } ldv_55942: tmp___5 = ldv__builtin_expect((bp->msg_enable & 1048576) != 0, 0L); if (tmp___5 != 0L) { printk("\rbnx2x: [%s:%d(%s)]Waited %d*%d usec for PBF cmd queue[%d]\n", "bnx2x_pbf_pN_cmd_flushed", 1267, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", poll_count - cur_cnt, 50, regs->pN); } else { } return; } } static u32 bnx2x_flr_clnup_reg_poll(struct bnx2x *bp , u32 reg , u32 expected , u32 poll_count ) { u32 cur_cnt ; u32 val ; u32 tmp ; { cur_cnt = poll_count; goto ldv_55954; ldv_55953: __const_udelay(214750UL); ldv_55954: val = readl((void const volatile *)bp->regview + (unsigned long )reg); if (val != expected) { tmp = cur_cnt; cur_cnt = cur_cnt - 1U; if (tmp != 0U) { goto ldv_55953; } else { goto ldv_55955; } } else { } ldv_55955: ; return (val); } } int bnx2x_flr_clnup_poll_hw_counter(struct bnx2x *bp , u32 reg , char *msg , u32 poll_cnt ) { u32 val ; u32 tmp ; { tmp = bnx2x_flr_clnup_reg_poll(bp, reg, 0U, poll_cnt); val = tmp; if (val != 0U) { printk("\vbnx2x: [%s:%d(%s)]%s usage count=%d\n", "bnx2x_flr_clnup_poll_hw_counter", 1287, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", msg, val); return (1); } else { } return (0); } } u32 bnx2x_flr_clnup_poll_count(struct bnx2x *bp ) { { if ((bp->common.chip_id & 61440U) > 20480U && (bp->common.chip_id & 4096U) == 0U) { return (400000U); } else { } if ((bp->common.chip_id & 61440U) > 20480U && (bp->common.chip_id & 4096U) != 0U) { return (24000U); } else { } return (200U); } } void bnx2x_tx_hw_flushed(struct bnx2x *bp , u32 poll_count ) { struct pbf_pN_cmd_regs cmd_regs[3U] ; struct pbf_pN_buf_regs buf_regs[3U] ; int i ; { cmd_regs[0].pN = 0; cmd_regs[0].lines_occup = (((((((((bp->common.chip_id >> 16 == 5770U || bp->common.chip_id >> 16 == 5797U) || bp->common.chip_id >> 16 == 5801U) || bp->common.chip_id >> 16 == 5774U) || bp->common.chip_id >> 16 == 5806U) || bp->common.chip_id >> 16 == 5807U) || ((bp->common.chip_id >> 16 == 5693U || bp->common.chip_id >> 16 == 5694U) || bp->common.chip_id >> 16 == 5695U)) || ((bp->common.chip_id >> 16 == 5793U || bp->common.chip_id >> 16 == 5794U) || bp->common.chip_id >> 16 == 5773U)) || (bp->common.chip_id >> 16 == 5796U || bp->common.chip_id >> 16 == 5803U)) || bp->common.chip_id >> 16 == 5805U) && ((bp->common.chip_id & 61440U) > 20480U ? ((~ bp->common.chip_id & 61440U) >> 13) << 12 == 4096U : (bp->common.chip_id & 61440U) == 4096U) ? 1311660U : 1311484U; cmd_regs[0].lines_freed = (((((((((bp->common.chip_id >> 16 == 5770U || bp->common.chip_id >> 16 == 5797U) || bp->common.chip_id >> 16 == 5801U) || bp->common.chip_id >> 16 == 5774U) || bp->common.chip_id >> 16 == 5806U) || bp->common.chip_id >> 16 == 5807U) || ((bp->common.chip_id >> 16 == 5693U || bp->common.chip_id >> 16 == 5694U) || bp->common.chip_id >> 16 == 5695U)) || ((bp->common.chip_id >> 16 == 5793U || bp->common.chip_id >> 16 == 5794U) || bp->common.chip_id >> 16 == 5773U)) || (bp->common.chip_id >> 16 == 5796U || bp->common.chip_id >> 16 == 5803U)) || bp->common.chip_id >> 16 == 5805U) && ((bp->common.chip_id & 61440U) > 20480U ? ((~ bp->common.chip_id & 61440U) >> 13) << 12 == 4096U : (bp->common.chip_id & 61440U) == 4096U) ? 1311632U : 1311472U; cmd_regs[1].pN = 1; cmd_regs[1].lines_occup = (((((((((bp->common.chip_id >> 16 == 5770U || bp->common.chip_id >> 16 == 5797U) || bp->common.chip_id >> 16 == 5801U) || bp->common.chip_id >> 16 == 5774U) || bp->common.chip_id >> 16 == 5806U) || bp->common.chip_id >> 16 == 5807U) || ((bp->common.chip_id >> 16 == 5693U || bp->common.chip_id >> 16 == 5694U) || bp->common.chip_id >> 16 == 5695U)) || ((bp->common.chip_id >> 16 == 5793U || bp->common.chip_id >> 16 == 5794U) || bp->common.chip_id >> 16 == 5773U)) || (bp->common.chip_id >> 16 == 5796U || bp->common.chip_id >> 16 == 5803U)) || bp->common.chip_id >> 16 == 5805U) && ((bp->common.chip_id & 61440U) > 20480U ? ((~ bp->common.chip_id & 61440U) >> 13) << 12 == 4096U : (bp->common.chip_id & 61440U) == 4096U) ? 1311664U : 1311488U; cmd_regs[1].lines_freed = (((((((((bp->common.chip_id >> 16 == 5770U || bp->common.chip_id >> 16 == 5797U) || bp->common.chip_id >> 16 == 5801U) || bp->common.chip_id >> 16 == 5774U) || bp->common.chip_id >> 16 == 5806U) || bp->common.chip_id >> 16 == 5807U) || ((bp->common.chip_id >> 16 == 5693U || bp->common.chip_id >> 16 == 5694U) || bp->common.chip_id >> 16 == 5695U)) || ((bp->common.chip_id >> 16 == 5793U || bp->common.chip_id >> 16 == 5794U) || bp->common.chip_id >> 16 == 5773U)) || (bp->common.chip_id >> 16 == 5796U || bp->common.chip_id >> 16 == 5803U)) || bp->common.chip_id >> 16 == 5805U) && ((bp->common.chip_id & 61440U) > 20480U ? ((~ bp->common.chip_id & 61440U) >> 13) << 12 == 4096U : (bp->common.chip_id & 61440U) == 4096U) ? 1311636U : 1311476U; cmd_regs[2].pN = 4; cmd_regs[2].lines_occup = (((((((((bp->common.chip_id >> 16 == 5770U || bp->common.chip_id >> 16 == 5797U) || bp->common.chip_id >> 16 == 5801U) || bp->common.chip_id >> 16 == 5774U) || bp->common.chip_id >> 16 == 5806U) || bp->common.chip_id >> 16 == 5807U) || ((bp->common.chip_id >> 16 == 5693U || bp->common.chip_id >> 16 == 5694U) || bp->common.chip_id >> 16 == 5695U)) || ((bp->common.chip_id >> 16 == 5793U || bp->common.chip_id >> 16 == 5794U) || bp->common.chip_id >> 16 == 5773U)) || (bp->common.chip_id >> 16 == 5796U || bp->common.chip_id >> 16 == 5803U)) || bp->common.chip_id >> 16 == 5805U) && ((bp->common.chip_id & 61440U) > 20480U ? ((~ bp->common.chip_id & 61440U) >> 13) << 12 == 4096U : (bp->common.chip_id & 61440U) == 4096U) ? 1311656U : 1311492U; cmd_regs[2].lines_freed = (((((((((bp->common.chip_id >> 16 == 5770U || bp->common.chip_id >> 16 == 5797U) || bp->common.chip_id >> 16 == 5801U) || bp->common.chip_id >> 16 == 5774U) || bp->common.chip_id >> 16 == 5806U) || bp->common.chip_id >> 16 == 5807U) || ((bp->common.chip_id >> 16 == 5693U || bp->common.chip_id >> 16 == 5694U) || bp->common.chip_id >> 16 == 5695U)) || ((bp->common.chip_id >> 16 == 5793U || bp->common.chip_id >> 16 == 5794U) || bp->common.chip_id >> 16 == 5773U)) || (bp->common.chip_id >> 16 == 5796U || bp->common.chip_id >> 16 == 5803U)) || bp->common.chip_id >> 16 == 5805U) && ((bp->common.chip_id & 61440U) > 20480U ? ((~ bp->common.chip_id & 61440U) >> 13) << 12 == 4096U : (bp->common.chip_id & 61440U) == 4096U) ? 1311628U : 1311480U; buf_regs[0].pN = 0; buf_regs[0].init_crd = (((((((((bp->common.chip_id >> 16 == 5770U || bp->common.chip_id >> 16 == 5797U) || bp->common.chip_id >> 16 == 5801U) || bp->common.chip_id >> 16 == 5774U) || bp->common.chip_id >> 16 == 5806U) || bp->common.chip_id >> 16 == 5807U) || ((bp->common.chip_id >> 16 == 5693U || bp->common.chip_id >> 16 == 5694U) || bp->common.chip_id >> 16 == 5695U)) || ((bp->common.chip_id >> 16 == 5793U || bp->common.chip_id >> 16 == 5794U) || bp->common.chip_id >> 16 == 5773U)) || (bp->common.chip_id >> 16 == 5796U || bp->common.chip_id >> 16 == 5803U)) || bp->common.chip_id >> 16 == 5805U) && ((bp->common.chip_id & 61440U) > 20480U ? ((~ bp->common.chip_id & 61440U) >> 13) << 12 == 4096U : (bp->common.chip_id & 61440U) == 4096U) ? 1425968U : 1310928U; buf_regs[0].crd = (((((((((bp->common.chip_id >> 16 == 5770U || bp->common.chip_id >> 16 == 5797U) || bp->common.chip_id >> 16 == 5801U) || bp->common.chip_id >> 16 == 5774U) || bp->common.chip_id >> 16 == 5806U) || bp->common.chip_id >> 16 == 5807U) || ((bp->common.chip_id >> 16 == 5693U || bp->common.chip_id >> 16 == 5694U) || bp->common.chip_id >> 16 == 5695U)) || ((bp->common.chip_id >> 16 == 5793U || bp->common.chip_id >> 16 == 5794U) || bp->common.chip_id >> 16 == 5773U)) || (bp->common.chip_id >> 16 == 5796U || bp->common.chip_id >> 16 == 5803U)) || bp->common.chip_id >> 16 == 5805U) && ((bp->common.chip_id & 61440U) > 20480U ? ((~ bp->common.chip_id & 61440U) >> 13) << 12 == 4096U : (bp->common.chip_id & 61440U) == 4096U) ? 1311548U : 1311232U; buf_regs[0].crd_freed = (((((((((bp->common.chip_id >> 16 == 5770U || bp->common.chip_id >> 16 == 5797U) || bp->common.chip_id >> 16 == 5801U) || bp->common.chip_id >> 16 == 5774U) || bp->common.chip_id >> 16 == 5806U) || bp->common.chip_id >> 16 == 5807U) || ((bp->common.chip_id >> 16 == 5693U || bp->common.chip_id >> 16 == 5694U) || bp->common.chip_id >> 16 == 5695U)) || ((bp->common.chip_id >> 16 == 5793U || bp->common.chip_id >> 16 == 5794U) || bp->common.chip_id >> 16 == 5773U)) || (bp->common.chip_id >> 16 == 5796U || bp->common.chip_id >> 16 == 5803U)) || bp->common.chip_id >> 16 == 5805U) && ((bp->common.chip_id & 61440U) > 20480U ? ((~ bp->common.chip_id & 61440U) >> 13) << 12 == 4096U : (bp->common.chip_id & 61440U) == 4096U) ? 1311576U : 1311496U; buf_regs[1].pN = 1; buf_regs[1].init_crd = (((((((((bp->common.chip_id >> 16 == 5770U || bp->common.chip_id >> 16 == 5797U) || bp->common.chip_id >> 16 == 5801U) || bp->common.chip_id >> 16 == 5774U) || bp->common.chip_id >> 16 == 5806U) || bp->common.chip_id >> 16 == 5807U) || ((bp->common.chip_id >> 16 == 5693U || bp->common.chip_id >> 16 == 5694U) || bp->common.chip_id >> 16 == 5695U)) || ((bp->common.chip_id >> 16 == 5793U || bp->common.chip_id >> 16 == 5794U) || bp->common.chip_id >> 16 == 5773U)) || (bp->common.chip_id >> 16 == 5796U || bp->common.chip_id >> 16 == 5803U)) || bp->common.chip_id >> 16 == 5805U) && ((bp->common.chip_id & 61440U) > 20480U ? ((~ bp->common.chip_id & 61440U) >> 13) << 12 == 4096U : (bp->common.chip_id & 61440U) == 4096U) ? 1425972U : 1310932U; buf_regs[1].crd = (((((((((bp->common.chip_id >> 16 == 5770U || bp->common.chip_id >> 16 == 5797U) || bp->common.chip_id >> 16 == 5801U) || bp->common.chip_id >> 16 == 5774U) || bp->common.chip_id >> 16 == 5806U) || bp->common.chip_id >> 16 == 5807U) || ((bp->common.chip_id >> 16 == 5693U || bp->common.chip_id >> 16 == 5694U) || bp->common.chip_id >> 16 == 5695U)) || ((bp->common.chip_id >> 16 == 5793U || bp->common.chip_id >> 16 == 5794U) || bp->common.chip_id >> 16 == 5773U)) || (bp->common.chip_id >> 16 == 5796U || bp->common.chip_id >> 16 == 5803U)) || bp->common.chip_id >> 16 == 5805U) && ((bp->common.chip_id & 61440U) > 20480U ? ((~ bp->common.chip_id & 61440U) >> 13) << 12 == 4096U : (bp->common.chip_id & 61440U) == 4096U) ? 1311552U : 1311240U; buf_regs[1].crd_freed = (((((((((bp->common.chip_id >> 16 == 5770U || bp->common.chip_id >> 16 == 5797U) || bp->common.chip_id >> 16 == 5801U) || bp->common.chip_id >> 16 == 5774U) || bp->common.chip_id >> 16 == 5806U) || bp->common.chip_id >> 16 == 5807U) || ((bp->common.chip_id >> 16 == 5693U || bp->common.chip_id >> 16 == 5694U) || bp->common.chip_id >> 16 == 5695U)) || ((bp->common.chip_id >> 16 == 5793U || bp->common.chip_id >> 16 == 5794U) || bp->common.chip_id >> 16 == 5773U)) || (bp->common.chip_id >> 16 == 5796U || bp->common.chip_id >> 16 == 5803U)) || bp->common.chip_id >> 16 == 5805U) && ((bp->common.chip_id & 61440U) > 20480U ? ((~ bp->common.chip_id & 61440U) >> 13) << 12 == 4096U : (bp->common.chip_id & 61440U) == 4096U) ? 1311580U : 1311500U; buf_regs[2].pN = 4; buf_regs[2].init_crd = (((((((((bp->common.chip_id >> 16 == 5770U || bp->common.chip_id >> 16 == 5797U) || bp->common.chip_id >> 16 == 5801U) || bp->common.chip_id >> 16 == 5774U) || bp->common.chip_id >> 16 == 5806U) || bp->common.chip_id >> 16 == 5807U) || ((bp->common.chip_id >> 16 == 5693U || bp->common.chip_id >> 16 == 5694U) || bp->common.chip_id >> 16 == 5695U)) || ((bp->common.chip_id >> 16 == 5793U || bp->common.chip_id >> 16 == 5794U) || bp->common.chip_id >> 16 == 5773U)) || (bp->common.chip_id >> 16 == 5796U || bp->common.chip_id >> 16 == 5803U)) || bp->common.chip_id >> 16 == 5805U) && ((bp->common.chip_id & 61440U) > 20480U ? ((~ bp->common.chip_id & 61440U) >> 13) << 12 == 4096U : (bp->common.chip_id & 61440U) == 4096U) ? 1425992U : 1310944U; buf_regs[2].crd = (((((((((bp->common.chip_id >> 16 == 5770U || bp->common.chip_id >> 16 == 5797U) || bp->common.chip_id >> 16 == 5801U) || bp->common.chip_id >> 16 == 5774U) || bp->common.chip_id >> 16 == 5806U) || bp->common.chip_id >> 16 == 5807U) || ((bp->common.chip_id >> 16 == 5693U || bp->common.chip_id >> 16 == 5694U) || bp->common.chip_id >> 16 == 5695U)) || ((bp->common.chip_id >> 16 == 5793U || bp->common.chip_id >> 16 == 5794U) || bp->common.chip_id >> 16 == 5773U)) || (bp->common.chip_id >> 16 == 5796U || bp->common.chip_id >> 16 == 5803U)) || bp->common.chip_id >> 16 == 5805U) && ((bp->common.chip_id & 61440U) > 20480U ? ((~ bp->common.chip_id & 61440U) >> 13) << 12 == 4096U : (bp->common.chip_id & 61440U) == 4096U) ? 1311544U : 1311248U; buf_regs[2].crd_freed = (((((((((bp->common.chip_id >> 16 == 5770U || bp->common.chip_id >> 16 == 5797U) || bp->common.chip_id >> 16 == 5801U) || bp->common.chip_id >> 16 == 5774U) || bp->common.chip_id >> 16 == 5806U) || bp->common.chip_id >> 16 == 5807U) || ((bp->common.chip_id >> 16 == 5693U || bp->common.chip_id >> 16 == 5694U) || bp->common.chip_id >> 16 == 5695U)) || ((bp->common.chip_id >> 16 == 5793U || bp->common.chip_id >> 16 == 5794U) || bp->common.chip_id >> 16 == 5773U)) || (bp->common.chip_id >> 16 == 5796U || bp->common.chip_id >> 16 == 5803U)) || bp->common.chip_id >> 16 == 5805U) && ((bp->common.chip_id & 61440U) > 20480U ? ((~ bp->common.chip_id & 61440U) >> 13) << 12 == 4096U : (bp->common.chip_id & 61440U) == 4096U) ? 1311572U : 1311504U; i = 0; goto ldv_55977; ldv_55976: bnx2x_pbf_pN_cmd_flushed(bp, (struct pbf_pN_cmd_regs *)(& cmd_regs) + (unsigned long )i, poll_count); i = i + 1; ldv_55977: ; if ((unsigned int )i <= 2U) { goto ldv_55976; } else { } i = 0; goto ldv_55982; ldv_55981: bnx2x_pbf_pN_buf_flushed(bp, (struct pbf_pN_buf_regs *)(& buf_regs) + (unsigned long )i, poll_count); i = i + 1; ldv_55982: ; if ((unsigned int )i <= 2U) { goto ldv_55981; } else { } return; } } int bnx2x_send_final_clnup(struct bnx2x *bp , u8 clnup_func , u32 poll_cnt ) { u32 op_gen_command ; u32 comp_addr ; int ret ; unsigned int tmp ; long tmp___0 ; unsigned int tmp___1 ; long tmp___2 ; u32 tmp___3 ; { op_gen_command = 0U; comp_addr = ((unsigned int )(bp->iro_arr + 159UL)->base + (unsigned int )((int )clnup_func * (int )(bp->iro_arr + 159UL)->m1)) + 4259840U; ret = 0; tmp = readl((void const volatile *)bp->regview + (unsigned long )comp_addr); if (tmp != 0U) { printk("\vbnx2x: [%s:%d(%s)]Cleanup complete was not 0 before sending\n", "bnx2x_send_final_clnup", 1390, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); return (1); } else { } op_gen_command = ((u32 )(bp->iro_arr + 66UL)->base & 31U) | op_gen_command; op_gen_command = ((u32 )((bp->iro_arr + 67UL)->base << 5) & 255U) | op_gen_command; op_gen_command = ((u32 )((int )clnup_func << 8) & 65535U) | op_gen_command; op_gen_command = op_gen_command | 65536U; tmp___0 = ldv__builtin_expect((bp->msg_enable & 1048576) != 0, 0L); if (tmp___0 != 0L) { printk("\rbnx2x: [%s:%d(%s)]sending FW Final cleanup\n", "bnx2x_send_final_clnup", 1399, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } writel(op_gen_command, (void volatile *)bp->regview + 1467588U); tmp___3 = bnx2x_flr_clnup_reg_poll(bp, comp_addr, 1U, poll_cnt); if (tmp___3 != 1U) { printk("\vbnx2x: [%s:%d(%s)]FW final cleanup did not succeed\n", "bnx2x_send_final_clnup", 1403, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); tmp___2 = ldv__builtin_expect((bp->msg_enable & 1048576) != 0, 0L); if (tmp___2 != 0L) { tmp___1 = readl((void const volatile *)bp->regview + (unsigned long )comp_addr); printk("\rbnx2x: [%s:%d(%s)]At timeout completion address contained %x\n", "bnx2x_send_final_clnup", 1405, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", tmp___1); } else { } bp->panic = 1; printk("\vbnx2x: [%s:%d(%s)]driver assert\n", "bnx2x_send_final_clnup", 1406, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); bnx2x_panic_dump(bp, 0); return (1); } else { } writel(0U, (void volatile *)bp->regview + (unsigned long )comp_addr); return (ret); } } u8 bnx2x_is_pcie_pending(struct pci_dev *dev ) { u16 status ; { pcie_capability_read_word(dev, 10, & status); return ((unsigned int )((u8 )status) & 32U); } } static int bnx2x_poll_hw_usage_counters(struct bnx2x *bp , u32 poll_cnt ) { int tmp ; int tmp___0 ; int tmp___1 ; int tmp___2 ; int tmp___3 ; int tmp___4 ; { tmp = bnx2x_flr_clnup_poll_hw_counter(bp, 1065248U, (char *)"CFC PF usage counter timed out", poll_cnt); if (tmp != 0) { return (1); } else { } tmp___0 = bnx2x_flr_clnup_poll_hw_counter(bp, 1507792U, (char *)"DQ PF usage counter timed out", poll_cnt); if (tmp___0 != 0) { return (1); } else { } tmp___1 = bnx2x_flr_clnup_poll_hw_counter(bp, (u32 )(((int )bp->pfid + 374800) * 4), (char *)"QM PF usage counter timed out", poll_cnt); if (tmp___1 != 0) { return (1); } else { } tmp___2 = bnx2x_flr_clnup_poll_hw_counter(bp, (u32 )((((int )bp->pfid & 1) + 364618) * 4), (char *)"Timers VNIC usage counter timed out", poll_cnt); if (tmp___2 != 0) { return (1); } else { } tmp___3 = bnx2x_flr_clnup_poll_hw_counter(bp, (u32 )((((int )bp->pfid & 1) + 364584) * 4), (char *)"Timers NUM_SCANS usage counter timed out", poll_cnt); if (tmp___3 != 0) { return (1); } else { } tmp___4 = bnx2x_flr_clnup_poll_hw_counter(bp, dmae_reg_go_c[((int )bp->pfid & 1) * 8 + ((int )bp->pfid >> 1)], (char *)"DMAE dommand register timed out", poll_cnt); if (tmp___4 != 0) { return (1); } else { } return (0); } } static void bnx2x_hw_enable_status(struct bnx2x *bp ) { u32 val ; long tmp ; long tmp___0 ; long tmp___1 ; long tmp___2 ; long tmp___3 ; long tmp___4 ; long tmp___5 ; long tmp___6 ; { val = readl((void const volatile *)bp->regview + 1065252U); tmp = ldv__builtin_expect((bp->msg_enable & 1048576) != 0, 0L); if (tmp != 0L) { printk("\rbnx2x: [%s:%d(%s)]CFC_REG_WEAK_ENABLE_PF is 0x%x\n", "bnx2x_hw_enable_status", 1477, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", val); } else { } val = readl((void const volatile *)bp->regview + 1311464U); tmp___0 = ldv__builtin_expect((bp->msg_enable & 1048576) != 0, 0L); if (tmp___0 != 0L) { printk("\rbnx2x: [%s:%d(%s)]PBF_REG_DISABLE_PF is 0x%x\n", "bnx2x_hw_enable_status", 1480, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", val); } else { } val = readl((void const volatile *)bp->regview + 1245504U); tmp___1 = ldv__builtin_expect((bp->msg_enable & 1048576) != 0, 0L); if (tmp___1 != 0L) { printk("\rbnx2x: [%s:%d(%s)]IGU_REG_PCI_PF_MSI_EN is 0x%x\n", "bnx2x_hw_enable_status", 1483, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", val); } else { } val = readl((void const volatile *)bp->regview + 1245508U); tmp___2 = ldv__builtin_expect((bp->msg_enable & 1048576) != 0, 0L); if (tmp___2 != 0L) { printk("\rbnx2x: [%s:%d(%s)]IGU_REG_PCI_PF_MSIX_EN is 0x%x\n", "bnx2x_hw_enable_status", 1486, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", val); } else { } val = readl((void const volatile *)bp->regview + 1245512U); tmp___3 = ldv__builtin_expect((bp->msg_enable & 1048576) != 0, 0L); if (tmp___3 != 0L) { printk("\rbnx2x: [%s:%d(%s)]IGU_REG_PCI_PF_MSIX_FUNC_MASK is 0x%x\n", "bnx2x_hw_enable_status", 1489, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", val); } else { } val = readl((void const volatile *)bp->regview + 37976U); tmp___4 = ldv__builtin_expect((bp->msg_enable & 1048576) != 0, 0L); if (tmp___4 != 0L) { printk("\rbnx2x: [%s:%d(%s)]PGLUE_B_REG_SHADOW_BME_PF_7_0_CLR is 0x%x\n", "bnx2x_hw_enable_status", 1492, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", val); } else { } val = readl((void const volatile *)bp->regview + 37912U); tmp___5 = ldv__builtin_expect((bp->msg_enable & 1048576) != 0, 0L); if (tmp___5 != 0L) { printk("\rbnx2x: [%s:%d(%s)]PGLUE_B_REG_FLR_REQUEST_PF_7_0_CLR is 0x%x\n", "bnx2x_hw_enable_status", 1495, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", val); } else { } val = readl((void const volatile *)bp->regview + 37932U); tmp___6 = ldv__builtin_expect((bp->msg_enable & 1048576) != 0, 0L); if (tmp___6 != 0L) { printk("\rbnx2x: [%s:%d(%s)]PGLUE_B_REG_INTERNAL_PFID_ENABLE_MASTER is 0x%x\n", "bnx2x_hw_enable_status", 1499, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", val); } else { } return; } } static int bnx2x_pf_flr_clnup(struct bnx2x *bp ) { u32 poll_cnt ; u32 tmp ; long tmp___0 ; long tmp___1 ; int tmp___2 ; int tmp___3 ; u8 tmp___4 ; { tmp = bnx2x_flr_clnup_poll_count(bp); poll_cnt = tmp; tmp___0 = ldv__builtin_expect((bp->msg_enable & 1048576) != 0, 0L); if (tmp___0 != 0L) { printk("\rbnx2x: [%s:%d(%s)]Cleanup after FLR PF[%d]\n", "bnx2x_pf_flr_clnup", 1506, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )bp->pf_num); } else { } writel(1U, (void volatile *)bp->regview + 37936U); tmp___1 = ldv__builtin_expect((bp->msg_enable & 1048576) != 0, 0L); if (tmp___1 != 0L) { printk("\rbnx2x: [%s:%d(%s)]Polling usage counters\n", "bnx2x_pf_flr_clnup", 1512, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } tmp___2 = bnx2x_poll_hw_usage_counters(bp, poll_cnt); if (tmp___2 != 0) { return (-16); } else { } tmp___3 = bnx2x_send_final_clnup(bp, (int )bp->pfid, poll_cnt); if (tmp___3 != 0) { return (-16); } else { } bnx2x_tx_hw_flushed(bp, poll_cnt); msleep(100U); tmp___4 = bnx2x_is_pcie_pending(bp->pdev); if ((unsigned int )tmp___4 != 0U) { printk("\vbnx2x: [%s:%d(%s)]PCIE Transactions still pending\n", "bnx2x_pf_flr_clnup", 1532, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } bnx2x_hw_enable_status(bp); writel(1U, (void volatile *)bp->regview + 37932U); return (0); } } static void bnx2x_hc_int_enable(struct bnx2x *bp ) { int port ; u32 addr ; u32 val ; unsigned int tmp ; bool msix ; bool single_msix ; bool msi ; long tmp___0 ; long tmp___1 ; { port = (int )bp->pfid & 1; addr = port != 0 ? 1081348U : 1081344U; tmp = readl((void const volatile *)bp->regview + (unsigned long )addr); val = tmp; msix = (bp->flags & 32U) != 0U; single_msix = (bp->flags & 1048576U) != 0U; msi = (bp->flags & 64U) != 0U; if ((int )msix) { val = val & 4294967285U; val = val | 20U; if ((int )single_msix) { val = val | 2U; } else { } } else if ((int )msi) { val = val & 4294967287U; val = val | 22U; } else { val = val | 30U; if (bp->common.chip_id >> 16 != 5710U) { tmp___0 = ldv__builtin_expect((bp->msg_enable & 32) != 0, 0L); if (tmp___0 != 0L) { printk("\rbnx2x: [%s:%d(%s)]write %x to HC %d (addr 0x%x)\n", "bnx2x_hc_int_enable", 1575, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", val, port, addr); } else { } writel(val, (void volatile *)bp->regview + (unsigned long )addr); val = val & 4294967291U; } else { } } if (bp->common.chip_id >> 16 == 5710U) { writel(131071U, (void volatile *)bp->regview + (unsigned long )((port + 270402) * 4)); } else { } tmp___1 = ldv__builtin_expect((bp->msg_enable & 32) != 0, 0L); if (tmp___1 != 0L) { printk("\rbnx2x: [%s:%d(%s)]write %x to HC %d (addr 0x%x) mode %s\n", "bnx2x_hc_int_enable", 1588, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", val, port, addr, (int )msix ? (char *)"MSI-X" : ((int )msi ? (char *)"MSI" : (char *)"INTx")); } else { } writel(val, (void volatile *)bp->regview + (unsigned long )addr); __asm__ volatile ("": : : "memory"); __asm__ volatile ("": : : "memory"); if (bp->common.chip_id >> 16 != 5710U) { if ((unsigned int )bp->mf_mode != 0U) { val = (u32 )((1 << (((int )bp->pfid >> 1) + 4)) | 60943); if (bp->port.pmf != 0U) { val = val | 4352U; } else { } } else { val = 65535U; } writel(val, (void volatile *)bp->regview + (unsigned long )(port * 8 + 1081412)); writel(val, (void volatile *)bp->regview + (unsigned long )((port + 135176) * 8)); } else { } __asm__ volatile ("": : : "memory"); return; } } static void bnx2x_igu_int_enable(struct bnx2x *bp ) { u32 val ; bool msix ; bool single_msix ; bool msi ; long tmp ; { msix = (bp->flags & 32U) != 0U; single_msix = (bp->flags & 1048576U) != 0U; msi = (bp->flags & 64U) != 0U; val = readl((void const volatile *)bp->regview + 1245524U); if ((int )msix) { val = val & 4294967275U; val = val | 10U; if ((int )single_msix) { val = val | 16U; } else { } } else if ((int )msi) { val = val & 4294967291U; val = val | 26U; } else { val = val & 4294967293U; val = val | 28U; } if (! msix || (int )single_msix) { writel(val, (void volatile *)bp->regview + 1245524U); bnx2x_ack_int(bp); } else { } val = val | 1U; tmp = ldv__builtin_expect((bp->msg_enable & 32) != 0, 0L); if (tmp != 0L) { printk("\rbnx2x: [%s:%d(%s)]write 0x%x to IGU mode %s\n", "bnx2x_igu_int_enable", 1653, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", val, (int )msix ? (char *)"MSI-X" : ((int )msi ? (char *)"MSI" : (char *)"INTx")); } else { } writel(val, (void volatile *)bp->regview + 1245524U); if ((val & 4U) != 0U) { pci_intx(bp->pdev, 1); } else { } __asm__ volatile ("": : : "memory"); if ((unsigned int )bp->mf_mode != 0U) { val = (u32 )((1 << (((int )bp->pfid >> 1) + 4)) | 60943); if (bp->port.pmf != 0U) { val = val | 4352U; } else { } } else { val = 65535U; } writel(val, (void volatile *)bp->regview + 1245444U); writel(val, (void volatile *)bp->regview + 1245492U); __asm__ volatile ("": : : "memory"); return; } } void bnx2x_int_enable(struct bnx2x *bp ) { { if ((unsigned int )bp->common.int_block == 0U) { bnx2x_hc_int_enable(bp); } else { bnx2x_igu_int_enable(bp); } return; } } void bnx2x_int_disable_sync(struct bnx2x *bp , int disable_hw ) { int msix ; int i ; int offset ; int tmp ; { msix = (bp->flags & 32U) != 0U; if (disable_hw != 0) { bnx2x_int_disable(bp); } else { } if (msix != 0) { synchronize_irq((bp->msix_table)->vector); offset = 1; if ((unsigned int )bp->cnic_support != 0U) { offset = offset + 1; } else { } i = 0; goto ldv_56040; ldv_56039: tmp = offset; offset = offset + 1; synchronize_irq((bp->msix_table + (unsigned long )tmp)->vector); i = i + 1; ldv_56040: ; if ((uint )i < bp->num_ethernet_queues) { goto ldv_56039; } else { } } else { synchronize_irq((bp->pdev)->irq); } cancel_delayed_work(& bp->sp_task); cancel_delayed_work(& bp->period_task); flush_workqueue(bnx2x_wq); return; } } static bool bnx2x_trylock_hw_lock(struct bnx2x *bp , u32 resource ) { u32 lock_status ; u32 resource_bit ; int func ; u32 hw_lock_control_reg ; long tmp ; long tmp___0 ; long tmp___1 ; { resource_bit = (u32 )(1 << (int )resource); func = (int )bp->pfid; tmp = ldv__builtin_expect((bp->msg_enable & 8224) != 0, 0L); if (tmp != 0L) { printk("\rbnx2x: [%s:%d(%s)]Trying to take a lock on resource %d\n", "bnx2x_trylock_hw_lock", 1727, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", resource); } else { } if (resource > 31U) { tmp___0 = ldv__builtin_expect((bp->msg_enable & 8224) != 0, 0L); if (tmp___0 != 0L) { printk("\rbnx2x: [%s:%d(%s)]resource(0x%x) > HW_LOCK_MAX_RESOURCE_VALUE(0x%x)\n", "bnx2x_trylock_hw_lock", 1733, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", resource, 31); } else { } return (0); } else { } if (func <= 5) { hw_lock_control_reg = (u32 )((func + 5282) * 8); } else { hw_lock_control_reg = (u32 )((func + 5235) * 8); } writel(resource_bit, (void volatile *)bp->regview + (unsigned long )(hw_lock_control_reg + 4U)); lock_status = readl((void const volatile *)bp->regview + (unsigned long )hw_lock_control_reg); if ((lock_status & resource_bit) != 0U) { return (1); } else { } tmp___1 = ldv__builtin_expect((bp->msg_enable & 8224) != 0, 0L); if (tmp___1 != 0L) { printk("\rbnx2x: [%s:%d(%s)]Failed to get a lock on resource %d\n", "bnx2x_trylock_hw_lock", 1750, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", resource); } else { } return (0); } } static int bnx2x_get_leader_lock_resource(struct bnx2x *bp ) { { if (bp->common.chip_id >> 16 != 5710U && (bp->common.chip_id >> 16 != 5711U && bp->common.chip_id >> 16 != 5712U) ? (int )bp->pf_num & 1 : 0) { return (9); } else { return (8); } } } static bool bnx2x_trylock_leader_lock(struct bnx2x *bp ) { int tmp ; bool tmp___0 ; { tmp = bnx2x_get_leader_lock_resource(bp); tmp___0 = bnx2x_trylock_hw_lock(bp, (u32 )tmp); return (tmp___0); } } static void bnx2x_cnic_cfc_comp(struct bnx2x *bp , int cid , u8 err ) ; static int bnx2x_schedule_sp_task(struct bnx2x *bp ) { bool tmp ; { atomic_set(& bp->interrupt_occurred, 1); __asm__ volatile ("": : : "memory"); tmp = queue_delayed_work(bnx2x_wq, & bp->sp_task, 0UL); return ((int )tmp); } } void bnx2x_sp_event(struct bnx2x_fastpath *fp , union eth_rx_cqe *rr_cqe ) { struct bnx2x *bp ; int cid ; int command ; enum bnx2x_queue_cmd drv_cmd ; struct bnx2x_queue_sp_obj *q_obj ; long tmp ; long tmp___0 ; long tmp___1 ; long tmp___2 ; long tmp___3 ; long tmp___4 ; long tmp___5 ; int tmp___6 ; int tmp___7 ; long tmp___8 ; int tmp___9 ; { bp = fp->bp; cid = (int )rr_cqe->ramrod_cqe.conn_and_cmd_data & 131071; command = (int )(rr_cqe->ramrod_cqe.conn_and_cmd_data >> 24); drv_cmd = 11; q_obj = & (bp->sp_objs + (unsigned long )fp->index)->q_obj; tmp = ldv__builtin_expect((bp->msg_enable & 1048576) != 0, 0L); if (tmp != 0L) { printk("\rbnx2x: [%s:%d(%s)]fp %d cid %d got ramrod #%d state is %x type is %d\n", "bnx2x_sp_event", 1814, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )fp->index, cid, command, (int )bp->state, (int )rr_cqe->ramrod_cqe.ramrod_type); } else { } if (cid > 255 && cid <= 319) { bnx2x_iov_set_queue_sp_obj(bp, cid, & q_obj); } else { } switch (command) { case 5: tmp___0 = ldv__builtin_expect((bp->msg_enable & 1048576) != 0, 0L); if (tmp___0 != 0L) { printk("\rbnx2x: [%s:%d(%s)]got UPDATE ramrod. CID %d\n", "bnx2x_sp_event", 1825, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", cid); } else { } drv_cmd = 5; goto ldv_56075; case 1: tmp___1 = ldv__builtin_expect((bp->msg_enable & 1048576) != 0, 0L); if (tmp___1 != 0L) { printk("\rbnx2x: [%s:%d(%s)]got MULTI[%d] setup ramrod\n", "bnx2x_sp_event", 1830, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", cid); } else { } drv_cmd = 1; goto ldv_56075; case 4: tmp___2 = ldv__builtin_expect((bp->msg_enable & 1048576) != 0, 0L); if (tmp___2 != 0L) { printk("\rbnx2x: [%s:%d(%s)]got MULTI[%d] tx-only setup ramrod\n", "bnx2x_sp_event", 1835, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", cid); } else { } drv_cmd = 2; goto ldv_56075; case 2: tmp___3 = ldv__builtin_expect((bp->msg_enable & 1048576) != 0, 0L); if (tmp___3 != 0L) { printk("\rbnx2x: [%s:%d(%s)]got MULTI[%d] halt ramrod\n", "bnx2x_sp_event", 1840, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", cid); } else { } drv_cmd = 7; goto ldv_56075; case 7: tmp___4 = ldv__builtin_expect((bp->msg_enable & 1048576) != 0, 0L); if (tmp___4 != 0L) { printk("\rbnx2x: [%s:%d(%s)]got MULTI[%d] teminate ramrod\n", "bnx2x_sp_event", 1845, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", cid); } else { } drv_cmd = 9; goto ldv_56075; case 6: tmp___5 = ldv__builtin_expect((bp->msg_enable & 1048576) != 0, 0L); if (tmp___5 != 0L) { printk("\rbnx2x: [%s:%d(%s)]got MULTI[%d] empty ramrod\n", "bnx2x_sp_event", 1850, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", cid); } else { } drv_cmd = 10; goto ldv_56075; default: printk("\vbnx2x: [%s:%d(%s)]unexpected MC reply (%d) on fp[%d]\n", "bnx2x_sp_event", 1856, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", command, (int )fp->index); return; } ldv_56075: ; if ((unsigned int )drv_cmd != 11U) { tmp___6 = (*(q_obj->complete_cmd))(bp, q_obj, drv_cmd); if (tmp___6 != 0) { return; } else { } } else { } bnx2x_iov_sp_event(bp, cid, 1); __asm__ volatile ("": : : "memory"); atomic_inc(& bp->cq_spq_left); __asm__ volatile ("": : : "memory"); tmp___8 = ldv__builtin_expect((bp->msg_enable & 1048576) != 0, 0L); if (tmp___8 != 0L) { tmp___7 = atomic_read((atomic_t const *)(& bp->cq_spq_left)); printk("\rbnx2x: [%s:%d(%s)]bp->cq_spq_left %x\n", "bnx2x_sp_event", 1882, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", tmp___7); } else { } if ((unsigned int )drv_cmd == 5U && (uint )fp->index == (uint )(fp->bp)->num_queues - (fp->bp)->num_cnic_queues) { tmp___9 = constant_test_bit(12U, (unsigned long const volatile *)(& bp->sp_state)); if (tmp___9 != 0) { __asm__ volatile ("": : : "memory"); set_bit(13U, (unsigned long volatile *)(& bp->sp_state)); __asm__ volatile ("sfence": : : "memory"); clear_bit(12, (unsigned long volatile *)(& bp->sp_state)); __asm__ volatile ("": : : "memory"); bnx2x_schedule_sp_task(bp); } else { } } else { } return; } } irqreturn_t bnx2x_interrupt(int irq , void *dev_instance ) { struct bnx2x *bp ; void *tmp ; u16 status ; u16 tmp___0 ; u16 mask ; int i ; u8 cos ; long tmp___1 ; long tmp___2 ; long tmp___3 ; struct bnx2x_fastpath *fp ; struct cnic_ops *c_ops ; struct cnic_ops *_________p1 ; bool __warned ; int tmp___4 ; int tmp___5 ; long tmp___6 ; long tmp___7 ; long tmp___8 ; { tmp = netdev_priv((struct net_device const *)dev_instance); bp = (struct bnx2x *)tmp; tmp___0 = bnx2x_ack_int(bp); status = tmp___0; tmp___2 = ldv__builtin_expect((unsigned int )status == 0U, 0L); if (tmp___2 != 0L) { tmp___1 = ldv__builtin_expect((bp->msg_enable & 512) != 0, 0L); if (tmp___1 != 0L) { printk("\rbnx2x: [%s:%d(%s)]not our interrupt!\n", "bnx2x_interrupt", 1918, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } return (0); } else { } tmp___3 = ldv__builtin_expect((bp->msg_enable & 512) != 0, 0L); if (tmp___3 != 0L) { printk("\rbnx2x: [%s:%d(%s)]got an interrupt status 0x%x\n", "bnx2x_interrupt", 1921, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )status); } else { } i = 0; goto ldv_56097; ldv_56096: fp = bp->fp + (unsigned long )i; mask = (u16 )(2 << ((int )fp->index + (int )bp->cnic_support)); if ((unsigned int )((int )status & (int )mask) != 0U) { __builtin_prefetch((void const *)fp->rx_cons_sb); cos = 0U; goto ldv_56094; ldv_56093: __builtin_prefetch((void const *)(fp->txdata_ptr[(int )cos])->tx_cons_sb); cos = (u8 )((int )cos + 1); ldv_56094: ; if ((int )fp->max_cos > (int )cos) { goto ldv_56093; } else { } __builtin_prefetch((void const *)fp->sb_running_index); napi_schedule(& (bp->fp + (unsigned long )fp->index)->napi); status = (u16 )(~ ((int )((short )mask)) & (int )((short )status)); } else { } i = i + 1; ldv_56097: ; if ((uint )i < bp->num_ethernet_queues) { goto ldv_56096; } else { } if ((unsigned int )bp->cnic_support != 0U) { mask = 2U; if ((((unsigned int )mask | 1U) & (unsigned int )status) != 0U) { c_ops = 0; rcu_read_lock(); _________p1 = *((struct cnic_ops * volatile *)(& bp->cnic_ops)); tmp___4 = debug_lockdep_rcu_enabled(); if (tmp___4 != 0 && ! __warned) { tmp___5 = rcu_read_lock_held(); if (tmp___5 == 0 && 1) { __warned = 1; lockdep_rcu_suspicious("/work/ldvuser/exper_fp/work/current--X--drivers--X--defaultlinux-3.10-rc1.tar--X--32_7a--X--cpachecker/linux-3.10-rc1.tar/csd_deg_dscv/8504/dscv_tempdir/dscv/ri/32_7a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c.prepared", 1949, "suspicious rcu_dereference_check() usage"); } else { } } else { } c_ops = _________p1; if ((unsigned long )c_ops != (unsigned long )((struct cnic_ops *)0) && (bp->cnic_eth_dev.drv_state & 32U) != 0U) { (*(c_ops->cnic_handler))(bp->cnic_data, 0); } else { } rcu_read_unlock(); status = (u16 )(~ ((int )((short )mask)) & (int )((short )status)); } else { } } else { } tmp___6 = ldv__builtin_expect((long )status & 1L, 0L); if (tmp___6 != 0L) { bnx2x_schedule_sp_task(bp); status = (unsigned int )status & 65534U; if ((unsigned int )status == 0U) { return (1); } else { } } else { } tmp___8 = ldv__builtin_expect((unsigned int )status != 0U, 0L); if (tmp___8 != 0L) { tmp___7 = ldv__builtin_expect((bp->msg_enable & 512) != 0, 0L); if (tmp___7 != 0L) { printk("\rbnx2x: [%s:%d(%s)]got an unknown interrupt! (status 0x%x)\n", "bnx2x_interrupt", 1973, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )status); } else { } } else { } return (1); } } int bnx2x_acquire_hw_lock(struct bnx2x *bp , u32 resource ) { u32 lock_status ; u32 resource_bit ; int func ; u32 hw_lock_control_reg ; int cnt ; { resource_bit = (u32 )(1 << (int )resource); func = (int )bp->pfid; if (resource > 31U) { printk("\vbnx2x: [%s:%d(%s)]resource(0x%x) > HW_LOCK_MAX_RESOURCE_VALUE(0x%x)\n", "bnx2x_acquire_hw_lock", 1995, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", resource, 31); return (-22); } else { } if (func <= 5) { hw_lock_control_reg = (u32 )((func + 5282) * 8); } else { hw_lock_control_reg = (u32 )((func + 5235) * 8); } lock_status = readl((void const volatile *)bp->regview + (unsigned long )hw_lock_control_reg); if ((lock_status & resource_bit) != 0U) { printk("\vbnx2x: [%s:%d(%s)]lock_status 0x%x resource_bit 0x%x\n", "bnx2x_acquire_hw_lock", 2010, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", lock_status, resource_bit); return (-17); } else { } cnt = 0; goto ldv_56114; ldv_56113: writel(resource_bit, (void volatile *)bp->regview + (unsigned long )(hw_lock_control_reg + 4U)); lock_status = readl((void const volatile *)bp->regview + (unsigned long )hw_lock_control_reg); if ((lock_status & resource_bit) != 0U) { return (0); } else { } msleep(5U); cnt = cnt + 1; ldv_56114: ; if (cnt <= 999) { goto ldv_56113; } else { } printk("\vbnx2x: [%s:%d(%s)]Timeout\n", "bnx2x_acquire_hw_lock", 2024, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); return (-11); } } int bnx2x_release_leader_lock(struct bnx2x *bp ) { int tmp ; int tmp___0 ; { tmp = bnx2x_get_leader_lock_resource(bp); tmp___0 = bnx2x_release_hw_lock(bp, (u32 )tmp); return (tmp___0); } } int bnx2x_release_hw_lock(struct bnx2x *bp , u32 resource ) { u32 lock_status ; u32 resource_bit ; int func ; u32 hw_lock_control_reg ; { resource_bit = (u32 )(1 << (int )resource); func = (int )bp->pfid; if (resource > 31U) { printk("\vbnx2x: [%s:%d(%s)]resource(0x%x) > HW_LOCK_MAX_RESOURCE_VALUE(0x%x)\n", "bnx2x_release_hw_lock", 2043, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", resource, 31); return (-22); } else { } if (func <= 5) { hw_lock_control_reg = (u32 )((func + 5282) * 8); } else { hw_lock_control_reg = (u32 )((func + 5235) * 8); } lock_status = readl((void const volatile *)bp->regview + (unsigned long )hw_lock_control_reg); if ((lock_status & resource_bit) == 0U) { printk("\vbnx2x: [%s:%d(%s)]lock_status 0x%x resource_bit 0x%x. unlock was called but lock wasn\'t taken!\n", "bnx2x_release_hw_lock", 2058, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", lock_status, resource_bit); return (-14); } else { } writel(resource_bit, (void volatile *)bp->regview + (unsigned long )hw_lock_control_reg); return (0); } } int bnx2x_get_gpio(struct bnx2x *bp , int gpio_num , u8 port ) { int gpio_port ; unsigned int tmp ; unsigned int tmp___0 ; int tmp___1 ; int gpio_shift ; u32 gpio_mask ; u32 gpio_reg ; int value ; long tmp___2 ; { tmp = readl((void const volatile *)bp->regview + 66452U); if (tmp != 0U) { tmp___0 = readl((void const volatile *)bp->regview + 66456U); if (tmp___0 != 0U) { tmp___1 = 1; } else { tmp___1 = 0; } } else { tmp___1 = 0; } gpio_port = tmp___1 ^ (int )port; gpio_shift = (gpio_port != 0 ? 4 : 0) + gpio_num; gpio_mask = (u32 )(1 << gpio_shift); if (gpio_num > 3) { printk("\vbnx2x: [%s:%d(%s)]Invalid GPIO %d\n", "bnx2x_get_gpio", 2079, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", gpio_num); return (-22); } else { } gpio_reg = readl((void const volatile *)bp->regview + 42128U); if ((gpio_reg & gpio_mask) == gpio_mask) { value = 1; } else { value = 0; } tmp___2 = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp___2 != 0L) { printk("\rbnx2x: [%s:%d(%s)]pin %d value 0x%x\n", "bnx2x_get_gpio", 2092, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", gpio_num, value); } else { } return (value); } } int bnx2x_set_gpio(struct bnx2x *bp , int gpio_num , u32 mode , u8 port ) { int gpio_port ; unsigned int tmp ; unsigned int tmp___0 ; int tmp___1 ; int gpio_shift ; u32 gpio_mask ; u32 gpio_reg ; unsigned int tmp___2 ; long tmp___3 ; long tmp___4 ; long tmp___5 ; { tmp = readl((void const volatile *)bp->regview + 66452U); if (tmp != 0U) { tmp___0 = readl((void const volatile *)bp->regview + 66456U); if (tmp___0 != 0U) { tmp___1 = 1; } else { tmp___1 = 0; } } else { tmp___1 = 0; } gpio_port = tmp___1 ^ (int )port; gpio_shift = (gpio_port != 0 ? 4 : 0) + gpio_num; gpio_mask = (u32 )(1 << gpio_shift); if (gpio_num > 3) { printk("\vbnx2x: [%s:%d(%s)]Invalid GPIO %d\n", "bnx2x_set_gpio", 2108, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", gpio_num); return (-22); } else { } bnx2x_acquire_hw_lock(bp, 1U); tmp___2 = readl((void const volatile *)bp->regview + 42128U); gpio_reg = tmp___2 & 4278190080U; switch (mode) { case 0U: tmp___3 = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp___3 != 0L) { printk("\rbnx2x: [%s:%d(%s)]Set GPIO %d (shift %d) -> output low\n", "bnx2x_set_gpio", 2120, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", gpio_num, gpio_shift); } else { } gpio_reg = ~ (gpio_mask << 24) & gpio_reg; gpio_reg = (gpio_mask << 16) | gpio_reg; goto ldv_56151; case 1U: tmp___4 = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp___4 != 0L) { printk("\rbnx2x: [%s:%d(%s)]Set GPIO %d (shift %d) -> output high\n", "bnx2x_set_gpio", 2129, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", gpio_num, gpio_shift); } else { } gpio_reg = ~ (gpio_mask << 24) & gpio_reg; gpio_reg = (gpio_mask << 8) | gpio_reg; goto ldv_56151; case 2U: tmp___5 = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp___5 != 0L) { printk("\rbnx2x: [%s:%d(%s)]Set GPIO %d (shift %d) -> input\n", "bnx2x_set_gpio", 2138, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", gpio_num, gpio_shift); } else { } gpio_reg = (gpio_mask << 24) | gpio_reg; goto ldv_56151; default: ; goto ldv_56151; } ldv_56151: writel(gpio_reg, (void volatile *)bp->regview + 42128U); bnx2x_release_hw_lock(bp, 1U); return (0); } } int bnx2x_set_mult_gpio(struct bnx2x *bp , u8 pins , u32 mode ) { u32 gpio_reg ; int rc ; long tmp ; long tmp___0 ; long tmp___1 ; { gpio_reg = 0U; rc = 0; bnx2x_acquire_hw_lock(bp, 1U); gpio_reg = readl((void const volatile *)bp->regview + 42128U); gpio_reg = (u32 )(~ ((int )pins << 24)) & gpio_reg; gpio_reg = (u32 )(~ ((int )pins << 16)) & gpio_reg; gpio_reg = (u32 )(~ ((int )pins << 8)) & gpio_reg; switch (mode) { case 0U: tmp = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp != 0L) { printk("\rbnx2x: [%s:%d(%s)]Set GPIO 0x%x -> output low\n", "bnx2x_set_mult_gpio", 2169, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )pins); } else { } gpio_reg = (u32 )((int )pins << 16) | gpio_reg; goto ldv_56164; case 1U: tmp___0 = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp___0 != 0L) { printk("\rbnx2x: [%s:%d(%s)]Set GPIO 0x%x -> output high\n", "bnx2x_set_mult_gpio", 2175, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )pins); } else { } gpio_reg = (u32 )((int )pins << 8) | gpio_reg; goto ldv_56164; case 2U: tmp___1 = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp___1 != 0L) { printk("\rbnx2x: [%s:%d(%s)]Set GPIO 0x%x -> input\n", "bnx2x_set_mult_gpio", 2181, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )pins); } else { } gpio_reg = (u32 )((int )pins << 24) | gpio_reg; goto ldv_56164; default: printk("\vbnx2x: [%s:%d(%s)]Invalid GPIO mode assignment %d\n", "bnx2x_set_mult_gpio", 2187, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", mode); rc = -22; goto ldv_56164; } ldv_56164: ; if (rc == 0) { writel(gpio_reg, (void volatile *)bp->regview + 42128U); } else { } bnx2x_release_hw_lock(bp, 1U); return (rc); } } int bnx2x_set_gpio_int(struct bnx2x *bp , int gpio_num , u32 mode , u8 port ) { int gpio_port ; unsigned int tmp ; unsigned int tmp___0 ; int tmp___1 ; int gpio_shift ; u32 gpio_mask ; u32 gpio_reg ; long tmp___2 ; long tmp___3 ; { tmp = readl((void const volatile *)bp->regview + 66452U); if (tmp != 0U) { tmp___0 = readl((void const volatile *)bp->regview + 66456U); if (tmp___0 != 0U) { tmp___1 = 1; } else { tmp___1 = 0; } } else { tmp___1 = 0; } gpio_port = tmp___1 ^ (int )port; gpio_shift = (gpio_port != 0 ? 4 : 0) + gpio_num; gpio_mask = (u32 )(1 << gpio_shift); if (gpio_num > 3) { printk("\vbnx2x: [%s:%d(%s)]Invalid GPIO %d\n", "bnx2x_set_gpio_int", 2211, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", gpio_num); return (-22); } else { } bnx2x_acquire_hw_lock(bp, 1U); gpio_reg = readl((void const volatile *)bp->regview + 42132U); switch (mode) { case 0U: tmp___2 = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp___2 != 0L) { printk("\rbnx2x: [%s:%d(%s)]Clear GPIO INT %d (shift %d) -> output low\n", "bnx2x_set_gpio_int", 2223, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", gpio_num, gpio_shift); } else { } gpio_reg = ~ (gpio_mask << 16) & gpio_reg; gpio_reg = (gpio_mask << 24) | gpio_reg; goto ldv_56180; case 1U: tmp___3 = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp___3 != 0L) { printk("\rbnx2x: [%s:%d(%s)]Set GPIO INT %d (shift %d) -> output high\n", "bnx2x_set_gpio_int", 2232, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", gpio_num, gpio_shift); } else { } gpio_reg = ~ (gpio_mask << 24) & gpio_reg; gpio_reg = (gpio_mask << 16) | gpio_reg; goto ldv_56180; default: ; goto ldv_56180; } ldv_56180: writel(gpio_reg, (void volatile *)bp->regview + 42132U); bnx2x_release_hw_lock(bp, 1U); return (0); } } static int bnx2x_set_spio(struct bnx2x *bp , int spio , u32 mode ) { u32 spio_reg ; unsigned int tmp ; long tmp___0 ; long tmp___1 ; long tmp___2 ; { if (spio != 16 && spio != 32) { printk("\vbnx2x: [%s:%d(%s)]Invalid SPIO 0x%x\n", "bnx2x_set_spio", 2254, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", spio); return (-22); } else { } bnx2x_acquire_hw_lock(bp, 2U); tmp = readl((void const volatile *)bp->regview + 42236U); spio_reg = tmp & 4278190080U; switch (mode) { case 0U: tmp___0 = ldv__builtin_expect((bp->msg_enable & 8192) != 0, 0L); if (tmp___0 != 0L) { printk("\rbnx2x: [%s:%d(%s)]Set SPIO 0x%x -> output low\n", "bnx2x_set_spio", 2264, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", spio); } else { } spio_reg = (u32 )(~ (spio << 24)) & spio_reg; spio_reg = (u32 )(spio << 16) | spio_reg; goto ldv_56191; case 1U: tmp___1 = ldv__builtin_expect((bp->msg_enable & 8192) != 0, 0L); if (tmp___1 != 0L) { printk("\rbnx2x: [%s:%d(%s)]Set SPIO 0x%x -> output high\n", "bnx2x_set_spio", 2271, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", spio); } else { } spio_reg = (u32 )(~ (spio << 24)) & spio_reg; spio_reg = (u32 )(spio << 8) | spio_reg; goto ldv_56191; case 2U: tmp___2 = ldv__builtin_expect((bp->msg_enable & 8192) != 0, 0L); if (tmp___2 != 0L) { printk("\rbnx2x: [%s:%d(%s)]Set SPIO 0x%x -> input\n", "bnx2x_set_spio", 2278, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", spio); } else { } spio_reg = (u32 )(spio << 24) | spio_reg; goto ldv_56191; default: ; goto ldv_56191; } ldv_56191: writel(spio_reg, (void volatile *)bp->regview + 42236U); bnx2x_release_hw_lock(bp, 2U); return (0); } } void bnx2x_calc_fc_adv(struct bnx2x *bp ) { u8 cfg_idx ; int tmp ; { tmp = bnx2x_get_link_cfg_idx(bp); cfg_idx = (u8 )tmp; switch ((int )bp->link_vars.ieee_fc & 384) { case 0: bp->port.advertising[(int )cfg_idx] = bp->port.advertising[(int )cfg_idx] & 4294942719U; goto ldv_56200; case 384: bp->port.advertising[(int )cfg_idx] = bp->port.advertising[(int )cfg_idx] | 24576U; goto ldv_56200; case 256: bp->port.advertising[(int )cfg_idx] = bp->port.advertising[(int )cfg_idx] | 16384U; goto ldv_56200; default: bp->port.advertising[(int )cfg_idx] = bp->port.advertising[(int )cfg_idx] & 4294942719U; goto ldv_56200; } ldv_56200: ; return; } } static void bnx2x_set_requested_fc(struct bnx2x *bp ) { { if ((bp->common.chip_id >> 16 == 5710U || (bp->common.chip_id >> 16 == 5711U || bp->common.chip_id >> 16 == 5712U)) && (bp->dev)->mtu > 5000U) { bp->link_params.req_fc_auto_adv = 256U; } else { bp->link_params.req_fc_auto_adv = 768U; } return; } } int bnx2x_initial_phy_init(struct bnx2x *bp , int load_mode ) { int rc ; int cfx_idx ; int tmp ; u16 req_line_speed ; struct link_params *lp ; struct link_params *lp___0 ; { tmp = bnx2x_get_link_cfg_idx(bp); cfx_idx = tmp; req_line_speed = bp->link_params.req_line_speed[cfx_idx]; if ((bp->flags & 512U) == 0U) { bnx2x_set_requested_fc(bp); bnx2x_acquire_phy_lock(bp); if (load_mode == 2) { lp = & bp->link_params; lp->loopback_mode = 3U; if ((unsigned int )lp->req_line_speed[cfx_idx] <= 9999U) { if ((lp->speed_cap_mask[cfx_idx] & 4194304U) != 0U) { lp->req_line_speed[cfx_idx] = 10000U; } else { lp->req_line_speed[cfx_idx] = 1000U; } } else { } } else { } if (load_mode == 3) { lp___0 = & bp->link_params; lp___0->loopback_mode = 5U; } else { } rc = bnx2x_phy_init(& bp->link_params, & bp->link_vars); bnx2x_release_phy_lock(bp); bnx2x_calc_fc_adv(bp); if ((unsigned int )bp->link_vars.link_up != 0U) { bnx2x_stats_handle(bp, 1); bnx2x_link_report(bp); } else { } queue_delayed_work(bnx2x_wq, & bp->period_task, 0UL); bp->link_params.req_line_speed[cfx_idx] = req_line_speed; return (rc); } else { } printk("\vbnx2x: [%s:%d(%s)]Bootcode is missing - can not initialize link\n", "bnx2x_initial_phy_init", 2374, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); return (-22); } } void bnx2x_link_set(struct bnx2x *bp ) { { if ((bp->flags & 512U) == 0U) { bnx2x_acquire_phy_lock(bp); bnx2x_phy_init(& bp->link_params, & bp->link_vars); bnx2x_release_phy_lock(bp); bnx2x_calc_fc_adv(bp); } else { printk("\vbnx2x: [%s:%d(%s)]Bootcode is missing - can not set link\n", "bnx2x_link_set", 2387, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } return; } } static void bnx2x__link_reset(struct bnx2x *bp ) { { if ((bp->flags & 512U) == 0U) { bnx2x_acquire_phy_lock(bp); bnx2x_lfa_reset(& bp->link_params, & bp->link_vars); bnx2x_release_phy_lock(bp); } else { printk("\vbnx2x: [%s:%d(%s)]Bootcode is missing - can not reset link\n", "bnx2x__link_reset", 2397, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } return; } } void bnx2x_force_link_reset(struct bnx2x *bp ) { { bnx2x_acquire_phy_lock(bp); bnx2x_link_reset(& bp->link_params, & bp->link_vars, 1); bnx2x_release_phy_lock(bp); return; } } u8 bnx2x_link_test(struct bnx2x *bp , u8 is_serdes ) { u8 rc ; int tmp ; { rc = 0U; if ((bp->flags & 512U) == 0U) { bnx2x_acquire_phy_lock(bp); tmp = bnx2x_test_link(& bp->link_params, & bp->link_vars, (int )is_serdes); rc = (u8 )tmp; bnx2x_release_phy_lock(bp); } else { printk("\vbnx2x: [%s:%d(%s)]Bootcode is missing - can not test link\n", "bnx2x_link_test", 2417, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } return (rc); } } static void bnx2x_calc_vn_min(struct bnx2x *bp , struct cmng_init_input *input ) { int all_zero ; int vn ; u32 vn_cfg ; u32 vn_min_rate ; long tmp ; long tmp___0 ; { all_zero = 1; vn = 0; goto ldv_56243; ldv_56242: vn_cfg = bp->mf_config[vn]; vn_min_rate = ((vn_cfg & 16711680U) >> 16) * 100U; if ((int )vn_cfg & 1) { vn_min_rate = 0U; } else if (vn_min_rate == 0U) { vn_min_rate = 100U; } else { all_zero = 0; } input->vnic_min_rate[vn] = (u16 )vn_min_rate; vn = vn + 1; ldv_56243: ; if (((unsigned int )bp->common.chip_port_mode == 0U ? 2 : 4) > vn) { goto ldv_56242; } else { } if ((unsigned int )bp->dcb_state == 1U && bp->dcbx_port_params.ets.enabled != 0U) { input->flags.cmng_enables = input->flags.cmng_enables & 4294967294U; tmp = ldv__builtin_expect((bp->msg_enable & 32) != 0, 0L); if (tmp != 0L) { printk("\rbnx2x: [%s:%d(%s)]Fairness will be disabled due to ETS\n", "bnx2x_calc_vn_min", 2459, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } } else if (all_zero != 0) { input->flags.cmng_enables = input->flags.cmng_enables & 4294967294U; tmp___0 = ldv__builtin_expect((bp->msg_enable & 32) != 0, 0L); if (tmp___0 != 0L) { printk("\rbnx2x: [%s:%d(%s)]All MIN values are zeroes fairness will be disabled\n", "bnx2x_calc_vn_min", 2464, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } } else { input->flags.cmng_enables = input->flags.cmng_enables | 1U; } return; } } static void bnx2x_calc_vn_max(struct bnx2x *bp , int vn , struct cmng_init_input *input ) { u16 vn_max_rate ; u32 vn_cfg ; u32 maxCfg ; u16 tmp ; long tmp___0 ; { vn_cfg = bp->mf_config[vn]; if ((int )vn_cfg & 1) { vn_max_rate = 0U; } else { tmp = bnx2x_extract_max_cfg(bp, vn_cfg); maxCfg = (u32 )tmp; if ((unsigned int )bp->mf_mode == 2U) { vn_max_rate = (u16 )(((u32 )bp->link_vars.line_speed * maxCfg) / 100U); } else { vn_max_rate = (unsigned int )((u16 )maxCfg) * 100U; } } tmp___0 = ldv__builtin_expect((bp->msg_enable & 32) != 0, 0L); if (tmp___0 != 0L) { printk("\rbnx2x: [%s:%d(%s)]vn %d: vn_max_rate %d\n", "bnx2x_calc_vn_max", 2489, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", vn, (int )vn_max_rate); } else { } input->vnic_max_rate[vn] = vn_max_rate; return; } } static int bnx2x_get_cmng_fns_mode(struct bnx2x *bp ) { { if ((bp->common.chip_id & 61440U) > 20480U) { return (0); } else { } if ((unsigned int )bp->mf_mode != 0U) { return (1); } else { } return (0); } } void bnx2x_read_mf_cfg(struct bnx2x *bp ) { int vn ; int n ; int func ; long tmp ; long tmp___0 ; { n = (unsigned int )bp->common.chip_port_mode == 0U ? 2 : 1; if ((bp->flags & 512U) != 0U) { return; } else { } vn = 0; goto ldv_56266; ldv_56265: func = (vn * 2 + ((int )bp->pfid & 1)) * n + (bp->common.chip_id >> 16 != 5710U && (bp->common.chip_id >> 16 != 5711U && bp->common.chip_id >> 16 != 5712U) ? (int )bp->pf_num & 1 : 0); if (func > 7) { goto ldv_56264; } else { } bp->mf_config[vn] = readl((void const volatile *)(bp->regview + (((unsigned long )bp->common.mf_cfg_base + (unsigned long )func * 24UL) + 36UL))); vn = vn + 1; ldv_56266: ; if (((unsigned int )bp->common.chip_port_mode == 0U ? 2 : 4) > vn) { goto ldv_56265; } else { } ldv_56264: ; if ((bp->mf_config[(int )bp->pfid >> 1] & 8U) != 0U) { tmp = ldv__builtin_expect((bp->msg_enable & 32) != 0, 0L); if (tmp != 0L) { printk("\rbnx2x: [%s:%d(%s)]mf_cfg function disabled\n", "bnx2x_read_mf_cfg", 2533, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } bp->flags = bp->flags | 2048U; } else { tmp___0 = ldv__builtin_expect((bp->msg_enable & 32) != 0, 0L); if (tmp___0 != 0L) { printk("\rbnx2x: [%s:%d(%s)]mf_cfg function enabled\n", "bnx2x_read_mf_cfg", 2536, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } bp->flags = bp->flags & 4294965247U; } return; } } static void bnx2x_cmng_fns_init(struct bnx2x *bp , u8 read_cfg , u8 cmng_type ) { struct cmng_init_input input ; int vn ; long tmp ; { memset((void *)(& input), 0, 44UL); input.port_rate = (u32 )bp->link_vars.line_speed; if ((unsigned int )cmng_type == 1U) { if ((unsigned int )read_cfg != 0U) { bnx2x_read_mf_cfg(bp); } else { } bnx2x_calc_vn_min(bp, & input); if (bp->port.pmf != 0U) { vn = 0; goto ldv_56276; ldv_56275: bnx2x_calc_vn_max(bp, vn, & input); vn = vn + 1; ldv_56276: ; if (((unsigned int )bp->common.chip_port_mode == 0U ? 2 : 4) > vn) { goto ldv_56275; } else { } } else { } input.flags.cmng_enables = input.flags.cmng_enables | 2U; bnx2x_init_cmng((struct cmng_init_input const *)(& input), & bp->cmng); return; } else { } tmp = ldv__builtin_expect((bp->msg_enable & 32) != 0, 0L); if (tmp != 0L) { printk("\rbnx2x: [%s:%d(%s)]rate shaping and fairness are disabled\n", "bnx2x_cmng_fns_init", 2573, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } return; } } static void storm_memset_cmng(struct bnx2x *bp , struct cmng_init *cmng , u8 port ) { int vn ; size_t size ; u32 addr ; int func ; int tmp ; { size = 72UL; addr = ((unsigned int )(bp->iro_arr + 43UL)->base + (unsigned int )((int )port * (int )(bp->iro_arr + 43UL)->m1)) + 4325376U; __storm_memset_struct(bp, addr, size, (u32 *)(& cmng->port)); vn = 0; goto ldv_56289; ldv_56288: tmp = func_by_vn(bp, vn); func = tmp; addr = ((unsigned int )(bp->iro_arr + 44UL)->base + (unsigned int )((int )(bp->iro_arr + 44UL)->m1 * func)) + 4325376U; size = 8UL; __storm_memset_struct(bp, addr, size, (u32 *)(& cmng->vnic.vnic_max_rate) + (unsigned long )vn); addr = ((unsigned int )(bp->iro_arr + 45UL)->base + (unsigned int )((int )(bp->iro_arr + 45UL)->m1 * func)) + 4325376U; size = 24UL; __storm_memset_struct(bp, addr, size, (u32 *)(& cmng->vnic.vnic_min_rate) + (unsigned long )vn); vn = vn + 1; ldv_56289: ; if (((unsigned int )bp->common.chip_port_mode == 0U ? 2 : 4) > vn) { goto ldv_56288; } else { } return; } } static void bnx2x_link_attn(struct bnx2x *bp ) { int port ; u32 pause_enabled ; struct host_port_stats *pstats ; int cmng_fns ; int tmp ; long tmp___0 ; { bnx2x_stats_handle(bp, 3); bnx2x_link_update(& bp->link_params, & bp->link_vars); if ((unsigned int )bp->link_vars.link_up != 0U) { if (bp->common.chip_id >> 16 != 5710U && (int )bp->dropless_fc) { port = (int )bp->pfid & 1; pause_enabled = 0U; if (((int )bp->link_vars.flow_ctrl & 256) != 0) { pause_enabled = 1U; } else { } writel(pause_enabled, (void volatile *)bp->regview + (unsigned long )(((unsigned int )(bp->iro_arr + 183UL)->base + (unsigned int )((int )(bp->iro_arr + 183UL)->m1 * port)) + 4194304U)); } else { } if ((unsigned int )bp->link_vars.mac_type != 1U) { pstats = & (bp->slowpath)->port_stats; memset((void *)(& pstats->mac_stx), 0, 304UL); } else { } if ((unsigned int )bp->state == 12288U) { bnx2x_stats_handle(bp, 1); } else { } } else { } if ((unsigned int )bp->link_vars.link_up != 0U && (unsigned int )bp->link_vars.line_speed != 0U) { tmp = bnx2x_get_cmng_fns_mode(bp); cmng_fns = tmp; if (cmng_fns != 0) { bnx2x_cmng_fns_init(bp, 0, (int )((u8 )cmng_fns)); storm_memset_cmng(bp, & bp->cmng, (int )bp->pfid & 1); } else { tmp___0 = ldv__builtin_expect((bp->msg_enable & 32) != 0, 0L); if (tmp___0 != 0L) { printk("\rbnx2x: [%s:%d(%s)]single function mode without fairness\n", "bnx2x_link_attn", 2649, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } } } else { } __bnx2x_link_report(bp); if ((unsigned int )bp->mf_mode != 0U) { bnx2x_link_sync_notify(bp); } else { } return; } } void bnx2x__link_status_update(struct bnx2x *bp ) { { if ((unsigned int )bp->state != 12288U) { return; } else { } if ((bp->flags & 4194304U) == 0U) { bnx2x_dcbx_pmf_update(bp); bnx2x_link_status_update(& bp->link_params, & bp->link_vars); if ((unsigned int )bp->link_vars.link_up != 0U) { bnx2x_stats_handle(bp, 1); } else { bnx2x_stats_handle(bp, 3); } bnx2x_link_report(bp); } else { bp->port.supported[0] = bp->port.supported[0] | 62703U; bp->port.advertising[0] = bp->port.supported[0]; bp->link_params.bp = bp; bp->link_params.port = (unsigned int )bp->pfid & 1U; bp->link_params.req_duplex[0] = 1U; bp->link_params.req_flow_ctrl[0] = 1024U; bp->link_params.req_line_speed[0] = 10000U; bp->link_params.speed_cap_mask[0] = 8323072U; bp->link_params.switch_cfg = 16777216U; bp->link_vars.mac_type = 2U; bp->link_vars.line_speed = 10000U; bp->link_vars.link_status = 21U; bp->link_vars.link_up = 1U; bp->link_vars.duplex = 1U; bp->link_vars.flow_ctrl = 1024U; __bnx2x_link_report(bp); bnx2x_stats_handle(bp, 1); } return; } } static int bnx2x_afex_func_update(struct bnx2x *bp , u16 vifid , u16 vlan_val , u8 allowed_prio ) { struct bnx2x_func_state_params func_params ; struct bnx2x_func_afex_update_params *f_update_params ; int tmp ; { func_params.f_obj = 0; func_params.cmd = 0; func_params.ramrod_flags = 0UL; func_params.params.tx_start.traffic_type_to_priority_cos[0].priority = (unsigned char)0; func_params.params.tx_start.traffic_type_to_priority_cos[0].cos = (unsigned char)0; func_params.params.tx_start.traffic_type_to_priority_cos[0].reserved1 = (unsigned short)0; func_params.params.tx_start.traffic_type_to_priority_cos[1].priority = (unsigned char)0; func_params.params.tx_start.traffic_type_to_priority_cos[1].cos = (unsigned char)0; func_params.params.tx_start.traffic_type_to_priority_cos[1].reserved1 = (unsigned short)0; func_params.params.tx_start.traffic_type_to_priority_cos[2].priority = (unsigned char)0; func_params.params.tx_start.traffic_type_to_priority_cos[2].cos = (unsigned char)0; func_params.params.tx_start.traffic_type_to_priority_cos[2].reserved1 = (unsigned short)0; func_params.params.tx_start.traffic_type_to_priority_cos[3].priority = (unsigned char)0; func_params.params.tx_start.traffic_type_to_priority_cos[3].cos = (unsigned char)0; func_params.params.tx_start.traffic_type_to_priority_cos[3].reserved1 = (unsigned short)0; func_params.params.tx_start.traffic_type_to_priority_cos[4].priority = (unsigned char)0; func_params.params.tx_start.traffic_type_to_priority_cos[4].cos = (unsigned char)0; func_params.params.tx_start.traffic_type_to_priority_cos[4].reserved1 = (unsigned short)0; func_params.params.tx_start.traffic_type_to_priority_cos[5].priority = (unsigned char)0; func_params.params.tx_start.traffic_type_to_priority_cos[5].cos = (unsigned char)0; func_params.params.tx_start.traffic_type_to_priority_cos[5].reserved1 = (unsigned short)0; func_params.params.tx_start.traffic_type_to_priority_cos[6].priority = (unsigned char)0; func_params.params.tx_start.traffic_type_to_priority_cos[6].cos = (unsigned char)0; func_params.params.tx_start.traffic_type_to_priority_cos[6].reserved1 = (unsigned short)0; func_params.params.tx_start.traffic_type_to_priority_cos[7].priority = (unsigned char)0; func_params.params.tx_start.traffic_type_to_priority_cos[7].cos = (unsigned char)0; func_params.params.tx_start.traffic_type_to_priority_cos[7].reserved1 = (unsigned short)0; func_params.params.tx_start.dcb_enabled = (unsigned char)0; func_params.params.tx_start.dcb_version = (unsigned char)0; func_params.params.tx_start.dont_add_pri_0_en = (unsigned char)0; f_update_params = & func_params.params.afex_update; func_params.f_obj = & bp->func_obj; func_params.cmd = 4; f_update_params->vif_id = vifid; f_update_params->afex_default_vlan = vlan_val; f_update_params->allowed_priorities = allowed_prio; tmp = bnx2x_func_state_change(bp, & func_params); if (tmp < 0) { bnx2x_fw_command(bp, 3556769792U, 0U); } else { } return (0); } } static int bnx2x_afex_handle_vif_list_cmd(struct bnx2x *bp , u8 cmd_type , u16 vif_index , u8 func_bit_map ) { struct bnx2x_func_state_params func_params ; struct bnx2x_func_afex_viflists_params *update_params ; int rc ; u32 drv_msg_code ; { func_params.f_obj = 0; func_params.cmd = 0; func_params.ramrod_flags = 0UL; func_params.params.tx_start.traffic_type_to_priority_cos[0].priority = (unsigned char)0; func_params.params.tx_start.traffic_type_to_priority_cos[0].cos = (unsigned char)0; func_params.params.tx_start.traffic_type_to_priority_cos[0].reserved1 = (unsigned short)0; func_params.params.tx_start.traffic_type_to_priority_cos[1].priority = (unsigned char)0; func_params.params.tx_start.traffic_type_to_priority_cos[1].cos = (unsigned char)0; func_params.params.tx_start.traffic_type_to_priority_cos[1].reserved1 = (unsigned short)0; func_params.params.tx_start.traffic_type_to_priority_cos[2].priority = (unsigned char)0; func_params.params.tx_start.traffic_type_to_priority_cos[2].cos = (unsigned char)0; func_params.params.tx_start.traffic_type_to_priority_cos[2].reserved1 = (unsigned short)0; func_params.params.tx_start.traffic_type_to_priority_cos[3].priority = (unsigned char)0; func_params.params.tx_start.traffic_type_to_priority_cos[3].cos = (unsigned char)0; func_params.params.tx_start.traffic_type_to_priority_cos[3].reserved1 = (unsigned short)0; func_params.params.tx_start.traffic_type_to_priority_cos[4].priority = (unsigned char)0; func_params.params.tx_start.traffic_type_to_priority_cos[4].cos = (unsigned char)0; func_params.params.tx_start.traffic_type_to_priority_cos[4].reserved1 = (unsigned short)0; func_params.params.tx_start.traffic_type_to_priority_cos[5].priority = (unsigned char)0; func_params.params.tx_start.traffic_type_to_priority_cos[5].cos = (unsigned char)0; func_params.params.tx_start.traffic_type_to_priority_cos[5].reserved1 = (unsigned short)0; func_params.params.tx_start.traffic_type_to_priority_cos[6].priority = (unsigned char)0; func_params.params.tx_start.traffic_type_to_priority_cos[6].cos = (unsigned char)0; func_params.params.tx_start.traffic_type_to_priority_cos[6].reserved1 = (unsigned short)0; func_params.params.tx_start.traffic_type_to_priority_cos[7].priority = (unsigned char)0; func_params.params.tx_start.traffic_type_to_priority_cos[7].cos = (unsigned char)0; func_params.params.tx_start.traffic_type_to_priority_cos[7].reserved1 = (unsigned short)0; func_params.params.tx_start.dcb_enabled = (unsigned char)0; func_params.params.tx_start.dcb_version = (unsigned char)0; func_params.params.tx_start.dont_add_pri_0_en = (unsigned char)0; update_params = & func_params.params.afex_viflists; if ((unsigned int )cmd_type != 1U && (unsigned int )cmd_type != 0U) { printk("\vbnx2x: [%s:%d(%s)]BUG! afex_handle_vif_list_cmd invalid type 0x%x\n", "bnx2x_afex_handle_vif_list_cmd", 2746, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )cmd_type); } else { } func_params.f_obj = & bp->func_obj; func_params.cmd = 5; update_params->afex_vif_list_command = cmd_type; update_params->vif_list_index = vif_index; update_params->func_bit_map = (unsigned int )cmd_type != 1U ? func_bit_map : 0U; update_params->func_to_clear = 0U; drv_msg_code = (unsigned int )cmd_type == 1U ? 3506438144U : 3523215360U; rc = bnx2x_func_state_change(bp, & func_params); if (rc < 0) { bnx2x_fw_command(bp, drv_msg_code, 0U); } else { } return (0); } } static void bnx2x_handle_afex_cmd(struct bnx2x *bp , u32 cmd ) { struct afex_stats afex_stats ; u32 func ; u32 mf_config ; u16 vlan_val ; u32 vlan_prio ; u16 vif_id ; u8 allowed_prio ; u8 vlan_mode ; u32 addr_to_write ; u32 vifid ; u32 addrs ; u32 stats_type ; u32 i ; long tmp ; long tmp___0 ; long tmp___1 ; long tmp___2 ; struct cmng_init_input cmng_input ; struct rate_shaping_vars_per_vn m_rs_vn ; size_t size ; u32 addr ; unsigned int tmp___3 ; unsigned int tmp___4 ; unsigned int tmp___5 ; unsigned int tmp___6 ; int tmp___7 ; { func = (u32 )bp->pf_num; if ((cmd & 1048576U) != 0U) { vifid = readl((void const volatile *)(bp->regview + ((unsigned long )bp->common.shmem2_base + ((unsigned long )(((int )bp->pfid & 1) + ((int )bp->pfid >> 1) * ((bp->common.chip_id >> 16 == 5710U || (bp->common.chip_id >> 16 == 5711U || bp->common.chip_id >> 16 == 5712U)) || (unsigned int )bp->common.chip_port_mode == 0U ? 2 : 1)) + 34UL) * 4UL))); tmp = ldv__builtin_expect((bp->msg_enable & 65536) != 0, 0L); if (tmp != 0L) { printk("\rbnx2x: [%s:%d(%s)]afex: got MCP req LISTGET_REQ for vifid 0x%x\n", "bnx2x_handle_afex_cmd", 2787, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", vifid); } else { } bnx2x_afex_handle_vif_list_cmd(bp, 1, (int )((u16 )vifid), 0); } else { } if ((cmd & 2097152U) != 0U) { vifid = readl((void const volatile *)(bp->regview + ((unsigned long )bp->common.shmem2_base + ((unsigned long )(((int )bp->pfid & 1) + ((int )bp->pfid >> 1) * ((bp->common.chip_id >> 16 == 5710U || (bp->common.chip_id >> 16 == 5711U || bp->common.chip_id >> 16 == 5712U)) || (unsigned int )bp->common.chip_port_mode == 0U ? 2 : 1)) + 34UL) * 4UL))); addrs = readl((void const volatile *)(bp->regview + ((unsigned long )bp->common.shmem2_base + ((unsigned long )(((int )bp->pfid & 1) + ((int )bp->pfid >> 1) * ((bp->common.chip_id >> 16 == 5710U || (bp->common.chip_id >> 16 == 5711U || bp->common.chip_id >> 16 == 5712U)) || (unsigned int )bp->common.chip_port_mode == 0U ? 2 : 1)) + 38UL) * 4UL))); tmp___0 = ldv__builtin_expect((bp->msg_enable & 65536) != 0, 0L); if (tmp___0 != 0L) { printk("\rbnx2x: [%s:%d(%s)]afex: got MCP req LISTSET_REQ for vifid 0x%x addrs 0x%x\n", "bnx2x_handle_afex_cmd", 2796, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", vifid, addrs); } else { } bnx2x_afex_handle_vif_list_cmd(bp, 0, (int )((u16 )vifid), (int )((u8 )addrs)); } else { } if ((cmd & 4194304U) != 0U) { addr_to_write = readl((void const volatile *)(bp->regview + ((unsigned long )bp->common.shmem2_base + ((unsigned long )(((int )bp->pfid & 1) + ((int )bp->pfid >> 1) * ((bp->common.chip_id >> 16 == 5710U || (bp->common.chip_id >> 16 == 5711U || bp->common.chip_id >> 16 == 5712U)) || (unsigned int )bp->common.chip_port_mode == 0U ? 2 : 1)) + 30UL) * 4UL))); stats_type = readl((void const volatile *)(bp->regview + ((unsigned long )bp->common.shmem2_base + ((unsigned long )(((int )bp->pfid & 1) + ((int )bp->pfid >> 1) * ((bp->common.chip_id >> 16 == 5710U || (bp->common.chip_id >> 16 == 5711U || bp->common.chip_id >> 16 == 5712U)) || (unsigned int )bp->common.chip_port_mode == 0U ? 2 : 1)) + 34UL) * 4UL))); tmp___1 = ldv__builtin_expect((bp->msg_enable & 65536) != 0, 0L); if (tmp___1 != 0L) { printk("\rbnx2x: [%s:%d(%s)]afex: got MCP req STATSGET_REQ, write to addr 0x%x\n", "bnx2x_handle_afex_cmd", 2809, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", addr_to_write); } else { } bnx2x_afex_collect_stats(bp, (void *)(& afex_stats), stats_type); i = 0U; goto ldv_56340; ldv_56339: writel(*((u32 *)(& afex_stats) + (unsigned long )i), (void volatile *)(bp->regview + ((unsigned long )addr_to_write + (unsigned long )i * 4UL))); i = i + 1U; ldv_56340: ; if (i <= 31U) { goto ldv_56339; } else { } bnx2x_fw_command(bp, 3539992576U, 0U); } else { } if ((cmd & 8388608U) != 0U) { mf_config = readl((void const volatile *)(bp->regview + (((unsigned long )bp->common.mf_cfg_base + (unsigned long )func * 24UL) + 36UL))); bp->mf_config[(int )bp->pfid >> 1] = mf_config; tmp___2 = ldv__builtin_expect((bp->msg_enable & 65536) != 0, 0L); if (tmp___2 != 0L) { printk("\rbnx2x: [%s:%d(%s)]afex: got MCP req VIFSET_REQ, mf_config 0x%x\n", "bnx2x_handle_afex_cmd", 2827, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", mf_config); } else { } if ((mf_config & 8U) == 0U) { size = 8UL; addr = ((unsigned int )(bp->iro_arr + 44UL)->base + (unsigned int )((int )bp->pfid * (int )(bp->iro_arr + 44UL)->m1)) + 4325376U; bp->mf_config[(int )bp->pfid >> 1] = mf_config; bnx2x_calc_vn_max(bp, (int )bp->pfid >> 1, & cmng_input); m_rs_vn.vn_counter.rate = cmng_input.vnic_max_rate[(int )bp->pfid >> 1]; m_rs_vn.vn_counter.quota = (u32 )(((int )m_rs_vn.vn_counter.rate * 400) / 8); __storm_memset_struct(bp, addr, size, (u32 *)(& m_rs_vn)); tmp___3 = readl((void const volatile *)(bp->regview + (((unsigned long )bp->common.mf_cfg_base + (unsigned long )func * 24UL) + 48UL))); vif_id = (u16 )tmp___3; tmp___4 = readl((void const volatile *)(bp->regview + (((unsigned long )bp->common.mf_cfg_base + (unsigned long )func * 24UL) + 48UL))); vlan_val = (u16 )((tmp___4 & 268369920U) >> 16); vlan_prio = (mf_config & 768U) >> 8; vlan_val = ((int )((u16 )vlan_prio) << 13U) | (int )vlan_val; tmp___5 = readl((void const volatile *)(bp->regview + (((unsigned long )bp->common.mf_cfg_base + (unsigned long )func * 24UL) + 52UL))); vlan_mode = (u8 )((tmp___5 & 983040U) >> 16); tmp___6 = readl((void const volatile *)(bp->regview + (((unsigned long )bp->common.mf_cfg_base + (unsigned long )func * 24UL) + 52UL))); allowed_prio = (u8 )tmp___6; tmp___7 = bnx2x_afex_func_update(bp, (int )vif_id, (int )vlan_val, (int )allowed_prio); if (tmp___7 != 0) { return; } else { } bp->afex_def_vlan_tag = (int )vlan_val; bp->afex_vlan_mode = (enum mf_cfg_afex_vlan_mode )vlan_mode; } else { bnx2x_link_report(bp); bnx2x_afex_func_update(bp, 65535, 0, 0); bp->afex_def_vlan_tag = -1; } } else { } return; } } static void bnx2x_pmf_update(struct bnx2x *bp ) { int port ; u32 val ; long tmp ; { port = (int )bp->pfid & 1; bp->port.pmf = 1U; tmp = ldv__builtin_expect((bp->msg_enable & 65536) != 0, 0L); if (tmp != 0L) { printk("\rbnx2x: [%s:%d(%s)]pmf %d\n", "bnx2x_pmf_update", 2899, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", bp->port.pmf); } else { } __asm__ volatile ("mfence": : : "memory"); queue_delayed_work(bnx2x_wq, & bp->period_task, 0UL); bnx2x_dcbx_pmf_update(bp); val = (u32 )((1 << (((int )bp->pfid >> 1) + 4)) | 65295); if ((unsigned int )bp->common.int_block == 0U) { writel(val, (void volatile *)bp->regview + (unsigned long )(port * 8 + 1081412)); writel(val, (void volatile *)bp->regview + (unsigned long )((port + 135176) * 8)); } else if (bp->common.chip_id >> 16 != 5710U && (bp->common.chip_id >> 16 != 5711U && bp->common.chip_id >> 16 != 5712U)) { writel(val, (void volatile *)bp->regview + 1245444U); writel(val, (void volatile *)bp->regview + 1245492U); } else { } bnx2x_stats_handle(bp, 0); return; } } u32 bnx2x_fw_command(struct bnx2x *bp , u32 command , u32 param ) { int mb_idx ; u32 seq ; u32 rc ; u32 cnt ; u8 delay ; long tmp ; u32 tmp___0 ; long tmp___1 ; { mb_idx = ((int )bp->pfid & 1) + ((int )bp->pfid >> 1) * ((bp->common.chip_id >> 16 == 5710U || (bp->common.chip_id >> 16 == 5711U || bp->common.chip_id >> 16 == 5712U)) || (unsigned int )bp->common.chip_port_mode == 0U ? 2 : 1); rc = 0U; cnt = 1U; delay = (bp->common.chip_id & 61440U) > 20480U ? 100U : 10U; ldv_mutex_lock_9(& bp->fw_mb_mutex); bp->fw_seq = (u16 )((int )bp->fw_seq + 1); seq = (u32 )bp->fw_seq; writel(param, (void volatile *)(bp->regview + (((unsigned long )bp->common.shmem_base + (unsigned long )mb_idx * 44UL) + 1672UL))); writel(command | seq, (void volatile *)(bp->regview + (((unsigned long )bp->common.shmem_base + (unsigned long )mb_idx * 44UL) + 1668UL))); tmp = ldv__builtin_expect((bp->msg_enable & 65536) != 0, 0L); if (tmp != 0L) { printk("\rbnx2x: [%s:%d(%s)]wrote command (%x) to FW MB param 0x%08x\n", "bnx2x_fw_command", 2948, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", command | seq, param); } else { } ldv_56363: msleep((unsigned int )delay); rc = readl((void const volatile *)(bp->regview + (((unsigned long )bp->common.shmem_base + (unsigned long )mb_idx * 44UL) + 1676UL))); if ((rc & 65535U) != seq) { tmp___0 = cnt; cnt = cnt + 1U; if (tmp___0 <= 499U) { goto ldv_56363; } else { goto ldv_56364; } } else { } ldv_56364: tmp___1 = ldv__builtin_expect((bp->msg_enable & 65536) != 0, 0L); if (tmp___1 != 0L) { printk("\rbnx2x: [%s:%d(%s)][after %d ms] read (%x) seq is (%x) from FW MB\n", "bnx2x_fw_command", 2960, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (u32 )delay * cnt, rc, seq); } else { } if ((rc & 65535U) == seq) { rc = rc & 4294901760U; } else { printk("\vbnx2x: [%s:%d(%s)]FW failed to respond!\n", "bnx2x_fw_command", 2967, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); bnx2x_fw_dump(bp); rc = 0U; } ldv_mutex_unlock_10(& bp->fw_mb_mutex); return (rc); } } static void storm_memset_func_cfg(struct bnx2x *bp , struct tstorm_eth_function_common_config *tcfg , u16 abs_fid ) { size_t size ; u32 addr ; { size = 8UL; addr = ((unsigned int )(bp->iro_arr + 201UL)->base + (unsigned int )((int )abs_fid * (int )(bp->iro_arr + 201UL)->m1)) + 4390912U; __storm_memset_struct(bp, addr, size, (u32 *)tcfg); return; } } void bnx2x_func_init(struct bnx2x *bp , struct bnx2x_func_init_params *p ) { struct tstorm_eth_function_common_config tcfg ; { if (bp->common.chip_id >> 16 == 5710U || (bp->common.chip_id >> 16 == 5711U || bp->common.chip_id >> 16 == 5712U)) { tcfg.config_flags = 0U; tcfg.rss_result_mask = (unsigned char)0; tcfg.reserved1 = (unsigned char)0; tcfg.vlan_id[0] = (unsigned short)0; tcfg.vlan_id[1] = (unsigned short)0; storm_memset_func_cfg(bp, & tcfg, (int )p->func_id); } else { } storm_memset_vf_to_pf(bp, (int )p->func_id, (int )p->pf_id); storm_memset_func_en(bp, (int )p->func_id, 1); if (((int )p->func_flgs & 16) != 0) { storm_memset_spq_addr(bp, p->spq_map, (int )p->func_id); writel((unsigned int )p->spq_prod, (void volatile *)bp->regview + (unsigned long )(((unsigned int )(bp->iro_arr + 31UL)->base + (unsigned int )((int )p->func_id * (int )(bp->iro_arr + 31UL)->m1)) + 2752512U)); } else { } return; } } static unsigned long bnx2x_get_common_flags(struct bnx2x *bp , struct bnx2x_fastpath *fp , bool zero_stats ) { unsigned long flags ; { flags = 0UL; __set_bit(5, (unsigned long volatile *)(& flags)); __set_bit(3, (unsigned long volatile *)(& flags)); if ((int )zero_stats) { __set_bit(4, (unsigned long volatile *)(& flags)); } else { } __set_bit(21, (unsigned long volatile *)(& flags)); __set_bit(22, (unsigned long volatile *)(& flags)); return (flags); } } static unsigned long bnx2x_get_q_flags(struct bnx2x *bp , struct bnx2x_fastpath *fp , bool leading ) { unsigned long flags ; unsigned long tmp ; { flags = 0UL; if ((unsigned int )bp->mf_mode == 1U) { __set_bit(6, (unsigned long volatile *)(& flags)); } else { } if ((uint )fp->index == (uint )(fp->bp)->num_queues - (fp->bp)->num_cnic_queues) { __set_bit(12, (unsigned long volatile *)(& flags)); __set_bit(20, (unsigned long volatile *)(& flags)); } else { } if ((unsigned int )fp->disable_tpa == 0U) { __set_bit(0, (unsigned long volatile *)(& flags)); __set_bit(1, (unsigned long volatile *)(& flags)); if ((unsigned int )fp->mode == 1U) { __set_bit(2, (unsigned long volatile *)(& flags)); } else { } } else { } if ((int )leading) { __set_bit(13, (unsigned long volatile *)(& flags)); __set_bit(14, (unsigned long volatile *)(& flags)); } else { } __set_bit(7, (unsigned long volatile *)(& flags)); if ((unsigned int )bp->mf_mode == 3U) { __set_bit(19, (unsigned long volatile *)(& flags)); } else { } tmp = bnx2x_get_common_flags(bp, fp, 1); return (tmp | flags); } } static void bnx2x_pf_q_prep_general(struct bnx2x *bp , struct bnx2x_fastpath *fp , struct bnx2x_general_setup_params *gen_init , u8 cos ) { { gen_init->stat_id = bnx2x_stats_id(fp); gen_init->spcl_id = fp->cl_id; if ((uint )fp->index == (uint )(fp->bp)->num_queues - (fp->bp)->num_cnic_queues) { gen_init->mtu = 2500U; } else { gen_init->mtu = (u16 )(bp->dev)->mtu; } gen_init->cos = cos; return; } } static void bnx2x_pf_rx_q_prep(struct bnx2x *bp , struct bnx2x_fastpath *fp , struct rxq_pause_params *pause , struct bnx2x_rxq_setup_params *rxq_init ) { u8 max_sge ; u16 sge_sz ; u16 tpa_agg_size ; int __ret_warn_on ; long tmp ; u32 __min1 ; u32 __min1___0 ; u32 __min2 ; u32 __min2___0 ; u32 __min1___1 ; u32 __min2___1 ; int __ret_warn_on___0 ; long tmp___0 ; int __ret_warn_on___1 ; long tmp___1 ; int _min1 ; int _min2 ; u64 __max1 ; int _min1___0 ; int _min2___0 ; u64 __max2 ; int _min1___1 ; int _min2___1 ; { max_sge = 0U; sge_sz = 0U; tpa_agg_size = 0U; if ((unsigned int )fp->disable_tpa == 0U) { pause->sge_th_lo = ((bp->common.chip_id >> 16 == 5710U ? 32U : 64U) + (unsigned int )((u16 )(((((((((((bp->common.chip_id >> 16 == 5770U || bp->common.chip_id >> 16 == 5797U) || bp->common.chip_id >> 16 == 5801U) || bp->common.chip_id >> 16 == 5774U) || bp->common.chip_id >> 16 == 5806U) || bp->common.chip_id >> 16 == 5807U) || ((bp->common.chip_id >> 16 == 5693U || bp->common.chip_id >> 16 == 5694U) || bp->common.chip_id >> 16 == 5695U)) || ((bp->common.chip_id >> 16 == 5793U || bp->common.chip_id >> 16 == 5794U) || bp->common.chip_id >> 16 == 5773U)) || (bp->common.chip_id >> 16 == 5796U || bp->common.chip_id >> 16 == 5803U)) || bp->common.chip_id >> 16 == 5805U ? 1024 : 512) - (bp->common.chip_id >> 16 == 5710U ? 32 : 64)) / 2))) + (unsigned int )((u16 )(((unsigned long )((bp->common.chip_id >> 16 == 5710U ? 32 : 64) + ((((((((((bp->common.chip_id >> 16 == 5770U || bp->common.chip_id >> 16 == 5797U) || bp->common.chip_id >> 16 == 5801U) || bp->common.chip_id >> 16 == 5774U) || bp->common.chip_id >> 16 == 5806U) || bp->common.chip_id >> 16 == 5807U) || ((bp->common.chip_id >> 16 == 5693U || bp->common.chip_id >> 16 == 5694U) || bp->common.chip_id >> 16 == 5695U)) || ((bp->common.chip_id >> 16 == 5793U || bp->common.chip_id >> 16 == 5794U) || bp->common.chip_id >> 16 == 5773U)) || (bp->common.chip_id >> 16 == 5796U || bp->common.chip_id >> 16 == 5803U)) || bp->common.chip_id >> 16 == 5805U ? 1024 : 512) - (bp->common.chip_id >> 16 == 5710U ? 32 : 64)) / 2) + 509UL) / 510UL)) * 2U; pause->sge_th_hi = (((bp->common.chip_id >> 16 == 5710U ? 32U : 64U) + (unsigned int )((u16 )(((((((((((bp->common.chip_id >> 16 == 5770U || bp->common.chip_id >> 16 == 5797U) || bp->common.chip_id >> 16 == 5801U) || bp->common.chip_id >> 16 == 5774U) || bp->common.chip_id >> 16 == 5806U) || bp->common.chip_id >> 16 == 5807U) || ((bp->common.chip_id >> 16 == 5693U || bp->common.chip_id >> 16 == 5694U) || bp->common.chip_id >> 16 == 5695U)) || ((bp->common.chip_id >> 16 == 5793U || bp->common.chip_id >> 16 == 5794U) || bp->common.chip_id >> 16 == 5773U)) || (bp->common.chip_id >> 16 == 5796U || bp->common.chip_id >> 16 == 5803U)) || bp->common.chip_id >> 16 == 5805U ? 1024 : 512) - (bp->common.chip_id >> 16 == 5710U ? 32 : 64)) / 2))) + (unsigned int )((u16 )(((unsigned long )((bp->common.chip_id >> 16 == 5710U ? 32 : 64) + ((((((((((bp->common.chip_id >> 16 == 5770U || bp->common.chip_id >> 16 == 5797U) || bp->common.chip_id >> 16 == 5801U) || bp->common.chip_id >> 16 == 5774U) || bp->common.chip_id >> 16 == 5806U) || bp->common.chip_id >> 16 == 5807U) || ((bp->common.chip_id >> 16 == 5693U || bp->common.chip_id >> 16 == 5694U) || bp->common.chip_id >> 16 == 5695U)) || ((bp->common.chip_id >> 16 == 5793U || bp->common.chip_id >> 16 == 5794U) || bp->common.chip_id >> 16 == 5773U)) || (bp->common.chip_id >> 16 == 5796U || bp->common.chip_id >> 16 == 5803U)) || bp->common.chip_id >> 16 == 5805U ? 1024 : 512) - (bp->common.chip_id >> 16 == 5710U ? 32 : 64)) / 2) + 509UL) / 510UL)) * 2U) + 100U; __ret_warn_on = (int )bp->dropless_fc && (unsigned int )((int )pause->sge_th_hi + 16) > 1020U; tmp = ldv__builtin_expect(__ret_warn_on != 0, 0L); if (tmp != 0L) { warn_slowpath_null("/work/ldvuser/exper_fp/work/current--X--drivers--X--defaultlinux-3.10-rc1.tar--X--32_7a--X--cpachecker/linux-3.10-rc1.tar/csd_deg_dscv/8504/dscv_tempdir/dscv/ri/32_7a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c.prepared", 3116); } else { } ldv__builtin_expect(__ret_warn_on != 0, 0L); __min1___0 = 8U; __min2 = 17U; __min1 = (__min1___0 < __min2 ? __min1___0 : __min2) * 4096U; __min2___0 = 65535U; tpa_agg_size = (u16 )(__min1 < __min2___0 ? __min1 : __min2___0); max_sge = (u8 )(((unsigned long )(bp->dev)->mtu + 4095UL) >> 12); max_sge = max_sge; __min1___1 = 4096U; __min2___1 = 65535U; sge_sz = (unsigned short )(__min1___1 < __min2___1 ? __min1___1 : __min2___1); } else { } if (bp->common.chip_id >> 16 != 5710U) { pause->bd_th_lo = ((((((((((bp->common.chip_id >> 16 == 5770U || bp->common.chip_id >> 16 == 5797U) || bp->common.chip_id >> 16 == 5801U) || bp->common.chip_id >> 16 == 5774U) || bp->common.chip_id >> 16 == 5806U) || bp->common.chip_id >> 16 == 5807U) || ((bp->common.chip_id >> 16 == 5693U || bp->common.chip_id >> 16 == 5694U) || bp->common.chip_id >> 16 == 5695U)) || ((bp->common.chip_id >> 16 == 5793U || bp->common.chip_id >> 16 == 5794U) || bp->common.chip_id >> 16 == 5773U)) || (bp->common.chip_id >> 16 == 5796U || bp->common.chip_id >> 16 == 5803U)) || bp->common.chip_id >> 16 == 5805U ? 1024U : 512U) + (((((((((bp->common.chip_id >> 16 == 5770U || bp->common.chip_id >> 16 == 5797U) || bp->common.chip_id >> 16 == 5801U) || bp->common.chip_id >> 16 == 5774U) || bp->common.chip_id >> 16 == 5806U) || bp->common.chip_id >> 16 == 5807U) || ((bp->common.chip_id >> 16 == 5693U || bp->common.chip_id >> 16 == 5694U) || bp->common.chip_id >> 16 == 5695U)) || ((bp->common.chip_id >> 16 == 5793U || bp->common.chip_id >> 16 == 5794U) || bp->common.chip_id >> 16 == 5773U)) || (bp->common.chip_id >> 16 == 5796U || bp->common.chip_id >> 16 == 5803U)) || bp->common.chip_id >> 16 == 5805U ? 6U : 4U)) + (bp->common.chip_id >> 16 == 5710U ? 43U : 75U); pause->bd_th_hi = (((((((((((bp->common.chip_id >> 16 == 5770U || bp->common.chip_id >> 16 == 5797U) || bp->common.chip_id >> 16 == 5801U) || bp->common.chip_id >> 16 == 5774U) || bp->common.chip_id >> 16 == 5806U) || bp->common.chip_id >> 16 == 5807U) || ((bp->common.chip_id >> 16 == 5693U || bp->common.chip_id >> 16 == 5694U) || bp->common.chip_id >> 16 == 5695U)) || ((bp->common.chip_id >> 16 == 5793U || bp->common.chip_id >> 16 == 5794U) || bp->common.chip_id >> 16 == 5773U)) || (bp->common.chip_id >> 16 == 5796U || bp->common.chip_id >> 16 == 5803U)) || bp->common.chip_id >> 16 == 5805U ? 1024U : 512U) + (((((((((bp->common.chip_id >> 16 == 5770U || bp->common.chip_id >> 16 == 5797U) || bp->common.chip_id >> 16 == 5801U) || bp->common.chip_id >> 16 == 5774U) || bp->common.chip_id >> 16 == 5806U) || bp->common.chip_id >> 16 == 5807U) || ((bp->common.chip_id >> 16 == 5693U || bp->common.chip_id >> 16 == 5694U) || bp->common.chip_id >> 16 == 5695U)) || ((bp->common.chip_id >> 16 == 5793U || bp->common.chip_id >> 16 == 5794U) || bp->common.chip_id >> 16 == 5773U)) || (bp->common.chip_id >> 16 == 5796U || bp->common.chip_id >> 16 == 5803U)) || bp->common.chip_id >> 16 == 5805U ? 6U : 4U)) + (bp->common.chip_id >> 16 == 5710U ? 43U : 75U)) + 100U; pause->rcq_th_lo = ((((((((((bp->common.chip_id >> 16 == 5770U || bp->common.chip_id >> 16 == 5797U) || bp->common.chip_id >> 16 == 5801U) || bp->common.chip_id >> 16 == 5774U) || bp->common.chip_id >> 16 == 5806U) || bp->common.chip_id >> 16 == 5807U) || ((bp->common.chip_id >> 16 == 5693U || bp->common.chip_id >> 16 == 5694U) || bp->common.chip_id >> 16 == 5695U)) || ((bp->common.chip_id >> 16 == 5793U || bp->common.chip_id >> 16 == 5794U) || bp->common.chip_id >> 16 == 5773U)) || (bp->common.chip_id >> 16 == 5796U || bp->common.chip_id >> 16 == 5803U)) || bp->common.chip_id >> 16 == 5805U ? 1024U : 512U) + (((((((((bp->common.chip_id >> 16 == 5770U || bp->common.chip_id >> 16 == 5797U) || bp->common.chip_id >> 16 == 5801U) || bp->common.chip_id >> 16 == 5774U) || bp->common.chip_id >> 16 == 5806U) || bp->common.chip_id >> 16 == 5807U) || ((bp->common.chip_id >> 16 == 5693U || bp->common.chip_id >> 16 == 5694U) || bp->common.chip_id >> 16 == 5695U)) || ((bp->common.chip_id >> 16 == 5793U || bp->common.chip_id >> 16 == 5794U) || bp->common.chip_id >> 16 == 5773U)) || (bp->common.chip_id >> 16 == 5796U || bp->common.chip_id >> 16 == 5803U)) || bp->common.chip_id >> 16 == 5805U ? 17U : 9U)) + (bp->common.chip_id >> 16 == 5710U ? 43U : 75U); pause->rcq_th_hi = (((((((((((bp->common.chip_id >> 16 == 5770U || bp->common.chip_id >> 16 == 5797U) || bp->common.chip_id >> 16 == 5801U) || bp->common.chip_id >> 16 == 5774U) || bp->common.chip_id >> 16 == 5806U) || bp->common.chip_id >> 16 == 5807U) || ((bp->common.chip_id >> 16 == 5693U || bp->common.chip_id >> 16 == 5694U) || bp->common.chip_id >> 16 == 5695U)) || ((bp->common.chip_id >> 16 == 5793U || bp->common.chip_id >> 16 == 5794U) || bp->common.chip_id >> 16 == 5773U)) || (bp->common.chip_id >> 16 == 5796U || bp->common.chip_id >> 16 == 5803U)) || bp->common.chip_id >> 16 == 5805U ? 1024U : 512U) + (((((((((bp->common.chip_id >> 16 == 5770U || bp->common.chip_id >> 16 == 5797U) || bp->common.chip_id >> 16 == 5801U) || bp->common.chip_id >> 16 == 5774U) || bp->common.chip_id >> 16 == 5806U) || bp->common.chip_id >> 16 == 5807U) || ((bp->common.chip_id >> 16 == 5693U || bp->common.chip_id >> 16 == 5694U) || bp->common.chip_id >> 16 == 5695U)) || ((bp->common.chip_id >> 16 == 5793U || bp->common.chip_id >> 16 == 5794U) || bp->common.chip_id >> 16 == 5773U)) || (bp->common.chip_id >> 16 == 5796U || bp->common.chip_id >> 16 == 5803U)) || bp->common.chip_id >> 16 == 5805U ? 17U : 9U)) + (bp->common.chip_id >> 16 == 5710U ? 43U : 75U)) + 100U; __ret_warn_on___0 = (int )bp->dropless_fc && (int )pause->bd_th_hi + 16 > bp->rx_ring_size; tmp___0 = ldv__builtin_expect(__ret_warn_on___0 != 0, 0L); if (tmp___0 != 0L) { warn_slowpath_null("/work/ldvuser/exper_fp/work/current--X--drivers--X--defaultlinux-3.10-rc1.tar--X--32_7a--X--cpachecker/linux-3.10-rc1.tar/csd_deg_dscv/8504/dscv_tempdir/dscv/ri/32_7a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c.prepared", 3139); } else { } ldv__builtin_expect(__ret_warn_on___0 != 0, 0L); __ret_warn_on___1 = (int )bp->dropless_fc && (unsigned int )((int )pause->rcq_th_hi + 16) > 4032U; tmp___1 = ldv__builtin_expect(__ret_warn_on___1 != 0, 0L); if (tmp___1 != 0L) { warn_slowpath_null("/work/ldvuser/exper_fp/work/current--X--drivers--X--defaultlinux-3.10-rc1.tar--X--32_7a--X--cpachecker/linux-3.10-rc1.tar/csd_deg_dscv/8504/dscv_tempdir/dscv/ri/32_7a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c.prepared", 3142); } else { } ldv__builtin_expect(__ret_warn_on___1 != 0, 0L); pause->pri_map = 1U; } else { } rxq_init->dscr_map = fp->rx_desc_mapping; rxq_init->sge_map = fp->rx_sge_mapping; rxq_init->rcq_map = fp->rx_comp_mapping; rxq_init->rcq_np_map = fp->rx_comp_mapping + 4096ULL; _min1 = 8; _min2 = 6; _min1___0 = 8; _min2___0 = 6; __max1 = (u64 )(1UL << (_min1___0 < _min2___0 ? _min1___0 : _min2___0)); __max2 = 320ULL; rxq_init->buf_sz = (unsigned int )(((int )((u16 )fp->rx_buf_size) - (int )((u16 )(1UL << (_min1 < _min2 ? _min1 : _min2)))) - (int )((u16 )(__max1 > __max2 ? __max1 : __max2))) - 2U; rxq_init->cl_qzone_id = fp->cl_qzone_id; rxq_init->tpa_agg_sz = tpa_agg_size; rxq_init->sge_buf_sz = sge_sz; rxq_init->max_sges_pkt = max_sge; rxq_init->rss_engine_id = bp->pfid; rxq_init->mcast_engine_id = bp->pfid; rxq_init->max_tpa_queues = bp->common.chip_id >> 16 == 5710U ? 32U : 64U; _min1___1 = 8; _min2___1 = 6; rxq_init->cache_line_log = (u8 )(_min1___1 < _min2___1 ? _min1___1 : _min2___1); rxq_init->fw_sb_id = fp->fw_sb_id; if ((uint )fp->index == (uint )(fp->bp)->num_queues - (fp->bp)->num_cnic_queues) { rxq_init->sb_cq_index = 4U; } else { rxq_init->sb_cq_index = 1U; } if ((unsigned int )bp->mf_mode == 3U) { rxq_init->silent_removal_value = (u16 )bp->afex_def_vlan_tag; rxq_init->silent_removal_mask = 4095U; } else { } return; } } static void bnx2x_pf_tx_q_prep(struct bnx2x *bp , struct bnx2x_fastpath *fp , struct bnx2x_txq_setup_params *txq_init , u8 cos ) { { txq_init->dscr_map = (fp->txdata_ptr[(int )cos])->tx_desc_mapping; txq_init->sb_cq_index = (unsigned int )cos + 5U; txq_init->traffic_type = 0U; txq_init->fw_sb_id = fp->fw_sb_id; txq_init->tss_leading_cl_id = (bp->fp)->cl_id; if ((uint )fp->index == (uint )(fp->bp)->num_queues - (fp->bp)->num_cnic_queues) { txq_init->sb_cq_index = 6U; txq_init->traffic_type = 1U; } else { } return; } } static void bnx2x_pf_init(struct bnx2x *bp ) { struct bnx2x_func_init_params func_init ; struct event_ring_data eq_data ; u16 flags ; int tmp ; { func_init.fw_stat_map = 0ULL; func_init.spq_map = 0ULL; func_init.func_flgs = (unsigned short)0; func_init.func_id = (unsigned short)0; func_init.pf_id = (unsigned short)0; func_init.spq_prod = (unsigned short)0; eq_data.base_addr.lo = 0U; eq_data.base_addr.hi = 0U; eq_data.producer = (unsigned short)0; eq_data.sb_id = (unsigned char)0; eq_data.index_id = (unsigned char)0; eq_data.reserved0 = 0U; if (bp->common.chip_id >> 16 != 5710U && (bp->common.chip_id >> 16 != 5711U && bp->common.chip_id >> 16 != 5712U)) { writel(0U, (void volatile *)bp->regview + (unsigned long )((unsigned int )bp->common.chip_port_mode == 0U ? ((int )bp->pfid + 311872) * 4 : (((int )bp->pfid >> 1) + 311872) * 4)); writel(0U, (void volatile *)bp->regview + (unsigned long )((unsigned int )bp->common.chip_port_mode == 0U ? ((int )bp->pfid + 311876) * 4 : (((int )bp->pfid >> 1) + 311876) * 4)); } else { } flags = 50U; flags = (u16 )(((bp->flags & 256U) != 0U ? 8 : 0) | (int )((short )flags)); func_init.func_flgs = flags; func_init.pf_id = (u16 )bp->pfid; func_init.func_id = (u16 )bp->pfid; func_init.spq_map = bp->spq_mapping; func_init.spq_prod = bp->spq_prod_idx; bnx2x_func_init(bp, & func_init); memset((void *)(& bp->cmng), 0, 72UL); bp->link_vars.line_speed = 10000U; tmp = bnx2x_get_cmng_fns_mode(bp); bnx2x_cmng_fns_init(bp, 1, (int )((u8 )tmp)); if (bp->port.pmf != 0U) { storm_memset_cmng(bp, & bp->cmng, (int )bp->pfid & 1); } else { } eq_data.base_addr.hi = (unsigned int )(bp->eq_mapping >> 32); eq_data.base_addr.lo = (unsigned int )bp->eq_mapping; eq_data.producer = bp->eq_prod; eq_data.index_id = 7U; eq_data.sb_id = 222U; storm_memset_eq_data(bp, & eq_data, (int )bp->pfid); return; } } static void bnx2x_e1h_disable(struct bnx2x *bp ) { int port ; { port = (int )bp->pfid & 1; bnx2x_tx_disable(bp); writel(0U, (void volatile *)bp->regview + (unsigned long )(port * 8 + 90364)); return; } } static void bnx2x_e1h_enable(struct bnx2x *bp ) { int port ; { port = (int )bp->pfid & 1; writel(1U, (void volatile *)bp->regview + (unsigned long )(port * 8 + 90364)); netif_tx_wake_all_queues(bp->dev); return; } } static void bnx2x_drv_info_ether_stat(struct bnx2x *bp ) { struct eth_stats_info *ether_stat ; struct bnx2x_vlan_mac_obj *mac_obj ; int i ; { ether_stat = & (bp->slowpath)->drv_info_to_mcp.ether_stat; mac_obj = & (bp->sp_objs)->mac_obj; strlcpy((char *)(& ether_stat->version), "1.78.17-0", 12UL); i = 0; goto ldv_56458; ldv_56457: memset((void *)(& ether_stat->mac_local) + (unsigned long )i, 0, 1UL); i = i + 1; ldv_56458: ; if (i <= 2) { goto ldv_56457; } else { } (*(mac_obj->get_n_elements))(bp, & (bp->sp_objs)->mac_obj, 3, (u8 *)(& ether_stat->mac_local) + 2UL, 2, 6); ether_stat->mtu_size = (bp->dev)->mtu; if (((bp->dev)->features & 536870912ULL) != 0ULL) { ether_stat->feature_flags = ether_stat->feature_flags | 1U; } else { } if (((bp->dev)->features & 65536ULL) != 0ULL) { ether_stat->feature_flags = ether_stat->feature_flags | 2U; } else { } ether_stat->feature_flags = ether_stat->feature_flags | bp->common.boot_mode; ether_stat->promiscuous_mode = ((bp->dev)->flags & 256U) != 0U; ether_stat->txq_size = (u32 )bp->tx_ring_size; ether_stat->rxq_size = (u32 )bp->rx_ring_size; return; } } static void bnx2x_drv_info_fcoe_stat(struct bnx2x *bp ) { struct bnx2x_dcbx_app_params *app ; struct fcoe_stats_info *fcoe_stat ; size_t __len ; void *__ret ; struct tstorm_per_queue_stats *fcoe_q_tstorm_stats ; struct xstorm_per_queue_stats *fcoe_q_xstorm_stats ; struct fcoe_statistics_params *fw_fcoe_stat ; { app = & bp->dcbx_port_params.app; fcoe_stat = & (bp->slowpath)->drv_info_to_mcp.fcoe_stat; if (! bp->cnic_loaded) { return; } else { } __len = 6UL; if (__len > 63UL) { __ret = __memcpy((void *)(& fcoe_stat->mac_local) + 2U, (void const *)(& bp->fip_mac), __len); } else { __ret = __builtin_memcpy((void *)(& fcoe_stat->mac_local) + 2U, (void const *)(& bp->fip_mac), __len); } fcoe_stat->qos_priority = app->traffic_type_priority[1]; if ((bp->flags & 32768U) == 0U) { fcoe_q_tstorm_stats = & (bp->fw_stats_data)->queue_stats[(uint )bp->num_queues - bp->num_cnic_queues].tstorm_queue_statistics; fcoe_q_xstorm_stats = & (bp->fw_stats_data)->queue_stats[(uint )bp->num_queues - bp->num_cnic_queues].xstorm_queue_statistics; fw_fcoe_stat = & (bp->fw_stats_data)->fcoe; fcoe_stat->rx_bytes_lo = fcoe_stat->rx_bytes_lo + fw_fcoe_stat->rx_stat0.fcoe_rx_byte_cnt; fcoe_stat->rx_bytes_hi = fcoe_stat->rx_bytes_hi + (fcoe_stat->rx_bytes_lo < fw_fcoe_stat->rx_stat0.fcoe_rx_byte_cnt ? 1U : 0U); fcoe_stat->rx_bytes_lo = fcoe_stat->rx_bytes_lo + fcoe_q_tstorm_stats->rcv_ucast_bytes.lo; fcoe_stat->rx_bytes_hi = fcoe_stat->rx_bytes_hi + (fcoe_q_tstorm_stats->rcv_ucast_bytes.hi + (fcoe_stat->rx_bytes_lo < fcoe_q_tstorm_stats->rcv_ucast_bytes.lo ? 1U : 0U)); fcoe_stat->rx_bytes_lo = fcoe_stat->rx_bytes_lo + fcoe_q_tstorm_stats->rcv_bcast_bytes.lo; fcoe_stat->rx_bytes_hi = fcoe_stat->rx_bytes_hi + (fcoe_q_tstorm_stats->rcv_bcast_bytes.hi + (fcoe_stat->rx_bytes_lo < fcoe_q_tstorm_stats->rcv_bcast_bytes.lo ? 1U : 0U)); fcoe_stat->rx_bytes_lo = fcoe_stat->rx_bytes_lo + fcoe_q_tstorm_stats->rcv_mcast_bytes.lo; fcoe_stat->rx_bytes_hi = fcoe_stat->rx_bytes_hi + (fcoe_q_tstorm_stats->rcv_mcast_bytes.hi + (fcoe_stat->rx_bytes_lo < fcoe_q_tstorm_stats->rcv_mcast_bytes.lo ? 1U : 0U)); fcoe_stat->rx_frames_lo = fcoe_stat->rx_frames_lo + fw_fcoe_stat->rx_stat0.fcoe_rx_pkt_cnt; fcoe_stat->rx_frames_hi = fcoe_stat->rx_frames_hi + (fcoe_stat->rx_frames_lo < fw_fcoe_stat->rx_stat0.fcoe_rx_pkt_cnt ? 1U : 0U); fcoe_stat->rx_frames_lo = fcoe_stat->rx_frames_lo + fcoe_q_tstorm_stats->rcv_ucast_pkts; fcoe_stat->rx_frames_hi = fcoe_stat->rx_frames_hi + (fcoe_stat->rx_frames_lo < fcoe_q_tstorm_stats->rcv_ucast_pkts ? 1U : 0U); fcoe_stat->rx_frames_lo = fcoe_stat->rx_frames_lo + fcoe_q_tstorm_stats->rcv_bcast_pkts; fcoe_stat->rx_frames_hi = fcoe_stat->rx_frames_hi + (fcoe_stat->rx_frames_lo < fcoe_q_tstorm_stats->rcv_bcast_pkts ? 1U : 0U); fcoe_stat->rx_frames_lo = fcoe_stat->rx_frames_lo + fcoe_q_tstorm_stats->rcv_mcast_pkts; fcoe_stat->rx_frames_hi = fcoe_stat->rx_frames_hi + (fcoe_stat->rx_frames_lo < fcoe_q_tstorm_stats->rcv_mcast_pkts ? 1U : 0U); fcoe_stat->tx_bytes_lo = fcoe_stat->tx_bytes_lo + fw_fcoe_stat->tx_stat.fcoe_tx_byte_cnt; fcoe_stat->tx_bytes_hi = fcoe_stat->tx_bytes_hi + (fcoe_stat->tx_bytes_lo < fw_fcoe_stat->tx_stat.fcoe_tx_byte_cnt ? 1U : 0U); fcoe_stat->tx_bytes_lo = fcoe_stat->tx_bytes_lo + fcoe_q_xstorm_stats->ucast_bytes_sent.lo; fcoe_stat->tx_bytes_hi = fcoe_stat->tx_bytes_hi + (fcoe_q_xstorm_stats->ucast_bytes_sent.hi + (fcoe_stat->tx_bytes_lo < fcoe_q_xstorm_stats->ucast_bytes_sent.lo ? 1U : 0U)); fcoe_stat->tx_bytes_lo = fcoe_stat->tx_bytes_lo + fcoe_q_xstorm_stats->bcast_bytes_sent.lo; fcoe_stat->tx_bytes_hi = fcoe_stat->tx_bytes_hi + (fcoe_q_xstorm_stats->bcast_bytes_sent.hi + (fcoe_stat->tx_bytes_lo < fcoe_q_xstorm_stats->bcast_bytes_sent.lo ? 1U : 0U)); fcoe_stat->tx_bytes_lo = fcoe_stat->tx_bytes_lo + fcoe_q_xstorm_stats->mcast_bytes_sent.lo; fcoe_stat->tx_bytes_hi = fcoe_stat->tx_bytes_hi + (fcoe_q_xstorm_stats->mcast_bytes_sent.hi + (fcoe_stat->tx_bytes_lo < fcoe_q_xstorm_stats->mcast_bytes_sent.lo ? 1U : 0U)); fcoe_stat->tx_frames_lo = fcoe_stat->tx_frames_lo + fw_fcoe_stat->tx_stat.fcoe_tx_pkt_cnt; fcoe_stat->tx_frames_hi = fcoe_stat->tx_frames_hi + (fcoe_stat->tx_frames_lo < fw_fcoe_stat->tx_stat.fcoe_tx_pkt_cnt ? 1U : 0U); fcoe_stat->tx_frames_lo = fcoe_stat->tx_frames_lo + fcoe_q_xstorm_stats->ucast_pkts_sent; fcoe_stat->tx_frames_hi = fcoe_stat->tx_frames_hi + (fcoe_stat->tx_frames_lo < fcoe_q_xstorm_stats->ucast_pkts_sent ? 1U : 0U); fcoe_stat->tx_frames_lo = fcoe_stat->tx_frames_lo + fcoe_q_xstorm_stats->bcast_pkts_sent; fcoe_stat->tx_frames_hi = fcoe_stat->tx_frames_hi + (fcoe_stat->tx_frames_lo < fcoe_q_xstorm_stats->bcast_pkts_sent ? 1U : 0U); fcoe_stat->tx_frames_lo = fcoe_stat->tx_frames_lo + fcoe_q_xstorm_stats->mcast_pkts_sent; fcoe_stat->tx_frames_hi = fcoe_stat->tx_frames_hi + (fcoe_stat->tx_frames_lo < fcoe_q_xstorm_stats->mcast_pkts_sent ? 1U : 0U); } else { } bnx2x_cnic_notify(bp, 5); return; } } static void bnx2x_drv_info_iscsi_stat(struct bnx2x *bp ) { struct bnx2x_dcbx_app_params *app ; struct iscsi_stats_info *iscsi_stat ; size_t __len ; void *__ret ; { app = & bp->dcbx_port_params.app; iscsi_stat = & (bp->slowpath)->drv_info_to_mcp.iscsi_stat; if (! bp->cnic_loaded) { return; } else { } __len = 6UL; if (__len > 63UL) { __ret = __memcpy((void *)(& iscsi_stat->mac_local) + 2U, (void const *)(& bp->cnic_eth_dev.iscsi_mac), __len); } else { __ret = __builtin_memcpy((void *)(& iscsi_stat->mac_local) + 2U, (void const *)(& bp->cnic_eth_dev.iscsi_mac), __len); } iscsi_stat->qos_priority = app->traffic_type_priority[2]; bnx2x_cnic_notify(bp, 6); return; } } static void bnx2x_config_mf_bw(struct bnx2x *bp ) { { if ((unsigned int )bp->link_vars.link_up != 0U) { bnx2x_cmng_fns_init(bp, 1, 1); bnx2x_link_sync_notify(bp); } else { } storm_memset_cmng(bp, & bp->cmng, (int )bp->pfid & 1); return; } } static void bnx2x_set_mf_bw(struct bnx2x *bp ) { { bnx2x_config_mf_bw(bp); bnx2x_fw_command(bp, 3774873600U, 0U); return; } } static void bnx2x_handle_eee_event(struct bnx2x *bp ) { long tmp ; { tmp = ldv__builtin_expect((bp->msg_enable & 65536) != 0, 0L); if (tmp != 0L) { printk("\rbnx2x: [%s:%d(%s)]EEE - LLDP event\n", "bnx2x_handle_eee_event", 3480, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } bnx2x_fw_command(bp, 3657433088U, 0U); return; } } static void bnx2x_handle_drv_info_req(struct bnx2x *bp ) { enum drv_info_opcode op_code ; u32 drv_info_ctl ; unsigned int tmp ; { tmp = readl((void const volatile *)(bp->regview + ((unsigned long )bp->common.shmem2_base + 264UL))); drv_info_ctl = tmp; if ((drv_info_ctl & 255U) != 2U) { bnx2x_fw_command(bp, 3640655872U, 0U); return; } else { } op_code = (enum drv_info_opcode )((drv_info_ctl & 65280U) >> 8); memset((void *)(& (bp->slowpath)->drv_info_to_mcp), 0, 316UL); switch ((unsigned int )op_code) { case 0U: bnx2x_drv_info_ether_stat(bp); goto ldv_56495; case 1U: bnx2x_drv_info_fcoe_stat(bp); goto ldv_56495; case 2U: bnx2x_drv_info_iscsi_stat(bp); goto ldv_56495; default: bnx2x_fw_command(bp, 3640655872U, 0U); return; } ldv_56495: writel((unsigned int )bp->slowpath_mapping + 4408U, (void volatile *)(bp->regview + ((unsigned long )bp->common.shmem2_base + 256UL))); writel((unsigned int )((bp->slowpath_mapping + 4408ULL) >> 32), (void volatile *)(bp->regview + ((unsigned long )bp->common.shmem2_base + 260UL))); bnx2x_fw_command(bp, 3623878656U, 0U); return; } } static void bnx2x_dcc_event(struct bnx2x *bp , u32 dcc_event ) { long tmp ; long tmp___0 ; long tmp___1 ; { tmp = ldv__builtin_expect((bp->msg_enable & 65536) != 0, 0L); if (tmp != 0L) { printk("\rbnx2x: [%s:%d(%s)]dcc_event 0x%x\n", "bnx2x_dcc_event", 3530, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", dcc_event); } else { } if ((dcc_event & 256U) != 0U) { if ((bp->mf_config[(int )bp->pfid >> 1] & 8U) != 0U) { tmp___0 = ldv__builtin_expect((bp->msg_enable & 65536) != 0, 0L); if (tmp___0 != 0L) { printk("\rbnx2x: [%s:%d(%s)]mf_cfg function disabled\n", "bnx2x_dcc_event", 3540, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } bp->flags = bp->flags | 2048U; bnx2x_e1h_disable(bp); } else { tmp___1 = ldv__builtin_expect((bp->msg_enable & 65536) != 0, 0L); if (tmp___1 != 0L) { printk("\rbnx2x: [%s:%d(%s)]mf_cfg function enabled\n", "bnx2x_dcc_event", 3545, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } bp->flags = bp->flags & 4294965247U; bnx2x_e1h_enable(bp); } dcc_event = dcc_event & 4294967039U; } else { } if ((dcc_event & 512U) != 0U) { bnx2x_config_mf_bw(bp); dcc_event = dcc_event & 4294966783U; } else { } if (dcc_event != 0U) { bnx2x_fw_command(bp, 822083584U, 0U); } else { bnx2x_fw_command(bp, 805306368U, 0U); } return; } } static struct eth_spe *bnx2x_sp_get_next(struct bnx2x *bp ) { struct eth_spe *next_spe ; long tmp ; { next_spe = bp->spq_prod_bd; if ((unsigned long )bp->spq_prod_bd == (unsigned long )bp->spq_last_bd) { bp->spq_prod_bd = bp->spq; bp->spq_prod_idx = 0U; tmp = ldv__builtin_expect((bp->msg_enable & 1048576) != 0, 0L); if (tmp != 0L) { printk("\rbnx2x: [%s:%d(%s)]end of spq\n", "bnx2x_sp_get_next", 3572, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } } else { bp->spq_prod_bd = bp->spq_prod_bd + 1; bp->spq_prod_idx = (u16 )((int )bp->spq_prod_idx + 1); } return (next_spe); } } static void bnx2x_sp_prod_update(struct bnx2x *bp ) { int func ; { func = (int )bp->pfid; __asm__ volatile ("mfence": : : "memory"); writew((int )bp->spq_prod_idx, (void volatile *)bp->regview + (unsigned long )(((unsigned int )(bp->iro_arr + 31UL)->base + (unsigned int )((int )(bp->iro_arr + 31UL)->m1 * func)) + 4325376U)); __asm__ volatile ("": : : "memory"); return; } } static bool bnx2x_is_contextless_ramrod(int cmd , int cmd_type ) { { if ((((((cmd_type == 8 || cmd == 3) || cmd == 9) || cmd == 10) || cmd == 11) || cmd == 13) || cmd == 12) { return (1); } else { return (0); } } } int bnx2x_sp_post(struct bnx2x *bp , int command , int cid , u32 data_hi , u32 data_lo , int cmd_type ) { struct eth_spe *spe ; u16 type ; bool common ; bool tmp ; int tmp___0 ; int tmp___1 ; int tmp___2 ; int tmp___3 ; long tmp___4 ; { tmp = bnx2x_is_contextless_ramrod(command, cmd_type); common = tmp; spin_lock_bh(& bp->spq_lock); if ((int )common) { tmp___0 = atomic_read((atomic_t const *)(& bp->eq_spq_left)); if (tmp___0 == 0) { printk("\vbnx2x: [%s:%d(%s)]BUG! EQ ring full!\n", "bnx2x_sp_post", 3651, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); spin_unlock_bh(& bp->spq_lock); bp->panic = 1; printk("\vbnx2x: [%s:%d(%s)]driver assert\n", "bnx2x_sp_post", 3653, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); bnx2x_panic_dump(bp, 0); return (-16); } else { } } else { tmp___1 = atomic_read((atomic_t const *)(& bp->cq_spq_left)); if (tmp___1 == 0) { printk("\vbnx2x: [%s:%d(%s)]BUG! SPQ ring full!\n", "bnx2x_sp_post", 3657, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); spin_unlock_bh(& bp->spq_lock); bp->panic = 1; printk("\vbnx2x: [%s:%d(%s)]driver assert\n", "bnx2x_sp_post", 3659, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); bnx2x_panic_dump(bp, 0); return (-16); } else { } } spe = bnx2x_sp_get_next(bp); spe->hdr.conn_and_cmd_data = (unsigned int )((command << 24) | (((((int )bp->pfid & 1) << 23) | (((int )bp->pfid >> 1) << 17)) | cid)); type = (unsigned int )((u16 )cmd_type) & 255U; type = (u16 )((int )((short )((int )bp->pfid << 8)) | (int )((short )type)); spe->hdr.type = type; spe->data.update_data_addr.hi = data_hi; spe->data.update_data_addr.lo = data_lo; if ((int )common) { atomic_dec(& bp->eq_spq_left); } else { atomic_dec(& bp->cq_spq_left); } tmp___4 = ldv__builtin_expect((bp->msg_enable & 1048576) != 0, 0L); if (tmp___4 != 0L) { tmp___2 = atomic_read((atomic_t const *)(& bp->eq_spq_left)); tmp___3 = atomic_read((atomic_t const *)(& bp->cq_spq_left)); printk("\rbnx2x: [%s:%d(%s)]SPQE[%x] (%x:%x) (cmd, common?) (%d,%d) hw_cid %x data (%x:%x) type(0x%x) left (CQ, EQ) (%x,%x)\n", "bnx2x_sp_post", 3697, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )bp->spq_prod_idx, (unsigned int )(bp->spq_mapping >> 32), (unsigned int )((long )((void *)bp->spq_prod_bd + (unsigned long )((unsigned int )bp->spq_mapping))) - (unsigned int )((long )bp->spq), command, (int )common, ((((int )bp->pfid & 1) << 23) | (((int )bp->pfid >> 1) << 17)) | cid, data_hi, data_lo, (int )type, tmp___3, tmp___2); } else { } bnx2x_sp_prod_update(bp); spin_unlock_bh(& bp->spq_lock); return (0); } } static int bnx2x_acquire_alr(struct bnx2x *bp ) { u32 j ; u32 val ; int rc ; { rc = 0; __might_sleep("/work/ldvuser/exper_fp/work/current--X--drivers--X--defaultlinux-3.10-rc1.tar--X--32_7a--X--cpachecker/linux-3.10-rc1.tar/csd_deg_dscv/8504/dscv_tempdir/dscv/ri/32_7a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c.prepared", 3710, 0); j = 0U; goto ldv_56537; ldv_56536: val = 2147483648U; writel(val, (void volatile *)bp->regview + 524444U); val = readl((void const volatile *)bp->regview + 524444U); if ((int )val < 0) { goto ldv_56535; } else { } msleep(5U); j = j + 1U; ldv_56537: ; if (j <= 999U) { goto ldv_56536; } else { } ldv_56535: ; if ((int )val >= 0) { printk("\vbnx2x: [%s:%d(%s)]Cannot acquire MCP access lock register\n", "bnx2x_acquire_alr", 3721, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); rc = -16; } else { } return (rc); } } static void bnx2x_release_alr(struct bnx2x *bp ) { { writel(0U, (void volatile *)bp->regview + 524444U); return; } } static u16 bnx2x_update_dsb_idx(struct bnx2x *bp ) { struct host_sp_status_block *def_sb ; u16 rc ; { def_sb = bp->def_status_blk; rc = 0U; __asm__ volatile ("": : : "memory"); if ((int )bp->def_att_idx != (int )def_sb->atten_status_block.attn_bits_index) { bp->def_att_idx = def_sb->atten_status_block.attn_bits_index; rc = (u16 )((unsigned int )rc | 1U); } else { } if ((int )bp->def_idx != (int )def_sb->sp_sb.running_index) { bp->def_idx = def_sb->sp_sb.running_index; rc = (u16 )((unsigned int )rc | 2U); } else { } __asm__ volatile ("": : : "memory"); return (rc); } } static void bnx2x_attn_int_asserted(struct bnx2x *bp , u32 asserted ) { int port ; u32 aeu_addr ; u32 nig_int_mask_addr ; u32 aeu_mask ; u32 nig_mask ; u32 reg_addr ; long tmp ; long tmp___0 ; long tmp___1 ; long tmp___2 ; long tmp___3 ; long tmp___4 ; long tmp___5 ; long tmp___6 ; long tmp___7 ; long tmp___8 ; long tmp___9 ; long tmp___10 ; long tmp___11 ; long tmp___12 ; long tmp___13 ; u32 cnt ; u32 igu_acked ; long tmp___14 ; { port = (int )bp->pfid & 1; aeu_addr = port != 0 ? 41060U : 41056U; nig_int_mask_addr = port != 0 ? 66356U : 66352U; nig_mask = 0U; if ((bp->attn_state & asserted) != 0U) { printk("\vbnx2x: [%s:%d(%s)]IGU ERROR\n", "bnx2x_attn_int_asserted", 3774, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } bnx2x_acquire_hw_lock(bp, (u32 )(port + 3)); aeu_mask = readl((void const volatile *)bp->regview + (unsigned long )aeu_addr); tmp = ldv__builtin_expect((bp->msg_enable & 8192) != 0, 0L); if (tmp != 0L) { printk("\rbnx2x: [%s:%d(%s)]aeu_mask %x newly asserted %x\n", "bnx2x_attn_int_asserted", 3780, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", aeu_mask, asserted); } else { } aeu_mask = ~ (asserted & 1023U) & aeu_mask; tmp___0 = ldv__builtin_expect((bp->msg_enable & 8192) != 0, 0L); if (tmp___0 != 0L) { printk("\rbnx2x: [%s:%d(%s)]new mask %x\n", "bnx2x_attn_int_asserted", 3782, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", aeu_mask); } else { } writel(aeu_mask, (void volatile *)bp->regview + (unsigned long )aeu_addr); bnx2x_release_hw_lock(bp, (u32 )(port + 3)); tmp___1 = ldv__builtin_expect((bp->msg_enable & 8192) != 0, 0L); if (tmp___1 != 0L) { printk("\rbnx2x: [%s:%d(%s)]attn_state %x\n", "bnx2x_attn_int_asserted", 3787, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", bp->attn_state); } else { } bp->attn_state = bp->attn_state | asserted; tmp___2 = ldv__builtin_expect((bp->msg_enable & 8192) != 0, 0L); if (tmp___2 != 0L) { printk("\rbnx2x: [%s:%d(%s)]new state %x\n", "bnx2x_attn_int_asserted", 3789, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", bp->attn_state); } else { } if ((asserted & 65280U) != 0U) { if (((long )asserted & 256L) != 0L) { bnx2x_acquire_phy_lock(bp); nig_mask = readl((void const volatile *)bp->regview + (unsigned long )nig_int_mask_addr); if (nig_mask != 0U) { writel(0U, (void volatile *)bp->regview + (unsigned long )nig_int_mask_addr); bnx2x_link_attn(bp); } else { } } else { } if (((long )asserted & 512L) != 0L) { tmp___3 = ldv__builtin_expect((bp->msg_enable & 8192) != 0, 0L); if (tmp___3 != 0L) { printk("\rbnx2x: [%s:%d(%s)]ATTN_SW_TIMER_4_FUNC!\n", "bnx2x_attn_int_asserted", 3811, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } } else { } if (((long )asserted & 1024L) != 0L) { tmp___4 = ldv__builtin_expect((bp->msg_enable & 8192) != 0, 0L); if (tmp___4 != 0L) { printk("\rbnx2x: [%s:%d(%s)]GPIO_2_FUNC!\n", "bnx2x_attn_int_asserted", 3814, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } } else { } if (((long )asserted & 2048L) != 0L) { tmp___5 = ldv__builtin_expect((bp->msg_enable & 8192) != 0, 0L); if (tmp___5 != 0L) { printk("\rbnx2x: [%s:%d(%s)]GPIO_3_FUNC!\n", "bnx2x_attn_int_asserted", 3817, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } } else { } if (((long )asserted & 4096L) != 0L) { tmp___6 = ldv__builtin_expect((bp->msg_enable & 8192) != 0, 0L); if (tmp___6 != 0L) { printk("\rbnx2x: [%s:%d(%s)]GPIO_4_FUNC!\n", "bnx2x_attn_int_asserted", 3820, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } } else { } if (port == 0) { if (((long )asserted & 8192L) != 0L) { tmp___7 = ldv__builtin_expect((bp->msg_enable & 8192) != 0, 0L); if (tmp___7 != 0L) { printk("\rbnx2x: [%s:%d(%s)]ATTN_GENERAL_ATTN_1!\n", "bnx2x_attn_int_asserted", 3824, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } writel(0U, (void volatile *)bp->regview + 40964U); } else { } if (((long )asserted & 16384L) != 0L) { tmp___8 = ldv__builtin_expect((bp->msg_enable & 8192) != 0, 0L); if (tmp___8 != 0L) { printk("\rbnx2x: [%s:%d(%s)]ATTN_GENERAL_ATTN_2!\n", "bnx2x_attn_int_asserted", 3828, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } writel(0U, (void volatile *)bp->regview + 40968U); } else { } if (((long )asserted & 32768L) != 0L) { tmp___9 = ldv__builtin_expect((bp->msg_enable & 8192) != 0, 0L); if (tmp___9 != 0L) { printk("\rbnx2x: [%s:%d(%s)]ATTN_GENERAL_ATTN_3!\n", "bnx2x_attn_int_asserted", 3832, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } writel(0U, (void volatile *)bp->regview + 40972U); } else { } } else { if (((long )asserted & 8192L) != 0L) { tmp___10 = ldv__builtin_expect((bp->msg_enable & 8192) != 0, 0L); if (tmp___10 != 0L) { printk("\rbnx2x: [%s:%d(%s)]ATTN_GENERAL_ATTN_4!\n", "bnx2x_attn_int_asserted", 3837, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } writel(0U, (void volatile *)bp->regview + 40976U); } else { } if (((long )asserted & 16384L) != 0L) { tmp___11 = ldv__builtin_expect((bp->msg_enable & 8192) != 0, 0L); if (tmp___11 != 0L) { printk("\rbnx2x: [%s:%d(%s)]ATTN_GENERAL_ATTN_5!\n", "bnx2x_attn_int_asserted", 3841, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } writel(0U, (void volatile *)bp->regview + 40980U); } else { } if (((long )asserted & 32768L) != 0L) { tmp___12 = ldv__builtin_expect((bp->msg_enable & 8192) != 0, 0L); if (tmp___12 != 0L) { printk("\rbnx2x: [%s:%d(%s)]ATTN_GENERAL_ATTN_6!\n", "bnx2x_attn_int_asserted", 3845, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } writel(0U, (void volatile *)bp->regview + 40984U); } else { } } } else { } if ((unsigned int )bp->common.int_block == 0U) { reg_addr = (u32 )((port + 33804) * 32 + 12); } else { reg_addr = 4467976U; } tmp___13 = ldv__builtin_expect((bp->msg_enable & 8192) != 0, 0L); if (tmp___13 != 0L) { printk("\rbnx2x: [%s:%d(%s)]about to mask 0x%08x at %s addr 0x%x\n", "bnx2x_attn_int_asserted", 3859, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", asserted, (unsigned int )bp->common.int_block == 0U ? (char *)"HC" : (char *)"IGU", reg_addr); } else { } writel(asserted, (void volatile *)bp->regview + (unsigned long )reg_addr); if (((long )asserted & 256L) != 0L) { if ((unsigned int )bp->common.int_block != 0U) { cnt = 0U; ldv_56560: igu_acked = readl((void const volatile *)bp->regview + 1245448U); if (((long )igu_acked & 256L) == 0L) { cnt = cnt + 1U; if (cnt <= 99U) { goto ldv_56560; } else { goto ldv_56561; } } else { } ldv_56561: ; if (igu_acked == 0U) { tmp___14 = ldv__builtin_expect((bp->msg_enable & 8192) != 0, 0L); if (tmp___14 != 0L) { printk("\rbnx2x: [%s:%d(%s)]Failed to verify IGU ack on time\n", "bnx2x_attn_int_asserted", 3876, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } } else { } __asm__ volatile ("": : : "memory"); } else { } writel(nig_mask, (void volatile *)bp->regview + (unsigned long )nig_int_mask_addr); bnx2x_release_phy_lock(bp); } else { } return; } } static void bnx2x_fan_failure(struct bnx2x *bp ) { int port ; u32 ext_phy_config ; { port = (int )bp->pfid & 1; ext_phy_config = readl((void const volatile *)(bp->regview + (((unsigned long )bp->common.shmem_base + (unsigned long )port * 400UL) + 436UL))); ext_phy_config = ext_phy_config & 4294902015U; ext_phy_config = ext_phy_config | 64768U; writel(ext_phy_config, (void volatile *)(bp->regview + (((unsigned long )bp->common.shmem_base + (unsigned long )port * 400UL) + 436UL))); netdev_err((struct net_device const *)bp->dev, "Fan Failure on Network Controller has caused the driver to shutdown the card to prevent permanent damage.\nPlease contact OEM Support for assistance\n"); __asm__ volatile ("": : : "memory"); set_bit(2U, (unsigned long volatile *)(& bp->sp_rtnl_state)); __asm__ volatile ("": : : "memory"); schedule_delayed_work(& bp->sp_rtnl_task, 0UL); return; } } static void bnx2x_attn_int_deasserted0(struct bnx2x *bp , u32 attn ) { int port ; int reg_offset ; u32 val ; { port = (int )bp->pfid & 1; reg_offset = port != 0 ? 41228 : 41068; if ((attn & 32768U) != 0U) { val = readl((void const volatile *)bp->regview + (unsigned long )reg_offset); val = val & 4294934527U; writel(val, (void volatile *)bp->regview + (unsigned long )reg_offset); printk("\vbnx2x: [%s:%d(%s)]SPIO5 hw attention\n", "bnx2x_attn_int_deasserted0", 3929, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); bnx2x_hw_reset_phy(& bp->link_params); bnx2x_fan_failure(bp); } else { } if ((bp->link_vars.aeu_int_mask & attn) != 0U && bp->port.pmf != 0U) { bnx2x_acquire_phy_lock(bp); bnx2x_handle_module_detect_int(& bp->link_params); bnx2x_release_phy_lock(bp); } else { } if ((attn & 2852651008U) != 0U) { val = readl((void const volatile *)bp->regview + (unsigned long )reg_offset); val = ~ (attn & 2852651008U) & val; writel(val, (void volatile *)bp->regview + (unsigned long )reg_offset); printk("\vbnx2x: [%s:%d(%s)]FATAL HW block attention set0 0x%x\n", "bnx2x_attn_int_deasserted0", 3949, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", attn & 2852651008U); bp->panic = 1; printk("\vbnx2x: [%s:%d(%s)]driver assert\n", "bnx2x_attn_int_deasserted0", 3950, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); bnx2x_panic_dump(bp, 0); } else { } return; } } static void bnx2x_attn_int_deasserted1(struct bnx2x *bp , u32 attn ) { u32 val ; int port ; int reg_offset ; { if ((attn & 8192U) != 0U) { val = readl((void const volatile *)bp->regview + 1507704U); printk("\vbnx2x: [%s:%d(%s)]DB hw attention 0x%x\n", "bnx2x_attn_int_deasserted1", 3961, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", val); if ((val & 2U) != 0U) { printk("\vbnx2x: [%s:%d(%s)]FATAL error from DORQ\n", "bnx2x_attn_int_deasserted1", 3964, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } } else { } if ((attn & 2862615208U) != 0U) { port = (int )bp->pfid & 1; reg_offset = port != 0 ? 41244 : 41084; val = readl((void const volatile *)bp->regview + (unsigned long )reg_offset); val = ~ (attn & 2862615208U) & val; writel(val, (void volatile *)bp->regview + (unsigned long )reg_offset); printk("\vbnx2x: [%s:%d(%s)]FATAL HW block attention set1 0x%x\n", "bnx2x_attn_int_deasserted1", 3980, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", attn & 2862615208U); bp->panic = 1; printk("\vbnx2x: [%s:%d(%s)]driver assert\n", "bnx2x_attn_int_deasserted1", 3981, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); bnx2x_panic_dump(bp, 0); } else { } return; } } static void bnx2x_attn_int_deasserted2(struct bnx2x *bp , u32 attn ) { u32 val ; int port ; int reg_offset ; { if ((attn & 128U) != 0U) { val = readl((void const volatile *)bp->regview + 1065216U); printk("\vbnx2x: [%s:%d(%s)]CFC hw attention 0x%x\n", "bnx2x_attn_int_deasserted2", 3992, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", val); if ((val & 2U) != 0U) { printk("\vbnx2x: [%s:%d(%s)]FATAL error from CFC\n", "bnx2x_attn_int_deasserted2", 3995, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } } else { } if ((attn & 8U) != 0U) { val = readl((void const volatile *)bp->regview + 1060972U); printk("\vbnx2x: [%s:%d(%s)]PXP hw attention-0 0x%x\n", "bnx2x_attn_int_deasserted2", 4000, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", val); if ((val & 98304U) != 0U) { printk("\vbnx2x: [%s:%d(%s)]FATAL error from PXP\n", "bnx2x_attn_int_deasserted2", 4003, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } if (bp->common.chip_id >> 16 != 5710U && (bp->common.chip_id >> 16 != 5711U && bp->common.chip_id >> 16 != 5712U)) { val = readl((void const volatile *)bp->regview + 1060988U); printk("\vbnx2x: [%s:%d(%s)]PXP hw attention-1 0x%x\n", "bnx2x_attn_int_deasserted2", 4007, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", val); } else { } } else { } if ((attn & 35362U) != 0U) { port = (int )bp->pfid & 1; reg_offset = port != 0 ? 41260 : 41100; val = readl((void const volatile *)bp->regview + (unsigned long )reg_offset); val = ~ (attn & 35362U) & val; writel(val, (void volatile *)bp->regview + (unsigned long )reg_offset); printk("\vbnx2x: [%s:%d(%s)]FATAL HW block attention set2 0x%x\n", "bnx2x_attn_int_deasserted2", 4024, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", attn & 35362U); bp->panic = 1; printk("\vbnx2x: [%s:%d(%s)]driver assert\n", "bnx2x_attn_int_deasserted2", 4025, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); bnx2x_panic_dump(bp, 0); } else { } return; } } static void bnx2x_attn_int_deasserted3(struct bnx2x *bp , u32 attn ) { u32 val ; int func ; unsigned int tmp ; unsigned int tmp___0 ; { if ((attn & 524256U) != 0U) { if ((int )((unsigned long )attn >> ((int )bp->pfid + 106) % 32) & 1) { func = (int )bp->pfid; writel(0U, (void volatile *)bp->regview + (unsigned long )((func + 10252) * 4)); bnx2x_read_mf_cfg(bp); bp->mf_config[(int )bp->pfid >> 1] = readl((void const volatile *)(bp->regview + (((unsigned long )bp->common.mf_cfg_base + (unsigned long )bp->pf_num * 24UL) + 36UL))); val = readl((void const volatile *)(bp->regview + (((unsigned long )bp->common.shmem_base + (unsigned long )(((int )bp->pfid & 1) + ((int )bp->pfid >> 1) * ((bp->common.chip_id >> 16 == 5710U || (bp->common.chip_id >> 16 == 5711U || bp->common.chip_id >> 16 == 5712U)) || (unsigned int )bp->common.chip_port_mode == 0U ? 2 : 1)) * 44UL) + 1700UL))); if ((val & 65280U) != 0U) { bnx2x_dcc_event(bp, val & 65280U); } else { } if ((val & 4U) != 0U) { bnx2x_set_mf_bw(bp); } else { } if ((val & 67108864U) != 0U) { bnx2x_handle_drv_info_req(bp); } else { } if ((val & 2U) != 0U) { bnx2x_vf_handle_flr_event(bp); } else { } if (bp->port.pmf == 0U && (int )val & 1) { bnx2x_pmf_update(bp); } else { } if ((bp->port.pmf != 0U && (val & 65536U) != 0U) && bp->dcbx_enabled > 0) { bnx2x_dcbx_set_params(bp, 1U); } else { } if ((val & 66060288U) != 0U) { bnx2x_handle_afex_cmd(bp, val & 66060288U); } else { } if ((val & 134217728U) != 0U) { bnx2x_handle_eee_event(bp); } else { } if ((int )bp->link_vars.periodic_flags & 1) { bnx2x_acquire_phy_lock(bp); bp->link_vars.periodic_flags = (unsigned int )bp->link_vars.periodic_flags & 65534U; bnx2x_release_phy_lock(bp); if ((unsigned int )bp->mf_mode != 0U) { bnx2x_link_sync_notify(bp); } else { } bnx2x_link_report(bp); } else { } bnx2x__link_status_update(bp); } else if (((unsigned long )attn & 480UL) != 0UL) { printk("\vbnx2x: [%s:%d(%s)]MC assert!\n", "bnx2x_attn_int_deasserted3", 4088, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); bnx2x_mc_assert(bp); writel(0U, (void volatile *)bp->regview + 41000U); writel(0U, (void volatile *)bp->regview + 40996U); writel(0U, (void volatile *)bp->regview + 40992U); writel(0U, (void volatile *)bp->regview + 40988U); bp->panic = 1; printk("\vbnx2x: [%s:%d(%s)]driver assert\n", "bnx2x_attn_int_deasserted3", 4094, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); bnx2x_panic_dump(bp, 0); } else if (((unsigned long )attn & 512UL) != 0UL) { printk("\vbnx2x: [%s:%d(%s)]MCP assert!\n", "bnx2x_attn_int_deasserted3", 4098, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); writel(0U, (void volatile *)bp->regview + 41004U); bnx2x_fw_dump(bp); } else { printk("\vbnx2x: [%s:%d(%s)]Unknown HW assert! (attn 0x%x)\n", "bnx2x_attn_int_deasserted3", 4103, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", attn); } } else { } if ((attn & 4292870144U) != 0U) { printk("\vbnx2x: [%s:%d(%s)]LATCHED attention 0x%08x (masked)\n", "bnx2x_attn_int_deasserted3", 4107, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", attn); if (((unsigned long )attn & 67108864UL) != 0UL) { if (bp->common.chip_id >> 16 != 5710U) { tmp = readl((void const volatile *)bp->regview + 41924U); val = tmp; } else { val = 0U; } printk("\vbnx2x: [%s:%d(%s)]GRC time-out 0x%08x\n", "bnx2x_attn_int_deasserted3", 4111, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", val); } else { } if (((unsigned long )attn & 199229440UL) != 0UL) { if (bp->common.chip_id >> 16 != 5710U) { tmp___0 = readl((void const volatile *)bp->regview + 41920U); val = tmp___0; } else { val = 0U; } printk("\vbnx2x: [%s:%d(%s)]GRC reserved 0x%08x\n", "bnx2x_attn_int_deasserted3", 4116, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", val); } else { } writel(2047U, (void volatile *)bp->regview + 42076U); } else { } return; } } void bnx2x_set_reset_global(struct bnx2x *bp ) { u32 val ; { bnx2x_acquire_hw_lock(bp, 11U); val = readl((void const volatile *)bp->regview + 42100U); writel(val | 262144U, (void volatile *)bp->regview + 42100U); bnx2x_release_hw_lock(bp, 11U); return; } } static void bnx2x_clear_reset_global(struct bnx2x *bp ) { u32 val ; { bnx2x_acquire_hw_lock(bp, 11U); val = readl((void const volatile *)bp->regview + 42100U); writel(val & 4294705151U, (void volatile *)bp->regview + 42100U); bnx2x_release_hw_lock(bp, 11U); return; } } static bool bnx2x_reset_is_global(struct bnx2x *bp ) { u32 val ; unsigned int tmp ; long tmp___0 ; { tmp = readl((void const volatile *)bp->regview + 42100U); val = tmp; tmp___0 = ldv__builtin_expect((bp->msg_enable & 8192) != 0, 0L); if (tmp___0 != 0L) { printk("\rbnx2x: [%s:%d(%s)]GEN_REG_VAL=0x%08x\n", "bnx2x_reset_is_global", 4183, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", val); } else { } return ((val & 262144U) != 0U); } } static void bnx2x_set_reset_done(struct bnx2x *bp ) { u32 val ; u32 bit ; { bit = (bp->common.chip_id >> 16 != 5710U && (bp->common.chip_id >> 16 != 5711U && bp->common.chip_id >> 16 != 5712U) ? (int )bp->pf_num & 1 : 0) ? 131072U : 65536U; bnx2x_acquire_hw_lock(bp, 11U); val = readl((void const volatile *)bp->regview + 42100U); val = ~ bit & val; writel(val, (void volatile *)bp->regview + 42100U); bnx2x_release_hw_lock(bp, 11U); return; } } void bnx2x_set_reset_in_progress(struct bnx2x *bp ) { u32 val ; u32 bit ; { bit = (bp->common.chip_id >> 16 != 5710U && (bp->common.chip_id >> 16 != 5711U && bp->common.chip_id >> 16 != 5712U) ? (int )bp->pf_num & 1 : 0) ? 131072U : 65536U; bnx2x_acquire_hw_lock(bp, 11U); val = readl((void const volatile *)bp->regview + 42100U); val = val | bit; writel(val, (void volatile *)bp->regview + 42100U); bnx2x_release_hw_lock(bp, 11U); return; } } bool bnx2x_reset_is_done(struct bnx2x *bp , int engine ) { u32 val ; unsigned int tmp ; u32 bit ; { tmp = readl((void const volatile *)bp->regview + 42100U); val = tmp; bit = engine != 0 ? 131072U : 65536U; return ((val & bit) == 0U); } } void bnx2x_set_pf_load(struct bnx2x *bp ) { u32 val1 ; u32 val ; u32 mask ; u32 shift ; long tmp ; { mask = (bp->common.chip_id >> 16 != 5710U && (bp->common.chip_id >> 16 != 5711U && bp->common.chip_id >> 16 != 5712U) ? (int )bp->pf_num & 1 : 0) ? 65280U : 255U; shift = (bp->common.chip_id >> 16 != 5710U && (bp->common.chip_id >> 16 != 5711U && bp->common.chip_id >> 16 != 5712U) ? (int )bp->pf_num & 1 : 0) ? 8U : 0U; bnx2x_acquire_hw_lock(bp, 11U); val = readl((void const volatile *)bp->regview + 42100U); tmp = ldv__builtin_expect((bp->msg_enable & 32) != 0, 0L); if (tmp != 0L) { printk("\rbnx2x: [%s:%d(%s)]Old GEN_REG_VAL=0x%08x\n", "bnx2x_set_pf_load", 4256, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", val); } else { } val1 = (val & mask) >> (int )shift; val1 = (u32 )(1 << (int )bp->pf_num) | val1; val = ~ mask & val; val = ((val1 << (int )shift) & mask) | val; writel(val, (void volatile *)bp->regview + 42100U); bnx2x_release_hw_lock(bp, 11U); return; } } bool bnx2x_clear_pf_load(struct bnx2x *bp ) { u32 val1 ; u32 val ; u32 mask ; u32 shift ; long tmp ; { mask = (bp->common.chip_id >> 16 != 5710U && (bp->common.chip_id >> 16 != 5711U && bp->common.chip_id >> 16 != 5712U) ? (int )bp->pf_num & 1 : 0) ? 65280U : 255U; shift = (bp->common.chip_id >> 16 != 5710U && (bp->common.chip_id >> 16 != 5711U && bp->common.chip_id >> 16 != 5712U) ? (int )bp->pf_num & 1 : 0) ? 8U : 0U; bnx2x_acquire_hw_lock(bp, 11U); val = readl((void const volatile *)bp->regview + 42100U); tmp = ldv__builtin_expect((bp->msg_enable & 16) != 0, 0L); if (tmp != 0L) { printk("\rbnx2x: [%s:%d(%s)]Old GEN_REG_VAL=0x%08x\n", "bnx2x_clear_pf_load", 4293, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", val); } else { } val1 = (val & mask) >> (int )shift; val1 = (u32 )(~ (1 << (int )bp->pf_num)) & val1; val = ~ mask & val; val = ((val1 << (int )shift) & mask) | val; writel(val, (void volatile *)bp->regview + 42100U); bnx2x_release_hw_lock(bp, 11U); return (val1 != 0U); } } static bool bnx2x_get_load_status(struct bnx2x *bp , int engine ) { u32 mask ; u32 shift ; u32 val ; unsigned int tmp ; long tmp___0 ; long tmp___1 ; { mask = engine != 0 ? 65280U : 255U; shift = engine != 0 ? 8U : 0U; tmp = readl((void const volatile *)bp->regview + 42100U); val = tmp; tmp___0 = ldv__builtin_expect((bp->msg_enable & 8224) != 0, 0L); if (tmp___0 != 0L) { printk("\rbnx2x: [%s:%d(%s)]GLOB_REG=0x%08x\n", "bnx2x_get_load_status", 4325, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", val); } else { } val = (val & mask) >> (int )shift; tmp___1 = ldv__builtin_expect((bp->msg_enable & 8224) != 0, 0L); if (tmp___1 != 0L) { printk("\rbnx2x: [%s:%d(%s)]load mask for engine %d = 0x%x\n", "bnx2x_get_load_status", 4330, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", engine, val); } else { } return (val != 0U); } } static void _print_next_block(int idx , char const *blk ) { { printk("%s%s", idx != 0 ? (char *)", " : (char *)"", blk); return; } } static int bnx2x_check_blocks_with_parity0(u32 sig , int par_num , bool print ) { int i ; u32 cur_bit ; int tmp ; int tmp___0 ; int tmp___1 ; int tmp___2 ; int tmp___3 ; int tmp___4 ; int tmp___5 ; { i = 0; cur_bit = 0U; i = 0; goto ldv_56671; ldv_56670: cur_bit = 1U << i; if ((sig & cur_bit) != 0U) { switch (cur_bit) { case 262144U: ; if ((int )print) { tmp = par_num; par_num = par_num + 1; _print_next_block(tmp, "BRB"); } else { } goto ldv_56663; case 1048576U: ; if ((int )print) { tmp___0 = par_num; par_num = par_num + 1; _print_next_block(tmp___0, "PARSER"); } else { } goto ldv_56663; case 16777216U: ; if ((int )print) { tmp___1 = par_num; par_num = par_num + 1; _print_next_block(tmp___1, "TSDM"); } else { } goto ldv_56663; case 4194304U: ; if ((int )print) { tmp___2 = par_num; par_num = par_num + 1; _print_next_block(tmp___2, "SEARCHER"); } else { } goto ldv_56663; case 67108864U: ; if ((int )print) { tmp___3 = par_num; par_num = par_num + 1; _print_next_block(tmp___3, "TCM"); } else { } goto ldv_56663; case 268435456U: ; if ((int )print) { tmp___4 = par_num; par_num = par_num + 1; _print_next_block(tmp___4, "TSEMI"); } else { } goto ldv_56663; case 1073741824U: ; if ((int )print) { tmp___5 = par_num; par_num = par_num + 1; _print_next_block(tmp___5, "XPB"); } else { } goto ldv_56663; } ldv_56663: sig = ~ cur_bit & sig; } else { } i = i + 1; ldv_56671: ; if (sig != 0U) { goto ldv_56670; } else { } return (par_num); } } static int bnx2x_check_blocks_with_parity1(u32 sig , int par_num , bool *global , bool print ) { int i ; u32 cur_bit ; 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 ; int tmp___12 ; int tmp___13 ; int tmp___14 ; { i = 0; cur_bit = 0U; i = 0; goto ldv_56699; ldv_56698: cur_bit = 1U << i; if ((sig & cur_bit) != 0U) { switch (cur_bit) { case 1U: ; if ((int )print) { tmp = par_num; par_num = par_num + 1; _print_next_block(tmp, "PBF"); } else { } goto ldv_56682; case 4U: ; if ((int )print) { tmp___0 = par_num; par_num = par_num + 1; _print_next_block(tmp___0, "QM"); } else { } goto ldv_56682; case 16U: ; if ((int )print) { tmp___1 = par_num; par_num = par_num + 1; _print_next_block(tmp___1, "TM"); } else { } goto ldv_56682; case 64U: ; if ((int )print) { tmp___2 = par_num; par_num = par_num + 1; _print_next_block(tmp___2, "XSDM"); } else { } goto ldv_56682; case 256U: ; if ((int )print) { tmp___3 = par_num; par_num = par_num + 1; _print_next_block(tmp___3, "XCM"); } else { } goto ldv_56682; case 1024U: ; if ((int )print) { tmp___4 = par_num; par_num = par_num + 1; _print_next_block(tmp___4, "XSEMI"); } else { } goto ldv_56682; case 4096U: ; if ((int )print) { tmp___5 = par_num; par_num = par_num + 1; _print_next_block(tmp___5, "DOORBELLQ"); } else { } goto ldv_56682; case 16384U: ; if ((int )print) { tmp___6 = par_num; par_num = par_num + 1; _print_next_block(tmp___6, "NIG"); } else { } goto ldv_56682; case 65536U: ; if ((int )print) { tmp___7 = par_num; par_num = par_num + 1; _print_next_block(tmp___7, "VAUX PCI CORE"); } else { } *global = 1; goto ldv_56682; case 262144U: ; if ((int )print) { tmp___8 = par_num; par_num = par_num + 1; _print_next_block(tmp___8, "DEBUG"); } else { } goto ldv_56682; case 1048576U: ; if ((int )print) { tmp___9 = par_num; par_num = par_num + 1; _print_next_block(tmp___9, "USDM"); } else { } goto ldv_56682; case 4194304U: ; if ((int )print) { tmp___10 = par_num; par_num = par_num + 1; _print_next_block(tmp___10, "UCM"); } else { } goto ldv_56682; case 16777216U: ; if ((int )print) { tmp___11 = par_num; par_num = par_num + 1; _print_next_block(tmp___11, "USEMI"); } else { } goto ldv_56682; case 67108864U: ; if ((int )print) { tmp___12 = par_num; par_num = par_num + 1; _print_next_block(tmp___12, "UPB"); } else { } goto ldv_56682; case 268435456U: ; if ((int )print) { tmp___13 = par_num; par_num = par_num + 1; _print_next_block(tmp___13, "CSDM"); } else { } goto ldv_56682; case 1073741824U: ; if ((int )print) { tmp___14 = par_num; par_num = par_num + 1; _print_next_block(tmp___14, "CCM"); } else { } goto ldv_56682; } ldv_56682: sig = ~ cur_bit & sig; } else { } i = i + 1; ldv_56699: ; if (sig != 0U) { goto ldv_56698; } else { } return (par_num); } } static int bnx2x_check_blocks_with_parity2(u32 sig , int par_num , bool print ) { int i ; u32 cur_bit ; int tmp ; int tmp___0 ; int tmp___1 ; int tmp___2 ; int tmp___3 ; int tmp___4 ; int tmp___5 ; int tmp___6 ; { i = 0; cur_bit = 0U; i = 0; goto ldv_56718; ldv_56717: cur_bit = 1U << i; if ((sig & cur_bit) != 0U) { switch (cur_bit) { case 1U: ; if ((int )print) { tmp = par_num; par_num = par_num + 1; _print_next_block(tmp, "CSEMI"); } else { } goto ldv_56709; case 4U: ; if ((int )print) { tmp___0 = par_num; par_num = par_num + 1; _print_next_block(tmp___0, "PXP"); } else { } goto ldv_56709; case 16U: ; if ((int )print) { tmp___1 = par_num; par_num = par_num + 1; _print_next_block(tmp___1, "PXPPCICLOCKCLIENT"); } else { } goto ldv_56709; case 64U: ; if ((int )print) { tmp___2 = par_num; par_num = par_num + 1; _print_next_block(tmp___2, "CFC"); } else { } goto ldv_56709; case 256U: ; if ((int )print) { tmp___3 = par_num; par_num = par_num + 1; _print_next_block(tmp___3, "CDU"); } else { } goto ldv_56709; case 1024U: ; if ((int )print) { tmp___4 = par_num; par_num = par_num + 1; _print_next_block(tmp___4, "DMAE"); } else { } goto ldv_56709; case 4096U: ; if ((int )print) { tmp___5 = par_num; par_num = par_num + 1; _print_next_block(tmp___5, "IGU"); } else { } goto ldv_56709; case 16384U: ; if ((int )print) { tmp___6 = par_num; par_num = par_num + 1; _print_next_block(tmp___6, "MISC"); } else { } goto ldv_56709; } ldv_56709: sig = ~ cur_bit & sig; } else { } i = i + 1; ldv_56718: ; if (sig != 0U) { goto ldv_56717; } else { } return (par_num); } } static int bnx2x_check_blocks_with_parity3(u32 sig , int par_num , bool *global , bool print ) { int i ; u32 cur_bit ; int tmp ; int tmp___0 ; int tmp___1 ; int tmp___2 ; { i = 0; cur_bit = 0U; i = 0; goto ldv_56734; ldv_56733: cur_bit = 1U << i; if ((sig & cur_bit) != 0U) { switch (cur_bit) { case 268435456U: ; if ((int )print) { tmp = par_num; par_num = par_num + 1; _print_next_block(tmp, "MCP ROM"); } else { } *global = 1; goto ldv_56729; case 536870912U: ; if ((int )print) { tmp___0 = par_num; par_num = par_num + 1; _print_next_block(tmp___0, "MCP UMP RX"); } else { } *global = 1; goto ldv_56729; case 1073741824U: ; if ((int )print) { tmp___1 = par_num; par_num = par_num + 1; _print_next_block(tmp___1, "MCP UMP TX"); } else { } *global = 1; goto ldv_56729; case 2147483648U: ; if ((int )print) { tmp___2 = par_num; par_num = par_num + 1; _print_next_block(tmp___2, "MCP SCPAD"); } else { } *global = 1; goto ldv_56729; } ldv_56729: sig = ~ cur_bit & sig; } else { } i = i + 1; ldv_56734: ; if (sig != 0U) { goto ldv_56733; } else { } return (par_num); } } static int bnx2x_check_blocks_with_parity4(u32 sig , int par_num , bool print ) { int i ; u32 cur_bit ; int tmp ; int tmp___0 ; { i = 0; cur_bit = 0U; i = 0; goto ldv_56747; ldv_56746: cur_bit = 1U << i; if ((sig & cur_bit) != 0U) { switch (cur_bit) { case 8U: ; if ((int )print) { tmp = par_num; par_num = par_num + 1; _print_next_block(tmp, "PGLUE_B"); } else { } goto ldv_56744; case 32U: ; if ((int )print) { tmp___0 = par_num; par_num = par_num + 1; _print_next_block(tmp___0, "ATC"); } else { } goto ldv_56744; } ldv_56744: sig = ~ cur_bit & sig; } else { } i = i + 1; ldv_56747: ; if (sig != 0U) { goto ldv_56746; } else { } return (par_num); } } static bool bnx2x_parity_attn(struct bnx2x *bp , bool *global , bool print , u32 *sig ) { int par_num ; long tmp ; { if (((((*sig & 1431568384U) != 0U || (*(sig + 1UL) & 1431655765U) != 0U) || (*(sig + 2UL) & 21845U) != 0U) || (*(sig + 3UL) & 4026531840U) != 0U) || (*(sig + 4UL) & 40U) != 0U) { par_num = 0; tmp = ldv__builtin_expect((bp->msg_enable & 8192) != 0, 0L); if (tmp != 0L) { printk("\rbnx2x: [%s:%d(%s)]Was parity error: HW block parity attention:\n[0]:0x%08x [1]:0x%08x [2]:0x%08x [3]:0x%08x [4]:0x%08x\n", "bnx2x_parity_attn", 4610, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", *sig & 1431568384U, *(sig + 1UL) & 1431655765U, *(sig + 2UL) & 21845U, *(sig + 3UL) & 4026531840U, *(sig + 4UL) & 40U); } else { } if ((int )print) { netdev_err((struct net_device const *)bp->dev, "Parity errors detected in blocks: "); } else { } par_num = bnx2x_check_blocks_with_parity0(*sig & 1431568384U, par_num, (int )print); par_num = bnx2x_check_blocks_with_parity1(*(sig + 1UL) & 1431655765U, par_num, global, (int )print); par_num = bnx2x_check_blocks_with_parity2(*(sig + 2UL) & 21845U, par_num, (int )print); par_num = bnx2x_check_blocks_with_parity3(*(sig + 3UL) & 4026531840U, par_num, global, (int )print); par_num = bnx2x_check_blocks_with_parity4(*(sig + 4UL) & 40U, par_num, (int )print); if ((int )print) { printk("\n"); } else { } return (1); } else { return (0); } } } bool bnx2x_chk_parity_attn(struct bnx2x *bp , bool *global , bool print ) { struct attn_route attn ; unsigned int tmp ; int port ; bool tmp___0 ; { attn.sig[0] = 0U; tmp = 1U; while (1) { if (tmp >= 5U) { break; } else { } attn.sig[tmp] = 0U; tmp = tmp + 1U; } port = (int )bp->pfid & 1; attn.sig[0] = readl((void const volatile *)bp->regview + (unsigned long )((port + 10507) * 4)); attn.sig[1] = readl((void const volatile *)bp->regview + (unsigned long )((port + 10510) * 4)); attn.sig[2] = readl((void const volatile *)bp->regview + (unsigned long )((port + 10513) * 4)); attn.sig[3] = readl((void const volatile *)bp->regview + (unsigned long )((port + 10516) * 4)); if (bp->common.chip_id >> 16 != 5710U && (bp->common.chip_id >> 16 != 5711U && bp->common.chip_id >> 16 != 5712U)) { attn.sig[4] = readl((void const volatile *)bp->regview + (unsigned long )((port + 10688) * 4)); } else { } tmp___0 = bnx2x_parity_attn(bp, global, (int )print, (u32 *)(& attn.sig)); return (tmp___0); } } static void bnx2x_attn_int_deasserted4(struct bnx2x *bp , u32 attn ) { u32 val ; { if ((attn & 4U) != 0U) { val = readl((void const volatile *)bp->regview + 37532U); printk("\vbnx2x: [%s:%d(%s)]PGLUE hw attention 0x%x\n", "bnx2x_attn_int_deasserted4", 4673, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", val); if ((int )val & 1) { printk("\vbnx2x: [%s:%d(%s)]PGLUE_B_PGLUE_B_INT_STS_REG_ADDRESS_ERROR\n", "bnx2x_attn_int_deasserted4", 4675, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } if ((val & 2U) != 0U) { printk("\vbnx2x: [%s:%d(%s)]PGLUE_B_PGLUE_B_INT_STS_REG_INCORRECT_RCV_BEHAVIOR\n", "bnx2x_attn_int_deasserted4", 4677, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } if ((val & 4U) != 0U) { printk("\vbnx2x: [%s:%d(%s)]PGLUE_B_PGLUE_B_INT_STS_REG_WAS_ERROR_ATTN\n", "bnx2x_attn_int_deasserted4", 4679, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } if ((val & 8U) != 0U) { printk("\vbnx2x: [%s:%d(%s)]PGLUE_B_PGLUE_B_INT_STS_REG_VF_LENGTH_VIOLATION_ATTN\n", "bnx2x_attn_int_deasserted4", 4681, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } if ((val & 16U) != 0U) { printk("\vbnx2x: [%s:%d(%s)]PGLUE_B_PGLUE_B_INT_STS_REG_VF_GRC_SPACE_VIOLATION_ATTN\n", "bnx2x_attn_int_deasserted4", 4684, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } if ((val & 32U) != 0U) { printk("\vbnx2x: [%s:%d(%s)]PGLUE_B_PGLUE_B_INT_STS_REG_VF_MSIX_BAR_VIOLATION_ATTN\n", "bnx2x_attn_int_deasserted4", 4687, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } if ((val & 64U) != 0U) { printk("\vbnx2x: [%s:%d(%s)]PGLUE_B_PGLUE_B_INT_STS_REG_TCPL_ERROR_ATTN\n", "bnx2x_attn_int_deasserted4", 4689, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } if ((val & 128U) != 0U) { printk("\vbnx2x: [%s:%d(%s)]PGLUE_B_PGLUE_B_INT_STS_REG_TCPL_IN_TWO_RCBS_ATTN\n", "bnx2x_attn_int_deasserted4", 4691, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } if ((val & 256U) != 0U) { printk("\vbnx2x: [%s:%d(%s)]PGLUE_B_PGLUE_B_INT_STS_REG_CSSNOOP_FIFO_OVERFLOW\n", "bnx2x_attn_int_deasserted4", 4693, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } } else { } if ((attn & 16U) != 0U) { val = readl((void const volatile *)bp->regview + 1114560U); printk("\vbnx2x: [%s:%d(%s)]ATC hw attention 0x%x\n", "bnx2x_attn_int_deasserted4", 4697, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", val); if ((int )val & 1) { printk("\vbnx2x: [%s:%d(%s)]ATC_ATC_INT_STS_REG_ADDRESS_ERROR\n", "bnx2x_attn_int_deasserted4", 4699, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } if ((val & 2U) != 0U) { printk("\vbnx2x: [%s:%d(%s)]ATC_ATC_INT_STS_REG_ATC_TCPL_TO_NOT_PEND\n", "bnx2x_attn_int_deasserted4", 4701, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } if ((val & 4U) != 0U) { printk("\vbnx2x: [%s:%d(%s)]ATC_ATC_INT_STS_REG_ATC_GPA_MULTIPLE_HITS\n", "bnx2x_attn_int_deasserted4", 4703, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } if ((val & 8U) != 0U) { printk("\vbnx2x: [%s:%d(%s)]ATC_ATC_INT_STS_REG_ATC_RCPL_TO_EMPTY_CNT\n", "bnx2x_attn_int_deasserted4", 4705, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } if ((val & 16U) != 0U) { printk("\vbnx2x: [%s:%d(%s)]ATC_ATC_INT_STS_REG_ATC_TCPL_ERROR\n", "bnx2x_attn_int_deasserted4", 4707, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } if ((val & 32U) != 0U) { printk("\vbnx2x: [%s:%d(%s)]ATC_ATC_INT_STS_REG_ATC_IREQ_LESS_THAN_STU\n", "bnx2x_attn_int_deasserted4", 4709, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } } else { } if ((attn & 40U) != 0U) { printk("\vbnx2x: [%s:%d(%s)]FATAL parity attention set4 0x%x\n", "bnx2x_attn_int_deasserted4", 4716, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", attn & 40U); } else { } return; } } static void bnx2x_attn_int_deasserted(struct bnx2x *bp , u32 deasserted ) { struct attn_route attn ; struct attn_route *group_mask ; int port ; int index ; u32 reg_addr ; u32 val ; u32 aeu_mask ; bool global ; bool tmp ; long tmp___0 ; long tmp___1 ; long tmp___2 ; long tmp___3 ; long tmp___4 ; long tmp___5 ; long tmp___6 ; { port = (int )bp->pfid & 1; global = 0; bnx2x_acquire_alr(bp); tmp = bnx2x_chk_parity_attn(bp, & global, 1); if ((int )tmp) { bp->recovery_state = 1; schedule_delayed_work(& bp->sp_rtnl_task, 0UL); bnx2x_int_disable(bp); bnx2x_release_alr(bp); return; } else { } attn.sig[0] = readl((void const volatile *)bp->regview + (unsigned long )((port + 10507) * 4)); attn.sig[1] = readl((void const volatile *)bp->regview + (unsigned long )((port + 10510) * 4)); attn.sig[2] = readl((void const volatile *)bp->regview + (unsigned long )((port + 10513) * 4)); attn.sig[3] = readl((void const volatile *)bp->regview + (unsigned long )((port + 10516) * 4)); if (bp->common.chip_id >> 16 != 5710U && (bp->common.chip_id >> 16 != 5711U && bp->common.chip_id >> 16 != 5712U)) { attn.sig[4] = readl((void const volatile *)bp->regview + (unsigned long )((port + 10688) * 4)); } else { attn.sig[4] = 0U; } tmp___0 = ldv__builtin_expect((bp->msg_enable & 8192) != 0, 0L); if (tmp___0 != 0L) { printk("\rbnx2x: [%s:%d(%s)]attn: %08x %08x %08x %08x %08x\n", "bnx2x_attn_int_deasserted", 4762, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", attn.sig[0], attn.sig[1], attn.sig[2], attn.sig[3], attn.sig[4]); } else { } index = 0; goto ldv_56784; ldv_56783: ; if (((u32 )(1 << index) & deasserted) != 0U) { group_mask = (struct attn_route *)(& bp->attn_group) + (unsigned long )index; tmp___1 = ldv__builtin_expect((bp->msg_enable & 8192) != 0, 0L); if (tmp___1 != 0L) { printk("\rbnx2x: [%s:%d(%s)]group[%d]: %08x %08x %08x %08x %08x\n", "bnx2x_attn_int_deasserted", 4772, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", index, group_mask->sig[0], group_mask->sig[1], group_mask->sig[2], group_mask->sig[3], group_mask->sig[4]); } else { } bnx2x_attn_int_deasserted4(bp, attn.sig[4] & group_mask->sig[4]); bnx2x_attn_int_deasserted3(bp, attn.sig[3] & group_mask->sig[3]); bnx2x_attn_int_deasserted1(bp, attn.sig[1] & group_mask->sig[1]); bnx2x_attn_int_deasserted2(bp, attn.sig[2] & group_mask->sig[2]); bnx2x_attn_int_deasserted0(bp, attn.sig[0] & group_mask->sig[0]); } else { } index = index + 1; ldv_56784: ; if (index <= 7) { goto ldv_56783; } else { } bnx2x_release_alr(bp); if ((unsigned int )bp->common.int_block == 0U) { reg_addr = (u32 )((port + 33804) * 32 + 16); } else { reg_addr = 4467984U; } val = ~ deasserted; tmp___2 = ldv__builtin_expect((bp->msg_enable & 8192) != 0, 0L); if (tmp___2 != 0L) { printk("\rbnx2x: [%s:%d(%s)]about to mask 0x%08x at %s addr 0x%x\n", "bnx2x_attn_int_deasserted", 4797, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", val, (unsigned int )bp->common.int_block == 0U ? (char *)"HC" : (char *)"IGU", reg_addr); } else { } writel(val, (void volatile *)bp->regview + (unsigned long )reg_addr); if ((~ bp->attn_state & deasserted) != 0U) { printk("\vbnx2x: [%s:%d(%s)]IGU ERROR\n", "bnx2x_attn_int_deasserted", 4801, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } reg_addr = port != 0 ? 41060U : 41056U; bnx2x_acquire_hw_lock(bp, (u32 )(port + 3)); aeu_mask = readl((void const volatile *)bp->regview + (unsigned long )reg_addr); tmp___3 = ldv__builtin_expect((bp->msg_enable & 8192) != 0, 0L); if (tmp___3 != 0L) { printk("\rbnx2x: [%s:%d(%s)]aeu_mask %x newly deasserted %x\n", "bnx2x_attn_int_deasserted", 4810, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", aeu_mask, deasserted); } else { } aeu_mask = (deasserted & 1023U) | aeu_mask; tmp___4 = ldv__builtin_expect((bp->msg_enable & 8192) != 0, 0L); if (tmp___4 != 0L) { printk("\rbnx2x: [%s:%d(%s)]new mask %x\n", "bnx2x_attn_int_deasserted", 4812, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", aeu_mask); } else { } writel(aeu_mask, (void volatile *)bp->regview + (unsigned long )reg_addr); bnx2x_release_hw_lock(bp, (u32 )(port + 3)); tmp___5 = ldv__builtin_expect((bp->msg_enable & 8192) != 0, 0L); if (tmp___5 != 0L) { printk("\rbnx2x: [%s:%d(%s)]attn_state %x\n", "bnx2x_attn_int_deasserted", 4817, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", bp->attn_state); } else { } bp->attn_state = bp->attn_state & ~ deasserted; tmp___6 = ldv__builtin_expect((bp->msg_enable & 8192) != 0, 0L); if (tmp___6 != 0L) { printk("\rbnx2x: [%s:%d(%s)]new state %x\n", "bnx2x_attn_int_deasserted", 4819, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", bp->attn_state); } else { } return; } } static void bnx2x_attn_int(struct bnx2x *bp ) { u32 attn_bits ; u32 attn_ack ; u32 attn_state ; u32 asserted ; u32 deasserted ; long tmp ; { attn_bits = (bp->def_status_blk)->atten_status_block.attn_bits; attn_ack = (bp->def_status_blk)->atten_status_block.attn_bits_ack; attn_state = bp->attn_state; asserted = (~ attn_ack & attn_bits) & ~ attn_state; deasserted = (~ attn_bits & attn_ack) & attn_state; tmp = ldv__builtin_expect((bp->msg_enable & 8192) != 0, 0L); if (tmp != 0L) { printk("\rbnx2x: [%s:%d(%s)]attn_bits %x attn_ack %x asserted %x deasserted %x\n", "bnx2x_attn_int", 4837, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", attn_bits, attn_ack, asserted, deasserted); } else { } if ((~ (attn_bits ^ attn_ack) & (attn_bits ^ attn_state)) != 0U) { printk("\vbnx2x: [%s:%d(%s)]BAD attention state\n", "bnx2x_attn_int", 4840, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } if (asserted != 0U) { bnx2x_attn_int_asserted(bp, asserted); } else { } if (deasserted != 0U) { bnx2x_attn_int_deasserted(bp, deasserted); } else { } return; } } void bnx2x_igu_ack_sb(struct bnx2x *bp , u8 igu_sb_id , u8 segment , u16 index , u8 op , u8 update ) { u32 igu_addr ; { igu_addr = bp->igu_base_addr; igu_addr = (u32 )(((int )igu_sb_id + 1024) * 8) + igu_addr; bnx2x_igu_ack_sb_gen(bp, (int )igu_sb_id, (int )segment, (int )index, (int )op, (int )update, igu_addr); return; } } static void bnx2x_update_eq_prod(struct bnx2x *bp , u16 prod ) { { storm_memset_eq_prod(bp, (int )prod, (int )bp->pfid); __asm__ volatile ("": : : "memory"); return; } } static int bnx2x_cnic_handle_cfc_del(struct bnx2x *bp , u32 cid , union event_ring_elem *elem ) { u8 err ; long tmp ; long tmp___0 ; { err = elem->message.error; if (bp->cnic_eth_dev.starting_cid == 0U || (bp->cnic_eth_dev.starting_cid > cid && (u32 )bp->cnic_eth_dev.iscsi_l2_cid != cid)) { return (1); } else { } tmp = ldv__builtin_expect((bp->msg_enable & 1048576) != 0, 0L); if (tmp != 0L) { printk("\rbnx2x: [%s:%d(%s)]got delete ramrod for CNIC CID %d\n", "bnx2x_cnic_handle_cfc_del", 4876, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", cid); } else { } tmp___0 = ldv__builtin_expect((unsigned int )err != 0U, 0L); if (tmp___0 != 0L) { printk("\vbnx2x: [%s:%d(%s)]got delete ramrod for CNIC CID %d with error!\n", "bnx2x_cnic_handle_cfc_del", 4881, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", cid); bnx2x_panic_dump(bp, 0); } else { } bnx2x_cnic_cfc_comp(bp, (int )cid, (int )err); return (0); } } static void bnx2x_handle_mcast_eqe(struct bnx2x *bp ) { struct bnx2x_mcast_ramrod_params rparam ; int rc ; bool tmp ; { memset((void *)(& rparam), 0, 40UL); rparam.mcast_obj = & bp->mcast_obj; netif_addr_lock_bh(bp->dev); (*(bp->mcast_obj.raw.clear_pending))(& bp->mcast_obj.raw); tmp = (*(bp->mcast_obj.check_pending))(& bp->mcast_obj); if ((int )tmp) { rc = bnx2x_config_mcast(bp, & rparam, 1); if (rc < 0) { printk("\vbnx2x: [%s:%d(%s)]Failed to send pending mcast commands: %d\n", "bnx2x_handle_mcast_eqe", 4907, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", rc); } else { } } else { } netif_addr_unlock_bh(bp->dev); return; } } static void bnx2x_handle_classification_eqe(struct bnx2x *bp , union event_ring_elem *elem ) { unsigned long ramrod_flags ; int rc ; u32 cid ; struct bnx2x_vlan_mac_obj *vlan_mac_obj ; long tmp ; long tmp___0 ; long tmp___1 ; { ramrod_flags = 0UL; rc = 0; cid = elem->message.data.eth_event.echo & 131071U; __set_bit(6, (unsigned long volatile *)(& ramrod_flags)); switch (elem->message.data.eth_event.echo >> 17) { case 0U: tmp = ldv__builtin_expect((bp->msg_enable & 1048576) != 0, 0L); if (tmp != 0L) { printk("\rbnx2x: [%s:%d(%s)]Got SETUP_MAC completions\n", "bnx2x_handle_classification_eqe", 4927, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } if ((int )bp->cnic_loaded && ((uint )bp->num_queues - bp->num_cnic_queues) * (uint )bp->max_cos == cid) { vlan_mac_obj = & bp->iscsi_l2_mac_obj; } else { vlan_mac_obj = & (bp->sp_objs + (unsigned long )cid)->mac_obj; } goto ldv_56831; case 9U: tmp___0 = ldv__builtin_expect((bp->msg_enable & 1048576) != 0, 0L); if (tmp___0 != 0L) { printk("\rbnx2x: [%s:%d(%s)]Got SETUP_MCAST completions\n", "bnx2x_handle_classification_eqe", 4935, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } bnx2x_handle_mcast_eqe(bp); return; default: printk("\vbnx2x: [%s:%d(%s)]Unsupported classification command: %d\n", "bnx2x_handle_classification_eqe", 4943, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", elem->message.data.eth_event.echo); return; } ldv_56831: rc = (*(vlan_mac_obj->complete))(bp, vlan_mac_obj, elem, & ramrod_flags); if (rc < 0) { printk("\vbnx2x: [%s:%d(%s)]Failed to schedule new commands: %d\n", "bnx2x_handle_classification_eqe", 4950, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", rc); } else if (rc > 0) { tmp___1 = ldv__builtin_expect((bp->msg_enable & 1048576) != 0, 0L); if (tmp___1 != 0L) { printk("\rbnx2x: [%s:%d(%s)]Scheduled next pending commands...\n", "bnx2x_handle_classification_eqe", 4952, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } } else { } return; } } static void bnx2x_set_iscsi_eth_rx_mode(struct bnx2x *bp , bool start ) ; static void bnx2x_handle_rx_mode_eqe(struct bnx2x *bp ) { int tmp ; int tmp___0 ; int tmp___1 ; { netif_addr_lock_bh(bp->dev); clear_bit(3, (unsigned long volatile *)(& bp->sp_state)); tmp___1 = test_and_clear_bit(4, (unsigned long volatile *)(& bp->sp_state)); if (tmp___1 != 0) { bnx2x_set_storm_rx_mode(bp); } else { tmp___0 = test_and_clear_bit(5, (unsigned long volatile *)(& bp->sp_state)); if (tmp___0 != 0) { bnx2x_set_iscsi_eth_rx_mode(bp, 1); } else { tmp = test_and_clear_bit(6, (unsigned long volatile *)(& bp->sp_state)); if (tmp != 0) { bnx2x_set_iscsi_eth_rx_mode(bp, 0); } else { } } } netif_addr_unlock_bh(bp->dev); return; } } static void bnx2x_after_afex_vif_lists(struct bnx2x *bp , union event_ring_elem *elem ) { long tmp ; long tmp___0 ; { if ((unsigned int )elem->message.data.vif_list_event.echo == 1U) { tmp = ldv__builtin_expect((bp->msg_enable & 1048576) != 0, 0L); if (tmp != 0L) { printk("\rbnx2x: [%s:%d(%s)]afex: ramrod completed VIF LIST_GET, addrs 0x%x\n", "bnx2x_after_afex_vif_lists", 4983, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )elem->message.data.vif_list_event.func_bit_map); } else { } bnx2x_fw_command(bp, 3506438144U, (u32 )elem->message.data.vif_list_event.func_bit_map); } else if ((unsigned int )elem->message.data.vif_list_event.echo == 0U) { tmp___0 = ldv__builtin_expect((bp->msg_enable & 1048576) != 0, 0L); if (tmp___0 != 0L) { printk("\rbnx2x: [%s:%d(%s)]afex: ramrod completed VIF LIST_SET\n", "bnx2x_after_afex_vif_lists", 4988, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } bnx2x_fw_command(bp, 3523215360U, 0U); } else { } return; } } static void bnx2x_after_function_update(struct bnx2x *bp ) { int q ; int rc ; struct bnx2x_fastpath *fp ; struct bnx2x_queue_state_params queue_params ; struct bnx2x_queue_update_params *q_update_params ; { queue_params.q_obj = 0; queue_params.cmd = 0; queue_params.ramrod_flags = 0UL; queue_params.params.setup.gen_params.stat_id = (unsigned char)0; queue_params.params.setup.gen_params.spcl_id = (unsigned char)0; queue_params.params.setup.gen_params.mtu = (unsigned short)0; queue_params.params.setup.gen_params.cos = (unsigned char)0; queue_params.params.setup.txq_params.dscr_map = 0ULL; queue_params.params.setup.txq_params.fw_sb_id = (unsigned char)0; queue_params.params.setup.txq_params.sb_cq_index = (unsigned char)0; queue_params.params.setup.txq_params.cos = (unsigned char)0; queue_params.params.setup.txq_params.traffic_type = (unsigned short)0; queue_params.params.setup.txq_params.tss_leading_cl_id = (unsigned char)0; queue_params.params.setup.txq_params.default_vlan = (unsigned short)0; queue_params.params.setup.rxq_params.dscr_map = 0ULL; queue_params.params.setup.rxq_params.sge_map = 0ULL; queue_params.params.setup.rxq_params.rcq_map = 0ULL; queue_params.params.setup.rxq_params.rcq_np_map = 0ULL; queue_params.params.setup.rxq_params.drop_flags = (unsigned short)0; queue_params.params.setup.rxq_params.buf_sz = (unsigned short)0; queue_params.params.setup.rxq_params.fw_sb_id = (unsigned char)0; queue_params.params.setup.rxq_params.cl_qzone_id = (unsigned char)0; queue_params.params.setup.rxq_params.tpa_agg_sz = (unsigned short)0; queue_params.params.setup.rxq_params.sge_buf_sz = (unsigned short)0; queue_params.params.setup.rxq_params.max_sges_pkt = (unsigned char)0; queue_params.params.setup.rxq_params.max_tpa_queues = (unsigned char)0; queue_params.params.setup.rxq_params.rss_engine_id = (unsigned char)0; queue_params.params.setup.rxq_params.mcast_engine_id = (unsigned char)0; queue_params.params.setup.rxq_params.cache_line_log = (unsigned char)0; queue_params.params.setup.rxq_params.sb_cq_index = (unsigned char)0; queue_params.params.setup.rxq_params.silent_removal_value = (unsigned short)0; queue_params.params.setup.rxq_params.silent_removal_mask = (unsigned short)0; queue_params.params.setup.pause_params.bd_th_lo = (unsigned short)0; queue_params.params.setup.pause_params.bd_th_hi = (unsigned short)0; queue_params.params.setup.pause_params.rcq_th_lo = (unsigned short)0; queue_params.params.setup.pause_params.rcq_th_hi = (unsigned short)0; queue_params.params.setup.pause_params.sge_th_lo = (unsigned short)0; queue_params.params.setup.pause_params.sge_th_hi = (unsigned short)0; queue_params.params.setup.pause_params.pri_map = (unsigned short)0; queue_params.params.setup.flags = 0UL; q_update_params = & queue_params.params.update; queue_params.cmd = 5; __set_bit(10, (unsigned long volatile *)(& q_update_params->update_flags)); __set_bit(11, (unsigned long volatile *)(& q_update_params->update_flags)); __set_bit(2, (unsigned long volatile *)(& queue_params.ramrod_flags)); if ((unsigned int )bp->afex_vlan_mode == 1U) { q_update_params->silent_removal_value = 0U; q_update_params->silent_removal_mask = 0U; } else { q_update_params->silent_removal_value = (unsigned int )((u16 )bp->afex_def_vlan_tag) & 4095U; q_update_params->silent_removal_mask = 4095U; } q = 0; goto ldv_56855; ldv_56854: fp = bp->fp + (unsigned long )q; queue_params.q_obj = & (bp->sp_objs + (unsigned long )fp->index)->q_obj; rc = bnx2x_queue_state_change(bp, & queue_params); if (rc < 0) { printk("\vbnx2x: [%s:%d(%s)]Failed to config silent vlan rem for Q %d\n", "bnx2x_after_function_update", 5031, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", q); } else { } q = q + 1; ldv_56855: ; if ((uint )q < bp->num_ethernet_queues) { goto ldv_56854; } else { } if ((bp->flags & 32768U) == 0U && (int )bp->cnic_enabled) { fp = bp->fp + (unsigned long )((uint )bp->num_queues - bp->num_cnic_queues); queue_params.q_obj = & (bp->sp_objs + (unsigned long )fp->index)->q_obj; __clear_bit(2, (unsigned long volatile *)(& queue_params.ramrod_flags)); __asm__ volatile ("": : : "memory"); set_bit(12U, (unsigned long volatile *)(& bp->sp_state)); __asm__ volatile ("": : : "memory"); rc = bnx2x_queue_state_change(bp, & queue_params); if (rc < 0) { printk("\vbnx2x: [%s:%d(%s)]Failed to config silent vlan rem for Q %d\n", "bnx2x_after_function_update", 5050, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", q); } else { } } else { bnx2x_link_report(bp); bnx2x_fw_command(bp, 3556769792U, 0U); } return; } } static struct bnx2x_queue_sp_obj *bnx2x_cid_to_q_obj(struct bnx2x *bp , u32 cid ) { long tmp ; { tmp = ldv__builtin_expect((bp->msg_enable & 1048576) != 0, 0L); if (tmp != 0L) { printk("\rbnx2x: [%s:%d(%s)]retrieving fp from cid %d\n", "bnx2x_cid_to_q_obj", 5061, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", cid); } else { } if ((int )bp->cnic_loaded && ((uint )bp->num_queues - bp->num_cnic_queues) * (uint )bp->max_cos + 1U == cid) { return (& (bp->sp_objs + (unsigned long )((uint )bp->num_queues - bp->num_cnic_queues))->q_obj); } else { return (& (bp->sp_objs + (unsigned long )(cid % ((uint )bp->num_queues - bp->num_cnic_queues)))->q_obj); } } } static void bnx2x_eq_int(struct bnx2x *bp ) { u16 hw_cons ; u16 sw_cons ; u16 sw_prod ; union event_ring_elem *elem ; u8 echo ; u32 cid ; u8 opcode ; int rc ; int spqe_cnt ; struct bnx2x_queue_sp_obj *q_obj ; struct bnx2x_func_sp_obj *f_obj ; struct bnx2x_raw_obj *rss_raw ; int tmp ; long tmp___0 ; long tmp___1 ; long tmp___2 ; u16 tmp___3 ; long tmp___4 ; long tmp___5 ; int tmp___6 ; int tmp___7 ; long tmp___8 ; int tmp___9 ; long tmp___10 ; int tmp___11 ; long tmp___12 ; int tmp___13 ; long tmp___14 ; long tmp___15 ; int tmp___16 ; long tmp___17 ; int tmp___18 ; long tmp___19 ; long tmp___20 ; long tmp___21 ; long tmp___22 ; { spqe_cnt = 0; f_obj = & bp->func_obj; rss_raw = & bp->rss_conf_obj.raw; hw_cons = *(bp->eq_cons_sb); if (((unsigned long )hw_cons & 255UL) == 255UL) { hw_cons = (u16 )((int )hw_cons + 1); } else { } sw_cons = bp->eq_cons; sw_prod = bp->eq_prod; tmp___0 = ldv__builtin_expect((bp->msg_enable & 1048576) != 0, 0L); if (tmp___0 != 0L) { tmp = atomic_read((atomic_t const *)(& bp->eq_spq_left)); printk("\rbnx2x: [%s:%d(%s)]EQ: hw_cons %u sw_cons %u bp->eq_spq_left %x\n", "bnx2x_eq_int", 5099, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )hw_cons, (int )sw_cons, tmp); } else { } goto ldv_56907; ldv_56906: elem = bp->eq_ring + ((unsigned long )sw_cons & 255UL); rc = bnx2x_iov_eq_sp_event(bp, elem); if (rc == 0) { tmp___1 = ldv__builtin_expect((bp->msg_enable & 8388608) != 0, 0L); if (tmp___1 != 0L) { printk("\rbnx2x: [%s:%d(%s)]bnx2x_iov_eq_sp_event returned %d\n", "bnx2x_eq_int", 5109, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", rc); } else { } goto next_spqe; } else { } cid = elem->message.data.cfc_del_event.cid & 131071U; opcode = elem->message.opcode; switch ((int )opcode) { case 0: tmp___2 = ldv__builtin_expect((bp->msg_enable & 8388608) != 0, 0L); if (tmp___2 != 0L) { printk("\rbnx2x: [%s:%d(%s)]vf pf channel element on eq\n", "bnx2x_eq_int", 5121, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } bnx2x_vf_mbx(bp, & elem->message.data.vf_pf_event); goto ldv_56880; case 5: tmp___4 = ldv__builtin_expect((bp->msg_enable & 1179648) != 0, 0L); if (tmp___4 != 0L) { tmp___3 = bp->stats_comp; bp->stats_comp = (u16 )((int )bp->stats_comp + 1); printk("\rbnx2x: [%s:%d(%s)]got statistics comp event %d\n", "bnx2x_eq_int", 5128, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )tmp___3); } else { } goto next_spqe; case 3: tmp___5 = ldv__builtin_expect((bp->msg_enable & 1048576) != 0, 0L); if (tmp___5 != 0L) { printk("\rbnx2x: [%s:%d(%s)]got delete ramrod for MULTI[%d]\n", "bnx2x_eq_int", 5139, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", cid); } else { } if ((int )bp->cnic_loaded) { tmp___6 = bnx2x_cnic_handle_cfc_del(bp, cid, elem); if (tmp___6 == 0) { goto next_spqe; } else { } } else { } q_obj = bnx2x_cid_to_q_obj(bp, cid); tmp___7 = (*(q_obj->complete_cmd))(bp, q_obj, 8); if (tmp___7 != 0) { goto ldv_56883; } else { } goto next_spqe; case 6: tmp___8 = ldv__builtin_expect((bp->msg_enable & 135266304) != 0, 0L); if (tmp___8 != 0L) { printk("\rbnx2x: [%s:%d(%s)]got STOP TRAFFIC\n", "bnx2x_eq_int", 5155, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } tmp___9 = (*(f_obj->complete_cmd))(bp, f_obj, 6); if (tmp___9 != 0) { goto ldv_56883; } else { } bnx2x_dcbx_set_params(bp, 2U); goto next_spqe; case 7: tmp___10 = ldv__builtin_expect((bp->msg_enable & 135266304) != 0, 0L); if (tmp___10 != 0L) { printk("\rbnx2x: [%s:%d(%s)]got START TRAFFIC\n", "bnx2x_eq_int", 5163, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } tmp___11 = (*(f_obj->complete_cmd))(bp, f_obj, 7); if (tmp___11 != 0) { goto ldv_56883; } else { } bnx2x_dcbx_set_params(bp, 3U); goto next_spqe; case 12: echo = elem->message.data.function_update_event.echo; if ((unsigned int )echo == 0U) { tmp___12 = ldv__builtin_expect((bp->msg_enable & 1048608) != 0, 0L); if (tmp___12 != 0L) { printk("\rbnx2x: [%s:%d(%s)]got FUNC_SWITCH_UPDATE ramrod\n", "bnx2x_eq_int", 5174, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } tmp___13 = (*(f_obj->complete_cmd))(bp, f_obj, 8); if (tmp___13 != 0) { goto ldv_56883; } else { } } else { tmp___14 = ldv__builtin_expect((bp->msg_enable & 1114112) != 0, 0L); if (tmp___14 != 0L) { printk("\rbnx2x: [%s:%d(%s)]AFEX: ramrod completed FUNCTION_UPDATE\n", "bnx2x_eq_int", 5181, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } (*(f_obj->complete_cmd))(bp, f_obj, 4); __asm__ volatile ("": : : "memory"); set_bit(3U, (unsigned long volatile *)(& bp->sp_rtnl_state)); __asm__ volatile ("": : : "memory"); schedule_delayed_work(& bp->sp_rtnl_task, 0UL); } goto next_spqe; case 13: (*(f_obj->complete_cmd))(bp, f_obj, 5); bnx2x_after_afex_vif_lists(bp, elem); goto next_spqe; case 1: tmp___15 = ldv__builtin_expect((bp->msg_enable & 1048608) != 0, 0L); if (tmp___15 != 0L) { printk("\rbnx2x: [%s:%d(%s)]got FUNC_START ramrod\n", "bnx2x_eq_int", 5206, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } tmp___16 = (*(f_obj->complete_cmd))(bp, f_obj, 1); if (tmp___16 != 0) { goto ldv_56883; } else { } goto next_spqe; case 2: tmp___17 = ldv__builtin_expect((bp->msg_enable & 1048608) != 0, 0L); if (tmp___17 != 0L) { printk("\rbnx2x: [%s:%d(%s)]got FUNC_STOP ramrod\n", "bnx2x_eq_int", 5214, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } tmp___18 = (*(f_obj->complete_cmd))(bp, f_obj, 2); if (tmp___18 != 0) { goto ldv_56883; } else { } goto next_spqe; } ldv_56883: ; switch ((int )opcode | (int )bp->state) { case 12299: ; case 8203: cid = elem->message.data.eth_event.echo & 131071U; tmp___19 = ldv__builtin_expect((bp->msg_enable & 1048576) != 0, 0L); if (tmp___19 != 0L) { printk("\rbnx2x: [%s:%d(%s)]got RSS_UPDATE ramrod. CID %d\n", "bnx2x_eq_int", 5229, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", cid); } else { } (*(rss_raw->clear_pending))(rss_raw); goto ldv_56892; case 12302: ; case 57358: ; case 16398: ; case 12303: ; case 57359: ; case 16399: tmp___20 = ldv__builtin_expect((bp->msg_enable & 1048576) != 0, 0L); if (tmp___20 != 0L) { printk("\rbnx2x: [%s:%d(%s)]got (un)set mac ramrod\n", "bnx2x_eq_int", 5243, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } bnx2x_handle_classification_eqe(bp, elem); goto ldv_56892; case 12305: ; case 57361: ; case 16401: tmp___21 = ldv__builtin_expect((bp->msg_enable & 1048576) != 0, 0L); if (tmp___21 != 0L) { printk("\rbnx2x: [%s:%d(%s)]got mcast ramrod\n", "bnx2x_eq_int", 5253, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } bnx2x_handle_mcast_eqe(bp); goto ldv_56892; case 12304: ; case 57360: ; case 16400: tmp___22 = ldv__builtin_expect((bp->msg_enable & 1048576) != 0, 0L); if (tmp___22 != 0L) { printk("\rbnx2x: [%s:%d(%s)]got rx_mode ramrod\n", "bnx2x_eq_int", 5263, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } bnx2x_handle_rx_mode_eqe(bp); goto ldv_56892; default: printk("\vbnx2x: [%s:%d(%s)]Unknown EQ event %d, bp->state 0x%x\n", "bnx2x_eq_int", 5269, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )elem->message.opcode, (int )bp->state); } ldv_56892: ; next_spqe: spqe_cnt = spqe_cnt + 1; ldv_56880: sw_prod = ((unsigned long )sw_prod & 255UL) == 254UL ? (unsigned int )sw_prod + 2U : (unsigned int )sw_prod + 1U; sw_cons = ((unsigned long )sw_cons & 255UL) == 254UL ? (unsigned int )sw_cons + 2U : (unsigned int )sw_cons + 1U; ldv_56907: ; if ((int )sw_cons != (int )hw_cons) { goto ldv_56906; } else { } __asm__ volatile ("": : : "memory"); atomic_add(spqe_cnt, & bp->eq_spq_left); bp->eq_cons = sw_cons; bp->eq_prod = sw_prod; __asm__ volatile ("": : : "memory"); bnx2x_update_eq_prod(bp, (int )bp->eq_prod); return; } } static void bnx2x_sp_task(struct work_struct *work ) { struct bnx2x *bp ; struct work_struct const *__mptr ; long tmp ; u16 status ; u16 tmp___0 ; long tmp___1 ; long tmp___2 ; struct bnx2x_fastpath *fp ; int tmp___3 ; bool tmp___4 ; long tmp___5 ; long tmp___6 ; int tmp___7 ; int tmp___8 ; { __mptr = (struct work_struct const *)work; bp = (struct bnx2x *)__mptr + 0xfffffffffffffcb0UL; tmp = ldv__builtin_expect((bp->msg_enable & 1048576) != 0, 0L); if (tmp != 0L) { printk("\rbnx2x: [%s:%d(%s)]sp task invoked\n", "bnx2x_sp_task", 5291, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } __asm__ volatile ("": : : "memory"); tmp___7 = atomic_read((atomic_t const *)(& bp->interrupt_occurred)); if (tmp___7 != 0) { tmp___0 = bnx2x_update_dsb_idx(bp); status = tmp___0; tmp___1 = ldv__builtin_expect((bp->msg_enable & 1048576) != 0, 0L); if (tmp___1 != 0L) { printk("\rbnx2x: [%s:%d(%s)]status %x\n", "bnx2x_sp_task", 5300, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )status); } else { } tmp___2 = ldv__builtin_expect((bp->msg_enable & 1048576) != 0, 0L); if (tmp___2 != 0L) { printk("\rbnx2x: [%s:%d(%s)]setting interrupt_occurred to 0\n", "bnx2x_sp_task", 5301, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } atomic_set(& bp->interrupt_occurred, 0); if ((int )status & 1) { bnx2x_attn_int(bp); status = (unsigned int )status & 65534U; } else { } if (((int )status & 2) != 0) { fp = bp->fp + (unsigned long )((uint )bp->num_queues - bp->num_cnic_queues); if ((int )bp->fcoe_init) { tmp___3 = bnx2x_has_rx_work(fp); if (tmp___3 != 0) { local_bh_disable(); napi_schedule(& (bp->fp + (unsigned long )((uint )bp->num_queues - bp->num_cnic_queues))->napi); local_bh_enable(); } else { tmp___4 = bnx2x_has_tx_work(fp); if ((int )tmp___4) { local_bh_disable(); napi_schedule(& (bp->fp + (unsigned long )((uint )bp->num_queues - bp->num_cnic_queues))->napi); local_bh_enable(); } else { } } } else { } bnx2x_eq_int(bp); bnx2x_ack_sb(bp, (int )bp->igu_dsb_id, 0, (int )bp->def_idx, 2, 1); status = (unsigned int )status & 65533U; } else { } tmp___6 = ldv__builtin_expect((unsigned int )status != 0U, 0L); if (tmp___6 != 0L) { tmp___5 = ldv__builtin_expect((bp->msg_enable & 1048576) != 0, 0L); if (tmp___5 != 0L) { printk("\rbnx2x: [%s:%d(%s)]got an unknown interrupt! (status 0x%x)\n", "bnx2x_sp_task", 5335, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )status); } else { } } else { } bnx2x_ack_sb(bp, (int )bp->igu_dsb_id, 4, (int )bp->def_att_idx, 0, 1); } else { } bnx2x_iov_sp_task(bp); tmp___8 = test_and_clear_bit(13, (unsigned long volatile *)(& bp->sp_state)); if (tmp___8 != 0) { bnx2x_link_report(bp); bnx2x_fw_command(bp, 3556769792U, 0U); } else { } return; } } irqreturn_t bnx2x_msix_sp_int(int irq , void *dev_instance ) { struct net_device *dev ; struct bnx2x *bp ; void *tmp ; struct cnic_ops *c_ops ; struct cnic_ops *_________p1 ; bool __warned ; int tmp___0 ; int tmp___1 ; { dev = (struct net_device *)dev_instance; tmp = netdev_priv((struct net_device const *)dev); bp = (struct bnx2x *)tmp; bnx2x_ack_sb(bp, (int )bp->igu_dsb_id, 0, 0, 1, 0); if ((int )bp->cnic_loaded) { rcu_read_lock(); _________p1 = *((struct cnic_ops * volatile *)(& bp->cnic_ops)); tmp___0 = debug_lockdep_rcu_enabled(); if (tmp___0 != 0 && ! __warned) { tmp___1 = rcu_read_lock_held(); if (tmp___1 == 0 && 1) { __warned = 1; lockdep_rcu_suspicious("/work/ldvuser/exper_fp/work/current--X--drivers--X--defaultlinux-3.10-rc1.tar--X--32_7a--X--cpachecker/linux-3.10-rc1.tar/csd_deg_dscv/8504/dscv_tempdir/dscv/ri/32_7a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c.prepared", 5375, "suspicious rcu_dereference_check() usage"); } else { } } else { } c_ops = _________p1; if ((unsigned long )c_ops != (unsigned long )((struct cnic_ops *)0)) { (*(c_ops->cnic_handler))(bp->cnic_data, 0); } else { } rcu_read_unlock(); } else { } bnx2x_schedule_sp_task(bp); return (1); } } void bnx2x_drv_pulse(struct bnx2x *bp ) { { writel((unsigned int )bp->fw_drv_pulse_wr_seq, (void volatile *)(bp->regview + (((unsigned long )bp->common.shmem_base + (unsigned long )(((int )bp->pfid & 1) + ((int )bp->pfid >> 1) * ((bp->common.chip_id >> 16 == 5710U || (bp->common.chip_id >> 16 == 5711U || bp->common.chip_id >> 16 == 5712U)) || (unsigned int )bp->common.chip_port_mode == 0U ? 2 : 1)) * 44UL) + 1684UL))); return; } } static void bnx2x_timer(unsigned long data ) { struct bnx2x *bp ; bool tmp ; int tmp___0 ; int mb_idx ; u32 drv_pulse ; u32 mcp_pulse ; unsigned int tmp___1 ; { bp = (struct bnx2x *)data; tmp = netif_running((struct net_device const *)bp->dev); if (tmp) { tmp___0 = 0; } else { tmp___0 = 1; } if (tmp___0) { return; } else { } if ((bp->flags & 4194304U) == 0U && (bp->flags & 512U) == 0U) { mb_idx = ((int )bp->pfid & 1) + ((int )bp->pfid >> 1) * ((bp->common.chip_id >> 16 == 5710U || (bp->common.chip_id >> 16 == 5711U || bp->common.chip_id >> 16 == 5712U)) || (unsigned int )bp->common.chip_port_mode == 0U ? 2 : 1); bp->fw_drv_pulse_wr_seq = (u16 )((int )bp->fw_drv_pulse_wr_seq + 1); bp->fw_drv_pulse_wr_seq = (unsigned int )bp->fw_drv_pulse_wr_seq & 32767U; drv_pulse = (u32 )bp->fw_drv_pulse_wr_seq; bnx2x_drv_pulse(bp); tmp___1 = readl((void const volatile *)(bp->regview + (((unsigned long )bp->common.shmem_base + (unsigned long )mb_idx * 44UL) + 1688UL))); mcp_pulse = tmp___1 & 32767U; if (drv_pulse != mcp_pulse && ((mcp_pulse + 1U) & 32767U) != drv_pulse) { printk("\vbnx2x: [%s:%d(%s)]drv_pulse (0x%x) != mcp_pulse (0x%x)\n", "bnx2x_timer", 5426, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", drv_pulse, mcp_pulse); } else { } } else { } if ((unsigned int )bp->state == 12288U) { bnx2x_stats_handle(bp, 2); } else { } if ((bp->flags & 4194304U) != 0U) { bnx2x_sample_bulletin(bp); } else { } mod_timer(& bp->timer, (unsigned long )bp->current_interval + (unsigned long )jiffies); return; } } static void bnx2x_fill(struct bnx2x *bp , u32 addr , int fill , u32 len ) { u32 i ; { if ((len & 3U) == 0U && (addr & 3U) == 0U) { i = 0U; goto ldv_56947; ldv_56946: writel((unsigned int )fill, (void volatile *)bp->regview + (unsigned long )(addr + i)); i = i + 4U; ldv_56947: ; if (i < len) { goto ldv_56946; } else { } } else { i = 0U; goto ldv_56950; ldv_56949: writeb((int )((unsigned char )fill), (void volatile *)bp->regview + (unsigned long )(addr + i)); i = i + 1U; ldv_56950: ; if (i < len) { goto ldv_56949; } else { } } return; } } static void bnx2x_wr_fp_sb_data(struct bnx2x *bp , int fw_sb_id , u32 *sb_data_p , u32 data_size ) { int index ; { index = 0; goto ldv_56960; ldv_56959: writel(*(sb_data_p + (unsigned long )index), (void volatile *)(bp->regview + ((unsigned long )(((unsigned int )(bp->iro_arr + 133UL)->base + (unsigned int )((int )(bp->iro_arr + 133UL)->m1 * fw_sb_id)) + 4259840U) + (unsigned long )index * 4UL))); index = index + 1; ldv_56960: ; if ((u32 )index < data_size) { goto ldv_56959; } else { } return; } } static void bnx2x_zero_fp_sb(struct bnx2x *bp , int fw_sb_id ) { u32 *sb_data_p ; u32 data_size ; struct hc_status_block_data_e2 sb_data_e2 ; struct hc_status_block_data_e1x sb_data_e1x ; { data_size = 0U; if (bp->common.chip_id >> 16 != 5710U && (bp->common.chip_id >> 16 != 5711U && bp->common.chip_id >> 16 != 5712U)) { memset((void *)(& sb_data_e2), 0, 64UL); sb_data_e2.common.state = 0U; sb_data_e2.common.p_func.vf_valid = 0U; sb_data_p = (u32 *)(& sb_data_e2); data_size = 16U; } else { memset((void *)(& sb_data_e1x), 0, 64UL); sb_data_e1x.common.state = 0U; sb_data_e1x.common.p_func.vf_valid = 0U; sb_data_p = (u32 *)(& sb_data_e1x); data_size = 16U; } bnx2x_wr_fp_sb_data(bp, fw_sb_id, sb_data_p, data_size); bnx2x_fill(bp, ((unsigned int )(bp->iro_arr + 132UL)->base + (unsigned int )((int )(bp->iro_arr + 132UL)->m1 * fw_sb_id)) + 4259840U, 0, (u32 )(bp->iro_arr + 132UL)->size); bnx2x_fill(bp, ((unsigned int )(bp->iro_arr + 137UL)->base + (unsigned int )((int )(bp->iro_arr + 137UL)->m1 * fw_sb_id)) + 4259840U, 0, (u32 )(bp->iro_arr + 137UL)->size); return; } } static void bnx2x_wr_sp_sb_data(struct bnx2x *bp , struct hc_sp_status_block_data *sp_sb_data ) { int func ; int i ; { func = (int )bp->pfid; i = 0; goto ldv_56977; ldv_56976: writel(*((u32 *)sp_sb_data + (unsigned long )i), (void volatile *)(bp->regview + ((unsigned long )(((unsigned int )(bp->iro_arr + 142UL)->base + (unsigned int )((int )(bp->iro_arr + 142UL)->m1 * func)) + 4259840U) + (unsigned long )i * 4UL))); i = i + 1; ldv_56977: ; if ((unsigned int )i <= 3U) { goto ldv_56976; } else { } return; } } static void bnx2x_zero_sp_sb(struct bnx2x *bp ) { int func ; struct hc_sp_status_block_data sp_sb_data ; { func = (int )bp->pfid; memset((void *)(& sp_sb_data), 0, 16UL); sp_sb_data.state = 0U; sp_sb_data.p_func.vf_valid = 0U; bnx2x_wr_sp_sb_data(bp, & sp_sb_data); bnx2x_fill(bp, ((unsigned int )(bp->iro_arr + 141UL)->base + (unsigned int )((int )(bp->iro_arr + 141UL)->m1 * func)) + 4259840U, 0, (u32 )(bp->iro_arr + 141UL)->size); bnx2x_fill(bp, ((unsigned int )(bp->iro_arr + 144UL)->base + (unsigned int )((int )(bp->iro_arr + 144UL)->m1 * func)) + 4259840U, 0, (u32 )(bp->iro_arr + 144UL)->size); return; } } static void bnx2x_setup_ndsb_state_machine(struct hc_status_block_sm *hc_sm , int igu_sb_id , int igu_seg_id ) { { hc_sm->igu_sb_id = (u8 )igu_sb_id; hc_sm->igu_seg_id = (u8 )igu_seg_id; hc_sm->timer_value = 255U; hc_sm->time_to_expire = 4294967295U; return; } } static void bnx2x_map_sb_state_machines(struct hc_index_data *index_data ) { { (index_data + 1UL)->flags = (unsigned int )(index_data + 1UL)->flags & 254U; (index_data + 4UL)->flags = (unsigned int )(index_data + 4UL)->flags & 254U; (index_data + 5UL)->flags = (unsigned int )(index_data + 5UL)->flags & 254U; (index_data + 6UL)->flags = (unsigned int )(index_data + 6UL)->flags & 254U; (index_data + 7UL)->flags = (unsigned int )(index_data + 7UL)->flags & 254U; (index_data + 1UL)->flags = (index_data + 1UL)->flags; (index_data + 4UL)->flags = (u8 )((unsigned int )(index_data + 4UL)->flags | 1U); (index_data + 5UL)->flags = (u8 )((unsigned int )(index_data + 5UL)->flags | 1U); (index_data + 6UL)->flags = (u8 )((unsigned int )(index_data + 6UL)->flags | 1U); (index_data + 7UL)->flags = (u8 )((unsigned int )(index_data + 7UL)->flags | 1U); return; } } void bnx2x_init_sb(struct bnx2x *bp , dma_addr_t mapping , int vfid , u8 vf_valid , int fw_sb_id , int igu_sb_id ) { int igu_seg_id ; struct hc_status_block_data_e2 sb_data_e2 ; struct hc_status_block_data_e1x sb_data_e1x ; struct hc_status_block_sm *hc_sm_p ; int data_size ; u32 *sb_data_p ; long tmp ; { if ((bp->common.chip_id >> 16 == 5710U || (bp->common.chip_id >> 16 == 5711U || bp->common.chip_id >> 16 == 5712U)) || ((int )bp->common.int_block & 2) != 0) { igu_seg_id = 0; } else { igu_seg_id = 0; } bnx2x_zero_fp_sb(bp, fw_sb_id); if (bp->common.chip_id >> 16 != 5710U && (bp->common.chip_id >> 16 != 5711U && bp->common.chip_id >> 16 != 5712U)) { memset((void *)(& sb_data_e2), 0, 64UL); sb_data_e2.common.state = 1U; sb_data_e2.common.p_func.pf_id = bp->pfid; sb_data_e2.common.p_func.vf_id = (u8 )vfid; sb_data_e2.common.p_func.vf_valid = vf_valid; sb_data_e2.common.p_func.vnic_id = (u8 )((int )bp->pfid >> 1); sb_data_e2.common.same_igu_sb_1b = 1U; sb_data_e2.common.host_sb_addr.hi = (unsigned int )(mapping >> 32); sb_data_e2.common.host_sb_addr.lo = (unsigned int )mapping; hc_sm_p = (struct hc_status_block_sm *)(& sb_data_e2.common.state_machine); sb_data_p = (u32 *)(& sb_data_e2); data_size = 16; bnx2x_map_sb_state_machines((struct hc_index_data *)(& sb_data_e2.index_data)); } else { memset((void *)(& sb_data_e1x), 0, 64UL); sb_data_e1x.common.state = 1U; sb_data_e1x.common.p_func.pf_id = bp->pfid; sb_data_e1x.common.p_func.vf_id = 255U; sb_data_e1x.common.p_func.vf_valid = 0U; sb_data_e1x.common.p_func.vnic_id = (u8 )((int )bp->pfid >> 1); sb_data_e1x.common.same_igu_sb_1b = 1U; sb_data_e1x.common.host_sb_addr.hi = (unsigned int )(mapping >> 32); sb_data_e1x.common.host_sb_addr.lo = (unsigned int )mapping; hc_sm_p = (struct hc_status_block_sm *)(& sb_data_e1x.common.state_machine); sb_data_p = (u32 *)(& sb_data_e1x); data_size = 16; bnx2x_map_sb_state_machines((struct hc_index_data *)(& sb_data_e1x.index_data)); } bnx2x_setup_ndsb_state_machine(hc_sm_p, igu_sb_id, igu_seg_id); bnx2x_setup_ndsb_state_machine(hc_sm_p + 1UL, igu_sb_id, igu_seg_id); tmp = ldv__builtin_expect((bp->msg_enable & 32) != 0, 0L); if (tmp != 0L) { printk("\rbnx2x: [%s:%d(%s)]Init FW SB %d\n", "bnx2x_init_sb", 5633, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", fw_sb_id); } else { } bnx2x_wr_fp_sb_data(bp, fw_sb_id, sb_data_p, (u32 )data_size); return; } } static void bnx2x_update_coalesce_sb(struct bnx2x *bp , u8 fw_sb_id , u16 tx_usec , u16 rx_usec ) { { bnx2x_update_coalesce_sb_index(bp, (int )fw_sb_id, 1, 0, (int )rx_usec); bnx2x_update_coalesce_sb_index(bp, (int )fw_sb_id, 5, 0, (int )tx_usec); bnx2x_update_coalesce_sb_index(bp, (int )fw_sb_id, 6, 0, (int )tx_usec); bnx2x_update_coalesce_sb_index(bp, (int )fw_sb_id, 7, 0, (int )tx_usec); return; } } static void bnx2x_init_def_sb(struct bnx2x *bp ) { struct host_sp_status_block *def_sb ; dma_addr_t mapping ; int igu_sp_sb_index ; int igu_seg_id ; int port ; int func ; int reg_offset ; int reg_offset_en5 ; u64 section ; int index ; struct hc_sp_status_block_data sp_sb_data ; int sindex ; { def_sb = bp->def_status_blk; mapping = bp->def_status_blk_mapping; port = (int )bp->pfid & 1; func = (int )bp->pfid; memset((void *)(& sp_sb_data), 0, 16UL); if ((bp->common.chip_id >> 16 == 5710U || (bp->common.chip_id >> 16 == 5711U || bp->common.chip_id >> 16 == 5712U)) || ((int )bp->common.int_block & 2) != 0) { igu_sp_sb_index = 16; igu_seg_id = 0; } else { igu_sp_sb_index = (int )bp->igu_dsb_id; igu_seg_id = 1; } section = mapping; def_sb->atten_status_block.status_block_id = (u8 )igu_sp_sb_index; bp->attn_state = 0U; reg_offset = port != 0 ? 41228 : 41068; reg_offset_en5 = port != 0 ? 42672 : 42632; index = 0; goto ldv_57032; ldv_57031: sindex = 0; goto ldv_57029; ldv_57028: bp->attn_group[index].sig[sindex] = readl((void const volatile *)bp->regview + (unsigned long )((index * 4 + sindex) * 4 + reg_offset)); sindex = sindex + 1; ldv_57029: ; if (sindex <= 3) { goto ldv_57028; } else { } if (bp->common.chip_id >> 16 != 5710U && (bp->common.chip_id >> 16 != 5711U && bp->common.chip_id >> 16 != 5712U)) { bp->attn_group[index].sig[4] = readl((void const volatile *)bp->regview + (unsigned long )(index * 4 + reg_offset_en5)); } else { bp->attn_group[index].sig[4] = 0U; } index = index + 1; ldv_57032: ; if (index <= 7) { goto ldv_57031; } else { } if ((unsigned int )bp->common.int_block == 0U) { reg_offset = port != 0 ? 1081376 : 1081368; writel((unsigned int )section, (void volatile *)bp->regview + (unsigned long )reg_offset); writel((unsigned int )(section >> 32), (void volatile *)(bp->regview + ((unsigned long )reg_offset + 4UL))); } else if (bp->common.chip_id >> 16 != 5710U && (bp->common.chip_id >> 16 != 5711U && bp->common.chip_id >> 16 != 5712U)) { writel((unsigned int )section, (void volatile *)bp->regview + 1245472U); writel((unsigned int )(section >> 32), (void volatile *)bp->regview + 1245468U); } else { } section = mapping + 16ULL; bnx2x_zero_sp_sb(bp); sp_sb_data.state = 1U; sp_sb_data.host_sb_addr.lo = (unsigned int )section; sp_sb_data.host_sb_addr.hi = (unsigned int )(section >> 32); sp_sb_data.igu_sb_id = (u8 )igu_sp_sb_index; sp_sb_data.igu_seg_id = (u8 )igu_seg_id; sp_sb_data.p_func.pf_id = (u8 )func; sp_sb_data.p_func.vnic_id = (u8 )((int )bp->pfid >> 1); sp_sb_data.p_func.vf_id = 255U; bnx2x_wr_sp_sb_data(bp, & sp_sb_data); bnx2x_ack_sb(bp, (int )bp->igu_dsb_id, 0, 0, 0, 0); return; } } void bnx2x_update_coalesce(struct bnx2x *bp ) { int i ; { i = 0; goto ldv_57039; ldv_57038: bnx2x_update_coalesce_sb(bp, (int )(bp->fp + (unsigned long )i)->fw_sb_id, (int )bp->tx_ticks, (int )bp->rx_ticks); i = i + 1; ldv_57039: ; if ((uint )i < bp->num_ethernet_queues) { goto ldv_57038; } else { } return; } } static void bnx2x_init_sp_ring(struct bnx2x *bp ) { struct lock_class_key __key ; { spinlock_check(& bp->spq_lock); __raw_spin_lock_init(& bp->spq_lock.ldv_6014.rlock, "&(&bp->spq_lock)->rlock", & __key); atomic_set(& bp->cq_spq_left, 8); bp->spq_prod_idx = 0U; bp->dsb_sp_prod = (__le16 *)(& (bp->def_status_blk)->sp_sb.index_values) + 3UL; bp->spq_prod_bd = bp->spq; bp->spq_last_bd = bp->spq_prod_bd + 255UL; return; } } static void bnx2x_init_eq_ring(struct bnx2x *bp ) { int i ; union event_ring_elem *elem ; int __min1 ; int __min2 ; { i = 1; goto ldv_57051; ldv_57050: elem = bp->eq_ring + ((unsigned long )i * 256UL + 0xffffffffffffffffUL); elem->next_page.addr.hi = (unsigned int )(bp->eq_mapping >> 32); elem->next_page.addr.lo = (unsigned int )bp->eq_mapping; i = i + 1; ldv_57051: ; if (i <= 1) { goto ldv_57050; } else { } bp->eq_cons = 0U; bp->eq_prod = 256U; bp->eq_cons_sb = (__le16 *)(& (bp->def_status_blk)->sp_sb.index_values) + 7UL; __min1 = 247; __min2 = 256; atomic_set(& bp->eq_spq_left, (__min1 < __min2 ? __min1 : __min2) + -1); return; } } int bnx2x_set_q_rx_mode(struct bnx2x *bp , u8 cl_id , unsigned long rx_mode_flags , unsigned long rx_accept_flags , unsigned long tx_accept_flags , unsigned long ramrod_flags ) { struct bnx2x_rx_mode_ramrod_params ramrod_param ; int rc ; { memset((void *)(& ramrod_param), 0, 80UL); ramrod_param.cid = 0U; ramrod_param.cl_id = cl_id; ramrod_param.rx_mode_obj = & bp->rx_mode_obj; ramrod_param.func_id = bp->pfid; ramrod_param.pstate = & bp->sp_state; ramrod_param.state = 3; ramrod_param.rdata = (void *)(& (bp->slowpath)->rx_mode_rdata); ramrod_param.rdata_mapping = bp->slowpath_mapping + 1032ULL; set_bit(3U, (unsigned long volatile *)(& bp->sp_state)); ramrod_param.ramrod_flags = ramrod_flags; ramrod_param.rx_mode_flags = rx_mode_flags; ramrod_param.rx_accept_flags = rx_accept_flags; ramrod_param.tx_accept_flags = tx_accept_flags; rc = bnx2x_config_rx_mode(bp, & ramrod_param); if (rc < 0) { printk("\vbnx2x: [%s:%d(%s)]Set rx_mode %d failed\n", "bnx2x_set_q_rx_mode", 5814, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", bp->rx_mode); return (rc); } else { } return (0); } } static int bnx2x_fill_accept_flags(struct bnx2x *bp , u32 rx_mode , unsigned long *rx_accept_flags , unsigned long *tx_accept_flags ) { { *rx_accept_flags = 0UL; *tx_accept_flags = 0UL; switch (rx_mode) { case 0U: ; goto ldv_57074; case 1U: __set_bit(0, (unsigned long volatile *)rx_accept_flags); __set_bit(1, (unsigned long volatile *)rx_accept_flags); __set_bit(4, (unsigned long volatile *)rx_accept_flags); __set_bit(0, (unsigned long volatile *)tx_accept_flags); __set_bit(1, (unsigned long volatile *)tx_accept_flags); __set_bit(4, (unsigned long volatile *)tx_accept_flags); goto ldv_57074; case 2U: __set_bit(0, (unsigned long volatile *)rx_accept_flags); __set_bit(3, (unsigned long volatile *)rx_accept_flags); __set_bit(4, (unsigned long volatile *)rx_accept_flags); __set_bit(0, (unsigned long volatile *)tx_accept_flags); __set_bit(3, (unsigned long volatile *)tx_accept_flags); __set_bit(4, (unsigned long volatile *)tx_accept_flags); goto ldv_57074; case 3U: __set_bit(5, (unsigned long volatile *)rx_accept_flags); __set_bit(0, (unsigned long volatile *)rx_accept_flags); __set_bit(3, (unsigned long volatile *)rx_accept_flags); __set_bit(4, (unsigned long volatile *)rx_accept_flags); __set_bit(3, (unsigned long volatile *)tx_accept_flags); __set_bit(4, (unsigned long volatile *)tx_accept_flags); if ((unsigned int )bp->mf_mode == 2U) { __set_bit(2, (unsigned long volatile *)tx_accept_flags); } else { __set_bit(0, (unsigned long volatile *)tx_accept_flags); } goto ldv_57074; default: printk("\vbnx2x: [%s:%d(%s)]Unknown rx_mode: %d\n", "bnx2x_fill_accept_flags", 5879, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", rx_mode); return (-22); } ldv_57074: ; if (bp->rx_mode != 0U) { __set_bit(6, (unsigned long volatile *)rx_accept_flags); __set_bit(6, (unsigned long volatile *)tx_accept_flags); } else { } return (0); } } int bnx2x_set_storm_rx_mode(struct bnx2x *bp ) { unsigned long rx_mode_flags ; unsigned long ramrod_flags ; unsigned long rx_accept_flags ; unsigned long tx_accept_flags ; int rc ; int tmp ; { rx_mode_flags = 0UL; ramrod_flags = 0UL; rx_accept_flags = 0UL; tx_accept_flags = 0UL; if ((bp->flags & 32768U) == 0U) { __set_bit(0, (unsigned long volatile *)(& rx_mode_flags)); } else { } rc = bnx2x_fill_accept_flags(bp, bp->rx_mode, & rx_accept_flags, & tx_accept_flags); if (rc != 0) { return (rc); } else { } __set_bit(1, (unsigned long volatile *)(& ramrod_flags)); __set_bit(0, (unsigned long volatile *)(& ramrod_flags)); tmp = bnx2x_set_q_rx_mode(bp, (int )(bp->fp)->cl_id, rx_mode_flags, rx_accept_flags, tx_accept_flags, ramrod_flags); return (tmp); } } static void bnx2x_init_internal_common(struct bnx2x *bp ) { int i ; { if ((unsigned int )bp->mf_mode == 2U) { writeb(2, (void volatile *)bp->regview + (unsigned long )((unsigned int )(bp->iro_arr + 204UL)->base + 4390912U)); } else if (bp->common.chip_id >> 16 != 5710U) { writeb(0, (void volatile *)bp->regview + (unsigned long )((unsigned int )(bp->iro_arr + 204UL)->base + 4390912U)); } else { } i = 0; goto ldv_57093; ldv_57092: writel(0U, (void volatile *)bp->regview + (unsigned long )(((unsigned int )(bp->iro_arr + 206UL)->base + (unsigned int )(i * 4)) + 4194304U)); i = i + 1; ldv_57093: ; if ((int )((unsigned short )(bp->iro_arr + 206UL)->size) >> 2 > i) { goto ldv_57092; } else { } if (bp->common.chip_id >> 16 != 5710U && (bp->common.chip_id >> 16 != 5711U && bp->common.chip_id >> 16 != 5712U)) { writeb((unsigned int )((unsigned char )((bp->common.chip_id >> 16 == 5710U || (bp->common.chip_id >> 16 == 5711U || bp->common.chip_id >> 16 == 5712U)) || ((int )bp->common.int_block & 2) != 0)) == 0U, (void volatile *)bp->regview + (unsigned long )((unsigned int )(bp->iro_arr + 157UL)->base + 4259840U)); } else { } return; } } static void bnx2x_init_internal(struct bnx2x *bp , u32 load_code ) { { switch (load_code) { case 269484032U: ; case 269680640U: bnx2x_init_internal_common(bp); case 269549568U: ; case 269615104U: ; goto ldv_57103; default: printk("\vbnx2x: [%s:%d(%s)]Unknown load_code (0x%x) from MCP\n", "bnx2x_init_internal", 5962, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", load_code); goto ldv_57103; } ldv_57103: ; return; } } __inline static u8 bnx2x_fp_igu_sb_id(struct bnx2x_fastpath *fp ) { { return (((int )(fp->bp)->igu_base_sb + (int )fp->index) + (int )(fp->bp)->cnic_support); } } __inline static u8 bnx2x_fp_fw_sb_id(struct bnx2x_fastpath *fp ) { { return (((int )((u8 )(fp->bp)->base_fw_ndsb) + (int )fp->index) + (int )(fp->bp)->cnic_support); } } static u8 bnx2x_fp_cl_id(struct bnx2x_fastpath *fp ) { u8 tmp ; { if ((fp->bp)->common.chip_id >> 16 == 5710U || ((fp->bp)->common.chip_id >> 16 == 5711U || (fp->bp)->common.chip_id >> 16 == 5712U)) { return (((int )((u8 )((int )(fp->bp)->pfid >> 1)) << 2U) + (int )fp->index); } else { tmp = bnx2x_fp_igu_sb_id(fp); return (tmp); } } } static void bnx2x_init_eth_fp(struct bnx2x *bp , int fp_idx ) { struct bnx2x_fastpath *fp ; u8 cos ; unsigned long q_type ; u32 cids[3U] ; unsigned int tmp ; long tmp___0 ; long tmp___1 ; { fp = bp->fp + (unsigned long )fp_idx; q_type = 0UL; cids[0] = 0U; tmp = 1U; while (1) { if (tmp >= 3U) { break; } else { } cids[tmp] = 0U; tmp = tmp + 1U; } fp->rx_queue = (u8 )fp_idx; fp->cid = (u32 )fp_idx; fp->cl_id = bnx2x_fp_cl_id(fp); fp->fw_sb_id = bnx2x_fp_fw_sb_id(fp); fp->igu_sb_id = bnx2x_fp_igu_sb_id(fp); fp->cl_qzone_id = bnx2x_fp_qzone_id(fp); fp->ustorm_rx_prods_offset = bnx2x_rx_ustorm_prods_offset(fp); fp->rx_cons_sb = fp->sb_index_values + 1UL; __set_bit(0, (unsigned long volatile *)(& q_type)); __set_bit(1, (unsigned long volatile *)(& q_type)); tmp___0 = ldv__builtin_expect((unsigned int )fp->max_cos > 3U, 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 *)"/work/ldvuser/exper_fp/work/current--X--drivers--X--defaultlinux-3.10-rc1.tar--X--32_7a--X--cpachecker/linux-3.10-rc1.tar/csd_deg_dscv/8504/dscv_tempdir/dscv/ri/32_7a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c.prepared"), "i" (6009), "i" (12UL)); ldv_57123: ; goto ldv_57123; } else { } cos = 0U; goto ldv_57125; ldv_57124: bnx2x_init_txdata(bp, fp->txdata_ptr[(int )cos], fp->cid + (uint )cos * ((uint )bp->num_queues - bp->num_cnic_queues), (int )((uint )fp->index + (uint )cos * ((uint )bp->num_queues - bp->num_cnic_queues)), fp->sb_index_values + ((unsigned long )cos + 5UL), fp); cids[(int )cos] = (fp->txdata_ptr[(int )cos])->cid; cos = (u8 )((int )cos + 1); ldv_57125: ; if ((int )fp->max_cos > (int )cos) { goto ldv_57124; } else { } if ((bp->flags & 4194304U) != 0U) { return; } else { } bnx2x_init_sb(bp, fp->status_blk_mapping, 255, 0, (int )fp->fw_sb_id, (int )fp->igu_sb_id); bnx2x_update_fpsb_idx(fp); bnx2x_init_queue_obj(bp, & (bp->sp_objs + (unsigned long )fp->index)->q_obj, (int )fp->cl_id, (u32 *)(& cids), (int )fp->max_cos, (int )bp->pfid, (void *)(& (bp->slowpath)->q_rdata), bp->slowpath_mapping + 2512ULL, q_type); bnx2x_init_vlan_mac_fp_objs(fp, 2); tmp___1 = ldv__builtin_expect((bp->msg_enable & 32) != 0, 0L); if (tmp___1 != 0L) { printk("\rbnx2x: [%s:%d(%s)]queue[%d]: bnx2x_init_sb(%p,%p) cl_id %d fw_sb %d igu_sb %d\n", "bnx2x_init_eth_fp", 6039, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", fp_idx, bp, fp->status_blk.e2_sb, (int )fp->cl_id, (int )fp->fw_sb_id, (int )fp->igu_sb_id); } else { } return; } } static void bnx2x_init_tx_ring_one(struct bnx2x_fp_txdata *txdata ) { int i ; struct eth_tx_next_bd *tx_next_bd ; { i = 1; goto ldv_57134; ldv_57133: tx_next_bd = & (txdata->tx_desc_ring + ((unsigned long )i * 256UL + 0xffffffffffffffffUL))->next_bd; tx_next_bd->addr_hi = (unsigned int )((txdata->tx_desc_mapping + (dma_addr_t )((i % 16) * 4096)) >> 32); tx_next_bd->addr_lo = (unsigned int )txdata->tx_desc_mapping + (unsigned int )((i % 16) * 4096); i = i + 1; ldv_57134: ; if (i <= 16) { goto ldv_57133; } else { } txdata->tx_db.data.header.header = (unsigned int )txdata->tx_db.data.header.header & 253U; txdata->tx_db.data.header.header = (u8 )((unsigned int )txdata->tx_db.data.header.header | 2U); txdata->tx_db.data.zero_fill1 = 0U; txdata->tx_db.data.prod = 0U; txdata->tx_pkt_prod = 0U; txdata->tx_pkt_cons = 0U; txdata->tx_bd_prod = 0U; txdata->tx_bd_cons = 0U; txdata->tx_pkt = 0UL; return; } } static void bnx2x_init_tx_rings_cnic(struct bnx2x *bp ) { int i ; { i = (int )bp->num_ethernet_queues; goto ldv_57142; ldv_57141: ; if ((bp->flags & 32768U) != 0U && (uint )i == (uint )bp->num_queues - bp->num_cnic_queues) { } else { bnx2x_init_tx_ring_one((bp->fp + (unsigned long )i)->txdata_ptr[0]); } i = i + 1; ldv_57142: ; if (bp->num_queues > i) { goto ldv_57141; } else { } return; } } static void bnx2x_init_tx_rings(struct bnx2x *bp ) { int i ; u8 cos ; { i = 0; goto ldv_57153; ldv_57152: cos = 0U; goto ldv_57150; ldv_57149: bnx2x_init_tx_ring_one((bp->fp + (unsigned long )i)->txdata_ptr[(int )cos]); cos = (u8 )((int )cos + 1); ldv_57150: ; if ((int )(bp->fp + (unsigned long )i)->max_cos > (int )cos) { goto ldv_57149; } else { } i = i + 1; ldv_57153: ; if ((uint )i < bp->num_ethernet_queues) { goto ldv_57152; } else { } return; } } void bnx2x_nic_init_cnic(struct bnx2x *bp ) { u8 tmp ; u8 tmp___0 ; { if ((bp->flags & 32768U) == 0U) { bnx2x_init_fcoe_fp(bp); } else { } tmp = bnx2x_cnic_igu_sb_id(bp); tmp___0 = bnx2x_cnic_fw_sb_id(bp); bnx2x_init_sb(bp, bp->cnic_sb_mapping, 255, 0, (int )tmp___0, (int )tmp); __asm__ volatile ("lfence": : : "memory"); bnx2x_init_rx_rings_cnic(bp); bnx2x_init_tx_rings_cnic(bp); __asm__ volatile ("mfence": : : "memory"); __asm__ volatile ("": : : "memory"); return; } } void bnx2x_pre_irq_nic_init(struct bnx2x *bp ) { int i ; { i = 0; goto ldv_57163; ldv_57162: bnx2x_init_eth_fp(bp, i); i = i + 1; ldv_57163: ; if ((uint )i < bp->num_ethernet_queues) { goto ldv_57162; } else { } __asm__ volatile ("lfence": : : "memory"); bnx2x_init_rx_rings(bp); bnx2x_init_tx_rings(bp); if ((bp->flags & 4194304U) != 0U) { bnx2x_memset_stats(bp); return; } else { } if ((bp->flags & 4194304U) == 0U) { bnx2x_init_mod_abs_int(bp, & bp->link_vars, bp->common.chip_id, bp->common.shmem_base, bp->common.shmem2_base, (int )bp->pfid & 1); bnx2x_init_def_sb(bp); bnx2x_update_dsb_idx(bp); bnx2x_init_sp_ring(bp); } else { } return; } } void bnx2x_post_irq_nic_init(struct bnx2x *bp , u32 load_code ) { unsigned int tmp ; { bnx2x_init_eq_ring(bp); bnx2x_init_internal(bp, load_code); bnx2x_pf_init(bp); bnx2x_stats_init(bp); __asm__ volatile ("mfence": : : "memory"); __asm__ volatile ("": : : "memory"); bnx2x_int_enable(bp); tmp = readl((void const volatile *)bp->regview + (unsigned long )((((int )bp->pfid & 1) + 10507) * 4)); bnx2x_attn_int_deasserted0(bp, tmp & 32768U); return; } } static int bnx2x_gunzip_init(struct bnx2x *bp ) { void *tmp ; int tmp___0 ; { bp->gunzip_buf = dma_alloc_attrs(& (bp->pdev)->dev, 32768UL, & bp->gunzip_mapping, 208U, 0); if ((unsigned long )bp->gunzip_buf == (unsigned long )((void *)0)) { goto gunzip_nomem1; } else { } tmp = kmalloc(96UL, 208U); bp->strm = (struct z_stream_s *)tmp; if ((unsigned long )bp->strm == (unsigned long )((struct z_stream_s *)0)) { goto gunzip_nomem2; } else { } tmp___0 = zlib_inflate_workspacesize(); (bp->strm)->workspace = vmalloc((unsigned long )tmp___0); if ((unsigned long )(bp->strm)->workspace == (unsigned long )((void *)0)) { goto gunzip_nomem3; } else { } return (0); gunzip_nomem3: kfree((void const *)bp->strm); bp->strm = 0; gunzip_nomem2: dma_free_attrs(& (bp->pdev)->dev, 32768UL, bp->gunzip_buf, bp->gunzip_mapping, 0); bp->gunzip_buf = 0; gunzip_nomem1: printk("\vbnx2x: [%s:%d(%s)]Cannot allocate firmware buffer for un-compression\n", "bnx2x_gunzip_init", 6183, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); return (-12); } } static void bnx2x_gunzip_end(struct bnx2x *bp ) { { if ((unsigned long )bp->strm != (unsigned long )((struct z_stream_s *)0)) { vfree((void const *)(bp->strm)->workspace); kfree((void const *)bp->strm); bp->strm = 0; } else { } if ((unsigned long )bp->gunzip_buf != (unsigned long )((void *)0)) { dma_free_attrs(& (bp->pdev)->dev, 32768UL, bp->gunzip_buf, bp->gunzip_mapping, 0); bp->gunzip_buf = 0; } else { } return; } } static int bnx2x_gunzip(struct bnx2x *bp , u8 const *zbuf , int len ) { int n ; int rc ; int tmp ; { if (((unsigned int )((unsigned char )*zbuf) != 31U || (unsigned int )((unsigned char )*(zbuf + 1UL)) != 139U) || (unsigned int )((unsigned char )*(zbuf + 2UL)) != 8U) { printk("\vbnx2x: [%s:%d(%s)]Bad gzip header\n", "bnx2x_gunzip", 6208, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); return (-22); } else { } n = 10; if (((int )*(zbuf + 3UL) & 8) != 0) { goto ldv_57188; ldv_57187: ; ldv_57188: tmp = n; n = n + 1; if ((unsigned int )((unsigned char )*(zbuf + (unsigned long )tmp)) != 0U && n < len) { goto ldv_57187; } else { } } else { } (bp->strm)->next_in = zbuf + (unsigned long )n; (bp->strm)->avail_in = (uInt )(len - n); (bp->strm)->next_out = (Byte *)bp->gunzip_buf; (bp->strm)->avail_out = 32768U; rc = zlib_inflateInit2(bp->strm, -15); if (rc != 0) { return (rc); } else { } rc = zlib_inflate(bp->strm, 5); if (rc != 0 && rc != 1) { netdev_err((struct net_device const *)bp->dev, "Firmware decompression error: %s\n", (bp->strm)->msg); } else { } bp->gunzip_outlen = (int )(32768U - (bp->strm)->avail_out); if ((bp->gunzip_outlen & 3) != 0) { netdev_err((struct net_device const *)bp->dev, "Firmware decompression error: gunzip_outlen (%d) not aligned\n", bp->gunzip_outlen); } else { } bp->gunzip_outlen = bp->gunzip_outlen >> 2; zlib_inflateEnd(bp->strm); if (rc == 1) { return (0); } else { } return (rc); } } static void bnx2x_lb_pckt(struct bnx2x *bp ) { u32 wb_write[3U] ; size_t __len ; void *__ret ; size_t __len___0 ; void *__ret___0 ; { wb_write[0] = 1431655765U; wb_write[1] = 1431655765U; wb_write[2] = 32U; __len = 12UL; if (__len > 63UL) { __ret = __memcpy((void *)(& (bp->slowpath)->wb_data), (void const *)(& wb_write), __len); } else { __ret = __builtin_memcpy((void *)(& (bp->slowpath)->wb_data), (void const *)(& wb_write), __len); } bnx2x_write_dmae(bp, bp->slowpath_mapping + 4392ULL, 67584U, 3U); wb_write[0] = 150994944U; wb_write[1] = 1431655765U; wb_write[2] = 16U; __len___0 = 12UL; if (__len___0 > 63UL) { __ret___0 = __memcpy((void *)(& (bp->slowpath)->wb_data), (void const *)(& wb_write), __len___0); } else { __ret___0 = __builtin_memcpy((void *)(& (bp->slowpath)->wb_data), (void const *)(& wb_write), __len___0); } bnx2x_write_dmae(bp, bp->slowpath_mapping + 4392ULL, 67584U, 3U); return; } } static int bnx2x_int_mem_test(struct bnx2x *bp ) { int factor ; int count ; int i ; u32 val ; long tmp ; long tmp___0 ; { val = 0U; if ((bp->common.chip_id & 61440U) > 20480U && (bp->common.chip_id & 4096U) != 0U) { factor = 120; } else if ((bp->common.chip_id & 61440U) > 20480U && (bp->common.chip_id & 4096U) == 0U) { factor = 200; } else { factor = 1; } writel(0U, (void volatile *)bp->regview + 270904U); writel(0U, (void volatile *)bp->regview + 327712U); writel(1U, (void volatile *)bp->regview + 1065040U); writel(0U, (void volatile *)bp->regview + 65720U); writel(0U, (void volatile *)bp->regview + 262428U); bnx2x_lb_pckt(bp); count = factor * 1000; goto ldv_57209; ldv_57208: bnx2x_read_dmae(bp, 67552U, 2U); val = *((u32 *)(& (bp->slowpath)->wb_data)); if (val == 16U) { goto ldv_57207; } else { } msleep(10U); count = count - 1; ldv_57209: ; if (count != 0) { goto ldv_57208; } else { } ldv_57207: ; if (val != 16U) { printk("\vbnx2x: [%s:%d(%s)]NIG timeout val = 0x%x\n", "bnx2x_int_mem_test", 6315, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", val); return (-1); } else { } count = factor * 1000; goto ldv_57213; ldv_57212: val = readl((void const volatile *)bp->regview + 262436U); if (val == 1U) { goto ldv_57211; } else { } msleep(10U); count = count - 1; ldv_57213: ; if (count != 0) { goto ldv_57212; } else { } ldv_57211: ; if (val != 1U) { printk("\vbnx2x: [%s:%d(%s)]PRS timeout val = 0x%x\n", "bnx2x_int_mem_test", 6330, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", val); return (-2); } else { } writel(3U, (void volatile *)bp->regview + 42376U); msleep(50U); writel(3U, (void volatile *)bp->regview + 42372U); msleep(50U); bnx2x_init_block(bp, 1U, 0U); bnx2x_init_block(bp, 16U, 0U); tmp = ldv__builtin_expect((bp->msg_enable & 8192) != 0, 0L); if (tmp != 0L) { printk("\rbnx2x: [%s:%d(%s)]part2\n", "bnx2x_int_mem_test", 6342, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } writel(0U, (void volatile *)bp->regview + 270904U); writel(0U, (void volatile *)bp->regview + 327712U); writel(1U, (void volatile *)bp->regview + 1065040U); writel(0U, (void volatile *)bp->regview + 65720U); writel(0U, (void volatile *)bp->regview + 262428U); i = 0; goto ldv_57215; ldv_57214: bnx2x_lb_pckt(bp); i = i + 1; ldv_57215: ; if (i <= 9) { goto ldv_57214; } else { } count = factor * 1000; goto ldv_57219; ldv_57218: bnx2x_read_dmae(bp, 67552U, 2U); val = *((u32 *)(& (bp->slowpath)->wb_data)); if (val == 176U) { goto ldv_57217; } else { } msleep(10U); count = count - 1; ldv_57219: ; if (count != 0) { goto ldv_57218; } else { } ldv_57217: ; if (val != 176U) { printk("\vbnx2x: [%s:%d(%s)]NIG timeout val = 0x%x\n", "bnx2x_int_mem_test", 6371, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", val); return (-3); } else { } val = readl((void const volatile *)bp->regview + 262436U); if (val != 2U) { printk("\vbnx2x: [%s:%d(%s)]PRS timeout val = 0x%x\n", "bnx2x_int_mem_test", 6378, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", val); } else { } writel(1U, (void volatile *)bp->regview + 262428U); msleep((unsigned int )(factor * 10)); val = readl((void const volatile *)bp->regview + 262436U); if (val != 3U) { printk("\vbnx2x: [%s:%d(%s)]PRS timeout val = 0x%x\n", "bnx2x_int_mem_test", 6388, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", val); } else { } i = 0; goto ldv_57221; ldv_57220: readl((void const volatile *)bp->regview + 66788U); i = i + 1; ldv_57221: ; if (i <= 10) { goto ldv_57220; } else { } val = readl((void const volatile *)bp->regview + 66784U); if (val != 1U) { printk("\vbnx2x: [%s:%d(%s)]clear of NIG failed\n", "bnx2x_int_mem_test", 6395, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); return (-4); } else { } writel(3U, (void volatile *)bp->regview + 42376U); msleep(50U); writel(3U, (void volatile *)bp->regview + 42372U); msleep(50U); bnx2x_init_block(bp, 1U, 0U); bnx2x_init_block(bp, 16U, 0U); if ((unsigned int )bp->cnic_support == 0U) { writel(1U, (void volatile *)bp->regview + 262456U); } else { } writel(2147483647U, (void volatile *)bp->regview + 270904U); writel(1U, (void volatile *)bp->regview + 327712U); writel(0U, (void volatile *)bp->regview + 1065040U); writel(1U, (void volatile *)bp->regview + 65720U); tmp___0 = ldv__builtin_expect((bp->msg_enable & 8192) != 0, 0L); if (tmp___0 != 0L) { printk("\rbnx2x: [%s:%d(%s)]done\n", "bnx2x_int_mem_test", 6416, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } return (0); } } static void bnx2x_enable_blocks_attention(struct bnx2x *bp ) { u32 val ; { writel(0U, (void volatile *)bp->regview + 1060980U); if (bp->common.chip_id >> 16 != 5710U && (bp->common.chip_id >> 16 != 5711U && bp->common.chip_id >> 16 != 5712U)) { writel(64U, (void volatile *)bp->regview + 1060996U); } else { writel(0U, (void volatile *)bp->regview + 1060996U); } writel(0U, (void volatile *)bp->regview + 1507712U); writel(0U, (void volatile *)bp->regview + 1065224U); writel(64512U, (void volatile *)bp->regview + 393512U); writel(0U, (void volatile *)bp->regview + 1475652U); writel(0U, (void volatile *)bp->regview + 1458428U); writel(0U, (void volatile *)bp->regview + 1467036U); writel(0U, (void volatile *)bp->regview + 1467052U); writel(0U, (void volatile *)bp->regview + 131764U); writel(0U, (void volatile *)bp->regview + 803488U); writel(0U, (void volatile *)bp->regview + 803504U); writel(0U, (void volatile *)bp->regview + 917972U); writel(0U, (void volatile *)bp->regview + 790568U); writel(0U, (void volatile *)bp->regview + 795292U); writel(0U, (void volatile *)bp->regview + 795308U); writel(0U, (void volatile *)bp->regview + 852452U); val = 5767168U; if (bp->common.chip_id >> 16 != 5710U && (bp->common.chip_id >> 16 != 5711U && bp->common.chip_id >> 16 != 5712U)) { val = val | 25165824U; } else { } writel(val, (void volatile *)bp->regview + 1181048U); writel(0U, (void volatile *)bp->regview + 271004U); writel(0U, (void volatile *)bp->regview + 271020U); writel(0U, (void volatile *)bp->regview + 328156U); if (bp->common.chip_id >> 16 != 5710U && (bp->common.chip_id >> 16 != 5711U && bp->common.chip_id >> 16 != 5712U)) { writel(2047U, (void volatile *)bp->regview + 1573136U); } else { } writel(0U, (void volatile *)bp->regview + 1052732U); writel(0U, (void volatile *)bp->regview + 1056852U); writel(24U, (void volatile *)bp->regview + 1311188U); return; } } static void bnx2x_reset_common(struct bnx2x *bp ) { u32 val ; { val = 5120U; writel(3556769663U, (void volatile *)bp->regview + 42376U); if (((((((((bp->common.chip_id >> 16 == 5770U || bp->common.chip_id >> 16 == 5797U) || bp->common.chip_id >> 16 == 5801U) || bp->common.chip_id >> 16 == 5774U) || bp->common.chip_id >> 16 == 5806U) || bp->common.chip_id >> 16 == 5807U) || ((bp->common.chip_id >> 16 == 5693U || bp->common.chip_id >> 16 == 5694U) || bp->common.chip_id >> 16 == 5695U)) || ((bp->common.chip_id >> 16 == 5793U || bp->common.chip_id >> 16 == 5794U) || bp->common.chip_id >> 16 == 5773U)) || (bp->common.chip_id >> 16 == 5796U || bp->common.chip_id >> 16 == 5803U)) || bp->common.chip_id >> 16 == 5805U) { val = val | 16777216U; val = val | 33554432U; } else { } writel(val, (void volatile *)bp->regview + 42392U); return; } } static void bnx2x_setup_dmae(struct bnx2x *bp ) { struct lock_class_key __key ; { bp->dmae_ready = 0; spinlock_check(& bp->dmae_lock); __raw_spin_lock_init(& bp->dmae_lock.ldv_6014.rlock, "&(&bp->dmae_lock)->rlock", & __key); return; } } static void bnx2x_init_pxp(struct bnx2x *bp ) { u16 devctl ; int r_order ; int w_order ; long tmp ; long tmp___0 ; { pcie_capability_read_word(bp->pdev, 8, & devctl); tmp = ldv__builtin_expect((bp->msg_enable & 8192) != 0, 0L); if (tmp != 0L) { printk("\rbnx2x: [%s:%d(%s)]read 0x%x from devctl\n", "bnx2x_init_pxp", 6509, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )devctl); } else { } w_order = ((int )devctl & 224) >> 5; if (bp->mrrs == -1) { r_order = ((int )devctl & 28672) >> 12; } else { tmp___0 = ldv__builtin_expect((bp->msg_enable & 8192) != 0, 0L); if (tmp___0 != 0L) { printk("\rbnx2x: [%s:%d(%s)]force read order to %d\n", "bnx2x_init_pxp", 6514, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", bp->mrrs); } else { } r_order = bp->mrrs; } bnx2x_init_pxp_arb(bp, r_order, w_order); return; } } static void bnx2x_setup_fan_failure_detection(struct bnx2x *bp ) { int is_required ; u32 val ; int port ; unsigned int tmp ; u8 tmp___0 ; long tmp___1 ; { if ((bp->flags & 512U) != 0U) { return; } else { } is_required = 0; tmp = readl((void const volatile *)(bp->regview + ((unsigned long )bp->common.shmem_base + 32UL))); val = tmp & 1572864U; if (val == 1048576U) { is_required = 1; } else if (val == 0U) { port = 0; goto ldv_57249; ldv_57248: tmp___0 = bnx2x_fan_failure_det_req(bp, bp->common.shmem_base, bp->common.shmem2_base, (int )((u8 )port)); is_required = (int )tmp___0 | is_required; port = port + 1; ldv_57249: ; if (port <= 1) { goto ldv_57248; } else { } } else { } tmp___1 = ldv__builtin_expect((bp->msg_enable & 8192) != 0, 0L); if (tmp___1 != 0L) { printk("\rbnx2x: [%s:%d(%s)]fan detection setting: %d\n", "bnx2x_setup_fan_failure_detection", 6552, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", is_required); } else { } if (is_required == 0) { return; } else { } bnx2x_set_spio(bp, 32, 2U); val = readl((void const volatile *)bp->regview + 42240U); val = val | 2097152U; writel(val, (void volatile *)bp->regview + 42240U); val = readl((void const volatile *)bp->regview + 41656U); val = val | 32U; writel(val, (void volatile *)bp->regview + 41656U); return; } } void bnx2x_pf_disable(struct bnx2x *bp ) { u32 val ; unsigned int tmp ; { tmp = readl((void const volatile *)bp->regview + 1245524U); val = tmp; val = val & 4294967294U; writel(val, (void volatile *)bp->regview + 1245524U); writel(0U, (void volatile *)bp->regview + 37932U); writel(0U, (void volatile *)bp->regview + 1065252U); return; } } static void bnx2x__common_init_phy(struct bnx2x *bp ) { u32 shmem_base[2U] ; u32 shmem2_base[2U] ; unsigned int tmp ; { tmp = readl((void const volatile *)bp->regview + (unsigned long )bp->common.shmem2_base); if (tmp > (unsigned int )(((unsigned long )bp->pfid & 1UL) + 79UL) * 4U) { return; } else { } shmem_base[0] = bp->common.shmem_base; shmem2_base[0] = bp->common.shmem2_base; if (bp->common.chip_id >> 16 != 5710U && (bp->common.chip_id >> 16 != 5711U && bp->common.chip_id >> 16 != 5712U)) { shmem_base[1] = readl((void const volatile *)(bp->regview + ((unsigned long )bp->common.shmem2_base + 52UL))); shmem2_base[1] = readl((void const volatile *)(bp->regview + ((unsigned long )bp->common.shmem2_base + 56UL))); } else { } bnx2x_acquire_phy_lock(bp); bnx2x_common_init_phy(bp, (u32 *)(& shmem_base), (u32 *)(& shmem2_base), bp->common.chip_id); bnx2x_release_phy_lock(bp); return; } } static int bnx2x_init_hw_common(struct bnx2x *bp ) { u32 val ; long tmp ; u8 abs_func_id ; struct ilt_client_info ilt_cli ; struct bnx2x_ilt ilt ; int _min1 ; int _min2 ; int _min1___0 ; int _min2___0 ; int factor ; int tmp___0 ; int tmp___1 ; { tmp = ldv__builtin_expect((bp->msg_enable & 8192) != 0, 0L); if (tmp != 0L) { printk("\rbnx2x: [%s:%d(%s)]starting common init func %d\n", "bnx2x_init_hw_common", 6611, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )bp->pf_num); } else { } bnx2x_acquire_hw_lock(bp, 5U); bnx2x_reset_common(bp); writel(4294967295U, (void volatile *)bp->regview + 42372U); val = 65532U; if (((((((((bp->common.chip_id >> 16 == 5770U || bp->common.chip_id >> 16 == 5797U) || bp->common.chip_id >> 16 == 5801U) || bp->common.chip_id >> 16 == 5774U) || bp->common.chip_id >> 16 == 5806U) || bp->common.chip_id >> 16 == 5807U) || ((bp->common.chip_id >> 16 == 5693U || bp->common.chip_id >> 16 == 5694U) || bp->common.chip_id >> 16 == 5695U)) || ((bp->common.chip_id >> 16 == 5793U || bp->common.chip_id >> 16 == 5794U) || bp->common.chip_id >> 16 == 5773U)) || (bp->common.chip_id >> 16 == 5796U || bp->common.chip_id >> 16 == 5803U)) || bp->common.chip_id >> 16 == 5805U) { val = val | 16777216U; val = val | 33554432U; } else { } writel(val, (void volatile *)bp->regview + 42388U); bnx2x_release_hw_lock(bp, 5U); bnx2x_init_block(bp, 12U, 0U); if (bp->common.chip_id >> 16 != 5710U && (bp->common.chip_id >> 16 != 5711U && bp->common.chip_id >> 16 != 5712U)) { abs_func_id = bp->common.chip_id >> 16 != 5710U && (bp->common.chip_id >> 16 != 5711U && bp->common.chip_id >> 16 != 5712U) ? (unsigned int )bp->pf_num & 1U : 0U; goto ldv_57269; ldv_57268: ; if ((int )bp->pf_num == (int )abs_func_id) { writel(1U, (void volatile *)bp->regview + 37932U); goto ldv_57267; } else { } bnx2x_pretend_func(bp, (int )abs_func_id); bnx2x_pf_disable(bp); bnx2x_pretend_func(bp, (int )bp->pf_num); ldv_57267: abs_func_id = (unsigned int )abs_func_id + 2U; ldv_57269: ; if ((unsigned int )abs_func_id <= 7U) { goto ldv_57268; } else { } } else { } bnx2x_init_block(bp, 18U, 0U); if (bp->common.chip_id >> 16 == 5710U) { writel(0U, (void volatile *)bp->regview + 1060980U); } else { } bnx2x_init_block(bp, 17U, 0U); bnx2x_init_pxp(bp); bnx2x_ilt_init_page_size(bp, 0); if (((bp->common.chip_id & 61440U) > 20480U && (bp->common.chip_id & 4096U) != 0U) && (bp->common.chip_id >> 16 == 5711U || bp->common.chip_id >> 16 == 5712U)) { writel(1U, (void volatile *)bp->regview + 1181096U); } else { } msleep(100U); val = readl((void const volatile *)bp->regview + 1180084U); if (val != 1U) { printk("\vbnx2x: [%s:%d(%s)]PXP2 CFG failed\n", "bnx2x_init_hw_common", 6695, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); return (-16); } else { } val = readl((void const volatile *)bp->regview + 1180528U); if (val != 1U) { printk("\vbnx2x: [%s:%d(%s)]PXP2 RD_INIT failed\n", "bnx2x_init_hw_common", 6700, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); return (-16); } else { } if (bp->common.chip_id >> 16 != 5710U && (bp->common.chip_id >> 16 != 5711U && bp->common.chip_id >> 16 != 5712U)) { memset((void *)(& ilt_cli), 0, 12UL); memset((void *)(& ilt), 0, 64UL); ilt_cli.start = 0U; ilt_cli.end = 3071U; ilt_cli.client_num = 3U; bnx2x_pretend_func(bp, bp->common.chip_id >> 16 != 5710U && (bp->common.chip_id >> 16 != 5711U && bp->common.chip_id >> 16 != 5712U) ? (int )(((unsigned int )((u16 )bp->pf_num) & 1U) + 6U) : 6); bnx2x_ilt_client_init_op_ilt(bp, & ilt, & ilt_cli, 1); bnx2x_pretend_func(bp, (int )bp->pf_num); _min1 = 8; _min2 = 6; writel((unsigned int )((_min1 < _min2 ? _min1 : _min2) + -5), (void volatile *)bp->regview + 1181104U); _min1___0 = 8; _min2___0 = 6; writel((unsigned int )((_min1___0 < _min2___0 ? _min1___0 : _min2___0) + -5), (void volatile *)bp->regview + 1181996U); writel(1U, (void volatile *)bp->regview + 1182000U); } else { } writel(0U, (void volatile *)bp->regview + 1180464U); writel(0U, (void volatile *)bp->regview + 1180532U); if (bp->common.chip_id >> 16 != 5710U && (bp->common.chip_id >> 16 != 5711U && bp->common.chip_id >> 16 != 5712U)) { factor = (bp->common.chip_id & 61440U) <= 20480U || (bp->common.chip_id & 4096U) != 0U ? ((bp->common.chip_id & 61440U) > 20480U && (bp->common.chip_id & 4096U) != 0U ? 400 : 0) : 1000; bnx2x_init_block(bp, 15U, 0U); bnx2x_init_block(bp, 0U, 0U); ldv_57280: msleep(200U); val = readl((void const volatile *)bp->regview + 1114300U); tmp___0 = factor; factor = factor - 1; if (tmp___0 != 0 && val != 1U) { goto ldv_57280; } else { } if (val != 1U) { printk("\vbnx2x: [%s:%d(%s)]ATC_INIT failed\n", "bnx2x_init_hw_common", 6819, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); return (-16); } else { } } else { } bnx2x_init_block(bp, 8U, 0U); bnx2x_iov_init_dmae(bp); bp->dmae_ready = 1; bnx2x_init_fill(bp, 1835008U, 0, 8U, 1); bnx2x_init_block(bp, 21U, 0U); bnx2x_init_block(bp, 25U, 0U); bnx2x_init_block(bp, 2U, 0U); bnx2x_init_block(bp, 29U, 0U); bnx2x_read_dmae(bp, 2629632U, 3U); bnx2x_read_dmae(bp, 2105344U, 3U); bnx2x_read_dmae(bp, 1576960U, 3U); bnx2x_read_dmae(bp, 3153920U, 3U); bnx2x_init_block(bp, 19U, 0U); bnx2x_qm_init_ptr_table(bp, bp->qm_cid_count, 0); writel(1U, (void volatile *)bp->regview + 1475624U); writel(0U, (void volatile *)bp->regview + 1475624U); if ((unsigned int )bp->cnic_support != 0U) { bnx2x_init_block(bp, 22U, 0U); } else { } bnx2x_init_block(bp, 9U, 0U); writel(7U, (void volatile *)bp->regview + 1507376U); if ((bp->common.chip_id & 61440U) <= 20480U) { writel(0U, (void volatile *)bp->regview + 1507712U); } else { } bnx2x_init_block(bp, 1U, 0U); bnx2x_init_block(bp, 16U, 0U); writel(15U, (void volatile *)bp->regview + 262452U); if (bp->common.chip_id >> 16 != 5710U) { writel(bp->path_has_ovlan, (void volatile *)bp->regview + 262600U); } else { } if ((bp->common.chip_id >> 16 != 5710U && (bp->common.chip_id >> 16 != 5711U && bp->common.chip_id >> 16 != 5712U)) && ((((((((((bp->common.chip_id >> 16 != 5770U && bp->common.chip_id >> 16 != 5797U) && bp->common.chip_id >> 16 != 5801U) && bp->common.chip_id >> 16 != 5774U) && bp->common.chip_id >> 16 != 5806U) && bp->common.chip_id >> 16 != 5807U) && ((bp->common.chip_id >> 16 != 5693U && bp->common.chip_id >> 16 != 5694U) && bp->common.chip_id >> 16 != 5695U)) && ((bp->common.chip_id >> 16 != 5793U && bp->common.chip_id >> 16 != 5794U) && bp->common.chip_id >> 16 != 5773U)) && (bp->common.chip_id >> 16 != 5796U && bp->common.chip_id >> 16 != 5803U)) && bp->common.chip_id >> 16 != 5805U) || ((bp->common.chip_id & 61440U) > 20480U ? ((~ bp->common.chip_id & 61440U) >> 13) << 12 != 4096U : (bp->common.chip_id & 61440U) != 4096U))) { if ((unsigned int )bp->mf_mode == 3U) { writel(14U, (void volatile *)bp->regview + 262712U); writel(10U, (void volatile *)bp->regview + 262740U); writel(6U, (void volatile *)bp->regview + 262728U); writel(35110U, (void volatile *)bp->regview + 262612U); writel(4U, (void volatile *)bp->regview + 262700U); } else { writel(bp->path_has_ovlan != 0U ? 7U : 6U, (void volatile *)bp->regview + 262712U); } } else { } bnx2x_init_block(bp, 23U, 0U); bnx2x_init_block(bp, 5U, 0U); bnx2x_init_block(bp, 27U, 0U); bnx2x_init_block(bp, 31U, 0U); if (bp->common.chip_id >> 16 != 5710U && (bp->common.chip_id >> 16 != 5711U && bp->common.chip_id >> 16 != 5712U)) { writel(3U, (void volatile *)bp->regview + 1807420U); writel(3U, (void volatile *)bp->regview + 2855996U); msleep(20U); } else { } bnx2x_init_block(bp, 24U, 0U); bnx2x_init_block(bp, 28U, 0U); bnx2x_init_block(bp, 6U, 0U); bnx2x_init_block(bp, 32U, 0U); writel(2147483648U, (void volatile *)bp->regview + 42376U); writel(2147483648U, (void volatile *)bp->regview + 42372U); bnx2x_init_block(bp, 26U, 0U); bnx2x_init_block(bp, 30U, 0U); bnx2x_init_block(bp, 14U, 0U); if (bp->common.chip_id >> 16 != 5710U && (bp->common.chip_id >> 16 != 5711U && bp->common.chip_id >> 16 != 5712U)) { if ((unsigned int )bp->mf_mode == 3U) { writel(14U, (void volatile *)bp->regview + 1425576U); writel(10U, (void volatile *)bp->regview + 1425604U); writel(6U, (void volatile *)bp->regview + 1425592U); writel(35110U, (void volatile *)bp->regview + 1425552U); writel(4U, (void volatile *)bp->regview + 1425564U); } else { writel(bp->path_has_ovlan != 0U ? 7U : 6U, (void volatile *)bp->regview + 1425576U); } } else { } writel(1U, (void volatile *)bp->regview + 263324U); bnx2x_init_block(bp, 20U, 0U); if ((unsigned int )bp->cnic_support != 0U) { writel(1663587954U, (void volatile *)bp->regview + 263256U); writel(616100556U, (void volatile *)bp->regview + 263260U); writel(574287771U, (void volatile *)bp->regview + 263264U); writel(637541946U, (void volatile *)bp->regview + 263268U); writel(2062094614U, (void volatile *)bp->regview + 263272U); writel(1558520587U, (void volatile *)bp->regview + 263276U); writel(697141983U, (void volatile *)bp->regview + 263280U); writel(1857093385U, (void volatile *)bp->regview + 263284U); writel(405862447U, (void volatile *)bp->regview + 263288U); writel(31747047U, (void volatile *)bp->regview + 263292U); } else { } writel(0U, (void volatile *)bp->regview + 263324U); bnx2x_init_block(bp, 3U, 0U); val = 67109888U; writel(val, (void volatile *)bp->regview + 1052704U); bnx2x_init_block(bp, 4U, 0U); writel(2047U, (void volatile *)bp->regview + 1065036U); writel(0U, (void volatile *)bp->regview + 1065224U); writel(537001984U, (void volatile *)bp->regview + 1065040U); bnx2x_init_block(bp, 10U, 0U); if ((bp->common.chip_id >> 16 != 5710U && (bp->common.chip_id >> 16 != 5711U && bp->common.chip_id >> 16 != 5712U)) && (bp->flags & 512U) != 0U) { writel(54U, (void volatile *)bp->regview + 1245528U); } else { } bnx2x_init_block(bp, 11U, 0U); bnx2x_init_block(bp, 33U, 0U); writel(4294967295U, (void volatile *)bp->regview + 10260U); writel(4294967295U, (void volatile *)bp->regview + 14368U); if (bp->common.chip_id >> 16 != 5710U && (bp->common.chip_id >> 16 != 5711U && bp->common.chip_id >> 16 != 5712U)) { writel(262400U, (void volatile *)bp->regview + 10260U); writel(268697856U, (void volatile *)bp->regview + 10324U); writel(268697856U, (void volatile *)bp->regview + 10332U); } else { } bnx2x_init_block(bp, 13U, 0U); if (bp->common.chip_id >> 16 != 5710U) { if (((((((((bp->common.chip_id >> 16 != 5770U && bp->common.chip_id >> 16 != 5797U) && bp->common.chip_id >> 16 != 5801U) && bp->common.chip_id >> 16 != 5774U) && bp->common.chip_id >> 16 != 5806U) && bp->common.chip_id >> 16 != 5807U) && ((bp->common.chip_id >> 16 != 5693U && bp->common.chip_id >> 16 != 5694U) && bp->common.chip_id >> 16 != 5695U)) && ((bp->common.chip_id >> 16 != 5793U && bp->common.chip_id >> 16 != 5794U) && bp->common.chip_id >> 16 != 5773U)) && (bp->common.chip_id >> 16 != 5796U && bp->common.chip_id >> 16 != 5803U)) && bp->common.chip_id >> 16 != 5805U) { writel((unsigned int )bp->mf_mode != 0U, (void volatile *)bp->regview + 90148U); } else { } } else { } if (bp->common.chip_id >> 16 == 5711U || bp->common.chip_id >> 16 == 5712U) { writel((unsigned int )bp->mf_mode == 1U, (void volatile *)bp->regview + 90328U); } else { } if ((bp->common.chip_id & 61440U) > 20480U) { msleep(200U); } else { } val = reg_poll(bp, 1065076U, 1U, 100, 10); if (val != 1U) { printk("\vbnx2x: [%s:%d(%s)]CFC LL_INIT failed\n", "bnx2x_init_hw_common", 7017, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); return (-16); } else { } val = reg_poll(bp, 1065080U, 1U, 100, 10); if (val != 1U) { printk("\vbnx2x: [%s:%d(%s)]CFC AC_INIT failed\n", "bnx2x_init_hw_common", 7022, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); return (-16); } else { } val = reg_poll(bp, 1065084U, 1U, 100, 10); if (val != 1U) { printk("\vbnx2x: [%s:%d(%s)]CFC CAM_INIT failed\n", "bnx2x_init_hw_common", 7027, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); return (-16); } else { } writel(0U, (void volatile *)bp->regview + 1065040U); if (bp->common.chip_id >> 16 == 5710U) { bnx2x_read_dmae(bp, 67552U, 2U); val = *((u32 *)(& (bp->slowpath)->wb_data)); if (val == 0U) { tmp___1 = bnx2x_int_mem_test(bp); if (tmp___1 != 0) { printk("\vbnx2x: [%s:%d(%s)]internal mem self test failed\n", "bnx2x_init_hw_common", 7040, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); return (-16); } else { } } else { } } else { } bnx2x_setup_fan_failure_detection(bp); readl((void const volatile *)bp->regview + 1181040U); bnx2x_enable_blocks_attention(bp); bnx2x_enable_blocks_parity(bp); if ((bp->flags & 512U) == 0U) { if (bp->common.chip_id >> 16 == 5710U || (bp->common.chip_id >> 16 == 5711U || bp->common.chip_id >> 16 == 5712U)) { bnx2x__common_init_phy(bp); } else { } } else { printk("\vbnx2x: [%s:%d(%s)]Bootcode is missing - can not initialize link\n", "bnx2x_init_hw_common", 7057, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } return (0); } } static int bnx2x_init_hw_common_chip(struct bnx2x *bp ) { int rc ; int tmp ; { tmp = bnx2x_init_hw_common(bp); rc = tmp; if (rc != 0) { return (rc); } else { } if ((bp->flags & 512U) == 0U) { bnx2x__common_init_phy(bp); } else { } return (0); } } static int bnx2x_init_hw_port(struct bnx2x *bp ) { int port ; int init_phase ; u32 low ; u32 high ; u32 val ; long tmp ; u32 reg_addr ; { port = (int )bp->pfid & 1; init_phase = port != 0 ? 2 : 1; tmp = ldv__builtin_expect((bp->msg_enable & 8192) != 0, 0L); if (tmp != 0L) { printk("\rbnx2x: [%s:%d(%s)]starting port init port %d\n", "bnx2x_init_hw_port", 7089, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", port); } else { } writel(0U, (void volatile *)bp->regview + (unsigned long )((port + 16588) * 4)); bnx2x_init_block(bp, 12U, (u32 )init_phase); bnx2x_init_block(bp, 18U, (u32 )init_phase); bnx2x_init_block(bp, 17U, (u32 )init_phase); if (bp->common.chip_id >> 16 != 5710U && (bp->common.chip_id >> 16 != 5711U && bp->common.chip_id >> 16 != 5712U)) { writel(1U, (void volatile *)bp->regview + 37932U); } else { } bnx2x_init_block(bp, 0U, (u32 )init_phase); bnx2x_init_block(bp, 8U, (u32 )init_phase); bnx2x_init_block(bp, 15U, (u32 )init_phase); bnx2x_init_block(bp, 19U, (u32 )init_phase); bnx2x_init_block(bp, 21U, (u32 )init_phase); bnx2x_init_block(bp, 25U, (u32 )init_phase); bnx2x_init_block(bp, 2U, (u32 )init_phase); bnx2x_init_block(bp, 29U, (u32 )init_phase); bnx2x_qm_init_cid_count(bp, bp->qm_cid_count, 0); if ((unsigned int )bp->cnic_support != 0U) { bnx2x_init_block(bp, 22U, (u32 )init_phase); writel(20U, (void volatile *)bp->regview + (unsigned long )((port + 364559) * 4)); writel(31U, (void volatile *)bp->regview + (unsigned long )((port + 364562) * 4)); } else { } bnx2x_init_block(bp, 9U, (u32 )init_phase); bnx2x_init_block(bp, 1U, (u32 )init_phase); if (bp->common.chip_id >> 16 == 5710U || (bp->common.chip_id >> 16 == 5711U || bp->common.chip_id >> 16 == 5712U)) { if ((unsigned int )bp->mf_mode != 0U) { low = (bp->flags & 4U) != 0U ? 160U : 246U; } else if ((bp->dev)->mtu > 4096U) { if ((bp->flags & 4U) != 0U) { low = 160U; } else { val = (bp->dev)->mtu; low = (val / 64U + ((val & 63U) != 0U ? 1U : 0U)) + 96U; } } else { low = (bp->flags & 4U) != 0U ? 80U : 160U; } high = low + 56U; writel(low, (void volatile *)bp->regview + (unsigned long )((port + 98330) * 4)); writel(high, (void volatile *)bp->regview + (unsigned long )((port + 98334) * 4)); } else { } if ((unsigned int )bp->common.chip_port_mode == 0U) { writel(40U, (void volatile *)(bp->regview + ((int )bp->pfid & 1 ? 393792UL : 393704UL))); } else { } bnx2x_init_block(bp, 16U, (u32 )init_phase); if ((((((((((bp->common.chip_id >> 16 == 5770U || bp->common.chip_id >> 16 == 5797U) || bp->common.chip_id >> 16 == 5801U) || bp->common.chip_id >> 16 == 5774U) || bp->common.chip_id >> 16 == 5806U) || bp->common.chip_id >> 16 == 5807U) || ((bp->common.chip_id >> 16 == 5693U || bp->common.chip_id >> 16 == 5694U) || bp->common.chip_id >> 16 == 5695U)) || ((bp->common.chip_id >> 16 == 5793U || bp->common.chip_id >> 16 == 5794U) || bp->common.chip_id >> 16 == 5773U)) || (bp->common.chip_id >> 16 == 5796U || bp->common.chip_id >> 16 == 5803U)) || bp->common.chip_id >> 16 == 5805U) && ((bp->common.chip_id & 61440U) > 20480U ? ((~ bp->common.chip_id & 61440U) >> 13) << 12 == 4096U : (bp->common.chip_id & 61440U) == 4096U)) { if ((unsigned int )bp->mf_mode == 3U) { writel(14U, (void volatile *)(bp->regview + ((int )bp->pfid & 1 ? 262800UL : 262768UL))); writel(6U, (void volatile *)(bp->regview + ((int )bp->pfid & 1 ? 262816UL : 262784UL))); writel(10U, (void volatile *)(bp->regview + ((int )bp->pfid & 1 ? 262828UL : 262796UL))); } else { writel(bp->path_has_ovlan != 0U ? 7U : 6U, (void volatile *)(bp->regview + ((int )bp->pfid & 1 ? 262800UL : 262768UL))); } } else { } bnx2x_init_block(bp, 23U, (u32 )init_phase); bnx2x_init_block(bp, 5U, (u32 )init_phase); bnx2x_init_block(bp, 27U, (u32 )init_phase); bnx2x_init_block(bp, 31U, (u32 )init_phase); bnx2x_init_block(bp, 24U, (u32 )init_phase); bnx2x_init_block(bp, 28U, (u32 )init_phase); bnx2x_init_block(bp, 6U, (u32 )init_phase); bnx2x_init_block(bp, 32U, (u32 )init_phase); bnx2x_init_block(bp, 26U, (u32 )init_phase); bnx2x_init_block(bp, 30U, (u32 )init_phase); bnx2x_init_block(bp, 14U, (u32 )init_phase); if (bp->common.chip_id >> 16 == 5710U || (bp->common.chip_id >> 16 == 5711U || bp->common.chip_id >> 16 == 5712U)) { writel(0U, (void volatile *)bp->regview + (unsigned long )((port + 327685) * 4)); writel(565U, (void volatile *)bp->regview + (unsigned long )((port + 327737) * 4)); writel(1096U, (void volatile *)bp->regview + (unsigned long )((port + 327732) * 4)); writel(1U, (void volatile *)bp->regview + (unsigned long )((port + 327681) * 4)); __const_udelay(214750UL); writel(0U, (void volatile *)bp->regview + (unsigned long )((port + 327681) * 4)); } else { } if ((unsigned int )bp->cnic_support != 0U) { bnx2x_init_block(bp, 20U, (u32 )init_phase); } else { } bnx2x_init_block(bp, 3U, (u32 )init_phase); bnx2x_init_block(bp, 4U, (u32 )init_phase); if (bp->common.chip_id >> 16 == 5710U) { writel(0U, (void volatile *)bp->regview + (unsigned long )((port + 135176) * 8)); writel(0U, (void volatile *)bp->regview + (unsigned long )(port * 8 + 1081412)); } else { } bnx2x_init_block(bp, 10U, (u32 )init_phase); bnx2x_init_block(bp, 11U, (u32 )init_phase); bnx2x_init_block(bp, 33U, (u32 )init_phase); val = (unsigned int )bp->mf_mode != 0U ? 247U : 7U; val = (bp->common.chip_id >> 16 == 5710U ? 0U : 16U) | val; writel(val, (void volatile *)bp->regview + (unsigned long )((port + 10264) * 4)); bnx2x_init_block(bp, 13U, (u32 )init_phase); if (bp->common.chip_id >> 16 != 5710U && (bp->common.chip_id >> 16 != 5711U && bp->common.chip_id >> 16 != 5712U)) { if ((unsigned int )bp->mf_mode == 3U) { writel(14U, (void volatile *)(bp->regview + ((int )bp->pfid & 1 ? 98700UL : 98360UL))); } else { writel((unsigned int )bp->mf_mode == 1U ? 7U : 6U, (void volatile *)(bp->regview + ((int )bp->pfid & 1 ? 98700UL : 98360UL))); } if (((((((((bp->common.chip_id >> 16 == 5770U || bp->common.chip_id >> 16 == 5797U) || bp->common.chip_id >> 16 == 5801U) || bp->common.chip_id >> 16 == 5774U) || bp->common.chip_id >> 16 == 5806U) || bp->common.chip_id >> 16 == 5807U) || ((bp->common.chip_id >> 16 == 5693U || bp->common.chip_id >> 16 == 5694U) || bp->common.chip_id >> 16 == 5695U)) || ((bp->common.chip_id >> 16 == 5793U || bp->common.chip_id >> 16 == 5794U) || bp->common.chip_id >> 16 == 5773U)) || (bp->common.chip_id >> 16 == 5796U || bp->common.chip_id >> 16 == 5803U)) || bp->common.chip_id >> 16 == 5805U) { writel((unsigned int )bp->mf_mode != 0U, (void volatile *)(bp->regview + ((int )bp->pfid & 1 ? 99860UL : 90148UL))); } else { } } else { } if (((((((((bp->common.chip_id >> 16 != 5770U && bp->common.chip_id >> 16 != 5797U) && bp->common.chip_id >> 16 != 5801U) && bp->common.chip_id >> 16 != 5774U) && bp->common.chip_id >> 16 != 5806U) && bp->common.chip_id >> 16 != 5807U) && ((bp->common.chip_id >> 16 != 5693U && bp->common.chip_id >> 16 != 5694U) && bp->common.chip_id >> 16 != 5695U)) && ((bp->common.chip_id >> 16 != 5793U && bp->common.chip_id >> 16 != 5794U) && bp->common.chip_id >> 16 != 5773U)) && (bp->common.chip_id >> 16 != 5796U && bp->common.chip_id >> 16 != 5803U)) && bp->common.chip_id >> 16 != 5805U) { writel(1U, (void volatile *)bp->regview + (unsigned long )((port + 16568) * 4)); } else { } if (bp->common.chip_id >> 16 != 5710U) { writel((unsigned int )bp->mf_mode == 1U ? 1U : 2U, (void volatile *)bp->regview + (unsigned long )((port + 22546) * 4)); if (bp->common.chip_id >> 16 != 5710U && (bp->common.chip_id >> 16 != 5711U && bp->common.chip_id >> 16 != 5712U)) { val = 0U; switch ((int )bp->mf_mode) { case 1: val = 1U; goto ldv_57296; case 2: ; case 3: val = 2U; goto ldv_57296; } ldv_57296: writel(val, (void volatile *)(bp->regview + ((int )bp->pfid & 1 ? 90244UL : 90240UL))); } else { } writel(0U, (void volatile *)bp->regview + (unsigned long )((port + 22658) * 4)); writel(0U, (void volatile *)bp->regview + (unsigned long )((port + 22578) * 4)); writel(1U, (void volatile *)bp->regview + (unsigned long )((port + 22576) * 4)); } else { } val = readl((void const volatile *)bp->regview + 41656U); if ((val & 32U) != 0U) { reg_addr = port != 0 ? 41228U : 41068U; val = readl((void const volatile *)bp->regview + (unsigned long )reg_addr); val = val | 32768U; writel(val, (void volatile *)bp->regview + (unsigned long )reg_addr); } else { } return (0); } } static void bnx2x_ilt_wr(struct bnx2x *bp , u32 index , dma_addr_t addr ) { int reg ; u32 wb_write[2U] ; size_t __len ; void *__ret ; { if (bp->common.chip_id >> 16 == 5710U) { reg = (int )((index + 148480U) * 8U); } else { reg = (int )((index + 151552U) * 8U); } wb_write[0] = (unsigned int )(addr >> 12); wb_write[1] = (unsigned int )(addr >> 44) | 1048576U; __len = 8UL; if (__len > 63UL) { __ret = __memcpy((void *)(& (bp->slowpath)->wb_data), (void const *)(& wb_write), __len); } else { __ret = __builtin_memcpy((void *)(& (bp->slowpath)->wb_data), (void const *)(& wb_write), __len); } bnx2x_write_dmae(bp, bp->slowpath_mapping + 4392ULL, (u32 )reg, 2U); return; } } void bnx2x_igu_clear_sb_gen(struct bnx2x *bp , u8 func , u8 idu_sb_id , bool is_pf ) { u32 data ; u32 ctl ; u32 cnt ; u32 igu_addr_data ; u32 igu_addr_ctl ; u32 igu_addr_ack ; u32 sb_bit ; u32 func_encode ; u32 addr_encode ; long tmp ; long tmp___0 ; unsigned int tmp___1 ; long tmp___2 ; unsigned int tmp___3 ; { cnt = 100U; igu_addr_data = 1245476U; igu_addr_ctl = 1245484U; igu_addr_ack = (u32 )(((int )((unsigned int )idu_sb_id / 32U) + 311424) * 4); sb_bit = (u32 )(1 << ((int )idu_sb_id & 31)); func_encode = (u32 )((int )func | ((int )is_pf << 6)); addr_encode = (u32 )((int )idu_sb_id + 1280); if ((bp->common.chip_id >> 16 == 5710U || (bp->common.chip_id >> 16 == 5711U || bp->common.chip_id >> 16 == 5712U)) || ((int )bp->common.int_block & 2) != 0) { return; } else { } data = 3758096384U; ctl = ((func_encode << 12) | addr_encode) | 1048576U; tmp = ldv__builtin_expect((bp->msg_enable & 8192) != 0, 0L); if (tmp != 0L) { printk("\rbnx2x: [%s:%d(%s)]write 0x%08x to IGU(via GRC) addr 0x%x\n", "bnx2x_igu_clear_sb_gen", 7336, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", data, igu_addr_data); } else { } writel(data, (void volatile *)bp->regview + (unsigned long )igu_addr_data); __asm__ volatile ("": : : "memory"); __asm__ volatile ("": : : "memory"); tmp___0 = ldv__builtin_expect((bp->msg_enable & 8192) != 0, 0L); if (tmp___0 != 0L) { printk("\rbnx2x: [%s:%d(%s)]write 0x%08x to IGU(via GRC) addr 0x%x\n", "bnx2x_igu_clear_sb_gen", 7341, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", ctl, igu_addr_ctl); } else { } writel(ctl, (void volatile *)bp->regview + (unsigned long )igu_addr_ctl); __asm__ volatile ("": : : "memory"); __asm__ volatile ("": : : "memory"); goto ldv_57327; ldv_57326: msleep(20U); ldv_57327: tmp___1 = readl((void const volatile *)bp->regview + (unsigned long )igu_addr_ack); if ((tmp___1 & sb_bit) == 0U) { cnt = cnt - 1U; if (cnt != 0U) { goto ldv_57326; } else { goto ldv_57328; } } else { } ldv_57328: tmp___3 = readl((void const volatile *)bp->regview + (unsigned long )igu_addr_ack); if ((tmp___3 & sb_bit) == 0U) { tmp___2 = ldv__builtin_expect((bp->msg_enable & 8192) != 0, 0L); if (tmp___2 != 0L) { printk("\rbnx2x: [%s:%d(%s)]Unable to finish IGU cleanup: idu_sb_id %d offset %d bit %d (cnt %d)\n", "bnx2x_igu_clear_sb_gen", 7354, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )idu_sb_id, (int )((unsigned int )idu_sb_id / 32U), (int )idu_sb_id & 31, cnt); } else { } } else { } return; } } static void bnx2x_igu_clear_sb(struct bnx2x *bp , u8 idu_sb_id ) { { bnx2x_igu_clear_sb_gen(bp, (int )bp->pfid, (int )idu_sb_id, 1); return; } } static void bnx2x_clear_func_ilt(struct bnx2x *bp , u32 func ) { u32 i ; u32 base ; { base = func * 384U; i = base; goto ldv_57340; ldv_57339: bnx2x_ilt_wr(bp, i, 0ULL); i = i + 1U; ldv_57340: ; if (base + 384U > i) { goto ldv_57339; } else { } return; } } static void bnx2x_init_searcher(struct bnx2x *bp ) { int port ; { port = (int )bp->pfid & 1; bnx2x_src_init_t2(bp, (struct src_ent *)bp->t2, bp->t2_mapping, 1024); writel(10U, (void volatile *)bp->regview + (unsigned long )((port + 65792) * 4)); return; } } __inline static int bnx2x_func_switch_update(struct bnx2x *bp , int suspend ) { int rc ; struct bnx2x_func_state_params func_params ; struct bnx2x_func_switch_update_params *switch_update_params ; { func_params.f_obj = 0; func_params.cmd = 0; func_params.ramrod_flags = 0UL; func_params.params.tx_start.traffic_type_to_priority_cos[0].priority = (unsigned char)0; func_params.params.tx_start.traffic_type_to_priority_cos[0].cos = (unsigned char)0; func_params.params.tx_start.traffic_type_to_priority_cos[0].reserved1 = (unsigned short)0; func_params.params.tx_start.traffic_type_to_priority_cos[1].priority = (unsigned char)0; func_params.params.tx_start.traffic_type_to_priority_cos[1].cos = (unsigned char)0; func_params.params.tx_start.traffic_type_to_priority_cos[1].reserved1 = (unsigned short)0; func_params.params.tx_start.traffic_type_to_priority_cos[2].priority = (unsigned char)0; func_params.params.tx_start.traffic_type_to_priority_cos[2].cos = (unsigned char)0; func_params.params.tx_start.traffic_type_to_priority_cos[2].reserved1 = (unsigned short)0; func_params.params.tx_start.traffic_type_to_priority_cos[3].priority = (unsigned char)0; func_params.params.tx_start.traffic_type_to_priority_cos[3].cos = (unsigned char)0; func_params.params.tx_start.traffic_type_to_priority_cos[3].reserved1 = (unsigned short)0; func_params.params.tx_start.traffic_type_to_priority_cos[4].priority = (unsigned char)0; func_params.params.tx_start.traffic_type_to_priority_cos[4].cos = (unsigned char)0; func_params.params.tx_start.traffic_type_to_priority_cos[4].reserved1 = (unsigned short)0; func_params.params.tx_start.traffic_type_to_priority_cos[5].priority = (unsigned char)0; func_params.params.tx_start.traffic_type_to_priority_cos[5].cos = (unsigned char)0; func_params.params.tx_start.traffic_type_to_priority_cos[5].reserved1 = (unsigned short)0; func_params.params.tx_start.traffic_type_to_priority_cos[6].priority = (unsigned char)0; func_params.params.tx_start.traffic_type_to_priority_cos[6].cos = (unsigned char)0; func_params.params.tx_start.traffic_type_to_priority_cos[6].reserved1 = (unsigned short)0; func_params.params.tx_start.traffic_type_to_priority_cos[7].priority = (unsigned char)0; func_params.params.tx_start.traffic_type_to_priority_cos[7].cos = (unsigned char)0; func_params.params.tx_start.traffic_type_to_priority_cos[7].reserved1 = (unsigned short)0; func_params.params.tx_start.dcb_enabled = (unsigned char)0; func_params.params.tx_start.dcb_version = (unsigned char)0; func_params.params.tx_start.dont_add_pri_0_en = (unsigned char)0; switch_update_params = & func_params.params.switch_update; __set_bit(2, (unsigned long volatile *)(& func_params.ramrod_flags)); __set_bit(7, (unsigned long volatile *)(& func_params.ramrod_flags)); func_params.f_obj = & bp->func_obj; func_params.cmd = 8; switch_update_params->suspend = (u8 )suspend; rc = bnx2x_func_state_change(bp, & func_params); return (rc); } } static int bnx2x_reset_nic_mode(struct bnx2x *bp ) { int rc ; int i ; int port ; int vlan_en ; int mac_en[8U] ; unsigned int tmp ; unsigned int tmp___0 ; long tmp___1 ; { port = (int )bp->pfid & 1; vlan_en = 0; if ((unsigned int )bp->mf_mode == 0U) { bnx2x_set_rx_filter(& bp->link_params, 0); } else { tmp = readl((void const volatile *)(bp->regview + (port != 0 ? 90372UL : 90364UL))); vlan_en = (int )tmp; writel(0U, (void volatile *)(bp->regview + (port != 0 ? 90372UL : 90364UL))); i = 0; goto ldv_57362; ldv_57361: tmp___0 = readl((void const volatile *)bp->regview + (unsigned long )(port != 0 ? (i + 22616) * 4 : (i + 22608) * 4)); mac_en[i] = (int )tmp___0; writel(0U, (void volatile *)bp->regview + (unsigned long )(port != 0 ? (i + 22616) * 4 : (i + 22608) * 4)); i = i + 1; ldv_57362: ; if (i <= 7) { goto ldv_57361; } else { } } writel(0U, (void volatile *)(bp->regview + (port != 0 ? 99060UL : 99064UL))); rc = bnx2x_func_switch_update(bp, 1); if (rc != 0) { printk("\vbnx2x: [%s:%d(%s)]Can\'t suspend tx-switching!\n", "bnx2x_reset_nic_mode", 7438, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); return (rc); } else { } writel(0U, (void volatile *)bp->regview + 262456U); if ((unsigned int )bp->mf_mode == 0U) { bnx2x_set_rx_filter(& bp->link_params, 1); } else { writel((unsigned int )vlan_en, (void volatile *)(bp->regview + (port != 0 ? 90372UL : 90364UL))); i = 0; goto ldv_57366; ldv_57365: writel((unsigned int )mac_en[i], (void volatile *)bp->regview + (unsigned long )(port != 0 ? (i + 22616) * 4 : (i + 22608) * 4)); i = i + 1; ldv_57366: ; if (i <= 7) { goto ldv_57365; } else { } } writel(1U, (void volatile *)(bp->regview + (port != 0 ? 99060UL : 99064UL))); rc = bnx2x_func_switch_update(bp, 0); if (rc != 0) { printk("\vbnx2x: [%s:%d(%s)]Can\'t resume tx-switching!\n", "bnx2x_reset_nic_mode", 7466, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); return (rc); } else { } tmp___1 = ldv__builtin_expect((bp->msg_enable & 32) != 0, 0L); if (tmp___1 != 0L) { printk("\rbnx2x: [%s:%d(%s)]NIC MODE disabled\n", "bnx2x_reset_nic_mode", 7470, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } return (0); } } int bnx2x_init_hw_func_cnic(struct bnx2x *bp ) { int rc ; { bnx2x_ilt_init_op_cnic(bp, 0); if ((bp->common.chip_id >> 16 != 5710U && (bp->common.chip_id >> 16 != 5711U && bp->common.chip_id >> 16 != 5712U)) && ! bp->cnic_enabled) { bnx2x_init_searcher(bp); rc = bnx2x_reset_nic_mode(bp); if (rc != 0) { printk("\vbnx2x: [%s:%d(%s)]Can\'t change NIC mode!\n", "bnx2x_init_hw_func_cnic", 7487, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } return (rc); } else { } return (0); } } static int bnx2x_init_hw_func(struct bnx2x *bp ) { int port ; int func ; int init_phase ; struct bnx2x_ilt *ilt ; u16 cdu_ilt_start ; u32 addr ; u32 val ; u32 main_mem_base ; u32 main_mem_size ; u32 main_mem_prty_clr ; int i ; int main_mem_width ; int rc ; long tmp ; int tmp___0 ; long tmp___1 ; long tmp___2 ; u32 pf_conf ; int num_segs ; int sb_idx ; int prod_offset ; int dsb_idx ; long tmp___3 ; { port = (int )bp->pfid & 1; func = (int )bp->pfid; init_phase = func + 3; ilt = bp->ilt; tmp = ldv__builtin_expect((bp->msg_enable & 8192) != 0, 0L); if (tmp != 0L) { printk("\rbnx2x: [%s:%d(%s)]starting func init func %d\n", "bnx2x_init_hw_func", 7505, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", func); } else { } if (bp->common.chip_id >> 16 != 5710U && (bp->common.chip_id >> 16 != 5711U && bp->common.chip_id >> 16 != 5712U)) { rc = bnx2x_pf_flr_clnup(bp); if (rc != 0) { bnx2x_fw_dump(bp); return (rc); } else { } } else { } if ((unsigned int )bp->common.int_block == 0U) { addr = port != 0 ? 1081348U : 1081344U; val = readl((void const volatile *)bp->regview + (unsigned long )addr); val = val | 128U; writel(val, (void volatile *)bp->regview + (unsigned long )addr); } else { } bnx2x_init_block(bp, 18U, (u32 )init_phase); bnx2x_init_block(bp, 17U, (u32 )init_phase); ilt = bp->ilt; cdu_ilt_start = ilt->clients[0].start; if ((unsigned long )bp->vfdb != (unsigned long )((struct bnx2x_vfdb *)0)) { cdu_ilt_start = (unsigned int )cdu_ilt_start + 8U; } else { } tmp___0 = bnx2x_iov_init_ilt(bp, (int )cdu_ilt_start); cdu_ilt_start = (u16 )tmp___0; cdu_ilt_start = ilt->clients[0].start; i = 0; goto ldv_57391; ldv_57390: (ilt->lines + (unsigned long )((int )cdu_ilt_start + i))->page = (void *)bp->context[i].vcxt; (ilt->lines + (unsigned long )((int )cdu_ilt_start + i))->page_mapping = bp->context[i].cxt_mapping; (ilt->lines + (unsigned long )((int )cdu_ilt_start + i))->size = (u32 )bp->context[i].size; i = i + 1; ldv_57391: ; if ((unsigned long )i < ((unsigned long )(bp->num_ethernet_queues * 3U + (uint )((int )bp->cnic_support * 2)) + 31UL) / 32UL) { goto ldv_57390; } else { } bnx2x_ilt_init_op(bp, 0); if ((bp->common.chip_id >> 16 == 5710U || (bp->common.chip_id >> 16 == 5711U || bp->common.chip_id >> 16 == 5712U)) || (int )bp->cnic_enabled) { bnx2x_init_searcher(bp); writel(0U, (void volatile *)bp->regview + 262456U); tmp___1 = ldv__builtin_expect((bp->msg_enable & 32) != 0, 0L); if (tmp___1 != 0L) { printk("\rbnx2x: [%s:%d(%s)]NIC MODE disabled\n", "bnx2x_init_hw_func", 7550, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } } else { writel(1U, (void volatile *)bp->regview + 262456U); tmp___2 = ldv__builtin_expect((bp->msg_enable & 32) != 0, 0L); if (tmp___2 != 0L) { printk("\rbnx2x: [%s:%d(%s)]NIC MODE configrued\n", "bnx2x_init_hw_func", 7554, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } } if (bp->common.chip_id >> 16 != 5710U && (bp->common.chip_id >> 16 != 5711U && bp->common.chip_id >> 16 != 5712U)) { pf_conf = 1U; if ((bp->flags & 32U) == 0U) { pf_conf = pf_conf | 16U; } else { } msleep(20U); writel(1U, (void volatile *)bp->regview + 37932U); writel(pf_conf, (void volatile *)bp->regview + 1245524U); } else { } bp->dmae_ready = 1; bnx2x_init_block(bp, 15U, (u32 )init_phase); if (bp->common.chip_id >> 16 != 5710U && (bp->common.chip_id >> 16 != 5711U && bp->common.chip_id >> 16 != 5712U)) { writel((unsigned int )func, (void volatile *)bp->regview + 38000U); } else { } bnx2x_init_block(bp, 0U, (u32 )init_phase); bnx2x_init_block(bp, 8U, (u32 )init_phase); bnx2x_init_block(bp, 13U, (u32 )init_phase); bnx2x_init_block(bp, 20U, (u32 )init_phase); bnx2x_init_block(bp, 12U, (u32 )init_phase); bnx2x_init_block(bp, 21U, (u32 )init_phase); bnx2x_init_block(bp, 25U, (u32 )init_phase); bnx2x_init_block(bp, 2U, (u32 )init_phase); bnx2x_init_block(bp, 29U, (u32 )init_phase); bnx2x_init_block(bp, 24U, (u32 )init_phase); bnx2x_init_block(bp, 28U, (u32 )init_phase); bnx2x_init_block(bp, 6U, (u32 )init_phase); bnx2x_init_block(bp, 32U, (u32 )init_phase); if (bp->common.chip_id >> 16 != 5710U && (bp->common.chip_id >> 16 != 5711U && bp->common.chip_id >> 16 != 5712U)) { writel(1U, (void volatile *)bp->regview + 1500940U); } else { } if (bp->common.chip_id >> 16 != 5710U && (bp->common.chip_id >> 16 != 5711U && bp->common.chip_id >> 16 != 5712U)) { writel((unsigned int )func + 64U, (void volatile *)bp->regview + 1573760U); writel((unsigned int )func + 64U, (void volatile *)bp->regview + 3146624U); writel((unsigned int )func + 64U, (void volatile *)bp->regview + 2098048U); writel((unsigned int )func + 64U, (void volatile *)bp->regview + 2622336U); } else { } bnx2x_init_block(bp, 19U, (u32 )init_phase); bnx2x_init_block(bp, 22U, (u32 )init_phase); bnx2x_init_block(bp, 9U, (u32 )init_phase); bnx2x_iov_init_dq(bp); bnx2x_init_block(bp, 1U, (u32 )init_phase); bnx2x_init_block(bp, 16U, (u32 )init_phase); bnx2x_init_block(bp, 23U, (u32 )init_phase); bnx2x_init_block(bp, 5U, (u32 )init_phase); bnx2x_init_block(bp, 27U, (u32 )init_phase); bnx2x_init_block(bp, 31U, (u32 )init_phase); bnx2x_init_block(bp, 26U, (u32 )init_phase); bnx2x_init_block(bp, 30U, (u32 )init_phase); bnx2x_init_block(bp, 14U, (u32 )init_phase); if (bp->common.chip_id >> 16 != 5710U && (bp->common.chip_id >> 16 != 5711U && bp->common.chip_id >> 16 != 5712U)) { writel(0U, (void volatile *)bp->regview + 1311464U); } else { } bnx2x_init_block(bp, 3U, (u32 )init_phase); bnx2x_init_block(bp, 4U, (u32 )init_phase); if (bp->common.chip_id >> 16 != 5710U && (bp->common.chip_id >> 16 != 5711U && bp->common.chip_id >> 16 != 5712U)) { writel(1U, (void volatile *)bp->regview + 1065252U); } else { } if ((unsigned int )bp->mf_mode != 0U) { writel(1U, (void volatile *)bp->regview + (unsigned long )(port * 8 + 90364)); writel((unsigned int )bp->mf_ov, (void volatile *)bp->regview + (unsigned long )((port + 11296) * 8)); } else { } bnx2x_init_block(bp, 33U, (u32 )init_phase); if ((unsigned int )bp->common.int_block == 0U) { if (bp->common.chip_id >> 16 == 5711U || bp->common.chip_id >> 16 == 5712U) { writel(0U, (void volatile *)bp->regview + (unsigned long )((func + 10252) * 4)); writel(0U, (void volatile *)bp->regview + (unsigned long )((port + 135176) * 8)); writel(0U, (void volatile *)bp->regview + (unsigned long )(port * 8 + 1081412)); } else { } bnx2x_init_block(bp, 10U, (u32 )init_phase); } else { writel(0U, (void volatile *)bp->regview + (unsigned long )((func + 10252) * 4)); if (bp->common.chip_id >> 16 != 5710U && (bp->common.chip_id >> 16 != 5711U && bp->common.chip_id >> 16 != 5712U)) { writel(0U, (void volatile *)bp->regview + 1245492U); writel(0U, (void volatile *)bp->regview + 1245444U); } else { } bnx2x_init_block(bp, 11U, (u32 )init_phase); if (bp->common.chip_id >> 16 != 5710U && (bp->common.chip_id >> 16 != 5711U && bp->common.chip_id >> 16 != 5712U)) { dsb_idx = 0; num_segs = (bp->common.chip_id >> 16 == 5710U || (bp->common.chip_id >> 16 == 5711U || bp->common.chip_id >> 16 == 5712U)) || ((int )bp->common.int_block & 2) != 0 ? 2 : 1; sb_idx = 0; goto ldv_57402; ldv_57401: prod_offset = ((int )bp->igu_base_sb + sb_idx) * num_segs; i = 0; goto ldv_57399; ldv_57398: addr = (u32 )(((prod_offset + i) + 313344) * 4); writel(0U, (void volatile *)bp->regview + (unsigned long )addr); i = i + 1; ldv_57399: ; if (i < num_segs) { goto ldv_57398; } else { } bnx2x_ack_sb(bp, (int )bp->igu_base_sb + (int )((u8 )sb_idx), 0, 0, 2, 1); bnx2x_igu_clear_sb(bp, (int )bp->igu_base_sb + (int )((u8 )sb_idx)); sb_idx = sb_idx + 1; ldv_57402: ; if ((int )bp->igu_sb_cnt > sb_idx) { goto ldv_57401; } else { } num_segs = (bp->common.chip_id >> 16 == 5710U || (bp->common.chip_id >> 16 == 5711U || bp->common.chip_id >> 16 == 5712U)) || ((int )bp->common.int_block & 2) != 0 ? 5 : 2; if ((unsigned int )bp->common.chip_port_mode == 0U) { dsb_idx = (int )bp->pfid; } else { dsb_idx = (int )bp->pfid >> 1; } prod_offset = (bp->common.chip_id >> 16 == 5710U || (bp->common.chip_id >> 16 == 5711U || bp->common.chip_id >> 16 == 5712U)) || ((int )bp->common.int_block & 2) != 0 ? dsb_idx + 128 : dsb_idx + 136; i = 0; goto ldv_57405; ldv_57404: addr = (u32 )(((prod_offset + i) + 313344) * 4); writel(0U, (void volatile *)bp->regview + (unsigned long )addr); i = i + 4; ldv_57405: ; if (num_segs * 4 > i) { goto ldv_57404; } else { } if ((bp->common.chip_id >> 16 == 5710U || (bp->common.chip_id >> 16 == 5711U || bp->common.chip_id >> 16 == 5712U)) || ((int )bp->common.int_block & 2) != 0) { bnx2x_ack_sb(bp, (int )bp->igu_dsb_id, 0, 0, 2, 1); bnx2x_ack_sb(bp, (int )bp->igu_dsb_id, 1, 0, 2, 1); bnx2x_ack_sb(bp, (int )bp->igu_dsb_id, 2, 0, 2, 1); bnx2x_ack_sb(bp, (int )bp->igu_dsb_id, 3, 0, 2, 1); bnx2x_ack_sb(bp, (int )bp->igu_dsb_id, 4, 0, 2, 1); } else { bnx2x_ack_sb(bp, (int )bp->igu_dsb_id, 0, 0, 2, 1); bnx2x_ack_sb(bp, (int )bp->igu_dsb_id, 4, 0, 2, 1); } bnx2x_igu_clear_sb(bp, (int )bp->igu_dsb_id); writel(0U, (void volatile *)bp->regview + 1245532U); writel(0U, (void volatile *)bp->regview + 1245536U); writel(0U, (void volatile *)bp->regview + 1245540U); writel(0U, (void volatile *)bp->regview + 1245544U); writel(0U, (void volatile *)bp->regview + 1245496U); writel(0U, (void volatile *)bp->regview + 1245500U); } else { } } writel(4294967295U, (void volatile *)bp->regview + 8468U); writel(4294967295U, (void volatile *)bp->regview + 8480U); if (bp->common.chip_id >> 16 == 5710U || (bp->common.chip_id >> 16 == 5711U || bp->common.chip_id >> 16 == 5712U)) { main_mem_size = 76U; main_mem_base = (((u32 )bp->pfid & 1U) * main_mem_size + 270848U) * 4U; main_mem_prty_clr = 1081496U; main_mem_width = 8; val = readl((void const volatile *)bp->regview + (unsigned long )main_mem_prty_clr); if (val != 0U) { tmp___3 = ldv__builtin_expect((bp->msg_enable & 8192) != 0, 0L); if (tmp___3 != 0L) { printk("\rbnx2x: [%s:%d(%s)]Hmmm... Parity errors in HC block during function init (0x%x)!\n", "bnx2x_init_hw_func", 7778, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", val); } else { } } else { } i = (int )main_mem_base; goto ldv_57408; ldv_57407: bnx2x_read_dmae(bp, (u32 )i, (u32 )(main_mem_width / 4)); bnx2x_write_dmae(bp, bp->slowpath_mapping + 4392ULL, (u32 )i, (u32 )(main_mem_width / 4)); i = i + main_mem_width; ldv_57408: ; if ((u32 )i < main_mem_size * 4U + main_mem_base) { goto ldv_57407; } else { } readl((void const volatile *)bp->regview + (unsigned long )main_mem_prty_clr); } else { } bnx2x_phy_probe(& bp->link_params); return (0); } } void bnx2x_free_mem_cnic(struct bnx2x *bp ) { { bnx2x_ilt_mem_op_cnic(bp, 1); if (bp->common.chip_id >> 16 != 5710U && (bp->common.chip_id >> 16 != 5711U && bp->common.chip_id >> 16 != 5712U)) { if ((unsigned long )bp->cnic_sb.e2_sb != (unsigned long )((struct host_hc_status_block_e2 *)0)) { dma_free_attrs(& (bp->pdev)->dev, 64UL, (void *)bp->cnic_sb.e2_sb, bp->cnic_sb_mapping, 0); bp->cnic_sb.e2_sb = 0; bp->cnic_sb_mapping = 0ULL; } else { } } else if ((unsigned long )bp->cnic_sb.e1x_sb != (unsigned long )((struct host_hc_status_block_e1x *)0)) { dma_free_attrs(& (bp->pdev)->dev, 64UL, (void *)bp->cnic_sb.e1x_sb, bp->cnic_sb_mapping, 0); bp->cnic_sb.e1x_sb = 0; bp->cnic_sb_mapping = 0ULL; } else { } if ((unsigned long )bp->t2 != (unsigned long )((void *)0)) { dma_free_attrs(& (bp->pdev)->dev, 65536UL, bp->t2, bp->t2_mapping, 0); bp->t2 = 0; bp->t2_mapping = 0ULL; } else { } return; } } void bnx2x_free_mem(struct bnx2x *bp ) { int i ; { if ((unsigned long )bp->def_status_blk != (unsigned long )((struct host_sp_status_block *)0)) { dma_free_attrs(& (bp->pdev)->dev, 56UL, (void *)bp->def_status_blk, bp->def_status_blk_mapping, 0); bp->def_status_blk = 0; bp->def_status_blk_mapping = 0ULL; } else { } if ((unsigned long )bp->fw_stats != (unsigned long )((void *)0)) { dma_free_attrs(& (bp->pdev)->dev, (size_t )(bp->fw_stats_data_sz + bp->fw_stats_req_sz), bp->fw_stats, bp->fw_stats_mapping, 0); bp->fw_stats = 0; bp->fw_stats_mapping = 0ULL; } else { } if ((unsigned long )bp->slowpath != (unsigned long )((struct bnx2x_slowpath *)0)) { dma_free_attrs(& (bp->pdev)->dev, 4724UL, (void *)bp->slowpath, bp->slowpath_mapping, 0); bp->slowpath = 0; bp->slowpath_mapping = 0ULL; } else { } i = 0; goto ldv_57418; ldv_57417: ; if ((unsigned long )bp->context[i].vcxt != (unsigned long )((union cdu_context *)0)) { dma_free_attrs(& (bp->pdev)->dev, bp->context[i].size, (void *)bp->context[i].vcxt, bp->context[i].cxt_mapping, 0); bp->context[i].vcxt = 0; bp->context[i].cxt_mapping = 0ULL; } else { } i = i + 1; ldv_57418: ; if ((unsigned long )i < ((unsigned long )(bp->num_ethernet_queues * 3U + (uint )((int )bp->cnic_support * 2)) + 31UL) / 32UL) { goto ldv_57417; } else { } bnx2x_ilt_mem_op(bp, 1); if ((unsigned long )(bp->ilt)->lines != (unsigned long )((struct ilt_line *)0)) { kfree((void const *)(bp->ilt)->lines); (bp->ilt)->lines = 0; } else { } if ((unsigned long )bp->spq != (unsigned long )((struct eth_spe *)0)) { dma_free_attrs(& (bp->pdev)->dev, 4096UL, (void *)bp->spq, bp->spq_mapping, 0); bp->spq = 0; bp->spq_mapping = 0ULL; } else { } if ((unsigned long )bp->eq_ring != (unsigned long )((union event_ring_elem *)0)) { dma_free_attrs(& (bp->pdev)->dev, 4096UL, (void *)bp->eq_ring, bp->eq_mapping, 0); bp->eq_ring = 0; bp->eq_mapping = 0ULL; } else { } if ((unsigned long )bp->t2 != (unsigned long )((void *)0)) { dma_free_attrs(& (bp->pdev)->dev, 65536UL, bp->t2, bp->t2_mapping, 0); bp->t2 = 0; bp->t2_mapping = 0ULL; } else { } bnx2x_iov_free_mem(bp); return; } } int bnx2x_alloc_mem_cnic(struct bnx2x *bp ) { void *tmp ; void *tmp___0 ; int tmp___1 ; { if (bp->common.chip_id >> 16 != 5710U && (bp->common.chip_id >> 16 != 5711U && bp->common.chip_id >> 16 != 5712U)) { tmp = dma_alloc_attrs(& (bp->pdev)->dev, 64UL, & bp->cnic_sb_mapping, 32976U, 0); bp->cnic_sb.e2_sb = (struct host_hc_status_block_e2 *)tmp; if ((unsigned long )bp->cnic_sb.e2_sb == (unsigned long )((struct host_hc_status_block_e2 *)0)) { goto alloc_mem_err; } else { } } else { tmp___0 = dma_alloc_attrs(& (bp->pdev)->dev, 64UL, & bp->cnic_sb_mapping, 32976U, 0); bp->cnic_sb.e1x_sb = (struct host_hc_status_block_e1x *)tmp___0; if ((unsigned long )bp->cnic_sb.e1x_sb == (unsigned long )((struct host_hc_status_block_e1x *)0)) { goto alloc_mem_err; } else { } } if (((bp->common.chip_id >> 16 != 5710U && (bp->common.chip_id >> 16 != 5711U && bp->common.chip_id >> 16 != 5712U)) && ! bp->cnic_enabled) && (unsigned long )bp->t2 == (unsigned long )((void *)0)) { bp->t2 = dma_alloc_attrs(& (bp->pdev)->dev, 65536UL, & bp->t2_mapping, 32976U, 0); if ((unsigned long )bp->t2 == (unsigned long )((void *)0)) { goto alloc_mem_err; } else { } } else { } bp->cnic_eth_dev.addr_drv_info_to_mcp = & (bp->slowpath)->drv_info_to_mcp; tmp___1 = bnx2x_ilt_mem_op_cnic(bp, 0); if (tmp___1 != 0) { goto alloc_mem_err; } else { } return (0); alloc_mem_err: bnx2x_free_mem_cnic(bp); printk("\vbnx2x: [%s:%d(%s)]Can\'t allocate memory\n", "bnx2x_alloc_mem_cnic", 7882, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); return (-12); } } int bnx2x_alloc_mem(struct bnx2x *bp ) { int i ; int allocated ; int context_size ; void *tmp ; void *tmp___0 ; int _min1 ; int _min2 ; void *tmp___1 ; void *tmp___2 ; int tmp___3 ; int tmp___4 ; void *tmp___5 ; void *tmp___6 ; { if (((bp->common.chip_id >> 16 == 5710U || (bp->common.chip_id >> 16 == 5711U || bp->common.chip_id >> 16 == 5712U)) || (int )bp->cnic_enabled) && (unsigned long )bp->t2 == (unsigned long )((void *)0)) { bp->t2 = dma_alloc_attrs(& (bp->pdev)->dev, 65536UL, & bp->t2_mapping, 32976U, 0); if ((unsigned long )bp->t2 == (unsigned long )((void *)0)) { goto alloc_mem_err; } else { } } else { } tmp = dma_alloc_attrs(& (bp->pdev)->dev, 56UL, & bp->def_status_blk_mapping, 32976U, 0); bp->def_status_blk = (struct host_sp_status_block *)tmp; if ((unsigned long )bp->def_status_blk == (unsigned long )((struct host_sp_status_block *)0)) { goto alloc_mem_err; } else { } tmp___0 = dma_alloc_attrs(& (bp->pdev)->dev, 4724UL, & bp->slowpath_mapping, 32976U, 0); bp->slowpath = (struct bnx2x_slowpath *)tmp___0; if ((unsigned long )bp->slowpath == (unsigned long )((struct bnx2x_slowpath *)0)) { goto alloc_mem_err; } else { } context_size = (int )(bp->num_ethernet_queues * 3072U + (uint )((int )bp->cnic_support * 2048)); i = 0; allocated = 0; goto ldv_57436; ldv_57435: _min1 = 32768; _min2 = context_size - allocated; bp->context[i].size = (size_t )(_min1 < _min2 ? _min1 : _min2); tmp___1 = dma_alloc_attrs(& (bp->pdev)->dev, bp->context[i].size, & bp->context[i].cxt_mapping, 32976U, 0); bp->context[i].vcxt = (union cdu_context *)tmp___1; if ((unsigned long )bp->context[i].vcxt == (unsigned long )((union cdu_context *)0)) { goto alloc_mem_err; } else { } allocated = (int )((unsigned int )bp->context[i].size + (unsigned int )allocated); i = i + 1; ldv_57436: ; if (allocated < context_size) { goto ldv_57435; } else { } tmp___2 = kzalloc(6144UL, 208U); (bp->ilt)->lines = (struct ilt_line *)tmp___2; if ((unsigned long )(bp->ilt)->lines == (unsigned long )((struct ilt_line *)0)) { goto alloc_mem_err; } else { } tmp___3 = bnx2x_ilt_mem_op(bp, 0); if (tmp___3 != 0) { goto alloc_mem_err; } else { } tmp___4 = bnx2x_iov_alloc_mem(bp); if (tmp___4 != 0) { goto alloc_mem_err; } else { } tmp___5 = dma_alloc_attrs(& (bp->pdev)->dev, 4096UL, & bp->spq_mapping, 32976U, 0); bp->spq = (struct eth_spe *)tmp___5; if ((unsigned long )bp->spq == (unsigned long )((struct eth_spe *)0)) { goto alloc_mem_err; } else { } tmp___6 = dma_alloc_attrs(& (bp->pdev)->dev, 4096UL, & bp->eq_mapping, 32976U, 0); bp->eq_ring = (union event_ring_elem *)tmp___6; if ((unsigned long )bp->eq_ring == (unsigned long )((union event_ring_elem *)0)) { goto alloc_mem_err; } else { } return (0); alloc_mem_err: bnx2x_free_mem(bp); printk("\vbnx2x: [%s:%d(%s)]Can\'t allocate memory\n", "bnx2x_alloc_mem", 7942, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); return (-12); } } int bnx2x_set_mac_one(struct bnx2x *bp , u8 *mac , struct bnx2x_vlan_mac_obj *obj , bool set , int mac_type , unsigned long *ramrod_flags ) { int rc ; struct bnx2x_vlan_mac_ramrod_params ramrod_param ; size_t __len ; void *__ret ; int tmp ; long tmp___0 ; { memset((void *)(& ramrod_param), 0, 56UL); ramrod_param.vlan_mac_obj = obj; ramrod_param.ramrod_flags = *ramrod_flags; tmp = constant_test_bit(6U, (unsigned long const volatile *)ramrod_flags); if (tmp == 0) { __len = 6UL; if (__len > 63UL) { __ret = __memcpy((void *)(& ramrod_param.user_req.u.mac.mac), (void const *)mac, __len); } else { __ret = __builtin_memcpy((void *)(& ramrod_param.user_req.u.mac.mac), (void const *)mac, __len); } __set_bit(mac_type, (unsigned long volatile *)(& ramrod_param.user_req.vlan_mac_flags)); if ((int )set) { ramrod_param.user_req.cmd = 0; } else { ramrod_param.user_req.cmd = 1; } } else { } rc = bnx2x_config_vlan_mac(bp, & ramrod_param); if (rc == -17) { tmp___0 = ldv__builtin_expect((bp->msg_enable & 1048576) != 0, 0L); if (tmp___0 != 0L) { printk("\rbnx2x: [%s:%d(%s)]Failed to schedule ADD operations: %d\n", "bnx2x_set_mac_one", 7979, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", rc); } else { } rc = 0; } else if (rc < 0) { printk("\vbnx2x: [%s:%d(%s)]%s MAC failed\n", "bnx2x_set_mac_one", 7983, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )set ? (char *)"Set" : (char *)"Del"); } else { } return (rc); } } int bnx2x_del_all_macs(struct bnx2x *bp , struct bnx2x_vlan_mac_obj *mac_obj , int mac_type , bool wait_for_comp ) { int rc ; unsigned long ramrod_flags ; unsigned long vlan_mac_flags ; { ramrod_flags = 0UL; vlan_mac_flags = 0UL; if ((int )wait_for_comp) { __set_bit(2, (unsigned long volatile *)(& ramrod_flags)); } else { } __set_bit(mac_type, (unsigned long volatile *)(& vlan_mac_flags)); rc = (*(mac_obj->delete_all))(bp, mac_obj, & vlan_mac_flags, & ramrod_flags); if (rc < 0) { printk("\vbnx2x: [%s:%d(%s)]Failed to delete MACs: %d\n", "bnx2x_del_all_macs", 8004, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", rc); } else { } return (rc); } } int bnx2x_set_eth_mac(struct bnx2x *bp , bool set ) { long tmp ; bool tmp___0 ; unsigned long ramrod_flags ; long tmp___1 ; int tmp___2 ; int tmp___3 ; { tmp___0 = is_zero_ether_addr((u8 const *)(bp->dev)->dev_addr); if ((int )tmp___0 && (((unsigned int )bp->mf_mode == 1U && ((bp->mf_config[(int )bp->pfid >> 1] & 6U) == 6U || (bp->mf_config[(int )bp->pfid >> 1] & 6U) == 0U)) || ((unsigned int )bp->mf_mode == 3U && (bp->mf_ext_config & 8U) != 0U))) { tmp = ldv__builtin_expect((bp->msg_enable & 48) != 0, 0L); if (tmp != 0L) { printk("\rbnx2x: [%s:%d(%s)]Ignoring Zero MAC for STORAGE SD mode\n", "bnx2x_set_eth_mac", 8014, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } return (0); } else { } if ((bp->flags & 4194304U) == 0U) { ramrod_flags = 0UL; tmp___1 = ldv__builtin_expect((bp->msg_enable & 32) != 0, 0L); if (tmp___1 != 0L) { printk("\rbnx2x: [%s:%d(%s)]Adding Eth MAC\n", "bnx2x_set_eth_mac", 8021, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } __set_bit(2, (unsigned long volatile *)(& ramrod_flags)); tmp___2 = bnx2x_set_mac_one(bp, (bp->dev)->dev_addr, & (bp->sp_objs)->mac_obj, (int )set, 1, & ramrod_flags); return (tmp___2); } else { tmp___3 = bnx2x_vfpf_config_mac(bp, (bp->dev)->dev_addr, (int )(bp->fp)->index, 1); return (tmp___3); } } } int bnx2x_setup_leading(struct bnx2x *bp ) { int tmp ; { tmp = bnx2x_setup_queue(bp, bp->fp, 1); return (tmp); } } int bnx2x_set_int_mode(struct bnx2x *bp ) { int rc ; long tmp ; long tmp___0 ; long tmp___1 ; { rc = 0; if ((bp->flags & 4194304U) != 0U && int_mode != 0) { return (-22); } else { } switch (int_mode) { case 0: rc = bnx2x_enable_msix(bp); if (rc == 0) { return (0); } else { } if (rc != 0 && (bp->flags & 4194304U) != 0U) { return (rc); } else { } tmp = ldv__builtin_expect((bp->msg_enable & 2) != 0, 0L); if (tmp != 0L) { _dev_info((struct device const *)(& (bp->pdev)->dev), "Failed to enable multiple MSI-X (%d), set number of queues to %d\n", bp->num_queues, bp->num_cnic_queues + 1U); } else { } case 2: bnx2x_enable_msi(bp); case 1: bp->num_ethernet_queues = 1U; bp->num_queues = (int )(bp->num_ethernet_queues + bp->num_cnic_queues); tmp___0 = ldv__builtin_expect((bp->msg_enable & 2) != 0, 0L); if (tmp___0 != 0L) { _dev_info((struct device const *)(& (bp->pdev)->dev), "set number of queues to 1\n"); } else { } goto ldv_57479; default: tmp___1 = ldv__builtin_expect((bp->msg_enable & 2) != 0, 0L); if (tmp___1 != 0L) { _dev_info((struct device const *)(& (bp->pdev)->dev), "unknown value in int_mode module parameter\n"); } else { } return (-22); } ldv_57479: ; return (0); } } __inline static u16 bnx2x_cid_ilt_lines(struct bnx2x *bp ) { { if ((unsigned long )bp->vfdb != (unsigned long )((struct bnx2x_vfdb *)0)) { return (10U); } else { } return ((u16 )(((unsigned long )(bp->num_ethernet_queues * 3U + (uint )((int )bp->cnic_support * 2)) + 31UL) / 32UL)); } } void bnx2x_ilt_set_info(struct bnx2x *bp ) { struct ilt_client_info *ilt_client ; struct bnx2x_ilt *ilt ; u16 line ; long tmp ; u16 tmp___0 ; int tmp___1 ; long tmp___2 ; int tmp___3 ; long tmp___4 ; int tmp___5 ; long tmp___6 ; int tmp___7 ; long tmp___8 ; long tmp___9 ; { ilt = bp->ilt; line = 0U; ilt->start_line = (u32 )((int )bp->pfid * 384); tmp = ldv__builtin_expect((bp->msg_enable & 1048576) != 0, 0L); if (tmp != 0L) { printk("\rbnx2x: [%s:%d(%s)]ilt starts at line %d\n", "bnx2x_ilt_set_info", 8101, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", ilt->start_line); } else { } ilt_client = (struct ilt_client_info *)(& ilt->clients); ilt_client->client_num = 0U; ilt_client->page_size = 32768U; ilt_client->flags = 2U; ilt_client->start = line; tmp___0 = bnx2x_cid_ilt_lines(bp); line = (int )tmp___0 + (int )line; if ((unsigned int )bp->cnic_support != 0U) { line = (unsigned int )line + 72U; } else { } ilt_client->end = (unsigned int )line + 65535U; tmp___2 = ldv__builtin_expect((bp->msg_enable & 32) != 0, 0L); if (tmp___2 != 0L) { tmp___1 = __ilog2_u32(ilt_client->page_size >> 12); printk("\rbnx2x: [%s:%d(%s)]ilt client[CDU]: start %d, end %d, psz 0x%x, flags 0x%x, hw psz %d\n", "bnx2x_ilt_set_info", 8120, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )ilt_client->start, (int )ilt_client->end, ilt_client->page_size, (int )ilt_client->flags, tmp___1); } else { } if (bp->qm_cid_count > 31) { ilt_client = (struct ilt_client_info *)(& ilt->clients) + 1UL; ilt_client->client_num = 1U; ilt_client->page_size = 4096U; ilt_client->flags = 0U; ilt_client->start = line; line = (int )((u16 )(((bp->qm_cid_count + 64) * 64 + -1) / 4096)) + (int )line; ilt_client->end = (unsigned int )line + 65535U; tmp___4 = ldv__builtin_expect((bp->msg_enable & 32) != 0, 0L); if (tmp___4 != 0L) { tmp___3 = __ilog2_u32(ilt_client->page_size >> 12); printk("\rbnx2x: [%s:%d(%s)]ilt client[QM]: start %d, end %d, psz 0x%x, flags 0x%x, hw psz %d\n", "bnx2x_ilt_set_info", 8142, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )ilt_client->start, (int )ilt_client->end, ilt_client->page_size, (int )ilt_client->flags, tmp___3); } else { } } else { } if ((unsigned int )bp->cnic_support != 0U) { ilt_client = (struct ilt_client_info *)(& ilt->clients) + 2UL; ilt_client->client_num = 2U; ilt_client->page_size = 4096U; ilt_client->flags = 0U; ilt_client->start = line; line = (unsigned int )line + 16U; ilt_client->end = (unsigned int )line + 65535U; tmp___6 = ldv__builtin_expect((bp->msg_enable & 32) != 0, 0L); if (tmp___6 != 0L) { tmp___5 = __ilog2_u32(ilt_client->page_size >> 12); printk("\rbnx2x: [%s:%d(%s)]ilt client[SRC]: start %d, end %d, psz 0x%x, flags 0x%x, hw psz %d\n", "bnx2x_ilt_set_info", 8162, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )ilt_client->start, (int )ilt_client->end, ilt_client->page_size, (int )ilt_client->flags, tmp___5); } else { } ilt_client = (struct ilt_client_info *)(& ilt->clients) + 3UL; ilt_client->client_num = 3U; ilt_client->page_size = 4096U; ilt_client->flags = 0U; ilt_client->start = line; line = (unsigned int )line + 2U; ilt_client->end = (unsigned int )line + 65535U; tmp___8 = ldv__builtin_expect((bp->msg_enable & 32) != 0, 0L); if (tmp___8 != 0L) { tmp___7 = __ilog2_u32(ilt_client->page_size >> 12); printk("\rbnx2x: [%s:%d(%s)]ilt client[TM]: start %d, end %d, psz 0x%x, flags 0x%x, hw psz %d\n", "bnx2x_ilt_set_info", 8179, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )ilt_client->start, (int )ilt_client->end, ilt_client->page_size, (int )ilt_client->flags, tmp___7); } else { } } else { } tmp___9 = ldv__builtin_expect((unsigned int )line > 256U, 0L); if (tmp___9 != 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 *)"/work/ldvuser/exper_fp/work/current--X--drivers--X--defaultlinux-3.10-rc1.tar--X--32_7a--X--cpachecker/linux-3.10-rc1.tar/csd_deg_dscv/8504/dscv_tempdir/dscv/ri/32_7a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c.prepared"), "i" (8182), "i" (12UL)); ldv_57491: ; goto ldv_57491; } else { } return; } } static void bnx2x_pf_q_prep_init(struct bnx2x *bp , struct bnx2x_fastpath *fp , struct bnx2x_queue_init_params *init_params ) { u8 cos ; int cxt_index ; int cxt_offset ; u8 tmp ; long tmp___0 ; { if ((uint )fp->index != (uint )(fp->bp)->num_queues - (fp->bp)->num_cnic_queues) { __set_bit(9, (unsigned long volatile *)(& init_params->rx.flags)); __set_bit(9, (unsigned long volatile *)(& init_params->tx.flags)); __set_bit(10, (unsigned long volatile *)(& init_params->rx.flags)); __set_bit(10, (unsigned long volatile *)(& init_params->tx.flags)); init_params->rx.hc_rate = (unsigned int )bp->rx_ticks != 0U ? (u16 )(1000000 / (int )bp->rx_ticks) : 0U; init_params->tx.hc_rate = (unsigned int )bp->tx_ticks != 0U ? (u16 )(1000000 / (int )bp->tx_ticks) : 0U; tmp = fp->fw_sb_id; init_params->tx.fw_sb_id = tmp; init_params->rx.fw_sb_id = tmp; init_params->rx.sb_cq_index = 1U; init_params->tx.sb_cq_index = 5U; } else { } init_params->max_cos = fp->max_cos; tmp___0 = ldv__builtin_expect((bp->msg_enable & 32) != 0, 0L); if (tmp___0 != 0L) { printk("\rbnx2x: [%s:%d(%s)]fp: %d setting queue params max cos to: %d\n", "bnx2x_pf_q_prep_init", 8236, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )fp->index, (int )init_params->max_cos); } else { } cos = 0U; goto ldv_57502; ldv_57501: cxt_index = (int )((fp->txdata_ptr[(int )cos])->cid / 32U); cxt_offset = (int )((fp->txdata_ptr[(int )cos])->cid - (unsigned int )((unsigned long )cxt_index) * 32U); init_params->cxts[(int )cos] = & (bp->context[cxt_index].vcxt + (unsigned long )cxt_offset)->eth; cos = (u8 )((int )cos + 1); ldv_57502: ; if ((int )init_params->max_cos > (int )cos) { goto ldv_57501; } else { } return; } } static int bnx2x_setup_tx_only(struct bnx2x *bp , struct bnx2x_fastpath *fp , struct bnx2x_queue_state_params *q_params , struct bnx2x_queue_setup_tx_only_params *tx_only_params , int tx_index , bool leading ) { long tmp ; int tmp___0 ; { memset((void *)tx_only_params, 0, 48UL); q_params->cmd = 2; tx_only_params->flags = bnx2x_get_common_flags(bp, fp, 0); tx_only_params->cid_index = (u8 )tx_index; bnx2x_pf_q_prep_general(bp, fp, & tx_only_params->gen_params, (int )((u8 )tx_index)); bnx2x_pf_tx_q_prep(bp, fp, & tx_only_params->txq_params, (int )((u8 )tx_index)); tmp = ldv__builtin_expect((bp->msg_enable & 32) != 0, 0L); if (tmp != 0L) { printk("\rbnx2x: [%s:%d(%s)]preparing to send tx-only ramrod for connection: cos %d, primary cid %d, cid %d, client id %d, sp-client id %d, flags %lx\n", "bnx2x_setup_tx_only", 8274, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", tx_index, (q_params->q_obj)->cids[0], (q_params->q_obj)->cids[tx_index], (int )(q_params->q_obj)->cl_id, (int )tx_only_params->gen_params.spcl_id, tx_only_params->flags); } else { } tmp___0 = bnx2x_queue_state_change(bp, q_params); return (tmp___0); } } int bnx2x_setup_queue(struct bnx2x *bp , struct bnx2x_fastpath *fp , bool leading ) { struct bnx2x_queue_state_params q_params ; struct bnx2x_queue_setup_params *setup_params ; struct bnx2x_queue_setup_tx_only_params *tx_only_params ; int rc ; u8 tx_index ; long tmp ; long tmp___0 ; { q_params.q_obj = 0; q_params.cmd = 0; q_params.ramrod_flags = 0UL; q_params.params.setup.gen_params.stat_id = (unsigned char)0; q_params.params.setup.gen_params.spcl_id = (unsigned char)0; q_params.params.setup.gen_params.mtu = (unsigned short)0; q_params.params.setup.gen_params.cos = (unsigned char)0; q_params.params.setup.txq_params.dscr_map = 0ULL; q_params.params.setup.txq_params.fw_sb_id = (unsigned char)0; q_params.params.setup.txq_params.sb_cq_index = (unsigned char)0; q_params.params.setup.txq_params.cos = (unsigned char)0; q_params.params.setup.txq_params.traffic_type = (unsigned short)0; q_params.params.setup.txq_params.tss_leading_cl_id = (unsigned char)0; q_params.params.setup.txq_params.default_vlan = (unsigned short)0; q_params.params.setup.rxq_params.dscr_map = 0ULL; q_params.params.setup.rxq_params.sge_map = 0ULL; q_params.params.setup.rxq_params.rcq_map = 0ULL; q_params.params.setup.rxq_params.rcq_np_map = 0ULL; q_params.params.setup.rxq_params.drop_flags = (unsigned short)0; q_params.params.setup.rxq_params.buf_sz = (unsigned short)0; q_params.params.setup.rxq_params.fw_sb_id = (unsigned char)0; q_params.params.setup.rxq_params.cl_qzone_id = (unsigned char)0; q_params.params.setup.rxq_params.tpa_agg_sz = (unsigned short)0; q_params.params.setup.rxq_params.sge_buf_sz = (unsigned short)0; q_params.params.setup.rxq_params.max_sges_pkt = (unsigned char)0; q_params.params.setup.rxq_params.max_tpa_queues = (unsigned char)0; q_params.params.setup.rxq_params.rss_engine_id = (unsigned char)0; q_params.params.setup.rxq_params.mcast_engine_id = (unsigned char)0; q_params.params.setup.rxq_params.cache_line_log = (unsigned char)0; q_params.params.setup.rxq_params.sb_cq_index = (unsigned char)0; q_params.params.setup.rxq_params.silent_removal_value = (unsigned short)0; q_params.params.setup.rxq_params.silent_removal_mask = (unsigned short)0; q_params.params.setup.pause_params.bd_th_lo = (unsigned short)0; q_params.params.setup.pause_params.bd_th_hi = (unsigned short)0; q_params.params.setup.pause_params.rcq_th_lo = (unsigned short)0; q_params.params.setup.pause_params.rcq_th_hi = (unsigned short)0; q_params.params.setup.pause_params.sge_th_lo = (unsigned short)0; q_params.params.setup.pause_params.sge_th_hi = (unsigned short)0; q_params.params.setup.pause_params.pri_map = (unsigned short)0; q_params.params.setup.flags = 0UL; setup_params = & q_params.params.setup; tx_only_params = & q_params.params.tx_only; tmp = ldv__builtin_expect((bp->msg_enable & 32) != 0, 0L); if (tmp != 0L) { printk("\rbnx2x: [%s:%d(%s)]setting up queue %d\n", "bnx2x_setup_queue", 8303, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )fp->index); } else { } if ((uint )fp->index != (uint )(fp->bp)->num_queues - (fp->bp)->num_cnic_queues) { bnx2x_ack_sb(bp, (int )fp->igu_sb_id, 0, 0, 0, 0); } else { } q_params.q_obj = & (bp->sp_objs + (unsigned long )fp->index)->q_obj; __set_bit(2, (unsigned long volatile *)(& q_params.ramrod_flags)); bnx2x_pf_q_prep_init(bp, fp, & q_params.params.init); q_params.cmd = 0; rc = bnx2x_queue_state_change(bp, & q_params); if (rc != 0) { printk("\vbnx2x: [%s:%d(%s)]Queue(%d) INIT failed\n", "bnx2x_setup_queue", 8323, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )fp->index); return (rc); } else { } tmp___0 = ldv__builtin_expect((bp->msg_enable & 32) != 0, 0L); if (tmp___0 != 0L) { printk("\rbnx2x: [%s:%d(%s)]init complete\n", "bnx2x_setup_queue", 8327, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } memset((void *)setup_params, 0, 112UL); setup_params->flags = bnx2x_get_q_flags(bp, fp, (int )leading); bnx2x_pf_q_prep_general(bp, fp, & setup_params->gen_params, 0); bnx2x_pf_rx_q_prep(bp, fp, & setup_params->pause_params, & setup_params->rxq_params); bnx2x_pf_tx_q_prep(bp, fp, & setup_params->txq_params, 0); q_params.cmd = 1; if ((uint )fp->index == (uint )(fp->bp)->num_queues - (fp->bp)->num_cnic_queues) { bp->fcoe_init = 1; } else { } rc = bnx2x_queue_state_change(bp, & q_params); if (rc != 0) { printk("\vbnx2x: [%s:%d(%s)]Queue(%d) SETUP failed\n", "bnx2x_setup_queue", 8355, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )fp->index); return (rc); } else { } tx_index = 1U; goto ldv_57525; ldv_57524: rc = bnx2x_setup_tx_only(bp, fp, & q_params, tx_only_params, (int )tx_index, (int )leading); if (rc != 0) { printk("\vbnx2x: [%s:%d(%s)]Queue(%d.%d) TX_ONLY_SETUP failed\n", "bnx2x_setup_queue", 8369, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )fp->index, (int )tx_index); return (rc); } else { } tx_index = (u8 )((int )tx_index + 1); ldv_57525: ; if ((int )fp->max_cos > (int )tx_index) { goto ldv_57524; } else { } return (rc); } } static int bnx2x_stop_queue(struct bnx2x *bp , int index ) { struct bnx2x_fastpath *fp ; struct bnx2x_fp_txdata *txdata ; struct bnx2x_queue_state_params q_params ; int rc ; int tx_index ; long tmp ; long tmp___0 ; int tmp___1 ; { fp = bp->fp + (unsigned long )index; q_params.q_obj = 0; q_params.cmd = 0; q_params.ramrod_flags = 0UL; q_params.params.setup.gen_params.stat_id = (unsigned char)0; q_params.params.setup.gen_params.spcl_id = (unsigned char)0; q_params.params.setup.gen_params.mtu = (unsigned short)0; q_params.params.setup.gen_params.cos = (unsigned char)0; q_params.params.setup.txq_params.dscr_map = 0ULL; q_params.params.setup.txq_params.fw_sb_id = (unsigned char)0; q_params.params.setup.txq_params.sb_cq_index = (unsigned char)0; q_params.params.setup.txq_params.cos = (unsigned char)0; q_params.params.setup.txq_params.traffic_type = (unsigned short)0; q_params.params.setup.txq_params.tss_leading_cl_id = (unsigned char)0; q_params.params.setup.txq_params.default_vlan = (unsigned short)0; q_params.params.setup.rxq_params.dscr_map = 0ULL; q_params.params.setup.rxq_params.sge_map = 0ULL; q_params.params.setup.rxq_params.rcq_map = 0ULL; q_params.params.setup.rxq_params.rcq_np_map = 0ULL; q_params.params.setup.rxq_params.drop_flags = (unsigned short)0; q_params.params.setup.rxq_params.buf_sz = (unsigned short)0; q_params.params.setup.rxq_params.fw_sb_id = (unsigned char)0; q_params.params.setup.rxq_params.cl_qzone_id = (unsigned char)0; q_params.params.setup.rxq_params.tpa_agg_sz = (unsigned short)0; q_params.params.setup.rxq_params.sge_buf_sz = (unsigned short)0; q_params.params.setup.rxq_params.max_sges_pkt = (unsigned char)0; q_params.params.setup.rxq_params.max_tpa_queues = (unsigned char)0; q_params.params.setup.rxq_params.rss_engine_id = (unsigned char)0; q_params.params.setup.rxq_params.mcast_engine_id = (unsigned char)0; q_params.params.setup.rxq_params.cache_line_log = (unsigned char)0; q_params.params.setup.rxq_params.sb_cq_index = (unsigned char)0; q_params.params.setup.rxq_params.silent_removal_value = (unsigned short)0; q_params.params.setup.rxq_params.silent_removal_mask = (unsigned short)0; q_params.params.setup.pause_params.bd_th_lo = (unsigned short)0; q_params.params.setup.pause_params.bd_th_hi = (unsigned short)0; q_params.params.setup.pause_params.rcq_th_lo = (unsigned short)0; q_params.params.setup.pause_params.rcq_th_hi = (unsigned short)0; q_params.params.setup.pause_params.sge_th_lo = (unsigned short)0; q_params.params.setup.pause_params.sge_th_hi = (unsigned short)0; q_params.params.setup.pause_params.pri_map = (unsigned short)0; q_params.params.setup.flags = 0UL; tmp = ldv__builtin_expect((bp->msg_enable & 16) != 0, 0L); if (tmp != 0L) { printk("\rbnx2x: [%s:%d(%s)]stopping queue %d cid %d\n", "bnx2x_stop_queue", 8384, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", index, fp->cid); } else { } q_params.q_obj = & (bp->sp_objs + (unsigned long )fp->index)->q_obj; __set_bit(2, (unsigned long volatile *)(& q_params.ramrod_flags)); tx_index = 1; goto ldv_57538; ldv_57537: txdata = fp->txdata_ptr[tx_index]; tmp___0 = ldv__builtin_expect((bp->msg_enable & 16) != 0, 0L); if (tmp___0 != 0L) { printk("\rbnx2x: [%s:%d(%s)]stopping tx-only queue %d\n", "bnx2x_stop_queue", 8400, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", txdata->txq_index); } else { } q_params.cmd = 9; memset((void *)(& q_params.params.terminate), 0, 1UL); q_params.params.terminate.cid_index = (u8 )tx_index; rc = bnx2x_queue_state_change(bp, & q_params); if (rc != 0) { return (rc); } else { } q_params.cmd = 8; memset((void *)(& q_params.params.cfc_del), 0, 1UL); q_params.params.cfc_del.cid_index = (u8 )tx_index; rc = bnx2x_queue_state_change(bp, & q_params); if (rc != 0) { return (rc); } else { } tx_index = tx_index + 1; ldv_57538: ; if ((int )fp->max_cos > tx_index) { goto ldv_57537; } else { } q_params.cmd = 7; rc = bnx2x_queue_state_change(bp, & q_params); if (rc != 0) { return (rc); } else { } q_params.cmd = 9; memset((void *)(& q_params.params.terminate), 0, 1UL); q_params.params.terminate.cid_index = 0U; rc = bnx2x_queue_state_change(bp, & q_params); if (rc != 0) { return (rc); } else { } q_params.cmd = 8; memset((void *)(& q_params.params.cfc_del), 0, 1UL); q_params.params.cfc_del.cid_index = 0U; tmp___1 = bnx2x_queue_state_change(bp, & q_params); return (tmp___1); } } static void bnx2x_reset_func(struct bnx2x *bp ) { int port ; int func ; int i ; struct bnx2x_fastpath *fp ; u8 tmp ; unsigned int tmp___0 ; struct ilt_client_info ilt_cli ; { port = (int )bp->pfid & 1; func = (int )bp->pfid; writeb(0, (void volatile *)bp->regview + (unsigned long )(((unsigned int )(bp->iro_arr + 47UL)->base + (unsigned int )((int )(bp->iro_arr + 47UL)->m1 * func)) + 4325376U)); writeb(0, (void volatile *)bp->regview + (unsigned long )(((unsigned int )(bp->iro_arr + 149UL)->base + (unsigned int )((int )(bp->iro_arr + 149UL)->m1 * func)) + 4259840U)); writeb(0, (void volatile *)bp->regview + (unsigned long )(((unsigned int )(bp->iro_arr + 103UL)->base + (unsigned int )((int )(bp->iro_arr + 103UL)->m1 * func)) + 4390912U)); writeb(0, (void volatile *)bp->regview + (unsigned long )(((unsigned int )(bp->iro_arr + 178UL)->base + (unsigned int )((int )(bp->iro_arr + 178UL)->m1 * func)) + 4194304U)); i = 0; goto ldv_57548; ldv_57547: fp = bp->fp + (unsigned long )i; writeb(0, (void volatile *)bp->regview + (unsigned long )(((unsigned int )(bp->iro_arr + 134UL)->base + (unsigned int )((int )fp->fw_sb_id * (int )(bp->iro_arr + 134UL)->m1)) + 4259840U)); i = i + 1; ldv_57548: ; if ((uint )i < bp->num_ethernet_queues) { goto ldv_57547; } else { } if ((int )bp->cnic_loaded) { tmp = bnx2x_cnic_fw_sb_id(bp); writeb(0, (void volatile *)bp->regview + (unsigned long )(((unsigned int )(bp->iro_arr + 134UL)->base + (unsigned int )((int )tmp * (int )(bp->iro_arr + 134UL)->m1)) + 4259840U)); } else { } writeb(0, (void volatile *)bp->regview + (unsigned long )(((unsigned int )(bp->iro_arr + 143UL)->base + (unsigned int )((int )(bp->iro_arr + 143UL)->m1 * func)) + 4259840U)); i = 0; goto ldv_57551; ldv_57550: writel(0U, (void volatile *)bp->regview + (unsigned long )(((unsigned int )(bp->iro_arr + 32UL)->base + (unsigned int )((int )(bp->iro_arr + 32UL)->m1 * func)) + 4325376U)); i = i + 1; ldv_57551: ; if ((int )((unsigned int )((unsigned short )(bp->iro_arr + 32UL)->size) / 4U) > i) { goto ldv_57550; } else { } if ((unsigned int )bp->common.int_block == 0U) { writel(0U, (void volatile *)bp->regview + (unsigned long )((port + 135176) * 8)); writel(0U, (void volatile *)bp->regview + (unsigned long )(port * 8 + 1081412)); } else { writel(0U, (void volatile *)bp->regview + 1245492U); writel(0U, (void volatile *)bp->regview + 1245444U); } if ((int )bp->cnic_loaded) { writel(0U, (void volatile *)bp->regview + (unsigned long )((port + 364549) * 4)); i = 0; goto ldv_57555; ldv_57554: msleep(10U); tmp___0 = readl((void const volatile *)bp->regview + (unsigned long )((port + 364596) * 4)); if (tmp___0 == 0U) { goto ldv_57553; } else { } i = i + 1; ldv_57555: ; if (i <= 199) { goto ldv_57554; } else { } ldv_57553: ; } else { } bnx2x_clear_func_ilt(bp, (u32 )func); if ((bp->common.chip_id >> 16 != 5710U && (bp->common.chip_id >> 16 != 5711U && bp->common.chip_id >> 16 != 5712U)) && (unsigned int )((int )bp->pfid >> 1) == 3U) { memset((void *)(& ilt_cli), 0, 12UL); ilt_cli.start = 0U; ilt_cli.end = 3071U; ilt_cli.client_num = 3U; bnx2x_ilt_boundry_init_op(bp, & ilt_cli, 0U, 1); } else { } if (bp->common.chip_id >> 16 != 5710U && (bp->common.chip_id >> 16 != 5711U && bp->common.chip_id >> 16 != 5712U)) { bnx2x_pf_disable(bp); } else { } bp->dmae_ready = 0; return; } } static void bnx2x_reset_port(struct bnx2x *bp ) { int port ; u32 val ; long tmp ; { port = (int )bp->pfid & 1; bnx2x__link_reset(bp); writel(0U, (void volatile *)bp->regview + (unsigned long )((port + 16588) * 4)); writel(0U, (void volatile *)bp->regview + (unsigned long )((port + 16529) * 4)); writel(0U, (void volatile *)(bp->regview + (port != 0 ? 66268UL : 66140UL))); writel(0U, (void volatile *)bp->regview + (unsigned long )((port + 10264) * 4)); msleep(100U); val = readl((void const volatile *)bp->regview + (unsigned long )((port + 98341) * 4)); if (val != 0U) { tmp = ldv__builtin_expect((bp->msg_enable & 16) != 0, 0L); if (tmp != 0L) { printk("\rbnx2x: [%s:%d(%s)]BRB1 is not empty %d blocks are occupied\n", "bnx2x_reset_port", 8550, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", val); } else { } } else { } return; } } static int bnx2x_reset_hw(struct bnx2x *bp , u32 load_code ) { struct bnx2x_func_state_params func_params ; int tmp ; { func_params.f_obj = 0; func_params.cmd = 0; func_params.ramrod_flags = 0UL; func_params.params.tx_start.traffic_type_to_priority_cos[0].priority = (unsigned char)0; func_params.params.tx_start.traffic_type_to_priority_cos[0].cos = (unsigned char)0; func_params.params.tx_start.traffic_type_to_priority_cos[0].reserved1 = (unsigned short)0; func_params.params.tx_start.traffic_type_to_priority_cos[1].priority = (unsigned char)0; func_params.params.tx_start.traffic_type_to_priority_cos[1].cos = (unsigned char)0; func_params.params.tx_start.traffic_type_to_priority_cos[1].reserved1 = (unsigned short)0; func_params.params.tx_start.traffic_type_to_priority_cos[2].priority = (unsigned char)0; func_params.params.tx_start.traffic_type_to_priority_cos[2].cos = (unsigned char)0; func_params.params.tx_start.traffic_type_to_priority_cos[2].reserved1 = (unsigned short)0; func_params.params.tx_start.traffic_type_to_priority_cos[3].priority = (unsigned char)0; func_params.params.tx_start.traffic_type_to_priority_cos[3].cos = (unsigned char)0; func_params.params.tx_start.traffic_type_to_priority_cos[3].reserved1 = (unsigned short)0; func_params.params.tx_start.traffic_type_to_priority_cos[4].priority = (unsigned char)0; func_params.params.tx_start.traffic_type_to_priority_cos[4].cos = (unsigned char)0; func_params.params.tx_start.traffic_type_to_priority_cos[4].reserved1 = (unsigned short)0; func_params.params.tx_start.traffic_type_to_priority_cos[5].priority = (unsigned char)0; func_params.params.tx_start.traffic_type_to_priority_cos[5].cos = (unsigned char)0; func_params.params.tx_start.traffic_type_to_priority_cos[5].reserved1 = (unsigned short)0; func_params.params.tx_start.traffic_type_to_priority_cos[6].priority = (unsigned char)0; func_params.params.tx_start.traffic_type_to_priority_cos[6].cos = (unsigned char)0; func_params.params.tx_start.traffic_type_to_priority_cos[6].reserved1 = (unsigned short)0; func_params.params.tx_start.traffic_type_to_priority_cos[7].priority = (unsigned char)0; func_params.params.tx_start.traffic_type_to_priority_cos[7].cos = (unsigned char)0; func_params.params.tx_start.traffic_type_to_priority_cos[7].reserved1 = (unsigned short)0; func_params.params.tx_start.dcb_enabled = (unsigned char)0; func_params.params.tx_start.dcb_version = (unsigned char)0; func_params.params.tx_start.dont_add_pri_0_en = (unsigned char)0; __set_bit(2, (unsigned long volatile *)(& func_params.ramrod_flags)); func_params.f_obj = & bp->func_obj; func_params.cmd = 3; func_params.params.hw_init.load_phase = load_code; tmp = bnx2x_func_state_change(bp, & func_params); return (tmp); } } static int bnx2x_func_stop(struct bnx2x *bp ) { struct bnx2x_func_state_params func_params ; int rc ; int tmp ; { func_params.f_obj = 0; func_params.cmd = 0; func_params.ramrod_flags = 0UL; func_params.params.tx_start.traffic_type_to_priority_cos[0].priority = (unsigned char)0; func_params.params.tx_start.traffic_type_to_priority_cos[0].cos = (unsigned char)0; func_params.params.tx_start.traffic_type_to_priority_cos[0].reserved1 = (unsigned short)0; func_params.params.tx_start.traffic_type_to_priority_cos[1].priority = (unsigned char)0; func_params.params.tx_start.traffic_type_to_priority_cos[1].cos = (unsigned char)0; func_params.params.tx_start.traffic_type_to_priority_cos[1].reserved1 = (unsigned short)0; func_params.params.tx_start.traffic_type_to_priority_cos[2].priority = (unsigned char)0; func_params.params.tx_start.traffic_type_to_priority_cos[2].cos = (unsigned char)0; func_params.params.tx_start.traffic_type_to_priority_cos[2].reserved1 = (unsigned short)0; func_params.params.tx_start.traffic_type_to_priority_cos[3].priority = (unsigned char)0; func_params.params.tx_start.traffic_type_to_priority_cos[3].cos = (unsigned char)0; func_params.params.tx_start.traffic_type_to_priority_cos[3].reserved1 = (unsigned short)0; func_params.params.tx_start.traffic_type_to_priority_cos[4].priority = (unsigned char)0; func_params.params.tx_start.traffic_type_to_priority_cos[4].cos = (unsigned char)0; func_params.params.tx_start.traffic_type_to_priority_cos[4].reserved1 = (unsigned short)0; func_params.params.tx_start.traffic_type_to_priority_cos[5].priority = (unsigned char)0; func_params.params.tx_start.traffic_type_to_priority_cos[5].cos = (unsigned char)0; func_params.params.tx_start.traffic_type_to_priority_cos[5].reserved1 = (unsigned short)0; func_params.params.tx_start.traffic_type_to_priority_cos[6].priority = (unsigned char)0; func_params.params.tx_start.traffic_type_to_priority_cos[6].cos = (unsigned char)0; func_params.params.tx_start.traffic_type_to_priority_cos[6].reserved1 = (unsigned short)0; func_params.params.tx_start.traffic_type_to_priority_cos[7].priority = (unsigned char)0; func_params.params.tx_start.traffic_type_to_priority_cos[7].cos = (unsigned char)0; func_params.params.tx_start.traffic_type_to_priority_cos[7].reserved1 = (unsigned short)0; func_params.params.tx_start.dcb_enabled = (unsigned char)0; func_params.params.tx_start.dcb_version = (unsigned char)0; func_params.params.tx_start.dont_add_pri_0_en = (unsigned char)0; __set_bit(2, (unsigned long volatile *)(& func_params.ramrod_flags)); func_params.f_obj = & bp->func_obj; func_params.cmd = 2; rc = bnx2x_func_state_change(bp, & func_params); if (rc != 0) { printk("\vbnx2x: [%s:%d(%s)]FUNC_STOP ramrod failed. Running a dry transaction\n", "bnx2x_func_stop", 8591, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); __set_bit(3, (unsigned long volatile *)(& func_params.ramrod_flags)); tmp = bnx2x_func_state_change(bp, & func_params); return (tmp); } else { } return (0); } } u32 bnx2x_send_unload_req(struct bnx2x *bp , int unload_mode ) { u32 reset_code ; int port ; u32 emac_base ; u8 *mac_addr ; u32 val ; u16 pmc ; u8 entry ; int path ; long tmp ; long tmp___0 ; { reset_code = 0U; port = (int )bp->pfid & 1; if (unload_mode == 0) { reset_code = 536936448U; } else if ((bp->flags & 8U) != 0U) { reset_code = 537001984U; } else if ((unsigned int )bp->wol != 0U) { emac_base = port != 0 ? 33792U : 32768U; mac_addr = (bp->dev)->dev_addr; entry = (unsigned int )((u8 )(((int )bp->pfid >> 1) + 1)) * 8U; val = (u32 )(((int )*mac_addr << 8) | (int )*(mac_addr + 1UL)); writel(val, (void volatile *)bp->regview + (unsigned long )(((u32 )entry + emac_base) + 16U)); val = (u32 )(((((int )*(mac_addr + 2UL) << 24) | ((int )*(mac_addr + 3UL) << 16)) | ((int )*(mac_addr + 4UL) << 8)) | (int )*(mac_addr + 5UL)); writel(val, (void volatile *)bp->regview + (unsigned long )(((u32 )entry + emac_base) + 20U)); pci_read_config_word((struct pci_dev const *)bp->pdev, bp->pm_cap + 4, & pmc); pmc = (u16 )((unsigned int )pmc | 33024U); pci_write_config_word((struct pci_dev const *)bp->pdev, bp->pm_cap + 4, (int )pmc); reset_code = 536870912U; } else { reset_code = 536936448U; } if ((bp->flags & 512U) == 0U) { reset_code = bnx2x_fw_command(bp, reset_code, 0U); } else { path = bp->common.chip_id >> 16 != 5710U && (bp->common.chip_id >> 16 != 5711U && bp->common.chip_id >> 16 != 5712U) ? (int )bp->pf_num & 1 : 0; tmp = ldv__builtin_expect((bp->msg_enable & 16) != 0, 0L); if (tmp != 0L) { printk("\rbnx2x: [%s:%d(%s)]NO MCP - load counts[%d] %d, %d, %d\n", "bnx2x_send_unload_req", 8656, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", path, load_count[path][0], load_count[path][1], load_count[path][2]); } else { } load_count[path][0] = load_count[path][0] - 1; load_count[path][port + 1] = load_count[path][port + 1] - 1; tmp___0 = ldv__builtin_expect((bp->msg_enable & 16) != 0, 0L); if (tmp___0 != 0L) { printk("\rbnx2x: [%s:%d(%s)]NO MCP - new load counts[%d] %d, %d, %d\n", "bnx2x_send_unload_req", 8661, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", path, load_count[path][0], load_count[path][1], load_count[path][2]); } else { } if (load_count[path][0] == 0) { reset_code = 537919488U; } else if (load_count[path][port + 1] == 0) { reset_code = 537985024U; } else { reset_code = 538050560U; } } return (reset_code); } } void bnx2x_send_unload_done(struct bnx2x *bp , bool keep_link ) { u32 reset_param ; { reset_param = (int )keep_link ? 2U : 0U; if ((bp->flags & 512U) == 0U) { bnx2x_fw_command(bp, 553648128U, reset_param); } else { } return; } } static int bnx2x_func_wait_started(struct bnx2x *bp ) { int tout ; int msix ; enum bnx2x_func_state tmp ; int tmp___0 ; struct bnx2x_func_state_params func_params ; long tmp___1 ; int tmp___2 ; enum bnx2x_func_state tmp___3 ; { tout = 50; msix = (bp->flags & 32U) != 0U; if (bp->port.pmf == 0U) { return (0); } else { } if (msix != 0) { synchronize_irq((bp->msix_table)->vector); } else { synchronize_irq((bp->pdev)->irq); } flush_workqueue(bnx2x_wq); goto ldv_57598; ldv_57597: msleep(20U); ldv_57598: tmp = bnx2x_func_get_state(bp, & bp->func_obj); if ((unsigned int )tmp != 2U) { tmp___0 = tout; tout = tout - 1; if (tmp___0 != 0) { goto ldv_57597; } else { goto ldv_57599; } } else { } ldv_57599: tmp___3 = bnx2x_func_get_state(bp, & bp->func_obj); if ((unsigned int )tmp___3 != 2U) { func_params.f_obj = 0; func_params.cmd = 0; func_params.ramrod_flags = 0UL; func_params.params.tx_start.traffic_type_to_priority_cos[0].priority = (unsigned char)0; func_params.params.tx_start.traffic_type_to_priority_cos[0].cos = (unsigned char)0; func_params.params.tx_start.traffic_type_to_priority_cos[0].reserved1 = (unsigned short)0; func_params.params.tx_start.traffic_type_to_priority_cos[1].priority = (unsigned char)0; func_params.params.tx_start.traffic_type_to_priority_cos[1].cos = (unsigned char)0; func_params.params.tx_start.traffic_type_to_priority_cos[1].reserved1 = (unsigned short)0; func_params.params.tx_start.traffic_type_to_priority_cos[2].priority = (unsigned char)0; func_params.params.tx_start.traffic_type_to_priority_cos[2].cos = (unsigned char)0; func_params.params.tx_start.traffic_type_to_priority_cos[2].reserved1 = (unsigned short)0; func_params.params.tx_start.traffic_type_to_priority_cos[3].priority = (unsigned char)0; func_params.params.tx_start.traffic_type_to_priority_cos[3].cos = (unsigned char)0; func_params.params.tx_start.traffic_type_to_priority_cos[3].reserved1 = (unsigned short)0; func_params.params.tx_start.traffic_type_to_priority_cos[4].priority = (unsigned char)0; func_params.params.tx_start.traffic_type_to_priority_cos[4].cos = (unsigned char)0; func_params.params.tx_start.traffic_type_to_priority_cos[4].reserved1 = (unsigned short)0; func_params.params.tx_start.traffic_type_to_priority_cos[5].priority = (unsigned char)0; func_params.params.tx_start.traffic_type_to_priority_cos[5].cos = (unsigned char)0; func_params.params.tx_start.traffic_type_to_priority_cos[5].reserved1 = (unsigned short)0; func_params.params.tx_start.traffic_type_to_priority_cos[6].priority = (unsigned char)0; func_params.params.tx_start.traffic_type_to_priority_cos[6].cos = (unsigned char)0; func_params.params.tx_start.traffic_type_to_priority_cos[6].reserved1 = (unsigned short)0; func_params.params.tx_start.traffic_type_to_priority_cos[7].priority = (unsigned char)0; func_params.params.tx_start.traffic_type_to_priority_cos[7].cos = (unsigned char)0; func_params.params.tx_start.traffic_type_to_priority_cos[7].reserved1 = (unsigned short)0; func_params.params.tx_start.dcb_enabled = (unsigned char)0; func_params.params.tx_start.dcb_version = (unsigned char)0; func_params.params.tx_start.dont_add_pri_0_en = (unsigned char)0; tmp___1 = ldv__builtin_expect((bp->msg_enable & 16) != 0, 0L); if (tmp___1 != 0L) { printk("\rbnx2x: [%s:%d(%s)]Hmmm... unexpected function state! Forcing STARTED-->TX_ST0PPED-->STARTED\n", "bnx2x_func_wait_started", 8735, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } func_params.f_obj = & bp->func_obj; __set_bit(3, (unsigned long volatile *)(& func_params.ramrod_flags)); func_params.cmd = 6; bnx2x_func_state_change(bp, & func_params); func_params.cmd = 7; tmp___2 = bnx2x_func_state_change(bp, & func_params); return (tmp___2); } else { } return (0); } } void bnx2x_chip_cleanup(struct bnx2x *bp , int unload_mode , bool keep_link ) { int port ; int i ; int rc ; u8 cos ; struct bnx2x_mcast_ramrod_params rparam ; u32 reset_code ; struct bnx2x_fastpath *fp ; int tmp ; int tmp___0 ; int tmp___1 ; bool tmp___2 ; int tmp___3 ; { port = (int )bp->pfid & 1; rc = 0; rparam.mcast_obj = 0; rparam.ramrod_flags = 0UL; rparam.mcast_list.next = 0; rparam.mcast_list.prev = 0; rparam.mcast_list_len = 0; i = 0; goto ldv_57619; ldv_57618: ; if ((bp->flags & 32768U) != 0U && (uint )i == (uint )bp->num_queues - bp->num_cnic_queues) { } else { fp = bp->fp + (unsigned long )i; cos = 0U; goto ldv_57616; ldv_57615: rc = bnx2x_clean_tx_queue(bp, fp->txdata_ptr[(int )cos]); cos = (u8 )((int )cos + 1); ldv_57616: ; if ((int )fp->max_cos > (int )cos) { goto ldv_57615; } else { } } i = i + 1; ldv_57619: ; if (bp->num_queues > i) { goto ldv_57618; } else { } usleep_range(1000UL, 2000UL); rc = bnx2x_del_all_macs(bp, & (bp->sp_objs)->mac_obj, 1, 0); if (rc < 0) { printk("\vbnx2x: [%s:%d(%s)]Failed to delete all ETH macs: %d\n", "bnx2x_chip_cleanup", 8781, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", rc); } else { } rc = bnx2x_del_all_macs(bp, & (bp->sp_objs)->mac_obj, 0, 1); if (rc < 0) { printk("\vbnx2x: [%s:%d(%s)]Failed to schedule DEL commands for UC MACs list: %d\n", "bnx2x_chip_cleanup", 8788, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", rc); } else { } if (bp->common.chip_id >> 16 != 5710U) { writel(0U, (void volatile *)bp->regview + (unsigned long )(port * 8 + 90364)); } else { } netif_addr_lock_bh(bp->dev); tmp = constant_test_bit(3U, (unsigned long const volatile *)(& bp->sp_state)); if (tmp != 0) { set_bit(4U, (unsigned long volatile *)(& bp->sp_state)); } else { bnx2x_set_storm_rx_mode(bp); } rparam.mcast_obj = & bp->mcast_obj; rc = bnx2x_config_mcast(bp, & rparam, 2); if (rc < 0) { printk("\vbnx2x: [%s:%d(%s)]Failed to send DEL multicast command: %d\n", "bnx2x_chip_cleanup", 8809, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", rc); } else { } netif_addr_unlock_bh(bp->dev); bnx2x_iov_chip_cleanup(bp); reset_code = bnx2x_send_unload_req(bp, unload_mode); rc = bnx2x_func_wait_started(bp); if (rc != 0) { printk("\vbnx2x: [%s:%d(%s)]bnx2x_func_wait_started failed\n", "bnx2x_chip_cleanup", 8829, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } i = 0; goto ldv_57624; ldv_57623: tmp___0 = bnx2x_stop_queue(bp, i); if (tmp___0 != 0) { goto unload_error; } else { } i = i + 1; ldv_57624: ; if ((uint )i < bp->num_ethernet_queues) { goto ldv_57623; } else { } if ((int )bp->cnic_loaded) { i = (int )bp->num_ethernet_queues; goto ldv_57628; ldv_57627: ; if ((bp->flags & 32768U) != 0U && (uint )i == (uint )bp->num_queues - bp->num_cnic_queues) { } else { tmp___1 = bnx2x_stop_queue(bp, i); if (tmp___1 != 0) { goto unload_error; } else { } } i = i + 1; ldv_57628: ; if (bp->num_queues > i) { goto ldv_57627; } else { } } else { } tmp___2 = bnx2x_wait_sp_comp(bp, 0xffffffffffffffffUL); if (tmp___2) { tmp___3 = 0; } else { tmp___3 = 1; } if (tmp___3) { printk("\vbnx2x: [%s:%d(%s)]Hmmm... Common slow path ramrods got stuck!\n", "bnx2x_chip_cleanup", 8860, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } unload_error: rc = bnx2x_func_stop(bp); if (rc != 0) { printk("\vbnx2x: [%s:%d(%s)]Function stop failed!\n", "bnx2x_chip_cleanup", 8867, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } bnx2x_netif_stop(bp, 1); bnx2x_del_all_napi(bp); if ((int )bp->cnic_loaded) { bnx2x_del_all_napi_cnic(bp); } else { } bnx2x_free_irq(bp); rc = bnx2x_reset_hw(bp, reset_code); if (rc != 0) { printk("\vbnx2x: [%s:%d(%s)]HW_RESET failed\n", "bnx2x_chip_cleanup", 8886, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } bnx2x_send_unload_done(bp, (int )keep_link); return; } } void bnx2x_disable_close_the_gate(struct bnx2x *bp ) { u32 val ; long tmp ; int port ; u32 addr ; { tmp = ldv__builtin_expect((bp->msg_enable & 16) != 0, 0L); if (tmp != 0L) { printk("\rbnx2x: [%s:%d(%s)]Disabling \"close the gates\"\n", "bnx2x_disable_close_the_gate", 8897, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } if (bp->common.chip_id >> 16 == 5710U) { port = (int )bp->pfid & 1; addr = port != 0 ? 41060U : 41056U; val = readl((void const volatile *)bp->regview + (unsigned long )addr); val = val & 4294966527U; writel(val, (void volatile *)bp->regview + (unsigned long )addr); } else { val = readl((void const volatile *)bp->regview + 42524U); val = val & 4294967292U; writel(val, (void volatile *)bp->regview + 42524U); } return; } } static void bnx2x_set_234_gates(struct bnx2x *bp , bool close ) { u32 val ; long tmp ; { if (bp->common.chip_id >> 16 != 5710U) { writel((unsigned int )close, (void volatile *)bp->regview + 1061028U); writel((unsigned int )close, (void volatile *)bp->regview + 1061032U); } else { } if (bp->common.chip_id >> 16 == 5710U || (bp->common.chip_id >> 16 == 5711U || bp->common.chip_id >> 16 == 5712U)) { val = readl((void const volatile *)bp->regview + 1081348U); writel(! close ? val | 1U : val & 4294967294U, (void volatile *)bp->regview + 1081348U); val = readl((void const volatile *)bp->regview + 1081344U); writel(! close ? val | 1U : val & 4294967294U, (void volatile *)bp->regview + 1081344U); } else { val = readl((void const volatile *)bp->regview + 1245184U); writel(! close ? val | 1U : val & 4294967294U, (void volatile *)bp->regview + 1245184U); } tmp = ldv__builtin_expect((bp->msg_enable & 8224) != 0, 0L); if (tmp != 0L) { printk("\rbnx2x: [%s:%d(%s)]%s gates #2, #3 and #4\n", "bnx2x_set_234_gates", 8951, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )close ? (char *)"closing" : (char *)"opening"); } else { } __asm__ volatile ("": : : "memory"); return; } } static void bnx2x_clp_reset_prep(struct bnx2x *bp , u32 *magic_val ) { u32 val ; unsigned int tmp ; { tmp = readl((void const volatile *)bp->regview + (unsigned long )bp->common.mf_cfg_base); val = tmp; *magic_val = val & 2147483648U; writel(val | 2147483648U, (void volatile *)bp->regview + (unsigned long )bp->common.mf_cfg_base); return; } } static void bnx2x_clp_reset_done(struct bnx2x *bp , u32 magic_val ) { u32 val ; unsigned int tmp ; { tmp = readl((void const volatile *)bp->regview + (unsigned long )bp->common.mf_cfg_base); val = tmp; writel((val & 2147483647U) | magic_val, (void volatile *)bp->regview + (unsigned long )bp->common.mf_cfg_base); return; } } static void bnx2x_reset_mcp_prep(struct bnx2x *bp , u32 *magic_val ) { u32 shmem ; u32 validity_offset ; long tmp ; { tmp = ldv__builtin_expect((bp->msg_enable & 8224) != 0, 0L); if (tmp != 0L) { printk("\rbnx2x: [%s:%d(%s)]Starting\n", "bnx2x_reset_mcp_prep", 8992, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } if (bp->common.chip_id >> 16 != 5710U) { bnx2x_clp_reset_prep(bp, magic_val); } else { } shmem = readl((void const volatile *)bp->regview + 41652U); validity_offset = ((u32 )bp->pfid & 1U) * 4U; if (shmem != 0U) { writel(0U, (void volatile *)bp->regview + (unsigned long )(shmem + validity_offset)); } else { } return; } } static void bnx2x_mcp_wait_one(struct bnx2x *bp ) { { if ((bp->common.chip_id & 61440U) > 20480U) { msleep(1000U); } else { msleep(100U); } return; } } static int bnx2x_init_shmem(struct bnx2x *bp ) { int cnt ; u32 val ; int tmp ; { cnt = 0; val = 0U; ldv_57668: bp->common.shmem_base = readl((void const volatile *)bp->regview + 41652U); if (bp->common.shmem_base != 0U) { val = readl((void const volatile *)(bp->regview + ((unsigned long )bp->common.shmem_base + ((unsigned long )bp->pfid & 1UL) * 4UL))); if ((val & 2097152U) != 0U) { return (0); } else { } } else { } bnx2x_mcp_wait_one(bp); tmp = cnt; cnt = cnt + 1; if (tmp <= 49) { goto ldv_57668; } else { } printk("\vbnx2x: [%s:%d(%s)]BAD MCP validity signature\n", "bnx2x_init_shmem", 9046, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); return (-19); } } static int bnx2x_reset_mcp_comp(struct bnx2x *bp , u32 magic_val ) { int rc ; int tmp ; { tmp = bnx2x_init_shmem(bp); rc = tmp; if (bp->common.chip_id >> 16 != 5710U) { bnx2x_clp_reset_done(bp, magic_val); } else { } return (rc); } } static void bnx2x_pxp_prep(struct bnx2x *bp ) { { if (bp->common.chip_id >> 16 != 5710U) { writel(0U, (void volatile *)bp->regview + 1180524U); writel(0U, (void volatile *)bp->regview + 1180080U); __asm__ volatile ("": : : "memory"); } else { } return; } } static void bnx2x_process_kill_chip_reset(struct bnx2x *bp , bool global ) { u32 not_reset_mask1 ; u32 reset_mask1 ; u32 not_reset_mask2 ; u32 reset_mask2 ; u32 global_bits2 ; u32 stay_reset2 ; { global_bits2 = 384U; not_reset_mask1 = 738197504U; not_reset_mask2 = 3861119U; stay_reset2 = 12582912U; reset_mask1 = 4294967295U; if (bp->common.chip_id >> 16 == 5710U) { reset_mask2 = 65535U; } else if (bp->common.chip_id >> 16 == 5711U || bp->common.chip_id >> 16 == 5712U) { reset_mask2 = 131071U; } else if ((bp->common.chip_id >> 16 == 5730U || bp->common.chip_id >> 16 == 5731U) || bp->common.chip_id >> 16 == 5743U) { reset_mask2 = 1048575U; } else { reset_mask2 = 67108863U; } if (! global) { reset_mask2 = ~ global_bits2 & reset_mask2; } else { } writel(~ not_reset_mask2 & reset_mask2, (void volatile *)bp->regview + 42392U); writel(~ not_reset_mask1 & reset_mask1, (void volatile *)bp->regview + 42376U); __asm__ volatile ("": : : "memory"); __asm__ volatile ("": : : "memory"); writel(~ stay_reset2 & reset_mask2, (void volatile *)bp->regview + 42388U); __asm__ volatile ("": : : "memory"); __asm__ volatile ("": : : "memory"); writel(reset_mask1, (void volatile *)bp->regview + 42372U); __asm__ volatile ("": : : "memory"); return; } } static int bnx2x_er_poll_igu_vq(struct bnx2x *bp ) { u32 cnt ; u32 pend_bits ; u32 tmp ; { cnt = 1000U; pend_bits = 0U; ldv_57695: pend_bits = readl((void const volatile *)bp->regview + 1245952U); if (pend_bits == 0U) { goto ldv_57694; } else { } usleep_range(1000UL, 2000UL); tmp = cnt; cnt = cnt - 1U; if (tmp != 0U) { goto ldv_57695; } else { } ldv_57694: ; if (cnt == 0U) { printk("\vbnx2x: [%s:%d(%s)]Still pending IGU requests pend_bits=%x!\n", "bnx2x_er_poll_igu_vq", 9204, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", pend_bits); return (-16); } else { } return (0); } } static int bnx2x_process_kill(struct bnx2x *bp , bool global ) { int cnt ; u32 val ; u32 sr_cnt ; u32 blk_cnt ; u32 port_is_idle_0 ; u32 port_is_idle_1 ; u32 pgl_exp_rom2 ; u32 tags_63_32 ; int tmp ; int tmp___0 ; int tmp___1 ; { cnt = 1000; val = 0U; tags_63_32 = 0U; ldv_57710: sr_cnt = readl((void const volatile *)bp->regview + 1180692U); blk_cnt = readl((void const volatile *)bp->regview + 1180696U); port_is_idle_0 = readl((void const volatile *)bp->regview + 1180700U); port_is_idle_1 = readl((void const volatile *)bp->regview + 1180704U); pgl_exp_rom2 = readl((void const volatile *)bp->regview + 1181704U); if (((((((((bp->common.chip_id >> 16 == 5770U || bp->common.chip_id >> 16 == 5797U) || bp->common.chip_id >> 16 == 5801U) || bp->common.chip_id >> 16 == 5774U) || bp->common.chip_id >> 16 == 5806U) || bp->common.chip_id >> 16 == 5807U) || ((bp->common.chip_id >> 16 == 5693U || bp->common.chip_id >> 16 == 5694U) || bp->common.chip_id >> 16 == 5695U)) || ((bp->common.chip_id >> 16 == 5793U || bp->common.chip_id >> 16 == 5794U) || bp->common.chip_id >> 16 == 5773U)) || (bp->common.chip_id >> 16 == 5796U || bp->common.chip_id >> 16 == 5803U)) || bp->common.chip_id >> 16 == 5805U) { tags_63_32 = readl((void const volatile *)bp->regview + 37444U); } else { } if (((((sr_cnt == 126U && blk_cnt == 160U) && (int )port_is_idle_0 & 1) && (int )port_is_idle_1 & 1) && pgl_exp_rom2 == 4294967295U) && ((((((((((bp->common.chip_id >> 16 != 5770U && bp->common.chip_id >> 16 != 5797U) && bp->common.chip_id >> 16 != 5801U) && bp->common.chip_id >> 16 != 5774U) && bp->common.chip_id >> 16 != 5806U) && bp->common.chip_id >> 16 != 5807U) && ((bp->common.chip_id >> 16 != 5693U && bp->common.chip_id >> 16 != 5694U) && bp->common.chip_id >> 16 != 5695U)) && ((bp->common.chip_id >> 16 != 5793U && bp->common.chip_id >> 16 != 5794U) && bp->common.chip_id >> 16 != 5773U)) && (bp->common.chip_id >> 16 != 5796U && bp->common.chip_id >> 16 != 5803U)) && bp->common.chip_id >> 16 != 5805U) || tags_63_32 == 4294967295U)) { goto ldv_57709; } else { } usleep_range(1000UL, 2000UL); tmp = cnt; cnt = cnt - 1; if (tmp > 0) { goto ldv_57710; } else { } ldv_57709: ; if (cnt <= 0) { printk("\vbnx2x: [%s:%d(%s)]Tetris buffer didn\'t get empty or there are still outstanding read requests after 1s!\n", "bnx2x_process_kill", 9238, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); printk("\vbnx2x: [%s:%d(%s)]sr_cnt=0x%08x, blk_cnt=0x%08x, port_is_idle_0=0x%08x, port_is_idle_1=0x%08x, pgl_exp_rom2=0x%08x\n", "bnx2x_process_kill", 9241, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", sr_cnt, blk_cnt, port_is_idle_0, port_is_idle_1, pgl_exp_rom2); return (-11); } else { } __asm__ volatile ("": : : "memory"); bnx2x_set_234_gates(bp, 1); if (bp->common.chip_id >> 16 != 5710U && (bp->common.chip_id >> 16 != 5711U && bp->common.chip_id >> 16 != 5712U)) { tmp___0 = bnx2x_er_poll_igu_vq(bp); if (tmp___0 != 0) { return (-11); } else { } } else { } writel(0U, (void volatile *)bp->regview + 42020U); __asm__ volatile ("": : : "memory"); __asm__ volatile ("": : : "memory"); usleep_range(1000UL, 2000UL); if ((int )global) { bnx2x_reset_mcp_prep(bp, & val); } else { } bnx2x_pxp_prep(bp); __asm__ volatile ("": : : "memory"); bnx2x_process_kill_chip_reset(bp, (int )global); __asm__ volatile ("": : : "memory"); if ((int )global) { tmp___1 = bnx2x_reset_mcp_comp(bp, val); if (tmp___1 != 0) { return (-11); } else { } } else { } bnx2x_set_234_gates(bp, 0); return (0); } } static int bnx2x_leader_reset(struct bnx2x *bp ) { int rc ; bool global ; bool tmp ; u32 load_code ; int tmp___0 ; { rc = 0; tmp = bnx2x_reset_is_global(bp); global = tmp; if (! global && (bp->flags & 512U) == 0U) { load_code = bnx2x_fw_command(bp, 268435456U, 4106U); if (load_code == 0U) { printk("\vbnx2x: [%s:%d(%s)]MCP response failure, aborting\n", "bnx2x_leader_reset", 9311, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); rc = -11; goto exit_leader_reset; } else { } if (load_code != 269680640U && load_code != 269484032U) { printk("\vbnx2x: [%s:%d(%s)]MCP unexpected resp, aborting\n", "bnx2x_leader_reset", 9317, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); rc = -11; goto exit_leader_reset2; } else { } load_code = bnx2x_fw_command(bp, 285212672U, 0U); if (load_code == 0U) { printk("\vbnx2x: [%s:%d(%s)]MCP response failure, aborting\n", "bnx2x_leader_reset", 9323, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); rc = -11; goto exit_leader_reset2; } else { } } else { } tmp___0 = bnx2x_process_kill(bp, (int )global); if (tmp___0 != 0) { printk("\vbnx2x: [%s:%d(%s)]Something bad had happen on engine %d! Aii!\n", "bnx2x_leader_reset", 9332, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", bp->common.chip_id >> 16 != 5710U && (bp->common.chip_id >> 16 != 5711U && bp->common.chip_id >> 16 != 5712U) ? (int )bp->pf_num & 1 : 0); rc = -11; goto exit_leader_reset2; } else { } bnx2x_set_reset_done(bp); if ((int )global) { bnx2x_clear_reset_global(bp); } else { } exit_leader_reset2: ; if (! global && (bp->flags & 512U) == 0U) { bnx2x_fw_command(bp, 537001984U, 0U); bnx2x_fw_command(bp, 553648128U, 0U); } else { } exit_leader_reset: bp->is_leader = 0; bnx2x_release_leader_lock(bp); __asm__ volatile ("mfence": : : "memory"); return (rc); } } static void bnx2x_recovery_failed(struct bnx2x *bp ) { { netdev_err((struct net_device const *)bp->dev, "Recovery has failed. Power cycle is needed.\n"); netif_device_detach(bp->dev); bnx2x_set_reset_in_progress(bp); bnx2x_set_power_state(bp, 3); bp->recovery_state = 3; __asm__ volatile ("mfence": : : "memory"); return; } } static void bnx2x_parity_recover(struct bnx2x *bp ) { bool global ; u32 error_recovered ; u32 error_unrecovered ; bool is_parity ; long tmp ; long tmp___0 ; int __ret_warn_on ; long tmp___1 ; bool tmp___2 ; int tmp___3 ; long tmp___4 ; int other_engine ; bool other_load_status ; bool tmp___5 ; bool load_status ; bool tmp___6 ; int tmp___7 ; bool tmp___8 ; bool tmp___9 ; int tmp___10 ; bool tmp___11 ; int tmp___12 ; { global = 0; tmp = ldv__builtin_expect((bp->msg_enable & 8192) != 0, 0L); if (tmp != 0L) { printk("\rbnx2x: [%s:%d(%s)]Handling parity\n", "bnx2x_parity_recover", 9390, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } ldv_57741: ; switch ((unsigned int )bp->recovery_state) { case 1U: tmp___0 = ldv__builtin_expect((bp->msg_enable & 8192) != 0, 0L); if (tmp___0 != 0L) { printk("\rbnx2x: [%s:%d(%s)]State is BNX2X_RECOVERY_INIT\n", "bnx2x_parity_recover", 9394, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } is_parity = bnx2x_chk_parity_attn(bp, & global, 0); __ret_warn_on = ! is_parity; tmp___1 = ldv__builtin_expect(__ret_warn_on != 0, 0L); if (tmp___1 != 0L) { warn_slowpath_null("/work/ldvuser/exper_fp/work/current--X--drivers--X--defaultlinux-3.10-rc1.tar--X--32_7a--X--cpachecker/linux-3.10-rc1.tar/csd_deg_dscv/8504/dscv_tempdir/dscv/ri/32_7a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c.prepared", 9396); } else { } ldv__builtin_expect(__ret_warn_on != 0, 0L); tmp___2 = bnx2x_trylock_leader_lock(bp); if ((int )tmp___2) { bnx2x_set_reset_in_progress(bp); if ((int )global) { bnx2x_set_reset_global(bp); } else { } bp->is_leader = 1; } else { } tmp___3 = bnx2x_nic_unload(bp, 2, 0); if (tmp___3 != 0) { return; } else { } bp->recovery_state = 2; __asm__ volatile ("mfence": : : "memory"); goto ldv_57735; case 2U: tmp___4 = ldv__builtin_expect((bp->msg_enable & 8192) != 0, 0L); if (tmp___4 != 0L) { printk("\rbnx2x: [%s:%d(%s)]State is BNX2X_RECOVERY_WAIT\n", "bnx2x_parity_recover", 9428, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } if (bp->is_leader != 0) { other_engine = (bp->common.chip_id >> 16 != 5710U && (bp->common.chip_id >> 16 != 5711U && bp->common.chip_id >> 16 != 5712U) ? (int )bp->pf_num & 1 : 0) ? 0 : 1; tmp___5 = bnx2x_get_load_status(bp, other_engine); other_load_status = tmp___5; tmp___6 = bnx2x_get_load_status(bp, bp->common.chip_id >> 16 != 5710U && (bp->common.chip_id >> 16 != 5711U && bp->common.chip_id >> 16 != 5712U) ? (int )bp->pf_num & 1 : 0); load_status = tmp___6; global = bnx2x_reset_is_global(bp); if ((int )load_status || ((int )global && (int )other_load_status)) { schedule_delayed_work(& bp->sp_rtnl_task, 25UL); return; } else { tmp___7 = bnx2x_leader_reset(bp); if (tmp___7 != 0) { bnx2x_recovery_failed(bp); return; } else { } goto ldv_57735; } } else { tmp___11 = bnx2x_reset_is_done(bp, bp->common.chip_id >> 16 != 5710U && (bp->common.chip_id >> 16 != 5711U && bp->common.chip_id >> 16 != 5712U) ? (int )bp->pf_num & 1 : 0); if (tmp___11) { tmp___12 = 0; } else { tmp___12 = 1; } if (tmp___12) { tmp___8 = bnx2x_trylock_leader_lock(bp); if ((int )tmp___8) { bp->is_leader = 1; goto ldv_57735; } else { } schedule_delayed_work(& bp->sp_rtnl_task, 25UL); return; } else { tmp___9 = bnx2x_reset_is_global(bp); if ((int )tmp___9) { schedule_delayed_work(& bp->sp_rtnl_task, 25UL); return; } else { } error_recovered = bp->eth_stats.recoverable_error; error_unrecovered = bp->eth_stats.unrecoverable_error; bp->recovery_state = 4; tmp___10 = bnx2x_nic_load(bp, 0); if (tmp___10 != 0) { error_unrecovered = error_unrecovered + 1U; netdev_err((struct net_device const *)bp->dev, "Recovery failed. Power cycle needed\n"); netif_device_detach(bp->dev); bnx2x_set_power_state(bp, 3); __asm__ volatile ("mfence": : : "memory"); } else { bp->recovery_state = 0; error_recovered = error_recovered + 1U; __asm__ volatile ("mfence": : : "memory"); } bp->eth_stats.recoverable_error = error_recovered; bp->eth_stats.unrecoverable_error = error_unrecovered; return; } } default: ; return; } ldv_57735: ; goto ldv_57741; } } static int bnx2x_close(struct net_device *dev ) ; static void bnx2x_sp_rtnl_task(struct work_struct *work ) { struct bnx2x *bp ; struct work_struct const *__mptr ; bool tmp ; int tmp___0 ; long tmp___1 ; int tmp___2 ; int tmp___3 ; int tmp___4 ; long tmp___5 ; int tmp___6 ; long tmp___7 ; int tmp___8 ; long tmp___9 ; int tmp___10 ; int tmp___11 ; int tmp___12 ; { __mptr = (struct work_struct const *)work; bp = (struct bnx2x *)__mptr + 0xfffffffffffffbc8UL; rtnl_lock(); tmp = netif_running((struct net_device const *)bp->dev); if (tmp) { tmp___0 = 0; } else { tmp___0 = 1; } if (tmp___0) { rtnl_unlock(); return; } else { } tmp___1 = ldv__builtin_expect((unsigned int )bp->recovery_state != 0U, 0L); if (tmp___1 != 0L) { bp->sp_rtnl_state = 0UL; __asm__ volatile ("mfence": : : "memory"); bnx2x_parity_recover(bp); rtnl_unlock(); return; } else { } tmp___2 = test_and_clear_bit(1, (unsigned long volatile *)(& bp->sp_rtnl_state)); if (tmp___2 != 0) { bp->sp_rtnl_state = 0UL; __asm__ volatile ("mfence": : : "memory"); bnx2x_nic_unload(bp, 0, 1); bnx2x_nic_load(bp, 0); rtnl_unlock(); return; } else { } tmp___3 = test_and_clear_bit(0, (unsigned long volatile *)(& bp->sp_rtnl_state)); if (tmp___3 != 0) { bnx2x_setup_tc(bp->dev, (int )bp->dcbx_port_params.ets.num_of_cos); } else { } tmp___4 = test_and_clear_bit(3, (unsigned long volatile *)(& bp->sp_rtnl_state)); if (tmp___4 != 0) { bnx2x_after_function_update(bp); } else { } tmp___6 = test_and_clear_bit(2, (unsigned long volatile *)(& bp->sp_rtnl_state)); if (tmp___6 != 0) { tmp___5 = ldv__builtin_expect((bp->msg_enable & 8192) != 0, 0L); if (tmp___5 != 0L) { printk("\rbnx2x: [%s:%d(%s)]fan failure detected. Unloading driver\n", "bnx2x_sp_rtnl_task", 9603, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } netif_device_detach(bp->dev); bnx2x_close(bp->dev); rtnl_unlock(); return; } else { } tmp___8 = test_and_clear_bit(5, (unsigned long volatile *)(& bp->sp_rtnl_state)); if (tmp___8 != 0) { tmp___7 = ldv__builtin_expect((bp->msg_enable & 1048576) != 0, 0L); if (tmp___7 != 0L) { printk("\rbnx2x: [%s:%d(%s)]sending set mcast vf pf channel message from rtnl sp-task\n", "bnx2x_sp_rtnl_task", 9612, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } bnx2x_vfpf_set_mcast(bp->dev); } else { } tmp___10 = test_and_clear_bit(6, (unsigned long volatile *)(& bp->sp_rtnl_state)); if (tmp___10 != 0) { tmp___9 = ldv__builtin_expect((bp->msg_enable & 1048576) != 0, 0L); if (tmp___9 != 0L) { printk("\rbnx2x: [%s:%d(%s)]sending set storm rx mode vf pf channel message from rtnl sp-task\n", "bnx2x_sp_rtnl_task", 9619, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } bnx2x_vfpf_storm_rx_mode(bp); } else { } tmp___11 = test_and_clear_bit(7, (unsigned long volatile *)(& bp->sp_rtnl_state)); if (tmp___11 != 0) { bnx2x_pf_set_vfs_vlan(bp); } else { } rtnl_unlock(); if ((unsigned long )bp->vfdb != (unsigned long )((struct bnx2x_vfdb *)0)) { tmp___12 = test_and_clear_bit(4, (unsigned long volatile *)(& bp->sp_rtnl_state)); if (tmp___12 != 0) { bnx2x_disable_sriov(bp); bnx2x_enable_sriov(bp); } else { } } else { } return; } } static void bnx2x_period_task(struct work_struct *work ) { struct bnx2x *bp ; struct work_struct const *__mptr ; bool tmp ; int tmp___0 ; { __mptr = (struct work_struct const *)work; bp = (struct bnx2x *)__mptr + 0xfffffffffffffae8UL; tmp = netif_running((struct net_device const *)bp->dev); if (tmp) { tmp___0 = 0; } else { tmp___0 = 1; } if (tmp___0) { goto period_task_exit; } else { } if ((bp->common.chip_id & 61440U) > 20480U) { printk("\vbnx2x: [%s:%d(%s)]period task called on emulation, ignoring\n", "bnx2x_period_task", 9648, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); goto period_task_exit; } else { } bnx2x_acquire_phy_lock(bp); __asm__ volatile ("mfence": : : "memory"); if (bp->port.pmf != 0U) { bnx2x_period_func(& bp->link_params, & bp->link_vars); queue_delayed_work(bnx2x_wq, & bp->period_task, 250UL); } else { } bnx2x_release_phy_lock(bp); period_task_exit: ; return; } } u32 bnx2x_get_pretend_reg(struct bnx2x *bp ) { u32 base ; u32 stride ; { base = 1181300U; stride = 1181304U - base; return ((u32 )bp->pf_num * stride + base); } } static void bnx2x_prev_unload_close_mac(struct bnx2x *bp , struct bnx2x_mac_vals *vals ) { u32 val ; u32 base_addr ; u32 offset ; u32 mask ; u32 reset_reg ; bool mac_stopped ; u8 port ; u32 wb_data[2U] ; long tmp ; long tmp___0 ; long tmp___1 ; long tmp___2 ; { mac_stopped = 0; port = (unsigned int )bp->pfid & 1U; vals->bmac_addr = 0U; vals->umac_addr = 0U; vals->xmac_addr = 0U; vals->emac_addr = 0U; reset_reg = readl((void const volatile *)bp->regview + 42384U); if (((((((((bp->common.chip_id >> 16 != 5770U && bp->common.chip_id >> 16 != 5797U) && bp->common.chip_id >> 16 != 5801U) && bp->common.chip_id >> 16 != 5774U) && bp->common.chip_id >> 16 != 5806U) && bp->common.chip_id >> 16 != 5807U) && ((bp->common.chip_id >> 16 != 5693U && bp->common.chip_id >> 16 != 5694U) && bp->common.chip_id >> 16 != 5695U)) && ((bp->common.chip_id >> 16 != 5793U && bp->common.chip_id >> 16 != 5794U) && bp->common.chip_id >> 16 != 5773U)) && (bp->common.chip_id >> 16 != 5796U && bp->common.chip_id >> 16 != 5803U)) && bp->common.chip_id >> 16 != 5805U) { val = readl((void const volatile *)bp->regview + (unsigned long )(((int )port + 16442) * 4)); mask = (u32 )(1 << (int )port); if ((mask & reset_reg) != 0U && val != 0U) { tmp = ldv__builtin_expect((bp->msg_enable & 2) != 0, 0L); if (tmp != 0L) { _dev_info((struct device const *)(& (bp->pdev)->dev), "Disable bmac Rx\n"); } else { } base_addr = (int )bp->pfid & 1 ? 69632U : 68608U; offset = 0U; wb_data[0] = readl((void const volatile *)bp->regview + (unsigned long )(base_addr + offset)); wb_data[1] = readl((void const volatile *)bp->regview + (unsigned long )((base_addr + offset) + 4U)); vals->bmac_addr = base_addr + offset; vals->bmac_val[0] = wb_data[0]; vals->bmac_val[1] = wb_data[1]; wb_data[0] = wb_data[0] & 4294967293U; writel(wb_data[0], (void volatile *)bp->regview + (unsigned long )vals->bmac_addr); writel(wb_data[1], (void volatile *)bp->regview + (unsigned long )(vals->bmac_addr + 4U)); } else { } tmp___0 = ldv__builtin_expect((bp->msg_enable & 2) != 0, 0L); if (tmp___0 != 0L) { _dev_info((struct device const *)(& (bp->pdev)->dev), "Disable emac Rx\n"); } else { } vals->emac_addr = (u32 )((((int )bp->pfid & 1) + 16399) * 4); vals->emac_val = readl((void const volatile *)bp->regview + (unsigned long )vals->emac_addr); writel(0U, (void volatile *)bp->regview + (unsigned long )vals->emac_addr); mac_stopped = 1; } else { if ((reset_reg & 4194304U) != 0U) { tmp___1 = ldv__builtin_expect((bp->msg_enable & 2) != 0, 0L); if (tmp___1 != 0L) { _dev_info((struct device const *)(& (bp->pdev)->dev), "Disable xmac Rx\n"); } else { } base_addr = (int )bp->pfid & 1 ? 1456128U : 1454080U; val = readl((void const volatile *)bp->regview + (unsigned long )(base_addr + 116U)); writel(val & 4294967293U, (void volatile *)bp->regview + (unsigned long )(base_addr + 116U)); writel(val | 2U, (void volatile *)bp->regview + (unsigned long )(base_addr + 116U)); vals->xmac_addr = base_addr; vals->xmac_val = readl((void const volatile *)bp->regview + (unsigned long )vals->xmac_addr); writel(0U, (void volatile *)bp->regview + (unsigned long )vals->xmac_addr); mac_stopped = 1; } else { } mask = (u32 )(1048576 << (int )port); if ((mask & reset_reg) != 0U) { tmp___2 = ldv__builtin_expect((bp->msg_enable & 2) != 0, 0L); if (tmp___2 != 0L) { _dev_info((struct device const *)(& (bp->pdev)->dev), "Disable umac Rx\n"); } else { } base_addr = (int )bp->pfid & 1 ? 1442816U : 1441792U; vals->umac_addr = base_addr + 8U; vals->umac_val = readl((void const volatile *)bp->regview + (unsigned long )vals->umac_addr); writel(0U, (void volatile *)bp->regview + (unsigned long )vals->umac_addr); mac_stopped = 1; } else { } } if ((int )mac_stopped) { msleep(20U); } else { } return; } } static void bnx2x_prev_unload_undi_inc(struct bnx2x *bp , u8 port , u8 inc ) { u16 rcq ; u16 bd ; u32 tmp_reg ; unsigned int tmp ; long tmp___0 ; { tmp = readl((void const volatile *)bp->regview + (unsigned long )(((int )port << 4) + 4396296)); tmp_reg = tmp; rcq = (int )((u16 )tmp_reg) + (int )((u16 )inc); bd = (int )((u16 )(tmp_reg >> 16)) + (int )((u16 )inc); tmp_reg = (u32 )(((int )bd << 16) | (int )rcq); writel(tmp_reg, (void volatile *)bp->regview + (unsigned long )(((int )port << 4) + 4396296)); tmp___0 = ldv__builtin_expect((bp->msg_enable & 2) != 0, 0L); if (tmp___0 != 0L) { _dev_info((struct device const *)(& (bp->pdev)->dev), "UNDI producer [%d] rings bd -> 0x%04x, rcq -> 0x%04x\n", (int )port, (int )bd, (int )rcq); } else { } return; } } static int bnx2x_prev_mcp_done(struct bnx2x *bp ) { u32 rc ; u32 tmp ; { tmp = bnx2x_fw_command(bp, 553648128U, 2U); rc = tmp; if (rc == 0U) { printk("\vbnx2x: [%s:%d(%s)]MCP response failure, aborting\n", "bnx2x_prev_mcp_done", 9784, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); return (-16); } else { } return (0); } } static struct bnx2x_prev_path_list *bnx2x_prev_path_get_entry(struct bnx2x *bp ) { struct bnx2x_prev_path_list *tmp_list ; struct list_head const *__mptr ; struct list_head const *__mptr___0 ; { __mptr = (struct list_head const *)bnx2x_prev_list.next; tmp_list = (struct bnx2x_prev_path_list *)__mptr; goto ldv_57798; ldv_57797: ; if (((((bp->pdev)->devfn >> 3) & 31U) == (unsigned int )tmp_list->slot && (int )((bp->pdev)->bus)->number == (int )tmp_list->bus) && (bp->common.chip_id >> 16 != 5710U && (bp->common.chip_id >> 16 != 5711U && bp->common.chip_id >> 16 != 5712U) ? (int )bp->pf_num & 1 : 0) == (int )tmp_list->path) { return (tmp_list); } else { } __mptr___0 = (struct list_head const *)tmp_list->list.next; tmp_list = (struct bnx2x_prev_path_list *)__mptr___0; ldv_57798: ; if ((unsigned long )(& tmp_list->list) != (unsigned long )(& bnx2x_prev_list)) { goto ldv_57797; } else { } return (0); } } static int bnx2x_prev_path_mark_eeh(struct bnx2x *bp ) { struct bnx2x_prev_path_list *tmp_list ; int rc ; { rc = down_interruptible(& bnx2x_prev_sem); if (rc != 0) { printk("\vbnx2x: [%s:%d(%s)]Received %d when tried to take lock\n", "bnx2x_prev_path_mark_eeh", 9812, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", rc); return (rc); } else { } tmp_list = bnx2x_prev_path_get_entry(bp); if ((unsigned long )tmp_list != (unsigned long )((struct bnx2x_prev_path_list *)0)) { tmp_list->aer = 1U; rc = 0; } else { printk("\vbnx2x: [%s:%d(%s)]path %d: Entry does not exist for eeh; Flow occurs before initial insmod is over ?\n", "bnx2x_prev_path_mark_eeh", 9822, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", bp->common.chip_id >> 16 != 5710U && (bp->common.chip_id >> 16 != 5711U && bp->common.chip_id >> 16 != 5712U) ? (int )bp->pf_num & 1 : 0); } up(& bnx2x_prev_sem); return (rc); } } static bool bnx2x_prev_is_path_marked(struct bnx2x *bp ) { struct bnx2x_prev_path_list *tmp_list ; int rc ; int tmp ; long tmp___0 ; long tmp___1 ; { rc = 0; tmp = down_trylock(& bnx2x_prev_sem); if (tmp != 0) { return (0); } else { } tmp_list = bnx2x_prev_path_get_entry(bp); if ((unsigned long )tmp_list != (unsigned long )((struct bnx2x_prev_path_list *)0)) { if ((unsigned int )tmp_list->aer != 0U) { tmp___0 = ldv__builtin_expect((bp->msg_enable & 8192) != 0, 0L); if (tmp___0 != 0L) { printk("\rbnx2x: [%s:%d(%s)]Path %d was marked by AER\n", "bnx2x_prev_is_path_marked", 9842, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", bp->common.chip_id >> 16 != 5710U && (bp->common.chip_id >> 16 != 5711U && bp->common.chip_id >> 16 != 5712U) ? (int )bp->pf_num & 1 : 0); } else { } } else { rc = 1; tmp___1 = ldv__builtin_expect((bp->msg_enable & 2) != 0, 0L); if (tmp___1 != 0L) { _dev_info((struct device const *)(& (bp->pdev)->dev), "Path %d was already cleaned from previous drivers\n", bp->common.chip_id >> 16 != 5710U && (bp->common.chip_id >> 16 != 5711U && bp->common.chip_id >> 16 != 5712U) ? (int )bp->pf_num & 1 : 0); } else { } } } else { } up(& bnx2x_prev_sem); return (rc != 0); } } static int bnx2x_prev_mark_path(struct bnx2x *bp , bool after_undi ) { struct bnx2x_prev_path_list *tmp_list ; int rc ; long tmp ; void *tmp___0 ; long tmp___1 ; { rc = down_interruptible(& bnx2x_prev_sem); if (rc != 0) { printk("\vbnx2x: [%s:%d(%s)]Received %d when tried to take lock\n", "bnx2x_prev_mark_path", 9862, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", rc); return (rc); } else { } tmp_list = bnx2x_prev_path_get_entry(bp); if ((unsigned long )tmp_list != (unsigned long )((struct bnx2x_prev_path_list *)0)) { if ((unsigned int )tmp_list->aer == 0U) { printk("\vbnx2x: [%s:%d(%s)]Re-Marking the path.\n", "bnx2x_prev_mark_path", 9870, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { tmp = ldv__builtin_expect((bp->msg_enable & 8192) != 0, 0L); if (tmp != 0L) { printk("\rbnx2x: [%s:%d(%s)]Removing AER indication from path %d\n", "bnx2x_prev_mark_path", 9873, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", bp->common.chip_id >> 16 != 5710U && (bp->common.chip_id >> 16 != 5711U && bp->common.chip_id >> 16 != 5712U) ? (int )bp->pf_num & 1 : 0); } else { } tmp_list->aer = 0U; } up(& bnx2x_prev_sem); return (0); } else { } up(& bnx2x_prev_sem); tmp___0 = kmalloc(24UL, 208U); tmp_list = (struct bnx2x_prev_path_list *)tmp___0; if ((unsigned long )tmp_list == (unsigned long )((struct bnx2x_prev_path_list *)0)) { printk("\vbnx2x: [%s:%d(%s)]Failed to allocate \'bnx2x_prev_path_list\'\n", "bnx2x_prev_mark_path", 9884, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); return (-12); } else { } tmp_list->bus = ((bp->pdev)->bus)->number; tmp_list->slot = (unsigned int )((u8 )((bp->pdev)->devfn >> 3)) & 31U; tmp_list->path = bp->common.chip_id >> 16 != 5710U && (bp->common.chip_id >> 16 != 5711U && bp->common.chip_id >> 16 != 5712U) ? (unsigned int )bp->pf_num & 1U : 0U; tmp_list->aer = 0U; tmp_list->undi = (int )after_undi ? (u8 )(1 << ((int )bp->pfid & 1)) : 0U; rc = down_interruptible(& bnx2x_prev_sem); if (rc != 0) { printk("\vbnx2x: [%s:%d(%s)]Received %d when tried to take lock\n", "bnx2x_prev_mark_path", 9896, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", rc); kfree((void const *)tmp_list); } else { tmp___1 = ldv__builtin_expect((bp->msg_enable & 8192) != 0, 0L); if (tmp___1 != 0L) { printk("\rbnx2x: [%s:%d(%s)]Marked path [%d] - finished previous unload\n", "bnx2x_prev_mark_path", 9900, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", bp->common.chip_id >> 16 != 5710U && (bp->common.chip_id >> 16 != 5711U && bp->common.chip_id >> 16 != 5712U) ? (int )bp->pf_num & 1 : 0); } else { } list_add(& tmp_list->list, & bnx2x_prev_list); up(& bnx2x_prev_sem); } return (rc); } } static int bnx2x_do_flr(struct bnx2x *bp ) { int i ; u16 status ; struct pci_dev *dev ; long tmp ; long tmp___0 ; { dev = bp->pdev; if (bp->common.chip_id >> 16 == 5710U || (bp->common.chip_id >> 16 == 5711U || bp->common.chip_id >> 16 == 5712U)) { tmp = ldv__builtin_expect((bp->msg_enable & 2) != 0, 0L); if (tmp != 0L) { _dev_info((struct device const *)(& (bp->pdev)->dev), "FLR not supported in E1/E1H\n"); } else { } return (-22); } else { } if (bp->common.bc_ver <= 459282U) { printk("\vbnx2x: [%s:%d(%s)]FLR not supported by BC_VER: 0x%x\n", "bnx2x_do_flr", 9923, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", bp->common.bc_ver); return (-22); } else { } i = 0; goto ldv_57828; ldv_57827: ; if (i != 0) { msleep((unsigned int )(100 << (i + -1))); } else { } pcie_capability_read_word(dev, 10, & status); if (((int )status & 32) == 0) { goto clear; } else { } i = i + 1; ldv_57828: ; if (i <= 3) { goto ldv_57827; } else { } dev_err((struct device const *)(& dev->dev), "transaction is not cleared; proceeding with reset anyway\n"); clear: tmp___0 = ldv__builtin_expect((bp->msg_enable & 2) != 0, 0L); if (tmp___0 != 0L) { _dev_info((struct device const *)(& (bp->pdev)->dev), "Initiating FLR\n"); } else { } bnx2x_fw_command(bp, 33554432U, 0U); return (0); } } static int bnx2x_prev_unload_uncommon(struct bnx2x *bp ) { int rc ; long tmp ; int tmp___0 ; bool tmp___1 ; long tmp___2 ; long tmp___3 ; long tmp___4 ; long tmp___5 ; { tmp = ldv__builtin_expect((bp->msg_enable & 2) != 0, 0L); if (tmp != 0L) { _dev_info((struct device const *)(& (bp->pdev)->dev), "Uncommon unload Flow\n"); } else { } tmp___1 = bnx2x_prev_is_path_marked(bp); if ((int )tmp___1) { tmp___0 = bnx2x_prev_mcp_done(bp); return (tmp___0); } else { } tmp___2 = ldv__builtin_expect((bp->msg_enable & 2) != 0, 0L); if (tmp___2 != 0L) { _dev_info((struct device const *)(& (bp->pdev)->dev), "Path is unmarked\n"); } else { } rc = bnx2x_nic_load_analyze_req(bp, 269615104U); if (rc == 0) { tmp___3 = ldv__builtin_expect((bp->msg_enable & 2) != 0, 0L); if (tmp___3 != 0L) { _dev_info((struct device const *)(& (bp->pdev)->dev), "FW version matches our own. Attempting FLR\n"); } else { } rc = bnx2x_do_flr(bp); } else { } if (rc == 0) { tmp___4 = ldv__builtin_expect((bp->msg_enable & 2) != 0, 0L); if (tmp___4 != 0L) { _dev_info((struct device const *)(& (bp->pdev)->dev), "FLR successful\n"); } else { } return (0); } else { } tmp___5 = ldv__builtin_expect((bp->msg_enable & 2) != 0, 0L); if (tmp___5 != 0L) { _dev_info((struct device const *)(& (bp->pdev)->dev), "Could not FLR\n"); } else { } rc = bnx2x_prev_mcp_done(bp); if (rc == 0) { rc = 1; } else { } return (rc); } } static int bnx2x_prev_unload_common(struct bnx2x *bp ) { u32 reset_reg ; u32 tmp_reg ; u32 rc ; bool prev_undi ; struct bnx2x_mac_vals mac_vals ; long tmp ; int tmp___0 ; bool tmp___1 ; u32 timer_count ; long tmp___2 ; u32 prev_brb ; long tmp___3 ; int tmp___4 ; int tmp___5 ; { tmp_reg = 0U; prev_undi = 0; tmp = ldv__builtin_expect((bp->msg_enable & 2) != 0, 0L); if (tmp != 0L) { _dev_info((struct device const *)(& (bp->pdev)->dev), "Common unload Flow\n"); } else { } memset((void *)(& mac_vals), 0, 36UL); tmp___1 = bnx2x_prev_is_path_marked(bp); if ((int )tmp___1) { tmp___0 = bnx2x_prev_mcp_done(bp); return (tmp___0); } else { } reset_reg = readl((void const volatile *)bp->regview + 42368U); if ((int )reset_reg & 1) { timer_count = 1000U; bnx2x_prev_unload_close_mac(bp, & mac_vals); bnx2x_set_rx_filter(& bp->link_params, 0); if ((reset_reg & 524288U) != 0U) { tmp_reg = readl((void const volatile *)bp->regview + 1507372U); if (tmp_reg == 7U) { tmp___2 = ldv__builtin_expect((bp->msg_enable & 2) != 0, 0L); if (tmp___2 != 0L) { _dev_info((struct device const *)(& (bp->pdev)->dev), "UNDI previously loaded\n"); } else { } prev_undi = 1; writel(0U, (void volatile *)bp->regview + 1507372U); readl((void const volatile *)bp->regview + 66484U); } else { } } else { } if (bp->common.chip_id >> 16 != 5710U && (bp->common.chip_id >> 16 != 5711U && bp->common.chip_id >> 16 != 5712U)) { writel(0U, (void volatile *)bp->regview + 37932U); } else { } tmp_reg = readl((void const volatile *)bp->regview + 393360U); goto ldv_57846; ldv_57845: prev_brb = tmp_reg; tmp_reg = readl((void const volatile *)bp->regview + 393360U); if (tmp_reg == 0U) { goto ldv_57844; } else { } tmp___3 = ldv__builtin_expect((bp->msg_enable & 2) != 0, 0L); if (tmp___3 != 0L) { _dev_info((struct device const *)(& (bp->pdev)->dev), "BRB still has 0x%08x\n", tmp_reg); } else { } if (prev_brb > tmp_reg) { timer_count = 1000U; } else { timer_count = timer_count - 1U; } if ((int )prev_undi) { bnx2x_prev_unload_undi_inc(bp, (int )bp->pfid & 1, 1); } else { } __const_udelay(42950UL); ldv_57846: ; if (timer_count != 0U) { goto ldv_57845; } else { } ldv_57844: ; if (timer_count == 0U) { printk("\vbnx2x: [%s:%d(%s)]Failed to empty BRB, hope for the best\n", "bnx2x_prev_unload_common", 10060, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } } else { } bnx2x_reset_common(bp); if (mac_vals.xmac_addr != 0U) { writel(mac_vals.xmac_val, (void volatile *)bp->regview + (unsigned long )mac_vals.xmac_addr); } else { } if (mac_vals.umac_addr != 0U) { writel(mac_vals.umac_val, (void volatile *)bp->regview + (unsigned long )mac_vals.umac_addr); } else { } if (mac_vals.emac_addr != 0U) { writel(mac_vals.emac_val, (void volatile *)bp->regview + (unsigned long )mac_vals.emac_addr); } else { } if (mac_vals.bmac_addr != 0U) { writel(mac_vals.bmac_val[0], (void volatile *)bp->regview + (unsigned long )mac_vals.bmac_addr); writel(mac_vals.bmac_val[1], (void volatile *)bp->regview + (unsigned long )(mac_vals.bmac_addr + 4U)); } else { } tmp___4 = bnx2x_prev_mark_path(bp, (int )prev_undi); rc = (u32 )tmp___4; if (rc != 0U) { bnx2x_prev_mcp_done(bp); return ((int )rc); } else { } tmp___5 = bnx2x_prev_mcp_done(bp); return (tmp___5); } } static void bnx2x_prev_interrupted_dmae(struct bnx2x *bp ) { u32 val ; unsigned int tmp ; long tmp___0 ; { if (bp->common.chip_id >> 16 != 5710U && (bp->common.chip_id >> 16 != 5711U && bp->common.chip_id >> 16 != 5712U)) { tmp = readl((void const volatile *)bp->regview + 37528U); val = tmp; if ((val & 4U) != 0U) { tmp___0 = ldv__builtin_expect((bp->msg_enable & 1048576) != 0, 0L); if (tmp___0 != 0L) { printk("\rbnx2x: [%s:%d(%s)]\'was error\' bit was found to be set in pglueb upon startup. Clearing\n", "bnx2x_prev_interrupted_dmae", 10100, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } writel(1U << (int )bp->pfid, (void volatile *)bp->regview + 38000U); } else { } } else { } return; } } static int bnx2x_prev_unload(struct bnx2x *bp ) { int time_counter ; u32 rc ; u32 fw ; u32 hw_lock_reg ; u32 hw_lock_val ; struct bnx2x_prev_path_list *prev_list ; long tmp ; long tmp___0 ; long tmp___1 ; long tmp___2 ; long tmp___3 ; unsigned int tmp___4 ; int aer ; int tmp___5 ; struct bnx2x_prev_path_list *tmp___6 ; struct bnx2x_prev_path_list *tmp___7 ; int tmp___8 ; int tmp___9 ; int tmp___10 ; long tmp___11 ; { time_counter = 10; tmp = ldv__builtin_expect((bp->msg_enable & 2) != 0, 0L); if (tmp != 0L) { _dev_info((struct device const *)(& (bp->pdev)->dev), "Entering Previous Unload Flow\n"); } else { } bnx2x_prev_interrupted_dmae(bp); hw_lock_reg = (u32 )((unsigned int )bp->pfid <= 5U ? ((int )bp->pfid + 5282) * 8 : ((int )bp->pfid + 5235) * 8); hw_lock_val = readl((void const volatile *)bp->regview + (unsigned long )hw_lock_reg); if (hw_lock_val != 0U) { if ((hw_lock_val & 12U) != 0U) { tmp___0 = ldv__builtin_expect((bp->msg_enable & 2) != 0, 0L); if (tmp___0 != 0L) { _dev_info((struct device const *)(& (bp->pdev)->dev), "Release Previously held NVRAM lock\n"); } else { } writel((unsigned int )(32L << ((int )bp->pfid & 1)), (void volatile *)bp->regview + 549920U); } else { } tmp___1 = ldv__builtin_expect((bp->msg_enable & 2) != 0, 0L); if (tmp___1 != 0L) { _dev_info((struct device const *)(& (bp->pdev)->dev), "Release Previously held hw lock\n"); } else { } writel(4294967295U, (void volatile *)bp->regview + (unsigned long )hw_lock_reg); } else { tmp___2 = ldv__builtin_expect((bp->msg_enable & 2) != 0, 0L); if (tmp___2 != 0L) { _dev_info((struct device const *)(& (bp->pdev)->dev), "No need to release hw/nvram locks\n"); } else { } } tmp___4 = readl((void const volatile *)bp->regview + 524444U); if ((int )tmp___4 < 0) { tmp___3 = ldv__builtin_expect((bp->msg_enable & 2) != 0, 0L); if (tmp___3 != 0L) { _dev_info((struct device const *)(& (bp->pdev)->dev), "Release previously held alr\n"); } else { } writel(0U, (void volatile *)bp->regview + 524444U); } else { } ldv_57865: aer = 0; fw = bnx2x_fw_command(bp, 536936448U, 0U); if (fw == 0U) { printk("\vbnx2x: [%s:%d(%s)]MCP response failure, aborting\n", "bnx2x_prev_unload", 10147, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); rc = 4294967280U; goto ldv_57864; } else { } tmp___5 = down_interruptible(& bnx2x_prev_sem); rc = (u32 )tmp___5; if (rc != 0U) { printk("\vbnx2x: [%s:%d(%s)]Cannot check for AER; Received %d when tried to take lock\n", "bnx2x_prev_unload", 10155, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", rc); } else { tmp___6 = bnx2x_prev_path_get_entry(bp); if ((unsigned long )tmp___6 != (unsigned long )((struct bnx2x_prev_path_list *)0)) { tmp___7 = bnx2x_prev_path_get_entry(bp); if ((unsigned int )tmp___7->aer != 0U) { tmp___8 = 1; } else { tmp___8 = 0; } } else { tmp___8 = 0; } aer = tmp___8; up(& bnx2x_prev_sem); } if (fw == 537919488U || aer != 0) { tmp___9 = bnx2x_prev_unload_common(bp); rc = (u32 )tmp___9; goto ldv_57864; } else { } tmp___10 = bnx2x_prev_unload_uncommon(bp); rc = (u32 )tmp___10; if (rc != 1U) { goto ldv_57864; } else { } msleep(20U); time_counter = time_counter - 1; if (time_counter != 0) { goto ldv_57865; } else { } ldv_57864: ; if (time_counter == 0 || rc != 0U) { printk("\vbnx2x: [%s:%d(%s)]Failed unloading previous driver, aborting\n", "bnx2x_prev_unload", 10177, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); rc = 4294967280U; } else { } prev_list = bnx2x_prev_path_get_entry(bp); if ((unsigned long )prev_list != (unsigned long )((struct bnx2x_prev_path_list *)0) && ((int )prev_list->undi >> ((int )bp->pfid & 1)) & 1) { bp->link_params.feature_config_flags = bp->link_params.feature_config_flags | 16384U; } else { } tmp___11 = ldv__builtin_expect((bp->msg_enable & 2) != 0, 0L); if (tmp___11 != 0L) { _dev_info((struct device const *)(& (bp->pdev)->dev), "Finished Previous Unload Flow [%d]\n", rc); } else { } return ((int )rc); } } static void bnx2x_get_common_hwinfo(struct bnx2x *bp ) { u32 val ; u32 val2 ; u32 val3 ; u32 val4 ; u32 id ; u32 boot_mode ; u16 pmc ; unsigned int tmp ; long tmp___0 ; long tmp___1 ; long tmp___2 ; unsigned int tmp___3 ; long tmp___4 ; long tmp___5 ; unsigned int tmp___6 ; long tmp___7 ; long tmp___8 ; long tmp___9 ; unsigned int tmp___10 ; long tmp___11 ; unsigned int tmp___12 ; long tmp___13 ; { val = readl((void const volatile *)bp->regview + 41992U); id = val << 16; val = readl((void const volatile *)bp->regview + 41996U); id = ((val << 12) & 65535U) | id; val = readl((void const volatile *)bp->regview + 9276U); id = (((val >> 24) << 4) & 255U) | id; val = readl((void const volatile *)bp->regview + 41984U); id = (val & 15U) | id; bp->common.chip_id = id; tmp = readl((void const volatile *)bp->regview + 44128U); if ((tmp & 2U) != 0U) { if (bp->common.chip_id >> 16 == 5774U) { bp->common.chip_id = (bp->common.chip_id & 65535U) | 373096448U; } else if (bp->common.chip_id >> 16 == 5806U) { bp->common.chip_id = (bp->common.chip_id & 65535U) | 373161984U; } else { } bp->common.chip_id = bp->common.chip_id | 1U; } else { } bp->db_size = 128U; if (bp->common.chip_id >> 16 != 5710U && (bp->common.chip_id >> 16 != 5711U && bp->common.chip_id >> 16 != 5712U)) { val = readl((void const volatile *)bp->regview + 42784U); if ((val & 1U) == 0U) { val = readl((void const volatile *)bp->regview + 42832U); } else { val = (val >> 1) & 1U; } tmp___0 = ldv__builtin_expect((bp->msg_enable & 2) != 0, 0L); if (tmp___0 != 0L) { _dev_info((struct device const *)(& (bp->pdev)->dev), "chip is in %s\n", val != 0U ? (char *)"4_PORT_MODE" : (char *)"2_PORT_MODE"); } else { } bp->common.chip_port_mode = val == 0U; if ((unsigned int )bp->common.chip_port_mode == 0U) { bp->pfid = (u8 )((int )bp->pf_num >> 1); } else { bp->pfid = (unsigned int )bp->pf_num & 6U; } } else { bp->common.chip_port_mode = 2U; bp->pfid = bp->pf_num; } tmp___1 = ldv__builtin_expect((bp->msg_enable & 2) != 0, 0L); if (tmp___1 != 0L) { _dev_info((struct device const *)(& (bp->pdev)->dev), "pf_id: %x", (int )bp->pfid); } else { } bp->link_params.chip_id = bp->common.chip_id; tmp___2 = ldv__builtin_expect((bp->msg_enable & 2) != 0, 0L); if (tmp___2 != 0L) { _dev_info((struct device const *)(& (bp->pdev)->dev), "chip ID is 0x%x\n", id); } else { } tmp___3 = readl((void const volatile *)bp->regview + 10356U); val = tmp___3 & 85U; if (((int )bp->common.chip_id & 1 || (bp->common.chip_id >> 16 == 5710U && val != 0U)) || ((bp->common.chip_id >> 16 == 5711U || bp->common.chip_id >> 16 == 5712U) && val == 85U)) { bp->flags = bp->flags | 4U; tmp___4 = ldv__builtin_expect((bp->msg_enable & 2) != 0, 0L); if (tmp___4 != 0L) { _dev_info((struct device const *)(& (bp->pdev)->dev), "single port device\n"); } else { } } else { } val = readl((void const volatile *)bp->regview + 549932U); bp->common.flash_size = 131072 << ((int )val & 7); tmp___5 = ldv__builtin_expect((bp->msg_enable & 2) != 0, 0L); if (tmp___5 != 0L) { _dev_info((struct device const *)(& (bp->pdev)->dev), "flash_size 0x%x (%d)\n", bp->common.flash_size, bp->common.flash_size); } else { } bnx2x_init_shmem(bp); bp->common.shmem2_base = readl((void const volatile *)(bp->regview + ((bp->common.chip_id >> 16 != 5710U && (bp->common.chip_id >> 16 != 5711U && bp->common.chip_id >> 16 != 5712U) ? (int )bp->pf_num & 1 : 0) ? 42084UL : 42080UL))); bp->link_params.shmem_base = bp->common.shmem_base; bp->link_params.shmem2_base = bp->common.shmem2_base; tmp___6 = readl((void const volatile *)bp->regview + (unsigned long )bp->common.shmem2_base); if (tmp___6 > (unsigned int )(((unsigned long )bp->pfid & 1UL) + 79UL) * 4U) { bp->link_params.lfa_base = readl((void const volatile *)bp->regview + (unsigned long )(bp->common.shmem2_base + (unsigned int )(((unsigned long )bp->pfid & 1UL) + 79UL) * 4U)); } else { bp->link_params.lfa_base = 0U; } tmp___7 = ldv__builtin_expect((bp->msg_enable & 2) != 0, 0L); if (tmp___7 != 0L) { _dev_info((struct device const *)(& (bp->pdev)->dev), "shmem offset 0x%x shmem2 offset 0x%x\n", bp->common.shmem_base, bp->common.shmem2_base); } else { } if (bp->common.shmem_base == 0U) { tmp___8 = ldv__builtin_expect((bp->msg_enable & 2) != 0, 0L); if (tmp___8 != 0L) { _dev_info((struct device const *)(& (bp->pdev)->dev), "MCP not active\n"); } else { } bp->flags = bp->flags | 512U; return; } else { } bp->common.hw_config = readl((void const volatile *)(bp->regview + ((unsigned long )bp->common.shmem_base + 28UL))); tmp___9 = ldv__builtin_expect((bp->msg_enable & 2) != 0, 0L); if (tmp___9 != 0L) { _dev_info((struct device const *)(& (bp->pdev)->dev), "hw_config 0x%08x\n", bp->common.hw_config); } else { } bp->link_params.hw_led_mode = (u16 )((bp->common.hw_config & 983040U) >> 16); bp->link_params.feature_config_flags = 0U; val = readl((void const volatile *)(bp->regview + ((unsigned long )bp->common.shmem_base + 852UL))); if ((val & 2U) != 0U) { bp->link_params.feature_config_flags = bp->link_params.feature_config_flags | 1U; } else { bp->link_params.feature_config_flags = bp->link_params.feature_config_flags & 4294967294U; } tmp___10 = readl((void const volatile *)(bp->regview + ((unsigned long )bp->common.shmem_base + 8UL))); val = tmp___10 >> 8; bp->common.bc_ver = val; tmp___11 = ldv__builtin_expect((bp->msg_enable & 2) != 0, 0L); if (tmp___11 != 0L) { _dev_info((struct device const *)(& (bp->pdev)->dev), "bc_ver %X\n", val); } else { } if (val <= 262655U) { printk("\vbnx2x: [%s:%d(%s)]This driver needs bc_ver %X but found %X, please upgrade BC\n", "bnx2x_get_common_hwinfo", 10315, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", 262656, val); } else { } bp->link_params.feature_config_flags = bp->link_params.feature_config_flags | (val > 327685U ? 4U : 0U); bp->link_params.feature_config_flags = bp->link_params.feature_config_flags | (val > 328243U ? 8U : 0U); bp->link_params.feature_config_flags = bp->link_params.feature_config_flags | (val > 458753U ? 256U : 0U); bp->link_params.feature_config_flags = bp->link_params.feature_config_flags | (val > 458771U ? 1024U : 0U); bp->link_params.feature_config_flags = bp->link_params.feature_config_flags | (val > 459264U ? 8192U : 0U); bp->flags = bp->flags | (val > 459264U ? 131072U : 0U); bp->flags = bp->flags | (val > 459272U ? 524288U : 0U); bp->flags = bp->flags | (val > 459776U ? 2097152U : 0U); tmp___12 = readl((void const volatile *)(bp->regview + (((unsigned long )bp->common.shmem_base + ((unsigned long )bp->pfid & 1UL) * 116UL) + 864UL))); boot_mode = tmp___12 & 7U; switch (boot_mode) { case 0U: bp->common.boot_mode = 4U; goto ldv_57878; case 3U: bp->common.boot_mode = 8U; goto ldv_57878; case 4U: bp->common.boot_mode = 12U; goto ldv_57878; case 7U: bp->common.boot_mode = 0U; goto ldv_57878; } ldv_57878: pci_read_config_word((struct pci_dev const *)bp->pdev, bp->pm_cap + 2, & pmc); bp->flags = bp->flags | ((int )((short )pmc) < 0 ? 0U : 8U); tmp___13 = ldv__builtin_expect((bp->msg_enable & 2) != 0, 0L); if (tmp___13 != 0L) { _dev_info((struct device const *)(& (bp->pdev)->dev), "%sWoL capable\n", (bp->flags & 8U) != 0U ? (char *)"not " : (char *)""); } else { } val = readl((void const volatile *)(bp->regview + ((unsigned long )bp->common.shmem_base + 12UL))); val2 = readl((void const volatile *)(bp->regview + ((unsigned long )bp->common.shmem_base + 16UL))); val3 = readl((void const volatile *)(bp->regview + ((unsigned long )bp->common.shmem_base + 20UL))); val4 = readl((void const volatile *)(bp->regview + ((unsigned long )bp->common.shmem_base + 24UL))); _dev_info((struct device const *)(& (bp->pdev)->dev), "part number %X-%X-%X-%X\n", val, val2, val3, val4); return; } } static int bnx2x_get_igu_cam_info(struct bnx2x *bp ) { int pfid ; int igu_sb_id ; u32 val ; u8 fid ; u8 igu_sb_cnt ; int vn ; int __min1 ; int __min2 ; { pfid = (int )bp->pfid; igu_sb_cnt = 0U; bp->igu_base_sb = 255U; if ((bp->common.chip_id >> 16 == 5710U || (bp->common.chip_id >> 16 == 5711U || bp->common.chip_id >> 16 == 5712U)) || ((int )bp->common.int_block & 2) != 0) { vn = (int )bp->pfid >> 1; igu_sb_cnt = bp->igu_sb_cnt; bp->igu_base_sb = (unsigned int )bp->common.chip_port_mode == 0U ? (unsigned int )((u8 )pfid) * 16U : (unsigned int )((u8 )vn) * 16U; bp->igu_dsb_id = (unsigned int )bp->common.chip_port_mode == 0U ? (unsigned int )((u8 )pfid) + 64U : (unsigned int )((u8 )vn) + 64U; return (0); } else { } igu_sb_id = 0; goto ldv_57893; ldv_57892: val = readl((void const volatile *)bp->regview + (unsigned long )((igu_sb_id + 312320) * 4)); if ((val & 1U) == 0U) { goto ldv_57891; } else { } fid = (u8 )((val & 16256U) >> 7); if (((int )fid & 64) != 0) { if (((int )fid & 7) != pfid) { goto ldv_57891; } else { } if ((val & 126U) >> 1 == 0U) { bp->igu_dsb_id = (u8 )igu_sb_id; } else { if ((unsigned int )bp->igu_base_sb == 255U) { bp->igu_base_sb = (u8 )igu_sb_id; } else { } igu_sb_cnt = (u8 )((int )igu_sb_cnt + 1); } } else { } ldv_57891: igu_sb_id = igu_sb_id + 1; ldv_57893: ; if (igu_sb_id <= 135) { goto ldv_57892; } else { } __min1 = (int )bp->igu_sb_cnt; __min2 = (int )igu_sb_cnt; bp->igu_sb_cnt = (u8 )(__min1 < __min2 ? __min1 : __min2); if ((unsigned int )igu_sb_cnt == 0U) { printk("\vbnx2x: [%s:%d(%s)]CAM configuration error\n", "bnx2x_get_igu_cam_info", 10431, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); return (-22); } else { } return (0); } } static void bnx2x_link_settings_supported(struct bnx2x *bp , u32 switch_cfg ) { int cfg_size ; int idx ; int port ; unsigned int tmp ; unsigned int tmp___0 ; long tmp___1 ; long tmp___2 ; { cfg_size = 0; port = (int )bp->pfid & 1; bp->port.supported[0] = 0U; bp->port.supported[1] = 0U; switch ((int )bp->link_params.num_phys) { case 1: bp->port.supported[0] = bp->link_params.phy[0].supported; cfg_size = 1; goto ldv_57907; case 2: bp->port.supported[0] = bp->link_params.phy[1].supported; cfg_size = 1; goto ldv_57907; case 3: ; if ((bp->link_params.multi_phy_config & 8U) != 0U) { bp->port.supported[1] = bp->link_params.phy[1].supported; bp->port.supported[0] = bp->link_params.phy[2].supported; } else { bp->port.supported[0] = bp->link_params.phy[1].supported; bp->port.supported[1] = bp->link_params.phy[2].supported; } cfg_size = 2; goto ldv_57907; } ldv_57907: ; if (bp->port.supported[0] == 0U && bp->port.supported[1] == 0U) { tmp = readl((void const volatile *)(bp->regview + (((unsigned long )bp->common.shmem_base + (unsigned long )port * 400UL) + 412UL))); tmp___0 = readl((void const volatile *)(bp->regview + (((unsigned long )bp->common.shmem_base + (unsigned long )port * 400UL) + 436UL))); printk("\vbnx2x: [%s:%d(%s)]NVRAM config error. BAD phy config. PHY1 config 0x%x, PHY2 config 0x%x\n", "bnx2x_link_settings_supported", 10476, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", tmp___0, tmp); return; } else { } if (((((((((bp->common.chip_id >> 16 == 5770U || bp->common.chip_id >> 16 == 5797U) || bp->common.chip_id >> 16 == 5801U) || bp->common.chip_id >> 16 == 5774U) || bp->common.chip_id >> 16 == 5806U) || bp->common.chip_id >> 16 == 5807U) || ((bp->common.chip_id >> 16 == 5693U || bp->common.chip_id >> 16 == 5694U) || bp->common.chip_id >> 16 == 5695U)) || ((bp->common.chip_id >> 16 == 5793U || bp->common.chip_id >> 16 == 5794U) || bp->common.chip_id >> 16 == 5773U)) || (bp->common.chip_id >> 16 == 5796U || bp->common.chip_id >> 16 == 5803U)) || bp->common.chip_id >> 16 == 5805U) { bp->port.phy_addr = readl((void const volatile *)bp->regview + 43468U); } else { switch (switch_cfg) { case 0U: bp->port.phy_addr = readl((void const volatile *)bp->regview + (unsigned long )(port * 16 + 66420)); goto ldv_57912; case 16777216U: bp->port.phy_addr = readl((void const volatile *)bp->regview + (unsigned long )(port * 24 + 66368)); goto ldv_57912; default: printk("\vbnx2x: [%s:%d(%s)]BAD switch_cfg link_config 0x%x\n", "bnx2x_link_settings_supported", 10494, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", bp->port.link_config[0]); return; } ldv_57912: ; } tmp___1 = ldv__builtin_expect((bp->msg_enable & 2) != 0, 0L); if (tmp___1 != 0L) { _dev_info((struct device const *)(& (bp->pdev)->dev), "phy_addr 0x%x\n", bp->port.phy_addr); } else { } idx = 0; goto ldv_57916; ldv_57915: ; if ((bp->link_params.speed_cap_mask[idx] & 131072U) == 0U) { bp->port.supported[idx] = bp->port.supported[idx] & 4294967294U; } else { } if ((bp->link_params.speed_cap_mask[idx] & 65536U) == 0U) { bp->port.supported[idx] = bp->port.supported[idx] & 4294967293U; } else { } if ((bp->link_params.speed_cap_mask[idx] & 262144U) == 0U) { bp->port.supported[idx] = bp->port.supported[idx] & 4294967291U; } else { } if ((bp->link_params.speed_cap_mask[idx] & 524288U) == 0U) { bp->port.supported[idx] = bp->port.supported[idx] & 4294967287U; } else { } if ((bp->link_params.speed_cap_mask[idx] & 1048576U) == 0U) { bp->port.supported[idx] = bp->port.supported[idx] & 4294967247U; } else { } if ((bp->link_params.speed_cap_mask[idx] & 2097152U) == 0U) { bp->port.supported[idx] = bp->port.supported[idx] & 4294934527U; } else { } if ((bp->link_params.speed_cap_mask[idx] & 4194304U) == 0U) { bp->port.supported[idx] = bp->port.supported[idx] & 4294963199U; } else { } idx = idx + 1; ldv_57916: ; if (idx < cfg_size) { goto ldv_57915; } else { } tmp___2 = ldv__builtin_expect((bp->msg_enable & 2) != 0, 0L); if (tmp___2 != 0L) { _dev_info((struct device const *)(& (bp->pdev)->dev), "supported 0x%x 0x%x\n", bp->port.supported[0], bp->port.supported[1]); } else { } return; } } static void bnx2x_link_settings_requested(struct bnx2x *bp ) { u32 link_config ; u32 idx ; u32 cfg_size ; long tmp ; { cfg_size = 0U; bp->port.advertising[0] = 0U; bp->port.advertising[1] = 0U; switch ((int )bp->link_params.num_phys) { case 1: ; case 2: cfg_size = 1U; goto ldv_57926; case 3: cfg_size = 2U; goto ldv_57926; } ldv_57926: idx = 0U; goto ldv_57942; ldv_57941: bp->link_params.req_duplex[idx] = 1U; link_config = bp->port.link_config[idx]; switch (link_config & 983040U) { case 0U: ; if ((bp->port.supported[idx] & 64U) != 0U) { bp->link_params.req_line_speed[idx] = 0U; bp->port.advertising[idx] = bp->port.advertising[idx] | bp->port.supported[idx]; if (bp->link_params.phy[1].type == 3328U) { bp->port.advertising[idx] = bp->port.advertising[idx] | 12U; } else { } } else { bp->link_params.req_line_speed[idx] = 10000U; bp->port.advertising[idx] = bp->port.advertising[idx] | 5120U; goto ldv_57929; } goto ldv_57930; case 65536U: ; if ((bp->port.supported[idx] & 2U) != 0U) { bp->link_params.req_line_speed[idx] = 10U; bp->port.advertising[idx] = bp->port.advertising[idx] | 130U; } else { printk("\vbnx2x: [%s:%d(%s)]NVRAM config error. Invalid link_config 0x%x speed_cap_mask 0x%x\n", "bnx2x_link_settings_requested", 10586, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", link_config, bp->link_params.speed_cap_mask[idx]); return; } goto ldv_57930; case 131072U: ; if ((int )bp->port.supported[idx] & 1) { bp->link_params.req_line_speed[idx] = 10U; bp->link_params.req_duplex[idx] = 0U; bp->port.advertising[idx] = bp->port.advertising[idx] | 129U; } else { printk("\vbnx2x: [%s:%d(%s)]NVRAM config error. Invalid link_config 0x%x speed_cap_mask 0x%x\n", "bnx2x_link_settings_requested", 10603, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", link_config, bp->link_params.speed_cap_mask[idx]); return; } goto ldv_57930; case 262144U: ; if ((bp->port.supported[idx] & 8U) != 0U) { bp->link_params.req_line_speed[idx] = 100U; bp->port.advertising[idx] = bp->port.advertising[idx] | 136U; } else { printk("\vbnx2x: [%s:%d(%s)]NVRAM config error. Invalid link_config 0x%x speed_cap_mask 0x%x\n", "bnx2x_link_settings_requested", 10619, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", link_config, bp->link_params.speed_cap_mask[idx]); return; } goto ldv_57930; case 196608U: ; if ((bp->port.supported[idx] & 4U) != 0U) { bp->link_params.req_line_speed[idx] = 100U; bp->link_params.req_duplex[idx] = 0U; bp->port.advertising[idx] = bp->port.advertising[idx] | 132U; } else { printk("\vbnx2x: [%s:%d(%s)]NVRAM config error. Invalid link_config 0x%x speed_cap_mask 0x%x\n", "bnx2x_link_settings_requested", 10637, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", link_config, bp->link_params.speed_cap_mask[idx]); return; } goto ldv_57930; case 327680U: ; if ((bp->port.supported[idx] & 32U) != 0U) { bp->link_params.req_line_speed[idx] = 1000U; bp->port.advertising[idx] = bp->port.advertising[idx] | 160U; } else { printk("\vbnx2x: [%s:%d(%s)]NVRAM config error. Invalid link_config 0x%x speed_cap_mask 0x%x\n", "bnx2x_link_settings_requested", 10653, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", link_config, bp->link_params.speed_cap_mask[idx]); return; } goto ldv_57930; case 393216U: ; if ((bp->port.supported[idx] & 32768U) != 0U) { bp->link_params.req_line_speed[idx] = 2500U; bp->port.advertising[idx] = bp->port.advertising[idx] | 32896U; } else { printk("\vbnx2x: [%s:%d(%s)]NVRAM config error. Invalid link_config 0x%x speed_cap_mask 0x%x\n", "bnx2x_link_settings_requested", 10669, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", link_config, bp->link_params.speed_cap_mask[idx]); return; } goto ldv_57930; case 458752U: ; if ((bp->port.supported[idx] & 4096U) != 0U) { bp->link_params.req_line_speed[idx] = 10000U; bp->port.advertising[idx] = bp->port.advertising[idx] | 5120U; } else { printk("\vbnx2x: [%s:%d(%s)]NVRAM config error. Invalid link_config 0x%x speed_cap_mask 0x%x\n", "bnx2x_link_settings_requested", 10685, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", link_config, bp->link_params.speed_cap_mask[idx]); return; } goto ldv_57930; case 524288U: bp->link_params.req_line_speed[idx] = 20000U; goto ldv_57930; default: printk("\vbnx2x: [%s:%d(%s)]NVRAM config error. BAD link speed link_config 0x%x\n", "bnx2x_link_settings_requested", 10695, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", link_config); bp->link_params.req_line_speed[idx] = 0U; bp->port.advertising[idx] = bp->port.supported[idx]; goto ldv_57930; } ldv_57930: bp->link_params.req_flow_ctrl[idx] = (unsigned int )((u16 )link_config) & 1792U; if ((unsigned int )bp->link_params.req_flow_ctrl[idx] == 0U) { if ((bp->port.supported[idx] & 64U) == 0U) { bp->link_params.req_flow_ctrl[idx] = 1024U; } else { bnx2x_set_requested_fc(bp); } } else { } tmp = ldv__builtin_expect((bp->msg_enable & 2) != 0, 0L); if (tmp != 0L) { _dev_info((struct device const *)(& (bp->pdev)->dev), "req_line_speed %d req_duplex %d req_flow_ctrl 0x%x advertising 0x%x\n", (int )bp->link_params.req_line_speed[idx], (int )bp->link_params.req_duplex[idx], (int )bp->link_params.req_flow_ctrl[idx], bp->port.advertising[idx]); } else { } ldv_57929: idx = idx + 1U; ldv_57942: ; if (idx < cfg_size) { goto ldv_57941; } else { } return; } } static void bnx2x_set_mac_buf(u8 *mac_buf , u32 mac_lo , u16 mac_hi ) { __be16 mac_hi_be ; __u16 tmp ; __be32 mac_lo_be ; __u32 tmp___0 ; size_t __len ; void *__ret ; size_t __len___0 ; void *__ret___0 ; { tmp = __fswab16((int )mac_hi); mac_hi_be = tmp; tmp___0 = __fswab32(mac_lo); mac_lo_be = tmp___0; __len = 2UL; if (__len > 63UL) { __ret = __memcpy((void *)mac_buf, (void const *)(& mac_hi_be), __len); } else { __ret = __builtin_memcpy((void *)mac_buf, (void const *)(& mac_hi_be), __len); } __len___0 = 4UL; if (__len___0 > 63UL) { __ret___0 = __memcpy((void *)mac_buf + 2U, (void const *)(& mac_lo_be), __len___0); } else { __ret___0 = __builtin_memcpy((void *)mac_buf + 2U, (void const *)(& mac_lo_be), __len___0); } return; } } static void bnx2x_get_port_hwinfo(struct bnx2x *bp ) { int port ; u32 config ; u32 ext_phy_type ; u32 ext_phy_config ; u32 eee_mode ; unsigned int tmp ; unsigned int tmp___0 ; long tmp___1 ; unsigned int tmp___2 ; { port = (int )bp->pfid & 1; bp->link_params.bp = bp; bp->link_params.port = (u8 )port; bp->link_params.lane_config = readl((void const volatile *)(bp->regview + (((unsigned long )bp->common.shmem_base + (unsigned long )port * 400UL) + 432UL))); tmp = readl((void const volatile *)(bp->regview + (((unsigned long )bp->common.shmem_base + (unsigned long )port * 400UL) + 440UL))); bp->link_params.speed_cap_mask[0] = tmp & 4294901760U; tmp___0 = readl((void const volatile *)(bp->regview + (((unsigned long )bp->common.shmem_base + (unsigned long )port * 400UL) + 404UL))); bp->link_params.speed_cap_mask[1] = tmp___0 & 4294901760U; bp->port.link_config[0] = readl((void const volatile *)(bp->regview + (((unsigned long )bp->common.shmem_base + (unsigned long )port * 116UL) + 888UL))); bp->port.link_config[1] = readl((void const volatile *)(bp->regview + (((unsigned long )bp->common.shmem_base + (unsigned long )port * 116UL) + 896UL))); bp->link_params.multi_phy_config = readl((void const volatile *)(bp->regview + (((unsigned long )bp->common.shmem_base + (unsigned long )port * 400UL) + 408UL))); config = readl((void const volatile *)(bp->regview + (((unsigned long )bp->common.shmem_base + (unsigned long )port * 116UL) + 856UL))); bp->wol = (u8 )((bp->flags & 8U) == 0U && (config & 16777216U) != 0U); if ((config & 3072U) == 1024U && (unsigned int )bp->mf_mode == 0U) { bp->flags = bp->flags | 16384U; } else { } if ((config & 3072U) == 2048U && (unsigned int )bp->mf_mode == 0U) { bp->flags = bp->flags | 32768U; } else { } tmp___1 = ldv__builtin_expect((bp->msg_enable & 2) != 0, 0L); if (tmp___1 != 0L) { _dev_info((struct device const *)(& (bp->pdev)->dev), "lane_config 0x%08x speed_cap_mask0 0x%08x link_config0 0x%08x\n", bp->link_params.lane_config, bp->link_params.speed_cap_mask[0], bp->port.link_config[0]); } else { } bp->link_params.switch_cfg = bp->port.link_config[0] & 50331648U; bnx2x_phy_probe(& bp->link_params); bnx2x_link_settings_supported(bp, bp->link_params.switch_cfg); bnx2x_link_settings_requested(bp); ext_phy_config = readl((void const volatile *)(bp->regview + (((unsigned long )bp->common.shmem_base + (unsigned long )port * 400UL) + 436UL))); ext_phy_type = ext_phy_config & 65280U; if (ext_phy_type == 0U) { bp->mdio.prtad = (int )bp->port.phy_addr; } else if (ext_phy_type != 64768U && ext_phy_type != 65280U) { bp->mdio.prtad = (int )ext_phy_config & 255; } else { } tmp___2 = readl((void const volatile *)(bp->regview + (((unsigned long )bp->common.shmem_base + (unsigned long )port * 116UL) + 904UL))); eee_mode = tmp___2 & 255U; if (eee_mode != 0U) { bp->link_params.eee_mode = 3489660928U; } else { bp->link_params.eee_mode = 0U; } return; } } void bnx2x_get_iscsi_info(struct bnx2x *bp ) { u32 no_flags ; int port ; u32 max_iscsi_conn ; unsigned int tmp ; long tmp___0 ; { no_flags = 16384U; port = (int )bp->pfid & 1; tmp = readl((void const volatile *)(bp->regview + (((unsigned long )bp->common.shmem_base + (unsigned long )port * 52UL) + 1112UL))); max_iscsi_conn = tmp ^ 505290270U; if ((unsigned int )bp->cnic_support == 0U) { bp->flags = bp->flags | no_flags; return; } else { } bp->cnic_eth_dev.max_iscsi_conn = max_iscsi_conn >> 16; tmp___0 = ldv__builtin_expect((bp->msg_enable & 2) != 0, 0L); if (tmp___0 != 0L) { _dev_info((struct device const *)(& (bp->pdev)->dev), "max_iscsi_conn 0x%x\n", bp->cnic_eth_dev.max_iscsi_conn); } else { } if (bp->cnic_eth_dev.max_iscsi_conn == 0U) { bp->flags = bp->flags | no_flags; } else { } return; } } static void bnx2x_get_ext_wwn_info(struct bnx2x *bp , int func ) { { bp->cnic_eth_dev.fcoe_wwn_port_name_hi = readl((void const volatile *)(bp->regview + (((unsigned long )bp->common.mf_cfg_base + (unsigned long )func * 40UL) + 248UL))); bp->cnic_eth_dev.fcoe_wwn_port_name_lo = readl((void const volatile *)(bp->regview + (((unsigned long )bp->common.mf_cfg_base + (unsigned long )func * 40UL) + 252UL))); bp->cnic_eth_dev.fcoe_wwn_node_name_hi = readl((void const volatile *)(bp->regview + (((unsigned long )bp->common.mf_cfg_base + (unsigned long )func * 40UL) + 256UL))); bp->cnic_eth_dev.fcoe_wwn_node_name_lo = readl((void const volatile *)(bp->regview + (((unsigned long )bp->common.mf_cfg_base + (unsigned long )func * 40UL) + 260UL))); return; } } static void bnx2x_get_fcoe_info(struct bnx2x *bp ) { int port ; int func ; u32 max_fcoe_conn ; unsigned int tmp ; long tmp___0 ; { port = (int )bp->pfid & 1; func = (int )bp->pf_num; tmp = readl((void const volatile *)(bp->regview + (((unsigned long )bp->common.shmem_base + (unsigned long )port * 52UL) + 1120UL))); max_fcoe_conn = tmp ^ 505290270U; if ((unsigned int )bp->cnic_support == 0U) { bp->flags = bp->flags | 32768U; return; } else { } bp->cnic_eth_dev.max_fcoe_conn = max_fcoe_conn >> 16; bp->cnic_eth_dev.max_fcoe_exchanges = 4096U; if ((unsigned int )bp->mf_mode != 0U || (unsigned int )bp->common.chip_port_mode == 0U) { bp->cnic_eth_dev.max_fcoe_exchanges = bp->cnic_eth_dev.max_fcoe_exchanges / 2U; } else { } if ((unsigned int )bp->mf_mode == 0U) { bp->cnic_eth_dev.fcoe_wwn_port_name_hi = readl((void const volatile *)(bp->regview + (((unsigned long )bp->common.shmem_base + (unsigned long )port * 400UL) + 184UL))); bp->cnic_eth_dev.fcoe_wwn_port_name_lo = readl((void const volatile *)(bp->regview + (((unsigned long )bp->common.shmem_base + (unsigned long )port * 400UL) + 188UL))); bp->cnic_eth_dev.fcoe_wwn_node_name_hi = readl((void const volatile *)(bp->regview + (((unsigned long )bp->common.shmem_base + (unsigned long )port * 400UL) + 192UL))); bp->cnic_eth_dev.fcoe_wwn_node_name_lo = readl((void const volatile *)(bp->regview + (((unsigned long )bp->common.shmem_base + (unsigned long )port * 400UL) + 196UL))); } else if ((unsigned int )bp->mf_mode != 1U) { if ((bp->mf_ext_config & 8U) != 0U && (bp->common.chip_id >> 16 != 5710U && (bp->common.chip_id >> 16 != 5711U && bp->common.chip_id >> 16 != 5712U))) { bnx2x_get_ext_wwn_info(bp, func); } else { } } else if (((unsigned int )bp->mf_mode == 1U && (bp->mf_config[(int )bp->pfid >> 1] & 6U) == 0U) && (bp->common.chip_id >> 16 != 5710U && (bp->common.chip_id >> 16 != 5711U && bp->common.chip_id >> 16 != 5712U))) { bnx2x_get_ext_wwn_info(bp, func); } else { } tmp___0 = ldv__builtin_expect((bp->msg_enable & 2) != 0, 0L); if (tmp___0 != 0L) { _dev_info((struct device const *)(& (bp->pdev)->dev), "max_fcoe_conn 0x%x\n", bp->cnic_eth_dev.max_fcoe_conn); } else { } if (bp->cnic_eth_dev.max_fcoe_conn == 0U) { bp->flags = bp->flags | 32768U; } else { } return; } } static void bnx2x_get_cnic_info(struct bnx2x *bp ) { { bnx2x_get_iscsi_info(bp); bnx2x_get_fcoe_info(bp); return; } } static void bnx2x_get_cnic_mac_hwinfo(struct bnx2x *bp ) { u32 val ; u32 val2 ; int func ; int port ; u8 *iscsi_mac ; u8 *fip_mac ; u32 cfg ; unsigned int tmp ; long tmp___0 ; long tmp___1 ; size_t __len ; void *__ret ; long tmp___2 ; long tmp___3 ; size_t __len___0 ; void *__ret___0 ; long tmp___4 ; long tmp___5 ; size_t __len___1 ; void *__ret___1 ; bool tmp___6 ; int tmp___7 ; bool tmp___8 ; int tmp___9 ; { func = (int )bp->pf_num; port = (int )bp->pfid & 1; iscsi_mac = (u8 *)(& bp->cnic_eth_dev.iscsi_mac); fip_mac = (u8 *)(& bp->fip_mac); if ((unsigned int )bp->mf_mode != 0U) { if ((unsigned int )bp->mf_mode != 1U && (bp->common.chip_id >> 16 != 5710U && (bp->common.chip_id >> 16 != 5711U && bp->common.chip_id >> 16 != 5712U))) { tmp = readl((void const volatile *)(bp->regview + (((unsigned long )bp->common.mf_cfg_base + (unsigned long )func * 40UL) + 228UL))); cfg = tmp; if ((cfg & 4U) != 0U) { val2 = readl((void const volatile *)(bp->regview + (((unsigned long )bp->common.mf_cfg_base + (unsigned long )func * 40UL) + 232UL))); val = readl((void const volatile *)(bp->regview + (((unsigned long )bp->common.mf_cfg_base + (unsigned long )func * 40UL) + 236UL))); bnx2x_set_mac_buf(iscsi_mac, val, (int )((u16 )val2)); tmp___0 = ldv__builtin_expect((bp->msg_enable & 2) != 0, 0L); if (tmp___0 != 0L) { _dev_info((struct device const *)(& (bp->pdev)->dev), "Read iSCSI MAC: %pM\n", iscsi_mac); } else { } } else { bp->flags = bp->flags | 24576U; } if ((cfg & 8U) != 0U) { val2 = readl((void const volatile *)(bp->regview + (((unsigned long )bp->common.mf_cfg_base + (unsigned long )func * 40UL) + 240UL))); val = readl((void const volatile *)(bp->regview + (((unsigned long )bp->common.mf_cfg_base + (unsigned long )func * 40UL) + 244UL))); bnx2x_set_mac_buf(fip_mac, val, (int )((u16 )val2)); tmp___1 = ldv__builtin_expect((bp->msg_enable & 2) != 0, 0L); if (tmp___1 != 0L) { _dev_info((struct device const *)(& (bp->pdev)->dev), "Read FCoE L2 MAC: %pM\n", fip_mac); } else { } } else { bp->flags = bp->flags | 32768U; } bp->mf_ext_config = cfg; } else if ((bp->mf_config[(int )bp->pfid >> 1] & 6U) == 6U) { __len = 6UL; if (__len > 63UL) { __ret = __memcpy((void *)iscsi_mac, (void const *)(bp->dev)->dev_addr, __len); } else { __ret = __builtin_memcpy((void *)iscsi_mac, (void const *)(bp->dev)->dev_addr, __len); } tmp___2 = ldv__builtin_expect((bp->msg_enable & 2) != 0, 0L); if (tmp___2 != 0L) { _dev_info((struct device const *)(& (bp->pdev)->dev), "SD ISCSI MODE\n"); } else { } tmp___3 = ldv__builtin_expect((bp->msg_enable & 2) != 0, 0L); if (tmp___3 != 0L) { _dev_info((struct device const *)(& (bp->pdev)->dev), "Read iSCSI MAC: %pM\n", iscsi_mac); } else { } } else if ((bp->mf_config[(int )bp->pfid >> 1] & 6U) == 0U) { __len___0 = 6UL; if (__len___0 > 63UL) { __ret___0 = __memcpy((void *)fip_mac, (void const *)(bp->dev)->dev_addr, __len___0); } else { __ret___0 = __builtin_memcpy((void *)fip_mac, (void const *)(bp->dev)->dev_addr, __len___0); } tmp___4 = ldv__builtin_expect((bp->msg_enable & 2) != 0, 0L); if (tmp___4 != 0L) { _dev_info((struct device const *)(& (bp->pdev)->dev), "SD FCoE MODE\n"); } else { } tmp___5 = ldv__builtin_expect((bp->msg_enable & 2) != 0, 0L); if (tmp___5 != 0L) { _dev_info((struct device const *)(& (bp->pdev)->dev), "Read FIP MAC: %pM\n", fip_mac); } else { } } else { } if ((unsigned int )bp->mf_mode == 3U && (bp->mf_ext_config & 8U) != 0U) { __len___1 = 6UL; if (__len___1 > 63UL) { __ret___1 = __memcpy((void *)(bp->dev)->dev_addr, (void const *)fip_mac, __len___1); } else { __ret___1 = __builtin_memcpy((void *)(bp->dev)->dev_addr, (void const *)fip_mac, __len___1); } } else { } } else { val2 = readl((void const volatile *)(bp->regview + (((unsigned long )bp->common.shmem_base + (unsigned long )port * 400UL) + 76UL))); val = readl((void const volatile *)(bp->regview + (((unsigned long )bp->common.shmem_base + (unsigned long )port * 400UL) + 80UL))); bnx2x_set_mac_buf(iscsi_mac, val, (int )((u16 )val2)); val2 = readl((void const volatile *)(bp->regview + (((unsigned long )bp->common.shmem_base + (unsigned long )port * 400UL) + 176UL))); val = readl((void const volatile *)(bp->regview + (((unsigned long )bp->common.shmem_base + (unsigned long )port * 400UL) + 180UL))); bnx2x_set_mac_buf(fip_mac, val, (int )((u16 )val2)); } tmp___6 = is_valid_ether_addr((u8 const *)iscsi_mac); if (tmp___6) { tmp___7 = 0; } else { tmp___7 = 1; } if (tmp___7) { bp->flags = bp->flags | 24576U; memset((void *)iscsi_mac, 0, 6UL); } else { } tmp___8 = is_valid_ether_addr((u8 const *)fip_mac); if (tmp___8) { tmp___9 = 0; } else { tmp___9 = 1; } if (tmp___9) { bp->flags = bp->flags | 32768U; memset((void *)(& bp->fip_mac), 0, 6UL); } else { } return; } } static void bnx2x_get_mac_hwinfo(struct bnx2x *bp ) { u32 val ; u32 val2 ; int func ; int port ; size_t __len ; void *__ret ; bool tmp ; int tmp___0 ; { func = (int )bp->pf_num; port = (int )bp->pfid & 1; memset((void *)(bp->dev)->dev_addr, 0, 6UL); if ((bp->flags & 512U) != 0U) { printk("\vbnx2x: [%s:%d]warning: random MAC workaround active\n", "bnx2x_get_mac_hwinfo", 11036); eth_hw_addr_random(bp->dev); } else if ((unsigned int )bp->mf_mode != 0U) { val2 = readl((void const volatile *)(bp->regview + (((unsigned long )bp->common.mf_cfg_base + (unsigned long )func * 24UL) + 40UL))); val = readl((void const volatile *)(bp->regview + (((unsigned long )bp->common.mf_cfg_base + (unsigned long )func * 24UL) + 44UL))); if (val2 != 65535U && val != 4294967295U) { bnx2x_set_mac_buf((bp->dev)->dev_addr, val, (int )((u16 )val2)); } else { } if ((unsigned int )bp->cnic_support != 0U) { bnx2x_get_cnic_mac_hwinfo(bp); } else { } } else { val2 = readl((void const volatile *)(bp->regview + (((unsigned long )bp->common.shmem_base + (unsigned long )port * 400UL) + 68UL))); val = readl((void const volatile *)(bp->regview + (((unsigned long )bp->common.shmem_base + (unsigned long )port * 400UL) + 72UL))); bnx2x_set_mac_buf((bp->dev)->dev_addr, val, (int )((u16 )val2)); if ((unsigned int )bp->cnic_support != 0U) { bnx2x_get_cnic_mac_hwinfo(bp); } else { } } __len = 6UL; if (__len > 63UL) { __ret = __memcpy((void *)(& bp->link_params.mac_addr), (void const *)(bp->dev)->dev_addr, __len); } else { __ret = __builtin_memcpy((void *)(& bp->link_params.mac_addr), (void const *)(bp->dev)->dev_addr, __len); } tmp = bnx2x_is_valid_ether_addr(bp, (bp->dev)->dev_addr); if (tmp) { tmp___0 = 0; } else { tmp___0 = 1; } if (tmp___0) { dev_err((struct device const *)(& (bp->pdev)->dev), "bad Ethernet MAC address configuration: %pM\nchange it manually before bringing up the appropriate network interface\n", (bp->dev)->dev_addr); } else { } return; } } static bool bnx2x_get_dropless_info(struct bnx2x *bp ) { int tmp ; u32 cfg ; { if ((unsigned int )bp->mf_mode != 0U && (bp->common.chip_id >> 16 != 5710U && (bp->common.chip_id >> 16 != 5711U && bp->common.chip_id >> 16 != 5712U))) { tmp = (int )bp->pf_num; cfg = readl((void const volatile *)(bp->regview + (((unsigned long )bp->common.mf_cfg_base + (unsigned long )tmp * 40UL) + 228UL))); cfg = (cfg & 128U) != 0U; } else { tmp = (int )bp->pfid & 1; cfg = readl((void const volatile *)(bp->regview + (((unsigned long )bp->common.shmem_base + (unsigned long )tmp * 400UL) + 124UL))); cfg = cfg & 1U; } return (cfg != 0U); } } static int bnx2x_get_hwinfo(struct bnx2x *bp ) { int func ; int vn ; u32 val ; int rc ; int tout ; long tmp ; unsigned int tmp___0 ; unsigned int tmp___1 ; long tmp___2 ; long tmp___3 ; long tmp___4 ; unsigned int tmp___5 ; long tmp___6 ; unsigned int tmp___7 ; long tmp___8 ; long tmp___9 ; unsigned int tmp___10 ; unsigned int tmp___11 ; long tmp___12 ; long tmp___13 ; long tmp___14 ; unsigned int tmp___15 ; long tmp___16 ; long tmp___17 ; long tmp___18 ; u8 other_port ; u8 other_func ; { func = (int )bp->pf_num; val = 0U; rc = 0; bnx2x_get_common_hwinfo(bp); if (bp->common.chip_id >> 16 == 5710U || (bp->common.chip_id >> 16 == 5711U || bp->common.chip_id >> 16 == 5712U)) { bp->common.int_block = 0U; bp->igu_dsb_id = 16U; bp->igu_base_sb = 0U; } else { bp->common.int_block = 1U; bnx2x_acquire_hw_lock(bp, 5U); val = readl((void const volatile *)bp->regview + 1245184U); if ((val & 2U) != 0U) { tout = 5000; tmp = ldv__builtin_expect((bp->msg_enable & 2) != 0, 0L); if (tmp != 0L) { _dev_info((struct device const *)(& (bp->pdev)->dev), "FORCING Normal Mode\n"); } else { } val = val & 4294967293U; writel(val, (void volatile *)bp->regview + 1245184U); writel(127U, (void volatile *)bp->regview + 1245528U); goto ldv_58028; ldv_58027: tout = tout - 1; usleep_range(1000UL, 2000UL); ldv_58028: ; if (tout != 0) { tmp___0 = readl((void const volatile *)bp->regview + 1245528U); if (tmp___0 != 0U) { goto ldv_58027; } else { goto ldv_58029; } } else { } ldv_58029: tmp___1 = readl((void const volatile *)bp->regview + 1245528U); if (tmp___1 != 0U) { dev_err((struct device const *)(& (bp->pdev)->dev), "FORCING Normal Mode failed!!!\n"); bnx2x_release_hw_lock(bp, 5U); return (-1); } else { } } else { } if ((val & 2U) != 0U) { tmp___2 = ldv__builtin_expect((bp->msg_enable & 2) != 0, 0L); if (tmp___2 != 0L) { _dev_info((struct device const *)(& (bp->pdev)->dev), "IGU Backward Compatible Mode\n"); } else { } bp->common.int_block = (u8 )((unsigned int )bp->common.int_block | 2U); } else { tmp___3 = ldv__builtin_expect((bp->msg_enable & 2) != 0, 0L); if (tmp___3 != 0L) { _dev_info((struct device const *)(& (bp->pdev)->dev), "IGU Normal Mode\n"); } else { } } rc = bnx2x_get_igu_cam_info(bp); bnx2x_release_hw_lock(bp, 5U); if (rc != 0) { return (rc); } else { } } if (bp->common.chip_id >> 16 == 5710U || (bp->common.chip_id >> 16 == 5711U || bp->common.chip_id >> 16 == 5712U)) { bp->base_fw_ndsb = ((int )bp->pfid & 1) * 16 + (((int )bp->pfid >> 1) << 2); } else { bp->base_fw_ndsb = (int )bp->igu_base_sb; } tmp___4 = ldv__builtin_expect((bp->msg_enable & 2) != 0, 0L); if (tmp___4 != 0L) { _dev_info((struct device const *)(& (bp->pdev)->dev), "igu_dsb_id %d igu_base_sb %d igu_sb_cnt %d\nbase_fw_ndsb %d\n", (int )bp->igu_dsb_id, (int )bp->igu_base_sb, (int )bp->igu_sb_cnt, bp->base_fw_ndsb); } else { } bp->mf_ov = 0U; bp->mf_mode = 0U; vn = (int )bp->pfid >> 1; if (bp->common.chip_id >> 16 != 5710U && (bp->flags & 512U) == 0U) { tmp___6 = ldv__builtin_expect((bp->msg_enable & 2) != 0, 0L); if (tmp___6 != 0L) { tmp___5 = readl((void const volatile *)bp->regview + (unsigned long )bp->common.shmem2_base); _dev_info((struct device const *)(& (bp->pdev)->dev), "shmem2base 0x%x, size %d, mfcfg offset %d\n", bp->common.shmem2_base, tmp___5, 16U); } else { } if (bp->common.shmem2_base != 0U) { tmp___7 = readl((void const volatile *)bp->regview + (unsigned long )bp->common.shmem2_base); if (tmp___7 > 16U) { bp->common.mf_cfg_base = readl((void const volatile *)(bp->regview + ((unsigned long )bp->common.shmem2_base + 16UL))); } else { bp->common.mf_cfg_base = bp->common.shmem_base + 2020U; } } else { bp->common.mf_cfg_base = bp->common.shmem_base + 2020U; } if (bp->common.mf_cfg_base != 0U) { val = readl((void const volatile *)(bp->regview + ((unsigned long )bp->common.shmem_base + 852UL))); val = val & 1792U; switch (val) { case 768U: val = readl((void const volatile *)(bp->regview + (((unsigned long )bp->common.mf_cfg_base + (unsigned long )func * 24UL) + 40UL))); if (val != 65535U) { bp->mf_mode = 2U; bp->mf_config[vn] = readl((void const volatile *)(bp->regview + (((unsigned long )bp->common.mf_cfg_base + (unsigned long )func * 24UL) + 36UL))); } else { tmp___8 = ldv__builtin_expect((bp->msg_enable & 2) != 0, 0L); if (tmp___8 != 0L) { _dev_info((struct device const *)(& (bp->pdev)->dev), "illegal MAC address for SI\n"); } else { } } goto ldv_58031; case 1024U: ; if (bp->common.chip_id >> 16 != 5710U && (bp->common.chip_id >> 16 != 5711U && bp->common.chip_id >> 16 != 5712U)) { tmp___10 = readl((void const volatile *)(bp->regview + (((unsigned long )bp->common.mf_cfg_base + (unsigned long )func * 24UL) + 40UL))); if (tmp___10 != 65535U) { if (bp->common.shmem2_base != 0U) { tmp___11 = readl((void const volatile *)bp->regview + (unsigned long )bp->common.shmem2_base); if (tmp___11 > 116U) { bp->mf_mode = 3U; bp->mf_config[vn] = readl((void const volatile *)(bp->regview + (((unsigned long )bp->common.mf_cfg_base + (unsigned long )func * 24UL) + 36UL))); } else { goto _L___0; } } else { goto _L___0; } } else { goto _L___0; } } else { _L___0: /* CIL Label */ tmp___9 = ldv__builtin_expect((bp->msg_enable & 2) != 0, 0L); if (tmp___9 != 0L) { _dev_info((struct device const *)(& (bp->pdev)->dev), "can not configure afex mode\n"); } else { } } goto ldv_58031; case 0U: val = readl((void const volatile *)(bp->regview + ((unsigned long )bp->common.mf_cfg_base + 48UL))); val = val & 65535U; if (val != 65535U) { bp->mf_mode = 1U; bp->mf_config[vn] = readl((void const volatile *)(bp->regview + (((unsigned long )bp->common.mf_cfg_base + (unsigned long )func * 24UL) + 36UL))); } else { tmp___12 = ldv__builtin_expect((bp->msg_enable & 2) != 0, 0L); if (tmp___12 != 0L) { _dev_info((struct device const *)(& (bp->pdev)->dev), "illegal OV for SD\n"); } else { } } goto ldv_58031; case 256U: bp->mf_config[vn] = 0U; goto ldv_58031; default: bp->mf_config[vn] = 0U; tmp___13 = ldv__builtin_expect((bp->msg_enable & 2) != 0, 0L); if (tmp___13 != 0L) { _dev_info((struct device const *)(& (bp->pdev)->dev), "unknown MF mode 0x%x\n", val); } else { } } ldv_58031: ; } else { } tmp___14 = ldv__builtin_expect((bp->msg_enable & 2) != 0, 0L); if (tmp___14 != 0L) { _dev_info((struct device const *)(& (bp->pdev)->dev), "%s function mode\n", (unsigned int )bp->mf_mode != 0U ? (char *)"multi" : (char *)"single"); } else { } switch ((int )bp->mf_mode) { case 1: tmp___15 = readl((void const volatile *)(bp->regview + (((unsigned long )bp->common.mf_cfg_base + (unsigned long )func * 24UL) + 48UL))); val = tmp___15 & 65535U; if (val != 65535U) { bp->mf_ov = (u16 )val; bp->path_has_ovlan = 1U; tmp___16 = ldv__builtin_expect((bp->msg_enable & 2) != 0, 0L); if (tmp___16 != 0L) { _dev_info((struct device const *)(& (bp->pdev)->dev), "MF OV for func %d is %d (0x%04x)\n", func, (int )bp->mf_ov, (int )bp->mf_ov); } else { } } else { dev_err((struct device const *)(& (bp->pdev)->dev), "No valid MF OV for func %d, aborting\n", func); return (-1); } goto ldv_58037; case 3: tmp___17 = ldv__builtin_expect((bp->msg_enable & 2) != 0, 0L); if (tmp___17 != 0L) { _dev_info((struct device const *)(& (bp->pdev)->dev), "func %d is in MF afex mode\n", func); } else { } goto ldv_58037; case 2: tmp___18 = ldv__builtin_expect((bp->msg_enable & 2) != 0, 0L); if (tmp___18 != 0L) { _dev_info((struct device const *)(& (bp->pdev)->dev), "func %d is in MF switch-independent mode\n", func); } else { } goto ldv_58037; default: ; if (vn != 0) { dev_err((struct device const *)(& (bp->pdev)->dev), "VN %d is in a single function mode, aborting\n", vn); return (-1); } else { } goto ldv_58037; } ldv_58037: ; if ((((unsigned int )bp->common.chip_port_mode == 0U && bp->path_has_ovlan == 0U) && (unsigned int )bp->mf_mode == 0U) && bp->common.mf_cfg_base != 0U) { other_port = ((int )bp->pfid & 1) == 0; other_func = (bp->common.chip_id >> 16 != 5710U && (bp->common.chip_id >> 16 != 5711U && bp->common.chip_id >> 16 != 5712U) ? (unsigned int )bp->pf_num & 1U : 0U) + (unsigned int )other_port * 2U; val = readl((void const volatile *)(bp->regview + (((unsigned long )bp->common.mf_cfg_base + (unsigned long )other_func * 24UL) + 48UL))); if (val != 65535U) { bp->path_has_ovlan = 1U; } else { } } else { } } else { } if ((bp->common.chip_id >> 16 == 5710U || (bp->common.chip_id >> 16 == 5711U || bp->common.chip_id >> 16 == 5712U)) && (unsigned int )bp->mf_mode != 0U) { bp->igu_sb_cnt = (u8 )((unsigned int )bp->igu_sb_cnt / 4U); } else { } bnx2x_get_port_hwinfo(bp); bnx2x_get_mac_hwinfo(bp); bnx2x_get_cnic_info(bp); return (rc); } } static void bnx2x_read_fwinfo(struct bnx2x *bp ) { int cnt ; int i ; int block_end ; int rodi ; char vpd_start[129U] ; char str_id_reg[5U] ; char str_id_cap[5U] ; char *vpd_data ; char *vpd_extended_data ; u8 len ; ssize_t tmp ; u16 tmp___0 ; void *tmp___1 ; size_t __len ; void *__ret ; ssize_t tmp___2 ; size_t __len___0 ; void *__ret___0 ; int tmp___3 ; int tmp___4 ; { vpd_extended_data = 0; tmp = pci_read_vpd(bp->pdev, 0LL, 128UL, (void *)(& vpd_start)); cnt = (int )tmp; memset((void *)(& bp->fw_ver), 0, 32UL); if (cnt <= 127) { goto out_not_found; } else { } i = pci_vpd_find_tag((u8 const *)(& vpd_start), 0U, 128U, 144); if (i < 0) { goto out_not_found; } else { } tmp___0 = pci_vpd_lrdt_size((u8 const *)(& vpd_start) + (unsigned long )i); block_end = (i + 3) + (int )tmp___0; i = i + 3; if (block_end > 128) { tmp___1 = kmalloc((size_t )block_end, 208U); vpd_extended_data = (char *)tmp___1; if ((unsigned long )vpd_extended_data == (unsigned long )((char *)0)) { goto out_not_found; } else { } __len = 128UL; if (__len > 63UL) { __ret = __memcpy((void *)vpd_extended_data, (void const *)(& vpd_start), __len); } else { __ret = __builtin_memcpy((void *)vpd_extended_data, (void const *)(& vpd_start), __len); } tmp___2 = pci_read_vpd(bp->pdev, 128LL, (size_t )(block_end + -128), (void *)vpd_extended_data + 128U); cnt = (int )tmp___2; if (block_end + -128 > cnt) { goto out_not_found; } else { } vpd_data = vpd_extended_data; } else { vpd_data = (char *)(& vpd_start); } rodi = pci_vpd_find_info_keyword((u8 const *)vpd_data, (unsigned int )i, (unsigned int )block_end, "MN"); if (rodi < 0) { goto out_not_found; } else { } len = pci_vpd_info_field_size((u8 const *)vpd_data + (unsigned long )rodi); if ((unsigned int )len != 4U) { goto out_not_found; } else { } rodi = rodi + 3; snprintf((char *)(& str_id_reg), 5UL, "%04x", 4136); snprintf((char *)(& str_id_cap), 5UL, "%04X", 4136); tmp___3 = strncmp((char const *)(& str_id_reg), (char const *)vpd_data + (unsigned long )rodi, 4UL); if (tmp___3 == 0) { goto _L; } else { tmp___4 = strncmp((char const *)(& str_id_cap), (char const *)vpd_data + (unsigned long )rodi, 4UL); if (tmp___4 == 0) { _L: /* CIL Label */ rodi = pci_vpd_find_info_keyword((u8 const *)vpd_data, (unsigned int )i, (unsigned int )block_end, "V0"); if (rodi >= 0) { len = pci_vpd_info_field_size((u8 const *)vpd_data + (unsigned long )rodi); rodi = rodi + 3; if ((unsigned int )len <= 31U && (int )len + rodi <= 128) { __len___0 = (size_t )len; __ret___0 = __builtin_memcpy((void *)(& bp->fw_ver), (void const *)vpd_data + (unsigned long )rodi, __len___0); bp->fw_ver[(int )len] = 32; } else { } } else { } kfree((void const *)vpd_extended_data); return; } else { } } out_not_found: kfree((void const *)vpd_extended_data); return; } } static void bnx2x_set_modes_bitmap(struct bnx2x *bp ) { u32 flags ; { flags = 0U; if ((bp->common.chip_id & 61440U) > 20480U && (bp->common.chip_id & 4096U) != 0U) { flags = flags | 2U; } else if ((bp->common.chip_id & 61440U) > 20480U && (bp->common.chip_id & 4096U) == 0U) { flags = flags | 4U; } else { flags = flags | 1U; } if ((unsigned int )bp->common.chip_port_mode == 0U) { flags = flags | 64U; } else { flags = flags | 32U; } if ((bp->common.chip_id >> 16 == 5730U || bp->common.chip_id >> 16 == 5731U) || bp->common.chip_id >> 16 == 5743U) { flags = flags | 8U; } else if (((((((((bp->common.chip_id >> 16 == 5770U || bp->common.chip_id >> 16 == 5797U) || bp->common.chip_id >> 16 == 5801U) || bp->common.chip_id >> 16 == 5774U) || bp->common.chip_id >> 16 == 5806U) || bp->common.chip_id >> 16 == 5807U) || ((bp->common.chip_id >> 16 == 5693U || bp->common.chip_id >> 16 == 5694U) || bp->common.chip_id >> 16 == 5695U)) || ((bp->common.chip_id >> 16 == 5793U || bp->common.chip_id >> 16 == 5794U) || bp->common.chip_id >> 16 == 5773U)) || (bp->common.chip_id >> 16 == 5796U || bp->common.chip_id >> 16 == 5803U)) || bp->common.chip_id >> 16 == 5805U) { flags = flags | 16U; if ((bp->common.chip_id & 61440U) > 20480U ? ((~ bp->common.chip_id & 61440U) >> 13) << 12 == 0U : (bp->common.chip_id & 61440U) == 0U) { flags = flags | 4096U; } else { flags = flags | 24576U; } } else { } if ((unsigned int )bp->mf_mode != 0U) { flags = flags | 256U; switch ((int )bp->mf_mode) { case 1: flags = flags | 512U; goto ldv_58068; case 2: flags = flags | 1024U; goto ldv_58068; case 3: flags = flags | 2048U; goto ldv_58068; } ldv_58068: ; } else { flags = flags | 128U; } flags = flags | 65536U; bp->init_mode_flags = flags; return; } } static int bnx2x_init_bp(struct bnx2x *bp ) { int func ; int rc ; struct lock_class_key __key ; struct lock_class_key __key___0 ; struct lock_class_key __key___1 ; struct lock_class_key __key___2 ; atomic_long_t __constr_expr_0 ; struct lock_class_key __key___3 ; struct lock_class_key __key___4 ; atomic_long_t __constr_expr_1 ; struct lock_class_key __key___5 ; struct lock_class_key __key___6 ; atomic_long_t __constr_expr_2 ; struct lock_class_key __key___7 ; unsigned int tmp ; long tmp___0 ; bool tmp___1 ; struct lock_class_key __key___8 ; unsigned int tmp___2 ; unsigned int tmp___3 ; unsigned int tmp___4 ; unsigned int tmp___5 ; long tmp___6 ; long tmp___7 ; { __mutex_init(& bp->port.phy_mutex, "&bp->port.phy_mutex", & __key); __mutex_init(& bp->fw_mb_mutex, "&bp->fw_mb_mutex", & __key___0); spinlock_check(& bp->stats_lock); __raw_spin_lock_init(& bp->stats_lock.ldv_6014.rlock, "&(&bp->stats_lock)->rlock", & __key___1); __init_work(& bp->sp_task.work, 0); __constr_expr_0.counter = 137438953408L; bp->sp_task.work.data = __constr_expr_0; lockdep_init_map(& bp->sp_task.work.lockdep_map, "(&(&bp->sp_task)->work)", & __key___2, 0); INIT_LIST_HEAD(& bp->sp_task.work.entry); bp->sp_task.work.func = & bnx2x_sp_task; init_timer_key(& bp->sp_task.timer, 2U, "(&(&bp->sp_task)->timer)", & __key___3); bp->sp_task.timer.function = & delayed_work_timer_fn; bp->sp_task.timer.data = (unsigned long )(& bp->sp_task); __init_work(& bp->sp_rtnl_task.work, 0); __constr_expr_1.counter = 137438953408L; bp->sp_rtnl_task.work.data = __constr_expr_1; lockdep_init_map(& bp->sp_rtnl_task.work.lockdep_map, "(&(&bp->sp_rtnl_task)->work)", & __key___4, 0); INIT_LIST_HEAD(& bp->sp_rtnl_task.work.entry); bp->sp_rtnl_task.work.func = & bnx2x_sp_rtnl_task; init_timer_key(& bp->sp_rtnl_task.timer, 2U, "(&(&bp->sp_rtnl_task)->timer)", & __key___5); bp->sp_rtnl_task.timer.function = & delayed_work_timer_fn; bp->sp_rtnl_task.timer.data = (unsigned long )(& bp->sp_rtnl_task); __init_work(& bp->period_task.work, 0); __constr_expr_2.counter = 137438953408L; bp->period_task.work.data = __constr_expr_2; lockdep_init_map(& bp->period_task.work.lockdep_map, "(&(&bp->period_task)->work)", & __key___6, 0); INIT_LIST_HEAD(& bp->period_task.work.entry); bp->period_task.work.func = & bnx2x_period_task; init_timer_key(& bp->period_task.timer, 2U, "(&(&bp->period_task)->timer)", & __key___7); bp->period_task.timer.function = & delayed_work_timer_fn; bp->period_task.timer.data = (unsigned long )(& bp->period_task); if ((bp->flags & 4194304U) == 0U) { rc = bnx2x_get_hwinfo(bp); if (rc != 0) { return (rc); } else { } } else { eth_random_addr((bp->dev)->dev_addr); } bnx2x_set_modes_bitmap(bp); rc = bnx2x_alloc_mem_bp(bp); if (rc != 0) { return (rc); } else { } bnx2x_read_fwinfo(bp); func = (int )bp->pfid; if ((bp->flags & 4194304U) == 0U && (bp->flags & 512U) == 0U) { tmp = readl((void const volatile *)(bp->regview + (((unsigned long )bp->common.shmem_base + (unsigned long )(((int )bp->pfid & 1) + ((int )bp->pfid >> 1) * ((bp->common.chip_id >> 16 == 5710U || (bp->common.chip_id >> 16 == 5711U || bp->common.chip_id >> 16 == 5712U)) || (unsigned int )bp->common.chip_port_mode == 0U ? 2 : 1)) * 44UL) + 1668UL))); bp->fw_seq = (u16 )tmp; tmp___0 = ldv__builtin_expect((bp->msg_enable & 2) != 0, 0L); if (tmp___0 != 0L) { _dev_info((struct device const *)(& (bp->pdev)->dev), "fw_seq 0x%08x\n", (int )bp->fw_seq); } else { } bnx2x_prev_unload(bp); } else { } if ((bp->common.chip_id & 61440U) > 20480U && (bp->common.chip_id & 4096U) != 0U) { dev_err((struct device const *)(& (bp->pdev)->dev), "FPGA detected\n"); } else { } if ((bp->flags & 512U) != 0U && func == 0) { dev_err((struct device const *)(& (bp->pdev)->dev), "MCP disabled, must load devices in order!\n"); } else { } bp->disable_tpa = disable_tpa; bp->disable_tpa = bp->disable_tpa | (((unsigned int )bp->mf_mode == 1U && ((bp->mf_config[(int )bp->pfid >> 1] & 6U) == 6U || (bp->mf_config[(int )bp->pfid >> 1] & 6U) == 0U)) || ((unsigned int )bp->mf_mode == 3U && (bp->mf_ext_config & 8U) != 0U)); if (bp->disable_tpa != 0) { bp->flags = bp->flags & 4294966015U; (bp->dev)->features = (bp->dev)->features & 0xffffffffffff7fffULL; } else { bp->flags = bp->flags | 1280U; (bp->dev)->features = (bp->dev)->features | 32768ULL; } if (bp->common.chip_id >> 16 == 5710U) { bp->dropless_fc = 0; } else { tmp___1 = bnx2x_get_dropless_info(bp); bp->dropless_fc = ((int )tmp___1 | dropless_fc) != 0; } bp->mrrs = mrrs; bp->tx_ring_size = (unsigned int )bp->mf_mode == 3U && (bp->mf_ext_config & 8U) != 0U ? 0 : 4078; if ((bp->flags & 4194304U) != 0U) { bp->rx_ring_size = 4078; } else { } bp->tx_ticks = 48U; bp->rx_ticks = 24U; bp->current_interval = (bp->common.chip_id & 61440U) > 20480U ? 1250 : 250; init_timer_key(& bp->timer, 0U, "(&bp->timer)", & __key___8); bp->timer.expires = (unsigned long )bp->current_interval + (unsigned long )jiffies; bp->timer.data = (unsigned long )bp; bp->timer.function = & bnx2x_timer; if (bp->common.shmem2_base != 0U) { tmp___2 = readl((void const volatile *)bp->regview + (unsigned long )bp->common.shmem2_base); if (tmp___2 > 40U) { if (bp->common.shmem2_base != 0U) { tmp___3 = readl((void const volatile *)bp->regview + (unsigned long )bp->common.shmem2_base); if (tmp___3 > 100U) { tmp___4 = readl((void const volatile *)(bp->regview + ((unsigned long )bp->common.shmem2_base + 40UL))); if (tmp___4 != 0U) { tmp___5 = readl((void const volatile *)(bp->regview + ((unsigned long )bp->common.shmem2_base + 100UL))); if (tmp___5 != 0U) { bnx2x_dcbx_set_state(bp, 1, 2U); bnx2x_dcbx_init_params(bp); } else { bnx2x_dcbx_set_state(bp, 0, 0U); } } else { bnx2x_dcbx_set_state(bp, 0, 0U); } } else { bnx2x_dcbx_set_state(bp, 0, 0U); } } else { bnx2x_dcbx_set_state(bp, 0, 0U); } } else { bnx2x_dcbx_set_state(bp, 0, 0U); } } else { bnx2x_dcbx_set_state(bp, 0, 0U); } if (bp->common.chip_id >> 16 == 5710U || (bp->common.chip_id >> 16 == 5711U || bp->common.chip_id >> 16 == 5712U)) { bp->cnic_base_cl_id = 16U; } else { bp->cnic_base_cl_id = 136U; } if ((bp->flags & 4194304U) != 0U) { bp->max_cos = 1U; } else if (bp->common.chip_id >> 16 == 5710U || (bp->common.chip_id >> 16 == 5711U || bp->common.chip_id >> 16 == 5712U)) { bp->max_cos = 3U; } else if (((bp->common.chip_id >> 16 == 5730U || bp->common.chip_id >> 16 == 5731U) || bp->common.chip_id >> 16 == 5743U) || ((((((((((bp->common.chip_id >> 16 == 5770U || bp->common.chip_id >> 16 == 5797U) || bp->common.chip_id >> 16 == 5801U) || bp->common.chip_id >> 16 == 5774U) || bp->common.chip_id >> 16 == 5806U) || bp->common.chip_id >> 16 == 5807U) || ((bp->common.chip_id >> 16 == 5693U || bp->common.chip_id >> 16 == 5694U) || bp->common.chip_id >> 16 == 5695U)) || ((bp->common.chip_id >> 16 == 5793U || bp->common.chip_id >> 16 == 5794U) || bp->common.chip_id >> 16 == 5773U)) || (bp->common.chip_id >> 16 == 5796U || bp->common.chip_id >> 16 == 5803U)) || bp->common.chip_id >> 16 == 5805U) && ((bp->common.chip_id & 61440U) > 20480U ? ((~ bp->common.chip_id & 61440U) >> 13) << 12 == 0U : (bp->common.chip_id & 61440U) == 0U))) { bp->max_cos = 2U; } else if ((((((((((bp->common.chip_id >> 16 == 5770U || bp->common.chip_id >> 16 == 5797U) || bp->common.chip_id >> 16 == 5801U) || bp->common.chip_id >> 16 == 5774U) || bp->common.chip_id >> 16 == 5806U) || bp->common.chip_id >> 16 == 5807U) || ((bp->common.chip_id >> 16 == 5693U || bp->common.chip_id >> 16 == 5694U) || bp->common.chip_id >> 16 == 5695U)) || ((bp->common.chip_id >> 16 == 5793U || bp->common.chip_id >> 16 == 5794U) || bp->common.chip_id >> 16 == 5773U)) || (bp->common.chip_id >> 16 == 5796U || bp->common.chip_id >> 16 == 5803U)) || bp->common.chip_id >> 16 == 5805U) && ((bp->common.chip_id & 61440U) > 20480U ? ((~ bp->common.chip_id & 61440U) >> 13) << 12 == 4096U : (bp->common.chip_id & 61440U) == 4096U)) { bp->max_cos = 3U; } else { printk("\vbnx2x: [%s:%d(%s)]unknown chip %x revision %x\n", "bnx2x_init_bp", 11559, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", bp->common.chip_id >> 16, (bp->common.chip_id & 61440U) > 20480U ? ((~ bp->common.chip_id & 61440U) >> 13) << 12 : bp->common.chip_id & 61440U); } tmp___6 = ldv__builtin_expect((bp->msg_enable & 2) != 0, 0L); if (tmp___6 != 0L) { _dev_info((struct device const *)(& (bp->pdev)->dev), "set bp->max_cos to %d\n", (int )bp->max_cos); } else { } if ((unsigned int )bp->cnic_support != 0U) { bp->min_msix_vec_cnt = 3U; } else { bp->min_msix_vec_cnt = 2U; } tmp___7 = ldv__builtin_expect((bp->msg_enable & 2) != 0, 0L); if (tmp___7 != 0L) { _dev_info((struct device const *)(& (bp->pdev)->dev), "bp->min_msix_vec_cnt %d", (int )bp->min_msix_vec_cnt); } else { } return (rc); } } static int bnx2x_open(struct net_device *dev ) { struct bnx2x *bp ; void *tmp ; bool global ; int other_engine ; bool other_load_status ; bool load_status ; int rc ; bool tmp___0 ; int tmp___1 ; bool tmp___2 ; int tmp___3 ; bool tmp___4 ; int tmp___5 ; { tmp = netdev_priv((struct net_device const *)dev); bp = (struct bnx2x *)tmp; global = 0; other_engine = (bp->common.chip_id >> 16 != 5710U && (bp->common.chip_id >> 16 != 5711U && bp->common.chip_id >> 16 != 5712U) ? (int )bp->pf_num & 1 : 0) ? 0 : 1; bp->stats_init = 1; netif_carrier_off(dev); bnx2x_set_power_state(bp, 0); if ((bp->flags & 4194304U) == 0U) { other_load_status = bnx2x_get_load_status(bp, other_engine); load_status = bnx2x_get_load_status(bp, bp->common.chip_id >> 16 != 5710U && (bp->common.chip_id >> 16 != 5711U && bp->common.chip_id >> 16 != 5712U) ? (int )bp->pf_num & 1 : 0); tmp___2 = bnx2x_reset_is_done(bp, bp->common.chip_id >> 16 != 5710U && (bp->common.chip_id >> 16 != 5711U && bp->common.chip_id >> 16 != 5712U) ? (int )bp->pf_num & 1 : 0); if (tmp___2) { tmp___3 = 0; } else { tmp___3 = 1; } if (tmp___3) { goto _L; } else { tmp___4 = bnx2x_chk_parity_attn(bp, & global, 1); if ((int )tmp___4) { _L: /* CIL Label */ if ((int )global) { bnx2x_set_reset_global(bp); } else { } if (! load_status && (! global || ! other_load_status)) { tmp___0 = bnx2x_trylock_leader_lock(bp); if ((int )tmp___0) { tmp___1 = bnx2x_leader_reset(bp); if (tmp___1 == 0) { netdev_info((struct net_device const *)bp->dev, "Recovered in open\n"); goto ldv_58099; } else { } } else { } } else { } bnx2x_set_power_state(bp, 3); bp->recovery_state = 3; printk("\vbnx2x: [%s:%d(%s)]Recovery flow hasn\'t been properly completed yet. Try again later.\nIf you still see this message after a few retries then power cycle is required.\n", "bnx2x_open", 11638, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); return (-11); ldv_58099: ; } else { } } } else { } bp->recovery_state = 0; rc = bnx2x_nic_load(bp, 1); if (rc != 0) { return (rc); } else { } tmp___5 = bnx2x_open_epilog(bp); return (tmp___5); } } static int bnx2x_close(struct net_device *dev ) { struct bnx2x *bp ; void *tmp ; { tmp = netdev_priv((struct net_device const *)dev); bp = (struct bnx2x *)tmp; bnx2x_nic_unload(bp, 1, 0); bnx2x_set_power_state(bp, 3); return (0); } } static int bnx2x_init_mcast_macs_list(struct bnx2x *bp , struct bnx2x_mcast_ramrod_params *p ) { int mc_count ; struct bnx2x_mcast_list_elem *mc_mac ; void *tmp ; struct netdev_hw_addr *ha ; struct list_head const *__mptr ; struct list_head const *__mptr___0 ; { mc_count = (bp->dev)->mc.count; tmp = kzalloc((unsigned long )mc_count * 24UL, 32U); mc_mac = (struct bnx2x_mcast_list_elem *)tmp; if ((unsigned long )mc_mac == (unsigned long )((struct bnx2x_mcast_list_elem *)0)) { return (-12); } else { } INIT_LIST_HEAD(& p->mcast_list); __mptr = (struct list_head const *)(bp->dev)->mc.list.next; ha = (struct netdev_hw_addr *)__mptr; goto ldv_58117; ldv_58116: mc_mac->mac = (u8 *)(& ha->addr); list_add_tail(& mc_mac->link, & p->mcast_list); mc_mac = mc_mac + 1; __mptr___0 = (struct list_head const *)ha->list.next; ha = (struct netdev_hw_addr *)__mptr___0; ldv_58117: ; if ((unsigned long )(& ha->list) != (unsigned long )(& (bp->dev)->mc.list)) { goto ldv_58116; } else { } p->mcast_list_len = mc_count; return (0); } } static void bnx2x_free_mcast_macs_list(struct bnx2x_mcast_ramrod_params *p ) { struct bnx2x_mcast_list_elem *mc_mac ; struct list_head const *__mptr ; int __ret_warn_on ; long tmp ; { __mptr = (struct list_head const *)p->mcast_list.next; mc_mac = (struct bnx2x_mcast_list_elem *)__mptr; __ret_warn_on = (unsigned long )mc_mac == (unsigned long )((struct bnx2x_mcast_list_elem *)0); tmp = ldv__builtin_expect(__ret_warn_on != 0, 0L); if (tmp != 0L) { warn_slowpath_null("/work/ldvuser/exper_fp/work/current--X--drivers--X--defaultlinux-3.10-rc1.tar--X--32_7a--X--cpachecker/linux-3.10-rc1.tar/csd_deg_dscv/8504/dscv_tempdir/dscv/ri/32_7a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c.prepared", 11697); } else { } ldv__builtin_expect(__ret_warn_on != 0, 0L); kfree((void const *)mc_mac); return; } } static int bnx2x_set_uc_list(struct bnx2x *bp ) { int rc ; struct net_device *dev ; struct netdev_hw_addr *ha ; struct bnx2x_vlan_mac_obj *mac_obj ; unsigned long ramrod_flags ; struct list_head const *__mptr ; long tmp ; struct list_head const *__mptr___0 ; int tmp___0 ; { dev = bp->dev; mac_obj = & (bp->sp_objs)->mac_obj; ramrod_flags = 0UL; rc = bnx2x_del_all_macs(bp, mac_obj, 0, 0); if (rc < 0) { printk("\vbnx2x: [%s:%d(%s)]Failed to schedule DELETE operations: %d\n", "bnx2x_set_uc_list", 11719, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", rc); return (rc); } else { } __mptr = (struct list_head const *)dev->uc.list.next; ha = (struct netdev_hw_addr *)__mptr; goto ldv_58141; ldv_58140: rc = bnx2x_set_mac_one(bp, (u8 *)(& ha->addr), mac_obj, 1, 0, & ramrod_flags); if (rc == -17) { tmp = ldv__builtin_expect((bp->msg_enable & 1048576) != 0, 0L); if (tmp != 0L) { printk("\rbnx2x: [%s:%d(%s)]Failed to schedule ADD operations: %d\n", "bnx2x_set_uc_list", 11728, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", rc); } else { } rc = 0; } else if (rc < 0) { printk("\vbnx2x: [%s:%d(%s)]Failed to schedule ADD operations: %d\n", "bnx2x_set_uc_list", 11735, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", rc); return (rc); } else { } __mptr___0 = (struct list_head const *)ha->list.next; ha = (struct netdev_hw_addr *)__mptr___0; ldv_58141: ; if ((unsigned long )(& ha->list) != (unsigned long )(& dev->uc.list)) { goto ldv_58140; } else { } __set_bit(6, (unsigned long volatile *)(& ramrod_flags)); tmp___0 = bnx2x_set_mac_one(bp, 0, mac_obj, 0, 0, & ramrod_flags); return (tmp___0); } } static int bnx2x_set_mc_list(struct bnx2x *bp ) { struct net_device *dev ; struct bnx2x_mcast_ramrod_params rparam ; int rc ; { dev = bp->dev; rparam.mcast_obj = 0; rparam.ramrod_flags = 0UL; rparam.mcast_list.next = 0; rparam.mcast_list.prev = 0; rparam.mcast_list_len = 0; rc = 0; rparam.mcast_obj = & bp->mcast_obj; rc = bnx2x_config_mcast(bp, & rparam, 2); if (rc < 0) { printk("\vbnx2x: [%s:%d(%s)]Failed to clear multicast configuration: %d\n", "bnx2x_set_mc_list", 11757, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", rc); return (rc); } else { } if (dev->mc.count != 0) { rc = bnx2x_init_mcast_macs_list(bp, & rparam); if (rc != 0) { printk("\vbnx2x: [%s:%d(%s)]Failed to create multicast MACs list: %d\n", "bnx2x_set_mc_list", 11766, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", rc); return (rc); } else { } rc = bnx2x_config_mcast(bp, & rparam, 0); if (rc < 0) { printk("\vbnx2x: [%s:%d(%s)]Failed to set a new multicast configuration: %d\n", "bnx2x_set_mc_list", 11775, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", rc); } else { } bnx2x_free_mcast_macs_list(& rparam); } else { } return (rc); } } void bnx2x_set_rx_mode(struct net_device *dev ) { struct bnx2x *bp ; void *tmp ; u32 rx_mode ; long tmp___0 ; long tmp___1 ; int tmp___2 ; int tmp___3 ; int tmp___4 ; { tmp = netdev_priv((struct net_device const *)dev); bp = (struct bnx2x *)tmp; rx_mode = 1U; if ((unsigned int )bp->state != 12288U) { tmp___0 = ldv__builtin_expect((bp->msg_enable & 32) != 0, 0L); if (tmp___0 != 0L) { printk("\rbnx2x: [%s:%d(%s)]state is %x, returning\n", "bnx2x_set_rx_mode", 11790, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )bp->state); } else { } return; } else { } tmp___1 = ldv__builtin_expect((bp->msg_enable & 32) != 0, 0L); if (tmp___1 != 0L) { printk("\rbnx2x: [%s:%d(%s)]dev->flags = %x\n", "bnx2x_set_rx_mode", 11794, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (bp->dev)->flags); } else { } if ((dev->flags & 256U) != 0U) { rx_mode = 3U; } else if ((dev->flags & 512U) != 0U || (dev->mc.count > 64 && bp->common.chip_id >> 16 == 5710U)) { rx_mode = 2U; } else if ((bp->flags & 4194304U) == 0U) { tmp___2 = bnx2x_set_mc_list(bp); if (tmp___2 < 0) { rx_mode = 2U; } else { } tmp___3 = bnx2x_set_uc_list(bp); if (tmp___3 < 0) { rx_mode = 3U; } else { } } else { __asm__ volatile ("": : : "memory"); set_bit(5U, (unsigned long volatile *)(& bp->sp_rtnl_state)); __asm__ volatile ("": : : "memory"); schedule_delayed_work(& bp->sp_rtnl_task, 0UL); } bp->rx_mode = rx_mode; if ((unsigned int )bp->mf_mode == 1U && (bp->mf_config[(int )bp->pfid >> 1] & 6U) == 6U) { bp->rx_mode = 0U; } else { } tmp___4 = constant_test_bit(3U, (unsigned long const volatile *)(& bp->sp_state)); if (tmp___4 != 0) { set_bit(4U, (unsigned long volatile *)(& bp->sp_state)); return; } else { } if ((bp->flags & 4194304U) == 0U) { bnx2x_set_storm_rx_mode(bp); } else { __asm__ volatile ("": : : "memory"); set_bit(6U, (unsigned long volatile *)(& bp->sp_rtnl_state)); __asm__ volatile ("": : : "memory"); schedule_delayed_work(& bp->sp_rtnl_task, 0UL); } return; } } static int bnx2x_mdio_read(struct net_device *netdev , int prtad , int devad , u16 addr ) { struct bnx2x *bp ; void *tmp ; u16 value ; int rc ; long tmp___0 ; long tmp___1 ; { tmp = netdev_priv((struct net_device const *)netdev); bp = (struct bnx2x *)tmp; tmp___0 = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp___0 != 0L) { printk("\rbnx2x: [%s:%d(%s)]mdio_read: prtad 0x%x, devad 0x%x, addr 0x%x\n", "bnx2x_mdio_read", 11860, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", prtad, devad, (int )addr); } else { } devad = devad != -1 ? devad : 3; bnx2x_acquire_phy_lock(bp); rc = bnx2x_phy_read(& bp->link_params, (int )((u8 )prtad), (int )((u8 )devad), (int )addr, & value); bnx2x_release_phy_lock(bp); tmp___1 = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp___1 != 0L) { printk("\rbnx2x: [%s:%d(%s)]mdio_read_val 0x%x rc = 0x%x\n", "bnx2x_mdio_read", 11868, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )value, rc); } else { } if (rc == 0) { rc = (int )value; } else { } return (rc); } } static int bnx2x_mdio_write(struct net_device *netdev , int prtad , int devad , u16 addr , u16 value ) { struct bnx2x *bp ; void *tmp ; int rc ; long tmp___0 ; { tmp = netdev_priv((struct net_device const *)netdev); bp = (struct bnx2x *)tmp; tmp___0 = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp___0 != 0L) { printk("\rbnx2x: [%s:%d(%s)]mdio_write: prtad 0x%x, devad 0x%x, addr 0x%x, value 0x%x\n", "bnx2x_mdio_write", 11884, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", prtad, devad, (int )addr, (int )value); } else { } devad = devad != -1 ? devad : 3; bnx2x_acquire_phy_lock(bp); rc = bnx2x_phy_write(& bp->link_params, (int )((u8 )prtad), (int )((u8 )devad), (int )addr, (int )value); bnx2x_release_phy_lock(bp); return (rc); } } static int bnx2x_ioctl(struct net_device *dev , struct ifreq *ifr , int cmd ) { struct bnx2x *bp ; void *tmp ; struct mii_ioctl_data *mdio ; struct mii_ioctl_data *tmp___0 ; long tmp___1 ; bool tmp___2 ; int tmp___3 ; int tmp___4 ; { tmp = netdev_priv((struct net_device const *)dev); bp = (struct bnx2x *)tmp; tmp___0 = if_mii(ifr); mdio = tmp___0; tmp___1 = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp___1 != 0L) { printk("\rbnx2x: [%s:%d(%s)]ioctl: phy id 0x%x, reg 0x%x, val_in 0x%x\n", "bnx2x_ioctl", 11902, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )mdio->phy_id, (int )mdio->reg_num, (int )mdio->val_in); } else { } tmp___2 = netif_running((struct net_device const *)dev); if (tmp___2) { tmp___3 = 0; } else { tmp___3 = 1; } if (tmp___3) { return (-11); } else { } tmp___4 = mdio_mii_ioctl((struct mdio_if_info const *)(& bp->mdio), mdio, cmd); return (tmp___4); } } static void poll_bnx2x(struct net_device *dev ) { struct bnx2x *bp ; void *tmp ; int i ; struct bnx2x_fastpath *fp ; { tmp = netdev_priv((struct net_device const *)dev); bp = (struct bnx2x *)tmp; i = 0; goto ldv_58191; ldv_58190: fp = bp->fp + (unsigned long )i; napi_schedule(& (bp->fp + (unsigned long )fp->index)->napi); i = i + 1; ldv_58191: ; if ((uint )i < bp->num_ethernet_queues) { goto ldv_58190; } else { } return; } } static int bnx2x_validate_addr(struct net_device *dev ) { struct bnx2x *bp ; void *tmp ; bool tmp___0 ; int tmp___1 ; { tmp = netdev_priv((struct net_device const *)dev); bp = (struct bnx2x *)tmp; tmp___0 = bnx2x_is_valid_ether_addr(bp, dev->dev_addr); if (tmp___0) { tmp___1 = 0; } else { tmp___1 = 1; } if (tmp___1) { printk("\vbnx2x: [%s:%d(%s)]Non-valid Ethernet address\n", "bnx2x_validate_addr", 11928, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); return (-99); } else { } return (0); } } static struct net_device_ops const bnx2x_netdev_ops = {0, 0, & bnx2x_open, & bnx2x_close, & bnx2x_start_xmit, & bnx2x_select_queue, 0, & bnx2x_set_rx_mode, & bnx2x_change_mac_addr, & bnx2x_validate_addr, & bnx2x_ioctl, 0, & bnx2x_change_mtu, 0, & bnx2x_tx_timeout, 0, 0, 0, 0, & poll_bnx2x, 0, 0, & bnx2x_set_vf_mac, & bnx2x_set_vf_vlan, 0, 0, & bnx2x_get_vf_config, 0, 0, & bnx2x_setup_tc, 0, 0, 0, 0, 0, 0, & bnx2x_fcoe_get_wwn, 0, 0, 0, & bnx2x_fix_features, & bnx2x_set_features, 0, 0, 0, 0, 0, 0, 0, 0, 0}; static int bnx2x_set_coherency_mask(struct bnx2x *bp ) { struct device *dev ; int tmp ; int tmp___0 ; int tmp___1 ; { dev = & (bp->pdev)->dev; tmp___1 = dma_set_mask(dev, 0xffffffffffffffffULL); if (tmp___1 == 0) { bp->flags = bp->flags | 16U; tmp = dma_set_coherent_mask(dev, 0xffffffffffffffffULL); if (tmp != 0) { dev_err((struct device const *)dev, "dma_set_coherent_mask failed, aborting\n"); return (-5); } else { } } else { tmp___0 = dma_set_mask(dev, 4294967295ULL); if (tmp___0 != 0) { dev_err((struct device const *)dev, "System does not support DMA, aborting\n"); return (-5); } else { } } return (0); } } static int bnx2x_init_dev(struct bnx2x *bp , struct pci_dev *pdev , struct net_device *dev , unsigned long board_type ) { int rc ; u32 pci_cfg_dword ; bool chip_is_e1x ; int tmp ; bool tmp___0 ; int tmp___1 ; long tmp___2 ; int tmp___3 ; { chip_is_e1x = (bool )((board_type == 0UL || board_type == 1UL) || board_type == 2UL); dev->dev.parent = & pdev->dev; bp->dev = dev; bp->pdev = pdev; rc = pci_enable_device(pdev); if (rc != 0) { dev_err((struct device const *)(& (bp->pdev)->dev), "Cannot enable PCI device, aborting\n"); goto err_out; } else { } if ((pdev->resource[0].flags & 512UL) == 0UL) { dev_err((struct device const *)(& (bp->pdev)->dev), "Cannot find PCI device base address, aborting\n"); rc = -19; goto err_out_disable; } else { } if ((bp->flags & 4194304U) == 0U && (pdev->resource[2].flags & 512UL) == 0UL) { dev_err((struct device const *)(& (bp->pdev)->dev), "Cannot find second PCI device base address, aborting\n"); rc = -19; goto err_out_disable; } else { } pci_read_config_dword((struct pci_dev const *)pdev, 8, & pci_cfg_dword); if ((pci_cfg_dword & 255U) == 255U) { printk("\vbnx2x: PCI device error, probably due to fan failure, aborting\n"); rc = -19; goto err_out_disable; } else { } tmp = atomic_read((atomic_t const *)(& pdev->enable_cnt)); if (tmp == 1) { rc = pci_request_regions(pdev, "bnx2x"); if (rc != 0) { dev_err((struct device const *)(& (bp->pdev)->dev), "Cannot obtain PCI resources, aborting\n"); goto err_out_disable; } else { } pci_set_master(pdev); pci_save_state(pdev); } else { } if ((bp->flags & 4194304U) == 0U) { bp->pm_cap = pci_find_capability(pdev, 1); if (bp->pm_cap == 0) { dev_err((struct device const *)(& (bp->pdev)->dev), "Cannot find power management capability, aborting\n"); rc = -5; goto err_out_release; } else { } } else { } tmp___0 = pci_is_pcie(pdev); if (tmp___0) { tmp___1 = 0; } else { tmp___1 = 1; } if (tmp___1) { dev_err((struct device const *)(& (bp->pdev)->dev), "Not PCI Express, aborting\n"); rc = -5; goto err_out_release; } else { } rc = bnx2x_set_coherency_mask(bp); if (rc != 0) { goto err_out_release; } else { } dev->mem_start = (unsigned long )pdev->resource[0].start; dev->base_addr = dev->mem_start; dev->mem_end = (unsigned long )pdev->resource[0].end; dev->irq = pdev->irq; bp->regview = pci_ioremap_bar(pdev, 0); if ((unsigned long )bp->regview == (unsigned long )((void *)0)) { dev_err((struct device const *)(& (bp->pdev)->dev), "Cannot map register space, aborting\n"); rc = -12; goto err_out_release; } else { } if ((int )chip_is_e1x) { bp->pf_num = (unsigned int )((u8 )pdev->devfn) & 7U; } else { pci_read_config_dword((struct pci_dev const *)bp->pdev, 152, & pci_cfg_dword); bp->pf_num = (unsigned char )(((long )pci_cfg_dword & 458752L) >> 16); } tmp___2 = ldv__builtin_expect((bp->msg_enable & 2) != 0, 0L); if (tmp___2 != 0L) { _dev_info((struct device const *)(& (bp->pdev)->dev), "me reg PF num: %d\n", (int )bp->pf_num); } else { } bnx2x_set_power_state(bp, 0); pci_write_config_dword((struct pci_dev const *)bp->pdev, 120, 0U); if ((bp->flags & 4194304U) == 0U) { writel(0U, (void volatile *)bp->regview + 1180980U); writel(0U, (void volatile *)bp->regview + 1180984U); writel(0U, (void volatile *)bp->regview + 1180988U); writel(0U, (void volatile *)bp->regview + 1180992U); if ((int )chip_is_e1x) { writel(0U, (void volatile *)bp->regview + 1180996U); writel(0U, (void volatile *)bp->regview + 1181000U); writel(0U, (void volatile *)bp->regview + 1181004U); writel(0U, (void volatile *)bp->regview + 1181008U); } else { } if (! chip_is_e1x) { writel(1U, (void volatile *)bp->regview + 37936U); } else { } } else { } dev->watchdog_timeo = 1250; dev->netdev_ops = & bnx2x_netdev_ops; bnx2x_set_ethtool_ops(bp, dev); dev->priv_flags = dev->priv_flags | 131072U; dev->hw_features = 806994067ULL; if (bp->common.chip_id >> 16 != 5710U && (bp->common.chip_id >> 16 != 5711U && bp->common.chip_id >> 16 != 5712U)) { dev->hw_features = dev->hw_features | 12582912ULL; dev->hw_enc_features = 14221331ULL; } else { } dev->vlan_features = 1638451ULL; dev->features = (dev->features | dev->hw_features) | 256ULL; if ((bp->flags & 16U) != 0U) { dev->features = dev->features | 32ULL; } else { } dev->hw_features = dev->hw_features | 2147483648ULL; dev->dcbnl_ops = & bnx2x_dcbnl_ops; bp->mdio.prtad = -1; bp->mdio.mmds = 0U; bp->mdio.mode_support = 6U; bp->mdio.dev = dev; bp->mdio.mdio_read = & bnx2x_mdio_read; bp->mdio.mdio_write = & bnx2x_mdio_write; return (0); err_out_release: tmp___3 = atomic_read((atomic_t const *)(& pdev->enable_cnt)); if (tmp___3 == 1) { pci_release_regions(pdev); } else { } err_out_disable: pci_disable_device(pdev); pci_set_drvdata(pdev, 0); err_out: ; return (rc); } } static void bnx2x_get_pcie_width_speed(struct bnx2x *bp , int *width , int *speed ) { u32 val ; { val = 0U; pci_read_config_dword((struct pci_dev const *)bp->pdev, 188, & val); *width = (int )((val & 32505856U) >> 20); *speed = (int )((val & 983040U) >> 16); return; } } static int bnx2x_check_firmware(struct bnx2x *bp ) { struct firmware const *firmware ; struct bnx2x_fw_file_hdr *fw_hdr ; struct bnx2x_fw_file_section *sections ; u32 offset ; u32 len ; u32 num_ops ; __be16 *ops_offsets ; int i ; u8 const *fw_ver ; __u32 tmp ; __u32 tmp___0 ; __u32 tmp___1 ; __u32 tmp___2 ; __u16 tmp___3 ; __u32 tmp___4 ; __u32 tmp___5 ; { firmware = bp->firmware; if ((unsigned long )firmware->size <= 103UL) { printk("\vbnx2x: [%s:%d(%s)]Wrong FW size\n", "bnx2x_check_firmware", 12191, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); return (-22); } else { } fw_hdr = (struct bnx2x_fw_file_hdr *)firmware->data; sections = (struct bnx2x_fw_file_section *)fw_hdr; i = 0; goto ldv_58235; ldv_58234: tmp = __fswab32((sections + (unsigned long )i)->offset); offset = tmp; tmp___0 = __fswab32((sections + (unsigned long )i)->len); len = tmp___0; if ((unsigned long )(offset + len) > (unsigned long )firmware->size) { printk("\vbnx2x: [%s:%d(%s)]Section %d length is out of bounds\n", "bnx2x_check_firmware", 12204, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", i); return (-22); } else { } i = i + 1; ldv_58235: ; if ((unsigned int )i <= 12U) { goto ldv_58234; } else { } tmp___1 = __fswab32(fw_hdr->init_ops_offsets.offset); offset = tmp___1; ops_offsets = (__be16 *)firmware->data + (unsigned long )offset; tmp___2 = __fswab32(fw_hdr->init_ops.len); num_ops = tmp___2 / 8U; i = 0; goto ldv_58238; ldv_58237: tmp___3 = __fswab16((int )*(ops_offsets + (unsigned long )i)); if ((u32 )tmp___3 > num_ops) { printk("\vbnx2x: [%s:%d(%s)]Section offset %d is out of bounds\n", "bnx2x_check_firmware", 12216, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", i); return (-22); } else { } i = i + 1; ldv_58238: tmp___4 = __fswab32(fw_hdr->init_ops_offsets.len); if ((unsigned int )i < tmp___4 / 2U) { goto ldv_58237; } else { } tmp___5 = __fswab32(fw_hdr->fw_version.offset); offset = tmp___5; fw_ver = firmware->data + (unsigned long )offset; if ((((unsigned int )((unsigned char )*fw_ver) != 7U || (unsigned int )((unsigned char )*(fw_ver + 1UL)) != 8U) || (unsigned int )((unsigned char )*(fw_ver + 2UL)) != 17U) || (unsigned int )((unsigned char )*(fw_ver + 3UL)) != 0U) { printk("\vbnx2x: [%s:%d(%s)]Bad FW version:%d.%d.%d.%d. Should be %d.%d.%d.%d\n", "bnx2x_check_firmware", 12233, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )*fw_ver, (int )*(fw_ver + 1UL), (int )*(fw_ver + 2UL), (int )*(fw_ver + 3UL), 7, 8, 17, 0); return (-22); } else { } return (0); } } static void be32_to_cpu_n(u8 const *_source , u8 *_target , u32 n ) { __be32 const *source ; u32 *target ; u32 i ; __u32 tmp ; { source = (__be32 const *)_source; target = (u32 *)_target; i = 0U; goto ldv_58249; ldv_58248: tmp = __fswab32(*(source + (unsigned long )i)); *(target + (unsigned long )i) = tmp; i = i + 1U; ldv_58249: ; if (n / 4U > i) { goto ldv_58248; } else { } return; } } static void bnx2x_prep_ops(u8 const *_source , u8 *_target , u32 n ) { __be32 const *source ; struct raw_op *target ; u32 i ; u32 j ; u32 tmp ; __u32 tmp___0 ; __u32 tmp___1 ; { source = (__be32 const *)_source; target = (struct raw_op *)_target; i = 0U; j = 0U; goto ldv_58262; ldv_58261: tmp___0 = __fswab32(*(source + (unsigned long )j)); tmp = tmp___0; (target + (unsigned long )i)->op = (unsigned char )(tmp >> 24); (target + (unsigned long )i)->offset = tmp & 16777215U; tmp___1 = __fswab32(*(source + (unsigned long )(j + 1U))); (target + (unsigned long )i)->raw_data = tmp___1; i = i + 1U; j = j + 2U; ldv_58262: ; if (n / 8U > i) { goto ldv_58261; } else { } return; } } static void bnx2x_prep_iro(u8 const *_source , u8 *_target , u32 n ) { __be32 const *source ; struct iro *target ; u32 i ; u32 j ; u32 tmp ; __u32 tmp___0 ; __u32 tmp___1 ; __u32 tmp___2 ; { source = (__be32 const *)_source; target = (struct iro *)_target; i = 0U; j = 0U; goto ldv_58275; ldv_58274: tmp___0 = __fswab32(*(source + (unsigned long )j)); (target + (unsigned long )i)->base = tmp___0; j = j + 1U; tmp___1 = __fswab32(*(source + (unsigned long )j)); tmp = tmp___1; (target + (unsigned long )i)->m1 = (u16 )(tmp >> 16); (target + (unsigned long )i)->m2 = (u16 )tmp; j = j + 1U; tmp___2 = __fswab32(*(source + (unsigned long )j)); tmp = tmp___2; (target + (unsigned long )i)->m3 = (u16 )(tmp >> 16); (target + (unsigned long )i)->size = (u16 )tmp; j = j + 1U; i = i + 1U; ldv_58275: ; if (n / 12U > i) { goto ldv_58274; } else { } return; } } static void be16_to_cpu_n(u8 const *_source , u8 *_target , u32 n ) { __be16 const *source ; u16 *target ; u32 i ; __u16 tmp ; { source = (__be16 const *)_source; target = (u16 *)_target; i = 0U; goto ldv_58286; ldv_58285: tmp = __fswab16((int )*(source + (unsigned long )i)); *(target + (unsigned long )i) = tmp; i = i + 1U; ldv_58286: ; if (n / 2U > i) { goto ldv_58285; } else { } return; } } static int bnx2x_init_firmware(struct bnx2x *bp ) { char const *fw_file_name ; struct bnx2x_fw_file_hdr *fw_hdr ; int rc ; long tmp ; u32 len ; __u32 tmp___0 ; void *tmp___1 ; __u32 tmp___2 ; u32 len___0 ; __u32 tmp___3 ; void *tmp___4 ; __u32 tmp___5 ; u32 len___1 ; __u32 tmp___6 ; void *tmp___7 ; __u32 tmp___8 ; __u32 tmp___9 ; __u32 tmp___10 ; __u32 tmp___11 ; __u32 tmp___12 ; __u32 tmp___13 ; __u32 tmp___14 ; __u32 tmp___15 ; __u32 tmp___16 ; u32 len___2 ; __u32 tmp___17 ; void *tmp___18 ; __u32 tmp___19 ; { if ((unsigned long )bp->firmware != (unsigned long )((struct firmware const *)0)) { return (0); } else { } if (bp->common.chip_id >> 16 == 5710U) { fw_file_name = "bnx2x/bnx2x-e1-7.8.17.0.fw"; } else if (bp->common.chip_id >> 16 == 5711U || bp->common.chip_id >> 16 == 5712U) { fw_file_name = "bnx2x/bnx2x-e1h-7.8.17.0.fw"; } else if (bp->common.chip_id >> 16 != 5710U && (bp->common.chip_id >> 16 != 5711U && bp->common.chip_id >> 16 != 5712U)) { fw_file_name = "bnx2x/bnx2x-e2-7.8.17.0.fw"; } else { printk("\vbnx2x: [%s:%d(%s)]Unsupported chip revision\n", "bnx2x_init_firmware", 12327, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); return (-22); } tmp = ldv__builtin_expect((bp->msg_enable & 2) != 0, 0L); if (tmp != 0L) { _dev_info((struct device const *)(& (bp->pdev)->dev), "Loading %s\n", fw_file_name); } else { } rc = request_firmware(& bp->firmware, fw_file_name, & (bp->pdev)->dev); if (rc != 0) { printk("\vbnx2x: [%s:%d(%s)]Can\'t load firmware file %s\n", "bnx2x_init_firmware", 12335, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", fw_file_name); goto request_firmware_exit; } else { } rc = bnx2x_check_firmware(bp); if (rc != 0) { printk("\vbnx2x: [%s:%d(%s)]Corrupt firmware file %s\n", "bnx2x_init_firmware", 12341, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", fw_file_name); goto request_firmware_exit; } else { } fw_hdr = (struct bnx2x_fw_file_hdr *)(bp->firmware)->data; tmp___0 = __fswab32(fw_hdr->init_data.len); len = tmp___0; tmp___1 = kmalloc((size_t )len, 208U); bp->init_data = (u32 *)tmp___1; if ((unsigned long )bp->init_data == (unsigned long )((u32 *)0)) { goto request_firmware_exit; } else { } tmp___2 = __fswab32(fw_hdr->init_data.offset); be32_to_cpu_n((bp->firmware)->data + (unsigned long )tmp___2, (u8 *)bp->init_data, len); tmp___3 = __fswab32(fw_hdr->init_ops.len); len___0 = tmp___3; tmp___4 = kmalloc((size_t )len___0, 208U); bp->init_ops = (struct raw_op *)tmp___4; if ((unsigned long )bp->init_ops == (unsigned long )((struct raw_op *)0)) { goto init_ops_alloc_err; } else { } tmp___5 = __fswab32(fw_hdr->init_ops.offset); bnx2x_prep_ops((bp->firmware)->data + (unsigned long )tmp___5, (u8 *)bp->init_ops, len___0); tmp___6 = __fswab32(fw_hdr->init_ops_offsets.len); len___1 = tmp___6; tmp___7 = kmalloc((size_t )len___1, 208U); bp->init_ops_offsets = (u16 *)tmp___7; if ((unsigned long )bp->init_ops_offsets == (unsigned long )((u16 *)0)) { goto init_offsets_alloc_err; } else { } tmp___8 = __fswab32(fw_hdr->init_ops_offsets.offset); be16_to_cpu_n((bp->firmware)->data + (unsigned long )tmp___8, (u8 *)bp->init_ops_offsets, len___1); tmp___9 = __fswab32(fw_hdr->tsem_int_table_data.offset); bp->tsem_int_table_data = (bp->firmware)->data + (unsigned long )tmp___9; tmp___10 = __fswab32(fw_hdr->tsem_pram_data.offset); bp->tsem_pram_data = (bp->firmware)->data + (unsigned long )tmp___10; tmp___11 = __fswab32(fw_hdr->usem_int_table_data.offset); bp->usem_int_table_data = (bp->firmware)->data + (unsigned long )tmp___11; tmp___12 = __fswab32(fw_hdr->usem_pram_data.offset); bp->usem_pram_data = (bp->firmware)->data + (unsigned long )tmp___12; tmp___13 = __fswab32(fw_hdr->xsem_int_table_data.offset); bp->xsem_int_table_data = (bp->firmware)->data + (unsigned long )tmp___13; tmp___14 = __fswab32(fw_hdr->xsem_pram_data.offset); bp->xsem_pram_data = (bp->firmware)->data + (unsigned long )tmp___14; tmp___15 = __fswab32(fw_hdr->csem_int_table_data.offset); bp->csem_int_table_data = (bp->firmware)->data + (unsigned long )tmp___15; tmp___16 = __fswab32(fw_hdr->csem_pram_data.offset); bp->csem_pram_data = (bp->firmware)->data + (unsigned long )tmp___16; tmp___17 = __fswab32(fw_hdr->iro_arr.len); len___2 = tmp___17; tmp___18 = kmalloc((size_t )len___2, 208U); bp->iro_arr = (struct iro const *)tmp___18; if ((unsigned long )bp->iro_arr == (unsigned long )((struct iro const *)0)) { goto iro_alloc_err; } else { } tmp___19 = __fswab32(fw_hdr->iro_arr.offset); bnx2x_prep_iro((bp->firmware)->data + (unsigned long )tmp___19, (u8 *)bp->iro_arr, len___2); return (0); iro_alloc_err: kfree((void const *)bp->init_ops_offsets); init_offsets_alloc_err: kfree((void const *)bp->init_ops); init_ops_alloc_err: kfree((void const *)bp->init_data); request_firmware_exit: release_firmware(bp->firmware); bp->firmware = 0; return (rc); } } static void bnx2x_release_firmware(struct bnx2x *bp ) { { kfree((void const *)bp->init_ops_offsets); kfree((void const *)bp->init_ops); kfree((void const *)bp->init_data); release_firmware(bp->firmware); bp->firmware = 0; return; } } static struct bnx2x_func_sp_drv_ops bnx2x_func_sp_drv = {& bnx2x_init_hw_common_chip, & bnx2x_init_hw_common, & bnx2x_init_hw_port, & bnx2x_init_hw_func, & bnx2x_reset_common, & bnx2x_reset_port, & bnx2x_reset_func, & bnx2x_gunzip_init, & bnx2x_gunzip_end, & bnx2x_init_firmware, & bnx2x_release_firmware}; void bnx2x__init_func_obj(struct bnx2x *bp ) { { bnx2x_setup_dmae(bp); bnx2x_init_func_obj(bp, & bp->func_obj, (void *)(& (bp->slowpath)->func_rdata), bp->slowpath_mapping + 2632ULL, (void *)(& (bp->slowpath)->func_afex_rdata), bp->slowpath_mapping + 2672ULL, & bnx2x_func_sp_drv); return; } } static int bnx2x_set_qm_cid_count(struct bnx2x *bp ) { int cid_count ; int __y ; { cid_count = ((int )bp->igu_sb_cnt - (int )bp->cnic_support) * 3 + (int )bp->cnic_support * 2; if ((unsigned long )bp->vfdb != (unsigned long )((struct bnx2x_vfdb *)0)) { cid_count = cid_count + 64; } else { } if ((unsigned int )bp->cnic_support != 0U) { cid_count = cid_count + 2304; } else { } __y = 1024; return ((((__y + -1) + cid_count) / __y) * __y); } } static int bnx2x_get_num_non_def_sbs(struct pci_dev *pdev , int cnic_cnt , bool is_vf ) { int pos ; int index ; u16 control ; { control = 0U; pos = pci_find_capability(pdev, 17); if (pos == 0) { _dev_info((struct device const *)(& pdev->dev), "no msix capability found\n"); return (cnic_cnt + 1); } else { } _dev_info((struct device const *)(& pdev->dev), "msix capability found\n"); pci_read_config_word((struct pci_dev const *)pdev, pos + 2, & control); index = (int )control & 2047; return ((int )is_vf ? index + 1 : index); } } static int set_max_cos_est(int chip_id ) { { switch (chip_id) { case 0: ; case 1: ; case 2: ; return (3); case 3: ; case 4: ; case 5: ; return (2); case 6: ; case 7: ; case 8: ; case 9: ; case 10: ; case 12: ; case 13: ; case 18: ; case 19: ; case 11: ; case 14: ; case 15: ; case 16: ; case 17: ; case 20: ; return (3); return (1); default: printk("\vbnx2x: Unknown board_type (%d), aborting\n", chip_id); return (-19); } } } static int set_is_vf(int chip_id ) { { switch (chip_id) { case 5: ; case 8: ; case 11: ; case 15: ; case 20: ; return (1); default: ; return (0); } } } struct cnic_eth_dev *bnx2x_cnic_probe(struct net_device *dev ) ; static int bnx2x_init_one(struct pci_dev *pdev , struct pci_device_id const *ent ) { struct net_device *dev ; struct bnx2x *bp ; int pcie_width ; int pcie_speed ; int rc ; int max_non_def_sbs ; int rx_count ; int tx_count ; int rss_count ; int doorbell_size ; int max_cos_est ; bool is_vf ; int cnic_cnt ; int tmp ; void *tmp___0 ; long tmp___1 ; long tmp___2 ; long tmp___3 ; long tmp___4 ; long tmp___5 ; long tmp___6 ; long tmp___7 ; long tmp___8 ; long tmp___9 ; int tmp___10 ; { dev = 0; max_cos_est = set_max_cos_est((int )ent->driver_data); if (max_cos_est < 0) { return (max_cos_est); } else { } tmp = set_is_vf((int )ent->driver_data); is_vf = tmp != 0; cnic_cnt = (int )is_vf ? 0 : 1; max_non_def_sbs = bnx2x_get_num_non_def_sbs(pdev, cnic_cnt, (int )is_vf); rss_count = (int )is_vf ? 1 : max_non_def_sbs - cnic_cnt; if (rss_count <= 0) { return (-22); } else { } rx_count = rss_count + cnic_cnt; tx_count = rss_count * max_cos_est + cnic_cnt; dev = alloc_etherdev_mqs(6952, (unsigned int )tx_count, (unsigned int )rx_count); if ((unsigned long )dev == (unsigned long )((struct net_device *)0)) { return (-12); } else { } tmp___0 = netdev_priv((struct net_device const *)dev); bp = (struct bnx2x *)tmp___0; bp->flags = 0U; if ((int )is_vf) { bp->flags = bp->flags | 4194304U; } else { } bp->igu_sb_cnt = (u8 )max_non_def_sbs; bp->igu_base_addr = (bp->flags & 4194304U) != 0U ? 0U : 4456448U; bp->msg_enable = debug; bp->cnic_support = (u8 )cnic_cnt; bp->cnic_probe = & bnx2x_cnic_probe; pci_set_drvdata(pdev, (void *)dev); rc = bnx2x_init_dev(bp, pdev, dev, ent->driver_data); if (rc < 0) { free_netdev(dev); return (rc); } else { } tmp___1 = ldv__builtin_expect((bp->msg_enable & 2) != 0, 0L); if (tmp___1 != 0L) { _dev_info((struct device const *)(& (bp->pdev)->dev), "This is a %s function\n", (bp->flags & 4194304U) == 0U ? (char *)"physical" : (char *)"virtual"); } else { } tmp___2 = ldv__builtin_expect((bp->msg_enable & 2) != 0, 0L); if (tmp___2 != 0L) { _dev_info((struct device const *)(& (bp->pdev)->dev), "Cnic support is %s\n", (unsigned int )bp->cnic_support != 0U ? (char *)"on" : (char *)"off"); } else { } tmp___3 = ldv__builtin_expect((bp->msg_enable & 2) != 0, 0L); if (tmp___3 != 0L) { _dev_info((struct device const *)(& (bp->pdev)->dev), "Max num of status blocks %d\n", max_non_def_sbs); } else { } tmp___4 = ldv__builtin_expect((bp->msg_enable & 2) != 0, 0L); if (tmp___4 != 0L) { _dev_info((struct device const *)(& (bp->pdev)->dev), "Allocated netdev with %d tx and %d rx queues\n", tx_count, rx_count); } else { } rc = bnx2x_init_bp(bp); if (rc != 0) { goto init_one_exit; } else { } if ((bp->flags & 4194304U) != 0U) { bp->doorbells = bnx2x_vf_doorbells(bp); rc = bnx2x_vf_pci_alloc(bp); if (rc != 0) { goto init_one_exit; } else { } } else { doorbell_size = ((int )bp->igu_sb_cnt - (int )bp->cnic_support) * 384 + (int )bp->cnic_support * 256; if ((resource_size_t )doorbell_size > (pdev->resource[2].start != 0ULL || pdev->resource[2].end != pdev->resource[2].start ? (pdev->resource[2].end - pdev->resource[2].start) + 1ULL : 0ULL)) { dev_err((struct device const *)(& (bp->pdev)->dev), "Cannot map doorbells, bar size too small, aborting\n"); rc = -12; goto init_one_exit; } else { } bp->doorbells = ioremap_nocache(pdev->resource[2].start, (unsigned long )doorbell_size); } if ((unsigned long )bp->doorbells == (unsigned long )((void *)0)) { dev_err((struct device const *)(& (bp->pdev)->dev), "Cannot map doorbell space, aborting\n"); rc = -12; goto init_one_exit; } else { } if ((bp->flags & 4194304U) != 0U) { rc = bnx2x_vfpf_acquire(bp, (int )((u8 )tx_count), (int )((u8 )rx_count)); if (rc != 0) { goto init_one_exit; } else { } } else { } rc = bnx2x_iov_init_one(bp, int_mode, 64); if (rc != 0) { goto init_one_exit; } else { } bp->qm_cid_count = bnx2x_set_qm_cid_count(bp); tmp___5 = ldv__builtin_expect((bp->msg_enable & 2) != 0, 0L); if (tmp___5 != 0L) { _dev_info((struct device const *)(& (bp->pdev)->dev), "qm_cid_count %d\n", bp->qm_cid_count); } else { } if (bp->common.chip_id >> 16 == 5710U || (bp->common.chip_id >> 16 == 5711U || bp->common.chip_id >> 16 == 5712U)) { bp->flags = bp->flags | 32768U; } else { } bnx2x_set_num_queues(bp); rc = bnx2x_set_int_mode(bp); if (rc != 0) { dev_err((struct device const *)(& pdev->dev), "Cannot set interrupts\n"); goto init_one_exit; } else { } tmp___6 = ldv__builtin_expect((bp->msg_enable & 2) != 0, 0L); if (tmp___6 != 0L) { _dev_info((struct device const *)(& (bp->pdev)->dev), "set interrupts successfully\n"); } else { } rc = register_netdev(dev); if (rc != 0) { dev_err((struct device const *)(& pdev->dev), "Cannot register net device\n"); goto init_one_exit; } else { } tmp___7 = ldv__builtin_expect((bp->msg_enable & 2) != 0, 0L); if (tmp___7 != 0L) { _dev_info((struct device const *)(& (bp->pdev)->dev), "device name after netdev register %s\n", (char *)(& dev->name)); } else { } if ((bp->flags & 32768U) == 0U) { rtnl_lock(); dev_addr_add(bp->dev, (unsigned char const *)(& bp->fip_mac), 2); rtnl_unlock(); } else { } bnx2x_get_pcie_width_speed(bp, & pcie_width, & pcie_speed); tmp___8 = ldv__builtin_expect((bp->msg_enable & 2) != 0, 0L); if (tmp___8 != 0L) { _dev_info((struct device const *)(& (bp->pdev)->dev), "got pcie width %d and speed %d\n", pcie_width, pcie_speed); } else { } tmp___9 = ldv__builtin_expect((bp->msg_enable & 2) != 0, 0L); if (tmp___9 != 0L) { _dev_info((struct device const *)(& (bp->pdev)->dev), "%s (%c%d) PCI-E x%d %s found at mem %lx, IRQ %d, node addr %pM\n", board_info[ent->driver_data].name, (bp->common.chip_id & 61440U) > 20480U ? ((~ bp->common.chip_id & 61440U) >> 13) + 65U : ((bp->common.chip_id & 61440U) >> 12) + 65U, (bp->common.chip_id & 4080U) >> 4, pcie_width, (((bp->common.chip_id >> 16 != 5730U && bp->common.chip_id >> 16 != 5731U) && bp->common.chip_id >> 16 != 5743U) && pcie_speed == 2) || (((bp->common.chip_id >> 16 == 5730U || bp->common.chip_id >> 16 == 5731U) || bp->common.chip_id >> 16 == 5743U) && pcie_speed == 1) ? (char *)"5GHz (Gen2)" : (char *)"2.5GHz", dev->base_addr, (bp->pdev)->irq, dev->dev_addr); } else { } return (0); init_one_exit: ; if ((unsigned long )bp->regview != (unsigned long )((void *)0)) { iounmap((void volatile *)bp->regview); } else { } if ((bp->flags & 4194304U) == 0U && (unsigned long )bp->doorbells != (unsigned long )((void *)0)) { iounmap((void volatile *)bp->doorbells); } else { } free_netdev(dev); tmp___10 = atomic_read((atomic_t const *)(& pdev->enable_cnt)); if (tmp___10 == 1) { pci_release_regions(pdev); } else { } pci_disable_device(pdev); pci_set_drvdata(pdev, 0); return (rc); } } static void bnx2x_remove_one(struct pci_dev *pdev ) { struct net_device *dev ; void *tmp ; struct bnx2x *bp ; void *tmp___0 ; int tmp___1 ; { tmp = pci_get_drvdata(pdev); dev = (struct net_device *)tmp; if ((unsigned long )dev == (unsigned long )((struct net_device *)0)) { dev_err((struct device const *)(& pdev->dev), "BAD net device from bnx2x_init_one\n"); return; } else { } tmp___0 = netdev_priv((struct net_device const *)dev); bp = (struct bnx2x *)tmp___0; if ((bp->flags & 32768U) == 0U) { rtnl_lock(); dev_addr_del(bp->dev, (unsigned char const *)(& bp->fip_mac), 2); rtnl_unlock(); } else { } bnx2x_dcbnl_update_applist(bp, 1); unregister_netdev(dev); if ((bp->flags & 4194304U) == 0U) { bnx2x_set_power_state(bp, 0); } else { } bnx2x_disable_msi(bp); if ((bp->flags & 4194304U) == 0U) { bnx2x_set_power_state(bp, 3); } else { } cancel_delayed_work_sync(& bp->sp_rtnl_task); bnx2x_iov_remove_one(bp); if ((bp->flags & 4194304U) != 0U) { bnx2x_vfpf_release(bp); } else { } if ((unsigned long )bp->regview != (unsigned long )((void *)0)) { iounmap((void volatile *)bp->regview); } else { } if ((bp->flags & 4194304U) == 0U) { if ((unsigned long )bp->doorbells != (unsigned long )((void *)0)) { iounmap((void volatile *)bp->doorbells); } else { } bnx2x_release_firmware(bp); } else { } bnx2x_free_mem_bp(bp); free_netdev(dev); tmp___1 = atomic_read((atomic_t const *)(& pdev->enable_cnt)); if (tmp___1 == 1) { pci_release_regions(pdev); } else { } pci_disable_device(pdev); pci_set_drvdata(pdev, 0); return; } } static int bnx2x_eeh_nic_unload(struct bnx2x *bp ) { { bp->state = 16384U; bp->rx_mode = 0U; if ((int )bp->cnic_loaded) { bnx2x_cnic_notify(bp, 1); } else { } bnx2x_tx_disable(bp); bnx2x_del_all_napi(bp); if ((int )bp->cnic_loaded) { bnx2x_del_all_napi_cnic(bp); } else { } netdev_reset_tc(bp->dev); del_timer_sync(& bp->timer); cancel_delayed_work(& bp->sp_task); cancel_delayed_work(& bp->period_task); spin_lock_bh(& bp->stats_lock); bp->stats_state = 0; spin_unlock_bh(& bp->stats_lock); bnx2x_save_statistics(bp); netif_carrier_off(bp->dev); return (0); } } static void bnx2x_eeh_recover(struct bnx2x *bp ) { u32 val ; struct lock_class_key __key ; { __mutex_init(& bp->port.phy_mutex, "&bp->port.phy_mutex", & __key); val = readl((void const volatile *)(bp->regview + ((unsigned long )bp->common.shmem_base + ((unsigned long )bp->pfid & 1UL) * 4UL))); if ((val & 6291456U) != 6291456U) { printk("\vbnx2x: [%s:%d(%s)]BAD MCP validity signature\n", "bnx2x_eeh_recover", 12832, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } return; } } static pci_ers_result_t bnx2x_io_error_detected(struct pci_dev *pdev , pci_channel_state_t state ) { struct net_device *dev ; void *tmp ; struct bnx2x *bp ; void *tmp___0 ; bool tmp___1 ; { tmp = pci_get_drvdata(pdev); dev = (struct net_device *)tmp; tmp___0 = netdev_priv((struct net_device const *)dev); bp = (struct bnx2x *)tmp___0; rtnl_lock(); printk("\vbnx2x: [%s:%d(%s)]IO error detected\n", "bnx2x_io_error_detected", 12851, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); netif_device_detach(dev); if (state == 3U) { rtnl_unlock(); return (4U); } else { } tmp___1 = netif_running((struct net_device const *)dev); if ((int )tmp___1) { bnx2x_eeh_nic_unload(bp); } else { } bnx2x_prev_path_mark_eeh(bp); pci_disable_device(pdev); rtnl_unlock(); return (3U); } } static pci_ers_result_t bnx2x_io_slot_reset(struct pci_dev *pdev ) { struct net_device *dev ; void *tmp ; struct bnx2x *bp ; void *tmp___0 ; int i ; int tmp___1 ; bool tmp___2 ; u32 v ; unsigned int tmp___3 ; bool tmp___4 ; { tmp = pci_get_drvdata(pdev); dev = (struct net_device *)tmp; tmp___0 = netdev_priv((struct net_device const *)dev); bp = (struct bnx2x *)tmp___0; rtnl_lock(); printk("\vbnx2x: [%s:%d(%s)]IO slot reset initializing...\n", "bnx2x_io_slot_reset", 12886, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); tmp___1 = pci_enable_device(pdev); if (tmp___1 != 0) { dev_err((struct device const *)(& pdev->dev), "Cannot re-enable PCI device after reset\n"); rtnl_unlock(); return (4U); } else { } pci_set_master(pdev); pci_restore_state(pdev); pci_save_state(pdev); tmp___2 = netif_running((struct net_device const *)dev); if ((int )tmp___2) { bnx2x_set_power_state(bp, 0); } else { } tmp___4 = netif_running((struct net_device const *)dev); if ((int )tmp___4) { printk("\vbnx2x: [%s:%d(%s)]IO slot reset --> driver unload\n", "bnx2x_io_slot_reset", 12902, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); if ((bp->flags & 4194304U) == 0U) { if (bp->common.shmem2_base != 0U) { tmp___3 = readl((void const volatile *)bp->regview + (unsigned long )bp->common.shmem2_base); if (tmp___3 > 224U) { v = readl((void const volatile *)(bp->regview + ((unsigned long )bp->common.shmem2_base + ((unsigned long )(((int )bp->pfid & 1) + ((int )bp->pfid >> 1) * ((bp->common.chip_id >> 16 == 5710U || (bp->common.chip_id >> 16 == 5711U || bp->common.chip_id >> 16 == 5712U)) || (unsigned int )bp->common.chip_port_mode == 0U ? 2 : 1)) + 56UL) * 4UL))); writel(v & 4294967293U, (void volatile *)(bp->regview + ((unsigned long )bp->common.shmem2_base + ((unsigned long )(((int )bp->pfid & 1) + ((int )bp->pfid >> 1) * ((bp->common.chip_id >> 16 == 5710U || (bp->common.chip_id >> 16 == 5711U || bp->common.chip_id >> 16 == 5712U)) || (unsigned int )bp->common.chip_port_mode == 0U ? 2 : 1)) + 56UL) * 4UL))); } else { } } else { } } else { } bnx2x_drain_tx_queues(bp); bnx2x_send_unload_req(bp, 2); bnx2x_netif_stop(bp, 1); bnx2x_free_irq(bp); bnx2x_send_unload_done(bp, 1); bp->sp_state = 0UL; bp->port.pmf = 0U; bnx2x_prev_unload(bp); bnx2x_squeeze_objects(bp); bnx2x_free_skbs(bp); i = 0; goto ldv_58409; ldv_58408: ; if ((bp->flags & 32768U) != 0U && (uint )i == (uint )bp->num_queues - bp->num_cnic_queues) { } else { bnx2x_free_rx_sge_range(bp, bp->fp + (unsigned long )i, 1024); } i = i + 1; ldv_58409: ; if (bp->num_queues > i) { goto ldv_58408; } else { } bnx2x_free_fp_mem(bp); bnx2x_free_mem(bp); bp->state = 0U; } else { } rtnl_unlock(); return (5U); } } static void bnx2x_io_resume(struct pci_dev *pdev ) { struct net_device *dev ; void *tmp ; struct bnx2x *bp ; void *tmp___0 ; unsigned int tmp___1 ; bool tmp___2 ; { tmp = pci_get_drvdata(pdev); dev = (struct net_device *)tmp; tmp___0 = netdev_priv((struct net_device const *)dev); bp = (struct bnx2x *)tmp___0; if ((unsigned int )bp->recovery_state != 0U) { netdev_err((struct net_device const *)bp->dev, "Handling parity error recovery. Try again later\n"); return; } else { } rtnl_lock(); bnx2x_eeh_recover(bp); tmp___1 = readl((void const volatile *)(bp->regview + (((unsigned long )bp->common.shmem_base + (unsigned long )(((int )bp->pfid & 1) + ((int )bp->pfid >> 1) * ((bp->common.chip_id >> 16 == 5710U || (bp->common.chip_id >> 16 == 5711U || bp->common.chip_id >> 16 == 5712U)) || (unsigned int )bp->common.chip_port_mode == 0U ? 2 : 1)) * 44UL) + 1668UL))); bp->fw_seq = (u16 )tmp___1; tmp___2 = netif_running((struct net_device const *)dev); if ((int )tmp___2) { bnx2x_nic_load(bp, 0); } else { } netif_device_attach(dev); rtnl_unlock(); return; } } static struct pci_error_handlers const bnx2x_err_handler = {(pci_ers_result_t (*)(struct pci_dev * , enum pci_channel_state ))(& bnx2x_io_error_detected), 0, 0, & bnx2x_io_slot_reset, & bnx2x_io_resume}; static struct pci_driver bnx2x_pci_driver = {{0, 0}, "bnx2x", (struct pci_device_id const *)(& bnx2x_pci_tbl), & bnx2x_init_one, & bnx2x_remove_one, & bnx2x_suspend, 0, 0, & bnx2x_resume, 0, & bnx2x_sriov_configure, & bnx2x_err_handler, {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 int bnx2x_init(void) { int ret ; struct lock_class_key __key ; char const *__lock_name ; struct workqueue_struct *tmp ; { printk("\016bnx2x: %s", (char *)(& version)); __lock_name = "bnx2x"; tmp = __alloc_workqueue_key("bnx2x", 10U, 1, & __key, __lock_name); bnx2x_wq = tmp; if ((unsigned long )bnx2x_wq == (unsigned long )((struct workqueue_struct *)0)) { printk("\vbnx2x: Cannot create workqueue\n"); return (-12); } else { } ret = __pci_register_driver(& bnx2x_pci_driver, & __this_module, "bnx2x"); if (ret != 0) { printk("\vbnx2x: Cannot register driver\n"); destroy_workqueue(bnx2x_wq); } else { } return (ret); } } static void bnx2x_cleanup(void) { struct list_head *pos ; struct list_head *q ; struct bnx2x_prev_path_list *tmp ; struct list_head const *__mptr ; { pci_unregister_driver(& bnx2x_pci_driver); destroy_workqueue(bnx2x_wq); pos = bnx2x_prev_list.next; q = pos->next; goto ldv_58434; ldv_58433: __mptr = (struct list_head const *)pos; tmp = (struct bnx2x_prev_path_list *)__mptr; list_del(pos); kfree((void const *)tmp); pos = q; q = pos->next; ldv_58434: ; if ((unsigned long )pos != (unsigned long )(& bnx2x_prev_list)) { goto ldv_58433; } else { } return; } } void bnx2x_notify_link_changed(struct bnx2x *bp ) { { writel(1U, (void volatile *)(bp->regview + ((unsigned long )bp->pfid + 10252UL) * 4UL)); return; } } static int bnx2x_set_iscsi_eth_mac_addr(struct bnx2x *bp ) { unsigned long ramrod_flags ; int tmp ; { ramrod_flags = 0UL; __set_bit(2, (unsigned long volatile *)(& ramrod_flags)); tmp = bnx2x_set_mac_one(bp, (u8 *)(& bp->cnic_eth_dev.iscsi_mac), & bp->iscsi_l2_mac_obj, 1, 2, & ramrod_flags); return (tmp); } } static void bnx2x_cnic_sp_post(struct bnx2x *bp , int count ) { struct eth_spe *spe ; int cxt_index ; int cxt_offset ; long tmp ; u16 type ; u8 cmd ; int tmp___0 ; int tmp___1 ; long tmp___2 ; { spin_lock_bh(& bp->spq_lock); tmp = ldv__builtin_expect((int )bp->cnic_spq_pending < count, 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 *)"/work/ldvuser/exper_fp/work/current--X--drivers--X--defaultlinux-3.10-rc1.tar--X--32_7a--X--cpachecker/linux-3.10-rc1.tar/csd_deg_dscv/8504/dscv_tempdir/dscv/ri/32_7a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c.prepared"), "i" (13068), "i" (12UL)); ldv_58460: ; goto ldv_58460; } else { } bp->cnic_spq_pending = (int )bp->cnic_spq_pending - (int )((u16 )count); goto ldv_58466; ldv_58465: type = (unsigned int )(bp->cnic_kwq_cons)->hdr.type & 255U; cmd = (u8 )((bp->cnic_kwq_cons)->hdr.conn_and_cmd_data >> 24); if ((unsigned int )type == 0U) { if ((unsigned int )cmd == 1U) { cxt_index = (int )((((uint )bp->num_queues - bp->num_cnic_queues) * (uint )bp->max_cos) / 32U); cxt_offset = (int )(((uint )bp->num_queues - bp->num_cnic_queues) * (uint )bp->max_cos - (unsigned int )((unsigned long )cxt_index) * 32U); bnx2x_set_ctx_validation(bp, & (bp->context[cxt_index].vcxt + (unsigned long )cxt_offset)->eth, ((uint )bp->num_queues - bp->num_cnic_queues) * (uint )bp->max_cos); } else { } } else { } if ((unsigned int )type == 0U) { tmp___0 = atomic_read((atomic_t const *)(& bp->cq_spq_left)); if (tmp___0 == 0) { goto ldv_58463; } else { atomic_dec(& bp->cq_spq_left); } } else if ((unsigned int )type == 8U) { tmp___1 = atomic_read((atomic_t const *)(& bp->eq_spq_left)); if (tmp___1 == 0) { goto ldv_58463; } else { atomic_dec(& bp->eq_spq_left); } } else if ((unsigned int )type == 3U || (unsigned int )type == 4U) { if ((u32 )bp->cnic_spq_pending >= bp->cnic_eth_dev.max_kwqe_pending) { goto ldv_58463; } else { bp->cnic_spq_pending = (u16 )((int )bp->cnic_spq_pending + 1); } } else { printk("\vbnx2x: [%s:%d(%s)]Unknown SPE type: %d\n", "bnx2x_cnic_sp_post", 13119, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )type); bp->panic = 1; printk("\vbnx2x: [%s:%d(%s)]driver assert\n", "bnx2x_cnic_sp_post", 13120, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); bnx2x_panic_dump(bp, 0); goto ldv_58463; } spe = bnx2x_sp_get_next(bp); *spe = *(bp->cnic_kwq_cons); tmp___2 = ldv__builtin_expect((bp->msg_enable & 1048576) != 0, 0L); if (tmp___2 != 0L) { printk("\rbnx2x: [%s:%d(%s)]pending on SPQ %d, on KWQ %d count %d\n", "bnx2x_cnic_sp_post", 13128, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )bp->cnic_spq_pending, (int )bp->cnic_kwq_pending, count); } else { } if ((unsigned long )bp->cnic_kwq_cons == (unsigned long )bp->cnic_kwq_last) { bp->cnic_kwq_cons = bp->cnic_kwq; } else { bp->cnic_kwq_cons = bp->cnic_kwq_cons + 1; } bp->cnic_kwq_pending = (u16 )((int )bp->cnic_kwq_pending - 1); ldv_58466: ; if ((unsigned int )bp->cnic_kwq_pending != 0U) { goto ldv_58465; } else { } ldv_58463: bnx2x_sp_prod_update(bp); spin_unlock_bh(& bp->spq_lock); return; } } static int bnx2x_cnic_sp_queue(struct net_device *dev , struct kwqe_16 **kwqes , u32 count ) { struct bnx2x *bp ; void *tmp ; int i ; struct eth_spe *spe ; long tmp___0 ; { tmp = netdev_priv((struct net_device const *)dev); bp = (struct bnx2x *)tmp; if ((unsigned int )bp->recovery_state != 0U && (unsigned int )bp->recovery_state != 4U) { printk("\vbnx2x: [%s:%d(%s)]Handling parity error recovery. Try again later\n", "bnx2x_cnic_sp_queue", 13154, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); return (-11); } else { } spin_lock_bh(& bp->spq_lock); i = 0; goto ldv_58478; ldv_58477: spe = (struct eth_spe *)*(kwqes + (unsigned long )i); if ((unsigned int )bp->cnic_kwq_pending == 255U) { goto ldv_58476; } else { } *(bp->cnic_kwq_prod) = *spe; bp->cnic_kwq_pending = (u16 )((int )bp->cnic_kwq_pending + 1); tmp___0 = ldv__builtin_expect((bp->msg_enable & 1048576) != 0, 0L); if (tmp___0 != 0L) { printk("\rbnx2x: [%s:%d(%s)]L5 SPQE %x %x %x:%x pos %d\n", "bnx2x_cnic_sp_queue", 13174, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", spe->hdr.conn_and_cmd_data, (int )spe->hdr.type, spe->data.update_data_addr.hi, spe->data.update_data_addr.lo, (int )bp->cnic_kwq_pending); } else { } if ((unsigned long )bp->cnic_kwq_prod == (unsigned long )bp->cnic_kwq_last) { bp->cnic_kwq_prod = bp->cnic_kwq; } else { bp->cnic_kwq_prod = bp->cnic_kwq_prod + 1; } i = i + 1; ldv_58478: ; if ((u32 )i < count) { goto ldv_58477; } else { } ldv_58476: spin_unlock_bh(& bp->spq_lock); if ((u32 )bp->cnic_spq_pending < bp->cnic_eth_dev.max_kwqe_pending) { bnx2x_cnic_sp_post(bp, 0); } else { } return (i); } } static int bnx2x_cnic_ctl_send(struct bnx2x *bp , struct cnic_ctl_info *ctl ) { struct cnic_ops *c_ops ; int rc ; bool __warned ; int tmp ; int tmp___0 ; { rc = 0; ldv_mutex_lock_11(& bp->cnic_mutex); tmp = debug_lockdep_rcu_enabled(); if (tmp != 0 && ! __warned) { tmp___0 = lock_is_held(& bp->cnic_mutex.dep_map); if (tmp___0 == 0) { __warned = 1; lockdep_rcu_suspicious("/work/ldvuser/exper_fp/work/current--X--drivers--X--defaultlinux-3.10-rc1.tar--X--32_7a--X--cpachecker/linux-3.10-rc1.tar/csd_deg_dscv/8504/dscv_tempdir/dscv/ri/32_7a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c.prepared", 13197, "suspicious rcu_dereference_protected() usage"); } else { } } else { } c_ops = bp->cnic_ops; if ((unsigned long )c_ops != (unsigned long )((struct cnic_ops *)0)) { rc = (*(c_ops->cnic_ctl))(bp->cnic_data, ctl); } else { } ldv_mutex_unlock_12(& bp->cnic_mutex); return (rc); } } static int bnx2x_cnic_ctl_send_bh(struct bnx2x *bp , struct cnic_ctl_info *ctl ) { struct cnic_ops *c_ops ; int rc ; struct cnic_ops *_________p1 ; bool __warned ; int tmp ; int tmp___0 ; { rc = 0; rcu_read_lock(); _________p1 = *((struct cnic_ops * volatile *)(& bp->cnic_ops)); tmp = debug_lockdep_rcu_enabled(); if (tmp != 0 && ! __warned) { tmp___0 = rcu_read_lock_held(); if (tmp___0 == 0 && 1) { __warned = 1; lockdep_rcu_suspicious("/work/ldvuser/exper_fp/work/current--X--drivers--X--defaultlinux-3.10-rc1.tar--X--32_7a--X--cpachecker/linux-3.10-rc1.tar/csd_deg_dscv/8504/dscv_tempdir/dscv/ri/32_7a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c.prepared", 13211, "suspicious rcu_dereference_check() usage"); } else { } } else { } c_ops = _________p1; if ((unsigned long )c_ops != (unsigned long )((struct cnic_ops *)0)) { rc = (*(c_ops->cnic_ctl))(bp->cnic_data, ctl); } else { } rcu_read_unlock(); return (rc); } } int bnx2x_cnic_notify(struct bnx2x *bp , int cmd ) { struct cnic_ctl_info ctl ; int tmp ; { ctl.cmd = 0; ctl.data.bytes[0] = (char)0; ctl.data.bytes[1] = (char)0; ctl.data.bytes[2] = (char)0; ctl.data.bytes[3] = (char)0; ctl.data.bytes[4] = (char)0; ctl.data.bytes[5] = (char)0; ctl.data.bytes[6] = (char)0; ctl.data.bytes[7] = (char)0; ctl.data.bytes[8] = (char)0; ctl.data.bytes[9] = (char)0; ctl.data.bytes[10] = (char)0; ctl.data.bytes[11] = (char)0; ctl.data.bytes[12] = (char)0; ctl.data.bytes[13] = (char)0; ctl.data.bytes[14] = (char)0; ctl.data.bytes[15] = (char)0; ctl.data.bytes[16] = (char)0; ctl.data.bytes[17] = (char)0; ctl.data.bytes[18] = (char)0; ctl.data.bytes[19] = (char)0; ctl.data.bytes[20] = (char)0; ctl.data.bytes[21] = (char)0; ctl.data.bytes[22] = (char)0; ctl.data.bytes[23] = (char)0; ctl.data.bytes[24] = (char)0; ctl.data.bytes[25] = (char)0; ctl.data.bytes[26] = (char)0; ctl.data.bytes[27] = (char)0; ctl.data.bytes[28] = (char)0; ctl.data.bytes[29] = (char)0; ctl.data.bytes[30] = (char)0; ctl.data.bytes[31] = (char)0; ctl.data.bytes[32] = (char)0; ctl.data.bytes[33] = (char)0; ctl.data.bytes[34] = (char)0; ctl.data.bytes[35] = (char)0; ctl.data.bytes[36] = (char)0; ctl.data.bytes[37] = (char)0; ctl.data.bytes[38] = (char)0; ctl.data.bytes[39] = (char)0; ctl.data.bytes[40] = (char)0; ctl.data.bytes[41] = (char)0; ctl.data.bytes[42] = (char)0; ctl.data.bytes[43] = (char)0; ctl.data.bytes[44] = (char)0; ctl.data.bytes[45] = (char)0; ctl.data.bytes[46] = (char)0; ctl.data.bytes[47] = (char)0; ctl.data.bytes[48] = (char)0; ctl.data.bytes[49] = (char)0; ctl.data.bytes[50] = (char)0; ctl.data.bytes[51] = (char)0; ctl.data.bytes[52] = (char)0; ctl.data.bytes[53] = (char)0; ctl.data.bytes[54] = (char)0; ctl.data.bytes[55] = (char)0; ctl.data.bytes[56] = (char)0; ctl.data.bytes[57] = (char)0; ctl.data.bytes[58] = (char)0; ctl.data.bytes[59] = (char)0; ctl.data.bytes[60] = (char)0; ctl.data.bytes[61] = (char)0; ctl.data.bytes[62] = (char)0; ctl.data.bytes[63] = (char)0; ctl.cmd = cmd; tmp = bnx2x_cnic_ctl_send(bp, & ctl); return (tmp); } } static void bnx2x_cnic_cfc_comp(struct bnx2x *bp , int cid , u8 err ) { struct cnic_ctl_info ctl ; { ctl.cmd = 0; ctl.data.bytes[0] = (char)0; ctl.data.bytes[1] = (char)0; ctl.data.bytes[2] = (char)0; ctl.data.bytes[3] = (char)0; ctl.data.bytes[4] = (char)0; ctl.data.bytes[5] = (char)0; ctl.data.bytes[6] = (char)0; ctl.data.bytes[7] = (char)0; ctl.data.bytes[8] = (char)0; ctl.data.bytes[9] = (char)0; ctl.data.bytes[10] = (char)0; ctl.data.bytes[11] = (char)0; ctl.data.bytes[12] = (char)0; ctl.data.bytes[13] = (char)0; ctl.data.bytes[14] = (char)0; ctl.data.bytes[15] = (char)0; ctl.data.bytes[16] = (char)0; ctl.data.bytes[17] = (char)0; ctl.data.bytes[18] = (char)0; ctl.data.bytes[19] = (char)0; ctl.data.bytes[20] = (char)0; ctl.data.bytes[21] = (char)0; ctl.data.bytes[22] = (char)0; ctl.data.bytes[23] = (char)0; ctl.data.bytes[24] = (char)0; ctl.data.bytes[25] = (char)0; ctl.data.bytes[26] = (char)0; ctl.data.bytes[27] = (char)0; ctl.data.bytes[28] = (char)0; ctl.data.bytes[29] = (char)0; ctl.data.bytes[30] = (char)0; ctl.data.bytes[31] = (char)0; ctl.data.bytes[32] = (char)0; ctl.data.bytes[33] = (char)0; ctl.data.bytes[34] = (char)0; ctl.data.bytes[35] = (char)0; ctl.data.bytes[36] = (char)0; ctl.data.bytes[37] = (char)0; ctl.data.bytes[38] = (char)0; ctl.data.bytes[39] = (char)0; ctl.data.bytes[40] = (char)0; ctl.data.bytes[41] = (char)0; ctl.data.bytes[42] = (char)0; ctl.data.bytes[43] = (char)0; ctl.data.bytes[44] = (char)0; ctl.data.bytes[45] = (char)0; ctl.data.bytes[46] = (char)0; ctl.data.bytes[47] = (char)0; ctl.data.bytes[48] = (char)0; ctl.data.bytes[49] = (char)0; ctl.data.bytes[50] = (char)0; ctl.data.bytes[51] = (char)0; ctl.data.bytes[52] = (char)0; ctl.data.bytes[53] = (char)0; ctl.data.bytes[54] = (char)0; ctl.data.bytes[55] = (char)0; ctl.data.bytes[56] = (char)0; ctl.data.bytes[57] = (char)0; ctl.data.bytes[58] = (char)0; ctl.data.bytes[59] = (char)0; ctl.data.bytes[60] = (char)0; ctl.data.bytes[61] = (char)0; ctl.data.bytes[62] = (char)0; ctl.data.bytes[63] = (char)0; ctl.cmd = 3; ctl.data.comp.cid = (u32 )cid; ctl.data.comp.error = err; bnx2x_cnic_ctl_send_bh(bp, & ctl); bnx2x_cnic_sp_post(bp, 0); return; } } static void bnx2x_set_iscsi_eth_rx_mode(struct bnx2x *bp , bool start ) { unsigned long accept_flags ; unsigned long ramrod_flags ; u8 cl_id ; u8 tmp ; int sched_state ; int tmp___0 ; { accept_flags = 0UL; ramrod_flags = 0UL; tmp = bnx2x_cnic_eth_cl_id(bp, 0); cl_id = tmp; sched_state = 6; if ((int )start) { __set_bit(0, (unsigned long volatile *)(& accept_flags)); __set_bit(3, (unsigned long volatile *)(& accept_flags)); __set_bit(4, (unsigned long volatile *)(& accept_flags)); __set_bit(6, (unsigned long volatile *)(& accept_flags)); clear_bit(6, (unsigned long volatile *)(& bp->sp_state)); sched_state = 5; } else { clear_bit(5, (unsigned long volatile *)(& bp->sp_state)); } tmp___0 = constant_test_bit(3U, (unsigned long const volatile *)(& bp->sp_state)); if (tmp___0 != 0) { set_bit((unsigned int )sched_state, (unsigned long volatile *)(& bp->sp_state)); } else { __set_bit(1, (unsigned long volatile *)(& ramrod_flags)); bnx2x_set_q_rx_mode(bp, (int )cl_id, 0UL, accept_flags, 0UL, ramrod_flags); } return; } } static int bnx2x_drv_ctl(struct net_device *dev , struct drv_ctl_info *ctl ) { struct bnx2x *bp ; void *tmp ; int rc ; u32 index ; dma_addr_t addr ; int count ; struct cnic_eth_dev *cp ; unsigned long sp_bits ; bool tmp___0 ; int tmp___1 ; unsigned long sp_bits___0 ; bool tmp___2 ; int tmp___3 ; int count___0 ; int ulp_type ; int idx ; u32 cap ; unsigned int tmp___4 ; int path ; int port ; int i ; u32 scratch_offset ; u32 *host_addr ; unsigned int tmp___5 ; int ulp_type___0 ; int idx___0 ; u32 cap___0 ; { tmp = netdev_priv((struct net_device const *)dev); bp = (struct bnx2x *)tmp; rc = 0; switch (ctl->cmd) { case 260: index = ctl->data.io.offset; addr = ctl->data.io.dma_addr; bnx2x_ilt_wr(bp, index, addr); goto ldv_58524; case 261: count = (int )ctl->data.credit.credit_count; bnx2x_cnic_sp_post(bp, count); goto ldv_58524; case 262: cp = & bp->cnic_eth_dev; sp_bits = 0UL; bnx2x_init_mac_obj(bp, & bp->iscsi_l2_mac_obj, (int )((u8 )cp->iscsi_l2_client_id), (u32 )cp->iscsi_l2_cid, (int )bp->pfid, (void *)(& (bp->slowpath)->mac_rdata), bp->slowpath_mapping, 0, & bp->sp_state, 0, & bp->macs_pool); rc = bnx2x_set_iscsi_eth_mac_addr(bp); if (rc != 0) { goto ldv_58524; } else { } __asm__ volatile ("": : : "memory"); __asm__ volatile ("": : : "memory"); netif_addr_lock_bh(dev); bnx2x_set_iscsi_eth_rx_mode(bp, 1); netif_addr_unlock_bh(dev); __set_bit(3, (unsigned long volatile *)(& sp_bits)); __set_bit(5, (unsigned long volatile *)(& sp_bits)); tmp___0 = bnx2x_wait_sp_comp(bp, sp_bits); if (tmp___0) { tmp___1 = 0; } else { tmp___1 = 1; } if (tmp___1) { printk("\vbnx2x: [%s:%d(%s)]rx_mode completion timed out!\n", "bnx2x_drv_ctl", 13341, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } goto ldv_58524; case 263: sp_bits___0 = 0UL; netif_addr_lock_bh(dev); bnx2x_set_iscsi_eth_rx_mode(bp, 0); netif_addr_unlock_bh(dev); __set_bit(3, (unsigned long volatile *)(& sp_bits___0)); __set_bit(6, (unsigned long volatile *)(& sp_bits___0)); tmp___2 = bnx2x_wait_sp_comp(bp, sp_bits___0); if (tmp___2) { tmp___3 = 0; } else { tmp___3 = 1; } if (tmp___3) { printk("\vbnx2x: [%s:%d(%s)]rx_mode completion timed out!\n", "bnx2x_drv_ctl", 13360, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } __asm__ volatile ("": : : "memory"); __asm__ volatile ("": : : "memory"); rc = bnx2x_del_all_macs(bp, & bp->iscsi_l2_mac_obj, 2, 1); goto ldv_58524; case 268: count___0 = (int )ctl->data.credit.credit_count; __asm__ volatile ("": : : "memory"); atomic_add(count___0, & bp->cq_spq_left); __asm__ volatile ("": : : "memory"); goto ldv_58524; case 270: ulp_type = ctl->data.register_data.ulp_type; if (((((((((bp->common.chip_id >> 16 == 5770U || bp->common.chip_id >> 16 == 5797U) || bp->common.chip_id >> 16 == 5801U) || bp->common.chip_id >> 16 == 5774U) || bp->common.chip_id >> 16 == 5806U) || bp->common.chip_id >> 16 == 5807U) || ((bp->common.chip_id >> 16 == 5693U || bp->common.chip_id >> 16 == 5694U) || bp->common.chip_id >> 16 == 5695U)) || ((bp->common.chip_id >> 16 == 5793U || bp->common.chip_id >> 16 == 5794U) || bp->common.chip_id >> 16 == 5773U)) || (bp->common.chip_id >> 16 == 5796U || bp->common.chip_id >> 16 == 5803U)) || bp->common.chip_id >> 16 == 5805U) { idx = ((int )bp->pfid & 1) + ((int )bp->pfid >> 1) * ((bp->common.chip_id >> 16 == 5710U || (bp->common.chip_id >> 16 == 5711U || bp->common.chip_id >> 16 == 5712U)) || (unsigned int )bp->common.chip_port_mode == 0U ? 2 : 1); tmp___4 = readl((void const volatile *)(bp->regview + ((unsigned long )bp->common.shmem2_base + ((unsigned long )idx + 56UL) * 4UL))); cap = tmp___4; path = bp->common.chip_id >> 16 != 5710U && (bp->common.chip_id >> 16 != 5711U && bp->common.chip_id >> 16 != 5712U) ? (int )bp->pf_num & 1 : 0; port = (int )bp->pfid & 1; if (ulp_type == 1) { cap = cap | 8U; } else if (ulp_type == 2) { cap = cap | 4U; } else { } writel(cap, (void volatile *)(bp->regview + ((unsigned long )bp->common.shmem2_base + ((unsigned long )idx + 56UL) * 4UL))); if (ulp_type != 2) { goto ldv_58524; } else if (bp->common.shmem2_base == 0U) { goto ldv_58524; } else { tmp___5 = readl((void const volatile *)bp->regview + (unsigned long )bp->common.shmem2_base); if (tmp___5 <= 196U) { goto ldv_58524; } else if ((bp->flags & 524288U) == 0U) { goto ldv_58524; } else { } } scratch_offset = readl((void const volatile *)(bp->regview + ((unsigned long )bp->common.shmem2_base + 196UL))); if (scratch_offset == 0U) { goto ldv_58524; } else { } scratch_offset = (u32 )(((unsigned long )path * 2UL + (unsigned long )port) + 1UL) * 16U + scratch_offset; host_addr = (u32 *)(& ctl->data.register_data.fcoe_features); i = 0; goto ldv_58545; ldv_58544: writel(*(host_addr + (unsigned long )(i / 4)), (void volatile *)bp->regview + (unsigned long )(scratch_offset + (u32 )i)); i = i + 4; ldv_58545: ; if ((unsigned int )i <= 15U) { goto ldv_58544; } else { } } else { } goto ldv_58524; case 271: ulp_type___0 = ctl->data.ulp_type; if (((((((((bp->common.chip_id >> 16 == 5770U || bp->common.chip_id >> 16 == 5797U) || bp->common.chip_id >> 16 == 5801U) || bp->common.chip_id >> 16 == 5774U) || bp->common.chip_id >> 16 == 5806U) || bp->common.chip_id >> 16 == 5807U) || ((bp->common.chip_id >> 16 == 5693U || bp->common.chip_id >> 16 == 5694U) || bp->common.chip_id >> 16 == 5695U)) || ((bp->common.chip_id >> 16 == 5793U || bp->common.chip_id >> 16 == 5794U) || bp->common.chip_id >> 16 == 5773U)) || (bp->common.chip_id >> 16 == 5796U || bp->common.chip_id >> 16 == 5803U)) || bp->common.chip_id >> 16 == 5805U) { idx___0 = ((int )bp->pfid & 1) + ((int )bp->pfid >> 1) * ((bp->common.chip_id >> 16 == 5710U || (bp->common.chip_id >> 16 == 5711U || bp->common.chip_id >> 16 == 5712U)) || (unsigned int )bp->common.chip_port_mode == 0U ? 2 : 1); cap___0 = readl((void const volatile *)(bp->regview + ((unsigned long )bp->common.shmem2_base + ((unsigned long )idx___0 + 56UL) * 4UL))); if (ulp_type___0 == 1) { cap___0 = cap___0 & 4294967287U; } else if (ulp_type___0 == 2) { cap___0 = cap___0 & 4294967291U; } else { } writel(cap___0, (void volatile *)(bp->regview + ((unsigned long )bp->common.shmem2_base + ((unsigned long )idx___0 + 56UL) * 4UL))); } else { } goto ldv_58524; default: printk("\vbnx2x: [%s:%d(%s)]unknown command %x\n", "bnx2x_drv_ctl", 13436, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", ctl->cmd); rc = -22; } ldv_58524: ; return (rc); } } void bnx2x_setup_cnic_irq_info(struct bnx2x *bp ) { struct cnic_eth_dev *cp ; u8 tmp ; u8 tmp___0 ; { cp = & bp->cnic_eth_dev; if ((bp->flags & 32U) != 0U) { cp->drv_state = cp->drv_state | 2U; cp->irq_arr[0].irq_flags = cp->irq_arr[0].irq_flags | 1U; cp->irq_arr[0].vector = (bp->msix_table + 1UL)->vector; } else { cp->drv_state = cp->drv_state & 4294967293U; cp->irq_arr[0].irq_flags = cp->irq_arr[0].irq_flags & 4294967294U; } if (bp->common.chip_id >> 16 != 5710U && (bp->common.chip_id >> 16 != 5711U && bp->common.chip_id >> 16 != 5712U)) { cp->irq_arr[0].status_blk = (void *)bp->cnic_sb.e2_sb; } else { cp->irq_arr[0].status_blk = (void *)bp->cnic_sb.e1x_sb; } tmp = bnx2x_cnic_fw_sb_id(bp); cp->irq_arr[0].status_blk_num = (u32 )tmp; tmp___0 = bnx2x_cnic_igu_sb_id(bp); cp->irq_arr[0].status_blk_num2 = (u32 )tmp___0; cp->irq_arr[1].status_blk = (void *)bp->def_status_blk; cp->irq_arr[1].status_blk_num = 222U; cp->irq_arr[1].status_blk_num2 = 16U; cp->num_irq = 2; return; } } void bnx2x_setup_cnic_info(struct bnx2x *bp ) { struct cnic_eth_dev *cp ; u16 tmp ; u16 tmp___0 ; { cp = & bp->cnic_eth_dev; tmp = bnx2x_cid_ilt_lines(bp); cp->ctx_tbl_offset = (u32 )((int )bp->pfid * 384 + (int )tmp); tmp___0 = bnx2x_cid_ilt_lines(bp); cp->starting_cid = (u32 )tmp___0 * 32U; cp->fcoe_init_cid = ((uint )bp->num_queues - bp->num_cnic_queues) * (uint )bp->max_cos + 1U; cp->iscsi_l2_cid = (int )((u16 )((uint )bp->num_queues - bp->num_cnic_queues)) * (int )((u16 )bp->max_cos); if ((bp->flags & 8192U) != 0U) { cp->drv_state = cp->drv_state | 4U; } else { } return; } } static int bnx2x_register_cnic(struct net_device *dev , struct cnic_ops *ops , void *data ) { struct bnx2x *bp ; void *tmp ; struct cnic_eth_dev *cp ; int rc ; long tmp___0 ; void *tmp___1 ; { tmp = netdev_priv((struct net_device const *)dev); bp = (struct bnx2x *)tmp; cp = & bp->cnic_eth_dev; tmp___0 = ldv__builtin_expect((bp->msg_enable & 32) != 0, 0L); if (tmp___0 != 0L) { printk("\rbnx2x: [%s:%d(%s)]Register_cnic called\n", "bnx2x_register_cnic", 13491, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } if ((unsigned long )ops == (unsigned long )((struct cnic_ops *)0)) { printk("\vbnx2x: [%s:%d(%s)]NULL ops received\n", "bnx2x_register_cnic", 13494, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); return (-22); } else { } if ((unsigned int )bp->cnic_support == 0U) { printk("\vbnx2x: [%s:%d(%s)]Can\'t register CNIC when not supported\n", "bnx2x_register_cnic", 13499, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); return (-95); } else { } if (! bp->cnic_loaded) { rc = bnx2x_load_cnic(bp); if (rc != 0) { printk("\vbnx2x: [%s:%d(%s)]CNIC-related load failed\n", "bnx2x_register_cnic", 13506, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); return (rc); } else { } } else { } bp->cnic_enabled = 1; tmp___1 = kzalloc(4096UL, 208U); bp->cnic_kwq = (struct eth_spe *)tmp___1; if ((unsigned long )bp->cnic_kwq == (unsigned long )((struct eth_spe *)0)) { return (-12); } else { } bp->cnic_kwq_cons = bp->cnic_kwq; bp->cnic_kwq_prod = bp->cnic_kwq; bp->cnic_kwq_last = bp->cnic_kwq + 255UL; bp->cnic_spq_pending = 0U; bp->cnic_kwq_pending = 0U; bp->cnic_data = data; cp->num_irq = 0; cp->drv_state = cp->drv_state | 1U; cp->iro_arr = (void const *)bp->iro_arr; bnx2x_setup_cnic_irq_info(bp); __asm__ volatile ("": : : "memory"); bp->cnic_ops = ops; return (0); } } static int bnx2x_unregister_cnic(struct net_device *dev ) { struct bnx2x *bp ; void *tmp ; struct cnic_eth_dev *cp ; { tmp = netdev_priv((struct net_device const *)dev); bp = (struct bnx2x *)tmp; cp = & bp->cnic_eth_dev; ldv_mutex_lock_13(& bp->cnic_mutex); cp->drv_state = 0U; bp->cnic_ops = 0; ldv_mutex_unlock_14(& bp->cnic_mutex); synchronize_rcu(); bp->cnic_enabled = 0; kfree((void const *)bp->cnic_kwq); bp->cnic_kwq = 0; return (0); } } struct cnic_eth_dev *bnx2x_cnic_probe(struct net_device *dev ) { struct bnx2x *bp ; void *tmp ; struct cnic_eth_dev *cp ; u16 tmp___0 ; u16 tmp___1 ; u8 tmp___2 ; long tmp___3 ; { tmp = netdev_priv((struct net_device const *)dev); bp = (struct bnx2x *)tmp; cp = & bp->cnic_eth_dev; if ((bp->flags & 16384U) != 0U && (bp->flags & 32768U) != 0U) { return (0); } else { } cp->drv_owner = & __this_module; cp->chip_id = bp->common.chip_id & 4294967280U; cp->pdev = bp->pdev; cp->io_base = bp->regview; cp->io_base2 = bp->doorbells; cp->max_kwqe_pending = 8U; cp->ctx_blk_size = 32768; tmp___0 = bnx2x_cid_ilt_lines(bp); cp->ctx_tbl_offset = (u32 )((int )bp->pfid * 384 + (int )tmp___0); cp->ctx_tbl_len = 72U; tmp___1 = bnx2x_cid_ilt_lines(bp); cp->starting_cid = (u32 )tmp___1 * 32U; cp->drv_submit_kwqes_16 = & bnx2x_cnic_sp_queue; cp->drv_ctl = & bnx2x_drv_ctl; cp->drv_register_cnic = & bnx2x_register_cnic; cp->drv_unregister_cnic = & bnx2x_unregister_cnic; cp->fcoe_init_cid = ((uint )bp->num_queues - bp->num_cnic_queues) * (uint )bp->max_cos + 1U; tmp___2 = bnx2x_cnic_eth_cl_id(bp, 0); cp->iscsi_l2_client_id = (u16 )tmp___2; cp->iscsi_l2_cid = (int )((u16 )((uint )bp->num_queues - bp->num_cnic_queues)) * (int )((u16 )bp->max_cos); if ((bp->flags & 8192U) != 0U) { cp->drv_state = cp->drv_state | 4U; } else { } if ((bp->flags & 16384U) != 0U) { cp->drv_state = cp->drv_state | 8U; } else { } if ((bp->flags & 32768U) != 0U) { cp->drv_state = cp->drv_state | 16U; } else { } tmp___3 = ldv__builtin_expect((bp->msg_enable & 2) != 0, 0L); if (tmp___3 != 0L) { _dev_info((struct device const *)(& (bp->pdev)->dev), "page_size %d, tbl_offset %d, tbl_lines %d, starting cid %d\n", cp->ctx_blk_size, cp->ctx_tbl_offset, cp->ctx_tbl_len, cp->starting_cid); } else { } return (cp); } } u32 bnx2x_rx_ustorm_prods_offset(struct bnx2x_fastpath *fp ) { struct bnx2x *bp ; u32 offset ; int tmp ; { bp = fp->bp; offset = 4194304U; if ((bp->flags & 4194304U) != 0U) { tmp = bnx2x_vf_ustorm_prods_offset(bp, fp); return ((u32 )tmp); } else if (bp->common.chip_id >> 16 != 5710U && (bp->common.chip_id >> 16 != 5711U && bp->common.chip_id >> 16 != 5712U)) { offset = ((unsigned int )(bp->iro_arr + 210UL)->base + (unsigned int )((int )fp->cl_qzone_id * (int )(bp->iro_arr + 210UL)->m1)) + offset; } else { offset = ((unsigned int )(bp->iro_arr + 209UL)->base + ((unsigned int )((int )fp->cl_id * (int )(bp->iro_arr + 209UL)->m2) + (unsigned int )(((int )bp->pfid & 1) * (int )(bp->iro_arr + 209UL)->m1))) + offset; } return (offset); } } int bnx2x_pretend_func(struct bnx2x *bp , u16 pretend_func_val ) { u32 pretend_reg ; { if ((bp->common.chip_id >> 16 == 5711U || bp->common.chip_id >> 16 == 5712U) && (unsigned int )pretend_func_val > 7U) { return (-1); } else { } pretend_reg = bnx2x_get_pretend_reg(bp); writel((unsigned int )pretend_func_val, (void volatile *)bp->regview + (unsigned long )pretend_reg); readl((void const volatile *)bp->regview + (unsigned long )pretend_reg); return (0); } } void ldv_check_final_state(void) ; extern void ldv_check_return_value(int ) ; extern void ldv_check_return_value_probe(int ) ; void ldv_initialize(void) ; extern void ldv_handler_precall(void) ; extern int __VERIFIER_nondet_int(void) ; int LDV_IN_INTERRUPT ; int main(void) { struct net_device *var_group1 ; int res_bnx2x_open_261 ; int res_bnx2x_close_262 ; struct ifreq *var_group2 ; int var_bnx2x_ioctl_270_p2 ; struct bnx2x *var_group3 ; struct pci_dev *var_group4 ; pci_channel_state_t var_bnx2x_io_error_detected_292_p1 ; struct pci_device_id const *var_bnx2x_init_one_288_p1 ; int res_bnx2x_init_one_288 ; int var_bnx2x_interrupt_45_p0 ; void *var_bnx2x_interrupt_45_p1 ; int var_bnx2x_msix_sp_int_136_p0 ; void *var_bnx2x_msix_sp_int_136_p1 ; unsigned long var_bnx2x_timer_138_p0 ; int ldv_s_bnx2x_netdev_ops_net_device_ops ; int ldv_s_bnx2x_pci_driver_pci_driver ; int tmp ; int tmp___0 ; int tmp___1 ; { ldv_s_bnx2x_netdev_ops_net_device_ops = 0; ldv_s_bnx2x_pci_driver_pci_driver = 0; LDV_IN_INTERRUPT = 1; ldv_initialize(); ldv_handler_precall(); tmp = bnx2x_init(); if (tmp != 0) { goto ldv_final; } else { } goto ldv_58652; ldv_58651: tmp___0 = __VERIFIER_nondet_int(); switch (tmp___0) { case 0: ; if (ldv_s_bnx2x_netdev_ops_net_device_ops == 0) { ldv_handler_precall(); res_bnx2x_open_261 = bnx2x_open(var_group1); ldv_check_return_value(res_bnx2x_open_261); if (res_bnx2x_open_261 < 0) { goto ldv_module_exit; } else { } ldv_s_bnx2x_netdev_ops_net_device_ops = ldv_s_bnx2x_netdev_ops_net_device_ops + 1; } else { } goto ldv_58625; case 1: ; if (ldv_s_bnx2x_netdev_ops_net_device_ops == 1) { ldv_handler_precall(); res_bnx2x_close_262 = bnx2x_close(var_group1); ldv_check_return_value(res_bnx2x_close_262); if (res_bnx2x_close_262 != 0) { goto ldv_module_exit; } else { } ldv_s_bnx2x_netdev_ops_net_device_ops = 0; } else { } goto ldv_58625; case 2: ldv_handler_precall(); bnx2x_set_rx_mode(var_group1); goto ldv_58625; case 3: ldv_handler_precall(); bnx2x_validate_addr(var_group1); goto ldv_58625; case 4: ldv_handler_precall(); bnx2x_ioctl(var_group1, var_group2, var_bnx2x_ioctl_270_p2); goto ldv_58625; case 5: ldv_handler_precall(); poll_bnx2x(var_group1); goto ldv_58625; case 6: ldv_handler_precall(); bnx2x_init_hw_common_chip(var_group3); goto ldv_58625; case 7: ldv_handler_precall(); bnx2x_init_hw_common(var_group3); goto ldv_58625; case 8: ldv_handler_precall(); bnx2x_init_hw_port(var_group3); goto ldv_58625; case 9: ldv_handler_precall(); bnx2x_init_hw_func(var_group3); goto ldv_58625; case 10: ldv_handler_precall(); bnx2x_reset_common(var_group3); goto ldv_58625; case 11: ldv_handler_precall(); bnx2x_reset_port(var_group3); goto ldv_58625; case 12: ldv_handler_precall(); bnx2x_reset_func(var_group3); goto ldv_58625; case 13: ldv_handler_precall(); bnx2x_gunzip_init(var_group3); goto ldv_58625; case 14: ldv_handler_precall(); bnx2x_gunzip_end(var_group3); goto ldv_58625; case 15: ldv_handler_precall(); bnx2x_init_firmware(var_group3); goto ldv_58625; case 16: ldv_handler_precall(); bnx2x_release_firmware(var_group3); goto ldv_58625; case 17: ldv_handler_precall(); bnx2x_io_error_detected(var_group4, var_bnx2x_io_error_detected_292_p1); goto ldv_58625; case 18: ldv_handler_precall(); bnx2x_io_slot_reset(var_group4); goto ldv_58625; case 19: ldv_handler_precall(); bnx2x_io_resume(var_group4); goto ldv_58625; case 20: ; if (ldv_s_bnx2x_pci_driver_pci_driver == 0) { res_bnx2x_init_one_288 = bnx2x_init_one(var_group4, var_bnx2x_init_one_288_p1); ldv_check_return_value(res_bnx2x_init_one_288); ldv_check_return_value_probe(res_bnx2x_init_one_288); if (res_bnx2x_init_one_288 != 0) { goto ldv_module_exit; } else { } ldv_s_bnx2x_pci_driver_pci_driver = ldv_s_bnx2x_pci_driver_pci_driver + 1; } else { } goto ldv_58625; case 21: ; if (ldv_s_bnx2x_pci_driver_pci_driver == 1) { ldv_handler_precall(); bnx2x_remove_one(var_group4); ldv_s_bnx2x_pci_driver_pci_driver = 0; } else { } goto ldv_58625; case 22: LDV_IN_INTERRUPT = 2; ldv_handler_precall(); bnx2x_interrupt(var_bnx2x_interrupt_45_p0, var_bnx2x_interrupt_45_p1); LDV_IN_INTERRUPT = 1; goto ldv_58625; case 23: LDV_IN_INTERRUPT = 2; ldv_handler_precall(); bnx2x_msix_sp_int(var_bnx2x_msix_sp_int_136_p0, var_bnx2x_msix_sp_int_136_p1); LDV_IN_INTERRUPT = 1; goto ldv_58625; case 24: ldv_handler_precall(); bnx2x_timer(var_bnx2x_timer_138_p0); goto ldv_58625; default: ; goto ldv_58625; } ldv_58625: ; ldv_58652: tmp___1 = __VERIFIER_nondet_int(); if ((tmp___1 != 0 || ldv_s_bnx2x_netdev_ops_net_device_ops != 0) || ldv_s_bnx2x_pci_driver_pci_driver != 0) { goto ldv_58651; } else { } ldv_module_exit: ldv_handler_precall(); bnx2x_cleanup(); 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_9(struct mutex *ldv_func_arg1 ) { { ldv_mutex_lock_fw_mb_mutex_of_bnx2x(ldv_func_arg1); mutex_lock(ldv_func_arg1); return; } } void ldv_mutex_unlock_10(struct mutex *ldv_func_arg1 ) { { ldv_mutex_unlock_fw_mb_mutex_of_bnx2x(ldv_func_arg1); mutex_unlock(ldv_func_arg1); return; } } void ldv_mutex_lock_11(struct mutex *ldv_func_arg1 ) { { ldv_mutex_lock_cnic_mutex_of_bnx2x(ldv_func_arg1); mutex_lock(ldv_func_arg1); return; } } void ldv_mutex_unlock_12(struct mutex *ldv_func_arg1 ) { { ldv_mutex_unlock_cnic_mutex_of_bnx2x(ldv_func_arg1); mutex_unlock(ldv_func_arg1); return; } } void ldv_mutex_lock_13(struct mutex *ldv_func_arg1 ) { { ldv_mutex_lock_cnic_mutex_of_bnx2x(ldv_func_arg1); mutex_lock(ldv_func_arg1); return; } } void ldv_mutex_unlock_14(struct mutex *ldv_func_arg1 ) { { ldv_mutex_unlock_cnic_mutex_of_bnx2x(ldv_func_arg1); mutex_unlock(ldv_func_arg1); return; } } int ldv_mutex_trylock_32(struct mutex *ldv_func_arg1 ) ; void ldv_mutex_unlock_30(struct mutex *ldv_func_arg1 ) ; void ldv_mutex_unlock_33(struct mutex *ldv_func_arg1 ) ; void ldv_mutex_lock_29(struct mutex *ldv_func_arg1 ) ; void ldv_mutex_lock_31(struct mutex *ldv_func_arg1 ) ; int bnx2x_get_ext_phy_fw_version(struct link_params *params , u8 *version___0 , u16 len ) ; int bnx2x_set_led(struct link_params *params , struct link_vars *vars , u8 mode , u32 speed ) ; void bnx2x_ext_phy_hw_reset(struct bnx2x *bp , u8 port ) ; void bnx2x_sfx7101_sp_sw_reset(struct bnx2x *bp , struct bnx2x_phy *phy ) ; int bnx2x_read_sfp_module_eeprom(struct bnx2x_phy *phy , struct link_params *params , u8 dev_addr , u16 addr , u16 byte_cnt , u8 *o_buf ) ; u32 bnx2x_phy_selection(struct link_params *params ) ; int bnx2x_update_pfc(struct link_params *params , struct link_vars *vars , struct bnx2x_nig_brb_pfc_port_params *pfc_params ) ; int bnx2x_ets_disabled(struct link_params *params , struct link_vars *vars ) ; void bnx2x_ets_bw_limit(struct link_params const *params , u32 const cos0_bw , u32 const cos1_bw ) ; int bnx2x_ets_strict(struct link_params const *params , u8 const strict_cos ) ; int bnx2x_ets_e3b0_config(struct link_params const *params , struct link_vars const *vars , struct bnx2x_ets_params *ets_params ) ; void bnx2x_pfc_statistic(struct link_params *params , struct link_vars *vars , u32 *pfc_frames_sent , u32 *pfc_frames_received ) ; int bnx2x_sfp_module_detection(struct bnx2x_phy *phy , struct link_params *params ) ; int bnx2x_check_half_open_conn(struct link_params *params , struct link_vars *vars , u8 notify ) ; static u32 bnx2x_bits_en(struct bnx2x *bp , u32 reg , u32 bits ) { u32 val ; unsigned int tmp ; { tmp = readl((void const volatile *)bp->regview + (unsigned long )reg); val = tmp; val = val | bits; writel(val, (void volatile *)bp->regview + (unsigned long )reg); return (val); } } static u32 bnx2x_bits_dis(struct bnx2x *bp , u32 reg , u32 bits ) { u32 val ; unsigned int tmp ; { tmp = readl((void const volatile *)bp->regview + (unsigned long )reg); val = tmp; val = ~ bits & val; writel(val, (void volatile *)bp->regview + (unsigned long )reg); return (val); } } static int bnx2x_check_lfa(struct link_params *params ) { u32 link_status ; u32 cfg_idx ; u32 lfa_mask ; u32 cfg_size ; u32 cur_speed_cap_mask ; u32 cur_req_fc_auto_adv ; u32 additional_config ; u32 saved_val ; u32 req_val ; u32 eee_status ; struct bnx2x *bp ; long tmp ; long tmp___0 ; long tmp___1 ; long tmp___2 ; long tmp___3 ; unsigned int tmp___4 ; long tmp___5 ; long tmp___6 ; { bp = params->bp; additional_config = readl((void const volatile *)(bp->regview + ((unsigned long )params->lfa_base + 20UL))); if ((additional_config & 65536U) != 0U) { tmp = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp != 0L) { printk("\rbnx2x: [%s:%d(%s)]No LFA due to DCC flap after clp exit\n", "bnx2x_check_lfa", 320, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } writel(additional_config & 4294901759U, (void volatile *)(bp->regview + ((unsigned long )params->lfa_base + 20UL))); return (8); } else { } link_status = readl((void const volatile *)(bp->regview + (((unsigned long )params->shmem_base + (unsigned long )params->port * 16UL) + 1636UL))); if ((link_status & 1U) == 0U) { return (1); } else { } if ((params->feature_config_flags & 16384U) != 0U) { return (0); } else { } if ((unsigned int )params->loopback_mode != 0U) { return (2); } else { } if (params->lfa_base == 0U) { return (4); } else { } if ((unsigned int )params->num_phys == 3U) { cfg_size = 2U; lfa_mask = 4294967295U; } else { cfg_size = 1U; lfa_mask = 65535U; } saved_val = readl((void const volatile *)bp->regview + (unsigned long )params->lfa_base); req_val = (u32 )((int )params->req_duplex[0] | ((int )params->req_duplex[1] << 16)); if (((saved_val ^ req_val) & lfa_mask) != 0U) { tmp___0 = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp___0 != 0L) { printk("\rbnx2x: [%s:%d(%s)]Duplex mismatch %x vs. %x\n", "bnx2x_check_lfa", 362, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", saved_val & lfa_mask, req_val & lfa_mask); } else { } return (3); } else { } saved_val = readl((void const volatile *)(bp->regview + ((unsigned long )params->lfa_base + 4UL))); req_val = (u32 )((int )params->req_flow_ctrl[0] | ((int )params->req_flow_ctrl[1] << 16)); if (((saved_val ^ req_val) & lfa_mask) != 0U) { tmp___1 = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp___1 != 0L) { printk("\rbnx2x: [%s:%d(%s)]Flow control mismatch %x vs. %x\n", "bnx2x_check_lfa", 371, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", saved_val & lfa_mask, req_val & lfa_mask); } else { } return (6); } else { } saved_val = readl((void const volatile *)(bp->regview + ((unsigned long )params->lfa_base + 8UL))); req_val = (u32 )((int )params->req_line_speed[0] | ((int )params->req_line_speed[1] << 16)); if (((saved_val ^ req_val) & lfa_mask) != 0U) { tmp___2 = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp___2 != 0L) { printk("\rbnx2x: [%s:%d(%s)]Link speed mismatch %x vs. %x\n", "bnx2x_check_lfa", 380, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", saved_val & lfa_mask, req_val & lfa_mask); } else { } return (5); } else { } cfg_idx = 0U; goto ldv_45047; ldv_45046: cur_speed_cap_mask = readl((void const volatile *)(bp->regview + ((unsigned long )params->lfa_base + ((unsigned long )cfg_idx + 3UL) * 4UL))); if (params->speed_cap_mask[cfg_idx] != cur_speed_cap_mask) { tmp___3 = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp___3 != 0L) { printk("\rbnx2x: [%s:%d(%s)]Speed Cap mismatch %x vs. %x\n", "bnx2x_check_lfa", 392, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", cur_speed_cap_mask, params->speed_cap_mask[cfg_idx]); } else { } return (7); } else { } cfg_idx = cfg_idx + 1U; ldv_45047: ; if (cfg_idx < cfg_size) { goto ldv_45046; } else { } tmp___4 = readl((void const volatile *)(bp->regview + ((unsigned long )params->lfa_base + 20UL))); cur_req_fc_auto_adv = tmp___4 & 65535U; if ((int )((unsigned short )cur_req_fc_auto_adv) != (int )params->req_fc_auto_adv) { tmp___5 = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp___5 != 0L) { printk("\rbnx2x: [%s:%d(%s)]Flow Ctrl AN mismatch %x vs. %x\n", "bnx2x_check_lfa", 404, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", cur_req_fc_auto_adv, (int )params->req_fc_auto_adv); } else { } return (6); } else { } eee_status = readl((void const volatile *)(bp->regview + ((unsigned long )params->shmem2_base + ((unsigned long )params->port + 76UL) * 4UL))); if ((eee_status & 536870912U) != (params->eee_mode & 1073741824U) || (eee_status & 268435456U) != (params->eee_mode & 2147483648U)) { tmp___6 = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp___6 != 0L) { printk("\rbnx2x: [%s:%d(%s)]EEE mismatch %x vs. %x\n", "bnx2x_check_lfa", 417, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", params->eee_mode, eee_status); } else { } return (9); } else { } return (0); } } static void bnx2x_get_epio(struct bnx2x *bp , u32 epio_pin , u32 *en ) { u32 epio_mask ; u32 gp_oenable ; long tmp ; unsigned int tmp___0 ; { *en = 0U; if (epio_pin > 31U) { tmp = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp != 0L) { printk("\rbnx2x: [%s:%d(%s)]Invalid EPIO pin %d to get\n", "bnx2x_get_epio", 433, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", epio_pin); } else { } return; } else { } epio_mask = (u32 )(1 << (int )epio_pin); gp_oenable = readl((void const volatile *)bp->regview + 524488U); writel(~ epio_mask & gp_oenable, (void volatile *)bp->regview + 524488U); tmp___0 = readl((void const volatile *)bp->regview + 524480U); *en = (tmp___0 & epio_mask) >> (int )epio_pin; return; } } static void bnx2x_set_epio(struct bnx2x *bp , u32 epio_pin , u32 en ) { u32 epio_mask ; u32 gp_output ; u32 gp_oenable ; long tmp ; long tmp___0 ; { if (epio_pin > 31U) { tmp = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp != 0L) { printk("\rbnx2x: [%s:%d(%s)]Invalid EPIO pin %d to set\n", "bnx2x_set_epio", 450, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", epio_pin); } else { } return; } else { } tmp___0 = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp___0 != 0L) { printk("\rbnx2x: [%s:%d(%s)]Setting EPIO pin %d to %d\n", "bnx2x_set_epio", 453, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", epio_pin, en); } else { } epio_mask = (u32 )(1 << (int )epio_pin); gp_output = readl((void const volatile *)bp->regview + 524484U); if (en != 0U) { gp_output = gp_output | epio_mask; } else { gp_output = ~ epio_mask & gp_output; } writel(gp_output, (void volatile *)bp->regview + 524484U); gp_oenable = readl((void const volatile *)bp->regview + 524488U); writel(gp_oenable | epio_mask, (void volatile *)bp->regview + 524488U); return; } } static void bnx2x_set_cfg_pin(struct bnx2x *bp , u32 pin_cfg , u32 val ) { u8 gpio_num ; u8 gpio_port ; { if (pin_cfg == 0U) { return; } else { } if (pin_cfg > 8U) { bnx2x_set_epio(bp, pin_cfg - 9U, val); } else { gpio_num = ((unsigned int )((u8 )pin_cfg) - 1U) & 3U; gpio_port = (u8 )((pin_cfg - 1U) >> 2); bnx2x_set_gpio(bp, (int )gpio_num, (u32 )((unsigned char )val), (int )gpio_port); } return; } } static u32 bnx2x_get_cfg_pin(struct bnx2x *bp , u32 pin_cfg , u32 *val ) { u8 gpio_num ; u8 gpio_port ; int tmp ; { if (pin_cfg == 0U) { return (4294967274U); } else { } if (pin_cfg > 8U) { bnx2x_get_epio(bp, pin_cfg - 9U, val); } else { gpio_num = ((unsigned int )((u8 )pin_cfg) - 1U) & 3U; gpio_port = (u8 )((pin_cfg - 1U) >> 2); tmp = bnx2x_get_gpio(bp, (int )gpio_num, (int )gpio_port); *val = (u32 )tmp; } return (0U); } } static void bnx2x_ets_e2e3a0_disabled(struct link_params *params ) { struct bnx2x *bp ; long tmp ; { bp = params->bp; tmp = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp != 0L) { printk("\rbnx2x: [%s:%d(%s)]ETS E2E3 disabled configuration\n", "bnx2x_ets_e2e3a0_disabled", 504, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } writel(18056U, (void volatile *)bp->regview + 98532U); writel(7U, (void volatile *)bp->regview + 98536U); writel(0U, (void volatile *)bp->regview + 98540U); writel(256U, (void volatile *)bp->regview + 98548U); writel(0U, (void volatile *)bp->regview + 98544U); writel(0U, (void volatile *)bp->regview + 98552U); writel(0U, (void volatile *)bp->regview + 98556U); writel(0U, (void volatile *)bp->regview + 98572U); writel(0U, (void volatile *)bp->regview + 98576U); writel(0U, (void volatile *)bp->regview + 1425484U); writel(0U, (void volatile *)bp->regview + 1425488U); writel(10000U, (void volatile *)bp->regview + 1425492U); writel(10000U, (void volatile *)bp->regview + 1425496U); writel(10000000U, (void volatile *)bp->regview + 1425500U); writel(10000000U, (void volatile *)bp->regview + 1425504U); writel(0U, (void volatile *)bp->regview + 1425508U); return; } } static u32 bnx2x_ets_get_min_w_val_nig(struct link_vars const *vars ) { u32 min_w_val ; { min_w_val = 0U; if ((unsigned int )((unsigned char )vars->link_up) != 0U) { if ((unsigned int )((unsigned short )vars->line_speed) == 20000U) { min_w_val = 2720U; } else { min_w_val = 1360U; } } else { min_w_val = 2720U; } return (min_w_val); } } static u32 bnx2x_ets_get_credit_upper_bound(u32 const min_w_val ) { u32 credit_upper_bound ; { credit_upper_bound = 9700U > (unsigned int )min_w_val * 150U ? 9700U : (unsigned int )min_w_val * 150U; return (credit_upper_bound); } } static void bnx2x_ets_e3b0_set_credit_upper_bound_nig(struct link_params const *params , u32 const min_w_val ) { struct bnx2x *bp ; u8 port ; u32 credit_upper_bound ; u32 tmp ; { bp = params->bp; port = params->port; tmp = bnx2x_ets_get_credit_upper_bound(min_w_val); credit_upper_bound = tmp; writel(credit_upper_bound, (void volatile *)(bp->regview + ((unsigned int )port != 0U ? 98904UL : 98572UL))); writel(credit_upper_bound, (void volatile *)(bp->regview + ((unsigned int )port != 0U ? 98908UL : 98576UL))); writel(credit_upper_bound, (void volatile *)(bp->regview + ((unsigned int )port != 0U ? 98912UL : 98580UL))); writel(credit_upper_bound, (void volatile *)(bp->regview + ((unsigned int )port != 0U ? 98916UL : 98584UL))); writel(credit_upper_bound, (void volatile *)(bp->regview + ((unsigned int )port != 0U ? 98920UL : 98588UL))); writel(credit_upper_bound, (void volatile *)(bp->regview + ((unsigned int )port != 0U ? 100084UL : 100000UL))); if ((unsigned int )port == 0U) { writel(credit_upper_bound, (void volatile *)bp->regview + 100004U); writel(credit_upper_bound, (void volatile *)bp->regview + 100008U); writel(credit_upper_bound, (void volatile *)bp->regview + 100012U); } else { } return; } } static void bnx2x_ets_e3b0_nig_disabled(struct link_params const *params , struct link_vars const *vars ) { struct bnx2x *bp ; u8 port ; u32 min_w_val ; u32 tmp ; { bp = params->bp; port = params->port; tmp = bnx2x_ets_get_min_w_val_nig(vars); min_w_val = tmp; if ((unsigned int )port != 0U) { writel(5517840U, (void volatile *)bp->regview + 100064U); writel(0U, (void volatile *)bp->regview + 100068U); } else { writel(1985229328U, (void volatile *)bp->regview + 99968U); writel(8U, (void volatile *)bp->regview + 99972U); } writel(256U, (void volatile *)bp->regview + 98880U); if ((unsigned int )port != 0U) { writel(2164035U, (void volatile *)bp->regview + 100072U); writel(0U, (void volatile *)bp->regview + 100076U); } else { writel(1126238326U, (void volatile *)bp->regview + 99976U); writel(5U, (void volatile *)bp->regview + 99980U); } if ((unsigned int )port != 0U) { writel(63U, (void volatile *)bp->regview + 98868U); } else { writel(511U, (void volatile *)bp->regview + 98536U); } writel(0U, (void volatile *)(bp->regview + ((unsigned int )port != 0U ? 98872UL : 98540UL))); writel(0U, (void volatile *)(bp->regview + ((unsigned int )port != 0U ? 98884UL : 98552UL))); writel(0U, (void volatile *)(bp->regview + ((unsigned int )port != 0U ? 98888UL : 98556UL))); writel(0U, (void volatile *)(bp->regview + ((unsigned int )port != 0U ? 98892UL : 98560UL))); writel(0U, (void volatile *)(bp->regview + ((unsigned int )port != 0U ? 98896UL : 98564UL))); writel(0U, (void volatile *)(bp->regview + ((unsigned int )port != 0U ? 98900UL : 98568UL))); writel(0U, (void volatile *)(bp->regview + ((unsigned int )port != 0U ? 100080UL : 99984UL))); if ((unsigned int )port == 0U) { writel(0U, (void volatile *)bp->regview + 99988U); writel(0U, (void volatile *)bp->regview + 99992U); writel(0U, (void volatile *)bp->regview + 99996U); } else { } bnx2x_ets_e3b0_set_credit_upper_bound_nig(params, min_w_val); return; } } static void bnx2x_ets_e3b0_set_credit_upper_bound_pbf(struct link_params const *params , u32 const min_w_val ) { struct bnx2x *bp ; u32 credit_upper_bound ; u32 tmp ; u8 port ; u32 base_upper_bound ; u8 max_cos ; u8 i ; { bp = params->bp; tmp = bnx2x_ets_get_credit_upper_bound(min_w_val); credit_upper_bound = tmp; port = params->port; base_upper_bound = 0U; max_cos = 0U; i = 0U; if ((unsigned int )port == 0U) { base_upper_bound = 1426124U; max_cos = 6U; } else { base_upper_bound = 1426148U; max_cos = 3U; } i = 0U; goto ldv_45118; ldv_45117: writel(credit_upper_bound, (void volatile *)bp->regview + (unsigned long )((u32 )((int )i << 2) + base_upper_bound)); i = (u8 )((int )i + 1); ldv_45118: ; if ((int )i < (int )max_cos) { goto ldv_45117; } else { } return; } } static void bnx2x_ets_e3b0_pbf_disabled(struct link_params const *params ) { struct bnx2x *bp ; u8 port ; u32 min_w_val_pbf ; u8 i ; u32 base_weight ; u8 max_cos ; { bp = params->bp; port = params->port; min_w_val_pbf = 10000U; i = 0U; base_weight = 0U; max_cos = 0U; if ((unsigned int )port != 0U) { writel(1672U, (void volatile *)bp->regview + 1426036U); } else { writel(181896U, (void volatile *)bp->regview + 1426032U); } if ((unsigned int )port != 0U) { writel(1672U, (void volatile *)bp->regview + 1426060U); } else { writel(181896U, (void volatile *)bp->regview + 1426056U); } writel(256U, (void volatile *)(bp->regview + ((unsigned int )port != 0U ? 1426084UL : 1426080UL))); writel(0U, (void volatile *)(bp->regview + ((unsigned int )port != 0U ? 1426044UL : 1426040UL))); writel(0U, (void volatile *)(bp->regview + ((unsigned int )port != 0U ? 1426052UL : 1426048UL))); if ((unsigned int )port == 0U) { base_weight = 1426088U; max_cos = 6U; } else { base_weight = 1426112U; max_cos = 3U; } i = 0U; goto ldv_45130; ldv_45129: writel(0U, (void volatile *)bp->regview + (unsigned long )((u32 )((int )i * 4) + base_weight)); i = (u8 )((int )i + 1); ldv_45130: ; if ((int )i < (int )max_cos) { goto ldv_45129; } else { } bnx2x_ets_e3b0_set_credit_upper_bound_pbf(params, min_w_val_pbf); return; } } static int bnx2x_ets_e3b0_disabled(struct link_params const *params , struct link_vars const *vars ) { struct bnx2x *bp ; long tmp ; { bp = params->bp; if ((((((((((bp->common.chip_id >> 16 != 5770U && bp->common.chip_id >> 16 != 5797U) && bp->common.chip_id >> 16 != 5801U) && bp->common.chip_id >> 16 != 5774U) && bp->common.chip_id >> 16 != 5806U) && bp->common.chip_id >> 16 != 5807U) && ((bp->common.chip_id >> 16 != 5693U && bp->common.chip_id >> 16 != 5694U) && bp->common.chip_id >> 16 != 5695U)) && ((bp->common.chip_id >> 16 != 5793U && bp->common.chip_id >> 16 != 5794U) && bp->common.chip_id >> 16 != 5773U)) && (bp->common.chip_id >> 16 != 5796U && bp->common.chip_id >> 16 != 5803U)) && bp->common.chip_id >> 16 != 5805U) || ((bp->common.chip_id & 61440U) > 20480U ? ((~ bp->common.chip_id & 61440U) >> 13) << 12 != 4096U : (bp->common.chip_id & 61440U) != 4096U)) { tmp = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp != 0L) { printk("\rbnx2x: [%s:%d(%s)]bnx2x_ets_e3b0_disabled the chip isn\'t E3B0\n", "bnx2x_ets_e3b0_disabled", 810, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } return (-22); } else { } bnx2x_ets_e3b0_nig_disabled(params, vars); bnx2x_ets_e3b0_pbf_disabled(params); return (0); } } int bnx2x_ets_disabled(struct link_params *params , struct link_vars *vars ) { struct bnx2x *bp ; int bnx2x_status ; long tmp ; { bp = params->bp; bnx2x_status = 0; if (((bp->common.chip_id >> 16 == 5730U || bp->common.chip_id >> 16 == 5731U) || bp->common.chip_id >> 16 == 5743U) || ((((((((((bp->common.chip_id >> 16 == 5770U || bp->common.chip_id >> 16 == 5797U) || bp->common.chip_id >> 16 == 5801U) || bp->common.chip_id >> 16 == 5774U) || bp->common.chip_id >> 16 == 5806U) || bp->common.chip_id >> 16 == 5807U) || ((bp->common.chip_id >> 16 == 5693U || bp->common.chip_id >> 16 == 5694U) || bp->common.chip_id >> 16 == 5695U)) || ((bp->common.chip_id >> 16 == 5793U || bp->common.chip_id >> 16 == 5794U) || bp->common.chip_id >> 16 == 5773U)) || (bp->common.chip_id >> 16 == 5796U || bp->common.chip_id >> 16 == 5803U)) || bp->common.chip_id >> 16 == 5805U) && ((bp->common.chip_id & 61440U) > 20480U ? ((~ bp->common.chip_id & 61440U) >> 13) << 12 == 0U : (bp->common.chip_id & 61440U) == 0U))) { bnx2x_ets_e2e3a0_disabled(params); } else if ((((((((((bp->common.chip_id >> 16 == 5770U || bp->common.chip_id >> 16 == 5797U) || bp->common.chip_id >> 16 == 5801U) || bp->common.chip_id >> 16 == 5774U) || bp->common.chip_id >> 16 == 5806U) || bp->common.chip_id >> 16 == 5807U) || ((bp->common.chip_id >> 16 == 5693U || bp->common.chip_id >> 16 == 5694U) || bp->common.chip_id >> 16 == 5695U)) || ((bp->common.chip_id >> 16 == 5793U || bp->common.chip_id >> 16 == 5794U) || bp->common.chip_id >> 16 == 5773U)) || (bp->common.chip_id >> 16 == 5796U || bp->common.chip_id >> 16 == 5803U)) || bp->common.chip_id >> 16 == 5805U) && ((bp->common.chip_id & 61440U) > 20480U ? ((~ bp->common.chip_id & 61440U) >> 13) << 12 == 4096U : (bp->common.chip_id & 61440U) == 4096U)) { bnx2x_status = bnx2x_ets_e3b0_disabled((struct link_params const *)params, (struct link_vars const *)vars); } else { tmp = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp != 0L) { printk("\rbnx2x: [%s:%d(%s)]bnx2x_ets_disabled - chip not supported\n", "bnx2x_ets_disabled", 837, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } return (-22); } return (bnx2x_status); } } static int bnx2x_ets_e3b0_cli_map(struct link_params const *params , struct bnx2x_ets_params const *ets_params , u8 const cos_sp_bitmap , u8 const cos_bw_bitmap ) { struct bnx2x *bp ; u8 port ; u8 nig_cli_sp_bitmap ; u8 pbf_cli_sp_bitmap ; u8 nig_cli_subject2wfq_bitmap ; u8 pbf_cli_subject2wfq_bitmap ; { bp = params->bp; port = params->port; nig_cli_sp_bitmap = (u8 const )((int )((signed char )((int )cos_sp_bitmap << 3)) | 7); pbf_cli_sp_bitmap = cos_sp_bitmap; nig_cli_subject2wfq_bitmap = (int const )cos_bw_bitmap << 3U; pbf_cli_subject2wfq_bitmap = cos_bw_bitmap; writel((unsigned int )nig_cli_sp_bitmap, (void volatile *)(bp->regview + ((unsigned int )port != 0U ? 98868UL : 98536UL))); writel((unsigned int )pbf_cli_sp_bitmap, (void volatile *)(bp->regview + ((unsigned int )port != 0U ? 1426044UL : 1426040UL))); writel((unsigned int )nig_cli_subject2wfq_bitmap, (void volatile *)(bp->regview + ((unsigned int )port != 0U ? 98872UL : 98540UL))); writel((unsigned int )pbf_cli_subject2wfq_bitmap, (void volatile *)(bp->regview + ((unsigned int )port != 0U ? 1426052UL : 1426048UL))); return (0); } } static int bnx2x_ets_e3b0_set_cos_bw(struct bnx2x *bp , u8 const cos_entry , u32 const min_w_val_nig , u32 const min_w_val_pbf , u16 const total_bw , u8 const bw , u8 const port ) { u32 nig_reg_adress_crd_weight ; u32 pbf_reg_adress_crd_weight ; u32 cos_bw_nig ; u32 cos_bw_pbf ; { nig_reg_adress_crd_weight = 0U; pbf_reg_adress_crd_weight = 0U; cos_bw_nig = (((unsigned int )((unsigned char )bw) != 0U ? (unsigned int )bw : 1U) * (unsigned int )min_w_val_nig) / (unsigned int )total_bw; cos_bw_pbf = (((unsigned int )((unsigned char )bw) != 0U ? (unsigned int )bw : 1U) * (unsigned int )min_w_val_pbf) / (unsigned int )total_bw; switch ((int )cos_entry) { case 0: nig_reg_adress_crd_weight = (unsigned int )((unsigned char )port) != 0U ? 98884U : 98552U; pbf_reg_adress_crd_weight = (unsigned int )((unsigned char )port) != 0U ? 1426112U : 1426088U; goto ldv_45171; case 1: nig_reg_adress_crd_weight = (unsigned int )((unsigned char )port) != 0U ? 98888U : 98556U; pbf_reg_adress_crd_weight = (unsigned int )((unsigned char )port) != 0U ? 1426116U : 1426092U; goto ldv_45171; case 2: nig_reg_adress_crd_weight = (unsigned int )((unsigned char )port) != 0U ? 98892U : 98560U; pbf_reg_adress_crd_weight = (unsigned int )((unsigned char )port) != 0U ? 1426120U : 1426096U; goto ldv_45171; case 3: ; if ((unsigned int )((unsigned char )port) != 0U) { return (-22); } else { } nig_reg_adress_crd_weight = 98564U; pbf_reg_adress_crd_weight = 1426100U; goto ldv_45171; case 4: ; if ((unsigned int )((unsigned char )port) != 0U) { return (-22); } else { } nig_reg_adress_crd_weight = 98568U; pbf_reg_adress_crd_weight = 1426104U; goto ldv_45171; case 5: ; if ((unsigned int )((unsigned char )port) != 0U) { return (-22); } else { } nig_reg_adress_crd_weight = 99984U; pbf_reg_adress_crd_weight = 1426108U; goto ldv_45171; } ldv_45171: writel(cos_bw_nig, (void volatile *)bp->regview + (unsigned long )nig_reg_adress_crd_weight); writel(cos_bw_pbf, (void volatile *)bp->regview + (unsigned long )pbf_reg_adress_crd_weight); return (0); } } static int bnx2x_ets_e3b0_get_total_bw(struct link_params const *params , struct bnx2x_ets_params *ets_params , u16 *total_bw ) { struct bnx2x *bp ; u8 cos_idx ; u8 is_bw_cos_exist ; long tmp ; long tmp___0 ; long tmp___1 ; { bp = params->bp; cos_idx = 0U; is_bw_cos_exist = 0U; *total_bw = 0U; cos_idx = 0U; goto ldv_45187; ldv_45186: ; if ((unsigned int )ets_params->cos[(int )cos_idx].state == 1U) { is_bw_cos_exist = 1U; if ((unsigned int )ets_params->cos[(int )cos_idx].params.bw_params.bw == 0U) { tmp = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp != 0L) { printk("\rbnx2x: [%s:%d(%s)]bnx2x_ets_E3B0_config BWwas set to 0\n", "bnx2x_ets_e3b0_get_total_bw", 971, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } ets_params->cos[(int )cos_idx].params.bw_params.bw = 1U; } else { } *total_bw = (int )*total_bw + (int )((u16 )ets_params->cos[(int )cos_idx].params.bw_params.bw); } else { } cos_idx = (u8 )((int )cos_idx + 1); ldv_45187: ; if ((int )ets_params->num_of_cos > (int )cos_idx) { goto ldv_45186; } else { } if ((unsigned int )is_bw_cos_exist == 1U && (unsigned int )*total_bw != 100U) { if ((unsigned int )*total_bw == 0U) { tmp___0 = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp___0 != 0L) { printk("\rbnx2x: [%s:%d(%s)]bnx2x_ets_E3B0_config total BW shouldn\'t be 0\n", "bnx2x_ets_e3b0_get_total_bw", 987, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } return (-22); } else { } tmp___1 = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp___1 != 0L) { printk("\rbnx2x: [%s:%d(%s)]bnx2x_ets_E3B0_config total BW should be 100\n", "bnx2x_ets_e3b0_get_total_bw", 991, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } } else { } return (0); } } static void bnx2x_ets_e3b0_sp_pri_to_cos_init(u8 *sp_pri_to_cos ) { u8 pri ; { pri = 0U; pri = 0U; goto ldv_45194; ldv_45193: *(sp_pri_to_cos + (unsigned long )pri) = 255U; pri = (u8 )((int )pri + 1); ldv_45194: ; if ((unsigned int )pri <= 5U) { goto ldv_45193; } else { } return; } } static int bnx2x_ets_e3b0_sp_pri_to_cos_set(struct link_params const *params , u8 *sp_pri_to_cos , u8 const pri , u8 const cos_entry ) { struct bnx2x *bp ; u8 port ; u8 max_num_of_cos ; long tmp ; long tmp___0 ; { bp = params->bp; port = params->port; max_num_of_cos = (unsigned int )port != 0U ? 3U : 6U; if ((int )((unsigned char )pri) >= (int )max_num_of_cos) { tmp = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp != 0L) { printk("\rbnx2x: [%s:%d(%s)]bnx2x_ets_e3b0_sp_pri_to_cos_set invalid parameter Illegal strict priority\n", "bnx2x_ets_e3b0_sp_pri_to_cos_set", 1027, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } return (-22); } else { } if ((unsigned int )*(sp_pri_to_cos + (unsigned long )pri) != 255U) { tmp___0 = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp___0 != 0L) { printk("\rbnx2x: [%s:%d(%s)]bnx2x_ets_e3b0_sp_pri_to_cos_set invalid parameter There can\'t be two COS\'s with the same strict pri\n", "bnx2x_ets_e3b0_sp_pri_to_cos_set", 1034, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } return (-22); } else { } *(sp_pri_to_cos + (unsigned long )pri) = cos_entry; return (0); } } static u64 bnx2x_e3b0_sp_get_pri_cli_reg(u8 const cos , u8 const cos_offset , u8 const pri_set , u8 const pri_offset , u8 const entry_size ) { u64 pri_cli_nig ; { pri_cli_nig = 0ULL; pri_cli_nig = (unsigned long long )((int )cos + (int )cos_offset) << (int )entry_size * ((int )pri_set + (int )pri_offset); return (pri_cli_nig); } } static u64 bnx2x_e3b0_sp_get_pri_cli_reg_nig(u8 const cos , u8 const pri_set ) { u8 nig_cos_offset ; u8 nig_pri_offset ; u64 tmp ; { nig_cos_offset = 3U; nig_pri_offset = 3U; tmp = bnx2x_e3b0_sp_get_pri_cli_reg((int )cos, (int )nig_cos_offset, (int )pri_set, (int )nig_pri_offset, 4); return (tmp); } } static u64 bnx2x_e3b0_sp_get_pri_cli_reg_pbf(u8 const cos , u8 const pri_set ) { u8 pbf_cos_offset ; u8 pbf_pri_offset ; u64 tmp ; { pbf_cos_offset = 0U; pbf_pri_offset = 0U; tmp = bnx2x_e3b0_sp_get_pri_cli_reg((int )cos, (int )pbf_cos_offset, (int )pri_set, (int )pbf_pri_offset, 3); return (tmp); } } static int bnx2x_ets_e3b0_sp_set_pri_cli_reg(struct link_params const *params , u8 *sp_pri_to_cos ) { struct bnx2x *bp ; u8 i ; u8 port ; u64 pri_cli_nig ; u32 pri_cli_pbf ; u8 pri_set ; u8 pri_bitmask ; u8 max_num_of_cos ; u8 cos_bit_to_set ; long tmp ; u64 tmp___0 ; u64 tmp___1 ; long tmp___2 ; u64 tmp___3 ; u64 tmp___4 ; long tmp___5 ; u32 pri_cli_nig_lsb ; u32 pri_cli_nig_msb ; { bp = params->bp; i = 0U; port = params->port; pri_cli_nig = 528ULL; pri_cli_pbf = 0U; pri_set = 0U; pri_bitmask = 0U; max_num_of_cos = (unsigned int )port != 0U ? 3U : 6U; cos_bit_to_set = (unsigned int )((u8 )(1 << (int )max_num_of_cos)) + 255U; i = 0U; goto ldv_45241; ldv_45240: ; if ((unsigned int )*(sp_pri_to_cos + (unsigned long )i) != 255U) { if ((unsigned int )*(sp_pri_to_cos + (unsigned long )i) > 5U) { tmp = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp != 0L) { printk("\rbnx2x: [%s:%d(%s)]bnx2x_ets_e3b0_sp_set_pri_cli_reg invalid cos entry\n", "bnx2x_ets_e3b0_sp_set_pri_cli_reg", 1120, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } return (-22); } else { } tmp___0 = bnx2x_e3b0_sp_get_pri_cli_reg_nig((int )*(sp_pri_to_cos + (unsigned long )i), (int )pri_set); pri_cli_nig = tmp___0 | pri_cli_nig; tmp___1 = bnx2x_e3b0_sp_get_pri_cli_reg_pbf((int )*(sp_pri_to_cos + (unsigned long )i), (int )pri_set); pri_cli_pbf = (u32 )tmp___1 | pri_cli_pbf; pri_bitmask = (u8 )(1 << (int )*(sp_pri_to_cos + (unsigned long )i)); if ((unsigned int )((int )pri_bitmask & (int )cos_bit_to_set) == 0U) { tmp___2 = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp___2 != 0L) { printk("\rbnx2x: [%s:%d(%s)]bnx2x_ets_e3b0_sp_set_pri_cli_reg invalid There can\'t be two COS\'s with the same strict pri\n", "bnx2x_ets_e3b0_sp_set_pri_cli_reg", 1135, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } return (-22); } else { } cos_bit_to_set = (u8 )(~ ((int )((signed char )pri_bitmask)) & (int )((signed char )cos_bit_to_set)); pri_set = (u8 )((int )pri_set + 1); } else { } i = (u8 )((int )i + 1); ldv_45241: ; if ((int )i < (int )max_num_of_cos) { goto ldv_45240; } else { } i = 0U; goto ldv_45244; ldv_45243: pri_bitmask = (u8 )(1 << (int )i); if ((unsigned int )((int )pri_bitmask & (int )cos_bit_to_set) != 0U) { tmp___3 = bnx2x_e3b0_sp_get_pri_cli_reg_nig((int )i, (int )pri_set); pri_cli_nig = tmp___3 | pri_cli_nig; tmp___4 = bnx2x_e3b0_sp_get_pri_cli_reg_pbf((int )i, (int )pri_set); pri_cli_pbf = (u32 )tmp___4 | pri_cli_pbf; cos_bit_to_set = (u8 )(~ ((int )((signed char )pri_bitmask)) & (int )((signed char )cos_bit_to_set)); pri_set = (u8 )((int )pri_set + 1); } else { } i = (u8 )((int )i + 1); ldv_45244: ; if ((int )i < (int )max_num_of_cos) { goto ldv_45243; } else { } if ((int )pri_set != (int )max_num_of_cos) { tmp___5 = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp___5 != 0L) { printk("\rbnx2x: [%s:%d(%s)]bnx2x_ets_e3b0_sp_set_pri_cli_reg not all entries were set\n", "bnx2x_ets_e3b0_sp_set_pri_cli_reg", 1162, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } return (-22); } else { } if ((unsigned int )port != 0U) { writel((unsigned int )pri_cli_nig, (void volatile *)bp->regview + 100064U); writel(pri_cli_pbf, (void volatile *)bp->regview + 1426036U); } else { pri_cli_nig_lsb = (unsigned int )pri_cli_nig; pri_cli_nig_msb = (unsigned int )(pri_cli_nig >> 32) & 15U; writel(pri_cli_nig_lsb, (void volatile *)bp->regview + 99968U); writel(pri_cli_nig_msb, (void volatile *)bp->regview + 99972U); writel(pri_cli_pbf, (void volatile *)bp->regview + 1426032U); } return (0); } } int bnx2x_ets_e3b0_config(struct link_params const *params , struct link_vars const *vars , struct bnx2x_ets_params *ets_params ) { struct bnx2x *bp ; int bnx2x_status ; u8 port ; u16 total_bw ; u32 min_w_val_nig ; u32 tmp ; u32 min_w_val_pbf ; u8 cos_bw_bitmap ; u8 cos_sp_bitmap ; u8 sp_pri_to_cos[6U] ; unsigned int tmp___0 ; u8 max_num_of_cos ; u8 cos_entry ; long tmp___1 ; long tmp___2 ; long tmp___3 ; long tmp___4 ; long tmp___5 ; long tmp___6 ; long tmp___7 ; { bp = params->bp; bnx2x_status = 0; port = params->port; total_bw = 0U; tmp = bnx2x_ets_get_min_w_val_nig(vars); min_w_val_nig = tmp; min_w_val_pbf = 10000U; cos_bw_bitmap = 0U; cos_sp_bitmap = 0U; sp_pri_to_cos[0] = 0U; tmp___0 = 1U; while (1) { if (tmp___0 >= 6U) { break; } else { } sp_pri_to_cos[tmp___0] = (unsigned char)0; tmp___0 = tmp___0 + 1U; } max_num_of_cos = (unsigned int )port != 0U ? 3U : 6U; cos_entry = 0U; if ((((((((((bp->common.chip_id >> 16 != 5770U && bp->common.chip_id >> 16 != 5797U) && bp->common.chip_id >> 16 != 5801U) && bp->common.chip_id >> 16 != 5774U) && bp->common.chip_id >> 16 != 5806U) && bp->common.chip_id >> 16 != 5807U) && ((bp->common.chip_id >> 16 != 5693U && bp->common.chip_id >> 16 != 5694U) && bp->common.chip_id >> 16 != 5695U)) && ((bp->common.chip_id >> 16 != 5793U && bp->common.chip_id >> 16 != 5794U) && bp->common.chip_id >> 16 != 5773U)) && (bp->common.chip_id >> 16 != 5796U && bp->common.chip_id >> 16 != 5803U)) && bp->common.chip_id >> 16 != 5805U) || ((bp->common.chip_id & 61440U) > 20480U ? ((~ bp->common.chip_id & 61440U) >> 13) << 12 != 4096U : (bp->common.chip_id & 61440U) != 4096U)) { tmp___1 = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp___1 != 0L) { printk("\rbnx2x: [%s:%d(%s)]bnx2x_ets_e3b0_disabled the chip isn\'t E3B0\n", "bnx2x_ets_e3b0_config", 1210, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } return (-22); } else { } if ((int )ets_params->num_of_cos > (int )max_num_of_cos) { tmp___2 = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp___2 != 0L) { printk("\rbnx2x: [%s:%d(%s)]bnx2x_ets_E3B0_config the number of COS isn\'t supported\n", "bnx2x_ets_e3b0_config", 1216, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } return (-22); } else { } bnx2x_ets_e3b0_sp_pri_to_cos_init((u8 *)(& sp_pri_to_cos)); bnx2x_status = bnx2x_ets_e3b0_get_total_bw(params, ets_params, & total_bw); if (bnx2x_status != 0) { tmp___3 = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp___3 != 0L) { printk("\rbnx2x: [%s:%d(%s)]bnx2x_ets_E3B0_config get_total_bw failed\n", "bnx2x_ets_e3b0_config", 1228, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } return (-22); } else { } bnx2x_ets_e3b0_set_credit_upper_bound_nig(params, min_w_val_nig); bnx2x_ets_e3b0_set_credit_upper_bound_pbf(params, min_w_val_pbf); cos_entry = 0U; goto ldv_45266; ldv_45265: ; if ((unsigned int )ets_params->cos[(int )cos_entry].state == 1U) { cos_bw_bitmap = (u8 )((int )((signed char )(1 << (int )cos_entry)) | (int )((signed char )cos_bw_bitmap)); bnx2x_status = bnx2x_ets_e3b0_set_cos_bw(bp, (int )cos_entry, min_w_val_nig, min_w_val_pbf, (int )total_bw, (int )ets_params->cos[(int )cos_entry].params.bw_params.bw, (int )port); } else if ((unsigned int )ets_params->cos[(int )cos_entry].state == 0U) { cos_sp_bitmap = (u8 )((int )((signed char )(1 << (int )cos_entry)) | (int )((signed char )cos_sp_bitmap)); bnx2x_status = bnx2x_ets_e3b0_sp_pri_to_cos_set(params, (u8 *)(& sp_pri_to_cos), (int )ets_params->cos[(int )cos_entry].params.sp_params.pri, (int )cos_entry); } else { tmp___4 = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp___4 != 0L) { printk("\rbnx2x: [%s:%d(%s)]bnx2x_ets_e3b0_config cos state not valid\n", "bnx2x_ets_e3b0_config", 1262, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } return (-22); } if (bnx2x_status != 0) { tmp___5 = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp___5 != 0L) { printk("\rbnx2x: [%s:%d(%s)]bnx2x_ets_e3b0_config set cos bw failed\n", "bnx2x_ets_e3b0_config", 1267, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } return (bnx2x_status); } else { } cos_entry = (u8 )((int )cos_entry + 1); ldv_45266: ; if ((int )ets_params->num_of_cos > (int )cos_entry) { goto ldv_45265; } else { } bnx2x_status = bnx2x_ets_e3b0_sp_set_pri_cli_reg(params, (u8 *)(& sp_pri_to_cos)); if (bnx2x_status != 0) { tmp___6 = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp___6 != 0L) { printk("\rbnx2x: [%s:%d(%s)]bnx2x_ets_E3B0_config set_pri_cli_reg failed\n", "bnx2x_ets_e3b0_config", 1278, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } return (bnx2x_status); } else { } bnx2x_status = bnx2x_ets_e3b0_cli_map(params, (struct bnx2x_ets_params const *)ets_params, (int )cos_sp_bitmap, (int )cos_bw_bitmap); if (bnx2x_status != 0) { tmp___7 = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp___7 != 0L) { printk("\rbnx2x: [%s:%d(%s)]bnx2x_ets_E3B0_config SP failed\n", "bnx2x_ets_e3b0_config", 1288, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } return (bnx2x_status); } else { } return (0); } } static void bnx2x_ets_bw_limit_common(struct link_params const *params ) { struct bnx2x *bp ; long tmp ; { bp = params->bp; tmp = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp != 0L) { printk("\rbnx2x: [%s:%d(%s)]ETS enabled BW limit configuration\n", "bnx2x_ets_bw_limit_common", 1297, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } writel(24U, (void volatile *)bp->regview + 98540U); writel(4378U, (void volatile *)bp->regview + 98544U); writel(20480U, (void volatile *)bp->regview + 98572U); writel(20480U, (void volatile *)bp->regview + 98576U); writel(1U, (void volatile *)bp->regview + 1425488U); writel(0U, (void volatile *)bp->regview + 1425508U); writel(7U, (void volatile *)bp->regview + 98536U); writel(20480U, (void volatile *)bp->regview + 1425500U); writel(20480U, (void volatile *)bp->regview + 1425504U); return; } } void bnx2x_ets_bw_limit(struct link_params const *params , u32 const cos0_bw , u32 const cos1_bw ) { struct bnx2x *bp ; u32 total_bw ; u32 cos0_credit_weight ; u32 cos1_credit_weight ; long tmp ; long tmp___0 ; { bp = params->bp; total_bw = (unsigned int )cos0_bw + (unsigned int )cos1_bw; cos0_credit_weight = 0U; cos1_credit_weight = 0U; tmp = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp != 0L) { printk("\rbnx2x: [%s:%d(%s)]ETS enabled BW limit configuration\n", "bnx2x_ets_bw_limit", 1346, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } if ((total_bw == 0U || (unsigned int )cos0_bw == 0U) || (unsigned int )cos1_bw == 0U) { tmp___0 = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp___0 != 0L) { printk("\rbnx2x: [%s:%d(%s)]Total BW can\'t be zero\n", "bnx2x_ets_bw_limit", 1351, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } return; } else { } cos0_credit_weight = ((unsigned int )cos0_bw * 20480U) / total_bw; cos1_credit_weight = ((unsigned int )cos1_bw * 20480U) / total_bw; bnx2x_ets_bw_limit_common(params); writel(cos0_credit_weight, (void volatile *)bp->regview + 98552U); writel(cos1_credit_weight, (void volatile *)bp->regview + 98556U); writel(cos0_credit_weight, (void volatile *)bp->regview + 1425492U); writel(cos1_credit_weight, (void volatile *)bp->regview + 1425496U); return; } } int bnx2x_ets_strict(struct link_params const *params , u8 const strict_cos ) { struct bnx2x *bp ; u32 val ; long tmp ; { bp = params->bp; val = 0U; tmp = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp != 0L) { printk("\rbnx2x: [%s:%d(%s)]ETS enabled strict configuration\n", "bnx2x_ets_strict", 1375, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } writel(31U, (void volatile *)bp->regview + 98536U); writel(256U, (void volatile *)bp->regview + 98548U); writel(0U, (void volatile *)bp->regview + 1425488U); writel(256U, (void volatile *)bp->regview + 1425508U); writel((unsigned int )strict_cos, (void volatile *)bp->regview + 1425484U); val = (unsigned int )((unsigned char )strict_cos) == 0U ? 8984U : 8928U; writel(val, (void volatile *)bp->regview + 98532U); return (0); } } static void bnx2x_update_pfc_xmac(struct link_params *params , struct link_vars *vars , u8 is_lb ) { struct bnx2x *bp ; u32 xmac_base ; u32 pause_val ; u32 pfc0_val ; u32 pfc1_val ; { bp = params->bp; xmac_base = (unsigned int )params->port != 0U ? 1456128U : 1454080U; pause_val = 98304U; pfc0_val = 4294934528U; pfc1_val = 2U; if ((params->feature_config_flags & 2U) == 0U) { if (((int )vars->flow_ctrl & 512) != 0) { pause_val = pause_val | 262144U; } else { } if (((int )vars->flow_ctrl & 256) != 0) { pause_val = pause_val | 131072U; } else { } } else { pfc1_val = pfc1_val | 59U; writel(pause_val, (void volatile *)bp->regview + (unsigned long )(xmac_base + 104U)); writel(pfc0_val, (void volatile *)bp->regview + (unsigned long )(xmac_base + 112U)); writel(pfc1_val, (void volatile *)bp->regview + (unsigned long )(xmac_base + 116U)); pfc1_val = pfc1_val & 4294967293U; } writel(pause_val, (void volatile *)bp->regview + (unsigned long )(xmac_base + 104U)); writel(pfc0_val, (void volatile *)bp->regview + (unsigned long )(xmac_base + 112U)); writel(pfc1_val, (void volatile *)bp->regview + (unsigned long )(xmac_base + 116U)); writel((unsigned int )(((((int )params->mac_addr[2] << 24) | ((int )params->mac_addr[3] << 16)) | ((int )params->mac_addr[4] << 8)) | (int )params->mac_addr[5]), (void volatile *)bp->regview + (unsigned long )(xmac_base + 40U)); writel((unsigned int )(((int )params->mac_addr[0] << 8) | (int )params->mac_addr[1]), (void volatile *)bp->regview + (unsigned long )(xmac_base + 44U)); __const_udelay(128850UL); return; } } static void bnx2x_emac_get_pfc_stat(struct link_params *params , u32 *pfc_frames_sent , u32 *pfc_frames_received ) { struct bnx2x *bp ; u32 emac_base ; u32 val_xon ; u32 val_xoff ; long tmp ; { bp = params->bp; emac_base = (unsigned int )params->port != 0U ? 33792U : 32768U; val_xon = 0U; val_xoff = 0U; tmp = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp != 0L) { printk("\rbnx2x: [%s:%d(%s)]pfc statistic read from EMAC\n", "bnx2x_emac_get_pfc_stat", 1484, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } val_xoff = readl((void const volatile *)bp->regview + (unsigned long )(emac_base + 808U)); val_xoff = val_xoff & 65535U; val_xon = readl((void const volatile *)bp->regview + (unsigned long )(emac_base + 812U)); val_xon = val_xon & 65535U; *pfc_frames_received = val_xon + val_xoff; val_xoff = readl((void const volatile *)bp->regview + (unsigned long )(emac_base + 816U)); val_xoff = val_xoff & 65535U; val_xon = readl((void const volatile *)bp->regview + (unsigned long )(emac_base + 820U)); val_xon = val_xon & 65535U; *pfc_frames_sent = val_xon + val_xoff; return; } } void bnx2x_pfc_statistic(struct link_params *params , struct link_vars *vars , u32 *pfc_frames_sent , u32 *pfc_frames_received ) { struct bnx2x *bp ; long tmp ; long tmp___0 ; { bp = params->bp; tmp = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp != 0L) { printk("\rbnx2x: [%s:%d(%s)]pfc statistic\n", "bnx2x_pfc_statistic", 1513, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } if ((unsigned int )vars->link_up == 0U) { return; } else { } if ((unsigned int )vars->mac_type == 1U) { tmp___0 = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp___0 != 0L) { printk("\rbnx2x: [%s:%d(%s)]About to read PFC stats from EMAC\n", "bnx2x_pfc_statistic", 1519, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } bnx2x_emac_get_pfc_stat(params, pfc_frames_sent, pfc_frames_received); } else { } return; } } static void bnx2x_set_mdio_clk(struct bnx2x *bp , u32 chip_id , u32 emac_base ) { u32 new_mode ; u32 cur_mode ; u32 clc_cnt ; long tmp ; { cur_mode = readl((void const volatile *)bp->regview + (unsigned long )(emac_base + 180U)); if (((((((((bp->common.chip_id >> 16 == 5770U || bp->common.chip_id >> 16 == 5797U) || bp->common.chip_id >> 16 == 5801U) || bp->common.chip_id >> 16 == 5774U) || bp->common.chip_id >> 16 == 5806U) || bp->common.chip_id >> 16 == 5807U) || ((bp->common.chip_id >> 16 == 5693U || bp->common.chip_id >> 16 == 5694U) || bp->common.chip_id >> 16 == 5695U)) || ((bp->common.chip_id >> 16 == 5793U || bp->common.chip_id >> 16 == 5794U) || bp->common.chip_id >> 16 == 5773U)) || (bp->common.chip_id >> 16 == 5796U || bp->common.chip_id >> 16 == 5803U)) || bp->common.chip_id >> 16 == 5805U) { clc_cnt = 4849664U; } else { clc_cnt = 3211264U; } if (((long )cur_mode & 67043328L) == (long )clc_cnt && (int )cur_mode < 0) { return; } else { } new_mode = cur_mode & 4227923951U; new_mode = new_mode | clc_cnt; new_mode = new_mode | 2147483648U; tmp = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp != 0L) { printk("\rbnx2x: [%s:%d(%s)]Changing emac_mode from 0x%x to 0x%x\n", "bnx2x_set_mdio_clk", 1552, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", cur_mode, new_mode); } else { } writel(new_mode, (void volatile *)bp->regview + (unsigned long )(emac_base + 180U)); __const_udelay(171800UL); return; } } static void bnx2x_set_mdio_emac_per_phy(struct bnx2x *bp , struct link_params *params ) { u8 phy_index ; { phy_index = 0U; goto ldv_45333; ldv_45332: bnx2x_set_mdio_clk(bp, params->chip_id, params->phy[(int )phy_index].mdio_ctrl); phy_index = (u8 )((int )phy_index + 1); ldv_45333: ; if ((int )params->num_phys > (int )phy_index) { goto ldv_45332; } else { } return; } } static u8 bnx2x_is_4_port_mode(struct bnx2x *bp ) { u32 port4mode_ovwr_val ; unsigned int tmp ; { port4mode_ovwr_val = readl((void const volatile *)bp->regview + 42784U); if ((int )port4mode_ovwr_val & 1) { return ((port4mode_ovwr_val & 2U) != 0U); } else { } tmp = readl((void const volatile *)bp->regview + 42832U); return ((u8 )tmp); } } static void bnx2x_emac_init(struct link_params *params , struct link_vars *vars ) { struct bnx2x *bp ; u8 port ; u32 emac_base ; u32 val ; u16 timeout ; long tmp ; long tmp___0 ; { bp = params->bp; port = params->port; emac_base = (unsigned int )port != 0U ? 33792U : 32768U; writel((unsigned int )(16384 << (int )port), (void volatile *)bp->regview + 42392U); __const_udelay(21475UL); writel((unsigned int )(16384 << (int )port), (void volatile *)bp->regview + 42388U); val = readl((void const volatile *)bp->regview + (unsigned long )emac_base); writel(val | 1U, (void volatile *)bp->regview + (unsigned long )emac_base); timeout = 200U; ldv_45349: val = readl((void const volatile *)bp->regview + (unsigned long )emac_base); tmp = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp != 0L) { printk("\rbnx2x: [%s:%d(%s)]EMAC reset reg is %u\n", "bnx2x_emac_init", 1605, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", val); } else { } if ((unsigned int )timeout == 0U) { tmp___0 = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp___0 != 0L) { printk("\rbnx2x: [%s:%d(%s)]EMAC timeout!\n", "bnx2x_emac_init", 1607, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } return; } else { } timeout = (u16 )((int )timeout - 1); if ((int )val & 1) { goto ldv_45349; } else { } bnx2x_set_mdio_emac_per_phy(bp, params); val = (u32 )(((int )params->mac_addr[0] << 8) | (int )params->mac_addr[1]); writel(val, (void volatile *)bp->regview + (unsigned long )(emac_base + 16U)); val = (u32 )(((((int )params->mac_addr[2] << 24) | ((int )params->mac_addr[3] << 16)) | ((int )params->mac_addr[4] << 8)) | (int )params->mac_addr[5]); writel(val, (void volatile *)bp->regview + (unsigned long )(emac_base + 20U)); return; } } static void bnx2x_set_xumac_nig(struct link_params *params , u16 tx_pause_en , u8 enable ) { struct bnx2x *bp ; { bp = params->bp; writel((unsigned int )enable, (void volatile *)(bp->regview + ((unsigned int )params->port != 0U ? 99776UL : 99756UL))); writel((unsigned int )enable, (void volatile *)(bp->regview + ((unsigned int )params->port != 0U ? 99780UL : 99760UL))); writel((unsigned int )tx_pause_en, (void volatile *)(bp->regview + ((unsigned int )params->port != 0U ? 99784UL : 99764UL))); return; } } static void bnx2x_set_umac_rxtx(struct link_params *params , u8 en ) { u32 umac_base ; u32 val ; struct bnx2x *bp ; unsigned int tmp ; { umac_base = (unsigned int )params->port != 0U ? 1442816U : 1441792U; bp = params->bp; tmp = readl((void const volatile *)bp->regview + 42384U); if ((tmp & (unsigned int )(1048576 << (int )params->port)) == 0U) { return; } else { } val = readl((void const volatile *)bp->regview + (unsigned long )(umac_base + 8U)); if ((unsigned int )en != 0U) { val = val | 3U; } else { val = val & 4294967292U; } writel(val, (void volatile *)bp->regview + (unsigned long )(umac_base + 8U)); return; } } static void bnx2x_umac_enable(struct link_params *params , struct link_vars *vars , u8 lb ) { u32 val ; u32 umac_base ; struct bnx2x *bp ; long tmp ; long tmp___0 ; long tmp___1 ; { umac_base = (unsigned int )params->port != 0U ? 1442816U : 1441792U; bp = params->bp; writel((unsigned int )(1048576 << (int )params->port), (void volatile *)bp->regview + 42392U); usleep_range(1000UL, 2000UL); writel((unsigned int )(1048576 << (int )params->port), (void volatile *)bp->regview + 42388U); tmp = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp != 0L) { printk("\rbnx2x: [%s:%d(%s)]enabling UMAC\n", "bnx2x_umac_enable", 1673, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } writel(1U, (void volatile *)bp->regview + (unsigned long )(((int )params->port + 16406) * 4)); val = 16785456U; switch ((int )vars->line_speed) { case 10: val = val; goto ldv_45374; case 100: val = val | 4U; goto ldv_45374; case 1000: val = val | 8U; goto ldv_45374; case 2500: val = val | 12U; goto ldv_45374; default: tmp___0 = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp___0 != 0L) { printk("\rbnx2x: [%s:%d(%s)]Invalid speed for UMAC %d\n", "bnx2x_umac_enable", 1697, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )vars->line_speed); } else { } goto ldv_45374; } ldv_45374: ; if (((int )vars->flow_ctrl & 256) == 0) { val = val | 268435456U; } else { } if (((int )vars->flow_ctrl & 512) == 0) { val = val | 256U; } else { } if ((unsigned int )vars->duplex == 0U) { val = val | 1024U; } else { } writel(val, (void volatile *)bp->regview + (unsigned long )(umac_base + 8U)); __const_udelay(214750UL); if ((vars->eee_status & 15728640U) != 0U) { tmp___1 = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp___1 != 0L) { printk("\rbnx2x: [%s:%d(%s)]configured UMAC for EEE\n", "bnx2x_umac_enable", 1714, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } writel(8U, (void volatile *)bp->regview + (unsigned long )(umac_base + 100U)); writel(17U, (void volatile *)bp->regview + (unsigned long )(umac_base + 108U)); } else { writel(0U, (void volatile *)bp->regview + (unsigned long )(umac_base + 100U)); } writel((unsigned int )(((((int )params->mac_addr[2] << 24) | ((int )params->mac_addr[3] << 16)) | ((int )params->mac_addr[4] << 8)) | (int )params->mac_addr[5]), (void volatile *)bp->regview + (unsigned long )(umac_base + 12U)); writel((unsigned int )(((int )params->mac_addr[0] << 8) | (int )params->mac_addr[1]), (void volatile *)bp->regview + (unsigned long )(umac_base + 16U)); val = val & 4294967263U; val = val | 3U; writel(val, (void volatile *)bp->regview + (unsigned long )(umac_base + 8U)); __const_udelay(214750UL); val = val & 4294959103U; if ((unsigned int )lb != 0U) { val = val | 32768U; } else { } writel(val, (void volatile *)bp->regview + (unsigned long )(umac_base + 8U)); writel(10000U, (void volatile *)bp->regview + (unsigned long )(umac_base + 20U)); bnx2x_set_xumac_nig(params, ((int )vars->flow_ctrl & 256) != 0, 1); vars->mac_type = 3U; return; } } static void bnx2x_xmac_init(struct link_params *params , u32 max_speed ) { struct bnx2x *bp ; u32 is_port4mode ; u8 tmp ; long tmp___0 ; unsigned int tmp___1 ; long tmp___2 ; long tmp___3 ; long tmp___4 ; { bp = params->bp; tmp = bnx2x_is_4_port_mode(bp); is_port4mode = (u32 )tmp; if (((bp->common.chip_id >> 16 == 5793U || bp->common.chip_id >> 16 == 5794U) || bp->common.chip_id >> 16 == 5773U) && is_port4mode != 0U) { tmp___1 = readl((void const volatile *)bp->regview + 42384U); if ((tmp___1 & 4194304U) != 0U) { tmp___0 = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp___0 != 0L) { printk("\rbnx2x: [%s:%d(%s)]XMAC already out of reset in 4-port mode\n", "bnx2x_xmac_init", 1776, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } return; } else { } } else { } writel(4194304U, (void volatile *)bp->regview + 42392U); usleep_range(1000UL, 2000UL); writel(4194304U, (void volatile *)bp->regview + 42388U); if (is_port4mode != 0U) { tmp___2 = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp___2 != 0L) { printk("\rbnx2x: [%s:%d(%s)]Init XMAC to 2 ports x 10G per path\n", "bnx2x_xmac_init", 1788, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } writel(1U, (void volatile *)bp->regview + 43364U); writel(3U, (void volatile *)bp->regview + 43360U); } else { writel(0U, (void volatile *)bp->regview + 43364U); if (max_speed == 10000U) { tmp___3 = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp___3 != 0L) { printk("\rbnx2x: [%s:%d(%s)]Init XMAC to 10G x 1 port per path\n", "bnx2x_xmac_init", 1800, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } writel(3U, (void volatile *)bp->regview + 43360U); } else { tmp___4 = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp___4 != 0L) { printk("\rbnx2x: [%s:%d(%s)]Init XMAC to 20G x 2 ports per path\n", "bnx2x_xmac_init", 1805, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } writel(1U, (void volatile *)bp->regview + 43360U); } } writel(8388608U, (void volatile *)bp->regview + 42392U); usleep_range(1000UL, 2000UL); writel(8388608U, (void volatile *)bp->regview + 42388U); return; } } static void bnx2x_set_xmac_rxtx(struct link_params *params , u8 en ) { u8 port ; struct bnx2x *bp ; u32 pfc_ctrl ; u32 xmac_base ; u32 val ; long tmp ; unsigned int tmp___0 ; { port = params->port; bp = params->bp; xmac_base = (unsigned int )port != 0U ? 1456128U : 1454080U; tmp___0 = readl((void const volatile *)bp->regview + 42384U); if ((tmp___0 & 4194304U) != 0U) { pfc_ctrl = readl((void const volatile *)bp->regview + (unsigned long )(xmac_base + 116U)); writel(pfc_ctrl & 4294967293U, (void volatile *)bp->regview + (unsigned long )(xmac_base + 116U)); writel(pfc_ctrl | 2U, (void volatile *)bp->regview + (unsigned long )(xmac_base + 116U)); tmp = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp != 0L) { printk("\rbnx2x: [%s:%d(%s)]Disable XMAC on port %x\n", "bnx2x_set_xmac_rxtx", 1838, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )port); } else { } val = readl((void const volatile *)bp->regview + (unsigned long )xmac_base); if ((unsigned int )en != 0U) { val = val | 3U; } else { val = val & 4294967292U; } writel(val, (void volatile *)bp->regview + (unsigned long )xmac_base); } else { } return; } } static int bnx2x_xmac_enable(struct link_params *params , struct link_vars *vars , u8 lb ) { u32 val ; u32 xmac_base ; struct bnx2x *bp ; long tmp ; long tmp___0 ; { bp = params->bp; tmp = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp != 0L) { printk("\rbnx2x: [%s:%d(%s)]enabling XMAC\n", "bnx2x_xmac_enable", 1853, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } xmac_base = (unsigned int )params->port != 0U ? 1456128U : 1454080U; bnx2x_xmac_init(params, (u32 )vars->line_speed); writel(0U, (void volatile *)bp->regview + (unsigned long )(((int )params->port + 16406) * 4)); if (((int )params->phy[0].flags & 4096) == 0) { writel(3U, (void volatile *)bp->regview + (unsigned long )(xmac_base + 80U)); writel(0U, (void volatile *)bp->regview + (unsigned long )(xmac_base + 96U)); writel(3U, (void volatile *)bp->regview + (unsigned long )(xmac_base + 96U)); } else { } writel(10000U, (void volatile *)bp->regview + (unsigned long )(xmac_base + 64U)); writel(51200U, (void volatile *)bp->regview + (unsigned long )(xmac_base + 32U)); bnx2x_update_pfc_xmac(params, vars, 0); if ((vars->eee_status & 15728640U) != 0U) { tmp___0 = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp___0 != 0L) { printk("\rbnx2x: [%s:%d(%s)]Setting XMAC for EEE\n", "bnx2x_xmac_enable", 1890, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } writel(20447240U, (void volatile *)bp->regview + (unsigned long )(xmac_base + 228U)); writel(1U, (void volatile *)bp->regview + (unsigned long )(xmac_base + 216U)); } else { writel(0U, (void volatile *)bp->regview + (unsigned long )(xmac_base + 216U)); } val = 3U; if ((unsigned int )vars->line_speed == 20000U && (params->phy[0].supported & 4194304U) != 0U) { val = val | 128U; } else { } if ((unsigned int )lb != 0U) { val = val | 4U; } else { } writel(val, (void volatile *)bp->regview + (unsigned long )xmac_base); bnx2x_set_xumac_nig(params, ((int )vars->flow_ctrl & 256) != 0, 1); vars->mac_type = 4U; return (0); } } static int bnx2x_emac_enable(struct link_params *params , struct link_vars *vars , u8 lb ) { struct bnx2x *bp ; u8 port ; u32 emac_base ; u32 val ; long tmp ; u32 ser_lane ; long tmp___0 ; long tmp___1 ; long tmp___2 ; { bp = params->bp; port = params->port; emac_base = (unsigned int )port != 0U ? 33792U : 32768U; tmp = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp != 0L) { printk("\rbnx2x: [%s:%d(%s)]enabling EMAC\n", "bnx2x_emac_enable", 1926, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } writel((unsigned int )(1 << (int )port), (void volatile *)bp->regview + 42392U); writel(1U, (void volatile *)bp->regview + (unsigned long )(((int )port + 16406) * 4)); if ((int )vars->phy_flags & 1) { ser_lane = (params->lane_config & 49152U) >> 14; tmp___0 = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp___0 != 0L) { printk("\rbnx2x: [%s:%d(%s)]XGXS\n", "bnx2x_emac_enable", 1941, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } writel(ser_lane, (void volatile *)bp->regview + (unsigned long )(((int )port + 16570) * 4)); writel(1U, (void volatile *)bp->regview + (unsigned long )(((int )port + 16568) * 4)); } else { tmp___1 = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp___1 != 0L) { printk("\rbnx2x: [%s:%d(%s)]SerDes\n", "bnx2x_emac_enable", 1948, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } writel(0U, (void volatile *)bp->regview + (unsigned long )(((int )port + 16568) * 4)); } bnx2x_bits_en(bp, emac_base + 200U, 1U); bnx2x_bits_en(bp, emac_base + 188U, 1U); bnx2x_bits_dis(bp, emac_base + 200U, 4U); bnx2x_bits_dis(bp, emac_base + 188U, 24U); if ((params->feature_config_flags & 2U) == 0U) { if (((int )vars->flow_ctrl & 512) != 0) { bnx2x_bits_en(bp, emac_base + 200U, 4U); } else { } if (((int )vars->flow_ctrl & 256) != 0) { bnx2x_bits_en(bp, emac_base + 188U, 24U); } else { } } else { bnx2x_bits_en(bp, emac_base + 188U, 16U); } val = readl((void const volatile *)bp->regview + (unsigned long )(emac_base + 200U)); val = val | 1280U; writel(0U, (void volatile *)bp->regview + (unsigned long )(emac_base + 800U)); if ((params->feature_config_flags & 2U) != 0U) { tmp___2 = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp___2 != 0L) { printk("\rbnx2x: [%s:%d(%s)]PFC is enabled\n", "bnx2x_emac_enable", 1994, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } writel(7U, (void volatile *)bp->regview + (unsigned long )(emac_base + 800U)); writel(16711937U, (void volatile *)bp->regview + (unsigned long )(emac_base + 804U)); val = val | 8U; } else { } writel(val, (void volatile *)bp->regview + (unsigned long )(emac_base + 200U)); val = readl((void const volatile *)bp->regview + (unsigned long )emac_base); if ((unsigned int )lb != 0U) { val = val | 2064U; } else { val = val & 4294965231U; } writel(val, (void volatile *)bp->regview + (unsigned long )emac_base); writel(1U, (void volatile *)bp->regview + (unsigned long )(((int )port + 16399) * 4)); writel(2147493278U, (void volatile *)bp->regview + (unsigned long )(emac_base + 156U)); writel(1U, (void volatile *)bp->regview + (unsigned long )(((int )port + 16401) * 4)); writel(0U, (void volatile *)bp->regview + (unsigned long )(((int )port + 16427) * 4)); writel(0U, (void volatile *)bp->regview + (unsigned long )(((int )port + 16452) * 4)); writel(0U, (void volatile *)bp->regview + (unsigned long )(((int )port + 16440) * 4)); writel(1U, (void volatile *)bp->regview + (unsigned long )(((int )port + 16425) * 4)); val = 0U; if ((params->feature_config_flags & 2U) != 0U || ((int )vars->flow_ctrl & 256) != 0) { val = 1U; } else { } writel(val, (void volatile *)bp->regview + (unsigned long )(((int )port + 16454) * 4)); writel(1U, (void volatile *)bp->regview + (unsigned long )(((int )port + 16456) * 4)); writel(0U, (void volatile *)bp->regview + (unsigned long )(((int )port + 16442) * 4)); vars->mac_type = 1U; return (0); } } static void bnx2x_update_pfc_bmac1(struct link_params *params , struct link_vars *vars ) { u32 wb_data[2U] ; struct bnx2x *bp ; u32 bmac_addr ; u32 val ; size_t __len ; void *__ret ; size_t __len___0 ; void *__ret___0 ; { bp = params->bp; bmac_addr = (unsigned int )params->port != 0U ? 69632U : 68608U; val = 20U; if ((params->feature_config_flags & 2U) == 0U && ((int )vars->flow_ctrl & 512) != 0) { val = val | 32U; } else { } wb_data[0] = val; wb_data[1] = 0U; __len = 8UL; if (__len > 63UL) { __ret = __memcpy((void *)(& (bp->slowpath)->wb_data), (void const *)(& wb_data), __len); } else { __ret = __builtin_memcpy((void *)(& (bp->slowpath)->wb_data), (void const *)(& wb_data), __len); } bnx2x_write_dmae(bp, bp->slowpath_mapping + 4392ULL, bmac_addr + 264U, 2U); val = 192U; if ((params->feature_config_flags & 2U) == 0U && ((int )vars->flow_ctrl & 256) != 0) { val = val | 8388608U; } else { } wb_data[0] = val; wb_data[1] = 0U; __len___0 = 8UL; if (__len___0 > 63UL) { __ret___0 = __memcpy((void *)(& (bp->slowpath)->wb_data), (void const *)(& wb_data), __len___0); } else { __ret___0 = __builtin_memcpy((void *)(& (bp->slowpath)->wb_data), (void const *)(& wb_data), __len___0); } bnx2x_write_dmae(bp, bp->slowpath_mapping + 4392ULL, bmac_addr + 56U, 2U); return; } } static void bnx2x_update_pfc_bmac2(struct link_params *params , struct link_vars *vars , u8 is_lb ) { u32 wb_data[2U] ; struct bnx2x *bp ; u32 bmac_addr ; u32 val ; size_t __len ; void *__ret ; size_t __len___0 ; void *__ret___0 ; long tmp ; size_t __len___1 ; void *__ret___1 ; long tmp___0 ; size_t __len___2 ; void *__ret___2 ; size_t __len___3 ; void *__ret___3 ; long tmp___1 ; size_t __len___4 ; void *__ret___4 ; { bp = params->bp; bmac_addr = (unsigned int )params->port != 0U ? 69632U : 68608U; val = 20U; if ((params->feature_config_flags & 2U) == 0U && ((int )vars->flow_ctrl & 512) != 0) { val = val | 32U; } else { } wb_data[0] = val; wb_data[1] = 0U; __len = 8UL; if (__len > 63UL) { __ret = __memcpy((void *)(& (bp->slowpath)->wb_data), (void const *)(& wb_data), __len); } else { __ret = __builtin_memcpy((void *)(& (bp->slowpath)->wb_data), (void const *)(& wb_data), __len); } bnx2x_write_dmae(bp, bp->slowpath_mapping + 4392ULL, bmac_addr + 464U, 2U); __const_udelay(128850UL); val = 192U; if ((params->feature_config_flags & 2U) == 0U && ((int )vars->flow_ctrl & 256) != 0) { val = val | 8388608U; } else { } wb_data[0] = val; wb_data[1] = 0U; __len___0 = 8UL; if (__len___0 > 63UL) { __ret___0 = __memcpy((void *)(& (bp->slowpath)->wb_data), (void const *)(& wb_data), __len___0); } else { __ret___0 = __builtin_memcpy((void *)(& (bp->slowpath)->wb_data), (void const *)(& wb_data), __len___0); } bnx2x_write_dmae(bp, bp->slowpath_mapping + 4392ULL, bmac_addr + 224U, 2U); if ((params->feature_config_flags & 2U) != 0U) { tmp = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp != 0L) { printk("\rbnx2x: [%s:%d(%s)]PFC is enabled\n", "bnx2x_update_pfc_bmac2", 2114, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } wb_data[0] = 0U; wb_data[0] = wb_data[0] | 1U; wb_data[0] = wb_data[0] | 2U; wb_data[0] = wb_data[0] | 4U; wb_data[0] = wb_data[0] | 8U; wb_data[0] = wb_data[0] | 32U; wb_data[1] = 0U; __len___1 = 8UL; if (__len___1 > 63UL) { __ret___1 = __memcpy((void *)(& (bp->slowpath)->wb_data), (void const *)(& wb_data), __len___1); } else { __ret___1 = __builtin_memcpy((void *)(& (bp->slowpath)->wb_data), (void const *)(& wb_data), __len___1); } bnx2x_write_dmae(bp, bp->slowpath_mapping + 4392ULL, bmac_addr + 48U, 2U); wb_data[0] = wb_data[0] & 4294967291U; } else { tmp___0 = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp___0 != 0L) { printk("\rbnx2x: [%s:%d(%s)]PFC is disabled\n", "bnx2x_update_pfc_bmac2", 2128, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } wb_data[0] = 8U; wb_data[1] = 0U; } __len___2 = 8UL; if (__len___2 > 63UL) { __ret___2 = __memcpy((void *)(& (bp->slowpath)->wb_data), (void const *)(& wb_data), __len___2); } else { __ret___2 = __builtin_memcpy((void *)(& (bp->slowpath)->wb_data), (void const *)(& wb_data), __len___2); } bnx2x_write_dmae(bp, bp->slowpath_mapping + 4392ULL, bmac_addr + 48U, 2U); val = 32768U; if ((params->feature_config_flags & 2U) != 0U) { val = val | 65536U; } else { } wb_data[0] = val; wb_data[1] = 0U; __len___3 = 8UL; if (__len___3 > 63UL) { __ret___3 = __memcpy((void *)(& (bp->slowpath)->wb_data), (void const *)(& wb_data), __len___3); } else { __ret___3 = __builtin_memcpy((void *)(& (bp->slowpath)->wb_data), (void const *)(& wb_data), __len___3); } bnx2x_write_dmae(bp, bp->slowpath_mapping + 4392ULL, bmac_addr + 256U, 2U); val = 3U; if ((unsigned int )is_lb != 0U) { val = val | 4U; tmp___1 = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp___1 != 0L) { printk("\rbnx2x: [%s:%d(%s)]enable bmac loopback\n", "bnx2x_update_pfc_bmac2", 2154, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } } else { } if ((params->feature_config_flags & 2U) != 0U) { val = val | 96U; } else { } wb_data[0] = val; wb_data[1] = 0U; __len___4 = 8UL; if (__len___4 > 63UL) { __ret___4 = __memcpy((void *)(& (bp->slowpath)->wb_data), (void const *)(& wb_data), __len___4); } else { __ret___4 = __builtin_memcpy((void *)(& (bp->slowpath)->wb_data), (void const *)(& wb_data), __len___4); } bnx2x_write_dmae(bp, bp->slowpath_mapping + 4392ULL, bmac_addr, 2U); return; } } static int bnx2x_pfc_nig_rx_priority_mask(struct bnx2x *bp , u8 cos_entry , u32 priority_mask , u8 port ) { u32 nig_reg_rx_priority_mask_add ; { nig_reg_rx_priority_mask_add = 0U; switch ((int )cos_entry) { case 0: nig_reg_rx_priority_mask_add = (unsigned int )port != 0U ? 98732U : 98392U; goto ldv_45466; case 1: nig_reg_rx_priority_mask_add = (unsigned int )port != 0U ? 98736U : 98396U; goto ldv_45466; case 2: nig_reg_rx_priority_mask_add = (unsigned int )port != 0U ? 100088U : 100016U; goto ldv_45466; case 3: ; if ((unsigned int )port != 0U) { return (-22); } else { } nig_reg_rx_priority_mask_add = 100020U; goto ldv_45466; case 4: ; if ((unsigned int )port != 0U) { return (-22); } else { } nig_reg_rx_priority_mask_add = 100024U; goto ldv_45466; case 5: ; if ((unsigned int )port != 0U) { return (-22); } else { } nig_reg_rx_priority_mask_add = 100028U; goto ldv_45466; } ldv_45466: writel(priority_mask, (void volatile *)bp->regview + (unsigned long )nig_reg_rx_priority_mask_add); return (0); } } static void bnx2x_update_mng(struct link_params *params , u32 link_status ) { struct bnx2x *bp ; { bp = params->bp; writel(link_status, (void volatile *)(bp->regview + (((unsigned long )params->shmem_base + (unsigned long )params->port * 16UL) + 1636UL))); return; } } static void bnx2x_update_link_attr(struct link_params *params , u32 link_attr ) { struct bnx2x *bp ; unsigned int tmp ; { bp = params->bp; if (bp->common.shmem2_base != 0U) { tmp = readl((void const volatile *)bp->regview + (unsigned long )bp->common.shmem2_base); if (tmp > 340U) { writel(link_attr, (void volatile *)(bp->regview + ((unsigned long )params->shmem2_base + ((unsigned long )params->port + 85UL) * 4UL))); } else { } } else { } return; } } static void bnx2x_update_pfc_nig(struct link_params *params , struct link_vars *vars , struct bnx2x_nig_brb_pfc_port_params *nig_params ) { u32 xcm_mask ; u32 ppp_enable ; u32 pause_enable ; u32 llfc_out_en ; u32 llfc_enable ; u32 xcm_out_en ; u32 hwpfc_enable ; u32 pkt_priority_to_cos ; struct bnx2x *bp ; u8 port ; int set_pfc ; long tmp ; u8 i ; { xcm_mask = 0U; ppp_enable = 0U; pause_enable = 0U; llfc_out_en = 0U; llfc_enable = 0U; xcm_out_en = 0U; hwpfc_enable = 0U; pkt_priority_to_cos = 0U; bp = params->bp; port = params->port; set_pfc = (int )params->feature_config_flags & 2; tmp = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp != 0L) { printk("\rbnx2x: [%s:%d(%s)]updating pfc nig parameters\n", "bnx2x_update_pfc_nig", 2244, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } xcm_mask = readl((void const volatile *)(bp->regview + ((unsigned int )port != 0U ? 65844UL : 65840UL))); if (set_pfc != 0) { pause_enable = 0U; llfc_out_en = 0U; llfc_enable = 0U; if (((((((((bp->common.chip_id >> 16 == 5770U || bp->common.chip_id >> 16 == 5797U) || bp->common.chip_id >> 16 == 5801U) || bp->common.chip_id >> 16 == 5774U) || bp->common.chip_id >> 16 == 5806U) || bp->common.chip_id >> 16 == 5807U) || ((bp->common.chip_id >> 16 == 5693U || bp->common.chip_id >> 16 == 5694U) || bp->common.chip_id >> 16 == 5695U)) || ((bp->common.chip_id >> 16 == 5793U || bp->common.chip_id >> 16 == 5794U) || bp->common.chip_id >> 16 == 5773U)) || (bp->common.chip_id >> 16 == 5796U || bp->common.chip_id >> 16 == 5803U)) || bp->common.chip_id >> 16 == 5805U) { ppp_enable = 0U; } else { ppp_enable = 1U; } xcm_mask = xcm_mask & 4294967294U; xcm_out_en = 0U; hwpfc_enable = 1U; } else { if ((unsigned long )nig_params != (unsigned long )((struct bnx2x_nig_brb_pfc_port_params *)0)) { llfc_out_en = nig_params->llfc_out_en; llfc_enable = nig_params->llfc_enable; pause_enable = nig_params->pause_enable; } else { pause_enable = 1U; } xcm_mask = xcm_mask | 1U; xcm_out_en = 1U; } if (((((((((bp->common.chip_id >> 16 == 5770U || bp->common.chip_id >> 16 == 5797U) || bp->common.chip_id >> 16 == 5801U) || bp->common.chip_id >> 16 == 5774U) || bp->common.chip_id >> 16 == 5806U) || bp->common.chip_id >> 16 == 5807U) || ((bp->common.chip_id >> 16 == 5693U || bp->common.chip_id >> 16 == 5694U) || bp->common.chip_id >> 16 == 5695U)) || ((bp->common.chip_id >> 16 == 5793U || bp->common.chip_id >> 16 == 5794U) || bp->common.chip_id >> 16 == 5773U)) || (bp->common.chip_id >> 16 == 5796U || bp->common.chip_id >> 16 == 5803U)) || bp->common.chip_id >> 16 == 5805U) { writel(pause_enable, (void volatile *)(bp->regview + ((unsigned int )port != 0U ? 65736UL : 65732UL))); } else { } writel(llfc_out_en, (void volatile *)(bp->regview + ((unsigned int )port != 0U ? 90316UL : 90312UL))); writel(llfc_enable, (void volatile *)(bp->regview + ((unsigned int )port != 0U ? 90636UL : 90632UL))); writel(pause_enable, (void volatile *)(bp->regview + ((unsigned int )port != 0U ? 90308UL : 90304UL))); writel(ppp_enable, (void volatile *)(bp->regview + ((unsigned int )port != 0U ? 90292UL : 90288UL))); writel(xcm_mask, (void volatile *)(bp->regview + ((unsigned int )port != 0U ? 65844UL : 65840UL))); writel(7U, (void volatile *)(bp->regview + ((unsigned int )port != 0U ? 90228UL : 90224UL))); writel(xcm_out_en, (void volatile *)(bp->regview + ((unsigned int )port != 0U ? 65780UL : 65776UL))); writel(hwpfc_enable, (void volatile *)(bp->regview + ((unsigned int )port != 0U ? 98768UL : 98424UL))); if ((unsigned long )nig_params != (unsigned long )((struct bnx2x_nig_brb_pfc_port_params *)0)) { i = 0U; pkt_priority_to_cos = nig_params->pkt_priority_to_cos; i = 0U; goto ldv_45501; ldv_45500: bnx2x_pfc_nig_rx_priority_mask(bp, (int )i, nig_params->rx_cos_priority_mask[(int )i], (int )port); i = (u8 )((int )i + 1); ldv_45501: ; if ((int )nig_params->num_of_rx_cos_priority_mask > (int )i) { goto ldv_45500; } else { } writel(nig_params->llfc_high_priority_classes, (void volatile *)(bp->regview + ((unsigned int )port != 0U ? 90204UL : 90200UL))); writel(nig_params->llfc_low_priority_classes, (void volatile *)(bp->regview + ((unsigned int )port != 0U ? 90212UL : 90208UL))); } else { } writel(pkt_priority_to_cos, (void volatile *)(bp->regview + ((unsigned int )port != 0U ? 98728UL : 98388UL))); return; } } int bnx2x_update_pfc(struct link_params *params , struct link_vars *vars , struct bnx2x_nig_brb_pfc_port_params *pfc_params ) { u32 val ; struct bnx2x *bp ; int bnx2x_status ; u8 bmac_loopback ; long tmp ; long tmp___0 ; { bp = params->bp; bnx2x_status = 0; bmac_loopback = (unsigned int )params->loopback_mode == 2U; if ((params->feature_config_flags & 2U) != 0U) { vars->link_status = vars->link_status | 536870912U; } else { vars->link_status = vars->link_status & 3758096383U; } bnx2x_update_mng(params, vars->link_status); bnx2x_update_pfc_nig(params, vars, pfc_params); if ((unsigned int )vars->link_up == 0U) { return (bnx2x_status); } else { } tmp = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp != 0L) { printk("\rbnx2x: [%s:%d(%s)]About to update PFC in BMAC\n", "bnx2x_update_pfc", 2354, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } if (((((((((bp->common.chip_id >> 16 == 5770U || bp->common.chip_id >> 16 == 5797U) || bp->common.chip_id >> 16 == 5801U) || bp->common.chip_id >> 16 == 5774U) || bp->common.chip_id >> 16 == 5806U) || bp->common.chip_id >> 16 == 5807U) || ((bp->common.chip_id >> 16 == 5693U || bp->common.chip_id >> 16 == 5694U) || bp->common.chip_id >> 16 == 5695U)) || ((bp->common.chip_id >> 16 == 5793U || bp->common.chip_id >> 16 == 5794U) || bp->common.chip_id >> 16 == 5773U)) || (bp->common.chip_id >> 16 == 5796U || bp->common.chip_id >> 16 == 5803U)) || bp->common.chip_id >> 16 == 5805U) { if ((unsigned int )vars->mac_type == 4U) { bnx2x_update_pfc_xmac(params, vars, 0); } else { } } else { val = readl((void const volatile *)bp->regview + 42384U); if (((u32 )(1 << (int )params->port) & val) == 0U) { tmp___0 = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp___0 != 0L) { printk("\rbnx2x: [%s:%d(%s)]About to update PFC in EMAC\n", "bnx2x_update_pfc", 2364, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } bnx2x_emac_enable(params, vars, 0); return (bnx2x_status); } else { } if ((bp->common.chip_id >> 16 == 5730U || bp->common.chip_id >> 16 == 5731U) || bp->common.chip_id >> 16 == 5743U) { bnx2x_update_pfc_bmac2(params, vars, (int )bmac_loopback); } else { bnx2x_update_pfc_bmac1(params, vars); } val = 0U; if ((params->feature_config_flags & 2U) != 0U || ((int )vars->flow_ctrl & 256) != 0) { val = 1U; } else { } writel(val, (void volatile *)bp->regview + (unsigned long )(((int )params->port + 16452) * 4)); } return (bnx2x_status); } } static int bnx2x_bmac1_enable(struct link_params *params , struct link_vars *vars , u8 is_lb ) { struct bnx2x *bp ; u8 port ; u32 bmac_addr ; u32 wb_data[2U] ; u32 val ; long tmp ; size_t __len ; void *__ret ; size_t __len___0 ; void *__ret___0 ; long tmp___0 ; size_t __len___1 ; void *__ret___1 ; size_t __len___2 ; void *__ret___2 ; size_t __len___3 ; void *__ret___3 ; size_t __len___4 ; void *__ret___4 ; size_t __len___5 ; void *__ret___5 ; { bp = params->bp; port = params->port; bmac_addr = (unsigned int )port != 0U ? 69632U : 68608U; tmp = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp != 0L) { printk("\rbnx2x: [%s:%d(%s)]Enabling BigMAC1\n", "bnx2x_bmac1_enable", 2394, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } wb_data[0] = 60U; wb_data[1] = 0U; __len = 8UL; if (__len > 63UL) { __ret = __memcpy((void *)(& (bp->slowpath)->wb_data), (void const *)(& wb_data), __len); } else { __ret = __builtin_memcpy((void *)(& (bp->slowpath)->wb_data), (void const *)(& wb_data), __len); } bnx2x_write_dmae(bp, bp->slowpath_mapping + 4392ULL, bmac_addr + 8U, 2U); wb_data[0] = (u32 )(((((int )params->mac_addr[2] << 24) | ((int )params->mac_addr[3] << 16)) | ((int )params->mac_addr[4] << 8)) | (int )params->mac_addr[5]); wb_data[1] = (u32 )(((int )params->mac_addr[0] << 8) | (int )params->mac_addr[1]); __len___0 = 8UL; if (__len___0 > 63UL) { __ret___0 = __memcpy((void *)(& (bp->slowpath)->wb_data), (void const *)(& wb_data), __len___0); } else { __ret___0 = __builtin_memcpy((void *)(& (bp->slowpath)->wb_data), (void const *)(& wb_data), __len___0); } bnx2x_write_dmae(bp, bp->slowpath_mapping + 4392ULL, bmac_addr + 64U, 2U); val = 3U; if ((unsigned int )is_lb != 0U) { val = val | 4U; tmp___0 = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp___0 != 0L) { printk("\rbnx2x: [%s:%d(%s)]enable bmac loopback\n", "bnx2x_bmac1_enable", 2415, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } } else { } wb_data[0] = val; wb_data[1] = 0U; __len___1 = 8UL; if (__len___1 > 63UL) { __ret___1 = __memcpy((void *)(& (bp->slowpath)->wb_data), (void const *)(& wb_data), __len___1); } else { __ret___1 = __builtin_memcpy((void *)(& (bp->slowpath)->wb_data), (void const *)(& wb_data), __len___1); } bnx2x_write_dmae(bp, bp->slowpath_mapping + 4392ULL, bmac_addr, 2U); wb_data[0] = 9630U; wb_data[1] = 0U; __len___2 = 8UL; if (__len___2 > 63UL) { __ret___2 = __memcpy((void *)(& (bp->slowpath)->wb_data), (void const *)(& wb_data), __len___2); } else { __ret___2 = __builtin_memcpy((void *)(& (bp->slowpath)->wb_data), (void const *)(& wb_data), __len___2); } bnx2x_write_dmae(bp, bp->slowpath_mapping + 4392ULL, bmac_addr + 280U, 2U); bnx2x_update_pfc_bmac1(params, vars); wb_data[0] = 9630U; wb_data[1] = 0U; __len___3 = 8UL; if (__len___3 > 63UL) { __ret___3 = __memcpy((void *)(& (bp->slowpath)->wb_data), (void const *)(& wb_data), __len___3); } else { __ret___3 = __builtin_memcpy((void *)(& (bp->slowpath)->wb_data), (void const *)(& wb_data), __len___3); } bnx2x_write_dmae(bp, bp->slowpath_mapping + 4392ULL, bmac_addr + 72U, 2U); wb_data[0] = 9630U; wb_data[1] = 0U; __len___4 = 8UL; if (__len___4 > 63UL) { __ret___4 = __memcpy((void *)(& (bp->slowpath)->wb_data), (void const *)(& wb_data), __len___4); } else { __ret___4 = __builtin_memcpy((void *)(& (bp->slowpath)->wb_data), (void const *)(& wb_data), __len___4); } bnx2x_write_dmae(bp, bp->slowpath_mapping + 4392ULL, bmac_addr + 40U, 2U); wb_data[0] = 16777728U; wb_data[1] = 0U; __len___5 = 8UL; if (__len___5 > 63UL) { __ret___5 = __memcpy((void *)(& (bp->slowpath)->wb_data), (void const *)(& wb_data), __len___5); } else { __ret___5 = __builtin_memcpy((void *)(& (bp->slowpath)->wb_data), (void const *)(& wb_data), __len___5); } bnx2x_write_dmae(bp, bp->slowpath_mapping + 4392ULL, bmac_addr + 560U, 2U); return (0); } } static int bnx2x_bmac2_enable(struct link_params *params , struct link_vars *vars , u8 is_lb ) { struct bnx2x *bp ; u8 port ; u32 bmac_addr ; u32 wb_data[2U] ; long tmp ; size_t __len ; void *__ret ; size_t __len___0 ; void *__ret___0 ; size_t __len___1 ; void *__ret___1 ; size_t __len___2 ; void *__ret___2 ; size_t __len___3 ; void *__ret___3 ; size_t __len___4 ; void *__ret___4 ; size_t __len___5 ; void *__ret___5 ; { bp = params->bp; port = params->port; bmac_addr = (unsigned int )port != 0U ? 69632U : 68608U; tmp = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp != 0L) { printk("\rbnx2x: [%s:%d(%s)]Enabling BigMAC2\n", "bnx2x_bmac2_enable", 2457, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } wb_data[0] = 0U; wb_data[1] = 0U; __len = 8UL; if (__len > 63UL) { __ret = __memcpy((void *)(& (bp->slowpath)->wb_data), (void const *)(& wb_data), __len); } else { __ret = __builtin_memcpy((void *)(& (bp->slowpath)->wb_data), (void const *)(& wb_data), __len); } bnx2x_write_dmae(bp, bp->slowpath_mapping + 4392ULL, bmac_addr, 2U); __const_udelay(128850UL); wb_data[0] = 60U; wb_data[1] = 0U; __len___0 = 8UL; if (__len___0 > 63UL) { __ret___0 = __memcpy((void *)(& (bp->slowpath)->wb_data), (void const *)(& wb_data), __len___0); } else { __ret___0 = __builtin_memcpy((void *)(& (bp->slowpath)->wb_data), (void const *)(& wb_data), __len___0); } bnx2x_write_dmae(bp, bp->slowpath_mapping + 4392ULL, bmac_addr + 8U, 2U); __const_udelay(128850UL); wb_data[0] = (u32 )(((((int )params->mac_addr[2] << 24) | ((int )params->mac_addr[3] << 16)) | ((int )params->mac_addr[4] << 8)) | (int )params->mac_addr[5]); wb_data[1] = (u32 )(((int )params->mac_addr[0] << 8) | (int )params->mac_addr[1]); __len___1 = 8UL; if (__len___1 > 63UL) { __ret___1 = __memcpy((void *)(& (bp->slowpath)->wb_data), (void const *)(& wb_data), __len___1); } else { __ret___1 = __builtin_memcpy((void *)(& (bp->slowpath)->wb_data), (void const *)(& wb_data), __len___1); } bnx2x_write_dmae(bp, bp->slowpath_mapping + 4392ULL, bmac_addr + 232U, 2U); __const_udelay(128850UL); wb_data[0] = 16777728U; wb_data[1] = 0U; __len___2 = 8UL; if (__len___2 > 63UL) { __ret___2 = __memcpy((void *)(& (bp->slowpath)->wb_data), (void const *)(& wb_data), __len___2); } else { __ret___2 = __builtin_memcpy((void *)(& (bp->slowpath)->wb_data), (void const *)(& wb_data), __len___2); } bnx2x_write_dmae(bp, bp->slowpath_mapping + 4392ULL, bmac_addr + 784U, 2U); __const_udelay(128850UL); wb_data[0] = 9630U; wb_data[1] = 0U; __len___3 = 8UL; if (__len___3 > 63UL) { __ret___3 = __memcpy((void *)(& (bp->slowpath)->wb_data), (void const *)(& wb_data), __len___3); } else { __ret___3 = __builtin_memcpy((void *)(& (bp->slowpath)->wb_data), (void const *)(& wb_data), __len___3); } bnx2x_write_dmae(bp, bp->slowpath_mapping + 4392ULL, bmac_addr + 480U, 2U); __const_udelay(128850UL); wb_data[0] = 9630U; wb_data[1] = 0U; __len___4 = 8UL; if (__len___4 > 63UL) { __ret___4 = __memcpy((void *)(& (bp->slowpath)->wb_data), (void const *)(& wb_data), __len___4); } else { __ret___4 = __builtin_memcpy((void *)(& (bp->slowpath)->wb_data), (void const *)(& wb_data), __len___4); } bnx2x_write_dmae(bp, bp->slowpath_mapping + 4392ULL, bmac_addr + 240U, 2U); __const_udelay(128850UL); wb_data[0] = 9628U; wb_data[1] = 0U; __len___5 = 8UL; if (__len___5 > 63UL) { __ret___5 = __memcpy((void *)(& (bp->slowpath)->wb_data), (void const *)(& wb_data), __len___5); } else { __ret___5 = __builtin_memcpy((void *)(& (bp->slowpath)->wb_data), (void const *)(& wb_data), __len___5); } bnx2x_write_dmae(bp, bp->slowpath_mapping + 4392ULL, bmac_addr + 40U, 2U); __const_udelay(128850UL); bnx2x_update_pfc_bmac2(params, vars, (int )is_lb); return (0); } } static int bnx2x_bmac_enable(struct link_params *params , struct link_vars *vars , u8 is_lb , u8 reset_bmac ) { int rc ; u8 port ; struct bnx2x *bp ; u32 val ; { rc = 0; port = params->port; bp = params->bp; if ((unsigned int )reset_bmac != 0U) { writel((unsigned int )(1 << (int )port), (void volatile *)bp->regview + 42392U); usleep_range(1000UL, 2000UL); } else { } writel((unsigned int )(1 << (int )port), (void volatile *)bp->regview + 42388U); writel(1U, (void volatile *)bp->regview + (unsigned long )(((int )port + 16442) * 4)); if ((bp->common.chip_id >> 16 == 5730U || bp->common.chip_id >> 16 == 5731U) || bp->common.chip_id >> 16 == 5743U) { rc = bnx2x_bmac2_enable(params, vars, (int )is_lb); } else { rc = bnx2x_bmac1_enable(params, vars, (int )is_lb); } writel(1U, (void volatile *)bp->regview + (unsigned long )(((int )port + 16568) * 4)); writel(0U, (void volatile *)bp->regview + (unsigned long )(((int )port + 16570) * 4)); writel(0U, (void volatile *)bp->regview + (unsigned long )(((int )port + 16406) * 4)); val = 0U; if ((params->feature_config_flags & 2U) != 0U || ((int )vars->flow_ctrl & 256) != 0) { val = 1U; } else { } writel(val, (void volatile *)bp->regview + (unsigned long )(((int )port + 16452) * 4)); writel(0U, (void volatile *)bp->regview + (unsigned long )(((int )port + 16456) * 4)); writel(0U, (void volatile *)bp->regview + (unsigned long )(((int )port + 16425) * 4)); writel(0U, (void volatile *)bp->regview + (unsigned long )(((int )port + 16454) * 4)); writel(1U, (void volatile *)bp->regview + (unsigned long )(((int )port + 16427) * 4)); writel(1U, (void volatile *)bp->regview + (unsigned long )(((int )port + 16440) * 4)); vars->mac_type = 2U; return (rc); } } static void bnx2x_set_bmac_rx(struct bnx2x *bp , u32 chip_id , u8 port , u8 en ) { u32 bmac_addr ; u32 wb_data[2U] ; u32 nig_bmac_enable ; unsigned int tmp ; size_t __len ; void *__ret ; size_t __len___0 ; void *__ret___0 ; unsigned int tmp___0 ; { bmac_addr = (unsigned int )port != 0U ? 69632U : 68608U; tmp = readl((void const volatile *)bp->regview + (unsigned long )(((int )port + 16442) * 4)); nig_bmac_enable = tmp; if ((bp->common.chip_id >> 16 == 5730U || bp->common.chip_id >> 16 == 5731U) || bp->common.chip_id >> 16 == 5743U) { bmac_addr = bmac_addr; } else { bmac_addr = bmac_addr; } tmp___0 = readl((void const volatile *)bp->regview + 42384U); if ((tmp___0 & (unsigned int )(1 << (int )port)) != 0U && nig_bmac_enable != 0U) { bnx2x_read_dmae(bp, bmac_addr, 2U); __len = 8UL; if (__len > 63UL) { __ret = __memcpy((void *)(& wb_data), (void const *)(& (bp->slowpath)->wb_data), __len); } else { __ret = __builtin_memcpy((void *)(& wb_data), (void const *)(& (bp->slowpath)->wb_data), __len); } if ((unsigned int )en != 0U) { wb_data[0] = wb_data[0] | 2U; } else { wb_data[0] = wb_data[0] & 4294967293U; } __len___0 = 8UL; if (__len___0 > 63UL) { __ret___0 = __memcpy((void *)(& (bp->slowpath)->wb_data), (void const *)(& wb_data), __len___0); } else { __ret___0 = __builtin_memcpy((void *)(& (bp->slowpath)->wb_data), (void const *)(& wb_data), __len___0); } bnx2x_write_dmae(bp, bp->slowpath_mapping + 4392ULL, bmac_addr, 2U); usleep_range(1000UL, 2000UL); } else { } return; } } static int bnx2x_pbf_update(struct link_params *params , u32 flow_ctrl , u32 line_speed ) { struct bnx2x *bp ; u8 port ; u32 init_crd ; u32 crd ; u32 count ; long tmp ; long tmp___0 ; u32 thresh ; long tmp___1 ; long tmp___2 ; { bp = params->bp; port = params->port; count = 1000U; writel(1U, (void volatile *)bp->regview + (unsigned long )(((int )port + 327703) * 4)); init_crd = readl((void const volatile *)bp->regview + (unsigned long )(((int )port + 327732) * 4)); crd = readl((void const volatile *)bp->regview + (unsigned long )(((int )port + 163904) * 8)); tmp = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp != 0L) { printk("\rbnx2x: [%s:%d(%s)]init_crd 0x%x crd 0x%x\n", "bnx2x_pbf_update", 2597, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", init_crd, crd); } else { } goto ldv_45613; ldv_45612: usleep_range(5000UL, 10000UL); crd = readl((void const volatile *)bp->regview + (unsigned long )(((int )port + 163904) * 8)); count = count - 1U; ldv_45613: ; if (init_crd != crd && count != 0U) { goto ldv_45612; } else { } crd = readl((void const volatile *)bp->regview + (unsigned long )(((int )port + 163904) * 8)); if (init_crd != crd) { tmp___0 = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp___0 != 0L) { printk("\rbnx2x: [%s:%d(%s)]BUG! init_crd 0x%x != crd 0x%x\n", "bnx2x_pbf_update", 2607, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", init_crd, crd); } else { } return (-22); } else { } if (((((flow_ctrl & 512U) != 0U || line_speed == 10U) || line_speed == 100U) || line_speed == 1000U) || line_speed == 2500U) { writel(1U, (void volatile *)bp->regview + (unsigned long )(((int )port + 327685) * 4)); writel(0U, (void volatile *)bp->regview + (unsigned long )(((int )port + 327737) * 4)); init_crd = 778U; } else { thresh = 601U; writel(0U, (void volatile *)bp->regview + (unsigned long )(((int )port + 327685) * 4)); writel(thresh, (void volatile *)bp->regview + (unsigned long )(((int )port + 327737) * 4)); switch (line_speed) { case 10000U: init_crd = thresh + 531U; goto ldv_45617; default: tmp___1 = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp___1 != 0L) { printk("\rbnx2x: [%s:%d(%s)]Invalid line_speed 0x%x\n", "bnx2x_pbf_update", 2635, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", line_speed); } else { } return (-22); } ldv_45617: ; } writel(init_crd, (void volatile *)bp->regview + (unsigned long )(((int )port + 327732) * 4)); tmp___2 = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp___2 != 0L) { printk("\rbnx2x: [%s:%d(%s)]PBF updated to speed %d credit %d\n", "bnx2x_pbf_update", 2641, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", line_speed, init_crd); } else { } writel(1U, (void volatile *)bp->regview + (unsigned long )(((int )port + 327681) * 4)); usleep_range(5000UL, 10000UL); writel(0U, (void volatile *)bp->regview + (unsigned long )(((int )port + 327681) * 4)); writel(0U, (void volatile *)bp->regview + (unsigned long )(((int )port + 327703) * 4)); return (0); } } static u32 bnx2x_get_emac_base(struct bnx2x *bp , u32 mdc_mdio_access , u8 port ) { u32 emac_base ; unsigned int tmp ; unsigned int tmp___0 ; { emac_base = 0U; switch (mdc_mdio_access) { case 0U: ; goto ldv_45626; case 67108864U: tmp = readl((void const volatile *)bp->regview + 66452U); if (tmp != 0U) { emac_base = 33792U; } else { emac_base = 32768U; } goto ldv_45626; case 134217728U: tmp___0 = readl((void const volatile *)bp->regview + 66452U); if (tmp___0 != 0U) { emac_base = 32768U; } else { emac_base = 33792U; } goto ldv_45626; case 201326592U: emac_base = (unsigned int )port != 0U ? 33792U : 32768U; goto ldv_45626; case 268435456U: emac_base = (unsigned int )port != 0U ? 32768U : 33792U; goto ldv_45626; default: ; goto ldv_45626; } ldv_45626: ; return (emac_base); } } static int bnx2x_cl22_write(struct bnx2x *bp , struct bnx2x_phy *phy , u16 reg , u16 val ) { u32 tmp ; u32 mode ; u8 i ; int rc ; long tmp___0 ; { rc = 0; mode = readl((void const volatile *)bp->regview + (unsigned long )(phy->mdio_ctrl + 180U)); writel(mode & 2147483647U, (void volatile *)bp->regview + (unsigned long )(phy->mdio_ctrl + 180U)); tmp = (u32 )(((((int )phy->addr << 21) | ((int )reg << 16)) | (int )val) | 603979776); writel(tmp, (void volatile *)bp->regview + (unsigned long )(phy->mdio_ctrl + 172U)); i = 0U; goto ldv_45644; ldv_45643: __const_udelay(42950UL); tmp = readl((void const volatile *)bp->regview + (unsigned long )(phy->mdio_ctrl + 172U)); if (((long )tmp & 536870912L) == 0L) { __const_udelay(21475UL); goto ldv_45642; } else { } i = (u8 )((int )i + 1); ldv_45644: ; if ((unsigned int )i <= 49U) { goto ldv_45643; } else { } ldv_45642: ; if (((long )tmp & 536870912L) != 0L) { tmp___0 = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp___0 != 0L) { printk("\rbnx2x: [%s:%d(%s)]write phy register failed\n", "bnx2x_cl22_write", 2731, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } rc = -14; } else { } writel(mode, (void volatile *)bp->regview + (unsigned long )(phy->mdio_ctrl + 180U)); return (rc); } } static int bnx2x_cl22_read(struct bnx2x *bp , struct bnx2x_phy *phy , u16 reg , u16 *ret_val ) { u32 val ; u32 mode ; u16 i ; int rc ; long tmp ; { rc = 0; mode = readl((void const volatile *)bp->regview + (unsigned long )(phy->mdio_ctrl + 180U)); writel(mode & 2147483647U, (void volatile *)bp->regview + (unsigned long )(phy->mdio_ctrl + 180U)); val = (u32 )((((int )phy->addr << 21) | ((int )reg << 16)) | 671088640); writel(val, (void volatile *)bp->regview + (unsigned long )(phy->mdio_ctrl + 172U)); i = 0U; goto ldv_45658; ldv_45657: __const_udelay(42950UL); val = readl((void const volatile *)bp->regview + (unsigned long )(phy->mdio_ctrl + 172U)); if (((long )val & 536870912L) == 0L) { *ret_val = (unsigned short )val; __const_udelay(21475UL); goto ldv_45656; } else { } i = (u16 )((int )i + 1); ldv_45658: ; if ((unsigned int )i <= 49U) { goto ldv_45657; } else { } ldv_45656: ; if (((long )val & 536870912L) != 0L) { tmp = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp != 0L) { printk("\rbnx2x: [%s:%d(%s)]read phy register failed\n", "bnx2x_cl22_read", 2768, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } *ret_val = 0U; rc = -14; } else { } writel(mode, (void volatile *)bp->regview + (unsigned long )(phy->mdio_ctrl + 180U)); return (rc); } } static int bnx2x_cl45_read(struct bnx2x *bp , struct bnx2x_phy *phy , u8 devad , u16 reg , u16 *ret_val ) { u32 val ; u16 i ; int rc ; u32 chip_id ; unsigned int tmp ; unsigned int tmp___0 ; long tmp___1 ; long tmp___2 ; u16 temp_val ; { rc = 0; if ((int )((short )phy->flags) < 0) { tmp = readl((void const volatile *)bp->regview + 41992U); tmp___0 = readl((void const volatile *)bp->regview + 41996U); chip_id = (tmp << 16) | ((tmp___0 << 12) & 65535U); bnx2x_set_mdio_clk(bp, chip_id, phy->mdio_ctrl); } else { } if (((int )phy->flags & 1024) != 0) { bnx2x_bits_en(bp, phy->mdio_ctrl + 176U, 2U); } else { } val = (u32 )(((((int )phy->addr << 21) | ((int )devad << 16)) | (int )reg) | 536870912); writel(val, (void volatile *)bp->regview + (unsigned long )(phy->mdio_ctrl + 172U)); i = 0U; goto ldv_45673; ldv_45672: __const_udelay(42950UL); val = readl((void const volatile *)bp->regview + (unsigned long )(phy->mdio_ctrl + 172U)); if (((long )val & 536870912L) == 0L) { __const_udelay(21475UL); goto ldv_45671; } else { } i = (u16 )((int )i + 1); ldv_45673: ; if ((unsigned int )i <= 49U) { goto ldv_45672; } else { } ldv_45671: ; if (((long )val & 536870912L) != 0L) { tmp___1 = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp___1 != 0L) { printk("\rbnx2x: [%s:%d(%s)]read phy register failed\n", "bnx2x_cl45_read", 2812, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } netdev_err((struct net_device const *)bp->dev, "MDC/MDIO access timeout\n"); *ret_val = 0U; rc = -14; } else { val = (u32 )((((int )phy->addr << 21) | ((int )devad << 16)) | 738197504); writel(val, (void volatile *)bp->regview + (unsigned long )(phy->mdio_ctrl + 172U)); i = 0U; goto ldv_45677; ldv_45676: __const_udelay(42950UL); val = readl((void const volatile *)bp->regview + (unsigned long )(phy->mdio_ctrl + 172U)); if (((long )val & 536870912L) == 0L) { *ret_val = (unsigned short )val; goto ldv_45675; } else { } i = (u16 )((int )i + 1); ldv_45677: ; if ((unsigned int )i <= 49U) { goto ldv_45676; } else { } ldv_45675: ; if (((long )val & 536870912L) != 0L) { tmp___2 = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp___2 != 0L) { printk("\rbnx2x: [%s:%d(%s)]read phy register failed\n", "bnx2x_cl45_read", 2834, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } netdev_err((struct net_device const *)bp->dev, "MDC/MDIO access timeout\n"); *ret_val = 0U; rc = -14; } else { } } if (((int )phy->flags & 256) != 0) { phy->flags = (u16 )((unsigned int )phy->flags ^ 512U); if (((int )phy->flags & 512) != 0) { bnx2x_cl45_read(bp, phy, (int )devad, 15, & temp_val); } else { } } else { } if (((int )phy->flags & 1024) != 0) { bnx2x_bits_dis(bp, phy->mdio_ctrl + 176U, 2U); } else { } return (rc); } } static int bnx2x_cl45_write(struct bnx2x *bp , struct bnx2x_phy *phy , u8 devad , u16 reg , u16 val ) { u32 tmp ; u8 i ; int rc ; u32 chip_id ; unsigned int tmp___0 ; unsigned int tmp___1 ; long tmp___2 ; long tmp___3 ; u16 temp_val ; { rc = 0; if ((int )((short )phy->flags) < 0) { tmp___0 = readl((void const volatile *)bp->regview + 41992U); tmp___1 = readl((void const volatile *)bp->regview + 41996U); chip_id = (tmp___0 << 16) | ((tmp___1 << 12) & 65535U); bnx2x_set_mdio_clk(bp, chip_id, phy->mdio_ctrl); } else { } if (((int )phy->flags & 1024) != 0) { bnx2x_bits_en(bp, phy->mdio_ctrl + 176U, 2U); } else { } tmp = (u32 )(((((int )phy->addr << 21) | ((int )devad << 16)) | (int )reg) | 536870912); writel(tmp, (void volatile *)bp->regview + (unsigned long )(phy->mdio_ctrl + 172U)); i = 0U; goto ldv_45692; ldv_45691: __const_udelay(42950UL); tmp = readl((void const volatile *)bp->regview + (unsigned long )(phy->mdio_ctrl + 172U)); if (((long )tmp & 536870912L) == 0L) { __const_udelay(21475UL); goto ldv_45690; } else { } i = (u8 )((int )i + 1); ldv_45692: ; if ((unsigned int )i <= 49U) { goto ldv_45691; } else { } ldv_45690: ; if (((long )tmp & 536870912L) != 0L) { tmp___2 = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp___2 != 0L) { printk("\rbnx2x: [%s:%d(%s)]write phy register failed\n", "bnx2x_cl45_write", 2888, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } netdev_err((struct net_device const *)bp->dev, "MDC/MDIO access timeout\n"); rc = -14; } else { tmp = (u32 )(((((int )phy->addr << 21) | ((int )devad << 16)) | (int )val) | 603979776); writel(tmp, (void volatile *)bp->regview + (unsigned long )(phy->mdio_ctrl + 172U)); i = 0U; goto ldv_45696; ldv_45695: __const_udelay(42950UL); tmp = readl((void const volatile *)bp->regview + (unsigned long )(phy->mdio_ctrl + 172U)); if (((long )tmp & 536870912L) == 0L) { __const_udelay(21475UL); goto ldv_45694; } else { } i = (u8 )((int )i + 1); ldv_45696: ; if ((unsigned int )i <= 49U) { goto ldv_45695; } else { } ldv_45694: ; if (((long )tmp & 536870912L) != 0L) { tmp___3 = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp___3 != 0L) { printk("\rbnx2x: [%s:%d(%s)]write phy register failed\n", "bnx2x_cl45_write", 2909, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } netdev_err((struct net_device const *)bp->dev, "MDC/MDIO access timeout\n"); rc = -14; } else { } } if (((int )phy->flags & 256) != 0) { phy->flags = (u16 )((unsigned int )phy->flags ^ 512U); if (((int )phy->flags & 512) != 0) { bnx2x_cl45_read(bp, phy, (int )devad, 15, & temp_val); } else { } } else { } if (((int )phy->flags & 1024) != 0) { bnx2x_bits_dis(bp, phy->mdio_ctrl + 176U, 2U); } else { } return (rc); } } static u8 bnx2x_eee_has_cap(struct link_params *params ) { struct bnx2x *bp ; unsigned int tmp ; { bp = params->bp; tmp = readl((void const volatile *)bp->regview + (unsigned long )params->shmem2_base); if ((unsigned long )tmp <= ((unsigned long )params->port + 76UL) * 4UL) { return (0U); } else { } return (1U); } } static int bnx2x_eee_nvram_to_time(u32 nvram_mode , u32 *idle_timer ) { { switch (nvram_mode) { case 1U: *idle_timer = 2560U; goto ldv_45707; case 2U: *idle_timer = 256U; goto ldv_45707; case 3U: *idle_timer = 24576U; goto ldv_45707; default: *idle_timer = 0U; goto ldv_45707; } ldv_45707: ; return (0); } } static int bnx2x_eee_time_to_nvram(u32 idle_timer , u32 *nvram_mode ) { { switch (idle_timer) { case 2560U: *nvram_mode = 1U; goto ldv_45716; case 256U: *nvram_mode = 2U; goto ldv_45716; case 24576U: *nvram_mode = 3U; goto ldv_45716; default: *nvram_mode = 0U; goto ldv_45716; } ldv_45716: ; return (0); } } static u32 bnx2x_eee_calc_timer(struct link_params *params ) { u32 eee_mode ; u32 eee_idle ; struct bnx2x *bp ; int tmp ; unsigned int tmp___0 ; int tmp___1 ; { bp = params->bp; if ((params->eee_mode & 536870912U) != 0U) { if ((params->eee_mode & 268435456U) != 0U) { eee_idle = params->eee_mode & 1048575U; } else { tmp = bnx2x_eee_nvram_to_time(params->eee_mode & 3U, & eee_idle); if (tmp != 0) { return (0U); } else { } } } else { tmp___0 = readl((void const volatile *)(bp->regview + (((unsigned long )params->shmem_base + (unsigned long )params->port * 116UL) + 904UL))); eee_mode = tmp___0 & 255U; tmp___1 = bnx2x_eee_nvram_to_time(eee_mode, & eee_idle); if (tmp___1 != 0) { return (0U); } else { } } return (eee_idle); } } static int bnx2x_eee_set_timers(struct link_params *params , struct link_vars *vars ) { u32 eee_idle ; u32 eee_mode ; struct bnx2x *bp ; long tmp ; int tmp___0 ; { eee_idle = 0U; bp = params->bp; eee_idle = bnx2x_eee_calc_timer(params); if (eee_idle != 0U) { writel(eee_idle, (void volatile *)bp->regview + (unsigned long )(((int )params->port << 2) + 43168)); } else if (((params->eee_mode & 1073741824U) != 0U && (params->eee_mode & 536870912U) != 0U) && (params->eee_mode & 268435456U) != 0U) { tmp = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp != 0L) { printk("\rbnx2x: [%s:%d(%s)]Error: Tx LPI is enabled with timer 0\n", "bnx2x_eee_set_timers", 3028, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } return (-22); } else { } vars->eee_status = vars->eee_status & 2147418112U; if ((params->eee_mode & 268435456U) != 0U) { eee_idle = eee_idle >> 4; vars->eee_status = (vars->eee_status | (eee_idle & 65535U)) | 2147483648U; } else { tmp___0 = bnx2x_eee_time_to_nvram(eee_idle, & eee_mode); if (tmp___0 != 0) { return (-22); } else { } vars->eee_status = vars->eee_status | eee_mode; } return (0); } } static int bnx2x_eee_initial_config(struct link_params *params , struct link_vars *vars , u8 mode ) { int tmp ; { vars->eee_status = vars->eee_status | ((unsigned int )mode << 16); if ((params->eee_mode & 1073741824U) != 0U) { vars->eee_status = vars->eee_status | 536870912U; } else { vars->eee_status = vars->eee_status & 3758096383U; } if ((int )params->eee_mode < 0) { vars->eee_status = vars->eee_status | 268435456U; } else { vars->eee_status = vars->eee_status & 4026531839U; } tmp = bnx2x_eee_set_timers(params, vars); return (tmp); } } static int bnx2x_eee_disable(struct bnx2x_phy *phy , struct link_params *params , struct link_vars *vars ) { struct bnx2x *bp ; { bp = params->bp; writel(0U, (void volatile *)bp->regview + (unsigned long )(((int )params->port << 2) + 43084)); bnx2x_cl45_write(bp, phy, 7, 60, 0); vars->eee_status = vars->eee_status & 4279238655U; return (0); } } static int bnx2x_eee_advertise(struct bnx2x_phy *phy , struct link_params *params , struct link_vars *vars , u8 modes ) { struct bnx2x *bp ; u16 val ; long tmp ; long tmp___0 ; { bp = params->bp; val = 0U; writel(64544U, (void volatile *)bp->regview + (unsigned long )(((int )params->port << 2) + 43144)); if (((int )modes & 4) != 0) { tmp = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp != 0L) { printk("\rbnx2x: [%s:%d(%s)]Advertise 10GBase-T EEE\n", "bnx2x_eee_advertise", 3093, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } val = (u16 )((unsigned int )val | 8U); } else { } if (((int )modes & 2) != 0) { tmp___0 = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp___0 != 0L) { printk("\rbnx2x: [%s:%d(%s)]Advertise 1GBase-T EEE\n", "bnx2x_eee_advertise", 3097, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } val = (u16 )((unsigned int )val | 4U); } else { } bnx2x_cl45_write(bp, phy, 7, 60, (int )val); vars->eee_status = vars->eee_status & 4279238655U; vars->eee_status = vars->eee_status | (u32 )((int )modes << 20); return (0); } } static void bnx2x_update_mng_eee(struct link_params *params , u32 eee_status ) { struct bnx2x *bp ; u8 tmp ; { bp = params->bp; tmp = bnx2x_eee_has_cap(params); if ((unsigned int )tmp != 0U) { writel(eee_status, (void volatile *)(bp->regview + ((unsigned long )params->shmem2_base + ((unsigned long )params->port + 76UL) * 4UL))); } else { } return; } } static void bnx2x_eee_an_resolve(struct bnx2x_phy *phy , struct link_params *params , struct link_vars *vars ) { struct bnx2x *bp ; u16 adv ; u16 lp ; u32 lp_adv ; u8 neg ; long tmp ; long tmp___0 ; long tmp___1 ; long tmp___2 ; { bp = params->bp; adv = 0U; lp = 0U; lp_adv = 0U; neg = 0U; bnx2x_cl45_read(bp, phy, 7, 60, & adv); bnx2x_cl45_read(bp, phy, 7, 61, & lp); if (((int )lp & 2) != 0) { lp_adv = lp_adv | 1U; if (((int )adv & 2) != 0) { if ((unsigned int )vars->line_speed == 100U) { neg = 1U; } else { } tmp = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp != 0L) { printk("\rbnx2x: [%s:%d(%s)]EEE negotiated - 100M\n", "bnx2x_eee_an_resolve", 3136, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } } else { } } else { } if (((int )lp & 20) != 0) { lp_adv = lp_adv | 2U; if (((int )adv & 20) != 0) { if ((unsigned int )vars->line_speed == 1000U) { neg = 1U; } else { } tmp___0 = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp___0 != 0L) { printk("\rbnx2x: [%s:%d(%s)]EEE negotiated - 1G\n", "bnx2x_eee_an_resolve", 3144, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } } else { } } else { } if (((int )lp & 104) != 0) { lp_adv = lp_adv | 4U; if (((int )adv & 104) != 0) { if ((unsigned int )vars->line_speed == 10000U) { neg = 1U; } else { } tmp___1 = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp___1 != 0L) { printk("\rbnx2x: [%s:%d(%s)]EEE negotiated - 10G\n", "bnx2x_eee_an_resolve", 3152, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } } else { } } else { } vars->eee_status = vars->eee_status & 4043309055U; vars->eee_status = vars->eee_status | (lp_adv << 24); if ((unsigned int )neg != 0U) { tmp___2 = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp___2 != 0L) { printk("\rbnx2x: [%s:%d(%s)]EEE is active\n", "bnx2x_eee_an_resolve", 3160, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } vars->eee_status = vars->eee_status | 1073741824U; } else { } return; } } static void bnx2x_bsc_module_sel(struct link_params *params ) { int idx ; u32 board_cfg ; u32 sfp_ctrl ; u32 i2c_pins[2U] ; u32 i2c_val[2U] ; struct bnx2x *bp ; u8 port ; long tmp ; { bp = params->bp; port = params->port; board_cfg = readl((void const volatile *)(bp->regview + ((unsigned long )params->shmem_base + 44UL))); i2c_pins[0] = board_cfg & 63U; i2c_pins[1] = (board_cfg & 4032U) >> 6; sfp_ctrl = readl((void const volatile *)(bp->regview + (((unsigned long )params->shmem_base + (unsigned long )port * 400UL) + 116UL))); i2c_val[0] = (sfp_ctrl & 16777216U) != 0U; i2c_val[1] = (sfp_ctrl & 33554432U) != 0U; tmp = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp != 0L) { printk("\rbnx2x: [%s:%d(%s)]Setting BSC switch\n", "bnx2x_bsc_module_sel", 3190, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } idx = 0; goto ldv_45782; ldv_45781: bnx2x_set_cfg_pin(bp, i2c_pins[idx], i2c_val[idx]); idx = idx + 1; ldv_45782: ; if (idx <= 1) { goto ldv_45781; } else { } return; } } static int bnx2x_bsc_read(struct link_params *params , struct bnx2x_phy *phy , u8 sl_devid , u16 sl_addr , u8 lc_addr , u8 xfer_cnt , u32 *data_array ) { u32 val ; u32 i ; int rc ; struct bnx2x *bp ; long tmp ; long tmp___0 ; u32 tmp___1 ; long tmp___2 ; u32 tmp___3 ; { rc = 0; bp = params->bp; if ((unsigned int )xfer_cnt > 16U) { tmp = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp != 0L) { printk("\rbnx2x: [%s:%d(%s)]invalid xfer_cnt %d. Max is 16 bytes\n", "bnx2x_bsc_read", 3209, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )xfer_cnt); } else { } return (-22); } else { } bnx2x_bsc_module_sel(params); xfer_cnt = 16U - (unsigned int )lc_addr; val = readl((void const volatile *)bp->regview + 547072U); val = val | 2147483648U; writel(val, (void volatile *)bp->regview + 547072U); val = (u32 )(((int )sl_devid << 16) | (int )sl_addr); writel(val, (void volatile *)bp->regview + 547076U); val = (u32 )(((int )lc_addr << 8) | -1610612736); writel(val, (void volatile *)bp->regview + 547072U); i = 0U; val = readl((void const volatile *)bp->regview + 547072U); goto ldv_45800; ldv_45799: __const_udelay(42950UL); val = readl((void const volatile *)bp->regview + 547072U); tmp___1 = i; i = i + 1U; if (tmp___1 > 1000U) { tmp___0 = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp___0 != 0L) { printk("\rbnx2x: [%s:%d(%s)]wr 0 byte timed out after %d try\n", "bnx2x_bsc_read", 3240, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", i); } else { } rc = -14; goto ldv_45798; } else { } ldv_45800: ; if (((val >> 16) & 3U) != 1U) { goto ldv_45799; } else { } ldv_45798: ; if (rc == -14) { return (rc); } else { } val = (u32 )((((int )lc_addr << 8) | -1879048192) | (int )xfer_cnt); writel(val, (void volatile *)bp->regview + 547072U); i = 0U; val = readl((void const volatile *)bp->regview + 547072U); goto ldv_45803; ldv_45802: __const_udelay(42950UL); val = readl((void const volatile *)bp->regview + 547072U); tmp___3 = i; i = i + 1U; if (tmp___3 > 1000U) { tmp___2 = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp___2 != 0L) { printk("\rbnx2x: [%s:%d(%s)]rd op timed out after %d try\n", "bnx2x_bsc_read", 3263, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", i); } else { } rc = -14; goto ldv_45801; } else { } ldv_45803: ; if (((val >> 16) & 3U) != 1U) { goto ldv_45802; } else { } ldv_45801: ; if (rc == -14) { return (rc); } else { } i = (u32 )((int )lc_addr >> 2); goto ldv_45805; ldv_45804: *(data_array + (unsigned long )i) = readl((void const volatile *)bp->regview + (unsigned long )((i + 136776U) * 4U)); i = i + 1U; ldv_45805: ; if (i <= 3U) { goto ldv_45804; } else { } return (rc); } } static void bnx2x_cl45_read_or_write(struct bnx2x *bp , struct bnx2x_phy *phy , u8 devad , u16 reg , u16 or_val ) { u16 val ; { bnx2x_cl45_read(bp, phy, (int )devad, (int )reg, & val); bnx2x_cl45_write(bp, phy, (int )devad, (int )reg, (int )val | (int )or_val); return; } } static void bnx2x_cl45_read_and_write(struct bnx2x *bp , struct bnx2x_phy *phy , u8 devad , u16 reg , u16 and_val ) { u16 val ; { bnx2x_cl45_read(bp, phy, (int )devad, (int )reg, & val); bnx2x_cl45_write(bp, phy, (int )devad, (int )reg, (int )val & (int )and_val); return; } } int bnx2x_phy_read(struct link_params *params , u8 phy_addr , u8 devad , u16 reg , u16 *ret_val ) { u8 phy_index ; int tmp ; { phy_index = 0U; goto ldv_45832; ldv_45831: ; if ((int )params->phy[(int )phy_index].addr == (int )phy_addr) { tmp = bnx2x_cl45_read(params->bp, (struct bnx2x_phy *)(& params->phy) + (unsigned long )phy_index, (int )devad, (int )reg, ret_val); return (tmp); } else { } phy_index = (u8 )((int )phy_index + 1); ldv_45832: ; if ((int )params->num_phys > (int )phy_index) { goto ldv_45831; } else { } return (-22); } } int bnx2x_phy_write(struct link_params *params , u8 phy_addr , u8 devad , u16 reg , u16 val ) { u8 phy_index ; int tmp ; { phy_index = 0U; goto ldv_45843; ldv_45842: ; if ((int )params->phy[(int )phy_index].addr == (int )phy_addr) { tmp = bnx2x_cl45_write(params->bp, (struct bnx2x_phy *)(& params->phy) + (unsigned long )phy_index, (int )devad, (int )reg, (int )val); return (tmp); } else { } phy_index = (u8 )((int )phy_index + 1); ldv_45843: ; if ((int )params->num_phys > (int )phy_index) { goto ldv_45842; } else { } return (-22); } } static u8 bnx2x_get_warpcore_lane(struct bnx2x_phy *phy , struct link_params *params ) { u8 lane ; struct bnx2x *bp ; u32 path_swap ; u32 path_swap_ovr ; u8 path ; u8 port ; u32 port_swap ; u32 port_swap_ovr ; u8 tmp ; { lane = 0U; bp = params->bp; path = bp->common.chip_id >> 16 != 5710U && (bp->common.chip_id >> 16 != 5711U && bp->common.chip_id >> 16 != 5712U) ? (unsigned int )bp->pf_num & 1U : 0U; port = params->port; tmp = bnx2x_is_4_port_mode(bp); if ((unsigned int )tmp != 0U) { path_swap_ovr = readl((void const volatile *)bp->regview + 42808U); if ((int )path_swap_ovr & 1) { path_swap = path_swap_ovr & 2U; } else { path_swap = readl((void const volatile *)bp->regview + 42844U); } if (path_swap != 0U) { path = (u8 )((unsigned int )path ^ 1U); } else { } port_swap_ovr = readl((void const volatile *)bp->regview + 42804U); if ((int )port_swap_ovr & 1) { port_swap = port_swap_ovr & 2U; } else { port_swap = readl((void const volatile *)bp->regview + 42836U); } if (port_swap != 0U) { port = (u8 )((unsigned int )port ^ 1U); } else { } lane = ((int )port << 1U) + (int )path; } else { path_swap_ovr = readl((void const volatile *)bp->regview + 42796U); if ((int )path_swap_ovr & 1) { path_swap = path_swap_ovr & 2U; } else { path_swap = readl((void const volatile *)bp->regview + 42840U); } if (path_swap != 0U) { path = (u8 )((unsigned int )path ^ 1U); } else { } lane = (int )path << 1U; } return (lane); } } static void bnx2x_set_aer_mmd(struct link_params *params , struct bnx2x_phy *phy ) { u32 ser_lane ; u16 offset ; u16 aer_val ; struct bnx2x *bp ; u8 tmp ; { bp = params->bp; ser_lane = (params->lane_config & 49152U) >> 14; offset = phy->type == 0U ? (int )((u16 )phy->addr) + (int )((u16 )ser_lane) : 0U; if (((((((((bp->common.chip_id >> 16 == 5770U || bp->common.chip_id >> 16 == 5797U) || bp->common.chip_id >> 16 == 5801U) || bp->common.chip_id >> 16 == 5774U) || bp->common.chip_id >> 16 == 5806U) || bp->common.chip_id >> 16 == 5807U) || ((bp->common.chip_id >> 16 == 5693U || bp->common.chip_id >> 16 == 5694U) || bp->common.chip_id >> 16 == 5695U)) || ((bp->common.chip_id >> 16 == 5793U || bp->common.chip_id >> 16 == 5794U) || bp->common.chip_id >> 16 == 5773U)) || (bp->common.chip_id >> 16 == 5796U || bp->common.chip_id >> 16 == 5803U)) || bp->common.chip_id >> 16 == 5805U) { tmp = bnx2x_get_warpcore_lane(phy, params); aer_val = (u16 )tmp; if (((int )phy->flags & 16) != 0) { aer_val = (u16 )((unsigned int )((int )aer_val >> 1) | 512U); } else { } } else if ((bp->common.chip_id >> 16 == 5730U || bp->common.chip_id >> 16 == 5731U) || bp->common.chip_id >> 16 == 5743U) { aer_val = (unsigned int )offset + 14335U; } else { aer_val = (unsigned int )offset + 14336U; } bnx2x_cl45_write(bp, phy, (int )phy->def_md_devad, 65502, (int )aer_val); return; } } static void bnx2x_set_serdes_access(struct bnx2x *bp , u8 port ) { u32 emac_base ; { emac_base = (unsigned int )port != 0U ? 33792U : 32768U; writel(1U, (void volatile *)bp->regview + (unsigned long )((int )port * 16 + 66412)); writel(610238464U, (void volatile *)bp->regview + (unsigned long )(emac_base + 172U)); __const_udelay(2147500UL); writel(610074639U, (void volatile *)bp->regview + (unsigned long )(emac_base + 172U)); __const_udelay(2147500UL); writel(0U, (void volatile *)bp->regview + (unsigned long )((int )port * 16 + 66412)); return; } } static void bnx2x_serdes_deassert(struct bnx2x *bp , u8 port ) { u32 val ; long tmp ; { tmp = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp != 0L) { printk("\rbnx2x: [%s:%d(%s)]bnx2x_serdes_deassert\n", "bnx2x_serdes_deassert", 3442, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } val = (u32 )(15 << (int )port * 16); writel(val, (void volatile *)bp->regview + 42408U); __const_udelay(2147500UL); writel(val, (void volatile *)bp->regview + 42404U); bnx2x_set_serdes_access(bp, (int )port); writel(3U, (void volatile *)bp->regview + (unsigned long )(((int )port + 4151) * 16)); return; } } static void bnx2x_xgxs_specific_func(struct bnx2x_phy *phy , struct link_params *params , u32 action ) { struct bnx2x *bp ; { bp = params->bp; switch (action) { case 3U: writel(0U, (void volatile *)bp->regview + (unsigned long )((int )params->port * 24 + 66360)); writel((unsigned int )phy->def_md_devad, (void volatile *)bp->regview + (unsigned long )((int )params->port * 24 + 66364)); goto ldv_45883; } ldv_45883: ; return; } } static void bnx2x_xgxs_deassert(struct link_params *params ) { struct bnx2x *bp ; u8 port ; u32 val ; long tmp ; { bp = params->bp; tmp = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp != 0L) { printk("\rbnx2x: [%s:%d(%s)]bnx2x_xgxs_deassert\n", "bnx2x_xgxs_deassert", 3477, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } port = params->port; val = (u32 )(496 << (int )port * 16); writel(val, (void volatile *)bp->regview + 42408U); __const_udelay(2147500UL); writel(val, (void volatile *)bp->regview + 42404U); bnx2x_xgxs_specific_func((struct bnx2x_phy *)(& params->phy), params, 3U); return; } } static void bnx2x_calc_ieee_aneg_adv(struct bnx2x_phy *phy , struct link_params *params , u16 *ieee_fc ) { struct bnx2x *bp ; long tmp ; { bp = params->bp; *ieee_fc = 32U; switch ((int )phy->req_flow_ctrl) { case 0: ; switch ((int )params->req_fc_auto_adv) { case 768: *ieee_fc = (u16 )((unsigned int )*ieee_fc | 384U); goto ldv_45899; case 512: ; case 256: *ieee_fc = (u16 )((unsigned int )*ieee_fc | 256U); goto ldv_45899; default: ; goto ldv_45899; } ldv_45899: ; goto ldv_45903; case 256: *ieee_fc = (u16 )((unsigned int )*ieee_fc | 256U); goto ldv_45903; case 512: ; case 768: *ieee_fc = (u16 )((unsigned int )*ieee_fc | 384U); goto ldv_45903; case 1024: ; default: *ieee_fc = *ieee_fc; goto ldv_45903; } ldv_45903: tmp = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp != 0L) { printk("\rbnx2x: [%s:%d(%s)]ieee_fc = 0x%x\n", "bnx2x_calc_ieee_aneg_adv", 3528, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )*ieee_fc); } else { } return; } } static void set_phy_vars(struct link_params *params , struct link_vars *vars ) { struct bnx2x *bp ; u8 actual_phy_idx ; u8 phy_index ; u8 link_cfg_idx ; u8 phy_config_swapped ; long tmp ; { bp = params->bp; phy_config_swapped = (unsigned int )((u8 )params->multi_phy_config) & 8U; phy_index = 0U; goto ldv_45921; ldv_45920: link_cfg_idx = (unsigned int )phy_index != 0U ? (unsigned int )phy_index + 255U : 0U; actual_phy_idx = phy_index; if ((unsigned int )phy_config_swapped != 0U) { if ((unsigned int )phy_index == 1U) { actual_phy_idx = 2U; } else if ((unsigned int )phy_index == 2U) { actual_phy_idx = 1U; } else { } } else { } params->phy[(int )actual_phy_idx].req_flow_ctrl = params->req_flow_ctrl[(int )link_cfg_idx]; params->phy[(int )actual_phy_idx].req_line_speed = params->req_line_speed[(int )link_cfg_idx]; params->phy[(int )actual_phy_idx].speed_cap_mask = params->speed_cap_mask[(int )link_cfg_idx]; params->phy[(int )actual_phy_idx].req_duplex = params->req_duplex[(int )link_cfg_idx]; if ((unsigned int )params->req_line_speed[(int )link_cfg_idx] == 0U) { vars->link_status = vars->link_status | 32U; } else { } tmp = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp != 0L) { printk("\rbnx2x: [%s:%d(%s)]req_flow_ctrl %x, req_line_speed %x, speed_cap_mask %x\n", "set_phy_vars", 3568, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )params->phy[(int )actual_phy_idx].req_flow_ctrl, (int )params->phy[(int )actual_phy_idx].req_line_speed, params->phy[(int )actual_phy_idx].speed_cap_mask); } else { } phy_index = (u8 )((int )phy_index + 1); ldv_45921: ; if ((int )params->num_phys > (int )phy_index) { goto ldv_45920; } else { } return; } } static void bnx2x_ext_phy_set_pause(struct link_params *params , struct bnx2x_phy *phy , struct link_vars *vars ) { u16 val ; struct bnx2x *bp ; long tmp ; { bp = params->bp; bnx2x_cl45_read(bp, phy, 7, 16, & val); val = (unsigned int )val & 62463U; bnx2x_calc_ieee_aneg_adv(phy, params, & vars->ieee_fc); if (((int )vars->ieee_fc & 256) != 0) { val = (u16 )((unsigned int )val | 2048U); } else { } if (((int )vars->ieee_fc & 384) == 384) { val = (u16 )((unsigned int )val | 1024U); } else { } tmp = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp != 0L) { printk("\rbnx2x: [%s:%d(%s)]Ext phy AN advertize 0x%x\n", "bnx2x_ext_phy_set_pause", 3595, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )val); } else { } bnx2x_cl45_write(bp, phy, 7, 16, (int )val); return; } } static void bnx2x_pause_resolve(struct link_vars *vars , u32 pause_result ) { { switch (pause_result) { case 11U: vars->flow_ctrl = 256U; goto ldv_45936; case 14U: vars->flow_ctrl = 512U; goto ldv_45936; case 5U: ; case 7U: ; case 13U: ; case 15U: vars->flow_ctrl = 768U; goto ldv_45936; default: ; goto ldv_45936; } ldv_45936: ; if ((int )pause_result & 1) { vars->link_status = vars->link_status | 262144U; } else { } if ((pause_result & 2U) != 0U) { vars->link_status = vars->link_status | 524288U; } else { } return; } } static void bnx2x_ext_phy_update_adv_fc(struct bnx2x_phy *phy , struct link_params *params , struct link_vars *vars ) { u16 ld_pause ; u16 lp_pause ; u16 pause_result ; struct bnx2x *bp ; u8 lane ; u8 tmp ; u16 gp_status ; u16 gp_mask ; long tmp___0 ; { bp = params->bp; if (phy->type == 3584U) { bnx2x_cl22_read(bp, phy, 4, & ld_pause); bnx2x_cl22_read(bp, phy, 5, & lp_pause); } else if ((((((((((bp->common.chip_id >> 16 == 5770U || bp->common.chip_id >> 16 == 5797U) || bp->common.chip_id >> 16 == 5801U) || bp->common.chip_id >> 16 == 5774U) || bp->common.chip_id >> 16 == 5806U) || bp->common.chip_id >> 16 == 5807U) || ((bp->common.chip_id >> 16 == 5693U || bp->common.chip_id >> 16 == 5694U) || bp->common.chip_id >> 16 == 5695U)) || ((bp->common.chip_id >> 16 == 5793U || bp->common.chip_id >> 16 == 5794U) || bp->common.chip_id >> 16 == 5773U)) || (bp->common.chip_id >> 16 == 5796U || bp->common.chip_id >> 16 == 5803U)) || bp->common.chip_id >> 16 == 5805U) && (unsigned int )params->num_phys == 1U) { tmp = bnx2x_get_warpcore_lane(phy, params); lane = tmp; bnx2x_cl45_read(bp, phy, 7, 33236, & gp_status); gp_mask = (u16 )(4112 << (int )lane); if (((int )gp_status & (int )gp_mask) == (int )gp_mask) { bnx2x_cl45_read(bp, phy, 7, 16, & ld_pause); bnx2x_cl45_read(bp, phy, 7, 19, & lp_pause); } else { bnx2x_cl45_read(bp, phy, 7, 65508, & ld_pause); bnx2x_cl45_read(bp, phy, 7, 65509, & lp_pause); ld_pause = ((unsigned int )ld_pause & 384U) << 3U; lp_pause = ((unsigned int )lp_pause & 384U) << 3U; } } else { bnx2x_cl45_read(bp, phy, 7, 16, & ld_pause); bnx2x_cl45_read(bp, phy, 7, 19, & lp_pause); } pause_result = (u16 )(((int )ld_pause & 3072) >> 8); pause_result = (u16 )((int )((short )(((int )lp_pause & 3072) >> 10)) | (int )((short )pause_result)); tmp___0 = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp___0 != 0L) { printk("\rbnx2x: [%s:%d(%s)]Ext PHY pause result 0x%x\n", "bnx2x_ext_phy_update_adv_fc", 3677, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )pause_result); } else { } bnx2x_pause_resolve(vars, (u32 )pause_result); return; } } static u8 bnx2x_ext_phy_resolve_fc(struct bnx2x_phy *phy , struct link_params *params , struct link_vars *vars ) { u8 ret ; { ret = 0U; vars->flow_ctrl = 1024U; if ((unsigned int )phy->req_flow_ctrl != 0U) { if ((unsigned int )phy->req_line_speed == 0U) { bnx2x_ext_phy_update_adv_fc(phy, params, vars); } else { } vars->flow_ctrl = phy->req_flow_ctrl; } else if ((unsigned int )phy->req_line_speed != 0U) { vars->flow_ctrl = params->req_fc_auto_adv; } else if ((vars->link_status & 64U) != 0U) { ret = 1U; bnx2x_ext_phy_update_adv_fc(phy, params, vars); } else { } return (ret); } } static void bnx2x_warpcore_enable_AN_KR2(struct bnx2x_phy *phy , struct link_params *params , struct link_vars *vars ) { struct bnx2x *bp ; u16 i ; struct bnx2x_reg_set reg_set[15U] ; long tmp ; { bp = params->bp; reg_set[0].devad = 3U; reg_set[0].reg = 33846U; reg_set[0].val = 41303U; reg_set[1].devad = 3U; reg_set[1].reg = 33848U; reg_set[1].val = 52194U; reg_set[2].devad = 3U; reg_set[2].reg = 33847U; reg_set[2].val = 30007U; reg_set[3].devad = 3U; reg_set[3].reg = 33849U; reg_set[3].val = 41303U; reg_set[4].devad = 3U; reg_set[4].reg = 33851U; reg_set[4].val = 52194U; reg_set[5].devad = 3U; reg_set[5].reg = 33850U; reg_set[5].val = 30007U; reg_set[6].devad = 3U; reg_set[6].reg = 33648U; reg_set[6].val = 10U; reg_set[7].devad = 3U; reg_set[7].reg = 33650U; reg_set[7].val = 25600U; reg_set[8].devad = 3U; reg_set[8].reg = 33652U; reg_set[8].val = 1568U; reg_set[9].devad = 3U; reg_set[9].reg = 33659U; reg_set[9].val = 343U; reg_set[10].devad = 3U; reg_set[10].reg = 33875U; reg_set[10].val = 25700U; reg_set[11].devad = 3U; reg_set[11].reg = 33876U; reg_set[11].val = 12624U; reg_set[12].devad = 3U; reg_set[12].reg = 33877U; reg_set[12].val = 12624U; reg_set[13].devad = 3U; reg_set[13].reg = 33878U; reg_set[13].val = 343U; reg_set[14].devad = 3U; reg_set[14].reg = 33879U; reg_set[14].val = 1568U; tmp = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp != 0L) { printk("\rbnx2x: [%s:%d(%s)]Enabling 20G-KR2\n", "bnx2x_warpcore_enable_AN_KR2", 3745, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } bnx2x_cl45_read_or_write(bp, phy, 3, 33640, 192); i = 0U; goto ldv_45974; ldv_45973: bnx2x_cl45_write(bp, phy, (int )reg_set[(int )i].devad, (int )reg_set[(int )i].reg, (int )reg_set[(int )i].val); i = (u16 )((int )i + 1); ldv_45974: ; if ((unsigned int )i <= 14U) { goto ldv_45973; } else { } vars->link_attr_sync = vars->link_attr_sync | 1U; bnx2x_update_link_attr(params, vars->link_attr_sync); return; } } static void bnx2x_warpcore_set_lpi_passthrough(struct bnx2x_phy *phy , struct link_params *params ) { struct bnx2x *bp ; long tmp ; { bp = params->bp; tmp = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp != 0L) { printk("\rbnx2x: [%s:%d(%s)]Configure WC for LPI pass through\n", "bnx2x_warpcore_set_lpi_passthrough", 3764, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } bnx2x_cl45_write(bp, phy, 3, 33680, 124); bnx2x_cl45_read_or_write(bp, phy, 3, 33598, 49152); return; } } static void bnx2x_warpcore_restart_AN_KR(struct bnx2x_phy *phy , struct link_params *params ) { struct bnx2x *bp ; u16 lane ; u8 tmp ; { bp = params->bp; tmp = bnx2x_get_warpcore_lane(phy, params); lane = (u16 )tmp; bnx2x_cl45_write(bp, phy, (int )phy->def_md_devad, 65502, (int )lane); bnx2x_cl45_write(bp, phy, 7, 0, 4608); bnx2x_set_aer_mmd(params, phy); return; } } static void bnx2x_warpcore_enable_AN_KR(struct bnx2x_phy *phy , struct link_params *params , struct link_vars *vars ) { u16 lane ; u16 i ; u16 cl72_ctrl ; u16 an_adv ; u16 ucode_ver ; struct bnx2x *bp ; struct bnx2x_reg_set reg_set[7U] ; long tmp ; u16 addr ; long tmp___0 ; long tmp___1 ; u8 tmp___2 ; long tmp___3 ; unsigned int tmp___4 ; long tmp___5 ; { an_adv = 0U; bp = params->bp; reg_set[0].devad = 3U; reg_set[0].reg = 33537U; reg_set[0].val = 7U; reg_set[1].devad = 1U; reg_set[1].reg = 7U; reg_set[1].val = 0U; reg_set[2].devad = 3U; reg_set[2].reg = 33728U; reg_set[2].val = 29717U; reg_set[3].devad = 3U; reg_set[3].reg = 33545U; reg_set[3].val = 24976U; reg_set[4].devad = 7U; reg_set[4].reg = 0U; reg_set[4].val = 0U; reg_set[5].devad = 1U; reg_set[5].reg = 150U; reg_set[5].val = 2U; reg_set[6].devad = 3U; reg_set[6].reg = 33506U; reg_set[6].val = 0U; tmp = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp != 0L) { printk("\rbnx2x: [%s:%d(%s)]Enable Auto Negotiation for KR\n", "bnx2x_warpcore_enable_AN_KR", 3802, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } i = 0U; goto ldv_46004; ldv_46003: bnx2x_cl45_write(bp, phy, (int )reg_set[(int )i].devad, (int )reg_set[(int )i].reg, (int )reg_set[(int )i].val); i = (u16 )((int )i + 1); ldv_46004: ; if ((unsigned int )i <= 6U) { goto ldv_46003; } else { } bnx2x_cl45_read(bp, phy, 3, 33507, & cl72_ctrl); cl72_ctrl = (unsigned int )cl72_ctrl & 2303U; cl72_ctrl = (u16 )((unsigned int )cl72_ctrl | 14336U); bnx2x_cl45_write(bp, phy, 3, 33507, (int )cl72_ctrl); if (((unsigned int )vars->line_speed == 0U && (phy->speed_cap_mask & 1048576U) != 0U) || (unsigned int )vars->line_speed == 1000U) { addr = 33537U; an_adv = (u16 )((unsigned int )an_adv | 32U); bnx2x_cl45_read_or_write(bp, phy, 3, (int )addr, 1); tmp___0 = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp___0 != 0L) { printk("\rbnx2x: [%s:%d(%s)]Advertize 1G\n", "bnx2x_warpcore_enable_AN_KR", 3824, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } } else { } if (((unsigned int )vars->line_speed == 0U && (phy->speed_cap_mask & 4194304U) != 0U) || (unsigned int )vars->line_speed == 10000U) { an_adv = (u16 )((unsigned int )an_adv | 128U); bnx2x_cl45_write(bp, phy, (int )phy->def_md_devad, 65502, 0); bnx2x_cl45_write(bp, phy, 7, 33073, 1); bnx2x_set_aer_mmd(params, phy); tmp___1 = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp___1 != 0L) { printk("\rbnx2x: [%s:%d(%s)]Advertize 10G\n", "bnx2x_warpcore_enable_AN_KR", 3838, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } } else { } tmp___2 = bnx2x_get_warpcore_lane(phy, params); lane = (u16 )tmp___2; bnx2x_cl45_write(bp, phy, 3, (int )((unsigned int )lane * 16U + 32871U), 9872); if (((int )phy->flags & 16) != 0) { bnx2x_cl45_write(bp, phy, 3, (int )((unsigned int )((u16 )((int )lane + 1)) * 16U + 32871U), 9872); } else { } bnx2x_cl45_write(bp, phy, 3, 33510, 1008); bnx2x_cl45_write(bp, phy, 3, 33512, 1008); bnx2x_cl45_write(bp, phy, 7, 17, (int )an_adv); bnx2x_cl45_write(bp, phy, 7, 18, 49152); tmp___4 = readl((void const volatile *)(bp->regview + ((unsigned long )params->shmem_base + ((unsigned long )params->port + 1UL) * 400UL))); if ((tmp___4 & 1048576U) != 0U) { bnx2x_cl45_read_or_write(bp, phy, 3, 33616, 1); tmp___3 = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp___3 != 0L) { printk("\rbnx2x: [%s:%d(%s)]Enable CL37 BAM on KR\n", "bnx2x_warpcore_enable_AN_KR", 3876, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } } else { } bnx2x_ext_phy_set_pause(params, phy, vars); bnx2x_cl45_read(bp, phy, 3, 33264, & ucode_ver); if ((unsigned int )ucode_ver <= 53511U) { tmp___5 = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp___5 != 0L) { printk("\rbnx2x: [%s:%d(%s)]Enable AN KR work-around. WC ver:0x%x\n", "bnx2x_warpcore_enable_AN_KR", 3887, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )ucode_ver); } else { } vars->rx_tx_asic_rst = 4U; } else { } bnx2x_cl45_read_or_write(bp, phy, 3, 33609, 256); bnx2x_cl45_write(bp, phy, 3, 33577, 31); if (((unsigned int )phy->req_line_speed == 0U && (phy->speed_cap_mask & 8388608U) != 0U) || (unsigned int )phy->req_line_speed == 20000U) { bnx2x_cl45_write(bp, phy, (int )phy->def_md_devad, 65502, (int )lane); bnx2x_cl45_read_or_write(bp, phy, 3, (int )((unsigned int )lane * 16U + 32970U), 2048); bnx2x_cl45_write(bp, phy, 3, 33090, 7); bnx2x_set_aer_mmd(params, phy); bnx2x_warpcore_enable_AN_KR2(phy, params, vars); } else { } bnx2x_warpcore_restart_AN_KR(phy, params); return; } } static void bnx2x_warpcore_set_10G_KR(struct bnx2x_phy *phy , struct link_params *params , struct link_vars *vars ) { struct bnx2x *bp ; u16 val16 ; u16 i ; u16 lane ; struct bnx2x_reg_set reg_set[7U] ; u8 tmp ; { bp = params->bp; reg_set[0].devad = 3U; reg_set[0].reg = 33537U; reg_set[0].val = 7U; reg_set[1].devad = 3U; reg_set[1].reg = 33507U; reg_set[1].val = 16128U; reg_set[2].devad = 7U; reg_set[2].reg = 17U; reg_set[2].val = 0U; reg_set[3].devad = 7U; reg_set[3].reg = 0U; reg_set[3].val = 0U; reg_set[4].devad = 3U; reg_set[4].reg = 33577U; reg_set[4].val = 1U; reg_set[5].devad = 3U; reg_set[5].reg = 33609U; reg_set[5].val = 10U; reg_set[6].devad = 1U; reg_set[6].reg = 150U; reg_set[6].val = 2U; i = 0U; goto ldv_46020; ldv_46019: bnx2x_cl45_write(bp, phy, (int )reg_set[(int )i].devad, (int )reg_set[(int )i].reg, (int )reg_set[(int )i].val); i = (u16 )((int )i + 1); ldv_46020: ; if ((unsigned int )i <= 6U) { goto ldv_46019; } else { } tmp = bnx2x_get_warpcore_lane(phy, params); lane = (u16 )tmp; bnx2x_cl45_write(bp, phy, (int )phy->def_md_devad, 65502, 0); bnx2x_cl45_read(bp, phy, 3, 32789, & val16); val16 = (u16 )(~ ((int )((short )(17 << (int )lane))) & (int )((short )val16)); bnx2x_cl45_write(bp, phy, 3, 32789, (int )val16); bnx2x_cl45_read(bp, phy, 3, 32790, & val16); val16 = (u16 )((int )((short )(771 << ((int )lane << 1))) | (int )((short )val16)); bnx2x_cl45_write(bp, phy, 3, 32790, (int )val16); bnx2x_set_aer_mmd(params, phy); bnx2x_cl45_write(bp, phy, 1, 0, 8256); bnx2x_cl45_write(bp, phy, 1, 7, 11); bnx2x_cl45_write(bp, phy, 3, 33545, 48); bnx2x_cl45_write(bp, phy, 3, 33712, 9); bnx2x_cl45_read_or_write(bp, phy, 3, 33728, 249); bnx2x_cl45_write(bp, phy, 3, 0, 16384); bnx2x_cl45_write(bp, phy, 3, 0, 0); return; } } static void bnx2x_warpcore_set_10G_XFI(struct bnx2x_phy *phy , struct link_params *params , u8 is_xfi ) { struct bnx2x *bp ; u16 misc1_val ; u16 tap_val ; u16 tx_driver_val ; u16 lane ; u16 val ; u32 cfg_tap_val ; u32 tx_drv_brdct ; u32 tx_equal ; u8 tmp ; { bp = params->bp; bnx2x_cl45_read_or_write(bp, phy, 3, 33310, 32768); bnx2x_cl45_read_or_write(bp, phy, 3, 33538, 1); bnx2x_cl45_write(bp, phy, 7, 0, 0); bnx2x_cl45_read_and_write(bp, phy, 3, 33792, 65530); bnx2x_cl45_read_or_write(bp, phy, 3, 33794, 128); bnx2x_cl45_read_and_write(bp, phy, 3, 33596, 65407); bnx2x_cl45_read_and_write(bp, phy, 3, 33536, 65518); bnx2x_cl45_read(bp, phy, 3, 33537, & val); bnx2x_cl45_write(bp, phy, 3, 33537, (int )(((unsigned int )val & 65528U) | 6U)); bnx2x_cl45_read(bp, phy, 3, 33544, & misc1_val); misc1_val = (unsigned int )misc1_val & 65504U; if ((unsigned int )is_xfi != 0U) { misc1_val = (u16 )((unsigned int )misc1_val | 5U); tap_val = 9072U; tx_driver_val = 560U; } else { cfg_tap_val = readl((void const volatile *)(bp->regview + (((unsigned long )params->shmem_base + (unsigned long )params->port * 400UL) + 128UL))); tx_equal = cfg_tap_val & 65535U; tx_drv_brdct = (cfg_tap_val & 983040U) >> 16; misc1_val = (u16 )((unsigned int )misc1_val | 9U); if (tx_equal != 0U) { tap_val = (unsigned short )tx_equal; } else { tap_val = 16050U; } if (tx_drv_brdct != 0U) { tx_driver_val = (u16 )((int )((short )((int )((unsigned short )tx_drv_brdct) << 8)) | 12384); } else { tx_driver_val = 12896U; } } bnx2x_cl45_write(bp, phy, 3, 33544, (int )misc1_val); tmp = bnx2x_get_warpcore_lane(phy, params); lane = (u16 )tmp; bnx2x_cl45_write(bp, phy, 3, 33506, (int )((unsigned int )tap_val | 32768U)); bnx2x_cl45_write(bp, phy, 3, (int )((unsigned int )lane * 16U + 32871U), (int )tx_driver_val); bnx2x_cl45_read_or_write(bp, phy, 3, 33536, 13); bnx2x_cl45_read_or_write(bp, phy, 3, 33596, 32896); bnx2x_warpcore_set_lpi_passthrough(phy, params); bnx2x_cl45_write(bp, phy, 3, 0, 256); bnx2x_cl45_read_and_write(bp, phy, 3, 33538, 65534); bnx2x_cl45_read_and_write(bp, phy, 3, 33310, 32767); return; } } static void bnx2x_warpcore_set_20G_force_KR2(struct bnx2x_phy *phy , struct link_params *params ) { u16 val ; struct bnx2x *bp ; { bp = params->bp; bnx2x_cl45_write(bp, phy, (int )phy->def_md_devad, 65502, 0); bnx2x_cl45_read_and_write(bp, phy, 3, 32768, 57343); bnx2x_set_aer_mmd(params, phy); bnx2x_cl45_read_and_write(bp, phy, 1, 150, 65533); bnx2x_cl45_write(bp, phy, 7, 0, 0); bnx2x_cl45_read(bp, phy, 3, 33648, & val); val = (unsigned int )val & 65503U; val = (u16 )((unsigned int )val | 64U); bnx2x_cl45_write(bp, phy, 3, 33648, (int )val); bnx2x_cl45_read_or_write(bp, phy, 3, 33544, 31); bnx2x_cl45_read_or_write(bp, phy, 3, 33596, 128); bnx2x_cl45_read(bp, phy, 3, 33507, & val); val = (unsigned int )val & 16383U; val = (u16 )((unsigned int )val | 32768U); bnx2x_cl45_write(bp, phy, 3, 33507, (int )val); bnx2x_cl45_write(bp, phy, 3, 33506, 33626); bnx2x_cl45_write(bp, phy, (int )phy->def_md_devad, 65502, 0); bnx2x_cl45_read_or_write(bp, phy, 3, 32768, 8192); bnx2x_set_aer_mmd(params, phy); return; } } static void bnx2x_warpcore_set_20G_DXGXS(struct bnx2x *bp , struct bnx2x_phy *phy , u16 lane ) { { bnx2x_cl45_write(bp, phy, 3, 32953, 144); bnx2x_cl45_write(bp, phy, 3, 32985, 144); bnx2x_cl45_write(bp, phy, 3, 33730, 57456); bnx2x_cl45_write(bp, phy, 3, 33731, 49360); bnx2x_cl45_write(bp, phy, 3, 33732, 41136); bnx2x_cl45_write(bp, phy, 3, 33733, 32912); bnx2x_cl45_write(bp, phy, 3, 33734, 61680); bnx2x_cl45_write(bp, phy, 3, 33735, 61680); bnx2x_cl45_write(bp, phy, 3, 33736, 61680); bnx2x_cl45_write(bp, phy, 3, 33737, 61680); bnx2x_cl45_write(bp, phy, 3, 33544, 24584); bnx2x_cl45_write(bp, phy, 3, 33596, 32904); bnx2x_cl45_write(bp, phy, 3, 33506, 51920); bnx2x_cl45_write(bp, phy, 3, (int )((unsigned int )lane * 16U + 32871U), 8736); return; } } static void bnx2x_warpcore_set_sgmii_speed(struct bnx2x_phy *phy , struct link_params *params , u8 fiber_mode , u8 always_autoneg ) { struct bnx2x *bp ; u16 val16 ; u16 digctrl_kx1 ; u16 digctrl_kx2 ; long tmp ; long tmp___0 ; long tmp___1 ; long tmp___2 ; { bp = params->bp; bnx2x_cl45_read_and_write(bp, phy, 3, 33728, 40959); bnx2x_warpcore_set_lpi_passthrough(phy, params); if ((unsigned int )always_autoneg != 0U || (unsigned int )phy->req_line_speed == 0U) { bnx2x_cl45_read_or_write(bp, phy, 3, 65504, 4096); tmp = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp != 0L) { printk("\rbnx2x: [%s:%d(%s)]set SGMII AUTONEG\n", "bnx2x_warpcore_set_sgmii_speed", 4227, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } } else { bnx2x_cl45_read(bp, phy, 3, 65504, & val16); val16 = (unsigned int )val16 & 52927U; switch ((int )phy->req_line_speed) { case 10: ; goto ldv_46059; case 100: val16 = (u16 )((unsigned int )val16 | 8192U); goto ldv_46059; case 1000: val16 = (u16 )((unsigned int )val16 | 64U); goto ldv_46059; default: tmp___0 = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp___0 != 0L) { printk("\rbnx2x: [%s:%d(%s)]Speed not supported: 0x%x\n", "bnx2x_warpcore_set_sgmii_speed", 4243, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )phy->req_line_speed); } else { } return; } ldv_46059: ; if ((unsigned int )phy->req_duplex == 1U) { val16 = (u16 )((unsigned int )val16 | 256U); } else { } bnx2x_cl45_write(bp, phy, 3, 65504, (int )val16); tmp___1 = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp___1 != 0L) { printk("\rbnx2x: [%s:%d(%s)]set SGMII force speed %d\n", "bnx2x_warpcore_set_sgmii_speed", 4254, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )phy->req_line_speed); } else { } bnx2x_cl45_read(bp, phy, 3, 65504, & val16); tmp___2 = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp___2 != 0L) { printk("\rbnx2x: [%s:%d(%s)] (readback) %x\n", "bnx2x_warpcore_set_sgmii_speed", 4257, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )val16); } else { } } bnx2x_cl45_read(bp, phy, 3, 33536, & digctrl_kx1); if ((unsigned int )fiber_mode != 0U) { digctrl_kx1 = 1U; } else { digctrl_kx1 = (unsigned int )digctrl_kx1 & 65354U; } bnx2x_cl45_write(bp, phy, 3, 33536, (int )digctrl_kx1); bnx2x_cl45_read(bp, phy, 3, 33537, & digctrl_kx2); bnx2x_cl45_write(bp, phy, 3, 33537, (int )digctrl_kx2 & 65531); bnx2x_cl45_write(bp, phy, 3, 33537, (int )((unsigned int )digctrl_kx2 | 4U)); bnx2x_cl45_write(bp, phy, 3, 33536, (int )((unsigned int )digctrl_kx1 | 16U)); return; } } static void bnx2x_warpcore_reset_lane(struct bnx2x *bp , struct bnx2x_phy *phy , u8 reset ) { u16 val ; { bnx2x_cl45_read(bp, phy, 3, 33605, & val); if ((unsigned int )reset != 0U) { val = (u16 )((unsigned int )val | 49152U); } else { val = (unsigned int )val & 16383U; } bnx2x_cl45_write(bp, phy, 3, 33605, (int )val); bnx2x_cl45_read(bp, phy, 3, 33605, & val); return; } } static void bnx2x_warpcore_clear_regs(struct bnx2x_phy *phy , struct link_params *params , u16 lane ) { struct bnx2x *bp ; u16 i ; struct bnx2x_reg_set wc_regs[11U] ; u8 tmp ; { bp = params->bp; wc_regs[0].devad = 7U; wc_regs[0].reg = 0U; wc_regs[0].val = 0U; wc_regs[1].devad = 3U; wc_regs[1].reg = 33792U; wc_regs[1].val = 330U; wc_regs[2].devad = 3U; wc_regs[2].reg = 33794U; wc_regs[2].val = 2048U; wc_regs[3].devad = 3U; wc_regs[3].reg = 33596U; wc_regs[3].val = 32776U; wc_regs[4].devad = 3U; wc_regs[4].reg = 33536U; wc_regs[4].val = 405U; wc_regs[5].devad = 3U; wc_regs[5].reg = 33537U; wc_regs[5].val = 7U; wc_regs[6].devad = 3U; wc_regs[6].reg = 33538U; wc_regs[6].val = 2U; wc_regs[7].devad = 3U; wc_regs[7].reg = 33544U; wc_regs[7].val = 24576U; wc_regs[8].devad = 3U; wc_regs[8].reg = 33506U; wc_regs[8].val = 0U; wc_regs[9].devad = 3U; wc_regs[9].reg = 0U; wc_regs[9].val = 8256U; wc_regs[10].devad = 3U; wc_regs[10].reg = 65504U; wc_regs[10].val = 320U; bnx2x_cl45_read_or_write(bp, phy, 3, 33728, 24576); i = 0U; goto ldv_46080; ldv_46079: bnx2x_cl45_write(bp, phy, (int )wc_regs[(int )i].devad, (int )wc_regs[(int )i].reg, (int )wc_regs[(int )i].val); i = (u16 )((int )i + 1); ldv_46080: ; if ((unsigned int )i <= 10U) { goto ldv_46079; } else { } tmp = bnx2x_get_warpcore_lane(phy, params); lane = (u16 )tmp; bnx2x_cl45_write(bp, phy, 3, (int )((unsigned int )lane * 16U + 32871U), 2448); return; } } static int bnx2x_get_mod_abs_int_cfg(struct bnx2x *bp , u32 chip_id , u32 shmem_base , u8 port , u8 *gpio_num , u8 *gpio_port ) { u32 cfg_pin ; unsigned int tmp ; long tmp___0 ; { *gpio_num = 0U; *gpio_port = 0U; if (((((((((bp->common.chip_id >> 16 == 5770U || bp->common.chip_id >> 16 == 5797U) || bp->common.chip_id >> 16 == 5801U) || bp->common.chip_id >> 16 == 5774U) || bp->common.chip_id >> 16 == 5806U) || bp->common.chip_id >> 16 == 5807U) || ((bp->common.chip_id >> 16 == 5693U || bp->common.chip_id >> 16 == 5694U) || bp->common.chip_id >> 16 == 5695U)) || ((bp->common.chip_id >> 16 == 5793U || bp->common.chip_id >> 16 == 5794U) || bp->common.chip_id >> 16 == 5773U)) || (bp->common.chip_id >> 16 == 5796U || bp->common.chip_id >> 16 == 5803U)) || bp->common.chip_id >> 16 == 5805U) { tmp = readl((void const volatile *)(bp->regview + (((unsigned long )shmem_base + (unsigned long )port * 400UL) + 112UL))); cfg_pin = (tmp & 16711680U) >> 16; if (cfg_pin == 0U || cfg_pin > 8U) { tmp___0 = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp___0 != 0L) { printk("\rbnx2x: [%s:%d(%s)]No cfg pin %x for module detect indication\n", "bnx2x_get_mod_abs_int_cfg", 4369, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", cfg_pin); } else { } return (-22); } else { } *gpio_num = ((unsigned int )((u8 )cfg_pin) - 1U) & 3U; *gpio_port = (u8 )((cfg_pin - 1U) >> 2); } else { *gpio_num = 3U; *gpio_port = port; } return (0); } } static int bnx2x_is_sfp_module_plugged(struct bnx2x_phy *phy , struct link_params *params ) { struct bnx2x *bp ; u8 gpio_num ; u8 gpio_port ; u32 gpio_val ; int tmp ; int tmp___0 ; { bp = params->bp; tmp = bnx2x_get_mod_abs_int_cfg(bp, params->chip_id, params->shmem_base, (int )params->port, & gpio_num, & gpio_port); if (tmp != 0) { return (0); } else { } tmp___0 = bnx2x_get_gpio(bp, (int )gpio_num, (int )gpio_port); gpio_val = (u32 )tmp___0; if (gpio_val == 0U) { return (1); } else { return (0); } } } static int bnx2x_warpcore_get_sigdet(struct bnx2x_phy *phy , struct link_params *params ) { u16 gp2_status_reg0 ; u16 lane ; struct bnx2x *bp ; u8 tmp ; { bp = params->bp; tmp = bnx2x_get_warpcore_lane(phy, params); lane = (u16 )tmp; bnx2x_cl45_read(bp, phy, 3, 33232, & gp2_status_reg0); return (((int )gp2_status_reg0 >> ((int )lane + 8)) & 1); } } static void bnx2x_warpcore_config_runtime(struct bnx2x_phy *phy , struct link_params *params , struct link_vars *vars ) { struct bnx2x *bp ; u32 serdes_net_if ; u16 gp_status1 ; u16 lnkup ; u16 lnkup_kr ; u16 lane ; u8 tmp ; long tmp___0 ; int tmp___1 ; unsigned int tmp___2 ; long tmp___3 ; long tmp___4 ; long tmp___5 ; { bp = params->bp; gp_status1 = 0U; lnkup = 0U; lnkup_kr = 0U; tmp = bnx2x_get_warpcore_lane(phy, params); lane = (u16 )tmp; vars->turn_to_run_wc_rt = (unsigned int )vars->turn_to_run_wc_rt == 0U; if ((unsigned int )vars->turn_to_run_wc_rt == 0U) { return; } else { } tmp___1 = bnx2x_warpcore_get_sigdet(phy, params); if (tmp___1 == 0) { tmp___0 = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp___0 != 0L) { printk("\rbnx2x: [%s:%d(%s)]bnx2x_warpcore_get_sigdet false\n", "bnx2x_warpcore_config_runtime", 4431, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } return; } else { } if ((unsigned int )vars->rx_tx_asic_rst != 0U) { tmp___2 = readl((void const volatile *)(bp->regview + ((unsigned long )params->shmem_base + ((unsigned long )params->port + 1UL) * 400UL))); serdes_net_if = tmp___2 & 251658240U; switch (serdes_net_if) { case 50331648U: bnx2x_cl45_read(bp, phy, 3, 33233, & gp_status1); lnkup = (unsigned int )((u16 )((int )gp_status1 >> ((int )lane + 8))) & 1U; lnkup_kr = (unsigned int )((u16 )((int )gp_status1 >> ((int )lane + 12))) & 1U; tmp___3 = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp___3 != 0L) { printk("\rbnx2x: [%s:%d(%s)]gp_status1 0x%x\n", "bnx2x_warpcore_config_runtime", 4451, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )gp_status1); } else { } if ((unsigned int )lnkup_kr != 0U || (unsigned int )lnkup != 0U) { vars->rx_tx_asic_rst = 0U; tmp___4 = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp___4 != 0L) { printk("\rbnx2x: [%s:%d(%s)]link up, rx_tx_asic_rst 0x%x\n", "bnx2x_warpcore_config_runtime", 4457, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )vars->rx_tx_asic_rst); } else { } } else { bnx2x_warpcore_reset_lane(bp, phy, 1); bnx2x_warpcore_reset_lane(bp, phy, 0); bnx2x_cl45_write(bp, phy, 7, 0, 4608); vars->rx_tx_asic_rst = (u8 )((int )vars->rx_tx_asic_rst - 1); tmp___5 = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp___5 != 0L) { printk("\rbnx2x: [%s:%d(%s)]0x%x retry left\n", "bnx2x_warpcore_config_runtime", 4469, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )vars->rx_tx_asic_rst); } else { } } goto ldv_46120; default: ; goto ldv_46120; } ldv_46120: ; } else { } return; } } static void bnx2x_warpcore_config_sfi(struct bnx2x_phy *phy , struct link_params *params ) { u16 lane ; u8 tmp ; struct bnx2x *bp ; long tmp___0 ; long tmp___1 ; { tmp = bnx2x_get_warpcore_lane(phy, params); lane = (u16 )tmp; bp = params->bp; bnx2x_warpcore_clear_regs(phy, params, (int )lane); if ((unsigned int )params->req_line_speed[0] == 10000U && phy->media_type != 5U) { tmp___0 = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp___0 != 0L) { printk("\rbnx2x: [%s:%d(%s)]Setting 10G SFI\n", "bnx2x_warpcore_config_sfi", 4489, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } bnx2x_warpcore_set_10G_XFI(phy, params, 0); } else { tmp___1 = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp___1 != 0L) { printk("\rbnx2x: [%s:%d(%s)]Setting 1G Fiber\n", "bnx2x_warpcore_config_sfi", 4492, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } bnx2x_warpcore_set_sgmii_speed(phy, params, 1, 0); } return; } } static void bnx2x_sfp_e3_set_transmitter(struct link_params *params , struct bnx2x_phy *phy , u8 tx_en ) { struct bnx2x *bp ; u32 cfg_pin ; u8 port ; unsigned int tmp ; long tmp___0 ; { bp = params->bp; port = params->port; tmp = readl((void const volatile *)(bp->regview + (((unsigned long )params->shmem_base + (unsigned long )port * 400UL) + 112UL))); cfg_pin = tmp & 255U; tmp___0 = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp___0 != 0L) { printk("\rbnx2x: [%s:%d(%s)]Setting WC TX to %d\n", "bnx2x_sfp_e3_set_transmitter", 4510, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )tx_en); } else { } bnx2x_set_cfg_pin(bp, cfg_pin, (unsigned int )tx_en ^ 1U); if ((phy->speed_cap_mask & 8388608U) != 0U) { bnx2x_set_cfg_pin(bp, cfg_pin + 3U, (unsigned int )tx_en ^ 1U); } else { } return; } } static void bnx2x_warpcore_config_init(struct bnx2x_phy *phy , struct link_params *params , struct link_vars *vars ) { struct bnx2x *bp ; u32 serdes_net_if ; u8 fiber_mode ; u16 lane ; u8 tmp ; unsigned int tmp___0 ; long tmp___1 ; long tmp___2 ; long tmp___3 ; long tmp___4 ; long tmp___5 ; long tmp___6 ; int tmp___7 ; long tmp___8 ; long tmp___9 ; long tmp___10 ; long tmp___11 ; long tmp___12 ; { bp = params->bp; tmp = bnx2x_get_warpcore_lane(phy, params); lane = (u16 )tmp; tmp___0 = readl((void const volatile *)(bp->regview + ((unsigned long )params->shmem_base + ((unsigned long )params->port + 1UL) * 400UL))); serdes_net_if = tmp___0 & 251658240U; tmp___1 = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp___1 != 0L) { printk("\rbnx2x: [%s:%d(%s)]Begin Warpcore init, link_speed %d, serdes_net_if = 0x%x\n", "bnx2x_warpcore_config_init", 4532, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )vars->line_speed, serdes_net_if); } else { } bnx2x_set_aer_mmd(params, phy); bnx2x_warpcore_reset_lane(bp, phy, 1); vars->phy_flags = (u8 )((unsigned int )vars->phy_flags | 1U); if (serdes_net_if == 0U || ((unsigned int )phy->req_line_speed != 0U && ((unsigned int )phy->req_line_speed == 100U || (unsigned int )phy->req_line_speed == 10U))) { vars->phy_flags = (u8 )((unsigned int )vars->phy_flags | 2U); tmp___2 = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp___2 != 0L) { printk("\rbnx2x: [%s:%d(%s)]Setting SGMII mode\n", "bnx2x_warpcore_config_init", 4541, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } bnx2x_warpcore_clear_regs(phy, params, (int )lane); bnx2x_warpcore_set_sgmii_speed(phy, params, 0, 1); } else { switch (serdes_net_if) { case 50331648U: ; if ((unsigned int )params->loopback_mode != 5U) { bnx2x_warpcore_enable_AN_KR(phy, params, vars); } else { tmp___3 = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp___3 != 0L) { printk("\rbnx2x: [%s:%d(%s)]Setting KR 10G-Force\n", "bnx2x_warpcore_config_init", 4551, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } bnx2x_warpcore_set_10G_KR(phy, params, vars); } goto ldv_46149; case 16777216U: bnx2x_warpcore_clear_regs(phy, params, (int )lane); if ((unsigned int )vars->line_speed == 10000U) { tmp___4 = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp___4 != 0L) { printk("\rbnx2x: [%s:%d(%s)]Setting 10G XFI\n", "bnx2x_warpcore_config_init", 4559, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } bnx2x_warpcore_set_10G_XFI(phy, params, 1); } else { if ((unsigned int )params->num_phys == 1U) { tmp___5 = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp___5 != 0L) { printk("\rbnx2x: [%s:%d(%s)]1G Fiber\n", "bnx2x_warpcore_config_init", 4563, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } fiber_mode = 1U; } else { tmp___6 = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp___6 != 0L) { printk("\rbnx2x: [%s:%d(%s)]10/100/1G SGMII\n", "bnx2x_warpcore_config_init", 4566, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } fiber_mode = 0U; } bnx2x_warpcore_set_sgmii_speed(phy, params, (int )fiber_mode, 0); } goto ldv_46149; case 33554432U: tmp___7 = bnx2x_is_sfp_module_plugged(phy, params); if (tmp___7 != 0) { bnx2x_sfp_module_detection(phy, params); } else { bnx2x_sfp_e3_set_transmitter(params, phy, 1); } bnx2x_warpcore_config_sfi(phy, params); goto ldv_46149; case 67108864U: ; if ((unsigned int )vars->line_speed != 20000U) { tmp___8 = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp___8 != 0L) { printk("\rbnx2x: [%s:%d(%s)]Speed not supported yet\n", "bnx2x_warpcore_config_init", 4592, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } return; } else { } tmp___9 = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp___9 != 0L) { printk("\rbnx2x: [%s:%d(%s)]Setting 20G DXGXS\n", "bnx2x_warpcore_config_init", 4595, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } bnx2x_warpcore_set_20G_DXGXS(bp, phy, (int )lane); bnx2x_sfp_module_detection(phy, params); goto ldv_46149; case 83886080U: ; if ((unsigned int )params->loopback_mode == 0U) { bnx2x_warpcore_enable_AN_KR(phy, params, vars); } else { tmp___10 = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp___10 != 0L) { printk("\rbnx2x: [%s:%d(%s)]Setting KR 20G-Force\n", "bnx2x_warpcore_config_init", 4605, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } bnx2x_warpcore_set_20G_force_KR2(phy, params); } goto ldv_46149; default: tmp___11 = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp___11 != 0L) { printk("\rbnx2x: [%s:%d(%s)]Unsupported Serdes Net Interface 0x%x\n", "bnx2x_warpcore_config_init", 4612, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", serdes_net_if); } else { } return; } ldv_46149: ; } bnx2x_warpcore_reset_lane(bp, phy, 0); tmp___12 = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp___12 != 0L) { printk("\rbnx2x: [%s:%d(%s)]Exit config init\n", "bnx2x_warpcore_config_init", 4619, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } return; } } static void bnx2x_warpcore_link_reset(struct bnx2x_phy *phy , struct link_params *params ) { struct bnx2x *bp ; u16 val16 ; u16 lane ; u8 tmp ; { bp = params->bp; bnx2x_sfp_e3_set_transmitter(params, phy, 0); bnx2x_set_mdio_emac_per_phy(bp, params); bnx2x_set_aer_mmd(params, phy); bnx2x_warpcore_reset_lane(bp, phy, 1); bnx2x_cl45_read_and_write(bp, phy, 3, 65504, 49151); bnx2x_cl45_read_and_write(bp, phy, 3, 0, 65534); bnx2x_cl45_write(bp, phy, (int )phy->def_md_devad, 65502, 0); bnx2x_cl45_read_and_write(bp, phy, 3, 32768, 65519); bnx2x_cl45_read_and_write(bp, phy, 3, 32791, 65280); tmp = bnx2x_get_warpcore_lane(phy, params); lane = (u16 )tmp; bnx2x_cl45_read(bp, phy, 3, 32789, & val16); val16 = (u16 )((int )((short )(17 << (int )lane)) | (int )((short )val16)); if (((int )phy->flags & 16) != 0) { val16 = (u16 )((int )((short )(34 << (int )lane)) | (int )((short )val16)); } else { } bnx2x_cl45_write(bp, phy, 3, 32789, (int )val16); bnx2x_cl45_read(bp, phy, 3, 32790, & val16); val16 = (u16 )(~ ((int )((short )(771 << ((int )lane << 1)))) & (int )((short )val16)); val16 = (u16 )((int )((short )(257 << ((int )lane << 1))) | (int )((short )val16)); if (((int )phy->flags & 16) != 0) { val16 = (u16 )(~ ((int )((short )(3084 << ((int )lane << 1)))) & (int )((short )val16)); val16 = (u16 )((int )((short )(1028 << ((int )lane << 1))) | (int )((short )val16)); } else { } bnx2x_cl45_write(bp, phy, 3, 32790, (int )val16); bnx2x_set_aer_mmd(params, phy); return; } } static void bnx2x_set_warpcore_loopback(struct bnx2x_phy *phy , struct link_params *params ) { struct bnx2x *bp ; u16 val16 ; u32 lane ; long tmp ; u8 tmp___0 ; { bp = params->bp; tmp = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp != 0L) { printk("\rbnx2x: [%s:%d(%s)]Setting Warpcore loopback type %x, speed %d\n", "bnx2x_set_warpcore_loopback", 4684, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )params->loopback_mode, (int )phy->req_line_speed); } else { } if ((unsigned int )phy->req_line_speed <= 9999U || (phy->supported & 4194304U) != 0U) { bnx2x_cl45_write(bp, phy, (int )phy->def_md_devad, 65502, 0); bnx2x_cl45_read_or_write(bp, phy, 3, 32768, 16); tmp___0 = bnx2x_get_warpcore_lane(phy, params); lane = (u32 )tmp___0; bnx2x_cl45_read(bp, phy, 3, 32791, & val16); val16 = (u16 )((int )((short )(1 << (int )lane)) | (int )((short )val16)); if (((int )phy->flags & 16) != 0) { val16 = (u16 )((int )((short )(2 << (int )lane)) | (int )((short )val16)); } else { } bnx2x_cl45_write(bp, phy, 3, 32791, (int )val16); bnx2x_set_aer_mmd(params, phy); } else { bnx2x_cl45_read_or_write(bp, phy, 3, 65504, 16384); bnx2x_cl45_read_or_write(bp, phy, 3, 0, 1); } return; } } static void bnx2x_sync_link(struct link_params *params , struct link_vars *vars ) { struct bnx2x *bp ; u8 link_10g_plus ; long tmp ; long tmp___0 ; { bp = params->bp; if ((vars->link_status & 1073741824U) != 0U) { vars->phy_flags = (u8 )((unsigned int )vars->phy_flags | 4U); } else { } vars->link_up = (unsigned int )((u8 )vars->link_status) & 1U; if ((unsigned int )vars->link_up != 0U) { tmp = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp != 0L) { printk("\rbnx2x: [%s:%d(%s)]phy link up\n", "bnx2x_sync_link", 4731, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } vars->phy_link_up = 1U; vars->duplex = 1U; switch (vars->link_status & 30U) { case 2U: vars->duplex = 0U; case 4U: vars->line_speed = 10U; goto ldv_46179; case 6U: vars->duplex = 0U; case 8U: ; case 10U: vars->line_speed = 100U; goto ldv_46179; case 12U: vars->duplex = 0U; case 14U: vars->line_speed = 1000U; goto ldv_46179; case 16U: vars->duplex = 0U; case 18U: vars->line_speed = 2500U; goto ldv_46179; case 20U: vars->line_speed = 10000U; goto ldv_46179; case 22U: vars->line_speed = 20000U; goto ldv_46179; default: ; goto ldv_46179; } ldv_46179: vars->flow_ctrl = 0U; if ((vars->link_status & 65536U) != 0U) { vars->flow_ctrl = (u16 )((unsigned int )vars->flow_ctrl | 256U); } else { } if ((vars->link_status & 131072U) != 0U) { vars->flow_ctrl = (u16 )((unsigned int )vars->flow_ctrl | 512U); } else { } if ((unsigned int )vars->flow_ctrl == 0U) { vars->flow_ctrl = 1024U; } else { } if ((unsigned int )vars->line_speed != 0U && ((unsigned int )vars->line_speed == 10U || (unsigned int )vars->line_speed == 100U)) { vars->phy_flags = (u8 )((unsigned int )vars->phy_flags | 2U); } else { vars->phy_flags = (unsigned int )vars->phy_flags & 253U; } if (((unsigned int )vars->line_speed != 0U && (((((((((bp->common.chip_id >> 16 == 5770U || bp->common.chip_id >> 16 == 5797U) || bp->common.chip_id >> 16 == 5801U) || bp->common.chip_id >> 16 == 5774U) || bp->common.chip_id >> 16 == 5806U) || bp->common.chip_id >> 16 == 5807U) || ((bp->common.chip_id >> 16 == 5693U || bp->common.chip_id >> 16 == 5694U) || bp->common.chip_id >> 16 == 5695U)) || ((bp->common.chip_id >> 16 == 5793U || bp->common.chip_id >> 16 == 5794U) || bp->common.chip_id >> 16 == 5773U)) || (bp->common.chip_id >> 16 == 5796U || bp->common.chip_id >> 16 == 5803U)) || bp->common.chip_id >> 16 == 5805U)) && (unsigned int )vars->line_speed == 1000U) { vars->phy_flags = (u8 )((unsigned int )vars->phy_flags | 2U); } else { } link_10g_plus = (unsigned int )vars->line_speed > 9999U; if ((unsigned int )link_10g_plus != 0U) { if (((((((((bp->common.chip_id >> 16 == 5770U || bp->common.chip_id >> 16 == 5797U) || bp->common.chip_id >> 16 == 5801U) || bp->common.chip_id >> 16 == 5774U) || bp->common.chip_id >> 16 == 5806U) || bp->common.chip_id >> 16 == 5807U) || ((bp->common.chip_id >> 16 == 5693U || bp->common.chip_id >> 16 == 5694U) || bp->common.chip_id >> 16 == 5695U)) || ((bp->common.chip_id >> 16 == 5793U || bp->common.chip_id >> 16 == 5794U) || bp->common.chip_id >> 16 == 5773U)) || (bp->common.chip_id >> 16 == 5796U || bp->common.chip_id >> 16 == 5803U)) || bp->common.chip_id >> 16 == 5805U) { vars->mac_type = 4U; } else { vars->mac_type = 2U; } } else if (((((((((bp->common.chip_id >> 16 == 5770U || bp->common.chip_id >> 16 == 5797U) || bp->common.chip_id >> 16 == 5801U) || bp->common.chip_id >> 16 == 5774U) || bp->common.chip_id >> 16 == 5806U) || bp->common.chip_id >> 16 == 5807U) || ((bp->common.chip_id >> 16 == 5693U || bp->common.chip_id >> 16 == 5694U) || bp->common.chip_id >> 16 == 5695U)) || ((bp->common.chip_id >> 16 == 5793U || bp->common.chip_id >> 16 == 5794U) || bp->common.chip_id >> 16 == 5773U)) || (bp->common.chip_id >> 16 == 5796U || bp->common.chip_id >> 16 == 5803U)) || bp->common.chip_id >> 16 == 5805U) { vars->mac_type = 3U; } else { vars->mac_type = 1U; } } else { tmp___0 = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp___0 != 0L) { printk("\rbnx2x: [%s:%d(%s)]phy link down\n", "bnx2x_sync_link", 4811, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } vars->phy_link_up = 0U; vars->line_speed = 0U; vars->duplex = 1U; vars->flow_ctrl = 1024U; vars->mac_type = 0U; if ((vars->link_status & 1073741824U) != 0U) { vars->phy_flags = (u8 )((unsigned int )vars->phy_flags | 8U); } else { } if ((int )vars->link_status < 0) { vars->phy_flags = (u8 )((unsigned int )vars->phy_flags | 32U); } else { } } return; } } void bnx2x_link_status_update(struct link_params *params , struct link_vars *vars ) { struct bnx2x *bp ; u8 port ; u32 sync_offset ; u32 media_types ; u8 tmp ; long tmp___0 ; unsigned int tmp___1 ; long tmp___2 ; long tmp___3 ; { bp = params->bp; port = params->port; set_phy_vars(params, vars); vars->link_status = readl((void const volatile *)(bp->regview + (((unsigned long )params->shmem_base + (unsigned long )port * 16UL) + 1636UL))); if ((unsigned int )params->loopback_mode != 0U && (unsigned int )params->loopback_mode != 5U) { vars->link_status = vars->link_status | 1U; } else { } tmp = bnx2x_eee_has_cap(params); if ((unsigned int )tmp != 0U) { vars->eee_status = readl((void const volatile *)(bp->regview + ((unsigned long )params->shmem2_base + ((unsigned long )params->port + 76UL) * 4UL))); } else { } vars->phy_flags = 1U; bnx2x_sync_link(params, vars); sync_offset = (params->shmem_base + (u32 )port * 400U) + 156U; media_types = readl((void const volatile *)bp->regview + (unsigned long )sync_offset); params->phy[0].media_type = media_types & 255U; params->phy[1].media_type = (media_types & 65280U) >> 8; params->phy[2].media_type = (media_types & 16711680U) >> 16; tmp___0 = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp___0 != 0L) { printk("\rbnx2x: [%s:%d(%s)]media_types = 0x%x\n", "bnx2x_link_status_update", 4868, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", media_types); } else { } sync_offset = (params->shmem_base + (u32 )port * 400U) + 152U; vars->aeu_int_mask = readl((void const volatile *)bp->regview + (unsigned long )sync_offset); if ((vars->link_status & 536870912U) != 0U) { params->feature_config_flags = params->feature_config_flags | 2U; } else { params->feature_config_flags = params->feature_config_flags & 4294967293U; } if (bp->common.shmem2_base != 0U) { tmp___1 = readl((void const volatile *)bp->regview + (unsigned long )bp->common.shmem2_base); if (tmp___1 > 340U) { vars->link_attr_sync = readl((void const volatile *)(bp->regview + ((unsigned long )bp->common.shmem2_base + ((unsigned long )params->port + 85UL) * 4UL))); } else { } } else { } tmp___2 = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp___2 != 0L) { printk("\rbnx2x: [%s:%d(%s)]link_status 0x%x phy_link_up %x int_mask 0x%x\n", "bnx2x_link_status_update", 4890, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", vars->link_status, (int )vars->phy_link_up, vars->aeu_int_mask); } else { } tmp___3 = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp___3 != 0L) { printk("\rbnx2x: [%s:%d(%s)]line_speed %x duplex %x flow_ctrl 0x%x\n", "bnx2x_link_status_update", 4892, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )vars->line_speed, (int )vars->duplex, (int )vars->flow_ctrl); } else { } return; } } static void bnx2x_set_master_ln(struct link_params *params , struct bnx2x_phy *phy ) { struct bnx2x *bp ; u16 new_master_ln ; u16 ser_lane ; { bp = params->bp; ser_lane = (u16 )((params->lane_config & 49152U) >> 14); bnx2x_cl45_read(bp, phy, (int )phy->def_md_devad, 33029, & new_master_ln); bnx2x_cl45_write(bp, phy, (int )phy->def_md_devad, 33029, (int )new_master_ln | (int )ser_lane); return; } } static int bnx2x_reset_unicore(struct link_params *params , struct bnx2x_phy *phy , u8 set_serdes ) { struct bnx2x *bp ; u16 mii_control ; u16 i ; long tmp ; { bp = params->bp; bnx2x_cl45_read(bp, phy, (int )phy->def_md_devad, 65504, & mii_control); bnx2x_cl45_write(bp, phy, (int )phy->def_md_devad, 65504, (int )((unsigned int )mii_control | 32768U)); if ((unsigned int )set_serdes != 0U) { bnx2x_set_serdes_access(bp, (int )params->port); } else { } i = 0U; goto ldv_46215; ldv_46214: __const_udelay(21475UL); bnx2x_cl45_read(bp, phy, (int )phy->def_md_devad, 65504, & mii_control); if ((int )((short )mii_control) >= 0) { __const_udelay(21475UL); return (0); } else { } i = (u16 )((int )i + 1); ldv_46215: ; if ((unsigned int )i <= 999U) { goto ldv_46214; } else { } netdev_err((struct net_device const *)bp->dev, "Warning: PHY was not initialized, Port %d\n", (int )params->port); tmp = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp != 0L) { printk("\rbnx2x: [%s:%d(%s)]BUG! XGXS is still in reset!\n", "bnx2x_reset_unicore", 4955, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } return (-22); } } static void bnx2x_set_swap_lanes(struct link_params *params , struct bnx2x_phy *phy ) { struct bnx2x *bp ; u16 rx_lane_swap ; u16 tx_lane_swap ; { bp = params->bp; rx_lane_swap = (u16 )((params->lane_config & 65280U) >> 8); tx_lane_swap = (unsigned int )((u16 )params->lane_config) & 255U; if ((unsigned int )rx_lane_swap != 27U) { bnx2x_cl45_write(bp, phy, (int )phy->def_md_devad, 33024, (int )((unsigned int )rx_lane_swap | 49152U)); } else { bnx2x_cl45_write(bp, phy, (int )phy->def_md_devad, 33024, 0); } if ((unsigned int )tx_lane_swap != 27U) { bnx2x_cl45_write(bp, phy, (int )phy->def_md_devad, 33025, (int )((unsigned int )tx_lane_swap | 32768U)); } else { bnx2x_cl45_write(bp, phy, (int )phy->def_md_devad, 33025, 0); } return; } } static void bnx2x_set_parallel_detection(struct bnx2x_phy *phy , struct link_params *params ) { struct bnx2x *bp ; u16 control2 ; long tmp ; long tmp___0 ; { bp = params->bp; bnx2x_cl45_read(bp, phy, (int )phy->def_md_devad, 33537, & control2); if ((phy->speed_cap_mask & 1048576U) != 0U) { control2 = (u16 )((unsigned int )control2 | 1U); } else { control2 = (unsigned int )control2 & 65534U; } tmp = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp != 0L) { printk("\rbnx2x: [%s:%d(%s)]phy->speed_cap_mask = 0x%x, control2 = 0x%x\n", "bnx2x_set_parallel_detection", 5016, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", phy->speed_cap_mask, (int )control2); } else { } bnx2x_cl45_write(bp, phy, (int )phy->def_md_devad, 33537, (int )control2); if (phy->type == 0U && (phy->speed_cap_mask & 4194304U) != 0U) { tmp___0 = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp___0 != 0L) { printk("\rbnx2x: [%s:%d(%s)]XGXS\n", "bnx2x_set_parallel_detection", 5025, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } bnx2x_cl45_write(bp, phy, (int )phy->def_md_devad, 33075, 5858); bnx2x_cl45_read(bp, phy, (int )phy->def_md_devad, 33073, & control2); control2 = (u16 )((unsigned int )control2 | 1U); bnx2x_cl45_write(bp, phy, (int )phy->def_md_devad, 33073, (int )control2); bnx2x_cl45_write(bp, phy, (int )phy->def_md_devad, 33028, 17); } else { } return; } } static void bnx2x_set_autoneg(struct bnx2x_phy *phy , struct link_params *params , struct link_vars *vars , u8 enable_cl73 ) { struct bnx2x *bp ; u16 reg_val ; { bp = params->bp; bnx2x_cl45_read(bp, phy, (int )phy->def_md_devad, 65504, & reg_val); if ((unsigned int )vars->line_speed == 0U) { reg_val = (u16 )((unsigned int )reg_val | 4096U); } else { reg_val = (unsigned int )reg_val & 60927U; } bnx2x_cl45_write(bp, phy, (int )phy->def_md_devad, 65504, (int )reg_val); bnx2x_cl45_read(bp, phy, (int )phy->def_md_devad, 33536, & reg_val); reg_val = (unsigned int )reg_val & 65523U; reg_val = (u16 )((unsigned int )reg_val | 1U); if ((unsigned int )vars->line_speed == 0U) { reg_val = (u16 )((unsigned int )reg_val | 16U); } else { reg_val = (unsigned int )reg_val & 65519U; } bnx2x_cl45_write(bp, phy, (int )phy->def_md_devad, 33536, (int )reg_val); bnx2x_cl45_read(bp, phy, (int )phy->def_md_devad, 33616, & reg_val); if ((unsigned int )vars->line_speed == 0U) { reg_val = (u16 )((unsigned int )reg_val | 3U); } else { reg_val = (unsigned int )reg_val & 65532U; } bnx2x_cl45_write(bp, phy, (int )phy->def_md_devad, 33616, (int )reg_val); if ((unsigned int )enable_cl73 != 0U) { bnx2x_cl45_write(bp, phy, (int )phy->def_md_devad, 33648, 14); bnx2x_cl45_write(bp, phy, (int )phy->def_md_devad, 33650, 57344); bnx2x_cl45_read(bp, phy, (int )phy->def_md_devad, 17, & reg_val); if ((phy->speed_cap_mask & 4194304U) != 0U) { reg_val = (u16 )((unsigned int )reg_val | 64U); } else { } if ((phy->speed_cap_mask & 1048576U) != 0U) { reg_val = (u16 )((unsigned int )reg_val | 32U); } else { } bnx2x_cl45_write(bp, phy, (int )phy->def_md_devad, 17, (int )reg_val); reg_val = 4096U; } else { reg_val = 0U; } bnx2x_cl45_write(bp, phy, (int )phy->def_md_devad, 0, (int )reg_val); return; } } static void bnx2x_program_serdes(struct bnx2x_phy *phy , struct link_params *params , struct link_vars *vars ) { struct bnx2x *bp ; u16 reg_val ; long tmp ; { bp = params->bp; bnx2x_cl45_read(bp, phy, (int )phy->def_md_devad, 65504, & reg_val); reg_val = (unsigned int )reg_val & 52927U; if ((unsigned int )phy->req_duplex == 1U) { reg_val = (u16 )((unsigned int )reg_val | 256U); } else { } bnx2x_cl45_write(bp, phy, (int )phy->def_md_devad, 65504, (int )reg_val); bnx2x_cl45_read(bp, phy, (int )phy->def_md_devad, 33544, & reg_val); tmp = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp != 0L) { printk("\rbnx2x: [%s:%d(%s)]MDIO_REG_BANK_SERDES_DIGITAL = 0x%x\n", "bnx2x_program_serdes", 5186, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )reg_val); } else { } reg_val = (unsigned int )reg_val & 65504U; if (((unsigned int )vars->line_speed != 1000U && (unsigned int )vars->line_speed != 100U) && (unsigned int )vars->line_speed != 10U) { reg_val = (u16 )((unsigned int )reg_val | 24592U); if ((unsigned int )vars->line_speed == 10000U) { reg_val = (u16 )((unsigned int )reg_val | 4U); } else { } } else { } bnx2x_cl45_write(bp, phy, (int )phy->def_md_devad, 33544, (int )reg_val); return; } } static void bnx2x_set_brcm_cl37_advertisement(struct bnx2x_phy *phy , struct link_params *params ) { struct bnx2x *bp ; u16 val ; { bp = params->bp; val = 0U; if ((phy->speed_cap_mask & 2097152U) != 0U) { val = (u16 )((unsigned int )val | 1U); } else { } if ((phy->speed_cap_mask & 4194304U) != 0U) { val = (u16 )((unsigned int )val | 16U); } else { } bnx2x_cl45_write(bp, phy, (int )phy->def_md_devad, 33577, (int )val); bnx2x_cl45_write(bp, phy, (int )phy->def_md_devad, 33579, 1024); return; } } static void bnx2x_set_ieee_aneg_advertisement(struct bnx2x_phy *phy , struct link_params *params , u16 ieee_fc ) { struct bnx2x *bp ; u16 val ; { bp = params->bp; bnx2x_cl45_write(bp, phy, (int )phy->def_md_devad, 65508, (int )ieee_fc); bnx2x_cl45_read(bp, phy, (int )phy->def_md_devad, 16, & val); val = (unsigned int )val & 62463U; val = (u16 )(((int )((short )((int )ieee_fc << 3)) & 3072) | (int )((short )val)); bnx2x_cl45_write(bp, phy, (int )phy->def_md_devad, 16, (int )val); return; } } static void bnx2x_restart_autoneg(struct bnx2x_phy *phy , struct link_params *params , u8 enable_cl73 ) { struct bnx2x *bp ; u16 mii_control ; long tmp ; long tmp___0 ; { bp = params->bp; tmp = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp != 0L) { printk("\rbnx2x: [%s:%d(%s)]bnx2x_restart_autoneg\n", "bnx2x_restart_autoneg", 5256, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } if ((unsigned int )enable_cl73 != 0U) { bnx2x_cl45_read(bp, phy, (int )phy->def_md_devad, 0, & mii_control); bnx2x_cl45_write(bp, phy, (int )phy->def_md_devad, 0, (int )((unsigned int )mii_control | 4608U)); } else { bnx2x_cl45_read(bp, phy, (int )phy->def_md_devad, 65504, & mii_control); tmp___0 = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp___0 != 0L) { printk("\rbnx2x: [%s:%d(%s)]bnx2x_restart_autoneg mii_control before = 0x%x\n", "bnx2x_restart_autoneg", 5279, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )mii_control); } else { } bnx2x_cl45_write(bp, phy, (int )phy->def_md_devad, 65504, (int )((unsigned int )mii_control | 4608U)); } return; } } static void bnx2x_initialize_sgmii_process(struct bnx2x_phy *phy , struct link_params *params , struct link_vars *vars ) { struct bnx2x *bp ; u16 control1 ; u16 mii_control ; long tmp ; { bp = params->bp; bnx2x_cl45_read(bp, phy, (int )phy->def_md_devad, 33536, & control1); control1 = (u16 )((unsigned int )control1 | 8U); control1 = (unsigned int )control1 & 65486U; bnx2x_cl45_write(bp, phy, (int )phy->def_md_devad, 33536, (int )control1); if ((unsigned int )vars->line_speed != 0U) { bnx2x_cl45_read(bp, phy, (int )phy->def_md_devad, 65504, & mii_control); mii_control = (unsigned int )mii_control & 52927U; switch ((int )vars->line_speed) { case 100: mii_control = (u16 )((unsigned int )mii_control | 8192U); goto ldv_46278; case 1000: mii_control = (u16 )((unsigned int )mii_control | 64U); goto ldv_46278; case 10: ; goto ldv_46278; default: tmp = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp != 0L) { printk("\rbnx2x: [%s:%d(%s)]Invalid line_speed 0x%x\n", "bnx2x_initialize_sgmii_process", 5340, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )vars->line_speed); } else { } goto ldv_46278; } ldv_46278: ; if ((unsigned int )phy->req_duplex == 1U) { mii_control = (u16 )((unsigned int )mii_control | 256U); } else { } bnx2x_cl45_write(bp, phy, (int )phy->def_md_devad, 65504, (int )mii_control); } else { bnx2x_restart_autoneg(phy, params, 0); } return; } } static int bnx2x_direct_parallel_detect_used(struct bnx2x_phy *phy , struct link_params *params ) { struct bnx2x *bp ; u16 pd_10g ; u16 status2_1000x ; long tmp ; long tmp___0 ; { bp = params->bp; if ((unsigned int )phy->req_line_speed != 0U) { return (0); } else { } bnx2x_cl45_read(bp, phy, (int )phy->def_md_devad, 33541, & status2_1000x); bnx2x_cl45_read(bp, phy, (int )phy->def_md_devad, 33541, & status2_1000x); if (((int )status2_1000x & 2) != 0) { tmp = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp != 0L) { printk("\rbnx2x: [%s:%d(%s)]1G parallel detect link on port %d\n", "bnx2x_direct_parallel_detect_used", 5378, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )params->port); } else { } return (1); } else { } bnx2x_cl45_read(bp, phy, (int )phy->def_md_devad, 33072, & pd_10g); if ((int )((short )pd_10g) < 0) { tmp___0 = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp___0 != 0L) { printk("\rbnx2x: [%s:%d(%s)]10G parallel detect link on port %d\n", "bnx2x_direct_parallel_detect_used", 5389, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )params->port); } else { } return (1); } else { } return (0); } } static void bnx2x_update_adv_fc(struct bnx2x_phy *phy , struct link_params *params , struct link_vars *vars , u32 gp_status ) { u16 ld_pause ; u16 lp_pause ; u16 pause_result ; struct bnx2x *bp ; long tmp ; long tmp___0 ; { bp = params->bp; if ((gp_status & 17U) == 17U) { bnx2x_cl45_read(bp, phy, (int )phy->def_md_devad, 16, & ld_pause); bnx2x_cl45_read(bp, phy, (int )phy->def_md_devad, 19, & lp_pause); pause_result = (u16 )(((int )ld_pause & 3072) >> 8); pause_result = (u16 )((int )((short )(((int )lp_pause & 3072) >> 10)) | (int )((short )pause_result)); tmp = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp != 0L) { printk("\rbnx2x: [%s:%d(%s)]pause_result CL73 0x%x\n", "bnx2x_update_adv_fc", 5422, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )pause_result); } else { } } else { bnx2x_cl45_read(bp, phy, (int )phy->def_md_devad, 65508, & ld_pause); bnx2x_cl45_read(bp, phy, (int )phy->def_md_devad, 65509, & lp_pause); pause_result = (u16 )(((int )ld_pause & 384) >> 5); pause_result = (u16 )((int )((short )(((int )lp_pause & 384) >> 7)) | (int )((short )pause_result)); tmp___0 = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp___0 != 0L) { printk("\rbnx2x: [%s:%d(%s)]pause_result CL37 0x%x\n", "bnx2x_update_adv_fc", 5436, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )pause_result); } else { } } bnx2x_pause_resolve(vars, (u32 )pause_result); return; } } static void bnx2x_flow_ctrl_resolve(struct bnx2x_phy *phy , struct link_params *params , struct link_vars *vars , u32 gp_status ) { struct bnx2x *bp ; int tmp ; long tmp___0 ; { bp = params->bp; vars->flow_ctrl = 1024U; if ((unsigned int )phy->req_flow_ctrl != 0U) { if ((unsigned int )phy->req_line_speed == 0U) { bnx2x_update_adv_fc(phy, params, vars, gp_status); } else { } vars->flow_ctrl = phy->req_flow_ctrl; } else if ((unsigned int )phy->req_line_speed != 0U) { vars->flow_ctrl = params->req_fc_auto_adv; } else if ((gp_status & 3U) != 0U && ((int )vars->phy_flags & 2) == 0) { tmp = bnx2x_direct_parallel_detect_used(phy, params); if (tmp != 0) { vars->flow_ctrl = params->req_fc_auto_adv; return; } else { } bnx2x_update_adv_fc(phy, params, vars, gp_status); } else { } tmp___0 = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp___0 != 0L) { printk("\rbnx2x: [%s:%d(%s)]flow_ctrl 0x%x\n", "bnx2x_flow_ctrl_resolve", 5467, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )vars->flow_ctrl); } else { } return; } } static void bnx2x_check_fallback_to_cl37(struct bnx2x_phy *phy , struct link_params *params ) { struct bnx2x *bp ; u16 rx_status ; u16 ustat_val ; u16 cl37_fsm_received ; long tmp ; long tmp___0 ; long tmp___1 ; long tmp___2 ; long tmp___3 ; { bp = params->bp; tmp = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp != 0L) { printk("\rbnx2x: [%s:%d(%s)]bnx2x_check_fallback_to_cl37\n", "bnx2x_check_fallback_to_cl37", 5475, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } bnx2x_cl45_read(bp, phy, (int )phy->def_md_devad, 32944, & rx_status); if ((int )((short )rx_status) >= 0) { tmp___0 = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp___0 != 0L) { printk("\rbnx2x: [%s:%d(%s)]Signal is not detected. Restoring CL73.rx_status(0x80b0) = 0x%x\n", "bnx2x_check_fallback_to_cl37", 5484, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )rx_status); } else { } bnx2x_cl45_write(bp, phy, (int )phy->def_md_devad, 0, 4096); return; } else { } bnx2x_cl45_read(bp, phy, (int )phy->def_md_devad, 33649, & ustat_val); if (((int )ustat_val & 1280) != 1280) { tmp___1 = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp___1 != 0L) { printk("\rbnx2x: [%s:%d(%s)]CL73 state-machine is not stable. ustat_val(0x8371) = 0x%x\n", "bnx2x_check_fallback_to_cl37", 5502, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )ustat_val); } else { } return; } else { } bnx2x_cl45_read(bp, phy, (int )phy->def_md_devad, 33584, & cl37_fsm_received); if (((int )cl37_fsm_received & 1552) != 1552) { tmp___2 = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp___2 != 0L) { printk("\rbnx2x: [%s:%d(%s)]No CL37 FSM were received. misc_rx_status(0x8330) = 0x%x\n", "bnx2x_check_fallback_to_cl37", 5519, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )cl37_fsm_received); } else { } return; } else { } bnx2x_cl45_write(bp, phy, (int )phy->def_md_devad, 0, 0); bnx2x_restart_autoneg(phy, params, 0); tmp___3 = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp___3 != 0L) { printk("\rbnx2x: [%s:%d(%s)]Disabling CL73, and restarting CL37 autoneg\n", "bnx2x_check_fallback_to_cl37", 5535, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } return; } } static void bnx2x_xgxs_an_resolve(struct bnx2x_phy *phy , struct link_params *params , struct link_vars *vars , u32 gp_status ) { int tmp ; { if ((gp_status & 3U) != 0U) { vars->link_status = vars->link_status | 64U; } else { } tmp = bnx2x_direct_parallel_detect_used(phy, params); if (tmp != 0) { vars->link_status = vars->link_status | 128U; } else { } return; } } static int bnx2x_get_link_speed_duplex(struct bnx2x_phy *phy , struct link_params *params , struct link_vars *vars , u16 is_link_up , u16 speed_mask , u16 is_duplex ) { struct bnx2x *bp ; long tmp ; long tmp___0 ; long tmp___1 ; long tmp___2 ; long tmp___3 ; { bp = params->bp; if ((unsigned int )phy->req_line_speed == 0U) { vars->link_status = vars->link_status | 32U; } else { } if ((unsigned int )is_link_up != 0U) { tmp = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp != 0L) { printk("\rbnx2x: [%s:%d(%s)]phy link up\n", "bnx2x_get_link_speed_duplex", 5562, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } vars->phy_link_up = 1U; vars->link_status = vars->link_status | 1U; switch ((int )speed_mask) { case 0: vars->line_speed = 10U; if ((unsigned int )is_duplex == 1U) { vars->link_status = vars->link_status | 4U; } else { vars->link_status = vars->link_status | 2U; } goto ldv_46336; case 256: vars->line_speed = 100U; if ((unsigned int )is_duplex == 1U) { vars->link_status = vars->link_status | 10U; } else { vars->link_status = vars->link_status | 6U; } goto ldv_46336; case 512: ; case 3328: vars->line_speed = 1000U; if ((unsigned int )is_duplex == 1U) { vars->link_status = vars->link_status | 14U; } else { vars->link_status = vars->link_status | 12U; } goto ldv_46336; case 768: vars->line_speed = 2500U; if ((unsigned int )is_duplex == 1U) { vars->link_status = vars->link_status | 18U; } else { vars->link_status = vars->link_status | 16U; } goto ldv_46336; case 1024: ; case 1280: tmp___0 = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp___0 != 0L) { printk("\rbnx2x: [%s:%d(%s)]link speed unsupported gp_status 0x%x\n", "bnx2x_get_link_speed_duplex", 5605, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )speed_mask); } else { } return (-22); case 3584: ; case 1536: ; case 1792: ; case 3840: ; case 7936: ; case 6912: vars->line_speed = 10000U; vars->link_status = vars->link_status | 20U; goto ldv_46336; case 7680: ; case 14592: vars->line_speed = 20000U; vars->link_status = vars->link_status | 22U; goto ldv_46336; default: tmp___1 = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp___1 != 0L) { printk("\rbnx2x: [%s:%d(%s)]link speed unsupported gp_status 0x%x\n", "bnx2x_get_link_speed_duplex", 5625, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )speed_mask); } else { } return (-22); } ldv_46336: ; } else { tmp___2 = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp___2 != 0L) { printk("\rbnx2x: [%s:%d(%s)]phy link down\n", "bnx2x_get_link_speed_duplex", 5629, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } vars->phy_link_up = 0U; vars->duplex = 1U; vars->flow_ctrl = 1024U; vars->mac_type = 0U; } tmp___3 = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp___3 != 0L) { printk("\rbnx2x: [%s:%d(%s)] phy_link_up %x line_speed %d\n", "bnx2x_get_link_speed_duplex", 5638, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )vars->phy_link_up, (int )vars->line_speed); } else { } return (0); } } static int bnx2x_link_settings_status(struct bnx2x_phy *phy , struct link_params *params , struct link_vars *vars ) { struct bnx2x *bp ; u16 gp_status ; u16 duplex ; u16 link_up ; u16 speed_mask ; int rc ; long tmp ; u16 val ; long tmp___0 ; { bp = params->bp; duplex = 0U; link_up = 0U; rc = 0; bnx2x_cl45_read(bp, phy, (int )phy->def_md_devad, 33067, & gp_status); if (((int )gp_status & 8) != 0) { duplex = 1U; } else { } if (((int )gp_status & 4) != 0) { link_up = 1U; } else { } speed_mask = (unsigned int )gp_status & 16128U; tmp = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp != 0L) { printk("\rbnx2x: [%s:%d(%s)]gp_status 0x%x, is_link_up %d, speed_mask 0x%x\n", "bnx2x_link_settings_status", 5662, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )gp_status, (int )link_up, (int )speed_mask); } else { } rc = bnx2x_get_link_speed_duplex(phy, params, vars, (int )link_up, (int )speed_mask, (int )duplex); if (rc == -22) { return (rc); } else { } if (((int )gp_status & 4) != 0) { if ((unsigned int )params->num_phys == 1U) { vars->duplex = duplex; bnx2x_flow_ctrl_resolve(phy, params, vars, (u32 )gp_status); if ((unsigned int )phy->req_line_speed == 0U) { bnx2x_xgxs_an_resolve(phy, params, vars, (u32 )gp_status); } else { } } else { } } else if ((unsigned int )phy->req_line_speed == 0U && (unsigned int )params->num_phys == 1U) { bnx2x_check_fallback_to_cl37(phy, params); } else { } if ((unsigned int )params->num_phys == 1U && (vars->link_status & 64U) != 0U) { bnx2x_cl45_read(bp, phy, (int )phy->def_md_devad, 20, & val); if (((int )val & 32) != 0) { vars->link_status = vars->link_status | 512U; } else { } if (((int )val & 192) != 0) { vars->link_status = vars->link_status | 8388608U; } else { } bnx2x_cl45_read(bp, phy, (int )phy->def_md_devad, 33580, & val); if ((int )val & 1) { vars->link_status = vars->link_status | 2097152U; } else { } if (((int )val & 24) != 0) { vars->link_status = vars->link_status | 8388608U; } else { } } else { } tmp___0 = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp___0 != 0L) { printk("\rbnx2x: [%s:%d(%s)]duplex %x flow_ctrl 0x%x link_status 0x%x\n", "bnx2x_link_settings_status", 5712, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )vars->duplex, (int )vars->flow_ctrl, vars->link_status); } else { } return (rc); } } static int bnx2x_warpcore_read_status(struct bnx2x_phy *phy , struct link_params *params , struct link_vars *vars ) { struct bnx2x *bp ; u8 lane ; u16 gp_status1 ; u16 gp_speed ; u16 link_up ; u16 duplex ; int rc ; u16 temp_link_up ; long tmp ; long tmp___0 ; u16 an_link ; u16 pd ; u16 gp_status4 ; u16 val ; long tmp___1 ; long tmp___2 ; { bp = params->bp; duplex = 1U; rc = 0; lane = bnx2x_get_warpcore_lane(phy, params); if ((unsigned int )params->loopback_mode != 0U && ((int )phy->flags & 16) != 0) { bnx2x_cl45_read(bp, phy, 3, 33613, & link_up); bnx2x_cl45_read(bp, phy, 3, 33613, & link_up); link_up = (unsigned int )link_up & 1U; } else if ((unsigned int )phy->req_line_speed > 10000U && (phy->supported & 2097152U) != 0U) { bnx2x_cl45_read(bp, phy, 3, 1, & temp_link_up); bnx2x_cl45_read(bp, phy, 3, 1, & link_up); tmp = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp != 0L) { printk("\rbnx2x: [%s:%d(%s)]PCS RX link status = 0x%x-->0x%x\n", "bnx2x_warpcore_read_status", 5741, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )temp_link_up, (int )link_up); } else { } link_up = (unsigned int )link_up & 4U; if ((unsigned int )link_up != 0U) { bnx2x_ext_phy_resolve_fc(phy, params, vars); } else { } } else { bnx2x_cl45_read(bp, phy, 3, 33233, & gp_status1); tmp___0 = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp___0 != 0L) { printk("\rbnx2x: [%s:%d(%s)]0x81d1 = 0x%x\n", "bnx2x_warpcore_read_status", 5749, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )gp_status1); } else { } link_up = (u16 )((int )((short )((((int )gp_status1 >> 8) | ((int )gp_status1 >> 12)) | (int )gp_status1)) & (int )((short )(1 << (int )lane))); if ((phy->supported & 4194304U) != 0U) { bnx2x_cl45_read(bp, phy, 7, 1, & an_link); bnx2x_cl45_read(bp, phy, 7, 1, & an_link); link_up = (u16 )(((int )((short )an_link) & 4) | (int )((short )link_up)); } else { } if ((unsigned int )link_up != 0U && (unsigned int )params->num_phys == 1U) { if ((unsigned int )phy->req_line_speed == 0U) { bnx2x_cl45_read(bp, phy, 3, 33236, & gp_status4); if (((int )gp_status4 & (4096 << (int )lane)) != 0) { vars->link_status = vars->link_status | 64U; } else { } bnx2x_cl45_read(bp, phy, 3, 33072, & pd); if ((int )((short )pd) < 0) { vars->link_status = vars->link_status | 128U; } else { } } else { } bnx2x_ext_phy_resolve_fc(phy, params, vars); vars->duplex = duplex; } else { } } if ((vars->link_status & 64U) != 0U && (unsigned int )params->num_phys == 1U) { bnx2x_cl45_read(bp, phy, 7, 20, & val); if (((int )val & 32) != 0) { vars->link_status = vars->link_status | 512U; } else { } if (((int )val & 192) != 0) { vars->link_status = vars->link_status | 8388608U; } else { } bnx2x_cl45_read(bp, phy, 3, 33580, & val); if ((int )val & 1) { vars->link_status = vars->link_status | 2097152U; } else { } if (((int )val & 24) != 0) { vars->link_status = vars->link_status | 8388608U; } else { } } else { } if ((unsigned int )lane <= 1U) { bnx2x_cl45_read(bp, phy, 3, 33234, & gp_speed); } else { bnx2x_cl45_read(bp, phy, 3, 33235, & gp_speed); } tmp___1 = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp___1 != 0L) { printk("\rbnx2x: [%s:%d(%s)]lane %d gp_speed 0x%x\n", "bnx2x_warpcore_read_status", 5822, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )lane, (int )gp_speed); } else { } if (((int )lane & 1) == 0) { gp_speed = (int )gp_speed << 8U; } else { } gp_speed = (unsigned int )gp_speed & 16128U; link_up = (unsigned int )link_up != 0U; rc = bnx2x_get_link_speed_duplex(phy, params, vars, (int )link_up, (int )gp_speed, (int )duplex); tmp___2 = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp___2 != 0L) { printk("\rbnx2x: [%s:%d(%s)]duplex %x flow_ctrl 0x%x link_status 0x%x\n", "bnx2x_warpcore_read_status", 5833, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )vars->duplex, (int )vars->flow_ctrl, vars->link_status); } else { } return (rc); } } static void bnx2x_set_gmii_tx_driver(struct link_params *params ) { struct bnx2x *bp ; struct bnx2x_phy *phy ; u16 lp_up2 ; u16 tx_driver ; u16 bank ; { bp = params->bp; phy = (struct bnx2x_phy *)(& params->phy); bnx2x_cl45_read(bp, phy, (int )phy->def_md_devad, 33581, & lp_up2); lp_up2 = (int )((u16 )(((int )lp_up2 & 1920) >> 7)) << 12U; if ((unsigned int )lp_up2 == 0U) { return; } else { } bank = 32864U; goto ldv_46392; ldv_46391: bnx2x_cl45_read(bp, phy, (int )phy->def_md_devad, (int )((unsigned int )bank + 7U), & tx_driver); if ((int )lp_up2 != ((int )tx_driver & 61440)) { tx_driver = (unsigned int )tx_driver & 4095U; tx_driver = (u16 )((int )tx_driver | (int )lp_up2); bnx2x_cl45_write(bp, phy, (int )phy->def_md_devad, (int )((unsigned int )bank + 7U), (int )tx_driver); } else { } bank = (unsigned int )bank + 16U; ldv_46392: ; if ((unsigned int )bank <= 32912U) { goto ldv_46391; } else { } return; } } static int bnx2x_emac_program(struct link_params *params , struct link_vars *vars ) { struct bnx2x *bp ; u8 port ; u16 mode ; long tmp ; long tmp___0 ; { bp = params->bp; port = params->port; mode = 0U; tmp = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp != 0L) { printk("\rbnx2x: [%s:%d(%s)]setting link speed & duplex\n", "bnx2x_emac_program", 5882, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } bnx2x_bits_dis(bp, (u32 )(((int )port + 32) * 1024), 46U); switch ((int )vars->line_speed) { case 10: mode = (u16 )((unsigned int )mode | 12U); goto ldv_46403; case 100: mode = (u16 )((unsigned int )mode | 4U); goto ldv_46403; case 1000: mode = (u16 )((unsigned int )mode | 8U); goto ldv_46403; case 2500: mode = (u16 )((unsigned int )mode | 40U); goto ldv_46403; default: tmp___0 = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp___0 != 0L) { printk("\rbnx2x: [%s:%d(%s)]Invalid line_speed 0x%x\n", "bnx2x_emac_program", 5908, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )vars->line_speed); } else { } return (-22); } ldv_46403: ; if ((unsigned int )vars->duplex == 0U) { mode = (u16 )((unsigned int )mode | 2U); } else { } bnx2x_bits_en(bp, (u32 )(((int )port + 32) * 1024), (u32 )mode); bnx2x_set_led(params, vars, 2, (u32 )vars->line_speed); return (0); } } static void bnx2x_set_preemphasis(struct bnx2x_phy *phy , struct link_params *params ) { u16 bank ; u16 i ; struct bnx2x *bp ; { i = 0U; bp = params->bp; bank = 32944U; i = 0U; goto ldv_46416; ldv_46415: bnx2x_cl45_write(bp, phy, (int )phy->def_md_devad, (int )((unsigned int )bank + 12U), (int )phy->rx_preemphasis[(int )i]); bank = (unsigned int )bank + 16U; i = (u16 )((int )i + 1); ldv_46416: ; if ((unsigned int )bank <= 32992U) { goto ldv_46415; } else { } bank = 32864U; i = 0U; goto ldv_46419; ldv_46418: bnx2x_cl45_write(bp, phy, (int )phy->def_md_devad, (int )((unsigned int )bank + 7U), (int )phy->tx_preemphasis[(int )i]); bank = (unsigned int )bank + 16U; i = (u16 )((int )i + 1); ldv_46419: ; if ((unsigned int )bank <= 32912U) { goto ldv_46418; } else { } return; } } static void bnx2x_xgxs_config_init(struct bnx2x_phy *phy , struct link_params *params , struct link_vars *vars ) { struct bnx2x *bp ; u8 enable_cl73 ; long tmp ; long tmp___0 ; long tmp___1 ; { bp = params->bp; enable_cl73 = (u8 )((unsigned int )params->num_phys == 1U || (unsigned int )params->loopback_mode == 3U); if (((int )vars->phy_flags & 2) == 0) { if ((unsigned int )params->num_phys == 1U && (int )params->feature_config_flags & 1) { bnx2x_set_preemphasis(phy, params); } else { } if ((unsigned int )vars->line_speed != 0U || ((unsigned int )params->num_phys == 1U && (unsigned int )params->loopback_mode == 5U)) { tmp = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp != 0L) { printk("\rbnx2x: [%s:%d(%s)]not SGMII, no AN\n", "bnx2x_xgxs_config_init", 5963, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } bnx2x_set_autoneg(phy, params, vars, 0); bnx2x_program_serdes(phy, params, vars); } else { tmp___0 = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp___0 != 0L) { printk("\rbnx2x: [%s:%d(%s)]not SGMII, AN\n", "bnx2x_xgxs_config_init", 5972, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } bnx2x_set_brcm_cl37_advertisement(phy, params); bnx2x_set_ieee_aneg_advertisement(phy, params, (int )vars->ieee_fc); bnx2x_set_autoneg(phy, params, vars, (int )enable_cl73); bnx2x_restart_autoneg(phy, params, (int )enable_cl73); } } else { tmp___1 = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp___1 != 0L) { printk("\rbnx2x: [%s:%d(%s)]SGMII\n", "bnx2x_xgxs_config_init", 5989, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } bnx2x_initialize_sgmii_process(phy, params, vars); } return; } } static int bnx2x_prepare_xgxs(struct bnx2x_phy *phy , struct link_params *params , struct link_vars *vars ) { int rc ; { vars->phy_flags = (u8 )((unsigned int )vars->phy_flags | 1U); if ((((unsigned int )phy->req_line_speed != 0U && ((unsigned int )phy->req_line_speed == 100U || (unsigned int )phy->req_line_speed == 10U)) || (((unsigned int )phy->req_line_speed == 0U && phy->speed_cap_mask > 65535U) && phy->speed_cap_mask <= 1048575U)) || phy->type == 33554432U) { vars->phy_flags = (u8 )((unsigned int )vars->phy_flags | 2U); } else { vars->phy_flags = (unsigned int )vars->phy_flags & 253U; } bnx2x_calc_ieee_aneg_adv(phy, params, & vars->ieee_fc); bnx2x_set_aer_mmd(params, phy); if (phy->type == 0U) { bnx2x_set_master_ln(params, phy); } else { } rc = bnx2x_reset_unicore(params, phy, 0); if (rc != 0) { return (rc); } else { } bnx2x_set_aer_mmd(params, phy); if (phy->type == 0U) { bnx2x_set_master_ln(params, phy); bnx2x_set_swap_lanes(params, phy); } else { } return (rc); } } static u16 bnx2x_wait_reset_complete(struct bnx2x *bp , struct bnx2x_phy *phy , struct link_params *params ) { u16 cnt ; u16 ctrl ; long tmp ; { cnt = 0U; goto ldv_46444; ldv_46443: ; if (phy->type == 3584U) { bnx2x_cl22_read(bp, phy, 0, & ctrl); } else { bnx2x_cl45_read(bp, phy, 1, 0, & ctrl); } if ((int )((short )ctrl) >= 0) { goto ldv_46442; } else { } usleep_range(1000UL, 2000UL); cnt = (u16 )((int )cnt + 1); ldv_46444: ; if ((unsigned int )cnt <= 999U) { goto ldv_46443; } else { } ldv_46442: ; if ((unsigned int )cnt == 1000U) { netdev_err((struct net_device const *)bp->dev, "Warning: PHY was not initialized, Port %d\n", (int )params->port); } else { } tmp = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp != 0L) { printk("\rbnx2x: [%s:%d(%s)]control reg 0x%x (after %d ms)\n", "bnx2x_wait_reset_complete", 6057, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )ctrl, (int )cnt); } else { } return (cnt); } } static void bnx2x_link_int_enable(struct link_params *params ) { u8 port ; u32 mask ; struct bnx2x *bp ; long tmp ; long tmp___0 ; long tmp___1 ; long tmp___2 ; unsigned int tmp___3 ; long tmp___4 ; unsigned int tmp___5 ; unsigned int tmp___6 ; unsigned int tmp___7 ; long tmp___8 ; unsigned int tmp___9 ; unsigned int tmp___10 ; long tmp___11 ; { port = params->port; bp = params->bp; if (((((((((bp->common.chip_id >> 16 == 5770U || bp->common.chip_id >> 16 == 5797U) || bp->common.chip_id >> 16 == 5801U) || bp->common.chip_id >> 16 == 5774U) || bp->common.chip_id >> 16 == 5806U) || bp->common.chip_id >> 16 == 5807U) || ((bp->common.chip_id >> 16 == 5693U || bp->common.chip_id >> 16 == 5694U) || bp->common.chip_id >> 16 == 5695U)) || ((bp->common.chip_id >> 16 == 5793U || bp->common.chip_id >> 16 == 5794U) || bp->common.chip_id >> 16 == 5773U)) || (bp->common.chip_id >> 16 == 5796U || bp->common.chip_id >> 16 == 5803U)) || bp->common.chip_id >> 16 == 5805U) { mask = 3932160U; if ((unsigned int )params->num_phys != 1U) { mask = mask | 1U; } else { } } else if (params->switch_cfg == 16777216U) { mask = 3964928U; tmp = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp != 0L) { printk("\rbnx2x: [%s:%d(%s)]enabled XGXS interrupt\n", "bnx2x_link_int_enable", 6075, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } if ((unsigned int )params->num_phys != 1U && params->phy[0].type != 64768U) { mask = mask | 1U; tmp___0 = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp___0 != 0L) { printk("\rbnx2x: [%s:%d(%s)]enabled external phy int\n", "bnx2x_link_int_enable", 6080, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } } else { } } else { mask = 512U; tmp___1 = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp___1 != 0L) { printk("\rbnx2x: [%s:%d(%s)]enabled SerDes interrupt\n", "bnx2x_link_int_enable", 6085, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } if ((unsigned int )params->num_phys != 1U && params->phy[0].type != 4278190080U) { mask = mask | 1U; tmp___2 = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp___2 != 0L) { printk("\rbnx2x: [%s:%d(%s)]enabled external phy int\n", "bnx2x_link_int_enable", 6090, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } } else { } } bnx2x_bits_en(bp, (u32 )(((int )port + 16588) * 4), mask); tmp___4 = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp___4 != 0L) { tmp___3 = readl((void const volatile *)bp->regview + (unsigned long )(((int )port + 16586) * 4)); printk("\rbnx2x: [%s:%d(%s)]port %x, is_xgxs %x, int_status 0x%x\n", "bnx2x_link_int_enable", 6099, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )port, params->switch_cfg == 16777216U, tmp___3); } else { } tmp___8 = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp___8 != 0L) { tmp___5 = readl((void const volatile *)bp->regview + (unsigned long )((int )port * 60 + 66936)); tmp___6 = readl((void const volatile *)bp->regview + (unsigned long )((int )port * 24 + 66708)); tmp___7 = readl((void const volatile *)bp->regview + (unsigned long )(((int )port + 16588) * 4)); printk("\rbnx2x: [%s:%d(%s)] int_mask 0x%x, MI_INT %x, SERDES_LINK %x\n", "bnx2x_link_int_enable", 6103, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", tmp___7, tmp___6, tmp___5); } else { } tmp___11 = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp___11 != 0L) { tmp___9 = readl((void const volatile *)bp->regview + (unsigned long )((int )port * 104 + 67204)); tmp___10 = readl((void const volatile *)bp->regview + (unsigned long )((int )port * 104 + 67200)); printk("\rbnx2x: [%s:%d(%s)] 10G %x, XGXS_LINK %x\n", "bnx2x_link_int_enable", 6106, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", tmp___10, tmp___9); } else { } return; } } static void bnx2x_rearm_latch_signal(struct bnx2x *bp , u8 port , u8 exp_mi_int ) { u32 latch_status ; long tmp ; { latch_status = 0U; latch_status = readl((void const volatile *)bp->regview + (unsigned long )(((int )port + 12288) * 8)); tmp = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp != 0L) { printk("\rbnx2x: [%s:%d(%s)]latch_status = 0x%x\n", "bnx2x_rearm_latch_signal", 6121, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", latch_status); } else { } if ((unsigned int )exp_mi_int != 0U) { bnx2x_bits_en(bp, (u32 )(((int )port + 16586) * 4), 1U); } else { bnx2x_bits_dis(bp, (u32 )(((int )port + 16586) * 4), 1U); } if ((int )latch_status & 1) { writel(latch_status & 65535U, (void volatile *)bp->regview + (unsigned long )(((int )port + 12288) * 8)); } else { } return; } } static void bnx2x_link_int_ack(struct link_params *params , struct link_vars *vars , u8 is_10g_plus ) { struct bnx2x *bp ; u8 port ; u32 mask ; u32 ser_lane ; long tmp ; { bp = params->bp; port = params->port; bnx2x_bits_dis(bp, (u32 )(((int )port + 16586) * 4), 3965440U); if ((unsigned int )vars->phy_link_up != 0U) { if (((((((((bp->common.chip_id >> 16 == 5770U || bp->common.chip_id >> 16 == 5797U) || bp->common.chip_id >> 16 == 5801U) || bp->common.chip_id >> 16 == 5774U) || bp->common.chip_id >> 16 == 5806U) || bp->common.chip_id >> 16 == 5807U) || ((bp->common.chip_id >> 16 == 5693U || bp->common.chip_id >> 16 == 5694U) || bp->common.chip_id >> 16 == 5695U)) || ((bp->common.chip_id >> 16 == 5793U || bp->common.chip_id >> 16 == 5794U) || bp->common.chip_id >> 16 == 5773U)) || (bp->common.chip_id >> 16 == 5796U || bp->common.chip_id >> 16 == 5803U)) || bp->common.chip_id >> 16 == 5805U) { mask = 3932160U; } else if ((unsigned int )is_10g_plus != 0U) { mask = 32768U; } else if (params->switch_cfg == 16777216U) { ser_lane = (params->lane_config & 49152U) >> 14; mask = (u32 )((1 << (int )ser_lane) << 18); } else { mask = 512U; } tmp = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp != 0L) { printk("\rbnx2x: [%s:%d(%s)]Ack link up interrupt with mask 0x%x\n", "bnx2x_link_int_ack", 6176, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", mask); } else { } bnx2x_bits_en(bp, (u32 )(((int )port + 16586) * 4), mask); } else { } return; } } static int bnx2x_format_ver(u32 num , u8 *str , u16 *len ) { u8 *str_ptr ; u32 mask ; u8 shift ; u8 digit ; u8 remove_leading_zeros ; { str_ptr = str; mask = 4026531840U; shift = 32U; remove_leading_zeros = 1U; if ((unsigned int )*len <= 9U) { *str_ptr = 0U; *len = (u16 )((int )*len - 1); return (-22); } else { } goto ldv_46480; ldv_46481: shift = (unsigned int )shift + 252U; digit = (u8 )((num & mask) >> (int )shift); if ((unsigned int )digit == 0U && (unsigned int )remove_leading_zeros != 0U) { mask = mask >> 4; goto ldv_46480; } else if ((unsigned int )digit <= 9U) { *str_ptr = (unsigned int )digit + 48U; } else { *str_ptr = (unsigned int )digit + 87U; } remove_leading_zeros = 0U; str_ptr = str_ptr + 1; *len = (u16 )((int )*len - 1); mask = mask >> 4; if ((unsigned int )shift == 16U) { *str_ptr = 46U; str_ptr = str_ptr + 1; *len = (u16 )((int )*len - 1); remove_leading_zeros = 1U; } else { } ldv_46480: ; if ((unsigned int )shift != 0U) { goto ldv_46481; } else { } return (0); } } static int bnx2x_null_format_ver(u32 spirom_ver , u8 *str , u16 *len ) { { *str = 0U; *len = (u16 )((int )*len - 1); return (0); } } int bnx2x_get_ext_phy_fw_version(struct link_params *params , u8 *version___0 , u16 len ) { struct bnx2x *bp ; u32 spirom_ver ; int status ; u8 *ver_p ; u16 remain_len ; u8 tmp ; u8 tmp___0 ; { spirom_ver = 0U; status = 0; ver_p = version___0; remain_len = len; if ((unsigned long )version___0 == (unsigned long )((u8 *)0) || (unsigned long )params == (unsigned long )((struct link_params *)0)) { return (-22); } else { } bp = params->bp; *version___0 = 0U; spirom_ver = readl((void const volatile *)bp->regview + (unsigned long )params->phy[1].ver_addr); if ((unsigned long )params->phy[1].format_fw_ver != (unsigned long )((u8 (*)(u32 , u8 * , u16 * ))0)) { tmp = (*(params->phy[1].format_fw_ver))(spirom_ver, ver_p, & remain_len); status = (int )tmp | status; ver_p = ver_p + (unsigned long )((int )len - (int )remain_len); } else { } if ((unsigned int )params->num_phys == 3U && params->phy[2].ver_addr != 0U) { spirom_ver = readl((void const volatile *)bp->regview + (unsigned long )params->phy[2].ver_addr); if ((unsigned long )params->phy[2].format_fw_ver != (unsigned long )((u8 (*)(u32 , u8 * , u16 * ))0)) { *ver_p = 47U; ver_p = ver_p + 1; remain_len = (u16 )((int )remain_len - 1); tmp___0 = (*(params->phy[2].format_fw_ver))(spirom_ver, ver_p, & remain_len); status = (int )tmp___0 | status; ver_p = version___0 + (unsigned long )((int )len - (int )remain_len); } else { } } else { } *ver_p = 0U; return (status); } } static void bnx2x_set_xgxs_loopback(struct bnx2x_phy *phy , struct link_params *params ) { u8 port ; struct bnx2x *bp ; u32 md_devad ; long tmp ; u16 mii_ctrl ; long tmp___0 ; { port = params->port; bp = params->bp; if ((unsigned int )phy->req_line_speed != 1000U) { md_devad = 0U; tmp = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp != 0L) { printk("\rbnx2x: [%s:%d(%s)]XGXS 10G loopback enable\n", "bnx2x_set_xgxs_loopback", 6278, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } if (((((((((bp->common.chip_id >> 16 != 5770U && bp->common.chip_id >> 16 != 5797U) && bp->common.chip_id >> 16 != 5801U) && bp->common.chip_id >> 16 != 5774U) && bp->common.chip_id >> 16 != 5806U) && bp->common.chip_id >> 16 != 5807U) && ((bp->common.chip_id >> 16 != 5693U && bp->common.chip_id >> 16 != 5694U) && bp->common.chip_id >> 16 != 5695U)) && ((bp->common.chip_id >> 16 != 5793U && bp->common.chip_id >> 16 != 5794U) && bp->common.chip_id >> 16 != 5773U)) && (bp->common.chip_id >> 16 != 5796U && bp->common.chip_id >> 16 != 5803U)) && bp->common.chip_id >> 16 != 5805U) { md_devad = readl((void const volatile *)bp->regview + (unsigned long )((int )port * 24 + 66364)); writel(5U, (void volatile *)bp->regview + (unsigned long )((int )port * 24 + 66364)); } else { } bnx2x_cl45_write(bp, phy, 5, 65502, 10240); bnx2x_cl45_write(bp, phy, 5, 0, 24641); msleep(200U); bnx2x_set_aer_mmd(params, phy); if (((((((((bp->common.chip_id >> 16 != 5770U && bp->common.chip_id >> 16 != 5797U) && bp->common.chip_id >> 16 != 5801U) && bp->common.chip_id >> 16 != 5774U) && bp->common.chip_id >> 16 != 5806U) && bp->common.chip_id >> 16 != 5807U) && ((bp->common.chip_id >> 16 != 5693U && bp->common.chip_id >> 16 != 5694U) && bp->common.chip_id >> 16 != 5695U)) && ((bp->common.chip_id >> 16 != 5793U && bp->common.chip_id >> 16 != 5794U) && bp->common.chip_id >> 16 != 5773U)) && (bp->common.chip_id >> 16 != 5796U && bp->common.chip_id >> 16 != 5803U)) && bp->common.chip_id >> 16 != 5805U) { writel(md_devad, (void volatile *)bp->regview + (unsigned long )((int )port * 24 + 66364)); } else { } } else { tmp___0 = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp___0 != 0L) { printk("\rbnx2x: [%s:%d(%s)]XGXS 1G loopback enable\n", "bnx2x_set_xgxs_loopback", 6311, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } bnx2x_cl45_read(bp, phy, 5, 65504, & mii_ctrl); bnx2x_cl45_write(bp, phy, 5, 65504, (int )((unsigned int )mii_ctrl | 16384U)); } return; } } int bnx2x_set_led(struct link_params *params , struct link_vars *vars , u8 mode , u32 speed ) { u8 port ; u16 hw_led_mode ; int rc ; u8 phy_idx ; u32 tmp ; u32 emac_base ; struct bnx2x *bp ; long tmp___0 ; long tmp___1 ; long tmp___2 ; { port = params->port; hw_led_mode = params->hw_led_mode; rc = 0; emac_base = (unsigned int )port != 0U ? 33792U : 32768U; bp = params->bp; tmp___0 = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp___0 != 0L) { printk("\rbnx2x: [%s:%d(%s)]bnx2x_set_led: port %x, mode %d\n", "bnx2x_set_led", 6334, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )port, (int )mode); } else { } tmp___1 = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp___1 != 0L) { printk("\rbnx2x: [%s:%d(%s)]speed 0x%x, hw_led_mode 0x%x\n", "bnx2x_set_led", 6336, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", speed, (int )hw_led_mode); } else { } phy_idx = 1U; goto ldv_46522; ldv_46521: ; if ((unsigned long )params->phy[(int )phy_idx].set_link_led != (unsigned long )((void (*)(struct bnx2x_phy * , struct link_params * , u8 ))0)) { (*(params->phy[(int )phy_idx].set_link_led))((struct bnx2x_phy *)(& params->phy) + (unsigned long )phy_idx, params, (int )mode); } else { } phy_idx = (u8 )((int )phy_idx + 1); ldv_46522: ; if ((unsigned int )phy_idx <= 2U) { goto ldv_46521; } else { } switch ((int )mode) { case 3: ; case 0: writel(0U, (void volatile *)bp->regview + (unsigned long )(((int )port + 16584) * 4)); writel(0U, (void volatile *)bp->regview + (unsigned long )(((int )port + 16572) * 4)); tmp = readl((void const volatile *)bp->regview + (unsigned long )(emac_base + 12U)); if (params->phy[1].type == 3584U) { tmp = tmp & 4294967281U; } else { tmp = tmp | 1U; } writel(tmp, (void volatile *)bp->regview + (unsigned long )(emac_base + 12U)); goto ldv_46526; case 2: ; if ((unsigned int )vars->link_up == 0U) { goto ldv_46526; } else { } case 1: ; if (((params->phy[1].type == 2304U || params->phy[1].type == 3840U) && ((bp->common.chip_id >> 16 == 5730U || bp->common.chip_id >> 16 == 5731U) || bp->common.chip_id >> 16 == 5743U)) && (unsigned int )params->num_phys == 2U) { if ((unsigned int )mode == 1U || speed == 10000U) { writel(0U, (void volatile *)bp->regview + (unsigned long )(((int )port + 16572) * 4)); writel(1U, (void volatile *)bp->regview + (unsigned long )(((int )port + 16584) * 4)); tmp = readl((void const volatile *)bp->regview + (unsigned long )(emac_base + 12U)); writel(tmp | 1U, (void volatile *)bp->regview + (unsigned long )(emac_base + 12U)); if ((unsigned int )mode == 1U) { return (rc); } else { } } else { } } else if ((unsigned int )params->num_phys == 1U) { if ((((((((((bp->common.chip_id >> 16 != 5770U && bp->common.chip_id >> 16 != 5797U) && bp->common.chip_id >> 16 != 5801U) && bp->common.chip_id >> 16 != 5774U) && bp->common.chip_id >> 16 != 5806U) && bp->common.chip_id >> 16 != 5807U) && ((bp->common.chip_id >> 16 != 5693U && bp->common.chip_id >> 16 != 5694U) && bp->common.chip_id >> 16 != 5695U)) && ((bp->common.chip_id >> 16 != 5793U && bp->common.chip_id >> 16 != 5794U) && bp->common.chip_id >> 16 != 5773U)) && (bp->common.chip_id >> 16 != 5796U && bp->common.chip_id >> 16 != 5803U)) && bp->common.chip_id >> 16 != 5805U) || ((((((((((bp->common.chip_id >> 16 == 5770U || bp->common.chip_id >> 16 == 5797U) || bp->common.chip_id >> 16 == 5801U) || bp->common.chip_id >> 16 == 5774U) || bp->common.chip_id >> 16 == 5806U) || bp->common.chip_id >> 16 == 5807U) || ((bp->common.chip_id >> 16 == 5693U || bp->common.chip_id >> 16 == 5694U) || bp->common.chip_id >> 16 == 5695U)) || ((bp->common.chip_id >> 16 == 5793U || bp->common.chip_id >> 16 == 5794U) || bp->common.chip_id >> 16 == 5773U)) || (bp->common.chip_id >> 16 == 5796U || bp->common.chip_id >> 16 == 5803U)) || bp->common.chip_id >> 16 == 5805U) && (unsigned int )mode == 1U)) { writel(1U, (void volatile *)bp->regview + (unsigned long )(((int )port + 16584) * 4)); } else { } if (((bp->common.chip_id >> 16 == 5710U || (bp->common.chip_id >> 16 == 5711U || bp->common.chip_id >> 16 == 5712U)) || ((bp->common.chip_id >> 16 == 5730U || bp->common.chip_id >> 16 == 5731U) || bp->common.chip_id >> 16 == 5743U)) || (unsigned int )mode == 1U) { writel(0U, (void volatile *)bp->regview + (unsigned long )(((int )port + 16572) * 4)); } else { writel((unsigned int )hw_led_mode, (void volatile *)bp->regview + (unsigned long )(((int )port + 16572) * 4)); } } else if (params->phy[1].type == 3584U && (unsigned int )mode == 1U) { writel(0U, (void volatile *)bp->regview + (unsigned long )(((int )port + 16572) * 4)); tmp = readl((void const volatile *)bp->regview + (unsigned long )(emac_base + 12U)); writel(tmp | 3U, (void volatile *)bp->regview + (unsigned long )(emac_base + 12U)); goto ldv_46526; } else { writel((unsigned int )hw_led_mode, (void volatile *)bp->regview + (unsigned long )(((int )port + 16572) * 4)); } writel(0U, (void volatile *)bp->regview + (unsigned long )(((int )port + 16574) * 4)); if (((((((((bp->common.chip_id >> 16 == 5770U || bp->common.chip_id >> 16 == 5797U) || bp->common.chip_id >> 16 == 5801U) || bp->common.chip_id >> 16 == 5774U) || bp->common.chip_id >> 16 == 5806U) || bp->common.chip_id >> 16 == 5807U) || ((bp->common.chip_id >> 16 == 5693U || bp->common.chip_id >> 16 == 5694U) || bp->common.chip_id >> 16 == 5695U)) || ((bp->common.chip_id >> 16 == 5793U || bp->common.chip_id >> 16 == 5794U) || bp->common.chip_id >> 16 == 5773U)) || (bp->common.chip_id >> 16 == 5796U || bp->common.chip_id >> 16 == 5803U)) || bp->common.chip_id >> 16 == 5805U) { writel(354U, (void volatile *)bp->regview + (unsigned long )(((int )port + 16580) * 4)); } else { writel(480U, (void volatile *)bp->regview + (unsigned long )(((int )port + 16580) * 4)); } writel(1U, (void volatile *)bp->regview + (unsigned long )(((int )port + 16582) * 4)); tmp = readl((void const volatile *)bp->regview + (unsigned long )(emac_base + 12U)); writel(tmp & 4294967294U, (void volatile *)bp->regview + (unsigned long )(emac_base + 12U)); if (bp->common.chip_id >> 16 == 5710U && (((speed == 2500U || speed == 1000U) || speed == 100U) || speed == 10U)) { writel(1U, (void volatile *)bp->regview + (unsigned long )(((int )port + 16574) * 4)); writel(0U, (void volatile *)bp->regview + (unsigned long )(((int )port + 16576) * 4)); writel(1U, (void volatile *)bp->regview + (unsigned long )(((int )port + 16578) * 4)); } else { } goto ldv_46526; default: rc = -22; tmp___2 = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp___2 != 0L) { printk("\rbnx2x: [%s:%d(%s)]bnx2x_set_led: Invalid led mode %d\n", "bnx2x_set_led", 6456, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )mode); } else { } goto ldv_46526; } ldv_46526: ; return (rc); } } int bnx2x_test_link(struct link_params *params , struct link_vars *vars , u8 is_serdes ) { struct bnx2x *bp ; u16 gp_status ; u16 phy_index ; u8 ext_phy_link_up ; u8 serdes_phy_type ; struct link_vars temp_vars ; struct bnx2x_phy *int_phy ; u16 link_up ; u8 lane ; u8 tmp ; u8 tmp___0 ; { bp = params->bp; gp_status = 0U; phy_index = 0U; ext_phy_link_up = 0U; int_phy = (struct bnx2x_phy *)(& params->phy); if (((((((((bp->common.chip_id >> 16 == 5770U || bp->common.chip_id >> 16 == 5797U) || bp->common.chip_id >> 16 == 5801U) || bp->common.chip_id >> 16 == 5774U) || bp->common.chip_id >> 16 == 5806U) || bp->common.chip_id >> 16 == 5807U) || ((bp->common.chip_id >> 16 == 5693U || bp->common.chip_id >> 16 == 5694U) || bp->common.chip_id >> 16 == 5695U)) || ((bp->common.chip_id >> 16 == 5793U || bp->common.chip_id >> 16 == 5794U) || bp->common.chip_id >> 16 == 5773U)) || (bp->common.chip_id >> 16 == 5796U || bp->common.chip_id >> 16 == 5803U)) || bp->common.chip_id >> 16 == 5805U) { if ((unsigned int )params->req_line_speed[0] > 10000U) { bnx2x_cl45_read(bp, int_phy, 3, 1, & link_up); bnx2x_cl45_read(bp, int_phy, 3, 1, & link_up); link_up = (unsigned int )link_up & 4U; } else { tmp = bnx2x_get_warpcore_lane(int_phy, params); lane = tmp; bnx2x_cl45_read(bp, int_phy, 3, 33233, & gp_status); gp_status = (unsigned int )((u16 )(((int )gp_status >> 8) | ((int )gp_status >> 12))) & 15U; link_up = (u16 )((int )((short )(1 << (int )lane)) & (int )((short )gp_status)); } if ((unsigned int )link_up == 0U) { return (-3); } else { } } else { bnx2x_cl45_read(bp, int_phy, (int )int_phy->def_md_devad, 33067, & gp_status); if (((int )gp_status & 4) == 0) { return (-3); } else { } } if ((unsigned int )params->loopback_mode == 3U) { return (0); } else { } switch ((int )params->num_phys) { case 1: ; return (0); case 2: ext_phy_link_up = (*(params->phy[1].read_status))((struct bnx2x_phy *)(& params->phy) + 1UL, params, & temp_vars); goto ldv_46546; case 3: phy_index = 1U; goto ldv_46550; ldv_46549: serdes_phy_type = (u8 )(((params->phy[(int )phy_index].media_type == 1U || params->phy[(int )phy_index].media_type == 5U) || params->phy[(int )phy_index].media_type == 2U) || params->phy[(int )phy_index].media_type == 3U); if ((int )is_serdes != (int )serdes_phy_type) { goto ldv_46548; } else { } if ((unsigned long )params->phy[(int )phy_index].read_status != (unsigned long )((u8 (*)(struct bnx2x_phy * , struct link_params * , struct link_vars * ))0)) { tmp___0 = (*(params->phy[(int )phy_index].read_status))((struct bnx2x_phy *)(& params->phy) + (unsigned long )phy_index, params, & temp_vars); ext_phy_link_up = (u8 )((int )tmp___0 | (int )ext_phy_link_up); } else { } ldv_46548: phy_index = (u16 )((int )phy_index + 1); ldv_46550: ; if ((int )((unsigned short )params->num_phys) > (int )phy_index) { goto ldv_46549; } else { } goto ldv_46546; } ldv_46546: ; if ((unsigned int )ext_phy_link_up != 0U) { return (0); } else { } return (-3); } } static int bnx2x_link_initialize(struct link_params *params , struct link_vars *vars ) { int rc ; u8 phy_index ; u8 non_ext_phy ; struct bnx2x *bp ; struct bnx2x_phy *phy ; long tmp ; u32 tmp___0 ; { rc = 0; bp = params->bp; vars->line_speed = params->phy[0].req_line_speed; if (((((((((bp->common.chip_id >> 16 != 5770U && bp->common.chip_id >> 16 != 5797U) && bp->common.chip_id >> 16 != 5801U) && bp->common.chip_id >> 16 != 5774U) && bp->common.chip_id >> 16 != 5806U) && bp->common.chip_id >> 16 != 5807U) && ((bp->common.chip_id >> 16 != 5693U && bp->common.chip_id >> 16 != 5694U) && bp->common.chip_id >> 16 != 5695U)) && ((bp->common.chip_id >> 16 != 5793U && bp->common.chip_id >> 16 != 5794U) && bp->common.chip_id >> 16 != 5773U)) && (bp->common.chip_id >> 16 != 5796U && bp->common.chip_id >> 16 != 5803U)) && bp->common.chip_id >> 16 != 5805U) { bnx2x_prepare_xgxs((struct bnx2x_phy *)(& params->phy), params, vars); } else { } non_ext_phy = (u8 )((unsigned int )params->num_phys == 1U || (unsigned int )params->loopback_mode == 3U); if (((unsigned int )non_ext_phy != 0U || ((int )params->phy[1].flags & 8) != 0) || (unsigned int )params->loopback_mode == 4U) { phy = (struct bnx2x_phy *)(& params->phy); if ((unsigned int )vars->line_speed == 0U && ((bp->common.chip_id >> 16 == 5710U || (bp->common.chip_id >> 16 == 5711U || bp->common.chip_id >> 16 == 5712U)) || ((bp->common.chip_id >> 16 == 5730U || bp->common.chip_id >> 16 == 5731U) || bp->common.chip_id >> 16 == 5743U))) { bnx2x_set_parallel_detection(phy, params); } else { } if ((unsigned long )params->phy[0].config_init != (unsigned long )((u8 (*)(struct bnx2x_phy * , struct link_params * , struct link_vars * ))0)) { (*(params->phy[0].config_init))(phy, params, vars); } else { } } else { } if ((unsigned int )non_ext_phy != 0U) { if ((params->phy[0].supported & 1024U) != 0U) { vars->link_status = vars->link_status | 1048576U; } else { } } else { phy_index = 1U; goto ldv_46564; ldv_46563: ; if ((params->phy[(int )phy_index].supported & 1024U) != 0U) { vars->link_status = vars->link_status | 1048576U; } else { } if ((unsigned int )phy_index == 2U) { tmp___0 = bnx2x_phy_selection(params); if (tmp___0 == 1U) { tmp = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp != 0L) { printk("\rbnx2x: [%s:%d(%s)]Not initializing second phy\n", "bnx2x_link_initialize", 6605, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } goto ldv_46562; } else { } } else { } (*(params->phy[(int )phy_index].config_init))((struct bnx2x_phy *)(& params->phy) + (unsigned long )phy_index, params, vars); ldv_46562: phy_index = (u8 )((int )phy_index + 1); ldv_46564: ; if ((int )params->num_phys > (int )phy_index) { goto ldv_46563; } else { } } bnx2x_bits_dis(bp, (u32 )(((int )params->port + 16586) * 4), 3965441U); return (rc); } } static void bnx2x_int_link_reset(struct bnx2x_phy *phy , struct link_params *params ) { { writel((unsigned int )(511 << (int )params->port * 16), (void volatile *)(params->bp)->regview + 42408U); return; } } static void bnx2x_common_ext_link_reset(struct bnx2x_phy *phy , struct link_params *params ) { struct bnx2x *bp ; u8 gpio_port ; long tmp ; { bp = params->bp; if ((bp->common.chip_id >> 16 == 5730U || bp->common.chip_id >> 16 == 5731U) || bp->common.chip_id >> 16 == 5743U) { gpio_port = bp->common.chip_id >> 16 != 5710U && (bp->common.chip_id >> 16 != 5711U && bp->common.chip_id >> 16 != 5712U) ? (unsigned int )bp->pf_num & 1U : 0U; } else { gpio_port = params->port; } bnx2x_set_gpio(bp, 1, 0U, (int )gpio_port); bnx2x_set_gpio(bp, 2, 0U, (int )gpio_port); tmp = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp != 0L) { printk("\rbnx2x: [%s:%d(%s)]reset external PHY\n", "bnx2x_common_ext_link_reset", 6647, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } return; } } static int bnx2x_update_link_down(struct link_params *params , struct link_vars *vars ) { struct bnx2x *bp ; u8 port ; long tmp ; { bp = params->bp; port = params->port; tmp = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp != 0L) { printk("\rbnx2x: [%s:%d(%s)]Port %x: Link is down\n", "bnx2x_update_link_down", 6656, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )port); } else { } bnx2x_set_led(params, vars, 0, 0U); vars->phy_flags = (unsigned int )vars->phy_flags & 251U; vars->mac_type = 0U; vars->link_status = vars->link_status & 3220242208U; vars->line_speed = 0U; bnx2x_update_mng(params, vars->link_status); writel(1U, (void volatile *)bp->regview + (unsigned long )(((int )port + 16408) * 4)); if (((((((((bp->common.chip_id >> 16 != 5770U && bp->common.chip_id >> 16 != 5797U) && bp->common.chip_id >> 16 != 5801U) && bp->common.chip_id >> 16 != 5774U) && bp->common.chip_id >> 16 != 5806U) && bp->common.chip_id >> 16 != 5807U) && ((bp->common.chip_id >> 16 != 5693U && bp->common.chip_id >> 16 != 5694U) && bp->common.chip_id >> 16 != 5695U)) && ((bp->common.chip_id >> 16 != 5793U && bp->common.chip_id >> 16 != 5794U) && bp->common.chip_id >> 16 != 5773U)) && (bp->common.chip_id >> 16 != 5796U && bp->common.chip_id >> 16 != 5803U)) && bp->common.chip_id >> 16 != 5805U) { writel(0U, (void volatile *)bp->regview + (unsigned long )(((int )port + 16399) * 4)); } else { } usleep_range(10000UL, 20000UL); if ((bp->common.chip_id >> 16 == 5710U || (bp->common.chip_id >> 16 == 5711U || bp->common.chip_id >> 16 == 5712U)) || ((bp->common.chip_id >> 16 == 5730U || bp->common.chip_id >> 16 == 5731U) || bp->common.chip_id >> 16 == 5743U)) { bnx2x_set_bmac_rx(bp, params->chip_id, (int )params->port, 0); } else { } if (((((((((bp->common.chip_id >> 16 == 5770U || bp->common.chip_id >> 16 == 5797U) || bp->common.chip_id >> 16 == 5801U) || bp->common.chip_id >> 16 == 5774U) || bp->common.chip_id >> 16 == 5806U) || bp->common.chip_id >> 16 == 5807U) || ((bp->common.chip_id >> 16 == 5693U || bp->common.chip_id >> 16 == 5694U) || bp->common.chip_id >> 16 == 5695U)) || ((bp->common.chip_id >> 16 == 5793U || bp->common.chip_id >> 16 == 5794U) || bp->common.chip_id >> 16 == 5773U)) || (bp->common.chip_id >> 16 == 5796U || bp->common.chip_id >> 16 == 5803U)) || bp->common.chip_id >> 16 == 5805U) { writel(0U, (void volatile *)bp->regview + (unsigned long )(((int )params->port << 2) + 43084)); writel(0U, (void volatile *)bp->regview + (unsigned long )(((int )params->port << 2) + 43136)); vars->eee_status = vars->eee_status & 2969567231U; bnx2x_update_mng_eee(params, vars->eee_status); bnx2x_set_xmac_rxtx(params, 0); bnx2x_set_umac_rxtx(params, 0); } else { } return (0); } } static int bnx2x_update_link_up(struct link_params *params , struct link_vars *vars , u8 link_10g ) { struct bnx2x *bp ; u8 phy_idx ; u8 port ; int rc ; long tmp ; int tmp___0 ; long tmp___1 ; long tmp___2 ; int tmp___3 ; int tmp___4 ; { bp = params->bp; port = params->port; rc = 0; vars->link_status = vars->link_status | 1073741825U; vars->phy_flags = (u8 )((unsigned int )vars->phy_flags | 4U); if (((int )vars->flow_ctrl & 256) != 0) { vars->link_status = vars->link_status | 65536U; } else { } if (((int )vars->flow_ctrl & 512) != 0) { vars->link_status = vars->link_status | 131072U; } else { } if (((((((((bp->common.chip_id >> 16 == 5770U || bp->common.chip_id >> 16 == 5797U) || bp->common.chip_id >> 16 == 5801U) || bp->common.chip_id >> 16 == 5774U) || bp->common.chip_id >> 16 == 5806U) || bp->common.chip_id >> 16 == 5807U) || ((bp->common.chip_id >> 16 == 5693U || bp->common.chip_id >> 16 == 5694U) || bp->common.chip_id >> 16 == 5695U)) || ((bp->common.chip_id >> 16 == 5793U || bp->common.chip_id >> 16 == 5794U) || bp->common.chip_id >> 16 == 5773U)) || (bp->common.chip_id >> 16 == 5796U || bp->common.chip_id >> 16 == 5803U)) || bp->common.chip_id >> 16 == 5805U) { if ((unsigned int )link_10g != 0U) { tmp___0 = bnx2x_xmac_enable(params, vars, 0); if (tmp___0 == -3) { tmp = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp != 0L) { printk("\rbnx2x: [%s:%d(%s)]Found errors on XMAC\n", "bnx2x_update_link_up", 6720, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } vars->link_up = 0U; vars->phy_flags = (u8 )((unsigned int )vars->phy_flags | 8U); vars->link_status = vars->link_status & 4294967294U; } else { } } else { bnx2x_umac_enable(params, vars, 0); } bnx2x_set_led(params, vars, 2, (u32 )vars->line_speed); if ((vars->eee_status & 1073741824U) != 0U && (vars->eee_status & 536870912U) != 0U) { tmp___1 = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp___1 != 0L) { printk("\rbnx2x: [%s:%d(%s)]Enabling LPI assertion\n", "bnx2x_update_link_up", 6732, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } writel(1U, (void volatile *)bp->regview + (unsigned long )(((int )params->port << 2) + 43084)); writel(1U, (void volatile *)bp->regview + 43096U); writel(64544U, (void volatile *)bp->regview + (unsigned long )(((int )params->port << 2) + 43136)); } else { } } else { } if ((bp->common.chip_id >> 16 == 5710U || (bp->common.chip_id >> 16 == 5711U || bp->common.chip_id >> 16 == 5712U)) || ((bp->common.chip_id >> 16 == 5730U || bp->common.chip_id >> 16 == 5731U) || bp->common.chip_id >> 16 == 5743U)) { if ((unsigned int )link_10g != 0U) { tmp___3 = bnx2x_bmac_enable(params, vars, 0, 1); if (tmp___3 == -3) { tmp___2 = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp___2 != 0L) { printk("\rbnx2x: [%s:%d(%s)]Found errors on BMAC\n", "bnx2x_update_link_up", 6745, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } vars->link_up = 0U; vars->phy_flags = (u8 )((unsigned int )vars->phy_flags | 8U); vars->link_status = vars->link_status & 4294967294U; } else { } bnx2x_set_led(params, vars, 2, 10000U); } else { rc = bnx2x_emac_program(params, vars); bnx2x_emac_enable(params, vars, 0); if (((vars->link_status & 64U) != 0U && ((int )vars->phy_flags & 2) == 0) && (unsigned int )params->num_phys == 1U) { bnx2x_set_gmii_tx_driver(params); } else { } } } else { } if (bp->common.chip_id >> 16 == 5710U || (bp->common.chip_id >> 16 == 5711U || bp->common.chip_id >> 16 == 5712U)) { tmp___4 = bnx2x_pbf_update(params, (u32 )vars->flow_ctrl, (u32 )vars->line_speed); rc = tmp___4 | rc; } else { } writel(0U, (void volatile *)bp->regview + (unsigned long )(((int )port + 16408) * 4)); bnx2x_update_mng(params, vars->link_status); bnx2x_update_mng_eee(params, vars->eee_status); phy_idx = 0U; goto ldv_46596; ldv_46595: ; if (((int )params->phy[(int )phy_idx].flags & 4096) != 0) { bnx2x_check_half_open_conn(params, vars, 0); goto ldv_46594; } else { } phy_idx = (u8 )((int )phy_idx + 1); ldv_46596: ; if ((unsigned int )phy_idx <= 2U) { goto ldv_46595; } else { } ldv_46594: msleep(20U); return (rc); } } int bnx2x_link_update(struct link_params *params , struct link_vars *vars ) { struct bnx2x *bp ; struct link_vars phy_vars[3U] ; u8 port ; u8 link_10g_plus ; u8 phy_index ; u8 ext_phy_link_up ; u8 cur_link_up ; int rc ; u8 is_mi_int ; u16 ext_phy_line_speed ; u16 prev_line_speed ; u8 active_external_phy ; unsigned int tmp ; long tmp___0 ; unsigned int tmp___1 ; unsigned int tmp___2 ; unsigned int tmp___3 ; long tmp___4 ; unsigned int tmp___5 ; unsigned int tmp___6 ; long tmp___7 ; struct bnx2x_phy *phy ; long tmp___8 ; long tmp___9 ; u32 tmp___10 ; long tmp___11 ; long tmp___12 ; long tmp___13 ; long tmp___14 ; long tmp___15 ; long tmp___16 ; { bp = params->bp; port = params->port; ext_phy_link_up = 0U; rc = 0; is_mi_int = 0U; ext_phy_line_speed = 0U; prev_line_speed = vars->line_speed; active_external_phy = 0U; vars->phy_flags = (unsigned int )vars->phy_flags & 247U; vars->link_status = vars->link_status & 3220242208U; phy_index = 0U; goto ldv_46614; ldv_46613: phy_vars[(int )phy_index].flow_ctrl = 0U; phy_vars[(int )phy_index].link_status = 0U; phy_vars[(int )phy_index].line_speed = 0U; phy_vars[(int )phy_index].duplex = 1U; phy_vars[(int )phy_index].phy_link_up = 0U; phy_vars[(int )phy_index].link_up = 0U; phy_vars[(int )phy_index].fault_detected = 0U; phy_vars[(int )phy_index].eee_status = vars->eee_status; phy_index = (u8 )((int )phy_index + 1); ldv_46614: ; if ((int )params->num_phys > (int )phy_index) { goto ldv_46613; } else { } if (((((((((bp->common.chip_id >> 16 == 5770U || bp->common.chip_id >> 16 == 5797U) || bp->common.chip_id >> 16 == 5801U) || bp->common.chip_id >> 16 == 5774U) || bp->common.chip_id >> 16 == 5806U) || bp->common.chip_id >> 16 == 5807U) || ((bp->common.chip_id >> 16 == 5693U || bp->common.chip_id >> 16 == 5694U) || bp->common.chip_id >> 16 == 5695U)) || ((bp->common.chip_id >> 16 == 5793U || bp->common.chip_id >> 16 == 5794U) || bp->common.chip_id >> 16 == 5773U)) || (bp->common.chip_id >> 16 == 5796U || bp->common.chip_id >> 16 == 5803U)) || bp->common.chip_id >> 16 == 5805U) { bnx2x_set_aer_mmd(params, (struct bnx2x_phy *)(& params->phy)); } else { } tmp___0 = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp___0 != 0L) { tmp = readl((void const volatile *)bp->regview + (unsigned long )(((int )port + 16586) * 4)); printk("\rbnx2x: [%s:%d(%s)]port %x, XGXS?%x, int_status 0x%x\n", "bnx2x_link_update", 6830, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )port, (int )vars->phy_flags & 1, tmp); } else { } tmp___1 = readl((void const volatile *)bp->regview + (unsigned long )((int )port * 24 + 66708)); is_mi_int = tmp___1 != 0U; tmp___4 = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp___4 != 0L) { tmp___2 = readl((void const volatile *)bp->regview + (unsigned long )((int )port * 60 + 66936)); tmp___3 = readl((void const volatile *)bp->regview + (unsigned long )(((int )port + 16588) * 4)); printk("\rbnx2x: [%s:%d(%s)]int_mask 0x%x MI_INT %x, SERDES_LINK %x\n", "bnx2x_link_update", 6837, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", tmp___3, (int )is_mi_int, tmp___2); } else { } tmp___7 = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp___7 != 0L) { tmp___5 = readl((void const volatile *)bp->regview + (unsigned long )((int )port * 104 + 67204)); tmp___6 = readl((void const volatile *)bp->regview + (unsigned long )((int )port * 104 + 67200)); printk("\rbnx2x: [%s:%d(%s)] 10G %x, XGXS_LINK %x\n", "bnx2x_link_update", 6841, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", tmp___6, tmp___5); } else { } if (((((((((bp->common.chip_id >> 16 != 5770U && bp->common.chip_id >> 16 != 5797U) && bp->common.chip_id >> 16 != 5801U) && bp->common.chip_id >> 16 != 5774U) && bp->common.chip_id >> 16 != 5806U) && bp->common.chip_id >> 16 != 5807U) && ((bp->common.chip_id >> 16 != 5693U && bp->common.chip_id >> 16 != 5694U) && bp->common.chip_id >> 16 != 5695U)) && ((bp->common.chip_id >> 16 != 5793U && bp->common.chip_id >> 16 != 5794U) && bp->common.chip_id >> 16 != 5773U)) && (bp->common.chip_id >> 16 != 5796U && bp->common.chip_id >> 16 != 5803U)) && bp->common.chip_id >> 16 != 5805U) { writel(0U, (void volatile *)bp->regview + (unsigned long )(((int )port + 16399) * 4)); } else { } phy_index = 1U; goto ldv_46625; ldv_46624: phy = (struct bnx2x_phy *)(& params->phy) + (unsigned long )phy_index; if ((unsigned long )phy->read_status == (unsigned long )((u8 (*)(struct bnx2x_phy * , struct link_params * , struct link_vars * ))0)) { goto ldv_46618; } else { } cur_link_up = (*(phy->read_status))(phy, params, (struct link_vars *)(& phy_vars) + (unsigned long )phy_index); if ((unsigned int )cur_link_up != 0U) { tmp___8 = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp___8 != 0L) { printk("\rbnx2x: [%s:%d(%s)]phy in index %d link is up\n", "bnx2x_link_update", 6864, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )phy_index); } else { } } else { tmp___9 = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp___9 != 0L) { printk("\rbnx2x: [%s:%d(%s)]phy in index %d link is down\n", "bnx2x_link_update", 6867, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )phy_index); } else { } goto ldv_46618; } if ((unsigned int )ext_phy_link_up == 0U) { ext_phy_link_up = 1U; active_external_phy = phy_index; } else { tmp___10 = bnx2x_phy_selection(params); switch (tmp___10) { case 0U: ; case 3U: active_external_phy = 1U; goto ldv_46621; case 4U: active_external_phy = 2U; goto ldv_46621; default: tmp___11 = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp___11 != 0L) { printk("\rbnx2x: [%s:%d(%s)]Invalid link indicationmpc=0x%x. DISABLING LINK !!!\n", "bnx2x_link_update", 6901, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", params->multi_phy_config); } else { } ext_phy_link_up = 0U; goto ldv_46621; } ldv_46621: ; } ldv_46618: phy_index = (u8 )((int )phy_index + 1); ldv_46625: ; if ((int )params->num_phys > (int )phy_index) { goto ldv_46624; } else { } prev_line_speed = vars->line_speed; if ((unsigned long )params->phy[0].read_status != (unsigned long )((u8 (*)(struct bnx2x_phy * , struct link_params * , struct link_vars * ))0)) { (*(params->phy[0].read_status))((struct bnx2x_phy *)(& params->phy), params, vars); } else { } if ((unsigned int )active_external_phy != 0U) { vars->flow_ctrl = phy_vars[(int )active_external_phy].flow_ctrl; vars->link_status = vars->link_status | phy_vars[(int )active_external_phy].link_status; if ((unsigned int )active_external_phy == 1U) { if ((unsigned long )params->phy[2].phy_specific_func != (unsigned long )((void (*)(struct bnx2x_phy * , struct link_params * , u32 ))0)) { tmp___12 = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp___12 != 0L) { printk("\rbnx2x: [%s:%d(%s)]Disabling TX on EXT_PHY2\n", "bnx2x_link_update", 6938, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } (*(params->phy[2].phy_specific_func))((struct bnx2x_phy *)(& params->phy) + 2UL, params, 1U); } else { } } else { } ext_phy_line_speed = phy_vars[(int )active_external_phy].line_speed; vars->duplex = phy_vars[(int )active_external_phy].duplex; if ((params->phy[(int )active_external_phy].supported & 1024U) != 0U) { vars->link_status = vars->link_status | 1048576U; } else { vars->link_status = vars->link_status & 4293918719U; } vars->eee_status = phy_vars[(int )active_external_phy].eee_status; tmp___13 = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp___13 != 0L) { printk("\rbnx2x: [%s:%d(%s)]Active external phy selected: %x\n", "bnx2x_link_update", 6956, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )active_external_phy); } else { } } else { } phy_index = 1U; goto ldv_46629; ldv_46628: ; if (((int )params->phy[(int )phy_index].flags & 64) != 0) { bnx2x_rearm_latch_signal(bp, (int )port, (int )phy_index == (int )active_external_phy); goto ldv_46627; } else { } phy_index = (u8 )((int )phy_index + 1); ldv_46629: ; if ((int )params->num_phys > (int )phy_index) { goto ldv_46628; } else { } ldv_46627: tmp___14 = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp___14 != 0L) { printk("\rbnx2x: [%s:%d(%s)]vars->flow_ctrl = 0x%x, vars->link_status = 0x%x, ext_phy_line_speed = %d\n", "bnx2x_link_update", 6971, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )vars->flow_ctrl, vars->link_status, (int )ext_phy_line_speed); } else { } if ((unsigned int )vars->phy_link_up != 0U) { if (((unsigned int )params->num_phys != 1U && (unsigned int )ext_phy_link_up != 0U) && (int )vars->line_speed != (int )ext_phy_line_speed) { tmp___15 = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp___15 != 0L) { printk("\rbnx2x: [%s:%d(%s)]Internal link speed %d is different than the external link speed %d\n", "bnx2x_link_update", 6983, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )vars->line_speed, (int )ext_phy_line_speed); } else { } vars->phy_link_up = 0U; } else if ((int )vars->line_speed != (int )prev_line_speed) { writel(0U, (void volatile *)bp->regview + (unsigned long )(((int )params->port + 16408) * 4)); usleep_range(1000UL, 2000UL); } else { } } else { } link_10g_plus = (unsigned int )vars->line_speed > 9999U; bnx2x_link_int_ack(params, vars, (int )link_10g_plus); if ((unsigned int )params->num_phys != 1U) { tmp___16 = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp___16 != 0L) { printk("\rbnx2x: [%s:%d(%s)]ext_phy_link_up = %d, int_link_up = %d, init_preceding = %d\n", "bnx2x_link_update", 7009, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )ext_phy_link_up, (int )vars->phy_link_up, (int )params->phy[1].flags & 8); } else { } if ((((int )params->phy[1].flags & 8) == 0 && (unsigned int )ext_phy_link_up != 0U) && (unsigned int )vars->phy_link_up == 0U) { vars->line_speed = ext_phy_line_speed; if ((unsigned int )vars->line_speed <= 999U) { vars->phy_flags = (u8 )((unsigned int )vars->phy_flags | 2U); } else { vars->phy_flags = (unsigned int )vars->phy_flags & 253U; } if ((unsigned long )params->phy[0].config_init != (unsigned long )((u8 (*)(struct bnx2x_phy * , struct link_params * , struct link_vars * ))0)) { (*(params->phy[0].config_init))((struct bnx2x_phy *)(& params->phy), params, vars); } else { } } else { } } else { } vars->link_up = (u8 )(((unsigned int )vars->phy_link_up != 0U && ((unsigned int )ext_phy_link_up != 0U || (unsigned int )params->num_phys == 1U)) && (unsigned int )phy_vars[(int )active_external_phy].fault_detected == 0U); if ((params->feature_config_flags & 2U) != 0U) { vars->link_status = vars->link_status | 536870912U; } else { vars->link_status = vars->link_status & 3758096383U; } if ((unsigned int )vars->link_up != 0U) { rc = bnx2x_update_link_up(params, vars, (int )link_10g_plus); } else { rc = bnx2x_update_link_down(params, vars); } if ((params->feature_config_flags & 256U) != 0U) { bnx2x_fw_command(bp, 16777216U, 0U); } else { } return (rc); } } void bnx2x_ext_phy_hw_reset(struct bnx2x *bp , u8 port ) { { bnx2x_set_gpio(bp, 1, 0U, (int )port); usleep_range(1000UL, 2000UL); bnx2x_set_gpio(bp, 1, 1U, (int )port); return; } } static void bnx2x_save_spirom_version(struct bnx2x *bp , u8 port , u32 spirom_ver , u32 ver_addr ) { long tmp ; { tmp = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp != 0L) { printk("\rbnx2x: [%s:%d(%s)]FW version 0x%x:0x%x for port %d\n", "bnx2x_save_spirom_version", 7067, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )((unsigned short )(spirom_ver >> 16)), (int )((unsigned short )spirom_ver), (int )port); } else { } if (ver_addr != 0U) { writel(spirom_ver, (void volatile *)bp->regview + (unsigned long )ver_addr); } else { } return; } } static void bnx2x_save_bcm_spirom_ver(struct bnx2x *bp , struct bnx2x_phy *phy , u8 port ) { u16 fw_ver1 ; u16 fw_ver2 ; { bnx2x_cl45_read(bp, phy, 1, 51737, & fw_ver1); bnx2x_cl45_read(bp, phy, 1, 51738, & fw_ver2); bnx2x_save_spirom_version(bp, (int )port, (unsigned int )(((int )fw_ver1 << 16) | (int )fw_ver2), phy->ver_addr); return; } } static void bnx2x_ext_phy_10G_an_resolve(struct bnx2x *bp , struct bnx2x_phy *phy , struct link_vars *vars ) { u16 val ; { bnx2x_cl45_read(bp, phy, 7, 1, & val); bnx2x_cl45_read(bp, phy, 7, 1, & val); if (((int )val & 32) != 0) { vars->link_status = vars->link_status | 64U; } else { } if (((int )val & 1) == 0) { vars->link_status = vars->link_status | 128U; } else { } return; } } static void bnx2x_8073_resolve_fc(struct bnx2x_phy *phy , struct link_params *params , struct link_vars *vars ) { struct bnx2x *bp ; u16 pause_result ; u16 ld_pause ; u16 lp_pause ; long tmp ; u8 tmp___0 ; { bp = params->bp; if ((unsigned int )phy->req_line_speed == 10U || (unsigned int )phy->req_line_speed == 100U) { vars->flow_ctrl = phy->req_flow_ctrl; return; } else { } tmp___0 = bnx2x_ext_phy_resolve_fc(phy, params, vars); if ((unsigned int )tmp___0 != 0U && (unsigned int )vars->flow_ctrl == 1024U) { bnx2x_cl45_read(bp, phy, 7, 65508, & ld_pause); bnx2x_cl45_read(bp, phy, 7, 65509, & lp_pause); pause_result = (u16 )(((int )ld_pause & 384) >> 5); pause_result = (u16 )((int )((short )(((int )lp_pause & 384) >> 7)) | (int )((short )pause_result)); bnx2x_pause_resolve(vars, (u32 )pause_result); tmp = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp != 0L) { printk("\rbnx2x: [%s:%d(%s)]Ext PHY CL37 pause result 0x%x\n", "bnx2x_8073_resolve_fc", 7137, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )pause_result); } else { } } else { } return; } } static int bnx2x_8073_8727_external_rom_boot(struct bnx2x *bp , struct bnx2x_phy *phy , u8 port ) { u32 count ; u16 fw_ver1 ; u16 fw_msgout ; int rc ; long tmp ; long tmp___0 ; { count = 0U; rc = 0; bnx2x_cl45_write(bp, phy, 1, 51728, 1); bnx2x_cl45_write(bp, phy, 1, 51728, 140); bnx2x_cl45_write(bp, phy, 1, 51845, 1); bnx2x_cl45_write(bp, phy, 1, 51728, 394); bnx2x_cl45_write(bp, phy, 1, 51728, 392); msleep(100U); ldv_46675: count = count + 1U; if (count > 300U) { tmp = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp != 0L) { printk("\rbnx2x: [%s:%d(%s)]bnx2x_8073_8727_external_rom_boot port %x:Download failed. fw version = 0x%x\n", "bnx2x_8073_8727_external_rom_boot", 7187, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )port, (int )fw_ver1); } else { } rc = -22; goto ldv_46674; } else { } bnx2x_cl45_read(bp, phy, 1, 51737, & fw_ver1); bnx2x_cl45_read(bp, phy, 1, 51731, & fw_msgout); usleep_range(1000UL, 2000UL); if (((unsigned int )fw_ver1 == 0U || (unsigned int )fw_ver1 == 17185U) || (((int )fw_msgout & 255) != 3 && phy->type == 768U)) { goto ldv_46675; } else { } ldv_46674: bnx2x_cl45_write(bp, phy, 1, 51845, 0); bnx2x_save_bcm_spirom_ver(bp, phy, (int )port); tmp___0 = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp___0 != 0L) { printk("\rbnx2x: [%s:%d(%s)]bnx2x_8073_8727_external_rom_boot port %x:Download complete. fw version = 0x%x\n", "bnx2x_8073_8727_external_rom_boot", 7213, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )port, (int )fw_ver1); } else { } return (rc); } } static int bnx2x_8073_is_snr_needed(struct bnx2x *bp , struct bnx2x_phy *phy ) { u16 val ; { bnx2x_cl45_read(bp, phy, 1, 51201, & val); if ((unsigned int )val != 1U) { return (0); } else { } bnx2x_cl45_read(bp, phy, 1, 51738, & val); if ((unsigned int )val != 258U) { return (0); } else { } return (1); } } static int bnx2x_8073_xaui_wa(struct bnx2x *bp , struct bnx2x_phy *phy ) { u16 val ; u16 cnt ; u16 cnt1 ; long tmp ; long tmp___0 ; long tmp___1 ; long tmp___2 ; { bnx2x_cl45_read(bp, phy, 1, 51201, & val); if ((unsigned int )val != 0U) { return (0); } else { } cnt = 0U; goto ldv_46694; ldv_46693: bnx2x_cl45_read(bp, phy, 1, 51232, & val); if (((int )val & 16384) == 0 || ((int )val & 8192) == 0) { tmp = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp != 0L) { printk("\rbnx2x: [%s:%d(%s)]XAUI work-around not required\n", "bnx2x_8073_xaui_wa", 7275, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } return (0); } else if ((int )((short )val) >= 0) { tmp___0 = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp___0 != 0L) { printk("\rbnx2x: [%s:%d(%s)]bit 15 went off\n", "bnx2x_8073_xaui_wa", 7278, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } cnt1 = 0U; goto ldv_46690; ldv_46689: bnx2x_cl45_read(bp, phy, 1, 51265, & val); if ((int )((short )val) < 0) { tmp___1 = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp___1 != 0L) { printk("\rbnx2x: [%s:%d(%s)]XAUI workaround has completed\n", "bnx2x_8073_xaui_wa", 7290, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } return (0); } else { } usleep_range(3000UL, 6000UL); cnt1 = (u16 )((int )cnt1 + 1); ldv_46690: ; if ((unsigned int )cnt1 <= 999U) { goto ldv_46689; } else { } goto ldv_46692; } else { } usleep_range(3000UL, 6000UL); cnt = (u16 )((int )cnt + 1); ldv_46694: ; if ((unsigned int )cnt <= 999U) { goto ldv_46693; } else { } ldv_46692: tmp___2 = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp___2 != 0L) { printk("\rbnx2x: [%s:%d(%s)]Warning: XAUI work-around timeout !!!\n", "bnx2x_8073_xaui_wa", 7299, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } return (-22); } } static void bnx2x_807x_force_10G(struct bnx2x *bp , struct bnx2x_phy *phy ) { { bnx2x_cl45_write(bp, phy, 1, 0, 8256); bnx2x_cl45_write(bp, phy, 1, 7, 11); bnx2x_cl45_write(bp, phy, 1, 150, 0); bnx2x_cl45_write(bp, phy, 7, 0, 0); return; } } static void bnx2x_8073_set_pause_cl37(struct link_params *params , struct bnx2x_phy *phy , struct link_vars *vars ) { u16 cl37_val ; struct bnx2x *bp ; long tmp ; { bp = params->bp; bnx2x_cl45_read(bp, phy, 7, 65508, & cl37_val); cl37_val = (unsigned int )cl37_val & 65151U; bnx2x_calc_ieee_aneg_adv(phy, params, & vars->ieee_fc); if (((int )vars->ieee_fc & 128) != 0) { cl37_val = (u16 )((unsigned int )cl37_val | 128U); } else { } if (((int )vars->ieee_fc & 256) != 0) { cl37_val = (u16 )((unsigned int )cl37_val | 256U); } else { } if (((int )vars->ieee_fc & 384) == 384) { cl37_val = (u16 )((unsigned int )cl37_val | 384U); } else { } tmp = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp != 0L) { printk("\rbnx2x: [%s:%d(%s)]Ext phy AN advertize cl37 0x%x\n", "bnx2x_8073_set_pause_cl37", 7344, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )cl37_val); } else { } bnx2x_cl45_write(bp, phy, 7, 65508, (int )cl37_val); msleep(500U); return; } } static void bnx2x_8073_specific_func(struct bnx2x_phy *phy , struct link_params *params , u32 action ) { struct bnx2x *bp ; { bp = params->bp; switch (action) { case 3U: bnx2x_cl45_write(bp, phy, 1, 36864, 4); bnx2x_cl45_write(bp, phy, 1, 36866, 4); goto ldv_46714; } ldv_46714: ; return; } } static int bnx2x_8073_config_init(struct bnx2x_phy *phy , struct link_params *params , struct link_vars *vars ) { struct bnx2x *bp ; u16 val ; u16 tmp1 ; u8 gpio_port ; long tmp ; long tmp___0 ; long tmp___1 ; long tmp___2 ; unsigned int tmp___3 ; long tmp___4 ; long tmp___5 ; u16 phy_ver ; long tmp___6 ; long tmp___7 ; int tmp___8 ; long tmp___9 ; { bp = params->bp; val = 0U; tmp = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp != 0L) { printk("\rbnx2x: [%s:%d(%s)]Init 8073\n", "bnx2x_8073_config_init", 7374, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } if ((bp->common.chip_id >> 16 == 5730U || bp->common.chip_id >> 16 == 5731U) || bp->common.chip_id >> 16 == 5743U) { gpio_port = bp->common.chip_id >> 16 != 5710U && (bp->common.chip_id >> 16 != 5711U && bp->common.chip_id >> 16 != 5712U) ? (unsigned int )bp->pf_num & 1U : 0U; } else { gpio_port = params->port; } bnx2x_set_gpio(bp, 2, 1U, (int )gpio_port); bnx2x_set_gpio(bp, 1, 1U, (int )gpio_port); bnx2x_8073_specific_func(phy, params, 3U); bnx2x_8073_set_pause_cl37(params, phy, vars); bnx2x_cl45_read(bp, phy, 1, 51731, & tmp1); bnx2x_cl45_read(bp, phy, 1, 36867, & tmp1); tmp___0 = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp___0 != 0L) { printk("\rbnx2x: [%s:%d(%s)]Before rom RX_ALARM(port1): 0x%x\n", "bnx2x_8073_config_init", 7396, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )tmp1); } else { } if ((params->lane_config & 65536U) != 0U) { tmp___1 = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp___1 != 0L) { printk("\rbnx2x: [%s:%d(%s)]Swapping polarity for the 8073\n", "bnx2x_8073_config_init", 7401, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } bnx2x_cl45_read(bp, phy, 1, 52488, & val); bnx2x_cl45_write(bp, phy, 1, 52488, (int )((unsigned int )val | 1536U)); } else { } tmp___3 = readl((void const volatile *)(bp->regview + ((unsigned long )params->shmem_base + ((unsigned long )params->port + 1UL) * 400UL))); if ((tmp___3 & 1048576U) != 0U) { bnx2x_cl45_read(bp, phy, 7, 33616, & val); bnx2x_cl45_write(bp, phy, 7, 33616, (int )((unsigned int )val | 1U)); tmp___2 = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp___2 != 0L) { printk("\rbnx2x: [%s:%d(%s)]Enable CL37 BAM on KR\n", "bnx2x_8073_config_init", 7425, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } } else { } if ((unsigned int )params->loopback_mode == 5U) { bnx2x_807x_force_10G(bp, phy); tmp___4 = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp___4 != 0L) { printk("\rbnx2x: [%s:%d(%s)]Forced speed 10G on 807X\n", "bnx2x_8073_config_init", 7429, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } return (0); } else { bnx2x_cl45_write(bp, phy, 1, 150, 2); } if ((unsigned int )phy->req_line_speed != 0U) { if ((unsigned int )phy->req_line_speed == 10000U) { val = 128U; } else if ((unsigned int )phy->req_line_speed == 2500U) { val = 32U; } else { val = 32U; } } else { val = 0U; if ((phy->speed_cap_mask & 4194304U) != 0U) { val = (u16 )((unsigned int )val | 128U); } else { } if ((phy->speed_cap_mask & 3145728U) != 0U) { val = (u16 )((unsigned int )val | 32U); } else { } tmp___5 = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp___5 != 0L) { printk("\rbnx2x: [%s:%d(%s)]807x autoneg val = 0x%x\n", "bnx2x_8073_config_init", 7456, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )val); } else { } } bnx2x_cl45_write(bp, phy, 7, 17, (int )val); bnx2x_cl45_read(bp, phy, 7, 33577, & tmp1); if (((phy->speed_cap_mask & 2097152U) != 0U && (unsigned int )phy->req_line_speed == 0U) || (unsigned int )phy->req_line_speed == 2500U) { bnx2x_cl45_read(bp, phy, 1, 51201, & phy_ver); tmp___6 = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp___6 != 0L) { printk("\rbnx2x: [%s:%d(%s)]Add 2.5G\n", "bnx2x_8073_config_init", 7470, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } if ((unsigned int )phy_ver != 0U) { tmp1 = (u16 )((unsigned int )tmp1 | 1U); } else { tmp1 = (unsigned int )tmp1 & 65534U; } } else { tmp___7 = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp___7 != 0L) { printk("\rbnx2x: [%s:%d(%s)]Disable 2.5G\n", "bnx2x_8073_config_init", 7476, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } tmp1 = (unsigned int )tmp1 & 65534U; } bnx2x_cl45_write(bp, phy, 7, 33577, (int )tmp1); bnx2x_cl45_read(bp, phy, 7, 65508, & tmp1); bnx2x_cl45_write(bp, phy, 7, 65508, (int )((u16 )(((unsigned int )phy->req_duplex == 1U ? 32 : 64) | (int )((short )tmp1)))); bnx2x_cl45_write(bp, phy, 7, 65504, 4096); tmp___8 = bnx2x_8073_is_snr_needed(bp, phy); if (tmp___8 != 0) { bnx2x_cl45_write(bp, phy, 1, 51739, 64268); } else { } bnx2x_cl45_read(bp, phy, 7, 18, & tmp1); tmp1 = (u16 )((unsigned int )tmp1 | 32768U); bnx2x_cl45_write(bp, phy, 7, 18, (int )tmp1); bnx2x_ext_phy_set_pause(params, phy, vars); msleep(500U); bnx2x_cl45_write(bp, phy, 7, 0, 4608); tmp___9 = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp___9 != 0L) { printk("\rbnx2x: [%s:%d(%s)]807x Autoneg Restart: Advertise 1G=%x, 10G=%x\n", "bnx2x_8073_config_init", 7511, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", ((int )val & 32) > 0, ((int )val & 128) > 0); } else { } return (0); } } static u8 bnx2x_8073_read_status(struct bnx2x_phy *phy , struct link_params *params , struct link_vars *vars ) { struct bnx2x *bp ; u8 link_up ; u16 val1 ; u16 val2 ; u16 link_status ; u16 an1000_status ; long tmp ; long tmp___0 ; long tmp___1 ; long tmp___2 ; long tmp___3 ; int tmp___4 ; long tmp___5 ; int tmp___6 ; long tmp___7 ; long tmp___8 ; long tmp___9 ; long tmp___10 ; long tmp___11 ; { bp = params->bp; link_up = 0U; link_status = 0U; an1000_status = 0U; bnx2x_cl45_read(bp, phy, 1, 36869, & val1); tmp = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp != 0L) { printk("\rbnx2x: [%s:%d(%s)]8703 LASI status 0x%x\n", "bnx2x_8073_read_status", 7528, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )val1); } else { } bnx2x_cl45_read(bp, phy, 3, 32, & val2); bnx2x_cl45_read(bp, phy, 3, 32, & val1); tmp___0 = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp___0 != 0L) { printk("\rbnx2x: [%s:%d(%s)]807x PCS status 0x%x->0x%x\n", "bnx2x_8073_read_status", 7535, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )val2, (int )val1); } else { } bnx2x_cl45_read(bp, phy, 1, 51731, & val1); bnx2x_cl45_read(bp, phy, 1, 36867, & val2); tmp___1 = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp___1 != 0L) { printk("\rbnx2x: [%s:%d(%s)]KR 0x9003 0x%x\n", "bnx2x_8073_read_status", 7544, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )val2); } else { } bnx2x_cl45_read(bp, phy, 3, 32, & val2); tmp___2 = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp___2 != 0L) { printk("\rbnx2x: [%s:%d(%s)]KR PCS status 0x%x\n", "bnx2x_8073_read_status", 7549, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )val2); } else { } bnx2x_cl45_read(bp, phy, 1, 1, & val2); bnx2x_cl45_read(bp, phy, 1, 1, & val1); link_up = ((int )val1 & 4) != 0; tmp___3 = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp___3 != 0L) { printk("\rbnx2x: [%s:%d(%s)]PMA_REG_STATUS=0x%x\n", "bnx2x_8073_read_status", 7556, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )val1); } else { } if ((unsigned int )link_up != 0U && (unsigned int )phy->req_line_speed != 10000U) { tmp___4 = bnx2x_8073_xaui_wa(bp, phy); if (tmp___4 != 0) { return (0U); } else { } } else { } bnx2x_cl45_read(bp, phy, 7, 33540, & an1000_status); bnx2x_cl45_read(bp, phy, 7, 33540, & an1000_status); bnx2x_cl45_read(bp, phy, 1, 1, & val2); bnx2x_cl45_read(bp, phy, 1, 1, & val1); tmp___5 = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp___5 != 0L) { printk("\rbnx2x: [%s:%d(%s)]KR PMA status 0x%x->0x%x,an_link_status=0x%x\n", "bnx2x_8073_read_status", 7574, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )val2, (int )val1, (int )an1000_status); } else { } link_up = (u8 )(((int )val1 & 4) != 0 || ((int )an1000_status & 2) != 0); if ((unsigned int )link_up != 0U) { tmp___6 = bnx2x_8073_is_snr_needed(bp, phy); if (tmp___6 != 0) { bnx2x_cl45_write(bp, phy, 1, 51741, 9916); bnx2x_cl45_write(bp, phy, 1, 51782, 819); } else { } } else { } bnx2x_cl45_read(bp, phy, 1, 51232, & link_status); if (((int )link_status & 4) != 0 && (int )((short )link_status) >= 0) { link_up = 1U; vars->line_speed = 10000U; tmp___7 = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp___7 != 0L) { printk("\rbnx2x: [%s:%d(%s)]port %x: External link up in 10G\n", "bnx2x_8073_read_status", 7600, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )params->port); } else { } } else if (((int )link_status & 2) != 0 && ((int )link_status & 16384) == 0) { link_up = 1U; vars->line_speed = 2500U; tmp___8 = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp___8 != 0L) { printk("\rbnx2x: [%s:%d(%s)]port %x: External link up in 2.5G\n", "bnx2x_8073_read_status", 7605, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )params->port); } else { } } else if ((int )link_status & 1 && ((int )link_status & 8192) == 0) { link_up = 1U; vars->line_speed = 1000U; tmp___9 = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp___9 != 0L) { printk("\rbnx2x: [%s:%d(%s)]port %x: External link up in 1G\n", "bnx2x_8073_read_status", 7610, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )params->port); } else { } } else { link_up = 0U; tmp___10 = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp___10 != 0L) { printk("\rbnx2x: [%s:%d(%s)]port %x: External link is down\n", "bnx2x_8073_read_status", 7614, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )params->port); } else { } } if ((unsigned int )link_up != 0U) { if ((params->lane_config & 65536U) != 0U) { bnx2x_cl45_read(bp, phy, 4, 33018, & val1); if ((unsigned int )vars->line_speed == 1000U) { tmp___11 = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp___11 != 0L) { printk("\rbnx2x: [%s:%d(%s)]Swapping 1G polarity forthe 8073\n", "bnx2x_8073_read_status", 7630, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } val1 = (u16 )((unsigned int )val1 | 8U); } else { val1 = (unsigned int )val1 & 65527U; } bnx2x_cl45_write(bp, phy, 4, 33018, (int )val1); } else { } bnx2x_ext_phy_10G_an_resolve(bp, phy, vars); bnx2x_8073_resolve_fc(phy, params, vars); vars->duplex = 1U; } else { } if ((vars->link_status & 64U) != 0U) { bnx2x_cl45_read(bp, phy, 7, 20, & val1); if (((int )val1 & 32) != 0) { vars->link_status = vars->link_status | 512U; } else { } if (((int )val1 & 128) != 0) { vars->link_status = vars->link_status | 8388608U; } else { } } else { } return (link_up); } } static void bnx2x_8073_link_reset(struct bnx2x_phy *phy , struct link_params *params ) { struct bnx2x *bp ; u8 gpio_port ; long tmp ; { bp = params->bp; if ((bp->common.chip_id >> 16 == 5730U || bp->common.chip_id >> 16 == 5731U) || bp->common.chip_id >> 16 == 5743U) { gpio_port = bp->common.chip_id >> 16 != 5710U && (bp->common.chip_id >> 16 != 5711U && bp->common.chip_id >> 16 != 5712U) ? (unsigned int )bp->pf_num & 1U : 0U; } else { gpio_port = params->port; } tmp = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp != 0L) { printk("\rbnx2x: [%s:%d(%s)]Setting 8073 port %d into low power mode\n", "bnx2x_8073_link_reset", 7670, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )gpio_port); } else { } bnx2x_set_gpio(bp, 2, 0U, (int )gpio_port); return; } } static int bnx2x_8705_config_init(struct bnx2x_phy *phy , struct link_params *params , struct link_vars *vars ) { struct bnx2x *bp ; long tmp ; { bp = params->bp; tmp = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp != 0L) { printk("\rbnx2x: [%s:%d(%s)]init 8705\n", "bnx2x_8705_config_init", 7684, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } bnx2x_set_gpio(bp, 2, 1U, (int )params->port); bnx2x_ext_phy_hw_reset(bp, (int )params->port); bnx2x_cl45_write(bp, phy, 1, 0, 41024); bnx2x_wait_reset_complete(bp, phy, params); bnx2x_cl45_write(bp, phy, 1, 51722, 33416); bnx2x_cl45_write(bp, phy, 1, 51200, 32703); bnx2x_cl45_write(bp, phy, 1, 51721, 256); bnx2x_cl45_write(bp, phy, 2, 36866, 1); bnx2x_save_spirom_version(bp, (int )params->port, params->shmem_base, 0U); return (0); } } static u8 bnx2x_8705_read_status(struct bnx2x_phy *phy , struct link_params *params , struct link_vars *vars ) { u8 link_up ; u16 val1 ; u16 rx_sd ; struct bnx2x *bp ; long tmp ; long tmp___0 ; long tmp___1 ; long tmp___2 ; { link_up = 0U; bp = params->bp; tmp = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp != 0L) { printk("\rbnx2x: [%s:%d(%s)]read status 8705\n", "bnx2x_8705_read_status", 7713, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } bnx2x_cl45_read(bp, phy, 2, 36869, & val1); tmp___0 = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp___0 != 0L) { printk("\rbnx2x: [%s:%d(%s)]8705 LASI status 0x%x\n", "bnx2x_8705_read_status", 7716, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )val1); } else { } bnx2x_cl45_read(bp, phy, 2, 36869, & val1); tmp___1 = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp___1 != 0L) { printk("\rbnx2x: [%s:%d(%s)]8705 LASI status 0x%x\n", "bnx2x_8705_read_status", 7720, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )val1); } else { } bnx2x_cl45_read(bp, phy, 1, 10, & rx_sd); bnx2x_cl45_read(bp, phy, 1, 51209, & val1); bnx2x_cl45_read(bp, phy, 1, 51209, & val1); tmp___2 = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp___2 != 0L) { printk("\rbnx2x: [%s:%d(%s)]8705 1.c809 val=0x%x\n", "bnx2x_8705_read_status", 7730, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )val1); } else { } link_up = (u8 )(((int )rx_sd & 1 && ((int )val1 & 512) != 0) && ((int )val1 & 256) == 0); if ((unsigned int )link_up != 0U) { vars->line_speed = 10000U; bnx2x_ext_phy_resolve_fc(phy, params, vars); } else { } return (link_up); } } static void bnx2x_set_disable_pmd_transmit(struct link_params *params , struct bnx2x_phy *phy , u8 pmd_dis ) { struct bnx2x *bp ; long tmp ; long tmp___0 ; long tmp___1 ; { bp = params->bp; if ((unsigned int )pmd_dis != 0U) { if ((params->feature_config_flags & 1024U) != 0U) { tmp = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp != 0L) { printk("\rbnx2x: [%s:%d(%s)]Disabling PMD transmitter\n", "bnx2x_set_disable_pmd_transmit", 7753, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } } else { tmp___0 = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp___0 != 0L) { printk("\rbnx2x: [%s:%d(%s)]NOT disabling PMD transmitter\n", "bnx2x_set_disable_pmd_transmit", 7755, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } return; } } else { tmp___1 = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp___1 != 0L) { printk("\rbnx2x: [%s:%d(%s)]Enabling PMD transmitter\n", "bnx2x_set_disable_pmd_transmit", 7759, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } } bnx2x_cl45_write(bp, phy, 1, 9, (int )pmd_dis); return; } } static u8 bnx2x_get_gpio_port(struct link_params *params ) { u8 gpio_port ; u32 swap_val ; u32 swap_override ; struct bnx2x *bp ; { bp = params->bp; if ((bp->common.chip_id >> 16 == 5730U || bp->common.chip_id >> 16 == 5731U) || bp->common.chip_id >> 16 == 5743U) { gpio_port = bp->common.chip_id >> 16 != 5710U && (bp->common.chip_id >> 16 != 5711U && bp->common.chip_id >> 16 != 5712U) ? (unsigned int )bp->pf_num & 1U : 0U; } else { gpio_port = params->port; } swap_val = readl((void const volatile *)bp->regview + 66452U); swap_override = readl((void const volatile *)bp->regview + 66456U); return ((u8 )((int )((signed char )(swap_val != 0U && swap_override != 0U)) ^ (int )((signed char )gpio_port))); } } static void bnx2x_sfp_e1e2_set_transmitter(struct link_params *params , struct bnx2x_phy *phy , u8 tx_en ) { u16 val ; u8 port ; struct bnx2x *bp ; u32 tx_en_mode ; unsigned int tmp ; long tmp___0 ; u16 gpio_pin ; u8 gpio_port ; u8 gpio_mode ; long tmp___1 ; { port = params->port; bp = params->bp; tmp = readl((void const volatile *)(bp->regview + (((unsigned long )params->shmem_base + (unsigned long )port * 400UL) + 108UL))); tx_en_mode = tmp & 255U; tmp___0 = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp___0 != 0L) { printk("\rbnx2x: [%s:%d(%s)]Setting transmitter tx_en=%x for port %x mode = %x\n", "bnx2x_sfp_e1e2_set_transmitter", 7794, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )tx_en, (int )port, tx_en_mode); } else { } switch (tx_en_mode) { case 0U: bnx2x_cl45_read(bp, phy, 1, 51200, & val); if ((unsigned int )tx_en != 0U) { val = (unsigned int )val & 32767U; } else { val = (u16 )((unsigned int )val | 32768U); } bnx2x_cl45_write(bp, phy, 1, 51200, (int )val); goto ldv_46787; case 1U: ; case 2U: ; case 3U: ; case 4U: ; if ((unsigned int )tx_en != 0U) { gpio_mode = 1U; } else { gpio_mode = 0U; } gpio_pin = (unsigned int )((u16 )tx_en_mode) - 1U; gpio_port = bnx2x_get_gpio_port(params); bnx2x_set_gpio(bp, (int )gpio_pin, (u32 )gpio_mode, (int )gpio_port); goto ldv_46787; default: tmp___1 = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp___1 != 0L) { printk("\rbnx2x: [%s:%d(%s)]Invalid TX_LASER_MDIO 0x%x\n", "bnx2x_sfp_e1e2_set_transmitter", 7831, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", tx_en_mode); } else { } goto ldv_46787; } ldv_46787: ; return; } } static void bnx2x_sfp_set_transmitter(struct link_params *params , struct bnx2x_phy *phy , u8 tx_en ) { struct bnx2x *bp ; long tmp ; { bp = params->bp; tmp = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp != 0L) { printk("\rbnx2x: [%s:%d(%s)]Setting SFP+ transmitter to %d\n", "bnx2x_sfp_set_transmitter", 7841, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )tx_en); } else { } if (((((((((bp->common.chip_id >> 16 == 5770U || bp->common.chip_id >> 16 == 5797U) || bp->common.chip_id >> 16 == 5801U) || bp->common.chip_id >> 16 == 5774U) || bp->common.chip_id >> 16 == 5806U) || bp->common.chip_id >> 16 == 5807U) || ((bp->common.chip_id >> 16 == 5693U || bp->common.chip_id >> 16 == 5694U) || bp->common.chip_id >> 16 == 5695U)) || ((bp->common.chip_id >> 16 == 5793U || bp->common.chip_id >> 16 == 5794U) || bp->common.chip_id >> 16 == 5773U)) || (bp->common.chip_id >> 16 == 5796U || bp->common.chip_id >> 16 == 5803U)) || bp->common.chip_id >> 16 == 5805U) { bnx2x_sfp_e3_set_transmitter(params, phy, (int )tx_en); } else { bnx2x_sfp_e1e2_set_transmitter(params, phy, (int )tx_en); } return; } } static int bnx2x_8726_read_sfp_module_eeprom(struct bnx2x_phy *phy , struct link_params *params , u8 dev_addr , u16 addr , u8 byte_cnt , u8 *o_buf , u8 is_init ) { struct bnx2x *bp ; u16 val ; u16 i ; long tmp ; long tmp___0 ; { bp = params->bp; val = 0U; if ((unsigned int )byte_cnt > 16U) { tmp = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp != 0L) { printk("\rbnx2x: [%s:%d(%s)]Reading from eeprom is limited to 0xf\n", "bnx2x_8726_read_sfp_module_eeprom", 7858, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } return (-22); } else { } bnx2x_cl45_write(bp, phy, 1, 32770, (int )((u16 )((int )((short )byte_cnt) | (int )((short )((int )dev_addr << 8))))); bnx2x_cl45_write(bp, phy, 1, 32771, (int )addr); bnx2x_cl45_write(bp, phy, 1, 32768, 11279); i = 0U; goto ldv_46818; ldv_46817: bnx2x_cl45_read(bp, phy, 1, 32768, & val); if (((int )val & 12) == 4) { goto ldv_46816; } else { } __const_udelay(21475UL); i = (u16 )((int )i + 1); ldv_46818: ; if ((unsigned int )i <= 99U) { goto ldv_46817; } else { } ldv_46816: ; if (((int )val & 12) != 4) { tmp___0 = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp___0 != 0L) { printk("\rbnx2x: [%s:%d(%s)]Got bad status 0x%x when reading from SFP+ EEPROM\n", "bnx2x_8726_read_sfp_module_eeprom", 7891, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )val & 12); } else { } return (-22); } else { } i = 0U; goto ldv_46820; ldv_46819: bnx2x_cl45_read(bp, phy, 1, (int )((unsigned int )i + 51232U), & val); *(o_buf + (unsigned long )i) = (unsigned char )val; i = (u16 )((int )i + 1); ldv_46820: ; if ((int )((unsigned short )byte_cnt) > (int )i) { goto ldv_46819; } else { } i = 0U; goto ldv_46823; ldv_46822: bnx2x_cl45_read(bp, phy, 1, 32768, & val); if (((int )val & 12) == 0) { return (0); } else { } usleep_range(1000UL, 2000UL); i = (u16 )((int )i + 1); ldv_46823: ; if ((unsigned int )i <= 99U) { goto ldv_46822; } else { } return (-22); } } static void bnx2x_warpcore_power_module(struct link_params *params , u8 power ) { u32 pin_cfg ; struct bnx2x *bp ; unsigned int tmp ; long tmp___0 ; { bp = params->bp; tmp = readl((void const volatile *)(bp->regview + (((unsigned long )params->shmem_base + (unsigned long )params->port * 400UL) + 112UL))); pin_cfg = tmp >> 24; if (pin_cfg == 0U) { return; } else { } tmp___0 = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp___0 != 0L) { printk("\rbnx2x: [%s:%d(%s)]Setting SFP+ module power to %d using pin cfg %d\n", "bnx2x_warpcore_power_module", 7930, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )power, pin_cfg); } else { } bnx2x_set_cfg_pin(bp, pin_cfg, (unsigned int )power ^ 1U); return; } } static int bnx2x_warpcore_read_sfp_module_eeprom(struct bnx2x_phy *phy , struct link_params *params , u8 dev_addr , u16 addr , u8 byte_cnt , u8 *o_buf , u8 is_init ) { int rc ; u8 i ; u8 j ; u8 cnt ; u32 data_array[4U] ; u16 addr32 ; struct bnx2x *bp ; long tmp ; { rc = 0; j = 0U; cnt = 0U; bp = params->bp; if ((unsigned int )byte_cnt > 16U) { tmp = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp != 0L) { printk("\rbnx2x: [%s:%d(%s)]Reading from eeprom is limited to 16 bytes\n", "bnx2x_warpcore_read_sfp_module_eeprom", 7950, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } return (-22); } else { } addr32 = (unsigned int )addr & 65532U; ldv_46849: ; if ((unsigned int )is_init == 0U && (unsigned int )cnt == 2U) { bnx2x_warpcore_power_module(params, 0); usleep_range(1000UL, 2000UL); bnx2x_warpcore_power_module(params, 1); } else { } rc = bnx2x_bsc_read(params, phy, (int )dev_addr, (int )addr32, 0, (int )byte_cnt, (u32 *)(& data_array)); if (rc != 0) { cnt = (u8 )((int )cnt + 1); if ((unsigned int )cnt <= 2U) { goto ldv_46849; } else { goto ldv_46850; } } else { } ldv_46850: ; if (rc == 0) { i = (int )((u8 )addr) - (int )((u8 )addr32); goto ldv_46852; ldv_46851: *(o_buf + (unsigned long )j) = *((u8 *)(& data_array) + (unsigned long )i); j = (u8 )((int )j + 1); i = (u8 )((int )i + 1); ldv_46852: ; if ((int )i < (int )byte_cnt + ((int )addr - (int )addr32)) { goto ldv_46851; } else { } } else { } return (rc); } } static int bnx2x_8727_read_sfp_module_eeprom(struct bnx2x_phy *phy , struct link_params *params , u8 dev_addr , u16 addr , u8 byte_cnt , u8 *o_buf , u8 is_init ) { struct bnx2x *bp ; u16 val ; u16 i ; long tmp ; long tmp___0 ; { bp = params->bp; if ((unsigned int )byte_cnt > 16U) { tmp = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp != 0L) { printk("\rbnx2x: [%s:%d(%s)]Reading from eeprom is limited to 0xf\n", "bnx2x_8727_read_sfp_module_eeprom", 7987, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } return (-22); } else { } bnx2x_cl45_write(bp, phy, 1, 32773, (int )((u16 )((int )((short )((int )dev_addr << 8)) | 1))); bnx2x_cl45_read(bp, phy, 1, 32768, & val); bnx2x_cl45_write(bp, phy, 1, 32770, (unsigned int )byte_cnt > 1U ? (int )byte_cnt : 2); bnx2x_cl45_write(bp, phy, 1, 32771, (int )addr); bnx2x_cl45_write(bp, phy, 1, 32772, 32775); bnx2x_cl45_write(bp, phy, 1, 32768, 32770); usleep_range(1000UL, 2000UL); i = 0U; goto ldv_46869; ldv_46868: bnx2x_cl45_read(bp, phy, 1, 32768, & val); if (((int )val & 12) == 4) { goto ldv_46867; } else { } __const_udelay(21475UL); i = (u16 )((int )i + 1); ldv_46869: ; if ((unsigned int )i <= 99U) { goto ldv_46868; } else { } ldv_46867: ; if (((int )val & 12) != 4) { tmp___0 = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp___0 != 0L) { printk("\rbnx2x: [%s:%d(%s)]Got bad status 0x%x when reading from SFP+ EEPROM\n", "bnx2x_8727_read_sfp_module_eeprom", 8048, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )val & 12); } else { } return (-14); } else { } i = 0U; goto ldv_46871; ldv_46870: bnx2x_cl45_read(bp, phy, 1, (int )((unsigned int )i + 32775U), & val); *(o_buf + (unsigned long )i) = (unsigned char )val; i = (u16 )((int )i + 1); ldv_46871: ; if ((int )((unsigned short )byte_cnt) > (int )i) { goto ldv_46870; } else { } i = 0U; goto ldv_46874; ldv_46873: bnx2x_cl45_read(bp, phy, 1, 32768, & val); if (((int )val & 12) == 0) { return (0); } else { } usleep_range(1000UL, 2000UL); i = (u16 )((int )i + 1); ldv_46874: ; if ((unsigned int )i <= 99U) { goto ldv_46873; } else { } return (-22); } } int bnx2x_read_sfp_module_eeprom(struct bnx2x_phy *phy , struct link_params *params , u8 dev_addr , u16 addr , u16 byte_cnt , u8 *o_buf ) { int rc ; struct bnx2x *bp ; u8 xfer_size ; u8 *user_data ; int (*read_func)(struct bnx2x_phy * , struct link_params * , u8 , u16 , u8 , u8 * , u8 ) ; long tmp ; { rc = 0; bp = params->bp; user_data = o_buf; if ((unsigned int )dev_addr != 160U && (unsigned int )dev_addr != 162U) { tmp = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp != 0L) { printk("\rbnx2x: [%s:%d(%s)]invalid dev_addr 0x%x\n", "bnx2x_read_sfp_module_eeprom", 8083, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )dev_addr); } else { } return (-22); } else { } switch (phy->type) { case 1536U: read_func = & bnx2x_8726_read_sfp_module_eeprom; goto ldv_46891; case 2304U: ; case 3840U: read_func = & bnx2x_8727_read_sfp_module_eeprom; goto ldv_46891; case 0U: read_func = & bnx2x_warpcore_read_sfp_module_eeprom; goto ldv_46891; default: ; return (-95); } ldv_46891: ; goto ldv_46897; ldv_46896: xfer_size = (unsigned int )byte_cnt <= 16U ? (u8 )byte_cnt : 16U; rc = (*read_func)(phy, params, (int )dev_addr, (int )addr, (int )xfer_size, user_data, 0); byte_cnt = (int )byte_cnt - (int )((u16 )xfer_size); user_data = user_data + (unsigned long )xfer_size; addr = (int )((u16 )xfer_size) + (int )addr; ldv_46897: ; if (rc == 0 && (unsigned int )byte_cnt != 0U) { goto ldv_46896; } else { } return (rc); } } static int bnx2x_get_edc_mode(struct bnx2x_phy *phy , struct link_params *params , u16 *edc_mode ) { struct bnx2x *bp ; u32 sync_offset ; u32 phy_idx ; u32 media_types ; u8 gport ; u8 val[2U] ; u8 check_limiting_mode ; long tmp ; int tmp___0 ; u8 copper_module_type ; long tmp___1 ; int tmp___2 ; long tmp___3 ; long tmp___4 ; long tmp___5 ; long tmp___6 ; int idx ; int cfg_idx ; long tmp___7 ; long tmp___8 ; u8 options[2U] ; long tmp___9 ; int tmp___10 ; long tmp___11 ; { bp = params->bp; sync_offset = 0U; check_limiting_mode = 0U; *edc_mode = 68U; phy->media_type = 0U; tmp___0 = bnx2x_read_sfp_module_eeprom(phy, params, 160, 2, 2, (u8 *)(& val)); if (tmp___0 != 0) { tmp = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp != 0L) { printk("\rbnx2x: [%s:%d(%s)]Failed to read from SFP+ module EEPROM\n", "bnx2x_get_edc_mode", 8130, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } return (-22); } else { } switch ((int )val[0]) { case 33: phy->media_type = 3U; tmp___2 = bnx2x_read_sfp_module_eeprom(phy, params, 160, 8, 1, & copper_module_type); if (tmp___2 != 0) { tmp___1 = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp___1 != 0L) { printk("\rbnx2x: [%s:%d(%s)]Failed to read copper-cable-type from SFP+ EEPROM\n", "bnx2x_get_edc_mode", 8150, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } return (-22); } else { } if (((int )copper_module_type & 8) != 0) { tmp___3 = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp___3 != 0L) { printk("\rbnx2x: [%s:%d(%s)]Active Copper cable detected\n", "bnx2x_get_edc_mode", 8156, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } check_limiting_mode = 1U; } else if (((int )copper_module_type & 4) != 0) { tmp___4 = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp___4 != 0L) { printk("\rbnx2x: [%s:%d(%s)]Passive Copper cable detected\n", "bnx2x_get_edc_mode", 8161, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } *edc_mode = 85U; } else { tmp___5 = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp___5 != 0L) { printk("\rbnx2x: [%s:%d(%s)]Unknown copper-cable-type 0x%x !!!\n", "bnx2x_get_edc_mode", 8167, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )copper_module_type); } else { } return (-22); } goto ldv_46914; case 7: ; case 34: check_limiting_mode = 1U; if (((int )val[1] & 112) == 0) { tmp___6 = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp___6 != 0L) { printk("\rbnx2x: [%s:%d(%s)]1G SFP module detected\n", "bnx2x_get_edc_mode", 8178, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } gport = params->port; phy->media_type = 5U; if ((unsigned int )phy->req_line_speed != 1000U) { phy->req_line_speed = 1000U; if (bp->common.chip_id >> 16 != 5710U && (bp->common.chip_id >> 16 != 5711U && bp->common.chip_id >> 16 != 5712U)) { gport = (bp->common.chip_id >> 16 != 5710U && (bp->common.chip_id >> 16 != 5711U && bp->common.chip_id >> 16 != 5712U) ? (unsigned int )bp->pf_num & 1U : 0U) + (unsigned int )((int )params->port << 1U); } else { } netdev_err((struct net_device const *)bp->dev, "Warning: Link speed was forced to 1000Mbps. Current SFP module in port %d is not compliant with 10G Ethernet\n", (int )gport); } else { } } else { cfg_idx = 0; tmp___7 = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp___7 != 0L) { printk("\rbnx2x: [%s:%d(%s)]10G Optic module detected\n", "bnx2x_get_edc_mode", 8193, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } idx = 0; goto ldv_46921; ldv_46920: ; if (params->phy[idx].type == phy->type) { cfg_idx = idx != 0 ? idx + -1 : 0; goto ldv_46919; } else { } idx = idx + 1; ldv_46921: ; if (idx <= 2) { goto ldv_46920; } else { } ldv_46919: phy->media_type = 1U; phy->req_line_speed = params->req_line_speed[cfg_idx]; } goto ldv_46914; default: tmp___8 = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp___8 != 0L) { printk("\rbnx2x: [%s:%d(%s)]Unable to determine module type 0x%x !!!\n", "bnx2x_get_edc_mode", 8206, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )val[0]); } else { } return (-22); } ldv_46914: sync_offset = (params->shmem_base + (u32 )params->port * 400U) + 156U; media_types = readl((void const volatile *)bp->regview + (unsigned long )sync_offset); phy_idx = 0U; goto ldv_46925; ldv_46924: ; if ((unsigned long )((struct bnx2x_phy *)(& params->phy) + (unsigned long )phy_idx) == (unsigned long )phy) { media_types = (u32 )(~ (255 << (int )(phy_idx * 8U))) & media_types; media_types = ((phy->media_type & 255U) << (int )(phy_idx * 8U)) | media_types; goto ldv_46923; } else { } phy_idx = phy_idx + 1U; ldv_46925: ; if (phy_idx <= 2U) { goto ldv_46924; } else { } ldv_46923: writel(media_types, (void volatile *)bp->regview + (unsigned long )sync_offset); if ((unsigned int )check_limiting_mode != 0U) { tmp___10 = bnx2x_read_sfp_module_eeprom(phy, params, 160, 64, 2, (u8 *)(& options)); if (tmp___10 != 0) { tmp___9 = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp___9 != 0L) { printk("\rbnx2x: [%s:%d(%s)]Failed to read Option field from module EEPROM\n", "bnx2x_get_edc_mode", 8234, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } return (-22); } else { } if ((int )options[0] & 1) { *edc_mode = 34U; } else { *edc_mode = 68U; } } else { } tmp___11 = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp___11 != 0L) { printk("\rbnx2x: [%s:%d(%s)]EDC mode is set to 0x%x\n", "bnx2x_get_edc_mode", 8242, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )*edc_mode); } else { } return (0); } } static int bnx2x_verify_sfp_module(struct bnx2x_phy *phy , struct link_params *params ) { struct bnx2x *bp ; u32 val ; u32 cmd ; u32 fw_resp ; u32 fw_cmd_param ; char vendor_name[17U] ; char vendor_pn[17U] ; long tmp ; long tmp___0 ; long tmp___1 ; long tmp___2 ; int tmp___3 ; int tmp___4 ; { bp = params->bp; phy->flags = (unsigned int )phy->flags & 65407U; val = readl((void const volatile *)(bp->regview + (((unsigned long )params->shmem_base + (unsigned long )params->port * 116UL) + 856UL))); if ((val & 3758096384U) == 0U) { tmp = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp != 0L) { printk("\rbnx2x: [%s:%d(%s)]NOT enforcing module verification\n", "bnx2x_verify_sfp_module", 8262, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } return (0); } else { } if ((params->feature_config_flags & 8U) != 0U) { cmd = 2701131776U; } else if ((params->feature_config_flags & 4U) != 0U) { if ((unsigned int )params->num_phys == 3U) { tmp___0 = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp___0 != 0L) { printk("\rbnx2x: [%s:%d(%s)]FW does not support OPT MDL verification\n", "bnx2x_verify_sfp_module", 8275, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } return (-22); } else { } cmd = 2684354560U; } else { tmp___1 = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp___1 != 0L) { printk("\rbnx2x: [%s:%d(%s)]FW does not support OPT MDL verification\n", "bnx2x_verify_sfp_module", 8282, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } return (-22); } fw_cmd_param = ((u32 )phy->addr | phy->type) | (phy->mdio_ctrl << 16); fw_resp = bnx2x_fw_command(bp, cmd, fw_cmd_param); if (fw_resp == 2685403136U) { tmp___2 = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp___2 != 0L) { printk("\rbnx2x: [%s:%d(%s)]Approved module\n", "bnx2x_verify_sfp_module", 8289, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } return (0); } else { } tmp___3 = bnx2x_read_sfp_module_eeprom(phy, params, 160, 20, 16, (u8 *)(& vendor_name)); if (tmp___3 != 0) { vendor_name[0] = 0; } else { vendor_name[16] = 0; } tmp___4 = bnx2x_read_sfp_module_eeprom(phy, params, 160, 40, 16, (u8 *)(& vendor_pn)); if (tmp___4 != 0) { vendor_pn[0] = 0; } else { vendor_pn[16] = 0; } netdev_err((struct net_device const *)bp->dev, "Warning: Unqualified SFP+ module detected, Port %d from %s part number %s\n", (int )params->port, (char *)(& vendor_name), (char *)(& vendor_pn)); if ((val & 3758096384U) != 1073741824U) { phy->flags = (u16 )((unsigned int )phy->flags | 128U); } else { } return (-22); } } static int bnx2x_wait_for_sfp_module_initialized(struct bnx2x_phy *phy , struct link_params *params ) { u8 val ; int rc ; struct bnx2x *bp ; u16 timeout ; long tmp ; { bp = params->bp; timeout = 0U; goto ldv_46949; ldv_46948: ; if (phy->type == 0U) { rc = bnx2x_warpcore_read_sfp_module_eeprom(phy, params, 160, 1, 1, & val, 1); } else { rc = bnx2x_read_sfp_module_eeprom(phy, params, 160, 1, 1, & val); } if (rc == 0) { tmp = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp != 0L) { printk("\rbnx2x: [%s:%d(%s)]SFP+ module initialization took %d ms\n", "bnx2x_wait_for_sfp_module_initialized", 8346, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )timeout * 5); } else { } return (0); } else { } usleep_range(5000UL, 10000UL); timeout = (u16 )((int )timeout + 1); ldv_46949: ; if ((unsigned int )timeout <= 59U) { goto ldv_46948; } else { } rc = bnx2x_read_sfp_module_eeprom(phy, params, 160, 1, 1, & val); return (rc); } } static void bnx2x_8727_power_module(struct bnx2x *bp , struct bnx2x_phy *phy , u8 is_power_up ) { u16 val ; { if (((int )phy->flags & 2) != 0) { return; } else { } if ((unsigned int )is_power_up != 0U) { val = 16U; } else { val = 2U; } bnx2x_cl45_write(bp, phy, 1, 51214, (int )val); return; } } static int bnx2x_8726_set_limiting_mode(struct bnx2x *bp , struct bnx2x_phy *phy , u16 edc_mode ) { u16 cur_limiting_mode ; long tmp ; long tmp___0 ; long tmp___1 ; { bnx2x_cl45_read(bp, phy, 1, 51738, & cur_limiting_mode); tmp = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp != 0L) { printk("\rbnx2x: [%s:%d(%s)]Current Limiting mode is 0x%x\n", "bnx2x_8726_set_limiting_mode", 8399, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )cur_limiting_mode); } else { } if ((unsigned int )edc_mode == 68U) { tmp___0 = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp___0 != 0L) { printk("\rbnx2x: [%s:%d(%s)]Setting LIMITING MODE\n", "bnx2x_8726_set_limiting_mode", 8402, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } bnx2x_cl45_write(bp, phy, 1, 51738, 68); } else { tmp___1 = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp___1 != 0L) { printk("\rbnx2x: [%s:%d(%s)]Setting LRM MODE\n", "bnx2x_8726_set_limiting_mode", 8409, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } if ((unsigned int )cur_limiting_mode != 68U) { return (0); } else { } bnx2x_cl45_write(bp, phy, 1, 51775, 0); bnx2x_cl45_write(bp, phy, 1, 51738, 296); bnx2x_cl45_write(bp, phy, 1, 51747, 16392); bnx2x_cl45_write(bp, phy, 1, 51775, 43690); } return (0); } } static int bnx2x_8727_set_limiting_mode(struct bnx2x *bp , struct bnx2x_phy *phy , u16 edc_mode ) { u16 phy_identifier ; u16 rom_ver2_val ; { bnx2x_cl45_read(bp, phy, 1, 51200, & phy_identifier); bnx2x_cl45_write(bp, phy, 1, 51200, (int )phy_identifier & 65023); bnx2x_cl45_read(bp, phy, 1, 51738, & rom_ver2_val); bnx2x_cl45_write(bp, phy, 1, 51738, (int )((u16 )(((int )((short )rom_ver2_val) & -256) | ((int )((short )edc_mode) & 255)))); bnx2x_cl45_write(bp, phy, 1, 51200, (int )((unsigned int )phy_identifier | 512U)); return (0); } } static void bnx2x_8727_specific_func(struct bnx2x_phy *phy , struct link_params *params , u32 action ) { struct bnx2x *bp ; u16 val ; long tmp ; { bp = params->bp; switch (action) { case 1U: bnx2x_sfp_set_transmitter(params, phy, 0); goto ldv_46979; case 2U: ; if (((int )phy->flags & 128) == 0) { bnx2x_sfp_set_transmitter(params, phy, 1); } else { } goto ldv_46979; case 3U: bnx2x_cl45_write(bp, phy, 1, 36864, 36); bnx2x_cl45_write(bp, phy, 1, 36865, 0); bnx2x_cl45_write(bp, phy, 1, 36866, 6); bnx2x_cl45_read(bp, phy, 1, 51208, & val); val = (u16 )((unsigned int )val | 4096U); if (((int )phy->flags & 2) != 0) { val = (u16 )((unsigned int )val | 96U); } else { } if (((int )phy->flags & 2) == 0) { val = (unsigned int )val & 65423U; } else { } bnx2x_cl45_write(bp, phy, 1, 51208, (int )val); goto ldv_46979; default: tmp = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp != 0L) { printk("\rbnx2x: [%s:%d(%s)]Function 0x%x not supported by 8727\n", "bnx2x_8727_specific_func", 8512, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", action); } else { } return; } ldv_46979: ; return; } } static void bnx2x_set_e1e2_module_fault_led(struct link_params *params , u8 gpio_mode ) { struct bnx2x *bp ; u32 fault_led_gpio ; unsigned int tmp ; u8 gpio_port ; u8 tmp___0 ; u16 gpio_pin ; long tmp___1 ; long tmp___2 ; { bp = params->bp; tmp = readl((void const volatile *)(bp->regview + (((unsigned long )params->shmem_base + (unsigned long )params->port * 400UL) + 108UL))); fault_led_gpio = tmp & 65280U; switch (fault_led_gpio) { case 1024U: ; return; case 0U: ; case 256U: ; case 512U: ; case 768U: tmp___0 = bnx2x_get_gpio_port(params); gpio_port = tmp___0; gpio_pin = (u16 )fault_led_gpio; tmp___1 = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp___1 != 0L) { printk("\rbnx2x: [%s:%d(%s)]Set fault module-detected led pin %x port %x mode %x\n", "bnx2x_set_e1e2_module_fault_led", 8539, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )gpio_pin, (int )gpio_port, (int )gpio_mode); } else { } bnx2x_set_gpio(bp, (int )gpio_pin, (u32 )gpio_mode, (int )gpio_port); goto ldv_46998; default: tmp___2 = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp___2 != 0L) { printk("\rbnx2x: [%s:%d(%s)]Error: Invalid fault led mode 0x%x\n", "bnx2x_set_e1e2_module_fault_led", 8545, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", fault_led_gpio); } else { } } ldv_46998: ; return; } } static void bnx2x_set_e3_module_fault_led(struct link_params *params , u8 gpio_mode ) { u32 pin_cfg ; u8 port ; struct bnx2x *bp ; unsigned int tmp ; long tmp___0 ; { port = params->port; bp = params->bp; tmp = readl((void const volatile *)(bp->regview + (((unsigned long )params->shmem_base + (unsigned long )port * 400UL) + 112UL))); pin_cfg = (tmp & 65280U) >> 8; tmp___0 = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp___0 != 0L) { printk("\rbnx2x: [%s:%d(%s)]Setting Fault LED to %d using pin cfg %d\n", "bnx2x_set_e3_module_fault_led", 8561, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )gpio_mode, pin_cfg); } else { } bnx2x_set_cfg_pin(bp, pin_cfg, (u32 )gpio_mode); return; } } static void bnx2x_set_sfp_module_fault_led(struct link_params *params , u8 gpio_mode ) { struct bnx2x *bp ; long tmp ; { bp = params->bp; tmp = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp != 0L) { printk("\rbnx2x: [%s:%d(%s)]Setting SFP+ module fault LED to %d\n", "bnx2x_set_sfp_module_fault_led", 8569, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )gpio_mode); } else { } if (((((((((bp->common.chip_id >> 16 == 5770U || bp->common.chip_id >> 16 == 5797U) || bp->common.chip_id >> 16 == 5801U) || bp->common.chip_id >> 16 == 5774U) || bp->common.chip_id >> 16 == 5806U) || bp->common.chip_id >> 16 == 5807U) || ((bp->common.chip_id >> 16 == 5693U || bp->common.chip_id >> 16 == 5694U) || bp->common.chip_id >> 16 == 5695U)) || ((bp->common.chip_id >> 16 == 5793U || bp->common.chip_id >> 16 == 5794U) || bp->common.chip_id >> 16 == 5773U)) || (bp->common.chip_id >> 16 == 5796U || bp->common.chip_id >> 16 == 5803U)) || bp->common.chip_id >> 16 == 5805U) { bnx2x_set_e3_module_fault_led(params, (int )gpio_mode); } else { bnx2x_set_e1e2_module_fault_led(params, (int )gpio_mode); } return; } } static void bnx2x_warpcore_hw_reset(struct bnx2x_phy *phy , struct link_params *params ) { struct bnx2x *bp ; { bp = params->bp; bnx2x_warpcore_power_module(params, 0); writel(3086U, (void volatile *)bp->regview + 44080U); writel(1U, (void volatile *)bp->regview + 43636U); writel(0U, (void volatile *)bp->regview + 43640U); writel(0U, (void volatile *)bp->regview + 43644U); return; } } static void bnx2x_power_sfp_module(struct link_params *params , struct bnx2x_phy *phy , u8 power ) { struct bnx2x *bp ; long tmp ; { bp = params->bp; tmp = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp != 0L) { printk("\rbnx2x: [%s:%d(%s)]Setting SFP+ power to %x\n", "bnx2x_power_sfp_module", 8598, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )power); } else { } switch (phy->type) { case 2304U: ; case 3840U: bnx2x_8727_power_module(params->bp, phy, (int )power); goto ldv_47028; case 0U: bnx2x_warpcore_power_module(params, (int )power); goto ldv_47028; default: ; goto ldv_47028; } ldv_47028: ; return; } } static void bnx2x_warpcore_set_limiting_mode(struct link_params *params , struct bnx2x_phy *phy , u16 edc_mode ) { u16 val ; u16 mode ; struct bnx2x *bp ; u8 lane ; u8 tmp ; { val = 0U; mode = 0U; bp = params->bp; tmp = bnx2x_get_warpcore_lane(phy, params); lane = tmp; bnx2x_cl45_read(bp, phy, 3, 33266, & val); val = (u16 )(~ ((int )((short )(15 << ((int )lane << 2)))) & (int )((short )val)); switch ((int )edc_mode) { case 34: ; case 68: mode = 0U; goto ldv_47042; case 85: mode = 2U; goto ldv_47042; default: ; goto ldv_47042; } ldv_47042: val = (u16 )((int )((short )((int )mode << ((int )lane << 2))) | (int )((short )val)); bnx2x_cl45_write(bp, phy, 3, 33266, (int )val); bnx2x_cl45_read(bp, phy, 3, 33266, & val); bnx2x_warpcore_reset_lane(bp, phy, 1); bnx2x_warpcore_reset_lane(bp, phy, 0); return; } } static void bnx2x_set_limiting_mode(struct link_params *params , struct bnx2x_phy *phy , u16 edc_mode ) { { switch (phy->type) { case 1536U: bnx2x_8726_set_limiting_mode(params->bp, phy, (int )edc_mode); goto ldv_47051; case 2304U: ; case 3840U: bnx2x_8727_set_limiting_mode(params->bp, phy, (int )edc_mode); goto ldv_47051; case 0U: bnx2x_warpcore_set_limiting_mode(params, phy, (int )edc_mode); goto ldv_47051; } ldv_47051: ; return; } } int bnx2x_sfp_module_detection(struct bnx2x_phy *phy , struct link_params *params ) { struct bnx2x *bp ; u16 edc_mode ; int rc ; u32 val ; unsigned int tmp ; long tmp___0 ; long tmp___1 ; long tmp___2 ; long tmp___3 ; int tmp___4 ; int tmp___5 ; { bp = params->bp; rc = 0; tmp = readl((void const volatile *)(bp->regview + (((unsigned long )params->shmem_base + (unsigned long )params->port * 116UL) + 856UL))); val = tmp; bnx2x_sfp_set_transmitter(params, phy, 1); tmp___0 = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp___0 != 0L) { printk("\rbnx2x: [%s:%d(%s)]SFP+ module plugged in/out detected on port %d\n", "bnx2x_sfp_module_detection", 8682, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )params->port); } else { } bnx2x_power_sfp_module(params, phy, 1); tmp___5 = bnx2x_get_edc_mode(phy, params, & edc_mode); if (tmp___5 != 0) { tmp___1 = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp___1 != 0L) { printk("\rbnx2x: [%s:%d(%s)]Failed to get valid module type\n", "bnx2x_sfp_module_detection", 8686, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } return (-22); } else { tmp___4 = bnx2x_verify_sfp_module(phy, params); if (tmp___4 != 0) { tmp___2 = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp___2 != 0L) { printk("\rbnx2x: [%s:%d(%s)]Module verification failed!!\n", "bnx2x_sfp_module_detection", 8690, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } rc = -22; bnx2x_set_sfp_module_fault_led(params, 1); if ((val & 3758096384U) == 1610612736U) { tmp___3 = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp___3 != 0L) { printk("\rbnx2x: [%s:%d(%s)]Shutdown SFP+ module!!\n", "bnx2x_sfp_module_detection", 8699, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } bnx2x_power_sfp_module(params, phy, 0); return (rc); } else { } } else { bnx2x_set_sfp_module_fault_led(params, 0); } } bnx2x_set_limiting_mode(params, phy, (int )edc_mode); if (rc != 0 && (val & 3758096384U) == 536870912U) { bnx2x_sfp_set_transmitter(params, phy, 0); } else { } return (rc); } } void bnx2x_handle_module_detect_int(struct link_params *params ) { struct bnx2x *bp ; struct bnx2x_phy *phy ; u32 gpio_val ; u8 gpio_num ; u8 gpio_port ; long tmp ; int tmp___0 ; int tmp___1 ; u16 rx_tx_in_reset ; long tmp___2 ; int tmp___3 ; { bp = params->bp; if (((((((((bp->common.chip_id >> 16 == 5770U || bp->common.chip_id >> 16 == 5797U) || bp->common.chip_id >> 16 == 5801U) || bp->common.chip_id >> 16 == 5774U) || bp->common.chip_id >> 16 == 5806U) || bp->common.chip_id >> 16 == 5807U) || ((bp->common.chip_id >> 16 == 5693U || bp->common.chip_id >> 16 == 5694U) || bp->common.chip_id >> 16 == 5695U)) || ((bp->common.chip_id >> 16 == 5793U || bp->common.chip_id >> 16 == 5794U) || bp->common.chip_id >> 16 == 5773U)) || (bp->common.chip_id >> 16 == 5796U || bp->common.chip_id >> 16 == 5803U)) || bp->common.chip_id >> 16 == 5805U) { phy = (struct bnx2x_phy *)(& params->phy); bnx2x_sfp_set_transmitter(params, phy, 1); } else { phy = (struct bnx2x_phy *)(& params->phy) + 1UL; } tmp___0 = bnx2x_get_mod_abs_int_cfg(bp, params->chip_id, params->shmem_base, (int )params->port, & gpio_num, & gpio_port); if (tmp___0 == -22) { tmp = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp != 0L) { printk("\rbnx2x: [%s:%d(%s)]Failed to get MOD_ABS interrupt config\n", "bnx2x_handle_module_detect_int", 8740, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } return; } else { } bnx2x_set_sfp_module_fault_led(params, 1); tmp___1 = bnx2x_get_gpio(bp, (int )gpio_num, (int )gpio_port); gpio_val = (u32 )tmp___1; if (gpio_val == 0U) { bnx2x_set_mdio_emac_per_phy(bp, params); bnx2x_set_aer_mmd(params, phy); bnx2x_power_sfp_module(params, phy, 1); bnx2x_set_gpio_int(bp, (int )gpio_num, 0U, (int )gpio_port); tmp___3 = bnx2x_wait_for_sfp_module_initialized(phy, params); if (tmp___3 == 0) { bnx2x_sfp_module_detection(phy, params); if (((((((((bp->common.chip_id >> 16 == 5770U || bp->common.chip_id >> 16 == 5797U) || bp->common.chip_id >> 16 == 5801U) || bp->common.chip_id >> 16 == 5774U) || bp->common.chip_id >> 16 == 5806U) || bp->common.chip_id >> 16 == 5807U) || ((bp->common.chip_id >> 16 == 5693U || bp->common.chip_id >> 16 == 5694U) || bp->common.chip_id >> 16 == 5695U)) || ((bp->common.chip_id >> 16 == 5793U || bp->common.chip_id >> 16 == 5794U) || bp->common.chip_id >> 16 == 5773U)) || (bp->common.chip_id >> 16 == 5796U || bp->common.chip_id >> 16 == 5803U)) || bp->common.chip_id >> 16 == 5805U) { bnx2x_cl45_read(bp, phy, 3, 33605, & rx_tx_in_reset); if ((unsigned int )rx_tx_in_reset == 0U && ((int )params->link_flags & 2) != 0) { bnx2x_warpcore_reset_lane(bp, phy, 1); bnx2x_warpcore_config_sfi(phy, params); bnx2x_warpcore_reset_lane(bp, phy, 0); } else { } } else { } } else { tmp___2 = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp___2 != 0L) { printk("\rbnx2x: [%s:%d(%s)]SFP+ module is not initialized\n", "bnx2x_handle_module_detect_int", 8780, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } } } else { bnx2x_set_gpio_int(bp, (int )gpio_num, 1U, (int )gpio_port); phy->media_type = 255U; } return; } } static void bnx2x_sfp_mask_fault(struct bnx2x *bp , struct bnx2x_phy *phy , u16 alarm_status_offset , u16 alarm_ctrl_offset ) { u16 alarm_status ; u16 val ; { bnx2x_cl45_read(bp, phy, 1, (int )alarm_status_offset, & alarm_status); bnx2x_cl45_read(bp, phy, 1, (int )alarm_status_offset, & alarm_status); bnx2x_cl45_read(bp, phy, 1, (int )alarm_ctrl_offset, & val); if ((int )alarm_status & 1) { val = (unsigned int )val & 65534U; } else { val = (u16 )((unsigned int )val | 1U); } bnx2x_cl45_write(bp, phy, 1, (int )alarm_ctrl_offset, (int )val); return; } } static u8 bnx2x_8706_8726_read_status(struct bnx2x_phy *phy , struct link_params *params , struct link_vars *vars ) { u8 link_up ; u16 val1 ; u16 val2 ; u16 rx_sd ; u16 pcs_status ; struct bnx2x *bp ; long tmp ; long tmp___0 ; long tmp___1 ; { link_up = 0U; bp = params->bp; tmp = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp != 0L) { printk("\rbnx2x: [%s:%d(%s)]XGXS 8706/8726\n", "bnx2x_8706_8726_read_status", 8826, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } bnx2x_cl45_read(bp, phy, 1, 36867, & val2); bnx2x_sfp_mask_fault(bp, phy, 36868, 36865); bnx2x_cl45_read(bp, phy, 1, 36869, & val1); bnx2x_cl45_read(bp, phy, 1, 36869, & val2); tmp___0 = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp___0 != 0L) { printk("\rbnx2x: [%s:%d(%s)]8706/8726 LASI status 0x%x--> 0x%x\n", "bnx2x_8706_8726_read_status", 8839, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )val1, (int )val2); } else { } bnx2x_cl45_read(bp, phy, 1, 10, & rx_sd); bnx2x_cl45_read(bp, phy, 3, 32, & pcs_status); bnx2x_cl45_read(bp, phy, 7, 33540, & val2); bnx2x_cl45_read(bp, phy, 7, 33540, & val2); tmp___1 = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp___1 != 0L) { printk("\rbnx2x: [%s:%d(%s)]8706/8726 rx_sd 0x%x pcs_status 0x%x 1Gbps link_status 0x%x\n", "bnx2x_8706_8726_read_status", 8851, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )rx_sd, (int )pcs_status, (int )val2); } else { } link_up = (u8 )(((int )rx_sd & (int )pcs_status) & 1 || ((int )val2 & 2) != 0); if ((unsigned int )link_up != 0U) { if (((int )val2 & 2) != 0) { vars->line_speed = 1000U; } else { vars->line_speed = 10000U; } bnx2x_ext_phy_resolve_fc(phy, params, vars); vars->duplex = 1U; } else { } if ((unsigned int )vars->line_speed == 10000U) { bnx2x_cl45_read(bp, phy, 1, 36868, & val1); bnx2x_cl45_read(bp, phy, 1, 36868, & val1); if ((int )val1 & 1) { vars->fault_detected = 1U; } else { } } else { } return (link_up); } } static u8 bnx2x_8706_config_init(struct bnx2x_phy *phy , struct link_params *params , struct link_vars *vars ) { u32 tx_en_mode ; u16 cnt ; u16 val ; u16 tmp1 ; struct bnx2x *bp ; long tmp ; u8 i ; u16 reg ; long tmp___0 ; long tmp___1 ; long tmp___2 ; unsigned int tmp___3 ; long tmp___4 ; { bp = params->bp; bnx2x_set_gpio(bp, 2, 1U, (int )params->port); bnx2x_ext_phy_hw_reset(bp, (int )params->port); bnx2x_cl45_write(bp, phy, 1, 0, 41024); bnx2x_wait_reset_complete(bp, phy, params); cnt = 0U; goto ldv_47106; ldv_47105: bnx2x_cl45_read(bp, phy, 1, 51737, & val); if ((unsigned int )val != 0U) { goto ldv_47104; } else { } usleep_range(10000UL, 20000UL); cnt = (u16 )((int )cnt + 1); ldv_47106: ; if ((unsigned int )cnt <= 99U) { goto ldv_47105; } else { } ldv_47104: tmp = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp != 0L) { printk("\rbnx2x: [%s:%d(%s)]XGXS 8706 is initialized after %d ms\n", "bnx2x_8706_config_init", 8904, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )cnt); } else { } if ((int )params->feature_config_flags & 1) { i = 0U; goto ldv_47111; ldv_47110: reg = (unsigned int )((u16 )i) * 16U + 32956U; bnx2x_cl45_read(bp, phy, 4, (int )reg, & val); val = (unsigned int )val & 65528U; val = (u16 )(((int )((short )phy->rx_preemphasis[(int )i]) & 7) | (int )((short )val)); tmp___0 = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp___0 != 0L) { printk("\rbnx2x: [%s:%d(%s)]Setting RX Equalizer to BCM8706 reg 0x%x <-- val 0x%x\n", "bnx2x_8706_config_init", 8919, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )reg, (int )val); } else { } bnx2x_cl45_write(bp, phy, 4, (int )reg, (int )val); i = (u8 )((int )i + 1); ldv_47111: ; if ((unsigned int )i <= 3U) { goto ldv_47110; } else { } } else { } if ((unsigned int )phy->req_line_speed == 10000U) { tmp___1 = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp___1 != 0L) { printk("\rbnx2x: [%s:%d(%s)]XGXS 8706 force 10Gbps\n", "bnx2x_8706_config_init", 8925, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } bnx2x_cl45_write(bp, phy, 1, 51208, 1024); bnx2x_cl45_write(bp, phy, 1, 36865, 0); bnx2x_cl45_write(bp, phy, 1, 36866, 3); } else { tmp___2 = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp___2 != 0L) { printk("\rbnx2x: [%s:%d(%s)]XGXS 8706 AutoNeg\n", "bnx2x_8706_config_init", 8940, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } bnx2x_cl45_write(bp, phy, 7, 33648, 1036); bnx2x_cl45_write(bp, phy, 7, 65509, 32); bnx2x_cl45_write(bp, phy, 7, 65504, 4096); bnx2x_cl45_write(bp, phy, 7, 17, 32); bnx2x_cl45_write(bp, phy, 7, 0, 4608); bnx2x_cl45_write(bp, phy, 1, 36864, 1024); bnx2x_cl45_write(bp, phy, 1, 36866, 4); } bnx2x_save_bcm_spirom_ver(bp, phy, (int )params->port); tmp___3 = readl((void const volatile *)(bp->regview + (((unsigned long )params->shmem_base + (unsigned long )params->port * 400UL) + 108UL))); tx_en_mode = tmp___3 & 255U; if (tx_en_mode == 1U) { tmp___4 = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp___4 != 0L) { printk("\rbnx2x: [%s:%d(%s)]Enabling TXONOFF_PWRDN_DIS\n", "bnx2x_8706_config_init", 8976, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } bnx2x_cl45_read(bp, phy, 1, 51208, & tmp1); tmp1 = (u16 )((unsigned int )tmp1 | 1U); bnx2x_cl45_write(bp, phy, 1, 51208, (int )tmp1); } else { } return (0U); } } static int bnx2x_8706_read_status(struct bnx2x_phy *phy , struct link_params *params , struct link_vars *vars ) { u8 tmp ; { tmp = bnx2x_8706_8726_read_status(phy, params, vars); return ((int )tmp); } } static void bnx2x_8726_config_loopback(struct bnx2x_phy *phy , struct link_params *params ) { struct bnx2x *bp ; long tmp ; { bp = params->bp; tmp = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp != 0L) { printk("\rbnx2x: [%s:%d(%s)]PMA/PMD ext_phy_loopback: 8726\n", "bnx2x_8726_config_loopback", 9001, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } bnx2x_cl45_write(bp, phy, 1, 0, 1); return; } } static void bnx2x_8726_external_rom_boot(struct bnx2x_phy *phy , struct link_params *params ) { struct bnx2x *bp ; { bp = params->bp; msleep(100U); bnx2x_cl45_write(bp, phy, 1, 51728, 395); bnx2x_cl45_write(bp, phy, 1, 51728, 394); bnx2x_cl45_write(bp, phy, 1, 51845, 1); bnx2x_cl45_write(bp, phy, 1, 51728, 392); msleep(150U); bnx2x_cl45_write(bp, phy, 1, 51845, 0); msleep(200U); bnx2x_save_bcm_spirom_ver(bp, phy, (int )params->port); return; } } static u8 bnx2x_8726_read_status(struct bnx2x_phy *phy , struct link_params *params , struct link_vars *vars ) { struct bnx2x *bp ; u16 val1 ; u8 link_up ; u8 tmp ; long tmp___0 ; { bp = params->bp; tmp = bnx2x_8706_8726_read_status(phy, params, vars); link_up = tmp; if ((unsigned int )link_up != 0U) { bnx2x_cl45_read(bp, phy, 1, 51200, & val1); if ((int )((short )val1) < 0) { tmp___0 = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp___0 != 0L) { printk("\rbnx2x: [%s:%d(%s)]Tx is disabled\n", "bnx2x_8726_read_status", 9055, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } link_up = 0U; vars->line_speed = 0U; } else { } } else { } return (link_up); } } static int bnx2x_8726_config_init(struct bnx2x_phy *phy , struct link_params *params , struct link_vars *vars ) { struct bnx2x *bp ; long tmp ; long tmp___0 ; long tmp___1 ; long tmp___2 ; { bp = params->bp; tmp = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp != 0L) { printk("\rbnx2x: [%s:%d(%s)]Initializing BCM8726\n", "bnx2x_8726_config_init", 9069, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } bnx2x_cl45_write(bp, phy, 1, 0, 32768); bnx2x_wait_reset_complete(bp, phy, params); bnx2x_8726_external_rom_boot(phy, params); bnx2x_sfp_module_detection(phy, params); if ((unsigned int )phy->req_line_speed == 1000U) { tmp___0 = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp___0 != 0L) { printk("\rbnx2x: [%s:%d(%s)]Setting 1G force\n", "bnx2x_8726_config_init", 9084, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } bnx2x_cl45_write(bp, phy, 1, 0, 64); bnx2x_cl45_write(bp, phy, 1, 7, 13); bnx2x_cl45_write(bp, phy, 1, 36866, 5); bnx2x_cl45_write(bp, phy, 1, 36864, 1024); } else if (((unsigned int )phy->req_line_speed == 0U && (phy->speed_cap_mask & 1048576U) != 0U) && (phy->speed_cap_mask & 4194304U) == 0U) { tmp___1 = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp___1 != 0L) { printk("\rbnx2x: [%s:%d(%s)]Setting 1G clause37\n", "bnx2x_8726_config_init", 9100, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } bnx2x_ext_phy_set_pause(params, phy, vars); bnx2x_cl45_write(bp, phy, 7, 17, 32); bnx2x_cl45_write(bp, phy, 7, 33648, 1036); bnx2x_cl45_write(bp, phy, 7, 65508, 32); bnx2x_cl45_write(bp, phy, 7, 65504, 4096); bnx2x_cl45_write(bp, phy, 7, 0, 4608); bnx2x_cl45_write(bp, phy, 1, 36866, 4); bnx2x_cl45_write(bp, phy, 1, 36864, 1024); } else { bnx2x_cl45_write(bp, phy, 1, 36866, 1); } if ((int )params->feature_config_flags & 1) { tmp___2 = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp___2 != 0L) { printk("\rbnx2x: [%s:%d(%s)]Setting TX_CTRL1 0x%x, TX_CTRL2 0x%x\n", "bnx2x_8726_config_init", 9133, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )phy->tx_preemphasis[0], (int )phy->tx_preemphasis[1]); } else { } bnx2x_cl45_write(bp, phy, 1, 51713, (int )phy->tx_preemphasis[0]); bnx2x_cl45_write(bp, phy, 1, 51717, (int )phy->tx_preemphasis[1]); } else { } return (0); } } static void bnx2x_8726_link_reset(struct bnx2x_phy *phy , struct link_params *params ) { struct bnx2x *bp ; long tmp ; { bp = params->bp; tmp = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp != 0L) { printk("\rbnx2x: [%s:%d(%s)]bnx2x_8726_link_reset port %d\n", "bnx2x_8726_link_reset", 9153, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )params->port); } else { } bnx2x_cl45_write(bp, phy, 1, 51728, 1); return; } } static void bnx2x_8727_set_link_led(struct bnx2x_phy *phy , struct link_params *params , u8 mode ) { struct bnx2x *bp ; u16 led_mode_bitmask ; u16 gpio_pins_bitmask ; u16 val ; { bp = params->bp; led_mode_bitmask = 0U; gpio_pins_bitmask = 0U; if (((int )phy->flags & 2) == 0) { return; } else { } switch ((int )mode) { case 3: ; case 0: led_mode_bitmask = 0U; gpio_pins_bitmask = 3U; goto ldv_47162; case 1: led_mode_bitmask = 0U; gpio_pins_bitmask = 2U; goto ldv_47162; case 2: led_mode_bitmask = 96U; gpio_pins_bitmask = 17U; goto ldv_47162; } ldv_47162: bnx2x_cl45_read(bp, phy, 1, 51208, & val); val = (unsigned int )val & 65423U; val = (u16 )((int )val | (int )led_mode_bitmask); bnx2x_cl45_write(bp, phy, 1, 51208, (int )val); bnx2x_cl45_read(bp, phy, 1, 51214, & val); val = (unsigned int )val & 65504U; val = (u16 )((int )val | (int )gpio_pins_bitmask); bnx2x_cl45_write(bp, phy, 1, 51214, (int )val); return; } } static void bnx2x_8727_hw_reset(struct bnx2x_phy *phy , struct link_params *params ) { u32 swap_val ; u32 swap_override ; u8 port ; struct bnx2x *bp ; { bp = params->bp; swap_val = readl((void const volatile *)bp->regview + 66452U); swap_override = readl((void const volatile *)bp->regview + 66456U); port = (u8 )((int )((signed char )(swap_val != 0U && swap_override != 0U)) ^ 1); bnx2x_set_gpio(bp, 1, 0U, (int )port); return; } } static void bnx2x_8727_config_speed(struct bnx2x_phy *phy , struct link_params *params ) { struct bnx2x *bp ; u16 tmp1 ; u16 val ; long tmp ; long tmp___0 ; long tmp___1 ; { bp = params->bp; if ((unsigned int )phy->req_line_speed == 1000U || phy->media_type == 5U) { tmp = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp != 0L) { printk("\rbnx2x: [%s:%d(%s)]Setting 1G force\n", "bnx2x_8727_config_speed", 9233, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } bnx2x_cl45_write(bp, phy, 1, 0, 64); bnx2x_cl45_write(bp, phy, 1, 7, 13); bnx2x_cl45_read(bp, phy, 1, 7, & tmp1); tmp___0 = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp___0 != 0L) { printk("\rbnx2x: [%s:%d(%s)]1.7 = 0x%x\n", "bnx2x_8727_config_speed", 9240, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )tmp1); } else { } if ((unsigned int )params->num_phys == 3U) { bnx2x_cl45_read(bp, phy, 1, 51266, & val); val = (u16 )((unsigned int )val | 3072U); bnx2x_cl45_write(bp, phy, 1, 51266, (int )val); } else { } } else if (((unsigned int )phy->req_line_speed == 0U && (phy->speed_cap_mask & 1048576U) != 0U) && (phy->speed_cap_mask & 4194304U) == 0U) { tmp___1 = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp___1 != 0L) { printk("\rbnx2x: [%s:%d(%s)]Setting 1G clause37\n", "bnx2x_8727_config_speed", 9260, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } bnx2x_cl45_write(bp, phy, 7, 33545, 0); bnx2x_cl45_write(bp, phy, 7, 65504, 4864); } else { bnx2x_cl45_write(bp, phy, 7, 33545, 32); bnx2x_cl45_write(bp, phy, 7, 65504, 256); bnx2x_cl45_write(bp, phy, 1, 0, 8256); bnx2x_cl45_write(bp, phy, 1, 7, 8); } return; } } static int bnx2x_8727_config_init(struct bnx2x_phy *phy , struct link_params *params , struct link_vars *vars ) { u32 tx_en_mode ; u16 tmp1 ; u16 mod_abs ; u16 tmp2 ; struct bnx2x *bp ; long tmp ; long tmp___0 ; unsigned int tmp___1 ; long tmp___2 ; { bp = params->bp; bnx2x_wait_reset_complete(bp, phy, params); tmp = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp != 0L) { printk("\rbnx2x: [%s:%d(%s)]Initializing BCM8727\n", "bnx2x_8727_config_init", 9293, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } bnx2x_8727_specific_func(phy, params, 3U); bnx2x_cl45_read(bp, phy, 1, 51200, & mod_abs); mod_abs = (unsigned int )mod_abs & 65279U; if (((int )phy->flags & 2) == 0) { mod_abs = (unsigned int )mod_abs & 65023U; } else { } bnx2x_cl45_write(bp, phy, 1, 51200, (int )mod_abs); bnx2x_set_disable_pmd_transmit(params, phy, 0); bnx2x_8727_power_module(bp, phy, 1); bnx2x_cl45_read(bp, phy, 1, 51731, & tmp1); bnx2x_cl45_read(bp, phy, 1, 36867, & tmp1); bnx2x_8727_config_speed(phy, params); if ((int )params->feature_config_flags & 1) { tmp___0 = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp___0 != 0L) { printk("\rbnx2x: [%s:%d(%s)]Setting TX_CTRL1 0x%x, TX_CTRL2 0x%x\n", "bnx2x_8727_config_init", 9330, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )phy->tx_preemphasis[0], (int )phy->tx_preemphasis[1]); } else { } bnx2x_cl45_write(bp, phy, 1, 51714, (int )phy->tx_preemphasis[0]); bnx2x_cl45_write(bp, phy, 1, 51717, (int )phy->tx_preemphasis[1]); } else { } tmp___1 = readl((void const volatile *)(bp->regview + (((unsigned long )params->shmem_base + (unsigned long )params->port * 400UL) + 108UL))); tx_en_mode = tmp___1 & 255U; if (tx_en_mode == 1U) { tmp___2 = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp___2 != 0L) { printk("\rbnx2x: [%s:%d(%s)]Enabling TXONOFF_PWRDN_DIS\n", "bnx2x_8727_config_init", 9350, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } bnx2x_cl45_read(bp, phy, 1, 51428, & tmp2); tmp2 = (u16 )((unsigned int )tmp2 | 4096U); tmp2 = (unsigned int )tmp2 & 65519U; bnx2x_cl45_write(bp, phy, 1, 51428, (int )tmp2); bnx2x_cl45_read(bp, phy, 1, 51200, & tmp2); bnx2x_cl45_write(bp, phy, 1, 51200, (int )tmp2 & 32767); } else { } return (0); } } static void bnx2x_8727_handle_mod_abs(struct bnx2x_phy *phy , struct link_params *params ) { struct bnx2x *bp ; u16 mod_abs ; u16 rx_alarm_status ; u32 val ; unsigned int tmp ; long tmp___0 ; long tmp___1 ; long tmp___2 ; int tmp___3 ; long tmp___4 ; { bp = params->bp; tmp = readl((void const volatile *)(bp->regview + (((unsigned long )params->shmem_base + (unsigned long )params->port * 116UL) + 856UL))); val = tmp; bnx2x_cl45_read(bp, phy, 1, 51200, & mod_abs); if (((int )mod_abs & 256) != 0) { tmp___0 = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp___0 != 0L) { printk("\rbnx2x: [%s:%d(%s)]MOD_ABS indication show module is absent\n", "bnx2x_8727_handle_mod_abs", 9384, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } phy->media_type = 255U; mod_abs = (unsigned int )mod_abs & 65279U; if (((int )phy->flags & 2) == 0) { mod_abs = (unsigned int )mod_abs & 65023U; } else { } bnx2x_cl45_write(bp, phy, 1, 51200, (int )mod_abs); bnx2x_cl45_read(bp, phy, 1, 36867, & rx_alarm_status); } else { tmp___1 = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp___1 != 0L) { printk("\rbnx2x: [%s:%d(%s)]MOD_ABS indication show module is present\n", "bnx2x_8727_handle_mod_abs", 9410, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } mod_abs = (u16 )((unsigned int )mod_abs | 256U); if (((int )phy->flags & 2) == 0) { mod_abs = (u16 )((unsigned int )mod_abs | 512U); } else { } bnx2x_cl45_write(bp, phy, 1, 51200, (int )mod_abs); bnx2x_cl45_read(bp, phy, 1, 36867, & rx_alarm_status); if ((val & 3758096384U) == 536870912U) { bnx2x_sfp_set_transmitter(params, phy, 0); } else { } tmp___3 = bnx2x_wait_for_sfp_module_initialized(phy, params); if (tmp___3 == 0) { bnx2x_sfp_module_detection(phy, params); } else { tmp___2 = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp___2 != 0L) { printk("\rbnx2x: [%s:%d(%s)]SFP+ module is not initialized\n", "bnx2x_8727_handle_mod_abs", 9442, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } } bnx2x_8727_config_speed(phy, params); } tmp___4 = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp___4 != 0L) { printk("\rbnx2x: [%s:%d(%s)]8727 RX_ALARM_STATUS 0x%x\n", "bnx2x_8727_handle_mod_abs", 9449, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )rx_alarm_status); } else { } return; } } static u8 bnx2x_8727_read_status(struct bnx2x_phy *phy , struct link_params *params , struct link_vars *vars ) { struct bnx2x *bp ; u8 link_up ; u8 oc_port ; u16 link_status ; u16 rx_alarm_status ; u16 lasi_ctrl ; u16 val1 ; long tmp ; long tmp___0 ; long tmp___1 ; long tmp___2 ; long tmp___3 ; long tmp___4 ; long tmp___5 ; long tmp___6 ; long tmp___7 ; { bp = params->bp; link_up = 0U; oc_port = params->port; link_status = 0U; bnx2x_cl45_read(bp, phy, 1, 36866, & lasi_ctrl); if ((unsigned int )lasi_ctrl == 0U) { return (0U); } else { } bnx2x_cl45_read(bp, phy, 1, 36867, & rx_alarm_status); vars->line_speed = 0U; tmp = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp != 0L) { printk("\rbnx2x: [%s:%d(%s)]8727 RX_ALARM_STATUS 0x%x\n", "bnx2x_8727_read_status", 9475, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )rx_alarm_status); } else { } bnx2x_sfp_mask_fault(bp, phy, 36868, 36865); bnx2x_cl45_read(bp, phy, 1, 36869, & val1); tmp___0 = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp___0 != 0L) { printk("\rbnx2x: [%s:%d(%s)]8727 LASI status 0x%x\n", "bnx2x_8727_read_status", 9483, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )val1); } else { } bnx2x_cl45_read(bp, phy, 1, 51731, & val1); if (((int )phy->flags & 2) == 0 && ((int )rx_alarm_status & 32) == 0) { bnx2x_cl45_read(bp, phy, 1, 51214, & val1); if (((int )val1 & 256) == 0) { if (bp->common.chip_id >> 16 != 5710U && (bp->common.chip_id >> 16 != 5711U && bp->common.chip_id >> 16 != 5712U)) { oc_port = (bp->common.chip_id >> 16 != 5710U && (bp->common.chip_id >> 16 != 5711U && bp->common.chip_id >> 16 != 5712U) ? (unsigned int )bp->pf_num & 1U : 0U) + (unsigned int )((int )params->port << 1U); } else { } tmp___1 = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp___1 != 0L) { printk("\rbnx2x: [%s:%d(%s)]8727 Power fault has been detected on port %d\n", "bnx2x_8727_read_status", 9503, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )oc_port); } else { } netdev_err((struct net_device const *)bp->dev, "Error: Power fault on Port %d has been detected and the power to that SFP+ module has been removed to prevent failure of the card. Please remove the SFP+ module and restart the system to clear this error.\n", (int )oc_port); bnx2x_cl45_write(bp, phy, 1, 36864, 32); bnx2x_cl45_read(bp, phy, 1, 51200, & val1); val1 = (u16 )((unsigned int )val1 | 256U); bnx2x_cl45_write(bp, phy, 1, 51200, (int )val1); bnx2x_cl45_read(bp, phy, 1, 36867, & rx_alarm_status); bnx2x_8727_power_module(params->bp, phy, 0); return (0U); } else { } } else { } if (((int )rx_alarm_status & 32) != 0) { bnx2x_8727_handle_mod_abs(phy, params); bnx2x_cl45_write(bp, phy, 1, 36864, 36); } else { } if (((int )phy->flags & 128) == 0) { tmp___2 = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp___2 != 0L) { printk("\rbnx2x: [%s:%d(%s)]Enabling 8727 TX laser\n", "bnx2x_8727_read_status", 9544, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } bnx2x_sfp_set_transmitter(params, phy, 1); } else { tmp___3 = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp___3 != 0L) { printk("\rbnx2x: [%s:%d(%s)]Tx is disabled\n", "bnx2x_8727_read_status", 9547, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } return (0U); } bnx2x_cl45_read(bp, phy, 1, 51232, & link_status); if (((int )link_status & 4) != 0 && (int )((short )link_status) >= 0) { link_up = 1U; vars->line_speed = 10000U; tmp___4 = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp___4 != 0L) { printk("\rbnx2x: [%s:%d(%s)]port %x: External link up in 10G\n", "bnx2x_8727_read_status", 9562, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )params->port); } else { } } else if ((int )link_status & 1 && ((int )link_status & 8192) == 0) { link_up = 1U; vars->line_speed = 1000U; tmp___5 = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp___5 != 0L) { printk("\rbnx2x: [%s:%d(%s)]port %x: External link up in 1G\n", "bnx2x_8727_read_status", 9567, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )params->port); } else { } } else { link_up = 0U; tmp___6 = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp___6 != 0L) { printk("\rbnx2x: [%s:%d(%s)]port %x: External link is down\n", "bnx2x_8727_read_status", 9571, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )params->port); } else { } } if ((unsigned int )vars->line_speed == 10000U) { bnx2x_cl45_read(bp, phy, 1, 36868, & val1); bnx2x_cl45_read(bp, phy, 1, 36868, & val1); if ((int )val1 & 1) { vars->fault_detected = 1U; } else { } } else { } if ((unsigned int )link_up != 0U) { bnx2x_ext_phy_resolve_fc(phy, params, vars); vars->duplex = 1U; tmp___7 = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp___7 != 0L) { printk("\rbnx2x: [%s:%d(%s)]duplex = 0x%x\n", "bnx2x_8727_read_status", 9590, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )vars->duplex); } else { } } else { } if ((unsigned int )params->num_phys == 3U && (unsigned int )phy->req_line_speed == 1000U) { bnx2x_cl45_read(bp, phy, 1, 51266, & val1); if ((unsigned int )link_up != 0U) { val1 = (unsigned int )val1 & 62463U; } else { val1 = (u16 )((unsigned int )val1 | 3072U); } bnx2x_cl45_write(bp, phy, 1, 51266, (int )val1); } else { } return (link_up); } } static void bnx2x_8727_link_reset(struct bnx2x_phy *phy , struct link_params *params ) { struct bnx2x *bp ; { bp = params->bp; bnx2x_set_disable_pmd_transmit(params, phy, 1); bnx2x_sfp_set_transmitter(params, phy, 0); bnx2x_cl45_write(bp, phy, 1, 36866, 0); return; } } static void bnx2x_save_848xx_spirom_version(struct bnx2x_phy *phy , struct bnx2x *bp , u8 port ) { u16 val ; u16 fw_ver2 ; u16 cnt ; u16 i ; struct bnx2x_reg_set reg_set[5U] ; u16 fw_ver1 ; long tmp ; long tmp___0 ; { reg_set[0].devad = 1U; reg_set[0].reg = 43033U; reg_set[0].val = 20U; reg_set[1].devad = 1U; reg_set[1].reg = 43034U; reg_set[1].val = 49664U; reg_set[2].devad = 1U; reg_set[2].reg = 43035U; reg_set[2].val = 0U; reg_set[3].devad = 1U; reg_set[3].reg = 43036U; reg_set[3].val = 768U; reg_set[4].devad = 1U; reg_set[4].reg = 43031U; reg_set[4].val = 9U; if (phy->type == 3328U || phy->type == 4352U) { bnx2x_cl45_read(bp, phy, 30, 16399, & fw_ver1); bnx2x_save_spirom_version(bp, (int )port, (u32 )fw_ver1 & 4095U, phy->ver_addr); } else { i = 0U; goto ldv_47233; ldv_47232: bnx2x_cl45_write(bp, phy, (int )reg_set[(int )i].devad, (int )reg_set[(int )i].reg, (int )reg_set[(int )i].val); i = (u16 )((int )i + 1); ldv_47233: ; if ((unsigned int )i <= 4U) { goto ldv_47232; } else { } cnt = 0U; goto ldv_47237; ldv_47236: bnx2x_cl45_read(bp, phy, 1, 43032, & val); if ((int )val & 1) { goto ldv_47235; } else { } __const_udelay(21475UL); cnt = (u16 )((int )cnt + 1); ldv_47237: ; if ((unsigned int )cnt <= 99U) { goto ldv_47236; } else { } ldv_47235: ; if ((unsigned int )cnt == 100U) { tmp = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp != 0L) { printk("\rbnx2x: [%s:%d(%s)]Unable to read 848xx phy fw version(1)\n", "bnx2x_save_848xx_spirom_version", 9664, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } bnx2x_save_spirom_version(bp, (int )port, 0U, phy->ver_addr); return; } else { } bnx2x_cl45_write(bp, phy, 1, 43033, 0); bnx2x_cl45_write(bp, phy, 1, 43034, 49664); bnx2x_cl45_write(bp, phy, 1, 43031, 10); cnt = 0U; goto ldv_47241; ldv_47240: bnx2x_cl45_read(bp, phy, 1, 43032, & val); if ((int )val & 1) { goto ldv_47239; } else { } __const_udelay(21475UL); cnt = (u16 )((int )cnt + 1); ldv_47241: ; if ((unsigned int )cnt <= 99U) { goto ldv_47240; } else { } ldv_47239: ; if ((unsigned int )cnt == 100U) { tmp___0 = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp___0 != 0L) { printk("\rbnx2x: [%s:%d(%s)]Unable to read 848xx phy fw version(2)\n", "bnx2x_save_848xx_spirom_version", 9683, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } bnx2x_save_spirom_version(bp, (int )port, 0U, phy->ver_addr); return; } else { } bnx2x_cl45_read(bp, phy, 1, 43035, & fw_ver1); bnx2x_cl45_read(bp, phy, 1, 43036, & fw_ver2); bnx2x_save_spirom_version(bp, (int )port, (u32 )(((int )fw_ver2 << 16) | (int )fw_ver1), phy->ver_addr); } return; } } static void bnx2x_848xx_set_led(struct bnx2x *bp , struct bnx2x_phy *phy ) { u16 val ; u16 offset ; u16 i ; struct bnx2x_reg_set reg_set[6U] ; { reg_set[0].devad = 1U; reg_set[0].reg = 43052U; reg_set[0].val = 128U; reg_set[1].devad = 1U; reg_set[1].reg = 43055U; reg_set[1].val = 24U; reg_set[2].devad = 1U; reg_set[2].reg = 43058U; reg_set[2].val = 6U; reg_set[3].devad = 1U; reg_set[3].reg = 43060U; reg_set[3].val = 0U; reg_set[4].devad = 1U; reg_set[4].reg = 43051U; reg_set[4].val = 47U; reg_set[5].devad = 7U; reg_set[5].reg = 65531U; reg_set[5].val = 65533U; bnx2x_cl45_read(bp, phy, 1, 43067, & val); val = (unsigned int )val & 65024U; val = (u16 )((unsigned int )val | 146U); bnx2x_cl45_write(bp, phy, 1, 43067, (int )val); i = 0U; goto ldv_47253; ldv_47252: bnx2x_cl45_write(bp, phy, (int )reg_set[(int )i].devad, (int )reg_set[(int )i].reg, (int )reg_set[(int )i].val); i = (u16 )((int )i + 1); ldv_47253: ; if ((unsigned int )i <= 5U) { goto ldv_47252; } else { } if (phy->type == 3328U || phy->type == 4352U) { offset = 43244U; } else { offset = 43235U; } bnx2x_cl45_read_or_write(bp, phy, 1, (int )offset, 128); return; } } static void bnx2x_848xx_specific_func(struct bnx2x_phy *phy , struct link_params *params , u32 action ) { struct bnx2x *bp ; { bp = params->bp; switch (action) { case 3U: ; if (phy->type != 3328U && phy->type != 4352U) { bnx2x_save_848xx_spirom_version(phy, bp, (int )params->port); } else { } bnx2x_bits_en(bp, (u32 )(((int )params->port + 22660) * 4), 1U); bnx2x_848xx_set_led(bp, phy); goto ldv_47262; } ldv_47262: ; return; } } static int bnx2x_848xx_cmn_config_init(struct bnx2x_phy *phy , struct link_params *params , struct link_vars *vars ) { struct bnx2x *bp ; u16 autoneg_val ; u16 an_1000_val ; u16 an_10_100_val ; long tmp ; long tmp___0 ; long tmp___1 ; long tmp___2 ; long tmp___3 ; long tmp___4 ; { bp = params->bp; bnx2x_848xx_specific_func(phy, params, 3U); bnx2x_cl45_write(bp, phy, 1, 0, 0); bnx2x_cl45_read(bp, phy, 7, 65513, & an_1000_val); bnx2x_ext_phy_set_pause(params, phy, vars); bnx2x_cl45_read(bp, phy, 7, 65508, & an_10_100_val); bnx2x_cl45_read(bp, phy, 7, 65504, & autoneg_val); autoneg_val = (unsigned int )autoneg_val & 52415U; an_10_100_val = (unsigned int )an_10_100_val & 65055U; if (((unsigned int )phy->req_line_speed == 0U && (phy->speed_cap_mask & 1048576U) != 0U) || (unsigned int )phy->req_line_speed == 1000U) { an_1000_val = (u16 )((unsigned int )an_1000_val | 256U); autoneg_val = (u16 )((unsigned int )autoneg_val | 4608U); if ((unsigned int )phy->req_duplex == 1U) { an_1000_val = (u16 )((unsigned int )an_1000_val | 512U); } else { } tmp = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp != 0L) { printk("\rbnx2x: [%s:%d(%s)]Advertising 1G\n", "bnx2x_848xx_cmn_config_init", 9799, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } } else { an_1000_val = (unsigned int )an_1000_val & 64767U; } bnx2x_cl45_write(bp, phy, 7, 65513, (int )an_1000_val); if ((unsigned int )phy->req_line_speed == 0U && (phy->speed_cap_mask & 786432U) != 0U) { an_10_100_val = (u16 )((unsigned int )an_10_100_val | 128U); autoneg_val = (u16 )((unsigned int )autoneg_val | 4608U); if ((unsigned int )phy->req_duplex == 1U) { an_10_100_val = (u16 )((unsigned int )an_10_100_val | 256U); } else { } tmp___0 = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp___0 != 0L) { printk("\rbnx2x: [%s:%d(%s)]Advertising 100M\n", "bnx2x_848xx_cmn_config_init", 9818, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } } else { } if (((unsigned int )phy->req_line_speed == 0U && (phy->speed_cap_mask & 196608U) != 0U) && (phy->supported & 3U) != 0U) { an_10_100_val = (u16 )((unsigned int )an_10_100_val | 32U); autoneg_val = (u16 )((unsigned int )autoneg_val | 4608U); if ((unsigned int )phy->req_duplex == 1U) { an_10_100_val = (u16 )((unsigned int )an_10_100_val | 64U); } else { } tmp___1 = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp___1 != 0L) { printk("\rbnx2x: [%s:%d(%s)]Advertising 10M\n", "bnx2x_848xx_cmn_config_init", 9832, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } } else { } if ((unsigned int )phy->req_line_speed == 100U && (phy->supported & 12U) != 0U) { autoneg_val = (u16 )((unsigned int )autoneg_val | 8192U); bnx2x_cl45_write(bp, phy, 7, 65528, 33287); an_10_100_val = (u16 )((unsigned int )an_10_100_val | 384U); tmp___2 = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp___2 != 0L) { printk("\rbnx2x: [%s:%d(%s)]Setting 100M force\n", "bnx2x_848xx_cmn_config_init", 9847, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } } else { } if ((unsigned int )phy->req_line_speed == 10U && (phy->supported & 3U) != 0U) { bnx2x_cl45_write(bp, phy, 7, 65528, 33287); tmp___3 = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp___3 != 0L) { printk("\rbnx2x: [%s:%d(%s)]Setting 10M force\n", "bnx2x_848xx_cmn_config_init", 9857, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } } else { } bnx2x_cl45_write(bp, phy, 7, 65508, (int )an_10_100_val); if ((unsigned int )phy->req_duplex == 1U) { autoneg_val = (u16 )((unsigned int )autoneg_val | 256U); } else { } if ((phy->type != 3328U && phy->type != 4352U) || ((int )autoneg_val & 4096) == 0) { bnx2x_cl45_write(bp, phy, 7, 65504, (int )autoneg_val); } else { } if (((unsigned int )phy->req_line_speed == 0U && (phy->speed_cap_mask & 4194304U) != 0U) || (unsigned int )phy->req_line_speed == 10000U) { tmp___4 = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp___4 != 0L) { printk("\rbnx2x: [%s:%d(%s)]Advertising 10G\n", "bnx2x_848xx_cmn_config_init", 9881, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } bnx2x_cl45_read_or_write(bp, phy, 7, 32, 4096); bnx2x_cl45_write(bp, phy, 7, 0, 12800); } else { bnx2x_cl45_write(bp, phy, 7, 32, 1); } return (0); } } static int bnx2x_8481_config_init(struct bnx2x_phy *phy , struct link_params *params , struct link_vars *vars ) { struct bnx2x *bp ; int tmp ; { bp = params->bp; bnx2x_set_gpio(bp, 2, 1U, (int )params->port); bnx2x_ext_phy_hw_reset(bp, (int )params->port); bnx2x_wait_reset_complete(bp, phy, params); bnx2x_cl45_write(bp, phy, 1, 0, 32768); tmp = bnx2x_848xx_cmn_config_init(phy, params, vars); return (tmp); } } static int bnx2x_84833_cmd_hdlr(struct bnx2x_phy *phy , struct link_params *params , u16 fw_cmd , u16 *cmd_args , int argc ) { int idx ; u16 val ; struct bnx2x *bp ; long tmp ; long tmp___0 ; { bp = params->bp; bnx2x_cl45_write(bp, phy, 30, 16439, 42405); idx = 0; goto ldv_47291; ldv_47290: bnx2x_cl45_read(bp, phy, 30, 16439, & val); if ((unsigned int )val == 16U) { goto ldv_47289; } else { } usleep_range(1000UL, 2000UL); idx = idx + 1; ldv_47291: ; if (idx <= 299) { goto ldv_47290; } else { } ldv_47289: ; if (idx > 299) { tmp = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp != 0L) { printk("\rbnx2x: [%s:%d(%s)]FW cmd: FW not ready.\n", "bnx2x_84833_cmd_hdlr", 9939, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } return (-22); } else { } idx = 0; goto ldv_47294; ldv_47293: bnx2x_cl45_write(bp, phy, 30, (int )((unsigned int )((u16 )idx) + 16440U), (int )*(cmd_args + (unsigned long )idx)); idx = idx + 1; ldv_47294: ; if (idx < argc) { goto ldv_47293; } else { } bnx2x_cl45_write(bp, phy, 30, 16389, (int )fw_cmd); idx = 0; goto ldv_47298; ldv_47297: bnx2x_cl45_read(bp, phy, 30, 16439, & val); if ((unsigned int )val == 4U || (unsigned int )val == 8U) { goto ldv_47296; } else { } usleep_range(1000UL, 2000UL); idx = idx + 1; ldv_47298: ; if (idx <= 299) { goto ldv_47297; } else { } ldv_47296: ; if (idx > 299 || (unsigned int )val == 8U) { tmp___0 = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp___0 != 0L) { printk("\rbnx2x: [%s:%d(%s)]FW cmd failed.\n", "bnx2x_84833_cmd_hdlr", 9961, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } return (-22); } else { } idx = 0; goto ldv_47300; ldv_47299: bnx2x_cl45_read(bp, phy, 30, (int )((unsigned int )((u16 )idx) + 16440U), cmd_args + (unsigned long )idx); idx = idx + 1; ldv_47300: ; if (idx < argc) { goto ldv_47299; } else { } bnx2x_cl45_write(bp, phy, 30, 16439, 128); return (0); } } static int bnx2x_84833_pair_swap_cfg(struct bnx2x_phy *phy , struct link_params *params , struct link_vars *vars ) { u32 pair_swap ; u16 data[5U] ; int status ; struct bnx2x *bp ; unsigned int tmp ; long tmp___0 ; { bp = params->bp; tmp = readl((void const volatile *)(bp->regview + (((unsigned long )params->shmem_base + (unsigned long )params->port * 400UL) + 396UL))); pair_swap = tmp & 255U; if (pair_swap == 0U) { return (0); } else { } data[1] = (unsigned short )pair_swap; status = bnx2x_84833_cmd_hdlr(phy, params, 32769, (u16 *)(& data), 5); if (status == 0) { tmp___0 = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp___0 != 0L) { printk("\rbnx2x: [%s:%d(%s)]Pairswap OK, val=0x%x\n", "bnx2x_84833_pair_swap_cfg", 10000, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )data[1]); } else { } } else { } return (status); } } static u8 bnx2x_84833_get_reset_gpios(struct bnx2x *bp , u32 *shmem_base_path , u32 chip_id ) { u32 reset_pin[2U] ; u32 idx ; u8 reset_gpios ; { if (((((((((bp->common.chip_id >> 16 == 5770U || bp->common.chip_id >> 16 == 5797U) || bp->common.chip_id >> 16 == 5801U) || bp->common.chip_id >> 16 == 5774U) || bp->common.chip_id >> 16 == 5806U) || bp->common.chip_id >> 16 == 5807U) || ((bp->common.chip_id >> 16 == 5693U || bp->common.chip_id >> 16 == 5694U) || bp->common.chip_id >> 16 == 5695U)) || ((bp->common.chip_id >> 16 == 5793U || bp->common.chip_id >> 16 == 5794U) || bp->common.chip_id >> 16 == 5773U)) || (bp->common.chip_id >> 16 == 5796U || bp->common.chip_id >> 16 == 5803U)) || bp->common.chip_id >> 16 == 5805U) { idx = 0U; goto ldv_47321; ldv_47320: reset_pin[idx] = readl((void const volatile *)(bp->regview + ((unsigned long )*(shmem_base_path + (unsigned long )idx) + 116UL))); reset_pin[idx] = (reset_pin[idx] & 65280U) >> 8; reset_pin[idx] = reset_pin[idx] - 1U; reset_pin[idx] = (u32 )(1 << (int )reset_pin[idx]); idx = idx + 1U; ldv_47321: ; if (idx <= 1U) { goto ldv_47320; } else { } reset_gpios = (int )((unsigned char )reset_pin[0]) | (int )((unsigned char )reset_pin[1]); } else { idx = 0U; goto ldv_47324; ldv_47323: reset_pin[idx] = readl((void const volatile *)(bp->regview + ((unsigned long )*(shmem_base_path + (unsigned long )idx) + 400UL))); reset_pin[idx] = reset_pin[idx] & 983040U; reset_pin[idx] = reset_pin[idx] - 65536U; reset_pin[idx] = reset_pin[idx] >> 16; reset_pin[idx] = (u32 )(1 << (int )reset_pin[idx]); idx = idx + 1U; ldv_47324: ; if (idx <= 1U) { goto ldv_47323; } else { } reset_gpios = (int )((unsigned char )reset_pin[0]) | (int )((unsigned char )reset_pin[1]); } return (reset_gpios); } } static int bnx2x_84833_hw_reset_phy(struct bnx2x_phy *phy , struct link_params *params ) { struct bnx2x *bp ; u8 reset_gpios ; u32 other_shmem_base_addr ; unsigned int tmp ; u32 shmem_base_path[2U] ; long tmp___0 ; { bp = params->bp; tmp = readl((void const volatile *)(bp->regview + ((unsigned long )params->shmem2_base + 52UL))); other_shmem_base_addr = tmp; bnx2x_cl45_write(bp, phy, 7, 65504, 64); bnx2x_cl45_write(bp, phy, 7, 65520, 8); shmem_base_path[0] = params->shmem_base; shmem_base_path[1] = other_shmem_base_addr; reset_gpios = bnx2x_84833_get_reset_gpios(bp, (u32 *)(& shmem_base_path), params->chip_id); bnx2x_set_mult_gpio(bp, (int )reset_gpios, 0U); __const_udelay(42950UL); tmp___0 = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp___0 != 0L) { printk("\rbnx2x: [%s:%d(%s)]84833 hw reset on pin values 0x%x\n", "bnx2x_84833_hw_reset_phy", 10071, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )reset_gpios); } else { } return (0); } } static int bnx2x_8483x_disable_eee(struct bnx2x_phy *phy , struct link_params *params , struct link_vars *vars ) { int rc ; struct bnx2x *bp ; u16 cmd_args ; long tmp ; long tmp___0 ; int tmp___1 ; { bp = params->bp; cmd_args = 0U; tmp = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp != 0L) { printk("\rbnx2x: [%s:%d(%s)]Don\'t Advertise 10GBase-T EEE\n", "bnx2x_8483x_disable_eee", 10084, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } rc = bnx2x_84833_cmd_hdlr(phy, params, 32777, & cmd_args, 1); if (rc != 0) { tmp___0 = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp___0 != 0L) { printk("\rbnx2x: [%s:%d(%s)]EEE disable failed.\n", "bnx2x_8483x_disable_eee", 10090, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } return (rc); } else { } tmp___1 = bnx2x_eee_disable(phy, params, vars); return (tmp___1); } } static int bnx2x_8483x_enable_eee(struct bnx2x_phy *phy , struct link_params *params , struct link_vars *vars ) { int rc ; struct bnx2x *bp ; u16 cmd_args ; long tmp ; int tmp___0 ; { bp = params->bp; cmd_args = 1U; rc = bnx2x_84833_cmd_hdlr(phy, params, 32777, & cmd_args, 1); if (rc != 0) { tmp = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp != 0L) { printk("\rbnx2x: [%s:%d(%s)]EEE enable failed.\n", "bnx2x_8483x_enable_eee", 10108, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } return (rc); } else { } tmp___0 = bnx2x_eee_advertise(phy, params, vars, 4); return (tmp___0); } } static int bnx2x_848x3_config_init(struct bnx2x_phy *phy , struct link_params *params , struct link_vars *vars ) { struct bnx2x *bp ; u8 port ; u8 initialize ; u16 val ; u32 actual_phy_selection ; u16 cmd_args[5U] ; int rc ; u16 temp ; long tmp ; long tmp___0 ; u32 cms_enable ; unsigned int tmp___1 ; long tmp___2 ; u32 tmp___3 ; long tmp___4 ; u8 tmp___5 ; { bp = params->bp; initialize = 1U; rc = 0; usleep_range(1000UL, 2000UL); if (bp->common.chip_id >> 16 != 5710U && (bp->common.chip_id >> 16 != 5711U && bp->common.chip_id >> 16 != 5712U)) { port = bp->common.chip_id >> 16 != 5710U && (bp->common.chip_id >> 16 != 5711U && bp->common.chip_id >> 16 != 5712U) ? (unsigned int )bp->pf_num & 1U : 0U; } else { port = params->port; } if (phy->type == 2816U) { bnx2x_set_gpio(bp, 3, 1U, (int )port); } else { bnx2x_cl45_write(bp, phy, 1, 0, 32768); } bnx2x_wait_reset_complete(bp, phy, params); msleep(50U); if (phy->type != 3328U && phy->type != 4352U) { temp = vars->line_speed; vars->line_speed = 10000U; bnx2x_set_autoneg((struct bnx2x_phy *)(& params->phy), params, vars, 0); bnx2x_program_serdes((struct bnx2x_phy *)(& params->phy), params, vars); vars->line_speed = temp; } else { } bnx2x_cl45_read(bp, phy, 30, 16410, & val); val = (unsigned int )val & 60935U; if (((((((((bp->common.chip_id >> 16 == 5770U || bp->common.chip_id >> 16 == 5797U) || bp->common.chip_id >> 16 == 5801U) || bp->common.chip_id >> 16 == 5774U) || bp->common.chip_id >> 16 == 5806U) || bp->common.chip_id >> 16 == 5807U) || ((bp->common.chip_id >> 16 == 5693U || bp->common.chip_id >> 16 == 5694U) || bp->common.chip_id >> 16 == 5695U)) || ((bp->common.chip_id >> 16 == 5793U || bp->common.chip_id >> 16 == 5794U) || bp->common.chip_id >> 16 == 5773U)) || (bp->common.chip_id >> 16 == 5796U || bp->common.chip_id >> 16 == 5803U)) || bp->common.chip_id >> 16 == 5805U) { val = (unsigned int )val & 65415U; } else { val = (u16 )((unsigned int )val | 40U); } actual_phy_selection = bnx2x_phy_selection(params); switch (actual_phy_selection) { case 0U: ; goto ldv_47367; case 3U: val = val; goto ldv_47367; case 4U: val = (u16 )((unsigned int )val | 256U); goto ldv_47367; case 1U: ; goto ldv_47367; case 2U: val = (u16 )((unsigned int )val | 128U); initialize = 0U; goto ldv_47367; } ldv_47367: ; if ((unsigned int )params->phy[2].req_line_speed == 1000U) { val = (u16 )((unsigned int )val | 4096U); } else { } bnx2x_cl45_write(bp, phy, 30, 16410, (int )val); tmp = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp != 0L) { printk("\rbnx2x: [%s:%d(%s)]Multi_phy config = 0x%x, Media control = 0x%x\n", "bnx2x_848x3_config_init", 10204, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", params->multi_phy_config, (int )val); } else { } if (phy->type == 3328U || phy->type == 4352U) { bnx2x_84833_pair_swap_cfg(phy, params, vars); cmd_args[0] = 0U; cmd_args[1] = 0U; cmd_args[2] = 1194U; cmd_args[3] = 1193U; rc = bnx2x_84833_cmd_hdlr(phy, params, 32777, (u16 *)(& cmd_args), 5); if (rc != 0) { tmp___0 = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp___0 != 0L) { printk("\rbnx2x: [%s:%d(%s)]Cfg AutogrEEEn failed.\n", "bnx2x_848x3_config_init", 10219, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } } else { } } else { } if ((unsigned int )initialize != 0U) { rc = bnx2x_848xx_cmn_config_init(phy, params, vars); } else { bnx2x_save_848xx_spirom_version(phy, bp, (int )params->port); } if (phy->type == 2816U) { tmp___1 = readl((void const volatile *)(bp->regview + ((unsigned long )params->shmem_base + ((unsigned long )params->port + 1UL) * 400UL))); cms_enable = tmp___1 & 2097152U; bnx2x_cl45_read(bp, phy, 30, 16389, & val); if (cms_enable != 0U) { val = (u16 )((unsigned int )val | 128U); } else { val = (unsigned int )val & 65407U; } bnx2x_cl45_write(bp, phy, 30, 16389, (int )val); } else { } bnx2x_cl45_read(bp, phy, 30, 16399, & val); if ((unsigned int )val > 4272U && (unsigned int )val != 8065U) { tmp___5 = bnx2x_eee_has_cap(params); if ((unsigned int )tmp___5 != 0U) { rc = bnx2x_eee_initial_config(params, vars, 4); if (rc != 0) { tmp___2 = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp___2 != 0L) { printk("\rbnx2x: [%s:%d(%s)]Failed to configure EEE timers\n", "bnx2x_848x3_config_init", 10251, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } bnx2x_8483x_disable_eee(phy, params, vars); return (rc); } else { } if ((unsigned int )phy->req_duplex == 1U && (int )params->eee_mode < 0) { tmp___3 = bnx2x_eee_calc_timer(params); if (tmp___3 != 0U || (params->eee_mode & 1073741824U) == 0U) { rc = bnx2x_8483x_enable_eee(phy, params, vars); } else { rc = bnx2x_8483x_disable_eee(phy, params, vars); } } else { rc = bnx2x_8483x_disable_eee(phy, params, vars); } if (rc != 0) { tmp___4 = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp___4 != 0L) { printk("\rbnx2x: [%s:%d(%s)]Failed to set EEE advertisement\n", "bnx2x_848x3_config_init", 10264, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } return (rc); } else { } } else { vars->eee_status = vars->eee_status & 4293984255U; } } else { vars->eee_status = vars->eee_status & 4293984255U; } if (phy->type == 3328U || phy->type == 4352U) { bnx2x_cl45_read_and_write(bp, phy, 30, 16410, 32767); } else { } return (rc); } } static u8 bnx2x_848xx_read_status(struct bnx2x_phy *phy , struct link_params *params , struct link_vars *vars ) { struct bnx2x *bp ; u16 val ; u16 val1 ; u16 val2 ; u8 link_up ; long tmp ; u16 legacy_status ; u16 legacy_speed ; long tmp___0 ; long tmp___1 ; long tmp___2 ; { bp = params->bp; link_up = 0U; bnx2x_cl45_read(bp, phy, 7, 65530, & val1); bnx2x_cl45_read(bp, phy, 1, 43025, & val2); tmp = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp != 0L) { printk("\rbnx2x: [%s:%d(%s)]BCM848xx: PMD_SIGNAL 1.a811 = 0x%x\n", "bnx2x_848xx_read_status", 10298, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )val2); } else { } if (((int )val2 & 2048) != 0) { vars->line_speed = 10000U; vars->duplex = 1U; link_up = 1U; bnx2x_ext_phy_10G_an_resolve(bp, phy, vars); } else { bnx2x_cl45_write(bp, phy, 7, 65527, 3906); bnx2x_cl45_read(bp, phy, 7, 65525, & legacy_status); tmp___0 = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp___0 != 0L) { printk("\rbnx2x: [%s:%d(%s)]Legacy speed status = 0x%x\n", "bnx2x_848xx_read_status", 10321, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )legacy_status); } else { } link_up = ((int )legacy_status & 2048) != 0; legacy_speed = (unsigned int )legacy_status & 1536U; if ((unsigned int )legacy_speed == 0U) { vars->line_speed = 10U; } else if ((unsigned int )legacy_speed == 512U) { vars->line_speed = 100U; } else if ((unsigned int )legacy_speed == 1024U) { vars->line_speed = 1000U; } else { vars->line_speed = 0U; link_up = 0U; } if ((unsigned int )link_up != 0U) { if (((int )legacy_status & 256) != 0) { vars->duplex = 1U; } else { vars->duplex = 0U; } tmp___1 = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp___1 != 0L) { printk("\rbnx2x: [%s:%d(%s)]Link is up in %dMbps, is_duplex_full= %d\n", "bnx2x_848xx_read_status", 10344, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )vars->line_speed, (unsigned int )vars->duplex == 1U); } else { } bnx2x_cl45_read(bp, phy, 7, 65505, & val); if (((int )val & 32) != 0) { vars->link_status = vars->link_status | 64U; } else { } bnx2x_cl45_read(bp, phy, 7, 65510, & val); if (((int )val & 1) == 0) { vars->link_status = vars->link_status | 128U; } else { } } else { } } if ((unsigned int )link_up != 0U) { tmp___2 = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp___2 != 0L) { printk("\rbnx2x: [%s:%d(%s)]BCM848x3: link speed is %d\n", "bnx2x_848xx_read_status", 10364, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )vars->line_speed); } else { } bnx2x_ext_phy_resolve_fc(phy, params, vars); bnx2x_cl45_read(bp, phy, 7, 65509, & val); if (((int )val & 32) != 0) { vars->link_status = vars->link_status | 32768U; } else { } if (((int )val & 64) != 0) { vars->link_status = vars->link_status | 16384U; } else { } if (((int )val & 128) != 0) { vars->link_status = vars->link_status | 8192U; } else { } if (((int )val & 256) != 0) { vars->link_status = vars->link_status | 4096U; } else { } if (((int )val & 512) != 0) { vars->link_status = vars->link_status | 2048U; } else { } bnx2x_cl45_read(bp, phy, 7, 65514, & val); if (((int )val & 1024) != 0) { vars->link_status = vars->link_status | 1024U; } else { } if (((int )val & 2048) != 0) { vars->link_status = vars->link_status | 512U; } else { } bnx2x_cl45_read(bp, phy, 7, 33, & val); if (((int )val & 2048) != 0) { vars->link_status = vars->link_status | 8388608U; } else { } if (phy->type == 3328U || phy->type == 4352U) { bnx2x_eee_an_resolve(phy, params, vars); } else { } } else { } return (link_up); } } static int bnx2x_848xx_format_ver(u32 raw_ver , u8 *str , u16 *len ) { int status ; u32 spirom_ver ; { status = 0; spirom_ver = (((raw_ver & 3968U) >> 7) << 16) | (raw_ver & 127U); status = bnx2x_format_ver(spirom_ver, str, len); return (status); } } static void bnx2x_8481_hw_reset(struct bnx2x_phy *phy , struct link_params *params ) { { bnx2x_set_gpio(params->bp, 1, 0U, 0); bnx2x_set_gpio(params->bp, 1, 0U, 1); return; } } static void bnx2x_8481_link_reset(struct bnx2x_phy *phy , struct link_params *params ) { { bnx2x_cl45_write(params->bp, phy, 7, 0, 0); bnx2x_cl45_write(params->bp, phy, 1, 0, 1); return; } } static void bnx2x_848x3_link_reset(struct bnx2x_phy *phy , struct link_params *params ) { struct bnx2x *bp ; u8 port ; u16 val16 ; { bp = params->bp; if (bp->common.chip_id >> 16 != 5710U && (bp->common.chip_id >> 16 != 5711U && bp->common.chip_id >> 16 != 5712U)) { port = bp->common.chip_id >> 16 != 5710U && (bp->common.chip_id >> 16 != 5711U && bp->common.chip_id >> 16 != 5712U) ? (unsigned int )bp->pf_num & 1U : 0U; } else { port = params->port; } if (phy->type == 2816U) { bnx2x_set_gpio(bp, 3, 0U, (int )port); } else { bnx2x_cl45_read(bp, phy, 30, 16410, & val16); val16 = (u16 )((unsigned int )val16 | 32768U); bnx2x_cl45_write(bp, phy, 30, 16410, (int )val16); } return; } } static void bnx2x_848xx_set_link_led(struct bnx2x_phy *phy , struct link_params *params , u8 mode ) { struct bnx2x *bp ; u16 val ; u8 port ; long tmp ; long tmp___0 ; unsigned int tmp___1 ; long tmp___2 ; unsigned int tmp___3 ; long tmp___4 ; long tmp___5 ; { bp = params->bp; if (bp->common.chip_id >> 16 != 5710U && (bp->common.chip_id >> 16 != 5711U && bp->common.chip_id >> 16 != 5712U)) { port = bp->common.chip_id >> 16 != 5710U && (bp->common.chip_id >> 16 != 5711U && bp->common.chip_id >> 16 != 5712U) ? (unsigned int )bp->pf_num & 1U : 0U; } else { port = params->port; } switch ((int )mode) { case 0: tmp = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp != 0L) { printk("\rbnx2x: [%s:%d(%s)]Port 0x%x: LED MODE OFF\n", "bnx2x_848xx_set_link_led", 10481, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )port); } else { } if ((int )params->hw_led_mode << 16 == 917504) { bnx2x_cl45_write(bp, phy, 1, 43052, 0); bnx2x_cl45_write(bp, phy, 1, 43055, 0); bnx2x_cl45_write(bp, phy, 1, 43058, 0); bnx2x_cl45_write(bp, phy, 1, 43064, 0); } else { bnx2x_cl45_write(bp, phy, 1, 43052, 0); } goto ldv_47419; case 3: tmp___0 = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp___0 != 0L) { printk("\rbnx2x: [%s:%d(%s)]Port 0x%x: LED MODE FRONT PANEL OFF\n", "bnx2x_848xx_set_link_led", 10517, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )port); } else { } if ((int )params->hw_led_mode << 16 == 917504) { bnx2x_cl45_write(bp, phy, 1, 43052, 0); bnx2x_cl45_write(bp, phy, 1, 43055, 0); bnx2x_cl45_write(bp, phy, 1, 43058, 0); bnx2x_cl45_write(bp, phy, 1, 43064, 32); } else { bnx2x_cl45_write(bp, phy, 1, 43052, 0); if (phy->type == 4352U) { tmp___1 = readl((void const volatile *)bp->regview + (unsigned long )(((int )params->port + 16588) * 4)); if ((int )tmp___1 & 1) { params->link_flags = (u16 )((unsigned int )params->link_flags | 1U); bnx2x_bits_dis(bp, (u32 )(((int )params->port + 16588) * 4), 1U); } else { } bnx2x_cl45_write(bp, phy, 1, 43061, 0); } else { } } goto ldv_47419; case 1: tmp___2 = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp___2 != 0L) { printk("\rbnx2x: [%s:%d(%s)]Port 0x%x: LED MODE ON\n", "bnx2x_848xx_set_link_led", 10574, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )port); } else { } if ((int )params->hw_led_mode << 16 == 917504) { bnx2x_cl45_read(bp, phy, 1, 43067, & val); val = (unsigned int )val & 32768U; val = (u16 )((unsigned int )val | 9362U); bnx2x_cl45_write(bp, phy, 1, 43067, (int )val); bnx2x_cl45_write(bp, phy, 1, 43052, 0); bnx2x_cl45_write(bp, phy, 1, 43055, 32); bnx2x_cl45_write(bp, phy, 1, 43058, 32); bnx2x_cl45_write(bp, phy, 1, 43064, 0); } else { bnx2x_cl45_write(bp, phy, 1, 43052, 32); if (phy->type == 4352U) { tmp___3 = readl((void const volatile *)bp->regview + (unsigned long )(((int )params->port + 16588) * 4)); if ((int )tmp___3 & 1) { params->link_flags = (u16 )((unsigned int )params->link_flags | 1U); bnx2x_bits_dis(bp, (u32 )(((int )params->port + 16588) * 4), 1U); } else { } bnx2x_cl45_write(bp, phy, 1, 43061, 32); } else { } } goto ldv_47419; case 2: tmp___4 = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp___4 != 0L) { printk("\rbnx2x: [%s:%d(%s)]Port 0x%x: LED MODE OPER\n", "bnx2x_848xx_set_link_led", 10643, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )port); } else { } if ((int )params->hw_led_mode << 16 == 917504) { bnx2x_cl45_read(bp, phy, 1, 43067, & val); if (((int )val & 2048) >> 11 == 0) { tmp___5 = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp___5 != 0L) { printk("\rbnx2x: [%s:%d(%s)]Setting LINK_SIGNAL\n", "bnx2x_848xx_set_link_led", 10657, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } bnx2x_cl45_write(bp, phy, 1, 43067, 42130); } else { } bnx2x_cl45_write(bp, phy, 1, 43052, 16); bnx2x_cl45_write(bp, phy, 1, 43055, 128); bnx2x_cl45_write(bp, phy, 1, 43058, 152); bnx2x_cl45_write(bp, phy, 1, 43064, 64); } else { bnx2x_cl45_write(bp, phy, 1, 43052, 128); bnx2x_cl45_read(bp, phy, 1, 43067, & val); val = (unsigned int )val & 65087U; val = (u16 )((unsigned int )val | 64U); bnx2x_cl45_write(bp, phy, 1, 43067, (int )val); if (phy->type == 4352U) { bnx2x_cl45_write(bp, phy, 1, 43061, 64); if ((int )params->link_flags & 1) { bnx2x_link_int_enable(params); params->link_flags = (unsigned int )params->link_flags & 65534U; } else { } } else { } } goto ldv_47419; } ldv_47419: ; if (((((((((bp->common.chip_id >> 16 == 5770U || bp->common.chip_id >> 16 == 5797U) || bp->common.chip_id >> 16 == 5801U) || bp->common.chip_id >> 16 == 5774U) || bp->common.chip_id >> 16 == 5806U) || bp->common.chip_id >> 16 == 5807U) || ((bp->common.chip_id >> 16 == 5693U || bp->common.chip_id >> 16 == 5694U) || bp->common.chip_id >> 16 == 5695U)) || ((bp->common.chip_id >> 16 == 5793U || bp->common.chip_id >> 16 == 5794U) || bp->common.chip_id >> 16 == 5773U)) || (bp->common.chip_id >> 16 == 5796U || bp->common.chip_id >> 16 == 5803U)) || bp->common.chip_id >> 16 == 5805U) { bnx2x_cl45_read(bp, phy, 3, 33233, & val); } else { } return; } } static void bnx2x_54618se_specific_func(struct bnx2x_phy *phy , struct link_params *params , u32 action ) { struct bnx2x *bp ; u16 temp ; { bp = params->bp; switch (action) { case 3U: bnx2x_cl22_write(bp, phy, 28, 14336); bnx2x_cl22_read(bp, phy, 28, & temp); temp = (unsigned int )temp & 65295U; temp = (u16 )((unsigned int )temp | 96U); bnx2x_cl22_write(bp, phy, 28, (int )((unsigned int )temp | 32768U)); bnx2x_cl22_write(bp, phy, 27, 65533); goto ldv_47431; } ldv_47431: ; return; } } static int bnx2x_54618se_config_init(struct bnx2x_phy *phy , struct link_params *params , struct link_vars *vars ) { struct bnx2x *bp ; u8 port ; u16 autoneg_val ; u16 an_1000_val ; u16 an_10_100_val ; u16 fc_val ; u16 temp ; u32 cfg_pin ; long tmp ; unsigned int tmp___0 ; long tmp___1 ; long tmp___2 ; long tmp___3 ; long tmp___4 ; long tmp___5 ; int rc ; long tmp___6 ; long tmp___7 ; u32 tmp___8 ; long tmp___9 ; long tmp___10 ; u8 tmp___11 ; { bp = params->bp; tmp = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp != 0L) { printk("\rbnx2x: [%s:%d(%s)]54618SE cfg init\n", "bnx2x_54618se_config_init", 10772, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } usleep_range(1000UL, 2000UL); port = params->port; tmp___0 = readl((void const volatile *)(bp->regview + (((unsigned long )params->shmem_base + (unsigned long )port * 400UL) + 116UL))); cfg_pin = (tmp___0 & 65280U) >> 8; bnx2x_set_cfg_pin(bp, cfg_pin, 1U); msleep(50U); bnx2x_cl22_write(bp, phy, 0, 32768); bnx2x_wait_reset_complete(bp, phy, params); msleep(50U); bnx2x_54618se_specific_func(phy, params, 3U); bnx2x_cl22_write(bp, phy, 28, 30720); bnx2x_cl22_read(bp, phy, 28, & temp); temp = (u16 )((unsigned int )temp | 256U); bnx2x_cl22_write(bp, phy, 28, (int )((unsigned int )temp | 32768U)); bnx2x_calc_ieee_aneg_adv(phy, params, & vars->ieee_fc); fc_val = 0U; if (((int )vars->ieee_fc & 256) != 0) { fc_val = (u16 )((unsigned int )fc_val | 2048U); } else { } if (((int )vars->ieee_fc & 384) == 384) { fc_val = (u16 )((unsigned int )fc_val | 1024U); } else { } bnx2x_cl22_read(bp, phy, 9, & an_1000_val); bnx2x_cl22_read(bp, phy, 4, & an_10_100_val); bnx2x_cl22_read(bp, phy, 0, & autoneg_val); autoneg_val = (unsigned int )autoneg_val & 52415U; an_10_100_val = (unsigned int )an_10_100_val & 61983U; if (((unsigned int )phy->req_line_speed == 0U && (phy->speed_cap_mask & 1048576U) != 0U) || (unsigned int )phy->req_line_speed == 1000U) { an_1000_val = (u16 )((unsigned int )an_1000_val | 256U); autoneg_val = (u16 )((unsigned int )autoneg_val | 4608U); if ((unsigned int )phy->req_duplex == 1U) { an_1000_val = (u16 )((unsigned int )an_1000_val | 512U); } else { } tmp___1 = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp___1 != 0L) { printk("\rbnx2x: [%s:%d(%s)]Advertising 1G\n", "bnx2x_54618se_config_init", 10852, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } } else { an_1000_val = (unsigned int )an_1000_val & 64767U; } bnx2x_cl22_write(bp, phy, 9, (int )an_1000_val); bnx2x_cl22_read(bp, phy, 9, & an_1000_val); if ((unsigned int )phy->req_line_speed == 0U && (phy->speed_cap_mask & 786432U) != 0U) { an_10_100_val = (u16 )((unsigned int )an_10_100_val | 128U); autoneg_val = (u16 )((unsigned int )autoneg_val | 4608U); if ((unsigned int )phy->req_duplex == 1U) { an_10_100_val = (u16 )((unsigned int )an_10_100_val | 256U); } else { } tmp___2 = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp___2 != 0L) { printk("\rbnx2x: [%s:%d(%s)]Advertising 100M\n", "bnx2x_54618se_config_init", 10874, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } } else { } if ((unsigned int )phy->req_line_speed == 0U && (phy->speed_cap_mask & 196608U) != 0U) { an_10_100_val = (u16 )((unsigned int )an_10_100_val | 32U); autoneg_val = (u16 )((unsigned int )autoneg_val | 4608U); if ((unsigned int )phy->req_duplex == 1U) { an_10_100_val = (u16 )((unsigned int )an_10_100_val | 64U); } else { } tmp___3 = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp___3 != 0L) { printk("\rbnx2x: [%s:%d(%s)]Advertising 10M\n", "bnx2x_54618se_config_init", 10886, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } } else { } if ((unsigned int )phy->req_line_speed == 100U) { autoneg_val = (u16 )((unsigned int )autoneg_val | 8192U); bnx2x_cl22_write(bp, phy, 24, 33287); tmp___4 = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp___4 != 0L) { printk("\rbnx2x: [%s:%d(%s)]Setting 100M force\n", "bnx2x_54618se_config_init", 10896, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } } else { } if ((unsigned int )phy->req_line_speed == 10U) { bnx2x_cl22_write(bp, phy, 24, 33287); tmp___5 = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp___5 != 0L) { printk("\rbnx2x: [%s:%d(%s)]Setting 10M force\n", "bnx2x_54618se_config_init", 10903, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } } else { } if (((int )phy->flags & 8192) != 0) { tmp___11 = bnx2x_eee_has_cap(params); if ((unsigned int )tmp___11 != 0U) { bnx2x_cl22_write(bp, phy, 23, 3392); bnx2x_cl22_read(bp, phy, 21, & temp); temp = (unsigned int )temp & 65534U; bnx2x_cl22_write(bp, phy, 21, (int )temp); rc = bnx2x_eee_initial_config(params, vars, 2); if (rc != 0) { tmp___6 = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp___6 != 0L) { printk("\rbnx2x: [%s:%d(%s)]Failed to configure EEE timers\n", "bnx2x_54618se_config_init", 10918, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } bnx2x_eee_disable(phy, params, vars); } else if ((int )params->eee_mode < 0 && (unsigned int )phy->req_duplex == 1U) { tmp___8 = bnx2x_eee_calc_timer(params); if (tmp___8 != 0U || (params->eee_mode & 1073741824U) == 0U) { bnx2x_eee_advertise(phy, params, vars, 2); } else { goto _L; } } else { _L: /* CIL Label */ tmp___7 = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp___7 != 0L) { printk("\rbnx2x: [%s:%d(%s)]Don\'t Advertise 1GBase-T EEE\n", "bnx2x_54618se_config_init", 10932, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } bnx2x_eee_disable(phy, params, vars); } } else { goto _L___0; } } else { _L___0: /* CIL Label */ vars->eee_status = vars->eee_status & 4294770688U; if (((int )phy->flags & 8192) != 0) { if ((params->feature_config_flags & 512U) != 0U) { temp = 6U; tmp___9 = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp___9 != 0L) { printk("\rbnx2x: [%s:%d(%s)]Enabling Auto-GrEEEn\n", "bnx2x_54618se_config_init", 10944, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } } else { temp = 0U; tmp___10 = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp___10 != 0L) { printk("\rbnx2x: [%s:%d(%s)]Don\'t Adv. EEE\n", "bnx2x_54618se_config_init", 10947, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } } bnx2x_cl45_write(bp, phy, 7, 60, (int )temp); } else { } } bnx2x_cl22_write(bp, phy, 4, (int )an_10_100_val | (int )fc_val); if ((unsigned int )phy->req_duplex == 1U) { autoneg_val = (u16 )((unsigned int )autoneg_val | 256U); } else { } bnx2x_cl22_write(bp, phy, 0, (int )autoneg_val); return (0); } } static void bnx2x_5461x_set_link_led(struct bnx2x_phy *phy , struct link_params *params , u8 mode ) { struct bnx2x *bp ; u16 temp ; long tmp ; { bp = params->bp; bnx2x_cl22_write(bp, phy, 28, 13312); bnx2x_cl22_read(bp, phy, 28, & temp); temp = (unsigned int )temp & 65280U; tmp = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp != 0L) { printk("\rbnx2x: [%s:%d(%s)]54618x set link led (mode=%x)\n", "bnx2x_5461x_set_link_led", 10982, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )mode); } else { } switch ((int )mode) { case 3: ; case 0: temp = (u16 )((unsigned int )temp | 238U); goto ldv_47457; case 2: temp = (u16 )((unsigned int )temp | 1U); goto ldv_47457; case 1: temp = (u16 )((unsigned int )temp | 255U); goto ldv_47457; default: ; goto ldv_47457; } ldv_47457: bnx2x_cl22_write(bp, phy, 28, (int )((unsigned int )temp | 32768U)); return; } } static void bnx2x_54618se_link_reset(struct bnx2x_phy *phy , struct link_params *params ) { struct bnx2x *bp ; u32 cfg_pin ; u8 port ; unsigned int tmp ; { bp = params->bp; bnx2x_cl22_write(bp, phy, 0, 2048); port = params->port; tmp = readl((void const volatile *)(bp->regview + (((unsigned long )params->shmem_base + (unsigned long )port * 400UL) + 116UL))); cfg_pin = (tmp & 65280U) >> 8; bnx2x_set_cfg_pin(bp, cfg_pin, 0U); return; } } static u8 bnx2x_54618se_read_status(struct bnx2x_phy *phy , struct link_params *params , struct link_vars *vars ) { struct bnx2x *bp ; u16 val ; u8 link_up ; u16 legacy_status ; u16 legacy_speed ; long tmp ; long tmp___0 ; long tmp___1 ; u8 tmp___2 ; { bp = params->bp; link_up = 0U; bnx2x_cl22_read(bp, phy, 25, & legacy_status); tmp = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp != 0L) { printk("\rbnx2x: [%s:%d(%s)]54618SE read_status: 0x%x\n", "bnx2x_54618se_read_status", 11042, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )legacy_status); } else { } bnx2x_cl22_read(bp, phy, 26, & val); link_up = ((int )legacy_status & 4) != 0; if ((unsigned int )link_up != 0U) { legacy_speed = (unsigned int )legacy_status & 1792U; if ((unsigned int )legacy_speed == 1792U) { vars->line_speed = 1000U; vars->duplex = 1U; } else if ((unsigned int )legacy_speed == 1536U) { vars->line_speed = 1000U; vars->duplex = 0U; } else if ((unsigned int )legacy_speed == 1280U) { vars->line_speed = 100U; vars->duplex = 1U; } else if ((unsigned int )legacy_speed == 768U) { vars->line_speed = 100U; vars->duplex = 0U; } else if ((unsigned int )legacy_speed == 512U) { vars->line_speed = 10U; vars->duplex = 1U; } else if ((unsigned int )legacy_speed == 256U) { vars->line_speed = 10U; vars->duplex = 0U; } else { vars->line_speed = 0U; } tmp___0 = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp___0 != 0L) { printk("\rbnx2x: [%s:%d(%s)]Link is up in %dMbps, is_duplex_full= %d\n", "bnx2x_54618se_read_status", 11079, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )vars->line_speed, (unsigned int )vars->duplex == 1U); } else { } bnx2x_cl22_read(bp, phy, 1, & val); if (((int )val & 32) != 0) { vars->link_status = vars->link_status | 64U; } else { } bnx2x_cl22_read(bp, phy, 6, & val); if (((int )val & 1) == 0) { vars->link_status = vars->link_status | 128U; } else { } tmp___1 = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp___1 != 0L) { printk("\rbnx2x: [%s:%d(%s)]BCM54618SE: link speed is %d\n", "bnx2x_54618se_read_status", 11096, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )vars->line_speed); } else { } bnx2x_ext_phy_resolve_fc(phy, params, vars); if ((vars->link_status & 64U) != 0U) { bnx2x_cl22_read(bp, phy, 5, & val); if (((int )val & 32) != 0) { vars->link_status = vars->link_status | 32768U; } else { } if (((int )val & 64) != 0) { vars->link_status = vars->link_status | 16384U; } else { } if (((int )val & 128) != 0) { vars->link_status = vars->link_status | 8192U; } else { } if (((int )val & 256) != 0) { vars->link_status = vars->link_status | 4096U; } else { } if (((int )val & 512) != 0) { vars->link_status = vars->link_status | 2048U; } else { } bnx2x_cl22_read(bp, phy, 10, & val); if (((int )val & 1024) != 0) { vars->link_status = vars->link_status | 1024U; } else { } if (((int )val & 2048) != 0) { vars->link_status = vars->link_status | 512U; } else { } if (((int )phy->flags & 8192) != 0) { tmp___2 = bnx2x_eee_has_cap(params); if ((unsigned int )tmp___2 != 0U) { bnx2x_eee_an_resolve(phy, params, vars); } else { } } else { } } else { } } else { } return (link_up); } } static void bnx2x_54618se_config_loopback(struct bnx2x_phy *phy , struct link_params *params ) { struct bnx2x *bp ; u16 val ; u32 umac_base ; long tmp ; { bp = params->bp; umac_base = (unsigned int )params->port != 0U ? 1442816U : 1441792U; tmp = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp != 0L) { printk("\rbnx2x: [%s:%d(%s)]2PMA/PMD ext_phy_loopback: 54618se\n", "bnx2x_54618se_config_loopback", 11143, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } bnx2x_cl22_write(bp, phy, 9, 6144); bnx2x_cl22_read(bp, phy, 0, & val); val = (unsigned int )val & 53183U; val = (u16 )((unsigned int )val | 320U); bnx2x_cl22_write(bp, phy, 0, (int )val); bnx2x_cl22_write(bp, phy, 24, 7); bnx2x_cl22_read(bp, phy, 24, & val); bnx2x_cl22_write(bp, phy, 24, (int )((unsigned int )val | 33792U)); writel(1U, (void volatile *)bp->regview + (unsigned long )(((int )params->port + 16406) * 4)); writel(10000U, (void volatile *)bp->regview + (unsigned long )(umac_base + 20U)); return; } } static void bnx2x_7101_config_loopback(struct bnx2x_phy *phy , struct link_params *params ) { struct bnx2x *bp ; { bp = params->bp; bnx2x_cl45_write(bp, phy, 4, 49162, 256); return; } } static int bnx2x_7101_config_init(struct bnx2x_phy *phy , struct link_params *params , struct link_vars *vars ) { u16 fw_ver1 ; u16 fw_ver2 ; u16 val ; struct bnx2x *bp ; long tmp ; long tmp___0 ; { bp = params->bp; tmp = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp != 0L) { printk("\rbnx2x: [%s:%d(%s)]Setting the SFX7101 LASI indication\n", "bnx2x_7101_config_init", 11194, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } bnx2x_set_gpio(bp, 2, 1U, (int )params->port); bnx2x_ext_phy_hw_reset(bp, (int )params->port); bnx2x_wait_reset_complete(bp, phy, params); bnx2x_cl45_write(bp, phy, 1, 36866, 1); tmp___0 = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp___0 != 0L) { printk("\rbnx2x: [%s:%d(%s)]Setting the SFX7101 LED to blink on traffic\n", "bnx2x_7101_config_init", 11205, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } bnx2x_cl45_write(bp, phy, 1, 49159, 8); bnx2x_ext_phy_set_pause(params, phy, vars); bnx2x_cl45_read(bp, phy, 7, 0, & val); val = (u16 )((unsigned int )val | 512U); bnx2x_cl45_write(bp, phy, 7, 0, (int )val); bnx2x_cl45_read(bp, phy, 1, 49190, & fw_ver1); bnx2x_cl45_read(bp, phy, 1, 49191, & fw_ver2); bnx2x_save_spirom_version(bp, (int )params->port, (unsigned int )(((int )fw_ver1 << 16) | (int )fw_ver2), phy->ver_addr); return (0); } } static u8 bnx2x_7101_read_status(struct bnx2x_phy *phy , struct link_params *params , struct link_vars *vars ) { struct bnx2x *bp ; u8 link_up ; u16 val1 ; u16 val2 ; long tmp ; long tmp___0 ; long tmp___1 ; { bp = params->bp; bnx2x_cl45_read(bp, phy, 1, 36869, & val2); bnx2x_cl45_read(bp, phy, 1, 36869, & val1); tmp = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp != 0L) { printk("\rbnx2x: [%s:%d(%s)]10G-base-T LASI status 0x%x->0x%x\n", "bnx2x_7101_read_status", 11240, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )val2, (int )val1); } else { } bnx2x_cl45_read(bp, phy, 1, 1, & val2); bnx2x_cl45_read(bp, phy, 1, 1, & val1); tmp___0 = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp___0 != 0L) { printk("\rbnx2x: [%s:%d(%s)]10G-base-T PMA status 0x%x->0x%x\n", "bnx2x_7101_read_status", 11246, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )val2, (int )val1); } else { } link_up = ((int )val1 & 4) != 0; if ((unsigned int )link_up != 0U) { bnx2x_cl45_read(bp, phy, 7, 33, & val2); vars->line_speed = 10000U; vars->duplex = 1U; tmp___1 = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp___1 != 0L) { printk("\rbnx2x: [%s:%d(%s)]SFX7101 AN status 0x%x->Master=%x\n", "bnx2x_7101_read_status", 11256, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )val2, (int )val2 & 16384); } else { } bnx2x_ext_phy_10G_an_resolve(bp, phy, vars); bnx2x_ext_phy_resolve_fc(phy, params, vars); if (((int )val2 & 2048) != 0) { vars->link_status = vars->link_status | 8388608U; } else { } } else { } return (link_up); } } static int bnx2x_7101_format_ver(u32 spirom_ver , u8 *str , u16 *len ) { { if ((unsigned int )*len <= 4U) { return (-22); } else { } *str = (u8 )spirom_ver; *(str + 1UL) = (u8 )((spirom_ver & 65280U) >> 8); *(str + 2UL) = (u8 )((spirom_ver & 16711680U) >> 16); *(str + 3UL) = (u8 )(spirom_ver >> 24); *(str + 4UL) = 0U; *len = (unsigned int )*len + 65531U; return (0); } } void bnx2x_sfx7101_sp_sw_reset(struct bnx2x *bp , struct bnx2x_phy *phy ) { u16 val ; u16 cnt ; { bnx2x_cl45_read(bp, phy, 1, 49152, & val); cnt = 0U; goto ldv_47525; ldv_47524: msleep(50U); bnx2x_cl45_write(bp, phy, 1, 49152, (int )((unsigned int )val | 32768U)); bnx2x_cl45_read(bp, phy, 1, 49152, & val); if ((int )((short )val) >= 0) { goto ldv_47523; } else { } cnt = (u16 )((int )cnt + 1); ldv_47525: ; if ((unsigned int )cnt <= 9U) { goto ldv_47524; } else { } ldv_47523: ; return; } } static void bnx2x_7101_hw_reset(struct bnx2x_phy *phy , struct link_params *params ) { { bnx2x_set_gpio(params->bp, 2, 0U, (int )params->port); bnx2x_set_gpio(params->bp, 1, 0U, (int )params->port); return; } } static void bnx2x_7101_set_link_led(struct bnx2x_phy *phy , struct link_params *params , u8 mode ) { u16 val ; struct bnx2x *bp ; { val = 0U; bp = params->bp; switch ((int )mode) { case 3: ; case 0: val = 2U; goto ldv_47539; case 1: val = 1U; goto ldv_47539; case 2: val = 0U; goto ldv_47539; } ldv_47539: bnx2x_cl45_write(bp, phy, 1, 49161, (int )val); return; } } static struct bnx2x_phy const phy_null = {65280U, 0U, 0U, 8U, {65535U, 65535U, 65535U, 65535U}, {65535U, 65535U, 65535U, 65535U}, 0U, 0U, 255U, 0U, 0U, 0U, 0U, 0U, 0U, 0, 0, 0, 0, 0, 0, 0, 0}; static struct bnx2x_phy const phy_serdes = {0U, 255U, 0U, 0U, {65535U, 65535U, 65535U, 65535U}, {65535U, 65535U, 65535U, 65535U}, 0U, 57583U, 4U, 0U, 0U, 0U, 0U, 0U, 0U, (u8 (*)(struct bnx2x_phy * , struct link_params * , struct link_vars * ))(& bnx2x_xgxs_config_init), (u8 (*)(struct bnx2x_phy * , struct link_params * , struct link_vars * ))(& bnx2x_link_settings_status), & bnx2x_int_link_reset, 0, 0, 0, 0, 0}; static struct bnx2x_phy const phy_xgxs = {0U, 255U, 0U, 0U, {65535U, 65535U, 65535U, 65535U}, {65535U, 65535U, 65535U, 65535U}, 0U, 62575U, 241U, 0U, 0U, 0U, 0U, 0U, 0U, (u8 (*)(struct bnx2x_phy * , struct link_params * , struct link_vars * ))(& bnx2x_xgxs_config_init), (u8 (*)(struct bnx2x_phy * , struct link_params * , struct link_vars * ))(& bnx2x_link_settings_status), & bnx2x_int_link_reset, & bnx2x_set_xgxs_loopback, 0, 0, 0, & bnx2x_xgxs_specific_func}; static struct bnx2x_phy const phy_warpcore = {0U, 255U, 0U, 4096U, {65535U, 65535U, 65535U, 65535U}, {65535U, 65535U, 65535U, 65535U}, 0U, 6321263U, 0U, 0U, 0U, 0U, 0U, 0U, 0U, (u8 (*)(struct bnx2x_phy * , struct link_params * , struct link_vars * ))(& bnx2x_warpcore_config_init), (u8 (*)(struct bnx2x_phy * , struct link_params * , struct link_vars * ))(& bnx2x_warpcore_read_status), & bnx2x_warpcore_link_reset, & bnx2x_set_warpcore_loopback, 0, & bnx2x_warpcore_hw_reset, 0, 0}; static struct bnx2x_phy const phy_7101 = {2048U, 255U, 0U, 4U, {65535U, 65535U, 65535U, 65535U}, {65535U, 65535U, 65535U, 65535U}, 0U, 28864U, 4U, 0U, 0U, 0U, 0U, 0U, 0U, (u8 (*)(struct bnx2x_phy * , struct link_params * , struct link_vars * ))(& bnx2x_7101_config_init), & bnx2x_7101_read_status, & bnx2x_common_ext_link_reset, & bnx2x_7101_config_loopback, (u8 (*)(u32 , u8 * , u16 * ))(& bnx2x_7101_format_ver), & bnx2x_7101_hw_reset, & bnx2x_7101_set_link_led, 0}; static struct bnx2x_phy const phy_8073 = {768U, 255U, 0U, 0U, {65535U, 65535U, 65535U, 65535U}, {65535U, 65535U, 65535U, 65535U}, 0U, 62560U, 240U, 0U, 0U, 0U, 0U, 0U, 0U, (u8 (*)(struct bnx2x_phy * , struct link_params * , struct link_vars * ))(& bnx2x_8073_config_init), & bnx2x_8073_read_status, & bnx2x_8073_link_reset, 0, (u8 (*)(u32 , u8 * , u16 * ))(& bnx2x_format_ver), 0, 0, & bnx2x_8073_specific_func}; static struct bnx2x_phy const phy_8705 = {1024U, 255U, 0U, 8U, {65535U, 65535U, 65535U, 65535U}, {65535U, 65535U, 65535U, 65535U}, 0U, 29696U, 2U, 0U, 0U, 0U, 0U, 0U, 0U, (u8 (*)(struct bnx2x_phy * , struct link_params * , struct link_vars * ))(& bnx2x_8705_config_init), & bnx2x_8705_read_status, & bnx2x_common_ext_link_reset, 0, (u8 (*)(u32 , u8 * , u16 * ))(& bnx2x_null_format_ver), 0, 0, 0}; static struct bnx2x_phy const phy_8706 = {1280U, 255U, 0U, 8U, {65535U, 65535U, 65535U, 65535U}, {65535U, 65535U, 65535U, 65535U}, 0U, 29728U, 1U, 0U, 0U, 0U, 0U, 0U, 0U, & bnx2x_8706_config_init, (u8 (*)(struct bnx2x_phy * , struct link_params * , struct link_vars * ))(& bnx2x_8706_read_status), & bnx2x_common_ext_link_reset, 0, (u8 (*)(u32 , u8 * , u16 * ))(& bnx2x_format_ver), 0, 0, 0}; static struct bnx2x_phy const phy_8726 = {1536U, 255U, 0U, 4104U, {65535U, 65535U, 65535U, 65535U}, {65535U, 65535U, 65535U, 65535U}, 0U, 29792U, 255U, 0U, 0U, 0U, 0U, 0U, 0U, (u8 (*)(struct bnx2x_phy * , struct link_params * , struct link_vars * ))(& bnx2x_8726_config_init), & bnx2x_8726_read_status, & bnx2x_8726_link_reset, & bnx2x_8726_config_loopback, (u8 (*)(u32 , u8 * , u16 * ))(& bnx2x_format_ver), 0, 0, 0}; static struct bnx2x_phy const phy_8727 = {2304U, 255U, 0U, 4100U, {65535U, 65535U, 65535U, 65535U}, {65535U, 65535U, 65535U, 65535U}, 0U, 29728U, 255U, 0U, 0U, 0U, 0U, 0U, 0U, (u8 (*)(struct bnx2x_phy * , struct link_params * , struct link_vars * ))(& bnx2x_8727_config_init), & bnx2x_8727_read_status, & bnx2x_8727_link_reset, 0, (u8 (*)(u32 , u8 * , u16 * ))(& bnx2x_format_ver), & bnx2x_8727_hw_reset, & bnx2x_8727_set_link_led, & bnx2x_8727_specific_func}; static struct bnx2x_phy const phy_8481 = {1792U, 255U, 0U, 68U, {65535U, 65535U, 65535U, 65535U}, {65535U, 65535U, 65535U, 65535U}, 0U, 28911U, 4U, 0U, 0U, 0U, 0U, 0U, 0U, (u8 (*)(struct bnx2x_phy * , struct link_params * , struct link_vars * ))(& bnx2x_8481_config_init), & bnx2x_848xx_read_status, & bnx2x_8481_link_reset, 0, (u8 (*)(u32 , u8 * , u16 * ))(& bnx2x_848xx_format_ver), & bnx2x_8481_hw_reset, & bnx2x_848xx_set_link_led, 0}; static struct bnx2x_phy const phy_84823 = {2816U, 255U, 0U, 4164U, {65535U, 65535U, 65535U, 65535U}, {65535U, 65535U, 65535U, 65535U}, 0U, 28911U, 4U, 0U, 0U, 0U, 0U, 0U, 0U, (u8 (*)(struct bnx2x_phy * , struct link_params * , struct link_vars * ))(& bnx2x_848x3_config_init), & bnx2x_848xx_read_status, & bnx2x_848x3_link_reset, 0, (u8 (*)(u32 , u8 * , u16 * ))(& bnx2x_848xx_format_ver), 0, & bnx2x_848xx_set_link_led, & bnx2x_848xx_specific_func}; static struct bnx2x_phy const phy_84833 = {3328U, 255U, 0U, 4164U, {65535U, 65535U, 65535U, 65535U}, {65535U, 65535U, 65535U, 65535U}, 0U, 28908U, 4U, 0U, 0U, 0U, 0U, 0U, 0U, (u8 (*)(struct bnx2x_phy * , struct link_params * , struct link_vars * ))(& bnx2x_848x3_config_init), & bnx2x_848xx_read_status, & bnx2x_848x3_link_reset, 0, (u8 (*)(u32 , u8 * , u16 * ))(& bnx2x_848xx_format_ver), (void (*)(struct bnx2x_phy * , struct link_params * ))(& bnx2x_84833_hw_reset_phy), & bnx2x_848xx_set_link_led, & bnx2x_848xx_specific_func}; static struct bnx2x_phy const phy_84834 = {4352U, 255U, 0U, 68U, {65535U, 65535U, 65535U, 65535U}, {65535U, 65535U, 65535U, 65535U}, 0U, 28908U, 4U, 0U, 0U, 0U, 0U, 0U, 0U, (u8 (*)(struct bnx2x_phy * , struct link_params * , struct link_vars * ))(& bnx2x_848x3_config_init), & bnx2x_848xx_read_status, & bnx2x_848x3_link_reset, 0, (u8 (*)(u32 , u8 * , u16 * ))(& bnx2x_848xx_format_ver), (void (*)(struct bnx2x_phy * , struct link_params * ))(& bnx2x_84833_hw_reset_phy), & bnx2x_848xx_set_link_led, & bnx2x_848xx_specific_func}; static struct bnx2x_phy const phy_54618se = {3584U, 255U, 0U, 8U, {65535U, 65535U, 65535U, 65535U}, {65535U, 65535U, 65535U, 65535U}, 0U, 24815U, 4U, 0U, 0U, 0U, 0U, 0U, 0U, (u8 (*)(struct bnx2x_phy * , struct link_params * , struct link_vars * ))(& bnx2x_54618se_config_init), & bnx2x_54618se_read_status, & bnx2x_54618se_link_reset, & bnx2x_54618se_config_loopback, 0, 0, & bnx2x_5461x_set_link_led, & bnx2x_54618se_specific_func}; static void bnx2x_populate_preemphasis(struct bnx2x *bp , u32 shmem_base , struct bnx2x_phy *phy , u8 port , u8 phy_index ) { u32 rx ; u32 tx ; u32 i ; { rx = 0U; tx = 0U; i = 0U; goto ldv_47568; ldv_47567: ; if ((unsigned int )phy_index == 0U || (unsigned int )phy_index == 1U) { rx = readl((void const volatile *)(bp->regview + ((unsigned long )shmem_base + (((unsigned long )port * 200UL + (unsigned long )(i << 1)) + 80UL) * 2UL))); tx = readl((void const volatile *)(bp->regview + ((unsigned long )shmem_base + (((unsigned long )port * 200UL + (unsigned long )(i << 1)) + 84UL) * 2UL))); } else { rx = readl((void const volatile *)(bp->regview + ((unsigned long )shmem_base + (((unsigned long )port * 200UL + (unsigned long )(i << 1)) + 208UL) * 2UL))); tx = readl((void const volatile *)(bp->regview + ((unsigned long )shmem_base + (((unsigned long )port * 200UL + (unsigned long )(i << 1)) + 208UL) * 2UL))); } phy->rx_preemphasis[i << 1] = (u16 )(rx >> 16); phy->rx_preemphasis[(i << 1) + 1U] = (u16 )rx; phy->tx_preemphasis[i << 1] = (u16 )(tx >> 16); phy->tx_preemphasis[(i << 1) + 1U] = (u16 )tx; i = i + 1U; ldv_47568: ; if (i <= 1U) { goto ldv_47567; } else { } return; } } static u32 bnx2x_get_ext_phy_config(struct bnx2x *bp , u32 shmem_base , u8 phy_index , u8 port ) { u32 ext_phy_config ; long tmp ; { ext_phy_config = 0U; switch ((int )phy_index) { case 1: ext_phy_config = readl((void const volatile *)(bp->regview + (((unsigned long )shmem_base + (unsigned long )port * 400UL) + 436UL))); goto ldv_47578; case 2: ext_phy_config = readl((void const volatile *)(bp->regview + (((unsigned long )shmem_base + (unsigned long )port * 400UL) + 412UL))); goto ldv_47578; default: tmp = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp != 0L) { printk("\rbnx2x: [%s:%d(%s)]Invalid phy_index %d\n", "bnx2x_get_ext_phy_config", 11891, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )phy_index); } else { } return (4294967274U); } ldv_47578: ; return (ext_phy_config); } } static int bnx2x_populate_int_phy(struct bnx2x *bp , u32 shmem_base , u8 port , struct bnx2x_phy *phy ) { u32 phy_addr ; u32 chip_id ; u32 switch_cfg ; unsigned int tmp ; unsigned int tmp___0 ; unsigned int tmp___1 ; long tmp___2 ; u32 serdes_net_if ; unsigned int tmp___3 ; unsigned int tmp___4 ; long tmp___5 ; long tmp___6 ; long tmp___7 ; { tmp = readl((void const volatile *)(bp->regview + (((unsigned long )shmem_base + (unsigned long )port * 116UL) + 888UL))); switch_cfg = tmp & 50331648U; tmp___0 = readl((void const volatile *)bp->regview + 41992U); tmp___1 = readl((void const volatile *)bp->regview + 41996U); chip_id = (tmp___0 << 16) | ((tmp___1 << 12) & 65535U); tmp___2 = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp___2 != 0L) { printk("\rbnx2x: [%s:%d(%s)]:chip_id = 0x%x\n", "bnx2x_populate_int_phy", 11909, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", chip_id); } else { } if (((((((((bp->common.chip_id >> 16 == 5770U || bp->common.chip_id >> 16 == 5797U) || bp->common.chip_id >> 16 == 5801U) || bp->common.chip_id >> 16 == 5774U) || bp->common.chip_id >> 16 == 5806U) || bp->common.chip_id >> 16 == 5807U) || ((bp->common.chip_id >> 16 == 5693U || bp->common.chip_id >> 16 == 5694U) || bp->common.chip_id >> 16 == 5695U)) || ((bp->common.chip_id >> 16 == 5793U || bp->common.chip_id >> 16 == 5794U) || bp->common.chip_id >> 16 == 5773U)) || (bp->common.chip_id >> 16 == 5796U || bp->common.chip_id >> 16 == 5803U)) || bp->common.chip_id >> 16 == 5805U) { phy_addr = readl((void const volatile *)bp->regview + 43468U); *phy = phy_warpcore; tmp___3 = readl((void const volatile *)bp->regview + 42784U); if (tmp___3 == 3U) { phy->flags = (u16 )((unsigned int )phy->flags | 32U); } else { phy->flags = (unsigned int )phy->flags & 65503U; } tmp___4 = readl((void const volatile *)(bp->regview + ((unsigned long )shmem_base + ((unsigned long )port + 1UL) * 400UL))); serdes_net_if = tmp___4 & 251658240U; switch (serdes_net_if) { case 0U: phy->supported = phy->supported & 25711U; phy->media_type = 4U; goto ldv_47594; case 16777216U: phy->supported = phy->supported & 29728U; phy->media_type = 2U; goto ldv_47594; case 33554432U: phy->supported = phy->supported & 29728U; phy->media_type = 1U; goto ldv_47594; case 50331648U: phy->media_type = 240U; phy->supported = phy->supported & 29792U; goto ldv_47594; case 67108864U: phy->media_type = 240U; phy->flags = (u16 )((unsigned int )phy->flags | 16U); phy->supported = phy->supported & 2122752U; goto ldv_47594; case 83886080U: phy->media_type = 240U; phy->flags = (u16 )((unsigned int )phy->flags | 16U); phy->supported = phy->supported & 4224096U; phy->flags = (unsigned int )phy->flags & 61439U; goto ldv_47594; default: tmp___5 = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp___5 != 0L) { printk("\rbnx2x: [%s:%d(%s)]Unknown WC interface type 0x%x\n", "bnx2x_populate_int_phy", 11987, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", serdes_net_if); } else { } goto ldv_47594; } ldv_47594: ; if ((bp->common.chip_id & 61440U) > 20480U ? ((~ bp->common.chip_id & 61440U) >> 13) << 12 == 0U : (bp->common.chip_id & 61440U) == 0U) { phy->flags = (u16 )((unsigned int )phy->flags | 256U); } else { phy->flags = (u16 )((unsigned int )phy->flags | 1024U); } } else { switch (switch_cfg) { case 0U: phy_addr = readl((void const volatile *)bp->regview + (unsigned long )((int )port * 16 + 66420)); *phy = phy_serdes; goto ldv_47602; case 16777216U: phy_addr = readl((void const volatile *)bp->regview + (unsigned long )((int )port * 24 + 66368)); *phy = phy_xgxs; goto ldv_47602; default: tmp___6 = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp___6 != 0L) { printk("\rbnx2x: [%s:%d(%s)]Invalid switch_cfg\n", "bnx2x_populate_int_phy", 12014, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } return (-22); } ldv_47602: ; } phy->addr = (unsigned char )phy_addr; phy->mdio_ctrl = bnx2x_get_emac_base(bp, 201326592U, (int )port); if ((bp->common.chip_id >> 16 == 5730U || bp->common.chip_id >> 16 == 5731U) || bp->common.chip_id >> 16 == 5743U) { phy->def_md_devad = 5U; } else { phy->def_md_devad = 3U; } tmp___7 = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp___7 != 0L) { printk("\rbnx2x: [%s:%d(%s)]Internal phy port=%d, addr=0x%x, mdio_ctl=0x%x\n", "bnx2x_populate_int_phy", 12028, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )port, (int )phy->addr, phy->mdio_ctrl); } else { } bnx2x_populate_preemphasis(bp, shmem_base, phy, (int )port, 0); return (0); } } static int bnx2x_populate_ext_phy(struct bnx2x *bp , u8 phy_index , u32 shmem_base , u32 shmem2_base , u8 port , struct bnx2x_phy *phy ) { u32 ext_phy_config ; u32 phy_type ; u32 config2 ; u32 mdc_mdio_access ; u32 size ; unsigned int tmp ; u32 raw_ver ; unsigned int tmp___0 ; long tmp___1 ; long tmp___2 ; { mdc_mdio_access = 201326592U; ext_phy_config = bnx2x_get_ext_phy_config(bp, shmem_base, (int )phy_index, (int )port); phy_type = ext_phy_config & 65280U; switch (phy_type) { case 768U: mdc_mdio_access = 268435456U; *phy = phy_8073; goto ldv_47618; case 1024U: *phy = phy_8705; goto ldv_47618; case 1280U: *phy = phy_8706; goto ldv_47618; case 1536U: mdc_mdio_access = 134217728U; *phy = phy_8726; goto ldv_47618; case 2560U: mdc_mdio_access = 134217728U; *phy = phy_8727; phy->flags = (u16 )((unsigned int )phy->flags | 2U); goto ldv_47618; case 3840U: ; case 2304U: mdc_mdio_access = 134217728U; *phy = phy_8727; goto ldv_47618; case 1792U: *phy = phy_8481; goto ldv_47618; case 2816U: *phy = phy_84823; goto ldv_47618; case 3328U: *phy = phy_84833; goto ldv_47618; case 4352U: *phy = phy_84834; goto ldv_47618; case 4096U: ; case 3584U: *phy = phy_54618se; if (phy_type == 3584U) { phy->flags = (u16 )((unsigned int )phy->flags | 8192U); } else { } goto ldv_47618; case 2048U: *phy = phy_7101; goto ldv_47618; case 64768U: *phy = phy_null; return (-22); default: *phy = phy_null; if (phy_type != 0U && phy_type != 65280U) { return (-22); } else { } return (0); } ldv_47618: phy->addr = (u8 )ext_phy_config; bnx2x_populate_preemphasis(bp, shmem_base, phy, (int )port, (int )phy_index); config2 = readl((void const volatile *)(bp->regview + ((unsigned long )shmem_base + 32UL))); if ((unsigned int )phy_index == 1U) { phy->ver_addr = (u32 )((unsigned long )port + 103UL) * 16U + shmem_base; if ((config2 & 469762048U) != 0U) { mdc_mdio_access = config2 & 469762048U; } else { } } else { tmp = readl((void const volatile *)bp->regview + (unsigned long )shmem2_base); size = tmp; if (size > 8U) { phy->ver_addr = (u32 )((unsigned long )port + 2UL) * 4U + shmem2_base; } else { } if ((config2 & 3758096384U) != 0U) { mdc_mdio_access = (config2 & 3758096384U) >> 3; } else { } } phy->mdio_ctrl = bnx2x_get_emac_base(bp, mdc_mdio_access, (int )port); if ((phy->type == 3328U || phy->type == 4352U) && phy->ver_addr != 0U) { tmp___0 = readl((void const volatile *)bp->regview + (unsigned long )phy->ver_addr); raw_ver = tmp___0; if ((raw_ver & 127U) <= 39U && (raw_ver & 3968U) >> 7 <= 1U) { phy->supported = phy->supported & 4294967283U; } else { } } else { } tmp___1 = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp___1 != 0L) { printk("\rbnx2x: [%s:%d(%s)]phy_type 0x%x port %d found in index %d\n", "bnx2x_populate_ext_phy", 12155, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", phy_type, (int )port, (int )phy_index); } else { } tmp___2 = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp___2 != 0L) { printk("\rbnx2x: [%s:%d(%s)] addr=0x%x, mdio_ctl=0x%x\n", "bnx2x_populate_ext_phy", 12157, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )phy->addr, phy->mdio_ctrl); } else { } return (0); } } static int bnx2x_populate_phy(struct bnx2x *bp , u8 phy_index , u32 shmem_base , u32 shmem2_base , u8 port , struct bnx2x_phy *phy ) { int status ; int tmp ; { status = 0; phy->type = 65280U; if ((unsigned int )phy_index == 0U) { tmp = bnx2x_populate_int_phy(bp, shmem_base, (int )port, phy); return (tmp); } else { } status = bnx2x_populate_ext_phy(bp, (int )phy_index, shmem_base, shmem2_base, (int )port, phy); return (status); } } static void bnx2x_phy_def_cfg(struct link_params *params , struct bnx2x_phy *phy , u8 phy_index ) { struct bnx2x *bp ; u32 link_config ; long tmp ; { bp = params->bp; if ((unsigned int )phy_index == 2U) { link_config = readl((void const volatile *)(bp->regview + (((unsigned long )params->shmem_base + (unsigned long )params->port * 116UL) + 896UL))); phy->speed_cap_mask = readl((void const volatile *)(bp->regview + (((unsigned long )params->shmem_base + (unsigned long )params->port * 400UL) + 404UL))); } else { link_config = readl((void const volatile *)(bp->regview + (((unsigned long )params->shmem_base + (unsigned long )params->port * 116UL) + 888UL))); phy->speed_cap_mask = readl((void const volatile *)(bp->regview + (((unsigned long )params->shmem_base + (unsigned long )params->port * 400UL) + 440UL))); } tmp = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp != 0L) { printk("\rbnx2x: [%s:%d(%s)]Default config phy idx %x cfg 0x%x speed_cap_mask 0x%x\n", "bnx2x_phy_def_cfg", 12199, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )phy_index, link_config, phy->speed_cap_mask); } else { } phy->req_duplex = 1U; switch (link_config & 983040U) { case 131072U: phy->req_duplex = 0U; case 65536U: phy->req_line_speed = 10U; goto ldv_47656; case 196608U: phy->req_duplex = 0U; case 262144U: phy->req_line_speed = 100U; goto ldv_47656; case 327680U: phy->req_line_speed = 1000U; goto ldv_47656; case 393216U: phy->req_line_speed = 2500U; goto ldv_47656; case 458752U: phy->req_line_speed = 10000U; goto ldv_47656; default: phy->req_line_speed = 0U; goto ldv_47656; } ldv_47656: ; switch (link_config & 1792U) { case 0U: phy->req_flow_ctrl = 0U; goto ldv_47664; case 256U: phy->req_flow_ctrl = 256U; goto ldv_47664; case 512U: phy->req_flow_ctrl = 512U; goto ldv_47664; case 768U: phy->req_flow_ctrl = 768U; goto ldv_47664; default: phy->req_flow_ctrl = 1024U; goto ldv_47664; } ldv_47664: ; return; } } u32 bnx2x_phy_selection(struct link_params *params ) { u32 phy_config_swapped ; u32 prio_cfg ; u32 return_cfg ; { return_cfg = 0U; phy_config_swapped = params->multi_phy_config & 8U; prio_cfg = params->multi_phy_config & 7U; if (phy_config_swapped != 0U) { switch (prio_cfg) { case 3U: return_cfg = 4U; goto ldv_47676; case 4U: return_cfg = 3U; goto ldv_47676; case 2U: return_cfg = 1U; goto ldv_47676; case 1U: return_cfg = 2U; goto ldv_47676; } ldv_47676: ; } else { return_cfg = prio_cfg; } return (return_cfg); } } int bnx2x_phy_probe(struct link_params *params ) { u8 phy_index ; u8 actual_phy_idx ; u32 phy_config_swapped ; u32 sync_offset ; u32 media_types ; struct bnx2x *bp ; struct bnx2x_phy *phy ; long tmp ; long tmp___0 ; long tmp___1 ; int tmp___2 ; long tmp___3 ; { bp = params->bp; params->num_phys = 0U; tmp = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp != 0L) { printk("\rbnx2x: [%s:%d(%s)]Begin phy probe\n", "bnx2x_phy_probe", 12285, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } phy_config_swapped = params->multi_phy_config & 8U; phy_index = 0U; goto ldv_47696; ldv_47695: actual_phy_idx = phy_index; if (phy_config_swapped != 0U) { if ((unsigned int )phy_index == 1U) { actual_phy_idx = 2U; } else if ((unsigned int )phy_index == 2U) { actual_phy_idx = 1U; } else { } } else { } tmp___0 = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp___0 != 0L) { printk("\rbnx2x: [%s:%d(%s)]phy_config_swapped %x, phy_index %x, actual_phy_idx %x\n", "bnx2x_phy_probe", 12300, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", phy_config_swapped, (int )phy_index, (int )actual_phy_idx); } else { } phy = (struct bnx2x_phy *)(& params->phy) + (unsigned long )actual_phy_idx; tmp___2 = bnx2x_populate_phy(bp, (int )phy_index, params->shmem_base, params->shmem2_base, (int )params->port, phy); if (tmp___2 != 0) { params->num_phys = 0U; tmp___1 = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp___1 != 0L) { printk("\rbnx2x: [%s:%d(%s)]phy probe failed in phy index %d\n", "bnx2x_phy_probe", 12307, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )phy_index); } else { } phy_index = 0U; goto ldv_47692; ldv_47691: *phy = phy_null; phy_index = (u8 )((int )phy_index + 1); ldv_47692: ; if ((unsigned int )phy_index <= 2U) { goto ldv_47691; } else { } return (-22); } else { } if (phy->type == 65280U) { goto ldv_47694; } else { } if ((params->feature_config_flags & 2048U) != 0U) { phy->flags = (unsigned int )phy->flags & 61439U; } else { } if ((params->feature_config_flags & 8192U) == 0U) { phy->flags = (u16 )((unsigned int )phy->flags | 32768U); } else { } sync_offset = (params->shmem_base + (u32 )params->port * 400U) + 156U; media_types = readl((void const volatile *)bp->regview + (unsigned long )sync_offset); if (((u32 )(255 << (int )actual_phy_idx * 8) & media_types) == 0U) { media_types = ((phy->media_type & 255U) << (int )actual_phy_idx * 8) | media_types; } else { } writel(media_types, (void volatile *)bp->regview + (unsigned long )sync_offset); bnx2x_phy_def_cfg(params, phy, (int )phy_index); params->num_phys = (u8 )((int )params->num_phys + 1); phy_index = (u8 )((int )phy_index + 1); ldv_47696: ; if ((unsigned int )phy_index <= 2U) { goto ldv_47695; } else { } ldv_47694: tmp___3 = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp___3 != 0L) { printk("\rbnx2x: [%s:%d(%s)]End phy probe. #phys found %x\n", "bnx2x_phy_probe", 12348, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )params->num_phys); } else { } return (0); } } static void bnx2x_init_bmac_loopback(struct link_params *params , struct link_vars *vars ) { struct bnx2x *bp ; { bp = params->bp; vars->link_up = 1U; vars->line_speed = 10000U; vars->duplex = 1U; vars->flow_ctrl = 1024U; vars->mac_type = 2U; vars->phy_flags = 1U; bnx2x_xgxs_deassert(params); bnx2x_bmac_enable(params, vars, 1, 1); writel(0U, (void volatile *)bp->regview + (unsigned long )(((int )params->port + 16408) * 4)); return; } } static void bnx2x_init_emac_loopback(struct link_params *params , struct link_vars *vars ) { struct bnx2x *bp ; { bp = params->bp; vars->link_up = 1U; vars->line_speed = 1000U; vars->duplex = 1U; vars->flow_ctrl = 1024U; vars->mac_type = 1U; vars->phy_flags = 1U; bnx2x_xgxs_deassert(params); bnx2x_emac_enable(params, vars, 1); bnx2x_emac_program(params, vars); writel(0U, (void volatile *)bp->regview + (unsigned long )(((int )params->port + 16408) * 4)); return; } } static void bnx2x_init_xmac_loopback(struct link_params *params , struct link_vars *vars ) { struct bnx2x *bp ; { bp = params->bp; vars->link_up = 1U; if ((unsigned int )params->req_line_speed[0] == 0U) { vars->line_speed = 10000U; } else { vars->line_speed = params->req_line_speed[0]; } vars->duplex = 1U; vars->flow_ctrl = 1024U; vars->mac_type = 4U; vars->phy_flags = 1U; bnx2x_set_aer_mmd(params, (struct bnx2x_phy *)(& params->phy)); bnx2x_warpcore_reset_lane(bp, (struct bnx2x_phy *)(& params->phy), 0); (*(params->phy[0].config_loopback))((struct bnx2x_phy *)(& params->phy), params); bnx2x_xmac_enable(params, vars, 1); writel(0U, (void volatile *)bp->regview + (unsigned long )(((int )params->port + 16408) * 4)); return; } } static void bnx2x_init_umac_loopback(struct link_params *params , struct link_vars *vars ) { struct bnx2x *bp ; { bp = params->bp; vars->link_up = 1U; vars->line_speed = 1000U; vars->duplex = 1U; vars->flow_ctrl = 1024U; vars->mac_type = 3U; vars->phy_flags = 1U; bnx2x_umac_enable(params, vars, 1); writel(0U, (void volatile *)bp->regview + (unsigned long )(((int )params->port + 16408) * 4)); return; } } static void bnx2x_init_xgxs_loopback(struct link_params *params , struct link_vars *vars ) { struct bnx2x *bp ; struct bnx2x_phy *int_phy ; u8 phy_index ; { bp = params->bp; int_phy = (struct bnx2x_phy *)(& params->phy); vars->link_up = 1U; vars->flow_ctrl = 1024U; vars->duplex = 1U; if ((unsigned int )params->req_line_speed[0] == 1000U) { vars->line_speed = 1000U; } else if ((unsigned int )params->req_line_speed[0] == 20000U || ((int )int_phy->flags & 16) != 0) { vars->line_speed = 20000U; } else { vars->line_speed = 10000U; } if (((((((((bp->common.chip_id >> 16 != 5770U && bp->common.chip_id >> 16 != 5797U) && bp->common.chip_id >> 16 != 5801U) && bp->common.chip_id >> 16 != 5774U) && bp->common.chip_id >> 16 != 5806U) && bp->common.chip_id >> 16 != 5807U) && ((bp->common.chip_id >> 16 != 5693U && bp->common.chip_id >> 16 != 5694U) && bp->common.chip_id >> 16 != 5695U)) && ((bp->common.chip_id >> 16 != 5793U && bp->common.chip_id >> 16 != 5794U) && bp->common.chip_id >> 16 != 5773U)) && (bp->common.chip_id >> 16 != 5796U && bp->common.chip_id >> 16 != 5803U)) && bp->common.chip_id >> 16 != 5805U) { bnx2x_xgxs_deassert(params); } else { } bnx2x_link_initialize(params, vars); if ((unsigned int )params->req_line_speed[0] == 1000U) { if (((((((((bp->common.chip_id >> 16 == 5770U || bp->common.chip_id >> 16 == 5797U) || bp->common.chip_id >> 16 == 5801U) || bp->common.chip_id >> 16 == 5774U) || bp->common.chip_id >> 16 == 5806U) || bp->common.chip_id >> 16 == 5807U) || ((bp->common.chip_id >> 16 == 5693U || bp->common.chip_id >> 16 == 5694U) || bp->common.chip_id >> 16 == 5695U)) || ((bp->common.chip_id >> 16 == 5793U || bp->common.chip_id >> 16 == 5794U) || bp->common.chip_id >> 16 == 5773U)) || (bp->common.chip_id >> 16 == 5796U || bp->common.chip_id >> 16 == 5803U)) || bp->common.chip_id >> 16 == 5805U) { bnx2x_umac_enable(params, vars, 0); } else { bnx2x_emac_program(params, vars); bnx2x_emac_enable(params, vars, 0); } } else if (((((((((bp->common.chip_id >> 16 == 5770U || bp->common.chip_id >> 16 == 5797U) || bp->common.chip_id >> 16 == 5801U) || bp->common.chip_id >> 16 == 5774U) || bp->common.chip_id >> 16 == 5806U) || bp->common.chip_id >> 16 == 5807U) || ((bp->common.chip_id >> 16 == 5693U || bp->common.chip_id >> 16 == 5694U) || bp->common.chip_id >> 16 == 5695U)) || ((bp->common.chip_id >> 16 == 5793U || bp->common.chip_id >> 16 == 5794U) || bp->common.chip_id >> 16 == 5773U)) || (bp->common.chip_id >> 16 == 5796U || bp->common.chip_id >> 16 == 5803U)) || bp->common.chip_id >> 16 == 5805U) { bnx2x_xmac_enable(params, vars, 0); } else { bnx2x_bmac_enable(params, vars, 0, 1); } if ((unsigned int )params->loopback_mode == 3U) { (*(int_phy->config_loopback))(int_phy, params); } else { phy_index = 1U; goto ldv_47725; ldv_47724: ; if ((unsigned long )params->phy[(int )phy_index].config_loopback != (unsigned long )((void (*)(struct bnx2x_phy * , struct link_params * ))0)) { (*(params->phy[(int )phy_index].config_loopback))((struct bnx2x_phy *)(& params->phy) + (unsigned long )phy_index, params); } else { } phy_index = (u8 )((int )phy_index + 1); ldv_47725: ; if ((int )params->num_phys > (int )phy_index) { goto ldv_47724; } else { } } writel(0U, (void volatile *)bp->regview + (unsigned long )(((int )params->port + 16408) * 4)); bnx2x_set_led(params, vars, 2, (u32 )vars->line_speed); return; } } void bnx2x_set_rx_filter(struct link_params *params , u8 en ) { struct bnx2x *bp ; u8 val ; { bp = params->bp; val = (unsigned int )en * 31U; if (bp->common.chip_id >> 16 != 5710U && (bp->common.chip_id >> 16 != 5711U && bp->common.chip_id >> 16 != 5712U)) { val = (u8 )((int )((signed char )((unsigned int )en * 32U)) | (int )((signed char )val)); } else { } writel((unsigned int )val, (void volatile *)bp->regview + (unsigned long )(((int )params->port + 16529) * 4)); if (bp->common.chip_id >> 16 != 5710U) { writel((unsigned int )en * 3U, (void volatile *)bp->regview + (unsigned long )(((int )params->port + 22546) * 4)); } else { } writel((unsigned int )en, (void volatile *)(bp->regview + ((unsigned int )params->port != 0U ? 66268UL : 66140UL))); return; } } static int bnx2x_avoid_link_flap(struct link_params *params , struct link_vars *vars ) { u32 phy_idx ; u32 dont_clear_stat ; u32 lfa_sts ; struct bnx2x *bp ; struct bnx2x_phy *phy ; long tmp ; { bp = params->bp; bnx2x_link_status_update(params, vars); phy_idx = 0U; goto ldv_47744; ldv_47743: phy = (struct bnx2x_phy *)(& params->phy) + (unsigned long )phy_idx; if ((unsigned long )phy->phy_specific_func != (unsigned long )((void (*)(struct bnx2x_phy * , struct link_params * , u32 ))0)) { tmp = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp != 0L) { printk("\rbnx2x: [%s:%d(%s)]Calling PHY specific func\n", "bnx2x_avoid_link_flap", 12520, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } (*(phy->phy_specific_func))(phy, params, 3U); } else { } if ((phy->media_type == 1U || phy->media_type == 5U) || phy->media_type == 3U) { bnx2x_verify_sfp_module(phy, params); } else { } phy_idx = phy_idx + 1U; ldv_47744: ; if ((u32 )params->num_phys > phy_idx) { goto ldv_47743; } else { } lfa_sts = readl((void const volatile *)(bp->regview + ((unsigned long )params->lfa_base + 24UL))); dont_clear_stat = lfa_sts & 16777216U; if (((((((((bp->common.chip_id >> 16 == 5770U || bp->common.chip_id >> 16 == 5797U) || bp->common.chip_id >> 16 == 5801U) || bp->common.chip_id >> 16 == 5774U) || bp->common.chip_id >> 16 == 5806U) || bp->common.chip_id >> 16 == 5807U) || ((bp->common.chip_id >> 16 == 5693U || bp->common.chip_id >> 16 == 5694U) || bp->common.chip_id >> 16 == 5695U)) || ((bp->common.chip_id >> 16 == 5793U || bp->common.chip_id >> 16 == 5794U) || bp->common.chip_id >> 16 == 5773U)) || (bp->common.chip_id >> 16 == 5796U || bp->common.chip_id >> 16 == 5803U)) || bp->common.chip_id >> 16 == 5805U) { if (dont_clear_stat == 0U) { writel((unsigned int )(16777216 << (int )params->port), (void volatile *)bp->regview + 42392U); writel((unsigned int )(16777216 << (int )params->port), (void volatile *)bp->regview + 42388U); } else { } if ((unsigned int )vars->line_speed <= 9999U) { bnx2x_umac_enable(params, vars, 0); } else { bnx2x_xmac_enable(params, vars, 0); } } else if ((unsigned int )vars->line_speed <= 9999U) { bnx2x_emac_enable(params, vars, 0); } else { bnx2x_bmac_enable(params, vars, 0, dont_clear_stat == 0U); } lfa_sts = (lfa_sts & 4294902015U) | (((((lfa_sts & 65280U) >> 8) + 1U) << 8) & 65535U); lfa_sts = lfa_sts & 4294967040U; writel(lfa_sts, (void volatile *)(bp->regview + ((unsigned long )params->lfa_base + 24UL))); writel(0U, (void volatile *)bp->regview + (unsigned long )(((int )params->port + 16408) * 4)); bnx2x_link_int_enable(params); return (0); } } static void bnx2x_cannot_avoid_link_flap(struct link_params *params , struct link_vars *vars , int lfa_status ) { u32 lfa_sts ; u32 cfg_idx ; u32 tmp_val ; struct bnx2x *bp ; { bp = params->bp; bnx2x_link_reset(params, vars, 1); if (params->lfa_base == 0U) { return; } else { } writel((unsigned int )params->req_duplex[0] | (unsigned int )((int )params->req_duplex[1] << 16), (void volatile *)bp->regview + (unsigned long )params->lfa_base); writel((unsigned int )params->req_flow_ctrl[0] | (unsigned int )((int )params->req_flow_ctrl[1] << 16), (void volatile *)(bp->regview + ((unsigned long )params->lfa_base + 4UL))); writel((unsigned int )params->req_line_speed[0] | (unsigned int )((int )params->req_line_speed[1] << 16), (void volatile *)(bp->regview + ((unsigned long )params->lfa_base + 8UL))); cfg_idx = 0U; goto ldv_47756; ldv_47755: writel(params->speed_cap_mask[cfg_idx], (void volatile *)(bp->regview + ((unsigned long )params->lfa_base + ((unsigned long )cfg_idx + 3UL) * 4UL))); cfg_idx = cfg_idx + 1U; ldv_47756: ; if (cfg_idx <= 1U) { goto ldv_47755; } else { } tmp_val = readl((void const volatile *)(bp->regview + ((unsigned long )params->lfa_base + 20UL))); tmp_val = tmp_val & 4294901760U; tmp_val = (u32 )params->req_fc_auto_adv | tmp_val; writel(tmp_val, (void volatile *)(bp->regview + ((unsigned long )params->lfa_base + 20UL))); lfa_sts = readl((void const volatile *)(bp->regview + ((unsigned long )params->lfa_base + 24UL))); lfa_sts = lfa_sts & 4278190079U; lfa_sts = lfa_sts & 4294967040U; lfa_sts = ((u32 )lfa_status & 255U) | lfa_sts; lfa_sts = (lfa_sts & 4278255615U) | (((((lfa_sts & 16711680U) >> 16) + 1U) & 255U) << 16); writel(lfa_sts, (void volatile *)(bp->regview + ((unsigned long )params->lfa_base + 24UL))); return; } } int bnx2x_phy_init(struct link_params *params , struct link_vars *vars ) { int lfa_status ; struct bnx2x *bp ; long tmp ; long tmp___0 ; long tmp___1 ; long tmp___2 ; long tmp___3 ; int tmp___4 ; long tmp___5 ; long tmp___6 ; long tmp___7 ; { bp = params->bp; tmp = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp != 0L) { printk("\rbnx2x: [%s:%d(%s)]Phy Initialization started\n", "bnx2x_phy_init", 12640, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } tmp___0 = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp___0 != 0L) { printk("\rbnx2x: [%s:%d(%s)](1) req_speed %d, req_flowctrl %d\n", "bnx2x_phy_init", 12642, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )params->req_line_speed[0], (int )params->req_flow_ctrl[0]); } else { } tmp___1 = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp___1 != 0L) { printk("\rbnx2x: [%s:%d(%s)](2) req_speed %d, req_flowctrl %d\n", "bnx2x_phy_init", 12644, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )params->req_line_speed[1], (int )params->req_flow_ctrl[1]); } else { } tmp___2 = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp___2 != 0L) { printk("\rbnx2x: [%s:%d(%s)]req_adv_flow_ctrl 0x%x\n", "bnx2x_phy_init", 12645, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )params->req_fc_auto_adv); } else { } vars->link_status = 0U; vars->phy_link_up = 0U; vars->link_up = 0U; vars->line_speed = 0U; vars->duplex = 1U; vars->flow_ctrl = 1024U; vars->mac_type = 0U; vars->phy_flags = 0U; vars->check_kr2_recovery_cnt = 0U; params->link_flags = 2U; bnx2x_set_rx_filter(params, 1); lfa_status = bnx2x_check_lfa(params); if (lfa_status == 0) { tmp___3 = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp___3 != 0L) { printk("\rbnx2x: [%s:%d(%s)]Link Flap Avoidance in progress\n", "bnx2x_phy_init", 12662, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } tmp___4 = bnx2x_avoid_link_flap(params, vars); return (tmp___4); } else { } tmp___5 = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp___5 != 0L) { printk("\rbnx2x: [%s:%d(%s)]Cannot avoid link flap lfa_sta=0x%x\n", "bnx2x_phy_init", 12667, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", lfa_status); } else { } bnx2x_cannot_avoid_link_flap(params, vars, lfa_status); bnx2x_bits_dis(bp, (u32 )(((int )params->port + 16588) * 4), 3965441U); bnx2x_emac_init(params, vars); if ((params->feature_config_flags & 2U) != 0U) { vars->link_status = vars->link_status | 536870912U; } else { } if ((unsigned int )params->num_phys == 0U) { tmp___6 = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp___6 != 0L) { printk("\rbnx2x: [%s:%d(%s)]No phy found for initialization !!\n", "bnx2x_phy_init", 12683, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } return (-22); } else { } set_phy_vars(params, vars); tmp___7 = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp___7 != 0L) { printk("\rbnx2x: [%s:%d(%s)]Num of phys on board: %d\n", "bnx2x_phy_init", 12688, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )params->num_phys); } else { } switch ((int )params->loopback_mode) { case 2: bnx2x_init_bmac_loopback(params, vars); goto ldv_47766; case 1: bnx2x_init_emac_loopback(params, vars); goto ldv_47766; case 7: bnx2x_init_xmac_loopback(params, vars); goto ldv_47766; case 6: bnx2x_init_umac_loopback(params, vars); goto ldv_47766; case 3: ; case 4: bnx2x_init_xgxs_loopback(params, vars); goto ldv_47766; default: ; if (((((((((bp->common.chip_id >> 16 != 5770U && bp->common.chip_id >> 16 != 5797U) && bp->common.chip_id >> 16 != 5801U) && bp->common.chip_id >> 16 != 5774U) && bp->common.chip_id >> 16 != 5806U) && bp->common.chip_id >> 16 != 5807U) && ((bp->common.chip_id >> 16 != 5693U && bp->common.chip_id >> 16 != 5694U) && bp->common.chip_id >> 16 != 5695U)) && ((bp->common.chip_id >> 16 != 5793U && bp->common.chip_id >> 16 != 5794U) && bp->common.chip_id >> 16 != 5773U)) && (bp->common.chip_id >> 16 != 5796U && bp->common.chip_id >> 16 != 5803U)) && bp->common.chip_id >> 16 != 5805U) { if (params->switch_cfg == 16777216U) { bnx2x_xgxs_deassert(params); } else { bnx2x_serdes_deassert(bp, (int )params->port); } } else { } bnx2x_link_initialize(params, vars); msleep(30U); bnx2x_link_int_enable(params); goto ldv_47766; } ldv_47766: bnx2x_update_mng(params, vars->link_status); bnx2x_update_mng_eee(params, vars->eee_status); return (0); } } int bnx2x_link_reset(struct link_params *params , struct link_vars *vars , u8 reset_ext_phy ) { struct bnx2x *bp ; u8 phy_index ; u8 port ; u8 clear_latch_ind ; long tmp ; u32 xmac_base ; unsigned int tmp___0 ; { bp = params->bp; port = params->port; clear_latch_ind = 0U; tmp = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp != 0L) { printk("\rbnx2x: [%s:%d(%s)]Resetting the link of port %d\n", "bnx2x_link_reset", 12729, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )port); } else { } vars->link_status = 0U; bnx2x_update_mng(params, vars->link_status); vars->eee_status = vars->eee_status & 2969567231U; bnx2x_update_mng_eee(params, vars->eee_status); bnx2x_bits_dis(bp, (u32 )(((int )port + 16588) * 4), 3965441U); writel(1U, (void volatile *)bp->regview + (unsigned long )(((int )port + 16408) * 4)); if (((((((((bp->common.chip_id >> 16 != 5770U && bp->common.chip_id >> 16 != 5797U) && bp->common.chip_id >> 16 != 5801U) && bp->common.chip_id >> 16 != 5774U) && bp->common.chip_id >> 16 != 5806U) && bp->common.chip_id >> 16 != 5807U) && ((bp->common.chip_id >> 16 != 5693U && bp->common.chip_id >> 16 != 5694U) && bp->common.chip_id >> 16 != 5695U)) && ((bp->common.chip_id >> 16 != 5793U && bp->common.chip_id >> 16 != 5794U) && bp->common.chip_id >> 16 != 5773U)) && (bp->common.chip_id >> 16 != 5796U && bp->common.chip_id >> 16 != 5803U)) && bp->common.chip_id >> 16 != 5805U) { writel(0U, (void volatile *)bp->regview + (unsigned long )(((int )port + 16440) * 4)); writel(0U, (void volatile *)bp->regview + (unsigned long )(((int )port + 16456) * 4)); } else { } if (((((((((bp->common.chip_id >> 16 != 5770U && bp->common.chip_id >> 16 != 5797U) && bp->common.chip_id >> 16 != 5801U) && bp->common.chip_id >> 16 != 5774U) && bp->common.chip_id >> 16 != 5806U) && bp->common.chip_id >> 16 != 5807U) && ((bp->common.chip_id >> 16 != 5693U && bp->common.chip_id >> 16 != 5694U) && bp->common.chip_id >> 16 != 5695U)) && ((bp->common.chip_id >> 16 != 5793U && bp->common.chip_id >> 16 != 5794U) && bp->common.chip_id >> 16 != 5773U)) && (bp->common.chip_id >> 16 != 5796U && bp->common.chip_id >> 16 != 5803U)) && bp->common.chip_id >> 16 != 5805U) { bnx2x_set_bmac_rx(bp, params->chip_id, (int )port, 0); } else { bnx2x_set_xmac_rxtx(params, 0); bnx2x_set_umac_rxtx(params, 0); } if (((((((((bp->common.chip_id >> 16 != 5770U && bp->common.chip_id >> 16 != 5797U) && bp->common.chip_id >> 16 != 5801U) && bp->common.chip_id >> 16 != 5774U) && bp->common.chip_id >> 16 != 5806U) && bp->common.chip_id >> 16 != 5807U) && ((bp->common.chip_id >> 16 != 5693U && bp->common.chip_id >> 16 != 5694U) && bp->common.chip_id >> 16 != 5695U)) && ((bp->common.chip_id >> 16 != 5793U && bp->common.chip_id >> 16 != 5794U) && bp->common.chip_id >> 16 != 5773U)) && (bp->common.chip_id >> 16 != 5796U && bp->common.chip_id >> 16 != 5803U)) && bp->common.chip_id >> 16 != 5805U) { writel(0U, (void volatile *)bp->regview + (unsigned long )(((int )port + 16399) * 4)); } else { } usleep_range(10000UL, 20000UL); bnx2x_set_mdio_emac_per_phy(bp, params); bnx2x_set_led(params, vars, 0, 0U); if ((unsigned int )reset_ext_phy != 0U) { phy_index = 1U; goto ldv_47784; ldv_47783: ; if ((unsigned long )params->phy[(int )phy_index].link_reset != (unsigned long )((void (*)(struct bnx2x_phy * , struct link_params * ))0)) { bnx2x_set_aer_mmd(params, (struct bnx2x_phy *)(& params->phy) + (unsigned long )phy_index); (*(params->phy[(int )phy_index].link_reset))((struct bnx2x_phy *)(& params->phy) + (unsigned long )phy_index, params); } else { } if (((int )params->phy[(int )phy_index].flags & 64) != 0) { clear_latch_ind = 1U; } else { } phy_index = (u8 )((int )phy_index + 1); ldv_47784: ; if ((int )params->num_phys > (int )phy_index) { goto ldv_47783; } else { } } else { } if ((unsigned int )clear_latch_ind != 0U) { bnx2x_rearm_latch_signal(bp, (int )port, 0); bnx2x_bits_dis(bp, (u32 )(((int )port + 22660) * 4), 1U); } else { } if ((unsigned long )params->phy[0].link_reset != (unsigned long )((void (*)(struct bnx2x_phy * , struct link_params * ))0)) { (*(params->phy[0].link_reset))((struct bnx2x_phy *)(& params->phy), params); } else { } if (((((((((bp->common.chip_id >> 16 != 5770U && bp->common.chip_id >> 16 != 5797U) && bp->common.chip_id >> 16 != 5801U) && bp->common.chip_id >> 16 != 5774U) && bp->common.chip_id >> 16 != 5806U) && bp->common.chip_id >> 16 != 5807U) && ((bp->common.chip_id >> 16 != 5693U && bp->common.chip_id >> 16 != 5694U) && bp->common.chip_id >> 16 != 5695U)) && ((bp->common.chip_id >> 16 != 5793U && bp->common.chip_id >> 16 != 5794U) && bp->common.chip_id >> 16 != 5773U)) && (bp->common.chip_id >> 16 != 5796U && bp->common.chip_id >> 16 != 5803U)) && bp->common.chip_id >> 16 != 5805U) { writel((unsigned int )(1 << (int )port), (void volatile *)bp->regview + 42392U); writel(0U, (void volatile *)bp->regview + (unsigned long )(((int )port + 16427) * 4)); writel(0U, (void volatile *)bp->regview + (unsigned long )(((int )port + 16425) * 4)); } else { xmac_base = (unsigned int )params->port != 0U ? 1456128U : 1454080U; bnx2x_set_xumac_nig(params, 0, 0); tmp___0 = readl((void const volatile *)bp->regview + 42384U); if ((tmp___0 & 4194304U) != 0U) { writel(64U, (void volatile *)bp->regview + (unsigned long )xmac_base); } else { } } vars->link_up = 0U; vars->phy_flags = 0U; return (0); } } int bnx2x_lfa_reset(struct link_params *params , struct link_vars *vars ) { struct bnx2x *bp ; int tmp ; { bp = params->bp; vars->link_up = 0U; vars->phy_flags = 0U; params->link_flags = (unsigned int )params->link_flags & 65533U; if (params->lfa_base == 0U) { tmp = bnx2x_link_reset(params, vars, 1); return (tmp); } else { } writel(1U, (void volatile *)bp->regview + (unsigned long )(((int )params->port + 16408) * 4)); if (((((((((bp->common.chip_id >> 16 != 5770U && bp->common.chip_id >> 16 != 5797U) && bp->common.chip_id >> 16 != 5801U) && bp->common.chip_id >> 16 != 5774U) && bp->common.chip_id >> 16 != 5806U) && bp->common.chip_id >> 16 != 5807U) && ((bp->common.chip_id >> 16 != 5693U && bp->common.chip_id >> 16 != 5694U) && bp->common.chip_id >> 16 != 5695U)) && ((bp->common.chip_id >> 16 != 5793U && bp->common.chip_id >> 16 != 5794U) && bp->common.chip_id >> 16 != 5773U)) && (bp->common.chip_id >> 16 != 5796U && bp->common.chip_id >> 16 != 5803U)) && bp->common.chip_id >> 16 != 5805U) { bnx2x_set_bmac_rx(bp, params->chip_id, (int )params->port, 0); } else { } if (((((((((bp->common.chip_id >> 16 == 5770U || bp->common.chip_id >> 16 == 5797U) || bp->common.chip_id >> 16 == 5801U) || bp->common.chip_id >> 16 == 5774U) || bp->common.chip_id >> 16 == 5806U) || bp->common.chip_id >> 16 == 5807U) || ((bp->common.chip_id >> 16 == 5693U || bp->common.chip_id >> 16 == 5694U) || bp->common.chip_id >> 16 == 5695U)) || ((bp->common.chip_id >> 16 == 5793U || bp->common.chip_id >> 16 == 5794U) || bp->common.chip_id >> 16 == 5773U)) || (bp->common.chip_id >> 16 == 5796U || bp->common.chip_id >> 16 == 5803U)) || bp->common.chip_id >> 16 == 5805U) { bnx2x_set_xmac_rxtx(params, 0); bnx2x_set_umac_rxtx(params, 0); } else { } usleep_range(10000UL, 20000UL); bnx2x_set_rx_filter(params, 0); if (((((((((bp->common.chip_id >> 16 != 5770U && bp->common.chip_id >> 16 != 5797U) && bp->common.chip_id >> 16 != 5801U) && bp->common.chip_id >> 16 != 5774U) && bp->common.chip_id >> 16 != 5806U) && bp->common.chip_id >> 16 != 5807U) && ((bp->common.chip_id >> 16 != 5693U && bp->common.chip_id >> 16 != 5694U) && bp->common.chip_id >> 16 != 5695U)) && ((bp->common.chip_id >> 16 != 5793U && bp->common.chip_id >> 16 != 5794U) && bp->common.chip_id >> 16 != 5773U)) && (bp->common.chip_id >> 16 != 5796U && bp->common.chip_id >> 16 != 5803U)) && bp->common.chip_id >> 16 != 5805U) { bnx2x_set_bmac_rx(bp, params->chip_id, (int )params->port, 1); } else { } if (((((((((bp->common.chip_id >> 16 == 5770U || bp->common.chip_id >> 16 == 5797U) || bp->common.chip_id >> 16 == 5801U) || bp->common.chip_id >> 16 == 5774U) || bp->common.chip_id >> 16 == 5806U) || bp->common.chip_id >> 16 == 5807U) || ((bp->common.chip_id >> 16 == 5693U || bp->common.chip_id >> 16 == 5694U) || bp->common.chip_id >> 16 == 5695U)) || ((bp->common.chip_id >> 16 == 5793U || bp->common.chip_id >> 16 == 5794U) || bp->common.chip_id >> 16 == 5773U)) || (bp->common.chip_id >> 16 == 5796U || bp->common.chip_id >> 16 == 5803U)) || bp->common.chip_id >> 16 == 5805U) { bnx2x_set_xmac_rxtx(params, 1); bnx2x_set_umac_rxtx(params, 1); } else { } writel(0U, (void volatile *)bp->regview + (unsigned long )(((int )params->port + 16408) * 4)); return (0); } } static int bnx2x_8073_common_init_phy(struct bnx2x *bp , u32 *shmem_base_path , u32 *shmem2_base_path , u8 phy_index , u32 chip_id ) { struct bnx2x_phy phy[2U] ; struct bnx2x_phy *phy_blk[2U] ; u16 val ; s8 port ; s8 port_of_path ; u32 swap_val ; u32 swap_override ; u32 shmem_base ; u32 shmem2_base ; long tmp ; int tmp___0 ; long tmp___1 ; int tmp___2 ; { port = 0; port_of_path = 0; swap_val = readl((void const volatile *)bp->regview + 66452U); swap_override = readl((void const volatile *)bp->regview + 66456U); port = (int )((s8 )(swap_val != 0U && swap_override != 0U)) ^ (int )port; bnx2x_ext_phy_hw_reset(bp, (int )((u8 )port)); port = 1; goto ldv_47810; ldv_47809: ; if (bp->common.chip_id >> 16 == 5710U || (bp->common.chip_id >> 16 == 5711U || bp->common.chip_id >> 16 == 5712U)) { shmem_base = *shmem_base_path; shmem2_base = *shmem2_base_path; port_of_path = port; } else { shmem_base = *(shmem_base_path + (unsigned long )port); shmem2_base = *(shmem2_base_path + (unsigned long )port); port_of_path = 0; } tmp___0 = bnx2x_populate_phy(bp, (int )phy_index, shmem_base, shmem2_base, (int )((u8 )port_of_path), (struct bnx2x_phy *)(& phy) + (unsigned long )port); if (tmp___0 != 0) { tmp = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp != 0L) { printk("\rbnx2x: [%s:%d(%s)]populate_phy failed\n", "bnx2x_8073_common_init_phy", 12902, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } return (-22); } else { } bnx2x_bits_dis(bp, (u32 )(((int )port_of_path + 16588) * 4), 3965441U); bnx2x_set_gpio(bp, 2, 1U, (int )((u8 )port)); bnx2x_cl45_write(bp, (struct bnx2x_phy *)(& phy) + (unsigned long )port, 1, 0, 32768); port = (s8 )((int )port - 1); ldv_47810: ; if ((int )port >= 0) { goto ldv_47809; } else { } msleep(150U); if ((int )phy[0].addr & 1) { phy_blk[0] = (struct bnx2x_phy *)(& phy) + 1UL; phy_blk[1] = (struct bnx2x_phy *)(& phy); } else { phy_blk[0] = (struct bnx2x_phy *)(& phy); phy_blk[1] = (struct bnx2x_phy *)(& phy) + 1UL; } port = 1; goto ldv_47813; ldv_47812: ; if (bp->common.chip_id >> 16 == 5710U || (bp->common.chip_id >> 16 == 5711U || bp->common.chip_id >> 16 == 5712U)) { port_of_path = port; } else { port_of_path = 0; } tmp___1 = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp___1 != 0L) { printk("\rbnx2x: [%s:%d(%s)]Loading spirom for phy address 0x%x\n", "bnx2x_8073_common_init_phy", 12946, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )(phy_blk[(int )port])->addr); } else { } tmp___2 = bnx2x_8073_8727_external_rom_boot(bp, phy_blk[(int )port], (int )((u8 )port_of_path)); if (tmp___2 != 0) { return (-22); } else { } bnx2x_cl45_read(bp, phy_blk[(int )port], 1, 51714, & val); bnx2x_cl45_write(bp, phy_blk[(int )port], 1, 51714, (int )((unsigned int )val | 1024U)); port = (s8 )((int )port - 1); ldv_47813: ; if ((int )port >= 0) { goto ldv_47812; } else { } msleep(600U); port = 1; goto ldv_47816; ldv_47815: bnx2x_cl45_read(bp, phy_blk[(int )port], 1, 51714, & val); bnx2x_cl45_write(bp, phy_blk[(int )port], 1, 51714, (int )val & 64511); usleep_range(15000UL, 30000UL); bnx2x_cl45_read(bp, phy_blk[(int )port], 1, 51739, & val); bnx2x_cl45_write(bp, phy_blk[(int )port], 1, 51739, (int )((unsigned int )val | 4096U)); bnx2x_set_gpio(bp, 2, 0U, (int )((u8 )port)); port = (s8 )((int )port - 1); ldv_47816: ; if ((int )port >= 0) { goto ldv_47815; } else { } return (0); } } static int bnx2x_8726_common_init_phy(struct bnx2x *bp , u32 *shmem_base_path , u32 *shmem2_base_path , u8 phy_index , u32 chip_id ) { u32 val ; s8 port ; struct bnx2x_phy phy ; u32 shmem_base ; u32 shmem2_base ; long tmp ; int tmp___0 ; { val = readl((void const volatile *)bp->regview + 41660U); val = val | 136U; writel(val, (void volatile *)bp->regview + 41660U); bnx2x_ext_phy_hw_reset(bp, 0); usleep_range(5000UL, 10000UL); port = 0; goto ldv_47832; ldv_47831: ; if (bp->common.chip_id >> 16 == 5710U || (bp->common.chip_id >> 16 == 5711U || bp->common.chip_id >> 16 == 5712U)) { shmem_base = *shmem_base_path; shmem2_base = *shmem2_base_path; } else { shmem_base = *(shmem_base_path + (unsigned long )port); shmem2_base = *(shmem2_base_path + (unsigned long )port); } tmp___0 = bnx2x_populate_phy(bp, (int )phy_index, shmem_base, shmem2_base, (int )((u8 )port), & phy); if (tmp___0 != 0) { tmp = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp != 0L) { printk("\rbnx2x: [%s:%d(%s)]populate phy failed\n", "bnx2x_8726_common_init_phy", 13027, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } return (-22); } else { } bnx2x_cl45_write(bp, & phy, 1, 51728, 1); bnx2x_set_gpio(bp, 0, 1U, (int )((u8 )port)); port = (s8 )((int )port + 1); ldv_47832: ; if ((int )port <= 1) { goto ldv_47831; } else { } return (0); } } static void bnx2x_get_ext_phy_reset_gpio(struct bnx2x *bp , u32 shmem_base , u8 *io_gpio , u8 *io_port ) { u32 phy_gpio_reset ; unsigned int tmp ; { tmp = readl((void const volatile *)(bp->regview + ((unsigned long )shmem_base + 400UL))); phy_gpio_reset = tmp; switch (phy_gpio_reset) { case 65536U: *io_gpio = 0U; *io_port = 0U; goto ldv_47842; case 131072U: *io_gpio = 1U; *io_port = 0U; goto ldv_47842; case 196608U: *io_gpio = 2U; *io_port = 0U; goto ldv_47842; case 262144U: *io_gpio = 3U; *io_port = 0U; goto ldv_47842; case 327680U: *io_gpio = 0U; *io_port = 1U; goto ldv_47842; case 393216U: *io_gpio = 1U; *io_port = 1U; goto ldv_47842; case 458752U: *io_gpio = 2U; *io_port = 1U; goto ldv_47842; case 524288U: *io_gpio = 3U; *io_port = 1U; goto ldv_47842; default: ; goto ldv_47842; } ldv_47842: ; return; } } static int bnx2x_8727_common_init_phy(struct bnx2x *bp , u32 *shmem_base_path , u32 *shmem2_base_path , u8 phy_index , u32 chip_id ) { s8 port ; s8 reset_gpio ; u32 swap_val ; u32 swap_override ; struct bnx2x_phy phy[2U] ; struct bnx2x_phy *phy_blk[2U] ; s8 port_of_path ; u32 shmem_base ; u32 shmem2_base ; long tmp ; int tmp___0 ; long tmp___1 ; int tmp___2 ; { swap_val = readl((void const volatile *)bp->regview + 66452U); swap_override = readl((void const volatile *)bp->regview + 66456U); reset_gpio = 1; port = 1; bnx2x_get_ext_phy_reset_gpio(bp, *shmem_base_path, (u8 *)(& reset_gpio), (u8 *)(& port)); port = (int )((s8 )(swap_val != 0U && swap_override != 0U)) ^ (int )port; bnx2x_set_gpio(bp, (int )reset_gpio, 0U, (int )((u8 )port)); usleep_range(1000UL, 2000UL); bnx2x_set_gpio(bp, (int )reset_gpio, 1U, (int )((u8 )port)); usleep_range(5000UL, 10000UL); port = 1; goto ldv_47869; ldv_47868: ; if (bp->common.chip_id >> 16 == 5710U || (bp->common.chip_id >> 16 == 5711U || bp->common.chip_id >> 16 == 5712U)) { shmem_base = *shmem_base_path; shmem2_base = *shmem2_base_path; port_of_path = port; } else { shmem_base = *(shmem_base_path + (unsigned long )port); shmem2_base = *(shmem2_base_path + (unsigned long )port); port_of_path = 0; } tmp___0 = bnx2x_populate_phy(bp, (int )phy_index, shmem_base, shmem2_base, (int )((u8 )port_of_path), (struct bnx2x_phy *)(& phy) + (unsigned long )port); if (tmp___0 != 0) { tmp = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp != 0L) { printk("\rbnx2x: [%s:%d(%s)]populate phy failed\n", "bnx2x_8727_common_init_phy", 13143, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } return (-22); } else { } bnx2x_bits_dis(bp, (u32 )(((int )port_of_path + 16588) * 4), 3965441U); bnx2x_cl45_write(bp, (struct bnx2x_phy *)(& phy) + (unsigned long )port, 1, 0, 32768); port = (s8 )((int )port - 1); ldv_47869: ; if ((int )port >= 0) { goto ldv_47868; } else { } msleep(150U); if ((int )phy[0].addr & 1) { phy_blk[0] = (struct bnx2x_phy *)(& phy) + 1UL; phy_blk[1] = (struct bnx2x_phy *)(& phy); } else { phy_blk[0] = (struct bnx2x_phy *)(& phy); phy_blk[1] = (struct bnx2x_phy *)(& phy) + 1UL; } port = 1; goto ldv_47872; ldv_47871: ; if (bp->common.chip_id >> 16 == 5710U || (bp->common.chip_id >> 16 == 5711U || bp->common.chip_id >> 16 == 5712U)) { port_of_path = port; } else { port_of_path = 0; } tmp___1 = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp___1 != 0L) { printk("\rbnx2x: [%s:%d(%s)]Loading spirom for phy address 0x%x\n", "bnx2x_8727_common_init_phy", 13176, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )(phy_blk[(int )port])->addr); } else { } tmp___2 = bnx2x_8073_8727_external_rom_boot(bp, phy_blk[(int )port], (int )((u8 )port_of_path)); if (tmp___2 != 0) { return (-22); } else { } bnx2x_cl45_write(bp, phy_blk[(int )port], 1, 9, 1); port = (s8 )((int )port - 1); ldv_47872: ; if ((int )port >= 0) { goto ldv_47871; } else { } return (0); } } static int bnx2x_84833_common_init_phy(struct bnx2x *bp , u32 *shmem_base_path , u32 *shmem2_base_path , u8 phy_index , u32 chip_id ) { u8 reset_gpios ; long tmp ; { reset_gpios = bnx2x_84833_get_reset_gpios(bp, shmem_base_path, chip_id); bnx2x_set_mult_gpio(bp, (int )reset_gpios, 0U); __const_udelay(42950UL); bnx2x_set_mult_gpio(bp, (int )reset_gpios, 1U); tmp = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp != 0L) { printk("\rbnx2x: [%s:%d(%s)]84833 reset pulse on pin values 0x%x\n", "bnx2x_84833_common_init_phy", 13201, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )reset_gpios); } else { } return (0); } } static int bnx2x_ext_phy_common_init(struct bnx2x *bp , u32 *shmem_base_path , u32 *shmem2_base_path , u8 phy_index , u32 ext_phy_type , u32 chip_id ) { int rc ; long tmp ; { rc = 0; switch (ext_phy_type) { case 768U: rc = bnx2x_8073_common_init_phy(bp, shmem_base_path, shmem2_base_path, (int )phy_index, chip_id); goto ldv_47893; case 3840U: ; case 2304U: ; case 2560U: rc = bnx2x_8727_common_init_phy(bp, shmem_base_path, shmem2_base_path, (int )phy_index, chip_id); goto ldv_47893; case 1536U: rc = bnx2x_8726_common_init_phy(bp, shmem_base_path, shmem2_base_path, (int )phy_index, chip_id); goto ldv_47893; case 3328U: ; case 4352U: rc = bnx2x_84833_common_init_phy(bp, shmem_base_path, shmem2_base_path, (int )phy_index, chip_id); goto ldv_47893; case 64768U: rc = -22; goto ldv_47893; default: tmp = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp != 0L) { printk("\rbnx2x: [%s:%d(%s)]ext_phy 0x%x common init not required\n", "bnx2x_ext_phy_common_init", 13248, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", ext_phy_type); } else { } goto ldv_47893; } ldv_47893: ; if (rc != 0) { netdev_err((struct net_device const *)bp->dev, "Warning: PHY was not initialized, Port %d\n", 0); } else { } return (rc); } } int bnx2x_common_init_phy(struct bnx2x *bp , u32 *shmem_base_path , u32 *shmem2_base_path , u32 chip_id ) { int rc ; u32 phy_ver ; u32 val ; u8 phy_index ; u32 ext_phy_type ; u32 ext_phy_config ; long tmp ; long tmp___0 ; int tmp___1 ; { rc = 0; phy_index = 0U; bnx2x_set_mdio_clk(bp, chip_id, 32768U); bnx2x_set_mdio_clk(bp, chip_id, 33792U); tmp = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp != 0L) { printk("\rbnx2x: [%s:%d(%s)]Begin common phy init\n", "bnx2x_common_init_phy", 13269, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } if (((((((((bp->common.chip_id >> 16 == 5770U || bp->common.chip_id >> 16 == 5797U) || bp->common.chip_id >> 16 == 5801U) || bp->common.chip_id >> 16 == 5774U) || bp->common.chip_id >> 16 == 5806U) || bp->common.chip_id >> 16 == 5807U) || ((bp->common.chip_id >> 16 == 5693U || bp->common.chip_id >> 16 == 5694U) || bp->common.chip_id >> 16 == 5695U)) || ((bp->common.chip_id >> 16 == 5793U || bp->common.chip_id >> 16 == 5794U) || bp->common.chip_id >> 16 == 5773U)) || (bp->common.chip_id >> 16 == 5796U || bp->common.chip_id >> 16 == 5803U)) || bp->common.chip_id >> 16 == 5805U) { val = readl((void const volatile *)bp->regview + 43424U); writel(val | 1U, (void volatile *)bp->regview + 43424U); } else { } phy_ver = readl((void const volatile *)(bp->regview + ((unsigned long )*shmem_base_path + 1648UL))); if (phy_ver != 0U) { tmp___0 = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp___0 != 0L) { printk("\rbnx2x: [%s:%d(%s)]Not doing common init; phy ver is 0x%x\n", "bnx2x_common_init_phy", 13281, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", phy_ver); } else { } return (0); } else { } phy_index = 1U; goto ldv_47917; ldv_47916: ext_phy_config = bnx2x_get_ext_phy_config(bp, *shmem_base_path, (int )phy_index, 0); ext_phy_type = ext_phy_config & 65280U; tmp___1 = bnx2x_ext_phy_common_init(bp, shmem_base_path, shmem2_base_path, (int )phy_index, ext_phy_type, chip_id); rc = tmp___1 | rc; phy_index = (u8 )((int )phy_index + 1); ldv_47917: ; if ((unsigned int )phy_index <= 2U) { goto ldv_47916; } else { } return (rc); } } static void bnx2x_check_over_curr(struct link_params *params , struct link_vars *vars ) { struct bnx2x *bp ; u32 cfg_pin ; u8 port ; u32 pin_val ; unsigned int tmp ; u32 tmp___0 ; { bp = params->bp; port = params->port; tmp = readl((void const volatile *)(bp->regview + (((unsigned long )params->shmem_base + (unsigned long )port * 400UL) + 120UL))); cfg_pin = tmp & 255U; tmp___0 = bnx2x_get_cfg_pin(bp, cfg_pin, & pin_val); if (tmp___0 != 0U) { return; } else { } if (pin_val == 0U) { if (((int )vars->phy_flags & 16) == 0) { netdev_err((struct net_device const *)bp->dev, "Error: Power fault on Port %d has been detected and the power to that SFP+ module has been removed to prevent failure of the card. Please remove the SFP+ module and restart the system to clear this error.\n", (int )params->port); vars->phy_flags = (u8 )((unsigned int )vars->phy_flags | 16U); bnx2x_warpcore_power_module(params, 0); } else { } } else { vars->phy_flags = (unsigned int )vars->phy_flags & 239U; } return; } } static u8 bnx2x_analyze_link_error(struct link_params *params , struct link_vars *vars , u32 status , u32 phy_flag , u32 link_flag , u8 notify ) { struct bnx2x *bp ; u8 led_mode ; u32 old_status ; long tmp ; long tmp___0 ; long tmp___1 ; long tmp___2 ; { bp = params->bp; old_status = ((u32 )vars->phy_flags & phy_flag) != 0U; if (status == old_status) { return (0U); } else { } switch (phy_flag) { case 8U: tmp = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp != 0L) { printk("\rbnx2x: [%s:%d(%s)]Analyze Remote Fault\n", "bnx2x_analyze_link_error", 13351, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } goto ldv_47940; case 32U: tmp___0 = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp___0 != 0L) { printk("\rbnx2x: [%s:%d(%s)]Analyze TX Fault\n", "bnx2x_analyze_link_error", 13354, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } goto ldv_47940; default: tmp___1 = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp___1 != 0L) { printk("\rbnx2x: [%s:%d(%s)]Analyze UNKNOWN\n", "bnx2x_analyze_link_error", 13357, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } } ldv_47940: tmp___2 = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp___2 != 0L) { printk("\rbnx2x: [%s:%d(%s)]Link changed:[%x %x]->%x\n", "bnx2x_analyze_link_error", 13360, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )vars->link_up, old_status, status); } else { } if (status != 0U) { vars->link_status = vars->link_status & 4294967294U; vars->link_status = vars->link_status | link_flag; vars->link_up = 0U; vars->phy_flags = (int )vars->phy_flags | (int )((u8 )phy_flag); writel(1U, (void volatile *)bp->regview + (unsigned long )(((int )params->port + 16408) * 4)); led_mode = 0U; } else { vars->link_status = vars->link_status | 1U; vars->link_status = vars->link_status & ~ link_flag; vars->link_up = 1U; vars->phy_flags = (int )vars->phy_flags & ~ ((int )((u8 )phy_flag)); led_mode = 2U; writel(0U, (void volatile *)bp->regview + (unsigned long )(((int )params->port + 16408) * 4)); } bnx2x_sync_link(params, vars); bnx2x_set_led(params, vars, (int )led_mode, 10000U); bnx2x_update_mng(params, vars->link_status); vars->periodic_flags = (u16 )((unsigned int )vars->periodic_flags | 1U); if ((unsigned int )notify != 0U) { bnx2x_notify_link_changed(bp); } else { } return (1U); } } int bnx2x_check_half_open_conn(struct link_params *params , struct link_vars *vars , u8 notify ) { struct bnx2x *bp ; u32 lss_status ; u32 mac_base ; unsigned int tmp ; unsigned int tmp___0 ; u32 lss_status_reg ; u32 wb_data[2U] ; size_t __len ; void *__ret ; unsigned int tmp___1 ; unsigned int tmp___2 ; { bp = params->bp; lss_status = 0U; if (((int )vars->phy_flags & 4) == 0) { return (0); } else { tmp = readl((void const volatile *)bp->regview + (unsigned long )(((int )params->port + 16406) * 4)); if (tmp != 0U) { return (0); } else { } } if (((((((((bp->common.chip_id >> 16 == 5770U || bp->common.chip_id >> 16 == 5797U) || bp->common.chip_id >> 16 == 5801U) || bp->common.chip_id >> 16 == 5774U) || bp->common.chip_id >> 16 == 5806U) || bp->common.chip_id >> 16 == 5807U) || ((bp->common.chip_id >> 16 == 5693U || bp->common.chip_id >> 16 == 5694U) || bp->common.chip_id >> 16 == 5695U)) || ((bp->common.chip_id >> 16 == 5793U || bp->common.chip_id >> 16 == 5794U) || bp->common.chip_id >> 16 == 5773U)) || (bp->common.chip_id >> 16 == 5796U || bp->common.chip_id >> 16 == 5803U)) || bp->common.chip_id >> 16 == 5805U) { tmp___2 = readl((void const volatile *)bp->regview + 42384U); if ((tmp___2 & 4194304U) != 0U) { mac_base = (unsigned int )params->port != 0U ? 1456128U : 1454080U; writel(0U, (void volatile *)bp->regview + (unsigned long )(mac_base + 96U)); writel(3U, (void volatile *)bp->regview + (unsigned long )(mac_base + 96U)); tmp___0 = readl((void const volatile *)bp->regview + (unsigned long )(mac_base + 88U)); if (tmp___0 != 0U) { lss_status = 1U; } else { } bnx2x_analyze_link_error(params, vars, lss_status, 8U, 0U, (int )notify); } else { goto _L; } } else { _L: /* CIL Label */ tmp___1 = readl((void const volatile *)bp->regview + 42384U); if ((tmp___1 & (unsigned int )(1 << (int )params->port)) != 0U) { mac_base = (unsigned int )params->port != 0U ? 69632U : 68608U; if ((bp->common.chip_id >> 16 == 5730U || bp->common.chip_id >> 16 == 5731U) || bp->common.chip_id >> 16 == 5743U) { lss_status_reg = 496U; } else { lss_status_reg = 536U; } bnx2x_read_dmae(bp, mac_base + lss_status_reg, 2U); __len = 8UL; if (__len > 63UL) { __ret = __memcpy((void *)(& wb_data), (void const *)(& (bp->slowpath)->wb_data), __len); } else { __ret = __builtin_memcpy((void *)(& wb_data), (void const *)(& (bp->slowpath)->wb_data), __len); } lss_status = wb_data[0] != 0U; bnx2x_analyze_link_error(params, vars, lss_status, 8U, 0U, (int )notify); } else { } } return (0); } } static void bnx2x_sfp_tx_fault_detection(struct bnx2x_phy *phy , struct link_params *params , struct link_vars *vars ) { struct bnx2x *bp ; u32 cfg_pin ; u32 value ; u8 led_change ; u8 port ; unsigned int tmp ; long tmp___0 ; u32 tmp___1 ; u8 led_mode ; long tmp___2 ; { bp = params->bp; value = 0U; port = params->port; tmp = readl((void const volatile *)(bp->regview + (((unsigned long )params->shmem_base + (unsigned long )port * 400UL) + 116UL))); cfg_pin = tmp & 255U; tmp___1 = bnx2x_get_cfg_pin(bp, cfg_pin, & value); if (tmp___1 != 0U) { tmp___0 = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp___0 != 0L) { printk("\rbnx2x: [%s:%d(%s)]Failed to read pin 0x%02x\n", "bnx2x_sfp_tx_fault_detection", 13481, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", cfg_pin); } else { } return; } else { } led_change = bnx2x_analyze_link_error(params, vars, value, 32U, 2147483648U, 1); if ((unsigned int )led_change != 0U) { if (((int )vars->phy_flags & 32) != 0) { led_mode = 1U; vars->link_status = vars->link_status | 2147483648U; } else { led_mode = 0U; vars->link_status = vars->link_status & 2147483647U; } if (((int )phy->flags & 128) == 0) { tmp___2 = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp___2 != 0L) { printk("\rbnx2x: [%s:%d(%s)]Change TX_Fault LED: ->%x\n", "bnx2x_sfp_tx_fault_detection", 13504, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )led_mode); } else { } bnx2x_set_e3_module_fault_led(params, (int )led_mode); } else { } } else { } return; } } static void bnx2x_disable_kr2(struct link_params *params , struct link_vars *vars , struct bnx2x_phy *phy ) { struct bnx2x *bp ; int i ; struct bnx2x_reg_set reg_set[15U] ; long tmp ; { bp = params->bp; reg_set[0].devad = 3U; reg_set[0].reg = 33846U; reg_set[0].val = 30352U; reg_set[1].devad = 3U; reg_set[1].reg = 33848U; reg_set[1].val = 58951U; reg_set[2].devad = 3U; reg_set[2].reg = 33847U; reg_set[2].val = 50416U; reg_set[3].devad = 3U; reg_set[3].reg = 33849U; reg_set[3].val = 30352U; reg_set[4].devad = 3U; reg_set[4].reg = 33851U; reg_set[4].val = 58951U; reg_set[5].devad = 3U; reg_set[5].reg = 33850U; reg_set[5].val = 50416U; reg_set[6].devad = 3U; reg_set[6].reg = 33648U; reg_set[6].val = 12U; reg_set[7].devad = 3U; reg_set[7].reg = 33650U; reg_set[7].val = 24576U; reg_set[8].devad = 3U; reg_set[8].reg = 33652U; reg_set[8].val = 0U; reg_set[9].devad = 3U; reg_set[9].reg = 33659U; reg_set[9].val = 2U; reg_set[10].devad = 3U; reg_set[10].reg = 33875U; reg_set[10].val = 0U; reg_set[11].devad = 3U; reg_set[11].reg = 33876U; reg_set[11].val = 2807U; reg_set[12].devad = 3U; reg_set[12].reg = 33877U; reg_set[12].val = 2807U; reg_set[13].devad = 3U; reg_set[13].reg = 33878U; reg_set[13].val = 2U; reg_set[14].devad = 3U; reg_set[14].reg = 33879U; reg_set[14].val = 0U; tmp = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp != 0L) { printk("\rbnx2x: [%s:%d(%s)]Disabling 20G-KR2\n", "bnx2x_disable_kr2", 13533, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } i = 0; goto ldv_47980; ldv_47979: bnx2x_cl45_write(bp, phy, (int )reg_set[i].devad, (int )reg_set[i].reg, (int )reg_set[i].val); i = i + 1; ldv_47980: ; if ((unsigned int )i <= 14U) { goto ldv_47979; } else { } vars->link_attr_sync = vars->link_attr_sync & 4294967294U; bnx2x_update_link_attr(params, vars->link_attr_sync); vars->check_kr2_recovery_cnt = 5U; bnx2x_warpcore_restart_AN_KR(phy, params); return; } } static void bnx2x_kr2_recovery(struct link_params *params , struct link_vars *vars , struct bnx2x_phy *phy ) { struct bnx2x *bp ; long tmp ; { bp = params->bp; tmp = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp != 0L) { printk("\rbnx2x: [%s:%d(%s)]KR2 recovery\n", "bnx2x_kr2_recovery", 13551, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } bnx2x_warpcore_enable_AN_KR2(phy, params, vars); bnx2x_warpcore_restart_AN_KR(phy, params); return; } } static void bnx2x_check_kr2_wa(struct link_params *params , struct link_vars *vars , struct bnx2x_phy *phy ) { struct bnx2x *bp ; u16 base_page ; u16 next_page ; u16 not_kr2_device ; u16 lane ; int sigdet ; long tmp ; u8 tmp___0 ; long tmp___1 ; long tmp___2 ; long tmp___3 ; { bp = params->bp; if ((unsigned int )vars->check_kr2_recovery_cnt != 0U) { vars->check_kr2_recovery_cnt = (u8 )((int )vars->check_kr2_recovery_cnt - 1); return; } else { } sigdet = bnx2x_warpcore_get_sigdet(phy, params); if (sigdet == 0) { if ((vars->link_attr_sync & 1U) == 0U) { bnx2x_kr2_recovery(params, vars, phy); tmp = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp != 0L) { printk("\rbnx2x: [%s:%d(%s)]No sigdet\n", "bnx2x_check_kr2_wa", 13578, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } } else { } return; } else { } tmp___0 = bnx2x_get_warpcore_lane(phy, params); lane = (u16 )tmp___0; bnx2x_cl45_write(bp, phy, (int )phy->def_md_devad, 65502, (int )lane); bnx2x_cl45_read(bp, phy, 7, 19, & base_page); bnx2x_cl45_read(bp, phy, 7, 20, & next_page); bnx2x_set_aer_mmd(params, phy); if ((unsigned int )base_page == 0U) { if ((vars->link_attr_sync & 1U) == 0U) { bnx2x_kr2_recovery(params, vars, phy); tmp___1 = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp___1 != 0L) { printk("\rbnx2x: [%s:%d(%s)]No BP\n", "bnx2x_check_kr2_wa", 13596, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } } else { } return; } else { } not_kr2_device = (int )((short )base_page) >= 0; if ((vars->link_attr_sync & 1U) == 0U) { if ((unsigned int )not_kr2_device == 0U) { tmp___2 = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp___2 != 0L) { printk("\rbnx2x: [%s:%d(%s)]BP=0x%x, NP=0x%x\n", "bnx2x_check_kr2_wa", 13613, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )base_page, (int )next_page); } else { } bnx2x_kr2_recovery(params, vars, phy); } else { } return; } else { } if ((unsigned int )not_kr2_device != 0U) { tmp___3 = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp___3 != 0L) { printk("\rbnx2x: [%s:%d(%s)]BP=0x%x, NP=0x%x\n", "bnx2x_check_kr2_wa", 13621, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )base_page, (int )next_page); } else { } bnx2x_disable_kr2(params, vars, phy); return; } else { } return; } } void bnx2x_period_func(struct link_params *params , struct link_vars *vars ) { u16 phy_idx ; struct bnx2x *bp ; long tmp ; int tmp___0 ; struct bnx2x_phy *phy ; int tmp___1 ; unsigned int tmp___2 ; { bp = params->bp; phy_idx = 0U; goto ldv_48010; ldv_48009: ; if (((int )params->phy[(int )phy_idx].flags & 4096) != 0) { bnx2x_set_aer_mmd(params, (struct bnx2x_phy *)(& params->phy) + (unsigned long )phy_idx); tmp___0 = bnx2x_check_half_open_conn(params, vars, 1); if (tmp___0 != 0) { tmp = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp != 0L) { printk("\rbnx2x: [%s:%d(%s)]Fault detection failed\n", "bnx2x_period_func", 13636, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } } else { } goto ldv_48008; } else { } phy_idx = (u16 )((int )phy_idx + 1); ldv_48010: ; if ((unsigned int )phy_idx <= 2U) { goto ldv_48009; } else { } ldv_48008: ; if (((((((((bp->common.chip_id >> 16 == 5770U || bp->common.chip_id >> 16 == 5797U) || bp->common.chip_id >> 16 == 5801U) || bp->common.chip_id >> 16 == 5774U) || bp->common.chip_id >> 16 == 5806U) || bp->common.chip_id >> 16 == 5807U) || ((bp->common.chip_id >> 16 == 5693U || bp->common.chip_id >> 16 == 5694U) || bp->common.chip_id >> 16 == 5695U)) || ((bp->common.chip_id >> 16 == 5793U || bp->common.chip_id >> 16 == 5794U) || bp->common.chip_id >> 16 == 5773U)) || (bp->common.chip_id >> 16 == 5796U || bp->common.chip_id >> 16 == 5803U)) || bp->common.chip_id >> 16 == 5805U) { phy = (struct bnx2x_phy *)(& params->phy); bnx2x_set_aer_mmd(params, phy); if ((phy->supported & 4194304U) != 0U && (phy->speed_cap_mask & 8388608U) != 0U) { bnx2x_check_kr2_wa(params, vars, phy); } else { } bnx2x_check_over_curr(params, vars); if ((unsigned int )vars->rx_tx_asic_rst != 0U) { bnx2x_warpcore_config_runtime(phy, params, vars); } else { } tmp___2 = readl((void const volatile *)(bp->regview + ((unsigned long )params->shmem_base + ((unsigned long )params->port + 1UL) * 400UL))); if ((tmp___2 & 251658240U) == 33554432U) { tmp___1 = bnx2x_is_sfp_module_plugged(phy, params); if (tmp___1 != 0) { bnx2x_sfp_tx_fault_detection(phy, params, vars); } else if ((int )vars->link_status < 0) { vars->link_status = vars->link_status & 2147483647U; vars->phy_flags = (unsigned int )vars->phy_flags & 223U; bnx2x_update_mng(params, vars->link_status); } else { } } else { } } else { } return; } } u8 bnx2x_fan_failure_det_req(struct bnx2x *bp , u32 shmem_base , u32 shmem2_base , u8 port ) { u8 phy_index ; u8 fan_failure_det_req ; struct bnx2x_phy phy ; long tmp ; int tmp___0 ; { fan_failure_det_req = 0U; phy_index = 1U; goto ldv_48023; ldv_48022: tmp___0 = bnx2x_populate_phy(bp, (int )phy_index, shmem_base, shmem2_base, (int )port, & phy); if (tmp___0 != 0) { tmp = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp != 0L) { printk("\rbnx2x: [%s:%d(%s)]populate phy failed\n", "bnx2x_fan_failure_det_req", 13682, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } return (0U); } else { } fan_failure_det_req = (u8 )(((int )((signed char )phy.flags) & 4) | (int )((signed char )fan_failure_det_req)); phy_index = (u8 )((int )phy_index + 1); ldv_48023: ; if ((unsigned int )phy_index <= 2U) { goto ldv_48022; } else { } return (fan_failure_det_req); } } void bnx2x_hw_reset_phy(struct link_params *params ) { u8 phy_index ; struct bnx2x *bp ; { bp = params->bp; bnx2x_update_mng(params, 0U); bnx2x_bits_dis(bp, (u32 )(((int )params->port + 16588) * 4), 3965441U); phy_index = 0U; goto ldv_48031; ldv_48030: ; if ((unsigned long )params->phy[(int )phy_index].hw_reset != (unsigned long )((void (*)(struct bnx2x_phy * , struct link_params * ))0)) { (*(params->phy[(int )phy_index].hw_reset))((struct bnx2x_phy *)(& params->phy) + (unsigned long )phy_index, params); params->phy[(int )phy_index] = phy_null; } else { } phy_index = (u8 )((int )phy_index + 1); ldv_48031: ; if ((unsigned int )phy_index <= 2U) { goto ldv_48030; } else { } return; } } void bnx2x_init_mod_abs_int(struct bnx2x *bp , struct link_vars *vars , u32 chip_id , u32 shmem_base , u32 shmem2_base , u8 port ) { u8 gpio_num ; u8 gpio_port ; u8 phy_index ; u32 val ; u32 offset ; u32 aeu_mask ; u32 swap_val ; u32 swap_override ; u32 sync_offset ; int tmp ; struct bnx2x_phy phy ; long tmp___0 ; int tmp___1 ; long tmp___2 ; { gpio_num = 255U; gpio_port = 255U; if (((((((((bp->common.chip_id >> 16 == 5770U || bp->common.chip_id >> 16 == 5797U) || bp->common.chip_id >> 16 == 5801U) || bp->common.chip_id >> 16 == 5774U) || bp->common.chip_id >> 16 == 5806U) || bp->common.chip_id >> 16 == 5807U) || ((bp->common.chip_id >> 16 == 5693U || bp->common.chip_id >> 16 == 5694U) || bp->common.chip_id >> 16 == 5695U)) || ((bp->common.chip_id >> 16 == 5793U || bp->common.chip_id >> 16 == 5794U) || bp->common.chip_id >> 16 == 5773U)) || (bp->common.chip_id >> 16 == 5796U || bp->common.chip_id >> 16 == 5803U)) || bp->common.chip_id >> 16 == 5805U) { tmp = bnx2x_get_mod_abs_int_cfg(bp, chip_id, shmem_base, (int )port, & gpio_num, & gpio_port); if (tmp != 0) { return; } else { } } else { phy_index = 1U; goto ldv_48054; ldv_48053: tmp___1 = bnx2x_populate_phy(bp, (int )phy_index, shmem_base, shmem2_base, (int )port, & phy); if (tmp___1 != 0) { tmp___0 = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp___0 != 0L) { printk("\rbnx2x: [%s:%d(%s)]populate phy failed\n", "bnx2x_init_mod_abs_int", 13734, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } return; } else { } if (phy.type == 1536U) { gpio_num = 3U; gpio_port = port; goto ldv_48052; } else { } phy_index = (u8 )((int )phy_index + 1); ldv_48054: ; if ((unsigned int )phy_index <= 2U) { goto ldv_48053; } else { } ldv_48052: ; } if ((unsigned int )gpio_num == 255U) { return; } else { } bnx2x_set_gpio(bp, (int )gpio_num, 2U, (int )gpio_port); swap_val = readl((void const volatile *)bp->regview + 66452U); swap_override = readl((void const volatile *)bp->regview + 66456U); gpio_port = (u8 )((int )((signed char )(swap_val != 0U && swap_override != 0U)) ^ (int )((signed char )gpio_port)); vars->aeu_int_mask = (u32 )(4 << ((int )gpio_num + ((int )gpio_port << 2))); sync_offset = ((u32 )port * 400U + shmem_base) + 152U; writel(vars->aeu_int_mask, (void volatile *)bp->regview + (unsigned long )sync_offset); tmp___2 = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp___2 != 0L) { printk("\rbnx2x: [%s:%d(%s)]Setting MOD_ABS (GPIO%d_P%d) AEU to 0x%x\n", "bnx2x_init_mod_abs_int", 13764, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )gpio_num, (int )gpio_port, vars->aeu_int_mask); } else { } if ((unsigned int )port == 0U) { offset = 41068U; } else { offset = 41228U; } aeu_mask = readl((void const volatile *)bp->regview + (unsigned long )offset); aeu_mask = vars->aeu_int_mask | aeu_mask; writel(aeu_mask, (void volatile *)bp->regview + (unsigned long )offset); val = readl((void const volatile *)bp->regview + 41660U); val = (u32 )(1 << ((int )gpio_num + ((int )gpio_port << 2))) | val; writel(val, (void volatile *)bp->regview + 41660U); return; } } void ldv_main1_sequence_infinite_withcheck_stateful(void) { int tmp ; int tmp___0 ; { LDV_IN_INTERRUPT = 1; ldv_initialize(); goto ldv_48074; ldv_48073: tmp = __VERIFIER_nondet_int(); switch (tmp) { default: ; goto ldv_48072; } ldv_48072: ; ldv_48074: tmp___0 = __VERIFIER_nondet_int(); if (tmp___0 != 0) { goto ldv_48073; } else { } ldv_check_final_state(); return; } } void ldv_mutex_lock_29(struct mutex *ldv_func_arg1 ) { { ldv_mutex_lock_lock(ldv_func_arg1); mutex_lock(ldv_func_arg1); return; } } void ldv_mutex_unlock_30(struct mutex *ldv_func_arg1 ) { { ldv_mutex_unlock_lock(ldv_func_arg1); mutex_unlock(ldv_func_arg1); return; } } void ldv_mutex_lock_31(struct mutex *ldv_func_arg1 ) { { ldv_mutex_lock_mutex_of_device(ldv_func_arg1); mutex_lock(ldv_func_arg1); return; } } int ldv_mutex_trylock_32(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_33(struct mutex *ldv_func_arg1 ) { { ldv_mutex_unlock_mutex_of_device(ldv_func_arg1); mutex_unlock(ldv_func_arg1); return; } } __inline static void le16_add_cpu(__le16 *var , u16 val ) { { *var = (int )*var + (int )val; return; } } extern void dump_stack(void) ; extern unsigned long __phys_addr(unsigned long ) ; extern int memcmp(void const * , void const * , size_t ) ; extern size_t strlen(char const * ) ; int ldv_mutex_trylock_48(struct mutex *ldv_func_arg1 ) ; void ldv_mutex_unlock_46(struct mutex *ldv_func_arg1 ) ; void ldv_mutex_unlock_49(struct mutex *ldv_func_arg1 ) ; void ldv_mutex_unlock_54(struct mutex *ldv_func_arg1 ) ; void ldv_mutex_lock_45(struct mutex *ldv_func_arg1 ) ; void ldv_mutex_lock_47(struct mutex *ldv_func_arg1 ) ; void ldv_mutex_lock_53(struct mutex *ldv_func_arg1 ) ; void ldv_mutex_lock_phy_mutex_of_bnx2x_port(struct mutex *lock ) ; void ldv_mutex_unlock_phy_mutex_of_bnx2x_port(struct mutex *lock ) ; __inline static void kmemcheck_mark_initialized(void *address , unsigned int n ) { { return; } } extern void prandom_bytes(void * , int ) ; extern struct page *alloc_pages_current(gfp_t , unsigned int ) ; __inline static struct page *alloc_pages(gfp_t gfp_mask , unsigned int order ) { struct page *tmp ; { tmp = alloc_pages_current(gfp_mask, order); return (tmp); } } __inline static void *kmalloc_array(size_t n , size_t size , gfp_t flags ) { void *tmp ; { if (size != 0UL && 0xffffffffffffffffUL / size < n) { return (0); } else { } tmp = __kmalloc(n * size, flags); return (tmp); } } __inline static void *kcalloc(size_t n , size_t size , gfp_t flags ) { void *tmp ; { tmp = kmalloc_array(n, size, flags | 32768U); return (tmp); } } __inline static __sum16 csum_fold(__wsum sum ) { { __asm__ (" addl %1,%0\n adcl $0xffff,%0": "=r" (sum): "r" (sum << 16), "0" (sum & 4294901760U)); return ((__sum16 )(~ sum >> 16)); } } __inline static __wsum csum_tcpudp_nofold(__be32 saddr , __be32 daddr , unsigned short len , unsigned short proto , __wsum sum ) { { __asm__ (" addl %1, %0\n adcl %2, %0\n adcl %3, %0\n adcl $0, %0\n": "=r" (sum): "g" (daddr), "g" (saddr), "g" (((int )len + (int )proto) << 8), "0" (sum)); return (sum); } } __inline static __sum16 csum_tcpudp_magic(__be32 saddr , __be32 daddr , unsigned short len , unsigned short proto , __wsum sum ) { __wsum tmp ; __sum16 tmp___0 ; { tmp = csum_tcpudp_nofold(saddr, daddr, (int )len, (int )proto, sum); tmp___0 = csum_fold(tmp); return (tmp___0); } } extern __wsum csum_partial(void const * , int , __wsum ) ; extern __sum16 csum_ipv6_magic(struct in6_addr const * , struct in6_addr const * , __u32 , unsigned short , __wsum ) ; __inline static __wsum csum_add(__wsum csum , __wsum addend ) { u32 res ; { res = csum; res = res + addend; return ((u32 )(res < addend) + res); } } __inline static __wsum csum_sub(__wsum csum , __wsum addend ) { __wsum tmp ; { tmp = csum_add(csum, ~ addend); return (tmp); } } __inline static int PageTail(struct page const *page ) { int tmp ; { tmp = constant_test_bit(15U, (unsigned long const volatile *)(& page->flags)); return (tmp); } } __inline static struct page *compound_head(struct page *page ) { int tmp ; long tmp___0 ; { tmp = PageTail((struct page const *)page); tmp___0 = ldv__builtin_expect(tmp != 0, 0L); if (tmp___0 != 0L) { return (page->ldv_19034.first_page); } else { } return (page); } } extern bool __get_page_tail(struct page * ) ; __inline static void get_page(struct page *page ) { bool tmp ; long tmp___0 ; int tmp___1 ; long tmp___2 ; int tmp___3 ; long tmp___4 ; { tmp___1 = PageTail((struct page const *)page); tmp___2 = ldv__builtin_expect(tmp___1 != 0, 0L); if (tmp___2 != 0L) { tmp = __get_page_tail(page); tmp___0 = ldv__builtin_expect((long )tmp, 1L); if (tmp___0 != 0L) { return; } else { } } else { } tmp___3 = atomic_read((atomic_t const *)(& page->ldv_19018.ldv_19017.ldv_19016._count)); tmp___4 = ldv__builtin_expect(tmp___3 <= 0, 0L); if (tmp___4 != 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/mm.h"), "i" (411), "i" (12UL)); ldv_16507: ; goto ldv_16507; } else { } atomic_inc(& page->ldv_19018.ldv_19017.ldv_19016._count); return; } } __inline static struct page *virt_to_head_page(void const *x ) { struct page *page ; unsigned long tmp ; struct page *tmp___0 ; { tmp = __phys_addr((unsigned long )x); page = 0xffffea0000000000UL + (tmp >> 12); tmp___0 = compound_head(page); return (tmp___0); } } extern void put_page(struct page * ) ; __inline static void *lowmem_page_address(struct page const *page ) { { return ((void *)((unsigned long )((unsigned long long )(((long )page + 24189255811072L) / 64L) << 12) + 0xffff880000000000UL)); } } extern void debug_dma_map_page(struct device * , struct page * , size_t , size_t , int , dma_addr_t , bool ) ; extern void debug_dma_mapping_error(struct device * , dma_addr_t ) ; extern void debug_dma_sync_single_for_cpu(struct device * , dma_addr_t , size_t , int ) ; __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_19093: ; goto ldv_19093; } 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_19102: ; goto ldv_19102; } 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 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_19136: ; goto ldv_19136; } 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 void dma_unmap_page___0(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_19144: ; goto ldv_19144; } 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 void dma_sync_single_for_cpu(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" (103), "i" (12UL)); ldv_19152: ; goto ldv_19152; } else { } if ((unsigned long )ops->sync_single_for_cpu != (unsigned long )((void (*)(struct device * , dma_addr_t , size_t , enum dma_data_direction ))0)) { (*(ops->sync_single_for_cpu))(dev, addr, size, dir); } else { } debug_dma_sync_single_for_cpu(dev, addr, size, (int )dir); return; } } __inline static int dma_mapping_error(struct device *dev , dma_addr_t dma_addr ) { struct dma_map_ops *ops ; struct dma_map_ops *tmp ; int tmp___0 ; { tmp = get_dma_ops(dev); ops = tmp; debug_dma_mapping_error(dev, dma_addr); if ((unsigned long )ops->mapping_error != (unsigned long )((int (*)(struct device * , dma_addr_t ))0)) { tmp___0 = (*(ops->mapping_error))(dev, dma_addr); return (tmp___0); } else { } return (dma_addr == 0ULL); } } __inline static unsigned int skb_frag_size(skb_frag_t const *frag ) { { return ((unsigned int )frag->size); } } __inline static void skb_frag_size_set(skb_frag_t *frag , unsigned int size ) { { frag->size = size; return; } } extern void consume_skb(struct sk_buff * ) ; extern struct sk_buff *build_skb(void * , unsigned int ) ; __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); } } __inline static void __skb_fill_page_desc(struct sk_buff *skb , int i , struct page *page , int off , int size ) { skb_frag_t *frag ; unsigned char *tmp ; { tmp = skb_end_pointer((struct sk_buff const *)skb); frag = (skb_frag_t *)(& ((struct skb_shared_info *)tmp)->frags) + (unsigned long )i; frag->page.p = page; frag->page_offset = (__u32 )off; skb_frag_size_set(frag, (unsigned int )size); page = compound_head(page); if ((int )page->ldv_19018.ldv_19002.pfmemalloc && (unsigned long )page->mapping == (unsigned long )((struct address_space *)0)) { skb->pfmemalloc = 1U; } else { } return; } } __inline static void skb_fill_page_desc(struct sk_buff *skb , int i , struct page *page , int off , int size ) { unsigned char *tmp ; { __skb_fill_page_desc(skb, i, page, off, size); tmp = skb_end_pointer((struct sk_buff const *)skb); ((struct skb_shared_info *)tmp)->nr_frags = (unsigned int )((unsigned char )i) + 1U; return; } } extern unsigned char *skb_put(struct sk_buff * , unsigned int ) ; extern unsigned char *__pskb_pull_tail(struct sk_buff * , int ) ; __inline static void skb_reserve(struct sk_buff *skb , int len ) { { skb->data = skb->data + (unsigned long )len; skb->tail = skb->tail + (sk_buff_data_t )len; return; } } __inline static unsigned char *skb_inner_transport_header(struct sk_buff const *skb ) { { return ((unsigned char *)skb->head + (unsigned long )skb->inner_transport_header); } } __inline static unsigned char *skb_inner_network_header(struct sk_buff const *skb ) { { return ((unsigned char *)skb->head + (unsigned long )skb->inner_network_header); } } __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; } } __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 int skb_transport_offset(struct sk_buff const *skb ) { unsigned char *tmp ; { tmp = skb_transport_header(skb); return ((int )((unsigned int )((long )tmp) - (unsigned int )((long )skb->data))); } } extern void *netdev_alloc_frag(unsigned int ) ; extern struct sk_buff *__netdev_alloc_skb(struct net_device * , unsigned int , gfp_t ) ; __inline static struct sk_buff *__netdev_alloc_skb_ip_align(struct net_device *dev , unsigned int length , gfp_t gfp ) { struct sk_buff *skb ; struct sk_buff *tmp ; { tmp = __netdev_alloc_skb(dev, length, gfp); skb = tmp; return (skb); } } __inline static struct sk_buff *netdev_alloc_skb_ip_align(struct net_device *dev , unsigned int length ) { struct sk_buff *tmp ; { tmp = __netdev_alloc_skb_ip_align(dev, length, 32U); return (tmp); } } __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 ) { unsigned char *tmp ; { tmp = __pskb_pull_tail(skb, (int )skb->data_len); return ((unsigned long )tmp != (unsigned long )((unsigned char *)0) ? 0 : -12); } } __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); } } extern int skb_copy_bits(struct sk_buff const * , int , void * , int ) ; __inline static void *skb_header_pointer(struct sk_buff const *skb , int offset , int len , void *buffer ) { int hlen ; unsigned int tmp ; int tmp___0 ; { tmp = skb_headlen(skb); hlen = (int )tmp; if (hlen - offset >= len) { return ((void *)skb->data + (unsigned long )offset); } else { } tmp___0 = skb_copy_bits(skb, offset, buffer, len); if (tmp___0 < 0) { return (0); } else { } return (buffer); } } extern void skb_clone_tx_timestamp(struct sk_buff * ) ; extern void skb_tstamp_tx(struct sk_buff * , struct skb_shared_hwtstamps * ) ; __inline static void sw_tx_timestamp(struct sk_buff *skb ) { unsigned char *tmp ; unsigned char *tmp___0 ; { tmp = skb_end_pointer((struct sk_buff const *)skb); if (((int )((struct skb_shared_info *)tmp)->tx_flags & 2) != 0) { tmp___0 = skb_end_pointer((struct sk_buff const *)skb); if (((int )((struct skb_shared_info *)tmp___0)->tx_flags & 4) == 0) { skb_tstamp_tx(skb, 0); } else { } } else { } return; } } __inline static void skb_tx_timestamp(struct sk_buff *skb ) { { skb_clone_tx_timestamp(skb); sw_tx_timestamp(skb); return; } } __inline static u16 skb_get_queue_mapping(struct sk_buff const *skb ) { { return ((u16 )skb->queue_mapping); } } __inline static void skb_record_rx_queue(struct sk_buff *skb , u16 rx_queue ) { { skb->queue_mapping = (unsigned int )rx_queue + 1U; return; } } extern u16 __skb_tx_hash(struct net_device const * , struct sk_buff const * , unsigned int ) ; __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 bool skb_is_gso_v6(struct sk_buff const *skb ) { unsigned char *tmp ; { tmp = skb_end_pointer(skb); return (((int )((struct skb_shared_info *)tmp)->gso_type & 16) != 0); } } __inline static void skb_checksum_none_assert(struct sk_buff const *skb ) { { return; } } __inline static void dql_queued(struct dql *dql , unsigned int count ) { long tmp ; { tmp = ldv__builtin_expect(count > 268435455U, 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/dynamic_queue_limits.h"), "i" (74), "i" (12UL)); ldv_20922: ; goto ldv_20922; } else { } dql->num_queued = dql->num_queued + count; dql->last_obj_cnt = count; return; } } __inline static int dql_avail(struct dql const *dql ) { { return ((int )((unsigned int )dql->adj_limit - (unsigned int )dql->num_queued)); } } extern void dql_completed(struct dql * , unsigned int ) ; extern void dql_reset(struct dql * ) ; __inline static u32 ethtool_rxfh_indir_default(u32 index , u32 n_rx_rings ) { { return (index % n_rx_rings); } } 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_35848; ldv_35847: msleep(1U); ldv_35848: tmp = test_and_set_bit(0, (unsigned long volatile *)(& n->state)); if (tmp != 0) { goto ldv_35847; } else { } 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" (472), "i" (12UL)); ldv_35853: ; goto ldv_35853; } else { } __asm__ volatile ("": : : "memory"); clear_bit(0, (unsigned long volatile *)(& n->state)); return; } } __inline static int netdev_set_prio_tc_map(struct net_device *dev , u8 prio , u8 tc ) { { if ((int )dev->num_tc <= (int )tc) { return (-22); } else { } dev->prio_tc_map[(int )prio & 15] = (unsigned int )tc & 15U; return (0); } } __inline static int netdev_set_tc_queue(struct net_device *dev , u8 tc , u16 count , u16 offset ) { { if ((int )dev->num_tc <= (int )tc) { return (-22); } else { } dev->tc_to_txq[(int )tc].count = count; dev->tc_to_txq[(int )tc].offset = offset; return (0); } } __inline static int netdev_set_num_tc(struct net_device *dev , u8 num_tc ) { { if ((unsigned int )num_tc > 16U) { return (-22); } else { } dev->num_tc = num_tc; return (0); } } extern void netif_napi_add(struct net_device * , struct napi_struct * , int (*)(struct napi_struct * , int ) , int ) ; __inline static void netif_schedule_queue(struct netdev_queue *txq ) { { if ((txq->state & 3UL) == 0UL) { __netif_schedule(txq->qdisc); } else { } return; } } __inline static void netif_tx_start_all_queues(struct net_device *dev ) { unsigned int i ; struct netdev_queue *txq ; struct netdev_queue *tmp ; { i = 0U; goto ldv_36631; ldv_36630: tmp = netdev_get_tx_queue((struct net_device const *)dev, i); txq = tmp; netif_tx_start_queue(txq); i = i + 1U; ldv_36631: ; if (dev->num_tx_queues > i) { goto ldv_36630; } else { } return; } } __inline static void netif_tx_wake_all_queues___0(struct net_device *dev ) { unsigned int i ; struct netdev_queue *txq ; struct netdev_queue *tmp ; { i = 0U; goto ldv_36645; ldv_36644: tmp = netdev_get_tx_queue((struct net_device const *)dev, i); txq = tmp; netif_tx_wake_queue(txq); i = i + 1U; ldv_36645: ; if (dev->num_tx_queues > i) { goto ldv_36644; } else { } 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 void netdev_tx_sent_queue(struct netdev_queue *dev_queue , unsigned int bytes ) { int tmp ; long tmp___0 ; int tmp___1 ; long tmp___2 ; { dql_queued(& dev_queue->dql, bytes); tmp = dql_avail((struct dql const *)(& dev_queue->dql)); tmp___0 = ldv__builtin_expect(tmp >= 0, 1L); if (tmp___0 != 0L) { return; } else { } set_bit(1U, (unsigned long volatile *)(& dev_queue->state)); __asm__ volatile ("mfence": : : "memory"); tmp___1 = dql_avail((struct dql const *)(& dev_queue->dql)); tmp___2 = ldv__builtin_expect(tmp___1 >= 0, 0L); if (tmp___2 != 0L) { clear_bit(1, (unsigned long volatile *)(& dev_queue->state)); } else { } return; } } __inline static void netdev_tx_completed_queue(struct netdev_queue *dev_queue , unsigned int pkts , unsigned int bytes ) { long tmp ; int tmp___0 ; int tmp___1 ; { tmp = ldv__builtin_expect(bytes == 0U, 0L); if (tmp != 0L) { return; } else { } dql_completed(& dev_queue->dql, bytes); __asm__ volatile ("mfence": : : "memory"); tmp___0 = dql_avail((struct dql const *)(& dev_queue->dql)); if (tmp___0 < 0) { return; } else { } tmp___1 = test_and_clear_bit(1, (unsigned long volatile *)(& dev_queue->state)); if (tmp___1 != 0) { netif_schedule_queue(dev_queue); } else { } return; } } __inline static void netdev_tx_reset_queue(struct netdev_queue *q ) { { clear_bit(1, (unsigned long volatile *)(& q->state)); dql_reset(& q->dql); return; } } extern int netif_set_real_num_tx_queues(struct net_device * , unsigned int ) ; extern int netif_set_real_num_rx_queues(struct net_device * , unsigned int ) ; extern int netif_get_num_default_rss_queues(void) ; extern void dev_kfree_skb_any(struct sk_buff * ) ; extern gro_result_t napi_gro_receive(struct napi_struct * , struct sk_buff * ) ; extern void netif_carrier_on(struct net_device * ) ; __inline static void netif_tx_disable___0(struct net_device *dev ) { unsigned int i ; int cpu ; int pscr_ret__ ; void const *__vpp_verify ; int pfo_ret__ ; int pfo_ret_____0 ; int pfo_ret_____1 ; int pfo_ret_____2 ; struct netdev_queue *txq ; struct netdev_queue *tmp ; { local_bh_disable(); __vpp_verify = 0; switch (4UL) { case 1UL: ; switch (4UL) { case 1UL: __asm__ ("movb %%gs:%P1,%0": "=q" (pfo_ret__): "m" (cpu_number)); goto ldv_37156; case 2UL: __asm__ ("movw %%gs:%P1,%0": "=r" (pfo_ret__): "m" (cpu_number)); goto ldv_37156; case 4UL: __asm__ ("movl %%gs:%P1,%0": "=r" (pfo_ret__): "m" (cpu_number)); goto ldv_37156; case 8UL: __asm__ ("movq %%gs:%P1,%0": "=r" (pfo_ret__): "m" (cpu_number)); goto ldv_37156; default: __bad_percpu_size(); } ldv_37156: pscr_ret__ = pfo_ret__; goto ldv_37162; case 2UL: ; switch (4UL) { case 1UL: __asm__ ("movb %%gs:%P1,%0": "=q" (pfo_ret_____0): "m" (cpu_number)); goto ldv_37166; case 2UL: __asm__ ("movw %%gs:%P1,%0": "=r" (pfo_ret_____0): "m" (cpu_number)); goto ldv_37166; case 4UL: __asm__ ("movl %%gs:%P1,%0": "=r" (pfo_ret_____0): "m" (cpu_number)); goto ldv_37166; case 8UL: __asm__ ("movq %%gs:%P1,%0": "=r" (pfo_ret_____0): "m" (cpu_number)); goto ldv_37166; default: __bad_percpu_size(); } ldv_37166: pscr_ret__ = pfo_ret_____0; goto ldv_37162; case 4UL: ; switch (4UL) { case 1UL: __asm__ ("movb %%gs:%P1,%0": "=q" (pfo_ret_____1): "m" (cpu_number)); goto ldv_37175; case 2UL: __asm__ ("movw %%gs:%P1,%0": "=r" (pfo_ret_____1): "m" (cpu_number)); goto ldv_37175; case 4UL: __asm__ ("movl %%gs:%P1,%0": "=r" (pfo_ret_____1): "m" (cpu_number)); goto ldv_37175; case 8UL: __asm__ ("movq %%gs:%P1,%0": "=r" (pfo_ret_____1): "m" (cpu_number)); goto ldv_37175; default: __bad_percpu_size(); } ldv_37175: pscr_ret__ = pfo_ret_____1; goto ldv_37162; case 8UL: ; switch (4UL) { case 1UL: __asm__ ("movb %%gs:%P1,%0": "=q" (pfo_ret_____2): "m" (cpu_number)); goto ldv_37184; case 2UL: __asm__ ("movw %%gs:%P1,%0": "=r" (pfo_ret_____2): "m" (cpu_number)); goto ldv_37184; case 4UL: __asm__ ("movl %%gs:%P1,%0": "=r" (pfo_ret_____2): "m" (cpu_number)); goto ldv_37184; case 8UL: __asm__ ("movq %%gs:%P1,%0": "=r" (pfo_ret_____2): "m" (cpu_number)); goto ldv_37184; default: __bad_percpu_size(); } ldv_37184: pscr_ret__ = pfo_ret_____2; goto ldv_37162; default: __bad_size_call_parameter(); goto ldv_37162; } ldv_37162: cpu = pscr_ret__; i = 0U; goto ldv_37194; ldv_37193: tmp = netdev_get_tx_queue((struct net_device const *)dev, i); txq = tmp; __netif_tx_lock(txq, cpu); netif_tx_stop_queue(txq); __netif_tx_unlock(txq); i = i + 1U; ldv_37194: ; if (dev->num_tx_queues > i) { goto ldv_37193; } else { } local_bh_enable(); return; } } extern __be16 eth_type_trans(struct sk_buff * , struct net_device * ) ; __inline static bool is_broadcast_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))) == 255U); } } extern int rtnl_is_locked(void) ; __inline static struct sk_buff *__vlan_hwaccel_put_tag(struct sk_buff *skb , __be16 vlan_proto , u16 vlan_tci ) { { skb->vlan_proto = vlan_proto; skb->vlan_tci = (__u16 )((unsigned int )vlan_tci | 4096U); return (skb); } } __inline static __be16 vlan_get_protocol(struct sk_buff const *skb ) { __be16 protocol ; __be16 proto ; __be16 *protop ; void *tmp ; long tmp___0 ; { protocol = 0U; if (((int )skb->vlan_tci & 4096) != 0 || (unsigned int )((unsigned short )skb->protocol) != 129U) { protocol = skb->protocol; } else { tmp = skb_header_pointer(skb, 16, 2, (void *)(& proto)); protop = (__be16 *)tmp; tmp___0 = ldv__builtin_expect((unsigned long )protop != (unsigned long )((__be16 *)0), 1L); if (tmp___0 != 0L) { protocol = *protop; } else { } } return (protocol); } } 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 * ) ; __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 iphdr *inner_ip_hdr(struct sk_buff const *skb ) { unsigned char *tmp ; { tmp = skb_inner_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 unsigned int tcp_hdrlen(struct sk_buff const *skb ) { struct tcphdr *tmp ; { tmp = tcp_hdr(skb); return ((unsigned int )((int )tmp->doff * 4)); } } __inline static struct tcphdr *inner_tcp_hdr(struct sk_buff const *skb ) { unsigned char *tmp ; { tmp = skb_inner_transport_header(skb); return ((struct tcphdr *)tmp); } } __inline static unsigned int inner_tcp_hdrlen(struct sk_buff const *skb ) { struct tcphdr *tmp ; { tmp = inner_tcp_hdr(skb); return ((unsigned int )((int )tmp->doff * 4)); } } __inline static struct ipv6hdr *ipv6_hdr(struct sk_buff const *skb ) { unsigned char *tmp ; { tmp = skb_network_header(skb); return ((struct ipv6hdr *)tmp); } } __inline static struct ipv6hdr *inner_ipv6_hdr(struct sk_buff const *skb ) { unsigned char *tmp ; { tmp = skb_inner_network_header(skb); return ((struct ipv6hdr *)tmp); } } __inline static __sum16 tcp_v4_check(int len , __be32 saddr , __be32 daddr , __wsum base ) { __sum16 tmp ; { tmp = csum_tcpudp_magic(saddr, daddr, (int )((unsigned short )len), 6, base); return (tmp); } } extern int tcp_gro_complete(struct sk_buff * ) ; __inline static __sum16 tcp_v6_check(int len , struct in6_addr const *saddr , struct in6_addr const *daddr , __wsum base ) { __sum16 tmp ; { tmp = csum_ipv6_magic(saddr, daddr, (__u32 )len, 6, base); return (tmp); } } extern pci_power_t pci_choose_state(struct pci_dev * , pm_message_t ) ; extern int pci_enable_msi_block(struct pci_dev * , unsigned int ) ; extern int pci_enable_msix(struct pci_dev * , struct msix_entry * , int ) ; __inline static u8 calc_crc8(u32 data , u8 crc ) { u8 D[32U] ; u8 NewCRC[8U] ; u8 C[8U] ; u8 crc_res ; u8 i ; { i = 0U; goto ldv_50815; ldv_50814: D[(int )i] = (unsigned int )((unsigned char )data) & 1U; data = data >> 1; i = (u8 )((int )i + 1); ldv_50815: ; if ((unsigned int )i <= 31U) { goto ldv_50814; } else { } i = 0U; goto ldv_50818; ldv_50817: C[(int )i] = (unsigned int )crc & 1U; crc = (u8 )((int )crc >> 1); i = (u8 )((int )i + 1); ldv_50818: ; if ((unsigned int )i <= 7U) { goto ldv_50817; } else { } NewCRC[0] = (u8 )(((((((((((((((((int )D[31] ^ (int )D[30]) ^ (int )D[28]) ^ (int )D[23]) ^ (int )D[21]) ^ (int )D[19]) ^ (int )D[18]) ^ (int )D[16]) ^ (int )D[14]) ^ (int )D[12]) ^ (int )D[8]) ^ (int )D[7]) ^ (int )D[6]) ^ (int )D[0]) ^ (int )C[4]) ^ (int )C[6]) ^ (int )C[7]); NewCRC[1] = (u8 )(((((((((((((((((((((((int )D[30] ^ (int )D[29]) ^ (int )D[28]) ^ (int )D[24]) ^ (int )D[23]) ^ (int )D[22]) ^ (int )D[21]) ^ (int )D[20]) ^ (int )D[18]) ^ (int )D[17]) ^ (int )D[16]) ^ (int )D[15]) ^ (int )D[14]) ^ (int )D[13]) ^ (int )D[12]) ^ (int )D[9]) ^ (int )D[6]) ^ (int )D[1]) ^ (int )D[0]) ^ (int )C[0]) ^ (int )C[4]) ^ (int )C[5]) ^ (int )C[6]); NewCRC[2] = (u8 )(((((((((((((((((((int )D[29] ^ (int )D[28]) ^ (int )D[25]) ^ (int )D[24]) ^ (int )D[22]) ^ (int )D[17]) ^ (int )D[15]) ^ (int )D[13]) ^ (int )D[12]) ^ (int )D[10]) ^ (int )D[8]) ^ (int )D[6]) ^ (int )D[2]) ^ (int )D[1]) ^ (int )D[0]) ^ (int )C[0]) ^ (int )C[1]) ^ (int )C[4]) ^ (int )C[5]); NewCRC[3] = (u8 )(((((((((((((((((((int )D[30] ^ (int )D[29]) ^ (int )D[26]) ^ (int )D[25]) ^ (int )D[23]) ^ (int )D[18]) ^ (int )D[16]) ^ (int )D[14]) ^ (int )D[13]) ^ (int )D[11]) ^ (int )D[9]) ^ (int )D[7]) ^ (int )D[3]) ^ (int )D[2]) ^ (int )D[1]) ^ (int )C[1]) ^ (int )C[2]) ^ (int )C[5]) ^ (int )C[6]); NewCRC[4] = (u8 )((((((((((((((((((((int )D[31] ^ (int )D[30]) ^ (int )D[27]) ^ (int )D[26]) ^ (int )D[24]) ^ (int )D[19]) ^ (int )D[17]) ^ (int )D[15]) ^ (int )D[14]) ^ (int )D[12]) ^ (int )D[10]) ^ (int )D[8]) ^ (int )D[4]) ^ (int )D[3]) ^ (int )D[2]) ^ (int )C[0]) ^ (int )C[2]) ^ (int )C[3]) ^ (int )C[6]) ^ (int )C[7]); NewCRC[5] = (u8 )((((((((((((((((((int )D[31] ^ (int )D[28]) ^ (int )D[27]) ^ (int )D[25]) ^ (int )D[20]) ^ (int )D[18]) ^ (int )D[16]) ^ (int )D[15]) ^ (int )D[13]) ^ (int )D[11]) ^ (int )D[9]) ^ (int )D[5]) ^ (int )D[4]) ^ (int )D[3]) ^ (int )C[1]) ^ (int )C[3]) ^ (int )C[4]) ^ (int )C[7]); NewCRC[6] = (u8 )((((((((((((((((int )D[29] ^ (int )D[28]) ^ (int )D[26]) ^ (int )D[21]) ^ (int )D[19]) ^ (int )D[17]) ^ (int )D[16]) ^ (int )D[14]) ^ (int )D[12]) ^ (int )D[10]) ^ (int )D[6]) ^ (int )D[5]) ^ (int )D[4]) ^ (int )C[2]) ^ (int )C[4]) ^ (int )C[5]); NewCRC[7] = (u8 )((((((((((((((((int )D[30] ^ (int )D[29]) ^ (int )D[27]) ^ (int )D[22]) ^ (int )D[20]) ^ (int )D[18]) ^ (int )D[17]) ^ (int )D[15]) ^ (int )D[13]) ^ (int )D[11]) ^ (int )D[7]) ^ (int )D[6]) ^ (int )D[5]) ^ (int )C[3]) ^ (int )C[5]) ^ (int )C[6]); crc_res = 0U; i = 0U; goto ldv_50821; ldv_50820: crc_res = (u8 )((int )((signed char )((int )NewCRC[(int )i] << (int )i)) | (int )((signed char )crc_res)); i = (u8 )((int )i + 1); ldv_50821: ; if ((unsigned int )i <= 7U) { goto ldv_50820; } else { } return (crc_res); } } void bnx2x_init_rx_mode_obj(struct bnx2x *bp , struct bnx2x_rx_mode_obj *o ) ; void bnx2x_init_mcast_obj(struct bnx2x *bp , struct bnx2x_mcast_obj *mcast_obj , u8 mcast_cl_id , u32 mcast_cid , u8 func_id , u8 engine_id , void *rdata , dma_addr_t rdata_mapping , int state , unsigned long *pstate , bnx2x_obj_type type ) ; void bnx2x_init_mac_credit_pool(struct bnx2x *bp , struct bnx2x_credit_pool_obj *p , u8 func_id , u8 func_num ) ; void bnx2x_init_vlan_credit_pool(struct bnx2x *bp , struct bnx2x_credit_pool_obj *p , u8 func_id , u8 func_num ) ; void bnx2x_init_rss_config_obj(struct bnx2x *bp , struct bnx2x_rss_config_obj *rss_obj , u8 cl_id , u32 cid , u8 func_id , u8 engine_id , void *rdata , dma_addr_t rdata_mapping , int state , unsigned long *pstate , bnx2x_obj_type type ) ; int bnx2x_config_rss(struct bnx2x *bp , struct bnx2x_config_rss_params *p ) ; int bnx2x_get_cur_phy_idx(struct bnx2x *bp ) ; int bnx2x_iov_nic_init(struct bnx2x *bp ) ; int bnx2x_vfpf_init(struct bnx2x *bp ) ; void bnx2x_vfpf_close_vf(struct bnx2x *bp ) ; int bnx2x_vfpf_setup_q(struct bnx2x *bp , int fp_idx ) ; __inline static void bnx2x_vf_fill_fw_str(struct bnx2x *bp , char *buf , size_t buf_len ) { { strlcpy(buf, (char const *)(& bp->acquire_resp.pfdev_info.fw_ver), buf_len); return; } } __inline static int bnx2x_vf_headroom(struct bnx2x *bp ) { { return ((int )(bp->vfdb)->sriov.nr_virtfn); } } int bnx2x_config_rss_pf(struct bnx2x *bp , struct bnx2x_rss_config_obj *rss_obj , bool config_hash ) ; u16 bnx2x_get_mf_speed(struct bnx2x *bp ) ; void bnx2x_dcbx_init(struct bnx2x *bp , bool update_shmem ) ; void bnx2x_update_max_mf_config(struct bnx2x *bp , u32 value ) ; __inline static void bnx2x_update_rx_prod(struct bnx2x *bp , struct bnx2x_fastpath *fp , u16 bd_prod , u16 rx_comp_prod , u16 rx_sge_prod ) { struct ustorm_eth_rx_producers rx_prods ; u32 i ; long tmp ; { rx_prods.cqe_prod = 0U; rx_prods.bd_prod = (unsigned short)0; rx_prods.sge_prod = (unsigned short)0; rx_prods.reserved = (unsigned short)0; rx_prods.bd_prod = bd_prod; rx_prods.cqe_prod = rx_comp_prod; rx_prods.sge_prod = rx_sge_prod; __asm__ volatile ("sfence": : : "memory"); i = 0U; goto ldv_53613; ldv_53612: writel(*((u32 *)(& rx_prods) + (unsigned long )i), (void volatile *)bp->regview + (unsigned long )(fp->ustorm_rx_prods_offset + i * 4U)); i = i + 1U; ldv_53613: ; if (i <= 1U) { goto ldv_53612; } else { } __asm__ volatile ("": : : "memory"); tmp = ldv__builtin_expect((bp->msg_enable & 2048) != 0, 0L); if (tmp != 0L) { printk("\rbnx2x: [%s:%d(%s)]queue[%d]: wrote bd_prod %u cqe_prod %u sge_prod %u\n", "bnx2x_update_rx_prod", 550, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )fp->index, (int )bd_prod, (int )rx_comp_prod, (int )rx_sge_prod); } else { } return; } } int bnx2x_reload_if_running(struct net_device *dev ) ; int bnx2x_rx_int(struct bnx2x_fastpath *fp , int budget ) ; int bnx2x_tx_int(struct bnx2x *bp , struct bnx2x_fp_txdata *txdata ) ; void bnx2x_free_fp_mem_cnic(struct bnx2x *bp ) ; int bnx2x_alloc_fp_mem_cnic(struct bnx2x *bp ) ; int bnx2x_alloc_fp_mem(struct bnx2x *bp ) ; void bnx2x_free_skbs_cnic(struct bnx2x *bp ) ; void bnx2x_netif_start(struct bnx2x *bp ) ; int bnx2x_poll(struct napi_struct *napi , int budget ) ; __inline static u16 bnx2x_tx_avail(struct bnx2x *bp , struct bnx2x_fp_txdata *txdata ) { s16 used ; u16 prod ; u16 cons ; { prod = txdata->tx_bd_prod; cons = txdata->tx_bd_cons; used = (short )((int )prod - (int )cons); return ((int )((u16 )txdata->tx_ring_size) - (int )((u16 )used)); } } __inline static bool bnx2x_has_tx_work___0(struct bnx2x_fastpath *fp ) { u8 cos ; int tmp ; { cos = 0U; goto ldv_53749; ldv_53748: tmp = bnx2x_tx_queue_has_work(fp->txdata_ptr[(int )cos]); if (tmp != 0) { return (1); } else { } cos = (u8 )((int )cos + 1); ldv_53749: ; if ((int )fp->max_cos > (int )cos) { goto ldv_53748; } else { } return (0); } } __inline static void bnx2x_tx_disable___0(struct bnx2x *bp ) { { netif_tx_disable___0(bp->dev); netif_carrier_off(bp->dev); return; } } __inline static void bnx2x_free_rx_sge___0(struct bnx2x *bp , struct bnx2x_fastpath *fp , u16 index ) { struct sw_rx_page *sw_buf ; struct page *page ; struct eth_rx_sge *sge ; { sw_buf = fp->rx_page_ring + (unsigned long )index; page = sw_buf->page; sge = fp->rx_sge_ring + (unsigned long )index; if ((unsigned long )page == (unsigned long )((struct page *)0)) { return; } else { } dma_unmap_page___0(& (bp->pdev)->dev, sw_buf->mapping, 4096UL, 2); __free_pages(page, 0U); sw_buf->page = 0; sge->addr_hi = 0U; sge->addr_lo = 0U; return; } } __inline static void bnx2x_add_all_napi_cnic(struct bnx2x *bp ) { int i ; { i = (int )bp->num_ethernet_queues; goto ldv_53772; ldv_53771: ; if ((bp->flags & 32768U) != 0U && (uint )i == (uint )bp->num_queues - bp->num_cnic_queues) { } else { netif_napi_add(bp->dev, & (bp->fp + (unsigned long )i)->napi, & bnx2x_poll, 64); } i = i + 1; ldv_53772: ; if (bp->num_queues > i) { goto ldv_53771; } else { } return; } } __inline static void bnx2x_add_all_napi(struct bnx2x *bp ) { int i ; { i = 0; goto ldv_53779; ldv_53778: netif_napi_add(bp->dev, & (bp->fp + (unsigned long )i)->napi, & bnx2x_poll, 64); i = i + 1; ldv_53779: ; if ((uint )i < bp->num_ethernet_queues) { goto ldv_53778; } else { } return; } } __inline static void bnx2x_del_all_napi_cnic___0(struct bnx2x *bp ) { int i ; { i = (int )bp->num_ethernet_queues; goto ldv_53787; ldv_53786: ; if ((bp->flags & 32768U) != 0U && (uint )i == (uint )bp->num_queues - bp->num_cnic_queues) { } else { netif_napi_del(& (bp->fp + (unsigned long )i)->napi); } i = i + 1; ldv_53787: ; if (bp->num_queues > i) { goto ldv_53786; } else { } return; } } __inline static void bnx2x_del_all_napi___0(struct bnx2x *bp ) { int i ; { i = 0; goto ldv_53794; ldv_53793: netif_napi_del(& (bp->fp + (unsigned long )i)->napi); i = i + 1; ldv_53794: ; if ((uint )i < bp->num_ethernet_queues) { goto ldv_53793; } else { } return; } } __inline static int bnx2x_calc_num_queues(struct bnx2x *bp ) { int __min1 ; int __min2 ; int __min1___0 ; int tmp ; int __min2___0 ; int tmp___0 ; { if (num_queues != 0) { __min1 = num_queues; __min2 = (int )bp->igu_sb_cnt - (int )bp->cnic_support; tmp___0 = __min1 < __min2 ? __min1 : __min2; } else { tmp = netif_get_num_default_rss_queues(); __min1___0 = tmp; __min2___0 = (int )bp->igu_sb_cnt - (int )bp->cnic_support; tmp___0 = __min1___0 < __min2___0 ? __min1___0 : __min2___0; } return (tmp___0); } } __inline static void bnx2x_clear_sge_mask_next_elems(struct bnx2x_fastpath *fp ) { int i ; int j ; int idx ; { i = 1; goto ldv_53820; ldv_53819: idx = (int )((unsigned int )((unsigned long )i) * 512U - 1U); j = 0; goto ldv_53817; ldv_53816: fp->sge_mask[idx >> 6] = fp->sge_mask[idx >> 6] & ~ (1ULL << (idx & 63)); idx = idx - 1; j = j + 1; ldv_53817: ; if (j <= 1) { goto ldv_53816; } else { } i = i + 1; ldv_53820: ; if (i <= 2) { goto ldv_53819; } else { } return; } } __inline static void bnx2x_init_sge_ring_bit_mask(struct bnx2x_fastpath *fp ) { { memset((void *)(& fp->sge_mask), 255, 128UL); bnx2x_clear_sge_mask_next_elems(fp); return; } } __inline static void bnx2x_reuse_rx_data(struct bnx2x_fastpath *fp , u16 cons , u16 prod ) { struct sw_rx_bd *cons_rx_buf ; struct sw_rx_bd *prod_rx_buf ; struct eth_rx_bd *cons_bd ; struct eth_rx_bd *prod_bd ; { cons_rx_buf = fp->rx_buf_ring + (unsigned long )cons; prod_rx_buf = fp->rx_buf_ring + (unsigned long )prod; cons_bd = fp->rx_desc_ring + (unsigned long )cons; prod_bd = fp->rx_desc_ring + (unsigned long )prod; prod_rx_buf->mapping = cons_rx_buf->mapping; prod_rx_buf->data = cons_rx_buf->data; *prod_bd = *cons_bd; return; } } __inline static int bnx2x_config_rss_eth(struct bnx2x *bp , bool config_hash ) { int tmp ; { tmp = bnx2x_config_rss_pf(bp, & bp->rss_conf_obj, (int )config_hash); return (tmp); } } __inline static int bnx2x_func_start(struct bnx2x *bp ) { struct bnx2x_func_state_params func_params ; struct bnx2x_func_start_params *start_params ; int tmp ; { func_params.f_obj = 0; func_params.cmd = 0; func_params.ramrod_flags = 0UL; func_params.params.tx_start.traffic_type_to_priority_cos[0].priority = (unsigned char)0; func_params.params.tx_start.traffic_type_to_priority_cos[0].cos = (unsigned char)0; func_params.params.tx_start.traffic_type_to_priority_cos[0].reserved1 = (unsigned short)0; func_params.params.tx_start.traffic_type_to_priority_cos[1].priority = (unsigned char)0; func_params.params.tx_start.traffic_type_to_priority_cos[1].cos = (unsigned char)0; func_params.params.tx_start.traffic_type_to_priority_cos[1].reserved1 = (unsigned short)0; func_params.params.tx_start.traffic_type_to_priority_cos[2].priority = (unsigned char)0; func_params.params.tx_start.traffic_type_to_priority_cos[2].cos = (unsigned char)0; func_params.params.tx_start.traffic_type_to_priority_cos[2].reserved1 = (unsigned short)0; func_params.params.tx_start.traffic_type_to_priority_cos[3].priority = (unsigned char)0; func_params.params.tx_start.traffic_type_to_priority_cos[3].cos = (unsigned char)0; func_params.params.tx_start.traffic_type_to_priority_cos[3].reserved1 = (unsigned short)0; func_params.params.tx_start.traffic_type_to_priority_cos[4].priority = (unsigned char)0; func_params.params.tx_start.traffic_type_to_priority_cos[4].cos = (unsigned char)0; func_params.params.tx_start.traffic_type_to_priority_cos[4].reserved1 = (unsigned short)0; func_params.params.tx_start.traffic_type_to_priority_cos[5].priority = (unsigned char)0; func_params.params.tx_start.traffic_type_to_priority_cos[5].cos = (unsigned char)0; func_params.params.tx_start.traffic_type_to_priority_cos[5].reserved1 = (unsigned short)0; func_params.params.tx_start.traffic_type_to_priority_cos[6].priority = (unsigned char)0; func_params.params.tx_start.traffic_type_to_priority_cos[6].cos = (unsigned char)0; func_params.params.tx_start.traffic_type_to_priority_cos[6].reserved1 = (unsigned short)0; func_params.params.tx_start.traffic_type_to_priority_cos[7].priority = (unsigned char)0; func_params.params.tx_start.traffic_type_to_priority_cos[7].cos = (unsigned char)0; func_params.params.tx_start.traffic_type_to_priority_cos[7].reserved1 = (unsigned short)0; func_params.params.tx_start.dcb_enabled = (unsigned char)0; func_params.params.tx_start.dcb_version = (unsigned char)0; func_params.params.tx_start.dont_add_pri_0_en = (unsigned char)0; start_params = & func_params.params.start; __set_bit(2, (unsigned long volatile *)(& func_params.ramrod_flags)); func_params.f_obj = & bp->func_obj; func_params.cmd = 1; start_params->mf_mode = (u16 )bp->mf_mode; start_params->sd_vlan_tag = bp->mf_ov; if (((bp->common.chip_id >> 16 == 5730U || bp->common.chip_id >> 16 == 5731U) || bp->common.chip_id >> 16 == 5743U) || (((((((((bp->common.chip_id >> 16 == 5770U || bp->common.chip_id >> 16 == 5797U) || bp->common.chip_id >> 16 == 5801U) || bp->common.chip_id >> 16 == 5774U) || bp->common.chip_id >> 16 == 5806U) || bp->common.chip_id >> 16 == 5807U) || ((bp->common.chip_id >> 16 == 5693U || bp->common.chip_id >> 16 == 5694U) || bp->common.chip_id >> 16 == 5695U)) || ((bp->common.chip_id >> 16 == 5793U || bp->common.chip_id >> 16 == 5794U) || bp->common.chip_id >> 16 == 5773U)) || (bp->common.chip_id >> 16 == 5796U || bp->common.chip_id >> 16 == 5803U)) || bp->common.chip_id >> 16 == 5805U)) { start_params->network_cos_mode = 1U; } else { start_params->network_cos_mode = 2U; } start_params->gre_tunnel_mode = 3U; start_params->gre_tunnel_rss = 1U; tmp = bnx2x_func_state_change(bp, & func_params); return (tmp); } } __inline static void bnx2x_set_fw_mac_addr(__le16 *fw_hi , __le16 *fw_mid , __le16 *fw_lo , u8 *mac ) { { *((u8 *)fw_hi) = *(mac + 1UL); *((u8 *)fw_hi + 1UL) = *mac; *((u8 *)fw_mid) = *(mac + 3UL); *((u8 *)fw_mid + 1UL) = *(mac + 2UL); *((u8 *)fw_lo) = *(mac + 5UL); *((u8 *)fw_lo + 1UL) = *(mac + 4UL); return; } } __inline static void bnx2x_free_rx_sge_range___0(struct bnx2x *bp , struct bnx2x_fastpath *fp , int last ) { int i ; { if ((unsigned int )fp->disable_tpa != 0U) { return; } else { } i = 0; goto ldv_53860; ldv_53859: bnx2x_free_rx_sge___0(bp, fp, (int )((u16 )i)); i = i + 1; ldv_53860: ; if (i < last) { goto ldv_53859; } else { } return; } } __inline static void bnx2x_set_next_page_rx_bd(struct bnx2x_fastpath *fp ) { int i ; struct eth_rx_bd *rx_bd ; { i = 1; goto ldv_53868; ldv_53867: rx_bd = fp->rx_desc_ring + ((unsigned long )i * 512UL + 0xfffffffffffffffeUL); rx_bd->addr_hi = (unsigned int )((fp->rx_desc_mapping + (dma_addr_t )((i % 8) * 4096)) >> 32); rx_bd->addr_lo = (unsigned int )fp->rx_desc_mapping + (unsigned int )((i % 8) * 4096); i = i + 1; ldv_53868: ; if (i <= 8) { goto ldv_53867; } else { } return; } } __inline static u8 bnx2x_get_path_func_num(struct bnx2x *bp ) { u8 func_num ; u8 i ; u32 func_config ; unsigned int tmp ; int __ret_warn_on ; long tmp___0 ; { func_num = 0U; if (bp->common.chip_id >> 16 == 5710U) { return (1U); } else { } if ((bp->common.chip_id & 61440U) > 20480U) { if ((unsigned int )bp->mf_mode != 0U) { func_num = 4U; } else { func_num = 2U; } } else { i = 0U; goto ldv_53886; ldv_53885: tmp = readl((void const volatile *)(bp->regview + (((unsigned long )bp->common.mf_cfg_base + (unsigned long )(((int )bp->pfid & 1) + (int )i * 2) * 24UL) + 36UL))); func_config = tmp; func_num = ((int )func_config & 1 ? 0U : 1U) + (unsigned int )func_num; i = (u8 )((int )i + 1); ldv_53886: ; if ((unsigned int )i <= 3U) { goto ldv_53885; } else { } } __ret_warn_on = (unsigned int )func_num == 0U; tmp___0 = ldv__builtin_expect(__ret_warn_on != 0, 0L); if (tmp___0 != 0L) { warn_slowpath_null("/work/ldvuser/exper_fp/inst/current/envs/linux-3.10-rc1.tar/linux-3.10-rc1/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.h", 1107); } else { } ldv__builtin_expect(__ret_warn_on != 0, 0L); return (func_num); } } __inline static void bnx2x_init_bp_objs(struct bnx2x *bp ) { u8 tmp ; u8 tmp___0 ; { bnx2x_init_rx_mode_obj(bp, & bp->rx_mode_obj); bnx2x_init_mcast_obj(bp, & bp->mcast_obj, (int )(bp->fp)->cl_id, (bp->fp)->cid, (int )bp->pfid, (int )bp->pfid, (void *)(& (bp->slowpath)->mcast_rdata), bp->slowpath_mapping + 1296ULL, 9, & bp->sp_state, 0); tmp = bnx2x_get_path_func_num(bp); bnx2x_init_mac_credit_pool(bp, & bp->macs_pool, (int )bp->pfid, (int )tmp); tmp___0 = bnx2x_get_path_func_num(bp); bnx2x_init_vlan_credit_pool(bp, & bp->vlans_pool, (int )bp->pf_num >> 1, (int )tmp___0); bnx2x_init_rss_config_obj(bp, & bp->rss_conf_obj, (int )(bp->fp)->cl_id, (bp->fp)->cid, (int )bp->pfid, (int )bp->pfid, (void *)(& (bp->slowpath)->rss_rdata), bp->slowpath_mapping + 2328ULL, 11, & bp->sp_state, 0); return; } } __inline static int bnx2x_clean_tx_queue___0(struct bnx2x *bp , struct bnx2x_fp_txdata *txdata ) { int cnt ; int tmp ; { cnt = 1000; goto ldv_53932; ldv_53931: ; if (cnt == 0) { printk("\vbnx2x: [%s:%d(%s)]timeout waiting for queue[%d]: txdata->tx_pkt_prod(%d) != txdata->tx_pkt_cons(%d)\n", "bnx2x_clean_tx_queue", 1235, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", txdata->txq_index, (int )txdata->tx_pkt_prod, (int )txdata->tx_pkt_cons); goto ldv_53930; } else { } cnt = cnt - 1; usleep_range(1000UL, 2000UL); ldv_53932: tmp = bnx2x_has_tx_work_unload(txdata); if (tmp != 0) { goto ldv_53931; } else { } ldv_53930: ; return (0); } } __inline static bool bnx2x_wait_sp_comp___0(struct bnx2x *bp , unsigned long mask ) { int tout ; int tmp ; { tout = 5000; goto ldv_53951; ldv_53950: __asm__ volatile ("mfence": : : "memory"); netif_addr_lock_bh(bp->dev); if ((bp->sp_state & mask) == 0UL) { netif_addr_unlock_bh(bp->dev); return (1); } else { } netif_addr_unlock_bh(bp->dev); usleep_range(1000UL, 2000UL); ldv_53951: tmp = tout; tout = tout - 1; if (tmp != 0) { goto ldv_53950; } else { } __asm__ volatile ("mfence": : : "memory"); netif_addr_lock_bh(bp->dev); if ((bp->sp_state & mask) != 0UL) { printk("\vbnx2x: [%s:%d(%s)]Filtering completion timed out. sp_state 0x%lx, mask 0x%lx\n", "bnx2x_wait_sp_comp", 1287, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", bp->sp_state, mask); netif_addr_unlock_bh(bp->dev); return (0); } else { } netif_addr_unlock_bh(bp->dev); return (1); } } __inline static bool bnx2x_mtu_allows_gro(int mtu ) { int fpp ; { fpp = (int )(4096UL / (unsigned long )(mtu + -72)); return ((bool )((unsigned int )mtu <= 4096U && (unsigned int )(fpp * 8) <= 17U)); } } __inline static void bnx2x_update_drv_flags(struct bnx2x *bp , u32 flags , u32 set ) { u32 drv_flags ; long tmp ; unsigned int tmp___0 ; { if (bp->common.shmem2_base != 0U) { tmp___0 = readl((void const volatile *)bp->regview + (unsigned long )bp->common.shmem2_base); if (tmp___0 > 188U) { bnx2x_acquire_hw_lock(bp, 10U); drv_flags = readl((void const volatile *)(bp->regview + ((unsigned long )bp->common.shmem2_base + 188UL))); if (set != 0U) { drv_flags = drv_flags | flags; } else { drv_flags = ~ flags & drv_flags; } writel(drv_flags, (void volatile *)(bp->regview + ((unsigned long )bp->common.shmem2_base + 188UL))); tmp = ldv__builtin_expect((bp->msg_enable & 32) != 0, 0L); if (tmp != 0L) { printk("\rbnx2x: [%s:%d(%s)]drv_flags 0x%08x\n", "bnx2x_update_drv_flags", 1394, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", drv_flags); } else { } bnx2x_release_hw_lock(bp, 10U); } else { } } else { } return; } } void bnx2x_fill_fw_str(struct bnx2x *bp , char *buf , size_t buf_len ) ; __inline static void bnx2x_move_fp(struct bnx2x *bp , int from , int to ) { struct bnx2x_fastpath *from_fp ; struct bnx2x_fastpath *to_fp ; struct bnx2x_sp_objs *from_sp_objs ; struct bnx2x_sp_objs *to_sp_objs ; struct bnx2x_fp_stats *from_fp_stats ; struct bnx2x_fp_stats *to_fp_stats ; int old_max_eth_txqs ; int new_max_eth_txqs ; int old_txdata_index ; int new_txdata_index ; size_t __len ; void *__ret ; size_t __len___0 ; void *__ret___0 ; size_t __len___1 ; void *__ret___1 ; size_t __len___2 ; void *__ret___2 ; { from_fp = bp->fp + (unsigned long )from; to_fp = bp->fp + (unsigned long )to; from_sp_objs = bp->sp_objs + (unsigned long )from; to_sp_objs = bp->sp_objs + (unsigned long )to; from_fp_stats = bp->fp_stats + (unsigned long )from; to_fp_stats = bp->fp_stats + (unsigned long )to; old_txdata_index = 0; new_txdata_index = 0; from_fp->napi = to_fp->napi; __len = 528UL; if (__len > 63UL) { __ret = __memcpy((void *)to_fp, (void const *)from_fp, __len); } else { __ret = __builtin_memcpy((void *)to_fp, (void const *)from_fp, __len); } to_fp->index = (u8 )to; __len___0 = 488UL; if (__len___0 > 63UL) { __ret___0 = __memcpy((void *)to_sp_objs, (void const *)from_sp_objs, __len___0); } else { __ret___0 = __builtin_memcpy((void *)to_sp_objs, (void const *)from_sp_objs, __len___0); } __len___1 = 512UL; if (__len___1 > 63UL) { __ret___1 = __memcpy((void *)to_fp_stats, (void const *)from_fp_stats, __len___1); } else { __ret___1 = __builtin_memcpy((void *)to_fp_stats, (void const *)from_fp_stats, __len___1); } old_max_eth_txqs = (int )(bp->num_ethernet_queues * (uint )bp->max_cos); new_max_eth_txqs = (int )(((bp->num_ethernet_queues - (uint )from) + (uint )to) * (uint )bp->max_cos); if ((uint )from == (uint )bp->num_queues - bp->num_cnic_queues) { old_txdata_index = old_max_eth_txqs; new_txdata_index = new_max_eth_txqs; } else { } __len___2 = 80UL; if (__len___2 > 63UL) { __ret___2 = __memcpy((void *)bp->bnx2x_txq + (unsigned long )new_txdata_index, (void const *)bp->bnx2x_txq + (unsigned long )old_txdata_index, __len___2); } else { __ret___2 = __builtin_memcpy((void *)bp->bnx2x_txq + (unsigned long )new_txdata_index, (void const *)bp->bnx2x_txq + (unsigned long )old_txdata_index, __len___2); } to_fp->txdata_ptr[0] = bp->bnx2x_txq + (unsigned long )new_txdata_index; return; } } void bnx2x_fill_fw_str(struct bnx2x *bp , char *buf , size_t buf_len ) { u8 phy_fw_ver[20U] ; size_t tmp ; size_t tmp___0 ; { if ((bp->flags & 4194304U) == 0U) { phy_fw_ver[0] = 0U; bnx2x_get_ext_phy_fw_version(& bp->link_params, (u8 *)(& phy_fw_ver), 20); strlcpy(buf, (char const *)(& bp->fw_ver), buf_len); tmp = strlen((char const *)(& bp->fw_ver)); tmp___0 = strlen((char const *)(& bp->fw_ver)); snprintf(buf + tmp___0, 32UL - tmp, "bc %d.%d.%d%s%s", (bp->common.bc_ver & 16711680U) >> 16, (bp->common.bc_ver & 65280U) >> 8, bp->common.bc_ver & 255U, (unsigned int )phy_fw_ver[0] != 0U ? (char *)" phy " : (char *)"", (u8 *)(& phy_fw_ver)); } else { bnx2x_vf_fill_fw_str(bp, buf, buf_len); } return; } } static void bnx2x_shrink_eth_fp(struct bnx2x *bp , int delta ) { int i ; int cos ; int old_eth_num ; struct bnx2x_fastpath *fp ; int new_idx ; size_t __len ; void *__ret ; { old_eth_num = (int )bp->num_ethernet_queues; cos = 1; goto ldv_54326; ldv_54325: i = 0; goto ldv_54323; ldv_54322: fp = bp->fp + (unsigned long )i; new_idx = (old_eth_num - delta) * cos + i; __len = 80UL; if (__len > 63UL) { __ret = __memcpy((void *)bp->bnx2x_txq + (unsigned long )new_idx, (void const *)fp->txdata_ptr[cos], __len); } else { __ret = __builtin_memcpy((void *)bp->bnx2x_txq + (unsigned long )new_idx, (void const *)fp->txdata_ptr[cos], __len); } fp->txdata_ptr[cos] = bp->bnx2x_txq + (unsigned long )new_idx; i = i + 1; ldv_54323: ; if (old_eth_num - delta > i) { goto ldv_54322; } else { } cos = cos + 1; ldv_54326: ; if ((int )bp->max_cos > cos) { goto ldv_54325; } else { } return; } } int load_count[2U][3U] = { { 0}}; static u16 bnx2x_free_tx_pkt(struct bnx2x *bp , struct bnx2x_fp_txdata *txdata , u16 idx , unsigned int *pkts_compl , unsigned int *bytes_compl ) { struct sw_tx_bd *tx_buf ; struct eth_tx_start_bd *tx_start_bd ; struct eth_tx_bd *tx_data_bd ; struct sk_buff *skb ; u16 bd_idx ; u16 new_cons ; int nbd ; long tmp ; int __ret_warn_on ; long tmp___0 ; long tmp___1 ; { tx_buf = txdata->tx_buf_ring + (unsigned long )idx; skb = tx_buf->skb; bd_idx = (unsigned int )tx_buf->first_bd & 4095U; __builtin_prefetch((void const *)(& skb->end)); tmp = ldv__builtin_expect((bp->msg_enable & 1024) != 0, 0L); if (tmp != 0L) { printk("\rbnx2x: [%s:%d(%s)]fp[%d]: pkt_idx %d buff @(%p)->skb %p\n", "bnx2x_free_tx_pkt", 232, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", txdata->txq_index, (int )idx, tx_buf, skb); } else { } tx_start_bd = & (txdata->tx_desc_ring + (unsigned long )bd_idx)->start_bd; dma_unmap_single_attrs(& (bp->pdev)->dev, ((unsigned long long )tx_start_bd->addr_hi << 32) + (unsigned long long )tx_start_bd->addr_lo, (size_t )tx_start_bd->nbytes, 1, 0); nbd = (int )tx_start_bd->nbd + -1; new_cons = (int )tx_buf->first_bd + (int )((u16 )nbd); bd_idx = ((unsigned long )bd_idx & 255UL) == 254UL ? ((unsigned int )bd_idx + 2U) & 4095U : ((unsigned int )bd_idx + 1U) & 4095U; nbd = nbd - 1; bd_idx = ((unsigned long )bd_idx & 255UL) == 254UL ? ((unsigned int )bd_idx + 2U) & 4095U : ((unsigned int )bd_idx + 1U) & 4095U; if ((int )tx_buf->flags & 1) { nbd = nbd - 1; bd_idx = ((unsigned long )bd_idx & 255UL) == 254UL ? ((unsigned int )bd_idx + 2U) & 4095U : ((unsigned int )bd_idx + 1U) & 4095U; } else { } goto ldv_54345; ldv_54344: tx_data_bd = & (txdata->tx_desc_ring + (unsigned long )bd_idx)->reg_bd; dma_unmap_page___0(& (bp->pdev)->dev, ((unsigned long long )tx_data_bd->addr_hi << 32) + (unsigned long long )tx_data_bd->addr_lo, (size_t )tx_data_bd->nbytes, 1); nbd = nbd - 1; if (nbd != 0) { bd_idx = ((unsigned long )bd_idx & 255UL) == 254UL ? ((unsigned int )bd_idx + 2U) & 4095U : ((unsigned int )bd_idx + 1U) & 4095U; } else { } ldv_54345: ; if (nbd > 0) { goto ldv_54344; } else { } __ret_warn_on = (unsigned long )skb == (unsigned long )((struct sk_buff *)0); tmp___0 = ldv__builtin_expect(__ret_warn_on != 0, 0L); if (tmp___0 != 0L) { warn_slowpath_null("/work/ldvuser/exper_fp/work/current--X--drivers--X--defaultlinux-3.10-rc1.tar--X--32_7a--X--cpachecker/linux-3.10-rc1.tar/csd_deg_dscv/8504/dscv_tempdir/dscv/ri/32_7a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c.prepared", 273); } else { } ldv__builtin_expect(__ret_warn_on != 0, 0L); tmp___1 = ldv__builtin_expect((unsigned long )skb != (unsigned long )((struct sk_buff *)0), 1L); if (tmp___1 != 0L) { *pkts_compl = *pkts_compl + 1U; *bytes_compl = *bytes_compl + skb->len; } else { } dev_kfree_skb_any(skb); tx_buf->first_bd = 0U; tx_buf->skb = 0; return (new_cons); } } int bnx2x_tx_int(struct bnx2x *bp , struct bnx2x_fp_txdata *txdata ) { struct netdev_queue *txq ; u16 hw_cons ; u16 sw_cons ; u16 bd_cons ; unsigned int pkts_compl ; unsigned int bytes_compl ; u16 pkt_cons ; long tmp ; int pscr_ret__ ; void const *__vpp_verify ; int pfo_ret__ ; int pfo_ret_____0 ; int pfo_ret_____1 ; int pfo_ret_____2 ; bool tmp___0 ; u16 tmp___1 ; bool tmp___2 ; long tmp___3 ; { bd_cons = txdata->tx_bd_cons; pkts_compl = 0U; bytes_compl = 0U; txq = netdev_get_tx_queue((struct net_device const *)bp->dev, (unsigned int )txdata->txq_index); hw_cons = *(txdata->tx_cons_sb); sw_cons = txdata->tx_pkt_cons; goto ldv_54362; ldv_54361: pkt_cons = (unsigned int )sw_cons & 4095U; tmp = ldv__builtin_expect((bp->msg_enable & 1024) != 0, 0L); if (tmp != 0L) { printk("\rbnx2x: [%s:%d(%s)]queue[%d]: hw_cons %u sw_cons %u pkt_cons %u\n", "bnx2x_tx_int", 308, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", txdata->txq_index, (int )hw_cons, (int )sw_cons, (int )pkt_cons); } else { } bd_cons = bnx2x_free_tx_pkt(bp, txdata, (int )pkt_cons, & pkts_compl, & bytes_compl); sw_cons = (u16 )((int )sw_cons + 1); ldv_54362: ; if ((int )sw_cons != (int )hw_cons) { goto ldv_54361; } else { } netdev_tx_completed_queue(txq, pkts_compl, bytes_compl); txdata->tx_pkt_cons = sw_cons; txdata->tx_bd_cons = bd_cons; __asm__ volatile ("mfence": : : "memory"); tmp___2 = netif_tx_queue_stopped((struct netdev_queue const *)txq); tmp___3 = ldv__builtin_expect((long )tmp___2, 0L); if (tmp___3 != 0L) { __vpp_verify = 0; switch (4UL) { case 1UL: ; switch (4UL) { case 1UL: __asm__ ("movb %%gs:%P1,%0": "=q" (pfo_ret__): "m" (cpu_number)); goto ldv_54369; case 2UL: __asm__ ("movw %%gs:%P1,%0": "=r" (pfo_ret__): "m" (cpu_number)); goto ldv_54369; case 4UL: __asm__ ("movl %%gs:%P1,%0": "=r" (pfo_ret__): "m" (cpu_number)); goto ldv_54369; case 8UL: __asm__ ("movq %%gs:%P1,%0": "=r" (pfo_ret__): "m" (cpu_number)); goto ldv_54369; default: __bad_percpu_size(); } ldv_54369: pscr_ret__ = pfo_ret__; goto ldv_54375; case 2UL: ; switch (4UL) { case 1UL: __asm__ ("movb %%gs:%P1,%0": "=q" (pfo_ret_____0): "m" (cpu_number)); goto ldv_54379; case 2UL: __asm__ ("movw %%gs:%P1,%0": "=r" (pfo_ret_____0): "m" (cpu_number)); goto ldv_54379; case 4UL: __asm__ ("movl %%gs:%P1,%0": "=r" (pfo_ret_____0): "m" (cpu_number)); goto ldv_54379; case 8UL: __asm__ ("movq %%gs:%P1,%0": "=r" (pfo_ret_____0): "m" (cpu_number)); goto ldv_54379; default: __bad_percpu_size(); } ldv_54379: pscr_ret__ = pfo_ret_____0; goto ldv_54375; case 4UL: ; switch (4UL) { case 1UL: __asm__ ("movb %%gs:%P1,%0": "=q" (pfo_ret_____1): "m" (cpu_number)); goto ldv_54388; case 2UL: __asm__ ("movw %%gs:%P1,%0": "=r" (pfo_ret_____1): "m" (cpu_number)); goto ldv_54388; case 4UL: __asm__ ("movl %%gs:%P1,%0": "=r" (pfo_ret_____1): "m" (cpu_number)); goto ldv_54388; case 8UL: __asm__ ("movq %%gs:%P1,%0": "=r" (pfo_ret_____1): "m" (cpu_number)); goto ldv_54388; default: __bad_percpu_size(); } ldv_54388: pscr_ret__ = pfo_ret_____1; goto ldv_54375; case 8UL: ; switch (4UL) { case 1UL: __asm__ ("movb %%gs:%P1,%0": "=q" (pfo_ret_____2): "m" (cpu_number)); goto ldv_54397; case 2UL: __asm__ ("movw %%gs:%P1,%0": "=r" (pfo_ret_____2): "m" (cpu_number)); goto ldv_54397; case 4UL: __asm__ ("movl %%gs:%P1,%0": "=r" (pfo_ret_____2): "m" (cpu_number)); goto ldv_54397; case 8UL: __asm__ ("movq %%gs:%P1,%0": "=r" (pfo_ret_____2): "m" (cpu_number)); goto ldv_54397; default: __bad_percpu_size(); } ldv_54397: pscr_ret__ = pfo_ret_____2; goto ldv_54375; default: __bad_size_call_parameter(); goto ldv_54375; } ldv_54375: __netif_tx_lock(txq, pscr_ret__); tmp___0 = netif_tx_queue_stopped((struct netdev_queue const *)txq); if ((int )tmp___0 && (unsigned int )bp->state == 12288U) { tmp___1 = bnx2x_tx_avail(bp, txdata); if ((unsigned int )tmp___1 > 21U) { netif_tx_wake_queue(txq); } else { } } else { } __netif_tx_unlock(txq); } else { } return (0); } } __inline static void bnx2x_update_last_max_sge(struct bnx2x_fastpath *fp , u16 idx ) { u16 last_max ; { last_max = fp->last_max_sge; if ((int )((short )((int )idx - (int )last_max)) > 0) { fp->last_max_sge = idx; } else { } return; } } __inline static void bnx2x_update_sge_prod(struct bnx2x_fastpath *fp , u16 sge_len , struct eth_end_agg_rx_cqe *cqe ) { struct bnx2x *bp ; u16 last_max ; u16 last_elem ; u16 first_elem ; u16 delta ; u16 i ; long tmp ; long tmp___0 ; long tmp___1 ; { bp = fp->bp; delta = 0U; if ((unsigned int )sge_len == 0U) { return; } else { } i = 0U; goto ldv_54422; ldv_54421: fp->sge_mask[((unsigned long )cqe->sgl_or_raw_data.sgl[(int )i] & 1023UL) >> 6] = fp->sge_mask[((unsigned long )cqe->sgl_or_raw_data.sgl[(int )i] & 1023UL) >> 6] & ~ (1ULL << ((int )cqe->sgl_or_raw_data.sgl[(int )i] & 63)); i = (u16 )((int )i + 1); ldv_54422: ; if ((int )i < (int )sge_len) { goto ldv_54421; } else { } tmp = ldv__builtin_expect((bp->msg_enable & 2048) != 0, 0L); if (tmp != 0L) { printk("\rbnx2x: [%s:%d(%s)]fp_cqe->sgl[%d] = %d\n", "bnx2x_update_sge_prod", 382, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )sge_len + -1, (int )cqe->sgl_or_raw_data.sgl[(int )sge_len + -1]); } else { } __builtin_prefetch((void const *)(& fp->sge_mask)); bnx2x_update_last_max_sge(fp, (int )cqe->sgl_or_raw_data.sgl[(int )sge_len + -1]); last_max = (unsigned int )fp->last_max_sge & 1023U; last_elem = (u16 )((int )last_max >> 6); first_elem = (u16 )(((unsigned long )fp->rx_sge_prod & 1023UL) >> 6); if ((int )last_elem + 1 != (int )first_elem) { last_elem = (u16 )((int )last_elem + 1); } else { } i = first_elem; goto ldv_54427; ldv_54426: tmp___0 = ldv__builtin_expect(fp->sge_mask[(int )i] != 0ULL, 1L); if (tmp___0 != 0L) { goto ldv_54425; } else { } fp->sge_mask[(int )i] = 0xffffffffffffffffULL; delta = (unsigned int )delta + 64U; i = ((unsigned int )i + 1U) & 15U; ldv_54427: ; if ((int )i != (int )last_elem) { goto ldv_54426; } else { } ldv_54425: ; if ((unsigned int )delta != 0U) { fp->rx_sge_prod = (int )fp->rx_sge_prod + (int )delta; bnx2x_clear_sge_mask_next_elems(fp); } else { } tmp___1 = ldv__builtin_expect((bp->msg_enable & 2048) != 0, 0L); if (tmp___1 != 0L) { printk("\rbnx2x: [%s:%d(%s)]fp->last_max_sge = %d fp->rx_sge_prod = %d\n", "bnx2x_update_sge_prod", 414, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )fp->last_max_sge, (int )fp->rx_sge_prod); } else { } return; } } static u32 bnx2x_get_rxhash(struct bnx2x const *bp , struct eth_fast_path_rx_cqe const *cqe , bool *l4_rxhash ) { enum eth_rss_hash_type htype ; { if (((bp->dev)->features & 268435456ULL) != 0ULL && ((int )cqe->status_flags & 8) != 0) { htype = (enum eth_rss_hash_type )((int )cqe->status_flags & 7); *l4_rxhash = (bool )((unsigned int )htype == 2U || (unsigned int )htype == 4U); return ((u32 )cqe->rss_hash_result); } else { } *l4_rxhash = 0; return (0U); } } static void bnx2x_tpa_start(struct bnx2x_fastpath *fp , u16 queue , u16 cons , u16 prod , struct eth_fast_path_rx_cqe *cqe ) { struct bnx2x *bp ; struct sw_rx_bd *cons_rx_buf ; struct sw_rx_bd *prod_rx_buf ; struct eth_rx_bd *prod_bd ; dma_addr_t mapping ; struct bnx2x_agg_info *tpa_info ; struct sw_rx_bd *first_buf ; int _max1 ; int _max2 ; int tmp ; long tmp___0 ; u16 gro_size ; { bp = fp->bp; cons_rx_buf = fp->rx_buf_ring + (unsigned long )cons; prod_rx_buf = fp->rx_buf_ring + (unsigned long )prod; prod_bd = fp->rx_desc_ring + (unsigned long )prod; tpa_info = fp->tpa_info + (unsigned long )queue; first_buf = & tpa_info->first_buf; if ((unsigned int )tpa_info->tpa_state != 2U) { printk("\vbnx2x: [%s:%d(%s)]start of bin not in stop [%d]\n", "bnx2x_tpa_start", 452, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )queue); } else { } _max1 = 32; _max2 = 64; mapping = dma_map_single_attrs(& (bp->pdev)->dev, (void *)first_buf->data + (unsigned long )(_max1 > _max2 ? _max1 : _max2), (size_t )fp->rx_buf_size, 2, 0); tmp = dma_mapping_error(& (bp->pdev)->dev, mapping); tmp___0 = ldv__builtin_expect(tmp != 0, 0L); if (tmp___0 != 0L) { bnx2x_reuse_rx_data(fp, (int )cons, (int )prod); tpa_info->tpa_state = 3U; return; } else { } prod_rx_buf->data = first_buf->data; prod_rx_buf->mapping = mapping; prod_bd->addr_hi = (unsigned int )(mapping >> 32); prod_bd->addr_lo = (unsigned int )mapping; *first_buf = *cons_rx_buf; tpa_info->parsing_flags = cqe->pars_flags.flags; tpa_info->vlan_tag = cqe->vlan_tag; tpa_info->tpa_state = 1U; tpa_info->len_on_bd = cqe->len_on_bd; tpa_info->placement_offset = cqe->placement_offset; tpa_info->rxhash = bnx2x_get_rxhash((struct bnx2x const *)bp, (struct eth_fast_path_rx_cqe const *)cqe, & tpa_info->l4_rxhash); if ((unsigned int )fp->mode == 1U) { gro_size = cqe->pkt_len_or_gro_seg_len; tpa_info->full_page = (int )((u16 )(4096U / (unsigned int )gro_size)) * (int )gro_size; tpa_info->gro_size = gro_size; } else { } return; } } static void bnx2x_set_gro_params(struct sk_buff *skb , u16 parsing_flags , u16 len_on_bd , unsigned int pkt_len , u16 num_of_coalesced_segs ) { u16 hdrs_len ; unsigned char *tmp ; unsigned char *tmp___0 ; unsigned char *tmp___1 ; { hdrs_len = 34U; if (((int )parsing_flags & 24) >> 3 == 2) { hdrs_len = (unsigned int )hdrs_len + 40U; tmp = skb_end_pointer((struct sk_buff const *)skb); ((struct skb_shared_info *)tmp)->gso_type = 16U; } else { hdrs_len = (unsigned int )hdrs_len + 20U; tmp___0 = skb_end_pointer((struct sk_buff const *)skb); ((struct skb_shared_info *)tmp___0)->gso_type = 1U; } if (((int )parsing_flags & 2048) != 0) { hdrs_len = (unsigned int )hdrs_len + 12U; } else { } tmp___1 = skb_end_pointer((struct sk_buff const *)skb); ((struct skb_shared_info *)tmp___1)->gso_size = (int )len_on_bd - (int )hdrs_len; ((struct napi_gro_cb *)(& skb->cb))->count = num_of_coalesced_segs; return; } } static int bnx2x_alloc_rx_sge(struct bnx2x *bp , struct bnx2x_fastpath *fp , u16 index ) { struct page *page ; struct page *tmp ; struct sw_rx_page *sw_buf ; struct eth_rx_sge *sge ; dma_addr_t mapping ; long tmp___0 ; int tmp___1 ; long tmp___2 ; { tmp = alloc_pages(32U, 0U); page = tmp; sw_buf = fp->rx_page_ring + (unsigned long )index; sge = fp->rx_sge_ring + (unsigned long )index; tmp___0 = ldv__builtin_expect((unsigned long )page == (unsigned long )((struct page *)0), 0L); if (tmp___0 != 0L) { printk("\vbnx2x: [%s:%d(%s)]Can\'t alloc sge\n", "bnx2x_alloc_rx_sge", 567, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); return (-12); } else { } mapping = dma_map_page(& (bp->pdev)->dev, page, 0UL, 4096UL, 2); tmp___1 = dma_mapping_error(& (bp->pdev)->dev, mapping); tmp___2 = ldv__builtin_expect(tmp___1 != 0, 0L); if (tmp___2 != 0L) { __free_pages(page, 0U); printk("\vbnx2x: [%s:%d(%s)]Can\'t map sge\n", "bnx2x_alloc_rx_sge", 575, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); return (-12); } else { } sw_buf->page = page; sw_buf->mapping = mapping; sge->addr_hi = (unsigned int )(mapping >> 32); sge->addr_lo = (unsigned int )mapping; return (0); } } static int bnx2x_fill_frag_skb(struct bnx2x *bp , struct bnx2x_fastpath *fp , struct bnx2x_agg_info *tpa_info , u16 pages , struct sk_buff *skb , struct eth_end_agg_rx_cqe *cqe , u16 cqe_idx ) { struct sw_rx_page *rx_pg ; struct sw_rx_page old_rx_pg ; u32 i ; u32 frag_len ; u32 frag_size ; int err ; int j ; int frag_id ; u16 len_on_bd ; u16 full_page ; u16 gro_size ; u16 sge_idx ; u32 __min1 ; u32 __min2 ; u32 __min1___0 ; u32 __min2___0 ; long tmp ; int rem ; int offset ; int len ; int tmp___0 ; { frag_id = 0; len_on_bd = tpa_info->len_on_bd; full_page = 0U; gro_size = 0U; frag_size = (u32 )((int )cqe->pkt_len - (int )len_on_bd); if ((unsigned int )fp->mode == 1U) { gro_size = tpa_info->gro_size; full_page = tpa_info->full_page; } else { } if (frag_size != 0U) { bnx2x_set_gro_params(skb, (int )tpa_info->parsing_flags, (int )len_on_bd, (unsigned int )cqe->pkt_len, (int )cqe->num_of_coalesced_segs); } else { } i = 0U; j = 0; goto ldv_54505; ldv_54504: sge_idx = (unsigned int )cqe->sgl_or_raw_data.sgl[j] & 1023U; if ((unsigned int )fp->mode == 1U) { __min1 = frag_size; __min2 = (unsigned int )full_page; frag_len = __min1 < __min2 ? __min1 : __min2; } else { __min1___0 = frag_size; __min2___0 = 4096U; frag_len = __min1___0 < __min2___0 ? __min1___0 : __min2___0; } rx_pg = fp->rx_page_ring + (unsigned long )sge_idx; old_rx_pg = *rx_pg; err = bnx2x_alloc_rx_sge(bp, fp, (int )sge_idx); tmp = ldv__builtin_expect(err != 0, 0L); if (tmp != 0L) { (bp->fp_stats + (unsigned long )fp->index)->eth_q_stats.rx_skb_alloc_failed = (bp->fp_stats + (unsigned long )fp->index)->eth_q_stats.rx_skb_alloc_failed + 1U; return (err); } else { } dma_unmap_page___0(& (bp->pdev)->dev, old_rx_pg.mapping, 4096UL, 2); if ((unsigned int )fp->mode == 0U) { skb_fill_page_desc(skb, j, old_rx_pg.page, 0, (int )frag_len); } else { offset = 0; rem = (int )frag_len; goto ldv_54502; ldv_54501: len = rem < (int )gro_size ? rem : (int )gro_size; tmp___0 = frag_id; frag_id = frag_id + 1; skb_fill_page_desc(skb, tmp___0, old_rx_pg.page, offset, len); if (offset != 0) { get_page(old_rx_pg.page); } else { } offset = offset + len; rem = rem - (int )gro_size; ldv_54502: ; if (rem > 0) { goto ldv_54501; } else { } } skb->data_len = skb->data_len + frag_len; skb->truesize = skb->truesize + 4096U; skb->len = skb->len + frag_len; frag_size = frag_size - frag_len; i = i + 1U; j = j + 1; ldv_54505: ; if ((u32 )pages > i) { goto ldv_54504; } else { } return (0); } } static void bnx2x_frag_free(struct bnx2x_fastpath const *fp , void *data ) { struct page *tmp ; { if ((unsigned int )fp->rx_frag_size != 0U) { tmp = virt_to_head_page((void const *)data); put_page(tmp); } else { kfree((void const *)data); } return; } } static void *bnx2x_frag_alloc(struct bnx2x_fastpath const *fp ) { void *tmp ; int _max1 ; int _max2 ; void *tmp___0 ; { if ((unsigned int )fp->rx_frag_size != 0U) { tmp = netdev_alloc_frag(fp->rx_frag_size); return (tmp); } else { } _max1 = 32; _max2 = 64; tmp___0 = kmalloc((size_t )((unsigned int )fp->rx_buf_size + (unsigned int )(_max1 > _max2 ? _max1 : _max2)), 32U); return (tmp___0); } } static void bnx2x_gro_ip_csum(struct bnx2x *bp , struct sk_buff *skb ) { struct iphdr const *iph ; struct iphdr *tmp ; struct tcphdr *th ; int tmp___0 ; __sum16 tmp___1 ; { tmp = ip_hdr((struct sk_buff const *)skb); iph = (struct iphdr const *)tmp; skb_set_transport_header(skb, 20); th = tcp_hdr((struct sk_buff const *)skb); tmp___0 = skb_transport_offset((struct sk_buff const *)skb); tmp___1 = tcp_v4_check((int )(skb->len - (unsigned int )tmp___0), iph->saddr, iph->daddr, 0U); th->check = ~ ((int )tmp___1); return; } } static void bnx2x_gro_ipv6_csum(struct bnx2x *bp , struct sk_buff *skb ) { struct ipv6hdr *iph ; struct ipv6hdr *tmp ; struct tcphdr *th ; int tmp___0 ; __sum16 tmp___1 ; { tmp = ipv6_hdr((struct sk_buff const *)skb); iph = tmp; skb_set_transport_header(skb, 40); th = tcp_hdr((struct sk_buff const *)skb); tmp___0 = skb_transport_offset((struct sk_buff const *)skb); tmp___1 = tcp_v6_check((int )(skb->len - (unsigned int )tmp___0), (struct in6_addr const *)(& iph->saddr), (struct in6_addr const *)(& iph->daddr), 0U); th->check = ~ ((int )tmp___1); return; } } static void bnx2x_gro_csum(struct bnx2x *bp , struct sk_buff *skb , void (*gro_func)(struct bnx2x * , struct sk_buff * ) ) { { skb_set_network_header(skb, 0); (*gro_func)(bp, skb); tcp_gro_complete(skb); return; } } static void bnx2x_gro_receive(struct bnx2x *bp , struct bnx2x_fastpath *fp , struct sk_buff *skb ) { __u16 tmp ; __u16 tmp___0 ; unsigned char *tmp___1 ; { tmp___1 = skb_end_pointer((struct sk_buff const *)skb); if ((unsigned int )((struct skb_shared_info *)tmp___1)->gso_size != 0U) { tmp = __fswab16((int )skb->protocol); switch ((int )tmp) { case 2048: bnx2x_gro_csum(bp, skb, & bnx2x_gro_ip_csum); goto ldv_54542; case 34525: bnx2x_gro_csum(bp, skb, & bnx2x_gro_ipv6_csum); goto ldv_54542; default: tmp___0 = __fswab16((int )skb->protocol); printk("\vbnx2x: [%s:%d(%s)]Error: FW GRO supports only IPv4/IPv6, not 0x%04x\n", "bnx2x_gro_receive", 740, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )tmp___0); } ldv_54542: ; } else { } napi_gro_receive(& fp->napi, skb); return; } } static void bnx2x_tpa_stop(struct bnx2x *bp , struct bnx2x_fastpath *fp , struct bnx2x_agg_info *tpa_info , u16 pages , struct eth_end_agg_rx_cqe *cqe , u16 cqe_idx ) { struct sw_rx_bd *rx_buf ; u8 pad ; u16 len ; struct sk_buff *skb ; u8 *new_data ; u8 *data ; u8 old_tpa_state ; void *tmp ; long tmp___0 ; int _max1 ; int _max2 ; long tmp___1 ; int tmp___2 ; long tmp___3 ; long tmp___4 ; { rx_buf = & tpa_info->first_buf; pad = tpa_info->placement_offset; len = tpa_info->len_on_bd; skb = 0; data = rx_buf->data; old_tpa_state = tpa_info->tpa_state; tpa_info->tpa_state = 2U; if ((unsigned int )old_tpa_state == 3U) { goto drop; } else { } tmp = bnx2x_frag_alloc((struct bnx2x_fastpath const *)fp); new_data = (u8 *)tmp; dma_unmap_single_attrs(& (bp->pdev)->dev, rx_buf->mapping, (size_t )fp->rx_buf_size, 2, 0); tmp___0 = ldv__builtin_expect((unsigned long )new_data != (unsigned long )((u8 *)0), 1L); if (tmp___0 != 0L) { skb = build_skb((void *)data, fp->rx_frag_size); } else { } tmp___3 = ldv__builtin_expect((unsigned long )skb != (unsigned long )((struct sk_buff *)0), 1L); if (tmp___3 != 0L) { _max1 = 32; _max2 = 64; skb_reserve(skb, (int )pad + (_max1 > _max2 ? _max1 : _max2)); skb_put(skb, (unsigned int )len); skb->rxhash = tpa_info->rxhash; skb->l4_rxhash = (unsigned char )tpa_info->l4_rxhash; skb->protocol = eth_type_trans(skb, bp->dev); skb->ip_summed = 1U; tmp___2 = bnx2x_fill_frag_skb(bp, fp, tpa_info, (int )pages, skb, cqe, (int )cqe_idx); if (tmp___2 == 0) { if (((int )tpa_info->parsing_flags & 2) != 0) { __vlan_hwaccel_put_tag(skb, 129, (int )tpa_info->vlan_tag); } else { } bnx2x_gro_receive(bp, fp, skb); } else { tmp___1 = ldv__builtin_expect((bp->msg_enable & 2048) != 0, 0L); if (tmp___1 != 0L) { printk("\rbnx2x: [%s:%d(%s)]Failed to allocate new pages - dropping packet!\n", "bnx2x_tpa_stop", 803, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } dev_kfree_skb_any(skb); } rx_buf->data = new_data; return; } else { } bnx2x_frag_free((struct bnx2x_fastpath const *)fp, (void *)new_data); drop: tmp___4 = ldv__builtin_expect((bp->msg_enable & 2048) != 0, 0L); if (tmp___4 != 0L) { printk("\rbnx2x: [%s:%d(%s)]Failed to allocate or map a new skb - dropping packet!\n", "bnx2x_tpa_stop", 817, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } (bp->fp_stats + (unsigned long )fp->index)->eth_q_stats.rx_skb_alloc_failed = (bp->fp_stats + (unsigned long )fp->index)->eth_q_stats.rx_skb_alloc_failed + 1U; return; } } static int bnx2x_alloc_rx_data(struct bnx2x *bp , struct bnx2x_fastpath *fp , u16 index ) { u8 *data ; struct sw_rx_bd *rx_buf ; struct eth_rx_bd *rx_bd ; dma_addr_t mapping ; void *tmp ; long tmp___0 ; int _max1 ; int _max2 ; int tmp___1 ; long tmp___2 ; { rx_buf = fp->rx_buf_ring + (unsigned long )index; rx_bd = fp->rx_desc_ring + (unsigned long )index; tmp = bnx2x_frag_alloc((struct bnx2x_fastpath const *)fp); data = (u8 *)tmp; tmp___0 = ldv__builtin_expect((unsigned long )data == (unsigned long )((u8 *)0), 0L); if (tmp___0 != 0L) { return (-12); } else { } _max1 = 32; _max2 = 64; mapping = dma_map_single_attrs(& (bp->pdev)->dev, (void *)data + (unsigned long )(_max1 > _max2 ? _max1 : _max2), (size_t )fp->rx_buf_size, 2, 0); tmp___1 = dma_mapping_error(& (bp->pdev)->dev, mapping); tmp___2 = ldv__builtin_expect(tmp___1 != 0, 0L); if (tmp___2 != 0L) { bnx2x_frag_free((struct bnx2x_fastpath const *)fp, (void *)data); printk("\vbnx2x: [%s:%d(%s)]Can\'t map rx data\n", "bnx2x_alloc_rx_data", 838, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); return (-12); } else { } rx_buf->data = data; rx_buf->mapping = mapping; rx_bd->addr_hi = (unsigned int )(mapping >> 32); rx_bd->addr_lo = (unsigned int )mapping; return (0); } } static void bnx2x_csum_validate(struct sk_buff *skb , union eth_rx_cqe *cqe , struct bnx2x_fastpath *fp , struct bnx2x_eth_q_stats *qstats ) { { if ((int )((signed char )cqe->fast_path_cqe.status_flags) < 0) { return; } else { } if (((int )cqe->fast_path_cqe.type_error_flags & 48) != 0) { qstats->hw_csum_err = qstats->hw_csum_err + 1U; } else { skb->ip_summed = 1U; } return; } } int bnx2x_rx_int(struct bnx2x_fastpath *fp , int budget ) { struct bnx2x *bp ; u16 bd_cons ; u16 bd_prod ; u16 bd_prod_fw ; u16 comp_ring_cons ; u16 hw_comp_cons ; u16 sw_comp_cons ; u16 sw_comp_prod ; int rx_pkt ; long tmp ; struct sw_rx_bd *rx_buf ; struct sk_buff *skb ; union eth_rx_cqe *cqe ; struct eth_fast_path_rx_cqe *cqe_fp ; u8 cqe_fp_flags ; enum eth_rx_cqe_type cqe_fp_type ; u16 len ; u16 pad ; u16 queue ; u8 *data ; bool l4_rxhash ; long tmp___0 ; long tmp___1 ; struct bnx2x_agg_info *tpa_info ; u16 frag_size ; u16 pages ; u16 queue___0 ; long tmp___2 ; long tmp___3 ; int _max1 ; int _max2 ; long tmp___4 ; long tmp___5 ; long tmp___6 ; size_t __len ; void *__ret ; long tmp___7 ; long tmp___8 ; int tmp___9 ; long tmp___10 ; { bp = fp->bp; rx_pkt = 0; hw_comp_cons = *(fp->rx_cons_sb); if (((unsigned long )hw_comp_cons & 63UL) == 63UL) { hw_comp_cons = (u16 )((int )hw_comp_cons + 1); } else { } bd_cons = fp->rx_bd_cons; bd_prod = fp->rx_bd_prod; bd_prod_fw = bd_prod; sw_comp_cons = fp->rx_comp_cons; sw_comp_prod = fp->rx_comp_prod; __asm__ volatile ("lfence": : : "memory"); tmp = ldv__builtin_expect((bp->msg_enable & 2048) != 0, 0L); if (tmp != 0L) { printk("\rbnx2x: [%s:%d(%s)]queue[%d]: hw_comp_cons %u sw_comp_cons %u\n", "bnx2x_rx_int", 906, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )fp->index, (int )hw_comp_cons, (int )sw_comp_cons); } else { } goto ldv_54625; ldv_54624: rx_buf = 0; comp_ring_cons = (unsigned int )sw_comp_cons & 4095U; bd_prod = (unsigned int )bd_prod & 4095U; bd_cons = (unsigned int )bd_cons & 4095U; cqe = fp->rx_comp_ring + (unsigned long )comp_ring_cons; cqe_fp = & cqe->fast_path_cqe; cqe_fp_flags = cqe_fp->type_error_flags; cqe_fp_type = (enum eth_rx_cqe_type )((int )cqe_fp_flags & 3); tmp___0 = ldv__builtin_expect((bp->msg_enable & 2048) != 0, 0L); if (tmp___0 != 0L) { printk("\rbnx2x: [%s:%d(%s)]CQE type %x err %x status %x queue %x vlan %x len %u\n", "bnx2x_rx_int", 939, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )cqe_fp_flags & 3, (int )cqe_fp_flags, (int )cqe_fp->status_flags, cqe_fp->rss_hash_result, (int )cqe_fp->vlan_tag, (int )cqe_fp->pkt_len_or_gro_seg_len); } else { } tmp___1 = ldv__builtin_expect((unsigned int )cqe_fp_type == 1U, 0L); if (tmp___1 != 0L) { bnx2x_sp_event(fp, cqe); goto next_cqe; } else { } rx_buf = fp->rx_buf_ring + (unsigned long )bd_cons; data = rx_buf->data; if ((unsigned int )cqe_fp_type != 0U) { if ((unsigned int )cqe_fp_type == 2U) { queue___0 = (u16 )cqe_fp->queue_index; tmp___2 = ldv__builtin_expect((bp->msg_enable & 2048) != 0, 0L); if (tmp___2 != 0L) { printk("\rbnx2x: [%s:%d(%s)]calling tpa_start on queue %d\n", "bnx2x_rx_int", 966, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )queue___0); } else { } bnx2x_tpa_start(fp, (int )queue___0, (int )bd_cons, (int )bd_prod, cqe_fp); goto next_rx; } else { } queue = (u16 )cqe->end_agg_cqe.queue_index; tpa_info = fp->tpa_info + (unsigned long )queue; tmp___3 = ldv__builtin_expect((bp->msg_enable & 2048) != 0, 0L); if (tmp___3 != 0L) { printk("\rbnx2x: [%s:%d(%s)]calling tpa_stop on queue %d\n", "bnx2x_rx_int", 979, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )queue); } else { } frag_size = (int )cqe->end_agg_cqe.pkt_len - (int )tpa_info->len_on_bd; if ((unsigned int )fp->mode == 1U) { pages = (u16 )((((int )frag_size + (int )tpa_info->full_page) + -1) / (int )tpa_info->full_page); } else { pages = (u16 )(((unsigned long )frag_size + 4095UL) >> 12); } bnx2x_tpa_stop(bp, fp, tpa_info, (int )pages, & cqe->end_agg_cqe, (int )comp_ring_cons); bnx2x_update_sge_prod(fp, (int )pages, & cqe->end_agg_cqe); goto next_cqe; } else { } len = cqe_fp->pkt_len_or_gro_seg_len; pad = (u16 )cqe_fp->placement_offset; dma_sync_single_for_cpu(& (bp->pdev)->dev, rx_buf->mapping, (size_t )((int )pad + 92), 2); _max1 = 32; _max2 = 64; pad = (int )((u16 )(_max1 > _max2 ? _max1 : _max2)) + (int )pad; __builtin_prefetch((void const *)data + (unsigned long )pad); tmp___5 = ldv__builtin_expect(((int )cqe_fp_flags & 8) != 0, 0L); if (tmp___5 != 0L) { tmp___4 = ldv__builtin_expect((bp->msg_enable & 2112) != 0, 0L); if (tmp___4 != 0L) { printk("\rbnx2x: [%s:%d(%s)]ERROR flags %x rx packet %u\n", "bnx2x_rx_int", 1014, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )cqe_fp_flags, (int )sw_comp_cons); } else { } (bp->fp_stats + (unsigned long )fp->index)->eth_q_stats.rx_err_discard_pkt = (bp->fp_stats + (unsigned long )fp->index)->eth_q_stats.rx_err_discard_pkt + 1U; goto reuse_rx; } else { } if ((bp->dev)->mtu > 1500U && (unsigned int )len <= 92U) { skb = netdev_alloc_skb_ip_align(bp->dev, (unsigned int )len); if ((unsigned long )skb == (unsigned long )((struct sk_buff *)0)) { tmp___6 = ldv__builtin_expect((bp->msg_enable & 2112) != 0, 0L); if (tmp___6 != 0L) { printk("\rbnx2x: [%s:%d(%s)]ERROR packet dropped because of alloc failure\n", "bnx2x_rx_int", 1027, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } (bp->fp_stats + (unsigned long )fp->index)->eth_q_stats.rx_skb_alloc_failed = (bp->fp_stats + (unsigned long )fp->index)->eth_q_stats.rx_skb_alloc_failed + 1U; goto reuse_rx; } else { } __len = (size_t )len; __ret = __builtin_memcpy((void *)skb->data, (void const *)data + (unsigned long )pad, __len); bnx2x_reuse_rx_data(fp, (int )bd_cons, (int )bd_prod); } else { tmp___9 = bnx2x_alloc_rx_data(bp, fp, (int )bd_prod); tmp___10 = ldv__builtin_expect(tmp___9 == 0, 1L); if (tmp___10 != 0L) { dma_unmap_single_attrs(& (bp->pdev)->dev, rx_buf->mapping, (size_t )fp->rx_buf_size, 2, 0); skb = build_skb((void *)data, fp->rx_frag_size); tmp___7 = ldv__builtin_expect((unsigned long )skb == (unsigned long )((struct sk_buff *)0), 0L); if (tmp___7 != 0L) { bnx2x_frag_free((struct bnx2x_fastpath const *)fp, (void *)data); (bp->fp_stats + (unsigned long )fp->index)->eth_q_stats.rx_skb_alloc_failed = (bp->fp_stats + (unsigned long )fp->index)->eth_q_stats.rx_skb_alloc_failed + 1U; goto next_rx; } else { } skb_reserve(skb, (int )pad); } else { tmp___8 = ldv__builtin_expect((bp->msg_enable & 2112) != 0, 0L); if (tmp___8 != 0L) { printk("\rbnx2x: [%s:%d(%s)]ERROR packet dropped because of alloc failure\n", "bnx2x_rx_int", 1049, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } (bp->fp_stats + (unsigned long )fp->index)->eth_q_stats.rx_skb_alloc_failed = (bp->fp_stats + (unsigned long )fp->index)->eth_q_stats.rx_skb_alloc_failed + 1U; reuse_rx: bnx2x_reuse_rx_data(fp, (int )bd_cons, (int )bd_prod); goto next_rx; } } skb_put(skb, (unsigned int )len); skb->protocol = eth_type_trans(skb, bp->dev); skb->rxhash = bnx2x_get_rxhash((struct bnx2x const *)bp, (struct eth_fast_path_rx_cqe const *)cqe_fp, & l4_rxhash); skb->l4_rxhash = (unsigned char )l4_rxhash; skb_checksum_none_assert((struct sk_buff const *)skb); if (((bp->dev)->features & 536870912ULL) != 0ULL) { bnx2x_csum_validate(skb, cqe, fp, & (bp->fp_stats + (unsigned long )fp->index)->eth_q_stats); } else { } skb_record_rx_queue(skb, (int )fp->rx_queue); if (((int )cqe_fp->pars_flags.flags & 2) != 0) { __vlan_hwaccel_put_tag(skb, 129, (int )cqe_fp->vlan_tag); } else { } napi_gro_receive(& fp->napi, skb); next_rx: rx_buf->data = 0; bd_cons = ((unsigned long )bd_cons & 511UL) == 509UL ? (unsigned int )bd_cons + 3U : (unsigned int )bd_cons + 1U; bd_prod = ((unsigned long )bd_prod & 511UL) == 509UL ? (unsigned int )bd_prod + 3U : (unsigned int )bd_prod + 1U; bd_prod_fw = ((unsigned long )bd_prod_fw & 511UL) == 509UL ? (unsigned int )bd_prod_fw + 3U : (unsigned int )bd_prod_fw + 1U; rx_pkt = rx_pkt + 1; next_cqe: sw_comp_prod = ((unsigned long )sw_comp_prod & 63UL) == 62UL ? (unsigned int )sw_comp_prod + 2U : (unsigned int )sw_comp_prod + 1U; sw_comp_cons = ((unsigned long )sw_comp_cons & 63UL) == 62UL ? (unsigned int )sw_comp_cons + 2U : (unsigned int )sw_comp_cons + 1U; if (rx_pkt == budget) { goto ldv_54623; } else { } ldv_54625: ; if ((int )sw_comp_cons != (int )hw_comp_cons) { goto ldv_54624; } else { } ldv_54623: fp->rx_bd_cons = bd_cons; fp->rx_bd_prod = bd_prod_fw; fp->rx_comp_cons = sw_comp_cons; fp->rx_comp_prod = sw_comp_prod; bnx2x_update_rx_prod(bp, fp, (int )bd_prod_fw, (int )sw_comp_prod, (int )fp->rx_sge_prod); fp->rx_pkt = fp->rx_pkt + (unsigned long )rx_pkt; fp->rx_calls = fp->rx_calls + 1UL; return (rx_pkt); } } static irqreturn_t bnx2x_msix_fp_int(int irq , void *fp_cookie ) { struct bnx2x_fastpath *fp ; struct bnx2x *bp ; u8 cos ; long tmp ; { fp = (struct bnx2x_fastpath *)fp_cookie; bp = fp->bp; tmp = ldv__builtin_expect((bp->msg_enable & 512) != 0, 0L); if (tmp != 0L) { printk("\rbnx2x: [%s:%d(%s)]got an MSI-X interrupt on IDX:SB [fp %d fw_sd %d igusb %d]\n", "bnx2x_msix_fp_int", 1117, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )fp->index, (int )fp->fw_sb_id, (int )fp->igu_sb_id); } else { } bnx2x_ack_sb(bp, (int )fp->igu_sb_id, 0, 0, 1, 0); __builtin_prefetch((void const *)fp->rx_cons_sb); cos = 0U; goto ldv_54635; ldv_54634: __builtin_prefetch((void const *)(fp->txdata_ptr[(int )cos])->tx_cons_sb); cos = (u8 )((int )cos + 1); ldv_54635: ; if ((int )fp->max_cos > (int )cos) { goto ldv_54634; } else { } __builtin_prefetch((void const *)fp->sb_running_index); napi_schedule(& (bp->fp + (unsigned long )fp->index)->napi); return (1); } } void bnx2x_acquire_phy_lock(struct bnx2x *bp ) { { ldv_mutex_lock_53(& bp->port.phy_mutex); bnx2x_acquire_hw_lock(bp, 0U); return; } } void bnx2x_release_phy_lock(struct bnx2x *bp ) { { bnx2x_release_hw_lock(bp, 0U); ldv_mutex_unlock_54(& bp->port.phy_mutex); return; } } u16 bnx2x_get_mf_speed(struct bnx2x *bp ) { u16 line_speed ; u16 maxCfg ; u16 tmp ; u16 vn_max_rate ; { line_speed = bp->link_vars.line_speed; if ((unsigned int )bp->mf_mode != 0U) { tmp = bnx2x_extract_max_cfg(bp, bp->mf_config[(int )bp->pfid >> 1]); maxCfg = tmp; if ((unsigned int )bp->mf_mode == 2U) { line_speed = (u16 )(((int )line_speed * (int )maxCfg) / 100); } else { vn_max_rate = (unsigned int )maxCfg * 100U; if ((int )vn_max_rate < (int )line_speed) { line_speed = vn_max_rate; } else { } } } else { } return (line_speed); } } static void bnx2x_fill_report_data(struct bnx2x *bp , struct bnx2x_link_report_data *data ) { u16 line_speed ; u16 tmp ; { tmp = bnx2x_get_mf_speed(bp); line_speed = tmp; memset((void *)data, 0, 16UL); data->line_speed = line_speed; if ((unsigned int )bp->link_vars.link_up == 0U || (bp->flags & 2048U) != 0U) { __set_bit(1, (unsigned long volatile *)(& data->link_report_flags)); } else { } if ((unsigned int )bp->link_vars.duplex == 1U) { __set_bit(0, (unsigned long volatile *)(& data->link_report_flags)); } else { } if (((int )bp->link_vars.flow_ctrl & 512) != 0) { __set_bit(2, (unsigned long volatile *)(& data->link_report_flags)); } else { } if (((int )bp->link_vars.flow_ctrl & 256) != 0) { __set_bit(3, (unsigned long volatile *)(& data->link_report_flags)); } else { } return; } } void bnx2x_link_report(struct bnx2x *bp ) { { bnx2x_acquire_phy_lock(bp); __bnx2x_link_report(bp); bnx2x_release_phy_lock(bp); return; } } void __bnx2x_link_report(struct bnx2x *bp ) { struct bnx2x_link_report_data cur_data ; int tmp ; int tmp___0 ; int tmp___1 ; size_t __len ; void *__ret ; char const *duplex ; char const *flow ; int tmp___2 ; int tmp___3 ; int tmp___4 ; int tmp___5 ; { if ((bp->flags & 4194304U) == 0U && bp->common.chip_id >> 16 != 5710U) { bnx2x_read_mf_cfg(bp); } else { } bnx2x_fill_report_data(bp, & cur_data); tmp = memcmp((void const *)(& cur_data), (void const *)(& bp->last_reported_link), 16UL); if (tmp == 0) { return; } else { tmp___0 = constant_test_bit(1U, (unsigned long const volatile *)(& bp->last_reported_link.link_report_flags)); if (tmp___0 != 0) { tmp___1 = constant_test_bit(1U, (unsigned long const volatile *)(& cur_data.link_report_flags)); if (tmp___1 != 0) { return; } else { } } else { } } bp->link_cnt = bp->link_cnt + 1U; __len = 16UL; if (__len > 63UL) { __ret = __memcpy((void *)(& bp->last_reported_link), (void const *)(& cur_data), __len); } else { __ret = __builtin_memcpy((void *)(& bp->last_reported_link), (void const *)(& cur_data), __len); } tmp___5 = constant_test_bit(1U, (unsigned long const volatile *)(& cur_data.link_report_flags)); if (tmp___5 != 0) { netif_carrier_off(bp->dev); netdev_err((struct net_device const *)bp->dev, "NIC Link is Down\n"); return; } else { netif_carrier_on(bp->dev); tmp___2 = test_and_clear_bit(0, (unsigned long volatile *)(& cur_data.link_report_flags)); if (tmp___2 != 0) { duplex = "full"; } else { duplex = "half"; } if (cur_data.link_report_flags != 0UL) { tmp___4 = constant_test_bit(2U, (unsigned long const volatile *)(& cur_data.link_report_flags)); if (tmp___4 != 0) { tmp___3 = constant_test_bit(3U, (unsigned long const volatile *)(& cur_data.link_report_flags)); if (tmp___3 != 0) { flow = "ON - receive & transmit"; } else { flow = "ON - receive"; } } else { flow = "ON - transmit"; } } else { flow = "none"; } netdev_info((struct net_device const *)bp->dev, "NIC Link is Up, %d Mbps %s duplex, Flow control: %s\n", (int )cur_data.line_speed, duplex, flow); } return; } } static void bnx2x_set_next_page_sgl(struct bnx2x_fastpath *fp ) { int i ; struct eth_rx_sge *sge ; { i = 1; goto ldv_54672; ldv_54671: sge = fp->rx_sge_ring + ((unsigned long )i * 512UL + 0xfffffffffffffffeUL); sge->addr_hi = (unsigned int )((fp->rx_sge_mapping + (dma_addr_t )((i % 2) * 4096)) >> 32); sge->addr_lo = (unsigned int )fp->rx_sge_mapping + (unsigned int )((i % 2) * 4096); i = i + 1; ldv_54672: ; if (i <= 2) { goto ldv_54671; } else { } return; } } static void bnx2x_free_tpa_pool(struct bnx2x *bp , struct bnx2x_fastpath *fp , int last ) { int i ; struct bnx2x_agg_info *tpa_info ; struct sw_rx_bd *first_buf ; u8 *data ; long tmp ; { i = 0; goto ldv_54686; ldv_54685: tpa_info = fp->tpa_info + (unsigned long )i; first_buf = & tpa_info->first_buf; data = first_buf->data; if ((unsigned long )data == (unsigned long )((u8 *)0)) { tmp = ldv__builtin_expect((bp->msg_enable & 16) != 0, 0L); if (tmp != 0L) { printk("\rbnx2x: [%s:%d(%s)]tpa bin %d empty on free\n", "bnx2x_free_tpa_pool", 1333, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", i); } else { } goto ldv_54684; } else { } if ((unsigned int )tpa_info->tpa_state == 1U) { dma_unmap_single_attrs(& (bp->pdev)->dev, first_buf->mapping, (size_t )fp->rx_buf_size, 2, 0); } else { } bnx2x_frag_free((struct bnx2x_fastpath const *)fp, (void *)data); first_buf->data = 0; ldv_54684: i = i + 1; ldv_54686: ; if (i < last) { goto ldv_54685; } else { } return; } } void bnx2x_init_rx_rings_cnic(struct bnx2x *bp ) { int j ; struct bnx2x_fastpath *fp ; { j = (int )bp->num_ethernet_queues; goto ldv_54695; ldv_54694: ; if ((bp->flags & 32768U) != 0U && (uint )j == (uint )bp->num_queues - bp->num_cnic_queues) { } else { fp = bp->fp + (unsigned long )j; fp->rx_bd_cons = 0U; bnx2x_update_rx_prod(bp, fp, (int )fp->rx_bd_prod, (int )fp->rx_comp_prod, (int )fp->rx_sge_prod); } j = j + 1; ldv_54695: ; if (bp->num_queues > j) { goto ldv_54694; } else { } return; } } void bnx2x_init_rx_rings(struct bnx2x *bp ) { int func ; u16 ring_prod ; int i ; int j ; struct bnx2x_fastpath *fp ; long tmp ; struct bnx2x_agg_info *tpa_info ; struct sw_rx_bd *first_buf ; void *tmp___0 ; int tmp___1 ; struct bnx2x_fastpath *fp___0 ; { func = (int )bp->pfid; j = 0; goto ldv_54715; ldv_54714: fp = bp->fp + (unsigned long )j; tmp = ldv__builtin_expect((bp->msg_enable & 32) != 0, 0L); if (tmp != 0L) { printk("\rbnx2x: [%s:%d(%s)]mtu %d rx_buf_size %d\n", "bnx2x_init_rx_rings", 1375, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (bp->dev)->mtu, fp->rx_buf_size); } else { } if ((unsigned int )fp->disable_tpa == 0U) { i = 0; goto ldv_54710; ldv_54709: tpa_info = fp->tpa_info + (unsigned long )i; first_buf = & tpa_info->first_buf; tmp___0 = bnx2x_frag_alloc((struct bnx2x_fastpath const *)fp); first_buf->data = (u8 *)tmp___0; if ((unsigned long )first_buf->data == (unsigned long )((u8 *)0)) { printk("\vbnx2x: [%s:%d(%s)]Failed to allocate TPA skb pool for queue[%d] - disabling TPA on this queue!\n", "bnx2x_init_rx_rings", 1388, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", j); bnx2x_free_tpa_pool(bp, fp, i); fp->disable_tpa = 1U; goto ldv_54708; } else { } first_buf->mapping = 0ULL; tpa_info->tpa_state = 2U; i = i + 1; ldv_54710: ; if ((bp->common.chip_id >> 16 == 5710U ? 32 : 64) > i) { goto ldv_54709; } else { } ldv_54708: bnx2x_set_next_page_sgl(fp); bnx2x_init_sge_ring_bit_mask(fp); i = 0; ring_prod = 0U; goto ldv_54713; ldv_54712: tmp___1 = bnx2x_alloc_rx_sge(bp, fp, (int )ring_prod); if (tmp___1 < 0) { printk("\vbnx2x: [%s:%d(%s)]was only able to allocate %d rx sges\n", "bnx2x_init_rx_rings", 1409, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", i); printk("\vbnx2x: [%s:%d(%s)]disabling TPA for queue[%d]\n", "bnx2x_init_rx_rings", 1411, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", j); bnx2x_free_rx_sge_range___0(bp, fp, (int )ring_prod); bnx2x_free_tpa_pool(bp, fp, bp->common.chip_id >> 16 == 5710U ? 32 : 64); fp->disable_tpa = 1U; ring_prod = 0U; goto ldv_54711; } else { } ring_prod = ((unsigned long )ring_prod & 511UL) == 509UL ? (unsigned int )ring_prod + 3U : (unsigned int )ring_prod + 1U; i = i + 1; ldv_54713: ; if ((unsigned int )i <= 1019U) { goto ldv_54712; } else { } ldv_54711: fp->rx_sge_prod = ring_prod; } else { } j = j + 1; ldv_54715: ; if ((uint )j < bp->num_ethernet_queues) { goto ldv_54714; } else { } j = 0; goto ldv_54720; ldv_54719: fp___0 = bp->fp + (unsigned long )j; fp___0->rx_bd_cons = 0U; bnx2x_update_rx_prod(bp, fp___0, (int )fp___0->rx_bd_prod, (int )fp___0->rx_comp_prod, (int )fp___0->rx_sge_prod); if (j != 0) { goto ldv_54718; } else { } if (bp->common.chip_id >> 16 == 5710U) { writel((unsigned int )fp___0->rx_comp_mapping, (void volatile *)bp->regview + (unsigned long )(((unsigned int )(bp->iro_arr + 182UL)->base + (unsigned int )((int )(bp->iro_arr + 182UL)->m1 * func)) + 4194304U)); writel((unsigned int )(fp___0->rx_comp_mapping >> 32), (void volatile *)bp->regview + (unsigned long )(((unsigned int )(bp->iro_arr + 182UL)->base + (unsigned int )((int )(bp->iro_arr + 182UL)->m1 * func)) + 4194308U)); } else { } ldv_54718: j = j + 1; ldv_54720: ; if ((uint )j < bp->num_ethernet_queues) { goto ldv_54719; } else { } return; } } static void bnx2x_free_tx_skbs_queue(struct bnx2x_fastpath *fp ) { u8 cos ; struct bnx2x *bp ; struct bnx2x_fp_txdata *txdata ; unsigned int pkts_compl ; unsigned int bytes_compl ; u16 sw_prod ; u16 sw_cons ; struct netdev_queue *tmp ; { bp = fp->bp; cos = 0U; goto ldv_54736; ldv_54735: txdata = fp->txdata_ptr[(int )cos]; pkts_compl = 0U; bytes_compl = 0U; sw_prod = txdata->tx_pkt_prod; sw_cons = txdata->tx_pkt_cons; goto ldv_54733; ldv_54732: bnx2x_free_tx_pkt(bp, txdata, (int )sw_cons & 4095, & pkts_compl, & bytes_compl); sw_cons = (u16 )((int )sw_cons + 1); ldv_54733: ; if ((int )sw_cons != (int )sw_prod) { goto ldv_54732; } else { } tmp = netdev_get_tx_queue((struct net_device const *)bp->dev, (unsigned int )txdata->txq_index); netdev_tx_reset_queue(tmp); cos = (u8 )((int )cos + 1); ldv_54736: ; if ((int )fp->max_cos > (int )cos) { goto ldv_54735; } else { } return; } } static void bnx2x_free_tx_skbs_cnic(struct bnx2x *bp ) { int i ; { i = (int )bp->num_ethernet_queues; goto ldv_54744; ldv_54743: ; if ((bp->flags & 32768U) != 0U && (uint )i == (uint )bp->num_queues - bp->num_cnic_queues) { } else { bnx2x_free_tx_skbs_queue(bp->fp + (unsigned long )i); } i = i + 1; ldv_54744: ; if (bp->num_queues > i) { goto ldv_54743; } else { } return; } } static void bnx2x_free_tx_skbs(struct bnx2x *bp ) { int i ; { i = 0; goto ldv_54751; ldv_54750: bnx2x_free_tx_skbs_queue(bp->fp + (unsigned long )i); i = i + 1; ldv_54751: ; if ((uint )i < bp->num_ethernet_queues) { goto ldv_54750; } else { } return; } } static void bnx2x_free_rx_bds(struct bnx2x_fastpath *fp ) { struct bnx2x *bp ; int i ; struct sw_rx_bd *rx_buf ; u8 *data ; { bp = fp->bp; if ((unsigned long )fp->rx_buf_ring == (unsigned long )((struct sw_rx_bd *)0)) { return; } else { } i = 0; goto ldv_54762; ldv_54761: rx_buf = fp->rx_buf_ring + (unsigned long )i; data = rx_buf->data; if ((unsigned long )data == (unsigned long )((u8 *)0)) { goto ldv_54760; } else { } dma_unmap_single_attrs(& (bp->pdev)->dev, rx_buf->mapping, (size_t )fp->rx_buf_size, 2, 0); rx_buf->data = 0; bnx2x_frag_free((struct bnx2x_fastpath const *)fp, (void *)data); ldv_54760: i = i + 1; ldv_54762: ; if ((unsigned int )i <= 4095U) { goto ldv_54761; } else { } return; } } static void bnx2x_free_rx_skbs_cnic(struct bnx2x *bp ) { int j ; { j = (int )bp->num_ethernet_queues; goto ldv_54770; ldv_54769: ; if ((bp->flags & 32768U) != 0U && (uint )j == (uint )bp->num_queues - bp->num_cnic_queues) { } else { bnx2x_free_rx_bds(bp->fp + (unsigned long )j); } j = j + 1; ldv_54770: ; if (bp->num_queues > j) { goto ldv_54769; } else { } return; } } static void bnx2x_free_rx_skbs(struct bnx2x *bp ) { int j ; struct bnx2x_fastpath *fp ; { j = 0; goto ldv_54778; ldv_54777: fp = bp->fp + (unsigned long )j; bnx2x_free_rx_bds(fp); if ((unsigned int )fp->disable_tpa == 0U) { bnx2x_free_tpa_pool(bp, fp, bp->common.chip_id >> 16 == 5710U ? 32 : 64); } else { } j = j + 1; ldv_54778: ; if ((uint )j < bp->num_ethernet_queues) { goto ldv_54777; } else { } return; } } void bnx2x_free_skbs_cnic(struct bnx2x *bp ) { { bnx2x_free_tx_skbs_cnic(bp); bnx2x_free_rx_skbs_cnic(bp); return; } } void bnx2x_free_skbs(struct bnx2x *bp ) { { bnx2x_free_tx_skbs(bp); bnx2x_free_rx_skbs(bp); return; } } void bnx2x_update_max_mf_config(struct bnx2x *bp , u32 value ) { u32 mf_cfg ; u16 tmp ; { mf_cfg = bp->mf_config[(int )bp->pfid >> 1]; tmp = bnx2x_extract_max_cfg(bp, mf_cfg); if ((u32 )tmp != value) { mf_cfg = mf_cfg & 16777215U; mf_cfg = (value << 24) | mf_cfg; bnx2x_fw_command(bp, 3758096384U, mf_cfg); } else { } return; } } static void bnx2x_free_msix_irqs(struct bnx2x *bp , int nvecs ) { int i ; int offset ; long tmp ; long tmp___0 ; int tmp___1 ; { offset = 0; if (nvecs == offset) { return; } else { } if ((bp->flags & 4194304U) == 0U) { free_irq((bp->msix_table + (unsigned long )offset)->vector, (void *)bp->dev); tmp = ldv__builtin_expect((bp->msg_enable & 16) != 0, 0L); if (tmp != 0L) { printk("\rbnx2x: [%s:%d(%s)]released sp irq (%d)\n", "bnx2x_free_msix_irqs", 1590, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (bp->msix_table + (unsigned long )offset)->vector); } else { } offset = offset + 1; } else { } if ((unsigned int )bp->cnic_support != 0U) { if (nvecs == offset) { return; } else { } offset = offset + 1; } else { } i = 0; goto ldv_54799; ldv_54798: ; if (nvecs == offset) { return; } else { } tmp___0 = ldv__builtin_expect((bp->msg_enable & 16) != 0, 0L); if (tmp___0 != 0L) { printk("\rbnx2x: [%s:%d(%s)]about to release fp #%d->%d irq\n", "bnx2x_free_msix_irqs", 1604, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", i, (bp->msix_table + (unsigned long )offset)->vector); } else { } tmp___1 = offset; offset = offset + 1; free_irq((bp->msix_table + (unsigned long )tmp___1)->vector, (void *)bp->fp + (unsigned long )i); i = i + 1; ldv_54799: ; if ((uint )i < bp->num_ethernet_queues) { goto ldv_54798; } else { } return; } } void bnx2x_free_irq(struct bnx2x *bp ) { int nvecs ; { if ((bp->flags & 32U) != 0U && (bp->flags & 1048576U) == 0U) { nvecs = (int )(bp->num_ethernet_queues + (uint )bp->cnic_support); if ((bp->flags & 4194304U) == 0U) { nvecs = nvecs + 1; } else { } bnx2x_free_msix_irqs(bp, nvecs); } else { free_irq((bp->dev)->irq, (void *)bp->dev); } return; } } int bnx2x_enable_msix(struct bnx2x *bp ) { int msix_vec ; int i ; int rc ; long tmp ; long tmp___0 ; long tmp___1 ; long tmp___2 ; int diff ; long tmp___3 ; long tmp___4 ; long tmp___5 ; long tmp___6 ; long tmp___7 ; long tmp___8 ; long tmp___9 ; { msix_vec = 0; if ((bp->flags & 4194304U) == 0U) { (bp->msix_table + (unsigned long )msix_vec)->entry = (u16 )msix_vec; tmp = ldv__builtin_expect((bp->msg_enable & 2) != 0, 0L); if (tmp != 0L) { _dev_info((struct device const *)(& (bp->pdev)->dev), "msix_table[0].entry = %d (slowpath)\n", (int )(bp->msix_table)->entry); } else { } msix_vec = msix_vec + 1; } else { } if ((unsigned int )bp->cnic_support != 0U) { (bp->msix_table + (unsigned long )msix_vec)->entry = (u16 )msix_vec; tmp___0 = ldv__builtin_expect((bp->msg_enable & 2) != 0, 0L); if (tmp___0 != 0L) { _dev_info((struct device const *)(& (bp->pdev)->dev), "msix_table[%d].entry = %d (CNIC)\n", msix_vec, (int )(bp->msix_table + (unsigned long )msix_vec)->entry); } else { } msix_vec = msix_vec + 1; } else { } i = 0; goto ldv_54812; ldv_54811: (bp->msix_table + (unsigned long )msix_vec)->entry = (u16 )msix_vec; tmp___1 = ldv__builtin_expect((bp->msg_enable & 2) != 0, 0L); if (tmp___1 != 0L) { _dev_info((struct device const *)(& (bp->pdev)->dev), "msix_table[%d].entry = %d (fastpath #%u)\n", msix_vec, msix_vec, i); } else { } msix_vec = msix_vec + 1; i = i + 1; ldv_54812: ; if ((uint )i < bp->num_ethernet_queues) { goto ldv_54811; } else { } tmp___2 = ldv__builtin_expect((bp->msg_enable & 1048576) != 0, 0L); if (tmp___2 != 0L) { printk("\rbnx2x: [%s:%d(%s)]about to request enable msix with %d vectors\n", "bnx2x_enable_msix", 1655, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", msix_vec); } else { } rc = pci_enable_msix(bp->pdev, bp->msix_table, msix_vec); if ((int )bp->min_msix_vec_cnt <= rc) { diff = msix_vec - rc; tmp___3 = ldv__builtin_expect((bp->msg_enable & 2) != 0, 0L); if (tmp___3 != 0L) { _dev_info((struct device const *)(& (bp->pdev)->dev), "Trying to use less MSI-X vectors: %d\n", rc); } else { } rc = pci_enable_msix(bp->pdev, bp->msix_table, rc); if (rc != 0) { tmp___4 = ldv__builtin_expect((bp->msg_enable & 2) != 0, 0L); if (tmp___4 != 0L) { _dev_info((struct device const *)(& (bp->pdev)->dev), "MSI-X is not attainable rc %d\n", rc); } else { } goto no_msix; } else { } bp->num_ethernet_queues = bp->num_ethernet_queues - (uint )diff; bp->num_queues = (int )(bp->num_ethernet_queues + bp->num_cnic_queues); tmp___5 = ldv__builtin_expect((bp->msg_enable & 2) != 0, 0L); if (tmp___5 != 0L) { _dev_info((struct device const *)(& (bp->pdev)->dev), "New queue configuration set: %d\n", bp->num_queues); } else { } } else if (rc > 0) { rc = pci_enable_msix(bp->pdev, bp->msix_table, 1); if (rc != 0) { tmp___6 = ldv__builtin_expect((bp->msg_enable & 2) != 0, 0L); if (tmp___6 != 0L) { _dev_info((struct device const *)(& (bp->pdev)->dev), "Single MSI-X is not attainable rc %d\n", rc); } else { } goto no_msix; } else { } tmp___7 = ldv__builtin_expect((bp->msg_enable & 2) != 0, 0L); if (tmp___7 != 0L) { _dev_info((struct device const *)(& (bp->pdev)->dev), "Using single MSI-X vector\n"); } else { } bp->flags = bp->flags | 1048576U; tmp___8 = ldv__builtin_expect((bp->msg_enable & 2) != 0, 0L); if (tmp___8 != 0L) { _dev_info((struct device const *)(& (bp->pdev)->dev), "set number of queues to 1\n"); } else { } bp->num_ethernet_queues = 1U; bp->num_queues = (int )(bp->num_ethernet_queues + bp->num_cnic_queues); } else if (rc < 0) { tmp___9 = ldv__builtin_expect((bp->msg_enable & 2) != 0, 0L); if (tmp___9 != 0L) { _dev_info((struct device const *)(& (bp->pdev)->dev), "MSI-X is not attainable rc %d\n", rc); } else { } goto no_msix; } else { } bp->flags = bp->flags | 32U; return (0); no_msix: ; if (rc == -12) { bp->flags = bp->flags | 128U; } else { } return (rc); } } static int bnx2x_req_msix_irqs(struct bnx2x *bp ) { int i ; int rc ; int offset ; int tmp ; struct bnx2x_fastpath *fp ; { offset = 0; if ((bp->flags & 4194304U) == 0U) { tmp = offset; offset = offset + 1; rc = request_irq((bp->msix_table + (unsigned long )tmp)->vector, & bnx2x_msix_sp_int, 0UL, (char const *)(& (bp->dev)->name), (void *)bp->dev); if (rc != 0) { printk("\vbnx2x: [%s:%d(%s)]request sp irq failed\n", "bnx2x_req_msix_irqs", 1725, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); return (-16); } else { } } else { } if ((unsigned int )bp->cnic_support != 0U) { offset = offset + 1; } else { } i = 0; goto ldv_54826; ldv_54825: fp = bp->fp + (unsigned long )i; snprintf((char *)(& fp->name), 24UL, "%s-fp-%d", (char *)(& (bp->dev)->name), i); rc = request_irq((bp->msix_table + (unsigned long )offset)->vector, & bnx2x_msix_fp_int, 0UL, (char const *)(& fp->name), (void *)fp); if (rc != 0) { printk("\vbnx2x: [%s:%d(%s)]request fp #%d irq (%d) failed rc %d\n", "bnx2x_req_msix_irqs", 1742, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", i, (bp->msix_table + (unsigned long )offset)->vector, rc); bnx2x_free_msix_irqs(bp, offset); return (-16); } else { } offset = offset + 1; i = i + 1; ldv_54826: ; if ((uint )i < bp->num_ethernet_queues) { goto ldv_54825; } else { } i = (int )bp->num_ethernet_queues; if ((bp->flags & 4194304U) == 0U) { offset = (int )bp->cnic_support + 1; netdev_info((struct net_device const *)bp->dev, "using MSI-X IRQs: sp %d fp[%d] %d ... fp[%d] %d\n", (bp->msix_table)->vector, 0, (bp->msix_table + (unsigned long )offset)->vector, i + -1, (bp->msix_table + ((unsigned long )(offset + i) + 0xffffffffffffffffUL))->vector); } else { offset = (int )bp->cnic_support; netdev_info((struct net_device const *)bp->dev, "using MSI-X IRQs: fp[%d] %d ... fp[%d] %d\n", 0, (bp->msix_table + (unsigned long )offset)->vector, i + -1, (bp->msix_table + ((unsigned long )(offset + i) + 0xffffffffffffffffUL))->vector); } return (0); } } int bnx2x_enable_msi(struct bnx2x *bp ) { int rc ; long tmp ; { rc = pci_enable_msi_block(bp->pdev, 1U); if (rc != 0) { tmp = ldv__builtin_expect((bp->msg_enable & 2) != 0, 0L); if (tmp != 0L) { _dev_info((struct device const *)(& (bp->pdev)->dev), "MSI is not attainable\n"); } else { } return (-1); } else { } bp->flags = bp->flags | 64U; return (0); } } static int bnx2x_req_irq(struct bnx2x *bp ) { unsigned long flags ; unsigned int irq ; int tmp ; { if ((bp->flags & 96U) != 0U) { flags = 0UL; } else { flags = 128UL; } if ((bp->flags & 32U) != 0U) { irq = (bp->msix_table)->vector; } else { irq = (bp->pdev)->irq; } tmp = request_irq(irq, & bnx2x_interrupt, flags, (char const *)(& (bp->dev)->name), (void *)bp->dev); return (tmp); } } int bnx2x_setup_irqs(struct bnx2x *bp ) { int rc ; { rc = 0; if ((bp->flags & 32U) != 0U && (bp->flags & 1048576U) == 0U) { rc = bnx2x_req_msix_irqs(bp); if (rc != 0) { return (rc); } else { } } else { rc = bnx2x_req_irq(bp); if (rc != 0) { printk("\vbnx2x: [%s:%d(%s)]IRQ request failed rc %d, aborting\n", "bnx2x_setup_irqs", 1811, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", rc); return (rc); } else { } if ((bp->flags & 64U) != 0U) { (bp->dev)->irq = (bp->pdev)->irq; netdev_info((struct net_device const *)bp->dev, "using MSI IRQ %d\n", (bp->dev)->irq); } else { } if ((bp->flags & 32U) != 0U) { (bp->dev)->irq = (bp->msix_table)->vector; netdev_info((struct net_device const *)bp->dev, "using MSIX IRQ %d\n", (bp->dev)->irq); } else { } } return (0); } } static void bnx2x_napi_enable_cnic(struct bnx2x *bp ) { int i ; { i = (int )bp->num_ethernet_queues; goto ldv_54848; ldv_54847: ; if ((bp->flags & 32768U) != 0U && (uint )i == (uint )bp->num_queues - bp->num_cnic_queues) { } else { napi_enable(& (bp->fp + (unsigned long )i)->napi); } i = i + 1; ldv_54848: ; if (bp->num_queues > i) { goto ldv_54847; } else { } return; } } static void bnx2x_napi_enable(struct bnx2x *bp ) { int i ; { i = 0; goto ldv_54855; ldv_54854: napi_enable(& (bp->fp + (unsigned long )i)->napi); i = i + 1; ldv_54855: ; if ((uint )i < bp->num_ethernet_queues) { goto ldv_54854; } else { } return; } } static void bnx2x_napi_disable_cnic(struct bnx2x *bp ) { int i ; { i = (int )bp->num_ethernet_queues; goto ldv_54863; ldv_54862: ; if ((bp->flags & 32768U) != 0U && (uint )i == (uint )bp->num_queues - bp->num_cnic_queues) { } else { napi_disable(& (bp->fp + (unsigned long )i)->napi); } i = i + 1; ldv_54863: ; if (bp->num_queues > i) { goto ldv_54862; } else { } return; } } static void bnx2x_napi_disable(struct bnx2x *bp ) { int i ; { i = 0; goto ldv_54870; ldv_54869: napi_disable(& (bp->fp + (unsigned long )i)->napi); i = i + 1; ldv_54870: ; if ((uint )i < bp->num_ethernet_queues) { goto ldv_54869; } else { } return; } } void bnx2x_netif_start(struct bnx2x *bp ) { bool tmp ; { tmp = netif_running((struct net_device const *)bp->dev); if ((int )tmp) { bnx2x_napi_enable(bp); if ((int )bp->cnic_loaded) { bnx2x_napi_enable_cnic(bp); } else { } bnx2x_int_enable(bp); if ((unsigned int )bp->state == 12288U) { netif_tx_wake_all_queues___0(bp->dev); } else { } } else { } return; } } void bnx2x_netif_stop(struct bnx2x *bp , int disable_hw ) { { bnx2x_int_disable_sync(bp, disable_hw); bnx2x_napi_disable(bp); if ((int )bp->cnic_loaded) { bnx2x_napi_disable_cnic(bp); } else { } return; } } u16 bnx2x_select_queue(struct net_device *dev , struct sk_buff *skb ) { struct bnx2x *bp ; void *tmp ; struct ethhdr *hdr ; u16 ether_type ; __u16 tmp___0 ; struct vlan_ethhdr *vhdr ; __u16 tmp___1 ; u16 tmp___2 ; { tmp = netdev_priv((struct net_device const *)dev); bp = (struct bnx2x *)tmp; if ((int )bp->cnic_loaded && (bp->flags & 32768U) == 0U) { hdr = (struct ethhdr *)skb->data; tmp___0 = __fswab16((int )hdr->h_proto); ether_type = tmp___0; if ((unsigned int )ether_type == 33024U) { vhdr = (struct vlan_ethhdr *)skb->data; tmp___1 = __fswab16((int )vhdr->h_vlan_encapsulated_proto); ether_type = tmp___1; } else { } if ((unsigned int )ether_type == 35078U || (unsigned int )ether_type == 35092U) { return ((u16 )((bp->fp + (unsigned long )((uint )bp->num_queues - bp->num_cnic_queues))->txdata_ptr[0])->txq_index); } else { } } else { } tmp___2 = __skb_tx_hash((struct net_device const *)dev, (struct sk_buff const *)skb, bp->num_ethernet_queues); return (tmp___2); } } void bnx2x_set_num_queues(struct bnx2x *bp ) { int tmp ; long tmp___0 ; { tmp = bnx2x_calc_num_queues(bp); bp->num_ethernet_queues = (uint )tmp; if (((unsigned int )bp->mf_mode == 1U && ((bp->mf_config[(int )bp->pfid >> 1] & 6U) == 6U || (bp->mf_config[(int )bp->pfid >> 1] & 6U) == 0U)) || ((unsigned int )bp->mf_mode == 3U && (bp->mf_ext_config & 8U) != 0U)) { bp->num_ethernet_queues = 1U; } else { } bp->num_cnic_queues = (uint )bp->cnic_support; bp->num_queues = (int )(bp->num_ethernet_queues + bp->num_cnic_queues); tmp___0 = ldv__builtin_expect((bp->msg_enable & 2) != 0, 0L); if (tmp___0 != 0L) { _dev_info((struct device const *)(& (bp->pdev)->dev), "set number of queues to %d\n", bp->num_queues); } else { } return; } } static int bnx2x_set_real_num_queues(struct bnx2x *bp , int include_cnic ) { int rc ; int tx ; int rx ; long tmp ; { tx = (int )(bp->num_ethernet_queues * (uint )bp->max_cos); rx = (int )bp->num_ethernet_queues; if (include_cnic != 0 && (bp->flags & 32768U) == 0U) { rx = rx + 1; tx = tx + 1; } else { } rc = netif_set_real_num_tx_queues(bp->dev, (unsigned int )tx); if (rc != 0) { printk("\vbnx2x: [%s:%d(%s)]Failed to set real number of Tx queues: %d\n", "bnx2x_set_real_num_queues", 1959, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", rc); return (rc); } else { } rc = netif_set_real_num_rx_queues(bp->dev, (unsigned int )rx); if (rc != 0) { printk("\vbnx2x: [%s:%d(%s)]Failed to set real number of Rx queues: %d\n", "bnx2x_set_real_num_queues", 1964, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", rc); return (rc); } else { } tmp = ldv__builtin_expect((bp->msg_enable & 32) != 0, 0L); if (tmp != 0L) { printk("\rbnx2x: [%s:%d(%s)]Setting real num queues to (tx, rx) (%d, %d)\n", "bnx2x_set_real_num_queues", 1969, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", tx, rx); } else { } return (rc); } } static void bnx2x_set_rx_buf_size(struct bnx2x *bp ) { int i ; struct bnx2x_fastpath *fp ; u32 mtu ; int _min1 ; int _min2 ; u64 __max1 ; int _min1___0 ; int _min2___0 ; u64 __max2 ; int _max1 ; int _max2 ; int _max1___0 ; int _max2___0 ; { i = 0; goto ldv_54921; ldv_54920: ; if ((bp->flags & 32768U) != 0U && (uint )i == (uint )bp->num_queues - bp->num_cnic_queues) { } else { fp = bp->fp + (unsigned long )i; if ((uint )i == (uint )bp->num_queues - bp->num_cnic_queues) { mtu = 2500U; } else { mtu = (bp->dev)->mtu; } _min1 = 8; _min2 = 6; _min1___0 = 8; _min2___0 = 6; __max1 = (u64 )(1UL << (_min1___0 < _min2___0 ? _min1___0 : _min2___0)); __max2 = 320ULL; fp->rx_buf_size = (((u32 )(1UL << (_min1 < _min2 ? _min1 : _min2)) + mtu) + (u32 )(__max1 > __max2 ? __max1 : __max2)) + 32U; _max1___0 = 32; _max2___0 = 64; if (fp->rx_buf_size + (u32 )(_max1___0 > _max2___0 ? _max1___0 : _max2___0) <= 4096U) { _max1 = 32; _max2 = 64; fp->rx_frag_size = fp->rx_buf_size + (u32 )(_max1 > _max2 ? _max1 : _max2); } else { fp->rx_frag_size = 0U; } } i = i + 1; ldv_54921: ; if (bp->num_queues > i) { goto ldv_54920; } else { } return; } } static int bnx2x_init_rss_pf(struct bnx2x *bp ) { int i ; u8 num_eth_queues ; u32 tmp ; int tmp___0 ; { num_eth_queues = (u8 )bp->num_ethernet_queues; i = 0; goto ldv_54929; ldv_54928: tmp = ethtool_rxfh_indir_default((u32 )i, (u32 )num_eth_queues); bp->rss_conf_obj.ind_table[i] = (int )(bp->fp)->cl_id + (int )((u8 )tmp); i = i + 1; ldv_54929: ; if ((unsigned int )i <= 127U) { goto ldv_54928; } else { } tmp___0 = bnx2x_config_rss_eth(bp, (int )((bool )(bp->port.pmf != 0U || (bp->common.chip_id >> 16 != 5710U && (bp->common.chip_id >> 16 != 5711U && bp->common.chip_id >> 16 != 5712U))))); return (tmp___0); } } int bnx2x_config_rss_pf(struct bnx2x *bp , struct bnx2x_rss_config_obj *rss_obj , bool config_hash ) { struct bnx2x_config_rss_params params ; size_t __len ; void *__ret ; int tmp ; { params.rss_obj = 0; params.ramrod_flags = 0UL; params.rss_flags = 0UL; params.rss_result_mask = (unsigned char)0; params.ind_table[0] = (unsigned char)0; params.ind_table[1] = (unsigned char)0; params.ind_table[2] = (unsigned char)0; params.ind_table[3] = (unsigned char)0; params.ind_table[4] = (unsigned char)0; params.ind_table[5] = (unsigned char)0; params.ind_table[6] = (unsigned char)0; params.ind_table[7] = (unsigned char)0; params.ind_table[8] = (unsigned char)0; params.ind_table[9] = (unsigned char)0; params.ind_table[10] = (unsigned char)0; params.ind_table[11] = (unsigned char)0; params.ind_table[12] = (unsigned char)0; params.ind_table[13] = (unsigned char)0; params.ind_table[14] = (unsigned char)0; params.ind_table[15] = (unsigned char)0; params.ind_table[16] = (unsigned char)0; params.ind_table[17] = (unsigned char)0; params.ind_table[18] = (unsigned char)0; params.ind_table[19] = (unsigned char)0; params.ind_table[20] = (unsigned char)0; params.ind_table[21] = (unsigned char)0; params.ind_table[22] = (unsigned char)0; params.ind_table[23] = (unsigned char)0; params.ind_table[24] = (unsigned char)0; params.ind_table[25] = (unsigned char)0; params.ind_table[26] = (unsigned char)0; params.ind_table[27] = (unsigned char)0; params.ind_table[28] = (unsigned char)0; params.ind_table[29] = (unsigned char)0; params.ind_table[30] = (unsigned char)0; params.ind_table[31] = (unsigned char)0; params.ind_table[32] = (unsigned char)0; params.ind_table[33] = (unsigned char)0; params.ind_table[34] = (unsigned char)0; params.ind_table[35] = (unsigned char)0; params.ind_table[36] = (unsigned char)0; params.ind_table[37] = (unsigned char)0; params.ind_table[38] = (unsigned char)0; params.ind_table[39] = (unsigned char)0; params.ind_table[40] = (unsigned char)0; params.ind_table[41] = (unsigned char)0; params.ind_table[42] = (unsigned char)0; params.ind_table[43] = (unsigned char)0; params.ind_table[44] = (unsigned char)0; params.ind_table[45] = (unsigned char)0; params.ind_table[46] = (unsigned char)0; params.ind_table[47] = (unsigned char)0; params.ind_table[48] = (unsigned char)0; params.ind_table[49] = (unsigned char)0; params.ind_table[50] = (unsigned char)0; params.ind_table[51] = (unsigned char)0; params.ind_table[52] = (unsigned char)0; params.ind_table[53] = (unsigned char)0; params.ind_table[54] = (unsigned char)0; params.ind_table[55] = (unsigned char)0; params.ind_table[56] = (unsigned char)0; params.ind_table[57] = (unsigned char)0; params.ind_table[58] = (unsigned char)0; params.ind_table[59] = (unsigned char)0; params.ind_table[60] = (unsigned char)0; params.ind_table[61] = (unsigned char)0; params.ind_table[62] = (unsigned char)0; params.ind_table[63] = (unsigned char)0; params.ind_table[64] = (unsigned char)0; params.ind_table[65] = (unsigned char)0; params.ind_table[66] = (unsigned char)0; params.ind_table[67] = (unsigned char)0; params.ind_table[68] = (unsigned char)0; params.ind_table[69] = (unsigned char)0; params.ind_table[70] = (unsigned char)0; params.ind_table[71] = (unsigned char)0; params.ind_table[72] = (unsigned char)0; params.ind_table[73] = (unsigned char)0; params.ind_table[74] = (unsigned char)0; params.ind_table[75] = (unsigned char)0; params.ind_table[76] = (unsigned char)0; params.ind_table[77] = (unsigned char)0; params.ind_table[78] = (unsigned char)0; params.ind_table[79] = (unsigned char)0; params.ind_table[80] = (unsigned char)0; params.ind_table[81] = (unsigned char)0; params.ind_table[82] = (unsigned char)0; params.ind_table[83] = (unsigned char)0; params.ind_table[84] = (unsigned char)0; params.ind_table[85] = (unsigned char)0; params.ind_table[86] = (unsigned char)0; params.ind_table[87] = (unsigned char)0; params.ind_table[88] = (unsigned char)0; params.ind_table[89] = (unsigned char)0; params.ind_table[90] = (unsigned char)0; params.ind_table[91] = (unsigned char)0; params.ind_table[92] = (unsigned char)0; params.ind_table[93] = (unsigned char)0; params.ind_table[94] = (unsigned char)0; params.ind_table[95] = (unsigned char)0; params.ind_table[96] = (unsigned char)0; params.ind_table[97] = (unsigned char)0; params.ind_table[98] = (unsigned char)0; params.ind_table[99] = (unsigned char)0; params.ind_table[100] = (unsigned char)0; params.ind_table[101] = (unsigned char)0; params.ind_table[102] = (unsigned char)0; params.ind_table[103] = (unsigned char)0; params.ind_table[104] = (unsigned char)0; params.ind_table[105] = (unsigned char)0; params.ind_table[106] = (unsigned char)0; params.ind_table[107] = (unsigned char)0; params.ind_table[108] = (unsigned char)0; params.ind_table[109] = (unsigned char)0; params.ind_table[110] = (unsigned char)0; params.ind_table[111] = (unsigned char)0; params.ind_table[112] = (unsigned char)0; params.ind_table[113] = (unsigned char)0; params.ind_table[114] = (unsigned char)0; params.ind_table[115] = (unsigned char)0; params.ind_table[116] = (unsigned char)0; params.ind_table[117] = (unsigned char)0; params.ind_table[118] = (unsigned char)0; params.ind_table[119] = (unsigned char)0; params.ind_table[120] = (unsigned char)0; params.ind_table[121] = (unsigned char)0; params.ind_table[122] = (unsigned char)0; params.ind_table[123] = (unsigned char)0; params.ind_table[124] = (unsigned char)0; params.ind_table[125] = (unsigned char)0; params.ind_table[126] = (unsigned char)0; params.ind_table[127] = (unsigned char)0; params.rss_key[0] = 0U; params.rss_key[1] = 0U; params.rss_key[2] = 0U; params.rss_key[3] = 0U; params.rss_key[4] = 0U; params.rss_key[5] = 0U; params.rss_key[6] = 0U; params.rss_key[7] = 0U; params.rss_key[8] = 0U; params.rss_key[9] = 0U; params.toe_rss_bitmap = (unsigned short)0; params.rss_obj = rss_obj; __set_bit(2, (unsigned long volatile *)(& params.ramrod_flags)); __set_bit(1, (unsigned long volatile *)(& params.rss_flags)); __set_bit(3, (unsigned long volatile *)(& params.rss_flags)); __set_bit(4, (unsigned long volatile *)(& params.rss_flags)); __set_bit(6, (unsigned long volatile *)(& params.rss_flags)); __set_bit(7, (unsigned long volatile *)(& params.rss_flags)); if ((unsigned int )rss_obj->udp_rss_v4 != 0U) { __set_bit(5, (unsigned long volatile *)(& params.rss_flags)); } else { } if ((unsigned int )rss_obj->udp_rss_v6 != 0U) { __set_bit(8, (unsigned long volatile *)(& params.rss_flags)); } else { } params.rss_result_mask = 127U; __len = 128UL; if (__len > 63UL) { __ret = __memcpy((void *)(& params.ind_table), (void const *)(& rss_obj->ind_table), __len); } else { __ret = __builtin_memcpy((void *)(& params.ind_table), (void const *)(& rss_obj->ind_table), __len); } if ((int )config_hash) { prandom_bytes((void *)(& params.rss_key), 40); __set_bit(2, (unsigned long volatile *)(& params.rss_flags)); } else { } tmp = bnx2x_config_rss(bp, & params); return (tmp); } } static int bnx2x_init_hw(struct bnx2x *bp , u32 load_code ) { struct bnx2x_func_state_params func_params ; int tmp ; { func_params.f_obj = 0; func_params.cmd = 0; func_params.ramrod_flags = 0UL; func_params.params.tx_start.traffic_type_to_priority_cos[0].priority = (unsigned char)0; func_params.params.tx_start.traffic_type_to_priority_cos[0].cos = (unsigned char)0; func_params.params.tx_start.traffic_type_to_priority_cos[0].reserved1 = (unsigned short)0; func_params.params.tx_start.traffic_type_to_priority_cos[1].priority = (unsigned char)0; func_params.params.tx_start.traffic_type_to_priority_cos[1].cos = (unsigned char)0; func_params.params.tx_start.traffic_type_to_priority_cos[1].reserved1 = (unsigned short)0; func_params.params.tx_start.traffic_type_to_priority_cos[2].priority = (unsigned char)0; func_params.params.tx_start.traffic_type_to_priority_cos[2].cos = (unsigned char)0; func_params.params.tx_start.traffic_type_to_priority_cos[2].reserved1 = (unsigned short)0; func_params.params.tx_start.traffic_type_to_priority_cos[3].priority = (unsigned char)0; func_params.params.tx_start.traffic_type_to_priority_cos[3].cos = (unsigned char)0; func_params.params.tx_start.traffic_type_to_priority_cos[3].reserved1 = (unsigned short)0; func_params.params.tx_start.traffic_type_to_priority_cos[4].priority = (unsigned char)0; func_params.params.tx_start.traffic_type_to_priority_cos[4].cos = (unsigned char)0; func_params.params.tx_start.traffic_type_to_priority_cos[4].reserved1 = (unsigned short)0; func_params.params.tx_start.traffic_type_to_priority_cos[5].priority = (unsigned char)0; func_params.params.tx_start.traffic_type_to_priority_cos[5].cos = (unsigned char)0; func_params.params.tx_start.traffic_type_to_priority_cos[5].reserved1 = (unsigned short)0; func_params.params.tx_start.traffic_type_to_priority_cos[6].priority = (unsigned char)0; func_params.params.tx_start.traffic_type_to_priority_cos[6].cos = (unsigned char)0; func_params.params.tx_start.traffic_type_to_priority_cos[6].reserved1 = (unsigned short)0; func_params.params.tx_start.traffic_type_to_priority_cos[7].priority = (unsigned char)0; func_params.params.tx_start.traffic_type_to_priority_cos[7].cos = (unsigned char)0; func_params.params.tx_start.traffic_type_to_priority_cos[7].reserved1 = (unsigned short)0; func_params.params.tx_start.dcb_enabled = (unsigned char)0; func_params.params.tx_start.dcb_version = (unsigned char)0; func_params.params.tx_start.dont_add_pri_0_en = (unsigned char)0; __set_bit(2, (unsigned long volatile *)(& func_params.ramrod_flags)); func_params.f_obj = & bp->func_obj; func_params.cmd = 0; func_params.params.hw_init.load_phase = load_code; tmp = bnx2x_func_state_change(bp, & func_params); return (tmp); } } void bnx2x_squeeze_objects(struct bnx2x *bp ) { int rc ; unsigned long ramrod_flags ; unsigned long vlan_mac_flags ; struct bnx2x_mcast_ramrod_params rparam ; struct bnx2x_vlan_mac_obj *mac_obj ; { ramrod_flags = 0UL; vlan_mac_flags = 0UL; rparam.mcast_obj = 0; rparam.ramrod_flags = 0UL; rparam.mcast_list.next = 0; rparam.mcast_list.prev = 0; rparam.mcast_list_len = 0; mac_obj = & (bp->sp_objs)->mac_obj; __set_bit(2, (unsigned long volatile *)(& ramrod_flags)); __set_bit(3, (unsigned long volatile *)(& ramrod_flags)); __set_bit(1, (unsigned long volatile *)(& vlan_mac_flags)); rc = (*(mac_obj->delete_all))(bp, & (bp->sp_objs)->mac_obj, & vlan_mac_flags, & ramrod_flags); if (rc != 0) { printk("\vbnx2x: [%s:%d(%s)]Failed to clean ETH MACs: %d\n", "bnx2x_squeeze_objects", 2110, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", rc); } else { } vlan_mac_flags = 0UL; __set_bit(0, (unsigned long volatile *)(& vlan_mac_flags)); rc = (*(mac_obj->delete_all))(bp, mac_obj, & vlan_mac_flags, & ramrod_flags); if (rc != 0) { printk("\vbnx2x: [%s:%d(%s)]Failed to clean UC list MACs: %d\n", "bnx2x_squeeze_objects", 2118, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", rc); } else { } rparam.mcast_obj = & bp->mcast_obj; __set_bit(3, (unsigned long volatile *)(& rparam.ramrod_flags)); rc = bnx2x_config_mcast(bp, & rparam, 2); if (rc < 0) { printk("\vbnx2x: [%s:%d(%s)]Failed to add a new DEL command to a multi-cast object: %d\n", "bnx2x_squeeze_objects", 2128, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", rc); } else { } rc = bnx2x_config_mcast(bp, & rparam, 1); goto ldv_54955; ldv_54954: ; if (rc < 0) { printk("\vbnx2x: [%s:%d(%s)]Failed to clean multi-cast object: %d\n", "bnx2x_squeeze_objects", 2135, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", rc); return; } else { } rc = bnx2x_config_mcast(bp, & rparam, 1); ldv_54955: ; if (rc != 0) { goto ldv_54954; } else { } return; } } static void bnx2x_free_fw_stats_mem(struct bnx2x *bp ) { { if ((unsigned long )bp->fw_stats != (unsigned long )((void *)0)) { dma_free_attrs(& (bp->pdev)->dev, (size_t )(bp->fw_stats_data_sz + bp->fw_stats_req_sz), bp->fw_stats, bp->fw_stats_mapping, 0); bp->fw_stats = 0; bp->fw_stats_mapping = 0ULL; } else { } return; } } static int bnx2x_alloc_fw_stats_mem(struct bnx2x *bp ) { int num_groups ; int vf_headroom ; int is_fcoe_stats ; u8 num_queue_stats ; long tmp ; long tmp___0 ; long tmp___1 ; { vf_headroom = 0; is_fcoe_stats = (bp->flags & 32768U) == 0U; num_queue_stats = (int )((u8 )bp->num_ethernet_queues) + (int )((u8 )is_fcoe_stats); bp->fw_stats_num = (unsigned int )((int )((u8 )is_fcoe_stats) + (int )num_queue_stats) + 2U; if ((unsigned long )bp->vfdb != (unsigned long )((struct bnx2x_vfdb *)0)) { vf_headroom = bnx2x_vf_headroom(bp); } else { } num_groups = ((int )bp->fw_stats_num + vf_headroom) / 16 + (((unsigned int )((int )bp->fw_stats_num + vf_headroom) & 15U) != 0U); tmp = ldv__builtin_expect((bp->msg_enable & 1048576) != 0, 0L); if (tmp != 0L) { printk("\rbnx2x: [%s:%d(%s)]stats fw_stats_num %d, vf headroom %d, num_groups %d\n", "bnx2x_alloc_fw_stats_mem", 2211, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )bp->fw_stats_num, vf_headroom, num_groups); } else { } bp->fw_stats_req_sz = (int )((unsigned int )((unsigned long )num_groups) * 256U + 16U); bp->fw_stats_data_sz = (int )((unsigned int )num_queue_stats * 152U + 128U); bp->fw_stats = dma_alloc_attrs(& (bp->pdev)->dev, (size_t )(bp->fw_stats_data_sz + bp->fw_stats_req_sz), & bp->fw_stats_mapping, 32976U, 0); if ((unsigned long )bp->fw_stats == (unsigned long )((void *)0)) { goto alloc_mem_err; } else { } bp->fw_stats_req = (struct bnx2x_fw_stats_req *)bp->fw_stats; bp->fw_stats_req_mapping = bp->fw_stats_mapping; bp->fw_stats_data = (struct bnx2x_fw_stats_data *)bp->fw_stats + (unsigned long )bp->fw_stats_req_sz; bp->fw_stats_data_mapping = bp->fw_stats_mapping + (dma_addr_t )bp->fw_stats_req_sz; tmp___0 = ldv__builtin_expect((bp->msg_enable & 1048576) != 0, 0L); if (tmp___0 != 0L) { printk("\rbnx2x: [%s:%d(%s)]statistics request base address set to %x %x", "bnx2x_alloc_fw_stats_mem", 2242, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (unsigned int )(bp->fw_stats_req_mapping >> 32), (unsigned int )bp->fw_stats_req_mapping); } else { } tmp___1 = ldv__builtin_expect((bp->msg_enable & 1048576) != 0, 0L); if (tmp___1 != 0L) { printk("\rbnx2x: [%s:%d(%s)]statistics data base address set to %x %x", "bnx2x_alloc_fw_stats_mem", 2245, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (unsigned int )(bp->fw_stats_data_mapping >> 32), (unsigned int )bp->fw_stats_data_mapping); } else { } return (0); alloc_mem_err: bnx2x_free_fw_stats_mem(bp); printk("\vbnx2x: [%s:%d(%s)]Can\'t allocate FW stats memory\n", "bnx2x_alloc_fw_stats_mem", 2250, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); return (-12); } } static int bnx2x_nic_load_request(struct bnx2x *bp , u32 *load_code ) { unsigned int tmp ; long tmp___0 ; unsigned int tmp___1 ; long tmp___2 ; { tmp = readl((void const volatile *)(bp->regview + (((unsigned long )bp->common.shmem_base + (unsigned long )(((int )bp->pfid & 1) + ((int )bp->pfid >> 1) * ((bp->common.chip_id >> 16 == 5710U || (bp->common.chip_id >> 16 == 5711U || bp->common.chip_id >> 16 == 5712U)) || (unsigned int )bp->common.chip_port_mode == 0U ? 2 : 1)) * 44UL) + 1668UL))); bp->fw_seq = (u16 )tmp; tmp___0 = ldv__builtin_expect((bp->msg_enable & 2) != 0, 0L); if (tmp___0 != 0L) { _dev_info((struct device const *)(& (bp->pdev)->dev), "fw_seq 0x%08x\n", (int )bp->fw_seq); } else { } tmp___1 = readl((void const volatile *)(bp->regview + (((unsigned long )bp->common.shmem_base + (unsigned long )(((int )bp->pfid & 1) + ((int )bp->pfid >> 1) * ((bp->common.chip_id >> 16 == 5710U || (bp->common.chip_id >> 16 == 5711U || bp->common.chip_id >> 16 == 5712U)) || (unsigned int )bp->common.chip_port_mode == 0U ? 2 : 1)) * 44UL) + 1684UL))); bp->fw_drv_pulse_wr_seq = (unsigned int )((u16 )tmp___1) & 32767U; tmp___2 = ldv__builtin_expect((bp->msg_enable & 2) != 0, 0L); if (tmp___2 != 0L) { _dev_info((struct device const *)(& (bp->pdev)->dev), "drv_pulse 0x%x\n", (int )bp->fw_drv_pulse_wr_seq); } else { } *load_code = bnx2x_fw_command(bp, 268435456U, 4106U); if (*load_code == 0U) { printk("\vbnx2x: [%s:%d(%s)]MCP response failure, aborting\n", "bnx2x_nic_load_request", 2275, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); return (-16); } else { } if (*load_code == 270532608U) { printk("\vbnx2x: [%s:%d(%s)]MCP refused load request, aborting\n", "bnx2x_nic_load_request", 2283, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); return (-16); } else { } return (0); } } int bnx2x_nic_load_analyze_req(struct bnx2x *bp , u32 load_code ) { u32 my_fw ; u32 loaded_fw ; unsigned int tmp ; long tmp___0 ; { if (load_code != 269680640U && load_code != 269484032U) { my_fw = 1116167U; tmp = readl((void const volatile *)bp->regview + 2883584U); loaded_fw = tmp; tmp___0 = ldv__builtin_expect((bp->msg_enable & 1048576) != 0, 0L); if (tmp___0 != 0L) { printk("\rbnx2x: [%s:%d(%s)]loaded fw %x, my fw %x\n", "bnx2x_nic_load_analyze_req", 2308, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", loaded_fw, my_fw); } else { } if (my_fw != loaded_fw) { printk("\vbnx2x: [%s:%d(%s)]bnx2x with FW %x was already loaded which mismatches my %x FW. aborting\n", "bnx2x_nic_load_analyze_req", 2313, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", loaded_fw, my_fw); return (-16); } else { } } else { } return (0); } } static int bnx2x_nic_load_no_mcp(struct bnx2x *bp , int port ) { int path ; long tmp ; long tmp___0 ; { path = bp->common.chip_id >> 16 != 5710U && (bp->common.chip_id >> 16 != 5711U && bp->common.chip_id >> 16 != 5712U) ? (int )bp->pf_num & 1 : 0; tmp = ldv__builtin_expect((bp->msg_enable & 32) != 0, 0L); if (tmp != 0L) { printk("\rbnx2x: [%s:%d(%s)]NO MCP - load counts[%d] %d, %d, %d\n", "bnx2x_nic_load_no_mcp", 2327, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", path, load_count[path][0], load_count[path][1], load_count[path][2]); } else { } load_count[path][0] = load_count[path][0] + 1; load_count[path][port + 1] = load_count[path][port + 1] + 1; tmp___0 = ldv__builtin_expect((bp->msg_enable & 32) != 0, 0L); if (tmp___0 != 0L) { printk("\rbnx2x: [%s:%d(%s)]NO MCP - new load counts[%d] %d, %d, %d\n", "bnx2x_nic_load_no_mcp", 2332, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", path, load_count[path][0], load_count[path][1], load_count[path][2]); } else { } if (load_count[path][0] == 1) { return (269484032); } else if (load_count[path][port + 1] == 1) { return (269549568); } else { return (269615104); } } } static void bnx2x_nic_load_pmf(struct bnx2x *bp , u32 load_code ) { long tmp ; { if ((load_code == 269484032U || load_code == 269680640U) || load_code == 269549568U) { bp->port.pmf = 1U; __asm__ volatile ("mfence": : : "memory"); } else { bp->port.pmf = 0U; } tmp = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp != 0L) { printk("\rbnx2x: [%s:%d(%s)]pmf %d\n", "bnx2x_nic_load_pmf", 2357, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", bp->port.pmf); } else { } return; } } static void bnx2x_nic_load_afex_dcc(struct bnx2x *bp , int load_code ) { unsigned int tmp ; unsigned int tmp___0 ; { if ((load_code == 269484032 || load_code == 269680640) && bp->common.shmem2_base != 0U) { if (bp->common.shmem2_base != 0U) { tmp = readl((void const volatile *)bp->regview + (unsigned long )bp->common.shmem2_base); if (tmp > 4U) { writel(5U, (void volatile *)(bp->regview + ((unsigned long )bp->common.shmem2_base + 4UL))); } else { } } else { } if (bp->common.shmem2_base != 0U) { tmp___0 = readl((void const volatile *)bp->regview + (unsigned long )bp->common.shmem2_base); if (tmp___0 > 116U) { writel(4097U, (void volatile *)(bp->regview + ((unsigned long )bp->common.shmem2_base + 116UL))); } else { } } else { } } else { } bp->afex_def_vlan_tag = -1; return; } } static void bnx2x_bz_fp(struct bnx2x *bp , int index ) { struct bnx2x_fastpath *fp ; int cos ; struct napi_struct orig_napi ; struct bnx2x_agg_info *orig_tpa_info ; bool tmp ; int tmp___0 ; int tmp___1 ; { fp = bp->fp + (unsigned long )index; orig_napi = fp->napi; orig_tpa_info = fp->tpa_info; if ((unsigned long )fp->tpa_info != (unsigned long )((struct bnx2x_agg_info *)0)) { memset((void *)fp->tpa_info, 0, 2560UL); } else { } memset((void *)fp, 0, 528UL); fp->napi = orig_napi; fp->tpa_info = orig_tpa_info; fp->bp = bp; fp->index = (u8 )index; if ((uint )fp->index < (fp->bp)->num_ethernet_queues) { fp->max_cos = bp->max_cos; } else { fp->max_cos = 1U; } if ((uint )fp->index == (uint )(fp->bp)->num_queues - (fp->bp)->num_cnic_queues) { fp->txdata_ptr[0] = bp->bnx2x_txq + (unsigned long )(((uint )bp->num_queues - bp->num_cnic_queues) * (uint )bp->max_cos); } else { } if ((uint )fp->index < (fp->bp)->num_ethernet_queues) { cos = 0; goto ldv_55005; ldv_55004: fp->txdata_ptr[cos] = bp->bnx2x_txq + (unsigned long )(bp->num_ethernet_queues * (uint )cos + (uint )index); cos = cos + 1; ldv_55005: ; if ((int )fp->max_cos > cos) { goto ldv_55004; } else { } } else { } if ((bp->flags & 256U) == 0U) { if ((bp->flags & 1024U) == 0U) { tmp___1 = 1; } else { tmp = bnx2x_mtu_allows_gro((int )(bp->dev)->mtu); if (tmp) { tmp___0 = 0; } else { tmp___0 = 1; } if (tmp___0) { tmp___1 = 1; } else { tmp___1 = 0; } } } else { tmp___1 = 0; } fp->disable_tpa = (u8 )tmp___1; if ((bp->flags & 256U) != 0U) { fp->mode = 0; } else if ((bp->flags & 1024U) != 0U) { fp->mode = 1; } else { } if ((uint )fp->index == (uint )(fp->bp)->num_queues - (fp->bp)->num_cnic_queues) { fp->disable_tpa = 1U; } else { } return; } } int bnx2x_load_cnic(struct bnx2x *bp ) { int i ; int rc ; int port ; long tmp ; struct lock_class_key __key ; long tmp___0 ; long tmp___1 ; { port = (int )bp->pfid & 1; tmp = ldv__builtin_expect((bp->msg_enable & 32) != 0, 0L); if (tmp != 0L) { printk("\rbnx2x: [%s:%d(%s)]Starting CNIC-related load\n", "bnx2x_load_cnic", 2440, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } __mutex_init(& bp->cnic_mutex, "&bp->cnic_mutex", & __key); if ((bp->flags & 4194304U) == 0U) { rc = bnx2x_alloc_mem_cnic(bp); if (rc != 0) { printk("\vbnx2x: [%s:%d(%s)]Unable to allocate bp memory for cnic\n", "bnx2x_load_cnic", 2447, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); bp->cnic_loaded = 0; goto load_error_cnic0; } else { } } else { } rc = bnx2x_alloc_fp_mem_cnic(bp); if (rc != 0) { printk("\vbnx2x: [%s:%d(%s)]Unable to allocate memory for cnic fps\n", "bnx2x_load_cnic", 2454, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); bp->cnic_loaded = 0; goto load_error_cnic0; } else { } rc = bnx2x_set_real_num_queues(bp, 1); if (rc != 0) { printk("\vbnx2x: [%s:%d(%s)]Unable to set real_num_queues including cnic\n", "bnx2x_load_cnic", 2461, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); bp->cnic_loaded = 0; goto load_error_cnic0; } else { } bnx2x_add_all_napi_cnic(bp); tmp___0 = ldv__builtin_expect((bp->msg_enable & 32) != 0, 0L); if (tmp___0 != 0L) { printk("\rbnx2x: [%s:%d(%s)]cnic napi added\n", "bnx2x_load_cnic", 2467, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } bnx2x_napi_enable_cnic(bp); rc = bnx2x_init_hw_func_cnic(bp); if (rc != 0) { bp->cnic_loaded = 0; goto load_error_cnic1; } else { } bnx2x_nic_init_cnic(bp); if ((bp->flags & 4194304U) == 0U) { writel(1U, (void volatile *)bp->regview + (unsigned long )((port + 364549) * 4)); i = (int )bp->num_ethernet_queues; goto ldv_55020; ldv_55019: ; if ((bp->flags & 32768U) != 0U && (uint )i == (uint )bp->num_queues - bp->num_cnic_queues) { } else { rc = bnx2x_setup_queue(bp, bp->fp + (unsigned long )i, 0); if (rc != 0) { printk("\vbnx2x: [%s:%d(%s)]Queue setup failed\n", "bnx2x_load_cnic", 2484, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); bp->state = 61440U; goto load_error_cnic2; } else { } } i = i + 1; ldv_55020: ; if (bp->num_queues > i) { goto ldv_55019; } else { } } else { } netif_addr_lock_bh(bp->dev); bnx2x_set_rx_mode(bp->dev); netif_addr_unlock_bh(bp->dev); bnx2x_get_iscsi_info(bp); bnx2x_setup_cnic_irq_info(bp); bnx2x_setup_cnic_info(bp); bp->cnic_loaded = 1; if ((unsigned int )bp->state == 12288U) { bnx2x_cnic_notify(bp, 2); } else { } tmp___1 = ldv__builtin_expect((bp->msg_enable & 32) != 0, 0L); if (tmp___1 != 0L) { printk("\rbnx2x: [%s:%d(%s)]Ending successfully CNIC-related load\n", "bnx2x_load_cnic", 2504, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } return (0); load_error_cnic2: writel(0U, (void volatile *)bp->regview + (unsigned long )((port + 364549) * 4)); load_error_cnic1: bnx2x_napi_disable_cnic(bp); rc = bnx2x_set_real_num_queues(bp, 0); if (rc != 0) { printk("\vbnx2x: [%s:%d(%s)]Unable to set real_num_queues not including cnic\n", "bnx2x_load_cnic", 2518, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } load_error_cnic0: printk("\vbnx2x: [%s:%d(%s)]CNIC-related load failed\n", "bnx2x_load_cnic", 2520, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); bnx2x_free_fp_mem_cnic(bp); bnx2x_free_mem_cnic(bp); return (rc); } } int bnx2x_nic_load(struct bnx2x *bp , int load_mode ) { int port ; int i ; int rc ; int load_code ; long tmp ; long tmp___0 ; long tmp___1 ; int tmp___2 ; long tmp___3 ; u32 tmp___4 ; u32 val ; unsigned int tmp___5 ; bool tmp___6 ; int tmp___7 ; long tmp___8 ; { port = (int )bp->pfid & 1; rc = 0; load_code = 0; tmp = ldv__builtin_expect((bp->msg_enable & 32) != 0, 0L); if (tmp != 0L) { printk("\rbnx2x: [%s:%d(%s)]Starting NIC load\n", "bnx2x_nic_load", 2533, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } tmp___0 = ldv__builtin_expect((bp->msg_enable & 32) != 0, 0L); if (tmp___0 != 0L) { printk("\rbnx2x: [%s:%d(%s)]CNIC is %s\n", "bnx2x_nic_load", 2535, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )bp->cnic_enabled ? (char *)"enabled" : (char *)"disabled"); } else { } bp->state = 4096U; memset((void *)(& bp->last_reported_link), 0, 16UL); __set_bit(1, (unsigned long volatile *)(& bp->last_reported_link.link_report_flags)); if ((bp->flags & 4194304U) == 0U) { bnx2x_ilt_set_info(bp); } else { } tmp___1 = ldv__builtin_expect((bp->msg_enable & 32) != 0, 0L); if (tmp___1 != 0L) { printk("\rbnx2x: [%s:%d(%s)]num queues: %d", "bnx2x_nic_load", 2559, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", bp->num_queues); } else { } i = 0; goto ldv_55033; ldv_55032: ; if ((bp->flags & 32768U) != 0U && (uint )i == (uint )bp->num_queues - bp->num_cnic_queues) { } else { bnx2x_bz_fp(bp, i); } i = i + 1; ldv_55033: ; if (bp->num_queues > i) { goto ldv_55032; } else { } memset((void *)bp->bnx2x_txq, 0, (unsigned long )((uint )(((int )bp->igu_sb_cnt - (int )bp->cnic_support) * 3) + bp->num_cnic_queues) * 80UL); bp->fcoe_init = 0; bnx2x_set_rx_buf_size(bp); if ((bp->flags & 4194304U) == 0U) { rc = bnx2x_alloc_mem(bp); if (rc != 0) { printk("\vbnx2x: [%s:%d(%s)]Unable to allocate bp memory\n", "bnx2x_nic_load", 2574, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); return (rc); } else { } } else { } tmp___2 = bnx2x_alloc_fw_stats_mem(bp); if (tmp___2 != 0) { bp->state = 61440U; goto load_error0; } else { } rc = bnx2x_alloc_fp_mem(bp); if (rc != 0) { printk("\vbnx2x: [%s:%d(%s)]Unable to allocate memory for fps\n", "bnx2x_nic_load", 2588, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); bp->state = 61440U; goto load_error0; } else { } if ((bp->flags & 4194304U) != 0U) { rc = bnx2x_vfpf_init(bp); if (rc != 0) { bp->state = 61440U; goto load_error0; } else { } } else { } rc = bnx2x_set_real_num_queues(bp, 0); if (rc != 0) { printk("\vbnx2x: [%s:%d(%s)]Unable to set real_num_queues\n", "bnx2x_nic_load", 2605, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); bp->state = 61440U; goto load_error0; } else { } bnx2x_setup_tc(bp->dev, (int )bp->max_cos); bnx2x_add_all_napi(bp); tmp___3 = ldv__builtin_expect((bp->msg_enable & 32) != 0, 0L); if (tmp___3 != 0L) { printk("\rbnx2x: [%s:%d(%s)]napi added\n", "bnx2x_nic_load", 2617, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } bnx2x_napi_enable(bp); if ((bp->flags & 4194304U) == 0U) { bnx2x_set_pf_load(bp); if ((bp->flags & 512U) == 0U) { rc = bnx2x_nic_load_request(bp, (u32 *)(& load_code)); if (rc != 0) { bp->state = 61440U; goto load_error1; } else { } rc = bnx2x_nic_load_analyze_req(bp, (u32 )load_code); if (rc != 0) { bnx2x_fw_command(bp, 285212672U, 0U); bp->state = 61440U; goto load_error2; } else { } } else { load_code = bnx2x_nic_load_no_mcp(bp, port); } bnx2x_nic_load_pmf(bp, (u32 )load_code); bnx2x__init_func_obj(bp); rc = bnx2x_init_hw(bp, (u32 )load_code); if (rc != 0) { printk("\vbnx2x: [%s:%d(%s)]HW init failed, aborting\n", "bnx2x_nic_load", 2650, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); bnx2x_fw_command(bp, 285212672U, 0U); bp->state = 61440U; goto load_error2; } else { } } else { } bnx2x_pre_irq_nic_init(bp); rc = bnx2x_setup_irqs(bp); if (rc != 0) { printk("\vbnx2x: [%s:%d(%s)]setup irqs failed\n", "bnx2x_nic_load", 2661, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); if ((bp->flags & 4194304U) == 0U) { bnx2x_fw_command(bp, 285212672U, 0U); } else { } bp->state = 61440U; goto load_error2; } else { } if ((bp->flags & 4194304U) == 0U) { bnx2x_post_irq_nic_init(bp, (u32 )load_code); bnx2x_init_bp_objs(bp); bnx2x_iov_nic_init(bp); bp->afex_def_vlan_tag = -1; bnx2x_nic_load_afex_dcc(bp, load_code); bp->state = 8192U; rc = bnx2x_func_start(bp); if (rc != 0) { printk("\vbnx2x: [%s:%d(%s)]Function start failed!\n", "bnx2x_nic_load", 2681, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); bnx2x_fw_command(bp, 285212672U, 0U); bp->state = 61440U; goto load_error3; } else { } if ((bp->flags & 512U) == 0U) { tmp___4 = bnx2x_fw_command(bp, 285212672U, 0U); load_code = (int )tmp___4; if (load_code == 0) { printk("\vbnx2x: [%s:%d(%s)]MCP response failure, aborting\n", "bnx2x_nic_load", 2692, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); rc = -16; bp->state = 61440U; goto load_error3; } else { } } else { } bnx2x_update_coalesce(bp); rc = bnx2x_setup_leading(bp); if (rc != 0) { printk("\vbnx2x: [%s:%d(%s)]Setup leading failed!\n", "bnx2x_nic_load", 2704, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); bp->state = 61440U; goto load_error3; } else { } i = 1; goto ldv_55040; ldv_55039: rc = bnx2x_setup_queue(bp, bp->fp + (unsigned long )i, 0); if (rc != 0) { printk("\vbnx2x: [%s:%d(%s)]Queue setup failed\n", "bnx2x_nic_load", 2712, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); bp->state = 61440U; goto load_error3; } else { } i = i + 1; ldv_55040: ; if ((uint )i < bp->num_ethernet_queues) { goto ldv_55039; } else { } rc = bnx2x_init_rss_pf(bp); if (rc != 0) { printk("\vbnx2x: [%s:%d(%s)]PF RSS init failed\n", "bnx2x_nic_load", 2720, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); bp->state = 61440U; goto load_error3; } else { } } else { i = 0; goto ldv_55043; ldv_55042: rc = bnx2x_vfpf_setup_q(bp, i); if (rc != 0) { printk("\vbnx2x: [%s:%d(%s)]Queue setup failed\n", "bnx2x_nic_load", 2728, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); bp->state = 61440U; goto load_error3; } else { } i = i + 1; ldv_55043: ; if ((uint )i < bp->num_ethernet_queues) { goto ldv_55042; } else { } } bp->state = 12288U; if ((bp->flags & 4194304U) == 0U) { rc = bnx2x_set_eth_mac(bp, 1); } else { rc = bnx2x_vfpf_config_mac(bp, (bp->dev)->dev_addr, (int )(bp->fp)->index, 1); } if (rc != 0) { printk("\vbnx2x: [%s:%d(%s)]Setting Ethernet MAC failed\n", "bnx2x_nic_load", 2744, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); bp->state = 61440U; goto load_error3; } else { } if ((bp->flags & 4194304U) == 0U && bp->pending_max != 0U) { bnx2x_update_max_mf_config(bp, bp->pending_max); bp->pending_max = 0U; } else { } if (bp->port.pmf != 0U) { rc = bnx2x_initial_phy_init(bp, load_mode); if (rc != 0) { bp->state = 61440U; goto load_error3; } else { } } else { } bp->link_params.feature_config_flags = bp->link_params.feature_config_flags & 4294950911U; netif_addr_lock_bh(bp->dev); bnx2x_set_rx_mode(bp->dev); netif_addr_unlock_bh(bp->dev); switch (load_mode) { case 0: netif_tx_wake_all_queues___0(bp->dev); goto ldv_55046; case 1: netif_tx_start_all_queues(bp->dev); __asm__ volatile ("": : : "memory"); goto ldv_55046; case 2: ; case 3: bp->state = 57344U; goto ldv_55046; default: ; goto ldv_55046; } ldv_55046: ; if (bp->port.pmf != 0U) { bnx2x_update_drv_flags(bp, 128U, 0U); } else { bnx2x__link_status_update(bp); } mod_timer(& bp->timer, (unsigned long )bp->current_interval + (unsigned long )jiffies); if ((int )bp->cnic_enabled) { bnx2x_load_cnic(bp); } else { } if ((bp->flags & 4194304U) == 0U) { if (bp->common.shmem2_base != 0U) { tmp___5 = readl((void const volatile *)bp->regview + (unsigned long )bp->common.shmem2_base); if (tmp___5 > 224U) { val = readl((void const volatile *)(bp->regview + ((unsigned long )bp->common.shmem2_base + ((unsigned long )(((int )bp->pfid & 1) + ((int )bp->pfid >> 1) * ((bp->common.chip_id >> 16 == 5710U || (bp->common.chip_id >> 16 == 5711U || bp->common.chip_id >> 16 == 5712U)) || (unsigned int )bp->common.chip_port_mode == 0U ? 2 : 1)) + 56UL) * 4UL))); writel(val | 3U, (void volatile *)(bp->regview + ((unsigned long )bp->common.shmem2_base + ((unsigned long )(((int )bp->pfid & 1) + ((int )bp->pfid >> 1) * ((bp->common.chip_id >> 16 == 5710U || (bp->common.chip_id >> 16 == 5711U || bp->common.chip_id >> 16 == 5712U)) || (unsigned int )bp->common.chip_port_mode == 0U ? 2 : 1)) + 56UL) * 4UL))); } else { } } else { } } else { } if ((bp->flags & 4194304U) == 0U) { tmp___6 = bnx2x_wait_sp_comp___0(bp, 0xffffffffffffffffUL); if (tmp___6) { tmp___7 = 0; } else { tmp___7 = 1; } if (tmp___7) { printk("\vbnx2x: [%s:%d(%s)]Timeout waiting for SP elements to complete\n", "bnx2x_nic_load", 2810, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); bnx2x_nic_unload(bp, 1, 0); return (-16); } else { } } else { } if (bp->port.pmf != 0U && (unsigned int )bp->state != 57344U) { bnx2x_dcbx_init(bp, 0); } else { } tmp___8 = ldv__builtin_expect((bp->msg_enable & 32) != 0, 0L); if (tmp___8 != 0L) { printk("\rbnx2x: [%s:%d(%s)]Ending successfully NIC load\n", "bnx2x_nic_load", 2819, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } return (0); load_error3: ; if ((bp->flags & 4194304U) == 0U) { bnx2x_int_disable_sync(bp, 1); bnx2x_squeeze_objects(bp); } else { } bnx2x_free_skbs(bp); i = 0; goto ldv_55054; ldv_55053: ; if ((bp->flags & 32768U) != 0U && (uint )i == (uint )bp->num_queues - bp->num_cnic_queues) { } else { bnx2x_free_rx_sge_range___0(bp, bp->fp + (unsigned long )i, 1024); } i = i + 1; ldv_55054: ; if (bp->num_queues > i) { goto ldv_55053; } else { } bnx2x_free_irq(bp); load_error2: ; if ((bp->flags & 4194304U) == 0U && (bp->flags & 512U) == 0U) { bnx2x_fw_command(bp, 537001984U, 0U); bnx2x_fw_command(bp, 553648128U, 0U); } else { } bp->port.pmf = 0U; load_error1: bnx2x_napi_disable(bp); bnx2x_del_all_napi___0(bp); if ((bp->flags & 4194304U) == 0U) { bnx2x_clear_pf_load(bp); } else { } load_error0: bnx2x_free_fp_mem(bp); bnx2x_free_fw_stats_mem(bp); bnx2x_free_mem(bp); return (rc); } } int bnx2x_drain_tx_queues(struct bnx2x *bp ) { u8 rc ; u8 cos ; u8 i ; struct bnx2x_fastpath *fp ; int tmp ; { rc = 0U; i = 0U; goto ldv_55068; ldv_55067: ; if ((bp->flags & 32768U) != 0U && (uint )i == (uint )bp->num_queues - bp->num_cnic_queues) { } else { fp = bp->fp + (unsigned long )i; cos = 0U; goto ldv_55065; ldv_55064: tmp = bnx2x_clean_tx_queue___0(bp, fp->txdata_ptr[(int )cos]); rc = (u8 )tmp; cos = (u8 )((int )cos + 1); ldv_55065: ; if ((int )fp->max_cos > (int )cos) { goto ldv_55064; } else { } if ((unsigned int )rc != 0U) { return ((int )rc); } else { } } i = (u8 )((int )i + 1); ldv_55068: ; if ((int )i < bp->num_queues) { goto ldv_55067; } else { } return (0); } } int bnx2x_nic_unload(struct bnx2x *bp , int unload_mode , bool keep_link ) { int i ; bool global ; long tmp ; u32 val ; unsigned int tmp___0 ; long tmp___1 ; bool tmp___2 ; bool tmp___3 ; int tmp___4 ; bool tmp___5 ; long tmp___6 ; { global = 0; tmp = ldv__builtin_expect((bp->msg_enable & 32) != 0, 0L); if (tmp != 0L) { printk("\rbnx2x: [%s:%d(%s)]Starting NIC unload\n", "bnx2x_nic_unload", 2884, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } if ((bp->flags & 4194304U) == 0U) { if (bp->common.shmem2_base != 0U) { tmp___0 = readl((void const volatile *)bp->regview + (unsigned long )bp->common.shmem2_base); if (tmp___0 > 224U) { val = readl((void const volatile *)(bp->regview + ((unsigned long )bp->common.shmem2_base + ((unsigned long )(((int )bp->pfid & 1) + ((int )bp->pfid >> 1) * ((bp->common.chip_id >> 16 == 5710U || (bp->common.chip_id >> 16 == 5711U || bp->common.chip_id >> 16 == 5712U)) || (unsigned int )bp->common.chip_port_mode == 0U ? 2 : 1)) + 56UL) * 4UL))); writel(val & 4294967293U, (void volatile *)(bp->regview + ((unsigned long )bp->common.shmem2_base + ((unsigned long )(((int )bp->pfid & 1) + ((int )bp->pfid >> 1) * ((bp->common.chip_id >> 16 == 5710U || (bp->common.chip_id >> 16 == 5711U || bp->common.chip_id >> 16 == 5712U)) || (unsigned int )bp->common.chip_port_mode == 0U ? 2 : 1)) + 56UL) * 4UL))); } else { } } else { } } else { } if (((bp->flags & 4194304U) == 0U && (unsigned int )bp->recovery_state != 0U) && ((unsigned int )bp->state == 0U || (unsigned int )bp->state == 61440U)) { bp->recovery_state = 0; bp->is_leader = 0; bnx2x_release_leader_lock(bp); __asm__ volatile ("mfence": : : "memory"); tmp___1 = ldv__builtin_expect((bp->msg_enable & 16) != 0, 0L); if (tmp___1 != 0L) { printk("\rbnx2x: [%s:%d(%s)]Releasing a leadership...\n", "bnx2x_nic_unload", 2909, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } printk("\vbnx2x: [%s:%d(%s)]Can\'t unload in closed or error state\n", "bnx2x_nic_unload", 2910, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); return (-22); } else { } if ((unsigned int )bp->state == 0U || (unsigned int )bp->state == 61440U) { return (0); } else { } bp->state = 16384U; __asm__ volatile ("mfence": : : "memory"); if ((int )bp->cnic_loaded) { bnx2x_cnic_notify(bp, 1); } else { } bnx2x_tx_disable___0(bp); netdev_reset_tc(bp->dev); bp->rx_mode = 0U; del_timer_sync(& bp->timer); if ((bp->flags & 4194304U) == 0U) { bp->fw_drv_pulse_wr_seq = (u16 )((unsigned int )bp->fw_drv_pulse_wr_seq | 32768U); bnx2x_drv_pulse(bp); bnx2x_stats_handle(bp, 3); bnx2x_save_statistics(bp); } else { } bnx2x_drain_tx_queues(bp); if ((bp->flags & 4194304U) != 0U) { bnx2x_vfpf_close_vf(bp); } else if (unload_mode != 2) { bnx2x_chip_cleanup(bp, unload_mode, (int )keep_link); } else { bnx2x_send_unload_req(bp, unload_mode); if (bp->common.chip_id >> 16 != 5710U && (bp->common.chip_id >> 16 != 5711U && bp->common.chip_id >> 16 != 5712U)) { bnx2x_pf_disable(bp); } else { } bnx2x_netif_stop(bp, 1); bnx2x_del_all_napi___0(bp); if ((int )bp->cnic_loaded) { bnx2x_del_all_napi_cnic___0(bp); } else { } bnx2x_free_irq(bp); bnx2x_send_unload_done(bp, 0); } if ((bp->flags & 4194304U) == 0U) { bnx2x_squeeze_objects(bp); } else { } bp->sp_state = 0UL; bp->port.pmf = 0U; bnx2x_free_skbs(bp); if ((int )bp->cnic_loaded) { bnx2x_free_skbs_cnic(bp); } else { } i = 0; goto ldv_55081; ldv_55080: ; if ((bp->flags & 32768U) != 0U && (uint )i == (uint )bp->num_queues - bp->num_cnic_queues) { } else { bnx2x_free_rx_sge_range___0(bp, bp->fp + (unsigned long )i, 1024); } i = i + 1; ldv_55081: ; if (bp->num_queues > i) { goto ldv_55080; } else { } bnx2x_free_fp_mem(bp); if ((int )bp->cnic_loaded) { bnx2x_free_fp_mem_cnic(bp); } else { } if ((bp->flags & 4194304U) == 0U) { if ((int )bp->cnic_loaded) { bnx2x_free_mem_cnic(bp); } else { } bnx2x_free_mem(bp); } else { } bp->state = 0U; bp->cnic_loaded = 0; if ((bp->flags & 4194304U) == 0U) { tmp___2 = bnx2x_chk_parity_attn(bp, & global, 0); if ((int )tmp___2) { bnx2x_set_reset_in_progress(bp); if ((int )global) { bnx2x_set_reset_global(bp); } else { } } else { } } else { } if ((bp->flags & 4194304U) == 0U) { tmp___3 = bnx2x_clear_pf_load(bp); if (tmp___3) { tmp___4 = 0; } else { tmp___4 = 1; } if (tmp___4) { tmp___5 = bnx2x_reset_is_done(bp, bp->common.chip_id >> 16 != 5710U && (bp->common.chip_id >> 16 != 5711U && bp->common.chip_id >> 16 != 5712U) ? (int )bp->pf_num & 1 : 0); if ((int )tmp___5) { bnx2x_disable_close_the_gate(bp); } else { } } else { } } else { } tmp___6 = ldv__builtin_expect((bp->msg_enable & 32) != 0, 0L); if (tmp___6 != 0L) { printk("\rbnx2x: [%s:%d(%s)]Ending NIC unload\n", "bnx2x_nic_unload", 3038, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } return (0); } } int bnx2x_set_power_state(struct bnx2x *bp , pci_power_t state ) { u16 pmcsr ; long tmp ; int tmp___0 ; { if (bp->pm_cap == 0) { tmp = ldv__builtin_expect((bp->msg_enable & 2) != 0, 0L); if (tmp != 0L) { _dev_info((struct device const *)(& (bp->pdev)->dev), "No power capability. Breaking.\n"); } else { } return (0); } else { } pci_read_config_word((struct pci_dev const *)bp->pdev, bp->pm_cap + 4, & pmcsr); switch (state) { case 0: pci_write_config_word((struct pci_dev const *)bp->pdev, bp->pm_cap + 4, (int )((u16 )(((int )((short )pmcsr) & 32764) | -32768))); if (((int )pmcsr & 3) != 0) { msleep(20U); } else { } goto ldv_55089; case 3: tmp___0 = atomic_read((atomic_t const *)(& (bp->pdev)->enable_cnt)); if (tmp___0 != 1) { return (0); } else { } if ((bp->common.chip_id & 61440U) > 20480U) { return (0); } else { } pmcsr = (unsigned int )pmcsr & 65532U; pmcsr = (u16 )((unsigned int )pmcsr | 3U); if ((unsigned int )bp->wol != 0U) { pmcsr = (u16 )((unsigned int )pmcsr | 256U); } else { } pci_write_config_word((struct pci_dev const *)bp->pdev, bp->pm_cap + 4, (int )pmcsr); goto ldv_55089; default: dev_err((struct device const *)(& (bp->pdev)->dev), "Can\'t support state = %d\n", state); return (-22); } ldv_55089: ; return (0); } } int bnx2x_poll(struct napi_struct *napi , int budget ) { int work_done ; u8 cos ; struct bnx2x_fastpath *fp ; struct napi_struct const *__mptr ; struct bnx2x *bp ; int tmp ; int tmp___0 ; int tmp___1 ; long tmp___2 ; int tmp___3 ; bool tmp___4 ; int tmp___5 ; int tmp___6 ; bool tmp___7 ; int tmp___8 ; { work_done = 0; __mptr = (struct napi_struct const *)napi; fp = (struct bnx2x_fastpath *)__mptr + 0xfffffffffffffff8UL; bp = fp->bp; ldv_55107: cos = 0U; goto ldv_55103; ldv_55102: tmp = bnx2x_tx_queue_has_work(fp->txdata_ptr[(int )cos]); if (tmp != 0) { bnx2x_tx_int(bp, fp->txdata_ptr[(int )cos]); } else { } cos = (u8 )((int )cos + 1); ldv_55103: ; if ((int )fp->max_cos > (int )cos) { goto ldv_55102; } else { } tmp___1 = bnx2x_has_rx_work(fp); if (tmp___1 != 0) { tmp___0 = bnx2x_rx_int(fp, budget - work_done); work_done = tmp___0 + work_done; if (work_done >= budget) { goto ldv_55105; } else { } } else { } tmp___6 = bnx2x_has_rx_work(fp); if (tmp___6 == 0) { tmp___7 = bnx2x_has_tx_work___0(fp); if (tmp___7) { tmp___8 = 0; } else { tmp___8 = 1; } if (tmp___8) { if ((uint )fp->index == (uint )(fp->bp)->num_queues - (fp->bp)->num_cnic_queues) { napi_complete(napi); goto ldv_55105; } else { } bnx2x_update_fpsb_idx(fp); __asm__ volatile ("lfence": : : "memory"); tmp___3 = bnx2x_has_rx_work(fp); if (tmp___3 == 0) { tmp___4 = bnx2x_has_tx_work___0(fp); if (tmp___4) { tmp___5 = 0; } else { tmp___5 = 1; } if (tmp___5) { napi_complete(napi); tmp___2 = ldv__builtin_expect((bp->msg_enable & 2048) != 0, 0L); if (tmp___2 != 0L) { printk("\rbnx2x: [%s:%d(%s)]Update index to %d\n", "bnx2x_poll", 3158, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )fp->fp_hc_idx); } else { } bnx2x_ack_sb(bp, (int )fp->igu_sb_id, 0, (int )fp->fp_hc_idx, 0, 1); goto ldv_55105; } else { } } else { } } else { } } else { } goto ldv_55107; ldv_55105: ; return (work_done); } } static u16 bnx2x_tx_split(struct bnx2x *bp , struct bnx2x_fp_txdata *txdata , struct sw_tx_bd *tx_buf , struct eth_tx_start_bd **tx_bd , u16 hlen , u16 bd_prod ) { struct eth_tx_start_bd *h_tx_bd ; struct eth_tx_bd *d_tx_bd ; dma_addr_t mapping ; int old_len ; long tmp ; long tmp___0 ; { h_tx_bd = *tx_bd; old_len = (int )h_tx_bd->nbytes; h_tx_bd->nbytes = hlen; tmp = ldv__builtin_expect((bp->msg_enable & 256) != 0, 0L); if (tmp != 0L) { printk("\rbnx2x: [%s:%d(%s)]TSO split header size is %d (%x:%x)\n", "bnx2x_tx_split", 3189, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )h_tx_bd->nbytes, h_tx_bd->addr_hi, h_tx_bd->addr_lo); } else { } bd_prod = ((unsigned long )bd_prod & 255UL) == 254UL ? ((unsigned int )bd_prod + 2U) & 4095U : ((unsigned int )bd_prod + 1U) & 4095U; d_tx_bd = & (txdata->tx_desc_ring + (unsigned long )bd_prod)->reg_bd; mapping = (((unsigned long long )h_tx_bd->addr_hi << 32) + (unsigned long long )h_tx_bd->addr_lo) + (unsigned long long )hlen; d_tx_bd->addr_hi = (unsigned int )(mapping >> 32); d_tx_bd->addr_lo = (unsigned int )mapping; d_tx_bd->nbytes = (int )((unsigned short )old_len) - (int )hlen; tx_buf->flags = (u8 )((unsigned int )tx_buf->flags | 1U); tmp___0 = ldv__builtin_expect((bp->msg_enable & 256) != 0, 0L); if (tmp___0 != 0L) { printk("\rbnx2x: [%s:%d(%s)]TSO split data size is %d (%x:%x)\n", "bnx2x_tx_split", 3208, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )d_tx_bd->nbytes, d_tx_bd->addr_hi, d_tx_bd->addr_lo); } else { } *tx_bd = (struct eth_tx_start_bd *)d_tx_bd; return (bd_prod); } } static __le16 bnx2x_csum_fix(unsigned char *t_header , u16 csum , s8 fix ) { __sum16 tsum ; __wsum tmp ; __wsum tmp___0 ; __sum16 tmp___1 ; __wsum tmp___2 ; __wsum tmp___3 ; __sum16 tmp___4 ; __u16 tmp___5 ; { tsum = csum; if ((int )fix > 0) { tmp = csum_partial((void const *)(t_header + - ((unsigned long )fix)), (int )fix, 0U); tmp___0 = csum_sub((unsigned int )csum, tmp); tmp___1 = csum_fold(tmp___0); tsum = ~ ((int )tmp___1); } else if ((int )fix < 0) { tmp___2 = csum_partial((void const *)t_header, - ((int )fix), 0U); tmp___3 = csum_add((unsigned int )csum, tmp___2); tmp___4 = csum_fold(tmp___3); tsum = ~ ((int )tmp___4); } else { } tmp___5 = __fswab16((int )tsum); return (tmp___5); } } static u32 bnx2x_xmit_type(struct bnx2x *bp , struct sk_buff *skb ) { u32 rc ; __u8 prot ; __be16 protocol ; struct ipv6hdr *tmp ; struct iphdr *tmp___0 ; struct ipv6hdr *tmp___1 ; struct iphdr *tmp___2 ; struct iphdr *tmp___3 ; bool tmp___4 ; bool tmp___5 ; { prot = 0U; if ((unsigned int )*((unsigned char *)skb + 124UL) != 12U) { return (0U); } else { } protocol = vlan_get_protocol((struct sk_buff const *)skb); if ((unsigned int )protocol == 56710U) { rc = 2U; tmp = ipv6_hdr((struct sk_buff const *)skb); prot = tmp->nexthdr; } else { rc = 1U; tmp___0 = ip_hdr((struct sk_buff const *)skb); prot = tmp___0->protocol; } if ((bp->common.chip_id >> 16 != 5710U && (bp->common.chip_id >> 16 != 5711U && bp->common.chip_id >> 16 != 5712U)) && (unsigned int )*((unsigned char *)skb + 179UL) != 0U) { tmp___3 = inner_ip_hdr((struct sk_buff const *)skb); if ((unsigned int )*((unsigned char *)tmp___3 + 0UL) == 96U) { rc = rc | 64U; tmp___1 = inner_ipv6_hdr((struct sk_buff const *)skb); if ((unsigned int )tmp___1->nexthdr == 6U) { rc = rc | 4U; } else { } } else { rc = rc | 32U; tmp___2 = inner_ip_hdr((struct sk_buff const *)skb); if ((unsigned int )tmp___2->protocol == 6U) { rc = rc | 4U; } else { } } } else { } if ((unsigned int )prot == 6U) { rc = rc | 4U; } else { } tmp___5 = skb_is_gso_v6((struct sk_buff const *)skb); if ((int )tmp___5) { rc = rc | 22U; if ((rc & 96U) != 0U) { rc = rc | 256U; } else { } } else { tmp___4 = skb_is_gso((struct sk_buff const *)skb); if ((int )tmp___4) { rc = rc | 13U; if ((rc & 96U) != 0U) { rc = rc | 128U; } else { } } else { } } return (rc); } } static int bnx2x_pkt_req_lin(struct bnx2x *bp , struct sk_buff *skb , u32 xmit_type ) { int to_copy ; int hlen ; int first_bd_sz ; unsigned short lso_mss ; unsigned char *tmp ; int wnd_size ; int num_wnds ; unsigned char *tmp___0 ; int wnd_idx ; int frag_idx ; u32 wnd_sum ; unsigned char *tmp___1 ; unsigned int tmp___2 ; unsigned int tmp___3 ; unsigned char *tmp___4 ; unsigned int tmp___5 ; long tmp___6 ; unsigned char *tmp___7 ; unsigned int tmp___8 ; long tmp___9 ; unsigned char *tmp___10 ; unsigned int tmp___11 ; unsigned char *tmp___12 ; unsigned char *tmp___13 ; long tmp___14 ; long tmp___15 ; { to_copy = 0; hlen = 0; first_bd_sz = 0; tmp___12 = skb_end_pointer((struct sk_buff const *)skb); if ((unsigned int )((struct skb_shared_info *)tmp___12)->nr_frags > 9U) { if ((xmit_type & 408U) != 0U) { tmp = skb_end_pointer((struct sk_buff const *)skb); lso_mss = ((struct skb_shared_info *)tmp)->gso_size; wnd_size = 10; tmp___0 = skb_end_pointer((struct sk_buff const *)skb); num_wnds = (int )((struct skb_shared_info *)tmp___0)->nr_frags - wnd_size; wnd_idx = 0; frag_idx = 0; wnd_sum = 0U; tmp___1 = skb_transport_header((struct sk_buff const *)skb); tmp___2 = tcp_hdrlen((struct sk_buff const *)skb); hlen = (int )(((unsigned int )((long )tmp___1) - (unsigned int )((long )skb->data)) + tmp___2); tmp___3 = skb_headlen((struct sk_buff const *)skb); first_bd_sz = (int )(tmp___3 - (unsigned int )hlen); wnd_sum = (u32 )first_bd_sz; frag_idx = 0; goto ldv_55149; ldv_55148: tmp___4 = skb_end_pointer((struct sk_buff const *)skb); tmp___5 = skb_frag_size((skb_frag_t const *)(& ((struct skb_shared_info *)tmp___4)->frags) + (unsigned long )frag_idx); wnd_sum = tmp___5 + wnd_sum; frag_idx = frag_idx + 1; ldv_55149: ; if (wnd_size + -1 > frag_idx) { goto ldv_55148; } else { } if (first_bd_sz > 0) { tmp___6 = ldv__builtin_expect((u32 )lso_mss > wnd_sum, 0L); if (tmp___6 != 0L) { to_copy = 1; goto exit_lbl; } else { } wnd_sum = wnd_sum - (u32 )first_bd_sz; } else { } wnd_idx = 0; goto ldv_55154; ldv_55153: tmp___7 = skb_end_pointer((struct sk_buff const *)skb); tmp___8 = skb_frag_size((skb_frag_t const *)(& ((struct skb_shared_info *)tmp___7)->frags) + ((unsigned long )(wnd_idx + wnd_size) + 0xffffffffffffffffUL)); wnd_sum = tmp___8 + wnd_sum; tmp___9 = ldv__builtin_expect((u32 )lso_mss > wnd_sum, 0L); if (tmp___9 != 0L) { to_copy = 1; goto ldv_55152; } else { } tmp___10 = skb_end_pointer((struct sk_buff const *)skb); tmp___11 = skb_frag_size((skb_frag_t const *)(& ((struct skb_shared_info *)tmp___10)->frags) + (unsigned long )wnd_idx); wnd_sum = wnd_sum - tmp___11; wnd_idx = wnd_idx + 1; ldv_55154: ; if (wnd_idx <= num_wnds) { goto ldv_55153; } else { } ldv_55152: ; } else { to_copy = 1; } } else { } exit_lbl: tmp___15 = ldv__builtin_expect(to_copy != 0, 0L); if (tmp___15 != 0L) { tmp___14 = ldv__builtin_expect((bp->msg_enable & 256) != 0, 0L); if (tmp___14 != 0L) { tmp___13 = skb_end_pointer((struct sk_buff const *)skb); printk("\rbnx2x: [%s:%d(%s)]Linearization IS REQUIRED for %s packet. num_frags %d hlen %d first_bd_sz %d\n", "bnx2x_pkt_req_lin", 3352, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (xmit_type & 408U) != 0U ? (char *)"LSO" : (char *)"non-LSO", (int )((struct skb_shared_info *)tmp___13)->nr_frags, hlen, first_bd_sz); } else { } } else { } return (to_copy); } } static void bnx2x_set_pbd_gso_e2(struct sk_buff *skb , u32 *parsing_data , u32 xmit_type ) { struct ipv6hdr *ipv6 ; unsigned char *tmp ; { tmp = skb_end_pointer((struct sk_buff const *)skb); *parsing_data = *parsing_data | ((u32 )((int )((struct skb_shared_info *)tmp)->gso_size << 16) & 1073676288U); if ((xmit_type & 256U) != 0U) { ipv6 = inner_ipv6_hdr((struct sk_buff const *)skb); } else if ((xmit_type & 16U) != 0U) { ipv6 = ipv6_hdr((struct sk_buff const *)skb); } else { ipv6 = 0; } if ((unsigned long )ipv6 != (unsigned long )((struct ipv6hdr *)0) && (unsigned int )ipv6->nexthdr == 41U) { *parsing_data = *parsing_data | 32768U; } else { } return; } } static void bnx2x_set_pbd_gso(struct sk_buff *skb , struct eth_tx_parse_bd_e1x *pbd , u32 xmit_type ) { unsigned char *tmp ; struct tcphdr *tmp___0 ; __u32 tmp___1 ; struct tcphdr *tmp___2 ; __u32 tmp___3 ; struct iphdr *tmp___4 ; __u16 tmp___5 ; struct iphdr *tmp___6 ; struct iphdr *tmp___7 ; __sum16 tmp___8 ; __u16 tmp___9 ; struct ipv6hdr *tmp___10 ; struct ipv6hdr *tmp___11 ; __sum16 tmp___12 ; __u16 tmp___13 ; { tmp = skb_end_pointer((struct sk_buff const *)skb); pbd->lso_mss = ((struct skb_shared_info *)tmp)->gso_size; tmp___0 = tcp_hdr((struct sk_buff const *)skb); tmp___1 = __fswab32(tmp___0->seq); pbd->tcp_send_seq = tmp___1; tmp___2 = tcp_hdr((struct sk_buff const *)skb); tmp___3 = __fswab32(((union tcp_word_hdr *)tmp___2)->words[3]); pbd->tcp_flags = (u8 )(tmp___3 >> 16); if ((xmit_type & 8U) != 0U) { tmp___4 = ip_hdr((struct sk_buff const *)skb); tmp___5 = __fswab16((int )tmp___4->id); pbd->ip_id = tmp___5; tmp___6 = ip_hdr((struct sk_buff const *)skb); tmp___7 = ip_hdr((struct sk_buff const *)skb); tmp___8 = csum_tcpudp_magic(tmp___7->saddr, tmp___6->daddr, 0, 6, 0U); tmp___9 = __fswab16(~ ((int )tmp___8)); pbd->tcp_pseudo_csum = tmp___9; } else { tmp___10 = ipv6_hdr((struct sk_buff const *)skb); tmp___11 = ipv6_hdr((struct sk_buff const *)skb); tmp___12 = csum_ipv6_magic((struct in6_addr const *)(& tmp___11->saddr), (struct in6_addr const *)(& tmp___10->daddr), 0U, 6, 0U); tmp___13 = __fswab16(~ ((int )tmp___12)); pbd->tcp_pseudo_csum = tmp___13; } pbd->global_data = (__le16 )((unsigned int )pbd->global_data | 64U); return; } } static u8 bnx2x_set_pbd_csum_enc(struct bnx2x *bp , struct sk_buff *skb , u32 *parsing_data , u32 xmit_type ) { unsigned char *tmp ; unsigned int tmp___0 ; unsigned char *tmp___1 ; unsigned int tmp___2 ; unsigned char *tmp___3 ; { tmp = skb_inner_transport_header((struct sk_buff const *)skb); *parsing_data = (u32 )((int )*parsing_data | ((int )(((long )tmp - (long )skb->data) >> 1) & 2047)); if ((xmit_type & 4U) != 0U) { tmp___0 = inner_tcp_hdrlen((struct sk_buff const *)skb); *parsing_data = *parsing_data | ((tmp___0 / 4U << 11) & 30720U); tmp___1 = skb_inner_transport_header((struct sk_buff const *)skb); tmp___2 = inner_tcp_hdrlen((struct sk_buff const *)skb); return ((int )((u8 )((long )(tmp___1 + (unsigned long )tmp___2))) - (int )((u8 )((long )skb->data))); } else { } tmp___3 = skb_inner_transport_header((struct sk_buff const *)skb); return ((int )((u8 )((long )(tmp___3 + 8UL))) - (int )((u8 )((long )skb->data))); } } static u8 bnx2x_set_pbd_csum_e2(struct bnx2x *bp , struct sk_buff *skb , u32 *parsing_data , u32 xmit_type ) { unsigned char *tmp ; unsigned int tmp___0 ; unsigned char *tmp___1 ; unsigned int tmp___2 ; unsigned char *tmp___3 ; { tmp = skb_transport_header((struct sk_buff const *)skb); *parsing_data = (u32 )((int )*parsing_data | ((int )(((long )tmp - (long )skb->data) >> 1) & 2047)); if ((xmit_type & 4U) != 0U) { tmp___0 = tcp_hdrlen((struct sk_buff const *)skb); *parsing_data = *parsing_data | ((tmp___0 / 4U << 11) & 30720U); tmp___1 = skb_transport_header((struct sk_buff const *)skb); tmp___2 = tcp_hdrlen((struct sk_buff const *)skb); return ((int )((u8 )((long )(tmp___1 + (unsigned long )tmp___2))) - (int )((u8 )((long )skb->data))); } else { } tmp___3 = skb_transport_header((struct sk_buff const *)skb); return ((int )((u8 )((long )(tmp___3 + 8UL))) - (int )((u8 )((long )skb->data))); } } static void bnx2x_set_sbd_csum(struct bnx2x *bp , struct sk_buff *skb , struct eth_tx_start_bd *tx_start_bd , u32 xmit_type ) { { tx_start_bd->bd_flags.as_bitfield = (u8 )((unsigned int )tx_start_bd->bd_flags.as_bitfield | 2U); if ((xmit_type & 66U) != 0U) { tx_start_bd->bd_flags.as_bitfield = (u8 )((unsigned int )tx_start_bd->bd_flags.as_bitfield | 128U); } else { } if ((xmit_type & 4U) == 0U) { tx_start_bd->bd_flags.as_bitfield = (u8 )((unsigned int )tx_start_bd->bd_flags.as_bitfield | 32U); } else { } return; } } static u8 bnx2x_set_pbd_csum(struct bnx2x *bp , struct sk_buff *skb , struct eth_tx_parse_bd_e1x *pbd , u32 xmit_type ) { u8 hlen ; unsigned char *tmp ; unsigned char *tmp___0 ; unsigned char *tmp___1 ; unsigned int tmp___2 ; struct tcphdr *tmp___3 ; __u16 tmp___4 ; s8 fix ; unsigned char *tmp___5 ; long tmp___6 ; unsigned char *tmp___7 ; unsigned char *tmp___8 ; long tmp___9 ; { tmp = skb_network_header((struct sk_buff const *)skb); hlen = (u8 )(((long )tmp - (long )skb->data) >> 1); pbd->global_data = (unsigned short )((int )((short )hlen) | ((unsigned int )skb->protocol == 129U ? 128 : 0)); tmp___0 = skb_transport_header((struct sk_buff const *)skb); tmp___1 = skb_network_header((struct sk_buff const *)skb); pbd->ip_hlen_w = (u8 )(((long )tmp___0 - (long )tmp___1) >> 1); hlen = (int )pbd->ip_hlen_w + (int )hlen; if ((xmit_type & 4U) != 0U) { tmp___2 = tcp_hdrlen((struct sk_buff const *)skb); hlen = (int )((u8 )(tmp___2 / 2U)) + (int )hlen; } else { hlen = (unsigned int )hlen + 4U; } pbd->total_hlen_w = (unsigned short )hlen; hlen = (unsigned int )hlen * 2U; if ((xmit_type & 4U) != 0U) { tmp___3 = tcp_hdr((struct sk_buff const *)skb); tmp___4 = __fswab16((int )tmp___3->check); pbd->tcp_pseudo_csum = tmp___4; } else { fix = (s8 )(16U - (unsigned int )((unsigned char )skb->ldv_31656.ldv_31655.csum_offset)); tmp___6 = ldv__builtin_expect((bp->msg_enable & 256) != 0, 0L); if (tmp___6 != 0L) { tmp___5 = skb_transport_header((struct sk_buff const *)skb); printk("\rbnx2x: [%s:%d(%s)]hlen %d fix %d csum before fix %x\n", "bnx2x_set_pbd_csum", 3531, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )pbd->total_hlen_w, (int )fix, (int )*((u16 *)tmp___5 + (unsigned long )skb->ldv_31656.ldv_31655.csum_offset)); } else { } tmp___7 = skb_transport_header((struct sk_buff const *)skb); tmp___8 = skb_transport_header((struct sk_buff const *)skb); pbd->tcp_pseudo_csum = bnx2x_csum_fix(tmp___8, (int )*((u16 *)tmp___7 + (unsigned long )skb->ldv_31656.ldv_31655.csum_offset), (int )fix); tmp___9 = ldv__builtin_expect((bp->msg_enable & 256) != 0, 0L); if (tmp___9 != 0L) { printk("\rbnx2x: [%s:%d(%s)]csum after fix %x\n", "bnx2x_set_pbd_csum", 3539, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )pbd->tcp_pseudo_csum); } else { } } return (hlen); } } static void bnx2x_update_pbds_gso_enc(struct sk_buff *skb , struct eth_tx_parse_bd_e2 *pbd_e2 , struct eth_tx_parse_2nd_bd *pbd2 , u16 *global_data , u32 xmit_type ) { u16 hlen_w ; u8 outerip_off ; u8 outerip_len ; unsigned char *tmp ; unsigned char *tmp___0 ; unsigned int tmp___1 ; struct iphdr *iph ; struct iphdr *tmp___2 ; __sum16 tmp___3 ; __u16 tmp___4 ; struct tcphdr *tmp___5 ; __u32 tmp___6 ; struct tcphdr *tmp___7 ; __u32 tmp___8 ; struct iphdr *tmp___9 ; __u16 tmp___10 ; struct iphdr *tmp___11 ; struct iphdr *tmp___12 ; __sum16 tmp___13 ; __u16 tmp___14 ; struct iphdr *tmp___15 ; struct ipv6hdr *tmp___16 ; struct ipv6hdr *tmp___17 ; __sum16 tmp___18 ; __u16 tmp___19 ; unsigned char *tmp___20 ; int tmp___21 ; struct iphdr *tmp___22 ; { hlen_w = 0U; outerip_len = 0U; tmp = skb_inner_transport_header((struct sk_buff const *)skb); tmp___0 = skb_network_header((struct sk_buff const *)skb); hlen_w = (u16 )(((long )tmp - (long )tmp___0) >> 1); if ((xmit_type & 4U) != 0U) { tmp___1 = inner_tcp_hdrlen((struct sk_buff const *)skb); hlen_w = (int )((u16 )(tmp___1 >> 1)) + (int )hlen_w; } else { hlen_w = (unsigned int )hlen_w + 4U; } pbd2->fw_ip_hdr_to_payload_w = (u8 )hlen_w; if ((xmit_type & 32U) != 0U) { tmp___2 = ip_hdr((struct sk_buff const *)skb); iph = tmp___2; tmp___3 = csum_fold((__wsum )((~ ((int )iph->check) - (int )iph->tot_len) - (int )iph->frag_off)); tmp___4 = __fswab16((int )tmp___3); pbd2->fw_ip_csum_wo_len_flags_frag = tmp___4; } else { pbd2->fw_ip_hdr_to_payload_w = (unsigned int )((u8 )hlen_w) - 20U; } tmp___5 = inner_tcp_hdr((struct sk_buff const *)skb); tmp___6 = __fswab32(tmp___5->seq); pbd2->tcp_send_seq = tmp___6; tmp___7 = inner_tcp_hdr((struct sk_buff const *)skb); tmp___8 = __fswab32(((union tcp_word_hdr *)tmp___7)->words[3]); pbd2->tcp_flags = (u8 )(tmp___8 >> 16); if ((xmit_type & 8U) != 0U) { tmp___9 = inner_ip_hdr((struct sk_buff const *)skb); tmp___10 = __fswab16((int )tmp___9->id); pbd2->hw_ip_id = tmp___10; tmp___11 = inner_ip_hdr((struct sk_buff const *)skb); tmp___12 = inner_ip_hdr((struct sk_buff const *)skb); tmp___13 = csum_tcpudp_magic(tmp___12->saddr, tmp___11->daddr, 0, 6, 0U); tmp___14 = __fswab16(~ ((int )tmp___13)); pbd_e2->data.tunnel_data.pseudo_csum = tmp___14; tmp___15 = ip_hdr((struct sk_buff const *)skb); outerip_len = (int )tmp___15->ihl << 1U; } else { tmp___16 = inner_ipv6_hdr((struct sk_buff const *)skb); tmp___17 = inner_ipv6_hdr((struct sk_buff const *)skb); tmp___18 = csum_ipv6_magic((struct in6_addr const *)(& tmp___17->saddr), (struct in6_addr const *)(& tmp___16->daddr), 0U, 6, 0U); tmp___19 = __fswab16(~ ((int )tmp___18)); pbd_e2->data.tunnel_data.pseudo_csum = tmp___19; } tmp___20 = skb_network_header((struct sk_buff const *)skb); outerip_off = (u8 )(((long )tmp___20 - (long )skb->data) >> 1); *global_data = (u16 )((int )((short )*global_data) | ((((int )((short )outerip_off) | ((xmit_type & 2U) != 0U ? 16 : 0)) | (int )((short )((int )outerip_len << 8))) | ((unsigned int )skb->protocol == 129U ? 32 : 0))); tmp___22 = ip_hdr((struct sk_buff const *)skb); if ((unsigned int )tmp___22->protocol == 17U) { *global_data = (unsigned int )*global_data & 65407U; *global_data = (u16 )((unsigned int )*global_data | 128U); tmp___21 = skb_transport_offset((struct sk_buff const *)skb); pbd2->tunnel_udp_hdr_start_w = (u8 )(tmp___21 >> 1); } else { } return; } } netdev_tx_t bnx2x_start_xmit(struct sk_buff *skb , struct net_device *dev ) { struct bnx2x *bp ; void *tmp ; struct netdev_queue *txq ; struct bnx2x_fp_txdata *txdata ; struct sw_tx_bd *tx_buf ; struct eth_tx_start_bd *tx_start_bd ; struct eth_tx_start_bd *first_bd ; struct eth_tx_bd *tx_data_bd ; struct eth_tx_bd *total_pkt_bd ; struct eth_tx_parse_bd_e1x *pbd_e1x ; struct eth_tx_parse_bd_e2 *pbd_e2 ; struct eth_tx_parse_2nd_bd *pbd2 ; u32 pbd_e2_parsing_data ; u16 pkt_prod ; u16 bd_prod ; int nbd ; int txq_index ; dma_addr_t mapping ; u32 xmit_type ; u32 tmp___0 ; int i ; u8 hlen ; __le16 pkt_size ; struct ethhdr *eth ; u8 mac_type ; u16 tmp___1 ; long tmp___2 ; struct bnx2x_eth_q_stats *q_stats ; u16 tmp___3 ; unsigned char *tmp___4 ; long tmp___5 ; unsigned char *tmp___6 ; struct iphdr *tmp___7 ; struct ipv6hdr *tmp___8 ; long tmp___9 ; bool tmp___10 ; bool tmp___11 ; long tmp___12 ; long tmp___13 ; int tmp___14 ; int tmp___15 ; unsigned int tmp___16 ; long tmp___17 ; int tmp___18 ; long tmp___19 ; long tmp___20 ; __u16 tmp___21 ; u16 global_data ; unsigned char *tmp___22 ; u16 global_data___0 ; unsigned int tmp___23 ; long tmp___24 ; unsigned char *tmp___25 ; unsigned int tmp___26 ; long tmp___27 ; unsigned int tmp___28 ; long tmp___29 ; skb_frag_t *frag ; unsigned char *tmp___30 ; unsigned int tmp___31 ; unsigned int pkts_compl ; unsigned int bytes_compl ; long tmp___32 ; int tmp___33 ; long tmp___34 ; unsigned int tmp___35 ; unsigned int tmp___36 ; long tmp___37 ; unsigned char *tmp___38 ; long tmp___39 ; long tmp___40 ; long tmp___41 ; long tmp___42 ; u16 tmp___43 ; u16 tmp___44 ; long tmp___45 ; { tmp = netdev_priv((struct net_device const *)dev); bp = (struct bnx2x *)tmp; total_pkt_bd = 0; pbd_e1x = 0; pbd_e2 = 0; pbd2 = 0; pbd_e2_parsing_data = 0U; tmp___0 = bnx2x_xmit_type(bp, skb); xmit_type = tmp___0; hlen = 0U; pkt_size = 0U; mac_type = 1U; tmp___1 = skb_get_queue_mapping((struct sk_buff const *)skb); txq_index = (int )tmp___1; txq = netdev_get_tx_queue((struct net_device const *)dev, (unsigned int )txq_index); tmp___2 = ldv__builtin_expect((uint )txq_index >= ((uint )bp->num_queues - bp->num_cnic_queues) * (uint )bp->max_cos + ((int )bp->cnic_loaded ? 1U : 0U), 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 *)"/work/ldvuser/exper_fp/work/current--X--drivers--X--defaultlinux-3.10-rc1.tar--X--32_7a--X--cpachecker/linux-3.10-rc1.tar/csd_deg_dscv/8504/dscv_tempdir/dscv/ri/32_7a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c.prepared"), "i" (3649), "i" (12UL)); ldv_55232: ; goto ldv_55232; } else { } txdata = bp->bnx2x_txq + (unsigned long )txq_index; tmp___3 = bnx2x_tx_avail(bp, txdata); tmp___4 = skb_end_pointer((struct sk_buff const *)skb); tmp___5 = ldv__builtin_expect((unsigned long )tmp___3 < (unsigned long )((int )((struct skb_shared_info *)tmp___4)->nr_frags + 4) + 1UL, 0L); if (tmp___5 != 0L) { if (txdata->tx_ring_size == 0) { q_stats = & (bp->fp_stats + (unsigned long )(txdata->parent_fp)->index)->eth_q_stats; q_stats->driver_filtered_tx_pkt = q_stats->driver_filtered_tx_pkt + 1U; consume_skb(skb); return (0); } else { } (bp->fp_stats + (unsigned long )(txdata->parent_fp)->index)->eth_q_stats.driver_xoff = (bp->fp_stats + (unsigned long )(txdata->parent_fp)->index)->eth_q_stats.driver_xoff + 1U; netif_tx_stop_queue(txq); printk("\vbnx2x: [%s:%d(%s)]BUG! Tx ring full when queue awake!\n", "bnx2x_start_xmit", 3676, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); return (16); } else { } tmp___9 = ldv__builtin_expect((bp->msg_enable & 256) != 0, 0L); if (tmp___9 != 0L) { tmp___6 = skb_end_pointer((struct sk_buff const *)skb); tmp___7 = ip_hdr((struct sk_buff const *)skb); tmp___8 = ipv6_hdr((struct sk_buff const *)skb); printk("\rbnx2x: [%s:%d(%s)]queue[%d]: SKB: summed %x protocol %x protocol(%x,%x) gso type %x xmit_type %x len %d\n", "bnx2x_start_xmit", 3685, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", txq_index, (int )skb->ip_summed, (int )skb->protocol, (int )tmp___8->nexthdr, (int )tmp___7->protocol, (int )((struct skb_shared_info *)tmp___6)->gso_type, xmit_type, skb->len); } else { } eth = (struct ethhdr *)skb->data; tmp___11 = is_multicast_ether_addr((u8 const *)(& eth->h_dest)); tmp___12 = ldv__builtin_expect((long )tmp___11, 0L); if (tmp___12 != 0L) { tmp___10 = is_broadcast_ether_addr((u8 const *)(& eth->h_dest)); if ((int )tmp___10) { mac_type = 3U; } else { mac_type = 2U; } } else { } tmp___15 = bnx2x_pkt_req_lin(bp, skb, xmit_type); if (tmp___15 != 0) { bp->lin_cnt = bp->lin_cnt + 1U; tmp___14 = skb_linearize(skb); if (tmp___14 != 0) { tmp___13 = ldv__builtin_expect((bp->msg_enable & 256) != 0, 0L); if (tmp___13 != 0L) { printk("\rbnx2x: [%s:%d(%s)]SKB linearization failed - silently dropping this SKB\n", "bnx2x_start_xmit", 3706, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } dev_kfree_skb_any(skb); return (0); } else { } } else { } tmp___16 = skb_headlen((struct sk_buff const *)skb); mapping = dma_map_single_attrs(& (bp->pdev)->dev, (void *)skb->data, (size_t )tmp___16, 1, 0); tmp___18 = dma_mapping_error(& (bp->pdev)->dev, mapping); tmp___19 = ldv__builtin_expect(tmp___18 != 0, 0L); if (tmp___19 != 0L) { tmp___17 = ldv__builtin_expect((bp->msg_enable & 256) != 0, 0L); if (tmp___17 != 0L) { printk("\rbnx2x: [%s:%d(%s)]SKB mapping failed - silently dropping this SKB\n", "bnx2x_start_xmit", 3717, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } dev_kfree_skb_any(skb); return (0); } else { } pkt_prod = txdata->tx_pkt_prod; bd_prod = (unsigned int )txdata->tx_bd_prod & 4095U; tx_buf = txdata->tx_buf_ring + ((unsigned long )pkt_prod & 4095UL); tx_start_bd = & (txdata->tx_desc_ring + (unsigned long )bd_prod)->start_bd; first_bd = tx_start_bd; tx_start_bd->bd_flags.as_bitfield = 16U; tx_start_bd->general_data = 1U; tx_buf->first_bd = txdata->tx_bd_prod; tx_buf->skb = skb; tx_buf->flags = 0U; tmp___20 = ldv__builtin_expect((bp->msg_enable & 256) != 0, 0L); if (tmp___20 != 0L) { printk("\rbnx2x: [%s:%d(%s)]sending pkt %u @%p next_idx %u bd %u @%p\n", "bnx2x_start_xmit", 3756, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )pkt_prod, tx_buf, (int )txdata->tx_pkt_prod, (int )bd_prod, tx_start_bd); } else { } if (((int )skb->vlan_tci & 4096) != 0) { tx_start_bd->vlan_or_ethertype = (unsigned int )skb->vlan_tci & 61439U; tx_start_bd->bd_flags.as_bitfield = (u8 )((unsigned int )tx_start_bd->bd_flags.as_bitfield | 4U); } else if ((bp->flags & 4194304U) != 0U) { tmp___21 = __fswab16((int )eth->h_proto); tx_start_bd->vlan_or_ethertype = tmp___21; } else { tx_start_bd->vlan_or_ethertype = pkt_prod; } nbd = 2; bd_prod = ((unsigned long )bd_prod & 255UL) == 254UL ? ((unsigned int )bd_prod + 2U) & 4095U : ((unsigned int )bd_prod + 1U) & 4095U; if ((xmit_type & 99U) != 0U) { bnx2x_set_sbd_csum(bp, skb, tx_start_bd, xmit_type); } else { } if (bp->common.chip_id >> 16 != 5710U && (bp->common.chip_id >> 16 != 5711U && bp->common.chip_id >> 16 != 5712U)) { pbd_e2 = & (txdata->tx_desc_ring + (unsigned long )bd_prod)->parse_bd_e2; memset((void *)pbd_e2, 0, 16UL); if ((xmit_type & 96U) != 0U) { global_data = 0U; hlen = bnx2x_set_pbd_csum_enc(bp, skb, & pbd_e2_parsing_data, xmit_type); bd_prod = ((unsigned long )bd_prod & 255UL) == 254UL ? ((unsigned int )bd_prod + 2U) & 4095U : ((unsigned int )bd_prod + 1U) & 4095U; pbd2 = & (txdata->tx_desc_ring + (unsigned long )bd_prod)->parse_2nd_bd; memset((void *)pbd2, 0, 16UL); tmp___22 = skb_inner_network_header((struct sk_buff const *)skb); pbd_e2->data.tunnel_data.ip_hdr_start_inner_w = (u8 )(((long )tmp___22 - (long )skb->data) >> 1); if ((xmit_type & 384U) != 0U) { bnx2x_update_pbds_gso_enc(skb, pbd_e2, pbd2, & global_data, xmit_type); } else { } pbd2->global_data = global_data; tx_start_bd->general_data = (unsigned int )tx_start_bd->general_data & 159U; tx_start_bd->general_data = (u8 )((unsigned int )tx_start_bd->general_data | 32U); tx_start_bd->general_data = (unsigned int )tx_start_bd->general_data & 127U; tx_start_bd->general_data = (u8 )((unsigned int )tx_start_bd->general_data | 128U); nbd = nbd + 1; } else if ((xmit_type & 99U) != 0U) { hlen = bnx2x_set_pbd_csum_e2(bp, skb, & pbd_e2_parsing_data, xmit_type); } else { } if ((bp->flags & 4194304U) != 0U) { bnx2x_set_fw_mac_addr(& pbd_e2->data.mac_addr.src_hi, & pbd_e2->data.mac_addr.src_mid, & pbd_e2->data.mac_addr.src_lo, (u8 *)(& eth->h_source)); bnx2x_set_fw_mac_addr(& pbd_e2->data.mac_addr.dst_hi, & pbd_e2->data.mac_addr.dst_mid, & pbd_e2->data.mac_addr.dst_lo, (u8 *)(& eth->h_dest)); } else { } pbd_e2_parsing_data = pbd_e2_parsing_data & 1073741823U; pbd_e2_parsing_data = (u32 )((int )mac_type << 30) | pbd_e2_parsing_data; } else { global_data___0 = 0U; pbd_e1x = & (txdata->tx_desc_ring + (unsigned long )bd_prod)->parse_bd_e1x; memset((void *)pbd_e1x, 0, 16UL); if ((xmit_type & 99U) != 0U) { hlen = bnx2x_set_pbd_csum(bp, skb, pbd_e1x, xmit_type); } else { } global_data___0 = (unsigned int )global_data___0 & 65487U; global_data___0 = (u16 )((int )((short )((int )mac_type << 4)) | (int )((short )global_data___0)); pbd_e1x->global_data = (__le16 )((int )pbd_e1x->global_data | (int )global_data___0); } tx_start_bd->addr_hi = (unsigned int )(mapping >> 32); tx_start_bd->addr_lo = (unsigned int )mapping; tmp___23 = skb_headlen((struct sk_buff const *)skb); tx_start_bd->nbytes = (unsigned short )tmp___23; pkt_size = tx_start_bd->nbytes; tmp___24 = ldv__builtin_expect((bp->msg_enable & 256) != 0, 0L); if (tmp___24 != 0L) { printk("\rbnx2x: [%s:%d(%s)]first bd @%p addr (%x:%x) nbytes %d flags %x vlan %x\n", "bnx2x_start_xmit", 3867, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", tx_start_bd, tx_start_bd->addr_hi, tx_start_bd->addr_lo, (int )tx_start_bd->nbytes, (int )tx_start_bd->bd_flags.as_bitfield, (int )tx_start_bd->vlan_or_ethertype); } else { } if ((xmit_type & 408U) != 0U) { tmp___27 = ldv__builtin_expect((bp->msg_enable & 256) != 0, 0L); if (tmp___27 != 0L) { tmp___25 = skb_end_pointer((struct sk_buff const *)skb); tmp___26 = skb_headlen((struct sk_buff const *)skb); printk("\rbnx2x: [%s:%d(%s)]TSO packet len %d hlen %d total len %d tso size %d\n", "bnx2x_start_xmit", 3874, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", skb->len, (int )hlen, tmp___26, (int )((struct skb_shared_info *)tmp___25)->gso_size); } else { } tx_start_bd->bd_flags.as_bitfield = (u8 )((unsigned int )tx_start_bd->bd_flags.as_bitfield | 64U); tmp___28 = skb_headlen((struct sk_buff const *)skb); tmp___29 = ldv__builtin_expect(tmp___28 > (unsigned int )hlen, 0L); if (tmp___29 != 0L) { nbd = nbd + 1; bd_prod = bnx2x_tx_split(bp, txdata, tx_buf, & tx_start_bd, (int )hlen, (int )bd_prod); } else { } if (bp->common.chip_id >> 16 != 5710U && (bp->common.chip_id >> 16 != 5711U && bp->common.chip_id >> 16 != 5712U)) { bnx2x_set_pbd_gso_e2(skb, & pbd_e2_parsing_data, xmit_type); } else { bnx2x_set_pbd_gso(skb, pbd_e1x, xmit_type); } } else { } if (pbd_e2_parsing_data != 0U) { pbd_e2->parsing_data = pbd_e2_parsing_data; } else { } tx_data_bd = (struct eth_tx_bd *)tx_start_bd; i = 0; goto ldv_55241; ldv_55240: tmp___30 = skb_end_pointer((struct sk_buff const *)skb); frag = (skb_frag_t *)(& ((struct skb_shared_info *)tmp___30)->frags) + (unsigned long )i; tmp___31 = skb_frag_size((skb_frag_t const *)frag); mapping = skb_frag_dma_map(& (bp->pdev)->dev, (skb_frag_t const *)frag, 0UL, (size_t )tmp___31, 1); tmp___33 = dma_mapping_error(& (bp->pdev)->dev, mapping); tmp___34 = ldv__builtin_expect(tmp___33 != 0, 0L); if (tmp___34 != 0L) { pkts_compl = 0U; bytes_compl = 0U; tmp___32 = ldv__builtin_expect((bp->msg_enable & 256) != 0, 0L); if (tmp___32 != 0L) { printk("\rbnx2x: [%s:%d(%s)]Unable to map page - dropping packet...\n", "bnx2x_start_xmit", 3909, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } first_bd->nbd = (unsigned short )nbd; bnx2x_free_tx_pkt(bp, txdata, (int )txdata->tx_pkt_prod & 4095, & pkts_compl, & bytes_compl); return (0); } else { } bd_prod = ((unsigned long )bd_prod & 255UL) == 254UL ? ((unsigned int )bd_prod + 2U) & 4095U : ((unsigned int )bd_prod + 1U) & 4095U; tx_data_bd = & (txdata->tx_desc_ring + (unsigned long )bd_prod)->reg_bd; if ((unsigned long )total_pkt_bd == (unsigned long )((struct eth_tx_bd *)0)) { total_pkt_bd = & (txdata->tx_desc_ring + (unsigned long )bd_prod)->reg_bd; } else { } tx_data_bd->addr_hi = (unsigned int )(mapping >> 32); tx_data_bd->addr_lo = (unsigned int )mapping; tmp___35 = skb_frag_size((skb_frag_t const *)frag); tx_data_bd->nbytes = (unsigned short )tmp___35; tmp___36 = skb_frag_size((skb_frag_t const *)frag); le16_add_cpu(& pkt_size, (int )((u16 )tmp___36)); nbd = nbd + 1; tmp___37 = ldv__builtin_expect((bp->msg_enable & 256) != 0, 0L); if (tmp___37 != 0L) { printk("\rbnx2x: [%s:%d(%s)]frag %d bd @%p addr (%x:%x) nbytes %d\n", "bnx2x_start_xmit", 3937, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", i, tx_data_bd, tx_data_bd->addr_hi, tx_data_bd->addr_lo, (int )tx_data_bd->nbytes); } else { } i = i + 1; ldv_55241: tmp___38 = skb_end_pointer((struct sk_buff const *)skb); if ((int )((struct skb_shared_info *)tmp___38)->nr_frags > i) { goto ldv_55240; } else { } tmp___39 = ldv__builtin_expect((bp->msg_enable & 256) != 0, 0L); if (tmp___39 != 0L) { printk("\rbnx2x: [%s:%d(%s)]last bd @%p\n", "bnx2x_start_xmit", 3940, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", tx_data_bd); } else { } first_bd->nbd = (unsigned short )nbd; bd_prod = ((unsigned long )bd_prod & 255UL) == 254UL ? ((unsigned int )bd_prod + 2U) & 4095U : ((unsigned int )bd_prod + 1U) & 4095U; if (((unsigned long )bd_prod & 255UL) < (unsigned long )nbd) { nbd = nbd + 1; } else { } if ((unsigned long )total_pkt_bd != (unsigned long )((struct eth_tx_bd *)0)) { total_pkt_bd->total_pkt_bytes = pkt_size; } else { } if ((unsigned long )pbd_e1x != (unsigned long )((struct eth_tx_parse_bd_e1x *)0)) { tmp___40 = ldv__builtin_expect((bp->msg_enable & 256) != 0, 0L); if (tmp___40 != 0L) { printk("\rbnx2x: [%s:%d(%s)]PBD (E1X) @%p ip_data %x ip_hlen %u ip_id %u lso_mss %u tcp_flags %x xsum %x seq %u hlen %u\n", "bnx2x_start_xmit", 3969, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", pbd_e1x, (int )pbd_e1x->global_data, (int )pbd_e1x->ip_hlen_w, (int )pbd_e1x->ip_id, (int )pbd_e1x->lso_mss, (int )pbd_e1x->tcp_flags, (int )pbd_e1x->tcp_pseudo_csum, pbd_e1x->tcp_send_seq, (int )pbd_e1x->total_hlen_w); } else { } } else { } if ((unsigned long )pbd_e2 != (unsigned long )((struct eth_tx_parse_bd_e2 *)0)) { tmp___41 = ldv__builtin_expect((bp->msg_enable & 256) != 0, 0L); if (tmp___41 != 0L) { printk("\rbnx2x: [%s:%d(%s)]PBD (E2) @%p dst %x %x %x src %x %x %x parsing_data %x\n", "bnx2x_start_xmit", 3980, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", pbd_e2, (int )pbd_e2->data.mac_addr.dst_hi, (int )pbd_e2->data.mac_addr.dst_mid, (int )pbd_e2->data.mac_addr.dst_lo, (int )pbd_e2->data.mac_addr.src_hi, (int )pbd_e2->data.mac_addr.src_mid, (int )pbd_e2->data.mac_addr.src_lo, pbd_e2->parsing_data); } else { } } else { } tmp___42 = ldv__builtin_expect((bp->msg_enable & 256) != 0, 0L); if (tmp___42 != 0L) { printk("\rbnx2x: [%s:%d(%s)]doorbell: nbd %d bd %u\n", "bnx2x_start_xmit", 3981, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", nbd, (int )bd_prod); } else { } netdev_tx_sent_queue(txq, skb->len); skb_tx_timestamp(skb); txdata->tx_pkt_prod = (u16 )((int )txdata->tx_pkt_prod + 1); __asm__ volatile ("sfence": : : "memory"); txdata->tx_db.data.prod = (int )txdata->tx_db.data.prod + (int )((u16 )nbd); __asm__ volatile ("": : : "memory"); writel(txdata->tx_db.raw, (void volatile *)(bp->doorbells + ((unsigned long )((u32 )bp->db_size * txdata->cid) + 64UL))); __asm__ volatile ("": : : "memory"); txdata->tx_bd_prod = (int )txdata->tx_bd_prod + (int )((u16 )nbd); tmp___44 = bnx2x_tx_avail(bp, txdata); tmp___45 = ldv__builtin_expect((unsigned int )tmp___44 <= 21U, 0L); if (tmp___45 != 0L) { netif_tx_stop_queue(txq); __asm__ volatile ("mfence": : : "memory"); (bp->fp_stats + (unsigned long )(txdata->parent_fp)->index)->eth_q_stats.driver_xoff = (bp->fp_stats + (unsigned long )(txdata->parent_fp)->index)->eth_q_stats.driver_xoff + 1U; tmp___43 = bnx2x_tx_avail(bp, txdata); if ((unsigned int )tmp___43 > 21U) { netif_tx_wake_queue(txq); } else { } } else { } txdata->tx_pkt = txdata->tx_pkt + 1UL; return (0); } } int bnx2x_setup_tc(struct net_device *dev , u8 num_tc ) { int cos ; int prio ; int count ; int offset ; struct bnx2x *bp ; void *tmp ; int tmp___0 ; long tmp___1 ; int tmp___2 ; long tmp___3 ; long tmp___4 ; { tmp = netdev_priv((struct net_device const *)dev); bp = (struct bnx2x *)tmp; tmp___0 = rtnl_is_locked(); tmp___1 = ldv__builtin_expect(tmp___0 == 0, 0L); if (tmp___1 != 0L) { printk("\vRTNL: assertion failed at %s (%d)\n", (char *)"/work/ldvuser/exper_fp/work/current--X--drivers--X--defaultlinux-3.10-rc1.tar--X--32_7a--X--cpachecker/linux-3.10-rc1.tar/csd_deg_dscv/8504/dscv_tempdir/dscv/ri/32_7a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c.prepared", 4037); dump_stack(); } else { } if ((unsigned int )num_tc == 0U) { netdev_reset_tc(dev); return (0); } else { } if ((int )bp->max_cos < (int )num_tc) { printk("\vbnx2x: [%s:%d(%s)]support for too many traffic classes requested: %d. max supported is %d\n", "bnx2x_setup_tc", 4048, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )num_tc, (int )bp->max_cos); return (-22); } else { } tmp___2 = netdev_set_num_tc(dev, (int )num_tc); if (tmp___2 != 0) { printk("\vbnx2x: [%s:%d(%s)]failed to declare %d traffic classes\n", "bnx2x_setup_tc", 4054, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )num_tc); return (-22); } else { } prio = 0; goto ldv_55254; ldv_55253: netdev_set_prio_tc_map(dev, (int )((u8 )prio), (int )bp->prio_to_cos[prio]); tmp___3 = ldv__builtin_expect((bp->msg_enable & 1048608) != 0, 0L); if (tmp___3 != 0L) { printk("\rbnx2x: [%s:%d(%s)]mapping priority %d to tc %d\n", "bnx2x_setup_tc", 4063, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", prio, (int )bp->prio_to_cos[prio]); } else { } prio = prio + 1; ldv_55254: ; if (prio <= 7) { goto ldv_55253; } else { } cos = 0; goto ldv_55257; ldv_55256: count = (int )bp->num_ethernet_queues; offset = (int )(((uint )bp->num_queues - bp->num_cnic_queues) * (uint )cos); netdev_set_tc_queue(dev, (int )((u8 )cos), (int )((u16 )count), (int )((u16 )offset)); tmp___4 = ldv__builtin_expect((bp->msg_enable & 1048608) != 0, 0L); if (tmp___4 != 0L) { printk("\rbnx2x: [%s:%d(%s)]mapping tc %d to offset %d count %d\n", "bnx2x_setup_tc", 4084, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", cos, offset, count); } else { } cos = cos + 1; ldv_55257: ; if ((int )bp->max_cos > cos) { goto ldv_55256; } else { } return (0); } } int bnx2x_change_mac_addr(struct net_device *dev , void *p ) { struct sockaddr *addr ; struct bnx2x *bp ; void *tmp ; int rc ; bool tmp___0 ; int tmp___1 ; bool tmp___2 ; int tmp___3 ; bool tmp___4 ; size_t __len ; void *__ret ; bool tmp___5 ; { addr = (struct sockaddr *)p; tmp = netdev_priv((struct net_device const *)dev); bp = (struct bnx2x *)tmp; rc = 0; tmp___0 = bnx2x_is_valid_ether_addr(bp, (u8 *)(& addr->sa_data)); if (tmp___0) { tmp___1 = 0; } else { tmp___1 = 1; } if (tmp___1) { printk("\vbnx2x: [%s:%d(%s)]Requested MAC address is not valid\n", "bnx2x_change_mac_addr", 4098, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); return (-22); } else { } if (((unsigned int )bp->mf_mode == 1U && ((bp->mf_config[(int )bp->pfid >> 1] & 6U) == 6U || (bp->mf_config[(int )bp->pfid >> 1] & 6U) == 0U)) || ((unsigned int )bp->mf_mode == 3U && (bp->mf_ext_config & 8U) != 0U)) { tmp___2 = is_zero_ether_addr((u8 const *)(& addr->sa_data)); if (tmp___2) { tmp___3 = 0; } else { tmp___3 = 1; } if (tmp___3) { printk("\vbnx2x: [%s:%d(%s)]Can\'t configure non-zero address on iSCSI or FCoE functions in MF-SD mode\n", "bnx2x_change_mac_addr", 4104, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); return (-22); } else { } } else { } tmp___4 = netif_running((struct net_device const *)dev); if ((int )tmp___4) { rc = bnx2x_set_eth_mac(bp, 0); if (rc != 0) { return (rc); } else { } } else { } __len = (size_t )dev->addr_len; __ret = __builtin_memcpy((void *)dev->dev_addr, (void const *)(& addr->sa_data), __len); tmp___5 = netif_running((struct net_device const *)dev); if ((int )tmp___5) { rc = bnx2x_set_eth_mac(bp, 1); } else { } return (rc); } } static void bnx2x_free_fp_mem_at(struct bnx2x *bp , int fp_index ) { union host_hc_status_block *sb ; struct bnx2x_fastpath *fp ; u8 cos ; struct bnx2x_fp_txdata *txdata ; long tmp ; { sb = & (bp->fp + (unsigned long )fp_index)->status_blk; fp = bp->fp + (unsigned long )fp_index; if ((uint )fp_index == (uint )bp->num_queues - bp->num_cnic_queues) { memset((void *)sb, 0, 8UL); fp->status_blk_mapping = 0ULL; } else if (bp->common.chip_id >> 16 != 5710U && (bp->common.chip_id >> 16 != 5711U && bp->common.chip_id >> 16 != 5712U)) { if ((unsigned long )sb->e2_sb != (unsigned long )((struct host_hc_status_block_e2 *)0)) { dma_free_attrs(& (bp->pdev)->dev, 64UL, (void *)sb->e2_sb, (bp->fp + (unsigned long )fp_index)->status_blk_mapping, 0); sb->e2_sb = 0; (bp->fp + (unsigned long )fp_index)->status_blk_mapping = 0ULL; } else { } } else if ((unsigned long )sb->e1x_sb != (unsigned long )((struct host_hc_status_block_e1x *)0)) { dma_free_attrs(& (bp->pdev)->dev, 64UL, (void *)sb->e1x_sb, (bp->fp + (unsigned long )fp_index)->status_blk_mapping, 0); sb->e1x_sb = 0; (bp->fp + (unsigned long )fp_index)->status_blk_mapping = 0ULL; } else { } if ((bp->flags & 32768U) == 0U || (uint )fp_index != (uint )bp->num_queues - bp->num_cnic_queues) { bnx2x_free_rx_bds(fp); if ((unsigned long )(bp->fp + (unsigned long )fp_index)->rx_buf_ring != (unsigned long )((struct sw_rx_bd *)0)) { kfree((void const *)(bp->fp + (unsigned long )fp_index)->rx_buf_ring); (bp->fp + (unsigned long )fp_index)->rx_buf_ring = 0; } else { } if ((unsigned long )(bp->fp + (unsigned long )fp_index)->rx_desc_ring != (unsigned long )((struct eth_rx_bd *)0)) { dma_free_attrs(& (bp->pdev)->dev, 32768UL, (void *)(bp->fp + (unsigned long )fp_index)->rx_desc_ring, (bp->fp + (unsigned long )fp_index)->rx_desc_mapping, 0); (bp->fp + (unsigned long )fp_index)->rx_desc_ring = 0; (bp->fp + (unsigned long )fp_index)->rx_desc_mapping = 0ULL; } else { } if ((unsigned long )(bp->fp + (unsigned long )fp_index)->rx_comp_ring != (unsigned long )((union eth_rx_cqe *)0)) { dma_free_attrs(& (bp->pdev)->dev, 262144UL, (void *)(bp->fp + (unsigned long )fp_index)->rx_comp_ring, (bp->fp + (unsigned long )fp_index)->rx_comp_mapping, 0); (bp->fp + (unsigned long )fp_index)->rx_comp_ring = 0; (bp->fp + (unsigned long )fp_index)->rx_comp_mapping = 0ULL; } else { } if ((unsigned long )(bp->fp + (unsigned long )fp_index)->rx_page_ring != (unsigned long )((struct sw_rx_page *)0)) { kfree((void const *)(bp->fp + (unsigned long )fp_index)->rx_page_ring); (bp->fp + (unsigned long )fp_index)->rx_page_ring = 0; } else { } if ((unsigned long )(bp->fp + (unsigned long )fp_index)->rx_sge_ring != (unsigned long )((struct eth_rx_sge *)0)) { dma_free_attrs(& (bp->pdev)->dev, 8192UL, (void *)(bp->fp + (unsigned long )fp_index)->rx_sge_ring, (bp->fp + (unsigned long )fp_index)->rx_sge_mapping, 0); (bp->fp + (unsigned long )fp_index)->rx_sge_ring = 0; (bp->fp + (unsigned long )fp_index)->rx_sge_mapping = 0ULL; } else { } } else { } if ((bp->flags & 32768U) == 0U || (uint )fp_index != (uint )bp->num_queues - bp->num_cnic_queues) { cos = 0U; goto ldv_55280; ldv_55279: txdata = fp->txdata_ptr[(int )cos]; tmp = ldv__builtin_expect((bp->msg_enable & 16) != 0, 0L); if (tmp != 0L) { printk("\rbnx2x: [%s:%d(%s)]freeing tx memory of fp %d cos %d cid %d\n", "bnx2x_free_fp_mem_at", 4177, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", fp_index, (int )cos, txdata->cid); } else { } if ((unsigned long )txdata->tx_buf_ring != (unsigned long )((struct sw_tx_bd *)0)) { kfree((void const *)txdata->tx_buf_ring); txdata->tx_buf_ring = 0; } else { } if ((unsigned long )txdata->tx_desc_ring != (unsigned long )((union eth_tx_bd_types *)0)) { dma_free_attrs(& (bp->pdev)->dev, 65536UL, (void *)txdata->tx_desc_ring, txdata->tx_desc_mapping, 0); txdata->tx_desc_ring = 0; txdata->tx_desc_mapping = 0ULL; } else { } cos = (u8 )((int )cos + 1); ldv_55280: ; if ((int )fp->max_cos > (int )cos) { goto ldv_55279; } else { } } else { } return; } } void bnx2x_free_fp_mem_cnic(struct bnx2x *bp ) { int i ; { i = (int )bp->num_ethernet_queues; goto ldv_55288; ldv_55287: ; if ((bp->flags & 32768U) != 0U && (uint )i == (uint )bp->num_queues - bp->num_cnic_queues) { } else { bnx2x_free_fp_mem_at(bp, i); } i = i + 1; ldv_55288: ; if (bp->num_queues > i) { goto ldv_55287; } else { } return; } } void bnx2x_free_fp_mem(struct bnx2x *bp ) { int i ; { i = 0; goto ldv_55295; ldv_55294: bnx2x_free_fp_mem_at(bp, i); i = i + 1; ldv_55295: ; if ((uint )i < bp->num_ethernet_queues) { goto ldv_55294; } else { } return; } } static void set_sb_shortcuts(struct bnx2x *bp , int index ) { union host_hc_status_block status_blk ; { status_blk = (bp->fp + (unsigned long )index)->status_blk; if (bp->common.chip_id >> 16 != 5710U && (bp->common.chip_id >> 16 != 5711U && bp->common.chip_id >> 16 != 5712U)) { (bp->fp + (unsigned long )index)->sb_index_values = (__le16 *)(& (status_blk.e2_sb)->sb.index_values); (bp->fp + (unsigned long )index)->sb_running_index = (__le16 *)(& (status_blk.e2_sb)->sb.running_index); } else { (bp->fp + (unsigned long )index)->sb_index_values = (__le16 *)(& (status_blk.e1x_sb)->sb.index_values); (bp->fp + (unsigned long )index)->sb_running_index = (__le16 *)(& (status_blk.e1x_sb)->sb.running_index); } return; } } static int bnx2x_alloc_rx_bds(struct bnx2x_fastpath *fp , int rx_ring_size ) { struct bnx2x *bp ; u16 ring_prod ; u16 cqe_ring_prod ; int i ; int failure_cnt ; int tmp ; int __ret_warn_on ; long tmp___0 ; u16 __min1 ; u16 __min2 ; unsigned long tmp___1 ; { bp = fp->bp; failure_cnt = 0; fp->rx_comp_cons = 0U; ring_prod = 0U; cqe_ring_prod = ring_prod; i = 0; goto ldv_55315; ldv_55314: tmp = bnx2x_alloc_rx_data(bp, fp, (int )ring_prod); if (tmp < 0) { failure_cnt = failure_cnt + 1; goto ldv_55311; } else { } ring_prod = ((unsigned long )ring_prod & 511UL) == 509UL ? (unsigned int )ring_prod + 3U : (unsigned int )ring_prod + 1U; cqe_ring_prod = ((unsigned long )cqe_ring_prod & 63UL) == 62UL ? (unsigned int )cqe_ring_prod + 2U : (unsigned int )cqe_ring_prod + 1U; __ret_warn_on = (int )ring_prod <= i - failure_cnt; tmp___0 = ldv__builtin_expect(__ret_warn_on != 0, 0L); if (tmp___0 != 0L) { warn_slowpath_null("/work/ldvuser/exper_fp/work/current--X--drivers--X--defaultlinux-3.10-rc1.tar--X--32_7a--X--cpachecker/linux-3.10-rc1.tar/csd_deg_dscv/8504/dscv_tempdir/dscv/ri/32_7a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c.prepared", 4239); } else { } ldv__builtin_expect(__ret_warn_on != 0, 0L); ldv_55311: i = i + 1; ldv_55315: ; if (i < rx_ring_size) { goto ldv_55314; } else { } if (failure_cnt != 0) { printk("\vbnx2x: [%s:%d(%s)]was only able to allocate %d rx skbs on queue[%d]\n", "bnx2x_alloc_rx_bds", 4244, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", i - failure_cnt, (int )fp->index); } else { } fp->rx_bd_prod = ring_prod; __min1 = 4096U; __min2 = cqe_ring_prod; fp->rx_comp_prod = (u16 )((int )__min1 < (int )__min2 ? __min1 : __min2); tmp___1 = 0UL; fp->rx_calls = tmp___1; fp->rx_pkt = tmp___1; (bp->fp_stats + (unsigned long )fp->index)->eth_q_stats.rx_skb_alloc_failed = (bp->fp_stats + (unsigned long )fp->index)->eth_q_stats.rx_skb_alloc_failed + (u32 )failure_cnt; return (i - failure_cnt); } } static void bnx2x_set_next_page_rx_cq(struct bnx2x_fastpath *fp ) { int i ; struct eth_rx_cqe_next_page *nextpg ; { i = 1; goto ldv_55327; ldv_55326: nextpg = (struct eth_rx_cqe_next_page *)(fp->rx_comp_ring + ((unsigned long )i * 64UL + 0xffffffffffffffffUL)); nextpg->addr_hi = (unsigned int )((fp->rx_comp_mapping + (unsigned long long )(((unsigned long )i & 63UL) * 4096UL)) >> 32); nextpg->addr_lo = (unsigned int )fp->rx_comp_mapping + ((unsigned int )((unsigned long )i) & 63U) * 4096U; i = i + 1; ldv_55327: ; if ((unsigned int )i <= 64U) { goto ldv_55326; } else { } return; } } static int bnx2x_alloc_fp_mem_at(struct bnx2x *bp , int index ) { union host_hc_status_block *sb ; struct bnx2x_fastpath *fp ; int ring_size ; u8 cos ; int rx_ring_size ; u32 __max1 ; u32 __max2 ; u32 cfg ; unsigned int tmp ; int __max1___0 ; u32 __max1___1 ; u32 __max2___0 ; u32 __max1___2 ; u32 __max2___1 ; u32 tmp___0 ; int __max2___2 ; long tmp___1 ; void *tmp___2 ; void *tmp___3 ; struct bnx2x_fp_txdata *txdata ; long tmp___4 ; void *tmp___5 ; void *tmp___6 ; void *tmp___7 ; void *tmp___8 ; void *tmp___9 ; void *tmp___10 ; void *tmp___11 ; u32 __max1___3 ; u32 __max2___3 ; u32 __max1___4 ; u32 __max2___4 ; u32 tmp___12 ; { fp = bp->fp + (unsigned long )index; ring_size = 0; rx_ring_size = 0; if (bp->rx_ring_size == 0 && (((unsigned int )bp->mf_mode == 1U && ((bp->mf_config[(int )bp->pfid >> 1] & 6U) == 6U || (bp->mf_config[(int )bp->pfid >> 1] & 6U) == 0U)) || ((unsigned int )bp->mf_mode == 3U && (bp->mf_ext_config & 8U) != 0U))) { __max1 = 11U; __max2 = (int )bp->dropless_fc ? (((((((((((bp->common.chip_id >> 16 == 5770U || bp->common.chip_id >> 16 == 5797U) || bp->common.chip_id >> 16 == 5801U) || bp->common.chip_id >> 16 == 5774U) || bp->common.chip_id >> 16 == 5806U) || bp->common.chip_id >> 16 == 5807U) || ((bp->common.chip_id >> 16 == 5693U || bp->common.chip_id >> 16 == 5694U) || bp->common.chip_id >> 16 == 5695U)) || ((bp->common.chip_id >> 16 == 5793U || bp->common.chip_id >> 16 == 5794U) || bp->common.chip_id >> 16 == 5773U)) || (bp->common.chip_id >> 16 == 5796U || bp->common.chip_id >> 16 == 5803U)) || bp->common.chip_id >> 16 == 5805U ? 1024U : 512U) + (((((((((bp->common.chip_id >> 16 == 5770U || bp->common.chip_id >> 16 == 5797U) || bp->common.chip_id >> 16 == 5801U) || bp->common.chip_id >> 16 == 5774U) || bp->common.chip_id >> 16 == 5806U) || bp->common.chip_id >> 16 == 5807U) || ((bp->common.chip_id >> 16 == 5693U || bp->common.chip_id >> 16 == 5694U) || bp->common.chip_id >> 16 == 5695U)) || ((bp->common.chip_id >> 16 == 5793U || bp->common.chip_id >> 16 == 5794U) || bp->common.chip_id >> 16 == 5773U)) || (bp->common.chip_id >> 16 == 5796U || bp->common.chip_id >> 16 == 5803U)) || bp->common.chip_id >> 16 == 5805U ? 6U : 4U)) + (bp->common.chip_id >> 16 == 5710U ? 43U : 75U)) + 228U : 128U; rx_ring_size = (int )(__max1 > __max2 ? __max1 : __max2); bp->rx_ring_size = rx_ring_size; } else if (bp->rx_ring_size == 0) { rx_ring_size = (int )(4078UL / (unsigned long )bp->num_queues); if (((((((((bp->common.chip_id >> 16 == 5770U || bp->common.chip_id >> 16 == 5797U) || bp->common.chip_id >> 16 == 5801U) || bp->common.chip_id >> 16 == 5774U) || bp->common.chip_id >> 16 == 5806U) || bp->common.chip_id >> 16 == 5807U) || ((bp->common.chip_id >> 16 == 5693U || bp->common.chip_id >> 16 == 5694U) || bp->common.chip_id >> 16 == 5695U)) || ((bp->common.chip_id >> 16 == 5793U || bp->common.chip_id >> 16 == 5794U) || bp->common.chip_id >> 16 == 5773U)) || (bp->common.chip_id >> 16 == 5796U || bp->common.chip_id >> 16 == 5803U)) || bp->common.chip_id >> 16 == 5805U) { tmp = readl((void const volatile *)(bp->regview + ((unsigned long )bp->common.shmem_base + (((unsigned long )bp->pfid & 1UL) + 1UL) * 400UL))); cfg = tmp; if ((cfg & 251658240U) == 0U) { rx_ring_size = rx_ring_size / 10; } else { } } else { } if (bp->disable_tpa != 0) { __max1___1 = 11U; __max2___0 = (int )bp->dropless_fc ? (((((((((((bp->common.chip_id >> 16 == 5770U || bp->common.chip_id >> 16 == 5797U) || bp->common.chip_id >> 16 == 5801U) || bp->common.chip_id >> 16 == 5774U) || bp->common.chip_id >> 16 == 5806U) || bp->common.chip_id >> 16 == 5807U) || ((bp->common.chip_id >> 16 == 5693U || bp->common.chip_id >> 16 == 5694U) || bp->common.chip_id >> 16 == 5695U)) || ((bp->common.chip_id >> 16 == 5793U || bp->common.chip_id >> 16 == 5794U) || bp->common.chip_id >> 16 == 5773U)) || (bp->common.chip_id >> 16 == 5796U || bp->common.chip_id >> 16 == 5803U)) || bp->common.chip_id >> 16 == 5805U ? 1024U : 512U) + (((((((((bp->common.chip_id >> 16 == 5770U || bp->common.chip_id >> 16 == 5797U) || bp->common.chip_id >> 16 == 5801U) || bp->common.chip_id >> 16 == 5774U) || bp->common.chip_id >> 16 == 5806U) || bp->common.chip_id >> 16 == 5807U) || ((bp->common.chip_id >> 16 == 5693U || bp->common.chip_id >> 16 == 5694U) || bp->common.chip_id >> 16 == 5695U)) || ((bp->common.chip_id >> 16 == 5793U || bp->common.chip_id >> 16 == 5794U) || bp->common.chip_id >> 16 == 5773U)) || (bp->common.chip_id >> 16 == 5796U || bp->common.chip_id >> 16 == 5803U)) || bp->common.chip_id >> 16 == 5805U ? 6U : 4U)) + (bp->common.chip_id >> 16 == 5710U ? 43U : 75U)) + 228U : 128U; tmp___0 = __max1___1 > __max2___0 ? __max1___1 : __max2___0; } else { __max1___2 = bp->common.chip_id >> 16 == 5710U ? 43U : 75U; __max2___1 = (int )bp->dropless_fc ? (((((((((((bp->common.chip_id >> 16 == 5770U || bp->common.chip_id >> 16 == 5797U) || bp->common.chip_id >> 16 == 5801U) || bp->common.chip_id >> 16 == 5774U) || bp->common.chip_id >> 16 == 5806U) || bp->common.chip_id >> 16 == 5807U) || ((bp->common.chip_id >> 16 == 5693U || bp->common.chip_id >> 16 == 5694U) || bp->common.chip_id >> 16 == 5695U)) || ((bp->common.chip_id >> 16 == 5793U || bp->common.chip_id >> 16 == 5794U) || bp->common.chip_id >> 16 == 5773U)) || (bp->common.chip_id >> 16 == 5796U || bp->common.chip_id >> 16 == 5803U)) || bp->common.chip_id >> 16 == 5805U ? 1024U : 512U) + (((((((((bp->common.chip_id >> 16 == 5770U || bp->common.chip_id >> 16 == 5797U) || bp->common.chip_id >> 16 == 5801U) || bp->common.chip_id >> 16 == 5774U) || bp->common.chip_id >> 16 == 5806U) || bp->common.chip_id >> 16 == 5807U) || ((bp->common.chip_id >> 16 == 5693U || bp->common.chip_id >> 16 == 5694U) || bp->common.chip_id >> 16 == 5695U)) || ((bp->common.chip_id >> 16 == 5793U || bp->common.chip_id >> 16 == 5794U) || bp->common.chip_id >> 16 == 5773U)) || (bp->common.chip_id >> 16 == 5796U || bp->common.chip_id >> 16 == 5803U)) || bp->common.chip_id >> 16 == 5805U ? 6U : 4U)) + (bp->common.chip_id >> 16 == 5710U ? 43U : 75U)) + 228U : 128U; tmp___0 = __max1___2 > __max2___1 ? __max1___2 : __max2___1; } __max1___0 = (int )tmp___0; __max2___2 = rx_ring_size; rx_ring_size = __max1___0 > __max2___2 ? __max1___0 : __max2___2; bp->rx_ring_size = rx_ring_size; } else { rx_ring_size = bp->rx_ring_size; } tmp___1 = ldv__builtin_expect((bp->msg_enable & 1048576) != 0, 0L); if (tmp___1 != 0L) { printk("\rbnx2x: [%s:%d(%s)]calculated rx_ring_size %d\n", "bnx2x_alloc_fp_mem_at", 4309, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", rx_ring_size); } else { } sb = & (bp->fp + (unsigned long )index)->status_blk; if ((uint )index != (uint )bp->num_queues - bp->num_cnic_queues) { if (bp->common.chip_id >> 16 != 5710U && (bp->common.chip_id >> 16 != 5711U && bp->common.chip_id >> 16 != 5712U)) { tmp___2 = dma_alloc_attrs(& (bp->pdev)->dev, 64UL, & (bp->fp + (unsigned long )index)->status_blk_mapping, 32976U, 0); sb->e2_sb = (struct host_hc_status_block_e2 *)tmp___2; if ((unsigned long )sb->e2_sb == (unsigned long )((struct host_hc_status_block_e2 *)0)) { goto alloc_mem_err; } else { } } else { tmp___3 = dma_alloc_attrs(& (bp->pdev)->dev, 64UL, & (bp->fp + (unsigned long )index)->status_blk_mapping, 32976U, 0); sb->e1x_sb = (struct host_hc_status_block_e1x *)tmp___3; if ((unsigned long )sb->e1x_sb == (unsigned long )((struct host_hc_status_block_e1x *)0)) { goto alloc_mem_err; } else { } } } else { } if ((uint )index != (uint )bp->num_queues - bp->num_cnic_queues) { set_sb_shortcuts(bp, index); } else { } if ((bp->flags & 32768U) == 0U || (uint )index != (uint )bp->num_queues - bp->num_cnic_queues) { cos = 0U; goto ldv_55355; ldv_55354: txdata = fp->txdata_ptr[(int )cos]; tmp___4 = ldv__builtin_expect((bp->msg_enable & 32) != 0, 0L); if (tmp___4 != 0L) { printk("\rbnx2x: [%s:%d(%s)]allocating tx memory of fp %d cos %d\n", "bnx2x_alloc_fp_mem_at", 4340, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", index, (int )cos); } else { } tmp___5 = kzalloc(65536UL, 208U); txdata->tx_buf_ring = (struct sw_tx_bd *)tmp___5; if ((unsigned long )txdata->tx_buf_ring == (unsigned long )((struct sw_tx_bd *)0)) { goto alloc_mem_err; } else { } tmp___6 = dma_alloc_attrs(& (bp->pdev)->dev, 65536UL, & txdata->tx_desc_mapping, 32976U, 0); txdata->tx_desc_ring = (union eth_tx_bd_types *)tmp___6; if ((unsigned long )txdata->tx_desc_ring == (unsigned long )((union eth_tx_bd_types *)0)) { goto alloc_mem_err; } else { } cos = (u8 )((int )cos + 1); ldv_55355: ; if ((int )fp->max_cos > (int )cos) { goto ldv_55354; } else { } } else { } if ((bp->flags & 32768U) == 0U || (uint )index != (uint )bp->num_queues - bp->num_cnic_queues) { tmp___7 = kzalloc(65536UL, 208U); (bp->fp + (unsigned long )index)->rx_buf_ring = (struct sw_rx_bd *)tmp___7; if ((unsigned long )(bp->fp + (unsigned long )index)->rx_buf_ring == (unsigned long )((struct sw_rx_bd *)0)) { goto alloc_mem_err; } else { } tmp___8 = dma_alloc_attrs(& (bp->pdev)->dev, 32768UL, & (bp->fp + (unsigned long )index)->rx_desc_mapping, 32976U, 0); (bp->fp + (unsigned long )index)->rx_desc_ring = (struct eth_rx_bd *)tmp___8; if ((unsigned long )(bp->fp + (unsigned long )index)->rx_desc_ring == (unsigned long )((struct eth_rx_bd *)0)) { goto alloc_mem_err; } else { } tmp___9 = dma_alloc_attrs(& (bp->pdev)->dev, 262144UL, & (bp->fp + (unsigned long )index)->rx_comp_mapping, 32976U, 0); (bp->fp + (unsigned long )index)->rx_comp_ring = (union eth_rx_cqe *)tmp___9; if ((unsigned long )(bp->fp + (unsigned long )index)->rx_comp_ring == (unsigned long )((union eth_rx_cqe *)0)) { goto alloc_mem_err; } else { } tmp___10 = kzalloc(16384UL, 208U); (bp->fp + (unsigned long )index)->rx_page_ring = (struct sw_rx_page *)tmp___10; if ((unsigned long )(bp->fp + (unsigned long )index)->rx_page_ring == (unsigned long )((struct sw_rx_page *)0)) { goto alloc_mem_err; } else { } tmp___11 = dma_alloc_attrs(& (bp->pdev)->dev, 8192UL, & (bp->fp + (unsigned long )index)->rx_sge_mapping, 32976U, 0); (bp->fp + (unsigned long )index)->rx_sge_ring = (struct eth_rx_sge *)tmp___11; if ((unsigned long )(bp->fp + (unsigned long )index)->rx_sge_ring == (unsigned long )((struct eth_rx_sge *)0)) { goto alloc_mem_err; } else { } bnx2x_set_next_page_rx_bd(fp); bnx2x_set_next_page_rx_cq(fp); ring_size = bnx2x_alloc_rx_bds(fp, rx_ring_size); if (ring_size < rx_ring_size) { goto alloc_mem_err; } else { } } else { } return (0); alloc_mem_err: printk("\vbnx2x: [%s:%d(%s)]Unable to allocate full memory for queue %d (size %d)\n", "bnx2x_alloc_fp_mem_at", 4387, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", index, ring_size); if ((unsigned int )fp->disable_tpa != 0U) { __max1___3 = 11U; __max2___3 = (int )bp->dropless_fc ? (((((((((((bp->common.chip_id >> 16 == 5770U || bp->common.chip_id >> 16 == 5797U) || bp->common.chip_id >> 16 == 5801U) || bp->common.chip_id >> 16 == 5774U) || bp->common.chip_id >> 16 == 5806U) || bp->common.chip_id >> 16 == 5807U) || ((bp->common.chip_id >> 16 == 5693U || bp->common.chip_id >> 16 == 5694U) || bp->common.chip_id >> 16 == 5695U)) || ((bp->common.chip_id >> 16 == 5793U || bp->common.chip_id >> 16 == 5794U) || bp->common.chip_id >> 16 == 5773U)) || (bp->common.chip_id >> 16 == 5796U || bp->common.chip_id >> 16 == 5803U)) || bp->common.chip_id >> 16 == 5805U ? 1024U : 512U) + (((((((((bp->common.chip_id >> 16 == 5770U || bp->common.chip_id >> 16 == 5797U) || bp->common.chip_id >> 16 == 5801U) || bp->common.chip_id >> 16 == 5774U) || bp->common.chip_id >> 16 == 5806U) || bp->common.chip_id >> 16 == 5807U) || ((bp->common.chip_id >> 16 == 5693U || bp->common.chip_id >> 16 == 5694U) || bp->common.chip_id >> 16 == 5695U)) || ((bp->common.chip_id >> 16 == 5793U || bp->common.chip_id >> 16 == 5794U) || bp->common.chip_id >> 16 == 5773U)) || (bp->common.chip_id >> 16 == 5796U || bp->common.chip_id >> 16 == 5803U)) || bp->common.chip_id >> 16 == 5805U ? 6U : 4U)) + (bp->common.chip_id >> 16 == 5710U ? 43U : 75U)) + 228U : 128U; tmp___12 = __max1___3 > __max2___3 ? __max1___3 : __max2___3; } else { __max1___4 = bp->common.chip_id >> 16 == 5710U ? 43U : 75U; __max2___4 = (int )bp->dropless_fc ? (((((((((((bp->common.chip_id >> 16 == 5770U || bp->common.chip_id >> 16 == 5797U) || bp->common.chip_id >> 16 == 5801U) || bp->common.chip_id >> 16 == 5774U) || bp->common.chip_id >> 16 == 5806U) || bp->common.chip_id >> 16 == 5807U) || ((bp->common.chip_id >> 16 == 5693U || bp->common.chip_id >> 16 == 5694U) || bp->common.chip_id >> 16 == 5695U)) || ((bp->common.chip_id >> 16 == 5793U || bp->common.chip_id >> 16 == 5794U) || bp->common.chip_id >> 16 == 5773U)) || (bp->common.chip_id >> 16 == 5796U || bp->common.chip_id >> 16 == 5803U)) || bp->common.chip_id >> 16 == 5805U ? 1024U : 512U) + (((((((((bp->common.chip_id >> 16 == 5770U || bp->common.chip_id >> 16 == 5797U) || bp->common.chip_id >> 16 == 5801U) || bp->common.chip_id >> 16 == 5774U) || bp->common.chip_id >> 16 == 5806U) || bp->common.chip_id >> 16 == 5807U) || ((bp->common.chip_id >> 16 == 5693U || bp->common.chip_id >> 16 == 5694U) || bp->common.chip_id >> 16 == 5695U)) || ((bp->common.chip_id >> 16 == 5793U || bp->common.chip_id >> 16 == 5794U) || bp->common.chip_id >> 16 == 5773U)) || (bp->common.chip_id >> 16 == 5796U || bp->common.chip_id >> 16 == 5803U)) || bp->common.chip_id >> 16 == 5805U ? 6U : 4U)) + (bp->common.chip_id >> 16 == 5710U ? 43U : 75U)) + 228U : 128U; tmp___12 = __max1___4 > __max2___4 ? __max1___4 : __max2___4; } if ((u32 )ring_size < tmp___12) { bnx2x_free_fp_mem_at(bp, index); return (-12); } else { } return (0); } } int bnx2x_alloc_fp_mem_cnic(struct bnx2x *bp ) { int tmp ; { if ((bp->flags & 32768U) == 0U) { tmp = bnx2x_alloc_fp_mem_at(bp, (int )((uint )bp->num_queues - bp->num_cnic_queues)); if (tmp != 0) { return (-12); } else { } } else { } return (0); } } int bnx2x_alloc_fp_mem(struct bnx2x *bp ) { int i ; int tmp ; int tmp___0 ; int delta ; int __ret_warn_on ; long tmp___1 ; { tmp = bnx2x_alloc_fp_mem_at(bp, 0); if (tmp != 0) { return (-12); } else { } i = 1; goto ldv_55372; ldv_55371: tmp___0 = bnx2x_alloc_fp_mem_at(bp, i); if (tmp___0 != 0) { goto ldv_55370; } else { } i = i + 1; ldv_55372: ; if ((uint )i < bp->num_ethernet_queues) { goto ldv_55371; } else { } ldv_55370: ; if ((uint )i != bp->num_ethernet_queues) { delta = (int )(bp->num_ethernet_queues - (uint )i); __ret_warn_on = delta < 0; tmp___1 = ldv__builtin_expect(__ret_warn_on != 0, 0L); if (tmp___1 != 0L) { warn_slowpath_null("/work/ldvuser/exper_fp/work/current--X--drivers--X--defaultlinux-3.10-rc1.tar--X--32_7a--X--cpachecker/linux-3.10-rc1.tar/csd_deg_dscv/8504/dscv_tempdir/dscv/ri/32_7a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c.prepared", 4435); } else { } ldv__builtin_expect(__ret_warn_on != 0, 0L); bnx2x_shrink_eth_fp(bp, delta); if ((unsigned int )bp->cnic_support != 0U) { bnx2x_move_fp(bp, (int )((uint )bp->num_queues - bp->num_cnic_queues), (int )(((uint )bp->num_queues - bp->num_cnic_queues) - (uint )delta)); } else { } bp->num_ethernet_queues = bp->num_ethernet_queues - (uint )delta; bp->num_queues = (int )(bp->num_ethernet_queues + bp->num_cnic_queues); printk("\vbnx2x: [%s:%d(%s)]Adjusted num of queues from %d to %d\n", "bnx2x_alloc_fp_mem", 4449, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", bp->num_queues + delta, bp->num_queues); } else { } return (0); } } void bnx2x_free_mem_bp(struct bnx2x *bp ) { int i ; { i = 0; goto ldv_55382; ldv_55381: kfree((void const *)(bp->fp + (unsigned long )i)->tpa_info); i = i + 1; ldv_55382: ; if (bp->fp_array_size > i) { goto ldv_55381; } else { } kfree((void const *)bp->fp); kfree((void const *)bp->sp_objs); kfree((void const *)bp->fp_stats); kfree((void const *)bp->bnx2x_txq); kfree((void const *)bp->msix_table); kfree((void const *)bp->ilt); return; } } int bnx2x_alloc_mem_bp(struct bnx2x *bp ) { struct bnx2x_fastpath *fp ; struct msix_entry *tbl ; struct bnx2x_ilt *ilt ; int msix_table_size ; int fp_array_size ; int txq_array_size ; int i ; long tmp ; long tmp___0 ; void *tmp___1 ; void *tmp___2 ; void *tmp___3 ; void *tmp___4 ; long tmp___5 ; void *tmp___6 ; void *tmp___7 ; void *tmp___8 ; { msix_table_size = 0; msix_table_size = (int )bp->igu_sb_cnt; if ((bp->flags & 4194304U) == 0U) { msix_table_size = msix_table_size + 1; } else { } tmp = ldv__builtin_expect((bp->msg_enable & 2) != 0, 0L); if (tmp != 0L) { _dev_info((struct device const *)(& (bp->pdev)->dev), "msix_table_size %d\n", msix_table_size); } else { } fp_array_size = ((int )bp->igu_sb_cnt - (int )bp->cnic_support) + (int )bp->cnic_support; bp->fp_array_size = fp_array_size; tmp___0 = ldv__builtin_expect((bp->msg_enable & 2) != 0, 0L); if (tmp___0 != 0L) { _dev_info((struct device const *)(& (bp->pdev)->dev), "fp_array_size %d\n", bp->fp_array_size); } else { } tmp___1 = kcalloc((size_t )bp->fp_array_size, 528UL, 208U); fp = (struct bnx2x_fastpath *)tmp___1; if ((unsigned long )fp == (unsigned long )((struct bnx2x_fastpath *)0)) { goto alloc_err; } else { } i = 0; goto ldv_55396; ldv_55395: tmp___2 = kcalloc(64UL, 40UL, 208U); (fp + (unsigned long )i)->tpa_info = (struct bnx2x_agg_info *)tmp___2; if ((unsigned long )(fp + (unsigned long )i)->tpa_info == (unsigned long )((struct bnx2x_agg_info *)0)) { goto alloc_err; } else { } i = i + 1; ldv_55396: ; if (bp->fp_array_size > i) { goto ldv_55395; } else { } bp->fp = fp; tmp___3 = kcalloc((size_t )bp->fp_array_size, 488UL, 208U); bp->sp_objs = (struct bnx2x_sp_objs *)tmp___3; if ((unsigned long )bp->sp_objs == (unsigned long )((struct bnx2x_sp_objs *)0)) { goto alloc_err; } else { } tmp___4 = kcalloc((size_t )bp->fp_array_size, 512UL, 208U); bp->fp_stats = (struct bnx2x_fp_stats *)tmp___4; if ((unsigned long )bp->fp_stats == (unsigned long )((struct bnx2x_fp_stats *)0)) { goto alloc_err; } else { } txq_array_size = ((int )bp->igu_sb_cnt - (int )bp->cnic_support) * 3 + (int )bp->cnic_support; tmp___5 = ldv__builtin_expect((bp->msg_enable & 2) != 0, 0L); if (tmp___5 != 0L) { _dev_info((struct device const *)(& (bp->pdev)->dev), "txq_array_size %d", txq_array_size); } else { } tmp___6 = kcalloc((size_t )txq_array_size, 80UL, 208U); bp->bnx2x_txq = (struct bnx2x_fp_txdata *)tmp___6; if ((unsigned long )bp->bnx2x_txq == (unsigned long )((struct bnx2x_fp_txdata *)0)) { goto alloc_err; } else { } tmp___7 = kcalloc((size_t )msix_table_size, 8UL, 208U); tbl = (struct msix_entry *)tmp___7; if ((unsigned long )tbl == (unsigned long )((struct msix_entry *)0)) { goto alloc_err; } else { } bp->msix_table = tbl; tmp___8 = kzalloc(64UL, 208U); ilt = (struct bnx2x_ilt *)tmp___8; if ((unsigned long )ilt == (unsigned long )((struct bnx2x_ilt *)0)) { goto alloc_err; } else { } bp->ilt = ilt; return (0); alloc_err: bnx2x_free_mem_bp(bp); return (-12); } } int bnx2x_reload_if_running(struct net_device *dev ) { struct bnx2x *bp ; void *tmp ; bool tmp___0 ; int tmp___1 ; long tmp___2 ; int tmp___3 ; { tmp = netdev_priv((struct net_device const *)dev); bp = (struct bnx2x *)tmp; tmp___0 = netif_running((struct net_device const *)dev); if (tmp___0) { tmp___1 = 0; } else { tmp___1 = 1; } tmp___2 = ldv__builtin_expect((long )tmp___1, 0L); if (tmp___2 != 0L) { return (0); } else { } bnx2x_nic_unload(bp, 0, 1); tmp___3 = bnx2x_nic_load(bp, 0); return (tmp___3); } } int bnx2x_get_cur_phy_idx(struct bnx2x *bp ) { u32 sel_phy_idx ; u32 tmp ; { sel_phy_idx = 0U; if ((unsigned int )bp->link_params.num_phys <= 1U) { return (0); } else { } if ((unsigned int )bp->link_vars.link_up != 0U) { sel_phy_idx = 1U; if ((bp->link_vars.link_status & 1048576U) != 0U && (bp->link_params.phy[2].supported & 1024U) != 0U) { sel_phy_idx = 2U; } else { } } else { tmp = bnx2x_phy_selection(& bp->link_params); switch (tmp) { case 0U: ; case 1U: ; case 3U: sel_phy_idx = 1U; goto ldv_55409; case 2U: ; case 4U: sel_phy_idx = 2U; goto ldv_55409; } ldv_55409: ; } return ((int )sel_phy_idx); } } int bnx2x_get_link_cfg_idx(struct bnx2x *bp ) { u32 sel_phy_idx ; int tmp ; { tmp = bnx2x_get_cur_phy_idx(bp); sel_phy_idx = (u32 )tmp; if ((bp->link_params.multi_phy_config & 8U) != 0U) { if (sel_phy_idx == 1U) { sel_phy_idx = 2U; } else if (sel_phy_idx == 2U) { sel_phy_idx = 1U; } else { } } else { } return (sel_phy_idx != 0U ? (int )(sel_phy_idx - 1U) : 0); } } int bnx2x_fcoe_get_wwn(struct net_device *dev , u64 *wwn , int type ) { struct bnx2x *bp ; void *tmp ; struct cnic_eth_dev *cp ; { tmp = netdev_priv((struct net_device const *)dev); bp = (struct bnx2x *)tmp; cp = & bp->cnic_eth_dev; switch (type) { case 0: *wwn = ((unsigned long long )cp->fcoe_wwn_node_name_hi << 32) + (unsigned long long )cp->fcoe_wwn_node_name_lo; goto ldv_55424; case 1: *wwn = ((unsigned long long )cp->fcoe_wwn_port_name_hi << 32) + (unsigned long long )cp->fcoe_wwn_port_name_lo; goto ldv_55424; default: printk("\vbnx2x: [%s:%d(%s)]Wrong WWN type requested - %d\n", "bnx2x_fcoe_get_wwn", 4622, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", type); return (-22); } ldv_55424: ; return (0); } } int bnx2x_change_mtu(struct net_device *dev , int new_mtu ) { struct bnx2x *bp ; void *tmp ; int tmp___0 ; { tmp = netdev_priv((struct net_device const *)dev); bp = (struct bnx2x *)tmp; if ((unsigned int )bp->recovery_state != 0U) { printk("\vbnx2x: [%s:%d(%s)]Can\'t perform change MTU during parity recovery\n", "bnx2x_change_mtu", 4636, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); return (-11); } else { } if (new_mtu > 9600 || new_mtu + 14 <= 59) { printk("\vbnx2x: [%s:%d(%s)]Can\'t support requested MTU size\n", "bnx2x_change_mtu", 4642, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); return (-22); } else { } dev->mtu = (unsigned int )new_mtu; tmp___0 = bnx2x_reload_if_running(dev); return (tmp___0); } } netdev_features_t bnx2x_fix_features(struct net_device *dev , netdev_features_t features ) { struct bnx2x *bp ; void *tmp ; { tmp = netdev_priv((struct net_device const *)dev); bp = (struct bnx2x *)tmp; if ((features & 536870912ULL) == 0ULL || bp->disable_tpa != 0) { features = features & 0xffffffffffff7fffULL; features = features & 0xffffffffffffbfffULL; } else { } return (features); } } int bnx2x_set_features(struct net_device *dev , netdev_features_t features ) { struct bnx2x *bp ; void *tmp ; u32 flags ; bool bnx2x_reload ; int tmp___0 ; { tmp = netdev_priv((struct net_device const *)dev); bp = (struct bnx2x *)tmp; flags = bp->flags; bnx2x_reload = 0; if ((features & 32768ULL) != 0ULL) { flags = flags | 256U; } else { flags = flags & 4294967039U; } if ((features & 16384ULL) != 0ULL) { flags = flags | 1024U; } else { flags = flags & 4294966271U; } if ((features & 2147483648ULL) != 0ULL) { if ((unsigned int )bp->link_params.loopback_mode != 2U) { bp->link_params.loopback_mode = 2U; bnx2x_reload = 1; } else { } } else if ((unsigned int )bp->link_params.loopback_mode != 0U) { bp->link_params.loopback_mode = 0U; bnx2x_reload = 1; } else { } if (bp->flags != flags) { bp->flags = flags; bnx2x_reload = 1; } else { } if ((int )bnx2x_reload) { if ((unsigned int )bp->recovery_state == 0U) { tmp___0 = bnx2x_reload_if_running(dev); return (tmp___0); } else { } } else { } return (0); } } void bnx2x_tx_timeout(struct net_device *dev ) { struct bnx2x *bp ; void *tmp ; { tmp = netdev_priv((struct net_device const *)dev); bp = (struct bnx2x *)tmp; __asm__ volatile ("": : : "memory"); set_bit(1U, (unsigned long volatile *)(& bp->sp_rtnl_state)); __asm__ volatile ("": : : "memory"); schedule_delayed_work(& bp->sp_rtnl_task, 0UL); return; } } int bnx2x_suspend(struct pci_dev *pdev , pm_message_t state ) { struct net_device *dev ; void *tmp ; struct bnx2x *bp ; void *tmp___0 ; bool tmp___1 ; int tmp___2 ; pci_power_t tmp___3 ; { tmp = pci_get_drvdata(pdev); dev = (struct net_device *)tmp; if ((unsigned long )dev == (unsigned long )((struct net_device *)0)) { dev_err((struct device const *)(& pdev->dev), "BAD net device from bnx2x_init_one\n"); return (-19); } else { } tmp___0 = netdev_priv((struct net_device const *)dev); bp = (struct bnx2x *)tmp___0; rtnl_lock(); pci_save_state(pdev); tmp___1 = netif_running((struct net_device const *)dev); if (tmp___1) { tmp___2 = 0; } else { tmp___2 = 1; } if (tmp___2) { rtnl_unlock(); return (0); } else { } netif_device_detach(dev); bnx2x_nic_unload(bp, 1, 0); tmp___3 = pci_choose_state(pdev, state); bnx2x_set_power_state(bp, tmp___3); rtnl_unlock(); return (0); } } int bnx2x_resume(struct pci_dev *pdev ) { struct net_device *dev ; void *tmp ; struct bnx2x *bp ; int rc ; void *tmp___0 ; bool tmp___1 ; int tmp___2 ; { tmp = pci_get_drvdata(pdev); dev = (struct net_device *)tmp; if ((unsigned long )dev == (unsigned long )((struct net_device *)0)) { dev_err((struct device const *)(& pdev->dev), "BAD net device from bnx2x_init_one\n"); return (-19); } else { } tmp___0 = netdev_priv((struct net_device const *)dev); bp = (struct bnx2x *)tmp___0; if ((unsigned int )bp->recovery_state != 0U) { printk("\vbnx2x: [%s:%d(%s)]Handling parity error recovery. Try again later\n", "bnx2x_resume", 4772, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); return (-11); } else { } rtnl_lock(); pci_restore_state(pdev); tmp___1 = netif_running((struct net_device const *)dev); if (tmp___1) { tmp___2 = 0; } else { tmp___2 = 1; } if (tmp___2) { rtnl_unlock(); return (0); } else { } bnx2x_set_power_state(bp, 0); netif_device_attach(dev); rc = bnx2x_nic_load(bp, 1); rtnl_unlock(); return (rc); } } void bnx2x_set_ctx_validation(struct bnx2x *bp , struct eth_context *cxt , u32 cid ) { u8 tmp ; u8 tmp___0 ; { tmp = calc_crc8((((u32 )((((int )bp->pfid & 1) << 23) | (((int )bp->pfid >> 1) << 17)) | cid) << 8) | 64U, 255); cxt->ustorm_ag_context.cdu_usage = (unsigned int )tmp | 128U; tmp___0 = calc_crc8((((u32 )((((int )bp->pfid & 1) << 23) | (((int )bp->pfid >> 1) << 17)) | cid) << 8) | 32U, 255); cxt->xstorm_ag_context.cdu_reserved = (unsigned int )tmp___0 | 128U; return; } } static void storm_memset_hc_timeout(struct bnx2x *bp , u8 port , u8 fw_sb_id , u8 sb_index , u8 ticks ) { u32 addr ; long tmp ; { addr = ((unsigned int )(bp->iro_arr + 135UL)->base + ((unsigned int )((int )sb_index * (int )(bp->iro_arr + 135UL)->m2) + (unsigned int )((int )fw_sb_id * (int )(bp->iro_arr + 135UL)->m1))) + 4259840U; writeb((int )ticks, (void volatile *)bp->regview + (unsigned long )addr); tmp = ldv__builtin_expect((bp->msg_enable & 32) != 0, 0L); if (tmp != 0L) { printk("\rbnx2x: [%s:%d(%s)]port %x fw_sb_id %d sb_index %d ticks %d\n", "storm_memset_hc_timeout", 4819, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )port, (int )fw_sb_id, (int )sb_index, (int )ticks); } else { } return; } } static void storm_memset_hc_disable(struct bnx2x *bp , u8 port , u16 fw_sb_id , u8 sb_index , u8 disable ) { u32 enable_flag ; u32 addr ; u8 flags ; unsigned char tmp ; long tmp___0 ; { enable_flag = (unsigned int )disable != 0U ? 0U : 2U; addr = ((unsigned int )(bp->iro_arr + 136UL)->base + ((unsigned int )((int )sb_index * (int )(bp->iro_arr + 136UL)->m2) + (unsigned int )((int )fw_sb_id * (int )(bp->iro_arr + 136UL)->m1))) + 4259840U; tmp = readb((void const volatile *)bp->regview + (unsigned long )addr); flags = tmp; flags = (unsigned int )flags & 253U; flags = (int )((u8 )enable_flag) | (int )flags; writeb((int )flags, (void volatile *)bp->regview + (unsigned long )addr); tmp___0 = ldv__builtin_expect((bp->msg_enable & 32) != 0, 0L); if (tmp___0 != 0L) { printk("\rbnx2x: [%s:%d(%s)]port %x fw_sb_id %d sb_index %d disable %d\n", "storm_memset_hc_disable", 4836, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )port, (int )fw_sb_id, (int )sb_index, (int )disable); } else { } return; } } void bnx2x_update_coalesce_sb_index(struct bnx2x *bp , u8 fw_sb_id , u8 sb_index , u8 disable , u16 usec ) { int port ; u8 ticks ; { port = (int )bp->pfid & 1; ticks = (u8 )((unsigned int )usec / 4U); storm_memset_hc_timeout(bp, (int )((u8 )port), (int )fw_sb_id, (int )sb_index, (int )ticks); disable = (u8 )((unsigned int )disable != 0U || (unsigned int )usec == 0U); storm_memset_hc_disable(bp, (int )((u8 )port), (int )fw_sb_id, (int )sb_index, (int )disable); return; } } void ldv_mutex_lock_45(struct mutex *ldv_func_arg1 ) { { ldv_mutex_lock_lock(ldv_func_arg1); mutex_lock(ldv_func_arg1); return; } } void ldv_mutex_unlock_46(struct mutex *ldv_func_arg1 ) { { ldv_mutex_unlock_lock(ldv_func_arg1); mutex_unlock(ldv_func_arg1); return; } } void ldv_mutex_lock_47(struct mutex *ldv_func_arg1 ) { { ldv_mutex_lock_mutex_of_device(ldv_func_arg1); mutex_lock(ldv_func_arg1); return; } } int ldv_mutex_trylock_48(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_49(struct mutex *ldv_func_arg1 ) { { ldv_mutex_unlock_mutex_of_device(ldv_func_arg1); mutex_unlock(ldv_func_arg1); return; } } void ldv_mutex_lock_53(struct mutex *ldv_func_arg1 ) { { ldv_mutex_lock_phy_mutex_of_bnx2x_port(ldv_func_arg1); mutex_lock(ldv_func_arg1); return; } } void ldv_mutex_unlock_54(struct mutex *ldv_func_arg1 ) { { ldv_mutex_unlock_phy_mutex_of_bnx2x_port(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_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_lock_65(struct mutex *ldv_func_arg1 ) ; void ldv_mutex_lock_67(struct mutex *ldv_func_arg1 ) ; extern bool capable(int ) ; __inline static char const *kobject_name(struct kobject const *kobj ) { { return ((char const *)kobj->name); } } __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); } } __inline static dma_addr_t dma_map_single_attrs___0(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_27083: ; goto ldv_27083; } 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_sync_single_for_cpu___0(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" (103), "i" (12UL)); ldv_27142: ; goto ldv_27142; } else { } if ((unsigned long )ops->sync_single_for_cpu != (unsigned long )((void (*)(struct device * , dma_addr_t , size_t , enum dma_data_direction ))0)) { (*(ops->sync_single_for_cpu))(dev, addr, size, dir); } else { } debug_dma_sync_single_for_cpu(dev, addr, size, (int )dir); return; } } __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 void ethtool_cmd_speed_set(struct ethtool_cmd *ep , __u32 speed ) { { ep->speed = (unsigned short )speed; ep->speed_hi = (unsigned short )(speed >> 16); return; } } __inline static __u32 ethtool_cmd_speed(struct ethtool_cmd const *ep ) { { return ((__u32 )(((int )ep->speed_hi << 16) | (int )ep->speed)); } } extern int ethtool_op_get_ts_info(struct net_device * , struct ethtool_ts_info * ) ; __inline static void dql_queued___0(struct dql *dql , unsigned int count ) { long tmp ; { tmp = ldv__builtin_expect(count > 268435455U, 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/dynamic_queue_limits.h"), "i" (74), "i" (12UL)); ldv_29282: ; goto ldv_29282; } else { } dql->num_queued = dql->num_queued + count; dql->last_obj_cnt = count; return; } } __inline static void netdev_tx_sent_queue___0(struct netdev_queue *dev_queue , unsigned int bytes ) { int tmp ; long tmp___0 ; int tmp___1 ; long tmp___2 ; { dql_queued___0(& dev_queue->dql, bytes); tmp = dql_avail((struct dql const *)(& dev_queue->dql)); tmp___0 = ldv__builtin_expect(tmp >= 0, 1L); if (tmp___0 != 0L) { return; } else { } set_bit(1U, (unsigned long volatile *)(& dev_queue->state)); __asm__ volatile ("mfence": : : "memory"); tmp___1 = dql_avail((struct dql const *)(& dev_queue->dql)); tmp___2 = ldv__builtin_expect(tmp___1 >= 0, 0L); if (tmp___2 != 0L) { clear_bit(1, (unsigned long volatile *)(& dev_queue->state)); } else { } return; } } extern u32 crc32_le(u32 , unsigned char const * , size_t ) ; __inline static char const *pci_name(struct pci_dev const *pdev ) { char const *tmp ; { tmp = dev_name(& pdev->dev); return (tmp); } } void bnx2x_get_rss_ind_table(struct bnx2x_rss_config_obj *rss_obj , u8 *ind_table ) ; __inline static void bnx2x_update_rx_prod___0(struct bnx2x *bp , struct bnx2x_fastpath *fp , u16 bd_prod , u16 rx_comp_prod , u16 rx_sge_prod ) { struct ustorm_eth_rx_producers rx_prods ; u32 i ; long tmp ; { rx_prods.cqe_prod = 0U; rx_prods.bd_prod = (unsigned short)0; rx_prods.sge_prod = (unsigned short)0; rx_prods.reserved = (unsigned short)0; rx_prods.bd_prod = bd_prod; rx_prods.cqe_prod = rx_comp_prod; rx_prods.sge_prod = rx_sge_prod; __asm__ volatile ("sfence": : : "memory"); i = 0U; goto ldv_44636; ldv_44635: writel(*((u32 *)(& rx_prods) + (unsigned long )i), (void volatile *)bp->regview + (unsigned long )(fp->ustorm_rx_prods_offset + i * 4U)); i = i + 1U; ldv_44636: ; if (i <= 1U) { goto ldv_44635; } else { } __asm__ volatile ("": : : "memory"); tmp = ldv__builtin_expect((bp->msg_enable & 2048) != 0, 0L); if (tmp != 0L) { printk("\rbnx2x: [%s:%d(%s)]queue[%d]: wrote bd_prod %u cqe_prod %u sge_prod %u\n", "bnx2x_update_rx_prod", 550, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )fp->index, (int )bd_prod, (int )rx_comp_prod, (int )rx_sge_prod); } else { } return; } } static u32 const page_vals_e2[2U] = { 0U, 128U}; static u32 const page_write_regs_e2[1U] = { 328476U}; static struct reg_addr const page_read_regs_e2[1U] = { {360448U, 4608U, 4U, 48U}}; static u32 const page_vals_e3[2U] = { 0U, 128U}; static u32 const page_write_regs_e3[1U] = { 328476U}; static struct reg_addr const page_read_regs_e3[1U] = { {360448U, 4608U, 24U, 48U}}; static struct reg_addr const reg_addrs[1820U] = { {8192U, 1U, 31U, 4095U}, {8196U, 1U, 31U, 8191U}, {8200U, 25U, 31U, 4095U}, {8300U, 1U, 31U, 8191U}, {8304U, 313U, 31U, 4095U}, {10240U, 103U, 31U, 4095U}, {12288U, 287U, 31U, 4095U}, {14336U, 331U, 31U, 4095U}, {34816U, 6U, 31U, 2340U}, {34840U, 1U, 30U, 2340U}, {36864U, 4U, 28U, 2340U}, {36880U, 7U, 28U, 4095U}, {36908U, 1U, 28U, 2340U}, {36912U, 1U, 28U, 4095U}, {36916U, 13U, 28U, 2340U}, {36968U, 16U, 28U, 4095U}, {37032U, 98U, 28U, 2340U}, {37424U, 2U, 28U, 4095U}, {37432U, 3U, 28U, 2340U}, {37444U, 1U, 28U, 4095U}, {37448U, 1U, 28U, 2340U}, {37452U, 1U, 4U, 2340U}, {37456U, 16U, 28U, 2340U}, {37544U, 2U, 28U, 8191U}, {37556U, 1U, 28U, 8191U}, {37888U, 33U, 28U, 2340U}, {38020U, 5U, 24U, 2340U}, {40960U, 27U, 31U, 2340U}, {41068U, 1U, 3U, 2340U}, {41072U, 2U, 31U, 2340U}, {41080U, 1U, 31U, 8191U}, {41084U, 31U, 31U, 2340U}, {41208U, 1U, 31U, 8191U}, {41212U, 3U, 31U, 2340U}, {41224U, 1U, 31U, 8191U}, {41228U, 3U, 31U, 2340U}, {41240U, 1U, 31U, 8191U}, {41244U, 28U, 31U, 2340U}, {41356U, 4U, 3U, 2340U}, {41372U, 3U, 31U, 2340U}, {41384U, 1U, 31U, 8191U}, {41388U, 3U, 31U, 2340U}, {41400U, 1U, 31U, 8191U}, {41404U, 54U, 31U, 2340U}, {41620U, 2U, 3U, 2340U}, {41628U, 2U, 31U, 2340U}, {41636U, 2U, 7U, 2340U}, {41644U, 2U, 31U, 2340U}, {41652U, 1U, 31U, 8191U}, {41656U, 49U, 31U, 2340U}, {41868U, 2U, 31U, 8191U}, {41880U, 1U, 31U, 8191U}, {41884U, 7U, 30U, 2340U}, {41912U, 2U, 24U, 2340U}, {41920U, 1U, 30U, 2340U}, {41924U, 1U, 30U, 4095U}, {41928U, 1U, 30U, 2340U}, {41936U, 1U, 30U, 2340U}, {41944U, 1U, 30U, 2340U}, {41952U, 1U, 30U, 2340U}, {41960U, 1U, 30U, 2340U}, {41968U, 1U, 30U, 2340U}, {41976U, 1U, 30U, 2340U}, {41984U, 1U, 31U, 2340U}, {41988U, 1U, 31U, 4095U}, {41992U, 2U, 31U, 8191U}, {42000U, 7U, 31U, 2340U}, {42028U, 12U, 31U, 4095U}, {42076U, 1U, 31U, 2340U}, {42080U, 1U, 31U, 6436U}, {42084U, 15U, 31U, 2340U}, {42144U, 1U, 7U, 2340U}, {42148U, 2U, 31U, 2340U}, {42156U, 2U, 3U, 2340U}, {42164U, 1U, 7U, 2340U}, {42168U, 2U, 3U, 2340U}, {42176U, 3U, 31U, 2340U}, {42188U, 5U, 3U, 2340U}, {42208U, 3U, 31U, 2340U}, {42236U, 2U, 31U, 2340U}, {42244U, 1U, 3U, 2340U}, {42248U, 3U, 31U, 2340U}, {42264U, 1U, 31U, 2340U}, {42272U, 1U, 31U, 2340U}, {42280U, 1U, 31U, 2340U}, {42288U, 1U, 31U, 2340U}, {42296U, 1U, 31U, 2340U}, {42304U, 1U, 31U, 2340U}, {42312U, 1U, 3U, 2340U}, {42320U, 1U, 3U, 2340U}, {42328U, 1U, 3U, 2340U}, {42336U, 1U, 3U, 2340U}, {42344U, 1U, 3U, 2340U}, {42352U, 1U, 31U, 2340U}, {42368U, 1U, 31U, 8191U}, {42384U, 1U, 31U, 8191U}, {42400U, 1U, 7U, 2340U}, {42432U, 1U, 31U, 2340U}, {42464U, 1U, 30U, 2340U}, {42472U, 1U, 30U, 2340U}, {42480U, 1U, 30U, 2340U}, {42488U, 1U, 6U, 2340U}, {42492U, 1U, 30U, 2340U}, {42496U, 5U, 30U, 4095U}, {42516U, 1U, 30U, 2340U}, {42520U, 1U, 30U, 4095U}, {42524U, 1U, 30U, 2340U}, {42528U, 6U, 28U, 2340U}, {42552U, 20U, 4U, 2340U}, {42632U, 35U, 28U, 2340U}, {42772U, 1U, 28U, 4095U}, {42776U, 2U, 28U, 2340U}, {42784U, 1U, 28U, 4095U}, {42788U, 3U, 28U, 2340U}, {42800U, 1U, 4U, 2340U}, {42804U, 2U, 28U, 2340U}, {42812U, 4U, 4U, 2340U}, {42828U, 1U, 28U, 2340U}, {42832U, 1U, 28U, 4095U}, {42836U, 3U, 28U, 2340U}, {42848U, 5U, 4U, 2340U}, {42868U, 7U, 28U, 2340U}, {42896U, 15U, 4U, 2340U}, {42956U, 4U, 28U, 2340U}, {42976U, 6U, 24U, 2340U}, {43008U, 18U, 4U, 2340U}, {43080U, 33U, 28U, 2340U}, {43212U, 2U, 24U, 2340U}, {43220U, 4U, 28U, 2340U}, {43236U, 1U, 24U, 2340U}, {43240U, 1U, 28U, 2340U}, {43248U, 1U, 28U, 2340U}, {43256U, 30U, 24U, 2340U}, {43380U, 73U, 24U, 2340U}, {44080U, 1U, 24U, 2340U}, {44096U, 1U, 24U, 2340U}, {44112U, 1U, 24U, 2340U}, {44128U, 1U, 16U, 2340U}, {65536U, 9U, 31U, 2340U}, {65572U, 1U, 7U, 2340U}, {65576U, 5U, 31U, 2340U}, {65596U, 6U, 7U, 2340U}, {65620U, 20U, 31U, 2340U}, {65700U, 4U, 7U, 2340U}, {65716U, 11U, 31U, 2340U}, {65760U, 4U, 7U, 2340U}, {65776U, 8U, 31U, 2340U}, {65808U, 6U, 7U, 2340U}, {65832U, 110U, 31U, 2340U}, {66272U, 4U, 7U, 2340U}, {66288U, 18U, 31U, 2340U}, {66360U, 20U, 7U, 2340U}, {66440U, 10U, 31U, 2340U}, {66512U, 2U, 3U, 8191U}, {66524U, 1U, 3U, 8191U}, {66560U, 6U, 7U, 2340U}, {66584U, 1U, 31U, 4095U}, {66588U, 1U, 31U, 2340U}, {66592U, 1U, 31U, 4095U}, {66596U, 1U, 31U, 2340U}, {66600U, 1U, 31U, 4095U}, {66604U, 1U, 31U, 2340U}, {66608U, 10U, 7U, 2340U}, {66648U, 2U, 31U, 2340U}, {66656U, 1U, 31U, 4095U}, {66660U, 4U, 31U, 2340U}, {66676U, 1U, 31U, 4095U}, {66680U, 14U, 31U, 2340U}, {66736U, 12U, 7U, 2340U}, {66784U, 1U, 31U, 4095U}, {66792U, 1U, 31U, 2340U}, {66796U, 1U, 31U, 4095U}, {66804U, 1U, 31U, 2340U}, {66808U, 1U, 31U, 4095U}, {66816U, 2U, 31U, 2340U}, {66824U, 1U, 31U, 4095U}, {66828U, 9U, 31U, 2340U}, {66864U, 1U, 31U, 4095U}, {66868U, 1U, 31U, 2340U}, {66872U, 1U, 31U, 4095U}, {66876U, 3U, 31U, 2340U}, {66888U, 1U, 31U, 4095U}, {66892U, 3U, 31U, 2340U}, {66904U, 1U, 31U, 4095U}, {66908U, 123U, 31U, 2340U}, {67408U, 2U, 7U, 2340U}, {67424U, 2U, 7U, 2340U}, {67440U, 2U, 7U, 2340U}, {67456U, 2U, 7U, 2340U}, {67472U, 2U, 31U, 2340U}, {67488U, 2U, 7U, 2340U}, {67504U, 2U, 7U, 2340U}, {67520U, 2U, 7U, 2340U}, {67536U, 2U, 7U, 2340U}, {67552U, 2U, 31U, 2340U}, {67712U, 2U, 31U, 2340U}, {67840U, 2U, 31U, 2340U}, {90112U, 1U, 6U, 2340U}, {90116U, 25U, 30U, 2340U}, {90224U, 8U, 30U, 2340U}, {90256U, 4U, 14U, 2340U}, {90272U, 6U, 30U, 2340U}, {90304U, 7U, 30U, 2340U}, {90332U, 2U, 6U, 2340U}, {90340U, 6U, 30U, 2340U}, {90364U, 4U, 30U, 8191U}, {90380U, 2U, 6U, 2340U}, {90388U, 6U, 30U, 2340U}, {90432U, 48U, 30U, 8191U}, {90628U, 5U, 30U, 2340U}, {98304U, 1U, 30U, 2340U}, {98312U, 1U, 30U, 2340U}, {98320U, 35U, 28U, 2340U}, {98468U, 2U, 28U, 2340U}, {98496U, 9U, 28U, 2340U}, {98532U, 1U, 12U, 2340U}, {98536U, 2U, 28U, 2340U}, {98544U, 1U, 12U, 2340U}, {98548U, 79U, 28U, 2340U}, {98864U, 1U, 12U, 2340U}, {98868U, 2U, 28U, 2340U}, {98876U, 1U, 12U, 2340U}, {98880U, 13U, 28U, 2340U}, {98932U, 1U, 4U, 2340U}, {98936U, 12U, 28U, 2340U}, {98984U, 1U, 28U, 4095U}, {98988U, 3U, 28U, 2340U}, {99000U, 1U, 28U, 4095U}, {99004U, 19U, 28U, 2340U}, {99080U, 1U, 28U, 4095U}, {99084U, 3U, 28U, 2340U}, {99096U, 1U, 28U, 4095U}, {99100U, 7U, 28U, 2340U}, {99128U, 1U, 28U, 4095U}, {99132U, 3U, 28U, 2340U}, {99144U, 1U, 28U, 4095U}, {99148U, 28U, 28U, 2340U}, {99260U, 2U, 28U, 8191U}, {99272U, 3U, 28U, 8191U}, {99288U, 1U, 28U, 8191U}, {99392U, 48U, 28U, 8191U}, {99584U, 15U, 28U, 2340U}, {99696U, 1U, 24U, 4095U}, {99700U, 1U, 24U, 2340U}, {99704U, 1U, 24U, 4095U}, {99708U, 4U, 24U, 2340U}, {99724U, 1U, 24U, 4095U}, {99728U, 1U, 24U, 2340U}, {99732U, 1U, 24U, 4095U}, {99736U, 32U, 24U, 2340U}, {99864U, 5U, 16U, 2340U}, {99884U, 4U, 16U, 4095U}, {99900U, 16U, 16U, 2340U}, {99968U, 44U, 16U, 2340U}, {100168U, 12U, 16U, 2340U}, {100232U, 1U, 16U, 2340U}, {100252U, 6U, 16U, 2340U}, {100292U, 51U, 16U, 2340U}, {100864U, 48U, 16U, 2340U}, {131072U, 24U, 31U, 2340U}, {131168U, 8U, 31U, 2532U}, {131200U, 94U, 31U, 2340U}, {131576U, 1U, 3U, 2340U}, {131580U, 1U, 31U, 2340U}, {131584U, 1U, 3U, 2340U}, {131588U, 1U, 31U, 2340U}, {131592U, 1U, 3U, 2340U}, {131596U, 4U, 31U, 2340U}, {131612U, 11U, 31U, 4095U}, {131656U, 24U, 31U, 2340U}, {131768U, 2U, 31U, 8191U}, {131780U, 1U, 31U, 8191U}, {131784U, 1U, 28U, 2340U}, {131800U, 4U, 28U, 2340U}, {131824U, 1U, 16U, 2340U}, {132096U, 1U, 31U, 2340U}, {132100U, 1U, 31U, 4095U}, {132108U, 2U, 31U, 4095U}, {132116U, 2U, 31U, 2340U}, {132124U, 2U, 31U, 4095U}, {132132U, 2U, 31U, 2340U}, {132140U, 18U, 30U, 2340U}, {132224U, 1U, 31U, 2340U}, {132352U, 1U, 31U, 2340U}, {132608U, 1U, 31U, 2340U}, {163840U, 1U, 31U, 2532U}, {163844U, 255U, 31U, 384U}, {164864U, 1U, 31U, 448U}, {164868U, 255U, 31U, 384U}, {165888U, 1U, 31U, 448U}, {165892U, 255U, 31U, 384U}, {166912U, 1U, 31U, 448U}, {166916U, 255U, 31U, 384U}, {167936U, 1U, 31U, 448U}, {167940U, 255U, 31U, 384U}, {168960U, 1U, 31U, 448U}, {168964U, 255U, 31U, 384U}, {169984U, 1U, 31U, 448U}, {169988U, 255U, 31U, 384U}, {171008U, 1U, 31U, 448U}, {171012U, 255U, 31U, 384U}, {172032U, 1U, 31U, 448U}, {172036U, 255U, 31U, 384U}, {173056U, 1U, 31U, 448U}, {173060U, 255U, 31U, 384U}, {174080U, 1U, 31U, 448U}, {174084U, 255U, 31U, 384U}, {175104U, 1U, 31U, 448U}, {175108U, 255U, 31U, 384U}, {176128U, 1U, 31U, 448U}, {176132U, 255U, 31U, 384U}, {177152U, 1U, 31U, 448U}, {177156U, 255U, 31U, 384U}, {178176U, 1U, 31U, 448U}, {178180U, 255U, 31U, 384U}, {179200U, 1U, 31U, 448U}, {179204U, 255U, 31U, 384U}, {180224U, 1U, 31U, 448U}, {180228U, 255U, 31U, 384U}, {181248U, 1U, 31U, 448U}, {181252U, 255U, 31U, 384U}, {182272U, 1U, 31U, 448U}, {182276U, 255U, 31U, 384U}, {183296U, 1U, 31U, 448U}, {183300U, 255U, 31U, 384U}, {184320U, 1U, 31U, 448U}, {184324U, 255U, 31U, 384U}, {185344U, 1U, 31U, 448U}, {185348U, 255U, 31U, 384U}, {186368U, 1U, 31U, 448U}, {186372U, 255U, 31U, 384U}, {187392U, 1U, 31U, 448U}, {187396U, 255U, 31U, 384U}, {188416U, 1U, 31U, 448U}, {188420U, 255U, 31U, 384U}, {189440U, 1U, 31U, 448U}, {189444U, 255U, 31U, 384U}, {190464U, 1U, 31U, 448U}, {190468U, 255U, 31U, 384U}, {191488U, 1U, 31U, 448U}, {191492U, 255U, 31U, 384U}, {192512U, 1U, 31U, 448U}, {192516U, 255U, 31U, 384U}, {193536U, 1U, 31U, 448U}, {193540U, 255U, 31U, 384U}, {194560U, 1U, 31U, 448U}, {194564U, 255U, 31U, 384U}, {195584U, 1U, 31U, 448U}, {195588U, 255U, 31U, 384U}, {196608U, 1U, 31U, 2532U}, {196612U, 255U, 31U, 384U}, {197632U, 1U, 31U, 448U}, {197636U, 255U, 31U, 384U}, {198656U, 1U, 31U, 448U}, {198660U, 255U, 31U, 384U}, {199680U, 1U, 31U, 448U}, {199684U, 255U, 31U, 384U}, {200704U, 1U, 31U, 448U}, {200708U, 255U, 31U, 384U}, {201728U, 1U, 31U, 448U}, {201732U, 255U, 31U, 384U}, {202752U, 1U, 31U, 448U}, {202756U, 255U, 31U, 384U}, {203776U, 1U, 31U, 448U}, {203780U, 255U, 31U, 384U}, {204800U, 1U, 31U, 448U}, {204804U, 255U, 31U, 384U}, {205824U, 1U, 31U, 448U}, {205828U, 255U, 31U, 384U}, {206848U, 1U, 31U, 448U}, {206852U, 255U, 31U, 384U}, {207872U, 1U, 31U, 448U}, {207876U, 255U, 31U, 384U}, {208896U, 1U, 31U, 448U}, {208900U, 255U, 31U, 384U}, {209920U, 1U, 31U, 448U}, {209924U, 255U, 31U, 384U}, {210944U, 1U, 31U, 448U}, {210948U, 255U, 31U, 384U}, {211968U, 1U, 31U, 448U}, {211972U, 255U, 31U, 384U}, {212992U, 1U, 31U, 448U}, {212996U, 255U, 31U, 384U}, {214016U, 1U, 31U, 448U}, {214020U, 255U, 31U, 384U}, {215040U, 1U, 31U, 448U}, {215044U, 255U, 31U, 384U}, {216064U, 1U, 31U, 448U}, {216068U, 255U, 31U, 384U}, {217088U, 1U, 31U, 448U}, {217092U, 255U, 31U, 384U}, {218112U, 1U, 31U, 448U}, {218116U, 255U, 31U, 384U}, {219136U, 1U, 31U, 448U}, {219140U, 255U, 31U, 384U}, {220160U, 1U, 31U, 448U}, {220164U, 255U, 31U, 384U}, {221184U, 1U, 31U, 448U}, {221188U, 255U, 31U, 384U}, {222208U, 1U, 31U, 448U}, {222212U, 255U, 31U, 384U}, {223232U, 1U, 31U, 448U}, {223236U, 255U, 31U, 384U}, {224256U, 1U, 31U, 448U}, {224260U, 255U, 31U, 384U}, {225280U, 1U, 31U, 448U}, {225284U, 255U, 31U, 384U}, {226304U, 1U, 31U, 448U}, {226308U, 255U, 31U, 384U}, {227328U, 1U, 31U, 448U}, {227332U, 255U, 31U, 384U}, {228352U, 1U, 31U, 448U}, {228356U, 255U, 31U, 384U}, {229376U, 1U, 31U, 448U}, {229380U, 255U, 31U, 384U}, {230400U, 1U, 31U, 448U}, {230404U, 255U, 31U, 384U}, {231424U, 1U, 31U, 448U}, {231428U, 255U, 31U, 384U}, {232448U, 1U, 31U, 448U}, {232452U, 255U, 31U, 384U}, {233472U, 1U, 31U, 448U}, {233476U, 255U, 31U, 384U}, {234496U, 1U, 31U, 448U}, {234500U, 255U, 31U, 384U}, {235520U, 1U, 31U, 448U}, {235524U, 255U, 31U, 384U}, {236544U, 1U, 31U, 448U}, {236548U, 255U, 31U, 384U}, {237568U, 1U, 31U, 448U}, {237572U, 255U, 31U, 384U}, {238592U, 1U, 31U, 448U}, {238596U, 255U, 31U, 384U}, {239616U, 1U, 31U, 448U}, {239620U, 255U, 31U, 384U}, {240640U, 1U, 31U, 448U}, {240644U, 255U, 31U, 384U}, {241664U, 1U, 31U, 448U}, {241668U, 255U, 31U, 384U}, {242688U, 1U, 31U, 448U}, {242692U, 255U, 31U, 384U}, {243712U, 1U, 31U, 448U}, {243716U, 255U, 31U, 384U}, {244736U, 1U, 31U, 448U}, {244740U, 255U, 31U, 384U}, {245760U, 1U, 31U, 448U}, {245764U, 255U, 31U, 384U}, {246784U, 1U, 31U, 448U}, {246788U, 255U, 31U, 384U}, {247808U, 1U, 31U, 448U}, {247812U, 255U, 31U, 384U}, {248832U, 1U, 31U, 448U}, {248836U, 255U, 31U, 384U}, {249856U, 1U, 31U, 448U}, {249860U, 255U, 31U, 384U}, {250880U, 1U, 31U, 448U}, {250884U, 255U, 31U, 384U}, {251904U, 1U, 31U, 448U}, {251908U, 255U, 31U, 384U}, {252928U, 1U, 31U, 448U}, {252932U, 255U, 31U, 384U}, {253952U, 1U, 31U, 448U}, {253956U, 255U, 31U, 384U}, {254976U, 1U, 31U, 448U}, {254980U, 255U, 31U, 384U}, {256000U, 1U, 31U, 448U}, {256004U, 255U, 31U, 384U}, {257024U, 1U, 31U, 448U}, {257028U, 255U, 31U, 384U}, {258048U, 1U, 31U, 448U}, {258052U, 255U, 31U, 384U}, {259072U, 1U, 31U, 448U}, {259076U, 255U, 31U, 384U}, {260096U, 1U, 31U, 448U}, {260100U, 255U, 31U, 384U}, {261120U, 1U, 31U, 448U}, {261124U, 255U, 31U, 384U}, {262144U, 85U, 31U, 2340U}, {262484U, 13U, 31U, 4095U}, {262552U, 2U, 31U, 8191U}, {262564U, 1U, 31U, 8191U}, {262568U, 8U, 30U, 2340U}, {262600U, 1U, 2U, 2340U}, {262604U, 2U, 30U, 2340U}, {262612U, 2U, 28U, 2340U}, {262656U, 4U, 31U, 2340U}, {262688U, 6U, 28U, 2340U}, {262712U, 8U, 12U, 2340U}, {262744U, 4U, 28U, 2340U}, {262760U, 2U, 24U, 2340U}, {262768U, 17U, 16U, 2340U}, {263168U, 43U, 31U, 2340U}, {263356U, 2U, 31U, 8191U}, {263368U, 1U, 31U, 8191U}, {263372U, 3U, 30U, 2340U}, {263392U, 1U, 28U, 2340U}, {263424U, 2U, 31U, 2340U}, {263440U, 2U, 31U, 2340U}, {263456U, 2U, 31U, 2340U}, {263472U, 2U, 31U, 2340U}, {263488U, 2U, 31U, 2340U}, {263504U, 10U, 28U, 2340U}, {263696U, 2U, 28U, 2340U}, {270336U, 164U, 31U, 2340U}, {271024U, 2U, 31U, 8191U}, {271036U, 1U, 31U, 8191U}, {271040U, 4U, 28U, 2340U}, {271060U, 5U, 30U, 2340U}, {271080U, 1U, 28U, 2340U}, {271360U, 49U, 31U, 2340U}, {271560U, 32U, 31U, 2340U}, {271688U, 1U, 31U, 4095U}, {271692U, 1U, 31U, 2340U}, {271696U, 1U, 31U, 4095U}, {271700U, 1U, 31U, 2340U}, {271704U, 1U, 31U, 4095U}, {271708U, 1U, 31U, 2340U}, {271720U, 2U, 31U, 2340U}, {271936U, 5U, 28U, 2340U}, {272384U, 1U, 31U, 2340U}, {327680U, 1U, 31U, 8191U}, {327684U, 19U, 31U, 2340U}, {327760U, 8U, 31U, 2364U}, {327792U, 60U, 31U, 2340U}, {328032U, 8U, 31U, 4095U}, {328064U, 20U, 31U, 2340U}, {328160U, 2U, 31U, 8191U}, {328172U, 1U, 31U, 8191U}, {328176U, 4U, 30U, 2340U}, {328192U, 1U, 31U, 2340U}, {328196U, 1U, 31U, 4095U}, {328204U, 2U, 31U, 4095U}, {328212U, 2U, 31U, 2340U}, {328220U, 1U, 31U, 4095U}, {328224U, 2U, 31U, 2340U}, {328232U, 6U, 30U, 2340U}, {328256U, 1U, 31U, 2340U}, {328320U, 1U, 31U, 2340U}, {328448U, 1U, 28U, 2340U}, {328460U, 1U, 28U, 2340U}, {328472U, 1U, 28U, 2356U}, {328476U, 1U, 28U, 2340U}, {328480U, 2U, 28U, 2356U}, {328496U, 1U, 16U, 2340U}, {335872U, 1U, 31U, 2340U}, {344064U, 1U, 31U, 2364U}, {344068U, 255U, 31U, 48U}, {345088U, 1U, 31U, 56U}, {345092U, 255U, 31U, 48U}, {346112U, 1U, 31U, 56U}, {346116U, 255U, 31U, 48U}, {347136U, 1U, 31U, 56U}, {347140U, 255U, 31U, 48U}, {348160U, 1U, 31U, 56U}, {348164U, 255U, 31U, 48U}, {349184U, 1U, 31U, 56U}, {349188U, 255U, 31U, 48U}, {350208U, 1U, 31U, 56U}, {350212U, 255U, 31U, 48U}, {351232U, 1U, 31U, 56U}, {351236U, 255U, 31U, 48U}, {352256U, 1U, 31U, 56U}, {352260U, 255U, 31U, 48U}, {353280U, 1U, 31U, 56U}, {353284U, 255U, 31U, 48U}, {354304U, 1U, 31U, 56U}, {354308U, 255U, 31U, 48U}, {355328U, 1U, 31U, 56U}, {355332U, 255U, 31U, 48U}, {356352U, 1U, 31U, 56U}, {356356U, 255U, 31U, 48U}, {360448U, 1U, 31U, 2356U}, {360452U, 8191U, 3U, 48U}, {393216U, 26U, 31U, 2340U}, {393320U, 8U, 3U, 2340U}, {393352U, 2U, 31U, 2340U}, {393360U, 1U, 31U, 4095U}, {393364U, 9U, 31U, 2340U}, {393400U, 9U, 3U, 2340U}, {393436U, 1U, 31U, 2340U}, {393440U, 5U, 3U, 2340U}, {393460U, 1U, 7U, 2340U}, {393464U, 1U, 3U, 2340U}, {393468U, 8U, 31U, 2340U}, {393516U, 2U, 31U, 8191U}, {393528U, 1U, 31U, 8191U}, {393532U, 24U, 2U, 2340U}, {393628U, 2U, 28U, 2340U}, {393644U, 18U, 28U, 2340U}, {393728U, 1U, 31U, 2925U}, {393732U, 2U, 31U, 585U}, {393744U, 13U, 28U, 2340U}, {393796U, 16U, 16U, 2340U}, {397312U, 1U, 31U, 2925U}, {397316U, 511U, 31U, 585U}, {399360U, 512U, 24U, 585U}, {458752U, 8U, 31U, 2925U}, {458784U, 8184U, 31U, 585U}, {491520U, 8192U, 24U, 585U}, {544768U, 3U, 31U, 4096U}, {544796U, 7U, 31U, 4096U}, {544840U, 1U, 31U, 4096U}, {545280U, 32U, 31U, 4096U}, {655360U, 16384U, 3U, 4096U}, {720896U, 16384U, 2U, 4096U}, {790528U, 7U, 31U, 2340U}, {790572U, 2U, 31U, 8191U}, {790584U, 1U, 31U, 8191U}, {790588U, 2U, 28U, 2340U}, {792576U, 2U, 31U, 2340U}, {794624U, 164U, 31U, 2340U}, {795312U, 2U, 31U, 8191U}, {795324U, 1U, 31U, 8191U}, {795328U, 5U, 28U, 2340U}, {795352U, 4U, 28U, 2340U}, {795648U, 49U, 31U, 2340U}, {795848U, 32U, 31U, 2340U}, {795976U, 1U, 31U, 4095U}, {795980U, 1U, 31U, 2340U}, {795984U, 1U, 31U, 4095U}, {795988U, 1U, 31U, 2340U}, {795992U, 1U, 31U, 4095U}, {795996U, 1U, 31U, 2340U}, {796008U, 2U, 31U, 2340U}, {796160U, 1U, 31U, 2340U}, {802816U, 165U, 31U, 2340U}, {803508U, 2U, 31U, 8191U}, {803520U, 1U, 31U, 8191U}, {803544U, 2U, 28U, 2340U}, {803552U, 7U, 30U, 2340U}, {803580U, 1U, 28U, 2340U}, {803840U, 51U, 31U, 2340U}, {804048U, 32U, 31U, 2340U}, {804176U, 1U, 31U, 4095U}, {804180U, 1U, 31U, 2340U}, {804184U, 1U, 31U, 4095U}, {804188U, 1U, 31U, 2340U}, {804192U, 1U, 31U, 4095U}, {804196U, 1U, 31U, 2340U}, {804208U, 2U, 31U, 2340U}, {804216U, 5U, 28U, 2340U}, {804352U, 1U, 31U, 2340U}, {851968U, 19U, 31U, 2340U}, {852044U, 8U, 31U, 6439U}, {852076U, 64U, 31U, 2340U}, {852332U, 8U, 31U, 4095U}, {852364U, 19U, 31U, 2340U}, {852456U, 2U, 31U, 8191U}, {852468U, 1U, 31U, 8191U}, {852476U, 1U, 28U, 2340U}, {852480U, 1U, 31U, 2340U}, {852484U, 1U, 31U, 4095U}, {852492U, 3U, 31U, 4095U}, {852504U, 4U, 31U, 2340U}, {852520U, 18U, 30U, 2340U}, {852608U, 1U, 31U, 2340U}, {852736U, 1U, 31U, 2340U}, {852992U, 1U, 31U, 2340U}, {854040U, 1U, 16U, 2340U}, {868352U, 1U, 31U, 6439U}, {868356U, 255U, 31U, 6U}, {869376U, 1U, 31U, 4103U}, {869380U, 255U, 31U, 6U}, {870400U, 1U, 31U, 4103U}, {870404U, 255U, 31U, 6U}, {871424U, 1U, 31U, 4103U}, {871428U, 255U, 31U, 6U}, {872448U, 1U, 31U, 4103U}, {872452U, 255U, 31U, 6U}, {873472U, 1U, 31U, 4103U}, {873476U, 255U, 31U, 6U}, {874496U, 1U, 31U, 4103U}, {874500U, 255U, 31U, 6U}, {875520U, 1U, 31U, 4103U}, {875524U, 255U, 31U, 6U}, {876544U, 1U, 31U, 4103U}, {876548U, 255U, 31U, 6U}, {877568U, 1U, 31U, 4103U}, {877572U, 255U, 31U, 6U}, {884736U, 1U, 31U, 6439U}, {884740U, 255U, 31U, 6U}, {885760U, 1U, 31U, 4103U}, {885764U, 255U, 31U, 6U}, {886784U, 1U, 31U, 4103U}, {886788U, 255U, 31U, 6U}, {887808U, 1U, 31U, 4103U}, {887812U, 255U, 31U, 6U}, {888832U, 1U, 31U, 4103U}, {888836U, 255U, 31U, 6U}, {889856U, 1U, 31U, 4103U}, {889860U, 255U, 31U, 6U}, {890880U, 1U, 31U, 4103U}, {890884U, 255U, 31U, 6U}, {891904U, 1U, 31U, 4103U}, {891908U, 255U, 31U, 6U}, {892928U, 1U, 31U, 4103U}, {892932U, 255U, 31U, 6U}, {893952U, 1U, 31U, 4103U}, {893956U, 255U, 31U, 6U}, {894976U, 1U, 31U, 4103U}, {894980U, 255U, 31U, 6U}, {896000U, 1U, 31U, 4103U}, {896004U, 255U, 31U, 6U}, {897024U, 1U, 31U, 4103U}, {897028U, 255U, 31U, 6U}, {898048U, 1U, 31U, 4103U}, {898052U, 255U, 31U, 6U}, {899072U, 1U, 31U, 4103U}, {899076U, 255U, 31U, 6U}, {900096U, 1U, 31U, 4103U}, {900100U, 255U, 31U, 6U}, {901120U, 1U, 31U, 4103U}, {901124U, 255U, 31U, 6U}, {902144U, 1U, 31U, 4103U}, {902148U, 255U, 31U, 6U}, {903168U, 1U, 31U, 4103U}, {903172U, 255U, 31U, 6U}, {904192U, 1U, 31U, 4103U}, {904196U, 255U, 31U, 6U}, {905216U, 1U, 31U, 4103U}, {905220U, 255U, 31U, 6U}, {906240U, 1U, 31U, 4103U}, {906244U, 255U, 31U, 6U}, {907264U, 1U, 31U, 4103U}, {907268U, 255U, 31U, 6U}, {908288U, 1U, 31U, 4103U}, {908292U, 255U, 31U, 6U}, {909312U, 1U, 31U, 4103U}, {909316U, 255U, 31U, 6U}, {910336U, 1U, 31U, 4103U}, {910340U, 255U, 31U, 6U}, {911360U, 1U, 31U, 4103U}, {911364U, 255U, 31U, 6U}, {912384U, 1U, 31U, 4103U}, {912388U, 255U, 31U, 6U}, {913408U, 1U, 31U, 4103U}, {913412U, 255U, 31U, 6U}, {914432U, 1U, 31U, 4103U}, {914436U, 255U, 31U, 6U}, {915456U, 1U, 31U, 4103U}, {915460U, 255U, 31U, 6U}, {916480U, 1U, 31U, 4103U}, {916484U, 255U, 31U, 6U}, {917504U, 21U, 31U, 2340U}, {917588U, 8U, 31U, 3876U}, {917620U, 49U, 31U, 2340U}, {917816U, 1U, 3U, 2340U}, {917820U, 6U, 31U, 2340U}, {917844U, 8U, 31U, 4095U}, {917876U, 21U, 31U, 2340U}, {917976U, 2U, 31U, 8191U}, {917988U, 1U, 31U, 8191U}, {918004U, 1U, 4U, 2340U}, {918008U, 1U, 28U, 2340U}, {918016U, 1U, 31U, 2340U}, {918020U, 1U, 31U, 4095U}, {918028U, 2U, 31U, 4095U}, {918036U, 2U, 31U, 2340U}, {918044U, 2U, 31U, 4095U}, {918052U, 2U, 31U, 2340U}, {918060U, 18U, 30U, 2340U}, {918144U, 1U, 31U, 2340U}, {918272U, 1U, 31U, 2340U}, {918528U, 1U, 16U, 2340U}, {921600U, 1U, 31U, 2340U}, {925696U, 1U, 31U, 3876U}, {925700U, 255U, 31U, 3072U}, {926720U, 1U, 31U, 3584U}, {926724U, 255U, 31U, 3072U}, {927744U, 1U, 31U, 3584U}, {927748U, 255U, 31U, 3072U}, {928768U, 1U, 31U, 3584U}, {928772U, 255U, 31U, 3072U}, {929792U, 1U, 31U, 3584U}, {929796U, 255U, 31U, 3072U}, {930816U, 1U, 31U, 3584U}, {930820U, 255U, 31U, 3072U}, {931840U, 1U, 31U, 3584U}, {931844U, 255U, 31U, 3072U}, {932864U, 1U, 31U, 3584U}, {932868U, 255U, 31U, 3072U}, {983040U, 1U, 31U, 3876U}, {983044U, 255U, 31U, 3072U}, {984064U, 1U, 31U, 3584U}, {984068U, 255U, 31U, 3072U}, {985088U, 1U, 31U, 3584U}, {985092U, 255U, 31U, 3072U}, {986112U, 1U, 31U, 3584U}, {986116U, 255U, 31U, 3072U}, {987136U, 1U, 31U, 3584U}, {987140U, 255U, 31U, 3072U}, {988160U, 1U, 31U, 3584U}, {988164U, 255U, 31U, 3072U}, {989184U, 1U, 31U, 3584U}, {989188U, 255U, 31U, 3072U}, {990208U, 1U, 31U, 3584U}, {990212U, 255U, 31U, 3072U}, {991232U, 1U, 31U, 3584U}, {991236U, 255U, 31U, 3072U}, {992256U, 1U, 31U, 3584U}, {992260U, 255U, 31U, 3072U}, {993280U, 1U, 31U, 3584U}, {993284U, 255U, 31U, 3072U}, {994304U, 1U, 31U, 3584U}, {994308U, 255U, 31U, 3072U}, {995328U, 1U, 31U, 3584U}, {995332U, 255U, 31U, 3072U}, {996352U, 1U, 31U, 3584U}, {996356U, 255U, 31U, 3072U}, {997376U, 1U, 31U, 3584U}, {997380U, 255U, 31U, 3072U}, {998400U, 1U, 31U, 3584U}, {998404U, 255U, 31U, 3072U}, {999424U, 1U, 31U, 3584U}, {999428U, 255U, 31U, 3072U}, {1000448U, 1U, 31U, 3584U}, {1000452U, 255U, 31U, 3072U}, {1001472U, 1U, 31U, 3584U}, {1001476U, 255U, 31U, 3072U}, {1002496U, 1U, 31U, 3584U}, {1002500U, 255U, 31U, 3072U}, {1003520U, 1U, 31U, 3584U}, {1003524U, 255U, 31U, 3072U}, {1004544U, 1U, 31U, 3584U}, {1004548U, 255U, 31U, 3072U}, {1005568U, 1U, 31U, 3584U}, {1005572U, 255U, 31U, 3072U}, {1006592U, 1U, 31U, 3584U}, {1006596U, 255U, 31U, 3072U}, {1007616U, 1U, 31U, 3584U}, {1007620U, 255U, 31U, 3072U}, {1008640U, 1U, 31U, 3584U}, {1008644U, 255U, 31U, 3072U}, {1009664U, 1U, 31U, 3584U}, {1009668U, 255U, 31U, 3072U}, {1010688U, 1U, 31U, 3584U}, {1010692U, 255U, 31U, 3072U}, {1011712U, 1U, 31U, 3584U}, {1011716U, 255U, 31U, 3072U}, {1012736U, 1U, 31U, 3584U}, {1012740U, 255U, 31U, 3072U}, {1013760U, 1U, 31U, 3584U}, {1013764U, 255U, 31U, 3072U}, {1014784U, 1U, 31U, 3584U}, {1014788U, 255U, 31U, 3072U}, {1015808U, 1U, 31U, 3584U}, {1015812U, 255U, 31U, 3072U}, {1016832U, 1U, 31U, 3584U}, {1016836U, 255U, 31U, 3072U}, {1017856U, 1U, 31U, 3584U}, {1017860U, 255U, 31U, 3072U}, {1018880U, 1U, 31U, 3584U}, {1018884U, 255U, 31U, 3072U}, {1019904U, 1U, 31U, 3584U}, {1019908U, 255U, 31U, 3072U}, {1020928U, 1U, 31U, 3584U}, {1020932U, 255U, 31U, 3072U}, {1021952U, 1U, 31U, 3584U}, {1021956U, 255U, 31U, 3072U}, {1022976U, 1U, 31U, 3584U}, {1022980U, 255U, 31U, 3072U}, {1024000U, 1U, 31U, 3584U}, {1024004U, 255U, 31U, 3072U}, {1025024U, 1U, 31U, 3584U}, {1025028U, 255U, 31U, 3072U}, {1026048U, 1U, 31U, 3584U}, {1026052U, 255U, 31U, 3072U}, {1027072U, 1U, 31U, 3584U}, {1027076U, 255U, 31U, 3072U}, {1028096U, 1U, 31U, 3584U}, {1028100U, 255U, 31U, 3072U}, {1029120U, 1U, 31U, 3584U}, {1029124U, 255U, 31U, 3072U}, {1030144U, 1U, 31U, 3584U}, {1030148U, 255U, 31U, 3072U}, {1031168U, 1U, 31U, 3584U}, {1031172U, 255U, 31U, 3072U}, {1032192U, 1U, 31U, 3584U}, {1032196U, 255U, 31U, 3072U}, {1033216U, 1U, 31U, 3584U}, {1033220U, 255U, 31U, 3072U}, {1034240U, 1U, 31U, 3584U}, {1034244U, 255U, 31U, 3072U}, {1035264U, 1U, 31U, 3584U}, {1035268U, 255U, 31U, 3072U}, {1036288U, 1U, 31U, 3584U}, {1036292U, 255U, 31U, 3072U}, {1037312U, 1U, 31U, 3584U}, {1037316U, 255U, 31U, 3072U}, {1038336U, 1U, 31U, 3584U}, {1038340U, 255U, 31U, 3072U}, {1039360U, 1U, 31U, 3584U}, {1039364U, 255U, 31U, 3072U}, {1040384U, 1U, 31U, 3584U}, {1040388U, 255U, 31U, 3072U}, {1041408U, 1U, 31U, 3584U}, {1041412U, 255U, 31U, 3072U}, {1042432U, 1U, 31U, 3584U}, {1042436U, 255U, 31U, 3072U}, {1043456U, 1U, 31U, 3584U}, {1043460U, 255U, 31U, 3072U}, {1044480U, 1U, 31U, 3584U}, {1044484U, 255U, 31U, 3072U}, {1045504U, 1U, 31U, 3584U}, {1045508U, 255U, 31U, 3072U}, {1046528U, 1U, 31U, 3584U}, {1046532U, 255U, 31U, 3072U}, {1047552U, 1U, 31U, 3584U}, {1047556U, 255U, 31U, 3072U}, {1052672U, 5U, 31U, 2340U}, {1052692U, 1U, 31U, 4095U}, {1052696U, 6U, 31U, 2340U}, {1052736U, 2U, 31U, 8191U}, {1052748U, 1U, 31U, 8191U}, {1052752U, 1U, 30U, 2340U}, {1052756U, 3U, 28U, 2340U}, {1052928U, 1U, 31U, 2340U}, {1054720U, 8U, 31U, 2340U}, {1056768U, 18U, 31U, 2340U}, {1056856U, 2U, 31U, 8191U}, {1056868U, 1U, 31U, 8191U}, {1056872U, 6U, 28U, 2340U}, {1056896U, 16U, 31U, 4095U}, {1056960U, 1U, 31U, 2340U}, {1056968U, 8U, 2U, 2340U}, {1057000U, 9U, 28U, 2340U}, {1057792U, 1U, 31U, 2340U}, {1060864U, 1U, 31U, 2340U}, {1060868U, 2U, 31U, 4095U}, {1060876U, 23U, 31U, 2340U}, {1061000U, 2U, 31U, 8191U}, {1061012U, 1U, 31U, 8191U}, {1061016U, 1U, 30U, 2340U}, {1061020U, 2U, 30U, 4095U}, {1061028U, 2U, 30U, 2340U}, {1061036U, 2U, 28U, 2340U}, {1061044U, 1U, 4U, 2340U}, {1061048U, 2U, 28U, 4095U}, {1061056U, 3U, 28U, 2340U}, {1061068U, 1U, 28U, 4095U}, {1061072U, 1U, 28U, 2340U}, {1061080U, 2U, 28U, 2340U}, {1061088U, 1U, 28U, 4095U}, {1061092U, 5U, 28U, 2340U}, {1061888U, 136U, 28U, 8191U}, {1062912U, 8U, 31U, 2340U}, {1064960U, 1U, 31U, 2340U}, {1064964U, 1U, 31U, 4095U}, {1064968U, 4U, 31U, 2340U}, {1064984U, 1U, 31U, 4095U}, {1064988U, 1U, 31U, 2340U}, {1064992U, 1U, 31U, 4095U}, {1064996U, 6U, 31U, 2340U}, {1065020U, 1U, 31U, 4095U}, {1065024U, 47U, 31U, 2340U}, {1065228U, 2U, 31U, 8191U}, {1065240U, 1U, 31U, 8191U}, {1065244U, 16U, 28U, 2340U}, {1065472U, 17U, 31U, 2340U}, {1065984U, 1U, 31U, 8191U}, {1065988U, 63U, 31U, 4095U}, {1066240U, 192U, 31U, 3510U}, {1067008U, 1U, 31U, 8191U}, {1067012U, 63U, 31U, 4095U}, {1067264U, 192U, 31U, 3510U}, {1069056U, 4U, 31U, 8191U}, {1069072U, 252U, 31U, 4095U}, {1070080U, 768U, 31U, 3510U}, {1077248U, 7U, 28U, 2340U}, {1077276U, 1U, 24U, 2340U}, {1081344U, 33U, 3U, 2340U}, {1081516U, 5U, 2U, 2340U}, {1081600U, 5U, 3U, 2340U}, {1081632U, 5U, 3U, 2340U}, {1081856U, 74U, 3U, 2340U}, {1082368U, 74U, 3U, 2340U}, {1083392U, 152U, 3U, 2340U}, {1114112U, 111U, 28U, 2340U}, {1114572U, 2U, 28U, 8191U}, {1114584U, 1U, 28U, 8191U}, {1114588U, 1U, 24U, 2340U}, {1114624U, 4U, 28U, 2340U}, {1179648U, 92U, 31U, 2340U}, {1180016U, 2U, 3U, 2340U}, {1180024U, 14U, 31U, 2340U}, {1180080U, 2U, 31U, 4095U}, {1180088U, 93U, 31U, 2340U}, {1180460U, 1U, 31U, 4095U}, {1180464U, 15U, 31U, 2340U}, {1180524U, 3U, 31U, 4095U}, {1180536U, 36U, 31U, 2340U}, {1180680U, 2U, 31U, 4095U}, {1180688U, 1U, 31U, 2340U}, {1180692U, 15U, 31U, 4095U}, {1180752U, 10U, 31U, 2340U}, {1180792U, 2U, 31U, 4095U}, {1180800U, 43U, 31U, 2340U}, {1180972U, 1U, 31U, 4095U}, {1180976U, 5U, 31U, 2340U}, {1180996U, 4U, 3U, 2340U}, {1181012U, 4U, 31U, 2340U}, {1181028U, 2U, 31U, 4095U}, {1181052U, 2U, 31U, 8191U}, {1181064U, 3U, 31U, 8191U}, {1181080U, 1U, 31U, 8191U}, {1181084U, 22U, 30U, 2340U}, {1181172U, 1U, 6U, 2340U}, {1181176U, 4U, 28U, 2340U}, {1181208U, 1U, 28U, 2340U}, {1181212U, 31U, 30U, 2340U}, {1181336U, 3U, 28U, 2340U}, {1181348U, 1U, 4U, 2340U}, {1181352U, 1U, 28U, 2340U}, {1181360U, 38U, 28U, 2340U}, {1181512U, 1U, 28U, 4095U}, {1181516U, 11U, 28U, 2340U}, {1181560U, 2U, 28U, 4095U}, {1181568U, 23U, 28U, 2340U}, {1181660U, 1U, 4U, 2340U}, {1181692U, 1U, 28U, 2340U}, {1181708U, 2U, 31U, 4095U}, {1181716U, 1U, 31U, 2340U}, {1181720U, 1U, 31U, 4095U}, {1181724U, 1U, 31U, 2340U}, {1181728U, 1U, 31U, 4095U}, {1181732U, 1U, 31U, 2340U}, {1181736U, 1U, 31U, 4095U}, {1181740U, 1U, 31U, 2340U}, {1181744U, 1U, 31U, 4095U}, {1181748U, 1U, 31U, 2340U}, {1181752U, 1U, 31U, 4095U}, {1181756U, 1U, 31U, 2340U}, {1181760U, 1U, 31U, 4095U}, {1181764U, 1U, 31U, 2340U}, {1181768U, 1U, 31U, 4095U}, {1181772U, 1U, 31U, 2340U}, {1181776U, 1U, 31U, 4095U}, {1181780U, 1U, 31U, 2340U}, {1181784U, 1U, 31U, 4095U}, {1181788U, 1U, 31U, 2340U}, {1181792U, 1U, 31U, 4095U}, {1181796U, 1U, 31U, 2340U}, {1181800U, 1U, 31U, 4095U}, {1181804U, 1U, 31U, 2340U}, {1181808U, 1U, 31U, 4095U}, {1181812U, 1U, 31U, 2340U}, {1181816U, 1U, 31U, 4095U}, {1181820U, 1U, 31U, 2340U}, {1181824U, 1U, 31U, 4095U}, {1181828U, 1U, 31U, 2340U}, {1181832U, 1U, 31U, 4095U}, {1181836U, 1U, 31U, 2340U}, {1181840U, 1U, 31U, 4095U}, {1181844U, 1U, 31U, 2340U}, {1181848U, 1U, 31U, 4095U}, {1181852U, 1U, 31U, 2340U}, {1181856U, 1U, 31U, 4095U}, {1181860U, 1U, 31U, 2340U}, {1181864U, 1U, 31U, 4095U}, {1181868U, 1U, 31U, 2340U}, {1181872U, 1U, 31U, 4095U}, {1181876U, 1U, 31U, 2340U}, {1181880U, 1U, 31U, 4095U}, {1181884U, 1U, 31U, 2340U}, {1181888U, 1U, 31U, 4095U}, {1181892U, 1U, 31U, 2340U}, {1181896U, 1U, 31U, 4095U}, {1181900U, 1U, 31U, 2340U}, {1181904U, 1U, 31U, 4095U}, {1181908U, 1U, 31U, 2340U}, {1181912U, 1U, 31U, 4095U}, {1181916U, 1U, 31U, 2340U}, {1181920U, 1U, 31U, 4095U}, {1181924U, 1U, 31U, 2340U}, {1181928U, 1U, 31U, 4095U}, {1181932U, 1U, 31U, 2340U}, {1181936U, 1U, 31U, 4095U}, {1181940U, 1U, 31U, 2340U}, {1181944U, 1U, 31U, 4095U}, {1181948U, 1U, 31U, 2340U}, {1181952U, 1U, 31U, 4095U}, {1181956U, 1U, 31U, 2340U}, {1181960U, 1U, 31U, 4095U}, {1181964U, 1U, 31U, 2340U}, {1181968U, 7U, 28U, 2340U}, {1182000U, 9U, 28U, 2340U}, {1182044U, 37U, 24U, 2340U}, {1182208U, 2U, 7U, 2340U}, {1182464U, 1U, 24U, 2340U}, {1187840U, 2U, 31U, 2340U}, {1187848U, 2046U, 1U, 2340U}, {1212416U, 6144U, 30U, 2340U}, {1245184U, 1U, 28U, 8191U}, {1245188U, 11U, 28U, 2340U}, {1245232U, 1U, 28U, 4095U}, {1245236U, 6U, 28U, 2340U}, {1245260U, 3U, 28U, 4095U}, {1245272U, 3U, 28U, 2340U}, {1245284U, 2U, 28U, 4095U}, {1245292U, 8U, 28U, 2340U}, {1245340U, 2U, 28U, 8191U}, {1245352U, 1U, 28U, 8191U}, {1245440U, 12U, 28U, 2340U}, {1245488U, 1U, 28U, 4095U}, {1245492U, 14U, 28U, 2340U}, {1245548U, 1U, 28U, 4095U}, {1245552U, 1U, 28U, 2340U}, {1245568U, 1U, 28U, 2340U}, {1245696U, 1U, 28U, 2340U}, {1245824U, 1U, 28U, 2340U}, {1245952U, 1U, 28U, 4095U}, {1245956U, 4U, 28U, 2340U}, {1246080U, 1U, 28U, 2340U}, {1246208U, 1U, 28U, 2340U}, {1246336U, 1U, 28U, 4095U}, {1246340U, 4U, 28U, 2340U}, {1247232U, 72U, 28U, 2340U}, {1249280U, 136U, 28U, 2340U}, {1253376U, 148U, 28U, 2340U}, {1261568U, 544U, 28U, 2340U}, {1310720U, 1U, 31U, 2340U}, {1310724U, 9U, 15U, 2340U}, {1310760U, 8U, 31U, 2340U}, {1310792U, 5U, 15U, 2340U}, {1310812U, 2U, 15U, 4095U}, {1310820U, 3U, 15U, 2340U}, {1310832U, 1U, 31U, 2340U}, {1310836U, 10U, 15U, 2340U}, {1310876U, 1U, 31U, 2340U}, {1310880U, 5U, 15U, 2340U}, {1310900U, 7U, 31U, 2340U}, {1310928U, 2U, 15U, 4095U}, {1310936U, 2U, 15U, 2340U}, {1310944U, 1U, 15U, 4095U}, {1310948U, 5U, 15U, 2340U}, {1310968U, 2U, 31U, 2340U}, {1310976U, 5U, 3U, 2340U}, {1310996U, 5U, 15U, 2340U}, {1311016U, 7U, 31U, 2340U}, {1311044U, 9U, 15U, 2340U}, {1311080U, 8U, 31U, 2340U}, {1311112U, 3U, 15U, 2340U}, {1311124U, 13U, 31U, 2340U}, {1311192U, 2U, 31U, 8191U}, {1311204U, 1U, 31U, 8191U}, {1311232U, 6U, 15U, 4095U}, {1311456U, 2U, 12U, 2340U}, {1311464U, 2U, 28U, 2340U}, {1311472U, 9U, 12U, 2340U}, {1311508U, 9U, 16U, 2340U}, {1311544U, 7U, 16U, 4095U}, {1311572U, 7U, 16U, 2340U}, {1311600U, 7U, 16U, 4095U}, {1311628U, 14U, 16U, 2340U}, {1311920U, 14U, 16U, 2340U}, {1425408U, 2U, 30U, 2340U}, {1425416U, 5U, 2U, 2340U}, {1425440U, 8U, 28U, 2340U}, {1425472U, 1U, 12U, 2340U}, {1425476U, 2U, 28U, 2340U}, {1425484U, 8U, 12U, 2340U}, {1425516U, 8U, 28U, 2340U}, {1425552U, 13U, 28U, 2340U}, {1425608U, 24U, 28U, 2340U}, {1425704U, 2U, 12U, 2340U}, {1425712U, 1U, 28U, 2340U}, {1425720U, 6U, 28U, 2340U}, {1425744U, 2U, 24U, 2340U}, {1425752U, 2U, 8U, 2340U}, {1425760U, 23U, 16U, 2340U}, {1425852U, 6U, 16U, 4095U}, {1425876U, 23U, 16U, 2340U}, {1425968U, 7U, 16U, 4095U}, {1425996U, 90U, 16U, 2340U}, {1441796U, 6U, 24U, 2340U}, {1441852U, 1U, 16U, 2340U}, {1441856U, 6U, 24U, 2340U}, {1441884U, 6U, 24U, 2340U}, {1441908U, 1U, 16U, 2340U}, {1441912U, 2U, 24U, 2340U}, {1442560U, 8U, 24U, 2340U}, {1442608U, 6U, 24U, 2340U}, {1442820U, 6U, 24U, 2340U}, {1442876U, 1U, 16U, 2340U}, {1442880U, 6U, 24U, 2340U}, {1442908U, 6U, 24U, 2340U}, {1442932U, 1U, 16U, 2340U}, {1442936U, 2U, 24U, 2340U}, {1443584U, 8U, 24U, 2340U}, {1443632U, 6U, 24U, 2340U}, {1445888U, 7U, 31U, 2340U}, {1445932U, 2U, 31U, 8191U}, {1445944U, 1U, 31U, 8191U}, {1445948U, 2U, 28U, 2340U}, {1447936U, 2U, 31U, 2340U}, {1449984U, 54U, 24U, 2340U}, {1450496U, 60U, 24U, 2340U}, {1451008U, 54U, 24U, 2340U}, {1451520U, 60U, 24U, 2340U}, {1452032U, 54U, 24U, 2340U}, {1452544U, 60U, 24U, 2340U}, {1453056U, 54U, 24U, 2340U}, {1453568U, 60U, 24U, 2340U}, {1454080U, 1U, 24U, 2340U}, {1454088U, 1U, 24U, 2340U}, {1454096U, 1U, 24U, 2340U}, {1454104U, 1U, 24U, 2340U}, {1454112U, 5U, 24U, 2340U}, {1454136U, 3U, 24U, 2340U}, {1454152U, 3U, 24U, 2340U}, {1454168U, 1U, 24U, 2340U}, {1454176U, 1U, 24U, 2340U}, {1454184U, 1U, 24U, 2340U}, {1454192U, 3U, 24U, 2340U}, {1454208U, 1U, 24U, 2340U}, {1454216U, 3U, 24U, 2340U}, {1454232U, 1U, 24U, 2340U}, {1454240U, 1U, 24U, 2340U}, {1454248U, 1U, 24U, 2340U}, {1454256U, 2U, 16U, 2340U}, {1454272U, 1U, 24U, 2340U}, {1454280U, 1U, 24U, 2340U}, {1454288U, 1U, 24U, 2340U}, {1454296U, 1U, 24U, 2340U}, {1454304U, 2U, 24U, 2340U}, {1454352U, 1U, 24U, 2340U}, {1454368U, 2U, 24U, 2340U}, {1455136U, 4U, 24U, 2340U}, {1455160U, 2U, 24U, 2340U}, {1455240U, 2U, 24U, 2340U}, {1455392U, 2U, 24U, 2340U}, {1456128U, 1U, 24U, 2340U}, {1456136U, 1U, 24U, 2340U}, {1456144U, 1U, 24U, 2340U}, {1456152U, 1U, 24U, 2340U}, {1456160U, 5U, 24U, 2340U}, {1456184U, 3U, 24U, 2340U}, {1456200U, 3U, 24U, 2340U}, {1456216U, 1U, 24U, 2340U}, {1456224U, 1U, 24U, 2340U}, {1456232U, 1U, 24U, 2340U}, {1456240U, 3U, 24U, 2340U}, {1456256U, 1U, 24U, 2340U}, {1456264U, 3U, 24U, 2340U}, {1456280U, 1U, 24U, 2340U}, {1456288U, 1U, 24U, 2340U}, {1456296U, 1U, 24U, 2340U}, {1456304U, 2U, 16U, 2340U}, {1456320U, 1U, 24U, 2340U}, {1456328U, 1U, 24U, 2340U}, {1456336U, 1U, 24U, 2340U}, {1456344U, 1U, 24U, 2340U}, {1456352U, 2U, 24U, 2340U}, {1456400U, 1U, 24U, 2340U}, {1456416U, 2U, 24U, 2340U}, {1457184U, 4U, 24U, 2340U}, {1457208U, 2U, 24U, 2340U}, {1457288U, 2U, 24U, 2340U}, {1457440U, 2U, 24U, 2340U}, {1458176U, 5U, 31U, 2340U}, {1458196U, 2U, 31U, 4095U}, {1458204U, 53U, 31U, 2340U}, {1458432U, 2U, 31U, 8191U}, {1458444U, 1U, 31U, 8191U}, {1458448U, 2U, 30U, 2340U}, {1458456U, 15U, 28U, 2340U}, {1458688U, 1U, 31U, 2340U}, {1458696U, 1U, 31U, 2340U}, {1458704U, 1U, 31U, 2340U}, {1458712U, 1U, 31U, 2340U}, {1458720U, 1U, 31U, 2340U}, {1458728U, 1U, 31U, 2340U}, {1458736U, 1U, 31U, 2340U}, {1458744U, 1U, 31U, 2340U}, {1458752U, 1U, 31U, 2340U}, {1458760U, 1U, 31U, 2340U}, {1458768U, 1U, 31U, 2340U}, {1458776U, 1U, 31U, 2340U}, {1458784U, 1U, 31U, 2340U}, {1458800U, 2U, 31U, 2340U}, {1458816U, 2U, 31U, 2340U}, {1460224U, 2U, 31U, 2340U}, {1462272U, 2U, 31U, 2340U}, {1466368U, 164U, 31U, 2340U}, {1467056U, 2U, 31U, 8191U}, {1467068U, 1U, 31U, 8191U}, {1467084U, 7U, 28U, 2340U}, {1467392U, 49U, 31U, 2340U}, {1467592U, 32U, 31U, 2340U}, {1467720U, 1U, 31U, 4095U}, {1467724U, 1U, 31U, 2340U}, {1467728U, 1U, 31U, 4095U}, {1467732U, 1U, 31U, 2340U}, {1467736U, 1U, 31U, 4095U}, {1467740U, 1U, 31U, 2340U}, {1467752U, 2U, 31U, 2340U}, {1467760U, 5U, 28U, 2340U}, {1468416U, 1U, 31U, 2340U}, {1474560U, 1U, 31U, 4095U}, {1474564U, 1U, 31U, 2340U}, {1474568U, 1U, 31U, 4095U}, {1474572U, 1U, 31U, 2340U}, {1474576U, 1U, 31U, 4095U}, {1474580U, 1U, 31U, 2340U}, {1474584U, 1U, 31U, 4095U}, {1474588U, 3U, 31U, 2340U}, {1474600U, 2U, 31U, 4095U}, {1474608U, 10U, 31U, 2340U}, {1474648U, 9U, 31U, 4095U}, {1474684U, 106U, 31U, 2340U}, {1475108U, 2U, 3U, 2340U}, {1475116U, 3U, 31U, 2340U}, {1475128U, 1U, 31U, 4095U}, {1475132U, 25U, 31U, 2340U}, {1475232U, 12U, 3U, 2340U}, {1475280U, 7U, 31U, 4095U}, {1475308U, 5U, 31U, 2340U}, {1475328U, 2U, 3U, 4095U}, {1475336U, 65U, 31U, 4095U}, {1475596U, 1U, 31U, 2340U}, {1475600U, 2U, 31U, 4095U}, {1475608U, 2U, 3U, 2340U}, {1475616U, 6U, 31U, 2340U}, {1475656U, 2U, 31U, 8191U}, {1475668U, 1U, 31U, 8191U}, {1476608U, 19U, 31U, 2340U}, {1476864U, 1U, 31U, 2340U}, {1477120U, 128U, 31U, 4095U}, {1482752U, 1536U, 31U, 2340U}, {1490944U, 1536U, 31U, 2340U}, {1499136U, 16U, 2U, 2340U}, {1499200U, 8U, 28U, 2340U}, {1499392U, 1U, 2U, 2340U}, {1499648U, 2U, 2U, 4095U}, {1500160U, 1U, 2U, 2340U}, {1500164U, 2U, 2U, 4095U}, {1500172U, 94U, 2U, 2340U}, {1500548U, 64U, 2U, 4095U}, {1500804U, 2U, 30U, 4095U}, {1500812U, 4U, 2U, 4095U}, {1500828U, 8U, 2U, 2340U}, {1500860U, 4U, 30U, 2340U}, {1500876U, 4U, 2U, 2340U}, {1500896U, 2U, 28U, 2340U}, {1500904U, 5U, 12U, 2340U}, {1500924U, 4U, 28U, 4095U}, {1500940U, 1U, 28U, 2340U}, {1501032U, 17U, 28U, 2340U}, {1501100U, 12U, 16U, 4095U}, {1507328U, 24U, 31U, 2340U}, {1507424U, 4U, 3U, 2340U}, {1507440U, 13U, 31U, 2340U}, {1507492U, 1U, 31U, 4095U}, {1507496U, 1U, 31U, 2340U}, {1507500U, 2U, 31U, 4095U}, {1507508U, 3U, 31U, 2340U}, {1507520U, 1U, 31U, 4095U}, {1507524U, 44U, 31U, 2340U}, {1507716U, 2U, 31U, 8191U}, {1507728U, 1U, 31U, 8191U}, {1507732U, 11U, 28U, 2340U}, {1507780U, 1U, 28U, 2340U}, {1507788U, 7U, 28U, 2340U}, {1507816U, 1U, 24U, 2340U}, {1507820U, 1U, 28U, 2340U}, {1507828U, 1U, 28U, 2340U}, {1507840U, 4U, 31U, 2340U}, {1507860U, 1U, 31U, 2340U}, {1507864U, 77U, 28U, 2340U}, {1508352U, 64U, 28U, 2340U}, {1540096U, 1U, 31U, 2340U}, {1572864U, 61U, 31U, 2340U}, {1573140U, 2U, 31U, 8191U}, {1573152U, 3U, 31U, 8191U}, {1573168U, 1U, 31U, 8191U}, {1573180U, 2U, 30U, 2340U}, {1573376U, 27U, 31U, 2340U}, {1573484U, 1U, 31U, 4095U}, {1573488U, 12U, 31U, 2340U}, {1573536U, 1U, 31U, 4095U}, {1573540U, 17U, 31U, 2340U}, {1573696U, 4U, 31U, 2340U}, {1573760U, 1U, 28U, 2340U}, {1573768U, 1U, 28U, 2340U}, {1573776U, 1U, 28U, 2340U}, {1573784U, 1U, 28U, 2340U}, {1573792U, 5U, 28U, 2340U}, {1573812U, 2U, 24U, 2340U}, {1573888U, 256U, 3U, 4095U}, {1576960U, 4U, 31U, 2364U}, {1576976U, 1020U, 31U, 56U}, {1581056U, 4U, 24U, 2340U}, {1703936U, 1U, 31U, 2348U}, {1703940U, 5631U, 31U, 8U}, {1726464U, 2560U, 30U, 8U}, {1736704U, 1U, 31U, 2348U}, {1736708U, 8191U, 30U, 8U}, {1769472U, 1U, 31U, 2348U}, {1769476U, 15U, 2U, 8U}, {1769536U, 1U, 30U, 2348U}, {1769540U, 239U, 2U, 8U}, {1770496U, 1U, 31U, 2348U}, {1770500U, 255U, 2U, 8U}, {1771520U, 1U, 31U, 2340U}, {1771584U, 1U, 30U, 2340U}, {1772544U, 1U, 31U, 8191U}, {1773568U, 1U, 31U, 8191U}, {1773632U, 1U, 30U, 8191U}, {1774592U, 1U, 31U, 2340U}, {1774656U, 1U, 30U, 2340U}, {1774720U, 1U, 30U, 2340U}, {1774784U, 1U, 30U, 2340U}, {1775616U, 128U, 31U, 16U}, {1776640U, 128U, 31U, 16U}, {1777664U, 1U, 31U, 3510U}, {1778688U, 1U, 30U, 2348U}, {1778692U, 5631U, 28U, 8U}, {1802240U, 1U, 31U, 4095U}, {1802304U, 1U, 31U, 4095U}, {1802368U, 1U, 31U, 4095U}, {1802432U, 1U, 31U, 4095U}, {1802496U, 1U, 31U, 2340U}, {1802560U, 1U, 31U, 2340U}, {1802624U, 1U, 31U, 2340U}, {1802688U, 1U, 31U, 2340U}, {1802752U, 1U, 31U, 2340U}, {1802816U, 1U, 31U, 2340U}, {1802880U, 1U, 31U, 2340U}, {1802944U, 1U, 31U, 2340U}, {1803008U, 1U, 31U, 2340U}, {1803072U, 1U, 31U, 2340U}, {1803136U, 1U, 31U, 2340U}, {1803200U, 1U, 31U, 2340U}, {1803264U, 1U, 31U, 2340U}, {1803328U, 1U, 31U, 2340U}, {1803392U, 1U, 31U, 2340U}, {1803456U, 1U, 31U, 2340U}, {1803520U, 1U, 31U, 2340U}, {1803584U, 1U, 31U, 2340U}, {1803648U, 1U, 31U, 2340U}, {1803712U, 19U, 28U, 2340U}, {1804288U, 1U, 31U, 2340U}, {1804352U, 1U, 31U, 2340U}, {1804416U, 1U, 31U, 2340U}, {1804480U, 1U, 31U, 2340U}, {1804544U, 1U, 31U, 2340U}, {1804608U, 1U, 31U, 2340U}, {1804672U, 1U, 31U, 2340U}, {1804736U, 1U, 31U, 2340U}, {1804800U, 1U, 31U, 2356U}, {1804864U, 1U, 31U, 2340U}, {1804928U, 1U, 31U, 1170U}, {1804992U, 1U, 31U, 2340U}, {1805056U, 1U, 31U, 2340U}, {1805120U, 1U, 31U, 2340U}, {1805184U, 1U, 31U, 2340U}, {1805248U, 1U, 31U, 2340U}, {1805312U, 1U, 31U, 2340U}, {1805376U, 1U, 31U, 2340U}, {1805440U, 1U, 31U, 2340U}, {1805504U, 1U, 31U, 2340U}, {1805508U, 1U, 28U, 2340U}, {1805568U, 1U, 31U, 2340U}, {1805632U, 1U, 31U, 2340U}, {1805696U, 1U, 31U, 2340U}, {1805760U, 1U, 31U, 2340U}, {1805824U, 1U, 31U, 2340U}, {1805888U, 1U, 31U, 2340U}, {1805952U, 1U, 31U, 2340U}, {1805956U, 1U, 28U, 2340U}, {1806016U, 1U, 30U, 2340U}, {1806080U, 1U, 30U, 2340U}, {1806144U, 1U, 30U, 2340U}, {1806208U, 1U, 30U, 2340U}, {1806272U, 1U, 30U, 2340U}, {1806292U, 5U, 28U, 2340U}, {1806312U, 2U, 24U, 2340U}, {1806336U, 1U, 28U, 2340U}, {1806400U, 3U, 28U, 2340U}, {1806428U, 1U, 24U, 2340U}, {1806436U, 1U, 16U, 2340U}, {1806464U, 10U, 16U, 2340U}, {1835008U, 2U, 31U, 2340U}, {2097152U, 65U, 31U, 2340U}, {2097444U, 2U, 31U, 8191U}, {2097456U, 3U, 31U, 8191U}, {2097472U, 1U, 31U, 8191U}, {2097484U, 2U, 30U, 2340U}, {2097664U, 27U, 31U, 2340U}, {2097772U, 1U, 31U, 4095U}, {2097776U, 12U, 31U, 2340U}, {2097824U, 1U, 31U, 4095U}, {2097828U, 17U, 31U, 2340U}, {2097984U, 4U, 31U, 2340U}, {2098048U, 1U, 28U, 2340U}, {2098056U, 1U, 28U, 2340U}, {2098064U, 1U, 28U, 2340U}, {2098072U, 1U, 28U, 2340U}, {2098080U, 1U, 28U, 2340U}, {2098088U, 2U, 28U, 2340U}, {2098176U, 256U, 3U, 4095U}, {2105344U, 4U, 31U, 6439U}, {2105360U, 2044U, 31U, 4103U}, {2113536U, 4U, 24U, 2340U}, {2228224U, 1U, 31U, 2341U}, {2228228U, 5631U, 31U, 1U}, {2250752U, 2560U, 30U, 1U}, {2260992U, 1U, 31U, 2341U}, {2260996U, 8191U, 30U, 1U}, {2293760U, 1U, 31U, 2341U}, {2293764U, 15U, 2U, 1U}, {2293824U, 1U, 30U, 2341U}, {2293828U, 239U, 2U, 1U}, {2294784U, 1U, 31U, 2341U}, {2294788U, 255U, 2U, 1U}, {2295808U, 1U, 31U, 2340U}, {2295872U, 1U, 30U, 2340U}, {2296832U, 1U, 31U, 2340U}, {2297856U, 1U, 31U, 2340U}, {2297920U, 1U, 30U, 2340U}, {2298880U, 1U, 31U, 2340U}, {2298944U, 1U, 30U, 2340U}, {2299008U, 1U, 30U, 2340U}, {2299072U, 1U, 30U, 2340U}, {2299904U, 128U, 31U, 2U}, {2300928U, 128U, 31U, 2U}, {2301952U, 1U, 31U, 3510U}, {2302976U, 1U, 30U, 2341U}, {2302980U, 5631U, 28U, 1U}, {2326528U, 1U, 31U, 4095U}, {2326592U, 1U, 31U, 4095U}, {2326656U, 1U, 31U, 4095U}, {2326720U, 1U, 31U, 4095U}, {2326784U, 1U, 31U, 2340U}, {2326848U, 1U, 31U, 2340U}, {2326912U, 1U, 31U, 2340U}, {2326976U, 1U, 31U, 2340U}, {2327040U, 1U, 31U, 2340U}, {2327104U, 1U, 31U, 2340U}, {2327168U, 1U, 31U, 2340U}, {2327232U, 1U, 31U, 2340U}, {2327296U, 1U, 31U, 2340U}, {2327360U, 1U, 31U, 2340U}, {2327424U, 1U, 31U, 2340U}, {2327488U, 1U, 31U, 2340U}, {2327552U, 1U, 31U, 2340U}, {2327616U, 1U, 31U, 2340U}, {2327680U, 1U, 31U, 2340U}, {2327744U, 1U, 31U, 2340U}, {2327808U, 1U, 31U, 2340U}, {2327872U, 1U, 31U, 2340U}, {2327936U, 1U, 31U, 2340U}, {2328000U, 19U, 28U, 2340U}, {2328576U, 1U, 31U, 2340U}, {2328640U, 1U, 31U, 2340U}, {2328704U, 1U, 31U, 2340U}, {2328768U, 1U, 31U, 2340U}, {2328832U, 1U, 31U, 2340U}, {2328896U, 1U, 31U, 2340U}, {2328960U, 1U, 31U, 2340U}, {2329024U, 1U, 31U, 2340U}, {2329088U, 1U, 31U, 2342U}, {2329152U, 1U, 31U, 2340U}, {2329216U, 1U, 31U, 1170U}, {2329280U, 1U, 31U, 2340U}, {2329344U, 1U, 31U, 2340U}, {2329408U, 1U, 31U, 2340U}, {2329472U, 1U, 31U, 2340U}, {2329536U, 1U, 31U, 2340U}, {2329600U, 1U, 31U, 2340U}, {2329664U, 1U, 31U, 2340U}, {2329728U, 1U, 31U, 2340U}, {2329792U, 1U, 31U, 2340U}, {2329796U, 1U, 28U, 2340U}, {2329856U, 1U, 31U, 2340U}, {2329920U, 1U, 31U, 2340U}, {2329984U, 1U, 31U, 2340U}, {2330048U, 1U, 31U, 2340U}, {2330112U, 1U, 31U, 2340U}, {2330176U, 1U, 31U, 2340U}, {2330240U, 1U, 31U, 2340U}, {2330244U, 1U, 28U, 2340U}, {2330304U, 1U, 30U, 2340U}, {2330368U, 1U, 30U, 2340U}, {2330432U, 1U, 30U, 2340U}, {2330496U, 1U, 30U, 2340U}, {2330560U, 1U, 30U, 2340U}, {2330580U, 5U, 28U, 2340U}, {2330600U, 2U, 24U, 2340U}, {2330624U, 1U, 28U, 2340U}, {2330688U, 3U, 28U, 2340U}, {2330716U, 1U, 24U, 2340U}, {2330724U, 1U, 16U, 2340U}, {2330752U, 10U, 16U, 2340U}, {2359296U, 2U, 31U, 2340U}, {2621440U, 65U, 31U, 2340U}, {2621732U, 2U, 31U, 8191U}, {2621744U, 3U, 31U, 8191U}, {2621760U, 1U, 31U, 8191U}, {2621772U, 2U, 30U, 2340U}, {2621952U, 27U, 31U, 2340U}, {2622060U, 1U, 31U, 4095U}, {2622064U, 12U, 31U, 2340U}, {2622112U, 1U, 31U, 4095U}, {2622116U, 17U, 31U, 2340U}, {2622272U, 4U, 31U, 2340U}, {2622336U, 1U, 28U, 2340U}, {2622344U, 1U, 28U, 2340U}, {2622352U, 1U, 28U, 2340U}, {2622360U, 1U, 28U, 2340U}, {2622368U, 1U, 28U, 2340U}, {2622376U, 2U, 28U, 2340U}, {2622464U, 256U, 3U, 4095U}, {2629632U, 4U, 31U, 2532U}, {2629648U, 2044U, 31U, 448U}, {2637824U, 4U, 24U, 2340U}, {2752512U, 1U, 31U, 2404U}, {2752516U, 5631U, 31U, 64U}, {2775040U, 2560U, 30U, 64U}, {2785280U, 1U, 31U, 2404U}, {2785284U, 8191U, 30U, 64U}, {2818048U, 1U, 31U, 2404U}, {2818052U, 15U, 2U, 64U}, {2818112U, 1U, 30U, 2404U}, {2818116U, 239U, 2U, 64U}, {2819072U, 1U, 31U, 2404U}, {2819076U, 255U, 2U, 64U}, {2820096U, 1U, 31U, 2340U}, {2820160U, 1U, 30U, 2340U}, {2821120U, 1U, 31U, 2340U}, {2822144U, 1U, 31U, 2340U}, {2822208U, 1U, 30U, 2340U}, {2823168U, 1U, 31U, 2340U}, {2823232U, 1U, 30U, 2340U}, {2823296U, 1U, 30U, 2340U}, {2823360U, 1U, 30U, 2340U}, {2824192U, 128U, 31U, 128U}, {2825216U, 128U, 31U, 128U}, {2826240U, 1U, 31U, 3510U}, {2827264U, 1U, 30U, 2404U}, {2827268U, 5631U, 28U, 64U}, {2850816U, 1U, 31U, 4095U}, {2850880U, 1U, 31U, 4095U}, {2850944U, 1U, 31U, 4095U}, {2851008U, 1U, 31U, 2340U}, {2851072U, 1U, 31U, 2340U}, {2851136U, 1U, 31U, 2340U}, {2851200U, 1U, 31U, 2340U}, {2851264U, 1U, 31U, 2340U}, {2851328U, 1U, 31U, 2340U}, {2851392U, 1U, 31U, 2340U}, {2851456U, 1U, 31U, 2340U}, {2851520U, 1U, 31U, 2340U}, {2851584U, 1U, 31U, 2340U}, {2851648U, 1U, 31U, 2340U}, {2851712U, 1U, 31U, 2340U}, {2851776U, 1U, 31U, 2340U}, {2851840U, 1U, 31U, 2340U}, {2851904U, 1U, 31U, 2340U}, {2851968U, 1U, 31U, 2340U}, {2852032U, 1U, 31U, 2340U}, {2852096U, 1U, 31U, 2340U}, {2852160U, 1U, 31U, 2340U}, {2852224U, 1U, 31U, 2340U}, {2852288U, 19U, 28U, 2340U}, {2852864U, 1U, 31U, 2340U}, {2852928U, 1U, 31U, 2340U}, {2852992U, 1U, 31U, 2340U}, {2853056U, 1U, 31U, 2340U}, {2853120U, 1U, 31U, 2340U}, {2853184U, 1U, 31U, 2340U}, {2853248U, 1U, 31U, 2340U}, {2853312U, 1U, 31U, 2340U}, {2853376U, 1U, 31U, 2468U}, {2853440U, 1U, 31U, 2340U}, {2853504U, 1U, 31U, 1170U}, {2853568U, 1U, 31U, 2340U}, {2853632U, 1U, 31U, 2340U}, {2853696U, 1U, 31U, 2340U}, {2853760U, 1U, 31U, 2340U}, {2853824U, 1U, 31U, 2340U}, {2853888U, 1U, 31U, 2340U}, {2853952U, 1U, 31U, 2340U}, {2854016U, 1U, 31U, 2340U}, {2854080U, 1U, 31U, 2340U}, {2854084U, 1U, 28U, 2340U}, {2854144U, 1U, 31U, 2340U}, {2854208U, 1U, 31U, 2340U}, {2854272U, 1U, 31U, 2340U}, {2854336U, 1U, 31U, 2340U}, {2854400U, 1U, 31U, 2340U}, {2854464U, 1U, 31U, 2340U}, {2854528U, 1U, 31U, 2340U}, {2854532U, 1U, 28U, 2340U}, {2854592U, 1U, 30U, 2340U}, {2854656U, 1U, 30U, 2340U}, {2854720U, 1U, 30U, 2340U}, {2854784U, 1U, 30U, 2340U}, {2854848U, 1U, 30U, 2340U}, {2854868U, 5U, 28U, 2340U}, {2854888U, 2U, 24U, 2340U}, {2854912U, 1U, 28U, 2340U}, {2854976U, 3U, 28U, 2340U}, {2855004U, 1U, 24U, 2340U}, {2855012U, 1U, 16U, 2340U}, {2855040U, 10U, 16U, 2340U}, {2883584U, 2U, 31U, 8191U}, {3145728U, 65U, 31U, 2340U}, {3146020U, 2U, 31U, 8191U}, {3146032U, 3U, 31U, 8191U}, {3146048U, 1U, 31U, 8191U}, {3146060U, 2U, 30U, 2340U}, {3146240U, 27U, 31U, 2340U}, {3146348U, 1U, 31U, 4095U}, {3146352U, 12U, 31U, 2340U}, {3146400U, 1U, 31U, 4095U}, {3146404U, 17U, 31U, 2340U}, {3146560U, 4U, 31U, 2340U}, {3146624U, 1U, 28U, 2340U}, {3146632U, 1U, 28U, 2340U}, {3146640U, 1U, 28U, 2340U}, {3146648U, 1U, 28U, 2340U}, {3146656U, 1U, 28U, 2340U}, {3146664U, 2U, 28U, 2340U}, {3146752U, 256U, 3U, 4095U}, {3153920U, 4U, 31U, 3876U}, {3153936U, 2044U, 31U, 3584U}, {3162112U, 4U, 24U, 2340U}, {3276800U, 1U, 31U, 2852U}, {3276804U, 5631U, 31U, 512U}, {3299328U, 2560U, 30U, 512U}, {3309568U, 1U, 31U, 2852U}, {3309572U, 8191U, 30U, 512U}, {3342336U, 1U, 31U, 2852U}, {3342340U, 15U, 2U, 512U}, {3342400U, 1U, 30U, 2852U}, {3342404U, 239U, 2U, 512U}, {3343360U, 1U, 31U, 2852U}, {3343364U, 255U, 2U, 512U}, {3344384U, 1U, 31U, 2340U}, {3344448U, 1U, 30U, 2340U}, {3345408U, 1U, 31U, 2340U}, {3346432U, 1U, 31U, 2340U}, {3346496U, 1U, 30U, 2340U}, {3347456U, 1U, 31U, 2340U}, {3347520U, 1U, 30U, 2340U}, {3347584U, 1U, 30U, 2340U}, {3347648U, 1U, 30U, 2340U}, {3348480U, 128U, 31U, 1024U}, {3349504U, 128U, 31U, 1024U}, {3350528U, 1U, 31U, 3510U}, {3351552U, 1U, 30U, 2852U}, {3351556U, 5631U, 28U, 512U}, {3375104U, 1U, 31U, 4095U}, {3375168U, 1U, 31U, 4095U}, {3375232U, 1U, 31U, 4095U}, {3375296U, 1U, 31U, 4095U}, {3375360U, 1U, 31U, 2340U}, {3375424U, 1U, 31U, 2340U}, {3375488U, 1U, 31U, 2340U}, {3375552U, 1U, 31U, 2340U}, {3375616U, 1U, 31U, 2340U}, {3375680U, 1U, 31U, 2340U}, {3375744U, 1U, 31U, 2340U}, {3375808U, 1U, 31U, 2340U}, {3375872U, 1U, 31U, 2340U}, {3375936U, 1U, 31U, 2340U}, {3376000U, 1U, 31U, 2340U}, {3376064U, 1U, 31U, 2340U}, {3376128U, 1U, 31U, 2340U}, {3376192U, 1U, 31U, 2340U}, {3376256U, 1U, 31U, 2340U}, {3376320U, 1U, 31U, 2340U}, {3376384U, 1U, 31U, 2340U}, {3376448U, 1U, 31U, 2340U}, {3376512U, 1U, 31U, 2340U}, {3376576U, 19U, 28U, 2340U}, {3377152U, 1U, 31U, 2340U}, {3377216U, 1U, 31U, 2340U}, {3377280U, 1U, 31U, 2340U}, {3377344U, 1U, 31U, 2340U}, {3377408U, 1U, 31U, 2340U}, {3377472U, 1U, 31U, 2340U}, {3377536U, 1U, 31U, 2340U}, {3377600U, 1U, 31U, 2340U}, {3377664U, 1U, 31U, 3364U}, {3377728U, 1U, 31U, 2340U}, {3377792U, 1U, 31U, 1170U}, {3377856U, 1U, 31U, 2340U}, {3377920U, 1U, 31U, 2340U}, {3377984U, 1U, 31U, 2340U}, {3378048U, 1U, 31U, 2340U}, {3378112U, 1U, 31U, 2340U}, {3378176U, 1U, 31U, 2340U}, {3378240U, 1U, 31U, 2340U}, {3378304U, 1U, 31U, 2340U}, {3378368U, 1U, 31U, 2340U}, {3378372U, 1U, 28U, 2340U}, {3378432U, 1U, 31U, 2340U}, {3378496U, 1U, 31U, 2340U}, {3378560U, 1U, 31U, 2340U}, {3378624U, 1U, 31U, 2340U}, {3378688U, 1U, 31U, 2340U}, {3378752U, 1U, 31U, 2340U}, {3378816U, 1U, 31U, 2340U}, {3378820U, 1U, 28U, 2340U}, {3378880U, 1U, 30U, 2340U}, {3378944U, 1U, 30U, 2340U}, {3379008U, 1U, 30U, 2340U}, {3379072U, 1U, 30U, 2340U}, {3379136U, 1U, 30U, 2340U}, {3379156U, 5U, 28U, 2340U}, {3379176U, 2U, 24U, 2340U}, {3379200U, 1U, 28U, 2340U}, {3379264U, 3U, 28U, 2340U}, {3379292U, 1U, 24U, 2340U}, {3379300U, 1U, 16U, 2340U}, {3379328U, 10U, 16U, 2340U}, {3407872U, 2U, 31U, 2340U}, {3801088U, 40960U, 28U, 4096U}}; static struct reg_addr const idle_reg_addrs[270U] = { {8452U, 1U, 31U, 4095U}, {8464U, 2U, 31U, 4095U}, {8476U, 8U, 31U, 4095U}, {10260U, 1U, 31U, 4095U}, {10268U, 2U, 31U, 4095U}, {10324U, 1U, 31U, 4095U}, {10332U, 1U, 31U, 4095U}, {12352U, 1U, 31U, 4095U}, {36880U, 7U, 28U, 4095U}, {36912U, 1U, 28U, 4095U}, {36968U, 16U, 28U, 4095U}, {37424U, 2U, 28U, 4095U}, {37444U, 1U, 28U, 4095U}, {37528U, 1U, 28U, 4095U}, {37544U, 1U, 28U, 8191U}, {41868U, 1U, 31U, 8191U}, {41924U, 1U, 30U, 4095U}, {41988U, 1U, 31U, 4095U}, {41992U, 2U, 31U, 8191U}, {42028U, 12U, 31U, 4095U}, {42368U, 1U, 31U, 8191U}, {42384U, 1U, 31U, 8191U}, {42496U, 5U, 30U, 4095U}, {42520U, 1U, 30U, 4095U}, {42772U, 1U, 28U, 4095U}, {42784U, 1U, 28U, 4095U}, {42832U, 1U, 28U, 4095U}, {49308U, 1U, 3U, 4095U}, {66480U, 1U, 31U, 4095U}, {66496U, 1U, 31U, 4095U}, {66512U, 1U, 3U, 8191U}, {66584U, 1U, 31U, 4095U}, {66592U, 1U, 31U, 4095U}, {66600U, 1U, 31U, 4095U}, {66656U, 1U, 31U, 4095U}, {66676U, 1U, 31U, 4095U}, {66784U, 1U, 31U, 4095U}, {66796U, 1U, 31U, 4095U}, {66808U, 1U, 31U, 4095U}, {66824U, 1U, 31U, 4095U}, {66864U, 1U, 31U, 4095U}, {66872U, 1U, 31U, 4095U}, {66888U, 1U, 31U, 4095U}, {66904U, 1U, 31U, 4095U}, {98984U, 1U, 28U, 4095U}, {99000U, 1U, 28U, 4095U}, {99080U, 1U, 28U, 4095U}, {99096U, 1U, 28U, 4095U}, {99128U, 1U, 28U, 4095U}, {99144U, 1U, 28U, 4095U}, {99260U, 1U, 28U, 8191U}, {99276U, 1U, 28U, 8191U}, {99696U, 1U, 24U, 4095U}, {99704U, 1U, 24U, 4095U}, {99724U, 1U, 24U, 4095U}, {99732U, 1U, 24U, 4095U}, {99884U, 4U, 16U, 4095U}, {131612U, 11U, 31U, 4095U}, {131752U, 1U, 31U, 4095U}, {131768U, 1U, 31U, 8191U}, {132100U, 1U, 31U, 4095U}, {132108U, 2U, 31U, 4095U}, {132124U, 2U, 31U, 4095U}, {262484U, 14U, 31U, 4095U}, {262552U, 1U, 31U, 8191U}, {263340U, 1U, 31U, 4095U}, {263356U, 1U, 31U, 8191U}, {270992U, 1U, 31U, 4095U}, {271008U, 1U, 31U, 4095U}, {271024U, 1U, 31U, 8191U}, {271688U, 1U, 31U, 4095U}, {271696U, 1U, 31U, 4095U}, {271704U, 1U, 31U, 4095U}, {328032U, 8U, 31U, 4095U}, {328144U, 1U, 31U, 4095U}, {328160U, 1U, 31U, 8191U}, {328196U, 1U, 31U, 4095U}, {328204U, 2U, 31U, 4095U}, {328220U, 1U, 31U, 4095U}, {393360U, 1U, 31U, 4095U}, {393500U, 1U, 31U, 4095U}, {393516U, 1U, 31U, 8191U}, {790556U, 1U, 31U, 4095U}, {790572U, 1U, 31U, 8191U}, {795280U, 1U, 31U, 4095U}, {795296U, 1U, 31U, 4095U}, {795312U, 1U, 31U, 8191U}, {795976U, 1U, 31U, 4095U}, {795984U, 1U, 31U, 4095U}, {795992U, 1U, 31U, 4095U}, {803476U, 1U, 31U, 4095U}, {803492U, 1U, 31U, 4095U}, {803508U, 1U, 31U, 8191U}, {804176U, 1U, 31U, 4095U}, {804184U, 1U, 31U, 4095U}, {804192U, 1U, 31U, 4095U}, {852332U, 8U, 31U, 4095U}, {852440U, 1U, 31U, 4095U}, {852456U, 1U, 31U, 8191U}, {852484U, 1U, 31U, 4095U}, {852492U, 3U, 31U, 4095U}, {917844U, 8U, 31U, 4095U}, {917960U, 1U, 31U, 4095U}, {917976U, 1U, 31U, 8191U}, {918020U, 1U, 31U, 4095U}, {918028U, 2U, 31U, 4095U}, {918044U, 2U, 31U, 4095U}, {1052692U, 1U, 31U, 4095U}, {1052720U, 1U, 31U, 4095U}, {1052736U, 1U, 31U, 8191U}, {1056856U, 1U, 31U, 8191U}, {1056896U, 16U, 31U, 4095U}, {1060868U, 2U, 31U, 4095U}, {1060968U, 1U, 31U, 4095U}, {1060984U, 1U, 31U, 4095U}, {1061000U, 1U, 31U, 8191U}, {1061020U, 2U, 30U, 4095U}, {1061048U, 2U, 28U, 4095U}, {1061068U, 1U, 28U, 4095U}, {1061088U, 1U, 28U, 4095U}, {1064964U, 1U, 31U, 4095U}, {1064984U, 1U, 31U, 4095U}, {1064992U, 1U, 31U, 4095U}, {1065020U, 1U, 31U, 4095U}, {1065212U, 1U, 31U, 4095U}, {1065228U, 1U, 31U, 8191U}, {1065984U, 1U, 31U, 8191U}, {1065988U, 63U, 31U, 4095U}, {1067008U, 1U, 31U, 8191U}, {1067012U, 63U, 31U, 4095U}, {1069056U, 4U, 31U, 8191U}, {1069072U, 252U, 31U, 4095U}, {1081492U, 1U, 3U, 4095U}, {1180080U, 2U, 31U, 4095U}, {1180460U, 1U, 31U, 4095U}, {1180524U, 3U, 31U, 4095U}, {1180680U, 2U, 31U, 4095U}, {1180692U, 15U, 31U, 4095U}, {1180792U, 2U, 31U, 4095U}, {1180972U, 1U, 31U, 4095U}, {1181028U, 3U, 31U, 4095U}, {1181052U, 1U, 31U, 8191U}, {1181068U, 1U, 31U, 8191U}, {1181192U, 1U, 30U, 4095U}, {1181512U, 1U, 28U, 4095U}, {1181560U, 2U, 28U, 4095U}, {1181704U, 3U, 31U, 4095U}, {1181720U, 1U, 31U, 4095U}, {1181728U, 1U, 31U, 4095U}, {1181736U, 1U, 31U, 4095U}, {1181744U, 1U, 31U, 4095U}, {1181752U, 1U, 31U, 4095U}, {1181760U, 1U, 31U, 4095U}, {1181768U, 1U, 31U, 4095U}, {1181776U, 1U, 31U, 4095U}, {1181784U, 1U, 31U, 4095U}, {1181792U, 1U, 31U, 4095U}, {1181800U, 1U, 31U, 4095U}, {1181808U, 1U, 31U, 4095U}, {1181816U, 1U, 31U, 4095U}, {1181824U, 1U, 31U, 4095U}, {1181832U, 1U, 31U, 4095U}, {1181840U, 1U, 31U, 4095U}, {1181848U, 1U, 31U, 4095U}, {1181856U, 1U, 31U, 4095U}, {1181864U, 1U, 31U, 4095U}, {1181872U, 1U, 31U, 4095U}, {1181880U, 1U, 31U, 4095U}, {1181888U, 1U, 31U, 4095U}, {1181896U, 1U, 31U, 4095U}, {1181904U, 1U, 31U, 4095U}, {1181912U, 1U, 31U, 4095U}, {1181920U, 1U, 31U, 4095U}, {1181928U, 1U, 31U, 4095U}, {1181936U, 1U, 31U, 4095U}, {1181944U, 1U, 31U, 4095U}, {1181952U, 1U, 31U, 4095U}, {1181960U, 1U, 31U, 4095U}, {1245232U, 1U, 28U, 4095U}, {1245260U, 3U, 28U, 4095U}, {1245284U, 2U, 28U, 4095U}, {1245340U, 1U, 28U, 8191U}, {1245488U, 1U, 28U, 4095U}, {1245548U, 1U, 28U, 4095U}, {1245952U, 1U, 28U, 4095U}, {1246336U, 1U, 28U, 4095U}, {1310812U, 2U, 15U, 4095U}, {1310928U, 2U, 15U, 4095U}, {1310944U, 1U, 15U, 4095U}, {1311176U, 1U, 15U, 4095U}, {1311232U, 6U, 15U, 4095U}, {1311544U, 7U, 16U, 4095U}, {1311600U, 7U, 16U, 4095U}, {1425852U, 6U, 16U, 4095U}, {1425968U, 7U, 16U, 4095U}, {1445916U, 1U, 31U, 4095U}, {1445932U, 1U, 31U, 8191U}, {1458196U, 2U, 31U, 4095U}, {1458416U, 1U, 31U, 4095U}, {1467024U, 1U, 31U, 4095U}, {1467040U, 1U, 31U, 4095U}, {1467056U, 1U, 31U, 8191U}, {1467720U, 1U, 31U, 4095U}, {1467728U, 1U, 31U, 4095U}, {1467736U, 1U, 31U, 4095U}, {1474560U, 1U, 31U, 4095U}, {1474568U, 1U, 31U, 4095U}, {1474576U, 1U, 31U, 4095U}, {1474584U, 1U, 31U, 4095U}, {1474600U, 2U, 31U, 4095U}, {1474648U, 9U, 31U, 4095U}, {1475128U, 1U, 31U, 4095U}, {1475280U, 7U, 31U, 4095U}, {1475328U, 2U, 3U, 4095U}, {1475336U, 65U, 31U, 4095U}, {1475600U, 2U, 31U, 4095U}, {1475640U, 1U, 31U, 4095U}, {1475656U, 1U, 31U, 8191U}, {1477120U, 128U, 31U, 4095U}, {1499648U, 128U, 2U, 4095U}, {1500164U, 2U, 2U, 4095U}, {1500548U, 64U, 2U, 4095U}, {1500804U, 2U, 30U, 4095U}, {1500812U, 4U, 2U, 4095U}, {1500924U, 4U, 28U, 4095U}, {1501100U, 12U, 16U, 4095U}, {1507492U, 1U, 31U, 4095U}, {1507500U, 2U, 31U, 4095U}, {1507520U, 1U, 31U, 4095U}, {1507700U, 1U, 31U, 4095U}, {1507716U, 1U, 31U, 8191U}, {1573108U, 1U, 31U, 4095U}, {1573124U, 1U, 31U, 4095U}, {1573140U, 1U, 31U, 8191U}, {1573156U, 1U, 31U, 8191U}, {1573484U, 1U, 31U, 4095U}, {1573536U, 1U, 31U, 4095U}, {1802240U, 1U, 31U, 4095U}, {1802304U, 1U, 31U, 4095U}, {1802368U, 1U, 31U, 4095U}, {1802432U, 1U, 31U, 4095U}, {2097412U, 1U, 31U, 4095U}, {2097428U, 1U, 31U, 4095U}, {2097444U, 1U, 31U, 8191U}, {2097460U, 1U, 31U, 8191U}, {2097772U, 1U, 31U, 4095U}, {2097824U, 1U, 31U, 4095U}, {2326528U, 1U, 31U, 4095U}, {2326592U, 1U, 31U, 4095U}, {2326656U, 1U, 31U, 4095U}, {2326720U, 1U, 31U, 4095U}, {2621700U, 1U, 31U, 4095U}, {2621716U, 1U, 31U, 4095U}, {2621732U, 1U, 31U, 8191U}, {2621748U, 1U, 31U, 8191U}, {2622060U, 1U, 31U, 4095U}, {2622112U, 1U, 31U, 4095U}, {2850816U, 1U, 31U, 4095U}, {2850880U, 1U, 31U, 4095U}, {2850944U, 1U, 31U, 4095U}, {3145988U, 1U, 31U, 4095U}, {3146004U, 1U, 31U, 4095U}, {3146020U, 1U, 31U, 8191U}, {3146036U, 1U, 31U, 8191U}, {3146348U, 1U, 31U, 4095U}, {3146400U, 1U, 31U, 4095U}, {3375104U, 1U, 31U, 4095U}, {3375168U, 1U, 31U, 4095U}, {3375232U, 1U, 31U, 4095U}, {3375296U, 1U, 31U, 4095U}}; static u32 const read_reg_e1[1U] = { 1773568U}; static struct wreg_addr const wreg_addr_e1 = {1772544U, 192U, 1U, (u32 const *)(& read_reg_e1), 31U, 8191U}; static u32 const read_reg_e1h[2U] = { 1773632U, 1773568U}; static struct wreg_addr const wreg_addr_e1h = {1772544U, 256U, 2U, (u32 const *)(& read_reg_e1h), 31U, 8191U}; static u32 const read_reg_e2[2U] = { 1773632U, 1773568U}; static struct wreg_addr const wreg_addr_e2 = {1772544U, 128U, 2U, (u32 const *)(& read_reg_e2), 31U, 8191U}; static u32 const read_reg_e3[2U] = { 1773632U, 1773568U}; static struct wreg_addr const wreg_addr_e3 = {1772544U, 128U, 2U, (u32 const *)(& read_reg_e3), 31U, 8191U}; static u32 const read_reg_e3b0[2U] = { 1773632U, 1773568U}; static struct wreg_addr const wreg_addr_e3b0 = {1772544U, 128U, 2U, (u32 const *)(& read_reg_e3b0), 31U, 8191U}; static unsigned int const dump_num_registers[5U][13U] = { { 20782U, 18567U, 27975U, 19729U, 18311U, 27719U, 20836U, 32391U, 41799U, 20812U, 26247U, 35655U, 19074U}, { 32774U, 19297U, 33277U, 31721U, 19041U, 33021U, 32828U, 33121U, 47101U, 32804U, 26977U, 40957U, 35895U}, { 36527U, 17928U, 33697U, 35474U, 18700U, 34466U, 36581U, 31752U, 47521U, 36557U, 25608U, 41377U, 43903U}, { 45239U, 17936U, 34387U, 44186U, 18708U, 35156U, 45293U, 31760U, 48211U, 45269U, 25616U, 42067U, 43903U}, { 45302U, 17999U, 34802U, 44249U, 18771U, 35571U, 45356U, 31823U, 48626U, 45332U, 25679U, 42482U, 43903U}}; static struct __anonstruct_bnx2x_blocks_parity_data_247 const bnx2x_blocks_parity_data___0[40U] = { {1061012U, 1061004U, 134217727U, {67108863U, 67108863U, 134217727U, 134217727U}, {'P', 'X', 'P', '\000'}}, {1181064U, 1181056U, 4294967295U, {4294967295U, 4294967295U, 4294967295U, 4294967295U}, {'P', 'X', 'P', '2', '_', '0', '\000'}}, {1181080U, 1181072U, 33554431U, {127U, 127U, 2047U, 33554431U}, {'P', 'X', 'P', '2', '_', '1', '\000'}}, {1081504U, 1081496U, 7U, {7U, 7U, 0U, 0U}, {'H', 'C', '\000'}}, {66524U, 66516U, 4294967295U, {1073741823U, 4294967295U, 0U, 0U}, {'N', 'I', 'G', '\000'}}, {99272U, 99264U, 4294967295U, {0U, 0U, 4294967295U, 4294967295U}, {'N', 'I', 'G', '_', '0', '\000'}}, {99288U, 99280U, 65535U, {0U, 0U, 255U, 65535U}, {'N', 'I', 'G', '_', '1', '\000'}}, {1245352U, 1245344U, 2047U, {0U, 0U, 2047U, 2047U}, {'I', 'G', 'U', '\000'}}, {41880U, 41872U, 1U, {1U, 1U, 1U, 1U}, {'M', 'I', 'S', 'C', '\000'}}, {1475668U, 1475660U, 0U, {511U, 4095U, 4095U, 4095U}, {'Q', 'M', '\000'}}, {1114584U, 1114576U, 31U, {0U, 0U, 31U, 31U}, {'A', 'T', 'C', '\000'}}, {37556U, 37548U, 3U, {0U, 0U, 3U, 3U}, {'P', 'G', 'L', 'U', 'E', '_', 'B', '\000'}}, {1507728U, 1507720U, 0U, {3U, 3U, 3U, 3U}, {'D', 'O', 'R', 'Q', '\000'}}, {790584U, 790576U, 15U, {15U, 15U, 15U, 15U}, {'U', 'P', 'B', '\000'}}, {1445944U, 1445936U, 0U, {15U, 15U, 15U, 15U}, {'X', 'P', 'B', '\000'}}, {263368U, 263360U, 4U, {7U, 7U, 7U, 7U}, {'S', 'R', 'C', '\000'}}, {1052748U, 1052740U, 0U, {31U, 31U, 31U, 31U}, {'C', 'D', 'U', '\000'}}, {1065240U, 1065232U, 0U, {15U, 15U, 15U, 63U}, {'C', 'F', 'C', '\000'}}, {49320U, 49312U, 0U, {1U, 1U, 1U, 1U}, {'D', 'B', 'G', '\000'}}, {1056868U, 1056860U, 0U, {15U, 15U, 15U, 15U}, {'D', 'M', 'A', 'E', '\000'}}, {393528U, 393520U, 0U, {15U, 15U, 15U, 15U}, {'B', 'R', 'B', '1', '\000'}}, {262564U, 262556U, 64U, {255U, 255U, 255U, 255U}, {'P', 'R', 'S', '\000'}}, {1311204U, 1311196U, 0U, {0U, 262143U, 1048575U, 268435455U}, {'P', 'B', 'F', '\000'}}, {1458444U, 1458436U, 0U, {0U, 127U, 127U, 127U}, {'T', 'M', '\000'}}, {271036U, 271028U, 24U, {2047U, 2047U, 2047U, 2047U}, {'T', 'S', 'D', 'M', '\000'}}, {795324U, 795316U, 8U, {2047U, 2047U, 2047U, 2047U}, {'C', 'S', 'D', 'M', '\000'}}, {803520U, 803512U, 56U, {2047U, 2047U, 2047U, 2047U}, {'U', 'S', 'D', 'M', '\000'}}, {1467068U, 1467060U, 8U, {2047U, 2047U, 2047U, 2047U}, {'X', 'S', 'D', 'M', '\000'}}, {328172U, 328164U, 0U, {0U, 134217727U, 134217727U, 134217727U}, {'T', 'C', 'M', '\000'}}, {852468U, 852460U, 0U, {0U, 134217727U, 134217727U, 134217727U}, {'C', 'C', 'M', '\000'}}, {917988U, 917980U, 0U, {0U, 134217727U, 134217727U, 134217727U}, {'U', 'C', 'M', '\000'}}, {131780U, 131772U, 0U, {0U, 1073741823U, 1073741823U, 1073741823U}, {'X', 'C', 'M', '\000'}}, {1573152U, 1573144U, 0U, {4294967295U, 4294967295U, 4294967295U, 4294967295U}, {'T', 'S', 'E', 'M', '_', '0', '\000'}}, {1573168U, 1573160U, 0U, {3U, 31U, 63U, 63U}, {'T', 'S', 'E', 'M', '_', '1', '\000'}}, {3146032U, 3146024U, 0U, {4294967295U, 4294967295U, 4294967295U, 4294967295U}, {'U', 'S', 'E', 'M', '_', '0', '\000'}}, {3146048U, 3146040U, 0U, {3U, 31U, 31U, 31U}, {'U', 'S', 'E', 'M', '_', '1', '\000'}}, {2097456U, 2097448U, 0U, {4294967295U, 4294967295U, 4294967295U, 4294967295U}, {'C', 'S', 'E', 'M', '_', '0', '\000'}}, {2097472U, 2097464U, 0U, {3U, 31U, 31U, 31U}, {'C', 'S', 'E', 'M', '_', '1', '\000'}}, {2621744U, 2621736U, 0U, {4294967295U, 4294967295U, 4294967295U, 4294967295U}, {'X', 'S', 'E', 'M', '_', '0', '\000'}}, {2621760U, 2621752U, 0U, {3U, 31U, 63U, 63U}, {'X', 'S', 'E', 'M', '_', '1', '\000'}}}; static u32 const mcp_attn_ctl_regs___0[6U] = { 41080U, 41208U, 41224U, 41240U, 41368U, 41384U}; __inline static void bnx2x_set_mcp_parity___0(struct bnx2x *bp , u8 enable ) { int i ; u32 reg_val ; { i = 0; goto ldv_45296; ldv_45295: reg_val = readl((void const volatile *)bp->regview + (unsigned long )mcp_attn_ctl_regs___0[i]); if ((unsigned int )enable != 0U) { reg_val = reg_val | 4026531840U; } else { reg_val = reg_val & 268435455U; } writel(reg_val, (void volatile *)bp->regview + (unsigned long )mcp_attn_ctl_regs___0[i]); i = i + 1; ldv_45296: ; if ((unsigned int )i <= 5U) { goto ldv_45295; } else { } return; } } __inline static u32 bnx2x_parity_reg_mask___0(struct bnx2x *bp , int idx ) { { if (bp->common.chip_id >> 16 == 5710U) { return ((u32 )bnx2x_blocks_parity_data___0[idx].reg_mask.e1); } else if (bp->common.chip_id >> 16 == 5711U || bp->common.chip_id >> 16 == 5712U) { return ((u32 )bnx2x_blocks_parity_data___0[idx].reg_mask.e1h); } else if ((bp->common.chip_id >> 16 == 5730U || bp->common.chip_id >> 16 == 5731U) || bp->common.chip_id >> 16 == 5743U) { return ((u32 )bnx2x_blocks_parity_data___0[idx].reg_mask.e2); } else { return ((u32 )bnx2x_blocks_parity_data___0[idx].reg_mask.e3); } } } __inline static void bnx2x_disable_blocks_parity(struct bnx2x *bp ) { int i ; u32 dis_mask ; u32 tmp ; long tmp___0 ; { i = 0; goto ldv_45311; ldv_45310: tmp = bnx2x_parity_reg_mask___0(bp, i); dis_mask = tmp; if (dis_mask != 0U) { writel(dis_mask, (void volatile *)bp->regview + (unsigned long )bnx2x_blocks_parity_data___0[i].mask_addr); tmp___0 = ldv__builtin_expect((bp->msg_enable & 8192) != 0, 0L); if (tmp___0 != 0L) { printk("\rbnx2x: [%s:%d(%s)]Setting parity mask for %s to\t\t0x%x\n", "bnx2x_disable_blocks_parity", 703, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (char const *)(& bnx2x_blocks_parity_data___0[i].name), dis_mask); } else { } } else { } i = i + 1; ldv_45311: ; if ((unsigned int )i <= 39U) { goto ldv_45310; } else { } bnx2x_set_mcp_parity___0(bp, 0); return; } } __inline static void bnx2x_clear_blocks_parity(struct bnx2x *bp ) { int i ; u32 reg_val ; u32 mcp_aeu_bits ; u32 reg_mask ; u32 tmp ; long tmp___0 ; long tmp___1 ; { mcp_aeu_bits = 4026531840U; writel(1U, (void volatile *)bp->regview + 2852928U); writel(1U, (void volatile *)bp->regview + 1804352U); writel(1U, (void volatile *)bp->regview + 3377216U); writel(1U, (void volatile *)bp->regview + 2328640U); i = 0; goto ldv_45324; ldv_45323: tmp = bnx2x_parity_reg_mask___0(bp, i); reg_mask = tmp; if (reg_mask != 0U) { reg_val = readl((void const volatile *)bp->regview + (unsigned long )bnx2x_blocks_parity_data___0[i].sts_clr_addr); if ((reg_val & reg_mask) != 0U) { tmp___0 = ldv__builtin_expect((bp->msg_enable & 8192) != 0, 0L); if (tmp___0 != 0L) { printk("\rbnx2x: [%s:%d(%s)]Parity errors in %s: 0x%x\n", "bnx2x_clear_blocks_parity", 737, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (char const *)(& bnx2x_blocks_parity_data___0[i].name), reg_val & reg_mask); } else { } } else { } } else { } i = i + 1; ldv_45324: ; if ((unsigned int )i <= 39U) { goto ldv_45323; } else { } reg_val = readl((void const volatile *)bp->regview + 42072U); if ((reg_val & mcp_aeu_bits) != 0U) { tmp___1 = ldv__builtin_expect((bp->msg_enable & 8192) != 0, 0L); if (tmp___1 != 0L) { printk("\rbnx2x: [%s:%d(%s)]Parity error in MCP: 0x%x\n", "bnx2x_clear_blocks_parity", 745, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", reg_val & mcp_aeu_bits); } else { } } else { } writel(1920U, (void volatile *)bp->regview + 42076U); return; } } __inline static void bnx2x_enable_blocks_parity___0(struct bnx2x *bp ) { int i ; u32 reg_mask ; u32 tmp ; { i = 0; goto ldv_45334; ldv_45333: tmp = bnx2x_parity_reg_mask___0(bp, i); reg_mask = tmp; if (reg_mask != 0U) { writel((unsigned int )bnx2x_blocks_parity_data___0[i].en_mask & reg_mask, (void volatile *)bp->regview + (unsigned long )bnx2x_blocks_parity_data___0[i].mask_addr); } else { } i = i + 1; ldv_45334: ; if ((unsigned int )i <= 39U) { goto ldv_45333; } else { } bnx2x_set_mcp_parity___0(bp, 1); return; } } static struct __anonstruct_bnx2x_q_stats_arr_253 const bnx2x_q_stats_arr[16U] = { {6L, 8, {'[', '%', 's', ']', ':', ' ', 'r', 'x', '_', 'b', 'y', 't', 'e', 's', '\000'}}, {16L, 8, {'[', '%', 's', ']', ':', ' ', 'r', 'x', '_', 'u', 'c', 'a', 's', 't', '_', 'p', 'a', 'c', 'k', 'e', 't', 's', '\000'}}, {18L, 8, {'[', '%', 's', ']', ':', ' ', 'r', 'x', '_', 'm', 'c', 'a', 's', 't', '_', 'p', 'a', 'c', 'k', 'e', 't', 's', '\000'}}, {20L, 8, {'[', '%', 's', ']', ':', ' ', 'r', 'x', '_', 'b', 'c', 'a', 's', 't', '_', 'p', 'a', 'c', 'k', 'e', 't', 's', '\000'}}, {32L, 8, {'[', '%', 's', ']', ':', ' ', 'r', 'x', '_', 'd', 'i', 's', 'c', 'a', 'r', 'd', 's', '\000'}}, {35L, 4, {'[', '%', 's', ']', ':', ' ', 'r', 'x', '_', 'p', 'h', 'y', '_', 'i', 'p', '_', 'e', 'r', 'r', '_', 'd', 'i', 's', 'c', 'a', 'r', 'd', 's', '\000'}}, {36L, 4, {'[', '%', 's', ']', ':', ' ', 'r', 'x', '_', 's', 'k', 'b', '_', 'a', 'l', 'l', 'o', 'c', '_', 'd', 'i', 's', 'c', 'a', 'r', 'd', '\000'}}, {37L, 4, {'[', '%', 's', ']', ':', ' ', 'r', 'x', '_', 'c', 's', 'u', 'm', '_', 'o', 'f', 'f', 'l', 'o', 'a', 'd', '_', 'e', 'r', 'r', 'o', 'r', 's', '\000'}}, {14L, 8, {'[', '%', 's', ']', ':', ' ', 't', 'x', '_', 'b', 'y', 't', 'e', 's', '\000'}}, {22L, 8, {'[', '%', 's', ']', ':', ' ', 't', 'x', '_', 'u', 'c', 'a', 's', 't', '_', 'p', 'a', 'c', 'k', 'e', 't', 's', '\000'}}, {24L, 8, {'[', '%', 's', ']', ':', ' ', 't', 'x', '_', 'm', 'c', 'a', 's', 't', '_', 'p', 'a', 'c', 'k', 'e', 't', 's', '\000'}}, {26L, 8, {'[', '%', 's', ']', ':', ' ', 't', 'x', '_', 'b', 'c', 'a', 's', 't', '_', 'p', 'a', 'c', 'k', 'e', 't', 's', '\000'}}, {44L, 8, {'[', '%', 's', ']', ':', ' ', 't', 'p', 'a', '_', 'a', 'g', 'g', 'r', 'e', 'g', 'a', 't', 'i', 'o', 'n', 's', '\000'}}, {46L, 8, {'[', '%', 's', ']', ':', ' ', 't', 'p', 'a', '_', 'a', 'g', 'g', 'r', 'e', 'g', 'a', 't', 'e', 'd', '_', 'f', 'r', 'a', 'm', 'e', 's', '\000'}}, {48L, 8, {'[', '%', 's', ']', ':', ' ', 't', 'p', 'a', '_', 'b', 'y', 't', 'e', 's', '\000'}}, {50L, 4, {'[', '%', 's', ']', ':', ' ', 'd', 'r', 'i', 'v', 'e', 'r', '_', 'f', 'i', 'l', 't', 'e', 'r', 'e', 'd', '_', 't', 'x', '_', 'p', 'k', 't', '\000'}}}; static struct __anonstruct_bnx2x_stats_arr_254 const bnx2x_stats_arr[52U] = { {0L, 8, 3U, {'r', 'x', '_', 'b', 'y', 't', 'e', 's', '\000'}}, {18L, 8, 3U, {'r', 'x', '_', 'e', 'r', 'r', 'o', 'r', '_', 'b', 'y', 't', 'e', 's', '\000'}}, {4L, 8, 3U, {'r', 'x', '_', 'u', 'c', 'a', 's', 't', '_', 'p', 'a', 'c', 'k', 'e', 't', 's', '\000'}}, {6L, 8, 3U, {'r', 'x', '_', 'm', 'c', 'a', 's', 't', '_', 'p', 'a', 'c', 'k', 'e', 't', 's', '\000'}}, {8L, 8, 3U, {'r', 'x', '_', 'b', 'c', 'a', 's', 't', '_', 'p', 'a', 'c', 'k', 'e', 't', 's', '\000'}}, {28L, 8, 1U, {'r', 'x', '_', 'c', 'r', 'c', '_', 'e', 'r', 'r', 'o', 'r', 's', '\000'}}, {30L, 8, 1U, {'r', 'x', '_', 'a', 'l', 'i', 'g', 'n', '_', 'e', 'r', 'r', 'o', 'r', 's', '\000'}}, {36L, 8, 1U, {'r', 'x', '_', 'u', 'n', 'd', 'e', 'r', 's', 'i', 'z', 'e', '_', 'p', 'a', 'c', 'k', 'e', 't', 's', '\000'}}, {20L, 8, 1U, {'r', 'x', '_', 'o', 'v', 'e', 'r', 's', 'i', 'z', 'e', '_', 'p', 'a', 'c', 'k', 'e', 't', 's', '\000'}}, {40L, 8, 1U, {'r', 'x', '_', 'f', 'r', 'a', 'g', 'm', 'e', 'n', 't', 's', '\000'}}, {42L, 8, 1U, {'r', 'x', '_', 'j', 'a', 'b', 'b', 'e', 'r', 's', '\000'}}, {22L, 8, 3U, {'r', 'x', '_', 'd', 'i', 's', 'c', 'a', 'r', 'd', 's', '\000'}}, {112L, 4, 1U, {'r', 'x', '_', 'f', 'i', 'l', 't', 'e', 'r', 'e', 'd', '_', 'p', 'a', 'c', 'k', 'e', 't', 's', '\000'}}, {113L, 4, 1U, {'r', 'x', '_', 'm', 'f', '_', 't', 'a', 'g', '_', 'd', 'i', 's', 'c', 'a', 'r', 'd', '\000'}}, {127L, 8, 1U, {'p', 'f', 'c', '_', 'f', 'r', 'a', 'm', 'e', 's', '_', 'r', 'e', 'c', 'e', 'i', 'v', 'e', 'd', '\000'}}, {129L, 8, 1U, {'p', 'f', 'c', '_', 'f', 'r', 'a', 'm', 'e', 's', '_', 's', 'e', 'n', 't', '\000'}}, {108L, 8, 1U, {'r', 'x', '_', 'b', 'r', 'b', '_', 'd', 'i', 's', 'c', 'a', 'r', 'd', '\000'}}, {110L, 8, 1U, {'r', 'x', '_', 'b', 'r', 'b', '_', 't', 'r', 'u', 'n', 'c', 'a', 't', 'e', '\000'}}, {100L, 8, 1U, {'r', 'x', '_', 'p', 'a', 'u', 's', 'e', '_', 'f', 'r', 'a', 'm', 'e', 's', '\000'}}, {44L, 8, 1U, {'r', 'x', '_', 'm', 'a', 'c', '_', 'c', 't', 'r', 'l', '_', 'f', 'r', 'a', 'm', 'e', 's', '\000'}}, {120L, 4, 1U, {'r', 'x', '_', 'c', 'o', 'n', 's', 't', 'a', 'n', 't', '_', 'p', 'a', 'u', 's', 'e', '_', 'e', 'v', 'e', 'n', 't', 's', '\000'}}, {117L, 4, 3U, {'r', 'x', '_', 'p', 'h', 'y', '_', 'i', 'p', '_', 'e', 'r', 'r', '_', 'd', 'i', 's', 'c', 'a', 'r', 'd', 's', '\000'}}, {118L, 4, 3U, {'r', 'x', '_', 's', 'k', 'b', '_', 'a', 'l', 'l', 'o', 'c', '_', 'd', 'i', 's', 'c', 'a', 'r', 'd', '\000'}}, {119L, 4, 3U, {'r', 'x', '_', 'c', 's', 'u', 'm', '_', 'o', 'f', 'f', 'l', 'o', 'a', 'd', '_', 'e', 'r', 'r', 'o', 'r', 's', '\000'}}, {2L, 8, 3U, {'t', 'x', '_', 'b', 'y', 't', 'e', 's', '\000'}}, {26L, 8, 1U, {'t', 'x', '_', 'e', 'r', 'r', 'o', 'r', '_', 'b', 'y', 't', 'e', 's', '\000'}}, {10L, 8, 3U, {'t', 'x', '_', 'u', 'c', 'a', 's', 't', '_', 'p', 'a', 'c', 'k', 'e', 't', 's', '\000'}}, {12L, 8, 3U, {'t', 'x', '_', 'm', 'c', 'a', 's', 't', '_', 'p', 'a', 'c', 'k', 'e', 't', 's', '\000'}}, {14L, 8, 3U, {'t', 'x', '_', 'b', 'c', 'a', 's', 't', '_', 'p', 'a', 'c', 'k', 'e', 't', 's', '\000'}}, {96L, 8, 1U, {'t', 'x', '_', 'm', 'a', 'c', '_', 'e', 'r', 'r', 'o', 'r', 's', '\000'}}, {32L, 8, 1U, {'t', 'x', '_', 'c', 'a', 'r', 'r', 'i', 'e', 'r', '_', 'e', 'r', 'r', 'o', 'r', 's', '\000'}}, {64L, 8, 1U, {'t', 'x', '_', 's', 'i', 'n', 'g', 'l', 'e', '_', 'c', 'o', 'l', 'l', 'i', 's', 'i', 'o', 'n', 's', '\000'}}, {66L, 8, 1U, {'t', 'x', '_', 'm', 'u', 'l', 't', 'i', '_', 'c', 'o', 'l', 'l', 'i', 's', 'i', 'o', 'n', 's', '\000'}}, {68L, 8, 1U, {'t', 'x', '_', 'd', 'e', 'f', 'e', 'r', 'r', 'e', 'd', '\000'}}, {70L, 8, 1U, {'t', 'x', '_', 'e', 'x', 'c', 'e', 's', 's', '_', 'c', 'o', 'l', 'l', 'i', 's', 'i', 'o', 'n', 's', '\000'}}, {72L, 8, 1U, {'t', 'x', '_', 'l', 'a', 't', 'e', '_', 'c', 'o', 'l', 'l', 'i', 's', 'i', 'o', 'n', 's', '\000'}}, {62L, 8, 1U, {'t', 'x', '_', 't', 'o', 't', 'a', 'l', '_', 'c', 'o', 'l', 'l', 'i', 's', 'i', 'o', 'n', 's', '\000'}}, {74L, 8, 1U, {'t', 'x', '_', '6', '4', '_', 'b', 'y', 't', 'e', '_', 'p', 'a', 'c', 'k', 'e', 't', 's', '\000'}}, {76L, 8, 1U, {'t', 'x', '_', '6', '5', '_', 't', 'o', '_', '1', '2', '7', '_', 'b', 'y', 't', 'e', '_', 'p', 'a', 'c', 'k', 'e', 't', 's', '\000'}}, {78L, 8, 1U, {'t', 'x', '_', '1', '2', '8', '_', 't', 'o', '_', '2', '5', '5', '_', 'b', 'y', 't', 'e', '_', 'p', 'a', 'c', 'k', 'e', 't', 's', '\000'}}, {80L, 8, 1U, {'t', 'x', '_', '2', '5', '6', '_', 't', 'o', '_', '5', '1', '1', '_', 'b', 'y', 't', 'e', '_', 'p', 'a', 'c', 'k', 'e', 't', 's', '\000'}}, {82L, 8, 1U, {'t', 'x', '_', '5', '1', '2', '_', 't', 'o', '_', '1', '0', '2', '3', '_', 'b', 'y', 't', 'e', '_', 'p', 'a', 'c', 'k', 'e', 't', 's', '\000'}}, {104L, 8, 1U, {'t', 'x', '_', '1', '0', '2', '4', '_', 't', 'o', '_', '1', '5', '2', '2', '_', 'b', 'y', 't', 'e', '_', 'p', 'a', 'c', 'k', 'e', 't', 's', '\000'}}, {106L, 8, 1U, {'t', 'x', '_', '1', '5', '2', '3', '_', 't', 'o', '_', '9', '0', '2', '2', '_', 'b', 'y', 't', 'e', '_', 'p', 'a', 'c', 'k', 'e', 't', 's', '\000'}}, {102L, 8, 1U, {'t', 'x', '_', 'p', 'a', 'u', 's', 'e', '_', 'f', 'r', 'a', 'm', 'e', 's', '\000'}}, {121L, 8, 2U, {'t', 'p', 'a', '_', 'a', 'g', 'g', 'r', 'e', 'g', 'a', 't', 'i', 'o', 'n', 's', '\000'}}, {123L, 8, 2U, {'t', 'p', 'a', '_', 'a', 'g', 'g', 'r', 'e', 'g', 'a', 't', 'e', 'd', '_', 'f', 'r', 'a', 'm', 'e', 's', '\000'}}, {125L, 8, 2U, {'t', 'p', 'a', '_', 'b', 'y', 't', 'e', 's', '\000'}}, {131L, 4, 2U, {'r', 'e', 'c', 'o', 'v', 'e', 'r', 'a', 'b', 'l', 'e', '_', 'e', 'r', 'r', 'o', 'r', 's', '\000'}}, {132L, 4, 2U, {'u', 'n', 'r', 'e', 'c', 'o', 'v', 'e', 'r', 'a', 'b', 'l', 'e', '_', 'e', 'r', 'r', 'o', 'r', 's', '\000'}}, {133L, 4, 2U, {'d', 'r', 'i', 'v', 'e', 'r', '_', 'f', 'i', 'l', 't', 'e', 'r', 'e', 'd', '_', 't', 'x', '_', 'p', 'k', 't', '\000'}}, {134L, 4, 1U, {'T', 'x', ' ', 'L', 'P', 'I', ' ', 'e', 'n', 't', 'r', 'y', ' ', 'c', 'o', 'u', 'n', 't', '\000'}}}; static int bnx2x_get_port_type(struct bnx2x *bp ) { int port_type ; u32 phy_idx ; int tmp ; { tmp = bnx2x_get_cur_phy_idx(bp); phy_idx = (u32 )tmp; switch (bp->link_params.phy[phy_idx].media_type) { case 1U: ; case 5U: ; case 2U: ; case 240U: ; case 241U: port_type = 3; goto ldv_45357; case 3U: port_type = 5; goto ldv_45357; case 4U: port_type = 0; goto ldv_45357; case 255U: port_type = 239; goto ldv_45357; case 0U: ; default: port_type = 255; goto ldv_45357; } ldv_45357: ; return (port_type); } } static int bnx2x_get_settings(struct net_device *dev , struct ethtool_cmd *cmd ) { struct bnx2x *bp ; void *tmp ; int cfg_idx ; int tmp___0 ; int tmp___1 ; u16 tmp___2 ; int tmp___3 ; u32 status ; __u32 tmp___4 ; long tmp___5 ; { tmp = netdev_priv((struct net_device const *)dev); bp = (struct bnx2x *)tmp; tmp___0 = bnx2x_get_link_cfg_idx(bp); cfg_idx = tmp___0; cmd->supported = bp->port.supported[cfg_idx] | (bp->port.supported[cfg_idx ^ 1] & 1152U); cmd->advertising = bp->port.advertising[cfg_idx]; tmp___1 = bnx2x_get_cur_phy_idx(bp); if (bp->link_params.phy[tmp___1].media_type == 5U) { cmd->supported = cmd->supported & 4294963199U; cmd->advertising = cmd->advertising & 4294963199U; } else { } if (((unsigned int )bp->state == 12288U && (unsigned int )bp->link_vars.link_up != 0U) && (bp->flags & 2048U) == 0U) { cmd->duplex = (__u8 )bp->link_vars.duplex; if ((unsigned int )bp->mf_mode != 0U && (bp->flags & 512U) == 0U) { tmp___2 = bnx2x_get_mf_speed(bp); ethtool_cmd_speed_set(cmd, (__u32 )tmp___2); } else { ethtool_cmd_speed_set(cmd, (__u32 )bp->link_vars.line_speed); } } else { cmd->duplex = 255U; ethtool_cmd_speed_set(cmd, 4294967295U); } tmp___3 = bnx2x_get_port_type(bp); cmd->port = (__u8 )tmp___3; cmd->phy_address = (__u8 )bp->mdio.prtad; cmd->transceiver = 0U; if ((unsigned int )bp->link_params.req_line_speed[cfg_idx] == 0U) { cmd->autoneg = 1U; } else { cmd->autoneg = 0U; } if ((bp->link_vars.link_status & 64U) != 0U) { status = bp->link_vars.link_status; cmd->lp_advertising = cmd->lp_advertising | 64U; if ((status & 262144U) != 0U) { cmd->lp_advertising = cmd->lp_advertising | 8192U; } else { } if ((status & 524288U) != 0U) { cmd->lp_advertising = cmd->lp_advertising | 16384U; } else { } if ((status & 32768U) != 0U) { cmd->lp_advertising = cmd->lp_advertising | 1U; } else { } if ((status & 16384U) != 0U) { cmd->lp_advertising = cmd->lp_advertising | 2U; } else { } if ((status & 8192U) != 0U) { cmd->lp_advertising = cmd->lp_advertising | 4U; } else { } if ((status & 4096U) != 0U) { cmd->lp_advertising = cmd->lp_advertising | 8U; } else { } if ((status & 1024U) != 0U) { cmd->lp_advertising = cmd->lp_advertising | 16U; } else { } if ((status & 512U) != 0U) { cmd->lp_advertising = cmd->lp_advertising | 32U; } else { } if ((status & 2097152U) != 0U) { cmd->lp_advertising = cmd->lp_advertising | 32768U; } else { } if ((status & 8388608U) != 0U) { cmd->lp_advertising = cmd->lp_advertising | 4096U; } else { } if ((status & 268435456U) != 0U) { cmd->lp_advertising = cmd->lp_advertising | 4194304U; } else { } } else { } cmd->maxtxpkt = 0U; cmd->maxrxpkt = 0U; tmp___5 = ldv__builtin_expect((bp->msg_enable & 67108864) != 0, 0L); if (tmp___5 != 0L) { tmp___4 = ethtool_cmd_speed((struct ethtool_cmd const *)cmd); printk("\rbnx2x: [%s:%d(%s)]ethtool_cmd: cmd %d\n supported 0x%x advertising 0x%x speed %u\n duplex %d port %d phy_address %d transceiver %d\n autoneg %d maxtxpkt %d maxrxpkt %d\n", "bnx2x_get_settings", 370, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", cmd->cmd, cmd->supported, cmd->advertising, tmp___4, (int )cmd->duplex, (int )cmd->port, (int )cmd->phy_address, (int )cmd->transceiver, (int )cmd->autoneg, cmd->maxtxpkt, cmd->maxrxpkt); } else { } return (0); } } static int bnx2x_set_settings(struct net_device *dev , struct ethtool_cmd *cmd ) { struct bnx2x *bp ; void *tmp ; u32 advertising ; u32 cfg_idx ; u32 old_multi_phy_config ; u32 new_multi_phy_config ; u32 speed ; u32 phy_idx ; __u32 tmp___0 ; long tmp___1 ; u32 part ; u32 line_speed ; long tmp___2 ; long tmp___3 ; int tmp___4 ; long tmp___5 ; long tmp___6 ; long tmp___7 ; int tmp___8 ; long tmp___9 ; u32 an_supported_speed ; long tmp___10 ; long tmp___11 ; long tmp___12 ; long tmp___13 ; long tmp___14 ; long tmp___15 ; long tmp___16 ; long tmp___17 ; long tmp___18 ; long tmp___19 ; long tmp___20 ; int tmp___21 ; long tmp___22 ; long tmp___23 ; long tmp___24 ; bool tmp___25 ; { tmp = netdev_priv((struct net_device const *)dev); bp = (struct bnx2x *)tmp; if ((unsigned int )bp->mf_mode == 1U) { return (0); } else { } tmp___1 = ldv__builtin_expect((bp->msg_enable & 67108864) != 0, 0L); if (tmp___1 != 0L) { tmp___0 = ethtool_cmd_speed((struct ethtool_cmd const *)cmd); printk("\rbnx2x: [%s:%d(%s)]ethtool_cmd: cmd %d\n supported 0x%x advertising 0x%x speed %u\n duplex %d port %d phy_address %d transceiver %d\n autoneg %d maxtxpkt %d maxrxpkt %d\n", "bnx2x_set_settings", 391, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", cmd->cmd, cmd->supported, cmd->advertising, tmp___0, (int )cmd->duplex, (int )cmd->port, (int )cmd->phy_address, (int )cmd->transceiver, (int )cmd->autoneg, cmd->maxtxpkt, cmd->maxrxpkt); } else { } speed = ethtool_cmd_speed((struct ethtool_cmd const *)cmd); if ((unsigned int )cmd->duplex == 255U) { cmd->duplex = 1U; } else { } if ((unsigned int )bp->mf_mode == 2U) { line_speed = (u32 )bp->link_vars.line_speed; if (line_speed == 0U) { line_speed = 10000U; } else { } if (bp->common.bc_ver <= 393729U) { tmp___2 = ldv__builtin_expect((bp->msg_enable & 67108864) != 0, 0L); if (tmp___2 != 0L) { printk("\rbnx2x: [%s:%d(%s)]To set speed BC %X or higher is required, please upgrade BC\n", "bnx2x_set_settings", 410, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", 393730); } else { } return (-22); } else { } part = (speed * 100U) / line_speed; if (line_speed < speed || part == 0U) { tmp___3 = ldv__builtin_expect((bp->msg_enable & 67108864) != 0, 0L); if (tmp___3 != 0L) { printk("\rbnx2x: [%s:%d(%s)]Speed setting should be in a range from 1%% to 100%% of actual line speed\n", "bnx2x_set_settings", 418, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } return (-22); } else { } if ((unsigned int )bp->state != 12288U) { bp->pending_max = part; } else { bnx2x_update_max_mf_config(bp, part); } return (0); } else { } tmp___4 = bnx2x_get_link_cfg_idx(bp); cfg_idx = (u32 )tmp___4; old_multi_phy_config = bp->link_params.multi_phy_config; switch ((int )cmd->port) { case 0: ; if ((bp->port.supported[cfg_idx] & 128U) != 0U) { goto ldv_45386; } else { } if ((bp->port.supported[0] & 128U) == 0U && (bp->port.supported[1] & 128U) == 0U) { tmp___5 = ldv__builtin_expect((bp->msg_enable & 67108864) != 0, 0L); if (tmp___5 != 0L) { printk("\rbnx2x: [%s:%d(%s)]Unsupported port type\n", "bnx2x_set_settings", 440, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } return (-22); } else { } bp->link_params.multi_phy_config = bp->link_params.multi_phy_config & 4294967288U; if ((bp->link_params.multi_phy_config & 8U) != 0U) { bp->link_params.multi_phy_config = bp->link_params.multi_phy_config | 2U; } else { bp->link_params.multi_phy_config = bp->link_params.multi_phy_config | 1U; } goto ldv_45386; case 3: ; case 5: ; if ((bp->port.supported[cfg_idx] & 1024U) != 0U) { goto ldv_45386; } else { } if ((bp->port.supported[0] & 1024U) == 0U && (bp->port.supported[1] & 1024U) == 0U) { tmp___6 = ldv__builtin_expect((bp->msg_enable & 67108864) != 0, 0L); if (tmp___6 != 0L) { printk("\rbnx2x: [%s:%d(%s)]Unsupported port type\n", "bnx2x_set_settings", 460, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } return (-22); } else { } bp->link_params.multi_phy_config = bp->link_params.multi_phy_config & 4294967288U; if ((bp->link_params.multi_phy_config & 8U) != 0U) { bp->link_params.multi_phy_config = bp->link_params.multi_phy_config | 1U; } else { bp->link_params.multi_phy_config = bp->link_params.multi_phy_config | 2U; } goto ldv_45386; default: tmp___7 = ldv__builtin_expect((bp->msg_enable & 67108864) != 0, 0L); if (tmp___7 != 0L) { printk("\rbnx2x: [%s:%d(%s)]Unsupported port type\n", "bnx2x_set_settings", 474, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } return (-22); } ldv_45386: new_multi_phy_config = bp->link_params.multi_phy_config; tmp___8 = bnx2x_get_link_cfg_idx(bp); cfg_idx = (u32 )tmp___8; bp->link_params.multi_phy_config = old_multi_phy_config; tmp___9 = ldv__builtin_expect((bp->msg_enable & 67108864) != 0, 0L); if (tmp___9 != 0L) { printk("\rbnx2x: [%s:%d(%s)]cfg_idx = %x\n", "bnx2x_set_settings", 483, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", cfg_idx); } else { } if ((unsigned int )cmd->autoneg == 1U) { an_supported_speed = bp->port.supported[cfg_idx]; if (bp->link_params.phy[1].type == 3328U) { an_supported_speed = an_supported_speed | 12U; } else { } if ((bp->port.supported[cfg_idx] & 64U) == 0U) { tmp___10 = ldv__builtin_expect((bp->msg_enable & 67108864) != 0, 0L); if (tmp___10 != 0L) { printk("\rbnx2x: [%s:%d(%s)]Autoneg not supported\n", "bnx2x_set_settings", 492, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } return (-22); } else { } if ((cmd->advertising & ~ an_supported_speed) != 0U) { tmp___11 = ldv__builtin_expect((bp->msg_enable & 67108864) != 0, 0L); if (tmp___11 != 0L) { printk("\rbnx2x: [%s:%d(%s)]Advertisement parameters are not supported\n", "bnx2x_set_settings", 499, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } return (-22); } else { } bp->link_params.req_line_speed[cfg_idx] = 0U; bp->link_params.req_duplex[cfg_idx] = (u16 )cmd->duplex; bp->port.advertising[cfg_idx] = cmd->advertising | 64U; if (cmd->advertising != 0U) { bp->link_params.speed_cap_mask[cfg_idx] = 0U; if ((int )cmd->advertising & 1) { bp->link_params.speed_cap_mask[cfg_idx] = bp->link_params.speed_cap_mask[cfg_idx] | 131072U; } else { } if ((cmd->advertising & 2U) != 0U) { bp->link_params.speed_cap_mask[cfg_idx] = bp->link_params.speed_cap_mask[cfg_idx] | 65536U; } else { } if ((cmd->advertising & 8U) != 0U) { bp->link_params.speed_cap_mask[cfg_idx] = bp->link_params.speed_cap_mask[cfg_idx] | 524288U; } else { } if ((cmd->advertising & 4U) != 0U) { bp->link_params.speed_cap_mask[cfg_idx] = bp->link_params.speed_cap_mask[cfg_idx] | 262144U; } else { } if ((cmd->advertising & 16U) != 0U) { bp->link_params.speed_cap_mask[cfg_idx] = bp->link_params.speed_cap_mask[cfg_idx] | 1048576U; } else { } if ((cmd->advertising & 131104U) != 0U) { bp->link_params.speed_cap_mask[cfg_idx] = bp->link_params.speed_cap_mask[cfg_idx] | 1048576U; } else { } if ((cmd->advertising & 790528U) != 0U) { bp->link_params.speed_cap_mask[cfg_idx] = bp->link_params.speed_cap_mask[cfg_idx] | 4194304U; } else { } if ((cmd->advertising & 4194304U) != 0U) { bp->link_params.speed_cap_mask[cfg_idx] = bp->link_params.speed_cap_mask[cfg_idx] | 8388608U; } else { } } else { } } else { switch (speed) { case 10U: ; if ((unsigned int )cmd->duplex == 1U) { if ((bp->port.supported[cfg_idx] & 2U) == 0U) { tmp___12 = ldv__builtin_expect((bp->msg_enable & 67108864) != 0, 0L); if (tmp___12 != 0L) { printk("\rbnx2x: [%s:%d(%s)]10M full not supported\n", "bnx2x_set_settings", 553, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } return (-22); } else { } advertising = 130U; } else { if ((bp->port.supported[cfg_idx] & 1U) == 0U) { tmp___13 = ldv__builtin_expect((bp->msg_enable & 67108864) != 0, 0L); if (tmp___13 != 0L) { printk("\rbnx2x: [%s:%d(%s)]10M half not supported\n", "bnx2x_set_settings", 563, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } return (-22); } else { } advertising = 129U; } goto ldv_45392; case 100U: ; if ((unsigned int )cmd->duplex == 1U) { if ((bp->port.supported[cfg_idx] & 8U) == 0U) { tmp___14 = ldv__builtin_expect((bp->msg_enable & 67108864) != 0, 0L); if (tmp___14 != 0L) { printk("\rbnx2x: [%s:%d(%s)]100M full not supported\n", "bnx2x_set_settings", 577, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } return (-22); } else { } advertising = 136U; } else { if ((bp->port.supported[cfg_idx] & 4U) == 0U) { tmp___15 = ldv__builtin_expect((bp->msg_enable & 67108864) != 0, 0L); if (tmp___15 != 0L) { printk("\rbnx2x: [%s:%d(%s)]100M half not supported\n", "bnx2x_set_settings", 587, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } return (-22); } else { } advertising = 132U; } goto ldv_45392; case 1000U: ; if ((unsigned int )cmd->duplex != 1U) { tmp___16 = ldv__builtin_expect((bp->msg_enable & 67108864) != 0, 0L); if (tmp___16 != 0L) { printk("\rbnx2x: [%s:%d(%s)]1G half not supported\n", "bnx2x_set_settings", 599, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } return (-22); } else { } if ((bp->port.supported[cfg_idx] & 32U) == 0U) { tmp___17 = ldv__builtin_expect((bp->msg_enable & 67108864) != 0, 0L); if (tmp___17 != 0L) { printk("\rbnx2x: [%s:%d(%s)]1G full not supported\n", "bnx2x_set_settings", 606, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } return (-22); } else { } advertising = 160U; goto ldv_45392; case 2500U: ; if ((unsigned int )cmd->duplex != 1U) { tmp___18 = ldv__builtin_expect((bp->msg_enable & 67108864) != 0, 0L); if (tmp___18 != 0L) { printk("\rbnx2x: [%s:%d(%s)]2.5G half not supported\n", "bnx2x_set_settings", 617, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } return (-22); } else { } if ((bp->port.supported[cfg_idx] & 32768U) == 0U) { tmp___19 = ldv__builtin_expect((bp->msg_enable & 67108864) != 0, 0L); if (tmp___19 != 0L) { printk("\rbnx2x: [%s:%d(%s)]2.5G full not supported\n", "bnx2x_set_settings", 624, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } return (-22); } else { } advertising = 32896U; goto ldv_45392; case 10000U: ; if ((unsigned int )cmd->duplex != 1U) { tmp___20 = ldv__builtin_expect((bp->msg_enable & 67108864) != 0, 0L); if (tmp___20 != 0L) { printk("\rbnx2x: [%s:%d(%s)]10G half not supported\n", "bnx2x_set_settings", 635, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } return (-22); } else { } tmp___21 = bnx2x_get_cur_phy_idx(bp); phy_idx = (u32 )tmp___21; if ((bp->port.supported[cfg_idx] & 4096U) == 0U || bp->link_params.phy[phy_idx].media_type == 5U) { tmp___22 = ldv__builtin_expect((bp->msg_enable & 67108864) != 0, 0L); if (tmp___22 != 0L) { printk("\rbnx2x: [%s:%d(%s)]10G full not supported\n", "bnx2x_set_settings", 644, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } return (-22); } else { } advertising = 5120U; goto ldv_45392; default: tmp___23 = ldv__builtin_expect((bp->msg_enable & 67108864) != 0, 0L); if (tmp___23 != 0L) { printk("\rbnx2x: [%s:%d(%s)]Unsupported speed %u\n", "bnx2x_set_settings", 653, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", speed); } else { } return (-22); } ldv_45392: bp->link_params.req_line_speed[cfg_idx] = (u16 )speed; bp->link_params.req_duplex[cfg_idx] = (u16 )cmd->duplex; bp->port.advertising[cfg_idx] = advertising; } tmp___24 = ldv__builtin_expect((bp->msg_enable & 67108864) != 0, 0L); if (tmp___24 != 0L) { printk("\rbnx2x: [%s:%d(%s)]req_line_speed %d\n req_duplex %d advertising 0x%x\n", "bnx2x_set_settings", 666, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )bp->link_params.req_line_speed[cfg_idx], (int )bp->link_params.req_duplex[cfg_idx], bp->port.advertising[cfg_idx]); } else { } bp->link_params.multi_phy_config = new_multi_phy_config; tmp___25 = netif_running((struct net_device const *)dev); if ((int )tmp___25) { bnx2x_stats_handle(bp, 3); bnx2x_link_set(bp); } else { } return (0); } } static int __bnx2x_get_preset_regs_len(struct bnx2x *bp , u32 preset ) { { if (bp->common.chip_id >> 16 == 5710U) { return ((int )dump_num_registers[0][preset - 1U]); } else if (bp->common.chip_id >> 16 == 5711U || bp->common.chip_id >> 16 == 5712U) { return ((int )dump_num_registers[1][preset - 1U]); } else if ((bp->common.chip_id >> 16 == 5730U || bp->common.chip_id >> 16 == 5731U) || bp->common.chip_id >> 16 == 5743U) { return ((int )dump_num_registers[2][preset - 1U]); } else if ((((((((((bp->common.chip_id >> 16 == 5770U || bp->common.chip_id >> 16 == 5797U) || bp->common.chip_id >> 16 == 5801U) || bp->common.chip_id >> 16 == 5774U) || bp->common.chip_id >> 16 == 5806U) || bp->common.chip_id >> 16 == 5807U) || ((bp->common.chip_id >> 16 == 5693U || bp->common.chip_id >> 16 == 5694U) || bp->common.chip_id >> 16 == 5695U)) || ((bp->common.chip_id >> 16 == 5793U || bp->common.chip_id >> 16 == 5794U) || bp->common.chip_id >> 16 == 5773U)) || (bp->common.chip_id >> 16 == 5796U || bp->common.chip_id >> 16 == 5803U)) || bp->common.chip_id >> 16 == 5805U) && ((bp->common.chip_id & 61440U) > 20480U ? ((~ bp->common.chip_id & 61440U) >> 13) << 12 == 0U : (bp->common.chip_id & 61440U) == 0U)) { return ((int )dump_num_registers[3][preset - 1U]); } else if ((((((((((bp->common.chip_id >> 16 == 5770U || bp->common.chip_id >> 16 == 5797U) || bp->common.chip_id >> 16 == 5801U) || bp->common.chip_id >> 16 == 5774U) || bp->common.chip_id >> 16 == 5806U) || bp->common.chip_id >> 16 == 5807U) || ((bp->common.chip_id >> 16 == 5693U || bp->common.chip_id >> 16 == 5694U) || bp->common.chip_id >> 16 == 5695U)) || ((bp->common.chip_id >> 16 == 5793U || bp->common.chip_id >> 16 == 5794U) || bp->common.chip_id >> 16 == 5773U)) || (bp->common.chip_id >> 16 == 5796U || bp->common.chip_id >> 16 == 5803U)) || bp->common.chip_id >> 16 == 5805U) && ((bp->common.chip_id & 61440U) > 20480U ? ((~ bp->common.chip_id & 61440U) >> 13) << 12 == 4096U : (bp->common.chip_id & 61440U) == 4096U)) { return ((int )dump_num_registers[4][preset - 1U]); } else { return (0); } } } static int __bnx2x_get_regs_len(struct bnx2x *bp ) { u32 preset_idx ; int regdump_len ; int tmp ; { regdump_len = 0; preset_idx = 1U; goto ldv_45408; ldv_45407: tmp = __bnx2x_get_preset_regs_len(bp, preset_idx); regdump_len = tmp + regdump_len; preset_idx = preset_idx + 1U; ldv_45408: ; if (preset_idx <= 13U) { goto ldv_45407; } else { } return (regdump_len); } } static int bnx2x_get_regs_len(struct net_device *dev ) { struct bnx2x *bp ; void *tmp ; int regdump_len ; { tmp = netdev_priv((struct net_device const *)dev); bp = (struct bnx2x *)tmp; regdump_len = 0; regdump_len = __bnx2x_get_regs_len(bp); regdump_len = regdump_len * 4; regdump_len = (int )((unsigned int )regdump_len + 16U); return (regdump_len); } } static u32 const *__bnx2x_get_page_addr_ar(struct bnx2x *bp ) { { if ((bp->common.chip_id >> 16 == 5730U || bp->common.chip_id >> 16 == 5731U) || bp->common.chip_id >> 16 == 5743U) { return ((u32 const *)(& page_vals_e2)); } else if (((((((((bp->common.chip_id >> 16 == 5770U || bp->common.chip_id >> 16 == 5797U) || bp->common.chip_id >> 16 == 5801U) || bp->common.chip_id >> 16 == 5774U) || bp->common.chip_id >> 16 == 5806U) || bp->common.chip_id >> 16 == 5807U) || ((bp->common.chip_id >> 16 == 5693U || bp->common.chip_id >> 16 == 5694U) || bp->common.chip_id >> 16 == 5695U)) || ((bp->common.chip_id >> 16 == 5793U || bp->common.chip_id >> 16 == 5794U) || bp->common.chip_id >> 16 == 5773U)) || (bp->common.chip_id >> 16 == 5796U || bp->common.chip_id >> 16 == 5803U)) || bp->common.chip_id >> 16 == 5805U) { return ((u32 const *)(& page_vals_e3)); } else { return (0); } } } static u32 __bnx2x_get_page_reg_num(struct bnx2x *bp ) { { if ((bp->common.chip_id >> 16 == 5730U || bp->common.chip_id >> 16 == 5731U) || bp->common.chip_id >> 16 == 5743U) { return (2U); } else if (((((((((bp->common.chip_id >> 16 == 5770U || bp->common.chip_id >> 16 == 5797U) || bp->common.chip_id >> 16 == 5801U) || bp->common.chip_id >> 16 == 5774U) || bp->common.chip_id >> 16 == 5806U) || bp->common.chip_id >> 16 == 5807U) || ((bp->common.chip_id >> 16 == 5693U || bp->common.chip_id >> 16 == 5694U) || bp->common.chip_id >> 16 == 5695U)) || ((bp->common.chip_id >> 16 == 5793U || bp->common.chip_id >> 16 == 5794U) || bp->common.chip_id >> 16 == 5773U)) || (bp->common.chip_id >> 16 == 5796U || bp->common.chip_id >> 16 == 5803U)) || bp->common.chip_id >> 16 == 5805U) { return (2U); } else { return (0U); } } } static u32 const *__bnx2x_get_page_write_ar(struct bnx2x *bp ) { { if ((bp->common.chip_id >> 16 == 5730U || bp->common.chip_id >> 16 == 5731U) || bp->common.chip_id >> 16 == 5743U) { return ((u32 const *)(& page_write_regs_e2)); } else if (((((((((bp->common.chip_id >> 16 == 5770U || bp->common.chip_id >> 16 == 5797U) || bp->common.chip_id >> 16 == 5801U) || bp->common.chip_id >> 16 == 5774U) || bp->common.chip_id >> 16 == 5806U) || bp->common.chip_id >> 16 == 5807U) || ((bp->common.chip_id >> 16 == 5693U || bp->common.chip_id >> 16 == 5694U) || bp->common.chip_id >> 16 == 5695U)) || ((bp->common.chip_id >> 16 == 5793U || bp->common.chip_id >> 16 == 5794U) || bp->common.chip_id >> 16 == 5773U)) || (bp->common.chip_id >> 16 == 5796U || bp->common.chip_id >> 16 == 5803U)) || bp->common.chip_id >> 16 == 5805U) { return ((u32 const *)(& page_write_regs_e3)); } else { return (0); } } } static u32 __bnx2x_get_page_write_num(struct bnx2x *bp ) { { if ((bp->common.chip_id >> 16 == 5730U || bp->common.chip_id >> 16 == 5731U) || bp->common.chip_id >> 16 == 5743U) { return (1U); } else if (((((((((bp->common.chip_id >> 16 == 5770U || bp->common.chip_id >> 16 == 5797U) || bp->common.chip_id >> 16 == 5801U) || bp->common.chip_id >> 16 == 5774U) || bp->common.chip_id >> 16 == 5806U) || bp->common.chip_id >> 16 == 5807U) || ((bp->common.chip_id >> 16 == 5693U || bp->common.chip_id >> 16 == 5694U) || bp->common.chip_id >> 16 == 5695U)) || ((bp->common.chip_id >> 16 == 5793U || bp->common.chip_id >> 16 == 5794U) || bp->common.chip_id >> 16 == 5773U)) || (bp->common.chip_id >> 16 == 5796U || bp->common.chip_id >> 16 == 5803U)) || bp->common.chip_id >> 16 == 5805U) { return (1U); } else { return (0U); } } } static struct reg_addr const *__bnx2x_get_page_read_ar(struct bnx2x *bp ) { { if ((bp->common.chip_id >> 16 == 5730U || bp->common.chip_id >> 16 == 5731U) || bp->common.chip_id >> 16 == 5743U) { return ((struct reg_addr const *)(& page_read_regs_e2)); } else if (((((((((bp->common.chip_id >> 16 == 5770U || bp->common.chip_id >> 16 == 5797U) || bp->common.chip_id >> 16 == 5801U) || bp->common.chip_id >> 16 == 5774U) || bp->common.chip_id >> 16 == 5806U) || bp->common.chip_id >> 16 == 5807U) || ((bp->common.chip_id >> 16 == 5693U || bp->common.chip_id >> 16 == 5694U) || bp->common.chip_id >> 16 == 5695U)) || ((bp->common.chip_id >> 16 == 5793U || bp->common.chip_id >> 16 == 5794U) || bp->common.chip_id >> 16 == 5773U)) || (bp->common.chip_id >> 16 == 5796U || bp->common.chip_id >> 16 == 5803U)) || bp->common.chip_id >> 16 == 5805U) { return ((struct reg_addr const *)(& page_read_regs_e3)); } else { return (0); } } } static u32 __bnx2x_get_page_read_num(struct bnx2x *bp ) { { if ((bp->common.chip_id >> 16 == 5730U || bp->common.chip_id >> 16 == 5731U) || bp->common.chip_id >> 16 == 5743U) { return (1U); } else if (((((((((bp->common.chip_id >> 16 == 5770U || bp->common.chip_id >> 16 == 5797U) || bp->common.chip_id >> 16 == 5801U) || bp->common.chip_id >> 16 == 5774U) || bp->common.chip_id >> 16 == 5806U) || bp->common.chip_id >> 16 == 5807U) || ((bp->common.chip_id >> 16 == 5693U || bp->common.chip_id >> 16 == 5694U) || bp->common.chip_id >> 16 == 5695U)) || ((bp->common.chip_id >> 16 == 5793U || bp->common.chip_id >> 16 == 5794U) || bp->common.chip_id >> 16 == 5773U)) || (bp->common.chip_id >> 16 == 5796U || bp->common.chip_id >> 16 == 5803U)) || bp->common.chip_id >> 16 == 5805U) { return (1U); } else { return (0U); } } } static bool bnx2x_is_reg_in_chip(struct bnx2x *bp , struct reg_addr const *reg_info ) { { if (bp->common.chip_id >> 16 == 5710U) { return (((int )reg_info->chips & 1) != 0); } else if (bp->common.chip_id >> 16 == 5711U || bp->common.chip_id >> 16 == 5712U) { return (((unsigned int )reg_info->chips & 2U) != 0U); } else if ((bp->common.chip_id >> 16 == 5730U || bp->common.chip_id >> 16 == 5731U) || bp->common.chip_id >> 16 == 5743U) { return (((unsigned int )reg_info->chips & 4U) != 0U); } else if ((((((((((bp->common.chip_id >> 16 == 5770U || bp->common.chip_id >> 16 == 5797U) || bp->common.chip_id >> 16 == 5801U) || bp->common.chip_id >> 16 == 5774U) || bp->common.chip_id >> 16 == 5806U) || bp->common.chip_id >> 16 == 5807U) || ((bp->common.chip_id >> 16 == 5693U || bp->common.chip_id >> 16 == 5694U) || bp->common.chip_id >> 16 == 5695U)) || ((bp->common.chip_id >> 16 == 5793U || bp->common.chip_id >> 16 == 5794U) || bp->common.chip_id >> 16 == 5773U)) || (bp->common.chip_id >> 16 == 5796U || bp->common.chip_id >> 16 == 5803U)) || bp->common.chip_id >> 16 == 5805U) && ((bp->common.chip_id & 61440U) > 20480U ? ((~ bp->common.chip_id & 61440U) >> 13) << 12 == 0U : (bp->common.chip_id & 61440U) == 0U)) { return (((unsigned int )reg_info->chips & 8U) != 0U); } else if ((((((((((bp->common.chip_id >> 16 == 5770U || bp->common.chip_id >> 16 == 5797U) || bp->common.chip_id >> 16 == 5801U) || bp->common.chip_id >> 16 == 5774U) || bp->common.chip_id >> 16 == 5806U) || bp->common.chip_id >> 16 == 5807U) || ((bp->common.chip_id >> 16 == 5693U || bp->common.chip_id >> 16 == 5694U) || bp->common.chip_id >> 16 == 5695U)) || ((bp->common.chip_id >> 16 == 5793U || bp->common.chip_id >> 16 == 5794U) || bp->common.chip_id >> 16 == 5773U)) || (bp->common.chip_id >> 16 == 5796U || bp->common.chip_id >> 16 == 5803U)) || bp->common.chip_id >> 16 == 5805U) && ((bp->common.chip_id & 61440U) > 20480U ? ((~ bp->common.chip_id & 61440U) >> 13) << 12 == 4096U : (bp->common.chip_id & 61440U) == 4096U)) { return (((unsigned int )reg_info->chips & 16U) != 0U); } else { return (0); } } } static bool bnx2x_is_wreg_in_chip(struct bnx2x *bp , struct wreg_addr const *wreg_info ) { { if (bp->common.chip_id >> 16 == 5710U) { return (((int )wreg_info->chips & 1) != 0); } else if (bp->common.chip_id >> 16 == 5711U || bp->common.chip_id >> 16 == 5712U) { return (((unsigned int )wreg_info->chips & 2U) != 0U); } else if ((bp->common.chip_id >> 16 == 5730U || bp->common.chip_id >> 16 == 5731U) || bp->common.chip_id >> 16 == 5743U) { return (((unsigned int )wreg_info->chips & 4U) != 0U); } else if ((((((((((bp->common.chip_id >> 16 == 5770U || bp->common.chip_id >> 16 == 5797U) || bp->common.chip_id >> 16 == 5801U) || bp->common.chip_id >> 16 == 5774U) || bp->common.chip_id >> 16 == 5806U) || bp->common.chip_id >> 16 == 5807U) || ((bp->common.chip_id >> 16 == 5693U || bp->common.chip_id >> 16 == 5694U) || bp->common.chip_id >> 16 == 5695U)) || ((bp->common.chip_id >> 16 == 5793U || bp->common.chip_id >> 16 == 5794U) || bp->common.chip_id >> 16 == 5773U)) || (bp->common.chip_id >> 16 == 5796U || bp->common.chip_id >> 16 == 5803U)) || bp->common.chip_id >> 16 == 5805U) && ((bp->common.chip_id & 61440U) > 20480U ? ((~ bp->common.chip_id & 61440U) >> 13) << 12 == 0U : (bp->common.chip_id & 61440U) == 0U)) { return (((unsigned int )wreg_info->chips & 8U) != 0U); } else if ((((((((((bp->common.chip_id >> 16 == 5770U || bp->common.chip_id >> 16 == 5797U) || bp->common.chip_id >> 16 == 5801U) || bp->common.chip_id >> 16 == 5774U) || bp->common.chip_id >> 16 == 5806U) || bp->common.chip_id >> 16 == 5807U) || ((bp->common.chip_id >> 16 == 5693U || bp->common.chip_id >> 16 == 5694U) || bp->common.chip_id >> 16 == 5695U)) || ((bp->common.chip_id >> 16 == 5793U || bp->common.chip_id >> 16 == 5794U) || bp->common.chip_id >> 16 == 5773U)) || (bp->common.chip_id >> 16 == 5796U || bp->common.chip_id >> 16 == 5803U)) || bp->common.chip_id >> 16 == 5805U) && ((bp->common.chip_id & 61440U) > 20480U ? ((~ bp->common.chip_id & 61440U) >> 13) << 12 == 4096U : (bp->common.chip_id & 61440U) == 4096U)) { return (((unsigned int )wreg_info->chips & 16U) != 0U); } else { return (0); } } } static void bnx2x_read_pages_regs(struct bnx2x *bp , u32 *p , u32 preset ) { u32 i ; u32 j ; u32 k ; u32 n ; u32 const *page_addr ; u32 const *tmp ; int num_pages ; u32 tmp___0 ; u32 const *write_addr ; u32 const *tmp___1 ; int write_num ; u32 tmp___2 ; struct reg_addr const *read_addr ; struct reg_addr const *tmp___3 ; int read_num ; u32 tmp___4 ; u32 addr ; u32 size ; u32 *tmp___5 ; { tmp = __bnx2x_get_page_addr_ar(bp); page_addr = tmp; tmp___0 = __bnx2x_get_page_reg_num(bp); num_pages = (int )tmp___0; tmp___1 = __bnx2x_get_page_write_ar(bp); write_addr = tmp___1; tmp___2 = __bnx2x_get_page_write_num(bp); write_num = (int )tmp___2; tmp___3 = __bnx2x_get_page_read_ar(bp); read_addr = tmp___3; tmp___4 = __bnx2x_get_page_read_num(bp); read_num = (int )tmp___4; i = 0U; goto ldv_45468; ldv_45467: j = 0U; goto ldv_45465; ldv_45464: writel(*(page_addr + (unsigned long )i), (void volatile *)bp->regview + (unsigned long )*(write_addr + (unsigned long )j)); k = 0U; goto ldv_45462; ldv_45461: ; if (((unsigned int )(read_addr + (unsigned long )k)->presets & (unsigned int )(1 << (int )(preset - 1U))) == (unsigned int )(1 << (int )(preset - 1U))) { size = (read_addr + (unsigned long )k)->size; n = 0U; goto ldv_45459; ldv_45458: addr = (unsigned int )(read_addr + (unsigned long )k)->addr + n * 4U; tmp___5 = p; p = p + 1; *tmp___5 = readl((void const volatile *)bp->regview + (unsigned long )addr); n = n + 1U; ldv_45459: ; if (n < size) { goto ldv_45458; } else { } } else { } k = k + 1U; ldv_45462: ; if ((u32 )read_num > k) { goto ldv_45461; } else { } j = j + 1U; ldv_45465: ; if ((u32 )write_num > j) { goto ldv_45464; } else { } i = i + 1U; ldv_45468: ; if ((u32 )num_pages > i) { goto ldv_45467; } else { } return; } } static int __bnx2x_get_preset_regs(struct bnx2x *bp , u32 *p , u32 preset ) { u32 i ; u32 j ; u32 addr ; struct wreg_addr const *wreg_addr_p ; u32 *tmp ; bool tmp___0 ; u32 *tmp___1 ; bool tmp___2 ; u32 *tmp___3 ; u32 *tmp___4 ; bool tmp___5 ; { wreg_addr_p = 0; if (bp->common.chip_id >> 16 == 5710U) { wreg_addr_p = & wreg_addr_e1; } else if (bp->common.chip_id >> 16 == 5711U || bp->common.chip_id >> 16 == 5712U) { wreg_addr_p = & wreg_addr_e1h; } else if ((bp->common.chip_id >> 16 == 5730U || bp->common.chip_id >> 16 == 5731U) || bp->common.chip_id >> 16 == 5743U) { wreg_addr_p = & wreg_addr_e2; } else if ((((((((((bp->common.chip_id >> 16 == 5770U || bp->common.chip_id >> 16 == 5797U) || bp->common.chip_id >> 16 == 5801U) || bp->common.chip_id >> 16 == 5774U) || bp->common.chip_id >> 16 == 5806U) || bp->common.chip_id >> 16 == 5807U) || ((bp->common.chip_id >> 16 == 5693U || bp->common.chip_id >> 16 == 5694U) || bp->common.chip_id >> 16 == 5695U)) || ((bp->common.chip_id >> 16 == 5793U || bp->common.chip_id >> 16 == 5794U) || bp->common.chip_id >> 16 == 5773U)) || (bp->common.chip_id >> 16 == 5796U || bp->common.chip_id >> 16 == 5803U)) || bp->common.chip_id >> 16 == 5805U) && ((bp->common.chip_id & 61440U) > 20480U ? ((~ bp->common.chip_id & 61440U) >> 13) << 12 == 0U : (bp->common.chip_id & 61440U) == 0U)) { wreg_addr_p = & wreg_addr_e3; } else if ((((((((((bp->common.chip_id >> 16 == 5770U || bp->common.chip_id >> 16 == 5797U) || bp->common.chip_id >> 16 == 5801U) || bp->common.chip_id >> 16 == 5774U) || bp->common.chip_id >> 16 == 5806U) || bp->common.chip_id >> 16 == 5807U) || ((bp->common.chip_id >> 16 == 5693U || bp->common.chip_id >> 16 == 5694U) || bp->common.chip_id >> 16 == 5695U)) || ((bp->common.chip_id >> 16 == 5793U || bp->common.chip_id >> 16 == 5794U) || bp->common.chip_id >> 16 == 5773U)) || (bp->common.chip_id >> 16 == 5796U || bp->common.chip_id >> 16 == 5803U)) || bp->common.chip_id >> 16 == 5805U) && ((bp->common.chip_id & 61440U) > 20480U ? ((~ bp->common.chip_id & 61440U) >> 13) << 12 == 4096U : (bp->common.chip_id & 61440U) == 4096U)) { wreg_addr_p = & wreg_addr_e3b0; } else { } i = 0U; goto ldv_45485; ldv_45484: tmp___0 = bnx2x_is_reg_in_chip(bp, (struct reg_addr const *)(& idle_reg_addrs) + (unsigned long )i); if ((int )tmp___0 && ((unsigned int )idle_reg_addrs[i].presets & (unsigned int )(1 << (int )(preset - 1U))) == (unsigned int )(1 << (int )(preset - 1U))) { j = 0U; goto ldv_45482; ldv_45481: tmp = p; p = p + 1; *tmp = readl((void const volatile *)bp->regview + (unsigned long )((unsigned int )idle_reg_addrs[i].addr + j * 4U)); j = j + 1U; ldv_45482: ; if ((u32 )idle_reg_addrs[i].size > j) { goto ldv_45481; } else { } } else { } i = i + 1U; ldv_45485: ; if (i <= 269U) { goto ldv_45484; } else { } i = 0U; goto ldv_45493; ldv_45492: tmp___2 = bnx2x_is_reg_in_chip(bp, (struct reg_addr const *)(& reg_addrs) + (unsigned long )i); if ((int )tmp___2 && ((unsigned int )reg_addrs[i].presets & (unsigned int )(1 << (int )(preset - 1U))) == (unsigned int )(1 << (int )(preset - 1U))) { j = 0U; goto ldv_45490; ldv_45489: tmp___1 = p; p = p + 1; *tmp___1 = readl((void const volatile *)bp->regview + (unsigned long )((unsigned int )reg_addrs[i].addr + j * 4U)); j = j + 1U; ldv_45490: ; if ((u32 )reg_addrs[i].size > j) { goto ldv_45489; } else { } } else { } i = i + 1U; ldv_45493: ; if (i <= 1819U) { goto ldv_45492; } else { } tmp___5 = bnx2x_is_wreg_in_chip(bp, wreg_addr_p); if ((int )tmp___5 && ((unsigned int )wreg_addr_p->presets & (unsigned int )(1 << (int )(preset - 1U))) == (unsigned int )(1 << (int )(preset - 1U))) { i = 0U; goto ldv_45499; ldv_45498: tmp___3 = p; p = p + 1; *tmp___3 = readl((void const volatile *)bp->regview + (unsigned long )((unsigned int )wreg_addr_p->addr + i * 4U)); j = 0U; goto ldv_45496; ldv_45495: addr = *(wreg_addr_p->read_regs); tmp___4 = p; p = p + 1; *tmp___4 = readl((void const volatile *)bp->regview + (unsigned long )(j * 4U + addr)); j = j + 1U; ldv_45496: ; if ((u32 )wreg_addr_p->read_regs_count > j) { goto ldv_45495; } else { } i = i + 1U; ldv_45499: ; if ((u32 )wreg_addr_p->size > i) { goto ldv_45498; } else { } } else { } if (((bp->common.chip_id >> 16 == 5730U || bp->common.chip_id >> 16 == 5731U) || bp->common.chip_id >> 16 == 5743U) || (((((((((bp->common.chip_id >> 16 == 5770U || bp->common.chip_id >> 16 == 5797U) || bp->common.chip_id >> 16 == 5801U) || bp->common.chip_id >> 16 == 5774U) || bp->common.chip_id >> 16 == 5806U) || bp->common.chip_id >> 16 == 5807U) || ((bp->common.chip_id >> 16 == 5693U || bp->common.chip_id >> 16 == 5694U) || bp->common.chip_id >> 16 == 5695U)) || ((bp->common.chip_id >> 16 == 5793U || bp->common.chip_id >> 16 == 5794U) || bp->common.chip_id >> 16 == 5773U)) || (bp->common.chip_id >> 16 == 5796U || bp->common.chip_id >> 16 == 5803U)) || bp->common.chip_id >> 16 == 5805U)) { bnx2x_read_pages_regs(bp, p, preset); } else { } return (0); } } static void __bnx2x_get_regs(struct bnx2x *bp , u32 *p ) { u32 preset_idx ; int tmp ; { preset_idx = 1U; goto ldv_45508; ldv_45507: ; if (((preset_idx == 2U || preset_idx == 5U) || preset_idx == 8U) || preset_idx == 11U) { goto ldv_45506; } else { } __bnx2x_get_preset_regs(bp, p, preset_idx); tmp = __bnx2x_get_preset_regs_len(bp, preset_idx); p = p + (unsigned long )tmp; ldv_45506: preset_idx = preset_idx + 1U; ldv_45508: ; if (preset_idx <= 13U) { goto ldv_45507; } else { } return; } } static void bnx2x_get_regs(struct net_device *dev , struct ethtool_regs *regs , void *_p ) { u32 *p ; struct bnx2x *bp ; void *tmp ; struct dump_header dump_hdr ; bool tmp___0 ; int tmp___1 ; size_t __len ; void *__ret ; { p = (u32 *)_p; tmp = netdev_priv((struct net_device const *)dev); bp = (struct bnx2x *)tmp; dump_hdr.header_size = 0U; dump_hdr.version = 0U; dump_hdr.preset = 0U; dump_hdr.dump_meta_data = 0U; regs->version = 2U; memset((void *)p, 0, (size_t )regs->len); tmp___0 = netif_running((struct net_device const *)bp->dev); if (tmp___0) { tmp___1 = 0; } else { tmp___1 = 1; } if (tmp___1) { return; } else { } bnx2x_pretend_func(bp, 0); bnx2x_disable_blocks_parity(bp); bnx2x_pretend_func(bp, 1); bnx2x_disable_blocks_parity(bp); bnx2x_pretend_func(bp, (int )bp->pf_num); dump_hdr.header_size = 3U; dump_hdr.preset = 8191U; dump_hdr.version = 1353514753U; if (bp->common.chip_id >> 16 == 5710U) { dump_hdr.dump_meta_data = 1U; } else if (bp->common.chip_id >> 16 == 5711U || bp->common.chip_id >> 16 == 5712U) { dump_hdr.dump_meta_data = 2U; } else if ((bp->common.chip_id >> 16 == 5730U || bp->common.chip_id >> 16 == 5731U) || bp->common.chip_id >> 16 == 5743U) { dump_hdr.dump_meta_data = (bp->common.chip_id >> 16 != 5710U && (bp->common.chip_id >> 16 != 5711U && bp->common.chip_id >> 16 != 5712U) ? (int )bp->pf_num & 1 : 0) ? 1028U : 516U; } else if ((((((((((bp->common.chip_id >> 16 == 5770U || bp->common.chip_id >> 16 == 5797U) || bp->common.chip_id >> 16 == 5801U) || bp->common.chip_id >> 16 == 5774U) || bp->common.chip_id >> 16 == 5806U) || bp->common.chip_id >> 16 == 5807U) || ((bp->common.chip_id >> 16 == 5693U || bp->common.chip_id >> 16 == 5694U) || bp->common.chip_id >> 16 == 5695U)) || ((bp->common.chip_id >> 16 == 5793U || bp->common.chip_id >> 16 == 5794U) || bp->common.chip_id >> 16 == 5773U)) || (bp->common.chip_id >> 16 == 5796U || bp->common.chip_id >> 16 == 5803U)) || bp->common.chip_id >> 16 == 5805U) && ((bp->common.chip_id & 61440U) > 20480U ? ((~ bp->common.chip_id & 61440U) >> 13) << 12 == 0U : (bp->common.chip_id & 61440U) == 0U)) { dump_hdr.dump_meta_data = (bp->common.chip_id >> 16 != 5710U && (bp->common.chip_id >> 16 != 5711U && bp->common.chip_id >> 16 != 5712U) ? (int )bp->pf_num & 1 : 0) ? 1032U : 520U; } else if ((((((((((bp->common.chip_id >> 16 == 5770U || bp->common.chip_id >> 16 == 5797U) || bp->common.chip_id >> 16 == 5801U) || bp->common.chip_id >> 16 == 5774U) || bp->common.chip_id >> 16 == 5806U) || bp->common.chip_id >> 16 == 5807U) || ((bp->common.chip_id >> 16 == 5693U || bp->common.chip_id >> 16 == 5694U) || bp->common.chip_id >> 16 == 5695U)) || ((bp->common.chip_id >> 16 == 5793U || bp->common.chip_id >> 16 == 5794U) || bp->common.chip_id >> 16 == 5773U)) || (bp->common.chip_id >> 16 == 5796U || bp->common.chip_id >> 16 == 5803U)) || bp->common.chip_id >> 16 == 5805U) && ((bp->common.chip_id & 61440U) > 20480U ? ((~ bp->common.chip_id & 61440U) >> 13) << 12 == 4096U : (bp->common.chip_id & 61440U) == 4096U)) { dump_hdr.dump_meta_data = (bp->common.chip_id >> 16 != 5710U && (bp->common.chip_id >> 16 != 5711U && bp->common.chip_id >> 16 != 5712U) ? (int )bp->pf_num & 1 : 0) ? 1040U : 528U; } else { } __len = 16UL; if (__len > 63UL) { __ret = __memcpy((void *)p, (void const *)(& dump_hdr), __len); } else { __ret = __builtin_memcpy((void *)p, (void const *)(& dump_hdr), __len); } p = p + (unsigned long )(dump_hdr.header_size + 1U); __bnx2x_get_regs(bp, p); bnx2x_pretend_func(bp, 0); bnx2x_clear_blocks_parity(bp); bnx2x_enable_blocks_parity___0(bp); bnx2x_pretend_func(bp, 1); bnx2x_clear_blocks_parity(bp); bnx2x_enable_blocks_parity___0(bp); bnx2x_pretend_func(bp, (int )bp->pf_num); return; } } static int bnx2x_get_preset_regs_len(struct net_device *dev , u32 preset ) { struct bnx2x *bp ; void *tmp ; int regdump_len ; { tmp = netdev_priv((struct net_device const *)dev); bp = (struct bnx2x *)tmp; regdump_len = 0; regdump_len = __bnx2x_get_preset_regs_len(bp, preset); regdump_len = regdump_len * 4; regdump_len = (int )((unsigned int )regdump_len + 16U); return (regdump_len); } } static int bnx2x_set_dump(struct net_device *dev , struct ethtool_dump *val ) { struct bnx2x *bp ; void *tmp ; { tmp = netdev_priv((struct net_device const *)dev); bp = (struct bnx2x *)tmp; bp->dump_preset_idx = val->flag; return (0); } } static int bnx2x_get_dump_flag(struct net_device *dev , struct ethtool_dump *dump ) { struct bnx2x *bp ; void *tmp ; int tmp___0 ; long tmp___1 ; { tmp = netdev_priv((struct net_device const *)dev); bp = (struct bnx2x *)tmp; tmp___0 = bnx2x_get_preset_regs_len(dev, bp->dump_preset_idx); dump->len = (__u32 )tmp___0; tmp___1 = ldv__builtin_expect((bp->msg_enable & 67108864) != 0, 0L); if (tmp___1 != 0L) { printk("\rbnx2x: [%s:%d(%s)]Get dump preset %d length=%d\n", "bnx2x_get_dump_flag", 1047, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", bp->dump_preset_idx, dump->len); } else { } dump->flag = 64U; return (0); } } static int bnx2x_get_dump_data(struct net_device *dev , struct ethtool_dump *dump , void *buffer ) { u32 *p ; struct bnx2x *bp ; void *tmp ; struct dump_header dump_hdr ; long tmp___0 ; size_t __len ; void *__ret ; { p = (u32 *)buffer; tmp = netdev_priv((struct net_device const *)dev); bp = (struct bnx2x *)tmp; dump_hdr.header_size = 0U; dump_hdr.version = 0U; dump_hdr.preset = 0U; dump_hdr.dump_meta_data = 0U; memset((void *)p, 0, (size_t )dump->len); bnx2x_pretend_func(bp, 0); bnx2x_disable_blocks_parity(bp); bnx2x_pretend_func(bp, 1); bnx2x_disable_blocks_parity(bp); bnx2x_pretend_func(bp, (int )bp->pf_num); dump_hdr.header_size = 3U; dump_hdr.preset = bp->dump_preset_idx; dump_hdr.version = 1353514753U; tmp___0 = ldv__builtin_expect((bp->msg_enable & 67108864) != 0, 0L); if (tmp___0 != 0L) { printk("\rbnx2x: [%s:%d(%s)]Get dump data of preset %d\n", "bnx2x_get_dump_data", 1083, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", dump_hdr.preset); } else { } if (bp->common.chip_id >> 16 == 5710U) { dump_hdr.dump_meta_data = 1U; } else if (bp->common.chip_id >> 16 == 5711U || bp->common.chip_id >> 16 == 5712U) { dump_hdr.dump_meta_data = 2U; } else if ((bp->common.chip_id >> 16 == 5730U || bp->common.chip_id >> 16 == 5731U) || bp->common.chip_id >> 16 == 5743U) { dump_hdr.dump_meta_data = (bp->common.chip_id >> 16 != 5710U && (bp->common.chip_id >> 16 != 5711U && bp->common.chip_id >> 16 != 5712U) ? (int )bp->pf_num & 1 : 0) ? 1028U : 516U; } else if ((((((((((bp->common.chip_id >> 16 == 5770U || bp->common.chip_id >> 16 == 5797U) || bp->common.chip_id >> 16 == 5801U) || bp->common.chip_id >> 16 == 5774U) || bp->common.chip_id >> 16 == 5806U) || bp->common.chip_id >> 16 == 5807U) || ((bp->common.chip_id >> 16 == 5693U || bp->common.chip_id >> 16 == 5694U) || bp->common.chip_id >> 16 == 5695U)) || ((bp->common.chip_id >> 16 == 5793U || bp->common.chip_id >> 16 == 5794U) || bp->common.chip_id >> 16 == 5773U)) || (bp->common.chip_id >> 16 == 5796U || bp->common.chip_id >> 16 == 5803U)) || bp->common.chip_id >> 16 == 5805U) && ((bp->common.chip_id & 61440U) > 20480U ? ((~ bp->common.chip_id & 61440U) >> 13) << 12 == 0U : (bp->common.chip_id & 61440U) == 0U)) { dump_hdr.dump_meta_data = (bp->common.chip_id >> 16 != 5710U && (bp->common.chip_id >> 16 != 5711U && bp->common.chip_id >> 16 != 5712U) ? (int )bp->pf_num & 1 : 0) ? 1032U : 520U; } else if ((((((((((bp->common.chip_id >> 16 == 5770U || bp->common.chip_id >> 16 == 5797U) || bp->common.chip_id >> 16 == 5801U) || bp->common.chip_id >> 16 == 5774U) || bp->common.chip_id >> 16 == 5806U) || bp->common.chip_id >> 16 == 5807U) || ((bp->common.chip_id >> 16 == 5693U || bp->common.chip_id >> 16 == 5694U) || bp->common.chip_id >> 16 == 5695U)) || ((bp->common.chip_id >> 16 == 5793U || bp->common.chip_id >> 16 == 5794U) || bp->common.chip_id >> 16 == 5773U)) || (bp->common.chip_id >> 16 == 5796U || bp->common.chip_id >> 16 == 5803U)) || bp->common.chip_id >> 16 == 5805U) && ((bp->common.chip_id & 61440U) > 20480U ? ((~ bp->common.chip_id & 61440U) >> 13) << 12 == 4096U : (bp->common.chip_id & 61440U) == 4096U)) { dump_hdr.dump_meta_data = (bp->common.chip_id >> 16 != 5710U && (bp->common.chip_id >> 16 != 5711U && bp->common.chip_id >> 16 != 5712U) ? (int )bp->pf_num & 1 : 0) ? 1040U : 528U; } else { } __len = 16UL; if (__len > 63UL) { __ret = __memcpy((void *)p, (void const *)(& dump_hdr), __len); } else { __ret = __builtin_memcpy((void *)p, (void const *)(& dump_hdr), __len); } p = p + (unsigned long )(dump_hdr.header_size + 1U); __bnx2x_get_preset_regs(bp, p, dump_hdr.preset); bnx2x_pretend_func(bp, 0); bnx2x_clear_blocks_parity(bp); bnx2x_enable_blocks_parity___0(bp); bnx2x_pretend_func(bp, 1); bnx2x_clear_blocks_parity(bp); bnx2x_enable_blocks_parity___0(bp); bnx2x_pretend_func(bp, (int )bp->pf_num); return (0); } } static void bnx2x_get_drvinfo(struct net_device *dev , struct ethtool_drvinfo *info ) { struct bnx2x *bp ; void *tmp ; char const *tmp___0 ; int tmp___1 ; { tmp = netdev_priv((struct net_device const *)dev); bp = (struct bnx2x *)tmp; strlcpy((char *)(& info->driver), "bnx2x", 32UL); strlcpy((char *)(& info->version), "1.78.17-0", 32UL); bnx2x_fill_fw_str(bp, (char *)(& info->fw_version), 32UL); tmp___0 = pci_name((struct pci_dev const *)bp->pdev); strlcpy((char *)(& info->bus_info), tmp___0, 32UL); info->n_stats = 52U; info->testinfo_len = (unsigned int )bp->mf_mode != 0U ? 3U : 7U; info->eedump_len = (__u32 )bp->common.flash_size; tmp___1 = bnx2x_get_regs_len(dev); info->regdump_len = (__u32 )tmp___1; return; } } static void bnx2x_get_wol(struct net_device *dev , struct ethtool_wolinfo *wol ) { struct bnx2x *bp ; void *tmp ; { tmp = netdev_priv((struct net_device const *)dev); bp = (struct bnx2x *)tmp; if ((bp->flags & 8U) != 0U) { wol->supported = 0U; wol->wolopts = 0U; } else { wol->supported = 32U; if ((unsigned int )bp->wol != 0U) { wol->wolopts = 32U; } else { wol->wolopts = 0U; } } memset((void *)(& wol->sopass), 0, 6UL); return; } } static int bnx2x_set_wol(struct net_device *dev , struct ethtool_wolinfo *wol ) { struct bnx2x *bp ; void *tmp ; long tmp___0 ; long tmp___1 ; { tmp = netdev_priv((struct net_device const *)dev); bp = (struct bnx2x *)tmp; if ((wol->wolopts & 4294967263U) != 0U) { tmp___0 = ldv__builtin_expect((bp->msg_enable & 67108864) != 0, 0L); if (tmp___0 != 0L) { printk("\rbnx2x: [%s:%d(%s)]WOL not supported\n", "bnx2x_set_wol", 1162, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } return (-22); } else { } if ((wol->wolopts & 32U) != 0U) { if ((bp->flags & 8U) != 0U) { tmp___1 = ldv__builtin_expect((bp->msg_enable & 67108864) != 0, 0L); if (tmp___1 != 0L) { printk("\rbnx2x: [%s:%d(%s)]WOL not supported\n", "bnx2x_set_wol", 1168, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } return (-22); } else { } bp->wol = 1U; } else { bp->wol = 0U; } return (0); } } static u32 bnx2x_get_msglevel(struct net_device *dev ) { struct bnx2x *bp ; void *tmp ; { tmp = netdev_priv((struct net_device const *)dev); bp = (struct bnx2x *)tmp; return ((u32 )bp->msg_enable); } } static void bnx2x_set_msglevel(struct net_device *dev , u32 level ) { struct bnx2x *bp ; void *tmp ; bool tmp___0 ; { tmp = netdev_priv((struct net_device const *)dev); bp = (struct bnx2x *)tmp; tmp___0 = capable(12); if ((int )tmp___0) { if ((bp->flags & 4194304U) == 0U && (level & 65536U) != 0U) { bnx2x_fw_dump_lvl(bp, "\016"); } else { } bp->msg_enable = (int )level; } else { } return; } } static int bnx2x_nway_reset(struct net_device *dev ) { struct bnx2x *bp ; void *tmp ; bool tmp___0 ; { tmp = netdev_priv((struct net_device const *)dev); bp = (struct bnx2x *)tmp; if (bp->port.pmf == 0U) { return (0); } else { } tmp___0 = netif_running((struct net_device const *)dev); if ((int )tmp___0) { bnx2x_stats_handle(bp, 3); bnx2x_force_link_reset(bp); bnx2x_link_set(bp); } else { } return (0); } } static u32 bnx2x_get_link(struct net_device *dev ) { struct bnx2x *bp ; void *tmp ; { tmp = netdev_priv((struct net_device const *)dev); bp = (struct bnx2x *)tmp; if ((bp->flags & 2048U) != 0U || (unsigned int )bp->state != 12288U) { return (0U); } else { } return ((u32 )bp->link_vars.link_up); } } static int bnx2x_get_eeprom_len(struct net_device *dev ) { struct bnx2x *bp ; void *tmp ; { tmp = netdev_priv((struct net_device const *)dev); bp = (struct bnx2x *)tmp; return (bp->common.flash_size); } } static int bnx2x_acquire_nvram_lock(struct bnx2x *bp ) { int port ; int count ; int i ; u32 val ; long tmp ; { port = (int )bp->pfid & 1; bnx2x_acquire_hw_lock(bp, 12U); count = 30000; if ((bp->common.chip_id & 61440U) > 20480U) { count = count * 100; } else { } writel((unsigned int )(2L << port), (void volatile *)bp->regview + 549920U); i = 0; goto ldv_45598; ldv_45597: val = readl((void const volatile *)bp->regview + 549920U); if (((long )val & (512L << port)) != 0L) { goto ldv_45596; } else { } __const_udelay(21475UL); i = i + 1; ldv_45598: ; if (count * 10 > i) { goto ldv_45597; } else { } ldv_45596: ; if (((long )val & (512L << port)) == 0L) { tmp = ldv__builtin_expect((bp->msg_enable & 67371008) != 0, 0L); if (tmp != 0L) { printk("\rbnx2x: [%s:%d(%s)]cannot get access to nvram interface\n", "bnx2x_acquire_nvram_lock", 1271, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } return (-16); } else { } return (0); } } static int bnx2x_release_nvram_lock(struct bnx2x *bp ) { int port ; int count ; int i ; u32 val ; long tmp ; { port = (int )bp->pfid & 1; count = 30000; if ((bp->common.chip_id & 61440U) > 20480U) { count = count * 100; } else { } writel((unsigned int )(32L << port), (void volatile *)bp->regview + 549920U); i = 0; goto ldv_45609; ldv_45608: val = readl((void const volatile *)bp->regview + 549920U); if (((long )val & (512L << port)) == 0L) { goto ldv_45607; } else { } __const_udelay(21475UL); i = i + 1; ldv_45609: ; if (count * 10 > i) { goto ldv_45608; } else { } ldv_45607: ; if (((long )val & (512L << port)) != 0L) { tmp = ldv__builtin_expect((bp->msg_enable & 67371008) != 0, 0L); if (tmp != 0L) { printk("\rbnx2x: [%s:%d(%s)]cannot free access to nvram interface\n", "bnx2x_release_nvram_lock", 1303, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } return (-16); } else { } bnx2x_release_hw_lock(bp, 12U); return (0); } } static void bnx2x_enable_nvram_access(struct bnx2x *bp ) { u32 val ; { val = readl((void const volatile *)bp->regview + 549924U); writel(val | 3U, (void volatile *)bp->regview + 549924U); return; } } static void bnx2x_disable_nvram_access(struct bnx2x *bp ) { u32 val ; { val = readl((void const volatile *)bp->regview + 549924U); writel(val & 4294967292U, (void volatile *)bp->regview + 549924U); return; } } static int bnx2x_nvram_read_dword(struct bnx2x *bp , u32 offset , __be32 *ret_val , u32 cmd_flags ) { int count ; int i ; int rc ; u32 val ; __u32 tmp ; long tmp___0 ; { cmd_flags = cmd_flags | 16U; writel(8U, (void volatile *)bp->regview + 549888U); writel(offset & 16777215U, (void volatile *)bp->regview + 549900U); writel(cmd_flags, (void volatile *)bp->regview + 549888U); count = 30000; if ((bp->common.chip_id & 61440U) > 20480U) { count = count * 100; } else { } *ret_val = 0U; rc = -16; i = 0; goto ldv_45631; ldv_45630: __const_udelay(21475UL); val = readl((void const volatile *)bp->regview + 549888U); if (((long )val & 8L) != 0L) { val = readl((void const volatile *)bp->regview + 549904U); tmp = __fswab32(val); *ret_val = tmp; rc = 0; goto ldv_45629; } else { } i = i + 1; ldv_45631: ; if (i < count) { goto ldv_45630; } else { } ldv_45629: ; if (rc == -16) { tmp___0 = ldv__builtin_expect((bp->msg_enable & 67371008) != 0, 0L); if (tmp___0 != 0L) { printk("\rbnx2x: [%s:%d(%s)]nvram read timeout expired\n", "bnx2x_nvram_read_dword", 1380, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } } else { } return (rc); } } static int bnx2x_nvram_read(struct bnx2x *bp , u32 offset , u8 *ret_buf , int buf_size ) { int rc ; u32 cmd_flags ; __be32 val ; long tmp ; long tmp___0 ; size_t __len ; void *__ret ; size_t __len___0 ; void *__ret___0 ; { if (((offset & 3U) != 0U || (buf_size & 3) != 0) || buf_size == 0) { tmp = ldv__builtin_expect((bp->msg_enable & 67371008) != 0, 0L); if (tmp != 0L) { printk("\rbnx2x: [%s:%d(%s)]Invalid parameter: offset 0x%x buf_size 0x%x\n", "bnx2x_nvram_read", 1394, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", offset, buf_size); } else { } return (-22); } else { } if (offset + (u32 )buf_size > (u32 )bp->common.flash_size) { tmp___0 = ldv__builtin_expect((bp->msg_enable & 67371008) != 0, 0L); if (tmp___0 != 0L) { printk("\rbnx2x: [%s:%d(%s)]Invalid parameter: offset (0x%x) + buf_size (0x%x) > flash_size (0x%x)\n", "bnx2x_nvram_read", 1401, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", offset, buf_size, bp->common.flash_size); } else { } return (-22); } else { } rc = bnx2x_acquire_nvram_lock(bp); if (rc != 0) { return (rc); } else { } bnx2x_enable_nvram_access(bp); cmd_flags = 128U; goto ldv_45647; ldv_45646: rc = bnx2x_nvram_read_dword(bp, offset, & val, cmd_flags); __len = 4UL; if (__len > 63UL) { __ret = __memcpy((void *)ret_buf, (void const *)(& val), __len); } else { __ret = __builtin_memcpy((void *)ret_buf, (void const *)(& val), __len); } offset = offset + 4U; ret_buf = ret_buf + 4UL; buf_size = (int )((unsigned int )buf_size - 4U); cmd_flags = 0U; ldv_45647: ; if ((unsigned int )buf_size > 4U && rc == 0) { goto ldv_45646; } else { } if (rc == 0) { cmd_flags = cmd_flags | 256U; rc = bnx2x_nvram_read_dword(bp, offset, & val, cmd_flags); __len___0 = 4UL; if (__len___0 > 63UL) { __ret___0 = __memcpy((void *)ret_buf, (void const *)(& val), __len___0); } else { __ret___0 = __builtin_memcpy((void *)ret_buf, (void const *)(& val), __len___0); } } else { } bnx2x_disable_nvram_access(bp); bnx2x_release_nvram_lock(bp); return (rc); } } static int bnx2x_nvram_read32(struct bnx2x *bp , u32 offset , u32 *buf , int buf_size ) { int rc ; __be32 *be ; u32 *tmp ; __be32 *tmp___0 ; __u32 tmp___1 ; { rc = bnx2x_nvram_read(bp, offset, (u8 *)buf, buf_size); if (rc == 0) { be = buf; goto ldv_45661; ldv_45660: tmp = buf; buf = buf + 1; tmp___0 = be; be = be + 1; tmp___1 = __fswab32(*tmp___0); *tmp = tmp___1; ldv_45661: buf_size = buf_size + -4; if (buf_size >= 0) { goto ldv_45660; } else { } } else { } return (rc); } } static int bnx2x_get_eeprom(struct net_device *dev , struct ethtool_eeprom *eeprom , u8 *eebuf ) { struct bnx2x *bp ; void *tmp ; long tmp___0 ; bool tmp___1 ; int tmp___2 ; long tmp___3 ; int tmp___4 ; { tmp = netdev_priv((struct net_device const *)dev); bp = (struct bnx2x *)tmp; tmp___1 = netif_running((struct net_device const *)dev); if (tmp___1) { tmp___2 = 0; } else { tmp___2 = 1; } if (tmp___2) { tmp___0 = ldv__builtin_expect((bp->msg_enable & 67371008) != 0, 0L); if (tmp___0 != 0L) { printk("\rbnx2x: [%s:%d(%s)]cannot access eeprom when the interface is down\n", "bnx2x_get_eeprom", 1463, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } return (-11); } else { } tmp___3 = ldv__builtin_expect((bp->msg_enable & 67371008) != 0, 0L); if (tmp___3 != 0L) { printk("\rbnx2x: [%s:%d(%s)]ethtool_eeprom: cmd %d\n magic 0x%x offset 0x%x (%d) len 0x%x (%d)\n", "bnx2x_get_eeprom", 1470, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", eeprom->cmd, eeprom->magic, eeprom->offset, eeprom->offset, eeprom->len, eeprom->len); } else { } tmp___4 = bnx2x_nvram_read(bp, eeprom->offset, eebuf, (int )eeprom->len); return (tmp___4); } } static int bnx2x_get_module_eeprom(struct net_device *dev , struct ethtool_eeprom *ee , u8 *data ) { struct bnx2x *bp ; void *tmp ; int rc ; int phy_idx ; u8 *user_data ; unsigned int start_addr ; unsigned int xfer_size ; long tmp___0 ; bool tmp___1 ; int tmp___2 ; long tmp___3 ; long tmp___4 ; { tmp = netdev_priv((struct net_device const *)dev); bp = (struct bnx2x *)tmp; rc = -22; user_data = data; start_addr = ee->offset; xfer_size = 0U; tmp___1 = netif_running((struct net_device const *)dev); if (tmp___1) { tmp___2 = 0; } else { tmp___2 = 1; } if (tmp___2) { tmp___0 = ldv__builtin_expect((bp->msg_enable & 67371008) != 0, 0L); if (tmp___0 != 0L) { printk("\rbnx2x: [%s:%d(%s)]cannot access eeprom when the interface is down\n", "bnx2x_get_module_eeprom", 1488, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } return (-11); } else { } phy_idx = bnx2x_get_cur_phy_idx(bp); if (start_addr <= 255U) { if (ee->len + start_addr > 256U) { xfer_size = 256U - start_addr; } else { xfer_size = ee->len; } bnx2x_acquire_phy_lock(bp); rc = bnx2x_read_sfp_module_eeprom((struct bnx2x_phy *)(& bp->link_params.phy) + (unsigned long )phy_idx, & bp->link_params, 160, (int )((u16 )start_addr), (int )((u16 )xfer_size), user_data); bnx2x_release_phy_lock(bp); if (rc != 0) { tmp___3 = ldv__builtin_expect((bp->msg_enable & 67108864) != 0, 0L); if (tmp___3 != 0L) { printk("\rbnx2x: [%s:%d(%s)]Failed reading A0 section\n", "bnx2x_get_module_eeprom", 1510, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } return (-22); } else { } user_data = user_data + (unsigned long )xfer_size; start_addr = start_addr + xfer_size; } else { } if (start_addr > 255U && start_addr <= 511U) { xfer_size = ee->len - xfer_size; if (start_addr + xfer_size > 512U) { xfer_size = 512U - start_addr; } else { } start_addr = start_addr - 256U; bnx2x_acquire_phy_lock(bp); rc = bnx2x_read_sfp_module_eeprom((struct bnx2x_phy *)(& bp->link_params.phy) + (unsigned long )phy_idx, & bp->link_params, 162, (int )((u16 )start_addr), (int )((u16 )xfer_size), user_data); bnx2x_release_phy_lock(bp); if (rc != 0) { tmp___4 = ldv__builtin_expect((bp->msg_enable & 67108864) != 0, 0L); if (tmp___4 != 0L) { printk("\rbnx2x: [%s:%d(%s)]Failed reading A2 section\n", "bnx2x_get_module_eeprom", 1535, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } return (-22); } else { } } else { } return (rc); } } static int bnx2x_get_module_info(struct net_device *dev , struct ethtool_modinfo *modinfo ) { struct bnx2x *bp ; void *tmp ; int phy_idx ; int rc ; u8 sff8472_comp ; u8 diag_type ; long tmp___0 ; bool tmp___1 ; int tmp___2 ; long tmp___3 ; long tmp___4 ; { tmp = netdev_priv((struct net_device const *)dev); bp = (struct bnx2x *)tmp; tmp___1 = netif_running((struct net_device const *)dev); if (tmp___1) { tmp___2 = 0; } else { tmp___2 = 1; } if (tmp___2) { tmp___0 = ldv__builtin_expect((bp->msg_enable & 67371008) != 0, 0L); if (tmp___0 != 0L) { printk("\rbnx2x: [%s:%d(%s)]cannot access eeprom when the interface is down\n", "bnx2x_get_module_info", 1551, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } return (-11); } else { } phy_idx = bnx2x_get_cur_phy_idx(bp); bnx2x_acquire_phy_lock(bp); rc = bnx2x_read_sfp_module_eeprom((struct bnx2x_phy *)(& bp->link_params.phy) + (unsigned long )phy_idx, & bp->link_params, 160, 94, 1, & sff8472_comp); bnx2x_release_phy_lock(bp); if (rc != 0) { tmp___3 = ldv__builtin_expect((bp->msg_enable & 67108864) != 0, 0L); if (tmp___3 != 0L) { printk("\rbnx2x: [%s:%d(%s)]Failed reading SFF-8472 comp field\n", "bnx2x_get_module_info", 1564, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } return (-22); } else { } bnx2x_acquire_phy_lock(bp); rc = bnx2x_read_sfp_module_eeprom((struct bnx2x_phy *)(& bp->link_params.phy) + (unsigned long )phy_idx, & bp->link_params, 160, 92, 1, & diag_type); bnx2x_release_phy_lock(bp); if (rc != 0) { tmp___4 = ldv__builtin_expect((bp->msg_enable & 67108864) != 0, 0L); if (tmp___4 != 0L) { printk("\rbnx2x: [%s:%d(%s)]Failed reading Diag Type field\n", "bnx2x_get_module_info", 1577, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } return (-22); } else { } if ((unsigned int )sff8472_comp == 0U || ((int )diag_type & 4) != 0) { modinfo->type = 1U; modinfo->eeprom_len = 256U; } else { modinfo->type = 2U; modinfo->eeprom_len = 512U; } return (0); } } static int bnx2x_nvram_write_dword(struct bnx2x *bp , u32 offset , u32 val , u32 cmd_flags ) { int count ; int i ; int rc ; long tmp ; { cmd_flags = cmd_flags | 48U; writel(8U, (void volatile *)bp->regview + 549888U); writel(val, (void volatile *)bp->regview + 549896U); writel(offset & 16777215U, (void volatile *)bp->regview + 549900U); writel(cmd_flags, (void volatile *)bp->regview + 549888U); count = 30000; if ((bp->common.chip_id & 61440U) > 20480U) { count = count * 100; } else { } rc = -16; i = 0; goto ldv_45703; ldv_45702: __const_udelay(21475UL); val = readl((void const volatile *)bp->regview + 549888U); if (((long )val & 8L) != 0L) { rc = 0; goto ldv_45701; } else { } i = i + 1; ldv_45703: ; if (i < count) { goto ldv_45702; } else { } ldv_45701: ; if (rc == -16) { tmp = ldv__builtin_expect((bp->msg_enable & 67371008) != 0, 0L); if (tmp != 0L) { printk("\rbnx2x: [%s:%d(%s)]nvram write timeout expired\n", "bnx2x_nvram_write_dword", 1631, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } } else { } return (rc); } } static int bnx2x_nvram_write1(struct bnx2x *bp , u32 offset , u8 *data_buf , int buf_size ) { int rc ; u32 cmd_flags ; u32 align_offset ; u32 val ; __be32 val_be ; long tmp ; __u32 tmp___0 ; { if (offset + (u32 )buf_size > (u32 )bp->common.flash_size) { tmp = ldv__builtin_expect((bp->msg_enable & 67371008) != 0, 0L); if (tmp != 0L) { printk("\rbnx2x: [%s:%d(%s)]Invalid parameter: offset (0x%x) + buf_size (0x%x) > flash_size (0x%x)\n", "bnx2x_nvram_write1", 1647, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", offset, buf_size, bp->common.flash_size); } else { } return (-22); } else { } rc = bnx2x_acquire_nvram_lock(bp); if (rc != 0) { return (rc); } else { } bnx2x_enable_nvram_access(bp); cmd_flags = 384U; align_offset = offset & 4294967292U; rc = bnx2x_nvram_read_dword(bp, align_offset, & val_be, cmd_flags); if (rc == 0) { tmp___0 = __fswab32(val_be); val = tmp___0; val = ~ ((u32 )(255 << (int )((offset & 3U) * 8U))) & val; val = (u32 )((int )*data_buf << (int )((offset & 3U) * 8U)) | val; rc = bnx2x_nvram_write_dword(bp, align_offset, val, cmd_flags); } else { } bnx2x_disable_nvram_access(bp); bnx2x_release_nvram_lock(bp); return (rc); } } static int bnx2x_nvram_write(struct bnx2x *bp , u32 offset , u8 *data_buf , int buf_size ) { int rc ; u32 cmd_flags ; u32 val ; u32 written_so_far ; int tmp ; long tmp___0 ; long tmp___1 ; size_t __len ; void *__ret ; { if (buf_size == 1) { tmp = bnx2x_nvram_write1(bp, offset, data_buf, buf_size); return (tmp); } else { } if (((offset & 3U) != 0U || (buf_size & 3) != 0) || buf_size == 0) { tmp___0 = ldv__builtin_expect((bp->msg_enable & 67371008) != 0, 0L); if (tmp___0 != 0L) { printk("\rbnx2x: [%s:%d(%s)]Invalid parameter: offset 0x%x buf_size 0x%x\n", "bnx2x_nvram_write", 1697, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", offset, buf_size); } else { } return (-22); } else { } if (offset + (u32 )buf_size > (u32 )bp->common.flash_size) { tmp___1 = ldv__builtin_expect((bp->msg_enable & 67371008) != 0, 0L); if (tmp___1 != 0L) { printk("\rbnx2x: [%s:%d(%s)]Invalid parameter: offset (0x%x) + buf_size (0x%x) > flash_size (0x%x)\n", "bnx2x_nvram_write", 1704, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", offset, buf_size, bp->common.flash_size); } else { } return (-22); } else { } rc = bnx2x_acquire_nvram_lock(bp); if (rc != 0) { return (rc); } else { } bnx2x_enable_nvram_access(bp); written_so_far = 0U; cmd_flags = 128U; goto ldv_45732; ldv_45731: ; if ((unsigned long )written_so_far == (unsigned long )buf_size - 4UL) { cmd_flags = cmd_flags | 256U; } else if (((offset + 4U) & 255U) == 0U) { cmd_flags = cmd_flags | 256U; } else if ((offset & 255U) == 0U) { cmd_flags = cmd_flags | 128U; } else { } __len = 4UL; if (__len > 63UL) { __ret = __memcpy((void *)(& val), (void const *)data_buf, __len); } else { __ret = __builtin_memcpy((void *)(& val), (void const *)data_buf, __len); } rc = bnx2x_nvram_write_dword(bp, offset, val, cmd_flags); offset = offset + 4U; data_buf = data_buf + 4UL; written_so_far = written_so_far + 4U; cmd_flags = 0U; ldv_45732: ; if ((u32 )buf_size > written_so_far && rc == 0) { goto ldv_45731; } else { } bnx2x_disable_nvram_access(bp); bnx2x_release_nvram_lock(bp); return (rc); } } static int bnx2x_set_eeprom(struct net_device *dev , struct ethtool_eeprom *eeprom , u8 *eebuf ) { struct bnx2x *bp ; void *tmp ; int port ; int rc ; u32 ext_phy_config ; long tmp___0 ; bool tmp___1 ; int tmp___2 ; long tmp___3 ; long tmp___4 ; int tmp___5 ; int tmp___6 ; int tmp___7 ; { tmp = netdev_priv((struct net_device const *)dev); bp = (struct bnx2x *)tmp; port = (int )bp->pfid & 1; rc = 0; tmp___1 = netif_running((struct net_device const *)dev); if (tmp___1) { tmp___2 = 0; } else { tmp___2 = 1; } if (tmp___2) { tmp___0 = ldv__builtin_expect((bp->msg_enable & 67371008) != 0, 0L); if (tmp___0 != 0L) { printk("\rbnx2x: [%s:%d(%s)]cannot access eeprom when the interface is down\n", "bnx2x_set_eeprom", 1753, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } return (-11); } else { } tmp___3 = ldv__builtin_expect((bp->msg_enable & 67371008) != 0, 0L); if (tmp___3 != 0L) { printk("\rbnx2x: [%s:%d(%s)]ethtool_eeprom: cmd %d\n magic 0x%x offset 0x%x (%d) len 0x%x (%d)\n", "bnx2x_set_eeprom", 1760, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", eeprom->cmd, eeprom->magic, eeprom->offset, eeprom->offset, eeprom->len, eeprom->len); } else { } if ((eeprom->magic > 1346918655U && eeprom->magic <= 1346918911U) && bp->port.pmf == 0U) { tmp___4 = ldv__builtin_expect((bp->msg_enable & 67371008) != 0, 0L); if (tmp___4 != 0L) { printk("\rbnx2x: [%s:%d(%s)]wrong magic or interface is not pmf\n", "bnx2x_set_eeprom", 1768, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } return (-22); } else { } ext_phy_config = readl((void const volatile *)(bp->regview + (((unsigned long )bp->common.shmem_base + (unsigned long )port * 400UL) + 436UL))); if (eeprom->magic == 1346918736U) { bnx2x_stats_handle(bp, 3); bnx2x_acquire_phy_lock(bp); tmp___5 = bnx2x_link_reset(& bp->link_params, & bp->link_vars, 0); rc = tmp___5 | rc; if ((ext_phy_config & 65280U) == 2048U) { bnx2x_set_gpio(bp, 0, 1U, (int )((u8 )port)); } else { } bnx2x_release_phy_lock(bp); bnx2x_link_report(bp); } else if (eeprom->magic == 1346918738U) { if ((unsigned int )bp->state == 12288U) { bnx2x_acquire_phy_lock(bp); tmp___6 = bnx2x_link_reset(& bp->link_params, & bp->link_vars, 1); rc = tmp___6 | rc; tmp___7 = bnx2x_phy_init(& bp->link_params, & bp->link_vars); rc = tmp___7 | rc; bnx2x_release_phy_lock(bp); bnx2x_calc_fc_adv(bp); } else { } } else if (eeprom->magic == 1402493251U) { if ((ext_phy_config & 65280U) == 2048U) { bnx2x_set_gpio(bp, 0, 0U, (int )((u8 )port)); bnx2x_acquire_phy_lock(bp); bnx2x_sfx7101_sp_sw_reset(bp, (struct bnx2x_phy *)(& bp->link_params.phy) + 1UL); msleep(500U); bnx2x_ext_phy_hw_reset(bp, (int )((u8 )port)); msleep(500U); bnx2x_release_phy_lock(bp); } else { } } else { rc = bnx2x_nvram_write(bp, eeprom->offset, eebuf, (int )eeprom->len); } return (rc); } } static int bnx2x_get_coalesce(struct net_device *dev , struct ethtool_coalesce *coal ) { struct bnx2x *bp ; void *tmp ; { tmp = netdev_priv((struct net_device const *)dev); bp = (struct bnx2x *)tmp; memset((void *)coal, 0, 92UL); coal->rx_coalesce_usecs = (__u32 )bp->rx_ticks; coal->tx_coalesce_usecs = (__u32 )bp->tx_ticks; return (0); } } static int bnx2x_set_coalesce(struct net_device *dev , struct ethtool_coalesce *coal ) { struct bnx2x *bp ; void *tmp ; bool tmp___0 ; { tmp = netdev_priv((struct net_device const *)dev); bp = (struct bnx2x *)tmp; bp->rx_ticks = (unsigned short )coal->rx_coalesce_usecs; if ((unsigned int )bp->rx_ticks > 2880U) { bp->rx_ticks = 2880U; } else { } bp->tx_ticks = (unsigned short )coal->tx_coalesce_usecs; if ((unsigned int )bp->tx_ticks > 2880U) { bp->tx_ticks = 2880U; } else { } tmp___0 = netif_running((struct net_device const *)dev); if ((int )tmp___0) { bnx2x_update_coalesce(bp); } else { } return (0); } } static void bnx2x_get_ringparam(struct net_device *dev , struct ethtool_ringparam *ering ) { struct bnx2x *bp ; void *tmp ; { tmp = netdev_priv((struct net_device const *)dev); bp = (struct bnx2x *)tmp; ering->rx_max_pending = 4078U; if (bp->rx_ring_size != 0) { ering->rx_pending = (__u32 )bp->rx_ring_size; } else { ering->rx_pending = 4078U; } ering->tx_max_pending = (unsigned int )bp->mf_mode == 3U && (bp->mf_ext_config & 8U) != 0U ? 0U : 4078U; ering->tx_pending = (__u32 )bp->tx_ring_size; return; } } static int bnx2x_set_ringparam(struct net_device *dev , struct ethtool_ringparam *ering ) { struct bnx2x *bp ; void *tmp ; long tmp___0 ; long tmp___1 ; long tmp___2 ; u32 __max1 ; u32 __max2 ; u32 __max1___0 ; u32 __max2___0 ; u32 tmp___3 ; int tmp___4 ; { tmp = netdev_priv((struct net_device const *)dev); bp = (struct bnx2x *)tmp; tmp___0 = ldv__builtin_expect((bp->msg_enable & 67108864) != 0, 0L); if (tmp___0 != 0L) { printk("\rbnx2x: [%s:%d(%s)]set ring params command parameters: rx_pending = %d, tx_pending = %d\n", "bnx2x_set_ringparam", 1883, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", ering->rx_pending, ering->tx_pending); } else { } if ((unsigned int )bp->recovery_state != 0U) { tmp___1 = ldv__builtin_expect((bp->msg_enable & 67108864) != 0, 0L); if (tmp___1 != 0L) { printk("\rbnx2x: [%s:%d(%s)]Handling parity error recovery. Try again later\n", "bnx2x_set_ringparam", 1887, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } return (-11); } else { } if (ering->rx_pending > 4078U) { goto _L; } else { if (bp->disable_tpa != 0) { __max1 = 11U; __max2 = (int )bp->dropless_fc ? (((((((((((bp->common.chip_id >> 16 == 5770U || bp->common.chip_id >> 16 == 5797U) || bp->common.chip_id >> 16 == 5801U) || bp->common.chip_id >> 16 == 5774U) || bp->common.chip_id >> 16 == 5806U) || bp->common.chip_id >> 16 == 5807U) || ((bp->common.chip_id >> 16 == 5693U || bp->common.chip_id >> 16 == 5694U) || bp->common.chip_id >> 16 == 5695U)) || ((bp->common.chip_id >> 16 == 5793U || bp->common.chip_id >> 16 == 5794U) || bp->common.chip_id >> 16 == 5773U)) || (bp->common.chip_id >> 16 == 5796U || bp->common.chip_id >> 16 == 5803U)) || bp->common.chip_id >> 16 == 5805U ? 1024U : 512U) + (((((((((bp->common.chip_id >> 16 == 5770U || bp->common.chip_id >> 16 == 5797U) || bp->common.chip_id >> 16 == 5801U) || bp->common.chip_id >> 16 == 5774U) || bp->common.chip_id >> 16 == 5806U) || bp->common.chip_id >> 16 == 5807U) || ((bp->common.chip_id >> 16 == 5693U || bp->common.chip_id >> 16 == 5694U) || bp->common.chip_id >> 16 == 5695U)) || ((bp->common.chip_id >> 16 == 5793U || bp->common.chip_id >> 16 == 5794U) || bp->common.chip_id >> 16 == 5773U)) || (bp->common.chip_id >> 16 == 5796U || bp->common.chip_id >> 16 == 5803U)) || bp->common.chip_id >> 16 == 5805U ? 6U : 4U)) + (bp->common.chip_id >> 16 == 5710U ? 43U : 75U)) + 228U : 128U; tmp___3 = __max1 > __max2 ? __max1 : __max2; } else { __max1___0 = bp->common.chip_id >> 16 == 5710U ? 43U : 75U; __max2___0 = (int )bp->dropless_fc ? (((((((((((bp->common.chip_id >> 16 == 5770U || bp->common.chip_id >> 16 == 5797U) || bp->common.chip_id >> 16 == 5801U) || bp->common.chip_id >> 16 == 5774U) || bp->common.chip_id >> 16 == 5806U) || bp->common.chip_id >> 16 == 5807U) || ((bp->common.chip_id >> 16 == 5693U || bp->common.chip_id >> 16 == 5694U) || bp->common.chip_id >> 16 == 5695U)) || ((bp->common.chip_id >> 16 == 5793U || bp->common.chip_id >> 16 == 5794U) || bp->common.chip_id >> 16 == 5773U)) || (bp->common.chip_id >> 16 == 5796U || bp->common.chip_id >> 16 == 5803U)) || bp->common.chip_id >> 16 == 5805U ? 1024U : 512U) + (((((((((bp->common.chip_id >> 16 == 5770U || bp->common.chip_id >> 16 == 5797U) || bp->common.chip_id >> 16 == 5801U) || bp->common.chip_id >> 16 == 5774U) || bp->common.chip_id >> 16 == 5806U) || bp->common.chip_id >> 16 == 5807U) || ((bp->common.chip_id >> 16 == 5693U || bp->common.chip_id >> 16 == 5694U) || bp->common.chip_id >> 16 == 5695U)) || ((bp->common.chip_id >> 16 == 5793U || bp->common.chip_id >> 16 == 5794U) || bp->common.chip_id >> 16 == 5773U)) || (bp->common.chip_id >> 16 == 5796U || bp->common.chip_id >> 16 == 5803U)) || bp->common.chip_id >> 16 == 5805U ? 6U : 4U)) + (bp->common.chip_id >> 16 == 5710U ? 43U : 75U)) + 228U : 128U; tmp___3 = __max1___0 > __max2___0 ? __max1___0 : __max2___0; } if (ering->rx_pending < tmp___3) { goto _L; } else if ((unsigned long )ering->tx_pending > ((unsigned int )bp->mf_mode == 3U && (bp->mf_ext_config & 8U) != 0U ? 0UL : 4078UL)) { goto _L; } else if (ering->tx_pending <= 21U) { _L: /* CIL Label */ tmp___2 = ldv__builtin_expect((bp->msg_enable & 67108864) != 0, 0L); if (tmp___2 != 0L) { printk("\rbnx2x: [%s:%d(%s)]Command parameters not supported\n", "bnx2x_set_ringparam", 1896, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } return (-22); } else { } } bp->rx_ring_size = (int )ering->rx_pending; bp->tx_ring_size = (int )ering->tx_pending; tmp___4 = bnx2x_reload_if_running(dev); return (tmp___4); } } static void bnx2x_get_pauseparam(struct net_device *dev , struct ethtool_pauseparam *epause ) { struct bnx2x *bp ; void *tmp ; int cfg_idx ; int tmp___0 ; int cfg_reg ; long tmp___1 ; { tmp = netdev_priv((struct net_device const *)dev); bp = (struct bnx2x *)tmp; tmp___0 = bnx2x_get_link_cfg_idx(bp); cfg_idx = tmp___0; epause->autoneg = (unsigned int )bp->link_params.req_flow_ctrl[cfg_idx] == 0U; if (epause->autoneg == 0U) { cfg_reg = (int )bp->link_params.req_flow_ctrl[cfg_idx]; } else { cfg_reg = (int )bp->link_params.req_fc_auto_adv; } epause->rx_pause = (cfg_reg & 512) != 0; epause->tx_pause = (cfg_reg & 256) != 0; tmp___1 = ldv__builtin_expect((bp->msg_enable & 67108864) != 0, 0L); if (tmp___1 != 0L) { printk("\rbnx2x: [%s:%d(%s)]ethtool_pauseparam: cmd %d\n autoneg %d rx_pause %d tx_pause %d\n", "bnx2x_get_pauseparam", 1928, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", epause->cmd, epause->autoneg, epause->rx_pause, epause->tx_pause); } else { } return; } } static int bnx2x_set_pauseparam(struct net_device *dev , struct ethtool_pauseparam *epause ) { struct bnx2x *bp ; void *tmp ; u32 cfg_idx ; int tmp___0 ; long tmp___1 ; long tmp___2 ; long tmp___3 ; bool tmp___4 ; { tmp = netdev_priv((struct net_device const *)dev); bp = (struct bnx2x *)tmp; tmp___0 = bnx2x_get_link_cfg_idx(bp); cfg_idx = (u32 )tmp___0; if ((unsigned int )bp->mf_mode != 0U) { return (0); } else { } tmp___1 = ldv__builtin_expect((bp->msg_enable & 67108864) != 0, 0L); if (tmp___1 != 0L) { printk("\rbnx2x: [%s:%d(%s)]ethtool_pauseparam: cmd %d\n autoneg %d rx_pause %d tx_pause %d\n", "bnx2x_set_pauseparam", 1941, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", epause->cmd, epause->autoneg, epause->rx_pause, epause->tx_pause); } else { } bp->link_params.req_flow_ctrl[cfg_idx] = 0U; if (epause->rx_pause != 0U) { bp->link_params.req_flow_ctrl[cfg_idx] = (u16 )((unsigned int )bp->link_params.req_flow_ctrl[cfg_idx] | 512U); } else { } if (epause->tx_pause != 0U) { bp->link_params.req_flow_ctrl[cfg_idx] = (u16 )((unsigned int )bp->link_params.req_flow_ctrl[cfg_idx] | 256U); } else { } if ((unsigned int )bp->link_params.req_flow_ctrl[cfg_idx] == 0U) { bp->link_params.req_flow_ctrl[cfg_idx] = 1024U; } else { } if (epause->autoneg != 0U) { if ((bp->port.supported[cfg_idx] & 64U) == 0U) { tmp___2 = ldv__builtin_expect((bp->msg_enable & 67108864) != 0, 0L); if (tmp___2 != 0L) { printk("\rbnx2x: [%s:%d(%s)]autoneg not supported\n", "bnx2x_set_pauseparam", 1956, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } return (-22); } else { } if ((unsigned int )bp->link_params.req_line_speed[cfg_idx] == 0U) { bp->link_params.req_flow_ctrl[cfg_idx] = 0U; } else { } bp->link_params.req_fc_auto_adv = 0U; if (epause->rx_pause != 0U) { bp->link_params.req_fc_auto_adv = (u16 )((unsigned int )bp->link_params.req_fc_auto_adv | 512U); } else { } if (epause->tx_pause != 0U) { bp->link_params.req_fc_auto_adv = (u16 )((unsigned int )bp->link_params.req_fc_auto_adv | 256U); } else { } if ((unsigned int )bp->link_params.req_fc_auto_adv == 0U) { bp->link_params.req_fc_auto_adv = (u16 )((unsigned int )bp->link_params.req_fc_auto_adv | 1024U); } else { } } else { } tmp___3 = ldv__builtin_expect((bp->msg_enable & 67108864) != 0, 0L); if (tmp___3 != 0L) { printk("\rbnx2x: [%s:%d(%s)]req_flow_ctrl 0x%x\n", "bnx2x_set_pauseparam", 1976, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )bp->link_params.req_flow_ctrl[cfg_idx]); } else { } tmp___4 = netif_running((struct net_device const *)dev); if ((int )tmp___4) { bnx2x_stats_handle(bp, 3); bnx2x_link_set(bp); } else { } return (0); } } static char const bnx2x_tests_str_arr[7U][32U] = { { 'r', 'e', 'g', 'i', 's', 't', 'e', 'r', '_', 't', 'e', 's', 't', ' ', '(', 'o', 'f', 'f', 'l', 'i', 'n', 'e', ')', ' ', ' ', ' ', ' ', '\000'}, { 'm', 'e', 'm', 'o', 'r', 'y', '_', 't', 'e', 's', 't', ' ', '(', 'o', 'f', 'f', 'l', 'i', 'n', 'e', ')', ' ', ' ', ' ', ' ', ' ', ' ', '\000'}, { 'i', 'n', 't', '_', 'l', 'o', 'o', 'p', 'b', 'a', 'c', 'k', '_', 't', 'e', 's', 't', ' ', '(', 'o', 'f', 'f', 'l', 'i', 'n', 'e', ')', '\000'}, { 'e', 'x', 't', '_', 'l', 'o', 'o', 'p', 'b', 'a', 'c', 'k', '_', 't', 'e', 's', 't', ' ', '(', 'o', 'f', 'f', 'l', 'i', 'n', 'e', ')', '\000'}, { 'n', 'v', 'r', 'a', 'm', '_', 't', 'e', 's', 't', ' ', '(', 'o', 'n', 'l', 'i', 'n', 'e', ')', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', '\000'}, { 'i', 'n', 't', 'e', 'r', 'r', 'u', 'p', 't', '_', 't', 'e', 's', 't', ' ', '(', 'o', 'n', 'l', 'i', 'n', 'e', ')', ' ', ' ', ' ', ' ', '\000'}, { 'l', 'i', 'n', 'k', '_', 't', 'e', 's', 't', ' ', '(', 'o', 'n', 'l', 'i', 'n', 'e', ')', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', '\000'}}; static u32 bnx2x_eee_to_adv(u32 eee_adv ) { u32 modes ; { modes = 0U; if ((int )eee_adv & 1) { modes = modes | 8U; } else { } if ((eee_adv & 2U) != 0U) { modes = modes | 32U; } else { } if ((eee_adv & 4U) != 0U) { modes = modes | 4096U; } else { } return (modes); } } static u32 bnx2x_adv_to_eee(u32 modes , u32 shift ) { u32 eee_adv ; { eee_adv = 0U; if ((modes & 8U) != 0U) { eee_adv = eee_adv | 1U; } else { } if ((modes & 32U) != 0U) { eee_adv = eee_adv | 2U; } else { } if ((modes & 4096U) != 0U) { eee_adv = eee_adv | 4U; } else { } return (eee_adv << (int )shift); } } static int bnx2x_get_eee(struct net_device *dev , struct ethtool_eee *edata ) { struct bnx2x *bp ; void *tmp ; u32 eee_cfg ; long tmp___0 ; unsigned int tmp___1 ; { tmp = netdev_priv((struct net_device const *)dev); bp = (struct bnx2x *)tmp; if (bp->common.shmem2_base == 0U) { goto _L; } else { tmp___1 = readl((void const volatile *)bp->regview + (unsigned long )bp->common.shmem2_base); if ((unsigned long )tmp___1 <= (((unsigned long )bp->pfid & 1UL) + 76UL) * 4UL) { _L: /* CIL Label */ tmp___0 = ldv__builtin_expect((bp->msg_enable & 67108864) != 0, 0L); if (tmp___0 != 0L) { printk("\rbnx2x: [%s:%d(%s)]BC Version does not support EEE\n", "bnx2x_get_eee", 2029, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } return (-95); } else { } } eee_cfg = bp->link_vars.eee_status; edata->supported = bnx2x_eee_to_adv((eee_cfg & 983040U) >> 16); edata->advertised = bnx2x_eee_to_adv((eee_cfg & 15728640U) >> 20); edata->lp_advertised = bnx2x_eee_to_adv((eee_cfg & 251658240U) >> 24); edata->tx_lpi_timer = (eee_cfg & 65535U) << 4; edata->eee_enabled = (eee_cfg & 268435456U) != 0U; edata->eee_active = (eee_cfg & 1073741824U) != 0U; edata->tx_lpi_enabled = (eee_cfg & 536870912U) != 0U; return (0); } } static int bnx2x_set_eee(struct net_device *dev , struct ethtool_eee *edata ) { struct bnx2x *bp ; void *tmp ; u32 eee_cfg ; u32 advertised ; long tmp___0 ; unsigned int tmp___1 ; long tmp___2 ; long tmp___3 ; long tmp___4 ; long tmp___5 ; bool tmp___6 ; { tmp = netdev_priv((struct net_device const *)dev); bp = (struct bnx2x *)tmp; if ((unsigned int )bp->mf_mode != 0U) { return (0); } else { } if (bp->common.shmem2_base == 0U) { goto _L; } else { tmp___1 = readl((void const volatile *)bp->regview + (unsigned long )bp->common.shmem2_base); if ((unsigned long )tmp___1 <= (((unsigned long )bp->pfid & 1UL) + 76UL) * 4UL) { _L: /* CIL Label */ tmp___0 = ldv__builtin_expect((bp->msg_enable & 67108864) != 0, 0L); if (tmp___0 != 0L) { printk("\rbnx2x: [%s:%d(%s)]BC Version does not support EEE\n", "bnx2x_set_eee", 2066, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } return (-95); } else { } } eee_cfg = bp->link_vars.eee_status; if ((eee_cfg & 983040U) == 0U) { tmp___2 = ldv__builtin_expect((bp->msg_enable & 67108864) != 0, 0L); if (tmp___2 != 0L) { printk("\rbnx2x: [%s:%d(%s)]Board does not support EEE!\n", "bnx2x_set_eee", 2073, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } return (-95); } else { } advertised = bnx2x_adv_to_eee(edata->advertised, 20U); if ((eee_cfg & 15728640U) != advertised) { tmp___3 = ldv__builtin_expect((bp->msg_enable & 67108864) != 0, 0L); if (tmp___3 != 0L) { printk("\rbnx2x: [%s:%d(%s)]Direct manipulation of EEE advertisement is not supported\n", "bnx2x_set_eee", 2081, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } return (-22); } else { } if (edata->tx_lpi_timer > 1048575U) { tmp___4 = ldv__builtin_expect((bp->msg_enable & 67108864) != 0, 0L); if (tmp___4 != 0L) { printk("\rbnx2x: [%s:%d(%s)]Maximal Tx Lpi timer supported is %x(u)\n", "bnx2x_set_eee", 2088, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", 1048575); } else { } return (-22); } else { } if (edata->tx_lpi_enabled != 0U && edata->tx_lpi_timer <= 255U) { tmp___5 = ldv__builtin_expect((bp->msg_enable & 67108864) != 0, 0L); if (tmp___5 != 0L) { printk("\rbnx2x: [%s:%d(%s)]Minimal Tx Lpi timer supported is %d(u)\n", "bnx2x_set_eee", 2095, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", 256); } else { } return (-22); } else { } if (edata->eee_enabled != 0U) { bp->link_params.eee_mode = bp->link_params.eee_mode | 2147483648U; } else { bp->link_params.eee_mode = bp->link_params.eee_mode & 2147483647U; } if (edata->tx_lpi_enabled != 0U) { bp->link_params.eee_mode = bp->link_params.eee_mode | 1073741824U; } else { bp->link_params.eee_mode = bp->link_params.eee_mode & 3221225471U; } bp->link_params.eee_mode = bp->link_params.eee_mode & 4293918720U; bp->link_params.eee_mode = (bp->link_params.eee_mode | (edata->tx_lpi_timer & 1048575U)) | 805306368U; tmp___6 = netif_running((struct net_device const *)dev); if ((int )tmp___6) { bnx2x_stats_handle(bp, 3); bnx2x_force_link_reset(bp); bnx2x_link_set(bp); } else { } return (0); } } static int bnx2x_test_registers(struct bnx2x *bp ) { int idx ; int i ; int rc ; u32 wr_val ; u32 hw ; int port ; struct __anonstruct_reg_tbl_259 reg_tbl[39U] ; long tmp ; bool tmp___0 ; int tmp___1 ; u32 offset ; u32 mask ; u32 save_val ; u32 val ; long tmp___2 ; { rc = -19; wr_val = 0U; port = (int )bp->pfid & 1; reg_tbl[0].hw = 31U; reg_tbl[0].offset0 = 393320U; reg_tbl[0].offset1 = 4U; reg_tbl[0].mask = 1023U; reg_tbl[1].hw = 31U; reg_tbl[1].offset0 = 1507468U; reg_tbl[1].offset1 = 4U; reg_tbl[1].mask = 4294967295U; reg_tbl[2].hw = 3U; reg_tbl[2].offset0 = 1081424U; reg_tbl[2].offset1 = 4U; reg_tbl[2].mask = 1023U; reg_tbl[3].hw = 31U; reg_tbl[3].offset0 = 1310768U; reg_tbl[3].offset1 = 4U; reg_tbl[3].mask = 1U; reg_tbl[4].hw = 15U; reg_tbl[4].offset0 = 1310928U; reg_tbl[4].offset1 = 4U; reg_tbl[4].mask = 2047U; reg_tbl[5].hw = 16U; reg_tbl[5].offset0 = 1425968U; reg_tbl[5].offset1 = 4U; reg_tbl[5].mask = 2047U; reg_tbl[6].hw = 31U; reg_tbl[6].offset0 = 262396U; reg_tbl[6].offset1 = 4U; reg_tbl[6].mask = 16777215U; reg_tbl[7].hw = 31U; reg_tbl[7].offset0 = 1179648U; reg_tbl[7].offset1 = 4U; reg_tbl[7].mask = 1048575U; reg_tbl[8].hw = 31U; reg_tbl[8].offset0 = 1179656U; reg_tbl[8].offset1 = 8U; reg_tbl[8].mask = 262143U; reg_tbl[9].hw = 31U; reg_tbl[9].offset0 = 1179676U; reg_tbl[9].offset1 = 4U; reg_tbl[9].mask = 1048575U; reg_tbl[10].hw = 31U; reg_tbl[10].offset0 = 1179796U; reg_tbl[10].offset1 = 8U; reg_tbl[10].mask = 262143U; reg_tbl[11].hw = 31U; reg_tbl[11].offset0 = 1179872U; reg_tbl[11].offset1 = 4U; reg_tbl[11].mask = 1048575U; reg_tbl[12].hw = 31U; reg_tbl[12].offset0 = 1474592U; reg_tbl[12].offset1 = 4U; reg_tbl[12].mask = 1048575U; reg_tbl[13].hw = 31U; reg_tbl[13].offset0 = 1458248U; reg_tbl[13].offset1 = 4U; reg_tbl[13].mask = 262143U; reg_tbl[14].hw = 31U; reg_tbl[14].offset0 = 263176U; reg_tbl[14].offset1 = 40U; reg_tbl[14].mask = 4294967295U; reg_tbl[15].hw = 31U; reg_tbl[15].offset0 = 263204U; reg_tbl[15].offset1 = 40U; reg_tbl[15].mask = 4294967295U; reg_tbl[16].hw = 31U; reg_tbl[16].offset0 = 131524U; reg_tbl[16].offset1 = 4U; reg_tbl[16].mask = 1U; reg_tbl[17].hw = 31U; reg_tbl[17].offset0 = 131540U; reg_tbl[17].offset1 = 4U; reg_tbl[17].mask = 3U; reg_tbl[18].hw = 31U; reg_tbl[18].offset0 = 131352U; reg_tbl[18].offset1 = 4U; reg_tbl[18].mask = 255U; reg_tbl[19].hw = 31U; reg_tbl[19].offset0 = 65652U; reg_tbl[19].offset1 = 4U; reg_tbl[19].mask = 1U; reg_tbl[20].hw = 7U; reg_tbl[20].offset0 = 65700U; reg_tbl[20].offset1 = 4U; reg_tbl[20].mask = 1U; reg_tbl[21].hw = 7U; reg_tbl[21].offset0 = 65708U; reg_tbl[21].offset1 = 4U; reg_tbl[21].mask = 1U; reg_tbl[22].hw = 31U; reg_tbl[22].offset0 = 65776U; reg_tbl[22].offset1 = 4U; reg_tbl[22].mask = 1U; reg_tbl[23].hw = 31U; reg_tbl[23].offset0 = 65784U; reg_tbl[23].offset1 = 4U; reg_tbl[23].mask = 1U; reg_tbl[24].hw = 31U; reg_tbl[24].offset0 = 65840U; reg_tbl[24].offset1 = 4U; reg_tbl[24].mask = 7U; reg_tbl[25].hw = 31U; reg_tbl[25].offset0 = 65876U; reg_tbl[25].offset1 = 68U; reg_tbl[25].mask = 255U; reg_tbl[26].hw = 31U; reg_tbl[26].offset0 = 65884U; reg_tbl[26].offset1 = 68U; reg_tbl[26].mask = 4294967295U; reg_tbl[27].hw = 31U; reg_tbl[27].offset0 = 65984U; reg_tbl[27].offset1 = 160U; reg_tbl[27].mask = 4294967295U; reg_tbl[28].hw = 31U; reg_tbl[28].offset0 = 66012U; reg_tbl[28].offset1 = 160U; reg_tbl[28].mask = 4294967295U; reg_tbl[29].hw = 31U; reg_tbl[29].offset0 = 66056U; reg_tbl[29].offset1 = 160U; reg_tbl[29].mask = 1U; reg_tbl[30].hw = 31U; reg_tbl[30].offset0 = 66068U; reg_tbl[30].offset1 = 160U; reg_tbl[30].mask = 65535U; reg_tbl[31].hw = 31U; reg_tbl[31].offset0 = 66080U; reg_tbl[31].offset1 = 160U; reg_tbl[31].mask = 65535U; reg_tbl[32].hw = 31U; reg_tbl[32].offset0 = 66092U; reg_tbl[32].offset1 = 160U; reg_tbl[32].mask = 4095U; reg_tbl[33].hw = 7U; reg_tbl[33].offset0 = 66272U; reg_tbl[33].offset1 = 4U; reg_tbl[33].mask = 1U; reg_tbl[34].hw = 31U; reg_tbl[34].offset0 = 66296U; reg_tbl[34].offset1 = 4U; reg_tbl[34].mask = 1U; reg_tbl[35].hw = 31U; reg_tbl[35].offset0 = 66344U; reg_tbl[35].offset1 = 4U; reg_tbl[35].mask = 134217727U; reg_tbl[36].hw = 7U; reg_tbl[36].offset0 = 66376U; reg_tbl[36].offset1 = 24U; reg_tbl[36].mask = 1U; reg_tbl[37].hw = 7U; reg_tbl[37].offset0 = 66420U; reg_tbl[37].offset1 = 16U; reg_tbl[37].mask = 31U; reg_tbl[38].hw = 31U; reg_tbl[38].offset0 = 4294967295U; reg_tbl[38].offset1 = 0U; reg_tbl[38].mask = 0U; tmp___0 = netif_running((struct net_device const *)bp->dev); if (tmp___0) { tmp___1 = 0; } else { tmp___1 = 1; } if (tmp___1) { tmp = ldv__builtin_expect((bp->msg_enable & 67371008) != 0, 0L); if (tmp != 0L) { printk("\rbnx2x: [%s:%d(%s)]cannot access eeprom when the interface is down\n", "bnx2x_test_registers", 2237, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } return (rc); } else { } if (bp->common.chip_id >> 16 == 5710U) { hw = 1U; } else if (bp->common.chip_id >> 16 == 5711U || bp->common.chip_id >> 16 == 5712U) { hw = 2U; } else if ((bp->common.chip_id >> 16 == 5730U || bp->common.chip_id >> 16 == 5731U) || bp->common.chip_id >> 16 == 5743U) { hw = 4U; } else if ((((((((((bp->common.chip_id >> 16 == 5770U || bp->common.chip_id >> 16 == 5797U) || bp->common.chip_id >> 16 == 5801U) || bp->common.chip_id >> 16 == 5774U) || bp->common.chip_id >> 16 == 5806U) || bp->common.chip_id >> 16 == 5807U) || ((bp->common.chip_id >> 16 == 5693U || bp->common.chip_id >> 16 == 5694U) || bp->common.chip_id >> 16 == 5695U)) || ((bp->common.chip_id >> 16 == 5793U || bp->common.chip_id >> 16 == 5794U) || bp->common.chip_id >> 16 == 5773U)) || (bp->common.chip_id >> 16 == 5796U || bp->common.chip_id >> 16 == 5803U)) || bp->common.chip_id >> 16 == 5805U) && ((bp->common.chip_id & 61440U) > 20480U ? ((~ bp->common.chip_id & 61440U) >> 13) << 12 == 4096U : (bp->common.chip_id & 61440U) == 4096U)) { hw = 16U; } else { hw = 8U; } idx = 0; goto ldv_45847; ldv_45846: ; switch (idx) { case 0: wr_val = 0U; goto ldv_45835; case 1: wr_val = 4294967295U; goto ldv_45835; } ldv_45835: i = 0; goto ldv_45844; ldv_45843: ; if ((reg_tbl[i].hw & hw) == 0U) { goto ldv_45841; } else { } offset = reg_tbl[i].offset0 + reg_tbl[i].offset1 * (unsigned int )port; mask = reg_tbl[i].mask; save_val = readl((void const volatile *)bp->regview + (unsigned long )offset); writel(wr_val & mask, (void volatile *)bp->regview + (unsigned long )offset); val = readl((void const volatile *)bp->regview + (unsigned long )offset); writel(save_val, (void volatile *)bp->regview + (unsigned long )offset); if (((val ^ wr_val) & mask) != 0U) { tmp___2 = ldv__builtin_expect((bp->msg_enable & 67108864) != 0, 0L); if (tmp___2 != 0L) { printk("\rbnx2x: [%s:%d(%s)]offset 0x%x: val 0x%x != 0x%x mask 0x%x\n", "bnx2x_test_registers", 2287, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", offset, val, wr_val, mask); } else { } goto test_reg_exit; } else { } ldv_45841: i = i + 1; ldv_45844: ; if (reg_tbl[i].offset0 != 4294967295U) { goto ldv_45843; } else { } idx = idx + 1; ldv_45847: ; if (idx <= 1) { goto ldv_45846; } else { } rc = 0; test_reg_exit: ; return (rc); } } static int bnx2x_test_memory(struct bnx2x *bp ) { int i ; int j ; int rc ; u32 val ; u32 index ; struct __anonstruct_mem_tbl_261 mem_tbl[8U] ; struct __anonstruct_prty_tbl_263 prty_tbl[7U] ; unsigned int tmp ; unsigned int tmp___0 ; unsigned int tmp___1 ; unsigned int tmp___2 ; unsigned int tmp___3 ; unsigned int tmp___4 ; unsigned int tmp___5 ; long tmp___6 ; bool tmp___7 ; int tmp___8 ; long tmp___9 ; long tmp___10 ; { rc = -19; mem_tbl[0].offset = 852736U; mem_tbl[0].size = 24; mem_tbl[1].offset = 1065984U; mem_tbl[1].size = 256; mem_tbl[2].offset = 1068032U; mem_tbl[2].size = 256; mem_tbl[3].offset = 1057792U; mem_tbl[3].size = 224; mem_tbl[4].offset = 328320U; mem_tbl[4].size = 29; mem_tbl[5].offset = 918144U; mem_tbl[5].size = 27; mem_tbl[6].offset = 132224U; mem_tbl[6].size = 32; mem_tbl[7].offset = 4294967295U; mem_tbl[7].size = 0; prty_tbl[0].name = (char *)"CCM_PRTY_STS"; prty_tbl[0].offset = 852456U; prty_tbl[0].hw_mask[0] = 262080U; prty_tbl[0].hw_mask[1] = 0U; prty_tbl[0].hw_mask[2] = 0U; prty_tbl[0].hw_mask[3] = 0U; tmp = 4U; while (1) { if (tmp >= 5U) { break; } else { } prty_tbl[0].hw_mask[tmp] = 0U; tmp = tmp + 1U; } prty_tbl[1].name = (char *)"CFC_PRTY_STS"; prty_tbl[1].offset = 1065228U; prty_tbl[1].hw_mask[0] = 2U; prty_tbl[1].hw_mask[1] = 2U; prty_tbl[1].hw_mask[2] = 0U; prty_tbl[1].hw_mask[3] = 0U; tmp___0 = 4U; while (1) { if (tmp___0 >= 5U) { break; } else { } prty_tbl[1].hw_mask[tmp___0] = 0U; tmp___0 = tmp___0 + 1U; } prty_tbl[2].name = (char *)"DMAE_PRTY_STS"; prty_tbl[2].offset = 1056856U; prty_tbl[2].hw_mask[0] = 0U; prty_tbl[2].hw_mask[1] = 0U; prty_tbl[2].hw_mask[2] = 0U; prty_tbl[2].hw_mask[3] = 0U; tmp___1 = 4U; while (1) { if (tmp___1 >= 5U) { break; } else { } prty_tbl[2].hw_mask[tmp___1] = 0U; tmp___1 = tmp___1 + 1U; } prty_tbl[3].name = (char *)"TCM_PRTY_STS"; prty_tbl[3].offset = 328160U; prty_tbl[3].hw_mask[0] = 262080U; prty_tbl[3].hw_mask[1] = 0U; prty_tbl[3].hw_mask[2] = 0U; prty_tbl[3].hw_mask[3] = 0U; tmp___2 = 4U; while (1) { if (tmp___2 >= 5U) { break; } else { } prty_tbl[3].hw_mask[tmp___2] = 0U; tmp___2 = tmp___2 + 1U; } prty_tbl[4].name = (char *)"UCM_PRTY_STS"; prty_tbl[4].offset = 917976U; prty_tbl[4].hw_mask[0] = 262080U; prty_tbl[4].hw_mask[1] = 0U; prty_tbl[4].hw_mask[2] = 0U; prty_tbl[4].hw_mask[3] = 0U; tmp___3 = 4U; while (1) { if (tmp___3 >= 5U) { break; } else { } prty_tbl[4].hw_mask[tmp___3] = 0U; tmp___3 = tmp___3 + 1U; } prty_tbl[5].name = (char *)"XCM_PRTY_STS"; prty_tbl[5].offset = 131768U; prty_tbl[5].hw_mask[0] = 262081U; prty_tbl[5].hw_mask[1] = 0U; prty_tbl[5].hw_mask[2] = 0U; prty_tbl[5].hw_mask[3] = 0U; tmp___4 = 4U; while (1) { if (tmp___4 >= 5U) { break; } else { } prty_tbl[5].hw_mask[tmp___4] = 0U; tmp___4 = tmp___4 + 1U; } prty_tbl[6].name = 0; prty_tbl[6].offset = 4294967295U; prty_tbl[6].hw_mask[0] = 0U; prty_tbl[6].hw_mask[1] = 0U; prty_tbl[6].hw_mask[2] = 0U; prty_tbl[6].hw_mask[3] = 0U; tmp___5 = 4U; while (1) { if (tmp___5 >= 5U) { break; } else { } prty_tbl[6].hw_mask[tmp___5] = 0U; tmp___5 = tmp___5 + 1U; } tmp___7 = netif_running((struct net_device const *)bp->dev); if (tmp___7) { tmp___8 = 0; } else { tmp___8 = 1; } if (tmp___8) { tmp___6 = ldv__builtin_expect((bp->msg_enable & 67371008) != 0, 0L); if (tmp___6 != 0L) { printk("\rbnx2x: [%s:%d(%s)]cannot access eeprom when the interface is down\n", "bnx2x_test_memory", 2341, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } return (rc); } else { } if (bp->common.chip_id >> 16 == 5710U) { index = 0U; } else if (bp->common.chip_id >> 16 == 5711U || bp->common.chip_id >> 16 == 5712U) { index = 1U; } else if ((bp->common.chip_id >> 16 == 5730U || bp->common.chip_id >> 16 == 5731U) || bp->common.chip_id >> 16 == 5743U) { index = 2U; } else { index = 3U; } i = 0; goto ldv_45869; ldv_45868: val = readl((void const volatile *)bp->regview + (unsigned long )prty_tbl[i].offset); if ((~ prty_tbl[i].hw_mask[index] & val) != 0U) { tmp___9 = ldv__builtin_expect((bp->msg_enable & 67108864) != 0, 0L); if (tmp___9 != 0L) { printk("\rbnx2x: [%s:%d(%s)]%s is 0x%x\n", "bnx2x_test_memory", 2359, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", prty_tbl[i].name, val); } else { } goto test_mem_exit; } else { } i = i + 1; ldv_45869: ; if (prty_tbl[i].offset != 4294967295U) { goto ldv_45868; } else { } i = 0; goto ldv_45875; ldv_45874: j = 0; goto ldv_45872; ldv_45871: readl((void const volatile *)bp->regview + (unsigned long )(mem_tbl[i].offset + (unsigned int )(j * 4))); j = j + 1; ldv_45872: ; if (mem_tbl[i].size > j) { goto ldv_45871; } else { } i = i + 1; ldv_45875: ; if (mem_tbl[i].offset != 4294967295U) { goto ldv_45874; } else { } i = 0; goto ldv_45878; ldv_45877: val = readl((void const volatile *)bp->regview + (unsigned long )prty_tbl[i].offset); if ((~ prty_tbl[i].hw_mask[index] & val) != 0U) { tmp___10 = ldv__builtin_expect((bp->msg_enable & 67108864) != 0, 0L); if (tmp___10 != 0L) { printk("\rbnx2x: [%s:%d(%s)]%s is 0x%x\n", "bnx2x_test_memory", 2374, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", prty_tbl[i].name, val); } else { } goto test_mem_exit; } else { } i = i + 1; ldv_45878: ; if (prty_tbl[i].offset != 4294967295U) { goto ldv_45877; } else { } rc = 0; test_mem_exit: ; return (rc); } } static void bnx2x_wait_for_link(struct bnx2x *bp , u8 link_up , u8 is_serdes ) { int cnt ; u8 tmp ; int tmp___0 ; long tmp___1 ; u8 tmp___2 ; int tmp___3 ; long tmp___4 ; { cnt = 1400; if ((unsigned int )link_up != 0U) { goto ldv_45887; ldv_45886: msleep(20U); ldv_45887: tmp = bnx2x_link_test(bp, (int )is_serdes); if ((unsigned int )tmp != 0U) { tmp___0 = cnt; cnt = cnt - 1; if (tmp___0 != 0) { goto ldv_45886; } else { goto ldv_45888; } } else { } ldv_45888: ; if (cnt <= 0) { tmp___2 = bnx2x_link_test(bp, (int )is_serdes); if ((unsigned int )tmp___2 != 0U) { tmp___1 = ldv__builtin_expect((bp->msg_enable & 67108864) != 0, 0L); if (tmp___1 != 0L) { printk("\rbnx2x: [%s:%d(%s)]Timeout waiting for link up\n", "bnx2x_wait_for_link", 2394, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } } else { } } else { } cnt = 1400; goto ldv_45891; ldv_45890: msleep(20U); ldv_45891: ; if ((unsigned int )bp->link_vars.link_up == 0U) { tmp___3 = cnt; cnt = cnt - 1; if (tmp___3 != 0) { goto ldv_45890; } else { goto ldv_45892; } } else { } ldv_45892: ; if (cnt <= 0 && (unsigned int )bp->link_vars.link_up == 0U) { tmp___4 = ldv__builtin_expect((bp->msg_enable & 67108864) != 0, 0L); if (tmp___4 != 0L) { printk("\rbnx2x: [%s:%d(%s)]Timeout waiting for link init\n", "bnx2x_wait_for_link", 2402, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } } else { } } else { } return; } } static int bnx2x_run_loopback(struct bnx2x *bp , int loopback_mode ) { unsigned int pkt_size ; unsigned int num_pkts ; unsigned int i ; struct sk_buff *skb ; unsigned char *packet ; struct bnx2x_fastpath *fp_rx ; struct bnx2x_fastpath *fp_tx ; struct bnx2x_fp_txdata *txdata ; u16 tx_start_idx ; u16 tx_idx ; u16 rx_start_idx ; u16 rx_idx ; u16 pkt_prod ; u16 bd_prod ; struct sw_tx_bd *tx_buf ; struct eth_tx_start_bd *tx_start_bd ; dma_addr_t mapping ; union eth_rx_cqe *cqe ; u8 cqe_fp_flags ; u8 cqe_fp_type ; struct sw_rx_bd *rx_buf ; u16 len ; int rc ; u8 *data ; struct netdev_queue *txq ; struct netdev_queue *tmp ; long tmp___0 ; int cfg_idx ; int tmp___1 ; long tmp___2 ; long tmp___3 ; long tmp___4 ; size_t __len ; void *__ret ; unsigned int tmp___5 ; long tmp___6 ; int tmp___7 ; long tmp___8 ; u16 tmp___9 ; unsigned int tmp___10 ; u16 global_data ; struct eth_tx_parse_bd_e1x *pbd_e1x ; u32 parsing_data ; struct eth_tx_parse_bd_e2 *pbd_e2 ; int _max1 ; int _max2 ; { fp_rx = bp->fp; fp_tx = bp->fp; txdata = fp_tx->txdata_ptr[0]; rc = -19; tmp = netdev_get_tx_queue((struct net_device const *)bp->dev, (unsigned int )txdata->txq_index); txq = tmp; switch (loopback_mode) { case 0: ; if ((unsigned int )bp->link_params.loopback_mode != 3U) { tmp___0 = ldv__builtin_expect((bp->msg_enable & 67108864) != 0, 0L); if (tmp___0 != 0L) { printk("\rbnx2x: [%s:%d(%s)]PHY loopback not supported\n", "bnx2x_run_loopback", 2433, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } return (-22); } else { } goto ldv_45924; case 1: ; if (((((((((bp->common.chip_id >> 16 == 5770U || bp->common.chip_id >> 16 == 5797U) || bp->common.chip_id >> 16 == 5801U) || bp->common.chip_id >> 16 == 5774U) || bp->common.chip_id >> 16 == 5806U) || bp->common.chip_id >> 16 == 5807U) || ((bp->common.chip_id >> 16 == 5693U || bp->common.chip_id >> 16 == 5694U) || bp->common.chip_id >> 16 == 5695U)) || ((bp->common.chip_id >> 16 == 5793U || bp->common.chip_id >> 16 == 5794U) || bp->common.chip_id >> 16 == 5773U)) || (bp->common.chip_id >> 16 == 5796U || bp->common.chip_id >> 16 == 5803U)) || bp->common.chip_id >> 16 == 5805U) { tmp___1 = bnx2x_get_link_cfg_idx(bp); cfg_idx = tmp___1; if ((bp->port.supported[cfg_idx] & 6295552U) != 0U) { bp->link_params.loopback_mode = 7U; } else { bp->link_params.loopback_mode = 6U; } } else { bp->link_params.loopback_mode = 2U; } bnx2x_phy_init(& bp->link_params, & bp->link_vars); goto ldv_45924; case 2: ; if ((unsigned int )bp->link_params.loopback_mode != 5U) { tmp___2 = ldv__builtin_expect((bp->msg_enable & 67108864) != 0, 0L); if (tmp___2 != 0L) { printk("\rbnx2x: [%s:%d(%s)]Can\'t configure external loopback\n", "bnx2x_run_loopback", 2455, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } return (-22); } else { } goto ldv_45924; default: tmp___3 = ldv__builtin_expect((bp->msg_enable & 67108864) != 0, 0L); if (tmp___3 != 0L) { printk("\rbnx2x: [%s:%d(%s)]Command parameters not supported\n", "bnx2x_run_loopback", 2460, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } return (-22); } ldv_45924: pkt_size = (1500U < (bp->dev)->mtu ? 1500U : (bp->dev)->mtu) + 14U; skb = netdev_alloc_skb(bp->dev, fp_rx->rx_buf_size); if ((unsigned long )skb == (unsigned long )((struct sk_buff *)0)) { tmp___4 = ldv__builtin_expect((bp->msg_enable & 67108864) != 0, 0L); if (tmp___4 != 0L) { printk("\rbnx2x: [%s:%d(%s)]Can\'t allocate skb\n", "bnx2x_run_loopback", 2469, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } rc = -12; goto test_loopback_exit; } else { } packet = skb_put(skb, pkt_size); __len = 6UL; if (__len > 63UL) { __ret = __memcpy((void *)packet, (void const *)(bp->dev)->dev_addr, __len); } else { __ret = __builtin_memcpy((void *)packet, (void const *)(bp->dev)->dev_addr, __len); } memset((void *)packet + 6U, 0, 6UL); memset((void *)packet + 12U, 119, 2UL); i = 14U; goto ldv_45934; ldv_45933: *(packet + (unsigned long )i) = (unsigned char )i; i = i + 1U; ldv_45934: ; if (i < pkt_size) { goto ldv_45933; } else { } tmp___5 = skb_headlen((struct sk_buff const *)skb); mapping = dma_map_single_attrs___0(& (bp->pdev)->dev, (void *)skb->data, (size_t )tmp___5, 1, 0); tmp___7 = dma_mapping_error(& (bp->pdev)->dev, mapping); tmp___8 = ldv__builtin_expect(tmp___7 != 0, 0L); if (tmp___8 != 0L) { rc = -12; consume_skb(skb); tmp___6 = ldv__builtin_expect((bp->msg_enable & 67108864) != 0, 0L); if (tmp___6 != 0L) { printk("\rbnx2x: [%s:%d(%s)]Unable to map SKB\n", "bnx2x_run_loopback", 2484, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } goto test_loopback_exit; } else { } num_pkts = 0U; tx_start_idx = *(txdata->tx_cons_sb); rx_start_idx = *(fp_rx->rx_cons_sb); netdev_tx_sent_queue___0(txq, skb->len); tmp___9 = txdata->tx_pkt_prod; txdata->tx_pkt_prod = (u16 )((int )txdata->tx_pkt_prod + 1); pkt_prod = tmp___9; tx_buf = txdata->tx_buf_ring + ((unsigned long )pkt_prod & 4095UL); tx_buf->first_bd = txdata->tx_bd_prod; tx_buf->skb = skb; tx_buf->flags = 0U; bd_prod = (unsigned int )txdata->tx_bd_prod & 4095U; tx_start_bd = & (txdata->tx_desc_ring + (unsigned long )bd_prod)->start_bd; tx_start_bd->addr_hi = (unsigned int )(mapping >> 32); tx_start_bd->addr_lo = (unsigned int )mapping; tx_start_bd->nbd = 2U; tmp___10 = skb_headlen((struct sk_buff const *)skb); tx_start_bd->nbytes = (unsigned short )tmp___10; tx_start_bd->vlan_or_ethertype = pkt_prod; tx_start_bd->bd_flags.as_bitfield = 16U; tx_start_bd->general_data = (unsigned int )tx_start_bd->general_data & 240U; tx_start_bd->general_data = (u8 )((unsigned int )tx_start_bd->general_data | 1U); tx_start_bd->general_data = (unsigned int )tx_start_bd->general_data & 159U; tx_start_bd->general_data = tx_start_bd->general_data; bd_prod = ((unsigned long )bd_prod & 255UL) == 254UL ? ((unsigned int )bd_prod + 2U) & 4095U : ((unsigned int )bd_prod + 1U) & 4095U; if (bp->common.chip_id >> 16 == 5710U || (bp->common.chip_id >> 16 == 5711U || bp->common.chip_id >> 16 == 5712U)) { global_data = 0U; pbd_e1x = & (txdata->tx_desc_ring + (unsigned long )bd_prod)->parse_bd_e1x; memset((void *)pbd_e1x, 0, 16UL); global_data = (unsigned int )global_data & 65487U; global_data = (u16 )((unsigned int )global_data | 16U); pbd_e1x->global_data = global_data; } else { parsing_data = 0U; pbd_e2 = & (txdata->tx_desc_ring + (unsigned long )bd_prod)->parse_bd_e2; memset((void *)pbd_e2, 0, 16UL); parsing_data = parsing_data & 1073741823U; parsing_data = parsing_data | 1073741824U; pbd_e2->parsing_data = parsing_data; } __asm__ volatile ("sfence": : : "memory"); txdata->tx_db.data.prod = (unsigned int )txdata->tx_db.data.prod + 2U; __asm__ volatile ("": : : "memory"); writel(txdata->tx_db.raw, (void volatile *)(bp->doorbells + ((unsigned long )((u32 )bp->db_size * txdata->cid) + 64UL))); __asm__ volatile ("": : : "memory"); __asm__ volatile ("": : : "memory"); num_pkts = num_pkts + 1U; txdata->tx_bd_prod = (unsigned int )txdata->tx_bd_prod + 2U; __const_udelay(429500UL); tx_idx = *(txdata->tx_cons_sb); if ((unsigned int )tx_idx != (unsigned int )tx_start_idx + num_pkts) { goto test_loopback_exit; } else { } if ((unsigned int )bp->common.int_block == 1U) { local_bh_disable(); bnx2x_tx_int(bp, txdata); local_bh_enable(); } else { } rx_idx = *(fp_rx->rx_cons_sb); if ((unsigned int )rx_idx != (unsigned int )rx_start_idx + num_pkts) { goto test_loopback_exit; } else { } cqe = fp_rx->rx_comp_ring + ((unsigned long )fp_rx->rx_comp_cons & 4095UL); cqe_fp_flags = cqe->fast_path_cqe.type_error_flags; cqe_fp_type = (unsigned int )cqe_fp_flags & 3U; if ((unsigned int )cqe_fp_type != 0U || ((int )cqe_fp_flags & 8) != 0) { goto test_loopback_rx_exit; } else { } len = cqe->fast_path_cqe.pkt_len_or_gro_seg_len; if ((unsigned int )len != pkt_size) { goto test_loopback_rx_exit; } else { } rx_buf = fp_rx->rx_buf_ring + ((unsigned long )fp_rx->rx_bd_cons & 4095UL); dma_sync_single_for_cpu___0(& (bp->pdev)->dev, rx_buf->mapping, (size_t )fp_rx->rx_buf_size, 2); _max1 = 32; _max2 = 64; data = rx_buf->data + ((unsigned long )(_max1 > _max2 ? _max1 : _max2) + (unsigned long )cqe->fast_path_cqe.placement_offset); i = 14U; goto ldv_45945; ldv_45944: ; if ((int )*(data + (unsigned long )i) != (int )((unsigned char )i)) { goto test_loopback_rx_exit; } else { } i = i + 1U; ldv_45945: ; if (i < pkt_size) { goto ldv_45944; } else { } rc = 0; test_loopback_rx_exit: fp_rx->rx_bd_cons = ((unsigned long )fp_rx->rx_bd_cons & 511UL) == 509UL ? (unsigned int )fp_rx->rx_bd_cons + 3U : (unsigned int )fp_rx->rx_bd_cons + 1U; fp_rx->rx_bd_prod = ((unsigned long )fp_rx->rx_bd_prod & 511UL) == 509UL ? (unsigned int )fp_rx->rx_bd_prod + 3U : (unsigned int )fp_rx->rx_bd_prod + 1U; fp_rx->rx_comp_cons = ((unsigned long )fp_rx->rx_comp_cons & 63UL) == 62UL ? (unsigned int )fp_rx->rx_comp_cons + 2U : (unsigned int )fp_rx->rx_comp_cons + 1U; fp_rx->rx_comp_prod = ((unsigned long )fp_rx->rx_comp_prod & 63UL) == 62UL ? (unsigned int )fp_rx->rx_comp_prod + 2U : (unsigned int )fp_rx->rx_comp_prod + 1U; bnx2x_update_rx_prod___0(bp, fp_rx, (int )fp_rx->rx_bd_prod, (int )fp_rx->rx_comp_prod, (int )fp_rx->rx_sge_prod); test_loopback_exit: bp->link_params.loopback_mode = 0U; return (rc); } } static int bnx2x_test_loopback(struct bnx2x *bp ) { int rc ; int res ; bool tmp ; int tmp___0 ; long tmp___1 ; long tmp___2 ; { rc = 0; if ((bp->flags & 512U) != 0U) { return (rc); } else { } tmp = netif_running((struct net_device const *)bp->dev); if (tmp) { tmp___0 = 0; } else { tmp___0 = 1; } if (tmp___0) { return (3); } else { } bnx2x_netif_stop(bp, 1); bnx2x_acquire_phy_lock(bp); res = bnx2x_run_loopback(bp, 0); if (res != 0) { tmp___1 = ldv__builtin_expect((bp->msg_enable & 67108864) != 0, 0L); if (tmp___1 != 0L) { printk("\rbnx2x: [%s:%d(%s)] PHY loopback failed (res %d)\n", "bnx2x_test_loopback", 2625, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", res); } else { } rc = rc | 1; } else { } res = bnx2x_run_loopback(bp, 1); if (res != 0) { tmp___2 = ldv__builtin_expect((bp->msg_enable & 67108864) != 0, 0L); if (tmp___2 != 0L) { printk("\rbnx2x: [%s:%d(%s)] MAC loopback failed (res %d)\n", "bnx2x_test_loopback", 2631, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", res); } else { } rc = rc | 2; } else { } bnx2x_release_phy_lock(bp); bnx2x_netif_start(bp); return (rc); } } static int bnx2x_test_ext_loopback(struct bnx2x *bp ) { int rc ; u8 is_serdes ; bool tmp ; int tmp___0 ; long tmp___1 ; long tmp___2 ; { is_serdes = (bp->link_vars.link_status & 1048576U) != 0U; if ((bp->flags & 512U) != 0U) { return (-19); } else { } tmp = netif_running((struct net_device const *)bp->dev); if (tmp) { tmp___0 = 0; } else { tmp___0 = 1; } if (tmp___0) { return (3); } else { } bnx2x_nic_unload(bp, 0, 0); rc = bnx2x_nic_load(bp, 3); if (rc != 0) { tmp___1 = ldv__builtin_expect((bp->msg_enable & 67108864) != 0, 0L); if (tmp___1 != 0L) { printk("\rbnx2x: [%s:%d(%s)]Can\'t perform self-test, nic_load (for external lb) failed\n", "bnx2x_test_ext_loopback", 2657, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } return (-19); } else { } bnx2x_wait_for_link(bp, 1, (int )is_serdes); bnx2x_netif_stop(bp, 1); rc = bnx2x_run_loopback(bp, 2); if (rc != 0) { tmp___2 = ldv__builtin_expect((bp->msg_enable & 67108864) != 0, 0L); if (tmp___2 != 0L) { printk("\rbnx2x: [%s:%d(%s)]EXT loopback failed (res %d)\n", "bnx2x_test_ext_loopback", 2666, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", rc); } else { } } else { } bnx2x_netif_start(bp); return (rc); } } static int bnx2x_nvram_crc(struct bnx2x *bp , int offset , int size , u8 *buff ) { u32 crc ; int rc ; int done ; long tmp ; int count ; int __min1 ; int __min2 ; { crc = 4294967295U; rc = 0; done = 0; tmp = ldv__builtin_expect((bp->msg_enable & 67371008) != 0, 0L); if (tmp != 0L) { printk("\rbnx2x: [%s:%d(%s)]NVRAM CRC from 0x%08x to 0x%08x\n", "bnx2x_nvram_crc", 2704, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", offset, offset + size); } else { } goto ldv_45978; ldv_45977: __min1 = size - done; __min2 = 256; count = __min1 < __min2 ? __min1 : __min2; rc = bnx2x_nvram_read(bp, (u32 )(offset + done), buff, count); if (rc != 0) { return (rc); } else { } crc = crc32_le(crc, (unsigned char const *)buff, (size_t )count); done = done + count; ldv_45978: ; if (done < size) { goto ldv_45977; } else { } if (crc != 3736805603U) { rc = -22; } else { } return (rc); } } static int bnx2x_test_nvram_dir(struct bnx2x *bp , struct code_entry *entry , u8 *buff ) { size_t size ; u32 type ; int rc ; long tmp ; { size = (size_t )entry->code_attribute & 8388604UL; type = entry->code_attribute & 4034920451U; if (size == 0UL || type == 3489660931U) { return (0); } else { } rc = bnx2x_nvram_crc(bp, (int )entry->nvm_start_addr, (int )size, buff); if (rc != 0) { tmp = ldv__builtin_expect((bp->msg_enable & 67371008) != 0, 0L); if (tmp != 0L) { printk("\rbnx2x: [%s:%d(%s)]image %x has failed crc test (rc %d)\n", "bnx2x_test_nvram_dir", 2739, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", type, rc); } else { } } else { } return (rc); } } static int bnx2x_test_dir_entry(struct bnx2x *bp , u32 addr , u8 *buff ) { int rc ; struct code_entry entry ; int tmp ; { rc = bnx2x_nvram_read32(bp, addr, (u32 *)(& entry), 12); if (rc != 0) { return (rc); } else { } tmp = bnx2x_test_nvram_dir(bp, & entry, buff); return (tmp); } } static int bnx2x_test_nvram_ext_dirs(struct bnx2x *bp , u8 *buff ) { u32 rc ; u32 cnt ; u32 dir_offset ; struct code_entry entry ; int i ; int tmp ; int tmp___0 ; int tmp___1 ; { dir_offset = 20U; tmp = bnx2x_nvram_read32(bp, dir_offset + 180U, (u32 *)(& entry), 12); rc = (u32 )tmp; if (rc != 0U) { return ((int )rc); } else { } if ((entry.code_attribute & 4034920451U) != 3758096384U || (entry.code_attribute & 8388604U) == 0U) { return (0); } else { } tmp___0 = bnx2x_nvram_read32(bp, entry.nvm_start_addr, & cnt, 4); rc = (u32 )tmp___0; if (rc != 0U) { return ((int )rc); } else { } dir_offset = entry.nvm_start_addr + 8U; i = 0; goto ldv_46006; ldv_46005: tmp___1 = bnx2x_test_dir_entry(bp, (u32 )((unsigned long )i) * 12U + dir_offset, buff); rc = (u32 )tmp___1; if (rc != 0U) { return ((int )rc); } else { } i = i + 1; ldv_46006: ; if ((u32 )i < cnt && i <= 63) { goto ldv_46005; } else { } return (0); } } static int bnx2x_test_nvram_dirs(struct bnx2x *bp , u8 *buff ) { u32 rc ; u32 dir_offset ; int i ; long tmp ; int tmp___0 ; int tmp___1 ; { dir_offset = 20U; tmp = ldv__builtin_expect((bp->msg_enable & 67371008) != 0, 0L); if (tmp != 0L) { printk("\rbnx2x: [%s:%d(%s)]NVRAM DIRS CRC test-set\n", "bnx2x_test_nvram_dirs", 2795, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } i = 0; goto ldv_46017; ldv_46016: tmp___0 = bnx2x_test_dir_entry(bp, (u32 )((unsigned long )i) * 12U + dir_offset, buff); rc = (u32 )tmp___0; if (rc != 0U) { return ((int )rc); } else { } i = i + 1; ldv_46017: ; if (i <= 14) { goto ldv_46016; } else { } tmp___1 = bnx2x_test_nvram_ext_dirs(bp, buff); return (tmp___1); } } static int bnx2x_test_nvram_tbl(struct bnx2x *bp , struct crc_pair const *nvram_tbl , u8 *buf ) { int i ; int rc ; int tmp ; long tmp___0 ; { i = 0; goto ldv_46031; ldv_46030: tmp = bnx2x_nvram_crc(bp, (nvram_tbl + (unsigned long )i)->offset, (nvram_tbl + (unsigned long )i)->size, buf); rc = tmp; if (rc != 0) { tmp___0 = ldv__builtin_expect((bp->msg_enable & 67371008) != 0, 0L); if (tmp___0 != 0L) { printk("\rbnx2x: [%s:%d(%s)]nvram_tbl[%d] has failed crc test (rc %d)\n", "bnx2x_test_nvram_tbl", 2824, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", i, rc); } else { } return (rc); } else { } i = i + 1; ldv_46031: ; if ((int )(nvram_tbl + (unsigned long )i)->size != 0) { goto ldv_46030; } else { } return (0); } } static int bnx2x_test_nvram(struct bnx2x *bp ) { struct crc_pair nvram_tbl[7U] ; struct crc_pair nvram_tbl2[3U] ; u8 *buf ; int rc ; u32 magic ; void *tmp ; long tmp___0 ; long tmp___1 ; long tmp___2 ; long tmp___3 ; u32 hide ; unsigned int tmp___4 ; long tmp___5 ; { nvram_tbl[0].offset = 0; nvram_tbl[0].size = 20; nvram_tbl[1].offset = 20; nvram_tbl[1].size = 236; nvram_tbl[2].offset = 256; nvram_tbl[2].size = 848; nvram_tbl[3].offset = 1104; nvram_tbl[3].size = 240; nvram_tbl[4].offset = 1600; nvram_tbl[4].size = 100; nvram_tbl[5].offset = 1800; nvram_tbl[5].size = 112; nvram_tbl[6].offset = 0; nvram_tbl[6].size = 0; nvram_tbl2[0].offset = 2024; nvram_tbl2[0].size = 848; nvram_tbl2[1].offset = 2872; nvram_tbl2[1].size = 240; nvram_tbl2[2].offset = 0; nvram_tbl2[2].size = 0; if ((bp->flags & 512U) != 0U) { return (0); } else { } tmp = kmalloc(256UL, 208U); buf = (u8 *)tmp; if ((unsigned long )buf == (unsigned long )((u8 *)0)) { tmp___0 = ldv__builtin_expect((bp->msg_enable & 67371008) != 0, 0L); if (tmp___0 != 0L) { printk("\rbnx2x: [%s:%d(%s)]kmalloc failed\n", "bnx2x_test_nvram", 2858, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } rc = -12; goto test_nvram_exit; } else { } rc = bnx2x_nvram_read32(bp, 0U, & magic, 4); if (rc != 0) { tmp___1 = ldv__builtin_expect((bp->msg_enable & 67371008) != 0, 0L); if (tmp___1 != 0L) { printk("\rbnx2x: [%s:%d(%s)]magic value read (rc %d)\n", "bnx2x_test_nvram", 2866, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", rc); } else { } goto test_nvram_exit; } else { } if (magic != 1721324970U) { tmp___2 = ldv__builtin_expect((bp->msg_enable & 67371008) != 0, 0L); if (tmp___2 != 0L) { printk("\rbnx2x: [%s:%d(%s)]wrong magic value (0x%08x)\n", "bnx2x_test_nvram", 2872, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", magic); } else { } rc = -19; goto test_nvram_exit; } else { } tmp___3 = ldv__builtin_expect((bp->msg_enable & 67371008) != 0, 0L); if (tmp___3 != 0L) { printk("\rbnx2x: [%s:%d(%s)]Port 0 CRC test-set\n", "bnx2x_test_nvram", 2877, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } rc = bnx2x_test_nvram_tbl(bp, (struct crc_pair const *)(& nvram_tbl), buf); if (rc != 0) { goto test_nvram_exit; } else { } if ((bp->common.chip_id >> 16 != 5710U && (bp->common.chip_id >> 16 != 5711U && bp->common.chip_id >> 16 != 5712U)) && ((bp->common.chip_id >> 16 != 5693U && bp->common.chip_id >> 16 != 5694U) && bp->common.chip_id >> 16 != 5695U)) { tmp___4 = readl((void const volatile *)(bp->regview + ((unsigned long )bp->common.shmem_base + 32UL))); hide = tmp___4 & 8192U; if (hide == 0U) { tmp___5 = ldv__builtin_expect((bp->msg_enable & 67371008) != 0, 0L); if (tmp___5 != 0L) { printk("\rbnx2x: [%s:%d(%s)]Port 1 CRC test-set\n", "bnx2x_test_nvram", 2888, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } rc = bnx2x_test_nvram_tbl(bp, (struct crc_pair const *)(& nvram_tbl2), buf); if (rc != 0) { goto test_nvram_exit; } else { } } else { } } else { } rc = bnx2x_test_nvram_dirs(bp, buf); test_nvram_exit: kfree((void const *)buf); return (rc); } } static int bnx2x_test_intr(struct bnx2x *bp ) { struct bnx2x_queue_state_params params ; long tmp ; bool tmp___0 ; int tmp___1 ; int tmp___2 ; { params.q_obj = 0; params.cmd = 0; params.ramrod_flags = 0UL; params.params.setup.gen_params.stat_id = (unsigned char)0; params.params.setup.gen_params.spcl_id = (unsigned char)0; params.params.setup.gen_params.mtu = (unsigned short)0; params.params.setup.gen_params.cos = (unsigned char)0; params.params.setup.txq_params.dscr_map = 0ULL; params.params.setup.txq_params.fw_sb_id = (unsigned char)0; params.params.setup.txq_params.sb_cq_index = (unsigned char)0; params.params.setup.txq_params.cos = (unsigned char)0; params.params.setup.txq_params.traffic_type = (unsigned short)0; params.params.setup.txq_params.tss_leading_cl_id = (unsigned char)0; params.params.setup.txq_params.default_vlan = (unsigned short)0; params.params.setup.rxq_params.dscr_map = 0ULL; params.params.setup.rxq_params.sge_map = 0ULL; params.params.setup.rxq_params.rcq_map = 0ULL; params.params.setup.rxq_params.rcq_np_map = 0ULL; params.params.setup.rxq_params.drop_flags = (unsigned short)0; params.params.setup.rxq_params.buf_sz = (unsigned short)0; params.params.setup.rxq_params.fw_sb_id = (unsigned char)0; params.params.setup.rxq_params.cl_qzone_id = (unsigned char)0; params.params.setup.rxq_params.tpa_agg_sz = (unsigned short)0; params.params.setup.rxq_params.sge_buf_sz = (unsigned short)0; params.params.setup.rxq_params.max_sges_pkt = (unsigned char)0; params.params.setup.rxq_params.max_tpa_queues = (unsigned char)0; params.params.setup.rxq_params.rss_engine_id = (unsigned char)0; params.params.setup.rxq_params.mcast_engine_id = (unsigned char)0; params.params.setup.rxq_params.cache_line_log = (unsigned char)0; params.params.setup.rxq_params.sb_cq_index = (unsigned char)0; params.params.setup.rxq_params.silent_removal_value = (unsigned short)0; params.params.setup.rxq_params.silent_removal_mask = (unsigned short)0; params.params.setup.pause_params.bd_th_lo = (unsigned short)0; params.params.setup.pause_params.bd_th_hi = (unsigned short)0; params.params.setup.pause_params.rcq_th_lo = (unsigned short)0; params.params.setup.pause_params.rcq_th_hi = (unsigned short)0; params.params.setup.pause_params.sge_th_lo = (unsigned short)0; params.params.setup.pause_params.sge_th_hi = (unsigned short)0; params.params.setup.pause_params.pri_map = (unsigned short)0; params.params.setup.flags = 0UL; tmp___0 = netif_running((struct net_device const *)bp->dev); if (tmp___0) { tmp___1 = 0; } else { tmp___1 = 1; } if (tmp___1) { tmp = ldv__builtin_expect((bp->msg_enable & 67371008) != 0, 0L); if (tmp != 0L) { printk("\rbnx2x: [%s:%d(%s)]cannot access eeprom when the interface is down\n", "bnx2x_test_intr", 2909, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } return (-19); } else { } params.q_obj = & (bp->sp_objs)->q_obj; params.cmd = 10; __set_bit(2, (unsigned long volatile *)(& params.ramrod_flags)); tmp___2 = bnx2x_queue_state_change(bp, & params); return (tmp___2); } } static void bnx2x_self_test(struct net_device *dev , struct ethtool_test *etest , u64 *buf ) { struct bnx2x *bp ; void *tmp ; u8 is_serdes ; u8 link_up ; int rc ; int cnt ; long tmp___0 ; long tmp___1 ; bool tmp___2 ; int tmp___3 ; int port ; u32 val ; long tmp___4 ; int tmp___5 ; int tmp___6 ; int tmp___7 ; int tmp___8 ; long tmp___9 ; int tmp___10 ; int tmp___11 ; u8 tmp___12 ; { tmp = netdev_priv((struct net_device const *)dev); bp = (struct bnx2x *)tmp; cnt = 0; if ((unsigned int )bp->recovery_state != 0U) { netdev_err((struct net_device const *)bp->dev, "Handling parity error recovery. Try again later\n"); etest->flags = etest->flags | 2U; return; } else { } tmp___0 = ldv__builtin_expect((bp->msg_enable & 67108864) != 0, 0L); if (tmp___0 != 0L) { printk("\rbnx2x: [%s:%d(%s)]Self-test command parameters: offline = %d, external_lb = %d\n", "bnx2x_self_test", 2938, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", etest->flags & 1U, (etest->flags & 4U) >> 2); } else { } memset((void *)buf, 0, (unsigned int )bp->mf_mode != 0U ? 24UL : 56UL); tmp___2 = netif_running((struct net_device const *)dev); if (tmp___2) { tmp___3 = 0; } else { tmp___3 = 1; } if (tmp___3) { tmp___1 = ldv__builtin_expect((bp->msg_enable & 67108864) != 0, 0L); if (tmp___1 != 0L) { printk("\rbnx2x: [%s:%d(%s)]Can\'t perform self-test when interface is down\n", "bnx2x_self_test", 2944, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } return; } else { } is_serdes = (bp->link_vars.link_status & 1048576U) != 0U; link_up = bp->link_vars.link_up; if ((int )etest->flags & 1 && (unsigned int )bp->mf_mode == 0U) { port = (int )bp->pfid & 1; val = readl((void const volatile *)bp->regview + (unsigned long )((port + 16437) * 4)); writel(0U, (void volatile *)bp->regview + (unsigned long )((port + 16437) * 4)); bnx2x_nic_unload(bp, 0, 0); rc = bnx2x_nic_load(bp, 2); if (rc != 0) { etest->flags = etest->flags | 2U; tmp___4 = ldv__builtin_expect((bp->msg_enable & 67108864) != 0, 0L); if (tmp___4 != 0L) { printk("\rbnx2x: [%s:%d(%s)]Can\'t perform self-test, nic_load (for offline) failed\n", "bnx2x_self_test", 2965, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } return; } else { } bnx2x_wait_for_link(bp, 1, (int )is_serdes); tmp___5 = bnx2x_test_registers(bp); if (tmp___5 != 0) { *buf = 1ULL; etest->flags = etest->flags | 2U; } else { } tmp___6 = bnx2x_test_memory(bp); if (tmp___6 != 0) { *(buf + 1UL) = 1ULL; etest->flags = etest->flags | 2U; } else { } tmp___7 = bnx2x_test_loopback(bp); *(buf + 2UL) = (u64 )tmp___7; if (*(buf + 2UL) != 0ULL) { etest->flags = etest->flags | 2U; } else { } if ((etest->flags & 4U) != 0U) { tmp___8 = bnx2x_test_ext_loopback(bp); *(buf + 3UL) = (u64 )tmp___8; if (*(buf + 3UL) != 0ULL) { etest->flags = etest->flags | 2U; } else { } etest->flags = etest->flags | 8U; } else { } bnx2x_nic_unload(bp, 0, 0); writel(val, (void volatile *)bp->regview + (unsigned long )((port + 16437) * 4)); rc = bnx2x_nic_load(bp, 0); if (rc != 0) { etest->flags = etest->flags | 2U; tmp___9 = ldv__builtin_expect((bp->msg_enable & 67108864) != 0, 0L); if (tmp___9 != 0L) { printk("\rbnx2x: [%s:%d(%s)]Can\'t perform self-test, nic_load (for online) failed\n", "bnx2x_self_test", 3000, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } return; } else { } bnx2x_wait_for_link(bp, (int )link_up, (int )is_serdes); } else { } tmp___10 = bnx2x_test_nvram(bp); if (tmp___10 != 0) { if ((unsigned int )bp->mf_mode == 0U) { *(buf + 4UL) = 1ULL; } else { *buf = 1ULL; } etest->flags = etest->flags | 2U; } else { } tmp___11 = bnx2x_test_intr(bp); if (tmp___11 != 0) { if ((unsigned int )bp->mf_mode == 0U) { *(buf + 5UL) = 1ULL; } else { *(buf + 1UL) = 1ULL; } etest->flags = etest->flags | 2U; } else { } if ((unsigned int )link_up != 0U) { cnt = 100; goto ldv_46063; ldv_46062: msleep(20U); ldv_46063: tmp___12 = bnx2x_link_test(bp, (int )is_serdes); if ((unsigned int )tmp___12 != 0U) { cnt = cnt - 1; if (cnt != 0) { goto ldv_46062; } else { goto ldv_46064; } } else { } ldv_46064: ; } else { } if (cnt == 0) { if ((unsigned int )bp->mf_mode == 0U) { *(buf + 6UL) = 1ULL; } else { *(buf + 2UL) = 1ULL; } etest->flags = etest->flags | 2U; } else { } return; } } static int bnx2x_num_stat_queues(struct bnx2x *bp ) { { return ((int )bp->num_ethernet_queues); } } static int bnx2x_get_sset_count(struct net_device *dev , int stringset ) { struct bnx2x *bp ; void *tmp ; int i ; int num_stats ; int tmp___0 ; { tmp = netdev_priv((struct net_device const *)dev); bp = (struct bnx2x *)tmp; switch (stringset) { case 1: ; if (bp->num_queues > 1) { tmp___0 = bnx2x_num_stat_queues(bp); num_stats = (int )((unsigned int )tmp___0 * 16U); } else { num_stats = 0; } if ((unsigned int )bp->mf_mode != 0U && (bp->msg_enable & 131072) == 0) { i = 0; goto ldv_46081; ldv_46080: ; if (((unsigned int )bnx2x_stats_arr[i].flags & 2U) != 0U) { num_stats = num_stats + 1; } else { } i = i + 1; ldv_46081: ; if ((unsigned int )i <= 51U) { goto ldv_46080; } else { } } else { num_stats = (int )((unsigned int )num_stats + 52U); } return (num_stats); case 0: ; return ((unsigned int )bp->mf_mode != 0U ? 3 : 7); default: ; return (-22); } } } static void bnx2x_get_strings(struct net_device *dev , u32 stringset , u8 *buf ) { struct bnx2x *bp ; void *tmp ; int i ; int j ; int k ; int start ; char queue_name[5U] ; size_t __len ; void *__ret ; { tmp = netdev_priv((struct net_device const *)dev); bp = (struct bnx2x *)tmp; switch (stringset) { case 1U: k = 0; if (bp->num_queues > 1) { i = 0; goto ldv_46107; ldv_46106: memset((void *)(& queue_name), 0, 5UL); sprintf((char *)(& queue_name), "%d", i); j = 0; goto ldv_46102; ldv_46101: snprintf((char *)buf + (unsigned long )((k + j) * 32), 32UL, (char const *)(& bnx2x_q_stats_arr[j].string), (char *)(& queue_name)); j = j + 1; ldv_46102: ; if ((unsigned int )j <= 15U) { goto ldv_46101; } else { } k = (int )((unsigned int )k + 16U); i = i + 1; ldv_46107: ; if ((uint )i < bp->num_ethernet_queues) { goto ldv_46106; } else { } } else { } i = 0; j = 0; goto ldv_46113; ldv_46112: ; if (((unsigned int )bp->mf_mode != 0U && (bp->msg_enable & 131072) == 0) && ((unsigned int )bnx2x_stats_arr[i].flags & 3U) == 1U) { goto ldv_46111; } else { } strcpy((char *)buf + (unsigned long )((k + j) * 32), (char const *)(& bnx2x_stats_arr[i].string)); j = j + 1; ldv_46111: i = i + 1; ldv_46113: ; if ((unsigned int )i <= 51U) { goto ldv_46112; } else { } goto ldv_46115; case 0U: ; if ((unsigned int )bp->mf_mode == 0U) { start = 0; } else { start = 4; } __len = (unsigned int )bp->mf_mode != 0U ? 96UL : 224UL; __ret = __builtin_memcpy((void *)buf, (void const *)(& bnx2x_tests_str_arr) + (unsigned long )start, __len); } ldv_46115: ; return; } } static void bnx2x_get_ethtool_stats(struct net_device *dev , struct ethtool_stats *stats , u64 *buf ) { struct bnx2x *bp ; void *tmp ; u32 *hw_stats ; u32 *offset ; int i ; int j ; int k ; { tmp = netdev_priv((struct net_device const *)dev); bp = (struct bnx2x *)tmp; k = 0; if (bp->num_queues > 1) { i = 0; goto ldv_46140; ldv_46139: hw_stats = (u32 *)(& (bp->fp_stats + (unsigned long )i)->eth_q_stats); j = 0; goto ldv_46135; ldv_46134: ; if ((int )bnx2x_q_stats_arr[j].size == 0) { *(buf + (unsigned long )(k + j)) = 0ULL; goto ldv_46133; } else { } offset = hw_stats + (unsigned long )bnx2x_q_stats_arr[j].offset; if ((int )bnx2x_q_stats_arr[j].size == 4) { *(buf + (unsigned long )(k + j)) = (unsigned long long )*offset; goto ldv_46133; } else { } *(buf + (unsigned long )(k + j)) = ((unsigned long long )*offset << 32) + (unsigned long long )*(offset + 1UL); ldv_46133: j = j + 1; ldv_46135: ; if ((unsigned int )j <= 15U) { goto ldv_46134; } else { } k = (int )((unsigned int )k + 16U); i = i + 1; ldv_46140: ; if ((uint )i < bp->num_ethernet_queues) { goto ldv_46139; } else { } } else { } hw_stats = (u32 *)(& bp->eth_stats); i = 0; j = 0; goto ldv_46146; ldv_46145: ; if (((unsigned int )bp->mf_mode != 0U && (bp->msg_enable & 131072) == 0) && ((unsigned int )bnx2x_stats_arr[i].flags & 3U) == 1U) { goto ldv_46144; } else { } if ((int )bnx2x_stats_arr[i].size == 0) { *(buf + (unsigned long )(k + j)) = 0ULL; j = j + 1; goto ldv_46144; } else { } offset = hw_stats + (unsigned long )bnx2x_stats_arr[i].offset; if ((int )bnx2x_stats_arr[i].size == 4) { *(buf + (unsigned long )(k + j)) = (unsigned long long )*offset; j = j + 1; goto ldv_46144; } else { } *(buf + (unsigned long )(k + j)) = ((unsigned long long )*offset << 32) + (unsigned long long )*(offset + 1UL); j = j + 1; ldv_46144: i = i + 1; ldv_46146: ; if ((unsigned int )i <= 51U) { goto ldv_46145; } else { } return; } } static int bnx2x_set_phys_id(struct net_device *dev , enum ethtool_phys_id_state state ) { struct bnx2x *bp ; void *tmp ; long tmp___0 ; bool tmp___1 ; int tmp___2 ; long tmp___3 ; { tmp = netdev_priv((struct net_device const *)dev); bp = (struct bnx2x *)tmp; tmp___1 = netif_running((struct net_device const *)dev); if (tmp___1) { tmp___2 = 0; } else { tmp___2 = 1; } if (tmp___2) { tmp___0 = ldv__builtin_expect((bp->msg_enable & 67371008) != 0, 0L); if (tmp___0 != 0L) { printk("\rbnx2x: [%s:%d(%s)]cannot access eeprom when the interface is down\n", "bnx2x_set_phys_id", 3183, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } return (-11); } else { } if (bp->port.pmf == 0U) { tmp___3 = ldv__builtin_expect((bp->msg_enable & 67108864) != 0, 0L); if (tmp___3 != 0L) { printk("\rbnx2x: [%s:%d(%s)]Interface is not pmf\n", "bnx2x_set_phys_id", 3188, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } return (-95); } else { } switch ((unsigned int )state) { case 1U: ; return (1); case 2U: bnx2x_acquire_phy_lock(bp); bnx2x_set_led(& bp->link_params, & bp->link_vars, 1, 1000U); bnx2x_release_phy_lock(bp); goto ldv_46156; case 3U: bnx2x_acquire_phy_lock(bp); bnx2x_set_led(& bp->link_params, & bp->link_vars, 3, 0U); bnx2x_release_phy_lock(bp); goto ldv_46156; case 0U: bnx2x_acquire_phy_lock(bp); bnx2x_set_led(& bp->link_params, & bp->link_vars, 2, (u32 )bp->link_vars.line_speed); bnx2x_release_phy_lock(bp); } ldv_46156: ; return (0); } } static int bnx2x_get_rss_flags(struct bnx2x *bp , struct ethtool_rxnfc *info ) { { switch (info->flow_type) { case 1U: ; case 5U: info->data = 240ULL; goto ldv_46165; case 2U: ; if ((unsigned int )bp->rss_conf_obj.udp_rss_v4 != 0U) { info->data = 240ULL; } else { info->data = 48ULL; } goto ldv_46165; case 6U: ; if ((unsigned int )bp->rss_conf_obj.udp_rss_v6 != 0U) { info->data = 240ULL; } else { info->data = 48ULL; } goto ldv_46165; case 16U: ; case 17U: info->data = 48ULL; goto ldv_46165; default: info->data = 0ULL; goto ldv_46165; } ldv_46165: ; return (0); } } static int bnx2x_get_rxnfc(struct net_device *dev , struct ethtool_rxnfc *info , u32 *rules ) { struct bnx2x *bp ; void *tmp ; int tmp___0 ; long tmp___1 ; { tmp = netdev_priv((struct net_device const *)dev); bp = (struct bnx2x *)tmp; switch (info->cmd) { case 45U: info->data = (__u64 )bp->num_ethernet_queues; return (0); case 41U: tmp___0 = bnx2x_get_rss_flags(bp, info); return (tmp___0); default: tmp___1 = ldv__builtin_expect((bp->msg_enable & 67108864) != 0, 0L); if (tmp___1 != 0L) { printk("\rbnx2x: [%s:%d(%s)]Command parameters not supported\n", "bnx2x_get_rxnfc", 3268, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } return (-95); } } } static int bnx2x_set_rss_flags(struct bnx2x *bp , struct ethtool_rxnfc *info ) { int udp_rss_requested ; long tmp ; long tmp___0 ; long tmp___1 ; int tmp___2 ; long tmp___3 ; int tmp___4 ; long tmp___5 ; long tmp___6 ; { tmp = ldv__builtin_expect((bp->msg_enable & 67108864) != 0, 0L); if (tmp != 0L) { printk("\rbnx2x: [%s:%d(%s)]Set rss flags command parameters: flow type = %d, data = %llu\n", "bnx2x_set_rss_flags", 3279, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", info->flow_type, info->data); } else { } switch (info->flow_type) { case 1U: ; case 5U: ; if (info->data != 240ULL) { tmp___0 = ldv__builtin_expect((bp->msg_enable & 67108864) != 0, 0L); if (tmp___0 != 0L) { printk("\rbnx2x: [%s:%d(%s)]Command parameters not supported\n", "bnx2x_set_rss_flags", 3288, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } return (-22); } else { } return (0); case 2U: ; case 6U: ; if (info->data == 240ULL) { udp_rss_requested = 1; } else if (info->data == 48ULL) { udp_rss_requested = 0; } else { return (-22); } if (info->flow_type == 2U && (int )bp->rss_conf_obj.udp_rss_v4 != udp_rss_requested) { bp->rss_conf_obj.udp_rss_v4 = (u8 )udp_rss_requested; tmp___1 = ldv__builtin_expect((bp->msg_enable & 67108864) != 0, 0L); if (tmp___1 != 0L) { printk("\rbnx2x: [%s:%d(%s)]rss re-configured, UDP 4-tupple %s\n", "bnx2x_set_rss_flags", 3308, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", udp_rss_requested != 0 ? (char *)"enabled" : (char *)"disabled"); } else { } tmp___2 = bnx2x_config_rss_pf(bp, & bp->rss_conf_obj, 0); return (tmp___2); } else if (info->flow_type == 6U && (int )bp->rss_conf_obj.udp_rss_v6 != udp_rss_requested) { bp->rss_conf_obj.udp_rss_v6 = (u8 )udp_rss_requested; tmp___3 = ldv__builtin_expect((bp->msg_enable & 67108864) != 0, 0L); if (tmp___3 != 0L) { printk("\rbnx2x: [%s:%d(%s)]rss re-configured, UDP 4-tupple %s\n", "bnx2x_set_rss_flags", 3315, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", udp_rss_requested != 0 ? (char *)"enabled" : (char *)"disabled"); } else { } tmp___4 = bnx2x_config_rss_pf(bp, & bp->rss_conf_obj, 0); return (tmp___4); } else { } return (0); case 16U: ; case 17U: ; if (info->data != 48ULL) { tmp___5 = ldv__builtin_expect((bp->msg_enable & 67108864) != 0, 0L); if (tmp___5 != 0L) { printk("\rbnx2x: [%s:%d(%s)]Command parameters not supported\n", "bnx2x_set_rss_flags", 3325, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } return (-22); } else { } return (0); case 3U: ; case 4U: ; case 9U: ; case 10U: ; case 7U: ; case 8U: ; case 11U: ; case 12U: ; case 13U: ; case 18U: ; if (info->data != 0ULL) { tmp___6 = ldv__builtin_expect((bp->msg_enable & 67108864) != 0, 0L); if (tmp___6 != 0L) { printk("\rbnx2x: [%s:%d(%s)]Command parameters not supported\n", "bnx2x_set_rss_flags", 3343, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } return (-22); } else { } return (0); default: ; return (-22); } } } static int bnx2x_set_rxnfc(struct net_device *dev , struct ethtool_rxnfc *info ) { struct bnx2x *bp ; void *tmp ; int tmp___0 ; long tmp___1 ; { tmp = netdev_priv((struct net_device const *)dev); bp = (struct bnx2x *)tmp; switch (info->cmd) { case 42U: tmp___0 = bnx2x_set_rss_flags(bp, info); return (tmp___0); default: tmp___1 = ldv__builtin_expect((bp->msg_enable & 67108864) != 0, 0L); if (tmp___1 != 0L) { printk("\rbnx2x: [%s:%d(%s)]Command parameters not supported\n", "bnx2x_set_rxnfc", 3361, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } return (-95); } } } static u32 bnx2x_get_rxfh_indir_size(struct net_device *dev ) { { return (128U); } } static int bnx2x_get_rxfh_indir(struct net_device *dev , u32 *indir ) { struct bnx2x *bp ; void *tmp ; u8 ind_table[128U] ; unsigned int tmp___0 ; size_t i ; { tmp = netdev_priv((struct net_device const *)dev); bp = (struct bnx2x *)tmp; ind_table[0] = 0U; tmp___0 = 1U; while (1) { if (tmp___0 >= 128U) { break; } else { } ind_table[tmp___0] = (unsigned char)0; tmp___0 = tmp___0 + 1U; } bnx2x_get_rss_ind_table(& bp->rss_conf_obj, (u8 *)(& ind_table)); i = 0UL; goto ldv_46223; ldv_46222: *(indir + i) = (u32 )((int )ind_table[i] - (int )(bp->fp)->cl_id); i = i + 1UL; ldv_46223: ; if (i <= 127UL) { goto ldv_46222; } else { } return (0); } } static int bnx2x_set_rxfh_indir(struct net_device *dev , u32 const *indir ) { struct bnx2x *bp ; void *tmp ; size_t i ; int tmp___0 ; { tmp = netdev_priv((struct net_device const *)dev); bp = (struct bnx2x *)tmp; i = 0UL; goto ldv_46232; ldv_46231: bp->rss_conf_obj.ind_table[i] = (int )((u8 )*(indir + i)) + (int )(bp->fp)->cl_id; i = i + 1UL; ldv_46232: ; if (i <= 127UL) { goto ldv_46231; } else { } tmp___0 = bnx2x_config_rss_eth(bp, 0); return (tmp___0); } } static void bnx2x_get_channels(struct net_device *dev , struct ethtool_channels *channels ) { struct bnx2x *bp ; void *tmp ; { tmp = netdev_priv((struct net_device const *)dev); bp = (struct bnx2x *)tmp; channels->max_combined = (__u32 )((int )bp->igu_sb_cnt - (int )bp->cnic_support); channels->combined_count = bp->num_ethernet_queues; return; } } static void bnx2x_change_num_queues(struct bnx2x *bp , int num_rss ) { long tmp ; { bnx2x_disable_msi(bp); bp->num_ethernet_queues = (uint )num_rss; bp->num_queues = (int )(bp->num_ethernet_queues + bp->num_cnic_queues); tmp = ldv__builtin_expect((bp->msg_enable & 2) != 0, 0L); if (tmp != 0L) { _dev_info((struct device const *)(& (bp->pdev)->dev), "set number of queues to %d\n", bp->num_queues); } else { } bnx2x_set_int_mode(bp); return; } } static int bnx2x_set_channels(struct net_device *dev , struct ethtool_channels *channels ) { struct bnx2x *bp ; void *tmp ; long tmp___0 ; long tmp___1 ; long tmp___2 ; bool tmp___3 ; int tmp___4 ; long tmp___5 ; int tmp___6 ; { tmp = netdev_priv((struct net_device const *)dev); bp = (struct bnx2x *)tmp; tmp___0 = ldv__builtin_expect((bp->msg_enable & 67108864) != 0, 0L); if (tmp___0 != 0L) { printk("\rbnx2x: [%s:%d(%s)]set-channels command parameters: rx = %d, tx = %d, other = %d, combined = %d\n", "bnx2x_set_channels", 3463, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", channels->rx_count, channels->tx_count, channels->other_count, channels->combined_count); } else { } if ((((channels->rx_count != 0U || channels->tx_count != 0U) || channels->other_count != 0U) || channels->combined_count == 0U) || channels->combined_count > (__u32 )((int )bp->igu_sb_cnt - (int )bp->cnic_support)) { tmp___1 = ldv__builtin_expect((bp->msg_enable & 67108864) != 0, 0L); if (tmp___1 != 0L) { printk("\rbnx2x: [%s:%d(%s)]command parameters not supported\n", "bnx2x_set_channels", 3471, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } return (-22); } else { } if (channels->combined_count == bp->num_ethernet_queues) { tmp___2 = ldv__builtin_expect((bp->msg_enable & 67108864) != 0, 0L); if (tmp___2 != 0L) { printk("\rbnx2x: [%s:%d(%s)]No change in active parameters\n", "bnx2x_set_channels", 3477, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } return (0); } else { } tmp___3 = netif_running((struct net_device const *)dev); if (tmp___3) { tmp___4 = 0; } else { tmp___4 = 1; } tmp___5 = ldv__builtin_expect((long )tmp___4, 0L); if (tmp___5 != 0L) { bnx2x_change_num_queues(bp, (int )channels->combined_count); return (0); } else { } bnx2x_nic_unload(bp, 0, 1); bnx2x_change_num_queues(bp, (int )channels->combined_count); tmp___6 = bnx2x_nic_load(bp, 0); return (tmp___6); } } static struct ethtool_ops const bnx2x_ethtool_ops = {& bnx2x_get_settings, & bnx2x_set_settings, & bnx2x_get_drvinfo, & bnx2x_get_regs_len, & bnx2x_get_regs, & bnx2x_get_wol, & bnx2x_set_wol, & bnx2x_get_msglevel, & bnx2x_set_msglevel, & bnx2x_nway_reset, & bnx2x_get_link, & bnx2x_get_eeprom_len, & bnx2x_get_eeprom, & bnx2x_set_eeprom, & bnx2x_get_coalesce, & bnx2x_set_coalesce, & bnx2x_get_ringparam, & bnx2x_set_ringparam, & bnx2x_get_pauseparam, & bnx2x_set_pauseparam, & bnx2x_self_test, & bnx2x_get_strings, & bnx2x_set_phys_id, & bnx2x_get_ethtool_stats, 0, 0, 0, 0, & bnx2x_get_sset_count, & bnx2x_get_rxnfc, & bnx2x_set_rxnfc, 0, 0, & bnx2x_get_rxfh_indir_size, & bnx2x_get_rxfh_indir, & bnx2x_set_rxfh_indir, & bnx2x_get_channels, & bnx2x_set_channels, & bnx2x_get_dump_flag, & bnx2x_get_dump_data, & bnx2x_set_dump, & ethtool_op_get_ts_info, & bnx2x_get_module_info, & bnx2x_get_module_eeprom, & bnx2x_get_eee, & bnx2x_set_eee}; static struct ethtool_ops const bnx2x_vf_ethtool_ops = {& bnx2x_get_settings, & bnx2x_set_settings, & bnx2x_get_drvinfo, 0, 0, 0, 0, & bnx2x_get_msglevel, & bnx2x_set_msglevel, 0, & bnx2x_get_link, 0, 0, 0, & bnx2x_get_coalesce, 0, & bnx2x_get_ringparam, & bnx2x_set_ringparam, 0, 0, 0, & bnx2x_get_strings, 0, & bnx2x_get_ethtool_stats, 0, 0, 0, 0, & bnx2x_get_sset_count, & bnx2x_get_rxnfc, & bnx2x_set_rxnfc, 0, 0, & bnx2x_get_rxfh_indir_size, & bnx2x_get_rxfh_indir, & bnx2x_set_rxfh_indir, & bnx2x_get_channels, & bnx2x_set_channels, 0, 0, 0, 0, 0, 0, 0, 0}; void bnx2x_set_ethtool_ops(struct bnx2x *bp , struct net_device *netdev ) { { if ((bp->flags & 4194304U) == 0U) { netdev->ethtool_ops = & bnx2x_ethtool_ops; } else { netdev->ethtool_ops = & bnx2x_vf_ethtool_ops; } return; } } void ldv_main3_sequence_infinite_withcheck_stateful(void) { struct net_device *var_group1 ; struct ethtool_cmd *var_group2 ; struct ethtool_drvinfo *var_group3 ; struct ethtool_regs *var_group4 ; void *var_bnx2x_get_regs_17_p2 ; struct ethtool_dump *var_group5 ; void *var_bnx2x_get_dump_data_21_p2 ; struct ethtool_wolinfo *var_group6 ; u32 var_bnx2x_set_msglevel_26_p1 ; struct ethtool_eeprom *var_group7 ; u8 *var_bnx2x_get_eeprom_37_p2 ; u8 *var_bnx2x_set_eeprom_43_p2 ; struct ethtool_coalesce *var_group8 ; struct ethtool_ringparam *var_group9 ; struct ethtool_pauseparam *var_group10 ; struct ethtool_test *var_group11 ; u64 *var_bnx2x_self_test_68_p2 ; int var_bnx2x_get_sset_count_70_p1 ; u32 var_bnx2x_get_strings_71_p1 ; u8 *var_bnx2x_get_strings_71_p2 ; enum ethtool_phys_id_state var_bnx2x_set_phys_id_73_p1 ; struct ethtool_stats *var_group12 ; u64 *var_bnx2x_get_ethtool_stats_72_p2 ; struct ethtool_rxnfc *var_group13 ; u32 *var_bnx2x_get_rxnfc_75_p2 ; u32 *var_bnx2x_get_rxfh_indir_79_p1 ; u32 const *var_bnx2x_set_rxfh_indir_80_p1 ; struct ethtool_channels *var_group14 ; struct ethtool_modinfo *var_group15 ; u8 *var_bnx2x_get_module_eeprom_38_p2 ; struct ethtool_eee *var_group16 ; int tmp ; int tmp___0 ; { LDV_IN_INTERRUPT = 1; ldv_initialize(); goto ldv_46363; ldv_46362: tmp = __VERIFIER_nondet_int(); switch (tmp) { case 0: ldv_handler_precall(); bnx2x_get_settings(var_group1, var_group2); goto ldv_46303; case 1: ldv_handler_precall(); bnx2x_set_settings(var_group1, var_group2); goto ldv_46303; case 2: ldv_handler_precall(); bnx2x_get_drvinfo(var_group1, var_group3); goto ldv_46303; case 3: ldv_handler_precall(); bnx2x_get_regs_len(var_group1); goto ldv_46303; case 4: ldv_handler_precall(); bnx2x_get_regs(var_group1, var_group4, var_bnx2x_get_regs_17_p2); goto ldv_46303; case 5: ldv_handler_precall(); bnx2x_get_dump_flag(var_group1, var_group5); goto ldv_46303; case 6: ldv_handler_precall(); bnx2x_get_dump_data(var_group1, var_group5, var_bnx2x_get_dump_data_21_p2); goto ldv_46303; case 7: ldv_handler_precall(); bnx2x_set_dump(var_group1, var_group5); goto ldv_46303; case 8: ldv_handler_precall(); bnx2x_get_wol(var_group1, var_group6); goto ldv_46303; case 9: ldv_handler_precall(); bnx2x_set_wol(var_group1, var_group6); goto ldv_46303; case 10: ldv_handler_precall(); bnx2x_get_msglevel(var_group1); goto ldv_46303; case 11: ldv_handler_precall(); bnx2x_set_msglevel(var_group1, var_bnx2x_set_msglevel_26_p1); goto ldv_46303; case 12: ldv_handler_precall(); bnx2x_nway_reset(var_group1); goto ldv_46303; case 13: ldv_handler_precall(); bnx2x_get_link(var_group1); goto ldv_46303; case 14: ldv_handler_precall(); bnx2x_get_eeprom_len(var_group1); goto ldv_46303; case 15: ldv_handler_precall(); bnx2x_get_eeprom(var_group1, var_group7, var_bnx2x_get_eeprom_37_p2); goto ldv_46303; case 16: ldv_handler_precall(); bnx2x_set_eeprom(var_group1, var_group7, var_bnx2x_set_eeprom_43_p2); goto ldv_46303; case 17: ldv_handler_precall(); bnx2x_get_coalesce(var_group1, var_group8); goto ldv_46303; case 18: ldv_handler_precall(); bnx2x_set_coalesce(var_group1, var_group8); goto ldv_46303; case 19: ldv_handler_precall(); bnx2x_get_ringparam(var_group1, var_group9); goto ldv_46303; case 20: ldv_handler_precall(); bnx2x_set_ringparam(var_group1, var_group9); goto ldv_46303; case 21: ldv_handler_precall(); bnx2x_get_pauseparam(var_group1, var_group10); goto ldv_46303; case 22: ldv_handler_precall(); bnx2x_set_pauseparam(var_group1, var_group10); goto ldv_46303; case 23: ldv_handler_precall(); bnx2x_self_test(var_group1, var_group11, var_bnx2x_self_test_68_p2); goto ldv_46303; case 24: ldv_handler_precall(); bnx2x_get_sset_count(var_group1, var_bnx2x_get_sset_count_70_p1); goto ldv_46303; case 25: ldv_handler_precall(); bnx2x_get_strings(var_group1, var_bnx2x_get_strings_71_p1, var_bnx2x_get_strings_71_p2); goto ldv_46303; case 26: ldv_handler_precall(); bnx2x_set_phys_id(var_group1, var_bnx2x_set_phys_id_73_p1); goto ldv_46303; case 27: ldv_handler_precall(); bnx2x_get_ethtool_stats(var_group1, var_group12, var_bnx2x_get_ethtool_stats_72_p2); goto ldv_46303; case 28: ldv_handler_precall(); bnx2x_get_rxnfc(var_group1, var_group13, var_bnx2x_get_rxnfc_75_p2); goto ldv_46303; case 29: ldv_handler_precall(); bnx2x_set_rxnfc(var_group1, var_group13); goto ldv_46303; case 30: ldv_handler_precall(); bnx2x_get_rxfh_indir_size(var_group1); goto ldv_46303; case 31: ldv_handler_precall(); bnx2x_get_rxfh_indir(var_group1, var_bnx2x_get_rxfh_indir_79_p1); goto ldv_46303; case 32: ldv_handler_precall(); bnx2x_set_rxfh_indir(var_group1, var_bnx2x_set_rxfh_indir_80_p1); goto ldv_46303; case 33: ldv_handler_precall(); bnx2x_get_channels(var_group1, var_group14); goto ldv_46303; case 34: ldv_handler_precall(); bnx2x_set_channels(var_group1, var_group14); goto ldv_46303; case 35: ldv_handler_precall(); bnx2x_get_module_info(var_group1, var_group15); goto ldv_46303; case 36: ldv_handler_precall(); bnx2x_get_module_eeprom(var_group1, var_group7, var_bnx2x_get_module_eeprom_38_p2); goto ldv_46303; case 37: ldv_handler_precall(); bnx2x_get_eee(var_group1, var_group16); goto ldv_46303; case 38: ldv_handler_precall(); bnx2x_set_eee(var_group1, var_group16); goto ldv_46303; case 39: ldv_handler_precall(); bnx2x_get_settings(var_group1, var_group2); goto ldv_46303; case 40: ldv_handler_precall(); bnx2x_set_settings(var_group1, var_group2); goto ldv_46303; case 41: ldv_handler_precall(); bnx2x_get_drvinfo(var_group1, var_group3); goto ldv_46303; case 42: ldv_handler_precall(); bnx2x_get_msglevel(var_group1); goto ldv_46303; case 43: ldv_handler_precall(); bnx2x_set_msglevel(var_group1, var_bnx2x_set_msglevel_26_p1); goto ldv_46303; case 44: ldv_handler_precall(); bnx2x_get_link(var_group1); goto ldv_46303; case 45: ldv_handler_precall(); bnx2x_get_coalesce(var_group1, var_group8); goto ldv_46303; case 46: ldv_handler_precall(); bnx2x_get_ringparam(var_group1, var_group9); goto ldv_46303; case 47: ldv_handler_precall(); bnx2x_set_ringparam(var_group1, var_group9); goto ldv_46303; case 48: ldv_handler_precall(); bnx2x_get_sset_count(var_group1, var_bnx2x_get_sset_count_70_p1); goto ldv_46303; case 49: ldv_handler_precall(); bnx2x_get_strings(var_group1, var_bnx2x_get_strings_71_p1, var_bnx2x_get_strings_71_p2); goto ldv_46303; case 50: ldv_handler_precall(); bnx2x_get_ethtool_stats(var_group1, var_group12, var_bnx2x_get_ethtool_stats_72_p2); goto ldv_46303; case 51: ldv_handler_precall(); bnx2x_get_rxnfc(var_group1, var_group13, var_bnx2x_get_rxnfc_75_p2); goto ldv_46303; case 52: ldv_handler_precall(); bnx2x_set_rxnfc(var_group1, var_group13); goto ldv_46303; case 53: ldv_handler_precall(); bnx2x_get_rxfh_indir_size(var_group1); goto ldv_46303; case 54: ldv_handler_precall(); bnx2x_get_rxfh_indir(var_group1, var_bnx2x_get_rxfh_indir_79_p1); goto ldv_46303; case 55: ldv_handler_precall(); bnx2x_set_rxfh_indir(var_group1, var_bnx2x_set_rxfh_indir_80_p1); goto ldv_46303; case 56: ldv_handler_precall(); bnx2x_get_channels(var_group1, var_group14); goto ldv_46303; case 57: ldv_handler_precall(); bnx2x_set_channels(var_group1, var_group14); goto ldv_46303; default: ; goto ldv_46303; } ldv_46303: ; ldv_46363: tmp___0 = __VERIFIER_nondet_int(); if (tmp___0 != 0) { goto ldv_46362; } else { } ldv_check_final_state(); 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; } } extern int __dynamic_netdev_dbg(struct _ddebug * , struct net_device const * , char const * , ...) ; int ldv_mutex_trylock_84(struct mutex *ldv_func_arg1 ) ; void ldv_mutex_unlock_82(struct mutex *ldv_func_arg1 ) ; void ldv_mutex_unlock_85(struct mutex *ldv_func_arg1 ) ; void ldv_mutex_lock_81(struct mutex *ldv_func_arg1 ) ; void ldv_mutex_lock_83(struct mutex *ldv_func_arg1 ) ; static u32 const dmae_reg_go_c___0[16U] = { 1056896U, 1056900U, 1056928U, 1056932U, 1056936U, 1056940U, 1056944U, 1056948U, 1056952U, 1056956U, 1056904U, 1056908U, 1056912U, 1056916U, 1056920U, 1056924U}; void bnx2x_iov_adjust_stats_req(struct bnx2x *bp ) ; __inline static long bnx2x_hilo(u32 *hiref ) { u32 lo ; u32 hi ; { lo = *(hiref + 1UL); hi = *hiref; return ((long )(((unsigned long long )hi << 32) + (unsigned long long )lo)); } } __inline static u16 bnx2x_get_port_stats_dma_len(struct bnx2x *bp ) { u16 res ; u32 size ; unsigned int tmp ; unsigned int tmp___0 ; int __ret_warn_on ; long tmp___1 ; { res = 0U; if (bp->common.shmem2_base != 0U) { tmp___0 = readl((void const volatile *)bp->regview + (unsigned long )bp->common.shmem2_base); if (tmp___0 > 312U) { tmp = readl((void const volatile *)(bp->regview + ((unsigned long )bp->common.shmem2_base + 312UL))); size = tmp; if (size != 0U) { res = (u16 )size; } else { } if ((unsigned int )res > 648U) { res = 648U; } else { } } else { } } else { } if ((unsigned int )res == 0U) { res = 624U; if ((bp->flags & 131072U) != 0U) { res = (unsigned int )res + 16U; } else { } } else { } res = (u16 )((int )res >> 2); __ret_warn_on = (unsigned int )res > 256U; tmp___1 = ldv__builtin_expect(__ret_warn_on != 0, 0L); if (tmp___1 != 0L) { warn_slowpath_null("/work/ldvuser/exper_fp/work/current--X--drivers--X--defaultlinux-3.10-rc1.tar--X--32_7a--X--cpachecker/linux-3.10-rc1.tar/csd_deg_dscv/8504/dscv_tempdir/dscv/ri/32_7a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_stats.c.prepared", 145); } else { } ldv__builtin_expect(__ret_warn_on != 0, 0L); return (res); } } static void bnx2x_dp_stats(struct bnx2x *bp ) { int i ; long tmp ; long tmp___0 ; { tmp = ldv__builtin_expect((bp->msg_enable & 131072) != 0, 0L); if (tmp != 0L) { printk("\rbnx2x: [%s:%d(%s)]dumping stats:\nfw_stats_req\n hdr\n cmd_num %d\n reserved0 %d\n drv_stats_counter %d\n reserved1 %d\n stats_counters_addrs %x %x\n", "bnx2x_dp_stats", 170, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )(bp->fw_stats_req)->hdr.cmd_num, (int )(bp->fw_stats_req)->hdr.reserved0, (int )(bp->fw_stats_req)->hdr.drv_stats_counter, (bp->fw_stats_req)->hdr.reserved1, (bp->fw_stats_req)->hdr.stats_counters_addrs.hi, (bp->fw_stats_req)->hdr.stats_counters_addrs.lo); } else { } i = 0; goto ldv_45029; ldv_45028: tmp___0 = ldv__builtin_expect((bp->msg_enable & 131072) != 0, 0L); if (tmp___0 != 0L) { printk("\rbnx2x: [%s:%d(%s)]query[%d]\n kind %d\n index %d\n funcID %d\n reserved %d\n address %x %x\n", "bnx2x_dp_stats", 185, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", i, (int )(bp->fw_stats_req)->query[i].kind, (int )(bp->fw_stats_req)->query[i].index, (int )(bp->fw_stats_req)->query[i].funcID, (bp->fw_stats_req)->query[i].reserved, (bp->fw_stats_req)->query[i].address.hi, (bp->fw_stats_req)->query[i].address.lo); } else { } i = i + 1; ldv_45029: ; if ((int )(bp->fw_stats_req)->hdr.cmd_num > i) { goto ldv_45028; } else { } return; } } static void bnx2x_storm_stats_post(struct bnx2x *bp ) { int rc ; u16 tmp ; long tmp___0 ; { if ((unsigned int )bp->stats_pending == 0U) { spin_lock_bh(& bp->stats_lock); if ((unsigned int )bp->stats_pending != 0U) { spin_unlock_bh(& bp->stats_lock); return; } else { } tmp = bp->stats_counter; bp->stats_counter = (u16 )((int )bp->stats_counter + 1); (bp->fw_stats_req)->hdr.drv_stats_counter = tmp; tmp___0 = ldv__builtin_expect((bp->msg_enable & 131072) != 0, 0L); if (tmp___0 != 0L) { printk("\rbnx2x: [%s:%d(%s)]Sending statistics ramrod %d\n", "bnx2x_storm_stats_post", 211, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )(bp->fw_stats_req)->hdr.drv_stats_counter); } else { } bnx2x_iov_adjust_stats_req(bp); bnx2x_dp_stats(bp); rc = bnx2x_sp_post(bp, 6, 0, (unsigned int )(bp->fw_stats_req_mapping >> 32), (unsigned int )bp->fw_stats_req_mapping, 8); if (rc == 0) { bp->stats_pending = 1U; } else { } spin_unlock_bh(& bp->stats_lock); } else { } return; } } static void bnx2x_hw_stats_post(struct bnx2x *bp ) { struct dmae_command *dmae ; u32 *stats_comp ; size_t __len ; void *__ret ; int loader_idx ; u32 opcode ; u32 tmp ; { dmae = & bp->stats_dmae; stats_comp = & (bp->slowpath)->stats_comp; *stats_comp = 1624297646U; if ((bp->common.chip_id & 61440U) > 20480U) { return; } else { } if (bp->func_stx != 0U) { __len = 80UL; if (__len > 63UL) { __ret = __memcpy((void *)(& (bp->slowpath)->func_stats), (void const *)(& bp->func_stats), __len); } else { __ret = __builtin_memcpy((void *)(& (bp->slowpath)->func_stats), (void const *)(& bp->func_stats), __len); } } else { } if (bp->executer_idx != 0) { loader_idx = ((int )bp->pfid & 1) * 8 + 4; tmp = bnx2x_dmae_opcode(bp, 0, 2, 1, 1); opcode = tmp; opcode = bnx2x_dmae_opcode_clr_src_reset(opcode); memset((void *)dmae, 0, 56UL); dmae->opcode = opcode; dmae->src_addr_lo = (unsigned int )bp->slowpath_mapping + 2680U; dmae->src_addr_hi = (unsigned int )((bp->slowpath_mapping + 2680ULL) >> 32); dmae->dst_addr_lo = (u32 )(((unsigned long )(loader_idx + 1) * 56UL + 1057792UL) >> 2); dmae->dst_addr_hi = 0U; dmae->len = 14U; if (bp->common.chip_id >> 16 == 5710U) { dmae->len = (u16 )((int )dmae->len - 1); } else { } dmae->comp_addr_lo = dmae_reg_go_c___0[loader_idx + 1] >> 2; dmae->comp_addr_hi = 0U; dmae->comp_val = 1U; *stats_comp = 0U; bnx2x_post_dmae(bp, dmae, loader_idx); } else if (bp->func_stx != 0U) { *stats_comp = 0U; bnx2x_post_dmae(bp, dmae, ((int )bp->pfid & 1) * 8 + ((int )bp->pfid >> 1)); } else { } return; } } static int bnx2x_stats_comp(struct bnx2x *bp ) { u32 *stats_comp ; int cnt ; { stats_comp = & (bp->slowpath)->stats_comp; cnt = 10; __might_sleep("/work/ldvuser/exper_fp/work/current--X--drivers--X--defaultlinux-3.10-rc1.tar--X--32_7a--X--cpachecker/linux-3.10-rc1.tar/csd_deg_dscv/8504/dscv_tempdir/dscv/ri/32_7a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_stats.c.prepared", 279, 0); goto ldv_45054; ldv_45053: ; if (cnt == 0) { printk("\vbnx2x: [%s:%d(%s)]timeout waiting for stats finished\n", "bnx2x_stats_comp", 282, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); goto ldv_45052; } else { } cnt = cnt - 1; usleep_range(1000UL, 2000UL); ldv_45054: ; if (*stats_comp != 1624297646U) { goto ldv_45053; } else { } ldv_45052: ; return (1); } } static void bnx2x_stats_pmf_update(struct bnx2x *bp ) { struct dmae_command *dmae ; u32 opcode ; int loader_idx ; u32 *stats_comp ; int tmp ; int tmp___0 ; u16 tmp___1 ; { loader_idx = ((int )bp->pfid & 1) * 8 + 4; stats_comp = & (bp->slowpath)->stats_comp; if (bp->port.pmf == 0U || bp->port.port_stx == 0U) { printk("\vbnx2x: [%s:%d(%s)]BUG!\n", "bnx2x_stats_pmf_update", 304, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); return; } else { } bp->executer_idx = 0; opcode = bnx2x_dmae_opcode(bp, 1, 1, 0, 0); tmp = bp->executer_idx; bp->executer_idx = bp->executer_idx + 1; dmae = (struct dmae_command *)(& (bp->slowpath)->dmae) + (unsigned long )tmp; dmae->opcode = bnx2x_dmae_opcode_add_comp(opcode, 1); dmae->src_addr_lo = bp->port.port_stx >> 2; dmae->src_addr_hi = 0U; dmae->dst_addr_lo = (unsigned int )bp->slowpath_mapping + 3660U; dmae->dst_addr_hi = (unsigned int )((bp->slowpath_mapping + 3660ULL) >> 32); dmae->len = 128U; dmae->comp_addr_lo = dmae_reg_go_c___0[loader_idx] >> 2; dmae->comp_addr_hi = 0U; dmae->comp_val = 1U; tmp___0 = bp->executer_idx; bp->executer_idx = bp->executer_idx + 1; dmae = (struct dmae_command *)(& (bp->slowpath)->dmae) + (unsigned long )tmp___0; dmae->opcode = bnx2x_dmae_opcode_add_comp(opcode, 0); dmae->src_addr_lo = (bp->port.port_stx >> 2) + 128U; dmae->src_addr_hi = 0U; dmae->dst_addr_lo = (unsigned int )bp->slowpath_mapping + 4172U; dmae->dst_addr_hi = (unsigned int )((bp->slowpath_mapping + 4172ULL) >> 32); tmp___1 = bnx2x_get_port_stats_dma_len(bp); dmae->len = (unsigned int )tmp___1 + 65408U; dmae->comp_addr_lo = (unsigned int )bp->slowpath_mapping + 3128U; dmae->comp_addr_hi = (unsigned int )((bp->slowpath_mapping + 3128ULL) >> 32); dmae->comp_val = 1624297646U; *stats_comp = 0U; bnx2x_hw_stats_post(bp); bnx2x_stats_comp(bp); return; } } static void bnx2x_port_stats_init(struct bnx2x *bp ) { struct dmae_command *dmae ; int port ; u32 opcode ; int loader_idx ; u32 mac_addr ; u32 *stats_comp ; int tmp ; int tmp___0 ; int tmp___1 ; int tmp___2 ; int tmp___3 ; u32 tx_src_addr_lo ; u32 rx_src_addr_lo ; u16 rx_len ; u16 tx_len ; int tmp___4 ; int tmp___5 ; int tmp___6 ; int tmp___7 ; int tmp___8 ; { port = (int )bp->pfid & 1; loader_idx = ((int )bp->pfid & 1) * 8 + 4; stats_comp = & (bp->slowpath)->stats_comp; if ((unsigned int )bp->link_vars.link_up == 0U || bp->port.pmf == 0U) { printk("\vbnx2x: [%s:%d(%s)]BUG!\n", "bnx2x_port_stats_init", 353, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); return; } else { } bp->executer_idx = 0; opcode = bnx2x_dmae_opcode(bp, 0, 2, 1, 1); if (bp->port.port_stx != 0U) { tmp = bp->executer_idx; bp->executer_idx = bp->executer_idx + 1; dmae = (struct dmae_command *)(& (bp->slowpath)->dmae) + (unsigned long )tmp; dmae->opcode = opcode; dmae->src_addr_lo = (unsigned int )bp->slowpath_mapping + 3660U; dmae->src_addr_hi = (unsigned int )((bp->slowpath_mapping + 3660ULL) >> 32); dmae->dst_addr_lo = bp->port.port_stx >> 2; dmae->dst_addr_hi = 0U; dmae->len = bnx2x_get_port_stats_dma_len(bp); dmae->comp_addr_lo = dmae_reg_go_c___0[loader_idx] >> 2; dmae->comp_addr_hi = 0U; dmae->comp_val = 1U; } else { } if (bp->func_stx != 0U) { tmp___0 = bp->executer_idx; bp->executer_idx = bp->executer_idx + 1; dmae = (struct dmae_command *)(& (bp->slowpath)->dmae) + (unsigned long )tmp___0; dmae->opcode = opcode; dmae->src_addr_lo = (unsigned int )bp->slowpath_mapping + 4308U; dmae->src_addr_hi = (unsigned int )((bp->slowpath_mapping + 4308ULL) >> 32); dmae->dst_addr_lo = bp->func_stx >> 2; dmae->dst_addr_hi = 0U; dmae->len = 20U; dmae->comp_addr_lo = dmae_reg_go_c___0[loader_idx] >> 2; dmae->comp_addr_hi = 0U; dmae->comp_val = 1U; } else { } opcode = bnx2x_dmae_opcode(bp, 1, 1, 1, 1); if ((unsigned int )bp->link_vars.mac_type == 1U) { mac_addr = port != 0 ? 33792U : 32768U; tmp___1 = bp->executer_idx; bp->executer_idx = bp->executer_idx + 1; dmae = (struct dmae_command *)(& (bp->slowpath)->dmae) + (unsigned long )tmp___1; dmae->opcode = opcode; dmae->src_addr_lo = (mac_addr + 384U) >> 2; dmae->src_addr_hi = 0U; dmae->dst_addr_lo = (unsigned int )bp->slowpath_mapping + 3132U; dmae->dst_addr_hi = (unsigned int )((bp->slowpath_mapping + 3132ULL) >> 32); dmae->len = 23U; dmae->comp_addr_lo = dmae_reg_go_c___0[loader_idx] >> 2; dmae->comp_addr_hi = 0U; dmae->comp_val = 1U; tmp___2 = bp->executer_idx; bp->executer_idx = bp->executer_idx + 1; dmae = (struct dmae_command *)(& (bp->slowpath)->dmae) + (unsigned long )tmp___2; dmae->opcode = opcode; dmae->src_addr_lo = (mac_addr + 500U) >> 2; dmae->src_addr_hi = 0U; dmae->dst_addr_lo = (unsigned int )bp->slowpath_mapping + 3224U; dmae->dst_addr_hi = (unsigned int )((bp->slowpath_mapping + 3224ULL) >> 32); dmae->len = 1U; dmae->comp_addr_lo = dmae_reg_go_c___0[loader_idx] >> 2; dmae->comp_addr_hi = 0U; dmae->comp_val = 1U; tmp___3 = bp->executer_idx; bp->executer_idx = bp->executer_idx + 1; dmae = (struct dmae_command *)(& (bp->slowpath)->dmae) + (unsigned long )tmp___3; dmae->opcode = opcode; dmae->src_addr_lo = (mac_addr + 640U) >> 2; dmae->src_addr_hi = 0U; dmae->dst_addr_lo = (unsigned int )bp->slowpath_mapping + 3228U; dmae->dst_addr_hi = (unsigned int )((bp->slowpath_mapping + 3228ULL) >> 32); dmae->len = 22U; dmae->comp_addr_lo = dmae_reg_go_c___0[loader_idx] >> 2; dmae->comp_addr_hi = 0U; dmae->comp_val = 1U; } else { switch ((int )bp->link_vars.mac_type) { case 2: mac_addr = port != 0 ? 69632U : 68608U; if (bp->common.chip_id >> 16 == 5710U || (bp->common.chip_id >> 16 == 5711U || bp->common.chip_id >> 16 == 5712U)) { tx_src_addr_lo = (mac_addr + 96U) >> 2; tx_len = 42U; rx_src_addr_lo = (mac_addr + 304U) >> 2; rx_len = 58U; } else { tx_src_addr_lo = (mac_addr + 272U) >> 2; tx_len = 48U; rx_src_addr_lo = (mac_addr + 512U) >> 2; rx_len = 64U; } goto ldv_45078; case 3: ; case 4: ; default: mac_addr = port != 0 ? 1452032U : 1449984U; tx_src_addr_lo = mac_addr >> 2; rx_src_addr_lo = (mac_addr + 512U) >> 2; tx_len = 54U; rx_len = 60U; goto ldv_45078; } ldv_45078: tmp___4 = bp->executer_idx; bp->executer_idx = bp->executer_idx + 1; dmae = (struct dmae_command *)(& (bp->slowpath)->dmae) + (unsigned long )tmp___4; dmae->opcode = opcode; dmae->src_addr_lo = tx_src_addr_lo; dmae->src_addr_hi = 0U; dmae->len = tx_len; dmae->dst_addr_lo = (unsigned int )bp->slowpath_mapping + 3132U; dmae->dst_addr_hi = (unsigned int )((bp->slowpath_mapping + 3132ULL) >> 32); dmae->comp_addr_lo = dmae_reg_go_c___0[loader_idx] >> 2; dmae->comp_addr_hi = 0U; dmae->comp_val = 1U; tmp___5 = bp->executer_idx; bp->executer_idx = bp->executer_idx + 1; dmae = (struct dmae_command *)(& (bp->slowpath)->dmae) + (unsigned long )tmp___5; dmae->opcode = opcode; dmae->src_addr_hi = 0U; dmae->src_addr_lo = rx_src_addr_lo; dmae->dst_addr_lo = ((unsigned int )bp->slowpath_mapping + (unsigned int )((int )tx_len << 2)) + 3132U; dmae->dst_addr_hi = (unsigned int )(((bp->slowpath_mapping + (unsigned long long )((int )tx_len << 2)) + 3132ULL) >> 32); dmae->len = rx_len; dmae->comp_addr_lo = dmae_reg_go_c___0[loader_idx] >> 2; dmae->comp_addr_hi = 0U; dmae->comp_val = 1U; } if (((((((((bp->common.chip_id >> 16 != 5770U && bp->common.chip_id >> 16 != 5797U) && bp->common.chip_id >> 16 != 5801U) && bp->common.chip_id >> 16 != 5774U) && bp->common.chip_id >> 16 != 5806U) && bp->common.chip_id >> 16 != 5807U) && ((bp->common.chip_id >> 16 != 5693U && bp->common.chip_id >> 16 != 5694U) && bp->common.chip_id >> 16 != 5695U)) && ((bp->common.chip_id >> 16 != 5793U && bp->common.chip_id >> 16 != 5794U) && bp->common.chip_id >> 16 != 5773U)) && (bp->common.chip_id >> 16 != 5796U && bp->common.chip_id >> 16 != 5803U)) && bp->common.chip_id >> 16 != 5805U) { tmp___6 = bp->executer_idx; bp->executer_idx = bp->executer_idx + 1; dmae = (struct dmae_command *)(& (bp->slowpath)->dmae) + (unsigned long )tmp___6; dmae->opcode = opcode; dmae->src_addr_lo = port != 0 ? 16872U : 16852U; dmae->src_addr_hi = 0U; dmae->dst_addr_lo = (unsigned int )bp->slowpath_mapping + 3644U; dmae->dst_addr_hi = (unsigned int )((bp->slowpath_mapping + 3644ULL) >> 32); dmae->len = 2U; dmae->comp_addr_lo = dmae_reg_go_c___0[loader_idx] >> 2; dmae->comp_addr_hi = 0U; dmae->comp_val = 1U; tmp___7 = bp->executer_idx; bp->executer_idx = bp->executer_idx + 1; dmae = (struct dmae_command *)(& (bp->slowpath)->dmae) + (unsigned long )tmp___7; dmae->opcode = opcode; dmae->src_addr_lo = port != 0 ? 16876U : 16856U; dmae->src_addr_hi = 0U; dmae->dst_addr_lo = (unsigned int )bp->slowpath_mapping + 3652U; dmae->dst_addr_hi = (unsigned int )((bp->slowpath_mapping + 3652ULL) >> 32); dmae->len = 2U; dmae->comp_addr_lo = dmae_reg_go_c___0[loader_idx] >> 2; dmae->comp_addr_hi = 0U; dmae->comp_val = 1U; } else { } tmp___8 = bp->executer_idx; bp->executer_idx = bp->executer_idx + 1; dmae = (struct dmae_command *)(& (bp->slowpath)->dmae) + (unsigned long )tmp___8; dmae->opcode = bnx2x_dmae_opcode(bp, 1, 1, 1, 0); dmae->src_addr_lo = port != 0 ? 16778U : 16764U; dmae->src_addr_hi = 0U; dmae->dst_addr_lo = (unsigned int )bp->slowpath_mapping + 3588U; dmae->dst_addr_hi = (unsigned int )((bp->slowpath_mapping + 3588ULL) >> 32); dmae->len = 14U; dmae->comp_addr_lo = (unsigned int )bp->slowpath_mapping + 3128U; dmae->comp_addr_hi = (unsigned int )((bp->slowpath_mapping + 3128ULL) >> 32); dmae->comp_val = 1624297646U; *stats_comp = 0U; return; } } static void bnx2x_func_stats_init(struct bnx2x *bp ) { struct dmae_command *dmae ; u32 *stats_comp ; { dmae = & bp->stats_dmae; stats_comp = & (bp->slowpath)->stats_comp; if (bp->func_stx == 0U) { printk("\vbnx2x: [%s:%d(%s)]BUG!\n", "bnx2x_func_stats_init", 571, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); return; } else { } bp->executer_idx = 0; memset((void *)dmae, 0, 56UL); dmae->opcode = bnx2x_dmae_opcode(bp, 0, 2, 1, 0); dmae->src_addr_lo = (unsigned int )bp->slowpath_mapping + 4308U; dmae->src_addr_hi = (unsigned int )((bp->slowpath_mapping + 4308ULL) >> 32); dmae->dst_addr_lo = bp->func_stx >> 2; dmae->dst_addr_hi = 0U; dmae->len = 20U; dmae->comp_addr_lo = (unsigned int )bp->slowpath_mapping + 3128U; dmae->comp_addr_hi = (unsigned int )((bp->slowpath_mapping + 3128ULL) >> 32); dmae->comp_val = 1624297646U; *stats_comp = 0U; return; } } static void bnx2x_stats_start(struct bnx2x *bp ) { { if ((bp->flags & 4194304U) != 0U) { return; } else { } if (bp->port.pmf != 0U) { bnx2x_port_stats_init(bp); } else if (bp->func_stx != 0U) { bnx2x_func_stats_init(bp); } else { } bnx2x_hw_stats_post(bp); bnx2x_storm_stats_post(bp); return; } } static void bnx2x_stats_pmf_start(struct bnx2x *bp ) { { bnx2x_stats_comp(bp); bnx2x_stats_pmf_update(bp); bnx2x_stats_start(bp); return; } } static void bnx2x_stats_restart(struct bnx2x *bp ) { { if ((bp->flags & 4194304U) != 0U) { return; } else { } bnx2x_stats_comp(bp); bnx2x_stats_start(bp); return; } } static void bnx2x_bmac_stats_update(struct bnx2x *bp ) { struct host_port_stats *pstats ; struct bnx2x_eth_stats *estats ; struct __anonstruct_diff_248 diff ; struct bmac1_stats *new ; struct bmac2_stats *new___0 ; { pstats = & (bp->slowpath)->port_stats; estats = & bp->eth_stats; if (bp->common.chip_id >> 16 == 5710U || (bp->common.chip_id >> 16 == 5711U || bp->common.chip_id >> 16 == 5712U)) { new = & (bp->slowpath)->mac_stats.bmac1_stats; if (new->rx_stat_grerb_lo < pstats->mac_stx[0].rx_stat_ifhcinbadoctets_lo) { diff.hi = new->rx_stat_grerb_hi - pstats->mac_stx[0].rx_stat_ifhcinbadoctets_hi; if (diff.hi != 0U) { diff.hi = diff.hi - 1U; diff.lo = (new->rx_stat_grerb_lo + ~ pstats->mac_stx[0].rx_stat_ifhcinbadoctets_lo) + 1U; } else { diff.hi = 0U; diff.lo = 0U; } } else if (new->rx_stat_grerb_hi < pstats->mac_stx[0].rx_stat_ifhcinbadoctets_hi) { diff.hi = 0U; diff.lo = 0U; } else { diff.hi = new->rx_stat_grerb_hi - pstats->mac_stx[0].rx_stat_ifhcinbadoctets_hi; diff.lo = new->rx_stat_grerb_lo - pstats->mac_stx[0].rx_stat_ifhcinbadoctets_lo; } pstats->mac_stx[0].rx_stat_ifhcinbadoctets_hi = new->rx_stat_grerb_hi; pstats->mac_stx[0].rx_stat_ifhcinbadoctets_lo = new->rx_stat_grerb_lo; pstats->mac_stx[1].rx_stat_ifhcinbadoctets_lo = pstats->mac_stx[1].rx_stat_ifhcinbadoctets_lo + diff.lo; pstats->mac_stx[1].rx_stat_ifhcinbadoctets_hi = pstats->mac_stx[1].rx_stat_ifhcinbadoctets_hi + (diff.hi + (pstats->mac_stx[1].rx_stat_ifhcinbadoctets_lo < diff.lo ? 1U : 0U)); if (new->rx_stat_grfcs_lo < pstats->mac_stx[0].rx_stat_dot3statsfcserrors_lo) { diff.hi = new->rx_stat_grfcs_hi - pstats->mac_stx[0].rx_stat_dot3statsfcserrors_hi; if (diff.hi != 0U) { diff.hi = diff.hi - 1U; diff.lo = (new->rx_stat_grfcs_lo + ~ pstats->mac_stx[0].rx_stat_dot3statsfcserrors_lo) + 1U; } else { diff.hi = 0U; diff.lo = 0U; } } else if (new->rx_stat_grfcs_hi < pstats->mac_stx[0].rx_stat_dot3statsfcserrors_hi) { diff.hi = 0U; diff.lo = 0U; } else { diff.hi = new->rx_stat_grfcs_hi - pstats->mac_stx[0].rx_stat_dot3statsfcserrors_hi; diff.lo = new->rx_stat_grfcs_lo - pstats->mac_stx[0].rx_stat_dot3statsfcserrors_lo; } pstats->mac_stx[0].rx_stat_dot3statsfcserrors_hi = new->rx_stat_grfcs_hi; pstats->mac_stx[0].rx_stat_dot3statsfcserrors_lo = new->rx_stat_grfcs_lo; pstats->mac_stx[1].rx_stat_dot3statsfcserrors_lo = pstats->mac_stx[1].rx_stat_dot3statsfcserrors_lo + diff.lo; pstats->mac_stx[1].rx_stat_dot3statsfcserrors_hi = pstats->mac_stx[1].rx_stat_dot3statsfcserrors_hi + (diff.hi + (pstats->mac_stx[1].rx_stat_dot3statsfcserrors_lo < diff.lo ? 1U : 0U)); if (new->rx_stat_grund_lo < pstats->mac_stx[0].rx_stat_etherstatsundersizepkts_lo) { diff.hi = new->rx_stat_grund_hi - pstats->mac_stx[0].rx_stat_etherstatsundersizepkts_hi; if (diff.hi != 0U) { diff.hi = diff.hi - 1U; diff.lo = (new->rx_stat_grund_lo + ~ pstats->mac_stx[0].rx_stat_etherstatsundersizepkts_lo) + 1U; } else { diff.hi = 0U; diff.lo = 0U; } } else if (new->rx_stat_grund_hi < pstats->mac_stx[0].rx_stat_etherstatsundersizepkts_hi) { diff.hi = 0U; diff.lo = 0U; } else { diff.hi = new->rx_stat_grund_hi - pstats->mac_stx[0].rx_stat_etherstatsundersizepkts_hi; diff.lo = new->rx_stat_grund_lo - pstats->mac_stx[0].rx_stat_etherstatsundersizepkts_lo; } pstats->mac_stx[0].rx_stat_etherstatsundersizepkts_hi = new->rx_stat_grund_hi; pstats->mac_stx[0].rx_stat_etherstatsundersizepkts_lo = new->rx_stat_grund_lo; pstats->mac_stx[1].rx_stat_etherstatsundersizepkts_lo = pstats->mac_stx[1].rx_stat_etherstatsundersizepkts_lo + diff.lo; pstats->mac_stx[1].rx_stat_etherstatsundersizepkts_hi = pstats->mac_stx[1].rx_stat_etherstatsundersizepkts_hi + (diff.hi + (pstats->mac_stx[1].rx_stat_etherstatsundersizepkts_lo < diff.lo ? 1U : 0U)); if (new->rx_stat_grovr_lo < pstats->mac_stx[0].rx_stat_dot3statsframestoolong_lo) { diff.hi = new->rx_stat_grovr_hi - pstats->mac_stx[0].rx_stat_dot3statsframestoolong_hi; if (diff.hi != 0U) { diff.hi = diff.hi - 1U; diff.lo = (new->rx_stat_grovr_lo + ~ pstats->mac_stx[0].rx_stat_dot3statsframestoolong_lo) + 1U; } else { diff.hi = 0U; diff.lo = 0U; } } else if (new->rx_stat_grovr_hi < pstats->mac_stx[0].rx_stat_dot3statsframestoolong_hi) { diff.hi = 0U; diff.lo = 0U; } else { diff.hi = new->rx_stat_grovr_hi - pstats->mac_stx[0].rx_stat_dot3statsframestoolong_hi; diff.lo = new->rx_stat_grovr_lo - pstats->mac_stx[0].rx_stat_dot3statsframestoolong_lo; } pstats->mac_stx[0].rx_stat_dot3statsframestoolong_hi = new->rx_stat_grovr_hi; pstats->mac_stx[0].rx_stat_dot3statsframestoolong_lo = new->rx_stat_grovr_lo; pstats->mac_stx[1].rx_stat_dot3statsframestoolong_lo = pstats->mac_stx[1].rx_stat_dot3statsframestoolong_lo + diff.lo; pstats->mac_stx[1].rx_stat_dot3statsframestoolong_hi = pstats->mac_stx[1].rx_stat_dot3statsframestoolong_hi + (diff.hi + (pstats->mac_stx[1].rx_stat_dot3statsframestoolong_lo < diff.lo ? 1U : 0U)); if (new->rx_stat_grfrg_lo < pstats->mac_stx[0].rx_stat_etherstatsfragments_lo) { diff.hi = new->rx_stat_grfrg_hi - pstats->mac_stx[0].rx_stat_etherstatsfragments_hi; if (diff.hi != 0U) { diff.hi = diff.hi - 1U; diff.lo = (new->rx_stat_grfrg_lo + ~ pstats->mac_stx[0].rx_stat_etherstatsfragments_lo) + 1U; } else { diff.hi = 0U; diff.lo = 0U; } } else if (new->rx_stat_grfrg_hi < pstats->mac_stx[0].rx_stat_etherstatsfragments_hi) { diff.hi = 0U; diff.lo = 0U; } else { diff.hi = new->rx_stat_grfrg_hi - pstats->mac_stx[0].rx_stat_etherstatsfragments_hi; diff.lo = new->rx_stat_grfrg_lo - pstats->mac_stx[0].rx_stat_etherstatsfragments_lo; } pstats->mac_stx[0].rx_stat_etherstatsfragments_hi = new->rx_stat_grfrg_hi; pstats->mac_stx[0].rx_stat_etherstatsfragments_lo = new->rx_stat_grfrg_lo; pstats->mac_stx[1].rx_stat_etherstatsfragments_lo = pstats->mac_stx[1].rx_stat_etherstatsfragments_lo + diff.lo; pstats->mac_stx[1].rx_stat_etherstatsfragments_hi = pstats->mac_stx[1].rx_stat_etherstatsfragments_hi + (diff.hi + (pstats->mac_stx[1].rx_stat_etherstatsfragments_lo < diff.lo ? 1U : 0U)); if (new->rx_stat_grjbr_lo < pstats->mac_stx[0].rx_stat_etherstatsjabbers_lo) { diff.hi = new->rx_stat_grjbr_hi - pstats->mac_stx[0].rx_stat_etherstatsjabbers_hi; if (diff.hi != 0U) { diff.hi = diff.hi - 1U; diff.lo = (new->rx_stat_grjbr_lo + ~ pstats->mac_stx[0].rx_stat_etherstatsjabbers_lo) + 1U; } else { diff.hi = 0U; diff.lo = 0U; } } else if (new->rx_stat_grjbr_hi < pstats->mac_stx[0].rx_stat_etherstatsjabbers_hi) { diff.hi = 0U; diff.lo = 0U; } else { diff.hi = new->rx_stat_grjbr_hi - pstats->mac_stx[0].rx_stat_etherstatsjabbers_hi; diff.lo = new->rx_stat_grjbr_lo - pstats->mac_stx[0].rx_stat_etherstatsjabbers_lo; } pstats->mac_stx[0].rx_stat_etherstatsjabbers_hi = new->rx_stat_grjbr_hi; pstats->mac_stx[0].rx_stat_etherstatsjabbers_lo = new->rx_stat_grjbr_lo; pstats->mac_stx[1].rx_stat_etherstatsjabbers_lo = pstats->mac_stx[1].rx_stat_etherstatsjabbers_lo + diff.lo; pstats->mac_stx[1].rx_stat_etherstatsjabbers_hi = pstats->mac_stx[1].rx_stat_etherstatsjabbers_hi + (diff.hi + (pstats->mac_stx[1].rx_stat_etherstatsjabbers_lo < diff.lo ? 1U : 0U)); if (new->rx_stat_grxcf_lo < pstats->mac_stx[0].rx_stat_maccontrolframesreceived_lo) { diff.hi = new->rx_stat_grxcf_hi - pstats->mac_stx[0].rx_stat_maccontrolframesreceived_hi; if (diff.hi != 0U) { diff.hi = diff.hi - 1U; diff.lo = (new->rx_stat_grxcf_lo + ~ pstats->mac_stx[0].rx_stat_maccontrolframesreceived_lo) + 1U; } else { diff.hi = 0U; diff.lo = 0U; } } else if (new->rx_stat_grxcf_hi < pstats->mac_stx[0].rx_stat_maccontrolframesreceived_hi) { diff.hi = 0U; diff.lo = 0U; } else { diff.hi = new->rx_stat_grxcf_hi - pstats->mac_stx[0].rx_stat_maccontrolframesreceived_hi; diff.lo = new->rx_stat_grxcf_lo - pstats->mac_stx[0].rx_stat_maccontrolframesreceived_lo; } pstats->mac_stx[0].rx_stat_maccontrolframesreceived_hi = new->rx_stat_grxcf_hi; pstats->mac_stx[0].rx_stat_maccontrolframesreceived_lo = new->rx_stat_grxcf_lo; pstats->mac_stx[1].rx_stat_maccontrolframesreceived_lo = pstats->mac_stx[1].rx_stat_maccontrolframesreceived_lo + diff.lo; pstats->mac_stx[1].rx_stat_maccontrolframesreceived_hi = pstats->mac_stx[1].rx_stat_maccontrolframesreceived_hi + (diff.hi + (pstats->mac_stx[1].rx_stat_maccontrolframesreceived_lo < diff.lo ? 1U : 0U)); if (new->rx_stat_grxpf_lo < pstats->mac_stx[0].rx_stat_xoffstateentered_lo) { diff.hi = new->rx_stat_grxpf_hi - pstats->mac_stx[0].rx_stat_xoffstateentered_hi; if (diff.hi != 0U) { diff.hi = diff.hi - 1U; diff.lo = (new->rx_stat_grxpf_lo + ~ pstats->mac_stx[0].rx_stat_xoffstateentered_lo) + 1U; } else { diff.hi = 0U; diff.lo = 0U; } } else if (new->rx_stat_grxpf_hi < pstats->mac_stx[0].rx_stat_xoffstateentered_hi) { diff.hi = 0U; diff.lo = 0U; } else { diff.hi = new->rx_stat_grxpf_hi - pstats->mac_stx[0].rx_stat_xoffstateentered_hi; diff.lo = new->rx_stat_grxpf_lo - pstats->mac_stx[0].rx_stat_xoffstateentered_lo; } pstats->mac_stx[0].rx_stat_xoffstateentered_hi = new->rx_stat_grxpf_hi; pstats->mac_stx[0].rx_stat_xoffstateentered_lo = new->rx_stat_grxpf_lo; pstats->mac_stx[1].rx_stat_xoffstateentered_lo = pstats->mac_stx[1].rx_stat_xoffstateentered_lo + diff.lo; pstats->mac_stx[1].rx_stat_xoffstateentered_hi = pstats->mac_stx[1].rx_stat_xoffstateentered_hi + (diff.hi + (pstats->mac_stx[1].rx_stat_xoffstateentered_lo < diff.lo ? 1U : 0U)); if (new->rx_stat_grxpf_lo < pstats->mac_stx[0].rx_stat_mac_xpf_lo) { diff.hi = new->rx_stat_grxpf_hi - pstats->mac_stx[0].rx_stat_mac_xpf_hi; if (diff.hi != 0U) { diff.hi = diff.hi - 1U; diff.lo = (new->rx_stat_grxpf_lo + ~ pstats->mac_stx[0].rx_stat_mac_xpf_lo) + 1U; } else { diff.hi = 0U; diff.lo = 0U; } } else if (new->rx_stat_grxpf_hi < pstats->mac_stx[0].rx_stat_mac_xpf_hi) { diff.hi = 0U; diff.lo = 0U; } else { diff.hi = new->rx_stat_grxpf_hi - pstats->mac_stx[0].rx_stat_mac_xpf_hi; diff.lo = new->rx_stat_grxpf_lo - pstats->mac_stx[0].rx_stat_mac_xpf_lo; } pstats->mac_stx[0].rx_stat_mac_xpf_hi = new->rx_stat_grxpf_hi; pstats->mac_stx[0].rx_stat_mac_xpf_lo = new->rx_stat_grxpf_lo; pstats->mac_stx[1].rx_stat_mac_xpf_lo = pstats->mac_stx[1].rx_stat_mac_xpf_lo + diff.lo; pstats->mac_stx[1].rx_stat_mac_xpf_hi = pstats->mac_stx[1].rx_stat_mac_xpf_hi + (diff.hi + (pstats->mac_stx[1].rx_stat_mac_xpf_lo < diff.lo ? 1U : 0U)); if (new->tx_stat_gtxpf_lo < pstats->mac_stx[0].tx_stat_outxoffsent_lo) { diff.hi = new->tx_stat_gtxpf_hi - pstats->mac_stx[0].tx_stat_outxoffsent_hi; if (diff.hi != 0U) { diff.hi = diff.hi - 1U; diff.lo = (new->tx_stat_gtxpf_lo + ~ pstats->mac_stx[0].tx_stat_outxoffsent_lo) + 1U; } else { diff.hi = 0U; diff.lo = 0U; } } else if (new->tx_stat_gtxpf_hi < pstats->mac_stx[0].tx_stat_outxoffsent_hi) { diff.hi = 0U; diff.lo = 0U; } else { diff.hi = new->tx_stat_gtxpf_hi - pstats->mac_stx[0].tx_stat_outxoffsent_hi; diff.lo = new->tx_stat_gtxpf_lo - pstats->mac_stx[0].tx_stat_outxoffsent_lo; } pstats->mac_stx[0].tx_stat_outxoffsent_hi = new->tx_stat_gtxpf_hi; pstats->mac_stx[0].tx_stat_outxoffsent_lo = new->tx_stat_gtxpf_lo; pstats->mac_stx[1].tx_stat_outxoffsent_lo = pstats->mac_stx[1].tx_stat_outxoffsent_lo + diff.lo; pstats->mac_stx[1].tx_stat_outxoffsent_hi = pstats->mac_stx[1].tx_stat_outxoffsent_hi + (diff.hi + (pstats->mac_stx[1].tx_stat_outxoffsent_lo < diff.lo ? 1U : 0U)); if (new->tx_stat_gtxpf_lo < pstats->mac_stx[0].tx_stat_flowcontroldone_lo) { diff.hi = new->tx_stat_gtxpf_hi - pstats->mac_stx[0].tx_stat_flowcontroldone_hi; if (diff.hi != 0U) { diff.hi = diff.hi - 1U; diff.lo = (new->tx_stat_gtxpf_lo + ~ pstats->mac_stx[0].tx_stat_flowcontroldone_lo) + 1U; } else { diff.hi = 0U; diff.lo = 0U; } } else if (new->tx_stat_gtxpf_hi < pstats->mac_stx[0].tx_stat_flowcontroldone_hi) { diff.hi = 0U; diff.lo = 0U; } else { diff.hi = new->tx_stat_gtxpf_hi - pstats->mac_stx[0].tx_stat_flowcontroldone_hi; diff.lo = new->tx_stat_gtxpf_lo - pstats->mac_stx[0].tx_stat_flowcontroldone_lo; } pstats->mac_stx[0].tx_stat_flowcontroldone_hi = new->tx_stat_gtxpf_hi; pstats->mac_stx[0].tx_stat_flowcontroldone_lo = new->tx_stat_gtxpf_lo; pstats->mac_stx[1].tx_stat_flowcontroldone_lo = pstats->mac_stx[1].tx_stat_flowcontroldone_lo + diff.lo; pstats->mac_stx[1].tx_stat_flowcontroldone_hi = pstats->mac_stx[1].tx_stat_flowcontroldone_hi + (diff.hi + (pstats->mac_stx[1].tx_stat_flowcontroldone_lo < diff.lo ? 1U : 0U)); if (new->tx_stat_gt64_lo < pstats->mac_stx[0].tx_stat_etherstatspkts64octets_lo) { diff.hi = new->tx_stat_gt64_hi - pstats->mac_stx[0].tx_stat_etherstatspkts64octets_hi; if (diff.hi != 0U) { diff.hi = diff.hi - 1U; diff.lo = (new->tx_stat_gt64_lo + ~ pstats->mac_stx[0].tx_stat_etherstatspkts64octets_lo) + 1U; } else { diff.hi = 0U; diff.lo = 0U; } } else if (new->tx_stat_gt64_hi < pstats->mac_stx[0].tx_stat_etherstatspkts64octets_hi) { diff.hi = 0U; diff.lo = 0U; } else { diff.hi = new->tx_stat_gt64_hi - pstats->mac_stx[0].tx_stat_etherstatspkts64octets_hi; diff.lo = new->tx_stat_gt64_lo - pstats->mac_stx[0].tx_stat_etherstatspkts64octets_lo; } pstats->mac_stx[0].tx_stat_etherstatspkts64octets_hi = new->tx_stat_gt64_hi; pstats->mac_stx[0].tx_stat_etherstatspkts64octets_lo = new->tx_stat_gt64_lo; pstats->mac_stx[1].tx_stat_etherstatspkts64octets_lo = pstats->mac_stx[1].tx_stat_etherstatspkts64octets_lo + diff.lo; pstats->mac_stx[1].tx_stat_etherstatspkts64octets_hi = pstats->mac_stx[1].tx_stat_etherstatspkts64octets_hi + (diff.hi + (pstats->mac_stx[1].tx_stat_etherstatspkts64octets_lo < diff.lo ? 1U : 0U)); if (new->tx_stat_gt127_lo < pstats->mac_stx[0].tx_stat_etherstatspkts65octetsto127octets_lo) { diff.hi = new->tx_stat_gt127_hi - pstats->mac_stx[0].tx_stat_etherstatspkts65octetsto127octets_hi; if (diff.hi != 0U) { diff.hi = diff.hi - 1U; diff.lo = (new->tx_stat_gt127_lo + ~ pstats->mac_stx[0].tx_stat_etherstatspkts65octetsto127octets_lo) + 1U; } else { diff.hi = 0U; diff.lo = 0U; } } else if (new->tx_stat_gt127_hi < pstats->mac_stx[0].tx_stat_etherstatspkts65octetsto127octets_hi) { diff.hi = 0U; diff.lo = 0U; } else { diff.hi = new->tx_stat_gt127_hi - pstats->mac_stx[0].tx_stat_etherstatspkts65octetsto127octets_hi; diff.lo = new->tx_stat_gt127_lo - pstats->mac_stx[0].tx_stat_etherstatspkts65octetsto127octets_lo; } pstats->mac_stx[0].tx_stat_etherstatspkts65octetsto127octets_hi = new->tx_stat_gt127_hi; pstats->mac_stx[0].tx_stat_etherstatspkts65octetsto127octets_lo = new->tx_stat_gt127_lo; pstats->mac_stx[1].tx_stat_etherstatspkts65octetsto127octets_lo = pstats->mac_stx[1].tx_stat_etherstatspkts65octetsto127octets_lo + diff.lo; pstats->mac_stx[1].tx_stat_etherstatspkts65octetsto127octets_hi = pstats->mac_stx[1].tx_stat_etherstatspkts65octetsto127octets_hi + (diff.hi + (pstats->mac_stx[1].tx_stat_etherstatspkts65octetsto127octets_lo < diff.lo ? 1U : 0U)); if (new->tx_stat_gt255_lo < pstats->mac_stx[0].tx_stat_etherstatspkts128octetsto255octets_lo) { diff.hi = new->tx_stat_gt255_hi - pstats->mac_stx[0].tx_stat_etherstatspkts128octetsto255octets_hi; if (diff.hi != 0U) { diff.hi = diff.hi - 1U; diff.lo = (new->tx_stat_gt255_lo + ~ pstats->mac_stx[0].tx_stat_etherstatspkts128octetsto255octets_lo) + 1U; } else { diff.hi = 0U; diff.lo = 0U; } } else if (new->tx_stat_gt255_hi < pstats->mac_stx[0].tx_stat_etherstatspkts128octetsto255octets_hi) { diff.hi = 0U; diff.lo = 0U; } else { diff.hi = new->tx_stat_gt255_hi - pstats->mac_stx[0].tx_stat_etherstatspkts128octetsto255octets_hi; diff.lo = new->tx_stat_gt255_lo - pstats->mac_stx[0].tx_stat_etherstatspkts128octetsto255octets_lo; } pstats->mac_stx[0].tx_stat_etherstatspkts128octetsto255octets_hi = new->tx_stat_gt255_hi; pstats->mac_stx[0].tx_stat_etherstatspkts128octetsto255octets_lo = new->tx_stat_gt255_lo; pstats->mac_stx[1].tx_stat_etherstatspkts128octetsto255octets_lo = pstats->mac_stx[1].tx_stat_etherstatspkts128octetsto255octets_lo + diff.lo; pstats->mac_stx[1].tx_stat_etherstatspkts128octetsto255octets_hi = pstats->mac_stx[1].tx_stat_etherstatspkts128octetsto255octets_hi + (diff.hi + (pstats->mac_stx[1].tx_stat_etherstatspkts128octetsto255octets_lo < diff.lo ? 1U : 0U)); if (new->tx_stat_gt511_lo < pstats->mac_stx[0].tx_stat_etherstatspkts256octetsto511octets_lo) { diff.hi = new->tx_stat_gt511_hi - pstats->mac_stx[0].tx_stat_etherstatspkts256octetsto511octets_hi; if (diff.hi != 0U) { diff.hi = diff.hi - 1U; diff.lo = (new->tx_stat_gt511_lo + ~ pstats->mac_stx[0].tx_stat_etherstatspkts256octetsto511octets_lo) + 1U; } else { diff.hi = 0U; diff.lo = 0U; } } else if (new->tx_stat_gt511_hi < pstats->mac_stx[0].tx_stat_etherstatspkts256octetsto511octets_hi) { diff.hi = 0U; diff.lo = 0U; } else { diff.hi = new->tx_stat_gt511_hi - pstats->mac_stx[0].tx_stat_etherstatspkts256octetsto511octets_hi; diff.lo = new->tx_stat_gt511_lo - pstats->mac_stx[0].tx_stat_etherstatspkts256octetsto511octets_lo; } pstats->mac_stx[0].tx_stat_etherstatspkts256octetsto511octets_hi = new->tx_stat_gt511_hi; pstats->mac_stx[0].tx_stat_etherstatspkts256octetsto511octets_lo = new->tx_stat_gt511_lo; pstats->mac_stx[1].tx_stat_etherstatspkts256octetsto511octets_lo = pstats->mac_stx[1].tx_stat_etherstatspkts256octetsto511octets_lo + diff.lo; pstats->mac_stx[1].tx_stat_etherstatspkts256octetsto511octets_hi = pstats->mac_stx[1].tx_stat_etherstatspkts256octetsto511octets_hi + (diff.hi + (pstats->mac_stx[1].tx_stat_etherstatspkts256octetsto511octets_lo < diff.lo ? 1U : 0U)); if (new->tx_stat_gt1023_lo < pstats->mac_stx[0].tx_stat_etherstatspkts512octetsto1023octets_lo) { diff.hi = new->tx_stat_gt1023_hi - pstats->mac_stx[0].tx_stat_etherstatspkts512octetsto1023octets_hi; if (diff.hi != 0U) { diff.hi = diff.hi - 1U; diff.lo = (new->tx_stat_gt1023_lo + ~ pstats->mac_stx[0].tx_stat_etherstatspkts512octetsto1023octets_lo) + 1U; } else { diff.hi = 0U; diff.lo = 0U; } } else if (new->tx_stat_gt1023_hi < pstats->mac_stx[0].tx_stat_etherstatspkts512octetsto1023octets_hi) { diff.hi = 0U; diff.lo = 0U; } else { diff.hi = new->tx_stat_gt1023_hi - pstats->mac_stx[0].tx_stat_etherstatspkts512octetsto1023octets_hi; diff.lo = new->tx_stat_gt1023_lo - pstats->mac_stx[0].tx_stat_etherstatspkts512octetsto1023octets_lo; } pstats->mac_stx[0].tx_stat_etherstatspkts512octetsto1023octets_hi = new->tx_stat_gt1023_hi; pstats->mac_stx[0].tx_stat_etherstatspkts512octetsto1023octets_lo = new->tx_stat_gt1023_lo; pstats->mac_stx[1].tx_stat_etherstatspkts512octetsto1023octets_lo = pstats->mac_stx[1].tx_stat_etherstatspkts512octetsto1023octets_lo + diff.lo; pstats->mac_stx[1].tx_stat_etherstatspkts512octetsto1023octets_hi = pstats->mac_stx[1].tx_stat_etherstatspkts512octetsto1023octets_hi + (diff.hi + (pstats->mac_stx[1].tx_stat_etherstatspkts512octetsto1023octets_lo < diff.lo ? 1U : 0U)); if (new->tx_stat_gt1518_lo < pstats->mac_stx[0].tx_stat_etherstatspkts1024octetsto1522octets_lo) { diff.hi = new->tx_stat_gt1518_hi - pstats->mac_stx[0].tx_stat_etherstatspkts1024octetsto1522octets_hi; if (diff.hi != 0U) { diff.hi = diff.hi - 1U; diff.lo = (new->tx_stat_gt1518_lo + ~ pstats->mac_stx[0].tx_stat_etherstatspkts1024octetsto1522octets_lo) + 1U; } else { diff.hi = 0U; diff.lo = 0U; } } else if (new->tx_stat_gt1518_hi < pstats->mac_stx[0].tx_stat_etherstatspkts1024octetsto1522octets_hi) { diff.hi = 0U; diff.lo = 0U; } else { diff.hi = new->tx_stat_gt1518_hi - pstats->mac_stx[0].tx_stat_etherstatspkts1024octetsto1522octets_hi; diff.lo = new->tx_stat_gt1518_lo - pstats->mac_stx[0].tx_stat_etherstatspkts1024octetsto1522octets_lo; } pstats->mac_stx[0].tx_stat_etherstatspkts1024octetsto1522octets_hi = new->tx_stat_gt1518_hi; pstats->mac_stx[0].tx_stat_etherstatspkts1024octetsto1522octets_lo = new->tx_stat_gt1518_lo; pstats->mac_stx[1].tx_stat_etherstatspkts1024octetsto1522octets_lo = pstats->mac_stx[1].tx_stat_etherstatspkts1024octetsto1522octets_lo + diff.lo; pstats->mac_stx[1].tx_stat_etherstatspkts1024octetsto1522octets_hi = pstats->mac_stx[1].tx_stat_etherstatspkts1024octetsto1522octets_hi + (diff.hi + (pstats->mac_stx[1].tx_stat_etherstatspkts1024octetsto1522octets_lo < diff.lo ? 1U : 0U)); if (new->tx_stat_gt2047_lo < pstats->mac_stx[0].tx_stat_mac_2047_lo) { diff.hi = new->tx_stat_gt2047_hi - pstats->mac_stx[0].tx_stat_mac_2047_hi; if (diff.hi != 0U) { diff.hi = diff.hi - 1U; diff.lo = (new->tx_stat_gt2047_lo + ~ pstats->mac_stx[0].tx_stat_mac_2047_lo) + 1U; } else { diff.hi = 0U; diff.lo = 0U; } } else if (new->tx_stat_gt2047_hi < pstats->mac_stx[0].tx_stat_mac_2047_hi) { diff.hi = 0U; diff.lo = 0U; } else { diff.hi = new->tx_stat_gt2047_hi - pstats->mac_stx[0].tx_stat_mac_2047_hi; diff.lo = new->tx_stat_gt2047_lo - pstats->mac_stx[0].tx_stat_mac_2047_lo; } pstats->mac_stx[0].tx_stat_mac_2047_hi = new->tx_stat_gt2047_hi; pstats->mac_stx[0].tx_stat_mac_2047_lo = new->tx_stat_gt2047_lo; pstats->mac_stx[1].tx_stat_mac_2047_lo = pstats->mac_stx[1].tx_stat_mac_2047_lo + diff.lo; pstats->mac_stx[1].tx_stat_mac_2047_hi = pstats->mac_stx[1].tx_stat_mac_2047_hi + (diff.hi + (pstats->mac_stx[1].tx_stat_mac_2047_lo < diff.lo ? 1U : 0U)); if (new->tx_stat_gt4095_lo < pstats->mac_stx[0].tx_stat_mac_4095_lo) { diff.hi = new->tx_stat_gt4095_hi - pstats->mac_stx[0].tx_stat_mac_4095_hi; if (diff.hi != 0U) { diff.hi = diff.hi - 1U; diff.lo = (new->tx_stat_gt4095_lo + ~ pstats->mac_stx[0].tx_stat_mac_4095_lo) + 1U; } else { diff.hi = 0U; diff.lo = 0U; } } else if (new->tx_stat_gt4095_hi < pstats->mac_stx[0].tx_stat_mac_4095_hi) { diff.hi = 0U; diff.lo = 0U; } else { diff.hi = new->tx_stat_gt4095_hi - pstats->mac_stx[0].tx_stat_mac_4095_hi; diff.lo = new->tx_stat_gt4095_lo - pstats->mac_stx[0].tx_stat_mac_4095_lo; } pstats->mac_stx[0].tx_stat_mac_4095_hi = new->tx_stat_gt4095_hi; pstats->mac_stx[0].tx_stat_mac_4095_lo = new->tx_stat_gt4095_lo; pstats->mac_stx[1].tx_stat_mac_4095_lo = pstats->mac_stx[1].tx_stat_mac_4095_lo + diff.lo; pstats->mac_stx[1].tx_stat_mac_4095_hi = pstats->mac_stx[1].tx_stat_mac_4095_hi + (diff.hi + (pstats->mac_stx[1].tx_stat_mac_4095_lo < diff.lo ? 1U : 0U)); if (new->tx_stat_gt9216_lo < pstats->mac_stx[0].tx_stat_mac_9216_lo) { diff.hi = new->tx_stat_gt9216_hi - pstats->mac_stx[0].tx_stat_mac_9216_hi; if (diff.hi != 0U) { diff.hi = diff.hi - 1U; diff.lo = (new->tx_stat_gt9216_lo + ~ pstats->mac_stx[0].tx_stat_mac_9216_lo) + 1U; } else { diff.hi = 0U; diff.lo = 0U; } } else if (new->tx_stat_gt9216_hi < pstats->mac_stx[0].tx_stat_mac_9216_hi) { diff.hi = 0U; diff.lo = 0U; } else { diff.hi = new->tx_stat_gt9216_hi - pstats->mac_stx[0].tx_stat_mac_9216_hi; diff.lo = new->tx_stat_gt9216_lo - pstats->mac_stx[0].tx_stat_mac_9216_lo; } pstats->mac_stx[0].tx_stat_mac_9216_hi = new->tx_stat_gt9216_hi; pstats->mac_stx[0].tx_stat_mac_9216_lo = new->tx_stat_gt9216_lo; pstats->mac_stx[1].tx_stat_mac_9216_lo = pstats->mac_stx[1].tx_stat_mac_9216_lo + diff.lo; pstats->mac_stx[1].tx_stat_mac_9216_hi = pstats->mac_stx[1].tx_stat_mac_9216_hi + (diff.hi + (pstats->mac_stx[1].tx_stat_mac_9216_lo < diff.lo ? 1U : 0U)); if (new->tx_stat_gt16383_lo < pstats->mac_stx[0].tx_stat_mac_16383_lo) { diff.hi = new->tx_stat_gt16383_hi - pstats->mac_stx[0].tx_stat_mac_16383_hi; if (diff.hi != 0U) { diff.hi = diff.hi - 1U; diff.lo = (new->tx_stat_gt16383_lo + ~ pstats->mac_stx[0].tx_stat_mac_16383_lo) + 1U; } else { diff.hi = 0U; diff.lo = 0U; } } else if (new->tx_stat_gt16383_hi < pstats->mac_stx[0].tx_stat_mac_16383_hi) { diff.hi = 0U; diff.lo = 0U; } else { diff.hi = new->tx_stat_gt16383_hi - pstats->mac_stx[0].tx_stat_mac_16383_hi; diff.lo = new->tx_stat_gt16383_lo - pstats->mac_stx[0].tx_stat_mac_16383_lo; } pstats->mac_stx[0].tx_stat_mac_16383_hi = new->tx_stat_gt16383_hi; pstats->mac_stx[0].tx_stat_mac_16383_lo = new->tx_stat_gt16383_lo; pstats->mac_stx[1].tx_stat_mac_16383_lo = pstats->mac_stx[1].tx_stat_mac_16383_lo + diff.lo; pstats->mac_stx[1].tx_stat_mac_16383_hi = pstats->mac_stx[1].tx_stat_mac_16383_hi + (diff.hi + (pstats->mac_stx[1].tx_stat_mac_16383_lo < diff.lo ? 1U : 0U)); if (new->tx_stat_gterr_lo < pstats->mac_stx[0].tx_stat_dot3statsinternalmactransmiterrors_lo) { diff.hi = new->tx_stat_gterr_hi - pstats->mac_stx[0].tx_stat_dot3statsinternalmactransmiterrors_hi; if (diff.hi != 0U) { diff.hi = diff.hi - 1U; diff.lo = (new->tx_stat_gterr_lo + ~ pstats->mac_stx[0].tx_stat_dot3statsinternalmactransmiterrors_lo) + 1U; } else { diff.hi = 0U; diff.lo = 0U; } } else if (new->tx_stat_gterr_hi < pstats->mac_stx[0].tx_stat_dot3statsinternalmactransmiterrors_hi) { diff.hi = 0U; diff.lo = 0U; } else { diff.hi = new->tx_stat_gterr_hi - pstats->mac_stx[0].tx_stat_dot3statsinternalmactransmiterrors_hi; diff.lo = new->tx_stat_gterr_lo - pstats->mac_stx[0].tx_stat_dot3statsinternalmactransmiterrors_lo; } pstats->mac_stx[0].tx_stat_dot3statsinternalmactransmiterrors_hi = new->tx_stat_gterr_hi; pstats->mac_stx[0].tx_stat_dot3statsinternalmactransmiterrors_lo = new->tx_stat_gterr_lo; pstats->mac_stx[1].tx_stat_dot3statsinternalmactransmiterrors_lo = pstats->mac_stx[1].tx_stat_dot3statsinternalmactransmiterrors_lo + diff.lo; pstats->mac_stx[1].tx_stat_dot3statsinternalmactransmiterrors_hi = pstats->mac_stx[1].tx_stat_dot3statsinternalmactransmiterrors_hi + (diff.hi + (pstats->mac_stx[1].tx_stat_dot3statsinternalmactransmiterrors_lo < diff.lo ? 1U : 0U)); if (new->tx_stat_gtufl_lo < pstats->mac_stx[0].tx_stat_mac_ufl_lo) { diff.hi = new->tx_stat_gtufl_hi - pstats->mac_stx[0].tx_stat_mac_ufl_hi; if (diff.hi != 0U) { diff.hi = diff.hi - 1U; diff.lo = (new->tx_stat_gtufl_lo + ~ pstats->mac_stx[0].tx_stat_mac_ufl_lo) + 1U; } else { diff.hi = 0U; diff.lo = 0U; } } else if (new->tx_stat_gtufl_hi < pstats->mac_stx[0].tx_stat_mac_ufl_hi) { diff.hi = 0U; diff.lo = 0U; } else { diff.hi = new->tx_stat_gtufl_hi - pstats->mac_stx[0].tx_stat_mac_ufl_hi; diff.lo = new->tx_stat_gtufl_lo - pstats->mac_stx[0].tx_stat_mac_ufl_lo; } pstats->mac_stx[0].tx_stat_mac_ufl_hi = new->tx_stat_gtufl_hi; pstats->mac_stx[0].tx_stat_mac_ufl_lo = new->tx_stat_gtufl_lo; pstats->mac_stx[1].tx_stat_mac_ufl_lo = pstats->mac_stx[1].tx_stat_mac_ufl_lo + diff.lo; pstats->mac_stx[1].tx_stat_mac_ufl_hi = pstats->mac_stx[1].tx_stat_mac_ufl_hi + (diff.hi + (pstats->mac_stx[1].tx_stat_mac_ufl_lo < diff.lo ? 1U : 0U)); } else { new___0 = & (bp->slowpath)->mac_stats.bmac2_stats; if (new___0->rx_stat_grerb_lo < pstats->mac_stx[0].rx_stat_ifhcinbadoctets_lo) { diff.hi = new___0->rx_stat_grerb_hi - pstats->mac_stx[0].rx_stat_ifhcinbadoctets_hi; if (diff.hi != 0U) { diff.hi = diff.hi - 1U; diff.lo = (new___0->rx_stat_grerb_lo + ~ pstats->mac_stx[0].rx_stat_ifhcinbadoctets_lo) + 1U; } else { diff.hi = 0U; diff.lo = 0U; } } else if (new___0->rx_stat_grerb_hi < pstats->mac_stx[0].rx_stat_ifhcinbadoctets_hi) { diff.hi = 0U; diff.lo = 0U; } else { diff.hi = new___0->rx_stat_grerb_hi - pstats->mac_stx[0].rx_stat_ifhcinbadoctets_hi; diff.lo = new___0->rx_stat_grerb_lo - pstats->mac_stx[0].rx_stat_ifhcinbadoctets_lo; } pstats->mac_stx[0].rx_stat_ifhcinbadoctets_hi = new___0->rx_stat_grerb_hi; pstats->mac_stx[0].rx_stat_ifhcinbadoctets_lo = new___0->rx_stat_grerb_lo; pstats->mac_stx[1].rx_stat_ifhcinbadoctets_lo = pstats->mac_stx[1].rx_stat_ifhcinbadoctets_lo + diff.lo; pstats->mac_stx[1].rx_stat_ifhcinbadoctets_hi = pstats->mac_stx[1].rx_stat_ifhcinbadoctets_hi + (diff.hi + (pstats->mac_stx[1].rx_stat_ifhcinbadoctets_lo < diff.lo ? 1U : 0U)); if (new___0->rx_stat_grfcs_lo < pstats->mac_stx[0].rx_stat_dot3statsfcserrors_lo) { diff.hi = new___0->rx_stat_grfcs_hi - pstats->mac_stx[0].rx_stat_dot3statsfcserrors_hi; if (diff.hi != 0U) { diff.hi = diff.hi - 1U; diff.lo = (new___0->rx_stat_grfcs_lo + ~ pstats->mac_stx[0].rx_stat_dot3statsfcserrors_lo) + 1U; } else { diff.hi = 0U; diff.lo = 0U; } } else if (new___0->rx_stat_grfcs_hi < pstats->mac_stx[0].rx_stat_dot3statsfcserrors_hi) { diff.hi = 0U; diff.lo = 0U; } else { diff.hi = new___0->rx_stat_grfcs_hi - pstats->mac_stx[0].rx_stat_dot3statsfcserrors_hi; diff.lo = new___0->rx_stat_grfcs_lo - pstats->mac_stx[0].rx_stat_dot3statsfcserrors_lo; } pstats->mac_stx[0].rx_stat_dot3statsfcserrors_hi = new___0->rx_stat_grfcs_hi; pstats->mac_stx[0].rx_stat_dot3statsfcserrors_lo = new___0->rx_stat_grfcs_lo; pstats->mac_stx[1].rx_stat_dot3statsfcserrors_lo = pstats->mac_stx[1].rx_stat_dot3statsfcserrors_lo + diff.lo; pstats->mac_stx[1].rx_stat_dot3statsfcserrors_hi = pstats->mac_stx[1].rx_stat_dot3statsfcserrors_hi + (diff.hi + (pstats->mac_stx[1].rx_stat_dot3statsfcserrors_lo < diff.lo ? 1U : 0U)); if (new___0->rx_stat_grund_lo < pstats->mac_stx[0].rx_stat_etherstatsundersizepkts_lo) { diff.hi = new___0->rx_stat_grund_hi - pstats->mac_stx[0].rx_stat_etherstatsundersizepkts_hi; if (diff.hi != 0U) { diff.hi = diff.hi - 1U; diff.lo = (new___0->rx_stat_grund_lo + ~ pstats->mac_stx[0].rx_stat_etherstatsundersizepkts_lo) + 1U; } else { diff.hi = 0U; diff.lo = 0U; } } else if (new___0->rx_stat_grund_hi < pstats->mac_stx[0].rx_stat_etherstatsundersizepkts_hi) { diff.hi = 0U; diff.lo = 0U; } else { diff.hi = new___0->rx_stat_grund_hi - pstats->mac_stx[0].rx_stat_etherstatsundersizepkts_hi; diff.lo = new___0->rx_stat_grund_lo - pstats->mac_stx[0].rx_stat_etherstatsundersizepkts_lo; } pstats->mac_stx[0].rx_stat_etherstatsundersizepkts_hi = new___0->rx_stat_grund_hi; pstats->mac_stx[0].rx_stat_etherstatsundersizepkts_lo = new___0->rx_stat_grund_lo; pstats->mac_stx[1].rx_stat_etherstatsundersizepkts_lo = pstats->mac_stx[1].rx_stat_etherstatsundersizepkts_lo + diff.lo; pstats->mac_stx[1].rx_stat_etherstatsundersizepkts_hi = pstats->mac_stx[1].rx_stat_etherstatsundersizepkts_hi + (diff.hi + (pstats->mac_stx[1].rx_stat_etherstatsundersizepkts_lo < diff.lo ? 1U : 0U)); if (new___0->rx_stat_grovr_lo < pstats->mac_stx[0].rx_stat_dot3statsframestoolong_lo) { diff.hi = new___0->rx_stat_grovr_hi - pstats->mac_stx[0].rx_stat_dot3statsframestoolong_hi; if (diff.hi != 0U) { diff.hi = diff.hi - 1U; diff.lo = (new___0->rx_stat_grovr_lo + ~ pstats->mac_stx[0].rx_stat_dot3statsframestoolong_lo) + 1U; } else { diff.hi = 0U; diff.lo = 0U; } } else if (new___0->rx_stat_grovr_hi < pstats->mac_stx[0].rx_stat_dot3statsframestoolong_hi) { diff.hi = 0U; diff.lo = 0U; } else { diff.hi = new___0->rx_stat_grovr_hi - pstats->mac_stx[0].rx_stat_dot3statsframestoolong_hi; diff.lo = new___0->rx_stat_grovr_lo - pstats->mac_stx[0].rx_stat_dot3statsframestoolong_lo; } pstats->mac_stx[0].rx_stat_dot3statsframestoolong_hi = new___0->rx_stat_grovr_hi; pstats->mac_stx[0].rx_stat_dot3statsframestoolong_lo = new___0->rx_stat_grovr_lo; pstats->mac_stx[1].rx_stat_dot3statsframestoolong_lo = pstats->mac_stx[1].rx_stat_dot3statsframestoolong_lo + diff.lo; pstats->mac_stx[1].rx_stat_dot3statsframestoolong_hi = pstats->mac_stx[1].rx_stat_dot3statsframestoolong_hi + (diff.hi + (pstats->mac_stx[1].rx_stat_dot3statsframestoolong_lo < diff.lo ? 1U : 0U)); if (new___0->rx_stat_grfrg_lo < pstats->mac_stx[0].rx_stat_etherstatsfragments_lo) { diff.hi = new___0->rx_stat_grfrg_hi - pstats->mac_stx[0].rx_stat_etherstatsfragments_hi; if (diff.hi != 0U) { diff.hi = diff.hi - 1U; diff.lo = (new___0->rx_stat_grfrg_lo + ~ pstats->mac_stx[0].rx_stat_etherstatsfragments_lo) + 1U; } else { diff.hi = 0U; diff.lo = 0U; } } else if (new___0->rx_stat_grfrg_hi < pstats->mac_stx[0].rx_stat_etherstatsfragments_hi) { diff.hi = 0U; diff.lo = 0U; } else { diff.hi = new___0->rx_stat_grfrg_hi - pstats->mac_stx[0].rx_stat_etherstatsfragments_hi; diff.lo = new___0->rx_stat_grfrg_lo - pstats->mac_stx[0].rx_stat_etherstatsfragments_lo; } pstats->mac_stx[0].rx_stat_etherstatsfragments_hi = new___0->rx_stat_grfrg_hi; pstats->mac_stx[0].rx_stat_etherstatsfragments_lo = new___0->rx_stat_grfrg_lo; pstats->mac_stx[1].rx_stat_etherstatsfragments_lo = pstats->mac_stx[1].rx_stat_etherstatsfragments_lo + diff.lo; pstats->mac_stx[1].rx_stat_etherstatsfragments_hi = pstats->mac_stx[1].rx_stat_etherstatsfragments_hi + (diff.hi + (pstats->mac_stx[1].rx_stat_etherstatsfragments_lo < diff.lo ? 1U : 0U)); if (new___0->rx_stat_grjbr_lo < pstats->mac_stx[0].rx_stat_etherstatsjabbers_lo) { diff.hi = new___0->rx_stat_grjbr_hi - pstats->mac_stx[0].rx_stat_etherstatsjabbers_hi; if (diff.hi != 0U) { diff.hi = diff.hi - 1U; diff.lo = (new___0->rx_stat_grjbr_lo + ~ pstats->mac_stx[0].rx_stat_etherstatsjabbers_lo) + 1U; } else { diff.hi = 0U; diff.lo = 0U; } } else if (new___0->rx_stat_grjbr_hi < pstats->mac_stx[0].rx_stat_etherstatsjabbers_hi) { diff.hi = 0U; diff.lo = 0U; } else { diff.hi = new___0->rx_stat_grjbr_hi - pstats->mac_stx[0].rx_stat_etherstatsjabbers_hi; diff.lo = new___0->rx_stat_grjbr_lo - pstats->mac_stx[0].rx_stat_etherstatsjabbers_lo; } pstats->mac_stx[0].rx_stat_etherstatsjabbers_hi = new___0->rx_stat_grjbr_hi; pstats->mac_stx[0].rx_stat_etherstatsjabbers_lo = new___0->rx_stat_grjbr_lo; pstats->mac_stx[1].rx_stat_etherstatsjabbers_lo = pstats->mac_stx[1].rx_stat_etherstatsjabbers_lo + diff.lo; pstats->mac_stx[1].rx_stat_etherstatsjabbers_hi = pstats->mac_stx[1].rx_stat_etherstatsjabbers_hi + (diff.hi + (pstats->mac_stx[1].rx_stat_etherstatsjabbers_lo < diff.lo ? 1U : 0U)); if (new___0->rx_stat_grxcf_lo < pstats->mac_stx[0].rx_stat_maccontrolframesreceived_lo) { diff.hi = new___0->rx_stat_grxcf_hi - pstats->mac_stx[0].rx_stat_maccontrolframesreceived_hi; if (diff.hi != 0U) { diff.hi = diff.hi - 1U; diff.lo = (new___0->rx_stat_grxcf_lo + ~ pstats->mac_stx[0].rx_stat_maccontrolframesreceived_lo) + 1U; } else { diff.hi = 0U; diff.lo = 0U; } } else if (new___0->rx_stat_grxcf_hi < pstats->mac_stx[0].rx_stat_maccontrolframesreceived_hi) { diff.hi = 0U; diff.lo = 0U; } else { diff.hi = new___0->rx_stat_grxcf_hi - pstats->mac_stx[0].rx_stat_maccontrolframesreceived_hi; diff.lo = new___0->rx_stat_grxcf_lo - pstats->mac_stx[0].rx_stat_maccontrolframesreceived_lo; } pstats->mac_stx[0].rx_stat_maccontrolframesreceived_hi = new___0->rx_stat_grxcf_hi; pstats->mac_stx[0].rx_stat_maccontrolframesreceived_lo = new___0->rx_stat_grxcf_lo; pstats->mac_stx[1].rx_stat_maccontrolframesreceived_lo = pstats->mac_stx[1].rx_stat_maccontrolframesreceived_lo + diff.lo; pstats->mac_stx[1].rx_stat_maccontrolframesreceived_hi = pstats->mac_stx[1].rx_stat_maccontrolframesreceived_hi + (diff.hi + (pstats->mac_stx[1].rx_stat_maccontrolframesreceived_lo < diff.lo ? 1U : 0U)); if (new___0->rx_stat_grxpf_lo < pstats->mac_stx[0].rx_stat_xoffstateentered_lo) { diff.hi = new___0->rx_stat_grxpf_hi - pstats->mac_stx[0].rx_stat_xoffstateentered_hi; if (diff.hi != 0U) { diff.hi = diff.hi - 1U; diff.lo = (new___0->rx_stat_grxpf_lo + ~ pstats->mac_stx[0].rx_stat_xoffstateentered_lo) + 1U; } else { diff.hi = 0U; diff.lo = 0U; } } else if (new___0->rx_stat_grxpf_hi < pstats->mac_stx[0].rx_stat_xoffstateentered_hi) { diff.hi = 0U; diff.lo = 0U; } else { diff.hi = new___0->rx_stat_grxpf_hi - pstats->mac_stx[0].rx_stat_xoffstateentered_hi; diff.lo = new___0->rx_stat_grxpf_lo - pstats->mac_stx[0].rx_stat_xoffstateentered_lo; } pstats->mac_stx[0].rx_stat_xoffstateentered_hi = new___0->rx_stat_grxpf_hi; pstats->mac_stx[0].rx_stat_xoffstateentered_lo = new___0->rx_stat_grxpf_lo; pstats->mac_stx[1].rx_stat_xoffstateentered_lo = pstats->mac_stx[1].rx_stat_xoffstateentered_lo + diff.lo; pstats->mac_stx[1].rx_stat_xoffstateentered_hi = pstats->mac_stx[1].rx_stat_xoffstateentered_hi + (diff.hi + (pstats->mac_stx[1].rx_stat_xoffstateentered_lo < diff.lo ? 1U : 0U)); if (new___0->rx_stat_grxpf_lo < pstats->mac_stx[0].rx_stat_mac_xpf_lo) { diff.hi = new___0->rx_stat_grxpf_hi - pstats->mac_stx[0].rx_stat_mac_xpf_hi; if (diff.hi != 0U) { diff.hi = diff.hi - 1U; diff.lo = (new___0->rx_stat_grxpf_lo + ~ pstats->mac_stx[0].rx_stat_mac_xpf_lo) + 1U; } else { diff.hi = 0U; diff.lo = 0U; } } else if (new___0->rx_stat_grxpf_hi < pstats->mac_stx[0].rx_stat_mac_xpf_hi) { diff.hi = 0U; diff.lo = 0U; } else { diff.hi = new___0->rx_stat_grxpf_hi - pstats->mac_stx[0].rx_stat_mac_xpf_hi; diff.lo = new___0->rx_stat_grxpf_lo - pstats->mac_stx[0].rx_stat_mac_xpf_lo; } pstats->mac_stx[0].rx_stat_mac_xpf_hi = new___0->rx_stat_grxpf_hi; pstats->mac_stx[0].rx_stat_mac_xpf_lo = new___0->rx_stat_grxpf_lo; pstats->mac_stx[1].rx_stat_mac_xpf_lo = pstats->mac_stx[1].rx_stat_mac_xpf_lo + diff.lo; pstats->mac_stx[1].rx_stat_mac_xpf_hi = pstats->mac_stx[1].rx_stat_mac_xpf_hi + (diff.hi + (pstats->mac_stx[1].rx_stat_mac_xpf_lo < diff.lo ? 1U : 0U)); if (new___0->tx_stat_gtxpf_lo < pstats->mac_stx[0].tx_stat_outxoffsent_lo) { diff.hi = new___0->tx_stat_gtxpf_hi - pstats->mac_stx[0].tx_stat_outxoffsent_hi; if (diff.hi != 0U) { diff.hi = diff.hi - 1U; diff.lo = (new___0->tx_stat_gtxpf_lo + ~ pstats->mac_stx[0].tx_stat_outxoffsent_lo) + 1U; } else { diff.hi = 0U; diff.lo = 0U; } } else if (new___0->tx_stat_gtxpf_hi < pstats->mac_stx[0].tx_stat_outxoffsent_hi) { diff.hi = 0U; diff.lo = 0U; } else { diff.hi = new___0->tx_stat_gtxpf_hi - pstats->mac_stx[0].tx_stat_outxoffsent_hi; diff.lo = new___0->tx_stat_gtxpf_lo - pstats->mac_stx[0].tx_stat_outxoffsent_lo; } pstats->mac_stx[0].tx_stat_outxoffsent_hi = new___0->tx_stat_gtxpf_hi; pstats->mac_stx[0].tx_stat_outxoffsent_lo = new___0->tx_stat_gtxpf_lo; pstats->mac_stx[1].tx_stat_outxoffsent_lo = pstats->mac_stx[1].tx_stat_outxoffsent_lo + diff.lo; pstats->mac_stx[1].tx_stat_outxoffsent_hi = pstats->mac_stx[1].tx_stat_outxoffsent_hi + (diff.hi + (pstats->mac_stx[1].tx_stat_outxoffsent_lo < diff.lo ? 1U : 0U)); if (new___0->tx_stat_gtxpf_lo < pstats->mac_stx[0].tx_stat_flowcontroldone_lo) { diff.hi = new___0->tx_stat_gtxpf_hi - pstats->mac_stx[0].tx_stat_flowcontroldone_hi; if (diff.hi != 0U) { diff.hi = diff.hi - 1U; diff.lo = (new___0->tx_stat_gtxpf_lo + ~ pstats->mac_stx[0].tx_stat_flowcontroldone_lo) + 1U; } else { diff.hi = 0U; diff.lo = 0U; } } else if (new___0->tx_stat_gtxpf_hi < pstats->mac_stx[0].tx_stat_flowcontroldone_hi) { diff.hi = 0U; diff.lo = 0U; } else { diff.hi = new___0->tx_stat_gtxpf_hi - pstats->mac_stx[0].tx_stat_flowcontroldone_hi; diff.lo = new___0->tx_stat_gtxpf_lo - pstats->mac_stx[0].tx_stat_flowcontroldone_lo; } pstats->mac_stx[0].tx_stat_flowcontroldone_hi = new___0->tx_stat_gtxpf_hi; pstats->mac_stx[0].tx_stat_flowcontroldone_lo = new___0->tx_stat_gtxpf_lo; pstats->mac_stx[1].tx_stat_flowcontroldone_lo = pstats->mac_stx[1].tx_stat_flowcontroldone_lo + diff.lo; pstats->mac_stx[1].tx_stat_flowcontroldone_hi = pstats->mac_stx[1].tx_stat_flowcontroldone_hi + (diff.hi + (pstats->mac_stx[1].tx_stat_flowcontroldone_lo < diff.lo ? 1U : 0U)); if (new___0->tx_stat_gt64_lo < pstats->mac_stx[0].tx_stat_etherstatspkts64octets_lo) { diff.hi = new___0->tx_stat_gt64_hi - pstats->mac_stx[0].tx_stat_etherstatspkts64octets_hi; if (diff.hi != 0U) { diff.hi = diff.hi - 1U; diff.lo = (new___0->tx_stat_gt64_lo + ~ pstats->mac_stx[0].tx_stat_etherstatspkts64octets_lo) + 1U; } else { diff.hi = 0U; diff.lo = 0U; } } else if (new___0->tx_stat_gt64_hi < pstats->mac_stx[0].tx_stat_etherstatspkts64octets_hi) { diff.hi = 0U; diff.lo = 0U; } else { diff.hi = new___0->tx_stat_gt64_hi - pstats->mac_stx[0].tx_stat_etherstatspkts64octets_hi; diff.lo = new___0->tx_stat_gt64_lo - pstats->mac_stx[0].tx_stat_etherstatspkts64octets_lo; } pstats->mac_stx[0].tx_stat_etherstatspkts64octets_hi = new___0->tx_stat_gt64_hi; pstats->mac_stx[0].tx_stat_etherstatspkts64octets_lo = new___0->tx_stat_gt64_lo; pstats->mac_stx[1].tx_stat_etherstatspkts64octets_lo = pstats->mac_stx[1].tx_stat_etherstatspkts64octets_lo + diff.lo; pstats->mac_stx[1].tx_stat_etherstatspkts64octets_hi = pstats->mac_stx[1].tx_stat_etherstatspkts64octets_hi + (diff.hi + (pstats->mac_stx[1].tx_stat_etherstatspkts64octets_lo < diff.lo ? 1U : 0U)); if (new___0->tx_stat_gt127_lo < pstats->mac_stx[0].tx_stat_etherstatspkts65octetsto127octets_lo) { diff.hi = new___0->tx_stat_gt127_hi - pstats->mac_stx[0].tx_stat_etherstatspkts65octetsto127octets_hi; if (diff.hi != 0U) { diff.hi = diff.hi - 1U; diff.lo = (new___0->tx_stat_gt127_lo + ~ pstats->mac_stx[0].tx_stat_etherstatspkts65octetsto127octets_lo) + 1U; } else { diff.hi = 0U; diff.lo = 0U; } } else if (new___0->tx_stat_gt127_hi < pstats->mac_stx[0].tx_stat_etherstatspkts65octetsto127octets_hi) { diff.hi = 0U; diff.lo = 0U; } else { diff.hi = new___0->tx_stat_gt127_hi - pstats->mac_stx[0].tx_stat_etherstatspkts65octetsto127octets_hi; diff.lo = new___0->tx_stat_gt127_lo - pstats->mac_stx[0].tx_stat_etherstatspkts65octetsto127octets_lo; } pstats->mac_stx[0].tx_stat_etherstatspkts65octetsto127octets_hi = new___0->tx_stat_gt127_hi; pstats->mac_stx[0].tx_stat_etherstatspkts65octetsto127octets_lo = new___0->tx_stat_gt127_lo; pstats->mac_stx[1].tx_stat_etherstatspkts65octetsto127octets_lo = pstats->mac_stx[1].tx_stat_etherstatspkts65octetsto127octets_lo + diff.lo; pstats->mac_stx[1].tx_stat_etherstatspkts65octetsto127octets_hi = pstats->mac_stx[1].tx_stat_etherstatspkts65octetsto127octets_hi + (diff.hi + (pstats->mac_stx[1].tx_stat_etherstatspkts65octetsto127octets_lo < diff.lo ? 1U : 0U)); if (new___0->tx_stat_gt255_lo < pstats->mac_stx[0].tx_stat_etherstatspkts128octetsto255octets_lo) { diff.hi = new___0->tx_stat_gt255_hi - pstats->mac_stx[0].tx_stat_etherstatspkts128octetsto255octets_hi; if (diff.hi != 0U) { diff.hi = diff.hi - 1U; diff.lo = (new___0->tx_stat_gt255_lo + ~ pstats->mac_stx[0].tx_stat_etherstatspkts128octetsto255octets_lo) + 1U; } else { diff.hi = 0U; diff.lo = 0U; } } else if (new___0->tx_stat_gt255_hi < pstats->mac_stx[0].tx_stat_etherstatspkts128octetsto255octets_hi) { diff.hi = 0U; diff.lo = 0U; } else { diff.hi = new___0->tx_stat_gt255_hi - pstats->mac_stx[0].tx_stat_etherstatspkts128octetsto255octets_hi; diff.lo = new___0->tx_stat_gt255_lo - pstats->mac_stx[0].tx_stat_etherstatspkts128octetsto255octets_lo; } pstats->mac_stx[0].tx_stat_etherstatspkts128octetsto255octets_hi = new___0->tx_stat_gt255_hi; pstats->mac_stx[0].tx_stat_etherstatspkts128octetsto255octets_lo = new___0->tx_stat_gt255_lo; pstats->mac_stx[1].tx_stat_etherstatspkts128octetsto255octets_lo = pstats->mac_stx[1].tx_stat_etherstatspkts128octetsto255octets_lo + diff.lo; pstats->mac_stx[1].tx_stat_etherstatspkts128octetsto255octets_hi = pstats->mac_stx[1].tx_stat_etherstatspkts128octetsto255octets_hi + (diff.hi + (pstats->mac_stx[1].tx_stat_etherstatspkts128octetsto255octets_lo < diff.lo ? 1U : 0U)); if (new___0->tx_stat_gt511_lo < pstats->mac_stx[0].tx_stat_etherstatspkts256octetsto511octets_lo) { diff.hi = new___0->tx_stat_gt511_hi - pstats->mac_stx[0].tx_stat_etherstatspkts256octetsto511octets_hi; if (diff.hi != 0U) { diff.hi = diff.hi - 1U; diff.lo = (new___0->tx_stat_gt511_lo + ~ pstats->mac_stx[0].tx_stat_etherstatspkts256octetsto511octets_lo) + 1U; } else { diff.hi = 0U; diff.lo = 0U; } } else if (new___0->tx_stat_gt511_hi < pstats->mac_stx[0].tx_stat_etherstatspkts256octetsto511octets_hi) { diff.hi = 0U; diff.lo = 0U; } else { diff.hi = new___0->tx_stat_gt511_hi - pstats->mac_stx[0].tx_stat_etherstatspkts256octetsto511octets_hi; diff.lo = new___0->tx_stat_gt511_lo - pstats->mac_stx[0].tx_stat_etherstatspkts256octetsto511octets_lo; } pstats->mac_stx[0].tx_stat_etherstatspkts256octetsto511octets_hi = new___0->tx_stat_gt511_hi; pstats->mac_stx[0].tx_stat_etherstatspkts256octetsto511octets_lo = new___0->tx_stat_gt511_lo; pstats->mac_stx[1].tx_stat_etherstatspkts256octetsto511octets_lo = pstats->mac_stx[1].tx_stat_etherstatspkts256octetsto511octets_lo + diff.lo; pstats->mac_stx[1].tx_stat_etherstatspkts256octetsto511octets_hi = pstats->mac_stx[1].tx_stat_etherstatspkts256octetsto511octets_hi + (diff.hi + (pstats->mac_stx[1].tx_stat_etherstatspkts256octetsto511octets_lo < diff.lo ? 1U : 0U)); if (new___0->tx_stat_gt1023_lo < pstats->mac_stx[0].tx_stat_etherstatspkts512octetsto1023octets_lo) { diff.hi = new___0->tx_stat_gt1023_hi - pstats->mac_stx[0].tx_stat_etherstatspkts512octetsto1023octets_hi; if (diff.hi != 0U) { diff.hi = diff.hi - 1U; diff.lo = (new___0->tx_stat_gt1023_lo + ~ pstats->mac_stx[0].tx_stat_etherstatspkts512octetsto1023octets_lo) + 1U; } else { diff.hi = 0U; diff.lo = 0U; } } else if (new___0->tx_stat_gt1023_hi < pstats->mac_stx[0].tx_stat_etherstatspkts512octetsto1023octets_hi) { diff.hi = 0U; diff.lo = 0U; } else { diff.hi = new___0->tx_stat_gt1023_hi - pstats->mac_stx[0].tx_stat_etherstatspkts512octetsto1023octets_hi; diff.lo = new___0->tx_stat_gt1023_lo - pstats->mac_stx[0].tx_stat_etherstatspkts512octetsto1023octets_lo; } pstats->mac_stx[0].tx_stat_etherstatspkts512octetsto1023octets_hi = new___0->tx_stat_gt1023_hi; pstats->mac_stx[0].tx_stat_etherstatspkts512octetsto1023octets_lo = new___0->tx_stat_gt1023_lo; pstats->mac_stx[1].tx_stat_etherstatspkts512octetsto1023octets_lo = pstats->mac_stx[1].tx_stat_etherstatspkts512octetsto1023octets_lo + diff.lo; pstats->mac_stx[1].tx_stat_etherstatspkts512octetsto1023octets_hi = pstats->mac_stx[1].tx_stat_etherstatspkts512octetsto1023octets_hi + (diff.hi + (pstats->mac_stx[1].tx_stat_etherstatspkts512octetsto1023octets_lo < diff.lo ? 1U : 0U)); if (new___0->tx_stat_gt1518_lo < pstats->mac_stx[0].tx_stat_etherstatspkts1024octetsto1522octets_lo) { diff.hi = new___0->tx_stat_gt1518_hi - pstats->mac_stx[0].tx_stat_etherstatspkts1024octetsto1522octets_hi; if (diff.hi != 0U) { diff.hi = diff.hi - 1U; diff.lo = (new___0->tx_stat_gt1518_lo + ~ pstats->mac_stx[0].tx_stat_etherstatspkts1024octetsto1522octets_lo) + 1U; } else { diff.hi = 0U; diff.lo = 0U; } } else if (new___0->tx_stat_gt1518_hi < pstats->mac_stx[0].tx_stat_etherstatspkts1024octetsto1522octets_hi) { diff.hi = 0U; diff.lo = 0U; } else { diff.hi = new___0->tx_stat_gt1518_hi - pstats->mac_stx[0].tx_stat_etherstatspkts1024octetsto1522octets_hi; diff.lo = new___0->tx_stat_gt1518_lo - pstats->mac_stx[0].tx_stat_etherstatspkts1024octetsto1522octets_lo; } pstats->mac_stx[0].tx_stat_etherstatspkts1024octetsto1522octets_hi = new___0->tx_stat_gt1518_hi; pstats->mac_stx[0].tx_stat_etherstatspkts1024octetsto1522octets_lo = new___0->tx_stat_gt1518_lo; pstats->mac_stx[1].tx_stat_etherstatspkts1024octetsto1522octets_lo = pstats->mac_stx[1].tx_stat_etherstatspkts1024octetsto1522octets_lo + diff.lo; pstats->mac_stx[1].tx_stat_etherstatspkts1024octetsto1522octets_hi = pstats->mac_stx[1].tx_stat_etherstatspkts1024octetsto1522octets_hi + (diff.hi + (pstats->mac_stx[1].tx_stat_etherstatspkts1024octetsto1522octets_lo < diff.lo ? 1U : 0U)); if (new___0->tx_stat_gt2047_lo < pstats->mac_stx[0].tx_stat_mac_2047_lo) { diff.hi = new___0->tx_stat_gt2047_hi - pstats->mac_stx[0].tx_stat_mac_2047_hi; if (diff.hi != 0U) { diff.hi = diff.hi - 1U; diff.lo = (new___0->tx_stat_gt2047_lo + ~ pstats->mac_stx[0].tx_stat_mac_2047_lo) + 1U; } else { diff.hi = 0U; diff.lo = 0U; } } else if (new___0->tx_stat_gt2047_hi < pstats->mac_stx[0].tx_stat_mac_2047_hi) { diff.hi = 0U; diff.lo = 0U; } else { diff.hi = new___0->tx_stat_gt2047_hi - pstats->mac_stx[0].tx_stat_mac_2047_hi; diff.lo = new___0->tx_stat_gt2047_lo - pstats->mac_stx[0].tx_stat_mac_2047_lo; } pstats->mac_stx[0].tx_stat_mac_2047_hi = new___0->tx_stat_gt2047_hi; pstats->mac_stx[0].tx_stat_mac_2047_lo = new___0->tx_stat_gt2047_lo; pstats->mac_stx[1].tx_stat_mac_2047_lo = pstats->mac_stx[1].tx_stat_mac_2047_lo + diff.lo; pstats->mac_stx[1].tx_stat_mac_2047_hi = pstats->mac_stx[1].tx_stat_mac_2047_hi + (diff.hi + (pstats->mac_stx[1].tx_stat_mac_2047_lo < diff.lo ? 1U : 0U)); if (new___0->tx_stat_gt4095_lo < pstats->mac_stx[0].tx_stat_mac_4095_lo) { diff.hi = new___0->tx_stat_gt4095_hi - pstats->mac_stx[0].tx_stat_mac_4095_hi; if (diff.hi != 0U) { diff.hi = diff.hi - 1U; diff.lo = (new___0->tx_stat_gt4095_lo + ~ pstats->mac_stx[0].tx_stat_mac_4095_lo) + 1U; } else { diff.hi = 0U; diff.lo = 0U; } } else if (new___0->tx_stat_gt4095_hi < pstats->mac_stx[0].tx_stat_mac_4095_hi) { diff.hi = 0U; diff.lo = 0U; } else { diff.hi = new___0->tx_stat_gt4095_hi - pstats->mac_stx[0].tx_stat_mac_4095_hi; diff.lo = new___0->tx_stat_gt4095_lo - pstats->mac_stx[0].tx_stat_mac_4095_lo; } pstats->mac_stx[0].tx_stat_mac_4095_hi = new___0->tx_stat_gt4095_hi; pstats->mac_stx[0].tx_stat_mac_4095_lo = new___0->tx_stat_gt4095_lo; pstats->mac_stx[1].tx_stat_mac_4095_lo = pstats->mac_stx[1].tx_stat_mac_4095_lo + diff.lo; pstats->mac_stx[1].tx_stat_mac_4095_hi = pstats->mac_stx[1].tx_stat_mac_4095_hi + (diff.hi + (pstats->mac_stx[1].tx_stat_mac_4095_lo < diff.lo ? 1U : 0U)); if (new___0->tx_stat_gt9216_lo < pstats->mac_stx[0].tx_stat_mac_9216_lo) { diff.hi = new___0->tx_stat_gt9216_hi - pstats->mac_stx[0].tx_stat_mac_9216_hi; if (diff.hi != 0U) { diff.hi = diff.hi - 1U; diff.lo = (new___0->tx_stat_gt9216_lo + ~ pstats->mac_stx[0].tx_stat_mac_9216_lo) + 1U; } else { diff.hi = 0U; diff.lo = 0U; } } else if (new___0->tx_stat_gt9216_hi < pstats->mac_stx[0].tx_stat_mac_9216_hi) { diff.hi = 0U; diff.lo = 0U; } else { diff.hi = new___0->tx_stat_gt9216_hi - pstats->mac_stx[0].tx_stat_mac_9216_hi; diff.lo = new___0->tx_stat_gt9216_lo - pstats->mac_stx[0].tx_stat_mac_9216_lo; } pstats->mac_stx[0].tx_stat_mac_9216_hi = new___0->tx_stat_gt9216_hi; pstats->mac_stx[0].tx_stat_mac_9216_lo = new___0->tx_stat_gt9216_lo; pstats->mac_stx[1].tx_stat_mac_9216_lo = pstats->mac_stx[1].tx_stat_mac_9216_lo + diff.lo; pstats->mac_stx[1].tx_stat_mac_9216_hi = pstats->mac_stx[1].tx_stat_mac_9216_hi + (diff.hi + (pstats->mac_stx[1].tx_stat_mac_9216_lo < diff.lo ? 1U : 0U)); if (new___0->tx_stat_gt16383_lo < pstats->mac_stx[0].tx_stat_mac_16383_lo) { diff.hi = new___0->tx_stat_gt16383_hi - pstats->mac_stx[0].tx_stat_mac_16383_hi; if (diff.hi != 0U) { diff.hi = diff.hi - 1U; diff.lo = (new___0->tx_stat_gt16383_lo + ~ pstats->mac_stx[0].tx_stat_mac_16383_lo) + 1U; } else { diff.hi = 0U; diff.lo = 0U; } } else if (new___0->tx_stat_gt16383_hi < pstats->mac_stx[0].tx_stat_mac_16383_hi) { diff.hi = 0U; diff.lo = 0U; } else { diff.hi = new___0->tx_stat_gt16383_hi - pstats->mac_stx[0].tx_stat_mac_16383_hi; diff.lo = new___0->tx_stat_gt16383_lo - pstats->mac_stx[0].tx_stat_mac_16383_lo; } pstats->mac_stx[0].tx_stat_mac_16383_hi = new___0->tx_stat_gt16383_hi; pstats->mac_stx[0].tx_stat_mac_16383_lo = new___0->tx_stat_gt16383_lo; pstats->mac_stx[1].tx_stat_mac_16383_lo = pstats->mac_stx[1].tx_stat_mac_16383_lo + diff.lo; pstats->mac_stx[1].tx_stat_mac_16383_hi = pstats->mac_stx[1].tx_stat_mac_16383_hi + (diff.hi + (pstats->mac_stx[1].tx_stat_mac_16383_lo < diff.lo ? 1U : 0U)); if (new___0->tx_stat_gterr_lo < pstats->mac_stx[0].tx_stat_dot3statsinternalmactransmiterrors_lo) { diff.hi = new___0->tx_stat_gterr_hi - pstats->mac_stx[0].tx_stat_dot3statsinternalmactransmiterrors_hi; if (diff.hi != 0U) { diff.hi = diff.hi - 1U; diff.lo = (new___0->tx_stat_gterr_lo + ~ pstats->mac_stx[0].tx_stat_dot3statsinternalmactransmiterrors_lo) + 1U; } else { diff.hi = 0U; diff.lo = 0U; } } else if (new___0->tx_stat_gterr_hi < pstats->mac_stx[0].tx_stat_dot3statsinternalmactransmiterrors_hi) { diff.hi = 0U; diff.lo = 0U; } else { diff.hi = new___0->tx_stat_gterr_hi - pstats->mac_stx[0].tx_stat_dot3statsinternalmactransmiterrors_hi; diff.lo = new___0->tx_stat_gterr_lo - pstats->mac_stx[0].tx_stat_dot3statsinternalmactransmiterrors_lo; } pstats->mac_stx[0].tx_stat_dot3statsinternalmactransmiterrors_hi = new___0->tx_stat_gterr_hi; pstats->mac_stx[0].tx_stat_dot3statsinternalmactransmiterrors_lo = new___0->tx_stat_gterr_lo; pstats->mac_stx[1].tx_stat_dot3statsinternalmactransmiterrors_lo = pstats->mac_stx[1].tx_stat_dot3statsinternalmactransmiterrors_lo + diff.lo; pstats->mac_stx[1].tx_stat_dot3statsinternalmactransmiterrors_hi = pstats->mac_stx[1].tx_stat_dot3statsinternalmactransmiterrors_hi + (diff.hi + (pstats->mac_stx[1].tx_stat_dot3statsinternalmactransmiterrors_lo < diff.lo ? 1U : 0U)); if (new___0->tx_stat_gtufl_lo < pstats->mac_stx[0].tx_stat_mac_ufl_lo) { diff.hi = new___0->tx_stat_gtufl_hi - pstats->mac_stx[0].tx_stat_mac_ufl_hi; if (diff.hi != 0U) { diff.hi = diff.hi - 1U; diff.lo = (new___0->tx_stat_gtufl_lo + ~ pstats->mac_stx[0].tx_stat_mac_ufl_lo) + 1U; } else { diff.hi = 0U; diff.lo = 0U; } } else if (new___0->tx_stat_gtufl_hi < pstats->mac_stx[0].tx_stat_mac_ufl_hi) { diff.hi = 0U; diff.lo = 0U; } else { diff.hi = new___0->tx_stat_gtufl_hi - pstats->mac_stx[0].tx_stat_mac_ufl_hi; diff.lo = new___0->tx_stat_gtufl_lo - pstats->mac_stx[0].tx_stat_mac_ufl_lo; } pstats->mac_stx[0].tx_stat_mac_ufl_hi = new___0->tx_stat_gtufl_hi; pstats->mac_stx[0].tx_stat_mac_ufl_lo = new___0->tx_stat_gtufl_lo; pstats->mac_stx[1].tx_stat_mac_ufl_lo = pstats->mac_stx[1].tx_stat_mac_ufl_lo + diff.lo; pstats->mac_stx[1].tx_stat_mac_ufl_hi = pstats->mac_stx[1].tx_stat_mac_ufl_hi + (diff.hi + (pstats->mac_stx[1].tx_stat_mac_ufl_lo < diff.lo ? 1U : 0U)); pstats->pfc_frames_tx_hi = new___0->tx_stat_gtpp_hi; pstats->pfc_frames_tx_lo = new___0->tx_stat_gtpp_lo; pstats->pfc_frames_rx_hi = new___0->rx_stat_grpp_hi; pstats->pfc_frames_rx_lo = new___0->rx_stat_grpp_lo; } estats->pause_frames_received_hi = pstats->mac_stx[1].rx_stat_mac_xpf_hi; estats->pause_frames_received_lo = pstats->mac_stx[1].rx_stat_mac_xpf_lo; estats->pause_frames_sent_hi = pstats->mac_stx[1].tx_stat_outxoffsent_hi; estats->pause_frames_sent_lo = pstats->mac_stx[1].tx_stat_outxoffsent_lo; estats->pfc_frames_received_hi = pstats->pfc_frames_rx_hi; estats->pfc_frames_received_lo = pstats->pfc_frames_rx_lo; estats->pfc_frames_sent_hi = pstats->pfc_frames_tx_hi; estats->pfc_frames_sent_lo = pstats->pfc_frames_tx_lo; return; } } static void bnx2x_mstat_stats_update(struct bnx2x *bp ) { struct host_port_stats *pstats ; struct bnx2x_eth_stats *estats ; struct mstat_stats *new ; { pstats = & (bp->slowpath)->port_stats; estats = & bp->eth_stats; new = & (bp->slowpath)->mac_stats.mstat_stats; pstats->mac_stx[1].rx_stat_ifhcinbadoctets_lo = pstats->mac_stx[1].rx_stat_ifhcinbadoctets_lo + new->stats_rx.rx_grerb_lo; pstats->mac_stx[1].rx_stat_ifhcinbadoctets_hi = pstats->mac_stx[1].rx_stat_ifhcinbadoctets_hi + (new->stats_rx.rx_grerb_hi + (pstats->mac_stx[1].rx_stat_ifhcinbadoctets_lo < new->stats_rx.rx_grerb_lo ? 1U : 0U)); pstats->mac_stx[1].rx_stat_dot3statsfcserrors_lo = pstats->mac_stx[1].rx_stat_dot3statsfcserrors_lo + new->stats_rx.rx_grfcs_lo; pstats->mac_stx[1].rx_stat_dot3statsfcserrors_hi = pstats->mac_stx[1].rx_stat_dot3statsfcserrors_hi + (new->stats_rx.rx_grfcs_hi + (pstats->mac_stx[1].rx_stat_dot3statsfcserrors_lo < new->stats_rx.rx_grfcs_lo ? 1U : 0U)); pstats->mac_stx[1].rx_stat_etherstatsundersizepkts_lo = pstats->mac_stx[1].rx_stat_etherstatsundersizepkts_lo + new->stats_rx.rx_grund_lo; pstats->mac_stx[1].rx_stat_etherstatsundersizepkts_hi = pstats->mac_stx[1].rx_stat_etherstatsundersizepkts_hi + (new->stats_rx.rx_grund_hi + (pstats->mac_stx[1].rx_stat_etherstatsundersizepkts_lo < new->stats_rx.rx_grund_lo ? 1U : 0U)); pstats->mac_stx[1].rx_stat_dot3statsframestoolong_lo = pstats->mac_stx[1].rx_stat_dot3statsframestoolong_lo + new->stats_rx.rx_grovr_lo; pstats->mac_stx[1].rx_stat_dot3statsframestoolong_hi = pstats->mac_stx[1].rx_stat_dot3statsframestoolong_hi + (new->stats_rx.rx_grovr_hi + (pstats->mac_stx[1].rx_stat_dot3statsframestoolong_lo < new->stats_rx.rx_grovr_lo ? 1U : 0U)); pstats->mac_stx[1].rx_stat_etherstatsfragments_lo = pstats->mac_stx[1].rx_stat_etherstatsfragments_lo + new->stats_rx.rx_grfrg_lo; pstats->mac_stx[1].rx_stat_etherstatsfragments_hi = pstats->mac_stx[1].rx_stat_etherstatsfragments_hi + (new->stats_rx.rx_grfrg_hi + (pstats->mac_stx[1].rx_stat_etherstatsfragments_lo < new->stats_rx.rx_grfrg_lo ? 1U : 0U)); pstats->mac_stx[1].rx_stat_maccontrolframesreceived_lo = pstats->mac_stx[1].rx_stat_maccontrolframesreceived_lo + new->stats_rx.rx_grxcf_lo; pstats->mac_stx[1].rx_stat_maccontrolframesreceived_hi = pstats->mac_stx[1].rx_stat_maccontrolframesreceived_hi + (new->stats_rx.rx_grxcf_hi + (pstats->mac_stx[1].rx_stat_maccontrolframesreceived_lo < new->stats_rx.rx_grxcf_lo ? 1U : 0U)); pstats->mac_stx[1].rx_stat_xoffstateentered_lo = pstats->mac_stx[1].rx_stat_xoffstateentered_lo + new->stats_rx.rx_grxpf_lo; pstats->mac_stx[1].rx_stat_xoffstateentered_hi = pstats->mac_stx[1].rx_stat_xoffstateentered_hi + (new->stats_rx.rx_grxpf_hi + (pstats->mac_stx[1].rx_stat_xoffstateentered_lo < new->stats_rx.rx_grxpf_lo ? 1U : 0U)); pstats->mac_stx[1].rx_stat_mac_xpf_lo = pstats->mac_stx[1].rx_stat_mac_xpf_lo + new->stats_rx.rx_grxpf_lo; pstats->mac_stx[1].rx_stat_mac_xpf_hi = pstats->mac_stx[1].rx_stat_mac_xpf_hi + (new->stats_rx.rx_grxpf_hi + (pstats->mac_stx[1].rx_stat_mac_xpf_lo < new->stats_rx.rx_grxpf_lo ? 1U : 0U)); pstats->mac_stx[1].tx_stat_outxoffsent_lo = pstats->mac_stx[1].tx_stat_outxoffsent_lo + new->stats_tx.tx_gtxpf_lo; pstats->mac_stx[1].tx_stat_outxoffsent_hi = pstats->mac_stx[1].tx_stat_outxoffsent_hi + (new->stats_tx.tx_gtxpf_hi + (pstats->mac_stx[1].tx_stat_outxoffsent_lo < new->stats_tx.tx_gtxpf_lo ? 1U : 0U)); pstats->mac_stx[1].tx_stat_flowcontroldone_lo = pstats->mac_stx[1].tx_stat_flowcontroldone_lo + new->stats_tx.tx_gtxpf_lo; pstats->mac_stx[1].tx_stat_flowcontroldone_hi = pstats->mac_stx[1].tx_stat_flowcontroldone_hi + (new->stats_tx.tx_gtxpf_hi + (pstats->mac_stx[1].tx_stat_flowcontroldone_lo < new->stats_tx.tx_gtxpf_lo ? 1U : 0U)); pstats->pfc_frames_tx_lo = pstats->pfc_frames_tx_lo + new->stats_tx.tx_gtxpp_lo; pstats->pfc_frames_tx_hi = pstats->pfc_frames_tx_hi + (new->stats_tx.tx_gtxpp_hi + (pstats->pfc_frames_tx_lo < new->stats_tx.tx_gtxpp_lo ? 1U : 0U)); pstats->pfc_frames_rx_lo = pstats->pfc_frames_rx_lo + new->stats_rx.rx_grxpp_lo; pstats->pfc_frames_rx_hi = pstats->pfc_frames_rx_hi + (new->stats_rx.rx_grxpp_hi + (pstats->pfc_frames_rx_lo < new->stats_rx.rx_grxpp_lo ? 1U : 0U)); pstats->mac_stx[1].tx_stat_etherstatspkts64octets_lo = pstats->mac_stx[1].tx_stat_etherstatspkts64octets_lo + new->stats_tx.tx_gt64_lo; pstats->mac_stx[1].tx_stat_etherstatspkts64octets_hi = pstats->mac_stx[1].tx_stat_etherstatspkts64octets_hi + (new->stats_tx.tx_gt64_hi + (pstats->mac_stx[1].tx_stat_etherstatspkts64octets_lo < new->stats_tx.tx_gt64_lo ? 1U : 0U)); pstats->mac_stx[1].tx_stat_etherstatspkts65octetsto127octets_lo = pstats->mac_stx[1].tx_stat_etherstatspkts65octetsto127octets_lo + new->stats_tx.tx_gt127_lo; pstats->mac_stx[1].tx_stat_etherstatspkts65octetsto127octets_hi = pstats->mac_stx[1].tx_stat_etherstatspkts65octetsto127octets_hi + (new->stats_tx.tx_gt127_hi + (pstats->mac_stx[1].tx_stat_etherstatspkts65octetsto127octets_lo < new->stats_tx.tx_gt127_lo ? 1U : 0U)); pstats->mac_stx[1].tx_stat_etherstatspkts128octetsto255octets_lo = pstats->mac_stx[1].tx_stat_etherstatspkts128octetsto255octets_lo + new->stats_tx.tx_gt255_lo; pstats->mac_stx[1].tx_stat_etherstatspkts128octetsto255octets_hi = pstats->mac_stx[1].tx_stat_etherstatspkts128octetsto255octets_hi + (new->stats_tx.tx_gt255_hi + (pstats->mac_stx[1].tx_stat_etherstatspkts128octetsto255octets_lo < new->stats_tx.tx_gt255_lo ? 1U : 0U)); pstats->mac_stx[1].tx_stat_etherstatspkts256octetsto511octets_lo = pstats->mac_stx[1].tx_stat_etherstatspkts256octetsto511octets_lo + new->stats_tx.tx_gt511_lo; pstats->mac_stx[1].tx_stat_etherstatspkts256octetsto511octets_hi = pstats->mac_stx[1].tx_stat_etherstatspkts256octetsto511octets_hi + (new->stats_tx.tx_gt511_hi + (pstats->mac_stx[1].tx_stat_etherstatspkts256octetsto511octets_lo < new->stats_tx.tx_gt511_lo ? 1U : 0U)); pstats->mac_stx[1].tx_stat_etherstatspkts512octetsto1023octets_lo = pstats->mac_stx[1].tx_stat_etherstatspkts512octetsto1023octets_lo + new->stats_tx.tx_gt1023_lo; pstats->mac_stx[1].tx_stat_etherstatspkts512octetsto1023octets_hi = pstats->mac_stx[1].tx_stat_etherstatspkts512octetsto1023octets_hi + (new->stats_tx.tx_gt1023_hi + (pstats->mac_stx[1].tx_stat_etherstatspkts512octetsto1023octets_lo < new->stats_tx.tx_gt1023_lo ? 1U : 0U)); pstats->mac_stx[1].tx_stat_etherstatspkts1024octetsto1522octets_lo = pstats->mac_stx[1].tx_stat_etherstatspkts1024octetsto1522octets_lo + new->stats_tx.tx_gt1518_lo; pstats->mac_stx[1].tx_stat_etherstatspkts1024octetsto1522octets_hi = pstats->mac_stx[1].tx_stat_etherstatspkts1024octetsto1522octets_hi + (new->stats_tx.tx_gt1518_hi + (pstats->mac_stx[1].tx_stat_etherstatspkts1024octetsto1522octets_lo < new->stats_tx.tx_gt1518_lo ? 1U : 0U)); pstats->mac_stx[1].tx_stat_mac_2047_lo = pstats->mac_stx[1].tx_stat_mac_2047_lo + new->stats_tx.tx_gt2047_lo; pstats->mac_stx[1].tx_stat_mac_2047_hi = pstats->mac_stx[1].tx_stat_mac_2047_hi + (new->stats_tx.tx_gt2047_hi + (pstats->mac_stx[1].tx_stat_mac_2047_lo < new->stats_tx.tx_gt2047_lo ? 1U : 0U)); pstats->mac_stx[1].tx_stat_mac_4095_lo = pstats->mac_stx[1].tx_stat_mac_4095_lo + new->stats_tx.tx_gt4095_lo; pstats->mac_stx[1].tx_stat_mac_4095_hi = pstats->mac_stx[1].tx_stat_mac_4095_hi + (new->stats_tx.tx_gt4095_hi + (pstats->mac_stx[1].tx_stat_mac_4095_lo < new->stats_tx.tx_gt4095_lo ? 1U : 0U)); pstats->mac_stx[1].tx_stat_mac_9216_lo = pstats->mac_stx[1].tx_stat_mac_9216_lo + new->stats_tx.tx_gt9216_lo; pstats->mac_stx[1].tx_stat_mac_9216_hi = pstats->mac_stx[1].tx_stat_mac_9216_hi + (new->stats_tx.tx_gt9216_hi + (pstats->mac_stx[1].tx_stat_mac_9216_lo < new->stats_tx.tx_gt9216_lo ? 1U : 0U)); pstats->mac_stx[1].tx_stat_mac_16383_lo = pstats->mac_stx[1].tx_stat_mac_16383_lo + new->stats_tx.tx_gt16383_lo; pstats->mac_stx[1].tx_stat_mac_16383_hi = pstats->mac_stx[1].tx_stat_mac_16383_hi + (new->stats_tx.tx_gt16383_hi + (pstats->mac_stx[1].tx_stat_mac_16383_lo < new->stats_tx.tx_gt16383_lo ? 1U : 0U)); pstats->mac_stx[1].tx_stat_dot3statsinternalmactransmiterrors_lo = pstats->mac_stx[1].tx_stat_dot3statsinternalmactransmiterrors_lo + new->stats_tx.tx_gterr_lo; pstats->mac_stx[1].tx_stat_dot3statsinternalmactransmiterrors_hi = pstats->mac_stx[1].tx_stat_dot3statsinternalmactransmiterrors_hi + (new->stats_tx.tx_gterr_hi + (pstats->mac_stx[1].tx_stat_dot3statsinternalmactransmiterrors_lo < new->stats_tx.tx_gterr_lo ? 1U : 0U)); pstats->mac_stx[1].tx_stat_mac_ufl_lo = pstats->mac_stx[1].tx_stat_mac_ufl_lo + new->stats_tx.tx_gtufl_lo; pstats->mac_stx[1].tx_stat_mac_ufl_hi = pstats->mac_stx[1].tx_stat_mac_ufl_hi + (new->stats_tx.tx_gtufl_hi + (pstats->mac_stx[1].tx_stat_mac_ufl_lo < new->stats_tx.tx_gtufl_lo ? 1U : 0U)); estats->etherstatspkts1024octetsto1522octets_hi = pstats->mac_stx[1].tx_stat_etherstatspkts1024octetsto1522octets_hi; estats->etherstatspkts1024octetsto1522octets_lo = pstats->mac_stx[1].tx_stat_etherstatspkts1024octetsto1522octets_lo; estats->etherstatspktsover1522octets_hi = pstats->mac_stx[1].tx_stat_mac_2047_hi; estats->etherstatspktsover1522octets_lo = pstats->mac_stx[1].tx_stat_mac_2047_lo; estats->etherstatspktsover1522octets_lo = estats->etherstatspktsover1522octets_lo + pstats->mac_stx[1].tx_stat_mac_4095_lo; estats->etherstatspktsover1522octets_hi = estats->etherstatspktsover1522octets_hi + (pstats->mac_stx[1].tx_stat_mac_4095_hi + (estats->etherstatspktsover1522octets_lo < pstats->mac_stx[1].tx_stat_mac_4095_lo ? 1U : 0U)); estats->etherstatspktsover1522octets_lo = estats->etherstatspktsover1522octets_lo + pstats->mac_stx[1].tx_stat_mac_9216_lo; estats->etherstatspktsover1522octets_hi = estats->etherstatspktsover1522octets_hi + (pstats->mac_stx[1].tx_stat_mac_9216_hi + (estats->etherstatspktsover1522octets_lo < pstats->mac_stx[1].tx_stat_mac_9216_lo ? 1U : 0U)); estats->etherstatspktsover1522octets_lo = estats->etherstatspktsover1522octets_lo + pstats->mac_stx[1].tx_stat_mac_16383_lo; estats->etherstatspktsover1522octets_hi = estats->etherstatspktsover1522octets_hi + (pstats->mac_stx[1].tx_stat_mac_16383_hi + (estats->etherstatspktsover1522octets_lo < pstats->mac_stx[1].tx_stat_mac_16383_lo ? 1U : 0U)); estats->pause_frames_received_hi = pstats->mac_stx[1].rx_stat_mac_xpf_hi; estats->pause_frames_received_lo = pstats->mac_stx[1].rx_stat_mac_xpf_lo; estats->pause_frames_sent_hi = pstats->mac_stx[1].tx_stat_outxoffsent_hi; estats->pause_frames_sent_lo = pstats->mac_stx[1].tx_stat_outxoffsent_lo; estats->pfc_frames_received_hi = pstats->pfc_frames_rx_hi; estats->pfc_frames_received_lo = pstats->pfc_frames_rx_lo; estats->pfc_frames_sent_hi = pstats->pfc_frames_tx_hi; estats->pfc_frames_sent_lo = pstats->pfc_frames_tx_lo; return; } } static void bnx2x_emac_stats_update(struct bnx2x *bp ) { struct emac_stats *new ; struct host_port_stats *pstats ; struct bnx2x_eth_stats *estats ; { new = & (bp->slowpath)->mac_stats.emac_stats; pstats = & (bp->slowpath)->port_stats; estats = & bp->eth_stats; pstats->mac_stx[1].rx_stat_ifhcinbadoctets_lo = pstats->mac_stx[1].rx_stat_ifhcinbadoctets_lo + new->rx_stat_ifhcinbadoctets; pstats->mac_stx[1].rx_stat_ifhcinbadoctets_hi = pstats->mac_stx[1].rx_stat_ifhcinbadoctets_hi + (pstats->mac_stx[1].rx_stat_ifhcinbadoctets_lo < new->rx_stat_ifhcinbadoctets ? 1U : 0U); pstats->mac_stx[1].tx_stat_ifhcoutbadoctets_lo = pstats->mac_stx[1].tx_stat_ifhcoutbadoctets_lo + new->tx_stat_ifhcoutbadoctets; pstats->mac_stx[1].tx_stat_ifhcoutbadoctets_hi = pstats->mac_stx[1].tx_stat_ifhcoutbadoctets_hi + (pstats->mac_stx[1].tx_stat_ifhcoutbadoctets_lo < new->tx_stat_ifhcoutbadoctets ? 1U : 0U); pstats->mac_stx[1].rx_stat_dot3statsfcserrors_lo = pstats->mac_stx[1].rx_stat_dot3statsfcserrors_lo + new->rx_stat_dot3statsfcserrors; pstats->mac_stx[1].rx_stat_dot3statsfcserrors_hi = pstats->mac_stx[1].rx_stat_dot3statsfcserrors_hi + (pstats->mac_stx[1].rx_stat_dot3statsfcserrors_lo < new->rx_stat_dot3statsfcserrors ? 1U : 0U); pstats->mac_stx[1].rx_stat_dot3statsalignmenterrors_lo = pstats->mac_stx[1].rx_stat_dot3statsalignmenterrors_lo + new->rx_stat_dot3statsalignmenterrors; pstats->mac_stx[1].rx_stat_dot3statsalignmenterrors_hi = pstats->mac_stx[1].rx_stat_dot3statsalignmenterrors_hi + (pstats->mac_stx[1].rx_stat_dot3statsalignmenterrors_lo < new->rx_stat_dot3statsalignmenterrors ? 1U : 0U); pstats->mac_stx[1].rx_stat_dot3statscarriersenseerrors_lo = pstats->mac_stx[1].rx_stat_dot3statscarriersenseerrors_lo + new->rx_stat_dot3statscarriersenseerrors; pstats->mac_stx[1].rx_stat_dot3statscarriersenseerrors_hi = pstats->mac_stx[1].rx_stat_dot3statscarriersenseerrors_hi + (pstats->mac_stx[1].rx_stat_dot3statscarriersenseerrors_lo < new->rx_stat_dot3statscarriersenseerrors ? 1U : 0U); pstats->mac_stx[1].rx_stat_falsecarriererrors_lo = pstats->mac_stx[1].rx_stat_falsecarriererrors_lo + new->rx_stat_falsecarriererrors; pstats->mac_stx[1].rx_stat_falsecarriererrors_hi = pstats->mac_stx[1].rx_stat_falsecarriererrors_hi + (pstats->mac_stx[1].rx_stat_falsecarriererrors_lo < new->rx_stat_falsecarriererrors ? 1U : 0U); pstats->mac_stx[1].rx_stat_etherstatsundersizepkts_lo = pstats->mac_stx[1].rx_stat_etherstatsundersizepkts_lo + new->rx_stat_etherstatsundersizepkts; pstats->mac_stx[1].rx_stat_etherstatsundersizepkts_hi = pstats->mac_stx[1].rx_stat_etherstatsundersizepkts_hi + (pstats->mac_stx[1].rx_stat_etherstatsundersizepkts_lo < new->rx_stat_etherstatsundersizepkts ? 1U : 0U); pstats->mac_stx[1].rx_stat_dot3statsframestoolong_lo = pstats->mac_stx[1].rx_stat_dot3statsframestoolong_lo + new->rx_stat_dot3statsframestoolong; pstats->mac_stx[1].rx_stat_dot3statsframestoolong_hi = pstats->mac_stx[1].rx_stat_dot3statsframestoolong_hi + (pstats->mac_stx[1].rx_stat_dot3statsframestoolong_lo < new->rx_stat_dot3statsframestoolong ? 1U : 0U); pstats->mac_stx[1].rx_stat_etherstatsfragments_lo = pstats->mac_stx[1].rx_stat_etherstatsfragments_lo + new->rx_stat_etherstatsfragments; pstats->mac_stx[1].rx_stat_etherstatsfragments_hi = pstats->mac_stx[1].rx_stat_etherstatsfragments_hi + (pstats->mac_stx[1].rx_stat_etherstatsfragments_lo < new->rx_stat_etherstatsfragments ? 1U : 0U); pstats->mac_stx[1].rx_stat_etherstatsjabbers_lo = pstats->mac_stx[1].rx_stat_etherstatsjabbers_lo + new->rx_stat_etherstatsjabbers; pstats->mac_stx[1].rx_stat_etherstatsjabbers_hi = pstats->mac_stx[1].rx_stat_etherstatsjabbers_hi + (pstats->mac_stx[1].rx_stat_etherstatsjabbers_lo < new->rx_stat_etherstatsjabbers ? 1U : 0U); pstats->mac_stx[1].rx_stat_maccontrolframesreceived_lo = pstats->mac_stx[1].rx_stat_maccontrolframesreceived_lo + new->rx_stat_maccontrolframesreceived; pstats->mac_stx[1].rx_stat_maccontrolframesreceived_hi = pstats->mac_stx[1].rx_stat_maccontrolframesreceived_hi + (pstats->mac_stx[1].rx_stat_maccontrolframesreceived_lo < new->rx_stat_maccontrolframesreceived ? 1U : 0U); pstats->mac_stx[1].rx_stat_xoffstateentered_lo = pstats->mac_stx[1].rx_stat_xoffstateentered_lo + new->rx_stat_xoffstateentered; pstats->mac_stx[1].rx_stat_xoffstateentered_hi = pstats->mac_stx[1].rx_stat_xoffstateentered_hi + (pstats->mac_stx[1].rx_stat_xoffstateentered_lo < new->rx_stat_xoffstateentered ? 1U : 0U); pstats->mac_stx[1].rx_stat_xonpauseframesreceived_lo = pstats->mac_stx[1].rx_stat_xonpauseframesreceived_lo + new->rx_stat_xonpauseframesreceived; pstats->mac_stx[1].rx_stat_xonpauseframesreceived_hi = pstats->mac_stx[1].rx_stat_xonpauseframesreceived_hi + (pstats->mac_stx[1].rx_stat_xonpauseframesreceived_lo < new->rx_stat_xonpauseframesreceived ? 1U : 0U); pstats->mac_stx[1].rx_stat_xoffpauseframesreceived_lo = pstats->mac_stx[1].rx_stat_xoffpauseframesreceived_lo + new->rx_stat_xoffpauseframesreceived; pstats->mac_stx[1].rx_stat_xoffpauseframesreceived_hi = pstats->mac_stx[1].rx_stat_xoffpauseframesreceived_hi + (pstats->mac_stx[1].rx_stat_xoffpauseframesreceived_lo < new->rx_stat_xoffpauseframesreceived ? 1U : 0U); pstats->mac_stx[1].tx_stat_outxonsent_lo = pstats->mac_stx[1].tx_stat_outxonsent_lo + new->tx_stat_outxonsent; pstats->mac_stx[1].tx_stat_outxonsent_hi = pstats->mac_stx[1].tx_stat_outxonsent_hi + (pstats->mac_stx[1].tx_stat_outxonsent_lo < new->tx_stat_outxonsent ? 1U : 0U); pstats->mac_stx[1].tx_stat_outxoffsent_lo = pstats->mac_stx[1].tx_stat_outxoffsent_lo + new->tx_stat_outxoffsent; pstats->mac_stx[1].tx_stat_outxoffsent_hi = pstats->mac_stx[1].tx_stat_outxoffsent_hi + (pstats->mac_stx[1].tx_stat_outxoffsent_lo < new->tx_stat_outxoffsent ? 1U : 0U); pstats->mac_stx[1].tx_stat_flowcontroldone_lo = pstats->mac_stx[1].tx_stat_flowcontroldone_lo + new->tx_stat_flowcontroldone; pstats->mac_stx[1].tx_stat_flowcontroldone_hi = pstats->mac_stx[1].tx_stat_flowcontroldone_hi + (pstats->mac_stx[1].tx_stat_flowcontroldone_lo < new->tx_stat_flowcontroldone ? 1U : 0U); pstats->mac_stx[1].tx_stat_etherstatscollisions_lo = pstats->mac_stx[1].tx_stat_etherstatscollisions_lo + new->tx_stat_etherstatscollisions; pstats->mac_stx[1].tx_stat_etherstatscollisions_hi = pstats->mac_stx[1].tx_stat_etherstatscollisions_hi + (pstats->mac_stx[1].tx_stat_etherstatscollisions_lo < new->tx_stat_etherstatscollisions ? 1U : 0U); pstats->mac_stx[1].tx_stat_dot3statssinglecollisionframes_lo = pstats->mac_stx[1].tx_stat_dot3statssinglecollisionframes_lo + new->tx_stat_dot3statssinglecollisionframes; pstats->mac_stx[1].tx_stat_dot3statssinglecollisionframes_hi = pstats->mac_stx[1].tx_stat_dot3statssinglecollisionframes_hi + (pstats->mac_stx[1].tx_stat_dot3statssinglecollisionframes_lo < new->tx_stat_dot3statssinglecollisionframes ? 1U : 0U); pstats->mac_stx[1].tx_stat_dot3statsmultiplecollisionframes_lo = pstats->mac_stx[1].tx_stat_dot3statsmultiplecollisionframes_lo + new->tx_stat_dot3statsmultiplecollisionframes; pstats->mac_stx[1].tx_stat_dot3statsmultiplecollisionframes_hi = pstats->mac_stx[1].tx_stat_dot3statsmultiplecollisionframes_hi + (pstats->mac_stx[1].tx_stat_dot3statsmultiplecollisionframes_lo < new->tx_stat_dot3statsmultiplecollisionframes ? 1U : 0U); pstats->mac_stx[1].tx_stat_dot3statsdeferredtransmissions_lo = pstats->mac_stx[1].tx_stat_dot3statsdeferredtransmissions_lo + new->tx_stat_dot3statsdeferredtransmissions; pstats->mac_stx[1].tx_stat_dot3statsdeferredtransmissions_hi = pstats->mac_stx[1].tx_stat_dot3statsdeferredtransmissions_hi + (pstats->mac_stx[1].tx_stat_dot3statsdeferredtransmissions_lo < new->tx_stat_dot3statsdeferredtransmissions ? 1U : 0U); pstats->mac_stx[1].tx_stat_dot3statsexcessivecollisions_lo = pstats->mac_stx[1].tx_stat_dot3statsexcessivecollisions_lo + new->tx_stat_dot3statsexcessivecollisions; pstats->mac_stx[1].tx_stat_dot3statsexcessivecollisions_hi = pstats->mac_stx[1].tx_stat_dot3statsexcessivecollisions_hi + (pstats->mac_stx[1].tx_stat_dot3statsexcessivecollisions_lo < new->tx_stat_dot3statsexcessivecollisions ? 1U : 0U); pstats->mac_stx[1].tx_stat_dot3statslatecollisions_lo = pstats->mac_stx[1].tx_stat_dot3statslatecollisions_lo + new->tx_stat_dot3statslatecollisions; pstats->mac_stx[1].tx_stat_dot3statslatecollisions_hi = pstats->mac_stx[1].tx_stat_dot3statslatecollisions_hi + (pstats->mac_stx[1].tx_stat_dot3statslatecollisions_lo < new->tx_stat_dot3statslatecollisions ? 1U : 0U); pstats->mac_stx[1].tx_stat_etherstatspkts64octets_lo = pstats->mac_stx[1].tx_stat_etherstatspkts64octets_lo + new->tx_stat_etherstatspkts64octets; pstats->mac_stx[1].tx_stat_etherstatspkts64octets_hi = pstats->mac_stx[1].tx_stat_etherstatspkts64octets_hi + (pstats->mac_stx[1].tx_stat_etherstatspkts64octets_lo < new->tx_stat_etherstatspkts64octets ? 1U : 0U); pstats->mac_stx[1].tx_stat_etherstatspkts65octetsto127octets_lo = pstats->mac_stx[1].tx_stat_etherstatspkts65octetsto127octets_lo + new->tx_stat_etherstatspkts65octetsto127octets; pstats->mac_stx[1].tx_stat_etherstatspkts65octetsto127octets_hi = pstats->mac_stx[1].tx_stat_etherstatspkts65octetsto127octets_hi + (pstats->mac_stx[1].tx_stat_etherstatspkts65octetsto127octets_lo < new->tx_stat_etherstatspkts65octetsto127octets ? 1U : 0U); pstats->mac_stx[1].tx_stat_etherstatspkts128octetsto255octets_lo = pstats->mac_stx[1].tx_stat_etherstatspkts128octetsto255octets_lo + new->tx_stat_etherstatspkts128octetsto255octets; pstats->mac_stx[1].tx_stat_etherstatspkts128octetsto255octets_hi = pstats->mac_stx[1].tx_stat_etherstatspkts128octetsto255octets_hi + (pstats->mac_stx[1].tx_stat_etherstatspkts128octetsto255octets_lo < new->tx_stat_etherstatspkts128octetsto255octets ? 1U : 0U); pstats->mac_stx[1].tx_stat_etherstatspkts256octetsto511octets_lo = pstats->mac_stx[1].tx_stat_etherstatspkts256octetsto511octets_lo + new->tx_stat_etherstatspkts256octetsto511octets; pstats->mac_stx[1].tx_stat_etherstatspkts256octetsto511octets_hi = pstats->mac_stx[1].tx_stat_etherstatspkts256octetsto511octets_hi + (pstats->mac_stx[1].tx_stat_etherstatspkts256octetsto511octets_lo < new->tx_stat_etherstatspkts256octetsto511octets ? 1U : 0U); pstats->mac_stx[1].tx_stat_etherstatspkts512octetsto1023octets_lo = pstats->mac_stx[1].tx_stat_etherstatspkts512octetsto1023octets_lo + new->tx_stat_etherstatspkts512octetsto1023octets; pstats->mac_stx[1].tx_stat_etherstatspkts512octetsto1023octets_hi = pstats->mac_stx[1].tx_stat_etherstatspkts512octetsto1023octets_hi + (pstats->mac_stx[1].tx_stat_etherstatspkts512octetsto1023octets_lo < new->tx_stat_etherstatspkts512octetsto1023octets ? 1U : 0U); pstats->mac_stx[1].tx_stat_etherstatspkts1024octetsto1522octets_lo = pstats->mac_stx[1].tx_stat_etherstatspkts1024octetsto1522octets_lo + new->tx_stat_etherstatspkts1024octetsto1522octets; pstats->mac_stx[1].tx_stat_etherstatspkts1024octetsto1522octets_hi = pstats->mac_stx[1].tx_stat_etherstatspkts1024octetsto1522octets_hi + (pstats->mac_stx[1].tx_stat_etherstatspkts1024octetsto1522octets_lo < new->tx_stat_etherstatspkts1024octetsto1522octets ? 1U : 0U); pstats->mac_stx[1].tx_stat_etherstatspktsover1522octets_lo = pstats->mac_stx[1].tx_stat_etherstatspktsover1522octets_lo + new->tx_stat_etherstatspktsover1522octets; pstats->mac_stx[1].tx_stat_etherstatspktsover1522octets_hi = pstats->mac_stx[1].tx_stat_etherstatspktsover1522octets_hi + (pstats->mac_stx[1].tx_stat_etherstatspktsover1522octets_lo < new->tx_stat_etherstatspktsover1522octets ? 1U : 0U); pstats->mac_stx[1].tx_stat_dot3statsinternalmactransmiterrors_lo = pstats->mac_stx[1].tx_stat_dot3statsinternalmactransmiterrors_lo + new->tx_stat_dot3statsinternalmactransmiterrors; pstats->mac_stx[1].tx_stat_dot3statsinternalmactransmiterrors_hi = pstats->mac_stx[1].tx_stat_dot3statsinternalmactransmiterrors_hi + (pstats->mac_stx[1].tx_stat_dot3statsinternalmactransmiterrors_lo < new->tx_stat_dot3statsinternalmactransmiterrors ? 1U : 0U); estats->pause_frames_received_hi = pstats->mac_stx[1].rx_stat_xonpauseframesreceived_hi; estats->pause_frames_received_lo = pstats->mac_stx[1].rx_stat_xonpauseframesreceived_lo; estats->pause_frames_received_lo = estats->pause_frames_received_lo + pstats->mac_stx[1].rx_stat_xoffpauseframesreceived_lo; estats->pause_frames_received_hi = estats->pause_frames_received_hi + (pstats->mac_stx[1].rx_stat_xoffpauseframesreceived_hi + (estats->pause_frames_received_lo < pstats->mac_stx[1].rx_stat_xoffpauseframesreceived_lo ? 1U : 0U)); estats->pause_frames_sent_hi = pstats->mac_stx[1].tx_stat_outxonsent_hi; estats->pause_frames_sent_lo = pstats->mac_stx[1].tx_stat_outxonsent_lo; estats->pause_frames_sent_lo = estats->pause_frames_sent_lo + pstats->mac_stx[1].tx_stat_outxoffsent_lo; estats->pause_frames_sent_hi = estats->pause_frames_sent_hi + (pstats->mac_stx[1].tx_stat_outxoffsent_hi + (estats->pause_frames_sent_lo < pstats->mac_stx[1].tx_stat_outxoffsent_lo ? 1U : 0U)); return; } } static int bnx2x_hw_stats_update(struct bnx2x *bp ) { struct nig_stats *new ; struct nig_stats *old ; struct host_port_stats *pstats ; struct bnx2x_eth_stats *estats ; struct __anonstruct_diff_250 diff ; long tmp ; size_t __len ; void *__ret ; size_t __len___0 ; void *__ret___0 ; u32 lpi_reg ; unsigned int tmp___0 ; u32 nig_timer_max ; unsigned int tmp___1 ; { new = & (bp->slowpath)->nig_stats; old = & bp->port.old_nig_stats; pstats = & (bp->slowpath)->port_stats; estats = & bp->eth_stats; switch ((int )bp->link_vars.mac_type) { case 2: bnx2x_bmac_stats_update(bp); goto ldv_45132; case 1: bnx2x_emac_stats_update(bp); goto ldv_45132; case 3: ; case 4: bnx2x_mstat_stats_update(bp); goto ldv_45132; case 0: tmp = ldv__builtin_expect((bp->msg_enable & 131072) != 0, 0L); if (tmp != 0L) { printk("\rbnx2x: [%s:%d(%s)]stats updated by DMAE but no MAC active\n", "bnx2x_hw_stats_update", 908, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } return (-1); default: printk("\vbnx2x: [%s:%d(%s)]Unknown MAC type\n", "bnx2x_hw_stats_update", 912, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } ldv_45132: pstats->brb_drop_lo = pstats->brb_drop_lo + (new->brb_discard - old->brb_discard); pstats->brb_drop_hi = pstats->brb_drop_hi + (pstats->brb_drop_lo < new->brb_discard - old->brb_discard ? 1U : 0U); estats->brb_truncate_lo = estats->brb_truncate_lo + (new->brb_truncate - old->brb_truncate); estats->brb_truncate_hi = estats->brb_truncate_hi + (estats->brb_truncate_lo < new->brb_truncate - old->brb_truncate ? 1U : 0U); if (((((((((bp->common.chip_id >> 16 != 5770U && bp->common.chip_id >> 16 != 5797U) && bp->common.chip_id >> 16 != 5801U) && bp->common.chip_id >> 16 != 5774U) && bp->common.chip_id >> 16 != 5806U) && bp->common.chip_id >> 16 != 5807U) && ((bp->common.chip_id >> 16 != 5693U && bp->common.chip_id >> 16 != 5694U) && bp->common.chip_id >> 16 != 5695U)) && ((bp->common.chip_id >> 16 != 5793U && bp->common.chip_id >> 16 != 5794U) && bp->common.chip_id >> 16 != 5773U)) && (bp->common.chip_id >> 16 != 5796U && bp->common.chip_id >> 16 != 5803U)) && bp->common.chip_id >> 16 != 5805U) { if (new->egress_mac_pkt0_lo < old->egress_mac_pkt0_lo) { diff.hi = new->egress_mac_pkt0_hi - old->egress_mac_pkt0_hi; if (diff.hi != 0U) { diff.hi = diff.hi - 1U; diff.lo = (new->egress_mac_pkt0_lo + ~ old->egress_mac_pkt0_lo) + 1U; } else { diff.hi = 0U; diff.lo = 0U; } } else if (new->egress_mac_pkt0_hi < old->egress_mac_pkt0_hi) { diff.hi = 0U; diff.lo = 0U; } else { diff.hi = new->egress_mac_pkt0_hi - old->egress_mac_pkt0_hi; diff.lo = new->egress_mac_pkt0_lo - old->egress_mac_pkt0_lo; } estats->etherstatspkts1024octetsto1522octets_lo = estats->etherstatspkts1024octetsto1522octets_lo + diff.lo; estats->etherstatspkts1024octetsto1522octets_hi = estats->etherstatspkts1024octetsto1522octets_hi + (diff.hi + (estats->etherstatspkts1024octetsto1522octets_lo < diff.lo ? 1U : 0U)); if (new->egress_mac_pkt1_lo < old->egress_mac_pkt1_lo) { diff.hi = new->egress_mac_pkt1_hi - old->egress_mac_pkt1_hi; if (diff.hi != 0U) { diff.hi = diff.hi - 1U; diff.lo = (new->egress_mac_pkt1_lo + ~ old->egress_mac_pkt1_lo) + 1U; } else { diff.hi = 0U; diff.lo = 0U; } } else if (new->egress_mac_pkt1_hi < old->egress_mac_pkt1_hi) { diff.hi = 0U; diff.lo = 0U; } else { diff.hi = new->egress_mac_pkt1_hi - old->egress_mac_pkt1_hi; diff.lo = new->egress_mac_pkt1_lo - old->egress_mac_pkt1_lo; } estats->etherstatspktsover1522octets_lo = estats->etherstatspktsover1522octets_lo + diff.lo; estats->etherstatspktsover1522octets_hi = estats->etherstatspktsover1522octets_hi + (diff.hi + (estats->etherstatspktsover1522octets_lo < diff.lo ? 1U : 0U)); } else { } __len = 72UL; if (__len > 63UL) { __ret = __memcpy((void *)old, (void const *)new, __len); } else { __ret = __builtin_memcpy((void *)old, (void const *)new, __len); } __len___0 = 304UL; if (__len___0 > 63UL) { __ret___0 = __memcpy((void *)(& estats->rx_stat_ifhcinbadoctets_hi), (void const *)(& pstats->mac_stx) + 1U, __len___0); } else { __ret___0 = __builtin_memcpy((void *)(& estats->rx_stat_ifhcinbadoctets_hi), (void const *)(& pstats->mac_stx) + 1U, __len___0); } estats->brb_drop_hi = pstats->brb_drop_hi; estats->brb_drop_lo = pstats->brb_drop_lo; pstats->host_port_stats_counter = pstats->host_port_stats_counter + 1U; if (((((((((bp->common.chip_id >> 16 == 5770U || bp->common.chip_id >> 16 == 5797U) || bp->common.chip_id >> 16 == 5801U) || bp->common.chip_id >> 16 == 5774U) || bp->common.chip_id >> 16 == 5806U) || bp->common.chip_id >> 16 == 5807U) || ((bp->common.chip_id >> 16 == 5693U || bp->common.chip_id >> 16 == 5694U) || bp->common.chip_id >> 16 == 5695U)) || ((bp->common.chip_id >> 16 == 5793U || bp->common.chip_id >> 16 == 5794U) || bp->common.chip_id >> 16 == 5773U)) || (bp->common.chip_id >> 16 == 5796U || bp->common.chip_id >> 16 == 5803U)) || bp->common.chip_id >> 16 == 5805U) { lpi_reg = (int )bp->pfid & 1 ? 43196U : 43192U; tmp___0 = readl((void const volatile *)bp->regview + (unsigned long )lpi_reg); estats->eee_tx_lpi = estats->eee_tx_lpi + tmp___0; } else { } if ((bp->flags & 512U) == 0U) { tmp___1 = readl((void const volatile *)(bp->regview + (((unsigned long )bp->common.shmem_base + ((unsigned long )bp->pfid & 1UL) * 16UL) + 1644UL))); nig_timer_max = tmp___1; if (estats->nig_timer_max != nig_timer_max) { estats->nig_timer_max = nig_timer_max; printk("\vbnx2x: [%s:%d(%s)]NIG timer max (%u)\n", "bnx2x_hw_stats_update", 948, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", estats->nig_timer_max); } else { } } else { } return (0); } } static int bnx2x_storm_stats_validate_counters(struct bnx2x *bp ) { struct stats_counter *counters ; u16 cur_stats_counter ; long tmp ; long tmp___0 ; long tmp___1 ; long tmp___2 ; { counters = & (bp->fw_stats_data)->storm_counters; spin_lock_bh(& bp->stats_lock); cur_stats_counter = (unsigned int )bp->stats_counter + 65535U; spin_unlock_bh(& bp->stats_lock); if ((int )counters->xstats_counter != (int )cur_stats_counter) { tmp = ldv__builtin_expect((bp->msg_enable & 131072) != 0, 0L); if (tmp != 0L) { printk("\rbnx2x: [%s:%d(%s)]stats not updated by xstorm xstorm counter (0x%x) != stats_counter (0x%x)\n", "bnx2x_storm_stats_validate_counters", 970, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )counters->xstats_counter, (int )bp->stats_counter); } else { } return (-11); } else { } if ((int )counters->ustats_counter != (int )cur_stats_counter) { tmp___0 = ldv__builtin_expect((bp->msg_enable & 131072) != 0, 0L); if (tmp___0 != 0L) { printk("\rbnx2x: [%s:%d(%s)]stats not updated by ustorm ustorm counter (0x%x) != stats_counter (0x%x)\n", "bnx2x_storm_stats_validate_counters", 977, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )counters->ustats_counter, (int )bp->stats_counter); } else { } return (-11); } else { } if ((int )counters->cstats_counter != (int )cur_stats_counter) { tmp___1 = ldv__builtin_expect((bp->msg_enable & 131072) != 0, 0L); if (tmp___1 != 0L) { printk("\rbnx2x: [%s:%d(%s)]stats not updated by cstorm cstorm counter (0x%x) != stats_counter (0x%x)\n", "bnx2x_storm_stats_validate_counters", 984, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )counters->cstats_counter, (int )bp->stats_counter); } else { } return (-11); } else { } if ((int )counters->tstats_counter != (int )cur_stats_counter) { tmp___2 = ldv__builtin_expect((bp->msg_enable & 131072) != 0, 0L); if (tmp___2 != 0L) { printk("\rbnx2x: [%s:%d(%s)]stats not updated by tstorm tstorm counter (0x%x) != stats_counter (0x%x)\n", "bnx2x_storm_stats_validate_counters", 991, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )counters->tstats_counter, (int )bp->stats_counter); } else { } return (-11); } else { } return (0); } } static int bnx2x_storm_stats_update(struct bnx2x *bp ) { struct tstorm_per_port_stats *tport ; struct tstorm_per_pf_stats *tfunc ; struct host_func_stats *fstats ; struct bnx2x_eth_stats *estats ; struct bnx2x_eth_stats_old *estats_old ; int i ; int tmp ; struct bnx2x_fastpath *fp ; struct tstorm_per_queue_stats *tclient ; struct tstorm_per_queue_stats *old_tclient ; struct ustorm_per_queue_stats *uclient ; struct ustorm_per_queue_stats *old_uclient ; struct xstorm_per_queue_stats *xclient ; struct xstorm_per_queue_stats *old_xclient ; struct bnx2x_eth_q_stats *qstats ; struct bnx2x_eth_q_stats_old *qstats_old ; u32 diff ; long tmp___0 ; long tmp___1 ; struct bnx2x_fw_port_stats_old *fwstats ; { tport = & (bp->fw_stats_data)->port.tstorm_port_statistics; tfunc = & (bp->fw_stats_data)->pf.tstorm_pf_statistics; fstats = & bp->func_stats; estats = & bp->eth_stats; estats_old = & bp->eth_stats_old; if ((bp->flags & 4194304U) == 0U) { tmp = bnx2x_storm_stats_validate_counters(bp); if (tmp != 0) { return (-11); } else { } } else { } estats->error_bytes_received_hi = 0U; estats->error_bytes_received_lo = 0U; i = 0; goto ldv_45174; ldv_45173: fp = bp->fp + (unsigned long )i; tclient = & (bp->fw_stats_data)->queue_stats[i].tstorm_queue_statistics; old_tclient = & (bp->fp_stats + (unsigned long )fp->index)->old_tclient; uclient = & (bp->fw_stats_data)->queue_stats[i].ustorm_queue_statistics; old_uclient = & (bp->fp_stats + (unsigned long )fp->index)->old_uclient; xclient = & (bp->fw_stats_data)->queue_stats[i].xstorm_queue_statistics; old_xclient = & (bp->fp_stats + (unsigned long )fp->index)->old_xclient; qstats = & (bp->fp_stats + (unsigned long )fp->index)->eth_q_stats; qstats_old = & (bp->fp_stats + (unsigned long )fp->index)->eth_q_stats_old; tmp___0 = ldv__builtin_expect((bp->msg_enable & 131072) != 0, 0L); if (tmp___0 != 0L) { printk("\rbnx2x: [%s:%d(%s)]queue[%d]: ucast_sent 0x%x, bcast_sent 0x%x mcast_sent 0x%x\n", "bnx2x_storm_stats_update", 1041, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", i, xclient->ucast_pkts_sent, xclient->bcast_pkts_sent, xclient->mcast_pkts_sent); } else { } tmp___1 = ldv__builtin_expect((bp->msg_enable & 131072) != 0, 0L); if (tmp___1 != 0L) { printk("\rbnx2x: [%s:%d(%s)]---------------\n", "bnx2x_storm_stats_update", 1043, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } qstats->total_broadcast_bytes_received_lo = qstats_old->total_broadcast_bytes_received_lo + tclient->rcv_bcast_bytes.lo; qstats->total_broadcast_bytes_received_hi = (qstats_old->total_broadcast_bytes_received_hi + tclient->rcv_bcast_bytes.hi) + (qstats->total_broadcast_bytes_received_lo < qstats_old->total_broadcast_bytes_received_lo ? 1U : 0U); qstats->total_multicast_bytes_received_lo = qstats_old->total_multicast_bytes_received_lo + tclient->rcv_mcast_bytes.lo; qstats->total_multicast_bytes_received_hi = (qstats_old->total_multicast_bytes_received_hi + tclient->rcv_mcast_bytes.hi) + (qstats->total_multicast_bytes_received_lo < qstats_old->total_multicast_bytes_received_lo ? 1U : 0U); qstats->total_unicast_bytes_received_lo = qstats_old->total_unicast_bytes_received_lo + tclient->rcv_ucast_bytes.lo; qstats->total_unicast_bytes_received_hi = (qstats_old->total_unicast_bytes_received_hi + tclient->rcv_ucast_bytes.hi) + (qstats->total_unicast_bytes_received_lo < qstats_old->total_unicast_bytes_received_lo ? 1U : 0U); qstats->total_bytes_received_hi = qstats->total_broadcast_bytes_received_hi; qstats->total_bytes_received_lo = qstats->total_broadcast_bytes_received_lo; qstats->total_bytes_received_lo = qstats->total_bytes_received_lo + qstats->total_multicast_bytes_received_lo; qstats->total_bytes_received_hi = qstats->total_bytes_received_hi + (qstats->total_multicast_bytes_received_hi + (qstats->total_bytes_received_lo < qstats->total_multicast_bytes_received_lo ? 1U : 0U)); qstats->total_bytes_received_lo = qstats->total_bytes_received_lo + qstats->total_unicast_bytes_received_lo; qstats->total_bytes_received_hi = qstats->total_bytes_received_hi + (qstats->total_unicast_bytes_received_hi + (qstats->total_bytes_received_lo < qstats->total_unicast_bytes_received_lo ? 1U : 0U)); qstats->valid_bytes_received_hi = qstats->total_bytes_received_hi; qstats->valid_bytes_received_lo = qstats->total_bytes_received_lo; diff = tclient->rcv_ucast_pkts - old_tclient->rcv_ucast_pkts; old_tclient->rcv_ucast_pkts = tclient->rcv_ucast_pkts; qstats->total_unicast_packets_received_lo = qstats->total_unicast_packets_received_lo + diff; qstats->total_unicast_packets_received_hi = qstats->total_unicast_packets_received_hi + (qstats->total_unicast_packets_received_lo < diff ? 1U : 0U); diff = tclient->rcv_mcast_pkts - old_tclient->rcv_mcast_pkts; old_tclient->rcv_mcast_pkts = tclient->rcv_mcast_pkts; qstats->total_multicast_packets_received_lo = qstats->total_multicast_packets_received_lo + diff; qstats->total_multicast_packets_received_hi = qstats->total_multicast_packets_received_hi + (qstats->total_multicast_packets_received_lo < diff ? 1U : 0U); diff = tclient->rcv_bcast_pkts - old_tclient->rcv_bcast_pkts; old_tclient->rcv_bcast_pkts = tclient->rcv_bcast_pkts; qstats->total_broadcast_packets_received_lo = qstats->total_broadcast_packets_received_lo + diff; qstats->total_broadcast_packets_received_hi = qstats->total_broadcast_packets_received_hi + (qstats->total_broadcast_packets_received_lo < diff ? 1U : 0U); diff = tclient->pkts_too_big_discard - old_tclient->pkts_too_big_discard; old_tclient->pkts_too_big_discard = tclient->pkts_too_big_discard; qstats->etherstatsoverrsizepkts_lo = qstats->etherstatsoverrsizepkts_lo + diff; qstats->etherstatsoverrsizepkts_hi = qstats->etherstatsoverrsizepkts_hi + (qstats->etherstatsoverrsizepkts_lo < diff ? 1U : 0U); estats->etherstatsoverrsizepkts_lo = estats->etherstatsoverrsizepkts_lo + diff; estats->etherstatsoverrsizepkts_hi = estats->etherstatsoverrsizepkts_hi + (estats->etherstatsoverrsizepkts_lo < diff ? 1U : 0U); diff = (u32 )((int )tclient->no_buff_discard - (int )old_tclient->no_buff_discard); old_tclient->no_buff_discard = tclient->no_buff_discard; qstats->no_buff_discard_lo = qstats->no_buff_discard_lo + diff; qstats->no_buff_discard_hi = qstats->no_buff_discard_hi + (qstats->no_buff_discard_lo < diff ? 1U : 0U); estats->no_buff_discard_lo = estats->no_buff_discard_lo + diff; estats->no_buff_discard_hi = estats->no_buff_discard_hi + (estats->no_buff_discard_lo < diff ? 1U : 0U); diff = uclient->ucast_no_buff_pkts - old_uclient->ucast_no_buff_pkts; if (qstats->total_unicast_packets_received_lo < diff) { qstats->total_unicast_packets_received_hi = qstats->total_unicast_packets_received_hi; if (qstats->total_unicast_packets_received_hi != 0U) { qstats->total_unicast_packets_received_hi = qstats->total_unicast_packets_received_hi - 1U; qstats->total_unicast_packets_received_lo = (qstats->total_unicast_packets_received_lo + ~ diff) + 1U; } else { qstats->total_unicast_packets_received_hi = 0U; qstats->total_unicast_packets_received_lo = 0U; } } else { qstats->total_unicast_packets_received_hi = qstats->total_unicast_packets_received_hi; qstats->total_unicast_packets_received_lo = qstats->total_unicast_packets_received_lo - diff; } diff = uclient->mcast_no_buff_pkts - old_uclient->mcast_no_buff_pkts; if (qstats->total_multicast_packets_received_lo < diff) { qstats->total_multicast_packets_received_hi = qstats->total_multicast_packets_received_hi; if (qstats->total_multicast_packets_received_hi != 0U) { qstats->total_multicast_packets_received_hi = qstats->total_multicast_packets_received_hi - 1U; qstats->total_multicast_packets_received_lo = (qstats->total_multicast_packets_received_lo + ~ diff) + 1U; } else { qstats->total_multicast_packets_received_hi = 0U; qstats->total_multicast_packets_received_lo = 0U; } } else { qstats->total_multicast_packets_received_hi = qstats->total_multicast_packets_received_hi; qstats->total_multicast_packets_received_lo = qstats->total_multicast_packets_received_lo - diff; } diff = uclient->bcast_no_buff_pkts - old_uclient->bcast_no_buff_pkts; if (qstats->total_broadcast_packets_received_lo < diff) { qstats->total_broadcast_packets_received_hi = qstats->total_broadcast_packets_received_hi; if (qstats->total_broadcast_packets_received_hi != 0U) { qstats->total_broadcast_packets_received_hi = qstats->total_broadcast_packets_received_hi - 1U; qstats->total_broadcast_packets_received_lo = (qstats->total_broadcast_packets_received_lo + ~ diff) + 1U; } else { qstats->total_broadcast_packets_received_hi = 0U; qstats->total_broadcast_packets_received_lo = 0U; } } else { qstats->total_broadcast_packets_received_hi = qstats->total_broadcast_packets_received_hi; qstats->total_broadcast_packets_received_lo = qstats->total_broadcast_packets_received_lo - diff; } diff = uclient->ucast_no_buff_pkts - old_uclient->ucast_no_buff_pkts; old_uclient->ucast_no_buff_pkts = uclient->ucast_no_buff_pkts; qstats->no_buff_discard_lo = qstats->no_buff_discard_lo + diff; qstats->no_buff_discard_hi = qstats->no_buff_discard_hi + (qstats->no_buff_discard_lo < diff ? 1U : 0U); estats->no_buff_discard_lo = estats->no_buff_discard_lo + diff; estats->no_buff_discard_hi = estats->no_buff_discard_hi + (estats->no_buff_discard_lo < diff ? 1U : 0U); diff = uclient->mcast_no_buff_pkts - old_uclient->mcast_no_buff_pkts; old_uclient->mcast_no_buff_pkts = uclient->mcast_no_buff_pkts; qstats->no_buff_discard_lo = qstats->no_buff_discard_lo + diff; qstats->no_buff_discard_hi = qstats->no_buff_discard_hi + (qstats->no_buff_discard_lo < diff ? 1U : 0U); estats->no_buff_discard_lo = estats->no_buff_discard_lo + diff; estats->no_buff_discard_hi = estats->no_buff_discard_hi + (estats->no_buff_discard_lo < diff ? 1U : 0U); diff = uclient->bcast_no_buff_pkts - old_uclient->bcast_no_buff_pkts; old_uclient->bcast_no_buff_pkts = uclient->bcast_no_buff_pkts; qstats->no_buff_discard_lo = qstats->no_buff_discard_lo + diff; qstats->no_buff_discard_hi = qstats->no_buff_discard_hi + (qstats->no_buff_discard_lo < diff ? 1U : 0U); estats->no_buff_discard_lo = estats->no_buff_discard_lo + diff; estats->no_buff_discard_hi = estats->no_buff_discard_hi + (estats->no_buff_discard_lo < diff ? 1U : 0U); qstats->total_broadcast_bytes_transmitted_lo = qstats_old->total_broadcast_bytes_transmitted_lo + xclient->bcast_bytes_sent.lo; qstats->total_broadcast_bytes_transmitted_hi = (qstats_old->total_broadcast_bytes_transmitted_hi + xclient->bcast_bytes_sent.hi) + (qstats->total_broadcast_bytes_transmitted_lo < qstats_old->total_broadcast_bytes_transmitted_lo ? 1U : 0U); qstats->total_multicast_bytes_transmitted_lo = qstats_old->total_multicast_bytes_transmitted_lo + xclient->mcast_bytes_sent.lo; qstats->total_multicast_bytes_transmitted_hi = (qstats_old->total_multicast_bytes_transmitted_hi + xclient->mcast_bytes_sent.hi) + (qstats->total_multicast_bytes_transmitted_lo < qstats_old->total_multicast_bytes_transmitted_lo ? 1U : 0U); qstats->total_unicast_bytes_transmitted_lo = qstats_old->total_unicast_bytes_transmitted_lo + xclient->ucast_bytes_sent.lo; qstats->total_unicast_bytes_transmitted_hi = (qstats_old->total_unicast_bytes_transmitted_hi + xclient->ucast_bytes_sent.hi) + (qstats->total_unicast_bytes_transmitted_lo < qstats_old->total_unicast_bytes_transmitted_lo ? 1U : 0U); qstats->total_bytes_transmitted_hi = qstats->total_unicast_bytes_transmitted_hi; qstats->total_bytes_transmitted_lo = qstats->total_unicast_bytes_transmitted_lo; qstats->total_bytes_transmitted_lo = qstats->total_bytes_transmitted_lo + qstats->total_broadcast_bytes_transmitted_lo; qstats->total_bytes_transmitted_hi = qstats->total_bytes_transmitted_hi + (qstats->total_broadcast_bytes_transmitted_hi + (qstats->total_bytes_transmitted_lo < qstats->total_broadcast_bytes_transmitted_lo ? 1U : 0U)); qstats->total_bytes_transmitted_lo = qstats->total_bytes_transmitted_lo + qstats->total_multicast_bytes_transmitted_lo; qstats->total_bytes_transmitted_hi = qstats->total_bytes_transmitted_hi + (qstats->total_multicast_bytes_transmitted_hi + (qstats->total_bytes_transmitted_lo < qstats->total_multicast_bytes_transmitted_lo ? 1U : 0U)); diff = xclient->ucast_pkts_sent - old_xclient->ucast_pkts_sent; old_xclient->ucast_pkts_sent = xclient->ucast_pkts_sent; qstats->total_unicast_packets_transmitted_lo = qstats->total_unicast_packets_transmitted_lo + diff; qstats->total_unicast_packets_transmitted_hi = qstats->total_unicast_packets_transmitted_hi + (qstats->total_unicast_packets_transmitted_lo < diff ? 1U : 0U); diff = xclient->mcast_pkts_sent - old_xclient->mcast_pkts_sent; old_xclient->mcast_pkts_sent = xclient->mcast_pkts_sent; qstats->total_multicast_packets_transmitted_lo = qstats->total_multicast_packets_transmitted_lo + diff; qstats->total_multicast_packets_transmitted_hi = qstats->total_multicast_packets_transmitted_hi + (qstats->total_multicast_packets_transmitted_lo < diff ? 1U : 0U); diff = xclient->bcast_pkts_sent - old_xclient->bcast_pkts_sent; old_xclient->bcast_pkts_sent = xclient->bcast_pkts_sent; qstats->total_broadcast_packets_transmitted_lo = qstats->total_broadcast_packets_transmitted_lo + diff; qstats->total_broadcast_packets_transmitted_hi = qstats->total_broadcast_packets_transmitted_hi + (qstats->total_broadcast_packets_transmitted_lo < diff ? 1U : 0U); diff = tclient->checksum_discard - old_tclient->checksum_discard; old_tclient->checksum_discard = tclient->checksum_discard; qstats->total_packets_received_checksum_discarded_lo = qstats->total_packets_received_checksum_discarded_lo + diff; qstats->total_packets_received_checksum_discarded_hi = qstats->total_packets_received_checksum_discarded_hi + (qstats->total_packets_received_checksum_discarded_lo < diff ? 1U : 0U); diff = tclient->ttl0_discard - old_tclient->ttl0_discard; old_tclient->ttl0_discard = tclient->ttl0_discard; qstats->total_packets_received_ttl0_discarded_lo = qstats->total_packets_received_ttl0_discarded_lo + diff; qstats->total_packets_received_ttl0_discarded_hi = qstats->total_packets_received_ttl0_discarded_hi + (qstats->total_packets_received_ttl0_discarded_lo < diff ? 1U : 0U); diff = xclient->error_drop_pkts - old_xclient->error_drop_pkts; old_xclient->error_drop_pkts = xclient->error_drop_pkts; qstats->total_transmitted_dropped_packets_error_lo = qstats->total_transmitted_dropped_packets_error_lo + diff; qstats->total_transmitted_dropped_packets_error_hi = qstats->total_transmitted_dropped_packets_error_hi + (qstats->total_transmitted_dropped_packets_error_lo < diff ? 1U : 0U); diff = uclient->coalesced_events - old_uclient->coalesced_events; old_uclient->coalesced_events = uclient->coalesced_events; qstats->total_tpa_aggregations_lo = qstats->total_tpa_aggregations_lo + diff; qstats->total_tpa_aggregations_hi = qstats->total_tpa_aggregations_hi + (qstats->total_tpa_aggregations_lo < diff ? 1U : 0U); estats->total_tpa_aggregations_lo = estats->total_tpa_aggregations_lo + diff; estats->total_tpa_aggregations_hi = estats->total_tpa_aggregations_hi + (estats->total_tpa_aggregations_lo < diff ? 1U : 0U); diff = uclient->coalesced_pkts - old_uclient->coalesced_pkts; old_uclient->coalesced_pkts = uclient->coalesced_pkts; qstats->total_tpa_aggregated_frames_lo = qstats->total_tpa_aggregated_frames_lo + diff; qstats->total_tpa_aggregated_frames_hi = qstats->total_tpa_aggregated_frames_hi + (qstats->total_tpa_aggregated_frames_lo < diff ? 1U : 0U); estats->total_tpa_aggregated_frames_lo = estats->total_tpa_aggregated_frames_lo + diff; estats->total_tpa_aggregated_frames_hi = estats->total_tpa_aggregated_frames_hi + (estats->total_tpa_aggregated_frames_lo < diff ? 1U : 0U); qstats->total_tpa_bytes_lo = qstats_old->total_tpa_bytes_lo + uclient->coalesced_bytes.lo; qstats->total_tpa_bytes_hi = (qstats_old->total_tpa_bytes_hi + uclient->coalesced_bytes.hi) + (qstats->total_tpa_bytes_lo < qstats_old->total_tpa_bytes_lo ? 1U : 0U); estats->total_tpa_bytes_lo = estats->total_tpa_bytes_lo + qstats->total_tpa_bytes_lo; estats->total_tpa_bytes_hi = estats->total_tpa_bytes_hi + (qstats->total_tpa_bytes_hi + (estats->total_tpa_bytes_lo < qstats->total_tpa_bytes_lo ? 1U : 0U)); if (estats->total_tpa_bytes_lo < qstats_old->total_tpa_bytes_lo_old) { estats->total_tpa_bytes_hi = estats->total_tpa_bytes_hi - qstats_old->total_tpa_bytes_hi_old; if (estats->total_tpa_bytes_hi != 0U) { estats->total_tpa_bytes_hi = estats->total_tpa_bytes_hi - 1U; estats->total_tpa_bytes_lo = (estats->total_tpa_bytes_lo + ~ qstats_old->total_tpa_bytes_lo_old) + 1U; } else { estats->total_tpa_bytes_hi = 0U; estats->total_tpa_bytes_lo = 0U; } } else if (estats->total_tpa_bytes_hi < qstats_old->total_tpa_bytes_hi_old) { estats->total_tpa_bytes_hi = 0U; estats->total_tpa_bytes_lo = 0U; } else { estats->total_tpa_bytes_hi = estats->total_tpa_bytes_hi - qstats_old->total_tpa_bytes_hi_old; estats->total_tpa_bytes_lo = estats->total_tpa_bytes_lo - qstats_old->total_tpa_bytes_lo_old; } qstats_old->total_tpa_bytes_hi_old = qstats->total_tpa_bytes_hi; qstats_old->total_tpa_bytes_lo_old = qstats->total_tpa_bytes_lo; fstats->total_bytes_received_lo = fstats->total_bytes_received_lo + qstats->total_bytes_received_lo; fstats->total_bytes_received_hi = fstats->total_bytes_received_hi + (qstats->total_bytes_received_hi + (fstats->total_bytes_received_lo < qstats->total_bytes_received_lo ? 1U : 0U)); if (fstats->total_bytes_received_lo < qstats_old->total_bytes_received_lo) { fstats->total_bytes_received_hi = fstats->total_bytes_received_hi - qstats_old->total_bytes_received_hi; if (fstats->total_bytes_received_hi != 0U) { fstats->total_bytes_received_hi = fstats->total_bytes_received_hi - 1U; fstats->total_bytes_received_lo = (fstats->total_bytes_received_lo + ~ qstats_old->total_bytes_received_lo) + 1U; } else { fstats->total_bytes_received_hi = 0U; fstats->total_bytes_received_lo = 0U; } } else if (fstats->total_bytes_received_hi < qstats_old->total_bytes_received_hi) { fstats->total_bytes_received_hi = 0U; fstats->total_bytes_received_lo = 0U; } else { fstats->total_bytes_received_hi = fstats->total_bytes_received_hi - qstats_old->total_bytes_received_hi; fstats->total_bytes_received_lo = fstats->total_bytes_received_lo - qstats_old->total_bytes_received_lo; } estats->total_bytes_received_hi = fstats->total_bytes_received_hi; estats->total_bytes_received_lo = fstats->total_bytes_received_lo; qstats_old->total_bytes_received_hi = qstats->total_bytes_received_hi; qstats_old->total_bytes_received_lo = qstats->total_bytes_received_lo; fstats->total_bytes_transmitted_lo = fstats->total_bytes_transmitted_lo + qstats->total_bytes_transmitted_lo; fstats->total_bytes_transmitted_hi = fstats->total_bytes_transmitted_hi + (qstats->total_bytes_transmitted_hi + (fstats->total_bytes_transmitted_lo < qstats->total_bytes_transmitted_lo ? 1U : 0U)); if (fstats->total_bytes_transmitted_lo < qstats_old->total_bytes_transmitted_lo) { fstats->total_bytes_transmitted_hi = fstats->total_bytes_transmitted_hi - qstats_old->total_bytes_transmitted_hi; if (fstats->total_bytes_transmitted_hi != 0U) { fstats->total_bytes_transmitted_hi = fstats->total_bytes_transmitted_hi - 1U; fstats->total_bytes_transmitted_lo = (fstats->total_bytes_transmitted_lo + ~ qstats_old->total_bytes_transmitted_lo) + 1U; } else { fstats->total_bytes_transmitted_hi = 0U; fstats->total_bytes_transmitted_lo = 0U; } } else if (fstats->total_bytes_transmitted_hi < qstats_old->total_bytes_transmitted_hi) { fstats->total_bytes_transmitted_hi = 0U; fstats->total_bytes_transmitted_lo = 0U; } else { fstats->total_bytes_transmitted_hi = fstats->total_bytes_transmitted_hi - qstats_old->total_bytes_transmitted_hi; fstats->total_bytes_transmitted_lo = fstats->total_bytes_transmitted_lo - qstats_old->total_bytes_transmitted_lo; } estats->total_bytes_transmitted_hi = fstats->total_bytes_transmitted_hi; estats->total_bytes_transmitted_lo = fstats->total_bytes_transmitted_lo; qstats_old->total_bytes_transmitted_hi = qstats->total_bytes_transmitted_hi; qstats_old->total_bytes_transmitted_lo = qstats->total_bytes_transmitted_lo; fstats->total_unicast_packets_received_lo = fstats->total_unicast_packets_received_lo + qstats->total_unicast_packets_received_lo; fstats->total_unicast_packets_received_hi = fstats->total_unicast_packets_received_hi + (qstats->total_unicast_packets_received_hi + (fstats->total_unicast_packets_received_lo < qstats->total_unicast_packets_received_lo ? 1U : 0U)); if (fstats->total_unicast_packets_received_lo < qstats_old->total_unicast_packets_received_lo) { fstats->total_unicast_packets_received_hi = fstats->total_unicast_packets_received_hi - qstats_old->total_unicast_packets_received_hi; if (fstats->total_unicast_packets_received_hi != 0U) { fstats->total_unicast_packets_received_hi = fstats->total_unicast_packets_received_hi - 1U; fstats->total_unicast_packets_received_lo = (fstats->total_unicast_packets_received_lo + ~ qstats_old->total_unicast_packets_received_lo) + 1U; } else { fstats->total_unicast_packets_received_hi = 0U; fstats->total_unicast_packets_received_lo = 0U; } } else if (fstats->total_unicast_packets_received_hi < qstats_old->total_unicast_packets_received_hi) { fstats->total_unicast_packets_received_hi = 0U; fstats->total_unicast_packets_received_lo = 0U; } else { fstats->total_unicast_packets_received_hi = fstats->total_unicast_packets_received_hi - qstats_old->total_unicast_packets_received_hi; fstats->total_unicast_packets_received_lo = fstats->total_unicast_packets_received_lo - qstats_old->total_unicast_packets_received_lo; } estats->total_unicast_packets_received_hi = fstats->total_unicast_packets_received_hi; estats->total_unicast_packets_received_lo = fstats->total_unicast_packets_received_lo; qstats_old->total_unicast_packets_received_hi = qstats->total_unicast_packets_received_hi; qstats_old->total_unicast_packets_received_lo = qstats->total_unicast_packets_received_lo; fstats->total_multicast_packets_received_lo = fstats->total_multicast_packets_received_lo + qstats->total_multicast_packets_received_lo; fstats->total_multicast_packets_received_hi = fstats->total_multicast_packets_received_hi + (qstats->total_multicast_packets_received_hi + (fstats->total_multicast_packets_received_lo < qstats->total_multicast_packets_received_lo ? 1U : 0U)); if (fstats->total_multicast_packets_received_lo < qstats_old->total_multicast_packets_received_lo) { fstats->total_multicast_packets_received_hi = fstats->total_multicast_packets_received_hi - qstats_old->total_multicast_packets_received_hi; if (fstats->total_multicast_packets_received_hi != 0U) { fstats->total_multicast_packets_received_hi = fstats->total_multicast_packets_received_hi - 1U; fstats->total_multicast_packets_received_lo = (fstats->total_multicast_packets_received_lo + ~ qstats_old->total_multicast_packets_received_lo) + 1U; } else { fstats->total_multicast_packets_received_hi = 0U; fstats->total_multicast_packets_received_lo = 0U; } } else if (fstats->total_multicast_packets_received_hi < qstats_old->total_multicast_packets_received_hi) { fstats->total_multicast_packets_received_hi = 0U; fstats->total_multicast_packets_received_lo = 0U; } else { fstats->total_multicast_packets_received_hi = fstats->total_multicast_packets_received_hi - qstats_old->total_multicast_packets_received_hi; fstats->total_multicast_packets_received_lo = fstats->total_multicast_packets_received_lo - qstats_old->total_multicast_packets_received_lo; } estats->total_multicast_packets_received_hi = fstats->total_multicast_packets_received_hi; estats->total_multicast_packets_received_lo = fstats->total_multicast_packets_received_lo; qstats_old->total_multicast_packets_received_hi = qstats->total_multicast_packets_received_hi; qstats_old->total_multicast_packets_received_lo = qstats->total_multicast_packets_received_lo; fstats->total_broadcast_packets_received_lo = fstats->total_broadcast_packets_received_lo + qstats->total_broadcast_packets_received_lo; fstats->total_broadcast_packets_received_hi = fstats->total_broadcast_packets_received_hi + (qstats->total_broadcast_packets_received_hi + (fstats->total_broadcast_packets_received_lo < qstats->total_broadcast_packets_received_lo ? 1U : 0U)); if (fstats->total_broadcast_packets_received_lo < qstats_old->total_broadcast_packets_received_lo) { fstats->total_broadcast_packets_received_hi = fstats->total_broadcast_packets_received_hi - qstats_old->total_broadcast_packets_received_hi; if (fstats->total_broadcast_packets_received_hi != 0U) { fstats->total_broadcast_packets_received_hi = fstats->total_broadcast_packets_received_hi - 1U; fstats->total_broadcast_packets_received_lo = (fstats->total_broadcast_packets_received_lo + ~ qstats_old->total_broadcast_packets_received_lo) + 1U; } else { fstats->total_broadcast_packets_received_hi = 0U; fstats->total_broadcast_packets_received_lo = 0U; } } else if (fstats->total_broadcast_packets_received_hi < qstats_old->total_broadcast_packets_received_hi) { fstats->total_broadcast_packets_received_hi = 0U; fstats->total_broadcast_packets_received_lo = 0U; } else { fstats->total_broadcast_packets_received_hi = fstats->total_broadcast_packets_received_hi - qstats_old->total_broadcast_packets_received_hi; fstats->total_broadcast_packets_received_lo = fstats->total_broadcast_packets_received_lo - qstats_old->total_broadcast_packets_received_lo; } estats->total_broadcast_packets_received_hi = fstats->total_broadcast_packets_received_hi; estats->total_broadcast_packets_received_lo = fstats->total_broadcast_packets_received_lo; qstats_old->total_broadcast_packets_received_hi = qstats->total_broadcast_packets_received_hi; qstats_old->total_broadcast_packets_received_lo = qstats->total_broadcast_packets_received_lo; fstats->total_unicast_packets_transmitted_lo = fstats->total_unicast_packets_transmitted_lo + qstats->total_unicast_packets_transmitted_lo; fstats->total_unicast_packets_transmitted_hi = fstats->total_unicast_packets_transmitted_hi + (qstats->total_unicast_packets_transmitted_hi + (fstats->total_unicast_packets_transmitted_lo < qstats->total_unicast_packets_transmitted_lo ? 1U : 0U)); if (fstats->total_unicast_packets_transmitted_lo < qstats_old->total_unicast_packets_transmitted_lo) { fstats->total_unicast_packets_transmitted_hi = fstats->total_unicast_packets_transmitted_hi - qstats_old->total_unicast_packets_transmitted_hi; if (fstats->total_unicast_packets_transmitted_hi != 0U) { fstats->total_unicast_packets_transmitted_hi = fstats->total_unicast_packets_transmitted_hi - 1U; fstats->total_unicast_packets_transmitted_lo = (fstats->total_unicast_packets_transmitted_lo + ~ qstats_old->total_unicast_packets_transmitted_lo) + 1U; } else { fstats->total_unicast_packets_transmitted_hi = 0U; fstats->total_unicast_packets_transmitted_lo = 0U; } } else if (fstats->total_unicast_packets_transmitted_hi < qstats_old->total_unicast_packets_transmitted_hi) { fstats->total_unicast_packets_transmitted_hi = 0U; fstats->total_unicast_packets_transmitted_lo = 0U; } else { fstats->total_unicast_packets_transmitted_hi = fstats->total_unicast_packets_transmitted_hi - qstats_old->total_unicast_packets_transmitted_hi; fstats->total_unicast_packets_transmitted_lo = fstats->total_unicast_packets_transmitted_lo - qstats_old->total_unicast_packets_transmitted_lo; } estats->total_unicast_packets_transmitted_hi = fstats->total_unicast_packets_transmitted_hi; estats->total_unicast_packets_transmitted_lo = fstats->total_unicast_packets_transmitted_lo; qstats_old->total_unicast_packets_transmitted_hi = qstats->total_unicast_packets_transmitted_hi; qstats_old->total_unicast_packets_transmitted_lo = qstats->total_unicast_packets_transmitted_lo; fstats->total_multicast_packets_transmitted_lo = fstats->total_multicast_packets_transmitted_lo + qstats->total_multicast_packets_transmitted_lo; fstats->total_multicast_packets_transmitted_hi = fstats->total_multicast_packets_transmitted_hi + (qstats->total_multicast_packets_transmitted_hi + (fstats->total_multicast_packets_transmitted_lo < qstats->total_multicast_packets_transmitted_lo ? 1U : 0U)); if (fstats->total_multicast_packets_transmitted_lo < qstats_old->total_multicast_packets_transmitted_lo) { fstats->total_multicast_packets_transmitted_hi = fstats->total_multicast_packets_transmitted_hi - qstats_old->total_multicast_packets_transmitted_hi; if (fstats->total_multicast_packets_transmitted_hi != 0U) { fstats->total_multicast_packets_transmitted_hi = fstats->total_multicast_packets_transmitted_hi - 1U; fstats->total_multicast_packets_transmitted_lo = (fstats->total_multicast_packets_transmitted_lo + ~ qstats_old->total_multicast_packets_transmitted_lo) + 1U; } else { fstats->total_multicast_packets_transmitted_hi = 0U; fstats->total_multicast_packets_transmitted_lo = 0U; } } else if (fstats->total_multicast_packets_transmitted_hi < qstats_old->total_multicast_packets_transmitted_hi) { fstats->total_multicast_packets_transmitted_hi = 0U; fstats->total_multicast_packets_transmitted_lo = 0U; } else { fstats->total_multicast_packets_transmitted_hi = fstats->total_multicast_packets_transmitted_hi - qstats_old->total_multicast_packets_transmitted_hi; fstats->total_multicast_packets_transmitted_lo = fstats->total_multicast_packets_transmitted_lo - qstats_old->total_multicast_packets_transmitted_lo; } estats->total_multicast_packets_transmitted_hi = fstats->total_multicast_packets_transmitted_hi; estats->total_multicast_packets_transmitted_lo = fstats->total_multicast_packets_transmitted_lo; qstats_old->total_multicast_packets_transmitted_hi = qstats->total_multicast_packets_transmitted_hi; qstats_old->total_multicast_packets_transmitted_lo = qstats->total_multicast_packets_transmitted_lo; fstats->total_broadcast_packets_transmitted_lo = fstats->total_broadcast_packets_transmitted_lo + qstats->total_broadcast_packets_transmitted_lo; fstats->total_broadcast_packets_transmitted_hi = fstats->total_broadcast_packets_transmitted_hi + (qstats->total_broadcast_packets_transmitted_hi + (fstats->total_broadcast_packets_transmitted_lo < qstats->total_broadcast_packets_transmitted_lo ? 1U : 0U)); if (fstats->total_broadcast_packets_transmitted_lo < qstats_old->total_broadcast_packets_transmitted_lo) { fstats->total_broadcast_packets_transmitted_hi = fstats->total_broadcast_packets_transmitted_hi - qstats_old->total_broadcast_packets_transmitted_hi; if (fstats->total_broadcast_packets_transmitted_hi != 0U) { fstats->total_broadcast_packets_transmitted_hi = fstats->total_broadcast_packets_transmitted_hi - 1U; fstats->total_broadcast_packets_transmitted_lo = (fstats->total_broadcast_packets_transmitted_lo + ~ qstats_old->total_broadcast_packets_transmitted_lo) + 1U; } else { fstats->total_broadcast_packets_transmitted_hi = 0U; fstats->total_broadcast_packets_transmitted_lo = 0U; } } else if (fstats->total_broadcast_packets_transmitted_hi < qstats_old->total_broadcast_packets_transmitted_hi) { fstats->total_broadcast_packets_transmitted_hi = 0U; fstats->total_broadcast_packets_transmitted_lo = 0U; } else { fstats->total_broadcast_packets_transmitted_hi = fstats->total_broadcast_packets_transmitted_hi - qstats_old->total_broadcast_packets_transmitted_hi; fstats->total_broadcast_packets_transmitted_lo = fstats->total_broadcast_packets_transmitted_lo - qstats_old->total_broadcast_packets_transmitted_lo; } estats->total_broadcast_packets_transmitted_hi = fstats->total_broadcast_packets_transmitted_hi; estats->total_broadcast_packets_transmitted_lo = fstats->total_broadcast_packets_transmitted_lo; qstats_old->total_broadcast_packets_transmitted_hi = qstats->total_broadcast_packets_transmitted_hi; qstats_old->total_broadcast_packets_transmitted_lo = qstats->total_broadcast_packets_transmitted_lo; fstats->valid_bytes_received_lo = fstats->valid_bytes_received_lo + qstats->valid_bytes_received_lo; fstats->valid_bytes_received_hi = fstats->valid_bytes_received_hi + (qstats->valid_bytes_received_hi + (fstats->valid_bytes_received_lo < qstats->valid_bytes_received_lo ? 1U : 0U)); if (fstats->valid_bytes_received_lo < qstats_old->valid_bytes_received_lo) { fstats->valid_bytes_received_hi = fstats->valid_bytes_received_hi - qstats_old->valid_bytes_received_hi; if (fstats->valid_bytes_received_hi != 0U) { fstats->valid_bytes_received_hi = fstats->valid_bytes_received_hi - 1U; fstats->valid_bytes_received_lo = (fstats->valid_bytes_received_lo + ~ qstats_old->valid_bytes_received_lo) + 1U; } else { fstats->valid_bytes_received_hi = 0U; fstats->valid_bytes_received_lo = 0U; } } else if (fstats->valid_bytes_received_hi < qstats_old->valid_bytes_received_hi) { fstats->valid_bytes_received_hi = 0U; fstats->valid_bytes_received_lo = 0U; } else { fstats->valid_bytes_received_hi = fstats->valid_bytes_received_hi - qstats_old->valid_bytes_received_hi; fstats->valid_bytes_received_lo = fstats->valid_bytes_received_lo - qstats_old->valid_bytes_received_lo; } estats->valid_bytes_received_hi = fstats->valid_bytes_received_hi; estats->valid_bytes_received_lo = fstats->valid_bytes_received_lo; qstats_old->valid_bytes_received_hi = qstats->valid_bytes_received_hi; qstats_old->valid_bytes_received_lo = qstats->valid_bytes_received_lo; i = i + 1; ldv_45174: ; if ((uint )i < bp->num_ethernet_queues) { goto ldv_45173; } else { } estats->total_bytes_received_lo = estats->total_bytes_received_lo + estats->rx_stat_ifhcinbadoctets_lo; estats->total_bytes_received_hi = estats->total_bytes_received_hi + (estats->rx_stat_ifhcinbadoctets_hi + (estats->total_bytes_received_lo < estats->rx_stat_ifhcinbadoctets_lo ? 1U : 0U)); estats->total_bytes_received_lo = estats->total_bytes_received_lo + tfunc->rcv_error_bytes.lo; estats->total_bytes_received_hi = estats->total_bytes_received_hi + (tfunc->rcv_error_bytes.hi + (estats->total_bytes_received_lo < tfunc->rcv_error_bytes.lo ? 1U : 0U)); estats->error_bytes_received_lo = estats->error_bytes_received_lo + tfunc->rcv_error_bytes.lo; estats->error_bytes_received_hi = estats->error_bytes_received_hi + (tfunc->rcv_error_bytes.hi + (estats->error_bytes_received_lo < tfunc->rcv_error_bytes.lo ? 1U : 0U)); if (estats->etherstatsoverrsizepkts_lo < estats_old->rx_stat_dot3statsframestoolong_lo) { estats->etherstatsoverrsizepkts_hi = estats->etherstatsoverrsizepkts_hi - estats_old->rx_stat_dot3statsframestoolong_hi; if (estats->etherstatsoverrsizepkts_hi != 0U) { estats->etherstatsoverrsizepkts_hi = estats->etherstatsoverrsizepkts_hi - 1U; estats->etherstatsoverrsizepkts_lo = (estats->etherstatsoverrsizepkts_lo + ~ estats_old->rx_stat_dot3statsframestoolong_lo) + 1U; } else { estats->etherstatsoverrsizepkts_hi = 0U; estats->etherstatsoverrsizepkts_lo = 0U; } } else if (estats->etherstatsoverrsizepkts_hi < estats_old->rx_stat_dot3statsframestoolong_hi) { estats->etherstatsoverrsizepkts_hi = 0U; estats->etherstatsoverrsizepkts_lo = 0U; } else { estats->etherstatsoverrsizepkts_hi = estats->etherstatsoverrsizepkts_hi - estats_old->rx_stat_dot3statsframestoolong_hi; estats->etherstatsoverrsizepkts_lo = estats->etherstatsoverrsizepkts_lo - estats_old->rx_stat_dot3statsframestoolong_lo; } estats->etherstatsoverrsizepkts_lo = estats->etherstatsoverrsizepkts_lo + estats->rx_stat_dot3statsframestoolong_lo; estats->etherstatsoverrsizepkts_hi = estats->etherstatsoverrsizepkts_hi + (estats->rx_stat_dot3statsframestoolong_hi + (estats->etherstatsoverrsizepkts_lo < estats->rx_stat_dot3statsframestoolong_lo ? 1U : 0U)); estats_old->rx_stat_dot3statsframestoolong_hi = estats->rx_stat_dot3statsframestoolong_hi; estats_old->rx_stat_dot3statsframestoolong_lo = estats->rx_stat_dot3statsframestoolong_lo; estats->error_bytes_received_lo = estats->error_bytes_received_lo + estats->rx_stat_ifhcinbadoctets_lo; estats->error_bytes_received_hi = estats->error_bytes_received_hi + (estats->rx_stat_ifhcinbadoctets_hi + (estats->error_bytes_received_lo < estats->rx_stat_ifhcinbadoctets_lo ? 1U : 0U)); if (bp->port.pmf != 0U) { fwstats = & bp->fw_stats_old; estats->mac_filter_discard = tport->mac_filter_discard + fwstats->mac_filter_discard; estats->mf_tag_discard = tport->mf_tag_discard + fwstats->mf_tag_discard; estats->brb_truncate_discard = tport->brb_truncate_discard + fwstats->brb_truncate_discard; estats->mac_discard = tport->mac_discard + fwstats->mac_discard; } else { } fstats->host_func_stats_end = fstats->host_func_stats_end + 1U; fstats->host_func_stats_start = fstats->host_func_stats_end; bp->stats_pending = 0U; return (0); } } static void bnx2x_net_stats_update(struct bnx2x *bp ) { struct bnx2x_eth_stats *estats ; struct net_device_stats *nstats ; unsigned long tmp ; int i ; long tmp___0 ; long tmp___1 ; long tmp___2 ; long tmp___3 ; long tmp___4 ; long tmp___5 ; long tmp___6 ; long tmp___7 ; struct tstorm_per_queue_stats *old_tclient ; long tmp___8 ; long tmp___9 ; long tmp___10 ; long tmp___11 ; long tmp___12 ; long tmp___13 ; long tmp___14 ; long tmp___15 ; long tmp___16 ; long tmp___17 ; long tmp___18 ; long tmp___19 ; long tmp___20 ; { estats = & bp->eth_stats; nstats = & (bp->dev)->stats; tmp___0 = bnx2x_hilo(& estats->total_unicast_packets_received_hi); tmp___1 = bnx2x_hilo(& estats->total_multicast_packets_received_hi); tmp___2 = bnx2x_hilo(& estats->total_broadcast_packets_received_hi); nstats->rx_packets = (unsigned long )((tmp___0 + tmp___1) + tmp___2); tmp___3 = bnx2x_hilo(& estats->total_unicast_packets_transmitted_hi); tmp___4 = bnx2x_hilo(& estats->total_multicast_packets_transmitted_hi); tmp___5 = bnx2x_hilo(& estats->total_broadcast_packets_transmitted_hi); nstats->tx_packets = (unsigned long )((tmp___3 + tmp___4) + tmp___5); tmp___6 = bnx2x_hilo(& estats->total_bytes_received_hi); nstats->rx_bytes = (unsigned long )tmp___6; tmp___7 = bnx2x_hilo(& estats->total_bytes_transmitted_hi); nstats->tx_bytes = (unsigned long )tmp___7; tmp = (unsigned long )estats->mac_discard; i = 0; goto ldv_45187; ldv_45186: ; if ((bp->flags & 32768U) != 0U && (uint )i == (uint )bp->num_queues - bp->num_cnic_queues) { } else { old_tclient = & (bp->fp_stats + (unsigned long )i)->old_tclient; tmp = (unsigned long )old_tclient->checksum_discard + tmp; } i = i + 1; ldv_45187: ; if (bp->num_queues > i) { goto ldv_45186; } else { } nstats->rx_dropped = (unsigned long )bp->net_stats_old.rx_dropped + tmp; nstats->tx_dropped = 0UL; tmp___8 = bnx2x_hilo(& estats->total_multicast_packets_received_hi); nstats->multicast = (unsigned long )tmp___8; tmp___9 = bnx2x_hilo(& estats->tx_stat_etherstatscollisions_hi); nstats->collisions = (unsigned long )tmp___9; tmp___10 = bnx2x_hilo(& estats->rx_stat_etherstatsundersizepkts_hi); tmp___11 = bnx2x_hilo(& estats->etherstatsoverrsizepkts_hi); nstats->rx_length_errors = (unsigned long )(tmp___10 + tmp___11); tmp___12 = bnx2x_hilo(& estats->brb_drop_hi); tmp___13 = bnx2x_hilo(& estats->brb_truncate_hi); nstats->rx_over_errors = (unsigned long )(tmp___12 + tmp___13); tmp___14 = bnx2x_hilo(& estats->rx_stat_dot3statsfcserrors_hi); nstats->rx_crc_errors = (unsigned long )tmp___14; tmp___15 = bnx2x_hilo(& estats->rx_stat_dot3statsalignmenterrors_hi); nstats->rx_frame_errors = (unsigned long )tmp___15; tmp___16 = bnx2x_hilo(& estats->no_buff_discard_hi); nstats->rx_fifo_errors = (unsigned long )tmp___16; nstats->rx_missed_errors = 0UL; nstats->rx_errors = ((((nstats->rx_length_errors + nstats->rx_over_errors) + nstats->rx_crc_errors) + nstats->rx_frame_errors) + nstats->rx_fifo_errors) + nstats->rx_missed_errors; tmp___17 = bnx2x_hilo(& estats->tx_stat_dot3statslatecollisions_hi); tmp___18 = bnx2x_hilo(& estats->tx_stat_dot3statsexcessivecollisions_hi); nstats->tx_aborted_errors = (unsigned long )(tmp___17 + tmp___18); tmp___19 = bnx2x_hilo(& estats->rx_stat_dot3statscarriersenseerrors_hi); nstats->tx_carrier_errors = (unsigned long )tmp___19; nstats->tx_fifo_errors = 0UL; nstats->tx_heartbeat_errors = 0UL; nstats->tx_window_errors = 0UL; tmp___20 = bnx2x_hilo(& estats->tx_stat_dot3statsinternalmactransmiterrors_hi); nstats->tx_errors = (nstats->tx_aborted_errors + nstats->tx_carrier_errors) + (unsigned long )tmp___20; return; } } static void bnx2x_drv_stats_update(struct bnx2x *bp ) { struct bnx2x_eth_stats *estats ; int i ; struct bnx2x_eth_q_stats *qstats ; struct bnx2x_eth_q_stats_old *qstats_old ; { estats = & bp->eth_stats; i = 0; goto ldv_45198; ldv_45197: ; if ((bp->flags & 32768U) != 0U && (uint )i == (uint )bp->num_queues - bp->num_cnic_queues) { } else { qstats = & (bp->fp_stats + (unsigned long )i)->eth_q_stats; qstats_old = & (bp->fp_stats + (unsigned long )i)->eth_q_stats_old; estats->driver_xoff = estats->driver_xoff + qstats->driver_xoff; estats->driver_xoff = estats->driver_xoff - qstats_old->driver_xoff_old; qstats_old->driver_xoff_old = qstats->driver_xoff; estats->rx_err_discard_pkt = estats->rx_err_discard_pkt + qstats->rx_err_discard_pkt; estats->rx_err_discard_pkt = estats->rx_err_discard_pkt - qstats_old->rx_err_discard_pkt_old; qstats_old->rx_err_discard_pkt_old = qstats->rx_err_discard_pkt; estats->rx_skb_alloc_failed = estats->rx_skb_alloc_failed + qstats->rx_skb_alloc_failed; estats->rx_skb_alloc_failed = estats->rx_skb_alloc_failed - qstats_old->rx_skb_alloc_failed_old; qstats_old->rx_skb_alloc_failed_old = qstats->rx_skb_alloc_failed; estats->hw_csum_err = estats->hw_csum_err + qstats->hw_csum_err; estats->hw_csum_err = estats->hw_csum_err - qstats_old->hw_csum_err_old; qstats_old->hw_csum_err_old = qstats->hw_csum_err; estats->driver_filtered_tx_pkt = estats->driver_filtered_tx_pkt + qstats->driver_filtered_tx_pkt; estats->driver_filtered_tx_pkt = estats->driver_filtered_tx_pkt - qstats_old->driver_filtered_tx_pkt_old; qstats_old->driver_filtered_tx_pkt_old = qstats->driver_filtered_tx_pkt; } i = i + 1; ldv_45198: ; if (bp->num_queues > i) { goto ldv_45197; } else { } return; } } static bool bnx2x_edebug_stats_stopped(struct bnx2x *bp ) { u32 val ; unsigned int tmp ; { if (bp->common.shmem2_base != 0U) { tmp = readl((void const volatile *)bp->regview + (unsigned long )bp->common.shmem2_base); if (tmp > 108U) { val = readl((void const volatile *)(bp->regview + ((unsigned long )bp->common.shmem2_base + 108UL))); if (val == 3U) { return (1); } else { } } else { } } else { } return (0); } } static void bnx2x_stats_update(struct bnx2x *bp ) { u32 *stats_comp ; bool tmp ; u16 tmp___0 ; int tmp___1 ; struct bnx2x_eth_stats *estats ; struct _ddebug descriptor ; long tmp___2 ; { stats_comp = & (bp->slowpath)->stats_comp; tmp = bnx2x_edebug_stats_stopped(bp); if ((int )tmp) { return; } else { } if ((bp->flags & 4194304U) == 0U) { if (*stats_comp != 1624297646U) { return; } else { } if (bp->port.pmf != 0U) { bnx2x_hw_stats_update(bp); } else { } tmp___1 = bnx2x_storm_stats_update(bp); if (tmp___1 != 0) { tmp___0 = bp->stats_pending; bp->stats_pending = (u16 )((int )bp->stats_pending + 1); if ((unsigned int )tmp___0 == 3U) { printk("\vbnx2x: [%s:%d(%s)]storm stats were not updated for 3 times\n", "bnx2x_stats_update", 1314, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); bp->panic = 1; printk("\vbnx2x: [%s:%d(%s)]driver assert\n", "bnx2x_stats_update", 1315, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); bnx2x_panic_dump(bp, 0); } else { } return; } else { } } else { bnx2x_storm_stats_update(bp); } bnx2x_net_stats_update(bp); bnx2x_drv_stats_update(bp); if ((bp->flags & 4194304U) != 0U) { return; } else { } if ((bp->msg_enable & 8) != 0) { estats = & bp->eth_stats; descriptor.modname = "bnx2x"; descriptor.function = "bnx2x_stats_update"; descriptor.filename = "/work/ldvuser/exper_fp/work/current--X--drivers--X--defaultlinux-3.10-rc1.tar--X--32_7a--X--cpachecker/linux-3.10-rc1.tar/csd_deg_dscv/8504/dscv_tempdir/dscv/ri/32_7a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_stats.c.prepared"; descriptor.format = "brb drops %u brb truncate %u\n"; descriptor.lineno = 1337U; descriptor.flags = 0U; tmp___2 = ldv__builtin_expect((long )descriptor.flags & 1L, 0L); if (tmp___2 != 0L) { __dynamic_netdev_dbg(& descriptor, (struct net_device const *)bp->dev, "brb drops %u brb truncate %u\n", estats->brb_drop_lo, estats->brb_truncate_lo); } else { } } else { } bnx2x_hw_stats_post(bp); bnx2x_storm_stats_post(bp); return; } } static void bnx2x_port_stats_stop(struct bnx2x *bp ) { struct dmae_command *dmae ; u32 opcode ; int loader_idx ; u32 *stats_comp ; int tmp ; int tmp___0 ; { loader_idx = ((int )bp->pfid & 1) * 8 + 4; stats_comp = & (bp->slowpath)->stats_comp; bp->executer_idx = 0; opcode = bnx2x_dmae_opcode(bp, 0, 2, 0, 0); if (bp->port.port_stx != 0U) { tmp = bp->executer_idx; bp->executer_idx = bp->executer_idx + 1; dmae = (struct dmae_command *)(& (bp->slowpath)->dmae) + (unsigned long )tmp; if (bp->func_stx != 0U) { dmae->opcode = bnx2x_dmae_opcode_add_comp(opcode, 1); } else { dmae->opcode = bnx2x_dmae_opcode_add_comp(opcode, 0); } dmae->src_addr_lo = (unsigned int )bp->slowpath_mapping + 3660U; dmae->src_addr_hi = (unsigned int )((bp->slowpath_mapping + 3660ULL) >> 32); dmae->dst_addr_lo = bp->port.port_stx >> 2; dmae->dst_addr_hi = 0U; dmae->len = bnx2x_get_port_stats_dma_len(bp); if (bp->func_stx != 0U) { dmae->comp_addr_lo = dmae_reg_go_c___0[loader_idx] >> 2; dmae->comp_addr_hi = 0U; dmae->comp_val = 1U; } else { dmae->comp_addr_lo = (unsigned int )bp->slowpath_mapping + 3128U; dmae->comp_addr_hi = (unsigned int )((bp->slowpath_mapping + 3128ULL) >> 32); dmae->comp_val = 1624297646U; *stats_comp = 0U; } } else { } if (bp->func_stx != 0U) { tmp___0 = bp->executer_idx; bp->executer_idx = bp->executer_idx + 1; dmae = (struct dmae_command *)(& (bp->slowpath)->dmae) + (unsigned long )tmp___0; dmae->opcode = bnx2x_dmae_opcode_add_comp(opcode, 0); dmae->src_addr_lo = (unsigned int )bp->slowpath_mapping + 4308U; dmae->src_addr_hi = (unsigned int )((bp->slowpath_mapping + 4308ULL) >> 32); dmae->dst_addr_lo = bp->func_stx >> 2; dmae->dst_addr_hi = 0U; dmae->len = 20U; dmae->comp_addr_lo = (unsigned int )bp->slowpath_mapping + 3128U; dmae->comp_addr_hi = (unsigned int )((bp->slowpath_mapping + 3128ULL) >> 32); dmae->comp_val = 1624297646U; *stats_comp = 0U; } else { } return; } } static void bnx2x_stats_stop(struct bnx2x *bp ) { int update ; int tmp ; int tmp___0 ; { update = 0; bnx2x_stats_comp(bp); if (bp->port.pmf != 0U) { tmp = bnx2x_hw_stats_update(bp); update = tmp == 0; } else { } tmp___0 = bnx2x_storm_stats_update(bp); update = (tmp___0 == 0) | update; if (update != 0) { bnx2x_net_stats_update(bp); if (bp->port.pmf != 0U) { bnx2x_port_stats_stop(bp); } else { } bnx2x_hw_stats_post(bp); bnx2x_stats_comp(bp); } else { } return; } } static void bnx2x_stats_do_nothing(struct bnx2x *bp ) { { return; } } static struct __anonstruct_bnx2x_stats_stm_251 const bnx2x_stats_stm[2U][4U] = { { {& bnx2x_stats_pmf_update, 0}, {& bnx2x_stats_start, 1}, {& bnx2x_stats_do_nothing, 0}, {& bnx2x_stats_do_nothing, 0}}, { {& bnx2x_stats_pmf_start, 1}, {& bnx2x_stats_restart, 1}, {& bnx2x_stats_update, 1}, {& bnx2x_stats_stop, 0}}}; void bnx2x_stats_handle(struct bnx2x *bp , enum bnx2x_stats_event event ) { enum bnx2x_stats_state state ; long tmp ; long tmp___0 ; { tmp = ldv__builtin_expect(bp->panic != 0, 0L); if (tmp != 0L) { return; } else { } spin_lock_bh(& bp->stats_lock); state = (enum bnx2x_stats_state )bp->stats_state; bp->stats_state = (int )bnx2x_stats_stm[(unsigned int )state][(unsigned int )event].next_state; spin_unlock_bh(& bp->stats_lock); (*(bnx2x_stats_stm[(unsigned int )state][(unsigned int )event].action))(bp); if ((unsigned int )event != 2U || (bp->msg_enable & 8) != 0) { tmp___0 = ldv__builtin_expect((bp->msg_enable & 131072) != 0, 0L); if (tmp___0 != 0L) { printk("\rbnx2x: [%s:%d(%s)]state %d -> event %d -> state %d\n", "bnx2x_stats_handle", 1463, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (unsigned int )state, (unsigned int )event, bp->stats_state); } else { } } else { } return; } } static void bnx2x_port_stats_base_init(struct bnx2x *bp ) { struct dmae_command *dmae ; u32 *stats_comp ; int tmp ; { stats_comp = & (bp->slowpath)->stats_comp; if (bp->port.pmf == 0U || bp->port.port_stx == 0U) { printk("\vbnx2x: [%s:%d(%s)]BUG!\n", "bnx2x_port_stats_base_init", 1473, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); return; } else { } bp->executer_idx = 0; tmp = bp->executer_idx; bp->executer_idx = bp->executer_idx + 1; dmae = (struct dmae_command *)(& (bp->slowpath)->dmae) + (unsigned long )tmp; dmae->opcode = bnx2x_dmae_opcode(bp, 0, 2, 1, 0); dmae->src_addr_lo = (unsigned int )bp->slowpath_mapping + 3660U; dmae->src_addr_hi = (unsigned int )((bp->slowpath_mapping + 3660ULL) >> 32); dmae->dst_addr_lo = bp->port.port_stx >> 2; dmae->dst_addr_hi = 0U; dmae->len = bnx2x_get_port_stats_dma_len(bp); dmae->comp_addr_lo = (unsigned int )bp->slowpath_mapping + 3128U; dmae->comp_addr_hi = (unsigned int )((bp->slowpath_mapping + 3128ULL) >> 32); dmae->comp_val = 1624297646U; *stats_comp = 0U; bnx2x_hw_stats_post(bp); bnx2x_stats_comp(bp); return; } } static void bnx2x_prep_fw_stats_req(struct bnx2x *bp ) { int i ; int first_queue_query_index ; struct stats_query_header *stats_hdr ; dma_addr_t cur_data_offset ; struct stats_query_entry *cur_query_entry ; { stats_hdr = & (bp->fw_stats_req)->hdr; stats_hdr->cmd_num = bp->fw_stats_num; stats_hdr->drv_stats_counter = 0U; cur_data_offset = bp->fw_stats_data_mapping; stats_hdr->stats_counters_addrs.hi = (unsigned int )(cur_data_offset >> 32); stats_hdr->stats_counters_addrs.lo = (unsigned int )cur_data_offset; memset((void *)(& (bp->fw_stats_data)->storm_counters), 255, 32UL); cur_data_offset = bp->fw_stats_data_mapping + 32ULL; cur_query_entry = (struct stats_query_entry *)(& (bp->fw_stats_req)->query); cur_query_entry->kind = 1U; cur_query_entry->index = (unsigned int )bp->pfid & 1U; cur_query_entry->funcID = (unsigned short )bp->pfid; cur_query_entry->address.hi = (unsigned int )(cur_data_offset >> 32); cur_query_entry->address.lo = (unsigned int )cur_data_offset; cur_data_offset = bp->fw_stats_data_mapping + 56ULL; cur_query_entry = (struct stats_query_entry *)(& (bp->fw_stats_req)->query) + 1UL; cur_query_entry->kind = 2U; cur_query_entry->index = (unsigned int )bp->pfid & 1U; cur_query_entry->funcID = (unsigned short )bp->pfid; cur_query_entry->address.hi = (unsigned int )(cur_data_offset >> 32); cur_query_entry->address.lo = (unsigned int )cur_data_offset; if ((bp->flags & 32768U) == 0U) { cur_data_offset = bp->fw_stats_data_mapping + 64ULL; cur_query_entry = (struct stats_query_entry *)(& (bp->fw_stats_req)->query) + 2UL; cur_query_entry->kind = 4U; cur_query_entry->index = (unsigned int )bp->pfid & 1U; cur_query_entry->funcID = (unsigned short )bp->pfid; cur_query_entry->address.hi = (unsigned int )(cur_data_offset >> 32); cur_query_entry->address.lo = (unsigned int )cur_data_offset; } else { } cur_data_offset = bp->fw_stats_data_mapping + 128ULL; if ((bp->flags & 32768U) == 0U) { first_queue_query_index = 3; } else { first_queue_query_index = 2; } i = 0; goto ldv_45251; ldv_45250: cur_query_entry = (struct stats_query_entry *)(& (bp->fw_stats_req)->query) + (unsigned long )(first_queue_query_index + i); cur_query_entry->kind = 0U; cur_query_entry->index = bnx2x_stats_id(bp->fp + (unsigned long )i); cur_query_entry->funcID = (unsigned short )bp->pfid; cur_query_entry->address.hi = (unsigned int )(cur_data_offset >> 32); cur_query_entry->address.lo = (unsigned int )cur_data_offset; cur_data_offset = cur_data_offset + 152ULL; i = i + 1; ldv_45251: ; if ((uint )i < bp->num_ethernet_queues) { goto ldv_45250; } else { } if ((bp->flags & 32768U) == 0U) { cur_query_entry = (struct stats_query_entry *)(& (bp->fw_stats_req)->query) + (unsigned long )(first_queue_query_index + i); cur_query_entry->kind = 0U; cur_query_entry->index = bnx2x_stats_id(bp->fp + (unsigned long )((uint )bp->num_queues - bp->num_cnic_queues)); cur_query_entry->funcID = (unsigned short )bp->pfid; cur_query_entry->address.hi = (unsigned int )(cur_data_offset >> 32); cur_query_entry->address.lo = (unsigned int )cur_data_offset; } else { } return; } } void bnx2x_memset_stats(struct bnx2x *bp ) { int i ; struct bnx2x_fp_stats *fp_stats ; { i = 0; goto ldv_45260; ldv_45259: ; if ((bp->flags & 32768U) != 0U && (uint )i == (uint )bp->num_queues - bp->num_cnic_queues) { } else { fp_stats = bp->fp_stats + (unsigned long )i; memset((void *)(& fp_stats->old_tclient), 0, 56UL); memset((void *)(& fp_stats->old_uclient), 0, 56UL); memset((void *)(& fp_stats->old_xclient), 0, 40UL); if ((int )bp->stats_init) { memset((void *)(& fp_stats->eth_q_stats), 0, 204UL); memset((void *)(& fp_stats->eth_q_stats_old), 0, 156UL); } else { } } i = i + 1; ldv_45260: ; if (bp->num_queues > i) { goto ldv_45259; } else { } memset((void *)(& (bp->dev)->stats), 0, 184UL); if ((int )bp->stats_init) { memset((void *)(& bp->net_stats_old), 0, 4UL); memset((void *)(& bp->fw_stats_old), 0, 16UL); memset((void *)(& bp->eth_stats_old), 0, 8UL); memset((void *)(& bp->eth_stats), 0, 540UL); memset((void *)(& bp->func_stats), 0, 80UL); } else { } bp->stats_state = 0; if (bp->port.pmf != 0U && bp->port.port_stx != 0U) { bnx2x_port_stats_base_init(bp); } else { } bp->stats_init = 0; return; } } void bnx2x_stats_init(struct bnx2x *bp ) { int port ; int mb_idx ; long tmp ; size_t __len ; void *__ret ; size_t __len___0 ; void *__ret___0 ; { port = (int )bp->pfid & 1; mb_idx = ((int )bp->pfid & 1) + ((int )bp->pfid >> 1) * ((bp->common.chip_id >> 16 == 5710U || (bp->common.chip_id >> 16 == 5711U || bp->common.chip_id >> 16 == 5712U)) || (unsigned int )bp->common.chip_port_mode == 0U ? 2 : 1); bp->stats_pending = 0U; bp->executer_idx = 0; bp->stats_counter = 0U; if ((bp->flags & 512U) == 0U) { bp->port.port_stx = readl((void const volatile *)(bp->regview + (((unsigned long )bp->common.shmem_base + (unsigned long )port * 16UL) + 1640UL))); bp->func_stx = readl((void const volatile *)(bp->regview + (((unsigned long )bp->common.shmem_base + (unsigned long )mb_idx * 44UL) + 1680UL))); } else { bp->port.port_stx = 0U; bp->func_stx = 0U; } tmp = ldv__builtin_expect((bp->msg_enable & 131072) != 0, 0L); if (tmp != 0L) { printk("\rbnx2x: [%s:%d(%s)]port_stx 0x%x func_stx 0x%x\n", "bnx2x_stats_init", 1681, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", bp->port.port_stx, bp->func_stx); } else { } if ((! bp->stats_init && bp->port.pmf != 0U) && bp->port.port_stx != 0U) { bnx2x_stats_handle(bp, 0); } else { } port = (int )bp->pfid & 1; memset((void *)(& bp->port.old_nig_stats), 0, 72UL); bp->port.old_nig_stats.brb_discard = readl((void const volatile *)bp->regview + (unsigned long )(port * 56 + 67056)); bp->port.old_nig_stats.brb_truncate = readl((void const volatile *)bp->regview + (unsigned long )(port * 56 + 67064)); if (((((((((bp->common.chip_id >> 16 != 5770U && bp->common.chip_id >> 16 != 5797U) && bp->common.chip_id >> 16 != 5801U) && bp->common.chip_id >> 16 != 5774U) && bp->common.chip_id >> 16 != 5806U) && bp->common.chip_id >> 16 != 5807U) && ((bp->common.chip_id >> 16 != 5693U && bp->common.chip_id >> 16 != 5694U) && bp->common.chip_id >> 16 != 5695U)) && ((bp->common.chip_id >> 16 != 5793U && bp->common.chip_id >> 16 != 5794U) && bp->common.chip_id >> 16 != 5773U)) && (bp->common.chip_id >> 16 != 5796U && bp->common.chip_id >> 16 != 5803U)) && bp->common.chip_id >> 16 != 5805U) { bnx2x_read_dmae(bp, (u32 )(port * 80 + 67408), 2U); __len = 8UL; if (__len > 63UL) { __ret = __memcpy((void *)(& bp->port.old_nig_stats.egress_mac_pkt0_lo), (void const *)(& (bp->slowpath)->wb_data), __len); } else { __ret = __builtin_memcpy((void *)(& bp->port.old_nig_stats.egress_mac_pkt0_lo), (void const *)(& (bp->slowpath)->wb_data), __len); } bnx2x_read_dmae(bp, (u32 )(port * 80 + 67424), 2U); __len___0 = 8UL; if (__len___0 > 63UL) { __ret___0 = __memcpy((void *)(& bp->port.old_nig_stats.egress_mac_pkt1_lo), (void const *)(& (bp->slowpath)->wb_data), __len___0); } else { __ret___0 = __builtin_memcpy((void *)(& bp->port.old_nig_stats.egress_mac_pkt1_lo), (void const *)(& (bp->slowpath)->wb_data), __len___0); } } else { } bnx2x_prep_fw_stats_req(bp); if ((int )bp->stats_init) { if (bp->func_stx != 0U) { memset((void *)(& (bp->slowpath)->func_stats), 0, 80UL); bnx2x_func_stats_init(bp); bnx2x_hw_stats_post(bp); bnx2x_stats_comp(bp); } else { } } else { } bnx2x_memset_stats(bp); return; } } void bnx2x_save_statistics(struct bnx2x *bp ) { int i ; struct net_device_stats *nstats ; struct bnx2x_fastpath *fp ; struct bnx2x_eth_q_stats *qstats ; struct bnx2x_eth_q_stats_old *qstats_old ; struct bnx2x_eth_stats *estats ; struct bnx2x_fw_port_stats_old *fwstats ; { nstats = & (bp->dev)->stats; i = 0; goto ldv_45283; ldv_45282: fp = bp->fp + (unsigned long )i; qstats = & (bp->fp_stats + (unsigned long )fp->index)->eth_q_stats; qstats_old = & (bp->fp_stats + (unsigned long )fp->index)->eth_q_stats_old; qstats_old->total_unicast_bytes_received_hi = qstats->total_unicast_bytes_received_hi; qstats_old->total_unicast_bytes_received_lo = qstats->total_unicast_bytes_received_lo; qstats_old->total_broadcast_bytes_received_hi = qstats->total_broadcast_bytes_received_hi; qstats_old->total_broadcast_bytes_received_lo = qstats->total_broadcast_bytes_received_lo; qstats_old->total_multicast_bytes_received_hi = qstats->total_multicast_bytes_received_hi; qstats_old->total_multicast_bytes_received_lo = qstats->total_multicast_bytes_received_lo; qstats_old->total_unicast_bytes_transmitted_hi = qstats->total_unicast_bytes_transmitted_hi; qstats_old->total_unicast_bytes_transmitted_lo = qstats->total_unicast_bytes_transmitted_lo; qstats_old->total_broadcast_bytes_transmitted_hi = qstats->total_broadcast_bytes_transmitted_hi; qstats_old->total_broadcast_bytes_transmitted_lo = qstats->total_broadcast_bytes_transmitted_lo; qstats_old->total_multicast_bytes_transmitted_hi = qstats->total_multicast_bytes_transmitted_hi; qstats_old->total_multicast_bytes_transmitted_lo = qstats->total_multicast_bytes_transmitted_lo; qstats_old->total_tpa_bytes_hi = qstats->total_tpa_bytes_hi; qstats_old->total_tpa_bytes_lo = qstats->total_tpa_bytes_lo; i = i + 1; ldv_45283: ; if ((uint )i < bp->num_ethernet_queues) { goto ldv_45282; } else { } bp->net_stats_old.rx_dropped = (u32 )nstats->rx_dropped; if (bp->port.pmf != 0U && (unsigned int )bp->mf_mode != 0U) { estats = & bp->eth_stats; fwstats = & bp->fw_stats_old; fwstats->mac_filter_discard = estats->mac_filter_discard; fwstats->mf_tag_discard = estats->mf_tag_discard; fwstats->brb_truncate_discard = estats->brb_truncate_discard; fwstats->mac_discard = estats->mac_discard; } else { } return; } } void bnx2x_afex_collect_stats(struct bnx2x *bp , void *void_afex_stats , u32 stats_type ) { int i ; struct afex_stats *afex_stats ; struct bnx2x_eth_stats *estats ; struct per_queue_stats *fcoe_q_stats ; struct tstorm_per_queue_stats *fcoe_q_tstorm_stats ; struct ustorm_per_queue_stats *fcoe_q_ustorm_stats ; struct xstorm_per_queue_stats *fcoe_q_xstorm_stats ; struct fcoe_statistics_params *fw_fcoe_stat ; struct bnx2x_eth_q_stats *qstats ; { afex_stats = (struct afex_stats *)void_afex_stats; estats = & bp->eth_stats; fcoe_q_stats = (struct per_queue_stats *)(& (bp->fw_stats_data)->queue_stats) + (unsigned long )((uint )bp->num_queues - bp->num_cnic_queues); fcoe_q_tstorm_stats = & fcoe_q_stats->tstorm_queue_statistics; fcoe_q_ustorm_stats = & fcoe_q_stats->ustorm_queue_statistics; fcoe_q_xstorm_stats = & fcoe_q_stats->xstorm_queue_statistics; fw_fcoe_stat = & (bp->fw_stats_data)->fcoe; memset((void *)afex_stats, 0, 128UL); i = 0; goto ldv_45302; ldv_45301: qstats = & (bp->fp_stats + (unsigned long )i)->eth_q_stats; afex_stats->rx_unicast_bytes_lo = afex_stats->rx_unicast_bytes_lo + qstats->total_unicast_bytes_received_lo; afex_stats->rx_unicast_bytes_hi = afex_stats->rx_unicast_bytes_hi + (qstats->total_unicast_bytes_received_hi + (afex_stats->rx_unicast_bytes_lo < qstats->total_unicast_bytes_received_lo ? 1U : 0U)); afex_stats->rx_broadcast_bytes_lo = afex_stats->rx_broadcast_bytes_lo + qstats->total_broadcast_bytes_received_lo; afex_stats->rx_broadcast_bytes_hi = afex_stats->rx_broadcast_bytes_hi + (qstats->total_broadcast_bytes_received_hi + (afex_stats->rx_broadcast_bytes_lo < qstats->total_broadcast_bytes_received_lo ? 1U : 0U)); afex_stats->rx_multicast_bytes_lo = afex_stats->rx_multicast_bytes_lo + qstats->total_multicast_bytes_received_lo; afex_stats->rx_multicast_bytes_hi = afex_stats->rx_multicast_bytes_hi + (qstats->total_multicast_bytes_received_hi + (afex_stats->rx_multicast_bytes_lo < qstats->total_multicast_bytes_received_lo ? 1U : 0U)); afex_stats->rx_unicast_frames_lo = afex_stats->rx_unicast_frames_lo + qstats->total_unicast_packets_received_lo; afex_stats->rx_unicast_frames_hi = afex_stats->rx_unicast_frames_hi + (qstats->total_unicast_packets_received_hi + (afex_stats->rx_unicast_frames_lo < qstats->total_unicast_packets_received_lo ? 1U : 0U)); afex_stats->rx_broadcast_frames_lo = afex_stats->rx_broadcast_frames_lo + qstats->total_broadcast_packets_received_lo; afex_stats->rx_broadcast_frames_hi = afex_stats->rx_broadcast_frames_hi + (qstats->total_broadcast_packets_received_hi + (afex_stats->rx_broadcast_frames_lo < qstats->total_broadcast_packets_received_lo ? 1U : 0U)); afex_stats->rx_multicast_frames_lo = afex_stats->rx_multicast_frames_lo + qstats->total_multicast_packets_received_lo; afex_stats->rx_multicast_frames_hi = afex_stats->rx_multicast_frames_hi + (qstats->total_multicast_packets_received_hi + (afex_stats->rx_multicast_frames_lo < qstats->total_multicast_packets_received_lo ? 1U : 0U)); afex_stats->rx_frames_discarded_lo = afex_stats->rx_frames_discarded_lo + qstats->total_packets_received_checksum_discarded_lo; afex_stats->rx_frames_discarded_hi = afex_stats->rx_frames_discarded_hi + (qstats->total_packets_received_checksum_discarded_hi + (afex_stats->rx_frames_discarded_lo < qstats->total_packets_received_checksum_discarded_lo ? 1U : 0U)); afex_stats->rx_frames_discarded_lo = afex_stats->rx_frames_discarded_lo + qstats->total_packets_received_ttl0_discarded_lo; afex_stats->rx_frames_discarded_hi = afex_stats->rx_frames_discarded_hi + (qstats->total_packets_received_ttl0_discarded_hi + (afex_stats->rx_frames_discarded_lo < qstats->total_packets_received_ttl0_discarded_lo ? 1U : 0U)); afex_stats->rx_frames_discarded_lo = afex_stats->rx_frames_discarded_lo + qstats->etherstatsoverrsizepkts_lo; afex_stats->rx_frames_discarded_hi = afex_stats->rx_frames_discarded_hi + (qstats->etherstatsoverrsizepkts_hi + (afex_stats->rx_frames_discarded_lo < qstats->etherstatsoverrsizepkts_lo ? 1U : 0U)); afex_stats->rx_frames_dropped_lo = afex_stats->rx_frames_dropped_lo + qstats->no_buff_discard_lo; afex_stats->rx_frames_dropped_hi = afex_stats->rx_frames_dropped_hi + (qstats->no_buff_discard_hi + (afex_stats->rx_frames_dropped_lo < qstats->no_buff_discard_lo ? 1U : 0U)); afex_stats->tx_unicast_bytes_lo = afex_stats->tx_unicast_bytes_lo + qstats->total_unicast_bytes_transmitted_lo; afex_stats->tx_unicast_bytes_hi = afex_stats->tx_unicast_bytes_hi + (qstats->total_unicast_bytes_transmitted_hi + (afex_stats->tx_unicast_bytes_lo < qstats->total_unicast_bytes_transmitted_lo ? 1U : 0U)); afex_stats->tx_broadcast_bytes_lo = afex_stats->tx_broadcast_bytes_lo + qstats->total_broadcast_bytes_transmitted_lo; afex_stats->tx_broadcast_bytes_hi = afex_stats->tx_broadcast_bytes_hi + (qstats->total_broadcast_bytes_transmitted_hi + (afex_stats->tx_broadcast_bytes_lo < qstats->total_broadcast_bytes_transmitted_lo ? 1U : 0U)); afex_stats->tx_multicast_bytes_lo = afex_stats->tx_multicast_bytes_lo + qstats->total_multicast_bytes_transmitted_lo; afex_stats->tx_multicast_bytes_hi = afex_stats->tx_multicast_bytes_hi + (qstats->total_multicast_bytes_transmitted_hi + (afex_stats->tx_multicast_bytes_lo < qstats->total_multicast_bytes_transmitted_lo ? 1U : 0U)); afex_stats->tx_unicast_frames_lo = afex_stats->tx_unicast_frames_lo + qstats->total_unicast_packets_transmitted_lo; afex_stats->tx_unicast_frames_hi = afex_stats->tx_unicast_frames_hi + (qstats->total_unicast_packets_transmitted_hi + (afex_stats->tx_unicast_frames_lo < qstats->total_unicast_packets_transmitted_lo ? 1U : 0U)); afex_stats->tx_broadcast_frames_lo = afex_stats->tx_broadcast_frames_lo + qstats->total_broadcast_packets_transmitted_lo; afex_stats->tx_broadcast_frames_hi = afex_stats->tx_broadcast_frames_hi + (qstats->total_broadcast_packets_transmitted_hi + (afex_stats->tx_broadcast_frames_lo < qstats->total_broadcast_packets_transmitted_lo ? 1U : 0U)); afex_stats->tx_multicast_frames_lo = afex_stats->tx_multicast_frames_lo + qstats->total_multicast_packets_transmitted_lo; afex_stats->tx_multicast_frames_hi = afex_stats->tx_multicast_frames_hi + (qstats->total_multicast_packets_transmitted_hi + (afex_stats->tx_multicast_frames_lo < qstats->total_multicast_packets_transmitted_lo ? 1U : 0U)); afex_stats->tx_frames_dropped_lo = afex_stats->tx_frames_dropped_lo + qstats->total_transmitted_dropped_packets_error_lo; afex_stats->tx_frames_dropped_hi = afex_stats->tx_frames_dropped_hi + (qstats->total_transmitted_dropped_packets_error_hi + (afex_stats->tx_frames_dropped_lo < qstats->total_transmitted_dropped_packets_error_lo ? 1U : 0U)); i = i + 1; ldv_45302: ; if ((uint )i < bp->num_ethernet_queues) { goto ldv_45301; } else { } if ((bp->flags & 32768U) == 0U) { afex_stats->rx_unicast_bytes_lo = afex_stats->rx_unicast_bytes_lo + fw_fcoe_stat->rx_stat0.fcoe_rx_byte_cnt; afex_stats->rx_unicast_bytes_hi = afex_stats->rx_unicast_bytes_hi + (afex_stats->rx_unicast_bytes_lo < fw_fcoe_stat->rx_stat0.fcoe_rx_byte_cnt ? 1U : 0U); afex_stats->rx_unicast_bytes_lo = afex_stats->rx_unicast_bytes_lo + fcoe_q_tstorm_stats->rcv_ucast_bytes.lo; afex_stats->rx_unicast_bytes_hi = afex_stats->rx_unicast_bytes_hi + (fcoe_q_tstorm_stats->rcv_ucast_bytes.hi + (afex_stats->rx_unicast_bytes_lo < fcoe_q_tstorm_stats->rcv_ucast_bytes.lo ? 1U : 0U)); afex_stats->rx_broadcast_bytes_lo = afex_stats->rx_broadcast_bytes_lo + fcoe_q_tstorm_stats->rcv_bcast_bytes.lo; afex_stats->rx_broadcast_bytes_hi = afex_stats->rx_broadcast_bytes_hi + (fcoe_q_tstorm_stats->rcv_bcast_bytes.hi + (afex_stats->rx_broadcast_bytes_lo < fcoe_q_tstorm_stats->rcv_bcast_bytes.lo ? 1U : 0U)); afex_stats->rx_multicast_bytes_lo = afex_stats->rx_multicast_bytes_lo + fcoe_q_tstorm_stats->rcv_mcast_bytes.lo; afex_stats->rx_multicast_bytes_hi = afex_stats->rx_multicast_bytes_hi + (fcoe_q_tstorm_stats->rcv_mcast_bytes.hi + (afex_stats->rx_multicast_bytes_lo < fcoe_q_tstorm_stats->rcv_mcast_bytes.lo ? 1U : 0U)); afex_stats->rx_unicast_frames_lo = afex_stats->rx_unicast_frames_lo + fw_fcoe_stat->rx_stat0.fcoe_rx_pkt_cnt; afex_stats->rx_unicast_frames_hi = afex_stats->rx_unicast_frames_hi + (afex_stats->rx_unicast_frames_lo < fw_fcoe_stat->rx_stat0.fcoe_rx_pkt_cnt ? 1U : 0U); afex_stats->rx_unicast_frames_lo = afex_stats->rx_unicast_frames_lo + fcoe_q_tstorm_stats->rcv_ucast_pkts; afex_stats->rx_unicast_frames_hi = afex_stats->rx_unicast_frames_hi + (afex_stats->rx_unicast_frames_lo < fcoe_q_tstorm_stats->rcv_ucast_pkts ? 1U : 0U); afex_stats->rx_broadcast_frames_lo = afex_stats->rx_broadcast_frames_lo + fcoe_q_tstorm_stats->rcv_bcast_pkts; afex_stats->rx_broadcast_frames_hi = afex_stats->rx_broadcast_frames_hi + (afex_stats->rx_broadcast_frames_lo < fcoe_q_tstorm_stats->rcv_bcast_pkts ? 1U : 0U); afex_stats->rx_multicast_frames_lo = afex_stats->rx_multicast_frames_lo + fcoe_q_tstorm_stats->rcv_ucast_pkts; afex_stats->rx_multicast_frames_hi = afex_stats->rx_multicast_frames_hi + (afex_stats->rx_multicast_frames_lo < fcoe_q_tstorm_stats->rcv_ucast_pkts ? 1U : 0U); afex_stats->rx_frames_discarded_lo = afex_stats->rx_frames_discarded_lo + fcoe_q_tstorm_stats->checksum_discard; afex_stats->rx_frames_discarded_hi = afex_stats->rx_frames_discarded_hi + (afex_stats->rx_frames_discarded_lo < fcoe_q_tstorm_stats->checksum_discard ? 1U : 0U); afex_stats->rx_frames_discarded_lo = afex_stats->rx_frames_discarded_lo + fcoe_q_tstorm_stats->pkts_too_big_discard; afex_stats->rx_frames_discarded_hi = afex_stats->rx_frames_discarded_hi + (afex_stats->rx_frames_discarded_lo < fcoe_q_tstorm_stats->pkts_too_big_discard ? 1U : 0U); afex_stats->rx_frames_discarded_lo = afex_stats->rx_frames_discarded_lo + fcoe_q_tstorm_stats->ttl0_discard; afex_stats->rx_frames_discarded_hi = afex_stats->rx_frames_discarded_hi + (afex_stats->rx_frames_discarded_lo < fcoe_q_tstorm_stats->ttl0_discard ? 1U : 0U); afex_stats->rx_frames_dropped_lo = afex_stats->rx_frames_dropped_lo + (u32 )fcoe_q_tstorm_stats->no_buff_discard; afex_stats->rx_frames_dropped_hi = afex_stats->rx_frames_dropped_hi + (u32 )(afex_stats->rx_frames_dropped_lo < (u32 )fcoe_q_tstorm_stats->no_buff_discard); afex_stats->rx_frames_dropped_lo = afex_stats->rx_frames_dropped_lo + fcoe_q_ustorm_stats->ucast_no_buff_pkts; afex_stats->rx_frames_dropped_hi = afex_stats->rx_frames_dropped_hi + (afex_stats->rx_frames_dropped_lo < fcoe_q_ustorm_stats->ucast_no_buff_pkts ? 1U : 0U); afex_stats->rx_frames_dropped_lo = afex_stats->rx_frames_dropped_lo + fcoe_q_ustorm_stats->mcast_no_buff_pkts; afex_stats->rx_frames_dropped_hi = afex_stats->rx_frames_dropped_hi + (afex_stats->rx_frames_dropped_lo < fcoe_q_ustorm_stats->mcast_no_buff_pkts ? 1U : 0U); afex_stats->rx_frames_dropped_lo = afex_stats->rx_frames_dropped_lo + fcoe_q_ustorm_stats->bcast_no_buff_pkts; afex_stats->rx_frames_dropped_hi = afex_stats->rx_frames_dropped_hi + (afex_stats->rx_frames_dropped_lo < fcoe_q_ustorm_stats->bcast_no_buff_pkts ? 1U : 0U); afex_stats->rx_frames_dropped_lo = afex_stats->rx_frames_dropped_lo + fw_fcoe_stat->rx_stat1.fcoe_rx_drop_pkt_cnt; afex_stats->rx_frames_dropped_hi = afex_stats->rx_frames_dropped_hi + (afex_stats->rx_frames_dropped_lo < fw_fcoe_stat->rx_stat1.fcoe_rx_drop_pkt_cnt ? 1U : 0U); afex_stats->rx_frames_dropped_lo = afex_stats->rx_frames_dropped_lo + fw_fcoe_stat->rx_stat2.fcoe_rx_drop_pkt_cnt; afex_stats->rx_frames_dropped_hi = afex_stats->rx_frames_dropped_hi + (afex_stats->rx_frames_dropped_lo < fw_fcoe_stat->rx_stat2.fcoe_rx_drop_pkt_cnt ? 1U : 0U); afex_stats->tx_unicast_bytes_lo = afex_stats->tx_unicast_bytes_lo + fw_fcoe_stat->tx_stat.fcoe_tx_byte_cnt; afex_stats->tx_unicast_bytes_hi = afex_stats->tx_unicast_bytes_hi + (afex_stats->tx_unicast_bytes_lo < fw_fcoe_stat->tx_stat.fcoe_tx_byte_cnt ? 1U : 0U); afex_stats->tx_unicast_bytes_lo = afex_stats->tx_unicast_bytes_lo + fcoe_q_xstorm_stats->ucast_bytes_sent.lo; afex_stats->tx_unicast_bytes_hi = afex_stats->tx_unicast_bytes_hi + (fcoe_q_xstorm_stats->ucast_bytes_sent.hi + (afex_stats->tx_unicast_bytes_lo < fcoe_q_xstorm_stats->ucast_bytes_sent.lo ? 1U : 0U)); afex_stats->tx_broadcast_bytes_lo = afex_stats->tx_broadcast_bytes_lo + fcoe_q_xstorm_stats->bcast_bytes_sent.lo; afex_stats->tx_broadcast_bytes_hi = afex_stats->tx_broadcast_bytes_hi + (fcoe_q_xstorm_stats->bcast_bytes_sent.hi + (afex_stats->tx_broadcast_bytes_lo < fcoe_q_xstorm_stats->bcast_bytes_sent.lo ? 1U : 0U)); afex_stats->tx_multicast_bytes_lo = afex_stats->tx_multicast_bytes_lo + fcoe_q_xstorm_stats->mcast_bytes_sent.lo; afex_stats->tx_multicast_bytes_hi = afex_stats->tx_multicast_bytes_hi + (fcoe_q_xstorm_stats->mcast_bytes_sent.hi + (afex_stats->tx_multicast_bytes_lo < fcoe_q_xstorm_stats->mcast_bytes_sent.lo ? 1U : 0U)); afex_stats->tx_unicast_frames_lo = afex_stats->tx_unicast_frames_lo + fw_fcoe_stat->tx_stat.fcoe_tx_pkt_cnt; afex_stats->tx_unicast_frames_hi = afex_stats->tx_unicast_frames_hi + (afex_stats->tx_unicast_frames_lo < fw_fcoe_stat->tx_stat.fcoe_tx_pkt_cnt ? 1U : 0U); afex_stats->tx_unicast_frames_lo = afex_stats->tx_unicast_frames_lo + fcoe_q_xstorm_stats->ucast_pkts_sent; afex_stats->tx_unicast_frames_hi = afex_stats->tx_unicast_frames_hi + (afex_stats->tx_unicast_frames_lo < fcoe_q_xstorm_stats->ucast_pkts_sent ? 1U : 0U); afex_stats->tx_broadcast_frames_lo = afex_stats->tx_broadcast_frames_lo + fcoe_q_xstorm_stats->bcast_pkts_sent; afex_stats->tx_broadcast_frames_hi = afex_stats->tx_broadcast_frames_hi + (afex_stats->tx_broadcast_frames_lo < fcoe_q_xstorm_stats->bcast_pkts_sent ? 1U : 0U); afex_stats->tx_multicast_frames_lo = afex_stats->tx_multicast_frames_lo + fcoe_q_xstorm_stats->mcast_pkts_sent; afex_stats->tx_multicast_frames_hi = afex_stats->tx_multicast_frames_hi + (afex_stats->tx_multicast_frames_lo < fcoe_q_xstorm_stats->mcast_pkts_sent ? 1U : 0U); afex_stats->tx_frames_dropped_lo = afex_stats->tx_frames_dropped_lo + fcoe_q_xstorm_stats->error_drop_pkts; afex_stats->tx_frames_dropped_hi = afex_stats->tx_frames_dropped_hi + (afex_stats->tx_frames_dropped_lo < fcoe_q_xstorm_stats->error_drop_pkts ? 1U : 0U); } else { } if (bp->port.pmf != 0U && stats_type == 2U) { afex_stats->rx_frames_dropped_lo = afex_stats->rx_frames_dropped_lo + estats->mac_filter_discard; afex_stats->rx_frames_dropped_hi = afex_stats->rx_frames_dropped_hi + (u32 )(afex_stats->rx_frames_dropped_lo < estats->mac_filter_discard); afex_stats->rx_frames_dropped_lo = afex_stats->rx_frames_dropped_lo + estats->brb_truncate_discard; afex_stats->rx_frames_dropped_hi = afex_stats->rx_frames_dropped_hi + (u32 )(afex_stats->rx_frames_dropped_lo < estats->brb_truncate_discard); afex_stats->rx_frames_discarded_lo = afex_stats->rx_frames_discarded_lo + estats->mac_discard; afex_stats->rx_frames_discarded_hi = afex_stats->rx_frames_discarded_hi + (u32 )(afex_stats->rx_frames_discarded_lo < estats->mac_discard); } else { } return; } } void ldv_mutex_lock_81(struct mutex *ldv_func_arg1 ) { { ldv_mutex_lock_lock(ldv_func_arg1); mutex_lock(ldv_func_arg1); return; } } void ldv_mutex_unlock_82(struct mutex *ldv_func_arg1 ) { { ldv_mutex_unlock_lock(ldv_func_arg1); mutex_unlock(ldv_func_arg1); return; } } void ldv_mutex_lock_83(struct mutex *ldv_func_arg1 ) { { ldv_mutex_lock_mutex_of_device(ldv_func_arg1); mutex_lock(ldv_func_arg1); return; } } int ldv_mutex_trylock_84(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_85(struct mutex *ldv_func_arg1 ) { { ldv_mutex_unlock_mutex_of_device(ldv_func_arg1); mutex_unlock(ldv_func_arg1); return; } } int ldv_mutex_trylock_100(struct mutex *ldv_func_arg1 ) ; void ldv_mutex_unlock_98(struct mutex *ldv_func_arg1 ) ; void ldv_mutex_unlock_101(struct mutex *ldv_func_arg1 ) ; void ldv_mutex_lock_97(struct mutex *ldv_func_arg1 ) ; void ldv_mutex_lock_99(struct mutex *ldv_func_arg1 ) ; extern int dcb_setapp(struct net_device * , struct dcb_app * ) ; extern int dcbnl_cee_notify(struct net_device * , int , int , u32 , u32 ) ; __inline static void bnx2x_link_sync_notify___0(struct bnx2x *bp ) { int func ; int vn ; { vn = 0; goto ldv_45338; ldv_45337: ; if ((int )bp->pfid >> 1 == vn) { goto ldv_45336; } else { } func = func_by_vn(bp, vn); writel(1U, (void volatile *)bp->regview + (unsigned long )((func + 10252) * 4)); ldv_45336: vn = vn + 1; ldv_45338: ; if (((unsigned int )bp->common.chip_port_mode == 0U ? 2 : 4) > vn) { goto ldv_45337; } else { } return; } } static int bnx2x_dcbx_stop_hw_tx(struct bnx2x *bp ) ; static void bnx2x_pfc_set_pfc(struct bnx2x *bp ) ; static void bnx2x_dcbx_update_ets_params(struct bnx2x *bp ) ; static int bnx2x_dcbx_resume_hw_tx(struct bnx2x *bp ) ; static void bnx2x_dcbx_get_ets_pri_pg_tbl(struct bnx2x *bp , u32 *set_configuration_ets_pg , u32 *pri_pg_tbl ) ; static void bnx2x_dcbx_get_num_pg_traf_type(struct bnx2x *bp , u32 *pg_pri_orginal_spread , struct pg_help_data *help_data ) ; static void bnx2x_dcbx_fill_cos_params(struct bnx2x *bp , struct pg_help_data *help_data , struct dcbx_ets_feature *ets , u32 *pg_pri_orginal_spread ) ; static void bnx2x_dcbx_separate_pauseable_from_non(struct bnx2x *bp , struct cos_help_data *cos_data , u32 *pg_pri_orginal_spread , struct dcbx_ets_feature *ets ) ; static void bnx2x_dcbx_fw_struct(struct bnx2x *bp , struct bnx2x_func_tx_start_params *pfc_fw_cfg ) ; static void bnx2x_read_data(struct bnx2x *bp , u32 *buff , u32 addr , u32 len ) { int i ; { i = 0; goto ldv_45396; ldv_45395: *buff = readl((void const volatile *)bp->regview + (unsigned long )(addr + (u32 )i)); i = i + 4; buff = buff + 1; ldv_45396: ; if ((u32 )i < len) { goto ldv_45395; } else { } return; } } static void bnx2x_write_data(struct bnx2x *bp , u32 *buff , u32 addr , u32 len ) { int i ; { i = 0; goto ldv_45406; ldv_45405: writel(*buff, (void volatile *)bp->regview + (unsigned long )(addr + (u32 )i)); i = i + 4; buff = buff + 1; ldv_45406: ; if ((u32 )i < len) { goto ldv_45405; } else { } return; } } static void bnx2x_pfc_set(struct bnx2x *bp ) { struct bnx2x_nig_brb_pfc_port_params pfc_params ; u32 pri_bit ; u32 val ; int i ; { pfc_params.pause_enable = 0U; pfc_params.llfc_out_en = 0U; pfc_params.llfc_enable = 0U; pfc_params.pkt_priority_to_cos = 0U; pfc_params.num_of_rx_cos_priority_mask = (unsigned char)0; pfc_params.rx_cos_priority_mask[0] = 0U; pfc_params.rx_cos_priority_mask[1] = 0U; pfc_params.rx_cos_priority_mask[2] = 0U; pfc_params.rx_cos_priority_mask[3] = 0U; pfc_params.rx_cos_priority_mask[4] = 0U; pfc_params.rx_cos_priority_mask[5] = 0U; pfc_params.llfc_high_priority_classes = 0U; pfc_params.llfc_low_priority_classes = 0U; val = 0U; pfc_params.num_of_rx_cos_priority_mask = bp->dcbx_port_params.ets.num_of_cos; i = 0; goto ldv_45416; ldv_45415: pfc_params.rx_cos_priority_mask[i] = bp->dcbx_port_params.ets.cos_params[i].pri_bitmask & (u32 )(~ ((int )((unsigned char )bp->dcbx_port_params.pfc.priority_non_pauseable_mask))); i = i + 1; ldv_45416: ; if ((int )bp->dcbx_port_params.ets.num_of_cos > i) { goto ldv_45415; } else { } i = 0; goto ldv_45419; ldv_45418: pri_bit = (u32 )(1 << i); if (((u32 )(~ ((int )((unsigned char )bp->dcbx_port_params.pfc.priority_non_pauseable_mask))) & pri_bit) == 0U) { val = (u32 )(1 << i * 4) | val; } else { } i = i + 1; ldv_45419: ; if (i <= 7) { goto ldv_45418; } else { } pfc_params.pkt_priority_to_cos = val; pfc_params.llfc_low_priority_classes = (u32 )(~ ((int )((unsigned char )bp->dcbx_port_params.pfc.priority_non_pauseable_mask))); pfc_params.llfc_high_priority_classes = 0U; bnx2x_acquire_phy_lock(bp); bp->link_params.feature_config_flags = bp->link_params.feature_config_flags | 2U; bnx2x_update_pfc(& bp->link_params, & bp->link_vars, & pfc_params); bnx2x_release_phy_lock(bp); return; } } static void bnx2x_pfc_clear(struct bnx2x *bp ) { struct bnx2x_nig_brb_pfc_port_params nig_params ; { nig_params.pause_enable = 0U; nig_params.llfc_out_en = 0U; nig_params.llfc_enable = 0U; nig_params.pkt_priority_to_cos = 0U; nig_params.num_of_rx_cos_priority_mask = (unsigned char)0; nig_params.rx_cos_priority_mask[0] = 0U; nig_params.rx_cos_priority_mask[1] = 0U; nig_params.rx_cos_priority_mask[2] = 0U; nig_params.rx_cos_priority_mask[3] = 0U; nig_params.rx_cos_priority_mask[4] = 0U; nig_params.rx_cos_priority_mask[5] = 0U; nig_params.llfc_high_priority_classes = 0U; nig_params.llfc_low_priority_classes = 0U; nig_params.pause_enable = 1U; bnx2x_acquire_phy_lock(bp); bp->link_params.feature_config_flags = bp->link_params.feature_config_flags & 4294967293U; bnx2x_update_pfc(& bp->link_params, & bp->link_vars, & nig_params); bnx2x_release_phy_lock(bp); return; } } static void bnx2x_dump_dcbx_drv_param(struct bnx2x *bp , struct dcbx_features *features , u32 error ) { u8 i ; long tmp ; long tmp___0 ; long tmp___1 ; long tmp___2 ; long tmp___3 ; long tmp___4 ; long tmp___5 ; long tmp___6 ; long tmp___7 ; long tmp___8 ; long tmp___9 ; long tmp___10 ; long tmp___11 ; { i = 0U; tmp = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp != 0L) { printk("\rbnx2x: [%s:%d(%s)]local_mib.error %x\n", "bnx2x_dump_dcbx_drv_param", 203, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", error); } else { } tmp___0 = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp___0 != 0L) { printk("\rbnx2x: [%s:%d(%s)]local_mib.features.ets.enabled %x\n", "bnx2x_dump_dcbx_drv_param", 207, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", features->ets.enabled); } else { } i = 0U; goto ldv_45433; ldv_45432: tmp___1 = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp___1 != 0L) { printk("\rbnx2x: [%s:%d(%s)]local_mib.features.ets.pg_bw_tbl[%d] %d\n", "bnx2x_dump_dcbx_drv_param", 211, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )i, (features->ets.pg_bw_tbl[(int )((unsigned int )i / 4U)] >> (~ ((int )i) & 3) * 8) & 255U); } else { } i = (u8 )((int )i + 1); ldv_45433: ; if ((unsigned int )i <= 7U) { goto ldv_45432; } else { } i = 0U; goto ldv_45436; ldv_45435: tmp___2 = ldv__builtin_expect((bp->msg_enable & 4) != 0, 0L); if (tmp___2 != 0L) { printk("\rbnx2x: [%s:%d(%s)]local_mib.features.ets.pri_pg_tbl[%d] %d\n", "bnx2x_dump_dcbx_drv_param", 215, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )i, (features->ets.pri_pg_tbl[(int )((unsigned int )i / 8U)] >> ((~ ((int )((unsigned int )i / 2U)) & 3) * 2 + ((int )i & 1)) * 4) & 15U); } else { } i = (u8 )((int )i + 1); ldv_45436: ; if ((unsigned int )i <= 7U) { goto ldv_45435; } else { } tmp___3 = ldv__builtin_expect((bp->msg_enable & 134217728) != 0, 0L); if (tmp___3 != 0L) { printk("\rbnx2x: [%s:%d(%s)]dcbx_features.pfc.pri_en_bitmap %x\n", "bnx2x_dump_dcbx_drv_param", 219, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )features->pfc.pri_en_bitmap); } else { } tmp___4 = ldv__builtin_expect((bp->msg_enable & 134217728) != 0, 0L); if (tmp___4 != 0L) { printk("\rbnx2x: [%s:%d(%s)]dcbx_features.pfc.pfc_caps %x\n", "bnx2x_dump_dcbx_drv_param", 221, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )features->pfc.pfc_caps); } else { } tmp___5 = ldv__builtin_expect((bp->msg_enable & 134217728) != 0, 0L); if (tmp___5 != 0L) { printk("\rbnx2x: [%s:%d(%s)]dcbx_features.pfc.enabled %x\n", "bnx2x_dump_dcbx_drv_param", 223, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )features->pfc.enabled); } else { } tmp___6 = ldv__builtin_expect((bp->msg_enable & 134217728) != 0, 0L); if (tmp___6 != 0L) { printk("\rbnx2x: [%s:%d(%s)]dcbx_features.app.default_pri %x\n", "bnx2x_dump_dcbx_drv_param", 226, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )features->app.default_pri); } else { } tmp___7 = ldv__builtin_expect((bp->msg_enable & 134217728) != 0, 0L); if (tmp___7 != 0L) { printk("\rbnx2x: [%s:%d(%s)]dcbx_features.app.tc_supported %x\n", "bnx2x_dump_dcbx_drv_param", 228, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )features->app.tc_supported); } else { } tmp___8 = ldv__builtin_expect((bp->msg_enable & 134217728) != 0, 0L); if (tmp___8 != 0L) { printk("\rbnx2x: [%s:%d(%s)]dcbx_features.app.enabled %x\n", "bnx2x_dump_dcbx_drv_param", 230, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )features->app.enabled); } else { } i = 0U; goto ldv_45439; ldv_45438: tmp___9 = ldv__builtin_expect((bp->msg_enable & 134217728) != 0, 0L); if (tmp___9 != 0L) { printk("\rbnx2x: [%s:%d(%s)]dcbx_features.app.app_pri_tbl[%x].app_id %x\n", "bnx2x_dump_dcbx_drv_param", 234, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )i, (int )features->app.app_pri_tbl[(int )i].app_id); } else { } tmp___10 = ldv__builtin_expect((bp->msg_enable & 134217728) != 0, 0L); if (tmp___10 != 0L) { printk("\rbnx2x: [%s:%d(%s)]dcbx_features.app.app_pri_tbl[%x].pri_bitmap %x\n", "bnx2x_dump_dcbx_drv_param", 237, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )i, (int )features->app.app_pri_tbl[(int )i].pri_bitmap); } else { } tmp___11 = ldv__builtin_expect((bp->msg_enable & 134217728) != 0, 0L); if (tmp___11 != 0L) { printk("\rbnx2x: [%s:%d(%s)]dcbx_features.app.app_pri_tbl[%x].appBitfield %x\n", "bnx2x_dump_dcbx_drv_param", 240, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )i, (int )features->app.app_pri_tbl[(int )i].appBitfield); } else { } i = (u8 )((int )i + 1); ldv_45439: ; if ((unsigned int )i <= 15U) { goto ldv_45438; } else { } return; } } static void bnx2x_dcbx_get_ap_priority(struct bnx2x *bp , u8 pri_bitmap , u8 llfc_traf_type ) { u32 pri ; u32 index ; u32 pri_mask ; u32 *ttp ; u32 __max1 ; u32 __max2 ; { pri = 8U; index = 7U; ttp = (u32 *)(& bp->dcbx_port_params.app.traffic_type_priority); goto ldv_45451; ldv_45450: pri_mask = (u32 )(1 << (int )index); if (((u32 )pri_bitmap & pri_mask) != 0U) { pri = index; } else { } index = index - 1U; ldv_45451: ; if (pri == 8U && index != 0U) { goto ldv_45450; } else { } if (pri <= 7U) { __max1 = *(ttp + (unsigned long )llfc_traf_type); __max2 = pri; *(ttp + (unsigned long )llfc_traf_type) = __max1 > __max2 ? __max1 : __max2; } else { } return; } } static void bnx2x_dcbx_get_ap_feature(struct bnx2x *bp , struct dcbx_app_priority_feature *app , u32 error ) { u8 index ; u32 *ttp ; long tmp ; long tmp___0 ; long tmp___1 ; struct dcbx_app_priority_entry *entry ; long tmp___2 ; { ttp = (u32 *)(& bp->dcbx_port_params.app.traffic_type_priority); if ((error & 4U) != 0U) { tmp = ldv__builtin_expect((bp->msg_enable & 134217728) != 0, 0L); if (tmp != 0L) { printk("\rbnx2x: [%s:%d(%s)]DCBX_LOCAL_APP_ERROR\n", "bnx2x_dcbx_get_ap_feature", 272, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } } else { } if ((error & 32U) != 0U) { tmp___0 = ldv__builtin_expect((bp->msg_enable & 134217728) != 0, 0L); if (tmp___0 != 0L) { printk("\rbnx2x: [%s:%d(%s)]DCBX_LOCAL_APP_MISMATCH\n", "bnx2x_dcbx_get_ap_feature", 275, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } } else { } if ((error & 512U) != 0U) { tmp___1 = ldv__builtin_expect((bp->msg_enable & 134217728) != 0, 0L); if (tmp___1 != 0L) { printk("\rbnx2x: [%s:%d(%s)]DCBX_REMOTE_APP_TLV_NOT_FOUND\n", "bnx2x_dcbx_get_ap_feature", 278, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } } else { } if ((unsigned int )app->enabled != 0U && (error & 548U) == 0U) { bp->dcbx_port_params.app.enabled = 1U; index = 0U; goto ldv_45465; ldv_45464: *(ttp + (unsigned long )index) = 0U; index = (u8 )((int )index + 1); ldv_45465: ; if ((unsigned int )index <= 2U) { goto ldv_45464; } else { } if ((unsigned int )app->default_pri <= 7U) { *ttp = (u32 )app->default_pri; } else { } index = 0U; goto ldv_45469; ldv_45468: entry = (struct dcbx_app_priority_entry *)(& app->app_pri_tbl); if (((int )(entry + (unsigned long )index)->appBitfield & 16) != 0 && (unsigned int )(entry + (unsigned long )index)->app_id == 35078U) { bnx2x_dcbx_get_ap_priority(bp, (int )(entry + (unsigned long )index)->pri_bitmap, 1); } else { } if (((int )(entry + (unsigned long )index)->appBitfield & 32) != 0 && (unsigned int )(entry + (unsigned long )index)->app_id == 3260U) { bnx2x_dcbx_get_ap_priority(bp, (int )(entry + (unsigned long )index)->pri_bitmap, 2); } else { } index = (u8 )((int )index + 1); ldv_45469: ; if ((unsigned int )index <= 15U) { goto ldv_45468; } else { } } else { tmp___2 = ldv__builtin_expect((bp->msg_enable & 134217728) != 0, 0L); if (tmp___2 != 0L) { printk("\rbnx2x: [%s:%d(%s)]DCBX_LOCAL_APP_DISABLED\n", "bnx2x_dcbx_get_ap_feature", 310, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } bp->dcbx_port_params.app.enabled = 0U; index = 0U; goto ldv_45472; ldv_45471: *(ttp + (unsigned long )index) = 4294967295U; index = (u8 )((int )index + 1); ldv_45472: ; if ((unsigned int )index <= 2U) { goto ldv_45471; } else { } } return; } } static void bnx2x_dcbx_get_ets_feature(struct bnx2x *bp , struct dcbx_ets_feature *ets , u32 error ) { int i ; u32 pg_pri_orginal_spread[8U] ; unsigned int tmp ; struct pg_help_data pg_help_data ; struct bnx2x_dcbx_cos_params *cos_params ; long tmp___0 ; long tmp___1 ; long tmp___2 ; long tmp___3 ; { i = 0; pg_pri_orginal_spread[0] = 0U; tmp = 1U; while (1) { if (tmp >= 8U) { break; } else { } pg_pri_orginal_spread[tmp] = 0U; tmp = tmp + 1U; } cos_params = (struct bnx2x_dcbx_cos_params *)(& bp->dcbx_port_params.ets.cos_params); memset((void *)(& pg_help_data), 0, 28UL); if ((int )error & 1) { tmp___0 = ldv__builtin_expect((bp->msg_enable & 134217728) != 0, 0L); if (tmp___0 != 0L) { printk("\rbnx2x: [%s:%d(%s)]DCBX_LOCAL_ETS_ERROR\n", "bnx2x_dcbx_get_ets_feature", 330, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } } else { } if ((error & 128U) != 0U) { tmp___1 = ldv__builtin_expect((bp->msg_enable & 134217728) != 0, 0L); if (tmp___1 != 0L) { printk("\rbnx2x: [%s:%d(%s)]DCBX_REMOTE_ETS_TLV_NOT_FOUND\n", "bnx2x_dcbx_get_ets_feature", 333, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } } else { } i = 0; goto ldv_45487; ldv_45486: (cos_params + (unsigned long )i)->pauseable = 0U; (cos_params + (unsigned long )i)->strict = 3U; (cos_params + (unsigned long )i)->bw_tbl = 4294967295U; (cos_params + (unsigned long )i)->pri_bitmask = 0U; i = i + 1; ldv_45487: ; if ((unsigned int )i <= 2U) { goto ldv_45486; } else { } if ((bp->dcbx_port_params.app.enabled != 0U && ets->enabled != 0U) && (error & 129U) == 0U) { tmp___2 = ldv__builtin_expect((bp->msg_enable & 134217728) != 0, 0L); if (tmp___2 != 0L) { printk("\rbnx2x: [%s:%d(%s)]DCBX_LOCAL_ETS_ENABLE\n", "bnx2x_dcbx_get_ets_feature", 346, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } bp->dcbx_port_params.ets.enabled = 1U; bnx2x_dcbx_get_ets_pri_pg_tbl(bp, (u32 *)(& pg_pri_orginal_spread), (u32 *)(& ets->pri_pg_tbl)); bnx2x_dcbx_get_num_pg_traf_type(bp, (u32 *)(& pg_pri_orginal_spread), & pg_help_data); bnx2x_dcbx_fill_cos_params(bp, & pg_help_data, ets, (u32 *)(& pg_pri_orginal_spread)); } else { tmp___3 = ldv__builtin_expect((bp->msg_enable & 134217728) != 0, 0L); if (tmp___3 != 0L) { printk("\rbnx2x: [%s:%d(%s)]DCBX_LOCAL_ETS_DISABLED\n", "bnx2x_dcbx_get_ets_feature", 361, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } bp->dcbx_port_params.ets.enabled = 0U; ets->pri_pg_tbl[0] = 0U; i = 0; goto ldv_45490; ldv_45489: ets->pg_bw_tbl[i / 4] = ets->pg_bw_tbl[i / 4] & (u32 )(~ (255 << (3 - i % 4) * 8)); ets->pg_bw_tbl[i / 4] = ets->pg_bw_tbl[i / 4] | (u32 )(1 << (3 - i % 4) * 8); i = i + 1; ldv_45490: ; if (i <= 7) { goto ldv_45489; } else { } } return; } } static void bnx2x_dcbx_get_pfc_feature(struct bnx2x *bp , struct dcbx_pfc_feature *pfc , u32 error ) { long tmp ; long tmp___0 ; long tmp___1 ; { if ((error & 2U) != 0U) { tmp = ldv__builtin_expect((bp->msg_enable & 134217728) != 0, 0L); if (tmp != 0L) { printk("\rbnx2x: [%s:%d(%s)]DCBX_LOCAL_PFC_ERROR\n", "bnx2x_dcbx_get_pfc_feature", 375, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } } else { } if ((error & 256U) != 0U) { tmp___0 = ldv__builtin_expect((bp->msg_enable & 134217728) != 0, 0L); if (tmp___0 != 0L) { printk("\rbnx2x: [%s:%d(%s)]DCBX_REMOTE_PFC_TLV_NOT_FOUND\n", "bnx2x_dcbx_get_pfc_feature", 378, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } } else { } if ((bp->dcbx_port_params.app.enabled != 0U && (unsigned int )pfc->enabled != 0U) && (error & 274U) == 0U) { bp->dcbx_port_params.pfc.enabled = 1U; bp->dcbx_port_params.pfc.priority_non_pauseable_mask = (u32 )(~ ((int )pfc->pri_en_bitmap)); } else { tmp___1 = ldv__builtin_expect((bp->msg_enable & 134217728) != 0, 0L); if (tmp___1 != 0L) { printk("\rbnx2x: [%s:%d(%s)]DCBX_LOCAL_PFC_DISABLED\n", "bnx2x_dcbx_get_pfc_feature", 386, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } bp->dcbx_port_params.pfc.enabled = 0U; bp->dcbx_port_params.pfc.priority_non_pauseable_mask = 0U; } return; } } static void bnx2x_dcbx_map_nw(struct bnx2x *bp ) { int i ; u32 unmapped ; u32 *ttp ; u32 nw_prio ; struct bnx2x_dcbx_cos_params *cos_params ; long tmp ; { unmapped = 255U; ttp = (u32 *)(& bp->dcbx_port_params.app.traffic_type_priority); nw_prio = (u32 )(1 << (int )*ttp); cos_params = (struct bnx2x_dcbx_cos_params *)(& bp->dcbx_port_params.ets.cos_params); i = 0; goto ldv_45507; ldv_45506: unmapped = (u32 )(~ (1 << (int )*(ttp + (unsigned long )i))) & unmapped; i = i + 1; ldv_45507: ; if (i <= 2) { goto ldv_45506; } else { } i = 0; goto ldv_45514; ldv_45513: ; if (((cos_params + (unsigned long )i)->pri_bitmask & nw_prio) != 0U) { tmp = ldv__builtin_expect((bp->msg_enable & 134217728) != 0, 0L); if (tmp != 0L) { printk("\rbnx2x: [%s:%d(%s)]cos %d extended with 0x%08x\n", "bnx2x_dcbx_map_nw", 411, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", i, unmapped); } else { } (cos_params + (unsigned long )i)->pri_bitmask = (cos_params + (unsigned long )i)->pri_bitmask | unmapped; goto ldv_45512; } else { } i = i + 1; ldv_45514: ; if ((unsigned int )i <= 2U) { goto ldv_45513; } else { } ldv_45512: ; return; } } static void bnx2x_get_dcbx_drv_param(struct bnx2x *bp , struct dcbx_features *features , u32 error ) { { bnx2x_dcbx_get_ap_feature(bp, & features->app, error); bnx2x_dcbx_get_pfc_feature(bp, & features->pfc, error); bnx2x_dcbx_get_ets_feature(bp, & features->ets, error); bnx2x_dcbx_map_nw(bp); return; } } static int bnx2x_dcbx_read_mib(struct bnx2x *bp , u32 *base_mib_addr , u32 offset , int read_mib_type ) { int max_try_read ; u32 mib_size ; u32 prefix_seq_num ; u32 suffix_seq_num ; struct lldp_remote_mib *remote_mib ; struct lldp_local_mib *local_mib ; { max_try_read = 0; switch (read_mib_type) { case 0: mib_size = 100U; goto ldv_45533; case 1: mib_size = 100U; goto ldv_45533; default: ; return (1); } ldv_45533: offset = ((u32 )bp->pfid & 1U) * mib_size + offset; ldv_45540: bnx2x_read_data(bp, base_mib_addr, offset, mib_size); max_try_read = max_try_read + 1; switch (read_mib_type) { case 0: local_mib = (struct lldp_local_mib *)base_mib_addr; prefix_seq_num = local_mib->prefix_seq_num; suffix_seq_num = local_mib->suffix_seq_num; goto ldv_45537; case 1: remote_mib = (struct lldp_remote_mib *)base_mib_addr; prefix_seq_num = remote_mib->prefix_seq_num; suffix_seq_num = remote_mib->suffix_seq_num; goto ldv_45537; default: ; return (1); } ldv_45537: ; if (prefix_seq_num != suffix_seq_num && max_try_read <= 99) { goto ldv_45540; } else { } if (max_try_read > 99) { printk("\vbnx2x: [%s:%d(%s)]MIB could not be read\n", "bnx2x_dcbx_read_mib", 479, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); return (1); } else { } return (0); } } static void bnx2x_pfc_set_pfc(struct bnx2x *bp ) { int mfw_configured ; unsigned int tmp ; unsigned int tmp___0 ; int tmp___1 ; { if (bp->common.shmem2_base != 0U) { tmp = readl((void const volatile *)bp->regview + (unsigned long )bp->common.shmem2_base); if (tmp > 188U) { tmp___0 = readl((void const volatile *)(bp->regview + ((unsigned long )bp->common.shmem2_base + 188UL))); if ((tmp___0 & 4U) != 0U) { tmp___1 = 1; } else { tmp___1 = 0; } } else { tmp___1 = 0; } } else { tmp___1 = 0; } mfw_configured = tmp___1; if (bp->dcbx_port_params.pfc.enabled != 0U && ((bp->dcbx_error & 64U) == 0U || mfw_configured != 0)) { bnx2x_pfc_set(bp); } else { bnx2x_pfc_clear(bp); } return; } } static int bnx2x_dcbx_stop_hw_tx(struct bnx2x *bp ) { struct bnx2x_func_state_params func_params ; long tmp ; int tmp___0 ; { func_params.f_obj = 0; func_params.cmd = 0; func_params.ramrod_flags = 0UL; func_params.params.tx_start.traffic_type_to_priority_cos[0].priority = (unsigned char)0; func_params.params.tx_start.traffic_type_to_priority_cos[0].cos = (unsigned char)0; func_params.params.tx_start.traffic_type_to_priority_cos[0].reserved1 = (unsigned short)0; func_params.params.tx_start.traffic_type_to_priority_cos[1].priority = (unsigned char)0; func_params.params.tx_start.traffic_type_to_priority_cos[1].cos = (unsigned char)0; func_params.params.tx_start.traffic_type_to_priority_cos[1].reserved1 = (unsigned short)0; func_params.params.tx_start.traffic_type_to_priority_cos[2].priority = (unsigned char)0; func_params.params.tx_start.traffic_type_to_priority_cos[2].cos = (unsigned char)0; func_params.params.tx_start.traffic_type_to_priority_cos[2].reserved1 = (unsigned short)0; func_params.params.tx_start.traffic_type_to_priority_cos[3].priority = (unsigned char)0; func_params.params.tx_start.traffic_type_to_priority_cos[3].cos = (unsigned char)0; func_params.params.tx_start.traffic_type_to_priority_cos[3].reserved1 = (unsigned short)0; func_params.params.tx_start.traffic_type_to_priority_cos[4].priority = (unsigned char)0; func_params.params.tx_start.traffic_type_to_priority_cos[4].cos = (unsigned char)0; func_params.params.tx_start.traffic_type_to_priority_cos[4].reserved1 = (unsigned short)0; func_params.params.tx_start.traffic_type_to_priority_cos[5].priority = (unsigned char)0; func_params.params.tx_start.traffic_type_to_priority_cos[5].cos = (unsigned char)0; func_params.params.tx_start.traffic_type_to_priority_cos[5].reserved1 = (unsigned short)0; func_params.params.tx_start.traffic_type_to_priority_cos[6].priority = (unsigned char)0; func_params.params.tx_start.traffic_type_to_priority_cos[6].cos = (unsigned char)0; func_params.params.tx_start.traffic_type_to_priority_cos[6].reserved1 = (unsigned short)0; func_params.params.tx_start.traffic_type_to_priority_cos[7].priority = (unsigned char)0; func_params.params.tx_start.traffic_type_to_priority_cos[7].cos = (unsigned char)0; func_params.params.tx_start.traffic_type_to_priority_cos[7].reserved1 = (unsigned short)0; func_params.params.tx_start.dcb_enabled = (unsigned char)0; func_params.params.tx_start.dcb_version = (unsigned char)0; func_params.params.tx_start.dont_add_pri_0_en = (unsigned char)0; func_params.f_obj = & bp->func_obj; func_params.cmd = 6; tmp = ldv__builtin_expect((bp->msg_enable & 134217728) != 0, 0L); if (tmp != 0L) { printk("\rbnx2x: [%s:%d(%s)]STOP TRAFFIC\n", "bnx2x_dcbx_stop_hw_tx", 510, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } tmp___0 = bnx2x_func_state_change(bp, & func_params); return (tmp___0); } } static int bnx2x_dcbx_resume_hw_tx(struct bnx2x *bp ) { struct bnx2x_func_state_params func_params ; struct bnx2x_func_tx_start_params *tx_params ; long tmp ; int tmp___0 ; { func_params.f_obj = 0; func_params.cmd = 0; func_params.ramrod_flags = 0UL; func_params.params.tx_start.traffic_type_to_priority_cos[0].priority = (unsigned char)0; func_params.params.tx_start.traffic_type_to_priority_cos[0].cos = (unsigned char)0; func_params.params.tx_start.traffic_type_to_priority_cos[0].reserved1 = (unsigned short)0; func_params.params.tx_start.traffic_type_to_priority_cos[1].priority = (unsigned char)0; func_params.params.tx_start.traffic_type_to_priority_cos[1].cos = (unsigned char)0; func_params.params.tx_start.traffic_type_to_priority_cos[1].reserved1 = (unsigned short)0; func_params.params.tx_start.traffic_type_to_priority_cos[2].priority = (unsigned char)0; func_params.params.tx_start.traffic_type_to_priority_cos[2].cos = (unsigned char)0; func_params.params.tx_start.traffic_type_to_priority_cos[2].reserved1 = (unsigned short)0; func_params.params.tx_start.traffic_type_to_priority_cos[3].priority = (unsigned char)0; func_params.params.tx_start.traffic_type_to_priority_cos[3].cos = (unsigned char)0; func_params.params.tx_start.traffic_type_to_priority_cos[3].reserved1 = (unsigned short)0; func_params.params.tx_start.traffic_type_to_priority_cos[4].priority = (unsigned char)0; func_params.params.tx_start.traffic_type_to_priority_cos[4].cos = (unsigned char)0; func_params.params.tx_start.traffic_type_to_priority_cos[4].reserved1 = (unsigned short)0; func_params.params.tx_start.traffic_type_to_priority_cos[5].priority = (unsigned char)0; func_params.params.tx_start.traffic_type_to_priority_cos[5].cos = (unsigned char)0; func_params.params.tx_start.traffic_type_to_priority_cos[5].reserved1 = (unsigned short)0; func_params.params.tx_start.traffic_type_to_priority_cos[6].priority = (unsigned char)0; func_params.params.tx_start.traffic_type_to_priority_cos[6].cos = (unsigned char)0; func_params.params.tx_start.traffic_type_to_priority_cos[6].reserved1 = (unsigned short)0; func_params.params.tx_start.traffic_type_to_priority_cos[7].priority = (unsigned char)0; func_params.params.tx_start.traffic_type_to_priority_cos[7].cos = (unsigned char)0; func_params.params.tx_start.traffic_type_to_priority_cos[7].reserved1 = (unsigned short)0; func_params.params.tx_start.dcb_enabled = (unsigned char)0; func_params.params.tx_start.dcb_version = (unsigned char)0; func_params.params.tx_start.dont_add_pri_0_en = (unsigned char)0; tx_params = & func_params.params.tx_start; func_params.f_obj = & bp->func_obj; func_params.cmd = 7; bnx2x_dcbx_fw_struct(bp, tx_params); tmp = ldv__builtin_expect((bp->msg_enable & 134217728) != 0, 0L); if (tmp != 0L) { printk("\rbnx2x: [%s:%d(%s)]START TRAFFIC\n", "bnx2x_dcbx_resume_hw_tx", 525, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } tmp___0 = bnx2x_func_state_change(bp, & func_params); return (tmp___0); } } static void bnx2x_dcbx_2cos_limit_update_ets_config(struct bnx2x *bp ) { struct bnx2x_dcbx_pg_params *ets ; int rc ; u32 bw_tbl_0 ; u32 bw_tbl_1 ; { ets = & bp->dcbx_port_params.ets; rc = 0; if ((unsigned int )ets->num_of_cos == 0U || (unsigned int )ets->num_of_cos > 2U) { printk("\vbnx2x: [%s:%d(%s)]Illegal number of COSes %d\n", "bnx2x_dcbx_2cos_limit_update_ets_config", 535, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )ets->num_of_cos); return; } else { } if ((unsigned int )ets->num_of_cos == 1U) { return; } else { } if (((unsigned int )ets->cos_params[0].strict == 3U && ets->cos_params[0].bw_tbl == 4294967295U) || ((unsigned int )ets->cos_params[1].strict == 3U && ets->cos_params[1].bw_tbl == 4294967295U)) { printk("\vbnx2x: [%s:%d(%s)]all COS should have at least bw_limit or strictets->cos_params[0].strict= %xets->cos_params[0].bw_tbl= %xets->cos_params[1].strict= %xets->cos_params[1].bw_tbl= %x", "bnx2x_dcbx_2cos_limit_update_ets_config", 556, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )ets->cos_params[0].strict, ets->cos_params[0].bw_tbl, (int )ets->cos_params[1].strict, ets->cos_params[1].bw_tbl); return; } else { } if (ets->cos_params[0].bw_tbl != 4294967295U && ets->cos_params[1].bw_tbl != 4294967295U) { bw_tbl_0 = ets->cos_params[0].bw_tbl; bw_tbl_1 = ets->cos_params[1].bw_tbl; if (bw_tbl_0 == 0U) { bw_tbl_0 = 1U; bw_tbl_1 = 99U; } else if (bw_tbl_1 == 0U) { bw_tbl_1 = 1U; bw_tbl_0 = 99U; } else { } bnx2x_ets_bw_limit((struct link_params const *)(& bp->link_params), bw_tbl_0, bw_tbl_1); } else { if ((unsigned int )ets->cos_params[0].strict == 0U) { rc = bnx2x_ets_strict((struct link_params const *)(& bp->link_params), 0); } else if ((unsigned int )ets->cos_params[1].strict == 0U) { rc = bnx2x_ets_strict((struct link_params const *)(& bp->link_params), 1); } else { } if (rc != 0) { printk("\vbnx2x: [%s:%d(%s)]update_ets_params failed\n", "bnx2x_dcbx_2cos_limit_update_ets_config", 584, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } } return; } } static void bnx2x_dcbx_update_ets_config(struct bnx2x *bp ) { struct bnx2x_dcbx_pg_params *ets ; struct bnx2x_ets_params ets_params ; u8 i ; int tmp ; { ets = & bp->dcbx_port_params.ets; ets_params.num_of_cos = 0U; ets_params.cos[0].state = 0; ets_params.cos[0].params.bw_params.bw = (unsigned char)0; ets_params.cos[1].state = 0; ets_params.cos[1].params.bw_params.bw = (unsigned char)0; ets_params.cos[2].state = 0; ets_params.cos[2].params.bw_params.bw = (unsigned char)0; ets_params.cos[3].state = 0; ets_params.cos[3].params.bw_params.bw = (unsigned char)0; ets_params.cos[4].state = 0; ets_params.cos[4].params.bw_params.bw = (unsigned char)0; ets_params.cos[5].state = 0; ets_params.cos[5].params.bw_params.bw = (unsigned char)0; ets_params.num_of_cos = ets->num_of_cos; i = 0U; goto ldv_45574; ldv_45573: ; if ((unsigned int )ets->cos_params[(int )i].strict != 3U) { if (ets->cos_params[(int )i].bw_tbl != 4294967295U) { printk("\vbnx2x: [%s:%d(%s)]COS can\'t be not BW and not SP\n", "bnx2x_dcbx_update_ets_config", 603, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); return; } else { } ets_params.cos[(int )i].state = 0; ets_params.cos[(int )i].params.sp_params.pri = ets->cos_params[(int )i].strict; } else { if (ets->cos_params[(int )i].bw_tbl == 4294967295U) { printk("\vbnx2x: [%s:%d(%s)]COS can\'t be not BW and not SP\n", "bnx2x_dcbx_update_ets_config", 612, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); return; } else { } ets_params.cos[(int )i].state = 1; ets_params.cos[(int )i].params.bw_params.bw = (unsigned char )ets->cos_params[(int )i].bw_tbl; } i = (u8 )((int )i + 1); ldv_45574: ; if ((int )ets->num_of_cos > (int )i) { goto ldv_45573; } else { } tmp = bnx2x_ets_e3b0_config((struct link_params const *)(& bp->link_params), (struct link_vars const *)(& bp->link_vars), & ets_params); if (tmp != 0) { printk("\vbnx2x: [%s:%d(%s)]bnx2x_ets_e3b0_config failed\n", "bnx2x_dcbx_update_ets_config", 624, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); bnx2x_ets_disabled(& bp->link_params, & bp->link_vars); } else { } return; } } static void bnx2x_dcbx_update_ets_params(struct bnx2x *bp ) { int mfw_configured ; unsigned int tmp ; unsigned int tmp___0 ; int tmp___1 ; { if (bp->common.shmem2_base != 0U) { tmp = readl((void const volatile *)bp->regview + (unsigned long )bp->common.shmem2_base); if (tmp > 188U) { tmp___0 = readl((void const volatile *)(bp->regview + ((unsigned long )bp->common.shmem2_base + 188UL))); if ((tmp___0 & 4U) != 0U) { tmp___1 = 1; } else { tmp___1 = 0; } } else { tmp___1 = 0; } } else { tmp___1 = 0; } mfw_configured = tmp___1; bnx2x_ets_disabled(& bp->link_params, & bp->link_vars); if (bp->dcbx_port_params.ets.enabled == 0U || ((bp->dcbx_error & 64U) != 0U && mfw_configured == 0)) { return; } else { } if ((((((((((bp->common.chip_id >> 16 == 5770U || bp->common.chip_id >> 16 == 5797U) || bp->common.chip_id >> 16 == 5801U) || bp->common.chip_id >> 16 == 5774U) || bp->common.chip_id >> 16 == 5806U) || bp->common.chip_id >> 16 == 5807U) || ((bp->common.chip_id >> 16 == 5693U || bp->common.chip_id >> 16 == 5694U) || bp->common.chip_id >> 16 == 5695U)) || ((bp->common.chip_id >> 16 == 5793U || bp->common.chip_id >> 16 == 5794U) || bp->common.chip_id >> 16 == 5773U)) || (bp->common.chip_id >> 16 == 5796U || bp->common.chip_id >> 16 == 5803U)) || bp->common.chip_id >> 16 == 5805U) && ((bp->common.chip_id & 61440U) > 20480U ? ((~ bp->common.chip_id & 61440U) >> 13) << 12 == 4096U : (bp->common.chip_id & 61440U) == 4096U)) { bnx2x_dcbx_update_ets_config(bp); } else { bnx2x_dcbx_2cos_limit_update_ets_config(bp); } return; } } static int bnx2x_dcbx_read_shmem_remote_mib(struct bnx2x *bp ) { struct lldp_remote_mib remote_mib ; u32 dcbx_remote_mib_offset ; unsigned int tmp ; int rc ; long tmp___0 ; { remote_mib.prefix_seq_num = 0U; remote_mib.flags = 0U; remote_mib.features.ets.enabled = 0U; remote_mib.features.ets.pg_bw_tbl[0] = 0U; remote_mib.features.ets.pg_bw_tbl[1] = 0U; remote_mib.features.ets.pri_pg_tbl[0] = 0U; remote_mib.features.pfc.enabled = (unsigned char)0; remote_mib.features.pfc.reserved = (unsigned char)0; remote_mib.features.pfc.pfc_caps = (unsigned char)0; remote_mib.features.pfc.pri_en_bitmap = (unsigned char)0; remote_mib.features.app.enabled = (unsigned char)0; remote_mib.features.app.tc_supported = (unsigned char)0; remote_mib.features.app.default_pri = (unsigned char)0; remote_mib.features.app.reserved = (unsigned char)0; remote_mib.features.app.app_pri_tbl[0].appBitfield = (unsigned char)0; remote_mib.features.app.app_pri_tbl[0].pri_bitmap = (unsigned char)0; remote_mib.features.app.app_pri_tbl[0].app_id = (unsigned short)0; remote_mib.features.app.app_pri_tbl[1].appBitfield = (unsigned char)0; remote_mib.features.app.app_pri_tbl[1].pri_bitmap = (unsigned char)0; remote_mib.features.app.app_pri_tbl[1].app_id = (unsigned short)0; remote_mib.features.app.app_pri_tbl[2].appBitfield = (unsigned char)0; remote_mib.features.app.app_pri_tbl[2].pri_bitmap = (unsigned char)0; remote_mib.features.app.app_pri_tbl[2].app_id = (unsigned short)0; remote_mib.features.app.app_pri_tbl[3].appBitfield = (unsigned char)0; remote_mib.features.app.app_pri_tbl[3].pri_bitmap = (unsigned char)0; remote_mib.features.app.app_pri_tbl[3].app_id = (unsigned short)0; remote_mib.features.app.app_pri_tbl[4].appBitfield = (unsigned char)0; remote_mib.features.app.app_pri_tbl[4].pri_bitmap = (unsigned char)0; remote_mib.features.app.app_pri_tbl[4].app_id = (unsigned short)0; remote_mib.features.app.app_pri_tbl[5].appBitfield = (unsigned char)0; remote_mib.features.app.app_pri_tbl[5].pri_bitmap = (unsigned char)0; remote_mib.features.app.app_pri_tbl[5].app_id = (unsigned short)0; remote_mib.features.app.app_pri_tbl[6].appBitfield = (unsigned char)0; remote_mib.features.app.app_pri_tbl[6].pri_bitmap = (unsigned char)0; remote_mib.features.app.app_pri_tbl[6].app_id = (unsigned short)0; remote_mib.features.app.app_pri_tbl[7].appBitfield = (unsigned char)0; remote_mib.features.app.app_pri_tbl[7].pri_bitmap = (unsigned char)0; remote_mib.features.app.app_pri_tbl[7].app_id = (unsigned short)0; remote_mib.features.app.app_pri_tbl[8].appBitfield = (unsigned char)0; remote_mib.features.app.app_pri_tbl[8].pri_bitmap = (unsigned char)0; remote_mib.features.app.app_pri_tbl[8].app_id = (unsigned short)0; remote_mib.features.app.app_pri_tbl[9].appBitfield = (unsigned char)0; remote_mib.features.app.app_pri_tbl[9].pri_bitmap = (unsigned char)0; remote_mib.features.app.app_pri_tbl[9].app_id = (unsigned short)0; remote_mib.features.app.app_pri_tbl[10].appBitfield = (unsigned char)0; remote_mib.features.app.app_pri_tbl[10].pri_bitmap = (unsigned char)0; remote_mib.features.app.app_pri_tbl[10].app_id = (unsigned short)0; remote_mib.features.app.app_pri_tbl[11].appBitfield = (unsigned char)0; remote_mib.features.app.app_pri_tbl[11].pri_bitmap = (unsigned char)0; remote_mib.features.app.app_pri_tbl[11].app_id = (unsigned short)0; remote_mib.features.app.app_pri_tbl[12].appBitfield = (unsigned char)0; remote_mib.features.app.app_pri_tbl[12].pri_bitmap = (unsigned char)0; remote_mib.features.app.app_pri_tbl[12].app_id = (unsigned short)0; remote_mib.features.app.app_pri_tbl[13].appBitfield = (unsigned char)0; remote_mib.features.app.app_pri_tbl[13].pri_bitmap = (unsigned char)0; remote_mib.features.app.app_pri_tbl[13].app_id = (unsigned short)0; remote_mib.features.app.app_pri_tbl[14].appBitfield = (unsigned char)0; remote_mib.features.app.app_pri_tbl[14].pri_bitmap = (unsigned char)0; remote_mib.features.app.app_pri_tbl[14].app_id = (unsigned short)0; remote_mib.features.app.app_pri_tbl[15].appBitfield = (unsigned char)0; remote_mib.features.app.app_pri_tbl[15].pri_bitmap = (unsigned char)0; remote_mib.features.app.app_pri_tbl[15].app_id = (unsigned short)0; remote_mib.suffix_seq_num = 0U; tmp = readl((void const volatile *)(bp->regview + ((unsigned long )bp->common.shmem2_base + 48UL))); dcbx_remote_mib_offset = tmp; tmp___0 = ldv__builtin_expect((bp->msg_enable & 134217728) != 0, 0L); if (tmp___0 != 0L) { printk("\rbnx2x: [%s:%d(%s)]dcbx_remote_mib_offset 0x%x\n", "bnx2x_dcbx_read_shmem_remote_mib", 655, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", dcbx_remote_mib_offset); } else { } if (dcbx_remote_mib_offset == 0U) { printk("\vbnx2x: [%s:%d(%s)]FW doesn\'t support dcbx_remote_mib_offset\n", "bnx2x_dcbx_read_shmem_remote_mib", 658, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); return (-22); } else { } rc = bnx2x_dcbx_read_mib(bp, (u32 *)(& remote_mib), dcbx_remote_mib_offset, 1); if (rc != 0) { printk("\vbnx2x: [%s:%d(%s)]Failed to read remote mib from FW\n", "bnx2x_dcbx_read_shmem_remote_mib", 666, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); return (rc); } else { } bp->dcbx_remote_feat = remote_mib.features; bp->dcbx_remote_flags = remote_mib.flags; return (0); } } static int bnx2x_dcbx_read_shmem_neg_results(struct bnx2x *bp ) { struct lldp_local_mib local_mib ; u32 dcbx_neg_res_offset ; unsigned int tmp ; int rc ; long tmp___0 ; { local_mib.prefix_seq_num = 0U; local_mib.error = 0U; local_mib.features.ets.enabled = 0U; local_mib.features.ets.pg_bw_tbl[0] = 0U; local_mib.features.ets.pg_bw_tbl[1] = 0U; local_mib.features.ets.pri_pg_tbl[0] = 0U; local_mib.features.pfc.enabled = (unsigned char)0; local_mib.features.pfc.reserved = (unsigned char)0; local_mib.features.pfc.pfc_caps = (unsigned char)0; local_mib.features.pfc.pri_en_bitmap = (unsigned char)0; local_mib.features.app.enabled = (unsigned char)0; local_mib.features.app.tc_supported = (unsigned char)0; local_mib.features.app.default_pri = (unsigned char)0; local_mib.features.app.reserved = (unsigned char)0; local_mib.features.app.app_pri_tbl[0].appBitfield = (unsigned char)0; local_mib.features.app.app_pri_tbl[0].pri_bitmap = (unsigned char)0; local_mib.features.app.app_pri_tbl[0].app_id = (unsigned short)0; local_mib.features.app.app_pri_tbl[1].appBitfield = (unsigned char)0; local_mib.features.app.app_pri_tbl[1].pri_bitmap = (unsigned char)0; local_mib.features.app.app_pri_tbl[1].app_id = (unsigned short)0; local_mib.features.app.app_pri_tbl[2].appBitfield = (unsigned char)0; local_mib.features.app.app_pri_tbl[2].pri_bitmap = (unsigned char)0; local_mib.features.app.app_pri_tbl[2].app_id = (unsigned short)0; local_mib.features.app.app_pri_tbl[3].appBitfield = (unsigned char)0; local_mib.features.app.app_pri_tbl[3].pri_bitmap = (unsigned char)0; local_mib.features.app.app_pri_tbl[3].app_id = (unsigned short)0; local_mib.features.app.app_pri_tbl[4].appBitfield = (unsigned char)0; local_mib.features.app.app_pri_tbl[4].pri_bitmap = (unsigned char)0; local_mib.features.app.app_pri_tbl[4].app_id = (unsigned short)0; local_mib.features.app.app_pri_tbl[5].appBitfield = (unsigned char)0; local_mib.features.app.app_pri_tbl[5].pri_bitmap = (unsigned char)0; local_mib.features.app.app_pri_tbl[5].app_id = (unsigned short)0; local_mib.features.app.app_pri_tbl[6].appBitfield = (unsigned char)0; local_mib.features.app.app_pri_tbl[6].pri_bitmap = (unsigned char)0; local_mib.features.app.app_pri_tbl[6].app_id = (unsigned short)0; local_mib.features.app.app_pri_tbl[7].appBitfield = (unsigned char)0; local_mib.features.app.app_pri_tbl[7].pri_bitmap = (unsigned char)0; local_mib.features.app.app_pri_tbl[7].app_id = (unsigned short)0; local_mib.features.app.app_pri_tbl[8].appBitfield = (unsigned char)0; local_mib.features.app.app_pri_tbl[8].pri_bitmap = (unsigned char)0; local_mib.features.app.app_pri_tbl[8].app_id = (unsigned short)0; local_mib.features.app.app_pri_tbl[9].appBitfield = (unsigned char)0; local_mib.features.app.app_pri_tbl[9].pri_bitmap = (unsigned char)0; local_mib.features.app.app_pri_tbl[9].app_id = (unsigned short)0; local_mib.features.app.app_pri_tbl[10].appBitfield = (unsigned char)0; local_mib.features.app.app_pri_tbl[10].pri_bitmap = (unsigned char)0; local_mib.features.app.app_pri_tbl[10].app_id = (unsigned short)0; local_mib.features.app.app_pri_tbl[11].appBitfield = (unsigned char)0; local_mib.features.app.app_pri_tbl[11].pri_bitmap = (unsigned char)0; local_mib.features.app.app_pri_tbl[11].app_id = (unsigned short)0; local_mib.features.app.app_pri_tbl[12].appBitfield = (unsigned char)0; local_mib.features.app.app_pri_tbl[12].pri_bitmap = (unsigned char)0; local_mib.features.app.app_pri_tbl[12].app_id = (unsigned short)0; local_mib.features.app.app_pri_tbl[13].appBitfield = (unsigned char)0; local_mib.features.app.app_pri_tbl[13].pri_bitmap = (unsigned char)0; local_mib.features.app.app_pri_tbl[13].app_id = (unsigned short)0; local_mib.features.app.app_pri_tbl[14].appBitfield = (unsigned char)0; local_mib.features.app.app_pri_tbl[14].pri_bitmap = (unsigned char)0; local_mib.features.app.app_pri_tbl[14].app_id = (unsigned short)0; local_mib.features.app.app_pri_tbl[15].appBitfield = (unsigned char)0; local_mib.features.app.app_pri_tbl[15].pri_bitmap = (unsigned char)0; local_mib.features.app.app_pri_tbl[15].app_id = (unsigned short)0; local_mib.suffix_seq_num = 0U; tmp = readl((void const volatile *)(bp->regview + ((unsigned long )bp->common.shmem2_base + 44UL))); dcbx_neg_res_offset = tmp; tmp___0 = ldv__builtin_expect((bp->msg_enable & 134217728) != 0, 0L); if (tmp___0 != 0L) { printk("\rbnx2x: [%s:%d(%s)]dcbx_neg_res_offset 0x%x\n", "bnx2x_dcbx_read_shmem_neg_results", 683, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", dcbx_neg_res_offset); } else { } if (dcbx_neg_res_offset == 0U) { printk("\vbnx2x: [%s:%d(%s)]FW doesn\'t support dcbx_neg_res_offset\n", "bnx2x_dcbx_read_shmem_neg_results", 686, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); return (-22); } else { } rc = bnx2x_dcbx_read_mib(bp, (u32 *)(& local_mib), dcbx_neg_res_offset, 0); if (rc != 0) { printk("\vbnx2x: [%s:%d(%s)]Failed to read local mib from FW\n", "bnx2x_dcbx_read_shmem_neg_results", 694, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); return (rc); } else { } bp->dcbx_local_feat = local_mib.features; bp->dcbx_error = local_mib.error; return (0); } } __inline static u8 bnx2x_dcbx_dcbnl_app_up(struct dcbx_app_priority_entry *ent ) { u8 pri ; { pri = 7U; goto ldv_45600; ldv_45599: ; if (((int )ent->pri_bitmap >> (int )pri) & 1) { goto ldv_45598; } else { } pri = (u8 )((int )pri - 1); ldv_45600: ; if ((unsigned int )pri != 0U) { goto ldv_45599; } else { } ldv_45598: ; return (pri); } } __inline static u8 bnx2x_dcbx_dcbnl_app_idtype(struct dcbx_app_priority_entry *ent ) { { return (((int )ent->appBitfield & 48) == 32); } } int bnx2x_dcbnl_update_applist(struct bnx2x *bp , bool delall ) { int i ; int err ; struct dcbx_app_priority_entry *ent ; u8 up___0 ; u8 tmp ; struct dcb_app app ; { err = 0; i = 0; goto ldv_45614; ldv_45613: ent = (struct dcbx_app_priority_entry *)(& bp->dcbx_local_feat.app.app_pri_tbl) + (unsigned long )i; if ((int )ent->appBitfield & 1) { tmp = bnx2x_dcbx_dcbnl_app_up(ent); up___0 = tmp; if ((unsigned int )up___0 != 0U) { app.selector = bnx2x_dcbx_dcbnl_app_idtype(ent); app.protocol = ent->app_id; app.priority = (int )delall ? 0U : up___0; err = dcb_setapp(bp->dev, & app); } else { } } else { } i = i + 1; ldv_45614: ; if (i <= 15 && err == 0) { goto ldv_45613; } else { } return (err); } } __inline static void bnx2x_dcbx_update_tc_mapping(struct bnx2x *bp ) { u8 prio ; u8 cos ; long tmp ; int tmp___0 ; { cos = 0U; goto ldv_45626; ldv_45625: prio = 0U; goto ldv_45623; ldv_45622: ; if ((bp->dcbx_port_params.ets.cos_params[(int )cos].pri_bitmask & (u32 )(1 << (int )prio)) != 0U) { bp->prio_to_cos[(int )prio] = cos; tmp = ldv__builtin_expect((bp->msg_enable & 134217728) != 0, 0L); if (tmp != 0L) { printk("\rbnx2x: [%s:%d(%s)]tx_mapping %d --> %d\n", "bnx2x_dcbx_update_tc_mapping", 760, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )prio, (int )cos); } else { } } else { } prio = (u8 )((int )prio + 1); ldv_45623: ; if ((unsigned int )prio <= 7U) { goto ldv_45622; } else { } cos = (u8 )((int )cos + 1); ldv_45626: ; if ((int )bp->dcbx_port_params.ets.num_of_cos > (int )cos) { goto ldv_45625; } else { } tmp___0 = test_and_set_bit(0, (unsigned long volatile *)(& bp->sp_rtnl_state)); if (tmp___0 == 0) { schedule_delayed_work(& bp->sp_rtnl_task, 0UL); } else { } return; } } void bnx2x_dcbx_set_params(struct bnx2x *bp , u32 state ) { long tmp ; int tmp___0 ; int tmp___1 ; long tmp___2 ; long tmp___3 ; { switch (state) { case 1U: tmp = ldv__builtin_expect((bp->msg_enable & 134217728) != 0, 0L); if (tmp != 0L) { printk("\rbnx2x: [%s:%d(%s)]BNX2X_DCBX_STATE_NEG_RECEIVED\n", "bnx2x_dcbx_set_params", 778, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } bnx2x_dcbnl_update_applist(bp, 1); tmp___0 = bnx2x_dcbx_read_shmem_remote_mib(bp); if (tmp___0 != 0) { return; } else { } tmp___1 = bnx2x_dcbx_read_shmem_neg_results(bp); if (tmp___1 != 0) { return; } else { } bnx2x_dump_dcbx_drv_param(bp, & bp->dcbx_local_feat, bp->dcbx_error); bnx2x_get_dcbx_drv_param(bp, & bp->dcbx_local_feat, bp->dcbx_error); bnx2x_update_drv_flags(bp, 1U, 1U); bnx2x_dcbnl_update_applist(bp, 0); bnx2x_dcbx_update_tc_mapping(bp); if ((unsigned int )bp->mf_mode != 0U) { bnx2x_link_sync_notify___0(bp); } else { } bnx2x_dcbx_stop_hw_tx(bp); return; case 2U: tmp___2 = ldv__builtin_expect((bp->msg_enable & 134217728) != 0, 0L); if (tmp___2 != 0L) { printk("\rbnx2x: [%s:%d(%s)]BNX2X_DCBX_STATE_TX_PAUSED\n", "bnx2x_dcbx_set_params", 828, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } bnx2x_pfc_set_pfc(bp); bnx2x_dcbx_update_ets_params(bp); bnx2x_dcbx_resume_hw_tx(bp); return; case 3U: tmp___3 = ldv__builtin_expect((bp->msg_enable & 134217728) != 0, 0L); if (tmp___3 != 0L) { printk("\rbnx2x: [%s:%d(%s)]BNX2X_DCBX_STATE_TX_RELEASED\n", "bnx2x_dcbx_set_params", 836, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } bnx2x_fw_command(bp, 2986344448U, 0U); dcbnl_cee_notify(bp->dev, 78, 26, 0U, 0U); return; default: printk("\vbnx2x: [%s:%d(%s)]Unknown DCBX_STATE\n", "bnx2x_dcbx_set_params", 846, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } return; } } static void bnx2x_dcbx_admin_mib_updated_params(struct bnx2x *bp , u32 dcbx_lldp_params_offset ) { struct lldp_admin_mib admin_mib ; u32 i ; u32 other_traf_type ; u32 traf_type ; u32 offset ; struct dcbx_features *af ; struct bnx2x_config_dcbx_params *dp ; long tmp ; long tmp___0 ; struct bnx2x_admin_priority_app_table *table ; u32 tmp___1 ; { other_traf_type = 2U; traf_type = 0U; offset = (((u32 )bp->pfid & 1U) * 92U + dcbx_lldp_params_offset) + 80U; af = & admin_mib.features; dp = & bp->dcbx_config_params; memset((void *)(& admin_mib), 0, 92UL); bnx2x_read_data(bp, (u32 *)(& admin_mib), offset, 92U); if (bp->dcbx_enabled == 2) { admin_mib.ver_cfg_flags = admin_mib.ver_cfg_flags | 1024U; } else { admin_mib.ver_cfg_flags = admin_mib.ver_cfg_flags & 4294966271U; } if (dp->overwrite_settings == 1U) { admin_mib.ver_cfg_flags = admin_mib.ver_cfg_flags & 4294905855U; admin_mib.ver_cfg_flags = admin_mib.ver_cfg_flags | ((dp->admin_dcbx_version << 12) & 65535U); af->ets.enabled = (u32 )((unsigned char )dp->admin_ets_enable); af->pfc.enabled = (unsigned char )dp->admin_pfc_enable; if (dp->admin_ets_configuration_tx_enable != 0U) { admin_mib.ver_cfg_flags = admin_mib.ver_cfg_flags | 1U; } else { admin_mib.ver_cfg_flags = admin_mib.ver_cfg_flags & 4294967294U; } if (dp->admin_pfc_tx_enable != 0U) { admin_mib.ver_cfg_flags = admin_mib.ver_cfg_flags | 2U; } else { admin_mib.ver_cfg_flags = admin_mib.ver_cfg_flags & 4294967293U; } if (dp->admin_application_priority_tx_enable != 0U) { admin_mib.ver_cfg_flags = admin_mib.ver_cfg_flags | 4U; } else { admin_mib.ver_cfg_flags = admin_mib.ver_cfg_flags & 4294967291U; } if (dp->admin_ets_willing != 0U) { admin_mib.ver_cfg_flags = admin_mib.ver_cfg_flags | 32U; } else { admin_mib.ver_cfg_flags = admin_mib.ver_cfg_flags & 4294967263U; } if (dp->admin_pfc_willing != 0U) { admin_mib.ver_cfg_flags = admin_mib.ver_cfg_flags | 64U; } else { admin_mib.ver_cfg_flags = admin_mib.ver_cfg_flags & 4294967231U; } if (dp->admin_app_priority_willing != 0U) { admin_mib.ver_cfg_flags = admin_mib.ver_cfg_flags | 128U; } else { admin_mib.ver_cfg_flags = admin_mib.ver_cfg_flags & 4294967167U; } i = 0U; goto ldv_45650; ldv_45649: af->ets.pg_bw_tbl[i / 4U] = af->ets.pg_bw_tbl[i / 4U] & (u32 )(~ (255 << (int )((~ i & 3U) * 8U))); af->ets.pg_bw_tbl[i / 4U] = af->ets.pg_bw_tbl[i / 4U] | (u32 )((int )((unsigned char )dp->admin_configuration_bw_precentage[i]) << (int )((~ i & 3U) * 8U)); tmp = ldv__builtin_expect((bp->msg_enable & 134217728) != 0, 0L); if (tmp != 0L) { printk("\rbnx2x: [%s:%d(%s)]pg_bw_tbl[%d] = %02x\n", "bnx2x_dcbx_admin_mib_updated_params", 928, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", i, (af->ets.pg_bw_tbl[i / 4U] >> (int )((~ i & 3U) * 8U)) & 255U); } else { } i = i + 1U; ldv_45650: ; if (i <= 7U) { goto ldv_45649; } else { } i = 0U; goto ldv_45653; ldv_45652: af->ets.pri_pg_tbl[i / 8U] = af->ets.pri_pg_tbl[i / 8U] & (u32 )(~ (15 << (int )(((~ (i / 2U) & 3U) * 2U + (i & 1U)) * 4U))); af->ets.pri_pg_tbl[i / 8U] = af->ets.pri_pg_tbl[i / 8U] | (u32 )(((int )((unsigned char )dp->admin_configuration_ets_pg[i]) & 15) << (int )(((~ (i / 2U) & 3U) * 2U + (i & 1U)) * 4U)); tmp___0 = ldv__builtin_expect((bp->msg_enable & 134217728) != 0, 0L); if (tmp___0 != 0L) { printk("\rbnx2x: [%s:%d(%s)]pri_pg_tbl[%d] = %02x\n", "bnx2x_dcbx_admin_mib_updated_params", 936, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", i, (af->ets.pri_pg_tbl[i / 8U] >> (int )(((~ (i / 2U) & 3U) * 2U + (i & 1U)) * 4U)) & 15U); } else { } i = i + 1U; ldv_45653: ; if (i <= 7U) { goto ldv_45652; } else { } af->pfc.pri_en_bitmap = (unsigned char )dp->admin_pfc_bitmap; i = 0U; goto ldv_45657; ldv_45656: ; if (dp->admin_priority_app_table[i].valid != 0U) { table = (struct bnx2x_admin_priority_app_table *)(& dp->admin_priority_app_table); if ((table + (unsigned long )i)->app_id == 35078U && (table + (unsigned long )i)->traffic_type == 0U) { traf_type = 0U; } else if ((table + (unsigned long )i)->app_id == 3260U && (table + (unsigned long )i)->traffic_type == 1U) { traf_type = 1U; } else { tmp___1 = other_traf_type; other_traf_type = other_traf_type + 1U; traf_type = tmp___1; } af->app.app_pri_tbl[traf_type].app_id = (u16 )(table + (unsigned long )i)->app_id; af->app.app_pri_tbl[traf_type].pri_bitmap = (unsigned char )(1 << (int )(table + (unsigned long )i)->priority); af->app.app_pri_tbl[traf_type].appBitfield = 1U; af->app.app_pri_tbl[traf_type].appBitfield = (u8 )((int )((signed char )af->app.app_pri_tbl[traf_type].appBitfield) | ((table + (unsigned long )i)->traffic_type == 0U ? 16 : 32)); } else { } i = i + 1U; ldv_45657: ; if (i <= 3U) { goto ldv_45656; } else { } af->app.default_pri = (unsigned char )dp->admin_default_priority; } else { } bnx2x_write_data(bp, (u32 *)(& admin_mib), offset, 92U); return; } } void bnx2x_dcbx_set_state(struct bnx2x *bp , bool dcb_on , u32 dcbx_enabled ) { long tmp ; { if (bp->common.chip_id >> 16 != 5710U && (bp->common.chip_id >> 16 != 5711U && bp->common.chip_id >> 16 != 5712U)) { bp->dcb_state = (u16 )dcb_on; bp->dcbx_enabled = (int )dcbx_enabled; } else { bp->dcb_state = 0U; bp->dcbx_enabled = -1; } tmp = ldv__builtin_expect((bp->msg_enable & 134217728) != 0, 0L); if (tmp != 0L) { printk("\rbnx2x: [%s:%d(%s)]DCB state [%s:%s]\n", "bnx2x_dcbx_set_state", 994, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )dcb_on ? (char *)"ON" : (char *)"OFF", dcbx_enabled != 0U ? (dcbx_enabled != 1U ? (dcbx_enabled == 2U ? (char *)"on-chip with negotiation" : (char *)"invalid") : (char *)"on-chip static") : (char *)"user-mode"); } else { } return; } } void bnx2x_dcbx_init_params(struct bnx2x *bp ) { { bp->dcbx_config_params.admin_dcbx_version = 0U; bp->dcbx_config_params.admin_ets_willing = 1U; bp->dcbx_config_params.admin_pfc_willing = 1U; bp->dcbx_config_params.overwrite_settings = 1U; bp->dcbx_config_params.admin_ets_enable = 1U; bp->dcbx_config_params.admin_pfc_enable = 1U; bp->dcbx_config_params.admin_tc_supported_tx_enable = 1U; bp->dcbx_config_params.admin_ets_configuration_tx_enable = 1U; bp->dcbx_config_params.admin_pfc_tx_enable = 1U; bp->dcbx_config_params.admin_application_priority_tx_enable = 1U; bp->dcbx_config_params.admin_ets_reco_valid = 1U; bp->dcbx_config_params.admin_app_priority_willing = 1U; bp->dcbx_config_params.admin_configuration_bw_precentage[0] = 100U; bp->dcbx_config_params.admin_configuration_bw_precentage[1] = 0U; bp->dcbx_config_params.admin_configuration_bw_precentage[2] = 0U; bp->dcbx_config_params.admin_configuration_bw_precentage[3] = 0U; bp->dcbx_config_params.admin_configuration_bw_precentage[4] = 0U; bp->dcbx_config_params.admin_configuration_bw_precentage[5] = 0U; bp->dcbx_config_params.admin_configuration_bw_precentage[6] = 0U; bp->dcbx_config_params.admin_configuration_bw_precentage[7] = 0U; bp->dcbx_config_params.admin_configuration_ets_pg[0] = 0U; bp->dcbx_config_params.admin_configuration_ets_pg[1] = 0U; bp->dcbx_config_params.admin_configuration_ets_pg[2] = 0U; bp->dcbx_config_params.admin_configuration_ets_pg[3] = 0U; bp->dcbx_config_params.admin_configuration_ets_pg[4] = 0U; bp->dcbx_config_params.admin_configuration_ets_pg[5] = 0U; bp->dcbx_config_params.admin_configuration_ets_pg[6] = 0U; bp->dcbx_config_params.admin_configuration_ets_pg[7] = 0U; bp->dcbx_config_params.admin_recommendation_bw_precentage[0] = 100U; bp->dcbx_config_params.admin_recommendation_bw_precentage[1] = 0U; bp->dcbx_config_params.admin_recommendation_bw_precentage[2] = 0U; bp->dcbx_config_params.admin_recommendation_bw_precentage[3] = 0U; bp->dcbx_config_params.admin_recommendation_bw_precentage[4] = 0U; bp->dcbx_config_params.admin_recommendation_bw_precentage[5] = 0U; bp->dcbx_config_params.admin_recommendation_bw_precentage[6] = 0U; bp->dcbx_config_params.admin_recommendation_bw_precentage[7] = 0U; bp->dcbx_config_params.admin_recommendation_ets_pg[0] = 0U; bp->dcbx_config_params.admin_recommendation_ets_pg[1] = 1U; bp->dcbx_config_params.admin_recommendation_ets_pg[2] = 2U; bp->dcbx_config_params.admin_recommendation_ets_pg[3] = 3U; bp->dcbx_config_params.admin_recommendation_ets_pg[4] = 4U; bp->dcbx_config_params.admin_recommendation_ets_pg[5] = 5U; bp->dcbx_config_params.admin_recommendation_ets_pg[6] = 6U; bp->dcbx_config_params.admin_recommendation_ets_pg[7] = 7U; bp->dcbx_config_params.admin_pfc_bitmap = 0U; bp->dcbx_config_params.admin_priority_app_table[0].valid = 0U; bp->dcbx_config_params.admin_priority_app_table[1].valid = 0U; bp->dcbx_config_params.admin_priority_app_table[2].valid = 0U; bp->dcbx_config_params.admin_priority_app_table[3].valid = 0U; bp->dcbx_config_params.admin_default_priority = 0U; return; } } void bnx2x_dcbx_init(struct bnx2x *bp , bool update_shmem ) { u32 dcbx_lldp_params_offset ; long tmp ; long tmp___0 ; unsigned int tmp___1 ; { dcbx_lldp_params_offset = 0U; if (bp->port.pmf == 0U && (bp->flags & 2097152U) == 0U) { return; } else { } if (bp->dcbx_enabled <= 0) { return; } else { } tmp = ldv__builtin_expect((bp->msg_enable & 134217728) != 0, 0L); if (tmp != 0L) { printk("\rbnx2x: [%s:%d(%s)]dcb_state %d bp->port.pmf %d\n", "bnx2x_dcbx_init", 1068, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )bp->dcb_state, bp->port.pmf); } else { } if ((unsigned int )bp->dcb_state == 1U) { if (bp->common.shmem2_base != 0U) { tmp___1 = readl((void const volatile *)bp->regview + (unsigned long )bp->common.shmem2_base); if (tmp___1 > 40U) { dcbx_lldp_params_offset = readl((void const volatile *)(bp->regview + ((unsigned long )bp->common.shmem2_base + 40UL))); tmp___0 = ldv__builtin_expect((bp->msg_enable & 134217728) != 0, 0L); if (tmp___0 != 0L) { printk("\rbnx2x: [%s:%d(%s)]dcbx_lldp_params_offset 0x%x\n", "bnx2x_dcbx_init", 1076, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", dcbx_lldp_params_offset); } else { } bnx2x_update_drv_flags(bp, 1U, 0U); if (dcbx_lldp_params_offset != 0U) { bnx2x_acquire_hw_lock(bp, 13U); if ((int )update_shmem) { bnx2x_dcbx_admin_mib_updated_params(bp, dcbx_lldp_params_offset); } else { } bnx2x_fw_command(bp, 2952790016U, 0U); bnx2x_release_hw_lock(bp, 13U); } else { } } else { } } else { } } else { } return; } } static void bnx2x_dcbx_print_cos_params(struct bnx2x *bp , struct bnx2x_func_tx_start_params *pfc_fw_cfg ) { u8 pri ; u8 cos ; long tmp ; long tmp___0 ; long tmp___1 ; long tmp___2 ; long tmp___3 ; long tmp___4 ; long tmp___5 ; long tmp___6 ; { pri = 0U; cos = 0U; tmp = ldv__builtin_expect((bp->msg_enable & 134217728) != 0, 0L); if (tmp != 0L) { printk("\rbnx2x: [%s:%d(%s)]pfc_fw_cfg->dcb_version %x\n", "bnx2x_dcbx_print_cos_params", 1109, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )pfc_fw_cfg->dcb_version); } else { } tmp___0 = ldv__builtin_expect((bp->msg_enable & 134217728) != 0, 0L); if (tmp___0 != 0L) { printk("\rbnx2x: [%s:%d(%s)]pdev->params.dcbx_port_params.pfc.priority_non_pauseable_mask %x\n", "bnx2x_dcbx_print_cos_params", 1112, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", bp->dcbx_port_params.pfc.priority_non_pauseable_mask); } else { } cos = 0U; goto ldv_45682; ldv_45681: tmp___1 = ldv__builtin_expect((bp->msg_enable & 134217728) != 0, 0L); if (tmp___1 != 0L) { printk("\rbnx2x: [%s:%d(%s)]pdev->params.dcbx_port_params.ets.cos_params[%d].pri_bitmask %x\n", "bnx2x_dcbx_print_cos_params", 1117, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )cos, bp->dcbx_port_params.ets.cos_params[(int )cos].pri_bitmask); } else { } tmp___2 = ldv__builtin_expect((bp->msg_enable & 134217728) != 0, 0L); if (tmp___2 != 0L) { printk("\rbnx2x: [%s:%d(%s)]pdev->params.dcbx_port_params.ets.cos_params[%d].bw_tbl %x\n", "bnx2x_dcbx_print_cos_params", 1121, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )cos, bp->dcbx_port_params.ets.cos_params[(int )cos].bw_tbl); } else { } tmp___3 = ldv__builtin_expect((bp->msg_enable & 134217728) != 0, 0L); if (tmp___3 != 0L) { printk("\rbnx2x: [%s:%d(%s)]pdev->params.dcbx_port_params.ets.cos_params[%d].strict %x\n", "bnx2x_dcbx_print_cos_params", 1125, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )cos, (int )bp->dcbx_port_params.ets.cos_params[(int )cos].strict); } else { } tmp___4 = ldv__builtin_expect((bp->msg_enable & 134217728) != 0, 0L); if (tmp___4 != 0L) { printk("\rbnx2x: [%s:%d(%s)]pdev->params.dcbx_port_params.ets.cos_params[%d].pauseable %x\n", "bnx2x_dcbx_print_cos_params", 1129, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )cos, (int )bp->dcbx_port_params.ets.cos_params[(int )cos].pauseable); } else { } cos = (u8 )((int )cos + 1); ldv_45682: ; if ((int )bp->dcbx_port_params.ets.num_of_cos > (int )cos) { goto ldv_45681; } else { } pri = 0U; goto ldv_45685; ldv_45684: tmp___5 = ldv__builtin_expect((bp->msg_enable & 134217728) != 0, 0L); if (tmp___5 != 0L) { printk("\rbnx2x: [%s:%d(%s)]pfc_fw_cfg->traffic_type_to_priority_cos[%d].priority %x\n", "bnx2x_dcbx_print_cos_params", 1135, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )pri, (int )pfc_fw_cfg->traffic_type_to_priority_cos[(int )pri].priority); } else { } tmp___6 = ldv__builtin_expect((bp->msg_enable & 134217728) != 0, 0L); if (tmp___6 != 0L) { printk("\rbnx2x: [%s:%d(%s)]pfc_fw_cfg->traffic_type_to_priority_cos[%d].cos %x\n", "bnx2x_dcbx_print_cos_params", 1139, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )pri, (int )pfc_fw_cfg->traffic_type_to_priority_cos[(int )pri].cos); } else { } pri = (u8 )((int )pri + 1); ldv_45685: ; if ((unsigned int )pri <= 2U) { goto ldv_45684; } else { } return; } } static void bnx2x_dcbx_get_num_pg_traf_type(struct bnx2x *bp , u32 *pg_pri_orginal_spread , struct pg_help_data *help_data ) { bool pg_found ; u32 i ; u32 traf_type ; u32 add_traf_type ; u32 add_pg ; u32 *ttp ; struct pg_entry_help_data *data ; long tmp ; { pg_found = 0; ttp = (u32 *)(& bp->dcbx_port_params.app.traffic_type_priority); data = (struct pg_entry_help_data *)(& help_data->data); i = 0U; goto ldv_45700; ldv_45699: (data + (unsigned long )i)->pg = 255U; i = i + 1U; ldv_45700: ; if (i <= 2U) { goto ldv_45699; } else { } add_traf_type = 0U; goto ldv_45707; ldv_45706: pg_found = 0; if (*(ttp + (unsigned long )add_traf_type) <= 7U) { add_pg = (u32 )((unsigned char )*(pg_pri_orginal_spread + (unsigned long )*(ttp + (unsigned long )add_traf_type))); traf_type = 0U; goto ldv_45704; ldv_45703: ; if ((u32 )(data + (unsigned long )traf_type)->pg == add_pg) { if (((data + (unsigned long )traf_type)->pg_priority & (u32 )(1 << (int )*(ttp + (unsigned long )add_traf_type))) == 0U) { (data + (unsigned long )traf_type)->num_of_dif_pri = (u8 )((int )(data + (unsigned long )traf_type)->num_of_dif_pri + 1); } else { } (data + (unsigned long )traf_type)->pg_priority = (data + (unsigned long )traf_type)->pg_priority | (u32 )(1 << (int )*(ttp + (unsigned long )add_traf_type)); pg_found = 1; goto ldv_45702; } else { } traf_type = traf_type + 1U; ldv_45704: ; if (traf_type <= 2U) { goto ldv_45703; } else { } ldv_45702: ; if (! pg_found) { (data + (unsigned long )help_data->num_of_pg)->pg = (u8 )add_pg; (data + (unsigned long )help_data->num_of_pg)->pg_priority = (u32 )(1 << (int )*(ttp + (unsigned long )add_traf_type)); (data + (unsigned long )help_data->num_of_pg)->num_of_dif_pri = 1U; help_data->num_of_pg = (u8 )((int )help_data->num_of_pg + 1); } else { } } else { } tmp = ldv__builtin_expect((bp->msg_enable & 134217728) != 0, 0L); if (tmp != 0L) { printk("\rbnx2x: [%s:%d(%s)]add_traf_type %d pg_found %s num_of_pg %d\n", "bnx2x_dcbx_get_num_pg_traf_type", 1187, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", add_traf_type, ! pg_found ? (char *)"NO" : (char *)"YES", (int )help_data->num_of_pg); } else { } add_traf_type = add_traf_type + 1U; ldv_45707: ; if (add_traf_type <= 2U) { goto ldv_45706; } else { } return; } } static void bnx2x_dcbx_ets_disabled_entry_data(struct bnx2x *bp , struct cos_help_data *cos_data , u32 pri_join_mask ) { { cos_data->data[0].pausable = ((u32 )(~ ((int )((unsigned char )bp->dcbx_port_params.pfc.priority_non_pauseable_mask))) & pri_join_mask) == pri_join_mask; cos_data->data[0].pri_join_mask = pri_join_mask; cos_data->data[0].cos_bw = 100U; cos_data->num_of_cos = 1U; return; } } __inline static void bnx2x_dcbx_add_to_cos_bw(struct bnx2x *bp , struct cos_entry_help_data *data , u8 pg_bw ) { { if (data->cos_bw == 4294967295U) { data->cos_bw = (u32 )pg_bw; } else { data->cos_bw = data->cos_bw + (u32 )pg_bw; } return; } } static void bnx2x_dcbx_separate_pauseable_from_non(struct bnx2x *bp , struct cos_help_data *cos_data , u32 *pg_pri_orginal_spread , struct dcbx_ets_feature *ets ) { u32 pri_tested ; u8 i ; u8 entry ; u8 pg_entry ; u8 num_of_pri ; u32 tmp ; { pri_tested = 0U; i = 0U; entry = 0U; pg_entry = 0U; num_of_pri = 3U; cos_data->data[0].pausable = 1; cos_data->data[1].pausable = 0; tmp = 0U; cos_data->data[1].pri_join_mask = tmp; cos_data->data[0].pri_join_mask = tmp; i = 0U; goto ldv_45731; ldv_45730: pri_tested = (u32 )(1 << (int )bp->dcbx_port_params.app.traffic_type_priority[(int )i]); if ((bp->dcbx_port_params.pfc.priority_non_pauseable_mask & pri_tested) != 0U) { cos_data->data[1].pri_join_mask = cos_data->data[1].pri_join_mask | pri_tested; entry = 1U; } else { cos_data->data[0].pri_join_mask = cos_data->data[0].pri_join_mask | pri_tested; entry = 0U; } pg_entry = (unsigned char )*(pg_pri_orginal_spread + (unsigned long )bp->dcbx_port_params.app.traffic_type_priority[(int )i]); if ((unsigned int )pg_entry <= 7U) { bnx2x_dcbx_add_to_cos_bw(bp, (struct cos_entry_help_data *)(& cos_data->data) + (unsigned long )entry, (int )((u8 )(ets->pg_bw_tbl[(int )((unsigned int )pg_entry / 4U)] >> (~ ((int )pg_entry) & 3) * 8))); } else { cos_data->data[(int )entry].strict = 0U; } i = (u8 )((int )i + 1); ldv_45731: ; if ((int )i < (int )num_of_pri) { goto ldv_45730; } else { } if (cos_data->data[0].pri_join_mask == 0U && cos_data->data[1].pri_join_mask == 0U) { printk("\vbnx2x: [%s:%d(%s)]dcbx error: Both groups must have priorities\n", "bnx2x_dcbx_separate_pauseable_from_non", 1253, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } return; } } static void bnx2x_dcbx_2cos_limit_cee_single_pg_to_cos_params(struct bnx2x *bp , struct pg_help_data *pg_help_data , struct cos_help_data *cos_data , u32 pri_join_mask , u8 num_of_dif_pri ) { u8 i ; u32 pri_tested ; u32 pri_mask_without_pri ; u32 *ttp ; bool tmp ; { i = 0U; pri_tested = 0U; pri_mask_without_pri = 0U; ttp = (u32 *)(& bp->dcbx_port_params.app.traffic_type_priority); if ((unsigned int )num_of_dif_pri == 1U) { bnx2x_dcbx_ets_disabled_entry_data(bp, cos_data, pri_join_mask); return; } else { } if ((unsigned int )pg_help_data->data[0].pg <= 7U) { if ((bp->dcbx_port_params.pfc.priority_non_pauseable_mask & pri_join_mask) != pri_join_mask && ((u32 )(~ ((int )((unsigned char )bp->dcbx_port_params.pfc.priority_non_pauseable_mask))) & pri_join_mask) != pri_join_mask) { cos_data->data[0].pausable = 1; cos_data->data[1].pausable = 0; if ((unsigned int )num_of_dif_pri == 2U) { cos_data->data[0].cos_bw = 50U; cos_data->data[1].cos_bw = 50U; } else { } if ((unsigned int )num_of_dif_pri == 3U) { if (((u32 )(~ ((int )((unsigned char )bp->dcbx_port_params.pfc.priority_non_pauseable_mask))) & pri_join_mask) != 0U && (((u32 )(~ ((int )((unsigned char )bp->dcbx_port_params.pfc.priority_non_pauseable_mask))) & pri_join_mask) & (((u32 )(~ ((int )((unsigned char )bp->dcbx_port_params.pfc.priority_non_pauseable_mask))) & pri_join_mask) - 1U)) == 0U) { cos_data->data[0].cos_bw = 33U; cos_data->data[1].cos_bw = 67U; } else { cos_data->data[0].cos_bw = 67U; cos_data->data[1].cos_bw = 33U; } } else { } } else if (((u32 )(~ ((int )((unsigned char )bp->dcbx_port_params.pfc.priority_non_pauseable_mask))) & pri_join_mask) == pri_join_mask) { if ((unsigned int )num_of_dif_pri == 2U) { cos_data->data[0].cos_bw = 50U; cos_data->data[1].cos_bw = 50U; } else { cos_data->data[0].cos_bw = 67U; cos_data->data[1].cos_bw = 33U; } cos_data->data[1].pausable = 1; cos_data->data[0].pausable = 1; cos_data->data[0].pri_join_mask = (u32 )(~ ((int )((unsigned char )(1 << (int )*(ttp + 1UL))))) & pri_join_mask; cos_data->data[1].pri_join_mask = (u32 )(1 << (int )*(ttp + 1UL)); } else { bnx2x_dcbx_ets_disabled_entry_data(bp, cos_data, pri_join_mask); } } else if ((bp->dcbx_port_params.pfc.priority_non_pauseable_mask & pri_join_mask) != pri_join_mask && ((u32 )(~ ((int )((unsigned char )bp->dcbx_port_params.pfc.priority_non_pauseable_mask))) & pri_join_mask) != pri_join_mask) { if (((u32 )(~ ((int )((unsigned char )bp->dcbx_port_params.pfc.priority_non_pauseable_mask))) & pri_join_mask) > (bp->dcbx_port_params.pfc.priority_non_pauseable_mask & pri_join_mask)) { cos_data->data[0].strict = 0U; cos_data->data[1].strict = 1U; } else { cos_data->data[0].strict = 1U; cos_data->data[1].strict = 0U; } cos_data->data[0].pausable = 1; cos_data->data[1].pausable = 0; } else { tmp = ((u32 )(~ ((int )((unsigned char )bp->dcbx_port_params.pfc.priority_non_pauseable_mask))) & pri_join_mask) == pri_join_mask; cos_data->data[1].pausable = tmp; cos_data->data[0].pausable = tmp; i = 0U; goto ldv_45747; ldv_45746: pri_tested = (u32 )(1 << (int )bp->dcbx_port_params.app.traffic_type_priority[(int )i]); pri_mask_without_pri = (u32 )(~ ((int )((unsigned char )pri_tested))) & pri_join_mask; if (pri_mask_without_pri < pri_tested) { goto ldv_45745; } else { } i = (u8 )((int )i + 1); ldv_45747: ; if ((unsigned int )i <= 2U) { goto ldv_45746; } else { } ldv_45745: ; if ((unsigned int )i == 3U) { printk("\vbnx2x: [%s:%d(%s)]Invalid value for pri_join_mask - could not find a priority\n", "bnx2x_dcbx_2cos_limit_cee_single_pg_to_cos_params", 1377, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } cos_data->data[0].pri_join_mask = pri_mask_without_pri; cos_data->data[1].pri_join_mask = pri_tested; cos_data->data[0].strict = 1U; cos_data->data[1].strict = 0U; } return; } } static void bnx2x_dcbx_2cos_limit_cee_two_pg_to_cos_params(struct bnx2x *bp , struct pg_help_data *pg_help_data , struct dcbx_ets_feature *ets , struct cos_help_data *cos_data , u32 *pg_pri_orginal_spread , u32 pri_join_mask , u8 num_of_dif_pri ) { u8 i ; u8 pg[2U] ; unsigned int tmp ; bool tmp___0 ; { i = 0U; pg[0] = 0U; tmp = 1U; while (1) { if (tmp >= 2U) { break; } else { } pg[tmp] = (unsigned char)0; tmp = tmp + 1U; } if ((bp->dcbx_port_params.pfc.priority_non_pauseable_mask & pri_join_mask) != pri_join_mask && ((u32 )(~ ((int )((unsigned char )bp->dcbx_port_params.pfc.priority_non_pauseable_mask))) & pri_join_mask) != pri_join_mask) { if ((pg_help_data->data[0].pg_priority != (bp->dcbx_port_params.pfc.priority_non_pauseable_mask & pg_help_data->data[0].pg_priority) && pg_help_data->data[0].pg_priority != (pg_help_data->data[0].pg_priority & (u32 )(~ ((int )((unsigned char )bp->dcbx_port_params.pfc.priority_non_pauseable_mask))))) || (pg_help_data->data[1].pg_priority != (bp->dcbx_port_params.pfc.priority_non_pauseable_mask & pg_help_data->data[1].pg_priority) && pg_help_data->data[1].pg_priority != (pg_help_data->data[1].pg_priority & (u32 )(~ ((int )((unsigned char )bp->dcbx_port_params.pfc.priority_non_pauseable_mask)))))) { bnx2x_dcbx_separate_pauseable_from_non(bp, cos_data, pg_pri_orginal_spread, ets); bp->dcbx_port_params.ets.enabled = 0U; return; } else { } cos_data->data[0].pausable = 1; cos_data->data[1].pausable = 0; if (pg_help_data->data[0].pg_priority == (pg_help_data->data[0].pg_priority & (u32 )(~ ((int )((unsigned char )bp->dcbx_port_params.pfc.priority_non_pauseable_mask))))) { cos_data->data[0].pri_join_mask = pg_help_data->data[0].pg_priority; pg[0] = pg_help_data->data[0].pg; cos_data->data[1].pri_join_mask = pg_help_data->data[1].pg_priority; pg[1] = pg_help_data->data[1].pg; } else { cos_data->data[0].pri_join_mask = pg_help_data->data[1].pg_priority; pg[0] = pg_help_data->data[1].pg; cos_data->data[1].pri_join_mask = pg_help_data->data[0].pg_priority; pg[1] = pg_help_data->data[0].pg; } } else { tmp___0 = ((u32 )(~ ((int )((unsigned char )bp->dcbx_port_params.pfc.priority_non_pauseable_mask))) & pri_join_mask) == pri_join_mask; cos_data->data[1].pausable = tmp___0; cos_data->data[0].pausable = tmp___0; cos_data->data[0].pri_join_mask = pg_help_data->data[0].pg_priority; pg[0] = pg_help_data->data[0].pg; cos_data->data[1].pri_join_mask = pg_help_data->data[1].pg_priority; pg[1] = pg_help_data->data[1].pg; } i = 0U; goto ldv_45763; ldv_45762: ; if ((unsigned int )pg[(int )i] <= 7U) { cos_data->data[(int )i].cos_bw = (ets->pg_bw_tbl[(int )((unsigned int )pg[(int )i] / 4U)] >> (~ ((int )pg[(int )i]) & 3) * 8) & 255U; } else { cos_data->data[(int )i].strict = 0U; } i = (u8 )((int )i + 1); ldv_45763: ; if ((unsigned int )i <= 1U) { goto ldv_45762; } else { } return; } } static int bnx2x_dcbx_join_pgs(struct bnx2x *bp , struct dcbx_ets_feature *ets , struct pg_help_data *pg_help_data , u8 required_num_of_pg ) { u8 entry_joined ; u8 entry_removed ; u8 pg_joined ; { entry_joined = (unsigned int )pg_help_data->num_of_pg + 255U; entry_removed = (unsigned int )entry_joined + 1U; pg_joined = 0U; if ((unsigned int )required_num_of_pg == 0U || (unsigned int )pg_help_data->num_of_pg > 2U) { printk("\vbnx2x: [%s:%d(%s)]required_num_of_pg can\'t be zero\n", "bnx2x_dcbx_join_pgs", 1483, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); return (-22); } else { } goto ldv_45780; ldv_45779: entry_joined = (unsigned int )pg_help_data->num_of_pg + 254U; entry_removed = (unsigned int )entry_joined + 1U; entry_removed = (u8 )((unsigned int )entry_removed % 3U); pg_help_data->data[(int )entry_joined].pg_priority = pg_help_data->data[(int )entry_joined].pg_priority | pg_help_data->data[(int )entry_removed].pg_priority; pg_help_data->data[(int )entry_joined].num_of_dif_pri = (int )pg_help_data->data[(int )entry_joined].num_of_dif_pri + (int )pg_help_data->data[(int )entry_removed].num_of_dif_pri; if ((unsigned int )pg_help_data->data[(int )entry_joined].pg == 15U || (unsigned int )pg_help_data->data[(int )entry_removed].pg == 15U) { pg_help_data->data[(int )entry_joined].pg = 15U; } else { pg_joined = (int )((u8 )(ets->pg_bw_tbl[(int )((unsigned int )pg_help_data->data[(int )entry_joined].pg / 4U)] >> (~ ((int )pg_help_data->data[(int )entry_joined].pg) & 3) * 8)) + (int )((u8 )(ets->pg_bw_tbl[(int )((unsigned int )pg_help_data->data[(int )entry_removed].pg / 4U)] >> (~ ((int )pg_help_data->data[(int )entry_removed].pg) & 3) * 8)); ets->pg_bw_tbl[(int )((unsigned int )pg_help_data->data[(int )entry_joined].pg / 4U)] = ets->pg_bw_tbl[(int )((unsigned int )pg_help_data->data[(int )entry_joined].pg / 4U)] & (u32 )(~ (255 << (~ ((int )pg_help_data->data[(int )entry_joined].pg) & 3) * 8)); ets->pg_bw_tbl[(int )((unsigned int )pg_help_data->data[(int )entry_joined].pg / 4U)] = ets->pg_bw_tbl[(int )((unsigned int )pg_help_data->data[(int )entry_joined].pg / 4U)] | (u32 )((int )pg_joined << (~ ((int )pg_help_data->data[(int )entry_joined].pg) & 3) * 8); } pg_help_data->num_of_pg = (u8 )((int )pg_help_data->num_of_pg - 1); ldv_45780: ; if ((int )pg_help_data->num_of_pg > (int )required_num_of_pg) { goto ldv_45779; } else { } return (0); } } static void bnx2x_dcbx_2cos_limit_cee_three_pg_to_cos_params(struct bnx2x *bp , struct pg_help_data *pg_help_data , struct dcbx_ets_feature *ets , struct cos_help_data *cos_data , u32 *pg_pri_orginal_spread , u32 pri_join_mask , u8 num_of_dif_pri ) { u8 i ; u32 pri_tested ; u8 entry ; u8 pg_entry ; bool b_found_strict ; u8 num_of_pri ; u32 tmp ; bool tmp___0 ; { i = 0U; pri_tested = 0U; entry = 0U; pg_entry = 0U; b_found_strict = 0; num_of_pri = 3U; tmp = 0U; cos_data->data[1].pri_join_mask = tmp; cos_data->data[0].pri_join_mask = tmp; if ((bp->dcbx_port_params.pfc.priority_non_pauseable_mask & pri_join_mask) != pri_join_mask && ((u32 )(~ ((int )((unsigned char )bp->dcbx_port_params.pfc.priority_non_pauseable_mask))) & pri_join_mask) != pri_join_mask) { bnx2x_dcbx_separate_pauseable_from_non(bp, cos_data, pg_pri_orginal_spread, ets); } else { tmp___0 = ((u32 )(~ ((int )((unsigned char )bp->dcbx_port_params.pfc.priority_non_pauseable_mask))) & pri_join_mask) == pri_join_mask; cos_data->data[1].pausable = tmp___0; cos_data->data[0].pausable = tmp___0; i = 0U; goto ldv_45798; ldv_45797: pri_tested = (u32 )(1 << (int )bp->dcbx_port_params.app.traffic_type_priority[(int )i]); pg_entry = (unsigned char )*(pg_pri_orginal_spread + (unsigned long )bp->dcbx_port_params.app.traffic_type_priority[(int )i]); if ((unsigned int )pg_entry <= 7U) { entry = 0U; if ((int )i == (int )num_of_pri + -1 && ! b_found_strict) { entry = 1U; } else { } cos_data->data[(int )entry].pri_join_mask = cos_data->data[(int )entry].pri_join_mask | pri_tested; bnx2x_dcbx_add_to_cos_bw(bp, (struct cos_entry_help_data *)(& cos_data->data) + (unsigned long )entry, (int )((u8 )(ets->pg_bw_tbl[(int )((unsigned int )pg_entry / 4U)] >> (~ ((int )pg_entry) & 3) * 8))); } else { b_found_strict = 1; cos_data->data[1].pri_join_mask = cos_data->data[1].pri_join_mask | pri_tested; cos_data->data[1].strict = 0U; } i = (u8 )((int )i + 1); ldv_45798: ; if ((int )i < (int )num_of_pri) { goto ldv_45797; } else { } } return; } } static void bnx2x_dcbx_2cos_limit_cee_fill_cos_params(struct bnx2x *bp , struct pg_help_data *help_data , struct dcbx_ets_feature *ets , struct cos_help_data *cos_data , u32 *pg_pri_orginal_spread , u32 pri_join_mask , u8 num_of_dif_pri ) { { cos_data->num_of_cos = 2U; switch ((int )help_data->num_of_pg) { case 1: bnx2x_dcbx_2cos_limit_cee_single_pg_to_cos_params(bp, help_data, cos_data, pri_join_mask, (int )num_of_dif_pri); goto ldv_45810; case 2: bnx2x_dcbx_2cos_limit_cee_two_pg_to_cos_params(bp, help_data, ets, cos_data, pg_pri_orginal_spread, pri_join_mask, (int )num_of_dif_pri); goto ldv_45810; case 3: bnx2x_dcbx_2cos_limit_cee_three_pg_to_cos_params(bp, help_data, ets, cos_data, pg_pri_orginal_spread, pri_join_mask, (int )num_of_dif_pri); goto ldv_45810; default: printk("\vbnx2x: [%s:%d(%s)]Wrong pg_help_data.num_of_pg\n", "bnx2x_dcbx_2cos_limit_cee_fill_cos_params", 1643, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); bnx2x_dcbx_ets_disabled_entry_data(bp, cos_data, pri_join_mask); } ldv_45810: ; return; } } static int bnx2x_dcbx_spread_strict_pri(struct bnx2x *bp , struct cos_help_data *cos_data , u8 entry , u8 num_spread_of_entries , u8 strict_app_pris ) { u8 strict_pri ; u8 num_of_app_pri ; u8 app_pri_bit ; struct cos_entry_help_data *data ; { strict_pri = 0U; num_of_app_pri = 8U; app_pri_bit = 0U; goto ldv_45827; ldv_45826: app_pri_bit = (u8 )(1 << ((int )num_of_app_pri + -1)); if ((unsigned int )((int )app_pri_bit & (int )strict_app_pris) != 0U) { data = (struct cos_entry_help_data *)(& cos_data->data) + (unsigned long )entry; num_spread_of_entries = (u8 )((int )num_spread_of_entries - 1); if ((unsigned int )num_spread_of_entries == 0U) { data->cos_bw = 4294967295U; data->strict = strict_pri; data->pri_join_mask = (u32 )strict_app_pris; data->pausable = (data->pri_join_mask & (u32 )(~ ((int )((unsigned char )bp->dcbx_port_params.pfc.priority_non_pauseable_mask)))) != 0U; } else { strict_app_pris = (u8 )(~ ((int )((signed char )app_pri_bit)) & (int )((signed char )strict_app_pris)); data->cos_bw = 4294967295U; data->strict = strict_pri; data->pri_join_mask = (u32 )app_pri_bit; data->pausable = (data->pri_join_mask & (u32 )(~ ((int )((unsigned char )bp->dcbx_port_params.pfc.priority_non_pauseable_mask)))) != 0U; } strict_pri = (unsigned int )strict_pri + 1U; entry = (u8 )((int )entry + 1); } else { } num_of_app_pri = (u8 )((int )num_of_app_pri - 1); ldv_45827: ; if ((unsigned int )num_spread_of_entries != 0U && (unsigned int )num_of_app_pri != 0U) { goto ldv_45826; } else { } if ((unsigned int )num_spread_of_entries != 0U) { printk("\vbnx2x: [%s:%d(%s)]Didn\'t succeed to spread strict priorities\n", "bnx2x_dcbx_spread_strict_pri", 1691, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); return (-22); } else { } return (0); } } static u8 bnx2x_dcbx_cee_fill_strict_pri(struct bnx2x *bp , struct cos_help_data *cos_data , u8 entry , u8 num_spread_of_entries , u8 strict_app_pris ) { struct cos_entry_help_data *data ; int tmp ; { tmp = bnx2x_dcbx_spread_strict_pri(bp, cos_data, (int )entry, (int )num_spread_of_entries, (int )strict_app_pris); if (tmp != 0) { data = (struct cos_entry_help_data *)(& cos_data->data) + (unsigned long )entry; data->cos_bw = 4294967295U; data->strict = 0U; data->pri_join_mask = (u32 )strict_app_pris; data->pausable = (data->pri_join_mask & (u32 )(~ ((int )((unsigned char )bp->dcbx_port_params.pfc.priority_non_pauseable_mask)))) != 0U; return (1U); } else { } return (num_spread_of_entries); } } static void bnx2x_dcbx_cee_fill_cos_params(struct bnx2x *bp , struct pg_help_data *help_data , struct dcbx_ets_feature *ets , struct cos_help_data *cos_data , u32 pri_join_mask ) { u8 need_num_of_entries ; u8 i ; u8 entry ; int tmp ; struct pg_entry_help_data *pg ; struct cos_entry_help_data *data ; u8 __min1 ; u8 __min2 ; u8 tmp___0 ; { need_num_of_entries = 0U; i = 0U; entry = 0U; if ((unsigned int )help_data->num_of_pg > 3U) { tmp = bnx2x_dcbx_join_pgs(bp, ets, help_data, 3); if (tmp != 0) { printk("\vbnx2x: [%s:%d(%s)]Unable to reduce the number of PGs - we will disables ETS\n", "bnx2x_dcbx_cee_fill_cos_params", 1741, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); bnx2x_dcbx_ets_disabled_entry_data(bp, cos_data, pri_join_mask); return; } else { } } else { } i = 0U; goto ldv_45855; ldv_45854: pg = (struct pg_entry_help_data *)(& help_data->data) + (unsigned long )i; if ((unsigned int )pg->pg <= 7U) { data = (struct cos_entry_help_data *)(& cos_data->data) + (unsigned long )entry; data->cos_bw = (ets->pg_bw_tbl[(int )((unsigned int )pg->pg / 4U)] >> (~ ((int )pg->pg) & 3) * 8) & 255U; data->strict = 3U; data->pri_join_mask = pg->pg_priority; data->pausable = (data->pri_join_mask & (u32 )(~ ((int )((unsigned char )bp->dcbx_port_params.pfc.priority_non_pauseable_mask)))) != 0U; entry = (u8 )((int )entry + 1); } else { __min1 = pg->num_of_dif_pri; __min2 = 4U - (unsigned int )help_data->num_of_pg; need_num_of_entries = (u8 )((int )__min1 < (int )__min2 ? __min1 : __min2); tmp___0 = bnx2x_dcbx_cee_fill_strict_pri(bp, cos_data, (int )entry, (int )need_num_of_entries, (int )((u8 )pg->pg_priority)); entry = (int )tmp___0 + (int )entry; } i = (u8 )((int )i + 1); ldv_45855: ; if ((int )help_data->num_of_pg > (int )i) { goto ldv_45854; } else { } cos_data->num_of_cos = entry; return; } } static void bnx2x_dcbx_fill_cos_params(struct bnx2x *bp , struct pg_help_data *help_data , struct dcbx_ets_feature *ets , u32 *pg_pri_orginal_spread ) { struct cos_help_data cos_data ; u8 i ; u32 pri_join_mask ; u8 num_of_dif_pri ; struct bnx2x_dcbx_cos_params *p ; long tmp ; long tmp___0 ; { i = 0U; pri_join_mask = 0U; num_of_dif_pri = 0U; memset((void *)(& cos_data), 0, 40UL); i = 0U; goto ldv_45869; ldv_45868: ; if ((unsigned int )help_data->data[(int )i].pg != 15U && (unsigned int )help_data->data[(int )i].pg > 7U) { printk("\vbnx2x: [%s:%d(%s)]Invalid pg[%d] data %x\n", "bnx2x_dcbx_fill_cos_params", 1796, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )i, (int )help_data->data[(int )i].pg); } else { } pri_join_mask = help_data->data[(int )i].pg_priority | pri_join_mask; num_of_dif_pri = (int )help_data->data[(int )i].num_of_dif_pri + (int )num_of_dif_pri; i = (u8 )((int )i + 1); ldv_45869: ; if ((int )help_data->num_of_pg > (int )i) { goto ldv_45868; } else { } cos_data.num_of_cos = 1U; i = 0U; goto ldv_45874; ldv_45873: cos_data.data[(int )i].pri_join_mask = 0U; cos_data.data[(int )i].pausable = 0; cos_data.data[(int )i].strict = 3U; cos_data.data[(int )i].cos_bw = 4294967295U; i = (u8 )((int )i + 1); ldv_45874: ; if ((unsigned int )i <= 2U) { goto ldv_45873; } else { } if ((((((((((bp->common.chip_id >> 16 == 5770U || bp->common.chip_id >> 16 == 5797U) || bp->common.chip_id >> 16 == 5801U) || bp->common.chip_id >> 16 == 5774U) || bp->common.chip_id >> 16 == 5806U) || bp->common.chip_id >> 16 == 5807U) || ((bp->common.chip_id >> 16 == 5693U || bp->common.chip_id >> 16 == 5694U) || bp->common.chip_id >> 16 == 5695U)) || ((bp->common.chip_id >> 16 == 5793U || bp->common.chip_id >> 16 == 5794U) || bp->common.chip_id >> 16 == 5773U)) || (bp->common.chip_id >> 16 == 5796U || bp->common.chip_id >> 16 == 5803U)) || bp->common.chip_id >> 16 == 5805U) && ((bp->common.chip_id & 61440U) > 20480U ? ((~ bp->common.chip_id & 61440U) >> 13) << 12 == 4096U : (bp->common.chip_id & 61440U) == 4096U)) { bnx2x_dcbx_cee_fill_cos_params(bp, help_data, ets, & cos_data, pri_join_mask); } else { bnx2x_dcbx_2cos_limit_cee_fill_cos_params(bp, help_data, ets, & cos_data, pg_pri_orginal_spread, pri_join_mask, (int )num_of_dif_pri); } i = 0U; goto ldv_45878; ldv_45877: p = (struct bnx2x_dcbx_cos_params *)(& bp->dcbx_port_params.ets.cos_params) + (unsigned long )i; p->strict = cos_data.data[(int )i].strict; p->bw_tbl = cos_data.data[(int )i].cos_bw; p->pri_bitmask = cos_data.data[(int )i].pri_join_mask; p->pauseable = (u8 )cos_data.data[(int )i].pausable; if (p->bw_tbl != 4294967295U || (unsigned int )p->strict != 3U) { if (p->pri_bitmask == 0U) { printk("\vbnx2x: [%s:%d(%s)]Invalid pri_bitmask for %d\n", "bnx2x_dcbx_fill_cos_params", 1834, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )i); } else { } if (((bp->common.chip_id >> 16 == 5730U || bp->common.chip_id >> 16 == 5731U) || bp->common.chip_id >> 16 == 5743U) || ((((((((((bp->common.chip_id >> 16 == 5770U || bp->common.chip_id >> 16 == 5797U) || bp->common.chip_id >> 16 == 5801U) || bp->common.chip_id >> 16 == 5774U) || bp->common.chip_id >> 16 == 5806U) || bp->common.chip_id >> 16 == 5807U) || ((bp->common.chip_id >> 16 == 5693U || bp->common.chip_id >> 16 == 5694U) || bp->common.chip_id >> 16 == 5695U)) || ((bp->common.chip_id >> 16 == 5793U || bp->common.chip_id >> 16 == 5794U) || bp->common.chip_id >> 16 == 5773U)) || (bp->common.chip_id >> 16 == 5796U || bp->common.chip_id >> 16 == 5803U)) || bp->common.chip_id >> 16 == 5805U) && ((bp->common.chip_id & 61440U) > 20480U ? ((~ bp->common.chip_id & 61440U) >> 13) << 12 == 0U : (bp->common.chip_id & 61440U) == 0U))) { if ((unsigned int )p->pauseable != 0U && (bp->dcbx_port_params.pfc.priority_non_pauseable_mask & p->pri_bitmask) != 0U) { printk("\vbnx2x: [%s:%d(%s)]Inconsistent config for pausable COS %d\n", "bnx2x_dcbx_fill_cos_params", 1842, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )i); } else { } if ((unsigned int )p->pauseable == 0U && (p->pri_bitmask & (u32 )(~ ((int )((unsigned char )bp->dcbx_port_params.pfc.priority_non_pauseable_mask)))) != 0U) { printk("\vbnx2x: [%s:%d(%s)]Inconsistent config for nonpausable COS %d\n", "bnx2x_dcbx_fill_cos_params", 1848, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )i); } else { } } else { } } else { } if ((unsigned int )p->pauseable != 0U) { tmp = ldv__builtin_expect((bp->msg_enable & 134217728) != 0, 0L); if (tmp != 0L) { printk("\rbnx2x: [%s:%d(%s)]COS %d PAUSABLE prijoinmask 0x%x\n", "bnx2x_dcbx_fill_cos_params", 1854, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )i, cos_data.data[(int )i].pri_join_mask); } else { } } else { tmp___0 = ldv__builtin_expect((bp->msg_enable & 134217728) != 0, 0L); if (tmp___0 != 0L) { printk("\rbnx2x: [%s:%d(%s)]COS %d NONPAUSABLE prijoinmask 0x%x\n", "bnx2x_dcbx_fill_cos_params", 1858, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )i, cos_data.data[(int )i].pri_join_mask); } else { } } i = (u8 )((int )i + 1); ldv_45878: ; if ((int )cos_data.num_of_cos > (int )i) { goto ldv_45877; } else { } bp->dcbx_port_params.ets.num_of_cos = cos_data.num_of_cos; return; } } static void bnx2x_dcbx_get_ets_pri_pg_tbl(struct bnx2x *bp , u32 *set_configuration_ets_pg , u32 *pri_pg_tbl ) { int i ; long tmp ; { i = 0; goto ldv_45888; ldv_45887: *(set_configuration_ets_pg + (unsigned long )i) = (*(pri_pg_tbl + (unsigned long )(i / 8)) >> ((3 - (i / 2) % 4) * 2 + i % 2) * 4) & 15U; tmp = ldv__builtin_expect((bp->msg_enable & 134217728) != 0, 0L); if (tmp != 0L) { printk("\rbnx2x: [%s:%d(%s)]set_configuration_ets_pg[%d] = 0x%x\n", "bnx2x_dcbx_get_ets_pri_pg_tbl", 1874, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", i, *(set_configuration_ets_pg + (unsigned long )i)); } else { } i = i + 1; ldv_45888: ; if (i <= 7) { goto ldv_45887; } else { } return; } } static void bnx2x_dcbx_fw_struct(struct bnx2x *bp , struct bnx2x_func_tx_start_params *pfc_fw_cfg ) { u16 pri_bit ; u8 cos ; u8 pri ; struct priority_cos *tt2cos ; u32 *ttp ; int mfw_configured ; unsigned int tmp ; unsigned int tmp___0 ; int tmp___1 ; { pri_bit = 0U; cos = 0U; pri = 0U; ttp = (u32 *)(& bp->dcbx_port_params.app.traffic_type_priority); if (bp->common.shmem2_base != 0U) { tmp = readl((void const volatile *)bp->regview + (unsigned long )bp->common.shmem2_base); if (tmp > 188U) { tmp___0 = readl((void const volatile *)(bp->regview + ((unsigned long )bp->common.shmem2_base + 188UL))); if ((tmp___0 & 4U) != 0U) { tmp___1 = 1; } else { tmp___1 = 0; } } else { tmp___1 = 0; } } else { tmp___1 = 0; } mfw_configured = tmp___1; memset((void *)pfc_fw_cfg, 0, 36UL); if ((bp->dcbx_error & 64U) != 0U && mfw_configured == 0) { return; } else { } tt2cos = (struct priority_cos *)(& pfc_fw_cfg->traffic_type_to_priority_cos); bp->dcb_version = bp->dcb_version + 1; pfc_fw_cfg->dcb_version = (u8 )bp->dcb_version; pfc_fw_cfg->dcb_enabled = 1U; pri = 0U; goto ldv_45904; ldv_45903: (tt2cos + (unsigned long )pri)->priority = (u8 )*(ttp + (unsigned long )pri); pri_bit = (u16 )(1 << (int )(tt2cos + (unsigned long )pri)->priority); cos = 0U; goto ldv_45901; ldv_45900: ; if ((bp->dcbx_port_params.ets.cos_params[(int )cos].pri_bitmask & (u32 )pri_bit) != 0U) { (tt2cos + (unsigned long )pri)->cos = cos; } else { } cos = (u8 )((int )cos + 1); ldv_45901: ; if ((int )bp->dcbx_port_params.ets.num_of_cos > (int )cos) { goto ldv_45900; } else { } pri = (u8 )((int )pri + 1); ldv_45904: ; if ((unsigned int )pri <= 2U) { goto ldv_45903; } else { } pfc_fw_cfg->dont_add_pri_0_en = 1U; bnx2x_dcbx_print_cos_params(bp, pfc_fw_cfg); return; } } void bnx2x_dcbx_pmf_update(struct bnx2x *bp ) { int tmp ; unsigned int tmp___0 ; unsigned int tmp___1 ; { if (bp->common.shmem2_base != 0U) { tmp___0 = readl((void const volatile *)bp->regview + (unsigned long )bp->common.shmem2_base); if (tmp___0 > 188U) { tmp___1 = readl((void const volatile *)(bp->regview + ((unsigned long )bp->common.shmem2_base + 188UL))); if ((int )tmp___1 & 1) { tmp = bnx2x_dcbx_read_shmem_neg_results(bp); if (tmp != 0) { return; } else { } bnx2x_dump_dcbx_drv_param(bp, & bp->dcbx_local_feat, bp->dcbx_error); bnx2x_get_dcbx_drv_param(bp, & bp->dcbx_local_feat, bp->dcbx_error); bnx2x_dcbnl_update_applist(bp, 0); dcbnl_cee_notify(bp->dev, 78, 26, 0U, 0U); bnx2x_dcbx_update_tc_mapping(bp); } else { } } else { } } else { } return; } } __inline static bool bnx2x_dcbnl_set_valid(struct bnx2x *bp ) { { return ((bool )((unsigned int )bp->dcb_state != 0U && (int )bp->dcbx_mode_uset)); } } static u8 bnx2x_dcbnl_get_state(struct net_device *netdev ) { struct bnx2x *bp ; void *tmp ; long tmp___0 ; { tmp = netdev_priv((struct net_device const *)netdev); bp = (struct bnx2x *)tmp; tmp___0 = ldv__builtin_expect((bp->msg_enable & 134217728) != 0, 0L); if (tmp___0 != 0L) { printk("\rbnx2x: [%s:%d(%s)]state = %d\n", "bnx2x_dcbnl_get_state", 1972, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )bp->dcb_state); } else { } return ((u8 )bp->dcb_state); } } static u8 bnx2x_dcbnl_set_state(struct net_device *netdev , u8 state ) { struct bnx2x *bp ; void *tmp ; long tmp___0 ; long tmp___1 ; { tmp = netdev_priv((struct net_device const *)netdev); bp = (struct bnx2x *)tmp; tmp___0 = ldv__builtin_expect((bp->msg_enable & 134217728) != 0, 0L); if (tmp___0 != 0L) { printk("\rbnx2x: [%s:%d(%s)]state = %s\n", "bnx2x_dcbnl_set_state", 1979, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (unsigned int )state != 0U ? (char *)"on" : (char *)"off"); } else { } if ((unsigned int )state != 0U && (bp->dcbx_enabled == 0 || bp->dcbx_enabled == -1)) { tmp___1 = ldv__builtin_expect((bp->msg_enable & 134217728) != 0, 0L); if (tmp___1 != 0L) { printk("\rbnx2x: [%s:%d(%s)]Can not set dcbx to enabled while it is disabled in nvm\n", "bnx2x_dcbnl_set_state", 1984, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } return (1U); } else { } bnx2x_dcbx_set_state(bp, (unsigned int )state != 0U, (u32 )bp->dcbx_enabled); return (0U); } } static void bnx2x_dcbnl_get_perm_hw_addr(struct net_device *netdev , u8 *perm_addr ) { struct bnx2x *bp ; void *tmp ; long tmp___0 ; size_t __len ; void *__ret ; size_t __len___0 ; void *__ret___0 ; { tmp = netdev_priv((struct net_device const *)netdev); bp = (struct bnx2x *)tmp; tmp___0 = ldv__builtin_expect((bp->msg_enable & 134217728) != 0, 0L); if (tmp___0 != 0L) { printk("\rbnx2x: [%s:%d(%s)]GET-PERM-ADDR\n", "bnx2x_dcbnl_get_perm_hw_addr", 1996, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } __len = (size_t )netdev->addr_len; __ret = __builtin_memcpy((void *)perm_addr, (void const *)netdev->dev_addr, __len); if ((int )bp->cnic_loaded) { __len___0 = (size_t )netdev->addr_len; __ret___0 = __builtin_memcpy((void *)perm_addr + (unsigned long )netdev->addr_len, (void const *)(& bp->fip_mac), __len___0); } else { } return; } } static void bnx2x_dcbnl_set_pg_tccfg_tx(struct net_device *netdev , int prio , u8 prio_type , u8 pgid , u8 bw_pct , u8 up_map ) { struct bnx2x *bp ; void *tmp ; long tmp___0 ; bool tmp___1 ; int tmp___2 ; { tmp = netdev_priv((struct net_device const *)netdev); bp = (struct bnx2x *)tmp; tmp___0 = ldv__builtin_expect((bp->msg_enable & 134217728) != 0, 0L); if (tmp___0 != 0L) { printk("\rbnx2x: [%s:%d(%s)]prio[%d] = %d\n", "bnx2x_dcbnl_set_pg_tccfg_tx", 2013, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", prio, (int )pgid); } else { } tmp___1 = bnx2x_dcbnl_set_valid(bp); if (tmp___1) { tmp___2 = 0; } else { tmp___2 = 1; } if (tmp___2 || prio > 7) { return; } else { } bp->dcbx_config_params.admin_configuration_ets_pg[prio] = (u32 )pgid; bp->dcbx_config_params.admin_ets_configuration_tx_enable = 1U; return; } } static void bnx2x_dcbnl_set_pg_bwgcfg_tx(struct net_device *netdev , int pgid , u8 bw_pct ) { struct bnx2x *bp ; void *tmp ; long tmp___0 ; bool tmp___1 ; int tmp___2 ; { tmp = netdev_priv((struct net_device const *)netdev); bp = (struct bnx2x *)tmp; tmp___0 = ldv__builtin_expect((bp->msg_enable & 134217728) != 0, 0L); if (tmp___0 != 0L) { printk("\rbnx2x: [%s:%d(%s)]pgid[%d] = %d\n", "bnx2x_dcbnl_set_pg_bwgcfg_tx", 2038, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", pgid, (int )bw_pct); } else { } tmp___1 = bnx2x_dcbnl_set_valid(bp); if (tmp___1) { tmp___2 = 0; } else { tmp___2 = 1; } if (tmp___2 || pgid > 7) { return; } else { } bp->dcbx_config_params.admin_configuration_bw_precentage[pgid] = (u32 )bw_pct; bp->dcbx_config_params.admin_ets_configuration_tx_enable = 1U; return; } } static void bnx2x_dcbnl_set_pg_tccfg_rx(struct net_device *netdev , int prio , u8 prio_type , u8 pgid , u8 bw_pct , u8 up_map ) { struct bnx2x *bp ; void *tmp ; long tmp___0 ; { tmp = netdev_priv((struct net_device const *)netdev); bp = (struct bnx2x *)tmp; tmp___0 = ldv__builtin_expect((bp->msg_enable & 134217728) != 0, 0L); if (tmp___0 != 0L) { printk("\rbnx2x: [%s:%d(%s)]Nothing to set; No RX support\n", "bnx2x_dcbnl_set_pg_tccfg_rx", 2052, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } return; } } static void bnx2x_dcbnl_set_pg_bwgcfg_rx(struct net_device *netdev , int pgid , u8 bw_pct ) { struct bnx2x *bp ; void *tmp ; long tmp___0 ; { tmp = netdev_priv((struct net_device const *)netdev); bp = (struct bnx2x *)tmp; tmp___0 = ldv__builtin_expect((bp->msg_enable & 134217728) != 0, 0L); if (tmp___0 != 0L) { printk("\rbnx2x: [%s:%d(%s)]Nothing to set; No RX support\n", "bnx2x_dcbnl_set_pg_bwgcfg_rx", 2059, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } return; } } static void bnx2x_dcbnl_get_pg_tccfg_tx(struct net_device *netdev , int prio , u8 *prio_type , u8 *pgid , u8 *bw_pct , u8 *up_map ) { struct bnx2x *bp ; void *tmp ; long tmp___0 ; u8 tmp___1 ; u8 tmp___2 ; u8 tmp___3 ; { tmp = netdev_priv((struct net_device const *)netdev); bp = (struct bnx2x *)tmp; tmp___0 = ldv__builtin_expect((bp->msg_enable & 134217728) != 0, 0L); if (tmp___0 != 0L) { printk("\rbnx2x: [%s:%d(%s)]prio = %d\n", "bnx2x_dcbnl_get_pg_tccfg_tx", 2067, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", prio); } else { } tmp___3 = 0U; *pgid = tmp___3; tmp___2 = tmp___3; *prio_type = tmp___2; tmp___1 = tmp___2; *bw_pct = tmp___1; *up_map = tmp___1; if ((unsigned int )bp->dcb_state == 0U || prio > 7) { return; } else { } *pgid = (unsigned int )((u8 )(bp->dcbx_local_feat.ets.pri_pg_tbl[prio / 8] >> ((3 - (prio / 2) % 4) * 2 + prio % 2) * 4)) & 15U; return; } } static void bnx2x_dcbnl_get_pg_bwgcfg_tx(struct net_device *netdev , int pgid , u8 *bw_pct ) { struct bnx2x *bp ; void *tmp ; long tmp___0 ; { tmp = netdev_priv((struct net_device const *)netdev); bp = (struct bnx2x *)tmp; tmp___0 = ldv__builtin_expect((bp->msg_enable & 134217728) != 0, 0L); if (tmp___0 != 0L) { printk("\rbnx2x: [%s:%d(%s)]pgid = %d\n", "bnx2x_dcbnl_get_pg_bwgcfg_tx", 2093, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", pgid); } else { } *bw_pct = 0U; if ((unsigned int )bp->dcb_state == 0U || pgid > 7) { return; } else { } *bw_pct = (u8 )(bp->dcbx_local_feat.ets.pg_bw_tbl[pgid / 4] >> (3 - pgid % 4) * 8); return; } } static void bnx2x_dcbnl_get_pg_tccfg_rx(struct net_device *netdev , int prio , u8 *prio_type , u8 *pgid , u8 *bw_pct , u8 *up_map ) { struct bnx2x *bp ; void *tmp ; long tmp___0 ; u8 tmp___1 ; u8 tmp___2 ; u8 tmp___3 ; { tmp = netdev_priv((struct net_device const *)netdev); bp = (struct bnx2x *)tmp; tmp___0 = ldv__builtin_expect((bp->msg_enable & 134217728) != 0, 0L); if (tmp___0 != 0L) { printk("\rbnx2x: [%s:%d(%s)]Nothing to get; No RX support\n", "bnx2x_dcbnl_get_pg_tccfg_rx", 2108, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } tmp___3 = 0U; *up_map = tmp___3; tmp___2 = tmp___3; *bw_pct = tmp___2; tmp___1 = tmp___2; *pgid = tmp___1; *prio_type = tmp___1; return; } } static void bnx2x_dcbnl_get_pg_bwgcfg_rx(struct net_device *netdev , int pgid , u8 *bw_pct ) { struct bnx2x *bp ; void *tmp ; long tmp___0 ; { tmp = netdev_priv((struct net_device const *)netdev); bp = (struct bnx2x *)tmp; tmp___0 = ldv__builtin_expect((bp->msg_enable & 134217728) != 0, 0L); if (tmp___0 != 0L) { printk("\rbnx2x: [%s:%d(%s)]Nothing to get; No RX support\n", "bnx2x_dcbnl_get_pg_bwgcfg_rx", 2117, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } *bw_pct = 0U; return; } } static void bnx2x_dcbnl_set_pfc_cfg(struct net_device *netdev , int prio , u8 setting ) { struct bnx2x *bp ; void *tmp ; long tmp___0 ; bool tmp___1 ; int tmp___2 ; { tmp = netdev_priv((struct net_device const *)netdev); bp = (struct bnx2x *)tmp; tmp___0 = ldv__builtin_expect((bp->msg_enable & 134217728) != 0, 0L); if (tmp___0 != 0L) { printk("\rbnx2x: [%s:%d(%s)]prio[%d] = %d\n", "bnx2x_dcbnl_set_pfc_cfg", 2126, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", prio, (int )setting); } else { } tmp___1 = bnx2x_dcbnl_set_valid(bp); if (tmp___1) { tmp___2 = 0; } else { tmp___2 = 1; } if (tmp___2 || prio > 7) { return; } else { } if ((unsigned int )setting != 0U) { bp->dcbx_config_params.admin_pfc_bitmap = bp->dcbx_config_params.admin_pfc_bitmap | (u32 )(1 << prio); bp->dcbx_config_params.admin_pfc_tx_enable = 1U; } else { bp->dcbx_config_params.admin_pfc_bitmap = bp->dcbx_config_params.admin_pfc_bitmap & (u32 )(~ (1 << prio)); } return; } } static void bnx2x_dcbnl_get_pfc_cfg(struct net_device *netdev , int prio , u8 *setting ) { struct bnx2x *bp ; void *tmp ; long tmp___0 ; { tmp = netdev_priv((struct net_device const *)netdev); bp = (struct bnx2x *)tmp; tmp___0 = ldv__builtin_expect((bp->msg_enable & 134217728) != 0, 0L); if (tmp___0 != 0L) { printk("\rbnx2x: [%s:%d(%s)]prio = %d\n", "bnx2x_dcbnl_get_pfc_cfg", 2143, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", prio); } else { } *setting = 0U; if ((unsigned int )bp->dcb_state == 0U || prio > 7) { return; } else { } *setting = (unsigned int )((u8 )((int )bp->dcbx_local_feat.pfc.pri_en_bitmap >> prio)) & 1U; return; } } static u8 bnx2x_dcbnl_set_all(struct net_device *netdev ) { struct bnx2x *bp ; void *tmp ; int rc ; long tmp___0 ; bool tmp___1 ; int tmp___2 ; bool tmp___3 ; long tmp___4 ; { tmp = netdev_priv((struct net_device const *)netdev); bp = (struct bnx2x *)tmp; rc = 0; tmp___0 = ldv__builtin_expect((bp->msg_enable & 134217728) != 0, 0L); if (tmp___0 != 0L) { printk("\rbnx2x: [%s:%d(%s)]SET-ALL\n", "bnx2x_dcbnl_set_all", 2158, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } tmp___1 = bnx2x_dcbnl_set_valid(bp); if (tmp___1) { tmp___2 = 0; } else { tmp___2 = 1; } if (tmp___2) { return (1U); } else { } if ((unsigned int )bp->recovery_state != 0U) { netdev_err((struct net_device const *)bp->dev, "Handling parity error recovery. Try again later\n"); return (1U); } else { } tmp___3 = netif_running((struct net_device const *)bp->dev); if ((int )tmp___3) { bnx2x_update_drv_flags(bp, 4U, 1U); bnx2x_dcbx_init(bp, 1); } else { } tmp___4 = ldv__builtin_expect((bp->msg_enable & 134217728) != 0, 0L); if (tmp___4 != 0L) { printk("\rbnx2x: [%s:%d(%s)]set_dcbx_params done (%d)\n", "bnx2x_dcbnl_set_all", 2174, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", rc); } else { } if (rc != 0) { return (1U); } else { } return (0U); } } static u8 bnx2x_dcbnl_get_cap(struct net_device *netdev , int capid , u8 *cap ) { struct bnx2x *bp ; void *tmp ; u8 rval ; long tmp___0 ; long tmp___1 ; { tmp = netdev_priv((struct net_device const *)netdev); bp = (struct bnx2x *)tmp; rval = 0U; if ((unsigned int )bp->dcb_state != 0U) { switch (capid) { case 2: *cap = 1U; goto ldv_46031; case 3: *cap = 1U; goto ldv_46031; case 4: *cap = 0U; goto ldv_46031; case 5: *cap = 128U; goto ldv_46031; case 6: *cap = 128U; goto ldv_46031; case 7: *cap = 1U; goto ldv_46031; case 8: *cap = 0U; goto ldv_46031; case 9: *cap = 22U; goto ldv_46031; default: printk("\vbnx2x: [%s:%d(%s)]Non valid capability ID\n", "bnx2x_dcbnl_get_cap", 2213, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); rval = 1U; goto ldv_46031; } ldv_46031: ; } else { tmp___0 = ldv__builtin_expect((bp->msg_enable & 134217728) != 0, 0L); if (tmp___0 != 0L) { printk("\rbnx2x: [%s:%d(%s)]DCB disabled\n", "bnx2x_dcbnl_get_cap", 2218, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } rval = 1U; } tmp___1 = ldv__builtin_expect((bp->msg_enable & 134217728) != 0, 0L); if (tmp___1 != 0L) { printk("\rbnx2x: [%s:%d(%s)]capid %d:%x\n", "bnx2x_dcbnl_get_cap", 2222, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", capid, (int )*cap); } else { } return (rval); } } static int bnx2x_dcbnl_get_numtcs(struct net_device *netdev , int tcid , u8 *num ) { struct bnx2x *bp ; void *tmp ; u8 rval ; long tmp___0 ; long tmp___1 ; { tmp = netdev_priv((struct net_device const *)netdev); bp = (struct bnx2x *)tmp; rval = 0U; tmp___0 = ldv__builtin_expect((bp->msg_enable & 134217728) != 0, 0L); if (tmp___0 != 0L) { printk("\rbnx2x: [%s:%d(%s)]tcid %d\n", "bnx2x_dcbnl_get_numtcs", 2231, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", tcid); } else { } if ((unsigned int )bp->dcb_state != 0U) { switch (tcid) { case 2: *num = (((((((((bp->common.chip_id >> 16 == 5770U || bp->common.chip_id >> 16 == 5797U) || bp->common.chip_id >> 16 == 5801U) || bp->common.chip_id >> 16 == 5774U) || bp->common.chip_id >> 16 == 5806U) || bp->common.chip_id >> 16 == 5807U) || ((bp->common.chip_id >> 16 == 5693U || bp->common.chip_id >> 16 == 5694U) || bp->common.chip_id >> 16 == 5695U)) || ((bp->common.chip_id >> 16 == 5793U || bp->common.chip_id >> 16 == 5794U) || bp->common.chip_id >> 16 == 5773U)) || (bp->common.chip_id >> 16 == 5796U || bp->common.chip_id >> 16 == 5803U)) || bp->common.chip_id >> 16 == 5805U) && ((bp->common.chip_id & 61440U) > 20480U ? ((~ bp->common.chip_id & 61440U) >> 13) << 12 == 4096U : (bp->common.chip_id & 61440U) == 4096U) ? 3U : 2U; goto ldv_46050; case 3: *num = (((((((((bp->common.chip_id >> 16 == 5770U || bp->common.chip_id >> 16 == 5797U) || bp->common.chip_id >> 16 == 5801U) || bp->common.chip_id >> 16 == 5774U) || bp->common.chip_id >> 16 == 5806U) || bp->common.chip_id >> 16 == 5807U) || ((bp->common.chip_id >> 16 == 5693U || bp->common.chip_id >> 16 == 5694U) || bp->common.chip_id >> 16 == 5695U)) || ((bp->common.chip_id >> 16 == 5793U || bp->common.chip_id >> 16 == 5794U) || bp->common.chip_id >> 16 == 5773U)) || (bp->common.chip_id >> 16 == 5796U || bp->common.chip_id >> 16 == 5803U)) || bp->common.chip_id >> 16 == 5805U) && ((bp->common.chip_id & 61440U) > 20480U ? ((~ bp->common.chip_id & 61440U) >> 13) << 12 == 4096U : (bp->common.chip_id & 61440U) == 4096U) ? 3U : 2U; goto ldv_46050; default: printk("\vbnx2x: [%s:%d(%s)]Non valid TC-ID\n", "bnx2x_dcbnl_get_numtcs", 2244, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); rval = 1U; goto ldv_46050; } ldv_46050: ; } else { tmp___1 = ldv__builtin_expect((bp->msg_enable & 134217728) != 0, 0L); if (tmp___1 != 0L) { printk("\rbnx2x: [%s:%d(%s)]DCB disabled\n", "bnx2x_dcbnl_get_numtcs", 2249, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } rval = 1U; } return ((int )rval); } } static int bnx2x_dcbnl_set_numtcs(struct net_device *netdev , int tcid , u8 num ) { struct bnx2x *bp ; void *tmp ; long tmp___0 ; { tmp = netdev_priv((struct net_device const *)netdev); bp = (struct bnx2x *)tmp; tmp___0 = ldv__builtin_expect((bp->msg_enable & 134217728) != 0, 0L); if (tmp___0 != 0L) { printk("\rbnx2x: [%s:%d(%s)]num tcs = %d; Not supported\n", "bnx2x_dcbnl_set_numtcs", 2259, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )num); } else { } return (-22); } } static u8 bnx2x_dcbnl_get_pfc_state(struct net_device *netdev ) { struct bnx2x *bp ; void *tmp ; long tmp___0 ; { tmp = netdev_priv((struct net_device const *)netdev); bp = (struct bnx2x *)tmp; tmp___0 = ldv__builtin_expect((bp->msg_enable & 134217728) != 0, 0L); if (tmp___0 != 0L) { printk("\rbnx2x: [%s:%d(%s)]state = %d\n", "bnx2x_dcbnl_get_pfc_state", 2266, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )bp->dcbx_local_feat.pfc.enabled); } else { } if ((unsigned int )bp->dcb_state == 0U) { return (0U); } else { } return (bp->dcbx_local_feat.pfc.enabled); } } static void bnx2x_dcbnl_set_pfc_state(struct net_device *netdev , u8 state ) { struct bnx2x *bp ; void *tmp ; long tmp___0 ; bool tmp___1 ; int tmp___2 ; u32 tmp___3 ; { tmp = netdev_priv((struct net_device const *)netdev); bp = (struct bnx2x *)tmp; tmp___0 = ldv__builtin_expect((bp->msg_enable & 134217728) != 0, 0L); if (tmp___0 != 0L) { printk("\rbnx2x: [%s:%d(%s)]state = %s\n", "bnx2x_dcbnl_set_pfc_state", 2277, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (unsigned int )state != 0U ? (char *)"on" : (char *)"off"); } else { } tmp___1 = bnx2x_dcbnl_set_valid(bp); if (tmp___1) { tmp___2 = 0; } else { tmp___2 = 1; } if (tmp___2) { return; } else { } tmp___3 = (unsigned int )state != 0U; bp->dcbx_config_params.admin_pfc_enable = tmp___3; bp->dcbx_config_params.admin_pfc_tx_enable = tmp___3; return; } } static void bnx2x_admin_app_set_ent(struct bnx2x_admin_priority_app_table *app_ent , u8 idtype , u16 idval , u8 up___0 ) { { app_ent->valid = 1U; switch ((int )idtype) { case 0: app_ent->traffic_type = 0U; goto ldv_46078; case 1: app_ent->traffic_type = 1U; goto ldv_46078; default: ; goto ldv_46078; } ldv_46078: app_ent->app_id = (u32 )idval; app_ent->priority = (u32 )up___0; return; } } static bool bnx2x_admin_app_is_equal(struct bnx2x_admin_priority_app_table *app_ent , u8 idtype , u16 idval ) { { if (app_ent->valid == 0U) { return (0); } else { } switch ((int )idtype) { case 0: ; if (app_ent->traffic_type != 0U) { return (0); } else { } goto ldv_46087; case 1: ; if (app_ent->traffic_type != 1U) { return (0); } else { } goto ldv_46087; default: ; return (0); } ldv_46087: ; if (app_ent->app_id != (u32 )idval) { return (0); } else { } return (1); } } static int bnx2x_set_admin_app_up(struct bnx2x *bp , u8 idtype , u16 idval , u8 up___0 ) { int i ; int ff ; struct bnx2x_admin_priority_app_table *app_ent ; bool tmp ; { i = 0; ff = -1; goto ldv_46101; ldv_46100: app_ent = (struct bnx2x_admin_priority_app_table *)(& bp->dcbx_config_params.admin_priority_app_table) + (unsigned long )i; tmp = bnx2x_admin_app_is_equal(app_ent, (int )idtype, (int )idval); if ((int )tmp) { goto ldv_46099; } else { } if (ff < 0 && app_ent->valid == 0U) { ff = i; } else { } i = i + 1; ldv_46101: ; if (i <= 3) { goto ldv_46100; } else { } ldv_46099: ; if (i <= 3) { bp->dcbx_config_params.admin_priority_app_table[i].priority = (u32 )up___0; } else if (ff >= 0) { bnx2x_admin_app_set_ent((struct bnx2x_admin_priority_app_table *)(& bp->dcbx_config_params.admin_priority_app_table) + (unsigned long )ff, (int )idtype, (int )idval, (int )up___0); } else { printk("\vbnx2x: [%s:%d(%s)]Application table is too large\n", "bnx2x_set_admin_app_up", 2356, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); return (-16); } if ((unsigned int )up___0 != 0U) { bp->dcbx_config_params.admin_application_priority_tx_enable = 1U; } else { } return (0); } } static u8 bnx2x_dcbnl_set_app_up(struct net_device *netdev , u8 idtype , u16 idval , u8 up___0 ) { struct bnx2x *bp ; void *tmp ; long tmp___0 ; long tmp___1 ; bool tmp___2 ; int tmp___3 ; long tmp___4 ; int tmp___5 ; { tmp = netdev_priv((struct net_device const *)netdev); bp = (struct bnx2x *)tmp; tmp___0 = ldv__builtin_expect((bp->msg_enable & 134217728) != 0, 0L); if (tmp___0 != 0L) { printk("\rbnx2x: [%s:%d(%s)]app_type %d, app_id %x, prio bitmap %d\n", "bnx2x_dcbnl_set_app_up", 2373, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )idtype, (int )idval, (int )up___0); } else { } tmp___2 = bnx2x_dcbnl_set_valid(bp); if (tmp___2) { tmp___3 = 0; } else { tmp___3 = 1; } if (tmp___3) { tmp___1 = ldv__builtin_expect((bp->msg_enable & 134217728) != 0, 0L); if (tmp___1 != 0L) { printk("\rbnx2x: [%s:%d(%s)]dcbnl call not valid\n", "bnx2x_dcbnl_set_app_up", 2376, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } return (234U); } else { } switch ((int )idtype) { case 0: ; case 1: ; goto ldv_46113; default: tmp___4 = ldv__builtin_expect((bp->msg_enable & 134217728) != 0, 0L); if (tmp___4 != 0L) { printk("\rbnx2x: [%s:%d(%s)]Wrong ID type\n", "bnx2x_dcbnl_set_app_up", 2386, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } return (234U); } ldv_46113: tmp___5 = bnx2x_set_admin_app_up(bp, (int )idtype, (int )idval, (int )up___0); return ((u8 )tmp___5); } } static u8 bnx2x_dcbnl_get_dcbx(struct net_device *netdev ) { struct bnx2x *bp ; void *tmp ; u8 state ; { tmp = netdev_priv((struct net_device const *)netdev); bp = (struct bnx2x *)tmp; state = 6U; if (bp->dcbx_enabled == 1) { state = (u8 )((unsigned int )state | 16U); } else { } return (state); } } static u8 bnx2x_dcbnl_set_dcbx(struct net_device *netdev , u8 state ) { struct bnx2x *bp ; void *tmp ; long tmp___0 ; { tmp = netdev_priv((struct net_device const *)netdev); bp = (struct bnx2x *)tmp; tmp___0 = ldv__builtin_expect((bp->msg_enable & 134217728) != 0, 0L); if (tmp___0 != 0L) { printk("\rbnx2x: [%s:%d(%s)]state = %02x\n", "bnx2x_dcbnl_set_dcbx", 2408, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )state); } else { } if (((int )state & 22) != (int )state) { printk("\vbnx2x: [%s:%d(%s)]Requested DCBX mode %x is beyond advertised capabilities\n", "bnx2x_dcbnl_set_dcbx", 2414, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )state); return (1U); } else { } if ((unsigned int )bp->dcb_state != 1U) { printk("\vbnx2x: [%s:%d(%s)]DCB turned off, DCBX configuration is invalid\n", "bnx2x_dcbnl_set_dcbx", 2419, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); return (1U); } else { } if (((int )state & 16) != 0) { bp->dcbx_enabled = 1; } else { bp->dcbx_enabled = 2; } bp->dcbx_mode_uset = 1; return (0U); } } static u8 bnx2x_dcbnl_get_featcfg(struct net_device *netdev , int featid , u8 *flags ) { struct bnx2x *bp ; void *tmp ; u8 rval ; long tmp___0 ; long tmp___1 ; { tmp = netdev_priv((struct net_device const *)netdev); bp = (struct bnx2x *)tmp; rval = 0U; tmp___0 = ldv__builtin_expect((bp->msg_enable & 134217728) != 0, 0L); if (tmp___0 != 0L) { printk("\rbnx2x: [%s:%d(%s)]featid %d\n", "bnx2x_dcbnl_get_featcfg", 2438, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", featid); } else { } if ((unsigned int )bp->dcb_state != 0U) { *flags = 0U; switch (featid) { case 2: ; if (bp->dcbx_local_feat.ets.enabled != 0U) { *flags = (u8 )((unsigned int )*flags | 2U); } else { } if ((int )bp->dcbx_error & 1) { *flags = (u8 )((unsigned int )*flags | 1U); } else { } goto ldv_46135; case 3: ; if ((unsigned int )bp->dcbx_local_feat.pfc.enabled != 0U) { *flags = (u8 )((unsigned int )*flags | 2U); } else { } if ((bp->dcbx_error & 18U) != 0U) { *flags = (u8 )((unsigned int )*flags | 1U); } else { } goto ldv_46135; case 4: ; if ((unsigned int )bp->dcbx_local_feat.app.enabled != 0U) { *flags = (u8 )((unsigned int )*flags | 2U); } else { } if ((bp->dcbx_error & 36U) != 0U) { *flags = (u8 )((unsigned int )*flags | 1U); } else { } goto ldv_46135; default: printk("\vbnx2x: [%s:%d(%s)]Non valid featrue-ID\n", "bnx2x_dcbnl_get_featcfg", 2464, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); rval = 1U; goto ldv_46135; } ldv_46135: ; } else { tmp___1 = ldv__builtin_expect((bp->msg_enable & 134217728) != 0, 0L); if (tmp___1 != 0L) { printk("\rbnx2x: [%s:%d(%s)]DCB disabled\n", "bnx2x_dcbnl_get_featcfg", 2469, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } rval = 1U; } return (rval); } } static u8 bnx2x_dcbnl_set_featcfg(struct net_device *netdev , int featid , u8 flags ) { struct bnx2x *bp ; void *tmp ; u8 rval ; long tmp___0 ; long tmp___1 ; bool tmp___2 ; { tmp = netdev_priv((struct net_device const *)netdev); bp = (struct bnx2x *)tmp; rval = 0U; tmp___0 = ldv__builtin_expect((bp->msg_enable & 134217728) != 0, 0L); if (tmp___0 != 0L) { printk("\rbnx2x: [%s:%d(%s)]featid = %d flags = %02x\n", "bnx2x_dcbnl_set_featcfg", 2482, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", featid, (int )flags); } else { } tmp___2 = bnx2x_dcbnl_set_valid(bp); if ((int )tmp___2) { switch (featid) { case 2: bp->dcbx_config_params.admin_ets_enable = ((int )flags & 2) != 0; bp->dcbx_config_params.admin_ets_willing = ((int )flags & 4) != 0; goto ldv_46148; case 3: bp->dcbx_config_params.admin_pfc_enable = ((int )flags & 2) != 0; bp->dcbx_config_params.admin_pfc_willing = ((int )flags & 4) != 0; goto ldv_46148; case 4: bp->dcbx_config_params.admin_app_priority_willing = ((int )flags & 4) != 0; goto ldv_46148; default: printk("\vbnx2x: [%s:%d(%s)]Non valid featrue-ID\n", "bnx2x_dcbnl_set_featcfg", 2505, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); rval = 1U; goto ldv_46148; } ldv_46148: ; } else { tmp___1 = ldv__builtin_expect((bp->msg_enable & 134217728) != 0, 0L); if (tmp___1 != 0L) { printk("\rbnx2x: [%s:%d(%s)]dcbnl call not valid\n", "bnx2x_dcbnl_set_featcfg", 2510, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } rval = 1U; } return (rval); } } static int bnx2x_peer_appinfo(struct net_device *netdev , struct dcb_peer_app_info *info , u16 *app_count ) { int i ; struct bnx2x *bp ; void *tmp ; long tmp___0 ; { tmp = netdev_priv((struct net_device const *)netdev); bp = (struct bnx2x *)tmp; tmp___0 = ldv__builtin_expect((bp->msg_enable & 134217728) != 0, 0L); if (tmp___0 != 0L) { printk("\rbnx2x: [%s:%d(%s)]APP-INFO\n", "bnx2x_peer_appinfo", 2523, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } info->willing = (__u8 )(bp->dcbx_remote_flags & 1024U); info->error = (__u8 )(bp->dcbx_remote_flags & 64U); *app_count = 0U; i = 0; goto ldv_46161; ldv_46160: ; if ((int )bp->dcbx_remote_feat.app.app_pri_tbl[i].appBitfield & 1) { *app_count = (u16 )((int )*app_count + 1); } else { } i = i + 1; ldv_46161: ; if (i <= 15) { goto ldv_46160; } else { } return (0); } } static int bnx2x_peer_apptable(struct net_device *netdev , struct dcb_app *table ) { int i ; int j ; struct bnx2x *bp ; void *tmp ; long tmp___0 ; struct dcbx_app_priority_entry *ent ; int tmp___1 ; { tmp = netdev_priv((struct net_device const *)netdev); bp = (struct bnx2x *)tmp; tmp___0 = ldv__builtin_expect((bp->msg_enable & 134217728) != 0, 0L); if (tmp___0 != 0L) { printk("\rbnx2x: [%s:%d(%s)]APP-TABLE\n", "bnx2x_peer_apptable", 2542, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } i = 0; j = 0; goto ldv_46173; ldv_46172: ent = (struct dcbx_app_priority_entry *)(& bp->dcbx_remote_feat.app.app_pri_tbl) + (unsigned long )i; if ((int )ent->appBitfield & 1) { (table + (unsigned long )j)->selector = bnx2x_dcbx_dcbnl_app_idtype(ent); (table + (unsigned long )j)->priority = bnx2x_dcbx_dcbnl_app_up(ent); tmp___1 = j; j = j + 1; (table + (unsigned long )tmp___1)->protocol = ent->app_id; } else { } i = i + 1; ldv_46173: ; if (i <= 15) { goto ldv_46172; } else { } return (0); } } static int bnx2x_cee_peer_getpg(struct net_device *netdev , struct cee_pg *pg ) { int i ; struct bnx2x *bp ; void *tmp ; { tmp = netdev_priv((struct net_device const *)netdev); bp = (struct bnx2x *)tmp; pg->willing = (__u8 )(bp->dcbx_remote_flags & 256U); i = 0; goto ldv_46182; ldv_46181: pg->pg_bw[i] = (__u8 )(bp->dcbx_remote_feat.ets.pg_bw_tbl[i / 4] >> (3 - i % 4) * 8); pg->prio_pg[i] = (unsigned int )((__u8 )(bp->dcbx_remote_feat.ets.pri_pg_tbl[i / 8] >> ((3 - (i / 2) % 4) * 2 + i % 2) * 4)) & 15U; i = i + 1; ldv_46182: ; if (i <= 7) { goto ldv_46181; } else { } return (0); } } static int bnx2x_cee_peer_getpfc(struct net_device *netdev , struct cee_pfc *pfc ) { struct bnx2x *bp ; void *tmp ; { tmp = netdev_priv((struct net_device const *)netdev); bp = (struct bnx2x *)tmp; pfc->tcs_supported = bp->dcbx_remote_feat.pfc.pfc_caps; pfc->pfc_en = bp->dcbx_remote_feat.pfc.pri_en_bitmap; return (0); } } struct dcbnl_rtnl_ops const bnx2x_dcbnl_ops = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, & bnx2x_dcbnl_get_state, & bnx2x_dcbnl_set_state, & bnx2x_dcbnl_get_perm_hw_addr, & bnx2x_dcbnl_set_pg_tccfg_tx, & bnx2x_dcbnl_set_pg_bwgcfg_tx, & bnx2x_dcbnl_set_pg_tccfg_rx, & bnx2x_dcbnl_set_pg_bwgcfg_rx, & bnx2x_dcbnl_get_pg_tccfg_tx, & bnx2x_dcbnl_get_pg_bwgcfg_tx, & bnx2x_dcbnl_get_pg_tccfg_rx, & bnx2x_dcbnl_get_pg_bwgcfg_rx, & bnx2x_dcbnl_set_pfc_cfg, & bnx2x_dcbnl_get_pfc_cfg, & bnx2x_dcbnl_set_all, & bnx2x_dcbnl_get_cap, & bnx2x_dcbnl_get_numtcs, & bnx2x_dcbnl_set_numtcs, & bnx2x_dcbnl_get_pfc_state, & bnx2x_dcbnl_set_pfc_state, 0, 0, 0, 0, & bnx2x_dcbnl_set_app_up, 0, & bnx2x_dcbnl_get_featcfg, & bnx2x_dcbnl_set_featcfg, & bnx2x_dcbnl_get_dcbx, & bnx2x_dcbnl_set_dcbx, & bnx2x_peer_appinfo, & bnx2x_peer_apptable, & bnx2x_cee_peer_getpg, & bnx2x_cee_peer_getpfc}; void ldv_main5_sequence_infinite_withcheck_stateful(void) { struct net_device *var_group1 ; u8 var_bnx2x_dcbnl_set_state_48_p1 ; u8 *var_bnx2x_dcbnl_get_perm_hw_addr_49_p1 ; int var_bnx2x_dcbnl_set_pg_tccfg_tx_50_p1 ; u8 var_bnx2x_dcbnl_set_pg_tccfg_tx_50_p2 ; u8 var_bnx2x_dcbnl_set_pg_tccfg_tx_50_p3 ; u8 var_bnx2x_dcbnl_set_pg_tccfg_tx_50_p4 ; u8 var_bnx2x_dcbnl_set_pg_tccfg_tx_50_p5 ; int var_bnx2x_dcbnl_set_pg_bwgcfg_tx_51_p1 ; u8 var_bnx2x_dcbnl_set_pg_bwgcfg_tx_51_p2 ; int var_bnx2x_dcbnl_set_pg_tccfg_rx_52_p1 ; u8 var_bnx2x_dcbnl_set_pg_tccfg_rx_52_p2 ; u8 var_bnx2x_dcbnl_set_pg_tccfg_rx_52_p3 ; u8 var_bnx2x_dcbnl_set_pg_tccfg_rx_52_p4 ; u8 var_bnx2x_dcbnl_set_pg_tccfg_rx_52_p5 ; int var_bnx2x_dcbnl_set_pg_bwgcfg_rx_53_p1 ; u8 var_bnx2x_dcbnl_set_pg_bwgcfg_rx_53_p2 ; int var_bnx2x_dcbnl_get_pg_tccfg_tx_54_p1 ; u8 *var_bnx2x_dcbnl_get_pg_tccfg_tx_54_p2 ; u8 *var_bnx2x_dcbnl_get_pg_tccfg_tx_54_p3 ; u8 *var_bnx2x_dcbnl_get_pg_tccfg_tx_54_p4 ; u8 *var_bnx2x_dcbnl_get_pg_tccfg_tx_54_p5 ; int var_bnx2x_dcbnl_get_pg_bwgcfg_tx_55_p1 ; u8 *var_bnx2x_dcbnl_get_pg_bwgcfg_tx_55_p2 ; int var_bnx2x_dcbnl_get_pg_tccfg_rx_56_p1 ; u8 *var_bnx2x_dcbnl_get_pg_tccfg_rx_56_p2 ; u8 *var_bnx2x_dcbnl_get_pg_tccfg_rx_56_p3 ; u8 *var_bnx2x_dcbnl_get_pg_tccfg_rx_56_p4 ; u8 *var_bnx2x_dcbnl_get_pg_tccfg_rx_56_p5 ; int var_bnx2x_dcbnl_get_pg_bwgcfg_rx_57_p1 ; u8 *var_bnx2x_dcbnl_get_pg_bwgcfg_rx_57_p2 ; int var_bnx2x_dcbnl_set_pfc_cfg_58_p1 ; u8 var_bnx2x_dcbnl_set_pfc_cfg_58_p2 ; int var_bnx2x_dcbnl_get_pfc_cfg_59_p1 ; u8 *var_bnx2x_dcbnl_get_pfc_cfg_59_p2 ; int var_bnx2x_dcbnl_get_cap_61_p1 ; u8 *var_bnx2x_dcbnl_get_cap_61_p2 ; int var_bnx2x_dcbnl_get_numtcs_62_p1 ; u8 *var_bnx2x_dcbnl_get_numtcs_62_p2 ; int var_bnx2x_dcbnl_set_numtcs_63_p1 ; u8 var_bnx2x_dcbnl_set_numtcs_63_p2 ; u8 var_bnx2x_dcbnl_set_pfc_state_65_p1 ; u8 var_bnx2x_dcbnl_set_app_up_69_p1 ; u16 var_bnx2x_dcbnl_set_app_up_69_p2 ; u8 var_bnx2x_dcbnl_set_app_up_69_p3 ; u8 var_bnx2x_dcbnl_set_dcbx_71_p1 ; int var_bnx2x_dcbnl_get_featcfg_72_p1 ; u8 *var_bnx2x_dcbnl_get_featcfg_72_p2 ; int var_bnx2x_dcbnl_set_featcfg_73_p1 ; u8 var_bnx2x_dcbnl_set_featcfg_73_p2 ; struct dcb_peer_app_info *var_group2 ; u16 *var_bnx2x_peer_appinfo_74_p2 ; struct dcb_app *var_group3 ; struct cee_pg *var_group4 ; struct cee_pfc *var_group5 ; int tmp ; int tmp___0 ; { LDV_IN_INTERRUPT = 1; ldv_initialize(); goto ldv_46292; ldv_46291: tmp = __VERIFIER_nondet_int(); switch (tmp) { case 0: ldv_handler_precall(); bnx2x_dcbnl_get_state(var_group1); goto ldv_46262; case 1: ldv_handler_precall(); bnx2x_dcbnl_set_state(var_group1, (int )var_bnx2x_dcbnl_set_state_48_p1); goto ldv_46262; case 2: ldv_handler_precall(); bnx2x_dcbnl_get_perm_hw_addr(var_group1, var_bnx2x_dcbnl_get_perm_hw_addr_49_p1); goto ldv_46262; case 3: ldv_handler_precall(); bnx2x_dcbnl_set_pg_tccfg_tx(var_group1, var_bnx2x_dcbnl_set_pg_tccfg_tx_50_p1, (int )var_bnx2x_dcbnl_set_pg_tccfg_tx_50_p2, (int )var_bnx2x_dcbnl_set_pg_tccfg_tx_50_p3, (int )var_bnx2x_dcbnl_set_pg_tccfg_tx_50_p4, (int )var_bnx2x_dcbnl_set_pg_tccfg_tx_50_p5); goto ldv_46262; case 4: ldv_handler_precall(); bnx2x_dcbnl_set_pg_bwgcfg_tx(var_group1, var_bnx2x_dcbnl_set_pg_bwgcfg_tx_51_p1, (int )var_bnx2x_dcbnl_set_pg_bwgcfg_tx_51_p2); goto ldv_46262; case 5: ldv_handler_precall(); bnx2x_dcbnl_set_pg_tccfg_rx(var_group1, var_bnx2x_dcbnl_set_pg_tccfg_rx_52_p1, (int )var_bnx2x_dcbnl_set_pg_tccfg_rx_52_p2, (int )var_bnx2x_dcbnl_set_pg_tccfg_rx_52_p3, (int )var_bnx2x_dcbnl_set_pg_tccfg_rx_52_p4, (int )var_bnx2x_dcbnl_set_pg_tccfg_rx_52_p5); goto ldv_46262; case 6: ldv_handler_precall(); bnx2x_dcbnl_set_pg_bwgcfg_rx(var_group1, var_bnx2x_dcbnl_set_pg_bwgcfg_rx_53_p1, (int )var_bnx2x_dcbnl_set_pg_bwgcfg_rx_53_p2); goto ldv_46262; case 7: ldv_handler_precall(); bnx2x_dcbnl_get_pg_tccfg_tx(var_group1, var_bnx2x_dcbnl_get_pg_tccfg_tx_54_p1, var_bnx2x_dcbnl_get_pg_tccfg_tx_54_p2, var_bnx2x_dcbnl_get_pg_tccfg_tx_54_p3, var_bnx2x_dcbnl_get_pg_tccfg_tx_54_p4, var_bnx2x_dcbnl_get_pg_tccfg_tx_54_p5); goto ldv_46262; case 8: ldv_handler_precall(); bnx2x_dcbnl_get_pg_bwgcfg_tx(var_group1, var_bnx2x_dcbnl_get_pg_bwgcfg_tx_55_p1, var_bnx2x_dcbnl_get_pg_bwgcfg_tx_55_p2); goto ldv_46262; case 9: ldv_handler_precall(); bnx2x_dcbnl_get_pg_tccfg_rx(var_group1, var_bnx2x_dcbnl_get_pg_tccfg_rx_56_p1, var_bnx2x_dcbnl_get_pg_tccfg_rx_56_p2, var_bnx2x_dcbnl_get_pg_tccfg_rx_56_p3, var_bnx2x_dcbnl_get_pg_tccfg_rx_56_p4, var_bnx2x_dcbnl_get_pg_tccfg_rx_56_p5); goto ldv_46262; case 10: ldv_handler_precall(); bnx2x_dcbnl_get_pg_bwgcfg_rx(var_group1, var_bnx2x_dcbnl_get_pg_bwgcfg_rx_57_p1, var_bnx2x_dcbnl_get_pg_bwgcfg_rx_57_p2); goto ldv_46262; case 11: ldv_handler_precall(); bnx2x_dcbnl_set_pfc_cfg(var_group1, var_bnx2x_dcbnl_set_pfc_cfg_58_p1, (int )var_bnx2x_dcbnl_set_pfc_cfg_58_p2); goto ldv_46262; case 12: ldv_handler_precall(); bnx2x_dcbnl_get_pfc_cfg(var_group1, var_bnx2x_dcbnl_get_pfc_cfg_59_p1, var_bnx2x_dcbnl_get_pfc_cfg_59_p2); goto ldv_46262; case 13: ldv_handler_precall(); bnx2x_dcbnl_set_all(var_group1); goto ldv_46262; case 14: ldv_handler_precall(); bnx2x_dcbnl_get_cap(var_group1, var_bnx2x_dcbnl_get_cap_61_p1, var_bnx2x_dcbnl_get_cap_61_p2); goto ldv_46262; case 15: ldv_handler_precall(); bnx2x_dcbnl_get_numtcs(var_group1, var_bnx2x_dcbnl_get_numtcs_62_p1, var_bnx2x_dcbnl_get_numtcs_62_p2); goto ldv_46262; case 16: ldv_handler_precall(); bnx2x_dcbnl_set_numtcs(var_group1, var_bnx2x_dcbnl_set_numtcs_63_p1, (int )var_bnx2x_dcbnl_set_numtcs_63_p2); goto ldv_46262; case 17: ldv_handler_precall(); bnx2x_dcbnl_get_pfc_state(var_group1); goto ldv_46262; case 18: ldv_handler_precall(); bnx2x_dcbnl_set_pfc_state(var_group1, (int )var_bnx2x_dcbnl_set_pfc_state_65_p1); goto ldv_46262; case 19: ldv_handler_precall(); bnx2x_dcbnl_set_app_up(var_group1, (int )var_bnx2x_dcbnl_set_app_up_69_p1, (int )var_bnx2x_dcbnl_set_app_up_69_p2, (int )var_bnx2x_dcbnl_set_app_up_69_p3); goto ldv_46262; case 20: ldv_handler_precall(); bnx2x_dcbnl_get_dcbx(var_group1); goto ldv_46262; case 21: ldv_handler_precall(); bnx2x_dcbnl_set_dcbx(var_group1, (int )var_bnx2x_dcbnl_set_dcbx_71_p1); goto ldv_46262; case 22: ldv_handler_precall(); bnx2x_dcbnl_get_featcfg(var_group1, var_bnx2x_dcbnl_get_featcfg_72_p1, var_bnx2x_dcbnl_get_featcfg_72_p2); goto ldv_46262; case 23: ldv_handler_precall(); bnx2x_dcbnl_set_featcfg(var_group1, var_bnx2x_dcbnl_set_featcfg_73_p1, (int )var_bnx2x_dcbnl_set_featcfg_73_p2); goto ldv_46262; case 24: ldv_handler_precall(); bnx2x_peer_appinfo(var_group1, var_group2, var_bnx2x_peer_appinfo_74_p2); goto ldv_46262; case 25: ldv_handler_precall(); bnx2x_peer_apptable(var_group1, var_group3); goto ldv_46262; case 26: ldv_handler_precall(); bnx2x_cee_peer_getpg(var_group1, var_group4); goto ldv_46262; case 27: ldv_handler_precall(); bnx2x_cee_peer_getpfc(var_group1, var_group5); goto ldv_46262; default: ; goto ldv_46262; } ldv_46262: ; ldv_46292: tmp___0 = __VERIFIER_nondet_int(); if (tmp___0 != 0) { goto ldv_46291; } else { } ldv_check_final_state(); return; } } void ldv_mutex_lock_97(struct mutex *ldv_func_arg1 ) { { ldv_mutex_lock_lock(ldv_func_arg1); mutex_lock(ldv_func_arg1); return; } } void ldv_mutex_unlock_98(struct mutex *ldv_func_arg1 ) { { ldv_mutex_unlock_lock(ldv_func_arg1); mutex_unlock(ldv_func_arg1); return; } } void ldv_mutex_lock_99(struct mutex *ldv_func_arg1 ) { { ldv_mutex_lock_mutex_of_device(ldv_func_arg1); mutex_lock(ldv_func_arg1); return; } } int ldv_mutex_trylock_100(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_101(struct mutex *ldv_func_arg1 ) { { ldv_mutex_unlock_mutex_of_device(ldv_func_arg1); mutex_unlock(ldv_func_arg1); return; } } __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); } } extern void __list_del_entry(struct list_head * ) ; __inline static void list_move_tail(struct list_head *list , struct list_head *head ) { { __list_del_entry(list); list_add_tail(list, head); return; } } __inline static int list_is_last(struct list_head const *list , struct list_head const *head ) { { return ((unsigned long )((struct list_head const *)list->next) == (unsigned long )head); } } __inline static int list_empty(struct list_head const *head ) { { return ((unsigned long )((struct list_head const *)head->next) == (unsigned long )head); } } __inline static void __list_splice(struct list_head const *list , struct list_head *prev , struct list_head *next ) { struct list_head *first ; struct list_head *last ; { first = list->next; last = list->prev; first->prev = prev; prev->next = first; last->next = next; next->prev = last; return; } } __inline static void list_splice_init(struct list_head *list , struct list_head *head ) { int tmp ; { tmp = list_empty((struct list_head const *)list); if (tmp == 0) { __list_splice((struct list_head const *)list, head, head->next); INIT_LIST_HEAD(list); } else { } return; } } extern void __cmpxchg_wrong_size(void) ; __inline static int atomic_cmpxchg(atomic_t *v , int old , int new ) { int __ret ; int __old ; int __new ; u8 volatile *__ptr ; u16 volatile *__ptr___0 ; u32 volatile *__ptr___1 ; u64 volatile *__ptr___2 ; { __old = old; __new = new; switch (4UL) { case 1UL: __ptr = (u8 volatile *)(& v->counter); __asm__ volatile (".pushsection .smp_locks,\"a\"\n.balign 4\n.long 671f - .\n.popsection\n671:\n\tlock; cmpxchgb %2,%1": "=a" (__ret), "+m" (*__ptr): "q" (__new), "0" (__old): "memory"); goto ldv_5547; case 2UL: __ptr___0 = (u16 volatile *)(& v->counter); __asm__ volatile (".pushsection .smp_locks,\"a\"\n.balign 4\n.long 671f - .\n.popsection\n671:\n\tlock; cmpxchgw %2,%1": "=a" (__ret), "+m" (*__ptr___0): "r" (__new), "0" (__old): "memory"); goto ldv_5547; case 4UL: __ptr___1 = (u32 volatile *)(& v->counter); __asm__ volatile (".pushsection .smp_locks,\"a\"\n.balign 4\n.long 671f - .\n.popsection\n671:\n\tlock; cmpxchgl %2,%1": "=a" (__ret), "+m" (*__ptr___1): "r" (__new), "0" (__old): "memory"); goto ldv_5547; case 8UL: __ptr___2 = (u64 volatile *)(& v->counter); __asm__ volatile (".pushsection .smp_locks,\"a\"\n.balign 4\n.long 671f - .\n.popsection\n671:\n\tlock; cmpxchgq %2,%1": "=a" (__ret), "+m" (*__ptr___2): "r" (__new), "0" (__old): "memory"); goto ldv_5547; default: __cmpxchg_wrong_size(); } ldv_5547: ; return (__ret); } } int ldv_mutex_trylock_116(struct mutex *ldv_func_arg1 ) ; void ldv_mutex_unlock_114(struct mutex *ldv_func_arg1 ) ; void ldv_mutex_unlock_117(struct mutex *ldv_func_arg1 ) ; void ldv_mutex_unlock_122(struct mutex *ldv_func_arg1 ) ; void ldv_mutex_unlock_124(struct mutex *ldv_func_arg1 ) ; void ldv_mutex_unlock_125(struct mutex *ldv_func_arg1 ) ; void ldv_mutex_unlock_126(struct mutex *ldv_func_arg1 ) ; void ldv_mutex_unlock_127(struct mutex *ldv_func_arg1 ) ; void ldv_mutex_lock_113(struct mutex *ldv_func_arg1 ) ; void ldv_mutex_lock_115(struct mutex *ldv_func_arg1 ) ; void ldv_mutex_lock_121(struct mutex *ldv_func_arg1 ) ; void ldv_mutex_lock_123(struct mutex *ldv_func_arg1 ) ; void ldv_mutex_lock_one_pending_mutex_of_bnx2x_func_sp_obj(struct mutex *lock ) ; void ldv_mutex_unlock_one_pending_mutex_of_bnx2x_func_sp_obj(struct mutex *lock ) ; extern u32 crc32c(u32 , void const * , unsigned int ) ; void bnx2x_set_mac_in_nig(struct bnx2x *bp , bool add , unsigned char *dev_addr , int index ) ; int bnx2x_get_q_logical_state(struct bnx2x *bp , struct bnx2x_queue_sp_obj *obj ) ; void bnx2x_init_vlan_obj(struct bnx2x *bp , struct bnx2x_vlan_mac_obj *vlan_obj , u8 cl_id , u32 cid , u8 func_id , void *rdata , dma_addr_t rdata_mapping , int state , unsigned long *pstate , bnx2x_obj_type type , struct bnx2x_credit_pool_obj *vlans_pool ) ; void bnx2x_init_vlan_mac_obj(struct bnx2x *bp , struct bnx2x_vlan_mac_obj *vlan_mac_obj , u8 cl_id , u32 cid , u8 func_id , void *rdata , dma_addr_t rdata_mapping , int state , unsigned long *pstate , bnx2x_obj_type type , struct bnx2x_credit_pool_obj *macs_pool , struct bnx2x_credit_pool_obj *vlans_pool ) ; __inline static void __storm_memset_struct___0(struct bnx2x *bp , u32 addr , size_t size , u32 *data ) { int i ; { i = 0; goto ldv_45787; ldv_45786: writel(*(data + (unsigned long )i), (void volatile *)bp->regview + (unsigned long )((u32 )(i * 4) + addr)); i = i + 1; ldv_45787: ; if ((size_t )i < size / 4UL) { goto ldv_45786; } else { } return; } } __inline static void bnx2x_exe_queue_init(struct bnx2x *bp , struct bnx2x_exe_queue_obj *o , int exe_len , union bnx2x_qable_obj *owner , int (*validate)(struct bnx2x * , union bnx2x_qable_obj * , struct bnx2x_exeq_elem * ) , int (*remove)(struct bnx2x * , union bnx2x_qable_obj * , struct bnx2x_exeq_elem * ) , int (*optimize)(struct bnx2x * , union bnx2x_qable_obj * , struct bnx2x_exeq_elem * ) , int (*exec)(struct bnx2x * , union bnx2x_qable_obj * , struct list_head * , unsigned long * ) , struct bnx2x_exeq_elem *(*get)(struct bnx2x_exe_queue_obj * , struct bnx2x_exeq_elem * ) ) { struct lock_class_key __key ; long tmp ; { memset((void *)o, 0, 160UL); INIT_LIST_HEAD(& o->exe_queue); INIT_LIST_HEAD(& o->pending_comp); spinlock_check(& o->lock); __raw_spin_lock_init(& o->lock.ldv_6014.rlock, "&(&o->lock)->rlock", & __key); o->exe_chunk_len = exe_len; o->owner = owner; o->validate = validate; o->remove = remove; o->optimize = optimize; o->execute = exec; o->get = get; tmp = ldv__builtin_expect((bp->msg_enable & 1048576) != 0, 0L); if (tmp != 0L) { printk("\rbnx2x: [%s:%d(%s)]Setup the execution queue with the chunk length of %d\n", "bnx2x_exe_queue_init", 145, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", exe_len); } else { } return; } } __inline static void bnx2x_exe_queue_free_elem(struct bnx2x *bp , struct bnx2x_exeq_elem *elem ) { long tmp ; { tmp = ldv__builtin_expect((bp->msg_enable & 1048576) != 0, 0L); if (tmp != 0L) { printk("\rbnx2x: [%s:%d(%s)]Deleting an exe_queue element\n", "bnx2x_exe_queue_free_elem", 151, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } kfree((void const *)elem); return; } } __inline static int bnx2x_exe_queue_length(struct bnx2x_exe_queue_obj *o ) { struct bnx2x_exeq_elem *elem ; int cnt ; struct list_head const *__mptr ; struct list_head const *__mptr___0 ; { cnt = 0; spin_lock_bh(& o->lock); __mptr = (struct list_head const *)o->exe_queue.next; elem = (struct bnx2x_exeq_elem *)__mptr; goto ldv_45880; ldv_45879: cnt = cnt + 1; __mptr___0 = (struct list_head const *)elem->link.next; elem = (struct bnx2x_exeq_elem *)__mptr___0; ldv_45880: ; if ((unsigned long )elem != (unsigned long )o) { goto ldv_45879; } else { } spin_unlock_bh(& o->lock); return (cnt); } } __inline static int bnx2x_exe_queue_add(struct bnx2x *bp , struct bnx2x_exe_queue_obj *o , struct bnx2x_exeq_elem *elem , bool restore ) { int rc ; long tmp ; { spin_lock_bh(& o->lock); if (! restore) { rc = (*(o->optimize))(bp, o->owner, elem); if (rc != 0) { goto free_and_exit; } else { } rc = (*(o->validate))(bp, o->owner, elem); if (rc != 0) { tmp = ldv__builtin_expect((bp->msg_enable & 1048576) != 0, 0L); if (tmp != 0L) { printk("\rbnx2x: [%s:%d(%s)]Preamble failed: %d\n", "bnx2x_exe_queue_add", 198, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", rc); } else { } goto free_and_exit; } else { } } else { } list_add_tail(& elem->link, & o->exe_queue); spin_unlock_bh(& o->lock); return (0); free_and_exit: bnx2x_exe_queue_free_elem(bp, elem); spin_unlock_bh(& o->lock); return (rc); } } __inline static void __bnx2x_exe_queue_reset_pending(struct bnx2x *bp , struct bnx2x_exe_queue_obj *o ) { struct bnx2x_exeq_elem *elem ; struct list_head const *__mptr ; int tmp ; { goto ldv_45899; ldv_45898: __mptr = (struct list_head const *)o->pending_comp.next; elem = (struct bnx2x_exeq_elem *)__mptr; list_del(& elem->link); bnx2x_exe_queue_free_elem(bp, elem); ldv_45899: tmp = list_empty((struct list_head const *)(& o->pending_comp)); if (tmp == 0) { goto ldv_45898; } else { } return; } } __inline static void bnx2x_exe_queue_reset_pending(struct bnx2x *bp , struct bnx2x_exe_queue_obj *o ) { { spin_lock_bh(& o->lock); __bnx2x_exe_queue_reset_pending(bp, o); spin_unlock_bh(& o->lock); return; } } __inline static int bnx2x_exe_queue_step(struct bnx2x *bp , struct bnx2x_exe_queue_obj *o , unsigned long *ramrod_flags ) { struct bnx2x_exeq_elem *elem ; struct bnx2x_exeq_elem spacer ; int cur_len ; int rc ; long tmp ; int tmp___0 ; int tmp___1 ; struct list_head const *__mptr ; int __ret_warn_on ; long tmp___2 ; int tmp___3 ; { cur_len = 0; memset((void *)(& spacer), 0, 64UL); spin_lock_bh(& o->lock); tmp___1 = list_empty((struct list_head const *)(& o->pending_comp)); if (tmp___1 == 0) { tmp___0 = constant_test_bit(3U, (unsigned long const volatile *)ramrod_flags); if (tmp___0 != 0) { tmp = ldv__builtin_expect((bp->msg_enable & 1048576) != 0, 0L); if (tmp != 0L) { printk("\rbnx2x: [%s:%d(%s)]RAMROD_DRV_CLR_ONLY requested: resetting a pending_comp list\n", "bnx2x_exe_queue_step", 275, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } __bnx2x_exe_queue_reset_pending(bp, o); } else { spin_unlock_bh(& o->lock); return (1); } } else { } goto ldv_45921; ldv_45920: __mptr = (struct list_head const *)o->exe_queue.next; elem = (struct bnx2x_exeq_elem *)__mptr; __ret_warn_on = elem->cmd_len == 0; tmp___2 = ldv__builtin_expect(__ret_warn_on != 0, 0L); if (tmp___2 != 0L) { warn_slowpath_null("/work/ldvuser/exper_fp/work/current--X--drivers--X--defaultlinux-3.10-rc1.tar--X--32_7a--X--cpachecker/linux-3.10-rc1.tar/csd_deg_dscv/8504/dscv_tempdir/dscv/ri/32_7a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sp.c.prepared", 290); } else { } ldv__builtin_expect(__ret_warn_on != 0, 0L); if (elem->cmd_len + cur_len <= o->exe_chunk_len) { cur_len = elem->cmd_len + cur_len; list_add_tail(& spacer.link, & o->pending_comp); __asm__ volatile ("mfence": : : "memory"); list_move_tail(& elem->link, & o->pending_comp); list_del(& spacer.link); } else { goto ldv_45919; } ldv_45921: tmp___3 = list_empty((struct list_head const *)(& o->exe_queue)); if (tmp___3 == 0) { goto ldv_45920; } else { } ldv_45919: ; if (cur_len == 0) { spin_unlock_bh(& o->lock); return (0); } else { } rc = (*(o->execute))(bp, o->owner, & o->pending_comp, ramrod_flags); if (rc < 0) { list_splice_init(& o->pending_comp, & o->exe_queue); } else if (rc == 0) { __bnx2x_exe_queue_reset_pending(bp, o); } else { } spin_unlock_bh(& o->lock); return (rc); } } __inline static bool bnx2x_exe_queue_empty(struct bnx2x_exe_queue_obj *o ) { bool empty ; int tmp ; int tmp___0 ; int tmp___1 ; { tmp = list_empty((struct list_head const *)(& o->exe_queue)); empty = tmp != 0; __asm__ volatile ("mfence": : : "memory"); if ((int )empty) { tmp___0 = list_empty((struct list_head const *)(& o->pending_comp)); if (tmp___0 != 0) { tmp___1 = 1; } else { tmp___1 = 0; } } else { tmp___1 = 0; } return ((bool )tmp___1); } } __inline static struct bnx2x_exeq_elem *bnx2x_exe_queue_alloc_elem(struct bnx2x *bp ) { long tmp ; void *tmp___0 ; { tmp = ldv__builtin_expect((bp->msg_enable & 1048576) != 0, 0L); if (tmp != 0L) { printk("\rbnx2x: [%s:%d(%s)]Allocating a new exe_queue element\n", "bnx2x_exe_queue_alloc_elem", 344, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } tmp___0 = kzalloc(64UL, 32U); return ((struct bnx2x_exeq_elem *)tmp___0); } } static bool bnx2x_raw_check_pending(struct bnx2x_raw_obj *o ) { int tmp ; { tmp = variable_test_bit(o->state, (unsigned long const volatile *)o->pstate); return (tmp != 0); } } static void bnx2x_raw_clear_pending(struct bnx2x_raw_obj *o ) { { __asm__ volatile ("": : : "memory"); clear_bit(o->state, (unsigned long volatile *)o->pstate); __asm__ volatile ("": : : "memory"); return; } } static void bnx2x_raw_set_pending(struct bnx2x_raw_obj *o ) { { __asm__ volatile ("": : : "memory"); set_bit((unsigned int )o->state, (unsigned long volatile *)o->pstate); __asm__ volatile ("": : : "memory"); return; } } __inline static int bnx2x_state_wait(struct bnx2x *bp , int state , unsigned long *pstate ) { int cnt ; long tmp ; int tmp___0 ; int tmp___1 ; { cnt = 5000; if ((bp->common.chip_id & 61440U) > 20480U && (bp->common.chip_id & 4096U) == 0U) { cnt = cnt * 20; } else { } tmp = ldv__builtin_expect((bp->msg_enable & 1048576) != 0, 0L); if (tmp != 0L) { printk("\rbnx2x: [%s:%d(%s)]waiting for state to become %d\n", "bnx2x_state_wait", 386, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", state); } else { } __might_sleep("/work/ldvuser/exper_fp/work/current--X--drivers--X--defaultlinux-3.10-rc1.tar--X--32_7a--X--cpachecker/linux-3.10-rc1.tar/csd_deg_dscv/8504/dscv_tempdir/dscv/ri/32_7a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sp.c.prepared", 388, 0); goto ldv_45947; ldv_45946: tmp___0 = variable_test_bit(state, (unsigned long const volatile *)pstate); if (tmp___0 == 0) { return (0); } else { } usleep_range(1000UL, 2000UL); if (bp->panic != 0) { return (-5); } else { } ldv_45947: tmp___1 = cnt; cnt = cnt - 1; if (tmp___1 != 0) { goto ldv_45946; } else { } printk("\vbnx2x: [%s:%d(%s)]timeout waiting for state %d\n", "bnx2x_state_wait", 404, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", state); return (-16); } } static int bnx2x_raw_wait(struct bnx2x *bp , struct bnx2x_raw_obj *raw ) { int tmp ; { tmp = bnx2x_state_wait(bp, raw->state, raw->pstate); return (tmp); } } static bool bnx2x_get_cam_offset_mac(struct bnx2x_vlan_mac_obj *o , int *offset ) { struct bnx2x_credit_pool_obj *mp ; int __ret_warn_on ; long tmp ; bool tmp___0 ; { mp = o->macs_pool; __ret_warn_on = (unsigned long )mp == (unsigned long )((struct bnx2x_credit_pool_obj *)0); tmp = ldv__builtin_expect(__ret_warn_on != 0, 0L); if (tmp != 0L) { warn_slowpath_null("/work/ldvuser/exper_fp/work/current--X--drivers--X--defaultlinux-3.10-rc1.tar--X--32_7a--X--cpachecker/linux-3.10-rc1.tar/csd_deg_dscv/8504/dscv_tempdir/dscv/ri/32_7a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sp.c.prepared", 423); } else { } ldv__builtin_expect(__ret_warn_on != 0, 0L); tmp___0 = (*(mp->get_entry))(mp, offset); return (tmp___0); } } static bool bnx2x_get_credit_mac(struct bnx2x_vlan_mac_obj *o ) { struct bnx2x_credit_pool_obj *mp ; int __ret_warn_on ; long tmp ; bool tmp___0 ; { mp = o->macs_pool; __ret_warn_on = (unsigned long )mp == (unsigned long )((struct bnx2x_credit_pool_obj *)0); tmp = ldv__builtin_expect(__ret_warn_on != 0, 0L); if (tmp != 0L) { warn_slowpath_null("/work/ldvuser/exper_fp/work/current--X--drivers--X--defaultlinux-3.10-rc1.tar--X--32_7a--X--cpachecker/linux-3.10-rc1.tar/csd_deg_dscv/8504/dscv_tempdir/dscv/ri/32_7a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sp.c.prepared", 432); } else { } ldv__builtin_expect(__ret_warn_on != 0, 0L); tmp___0 = (*(mp->get))(mp, 1); return (tmp___0); } } static bool bnx2x_get_cam_offset_vlan(struct bnx2x_vlan_mac_obj *o , int *offset ) { struct bnx2x_credit_pool_obj *vp ; int __ret_warn_on ; long tmp ; bool tmp___0 ; { vp = o->vlans_pool; __ret_warn_on = (unsigned long )vp == (unsigned long )((struct bnx2x_credit_pool_obj *)0); tmp = ldv__builtin_expect(__ret_warn_on != 0, 0L); if (tmp != 0L) { warn_slowpath_null("/work/ldvuser/exper_fp/work/current--X--drivers--X--defaultlinux-3.10-rc1.tar--X--32_7a--X--cpachecker/linux-3.10-rc1.tar/csd_deg_dscv/8504/dscv_tempdir/dscv/ri/32_7a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sp.c.prepared", 441); } else { } ldv__builtin_expect(__ret_warn_on != 0, 0L); tmp___0 = (*(vp->get_entry))(vp, offset); return (tmp___0); } } static bool bnx2x_get_credit_vlan(struct bnx2x_vlan_mac_obj *o ) { struct bnx2x_credit_pool_obj *vp ; int __ret_warn_on ; long tmp ; bool tmp___0 ; { vp = o->vlans_pool; __ret_warn_on = (unsigned long )vp == (unsigned long )((struct bnx2x_credit_pool_obj *)0); tmp = ldv__builtin_expect(__ret_warn_on != 0, 0L); if (tmp != 0L) { warn_slowpath_null("/work/ldvuser/exper_fp/work/current--X--drivers--X--defaultlinux-3.10-rc1.tar--X--32_7a--X--cpachecker/linux-3.10-rc1.tar/csd_deg_dscv/8504/dscv_tempdir/dscv/ri/32_7a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sp.c.prepared", 450); } else { } ldv__builtin_expect(__ret_warn_on != 0, 0L); tmp___0 = (*(vp->get))(vp, 1); return (tmp___0); } } static bool bnx2x_get_credit_vlan_mac(struct bnx2x_vlan_mac_obj *o ) { struct bnx2x_credit_pool_obj *mp ; struct bnx2x_credit_pool_obj *vp ; bool tmp ; int tmp___0 ; bool tmp___1 ; int tmp___2 ; { mp = o->macs_pool; vp = o->vlans_pool; tmp = (*(mp->get))(mp, 1); if (tmp) { tmp___0 = 0; } else { tmp___0 = 1; } if (tmp___0) { return (0); } else { } tmp___1 = (*(vp->get))(vp, 1); if (tmp___1) { tmp___2 = 0; } else { tmp___2 = 1; } if (tmp___2) { (*(mp->put))(mp, 1); return (0); } else { } return (1); } } static bool bnx2x_put_cam_offset_mac(struct bnx2x_vlan_mac_obj *o , int offset ) { struct bnx2x_credit_pool_obj *mp ; bool tmp ; { mp = o->macs_pool; tmp = (*(mp->put_entry))(mp, offset); return (tmp); } } static bool bnx2x_put_credit_mac(struct bnx2x_vlan_mac_obj *o ) { struct bnx2x_credit_pool_obj *mp ; bool tmp ; { mp = o->macs_pool; tmp = (*(mp->put))(mp, 1); return (tmp); } } static bool bnx2x_put_cam_offset_vlan(struct bnx2x_vlan_mac_obj *o , int offset ) { struct bnx2x_credit_pool_obj *vp ; bool tmp ; { vp = o->vlans_pool; tmp = (*(vp->put_entry))(vp, offset); return (tmp); } } static bool bnx2x_put_credit_vlan(struct bnx2x_vlan_mac_obj *o ) { struct bnx2x_credit_pool_obj *vp ; bool tmp ; { vp = o->vlans_pool; tmp = (*(vp->put))(vp, 1); return (tmp); } } static bool bnx2x_put_credit_vlan_mac(struct bnx2x_vlan_mac_obj *o ) { struct bnx2x_credit_pool_obj *mp ; struct bnx2x_credit_pool_obj *vp ; bool tmp ; int tmp___0 ; bool tmp___1 ; int tmp___2 ; { mp = o->macs_pool; vp = o->vlans_pool; tmp = (*(mp->put))(mp, 1); if (tmp) { tmp___0 = 0; } else { tmp___0 = 1; } if (tmp___0) { return (0); } else { } tmp___1 = (*(vp->put))(vp, 1); if (tmp___1) { tmp___2 = 0; } else { tmp___2 = 1; } if (tmp___2) { (*(mp->get))(mp, 1); return (0); } else { } return (1); } } static int bnx2x_get_n_elements(struct bnx2x *bp , struct bnx2x_vlan_mac_obj *o , int n , u8 *base , u8 stride , u8 size ) { struct bnx2x_vlan_mac_registry_elem *pos ; u8 *next ; int counter ; struct list_head const *__mptr ; size_t __len ; void *__ret ; long tmp ; struct list_head const *__mptr___0 ; { next = base; counter = 0; __mptr = (struct list_head const *)o->head.next; pos = (struct bnx2x_vlan_mac_registry_elem *)__mptr; goto ldv_46027; ldv_46026: ; if (counter < n) { __len = (size_t )size; __ret = __builtin_memcpy((void *)next, (void const *)(& pos->u), __len); counter = counter + 1; tmp = ldv__builtin_expect((bp->msg_enable & 1048576) != 0, 0L); if (tmp != 0L) { printk("\rbnx2x: [%s:%d(%s)]copied element number %d to address %p element was:\n", "bnx2x_get_n_elements", 528, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", counter, next); } else { } next = next + (unsigned long )((int )stride + (int )size); } else { } __mptr___0 = (struct list_head const *)pos->link.next; pos = (struct bnx2x_vlan_mac_registry_elem *)__mptr___0; ldv_46027: ; if ((unsigned long )(& pos->link) != (unsigned long )(& o->head)) { goto ldv_46026; } else { } return (counter * 6); } } static int bnx2x_check_mac_add(struct bnx2x *bp , struct bnx2x_vlan_mac_obj *o , union bnx2x_classification_ramrod_data *data ) { struct bnx2x_vlan_mac_registry_elem *pos ; long tmp ; bool tmp___0 ; int tmp___1 ; struct list_head const *__mptr ; int tmp___2 ; struct list_head const *__mptr___0 ; { tmp = ldv__builtin_expect((bp->msg_enable & 1048576) != 0, 0L); if (tmp != 0L) { printk("\rbnx2x: [%s:%d(%s)]Checking MAC %pM for ADD command\n", "bnx2x_check_mac_add", 543, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (u8 *)(& data->mac.mac)); } else { } tmp___0 = is_valid_ether_addr((u8 const *)(& data->mac.mac)); if (tmp___0) { tmp___1 = 0; } else { tmp___1 = 1; } if (tmp___1) { return (-22); } else { } __mptr = (struct list_head const *)o->head.next; pos = (struct bnx2x_vlan_mac_registry_elem *)__mptr; goto ldv_46041; ldv_46040: tmp___2 = memcmp((void const *)(& data->mac.mac), (void const *)(& pos->u.mac.mac), 6UL); if (tmp___2 == 0 && (int )data->mac.is_inner_mac == (int )pos->u.mac.is_inner_mac) { return (-17); } else { } __mptr___0 = (struct list_head const *)pos->link.next; pos = (struct bnx2x_vlan_mac_registry_elem *)__mptr___0; ldv_46041: ; if ((unsigned long )(& pos->link) != (unsigned long )(& o->head)) { goto ldv_46040; } else { } return (0); } } static int bnx2x_check_vlan_add(struct bnx2x *bp , struct bnx2x_vlan_mac_obj *o , union bnx2x_classification_ramrod_data *data ) { struct bnx2x_vlan_mac_registry_elem *pos ; long tmp ; struct list_head const *__mptr ; struct list_head const *__mptr___0 ; { tmp = ldv__builtin_expect((bp->msg_enable & 1048576) != 0, 0L); if (tmp != 0L) { printk("\rbnx2x: [%s:%d(%s)]Checking VLAN %d for ADD command\n", "bnx2x_check_vlan_add", 563, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )data->vlan.vlan); } else { } __mptr = (struct list_head const *)o->head.next; pos = (struct bnx2x_vlan_mac_registry_elem *)__mptr; goto ldv_46055; ldv_46054: ; if ((int )data->vlan.vlan == (int )pos->u.vlan.vlan) { return (-17); } else { } __mptr___0 = (struct list_head const *)pos->link.next; pos = (struct bnx2x_vlan_mac_registry_elem *)__mptr___0; ldv_46055: ; if ((unsigned long )(& pos->link) != (unsigned long )(& o->head)) { goto ldv_46054; } else { } return (0); } } static int bnx2x_check_vlan_mac_add(struct bnx2x *bp , struct bnx2x_vlan_mac_obj *o , union bnx2x_classification_ramrod_data *data ) { struct bnx2x_vlan_mac_registry_elem *pos ; long tmp ; struct list_head const *__mptr ; int tmp___0 ; struct list_head const *__mptr___0 ; { tmp = ldv__builtin_expect((bp->msg_enable & 1048576) != 0, 0L); if (tmp != 0L) { printk("\rbnx2x: [%s:%d(%s)]Checking VLAN_MAC (%pM, %d) for ADD command\n", "bnx2x_check_vlan_mac_add", 579, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (u8 *)(& data->vlan_mac.mac), (int )data->vlan_mac.vlan); } else { } __mptr = (struct list_head const *)o->head.next; pos = (struct bnx2x_vlan_mac_registry_elem *)__mptr; goto ldv_46069; ldv_46068: ; if ((int )data->vlan_mac.vlan == (int )pos->u.vlan_mac.vlan) { tmp___0 = memcmp((void const *)(& data->vlan_mac.mac), (void const *)(& pos->u.vlan_mac.mac), 6UL); if (tmp___0 == 0) { if ((int )data->vlan_mac.is_inner_mac == (int )pos->u.vlan_mac.is_inner_mac) { return (-17); } else { } } else { } } else { } __mptr___0 = (struct list_head const *)pos->link.next; pos = (struct bnx2x_vlan_mac_registry_elem *)__mptr___0; ldv_46069: ; if ((unsigned long )(& pos->link) != (unsigned long )(& o->head)) { goto ldv_46068; } else { } return (0); } } static struct bnx2x_vlan_mac_registry_elem *bnx2x_check_mac_del(struct bnx2x *bp , struct bnx2x_vlan_mac_obj *o , union bnx2x_classification_ramrod_data *data ) { struct bnx2x_vlan_mac_registry_elem *pos ; long tmp ; struct list_head const *__mptr ; int tmp___0 ; struct list_head const *__mptr___0 ; { tmp = ldv__builtin_expect((bp->msg_enable & 1048576) != 0, 0L); if (tmp != 0L) { printk("\rbnx2x: [%s:%d(%s)]Checking MAC %pM for DEL command\n", "bnx2x_check_mac_del", 601, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (u8 *)(& data->mac.mac)); } else { } __mptr = (struct list_head const *)o->head.next; pos = (struct bnx2x_vlan_mac_registry_elem *)__mptr; goto ldv_46083; ldv_46082: tmp___0 = memcmp((void const *)(& data->mac.mac), (void const *)(& pos->u.mac.mac), 6UL); if (tmp___0 == 0 && (int )data->mac.is_inner_mac == (int )pos->u.mac.is_inner_mac) { return (pos); } else { } __mptr___0 = (struct list_head const *)pos->link.next; pos = (struct bnx2x_vlan_mac_registry_elem *)__mptr___0; ldv_46083: ; if ((unsigned long )(& pos->link) != (unsigned long )(& o->head)) { goto ldv_46082; } else { } return (0); } } static struct bnx2x_vlan_mac_registry_elem *bnx2x_check_vlan_del(struct bnx2x *bp , struct bnx2x_vlan_mac_obj *o , union bnx2x_classification_ramrod_data *data ) { struct bnx2x_vlan_mac_registry_elem *pos ; long tmp ; struct list_head const *__mptr ; struct list_head const *__mptr___0 ; { tmp = ldv__builtin_expect((bp->msg_enable & 1048576) != 0, 0L); if (tmp != 0L) { printk("\rbnx2x: [%s:%d(%s)]Checking VLAN %d for DEL command\n", "bnx2x_check_vlan_del", 618, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )data->vlan.vlan); } else { } __mptr = (struct list_head const *)o->head.next; pos = (struct bnx2x_vlan_mac_registry_elem *)__mptr; goto ldv_46097; ldv_46096: ; if ((int )data->vlan.vlan == (int )pos->u.vlan.vlan) { return (pos); } else { } __mptr___0 = (struct list_head const *)pos->link.next; pos = (struct bnx2x_vlan_mac_registry_elem *)__mptr___0; ldv_46097: ; if ((unsigned long )(& pos->link) != (unsigned long )(& o->head)) { goto ldv_46096; } else { } return (0); } } static struct bnx2x_vlan_mac_registry_elem *bnx2x_check_vlan_mac_del(struct bnx2x *bp , struct bnx2x_vlan_mac_obj *o , union bnx2x_classification_ramrod_data *data ) { struct bnx2x_vlan_mac_registry_elem *pos ; long tmp ; struct list_head const *__mptr ; int tmp___0 ; struct list_head const *__mptr___0 ; { tmp = ldv__builtin_expect((bp->msg_enable & 1048576) != 0, 0L); if (tmp != 0L) { printk("\rbnx2x: [%s:%d(%s)]Checking VLAN_MAC (%pM, %d) for DEL command\n", "bnx2x_check_vlan_mac_del", 635, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (u8 *)(& data->vlan_mac.mac), (int )data->vlan_mac.vlan); } else { } __mptr = (struct list_head const *)o->head.next; pos = (struct bnx2x_vlan_mac_registry_elem *)__mptr; goto ldv_46111; ldv_46110: ; if ((int )data->vlan_mac.vlan == (int )pos->u.vlan_mac.vlan) { tmp___0 = memcmp((void const *)(& data->vlan_mac.mac), (void const *)(& pos->u.vlan_mac.mac), 6UL); if (tmp___0 == 0) { if ((int )data->vlan_mac.is_inner_mac == (int )pos->u.vlan_mac.is_inner_mac) { return (pos); } else { } } else { } } else { } __mptr___0 = (struct list_head const *)pos->link.next; pos = (struct bnx2x_vlan_mac_registry_elem *)__mptr___0; ldv_46111: ; if ((unsigned long )(& pos->link) != (unsigned long )(& o->head)) { goto ldv_46110; } else { } return (0); } } static bool bnx2x_check_move(struct bnx2x *bp , struct bnx2x_vlan_mac_obj *src_o , struct bnx2x_vlan_mac_obj *dst_o , union bnx2x_classification_ramrod_data *data ) { struct bnx2x_vlan_mac_registry_elem *pos ; int rc ; { pos = (*(src_o->check_del))(bp, src_o, data); rc = (*(dst_o->check_add))(bp, dst_o, data); if (rc != 0 || (unsigned long )pos == (unsigned long )((struct bnx2x_vlan_mac_registry_elem *)0)) { return (0); } else { } return (1); } } static bool bnx2x_check_move_always_err(struct bnx2x *bp , struct bnx2x_vlan_mac_obj *src_o , struct bnx2x_vlan_mac_obj *dst_o , union bnx2x_classification_ramrod_data *data ) { { return (0); } } __inline static u8 bnx2x_vlan_mac_get_rx_tx_flag(struct bnx2x_vlan_mac_obj *o ) { struct bnx2x_raw_obj *raw ; u8 rx_tx_flag ; { raw = & o->raw; rx_tx_flag = 0U; if ((unsigned int )raw->obj_type == 1U || (unsigned int )raw->obj_type == 2U) { rx_tx_flag = (u8 )((unsigned int )rx_tx_flag | 2U); } else { } if ((unsigned int )raw->obj_type == 0U || (unsigned int )raw->obj_type == 2U) { rx_tx_flag = (u8 )((unsigned int )rx_tx_flag | 1U); } else { } return (rx_tx_flag); } } void bnx2x_set_mac_in_nig(struct bnx2x *bp , bool add , unsigned char *dev_addr , int index ) { u32 wb_data[2U] ; u32 reg_offset ; long tmp ; size_t __len ; void *__ret ; { reg_offset = (int )bp->pfid & 1 ? 90560U : 90496U; if ((unsigned int )bp->mf_mode != 2U && (unsigned int )bp->mf_mode != 3U) { return; } else { } if (index > 8) { return; } else { } tmp = ldv__builtin_expect((bp->msg_enable & 1048576) != 0, 0L); if (tmp != 0L) { printk("\rbnx2x: [%s:%d(%s)]Going to %s LLH configuration at entry %d\n", "bnx2x_set_mac_in_nig", 715, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )add ? (char *)"ADD" : (char *)"DELETE", index); } else { } if ((int )add) { reg_offset = (u32 )(index * 8) + reg_offset; wb_data[0] = (u32 )(((((int )*(dev_addr + 2UL) << 24) | ((int )*(dev_addr + 3UL) << 16)) | ((int )*(dev_addr + 4UL) << 8)) | (int )*(dev_addr + 5UL)); wb_data[1] = (u32 )(((int )*dev_addr << 8) | (int )*(dev_addr + 1UL)); __len = 8UL; if (__len > 63UL) { __ret = __memcpy((void *)(& (bp->slowpath)->wb_data), (void const *)(& wb_data), __len); } else { __ret = __builtin_memcpy((void *)(& (bp->slowpath)->wb_data), (void const *)(& wb_data), __len); } bnx2x_write_dmae(bp, bp->slowpath_mapping + 4392ULL, reg_offset, 2U); } else { } writel((unsigned int )add, (void volatile *)bp->regview + (unsigned long )(((int )bp->pfid & 1 ? 90464 : 90432) + index * 4)); return; } } __inline static void bnx2x_vlan_mac_set_cmd_hdr_e2(struct bnx2x *bp , struct bnx2x_vlan_mac_obj *o , bool add , int opcode , struct eth_classify_cmd_header *hdr ) { struct bnx2x_raw_obj *raw ; u8 tmp ; { raw = & o->raw; hdr->client_id = raw->cl_id; hdr->func_id = raw->func_id; tmp = bnx2x_vlan_mac_get_rx_tx_flag(o); hdr->cmd_general_data = (u8 )((int )hdr->cmd_general_data | (int )tmp); if ((int )add) { hdr->cmd_general_data = (u8 )((unsigned int )hdr->cmd_general_data | 16U); } else { } hdr->cmd_general_data = (u8 )((int )((signed char )hdr->cmd_general_data) | (int )((signed char )(opcode << 2))); return; } } __inline static void bnx2x_vlan_mac_set_rdata_hdr_e2(u32 cid , int type , struct eth_classify_header *hdr , int rule_cnt ) { { hdr->echo = (cid & 131071U) | (u32 )(type << 17); hdr->rule_cnt = (unsigned char )rule_cnt; return; } } static void bnx2x_set_one_mac_e2(struct bnx2x *bp , struct bnx2x_vlan_mac_obj *o , struct bnx2x_exeq_elem *elem , int rule_idx , int cam_offset ) { struct bnx2x_raw_obj *raw ; struct eth_classify_rules_ramrod_data *data ; int rule_cnt ; int cmd ; union eth_classify_rule_cmd *rule_entry ; bool add ; unsigned long *vlan_mac_flags ; u8 *mac ; int tmp ; int tmp___0 ; long tmp___1 ; { raw = & o->raw; data = (struct eth_classify_rules_ramrod_data *)raw->rdata; rule_cnt = rule_idx + 1; cmd = (int )elem->cmd_data.vlan_mac.cmd; rule_entry = (union eth_classify_rule_cmd *)(& data->rules) + (unsigned long )rule_idx; add = cmd == 0; vlan_mac_flags = & elem->cmd_data.vlan_mac.vlan_mac_flags; mac = (u8 *)(& elem->cmd_data.vlan_mac.u.mac.mac); if (cmd != 2) { tmp___0 = constant_test_bit(2U, (unsigned long const volatile *)vlan_mac_flags); if (tmp___0 != 0) { bnx2x_set_mac_in_nig(bp, (int )add, mac, 0); } else { tmp = constant_test_bit(1U, (unsigned long const volatile *)vlan_mac_flags); if (tmp != 0) { bnx2x_set_mac_in_nig(bp, (int )add, mac, 1); } else { } } } else { } if (rule_idx == 0) { memset((void *)data, 0, 264UL); } else { } bnx2x_vlan_mac_set_cmd_hdr_e2(bp, o, (int )add, 0, & rule_entry->mac.header); tmp___1 = ldv__builtin_expect((bp->msg_enable & 1048576) != 0, 0L); if (tmp___1 != 0L) { printk("\rbnx2x: [%s:%d(%s)]About to %s MAC %pM for Queue %d\n", "bnx2x_set_one_mac_e2", 833, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )add ? (char *)"add" : (char *)"delete", mac, (int )raw->cl_id); } else { } bnx2x_set_fw_mac_addr(& rule_entry->mac.mac_msb, & rule_entry->mac.mac_mid, & rule_entry->mac.mac_lsb, mac); rule_entry->mac.inner_mac = (unsigned short )elem->cmd_data.vlan_mac.u.mac.is_inner_mac; if (cmd == 2) { rule_entry = rule_entry + 1; rule_cnt = rule_cnt + 1; bnx2x_vlan_mac_set_cmd_hdr_e2(bp, elem->cmd_data.vlan_mac.target_obj, 1, 0, & rule_entry->mac.header); bnx2x_set_fw_mac_addr(& rule_entry->mac.mac_msb, & rule_entry->mac.mac_mid, & rule_entry->mac.mac_lsb, mac); rule_entry->mac.inner_mac = (unsigned short )elem->cmd_data.vlan_mac.u.mac.is_inner_mac; } else { } bnx2x_vlan_mac_set_rdata_hdr_e2(raw->cid, raw->state, & data->header, rule_cnt); return; } } __inline static void bnx2x_vlan_mac_set_rdata_hdr_e1x(struct bnx2x *bp , struct bnx2x_vlan_mac_obj *o , int type , int cam_offset , struct mac_configuration_hdr *hdr ) { struct bnx2x_raw_obj *r ; { r = & o->raw; hdr->length = 1U; hdr->offset = (unsigned char )cam_offset; hdr->client_id = 255U; hdr->echo = (r->cid & 131071U) | (u32 )(type << 17); return; } } __inline static void bnx2x_vlan_mac_set_cfg_entry_e1x(struct bnx2x *bp , struct bnx2x_vlan_mac_obj *o , bool add , int opcode , u8 *mac , u16 vlan_id , struct mac_configuration_entry *cfg_entry ) { struct bnx2x_raw_obj *r ; u32 cl_bit_vec ; { r = & o->raw; cl_bit_vec = (u32 )(1 << (int )r->cl_id); cfg_entry->clients_bit_vector = cl_bit_vec; cfg_entry->pf_id = r->func_id; cfg_entry->vlan_id = vlan_id; if ((int )add) { cfg_entry->flags = (unsigned int )cfg_entry->flags & 254U; cfg_entry->flags = (u8 )((unsigned int )cfg_entry->flags | 1U); cfg_entry->flags = (unsigned int )cfg_entry->flags & 243U; cfg_entry->flags = (u8 )((int )((signed char )cfg_entry->flags) | (int )((signed char )(opcode << 2))); bnx2x_set_fw_mac_addr(& cfg_entry->msb_mac_addr, & cfg_entry->middle_mac_addr, & cfg_entry->lsb_mac_addr, mac); } else { cfg_entry->flags = (unsigned int )cfg_entry->flags & 254U; cfg_entry->flags = cfg_entry->flags; } return; } } __inline static void bnx2x_vlan_mac_set_rdata_e1x(struct bnx2x *bp , struct bnx2x_vlan_mac_obj *o , int type , int cam_offset , bool add , u8 *mac , u16 vlan_id , int opcode , struct mac_configuration_cmd *config ) { struct mac_configuration_entry *cfg_entry ; struct bnx2x_raw_obj *raw ; long tmp ; { cfg_entry = (struct mac_configuration_entry *)(& config->config_table); raw = & o->raw; bnx2x_vlan_mac_set_rdata_hdr_e1x(bp, o, type, cam_offset, & config->hdr); bnx2x_vlan_mac_set_cfg_entry_e1x(bp, o, (int )add, opcode, mac, (int )vlan_id, cfg_entry); tmp = ldv__builtin_expect((bp->msg_enable & 1048576) != 0, 0L); if (tmp != 0L) { printk("\rbnx2x: [%s:%d(%s)]%s MAC %pM CLID %d CAM offset %d\n", "bnx2x_vlan_mac_set_rdata_e1x", 933, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )add ? (char *)"setting" : (char *)"clearing", mac, (int )raw->cl_id, cam_offset); } else { } return; } } static void bnx2x_set_one_mac_e1x(struct bnx2x *bp , struct bnx2x_vlan_mac_obj *o , struct bnx2x_exeq_elem *elem , int rule_idx , int cam_offset ) { struct bnx2x_raw_obj *raw ; struct mac_configuration_cmd *config ; bool add ; { raw = & o->raw; config = (struct mac_configuration_cmd *)raw->rdata; add = (unsigned int )elem->cmd_data.vlan_mac.cmd == 0U; memset((void *)config, 0, 1032UL); bnx2x_vlan_mac_set_rdata_e1x(bp, o, raw->state, cam_offset, (int )add, (u8 *)(& elem->cmd_data.vlan_mac.u.mac.mac), 0, 0, config); return; } } static void bnx2x_set_one_vlan_e2(struct bnx2x *bp , struct bnx2x_vlan_mac_obj *o , struct bnx2x_exeq_elem *elem , int rule_idx , int cam_offset ) { struct bnx2x_raw_obj *raw ; struct eth_classify_rules_ramrod_data *data ; int rule_cnt ; union eth_classify_rule_cmd *rule_entry ; enum bnx2x_vlan_mac_cmd cmd ; bool add ; u16 vlan ; long tmp ; { raw = & o->raw; data = (struct eth_classify_rules_ramrod_data *)raw->rdata; rule_cnt = rule_idx + 1; rule_entry = (union eth_classify_rule_cmd *)(& data->rules) + (unsigned long )rule_idx; cmd = elem->cmd_data.vlan_mac.cmd; add = (unsigned int )cmd == 0U; vlan = elem->cmd_data.vlan_mac.u.vlan.vlan; if (rule_idx == 0) { memset((void *)data, 0, 264UL); } else { } bnx2x_vlan_mac_set_cmd_hdr_e2(bp, o, (int )add, 1, & rule_entry->vlan.header); tmp = ldv__builtin_expect((bp->msg_enable & 1048576) != 0, 0L); if (tmp != 0L) { printk("\rbnx2x: [%s:%d(%s)]About to %s VLAN %d\n", "bnx2x_set_one_vlan_e2", 992, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )add ? (char *)"add" : (char *)"delete", (int )vlan); } else { } rule_entry->vlan.vlan = vlan; if ((unsigned int )cmd == 2U) { rule_entry = rule_entry + 1; rule_cnt = rule_cnt + 1; bnx2x_vlan_mac_set_cmd_hdr_e2(bp, elem->cmd_data.vlan_mac.target_obj, 1, 1, & rule_entry->vlan.header); rule_entry->vlan.vlan = vlan; } else { } bnx2x_vlan_mac_set_rdata_hdr_e2(raw->cid, raw->state, & data->header, rule_cnt); return; } } static void bnx2x_set_one_vlan_mac_e2(struct bnx2x *bp , struct bnx2x_vlan_mac_obj *o , struct bnx2x_exeq_elem *elem , int rule_idx , int cam_offset ) { struct bnx2x_raw_obj *raw ; struct eth_classify_rules_ramrod_data *data ; int rule_cnt ; union eth_classify_rule_cmd *rule_entry ; enum bnx2x_vlan_mac_cmd cmd ; bool add ; u16 vlan ; u8 *mac ; { raw = & o->raw; data = (struct eth_classify_rules_ramrod_data *)raw->rdata; rule_cnt = rule_idx + 1; rule_entry = (union eth_classify_rule_cmd *)(& data->rules) + (unsigned long )rule_idx; cmd = elem->cmd_data.vlan_mac.cmd; add = (unsigned int )cmd == 0U; vlan = elem->cmd_data.vlan_mac.u.vlan_mac.vlan; mac = (u8 *)(& elem->cmd_data.vlan_mac.u.vlan_mac.mac); if (rule_idx == 0) { memset((void *)data, 0, 264UL); } else { } bnx2x_vlan_mac_set_cmd_hdr_e2(bp, o, (int )add, 2, & rule_entry->pair.header); rule_entry->pair.vlan = vlan; bnx2x_set_fw_mac_addr(& rule_entry->pair.mac_msb, & rule_entry->pair.mac_mid, & rule_entry->pair.mac_lsb, mac); rule_entry->pair.inner_mac = (unsigned short )elem->cmd_data.vlan_mac.u.vlan_mac.is_inner_mac; if ((unsigned int )cmd == 2U) { rule_entry = rule_entry + 1; rule_cnt = rule_cnt + 1; bnx2x_vlan_mac_set_cmd_hdr_e2(bp, elem->cmd_data.vlan_mac.target_obj, 1, 2, & rule_entry->pair.header); rule_entry->pair.vlan = vlan; bnx2x_set_fw_mac_addr(& rule_entry->pair.mac_msb, & rule_entry->pair.mac_mid, & rule_entry->pair.mac_lsb, mac); rule_entry->pair.inner_mac = (unsigned short )elem->cmd_data.vlan_mac.u.vlan_mac.is_inner_mac; } else { } bnx2x_vlan_mac_set_rdata_hdr_e2(raw->cid, raw->state, & data->header, rule_cnt); return; } } static void bnx2x_set_one_vlan_mac_e1h(struct bnx2x *bp , struct bnx2x_vlan_mac_obj *o , struct bnx2x_exeq_elem *elem , int rule_idx , int cam_offset ) { struct bnx2x_raw_obj *raw ; struct mac_configuration_cmd *config ; bool add ; { raw = & o->raw; config = (struct mac_configuration_cmd *)raw->rdata; add = (unsigned int )elem->cmd_data.vlan_mac.cmd == 0U; memset((void *)config, 0, 1032UL); bnx2x_vlan_mac_set_rdata_e1x(bp, o, 2, cam_offset, (int )add, (u8 *)(& elem->cmd_data.vlan_mac.u.vlan_mac.mac), (int )elem->cmd_data.vlan_mac.u.vlan_mac.vlan, 2, config); return; } } static int bnx2x_vlan_mac_restore(struct bnx2x *bp , struct bnx2x_vlan_mac_ramrod_params *p , struct bnx2x_vlan_mac_registry_elem **ppos ) { struct bnx2x_vlan_mac_registry_elem *pos ; struct bnx2x_vlan_mac_obj *o ; int tmp ; struct list_head const *__mptr ; struct list_head const *__mptr___0 ; int tmp___0 ; size_t __len ; void *__ret ; int tmp___1 ; { o = p->vlan_mac_obj; tmp = list_empty((struct list_head const *)(& o->head)); if (tmp != 0) { *ppos = 0; return (0); } else { } if ((unsigned long )*ppos == (unsigned long )((struct bnx2x_vlan_mac_registry_elem *)0)) { __mptr = (struct list_head const *)o->head.next; *ppos = (struct bnx2x_vlan_mac_registry_elem *)__mptr; } else { __mptr___0 = (struct list_head const *)(*ppos)->link.next; *ppos = (struct bnx2x_vlan_mac_registry_elem *)__mptr___0; } pos = *ppos; tmp___0 = list_is_last((struct list_head const *)(& pos->link), (struct list_head const *)(& o->head)); if (tmp___0 != 0) { *ppos = 0; } else { } __len = 10UL; if (__len > 63UL) { __ret = __memcpy((void *)(& p->user_req.u), (void const *)(& pos->u), __len); } else { __ret = __builtin_memcpy((void *)(& p->user_req.u), (void const *)(& pos->u), __len); } p->user_req.cmd = 0; p->user_req.vlan_mac_flags = pos->vlan_mac_flags; __set_bit(4, (unsigned long volatile *)(& p->ramrod_flags)); tmp___1 = bnx2x_config_vlan_mac(bp, p); return (tmp___1); } } static struct bnx2x_exeq_elem *bnx2x_exeq_get_mac(struct bnx2x_exe_queue_obj *o , struct bnx2x_exeq_elem *elem ) { struct bnx2x_exeq_elem *pos ; struct bnx2x_mac_ramrod_data *data ; struct list_head const *__mptr ; int tmp ; struct list_head const *__mptr___0 ; { data = & elem->cmd_data.vlan_mac.u.mac; __mptr = (struct list_head const *)o->exe_queue.next; pos = (struct bnx2x_exeq_elem *)__mptr; goto ldv_46282; ldv_46281: tmp = memcmp((void const *)(& pos->cmd_data.vlan_mac.u.mac), (void const *)data, 7UL); if (tmp == 0 && (unsigned int )pos->cmd_data.vlan_mac.cmd == (unsigned int )elem->cmd_data.vlan_mac.cmd) { return (pos); } else { } __mptr___0 = (struct list_head const *)pos->link.next; pos = (struct bnx2x_exeq_elem *)__mptr___0; ldv_46282: ; if ((unsigned long )pos != (unsigned long )o) { goto ldv_46281; } else { } return (0); } } static struct bnx2x_exeq_elem *bnx2x_exeq_get_vlan(struct bnx2x_exe_queue_obj *o , struct bnx2x_exeq_elem *elem ) { struct bnx2x_exeq_elem *pos ; struct bnx2x_vlan_ramrod_data *data ; struct list_head const *__mptr ; int tmp ; struct list_head const *__mptr___0 ; { data = & elem->cmd_data.vlan_mac.u.vlan; __mptr = (struct list_head const *)o->exe_queue.next; pos = (struct bnx2x_exeq_elem *)__mptr; goto ldv_46295; ldv_46294: tmp = memcmp((void const *)(& pos->cmd_data.vlan_mac.u.vlan), (void const *)data, 2UL); if (tmp == 0 && (unsigned int )pos->cmd_data.vlan_mac.cmd == (unsigned int )elem->cmd_data.vlan_mac.cmd) { return (pos); } else { } __mptr___0 = (struct list_head const *)pos->link.next; pos = (struct bnx2x_exeq_elem *)__mptr___0; ldv_46295: ; if ((unsigned long )pos != (unsigned long )o) { goto ldv_46294; } else { } return (0); } } static struct bnx2x_exeq_elem *bnx2x_exeq_get_vlan_mac(struct bnx2x_exe_queue_obj *o , struct bnx2x_exeq_elem *elem ) { struct bnx2x_exeq_elem *pos ; struct bnx2x_vlan_mac_ramrod_data *data ; struct list_head const *__mptr ; int tmp ; struct list_head const *__mptr___0 ; { data = & elem->cmd_data.vlan_mac.u.vlan_mac; __mptr = (struct list_head const *)o->exe_queue.next; pos = (struct bnx2x_exeq_elem *)__mptr; goto ldv_46308; ldv_46307: tmp = memcmp((void const *)(& pos->cmd_data.vlan_mac.u.vlan_mac), (void const *)data, 10UL); if (tmp == 0 && (unsigned int )pos->cmd_data.vlan_mac.cmd == (unsigned int )elem->cmd_data.vlan_mac.cmd) { return (pos); } else { } __mptr___0 = (struct list_head const *)pos->link.next; pos = (struct bnx2x_exeq_elem *)__mptr___0; ldv_46308: ; if ((unsigned long )pos != (unsigned long )o) { goto ldv_46307; } else { } return (0); } } __inline static int bnx2x_validate_vlan_mac_add(struct bnx2x *bp , union bnx2x_qable_obj *qo , struct bnx2x_exeq_elem *elem ) { struct bnx2x_vlan_mac_obj *o ; struct bnx2x_exe_queue_obj *exeq ; int rc ; long tmp ; long tmp___0 ; struct bnx2x_exeq_elem *tmp___1 ; int tmp___2 ; bool tmp___3 ; int tmp___4 ; { o = & qo->vlan_mac; exeq = & o->exe_queue; rc = (*(o->check_add))(bp, o, & elem->cmd_data.vlan_mac.u); if (rc != 0) { tmp = ldv__builtin_expect((bp->msg_enable & 1048576) != 0, 0L); if (tmp != 0L) { printk("\rbnx2x: [%s:%d(%s)]ADD command is not allowed considering current registry state.\n", "bnx2x_validate_vlan_mac_add", 1257, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } return (rc); } else { } tmp___1 = (*(exeq->get))(exeq, elem); if ((unsigned long )tmp___1 != (unsigned long )((struct bnx2x_exeq_elem *)0)) { tmp___0 = ldv__builtin_expect((bp->msg_enable & 1048576) != 0, 0L); if (tmp___0 != 0L) { printk("\rbnx2x: [%s:%d(%s)]There is a pending ADD command already\n", "bnx2x_validate_vlan_mac_add", 1266, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } return (-17); } else { } tmp___2 = constant_test_bit(4U, (unsigned long const volatile *)(& elem->cmd_data.vlan_mac.vlan_mac_flags)); if (tmp___2 == 0) { tmp___3 = (*(o->get_credit))(o); if (tmp___3) { tmp___4 = 0; } else { tmp___4 = 1; } if (tmp___4) { return (-22); } else { } } else { } return (0); } } __inline static int bnx2x_validate_vlan_mac_del(struct bnx2x *bp , union bnx2x_qable_obj *qo , struct bnx2x_exeq_elem *elem ) { struct bnx2x_vlan_mac_obj *o ; struct bnx2x_vlan_mac_registry_elem *pos ; struct bnx2x_exe_queue_obj *exeq ; struct bnx2x_exeq_elem query_elem ; long tmp ; size_t __len ; void *__ret ; struct bnx2x_exeq_elem *tmp___0 ; long tmp___1 ; struct bnx2x_exeq_elem *tmp___2 ; int tmp___3 ; bool tmp___4 ; int tmp___5 ; { o = & qo->vlan_mac; exeq = & o->exe_queue; pos = (*(o->check_del))(bp, o, & elem->cmd_data.vlan_mac.u); if ((unsigned long )pos == (unsigned long )((struct bnx2x_vlan_mac_registry_elem *)0)) { tmp = ldv__builtin_expect((bp->msg_enable & 1048576) != 0, 0L); if (tmp != 0L) { printk("\rbnx2x: [%s:%d(%s)]DEL command is not allowed considering current registry state\n", "bnx2x_validate_vlan_mac_del", 1310, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } return (-17); } else { } __len = 64UL; if (__len > 63UL) { __ret = __memcpy((void *)(& query_elem), (void const *)elem, __len); } else { __ret = __builtin_memcpy((void *)(& query_elem), (void const *)elem, __len); } query_elem.cmd_data.vlan_mac.cmd = 2; tmp___0 = (*(exeq->get))(exeq, & query_elem); if ((unsigned long )tmp___0 != (unsigned long )((struct bnx2x_exeq_elem *)0)) { printk("\vbnx2x: [%s:%d(%s)]There is a pending MOVE command already\n", "bnx2x_validate_vlan_mac_del", 1323, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); return (-22); } else { } tmp___2 = (*(exeq->get))(exeq, elem); if ((unsigned long )tmp___2 != (unsigned long )((struct bnx2x_exeq_elem *)0)) { tmp___1 = ldv__builtin_expect((bp->msg_enable & 1048576) != 0, 0L); if (tmp___1 != 0L) { printk("\rbnx2x: [%s:%d(%s)]There is a pending DEL command already\n", "bnx2x_validate_vlan_mac_del", 1329, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } return (-17); } else { } tmp___3 = constant_test_bit(4U, (unsigned long const volatile *)(& elem->cmd_data.vlan_mac.vlan_mac_flags)); if (tmp___3 == 0) { tmp___4 = (*(o->put_credit))(o); if (tmp___4) { tmp___5 = 0; } else { tmp___5 = 1; } if (tmp___5) { printk("\vbnx2x: [%s:%d(%s)]Failed to return a credit\n", "bnx2x_validate_vlan_mac_del", 1337, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); return (-22); } else { } } else { } return (0); } } __inline static int bnx2x_validate_vlan_mac_move(struct bnx2x *bp , union bnx2x_qable_obj *qo , struct bnx2x_exeq_elem *elem ) { struct bnx2x_vlan_mac_obj *src_o ; struct bnx2x_vlan_mac_obj *dest_o ; struct bnx2x_exeq_elem query_elem ; struct bnx2x_exe_queue_obj *src_exeq ; struct bnx2x_exe_queue_obj *dest_exeq ; long tmp ; bool tmp___0 ; int tmp___1 ; size_t __len ; void *__ret ; struct bnx2x_exeq_elem *tmp___2 ; long tmp___3 ; struct bnx2x_exeq_elem *tmp___4 ; struct bnx2x_exeq_elem *tmp___5 ; int tmp___6 ; bool tmp___7 ; int tmp___8 ; int tmp___9 ; bool tmp___10 ; int tmp___11 ; { src_o = & qo->vlan_mac; dest_o = elem->cmd_data.vlan_mac.target_obj; src_exeq = & src_o->exe_queue; dest_exeq = & dest_o->exe_queue; tmp___0 = (*(src_o->check_move))(bp, src_o, dest_o, & elem->cmd_data.vlan_mac.u); if (tmp___0) { tmp___1 = 0; } else { tmp___1 = 1; } if (tmp___1) { tmp = ldv__builtin_expect((bp->msg_enable & 1048576) != 0, 0L); if (tmp != 0L) { printk("\rbnx2x: [%s:%d(%s)]MOVE command is not allowed considering current registry state\n", "bnx2x_validate_vlan_mac_move", 1372, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } return (-22); } else { } __len = 64UL; if (__len > 63UL) { __ret = __memcpy((void *)(& query_elem), (void const *)elem, __len); } else { __ret = __builtin_memcpy((void *)(& query_elem), (void const *)elem, __len); } query_elem.cmd_data.vlan_mac.cmd = 1; tmp___2 = (*(src_exeq->get))(src_exeq, & query_elem); if ((unsigned long )tmp___2 != (unsigned long )((struct bnx2x_exeq_elem *)0)) { printk("\vbnx2x: [%s:%d(%s)]There is a pending DEL command on the source queue already\n", "bnx2x_validate_vlan_mac_move", 1386, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); return (-22); } else { } tmp___4 = (*(src_exeq->get))(src_exeq, elem); if ((unsigned long )tmp___4 != (unsigned long )((struct bnx2x_exeq_elem *)0)) { tmp___3 = ldv__builtin_expect((bp->msg_enable & 1048576) != 0, 0L); if (tmp___3 != 0L) { printk("\rbnx2x: [%s:%d(%s)]There is a pending MOVE command already\n", "bnx2x_validate_vlan_mac_move", 1392, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } return (-17); } else { } query_elem.cmd_data.vlan_mac.cmd = 0; tmp___5 = (*(dest_exeq->get))(dest_exeq, & query_elem); if ((unsigned long )tmp___5 != (unsigned long )((struct bnx2x_exeq_elem *)0)) { printk("\vbnx2x: [%s:%d(%s)]There is a pending ADD command on the destination queue already\n", "bnx2x_validate_vlan_mac_move", 1399, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); return (-22); } else { } tmp___6 = constant_test_bit(5U, (unsigned long const volatile *)(& elem->cmd_data.vlan_mac.vlan_mac_flags)); if (tmp___6 == 0) { tmp___7 = (*(dest_o->get_credit))(dest_o); if (tmp___7) { tmp___8 = 0; } else { tmp___8 = 1; } if (tmp___8) { return (-22); } else { } } else { } tmp___9 = constant_test_bit(4U, (unsigned long const volatile *)(& elem->cmd_data.vlan_mac.vlan_mac_flags)); if (tmp___9 == 0) { tmp___10 = (*(src_o->put_credit))(src_o); if (tmp___10) { tmp___11 = 0; } else { tmp___11 = 1; } if (tmp___11) { (*(dest_o->put_credit))(dest_o); return (-22); } else { } } else { } return (0); } } static int bnx2x_validate_vlan_mac(struct bnx2x *bp , union bnx2x_qable_obj *qo , struct bnx2x_exeq_elem *elem ) { int tmp ; int tmp___0 ; int tmp___1 ; { switch ((unsigned int )elem->cmd_data.vlan_mac.cmd) { case 0U: tmp = bnx2x_validate_vlan_mac_add(bp, qo, elem); return (tmp); case 1U: tmp___0 = bnx2x_validate_vlan_mac_del(bp, qo, elem); return (tmp___0); case 2U: tmp___1 = bnx2x_validate_vlan_mac_move(bp, qo, elem); return (tmp___1); default: ; return (-22); } } } static int bnx2x_remove_vlan_mac(struct bnx2x *bp , union bnx2x_qable_obj *qo , struct bnx2x_exeq_elem *elem ) { int rc ; int tmp ; bool tmp___0 ; bool tmp___1 ; { rc = 0; tmp = constant_test_bit(4U, (unsigned long const volatile *)(& elem->cmd_data.vlan_mac.vlan_mac_flags)); if (tmp != 0) { return (0); } else { } switch ((unsigned int )elem->cmd_data.vlan_mac.cmd) { case 0U: ; case 2U: tmp___0 = (*(qo->vlan_mac.put_credit))(& qo->vlan_mac); rc = (int )tmp___0; goto ldv_46363; case 1U: tmp___1 = (*(qo->vlan_mac.get_credit))(& qo->vlan_mac); rc = (int )tmp___1; goto ldv_46363; default: ; return (-22); } ldv_46363: ; if (rc != 1) { return (-22); } else { } return (0); } } static int bnx2x_wait_vlan_mac(struct bnx2x *bp , struct bnx2x_vlan_mac_obj *o ) { int cnt ; int rc ; struct bnx2x_exe_queue_obj *exeq ; struct bnx2x_raw_obj *raw ; bool tmp ; int tmp___0 ; int tmp___1 ; { cnt = 5000; exeq = & o->exe_queue; raw = & o->raw; goto ldv_46375; ldv_46374: rc = (*(raw->wait_comp))(bp, raw); if (rc != 0) { return (rc); } else { } tmp = bnx2x_exe_queue_empty(exeq); if (tmp) { tmp___0 = 0; } else { tmp___0 = 1; } if (tmp___0) { usleep_range(1000UL, 2000UL); } else { return (0); } ldv_46375: tmp___1 = cnt; cnt = cnt - 1; if (tmp___1 != 0) { goto ldv_46374; } else { } return (-16); } } static int bnx2x_complete_vlan_mac(struct bnx2x *bp , struct bnx2x_vlan_mac_obj *o , union event_ring_elem *cqe , unsigned long *ramrod_flags ) { struct bnx2x_raw_obj *r ; int rc ; int tmp ; bool tmp___0 ; int tmp___1 ; { r = & o->raw; bnx2x_exe_queue_reset_pending(bp, & o->exe_queue); (*(r->clear_pending))(r); if ((unsigned int )cqe->message.error != 0U) { return (-22); } else { } tmp = constant_test_bit(6U, (unsigned long const volatile *)ramrod_flags); if (tmp != 0) { rc = bnx2x_exe_queue_step(bp, & o->exe_queue, ramrod_flags); if (rc < 0) { return (rc); } else { } } else { } tmp___0 = bnx2x_exe_queue_empty(& o->exe_queue); if (tmp___0) { tmp___1 = 0; } else { tmp___1 = 1; } if (tmp___1) { return (1); } else { } return (0); } } static int bnx2x_optimize_vlan_mac(struct bnx2x *bp , union bnx2x_qable_obj *qo , struct bnx2x_exeq_elem *elem ) { struct bnx2x_exeq_elem query ; struct bnx2x_exeq_elem *pos ; struct bnx2x_vlan_mac_obj *o ; struct bnx2x_exe_queue_obj *exeq ; size_t __len ; void *__ret ; bool tmp ; int tmp___0 ; bool tmp___1 ; int tmp___2 ; int tmp___3 ; long tmp___4 ; { o = & qo->vlan_mac; exeq = & o->exe_queue; __len = 64UL; if (__len > 63UL) { __ret = __memcpy((void *)(& query), (void const *)elem, __len); } else { __ret = __builtin_memcpy((void *)(& query), (void const *)elem, __len); } switch ((unsigned int )elem->cmd_data.vlan_mac.cmd) { case 0U: query.cmd_data.vlan_mac.cmd = 1; goto ldv_46398; case 1U: query.cmd_data.vlan_mac.cmd = 0; goto ldv_46398; default: ; return (0); } ldv_46398: pos = (*(exeq->get))(exeq, & query); if ((unsigned long )pos != (unsigned long )((struct bnx2x_exeq_elem *)0)) { tmp___3 = constant_test_bit(4U, (unsigned long const volatile *)(& pos->cmd_data.vlan_mac.vlan_mac_flags)); if (tmp___3 == 0) { if ((unsigned int )query.cmd_data.vlan_mac.cmd == 0U) { tmp___1 = (*(o->put_credit))(o); if (tmp___1) { tmp___2 = 0; } else { tmp___2 = 1; } if (tmp___2) { printk("\vbnx2x: [%s:%d(%s)]Failed to return the credit for the optimized ADD command\n", "bnx2x_optimize_vlan_mac", 1574, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); return (-22); } else { goto _L; } } else { _L: /* CIL Label */ tmp = (*(o->get_credit))(o); if (tmp) { tmp___0 = 0; } else { tmp___0 = 1; } if (tmp___0) { printk("\vbnx2x: [%s:%d(%s)]Failed to recover the credit from the optimized DEL command\n", "bnx2x_optimize_vlan_mac", 1577, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); return (-22); } else { } } } else { } tmp___4 = ldv__builtin_expect((bp->msg_enable & 1048576) != 0, 0L); if (tmp___4 != 0L) { printk("\rbnx2x: [%s:%d(%s)]Optimizing %s command\n", "bnx2x_optimize_vlan_mac", 1584, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (unsigned int )elem->cmd_data.vlan_mac.cmd == 0U ? (char *)"ADD" : (char *)"DEL"); } else { } list_del(& pos->link); bnx2x_exe_queue_free_elem(bp, pos); return (1); } else { } return (0); } } __inline static int bnx2x_vlan_mac_get_registry_elem(struct bnx2x *bp , struct bnx2x_vlan_mac_obj *o , struct bnx2x_exeq_elem *elem , bool restore , struct bnx2x_vlan_mac_registry_elem **re ) { enum bnx2x_vlan_mac_cmd cmd ; struct bnx2x_vlan_mac_registry_elem *reg_elem ; void *tmp ; int __ret_warn_on ; long tmp___0 ; bool tmp___1 ; int tmp___2 ; long tmp___3 ; size_t __len ; void *__ret ; { cmd = elem->cmd_data.vlan_mac.cmd; if (! restore && ((unsigned int )cmd == 0U || (unsigned int )cmd == 2U)) { tmp = kzalloc(48UL, 32U); reg_elem = (struct bnx2x_vlan_mac_registry_elem *)tmp; if ((unsigned long )reg_elem == (unsigned long )((struct bnx2x_vlan_mac_registry_elem *)0)) { return (-12); } else { } tmp___1 = (*(o->get_cam_offset))(o, & reg_elem->cam_offset); if (tmp___1) { tmp___2 = 0; } else { tmp___2 = 1; } if (tmp___2) { __ret_warn_on = 1; tmp___0 = ldv__builtin_expect(__ret_warn_on != 0, 0L); if (tmp___0 != 0L) { warn_slowpath_null("/work/ldvuser/exper_fp/work/current--X--drivers--X--defaultlinux-3.10-rc1.tar--X--32_7a--X--cpachecker/linux-3.10-rc1.tar/csd_deg_dscv/8504/dscv_tempdir/dscv/ri/32_7a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sp.c.prepared", 1628); } else { } ldv__builtin_expect(__ret_warn_on != 0, 0L); kfree((void const *)reg_elem); return (-22); } else { } tmp___3 = ldv__builtin_expect((bp->msg_enable & 1048576) != 0, 0L); if (tmp___3 != 0L) { printk("\rbnx2x: [%s:%d(%s)]Got cam offset %d\n", "bnx2x_vlan_mac_get_registry_elem", 1633, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", reg_elem->cam_offset); } else { } __len = 10UL; if (__len > 63UL) { __ret = __memcpy((void *)(& reg_elem->u), (void const *)(& elem->cmd_data.vlan_mac.u), __len); } else { __ret = __builtin_memcpy((void *)(& reg_elem->u), (void const *)(& elem->cmd_data.vlan_mac.u), __len); } reg_elem->vlan_mac_flags = elem->cmd_data.vlan_mac.vlan_mac_flags; } else { reg_elem = (*(o->check_del))(bp, o, & elem->cmd_data.vlan_mac.u); } *re = reg_elem; return (0); } } static int bnx2x_execute_vlan_mac(struct bnx2x *bp , union bnx2x_qable_obj *qo , struct list_head *exe_chunk , unsigned long *ramrod_flags ) { struct bnx2x_exeq_elem *elem ; struct bnx2x_vlan_mac_obj *o ; struct bnx2x_vlan_mac_obj *cam_obj ; struct bnx2x_raw_obj *r ; int rc ; int idx ; bool restore ; int tmp ; bool drv_only ; int tmp___0 ; struct bnx2x_vlan_mac_registry_elem *reg_elem ; enum bnx2x_vlan_mac_cmd cmd ; int __ret_warn_on ; bool tmp___1 ; long tmp___2 ; struct list_head const *__mptr ; int __ret_warn_on___0 ; long tmp___3 ; struct list_head const *__mptr___0 ; struct list_head const *__mptr___1 ; int __ret_warn_on___1 ; long tmp___4 ; struct list_head const *__mptr___2 ; struct list_head const *__mptr___3 ; struct list_head const *__mptr___4 ; { o = & qo->vlan_mac; r = & o->raw; idx = 0; tmp = constant_test_bit(4U, (unsigned long const volatile *)ramrod_flags); restore = tmp != 0; tmp___0 = constant_test_bit(3U, (unsigned long const volatile *)ramrod_flags); drv_only = tmp___0 != 0; if (! drv_only) { tmp___1 = (*(r->check_pending))(r); __ret_warn_on = (int )tmp___1; tmp___2 = ldv__builtin_expect(__ret_warn_on != 0, 0L); if (tmp___2 != 0L) { warn_slowpath_null("/work/ldvuser/exper_fp/work/current--X--drivers--X--defaultlinux-3.10-rc1.tar--X--32_7a--X--cpachecker/linux-3.10-rc1.tar/csd_deg_dscv/8504/dscv_tempdir/dscv/ri/32_7a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sp.c.prepared", 1678); } else { } ldv__builtin_expect(__ret_warn_on != 0, 0L); (*(r->set_pending))(r); __mptr = (struct list_head const *)exe_chunk->next; elem = (struct bnx2x_exeq_elem *)__mptr; goto ldv_46443; ldv_46442: cmd = elem->cmd_data.vlan_mac.cmd; if ((unsigned int )cmd == 2U) { cam_obj = elem->cmd_data.vlan_mac.target_obj; } else { cam_obj = o; } rc = bnx2x_vlan_mac_get_registry_elem(bp, cam_obj, elem, (int )restore, & reg_elem); if (rc != 0) { goto error_exit; } else { } __ret_warn_on___0 = (unsigned long )reg_elem == (unsigned long )((struct bnx2x_vlan_mac_registry_elem *)0); tmp___3 = ldv__builtin_expect(__ret_warn_on___0 != 0, 0L); if (tmp___3 != 0L) { warn_slowpath_null("/work/ldvuser/exper_fp/work/current--X--drivers--X--defaultlinux-3.10-rc1.tar--X--32_7a--X--cpachecker/linux-3.10-rc1.tar/csd_deg_dscv/8504/dscv_tempdir/dscv/ri/32_7a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sp.c.prepared", 1701); } else { } ldv__builtin_expect(__ret_warn_on___0 != 0, 0L); if (! restore && ((unsigned int )cmd == 0U || (unsigned int )cmd == 2U)) { list_add(& reg_elem->link, & cam_obj->head); } else { } (*(o->set_one_rule))(bp, o, elem, idx, reg_elem->cam_offset); if ((unsigned int )cmd == 2U) { idx = idx + 2; } else { idx = idx + 1; } __mptr___0 = (struct list_head const *)elem->link.next; elem = (struct bnx2x_exeq_elem *)__mptr___0; ldv_46443: ; if ((unsigned long )(& elem->link) != (unsigned long )exe_chunk) { goto ldv_46442; } else { } rc = bnx2x_sp_post(bp, o->ramrod_cmd, (int )r->cid, (unsigned int )(r->rdata_mapping >> 32), (unsigned int )r->rdata_mapping, 0); if (rc != 0) { goto error_exit; } else { } } else { } __mptr___1 = (struct list_head const *)exe_chunk->next; elem = (struct bnx2x_exeq_elem *)__mptr___1; goto ldv_46452; ldv_46451: cmd = elem->cmd_data.vlan_mac.cmd; if ((unsigned int )cmd == 1U || (unsigned int )cmd == 2U) { reg_elem = (*(o->check_del))(bp, o, & elem->cmd_data.vlan_mac.u); __ret_warn_on___1 = (unsigned long )reg_elem == (unsigned long )((struct bnx2x_vlan_mac_registry_elem *)0); tmp___4 = ldv__builtin_expect(__ret_warn_on___1 != 0, 0L); if (tmp___4 != 0L) { warn_slowpath_null("/work/ldvuser/exper_fp/work/current--X--drivers--X--defaultlinux-3.10-rc1.tar--X--32_7a--X--cpachecker/linux-3.10-rc1.tar/csd_deg_dscv/8504/dscv_tempdir/dscv/ri/32_7a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sp.c.prepared", 1744); } else { } ldv__builtin_expect(__ret_warn_on___1 != 0, 0L); (*(o->put_cam_offset))(o, reg_elem->cam_offset); list_del(& reg_elem->link); kfree((void const *)reg_elem); } else { } __mptr___2 = (struct list_head const *)elem->link.next; elem = (struct bnx2x_exeq_elem *)__mptr___2; ldv_46452: ; if ((unsigned long )(& elem->link) != (unsigned long )exe_chunk) { goto ldv_46451; } else { } if (! drv_only) { return (1); } else { return (0); } error_exit: (*(r->clear_pending))(r); __mptr___3 = (struct list_head const *)exe_chunk->next; elem = (struct bnx2x_exeq_elem *)__mptr___3; goto ldv_46459; ldv_46458: cmd = elem->cmd_data.vlan_mac.cmd; if ((unsigned int )cmd == 2U) { cam_obj = elem->cmd_data.vlan_mac.target_obj; } else { cam_obj = o; } if (! restore && ((unsigned int )cmd == 0U || (unsigned int )cmd == 2U)) { reg_elem = (*(o->check_del))(bp, cam_obj, & elem->cmd_data.vlan_mac.u); if ((unsigned long )reg_elem != (unsigned long )((struct bnx2x_vlan_mac_registry_elem *)0)) { list_del(& reg_elem->link); kfree((void const *)reg_elem); } else { } } else { } __mptr___4 = (struct list_head const *)elem->link.next; elem = (struct bnx2x_exeq_elem *)__mptr___4; ldv_46459: ; if ((unsigned long )(& elem->link) != (unsigned long )exe_chunk) { goto ldv_46458; } else { } return (rc); } } __inline static int bnx2x_vlan_mac_push_new_cmd(struct bnx2x *bp , struct bnx2x_vlan_mac_ramrod_params *p ) { struct bnx2x_exeq_elem *elem ; struct bnx2x_vlan_mac_obj *o ; bool restore ; int tmp ; size_t __len ; void *__ret ; int tmp___0 ; { o = p->vlan_mac_obj; tmp = constant_test_bit(4U, (unsigned long const volatile *)(& p->ramrod_flags)); restore = tmp != 0; elem = bnx2x_exe_queue_alloc_elem(bp); if ((unsigned long )elem == (unsigned long )((struct bnx2x_exeq_elem *)0)) { return (-12); } else { } switch ((unsigned int )p->user_req.cmd) { case 2U: elem->cmd_len = 2; goto ldv_46469; default: elem->cmd_len = 1; } ldv_46469: __len = 40UL; if (__len > 63UL) { __ret = __memcpy((void *)(& elem->cmd_data.vlan_mac), (void const *)(& p->user_req), __len); } else { __ret = __builtin_memcpy((void *)(& elem->cmd_data.vlan_mac), (void const *)(& p->user_req), __len); } tmp___0 = bnx2x_exe_queue_add(bp, & o->exe_queue, elem, (int )restore); return (tmp___0); } } int bnx2x_config_vlan_mac(struct bnx2x *bp , struct bnx2x_vlan_mac_ramrod_params *p ) { int rc ; struct bnx2x_vlan_mac_obj *o ; unsigned long *ramrod_flags ; bool cont ; int tmp ; struct bnx2x_raw_obj *raw ; bool tmp___0 ; int tmp___1 ; long tmp___2 ; int tmp___3 ; int tmp___4 ; int tmp___5 ; int max_iterations ; int tmp___6 ; bool tmp___7 ; int tmp___8 ; int tmp___9 ; int tmp___10 ; { rc = 0; o = p->vlan_mac_obj; ramrod_flags = & p->ramrod_flags; tmp = constant_test_bit(6U, (unsigned long const volatile *)ramrod_flags); cont = tmp != 0; raw = & o->raw; if (! cont) { rc = bnx2x_vlan_mac_push_new_cmd(bp, p); if (rc != 0) { return (rc); } else { } } else { } tmp___0 = bnx2x_exe_queue_empty(& o->exe_queue); if (tmp___0) { tmp___1 = 0; } else { tmp___1 = 1; } if (tmp___1) { rc = 1; } else { } tmp___3 = constant_test_bit(3U, (unsigned long const volatile *)ramrod_flags); if (tmp___3 != 0) { tmp___2 = ldv__builtin_expect((bp->msg_enable & 1048576) != 0, 0L); if (tmp___2 != 0L) { printk("\rbnx2x: [%s:%d(%s)]RAMROD_DRV_CLR_ONLY requested: clearing a pending bit.\n", "bnx2x_config_vlan_mac", 1848, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } (*(raw->clear_pending))(raw); } else { } if ((int )cont) { goto _L; } else { tmp___4 = constant_test_bit(5U, (unsigned long const volatile *)ramrod_flags); if (tmp___4 != 0) { goto _L; } else { tmp___5 = constant_test_bit(2U, (unsigned long const volatile *)ramrod_flags); if (tmp___5 != 0) { _L: /* CIL Label */ rc = bnx2x_exe_queue_step(bp, & o->exe_queue, ramrod_flags); if (rc < 0) { return (rc); } else { } } else { } } } tmp___10 = constant_test_bit(2U, (unsigned long const volatile *)(& p->ramrod_flags)); if (tmp___10 != 0) { tmp___6 = bnx2x_exe_queue_length(& o->exe_queue); max_iterations = tmp___6 + 1; goto ldv_46486; ldv_46485: rc = (*(raw->wait_comp))(bp, raw); if (rc != 0) { return (rc); } else { } rc = bnx2x_exe_queue_step(bp, & o->exe_queue, ramrod_flags); if (rc < 0) { return (rc); } else { } ldv_46486: tmp___7 = bnx2x_exe_queue_empty(& o->exe_queue); if (tmp___7) { tmp___8 = 0; } else { tmp___8 = 1; } if (tmp___8) { tmp___9 = max_iterations; max_iterations = max_iterations - 1; if (tmp___9 != 0) { goto ldv_46485; } else { goto ldv_46487; } } else { } ldv_46487: ; return (0); } else { } return (rc); } } static int bnx2x_vlan_mac_del_all(struct bnx2x *bp , struct bnx2x_vlan_mac_obj *o , unsigned long *vlan_mac_flags , unsigned long *ramrod_flags ) { struct bnx2x_vlan_mac_registry_elem *pos ; int rc ; struct bnx2x_vlan_mac_ramrod_params p ; struct bnx2x_exe_queue_obj *exeq ; struct bnx2x_exeq_elem *exeq_pos ; struct bnx2x_exeq_elem *exeq_pos_n ; struct list_head const *__mptr ; struct list_head const *__mptr___0 ; struct list_head const *__mptr___1 ; struct list_head const *__mptr___2 ; size_t __len ; void *__ret ; struct list_head const *__mptr___3 ; int tmp ; { pos = 0; rc = 0; exeq = & o->exe_queue; spin_lock_bh(& exeq->lock); __mptr = (struct list_head const *)exeq->exe_queue.next; exeq_pos = (struct bnx2x_exeq_elem *)__mptr; __mptr___0 = (struct list_head const *)exeq_pos->link.next; exeq_pos_n = (struct bnx2x_exeq_elem *)__mptr___0; goto ldv_46508; ldv_46507: ; if (exeq_pos->cmd_data.vlan_mac.vlan_mac_flags == *vlan_mac_flags) { rc = (*(exeq->remove))(bp, exeq->owner, exeq_pos); if (rc != 0) { printk("\vbnx2x: [%s:%d(%s)]Failed to remove command\n", "bnx2x_vlan_mac_del_all", 1927, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); spin_unlock_bh(& exeq->lock); return (rc); } else { } list_del(& exeq_pos->link); bnx2x_exe_queue_free_elem(bp, exeq_pos); } else { } exeq_pos = exeq_pos_n; __mptr___1 = (struct list_head const *)exeq_pos_n->link.next; exeq_pos_n = (struct bnx2x_exeq_elem *)__mptr___1; ldv_46508: ; if ((unsigned long )exeq_pos != (unsigned long )exeq) { goto ldv_46507; } else { } spin_unlock_bh(& exeq->lock); memset((void *)(& p), 0, 56UL); p.vlan_mac_obj = o; p.ramrod_flags = *ramrod_flags; p.user_req.cmd = 1; __clear_bit(2, (unsigned long volatile *)(& p.ramrod_flags)); __clear_bit(5, (unsigned long volatile *)(& p.ramrod_flags)); __clear_bit(6, (unsigned long volatile *)(& p.ramrod_flags)); __mptr___2 = (struct list_head const *)o->head.next; pos = (struct bnx2x_vlan_mac_registry_elem *)__mptr___2; goto ldv_46518; ldv_46517: ; if (pos->vlan_mac_flags == *vlan_mac_flags) { p.user_req.vlan_mac_flags = pos->vlan_mac_flags; __len = 10UL; if (__len > 63UL) { __ret = __memcpy((void *)(& p.user_req.u), (void const *)(& pos->u), __len); } else { __ret = __builtin_memcpy((void *)(& p.user_req.u), (void const *)(& pos->u), __len); } rc = bnx2x_config_vlan_mac(bp, & p); if (rc < 0) { printk("\vbnx2x: [%s:%d(%s)]Failed to add a new DEL command\n", "bnx2x_vlan_mac_del_all", 1958, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); return (rc); } else { } } else { } __mptr___3 = (struct list_head const *)pos->link.next; pos = (struct bnx2x_vlan_mac_registry_elem *)__mptr___3; ldv_46518: ; if ((unsigned long )(& pos->link) != (unsigned long )(& o->head)) { goto ldv_46517; } else { } p.ramrod_flags = *ramrod_flags; __set_bit(6, (unsigned long volatile *)(& p.ramrod_flags)); tmp = bnx2x_config_vlan_mac(bp, & p); return (tmp); } } __inline static void bnx2x_init_raw_obj(struct bnx2x_raw_obj *raw , u8 cl_id , u32 cid , u8 func_id , void *rdata , dma_addr_t rdata_mapping , int state , unsigned long *pstate , bnx2x_obj_type type ) { { raw->func_id = func_id; raw->cid = cid; raw->cl_id = cl_id; raw->rdata = rdata; raw->rdata_mapping = rdata_mapping; raw->state = state; raw->pstate = pstate; raw->obj_type = type; raw->check_pending = & bnx2x_raw_check_pending; raw->clear_pending = & bnx2x_raw_clear_pending; raw->set_pending = & bnx2x_raw_set_pending; raw->wait_comp = & bnx2x_raw_wait; return; } } __inline static void bnx2x_init_vlan_mac_common(struct bnx2x_vlan_mac_obj *o , u8 cl_id , u32 cid , u8 func_id , void *rdata , dma_addr_t rdata_mapping , int state , unsigned long *pstate , bnx2x_obj_type type , struct bnx2x_credit_pool_obj *macs_pool , struct bnx2x_credit_pool_obj *vlans_pool ) { { INIT_LIST_HEAD(& o->head); o->macs_pool = macs_pool; o->vlans_pool = vlans_pool; o->delete_all = & bnx2x_vlan_mac_del_all; o->restore = & bnx2x_vlan_mac_restore; o->complete = & bnx2x_complete_vlan_mac; o->wait = & bnx2x_wait_vlan_mac; bnx2x_init_raw_obj(& o->raw, (int )cl_id, cid, (int )func_id, rdata, rdata_mapping, state, pstate, type); return; } } void bnx2x_init_mac_obj(struct bnx2x *bp , struct bnx2x_vlan_mac_obj *mac_obj , u8 cl_id , u32 cid , u8 func_id , void *rdata , dma_addr_t rdata_mapping , int state , unsigned long *pstate , bnx2x_obj_type type , struct bnx2x_credit_pool_obj *macs_pool ) { union bnx2x_qable_obj *qable_obj ; { qable_obj = (union bnx2x_qable_obj *)mac_obj; bnx2x_init_vlan_mac_common(mac_obj, (int )cl_id, cid, (int )func_id, rdata, rdata_mapping, state, pstate, type, macs_pool, 0); mac_obj->get_credit = & bnx2x_get_credit_mac; mac_obj->put_credit = & bnx2x_put_credit_mac; mac_obj->get_cam_offset = & bnx2x_get_cam_offset_mac; mac_obj->put_cam_offset = & bnx2x_put_cam_offset_mac; if (bp->common.chip_id >> 16 == 5710U || (bp->common.chip_id >> 16 == 5711U || bp->common.chip_id >> 16 == 5712U)) { mac_obj->set_one_rule = & bnx2x_set_one_mac_e1x; mac_obj->check_del = & bnx2x_check_mac_del; mac_obj->check_add = & bnx2x_check_mac_add; mac_obj->check_move = & bnx2x_check_move_always_err; mac_obj->ramrod_cmd = 13; bnx2x_exe_queue_init(bp, & mac_obj->exe_queue, 1, qable_obj, & bnx2x_validate_vlan_mac, & bnx2x_remove_vlan_mac, & bnx2x_optimize_vlan_mac, & bnx2x_execute_vlan_mac, & bnx2x_exeq_get_mac); } else { mac_obj->set_one_rule = & bnx2x_set_one_mac_e2; mac_obj->check_del = & bnx2x_check_mac_del; mac_obj->check_add = & bnx2x_check_mac_add; mac_obj->check_move = & bnx2x_check_move; mac_obj->ramrod_cmd = 9; mac_obj->get_n_elements = & bnx2x_get_n_elements; bnx2x_exe_queue_init(bp, & mac_obj->exe_queue, 16, qable_obj, & bnx2x_validate_vlan_mac, & bnx2x_remove_vlan_mac, & bnx2x_optimize_vlan_mac, & bnx2x_execute_vlan_mac, & bnx2x_exeq_get_mac); } return; } } void bnx2x_init_vlan_obj(struct bnx2x *bp , struct bnx2x_vlan_mac_obj *vlan_obj , u8 cl_id , u32 cid , u8 func_id , void *rdata , dma_addr_t rdata_mapping , int state , unsigned long *pstate , bnx2x_obj_type type , struct bnx2x_credit_pool_obj *vlans_pool ) { union bnx2x_qable_obj *qable_obj ; { qable_obj = (union bnx2x_qable_obj *)vlan_obj; bnx2x_init_vlan_mac_common(vlan_obj, (int )cl_id, cid, (int )func_id, rdata, rdata_mapping, state, pstate, type, 0, vlans_pool); vlan_obj->get_credit = & bnx2x_get_credit_vlan; vlan_obj->put_credit = & bnx2x_put_credit_vlan; vlan_obj->get_cam_offset = & bnx2x_get_cam_offset_vlan; vlan_obj->put_cam_offset = & bnx2x_put_cam_offset_vlan; if (bp->common.chip_id >> 16 == 5710U || (bp->common.chip_id >> 16 == 5711U || bp->common.chip_id >> 16 == 5712U)) { printk("\vbnx2x: [%s:%d(%s)]Do not support chips others than E2 and newer\n", "bnx2x_init_vlan_obj", 2082, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); __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 *)"/work/ldvuser/exper_fp/work/current--X--drivers--X--defaultlinux-3.10-rc1.tar--X--32_7a--X--cpachecker/linux-3.10-rc1.tar/csd_deg_dscv/8504/dscv_tempdir/dscv/ri/32_7a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sp.c.prepared"), "i" (2083), "i" (12UL)); ldv_46573: ; goto ldv_46573; } else { vlan_obj->set_one_rule = & bnx2x_set_one_vlan_e2; vlan_obj->check_del = & bnx2x_check_vlan_del; vlan_obj->check_add = & bnx2x_check_vlan_add; vlan_obj->check_move = & bnx2x_check_move; vlan_obj->ramrod_cmd = 9; vlan_obj->get_n_elements = & bnx2x_get_n_elements; bnx2x_exe_queue_init(bp, & vlan_obj->exe_queue, 16, qable_obj, & bnx2x_validate_vlan_mac, & bnx2x_remove_vlan_mac, & bnx2x_optimize_vlan_mac, & bnx2x_execute_vlan_mac, & bnx2x_exeq_get_vlan); } return; } } void bnx2x_init_vlan_mac_obj(struct bnx2x *bp , struct bnx2x_vlan_mac_obj *vlan_mac_obj , u8 cl_id , u32 cid , u8 func_id , void *rdata , dma_addr_t rdata_mapping , int state , unsigned long *pstate , bnx2x_obj_type type , struct bnx2x_credit_pool_obj *macs_pool , struct bnx2x_credit_pool_obj *vlans_pool ) { union bnx2x_qable_obj *qable_obj ; { qable_obj = (union bnx2x_qable_obj *)vlan_mac_obj; bnx2x_init_vlan_mac_common(vlan_mac_obj, (int )cl_id, cid, (int )func_id, rdata, rdata_mapping, state, pstate, type, macs_pool, vlans_pool); vlan_mac_obj->get_credit = & bnx2x_get_credit_vlan_mac; vlan_mac_obj->put_credit = & bnx2x_put_credit_vlan_mac; vlan_mac_obj->get_cam_offset = & bnx2x_get_cam_offset_mac; vlan_mac_obj->put_cam_offset = & bnx2x_put_cam_offset_mac; if (bp->common.chip_id >> 16 == 5710U) { printk("\vbnx2x: [%s:%d(%s)]Do not support chips others than E2\n", "bnx2x_init_vlan_mac_obj", 2131, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); __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 *)"/work/ldvuser/exper_fp/work/current--X--drivers--X--defaultlinux-3.10-rc1.tar--X--32_7a--X--cpachecker/linux-3.10-rc1.tar/csd_deg_dscv/8504/dscv_tempdir/dscv/ri/32_7a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sp.c.prepared"), "i" (2132), "i" (12UL)); ldv_46590: ; goto ldv_46590; } else if (bp->common.chip_id >> 16 == 5711U || bp->common.chip_id >> 16 == 5712U) { vlan_mac_obj->set_one_rule = & bnx2x_set_one_vlan_mac_e1h; vlan_mac_obj->check_del = & bnx2x_check_vlan_mac_del; vlan_mac_obj->check_add = & bnx2x_check_vlan_mac_add; vlan_mac_obj->check_move = & bnx2x_check_move_always_err; vlan_mac_obj->ramrod_cmd = 13; bnx2x_exe_queue_init(bp, & vlan_mac_obj->exe_queue, 1, qable_obj, & bnx2x_validate_vlan_mac, & bnx2x_remove_vlan_mac, & bnx2x_optimize_vlan_mac, & bnx2x_execute_vlan_mac, & bnx2x_exeq_get_vlan_mac); } else { vlan_mac_obj->set_one_rule = & bnx2x_set_one_vlan_mac_e2; vlan_mac_obj->check_del = & bnx2x_check_vlan_mac_del; vlan_mac_obj->check_add = & bnx2x_check_vlan_mac_add; vlan_mac_obj->check_move = & bnx2x_check_move; vlan_mac_obj->ramrod_cmd = 9; bnx2x_exe_queue_init(bp, & vlan_mac_obj->exe_queue, 16, qable_obj, & bnx2x_validate_vlan_mac, & bnx2x_remove_vlan_mac, & bnx2x_optimize_vlan_mac, & bnx2x_execute_vlan_mac, & bnx2x_exeq_get_vlan_mac); } return; } } __inline static void __storm_memset_mac_filters(struct bnx2x *bp , struct tstorm_eth_mac_filter_config *mac_filters , u16 pf_id ) { size_t size ; u32 addr ; { size = 32UL; addr = ((unsigned int )(bp->iro_arr + 202UL)->base + (unsigned int )((int )pf_id * (int )(bp->iro_arr + 202UL)->m1)) + 4390912U; __storm_memset_struct___0(bp, addr, size, (u32 *)mac_filters); return; } } static int bnx2x_set_rx_mode_e1x(struct bnx2x *bp , struct bnx2x_rx_mode_ramrod_params *p ) { u32 mask ; struct tstorm_eth_mac_filter_config *mac_filters ; u8 drop_all_ucast ; u8 drop_all_mcast ; u8 accp_all_ucast ; u8 accp_all_bcast ; u8 accp_all_mcast ; u8 unmatched_unicast ; int tmp ; int tmp___0 ; int tmp___1 ; int tmp___2 ; int tmp___3 ; int tmp___4 ; long tmp___5 ; { mask = (u32 )(1 << (int )p->cl_id); mac_filters = (struct tstorm_eth_mac_filter_config *)p->rdata; drop_all_ucast = 1U; drop_all_mcast = 1U; accp_all_ucast = 0U; accp_all_bcast = 0U; accp_all_mcast = 0U; unmatched_unicast = 0U; tmp = constant_test_bit(0U, (unsigned long const volatile *)(& p->rx_accept_flags)); if (tmp != 0) { drop_all_ucast = 0U; } else { } tmp___0 = constant_test_bit(1U, (unsigned long const volatile *)(& p->rx_accept_flags)); if (tmp___0 != 0) { drop_all_mcast = 0U; } else { } tmp___1 = constant_test_bit(2U, (unsigned long const volatile *)(& p->rx_accept_flags)); if (tmp___1 != 0) { drop_all_ucast = 0U; accp_all_ucast = 1U; } else { } tmp___2 = constant_test_bit(3U, (unsigned long const volatile *)(& p->rx_accept_flags)); if (tmp___2 != 0) { drop_all_mcast = 0U; accp_all_mcast = 1U; } else { } tmp___3 = constant_test_bit(4U, (unsigned long const volatile *)(& p->rx_accept_flags)); if (tmp___3 != 0) { accp_all_bcast = 1U; } else { } tmp___4 = constant_test_bit(5U, (unsigned long const volatile *)(& p->rx_accept_flags)); if (tmp___4 != 0) { unmatched_unicast = 1U; } else { } mac_filters->ucast_drop_all = (unsigned int )drop_all_ucast != 0U ? mac_filters->ucast_drop_all | mask : mac_filters->ucast_drop_all & ~ mask; mac_filters->mcast_drop_all = (unsigned int )drop_all_mcast != 0U ? mac_filters->mcast_drop_all | mask : mac_filters->mcast_drop_all & ~ mask; mac_filters->ucast_accept_all = (unsigned int )accp_all_ucast != 0U ? mac_filters->ucast_accept_all | mask : mac_filters->ucast_accept_all & ~ mask; mac_filters->mcast_accept_all = (unsigned int )accp_all_mcast != 0U ? mac_filters->mcast_accept_all | mask : mac_filters->mcast_accept_all & ~ mask; mac_filters->bcast_accept_all = (unsigned int )accp_all_bcast != 0U ? mac_filters->bcast_accept_all | mask : mac_filters->bcast_accept_all & ~ mask; mac_filters->unmatched_unicast = (unsigned int )unmatched_unicast != 0U ? mac_filters->unmatched_unicast | mask : mac_filters->unmatched_unicast & ~ mask; tmp___5 = ldv__builtin_expect((bp->msg_enable & 1048576) != 0, 0L); if (tmp___5 != 0L) { printk("\rbnx2x: [%s:%d(%s)]drop_ucast 0x%x\ndrop_mcast 0x%x\n accp_ucast 0x%x\naccp_mcast 0x%x\naccp_bcast 0x%x\n", "bnx2x_set_rx_mode_e1x", 2251, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", mac_filters->ucast_drop_all, mac_filters->mcast_drop_all, mac_filters->ucast_accept_all, mac_filters->mcast_accept_all, mac_filters->bcast_accept_all); } else { } __storm_memset_mac_filters(bp, mac_filters, (int )p->func_id); clear_bit(p->state, (unsigned long volatile *)p->pstate); __asm__ volatile ("": : : "memory"); return (0); } } __inline static void bnx2x_rx_mode_set_rdata_hdr_e2(u32 cid , struct eth_classify_header *hdr , u8 rule_cnt ) { { hdr->echo = cid; hdr->rule_cnt = rule_cnt; return; } } __inline static void bnx2x_rx_mode_set_cmd_state_e2(struct bnx2x *bp , unsigned long *accept_flags , struct eth_filter_rules_cmd *cmd , bool clear_accept_all ) { u16 state ; int tmp ; int tmp___0 ; int tmp___1 ; int tmp___2 ; int tmp___3 ; int tmp___4 ; int tmp___5 ; { state = 9U; tmp = constant_test_bit(0U, (unsigned long const volatile *)accept_flags); if (tmp != 0) { state = (unsigned int )state & 65534U; } else { } tmp___0 = constant_test_bit(1U, (unsigned long const volatile *)accept_flags); if (tmp___0 != 0) { state = (unsigned int )state & 65527U; } else { } tmp___1 = constant_test_bit(2U, (unsigned long const volatile *)accept_flags); if (tmp___1 != 0) { state = (unsigned int )state & 65534U; state = (u16 )((unsigned int )state | 2U); } else { } tmp___2 = constant_test_bit(3U, (unsigned long const volatile *)accept_flags); if (tmp___2 != 0) { state = (u16 )((unsigned int )state | 16U); state = (unsigned int )state & 65527U; } else { } tmp___3 = constant_test_bit(4U, (unsigned long const volatile *)accept_flags); if (tmp___3 != 0) { state = (u16 )((unsigned int )state | 32U); } else { } tmp___4 = constant_test_bit(5U, (unsigned long const volatile *)accept_flags); if (tmp___4 != 0) { state = (unsigned int )state & 65534U; state = (u16 )((unsigned int )state | 4U); } else { } tmp___5 = constant_test_bit(6U, (unsigned long const volatile *)accept_flags); if (tmp___5 != 0) { state = (u16 )((unsigned int )state | 64U); } else { } if ((int )clear_accept_all) { state = (unsigned int )state & 65519U; state = (unsigned int )state & 65503U; state = (unsigned int )state & 65533U; state = (unsigned int )state & 65531U; } else { } cmd->state = state; return; } } static int bnx2x_set_rx_mode_e2(struct bnx2x *bp , struct bnx2x_rx_mode_ramrod_params *p ) { struct eth_filter_rules_ramrod_data *data ; int rc ; u8 rule_idx ; u8 tmp ; int tmp___0 ; u8 tmp___1 ; int tmp___2 ; int tmp___3 ; int tmp___4 ; int tmp___5 ; long tmp___6 ; { data = (struct eth_filter_rules_ramrod_data *)p->rdata; rule_idx = 0U; memset((void *)data, 0, 264UL); tmp___0 = constant_test_bit(0U, (unsigned long const volatile *)(& p->ramrod_flags)); if (tmp___0 != 0) { data->rules[(int )rule_idx].client_id = p->cl_id; data->rules[(int )rule_idx].func_id = p->func_id; data->rules[(int )rule_idx].cmd_general_data = 2U; tmp = rule_idx; rule_idx = (u8 )((int )rule_idx + 1); bnx2x_rx_mode_set_cmd_state_e2(bp, & p->tx_accept_flags, (struct eth_filter_rules_cmd *)(& data->rules) + (unsigned long )tmp, 0); } else { } tmp___2 = constant_test_bit(1U, (unsigned long const volatile *)(& p->ramrod_flags)); if (tmp___2 != 0) { data->rules[(int )rule_idx].client_id = p->cl_id; data->rules[(int )rule_idx].func_id = p->func_id; data->rules[(int )rule_idx].cmd_general_data = 1U; tmp___1 = rule_idx; rule_idx = (u8 )((int )rule_idx + 1); bnx2x_rx_mode_set_cmd_state_e2(bp, & p->rx_accept_flags, (struct eth_filter_rules_cmd *)(& data->rules) + (unsigned long )tmp___1, 0); } else { } tmp___5 = constant_test_bit(0U, (unsigned long const volatile *)(& p->rx_mode_flags)); if (tmp___5 != 0) { tmp___3 = constant_test_bit(0U, (unsigned long const volatile *)(& p->ramrod_flags)); if (tmp___3 != 0) { data->rules[(int )rule_idx].client_id = (bp->fp + (unsigned long )((uint )bp->num_queues - bp->num_cnic_queues))->cl_id; data->rules[(int )rule_idx].func_id = p->func_id; data->rules[(int )rule_idx].cmd_general_data = 2U; bnx2x_rx_mode_set_cmd_state_e2(bp, & p->tx_accept_flags, (struct eth_filter_rules_cmd *)(& data->rules) + (unsigned long )rule_idx, 1); rule_idx = (u8 )((int )rule_idx + 1); } else { } tmp___4 = constant_test_bit(1U, (unsigned long const volatile *)(& p->ramrod_flags)); if (tmp___4 != 0) { data->rules[(int )rule_idx].client_id = (bp->fp + (unsigned long )((uint )bp->num_queues - bp->num_cnic_queues))->cl_id; data->rules[(int )rule_idx].func_id = p->func_id; data->rules[(int )rule_idx].cmd_general_data = 1U; bnx2x_rx_mode_set_cmd_state_e2(bp, & p->rx_accept_flags, (struct eth_filter_rules_cmd *)(& data->rules) + (unsigned long )rule_idx, 1); rule_idx = (u8 )((int )rule_idx + 1); } else { } } else { } bnx2x_rx_mode_set_rdata_hdr_e2(p->cid, & data->header, (int )rule_idx); tmp___6 = ldv__builtin_expect((bp->msg_enable & 1048576) != 0, 0L); if (tmp___6 != 0L) { printk("\rbnx2x: [%s:%d(%s)]About to configure %d rules, rx_accept_flags 0x%lx, tx_accept_flags 0x%lx\n", "bnx2x_set_rx_mode_e2", 2406, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )data->header.rule_cnt, p->rx_accept_flags, p->tx_accept_flags); } else { } rc = bnx2x_sp_post(bp, 10, (int )p->cid, (unsigned int )(p->rdata_mapping >> 32), (unsigned int )p->rdata_mapping, 0); if (rc != 0) { return (rc); } else { } return (1); } } static int bnx2x_wait_rx_mode_comp_e2(struct bnx2x *bp , struct bnx2x_rx_mode_ramrod_params *p ) { int tmp ; { tmp = bnx2x_state_wait(bp, p->state, p->pstate); return (tmp); } } static int bnx2x_empty_rx_mode_wait(struct bnx2x *bp , struct bnx2x_rx_mode_ramrod_params *p ) { { return (0); } } int bnx2x_config_rx_mode(struct bnx2x *bp , struct bnx2x_rx_mode_ramrod_params *p ) { int rc ; int tmp ; { rc = (*((p->rx_mode_obj)->config_rx_mode))(bp, p); if (rc < 0) { return (rc); } else { } tmp = constant_test_bit(2U, (unsigned long const volatile *)(& p->ramrod_flags)); if (tmp != 0) { rc = (*((p->rx_mode_obj)->wait_comp))(bp, p); if (rc != 0) { return (rc); } else { } } else { } return (rc); } } void bnx2x_init_rx_mode_obj(struct bnx2x *bp , struct bnx2x_rx_mode_obj *o ) { { if (bp->common.chip_id >> 16 == 5710U || (bp->common.chip_id >> 16 == 5711U || bp->common.chip_id >> 16 == 5712U)) { o->wait_comp = & bnx2x_empty_rx_mode_wait; o->config_rx_mode = & bnx2x_set_rx_mode_e1x; } else { o->wait_comp = & bnx2x_wait_rx_mode_comp_e2; o->config_rx_mode = & bnx2x_set_rx_mode_e2; } return; } } __inline static u8 bnx2x_mcast_bin_from_mac(u8 *mac ) { u32 tmp ; { tmp = crc32c(0U, (void const *)mac, 6U); return ((u8 )(tmp >> 24)); } } static int bnx2x_mcast_wait(struct bnx2x *bp , struct bnx2x_mcast_obj *o ) { int tmp ; int tmp___0 ; { tmp = bnx2x_state_wait(bp, o->sched_state, o->raw.pstate); if (tmp != 0) { return (-16); } else { tmp___0 = (*(o->raw.wait_comp))(bp, & o->raw); if (tmp___0 != 0) { return (-16); } else { } } return (0); } } static int bnx2x_mcast_enqueue_cmd(struct bnx2x *bp , struct bnx2x_mcast_obj *o , struct bnx2x_mcast_ramrod_params *p , enum bnx2x_mcast_cmd cmd ) { int total_sz ; struct bnx2x_pending_mcast_cmd *new_cmd ; struct bnx2x_mcast_mac_elem *cur_mac ; struct bnx2x_mcast_list_elem *pos ; int macs_list_len ; void *tmp ; long tmp___0 ; struct list_head const *__mptr ; size_t __len ; void *__ret ; struct list_head const *__mptr___0 ; { cur_mac = 0; macs_list_len = (unsigned int )cmd == 0U ? p->mcast_list_len : 0; if (p->mcast_list_len == 0) { return (0); } else { } total_sz = (int )((unsigned int )((unsigned long )macs_list_len) * 24U + 48U); tmp = kzalloc((size_t )total_sz, 32U); new_cmd = (struct bnx2x_pending_mcast_cmd *)tmp; if ((unsigned long )new_cmd == (unsigned long )((struct bnx2x_pending_mcast_cmd *)0)) { return (-12); } else { } tmp___0 = ldv__builtin_expect((bp->msg_enable & 1048576) != 0, 0L); if (tmp___0 != 0L) { printk("\rbnx2x: [%s:%d(%s)]About to enqueue a new %d command. macs_list_len=%d\n", "bnx2x_mcast_enqueue_cmd", 2538, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (unsigned int )cmd, macs_list_len); } else { } INIT_LIST_HEAD(& new_cmd->data.macs_head); new_cmd->type = (int )cmd; new_cmd->done = 0; switch ((unsigned int )cmd) { case 0U: cur_mac = (struct bnx2x_mcast_mac_elem *)new_cmd + 48U; __mptr = (struct list_head const *)p->mcast_list.next; pos = (struct bnx2x_mcast_list_elem *)__mptr; goto ldv_46689; ldv_46688: __len = 6UL; if (__len > 63UL) { __ret = __memcpy((void *)(& cur_mac->mac), (void const *)pos->mac, __len); } else { __ret = __builtin_memcpy((void *)(& cur_mac->mac), (void const *)pos->mac, __len); } list_add_tail(& cur_mac->link, & new_cmd->data.macs_head); cur_mac = cur_mac + 1; __mptr___0 = (struct list_head const *)pos->link.next; pos = (struct bnx2x_mcast_list_elem *)__mptr___0; ldv_46689: ; if ((unsigned long )(& pos->link) != (unsigned long )(& p->mcast_list)) { goto ldv_46688; } else { } goto ldv_46691; case 2U: new_cmd->data.macs_num = (u32 )p->mcast_list_len; goto ldv_46691; case 3U: new_cmd->data.next_bin = 0; goto ldv_46691; default: kfree((void const *)new_cmd); printk("\vbnx2x: [%s:%d(%s)]Unknown command: %d\n", "bnx2x_mcast_enqueue_cmd", 2571, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (unsigned int )cmd); return (-22); } ldv_46691: list_add_tail(& new_cmd->link, & o->pending_cmds_head); (*(o->set_sched))(o); return (1); } } __inline static int bnx2x_mcast_get_next_bin(struct bnx2x_mcast_obj *o , int last ) { int i ; int j ; int inner_start ; int cur_bit ; { inner_start = last % 64; i = last / 64; goto ldv_46707; ldv_46706: ; if (o->registry.aprox_match.vec[i] != 0ULL) { j = inner_start; goto ldv_46704; ldv_46703: cur_bit = i * 64 + j; if ((int )(o->registry.aprox_match.vec[cur_bit >> 6] >> (cur_bit & 63)) & 1) { return (cur_bit); } else { } j = j + 1; ldv_46704: ; if (j <= 63) { goto ldv_46703; } else { } } else { } inner_start = 0; i = i + 1; ldv_46707: ; if (i <= 3) { goto ldv_46706; } else { } return (-1); } } __inline static int bnx2x_mcast_clear_first_bin(struct bnx2x_mcast_obj *o ) { int cur_bit ; int tmp ; { tmp = bnx2x_mcast_get_next_bin(o, 0); cur_bit = tmp; if (cur_bit >= 0) { o->registry.aprox_match.vec[cur_bit >> 6] = o->registry.aprox_match.vec[cur_bit >> 6] & ~ (1ULL << (cur_bit & 63)); } else { } return (cur_bit); } } __inline static u8 bnx2x_mcast_get_rx_tx_flag(struct bnx2x_mcast_obj *o ) { struct bnx2x_raw_obj *raw ; u8 rx_tx_flag ; { raw = & o->raw; rx_tx_flag = 0U; if ((unsigned int )raw->obj_type == 1U || (unsigned int )raw->obj_type == 2U) { rx_tx_flag = (u8 )((unsigned int )rx_tx_flag | 2U); } else { } if ((unsigned int )raw->obj_type == 0U || (unsigned int )raw->obj_type == 2U) { rx_tx_flag = (u8 )((unsigned int )rx_tx_flag | 1U); } else { } return (rx_tx_flag); } } static void bnx2x_mcast_set_one_rule_e2(struct bnx2x *bp , struct bnx2x_mcast_obj *o , int idx , union bnx2x_mcast_config_data *cfg_data , enum bnx2x_mcast_cmd cmd ) { struct bnx2x_raw_obj *r ; struct eth_multicast_rules_ramrod_data *data ; u8 func_id ; u8 rx_tx_add_flag ; u8 tmp ; int bin ; u8 tmp___0 ; long tmp___1 ; { r = & o->raw; data = (struct eth_multicast_rules_ramrod_data *)r->rdata; func_id = r->func_id; tmp = bnx2x_mcast_get_rx_tx_flag(o); rx_tx_add_flag = tmp; if ((unsigned int )cmd == 0U || (unsigned int )cmd == 3U) { rx_tx_add_flag = (u8 )((unsigned int )rx_tx_add_flag | 4U); } else { } data->rules[idx].cmd_general_data = (u8 )((int )data->rules[idx].cmd_general_data | (int )rx_tx_add_flag); switch ((unsigned int )cmd) { case 0U: tmp___0 = bnx2x_mcast_bin_from_mac(cfg_data->mac); bin = (int )tmp___0; o->registry.aprox_match.vec[bin >> 6] = o->registry.aprox_match.vec[bin >> 6] | (1ULL << (bin & 63)); goto ldv_46731; case 2U: bin = bnx2x_mcast_clear_first_bin(o); goto ldv_46731; case 3U: bin = (int )cfg_data->bin; goto ldv_46731; default: printk("\vbnx2x: [%s:%d(%s)]Unknown command: %d\n", "bnx2x_mcast_set_one_rule_e2", 2683, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (unsigned int )cmd); return; } ldv_46731: tmp___1 = ldv__builtin_expect((bp->msg_enable & 1048576) != 0, 0L); if (tmp___1 != 0L) { printk("\rbnx2x: [%s:%d(%s)]%s bin %d\n", "bnx2x_mcast_set_one_rule_e2", 2689, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", ((int )rx_tx_add_flag & 4) != 0 ? (char *)"Setting" : (char *)"Clearing", bin); } else { } data->rules[idx].bin_id = (unsigned char )bin; data->rules[idx].func_id = func_id; data->rules[idx].engine_id = o->engine_id; return; } } __inline static int bnx2x_mcast_handle_restore_cmd_e2(struct bnx2x *bp , struct bnx2x_mcast_obj *o , int start_bin , int *rdata_idx ) { int cur_bin ; int cnt ; union bnx2x_mcast_config_data cfg_data ; long tmp ; { cnt = *rdata_idx; cfg_data.mac = 0; cur_bin = bnx2x_mcast_get_next_bin(o, start_bin); goto ldv_46748; ldv_46747: cfg_data.bin = (unsigned char )cur_bin; (*(o->set_one_rule))(bp, o, cnt, & cfg_data, 3); cnt = cnt + 1; tmp = ldv__builtin_expect((bp->msg_enable & 1048576) != 0, 0L); if (tmp != 0L) { printk("\rbnx2x: [%s:%d(%s)]About to configure a bin %d\n", "bnx2x_mcast_handle_restore_cmd_e2", 2723, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", cur_bin); } else { } if (o->max_cmd_len <= cnt) { goto ldv_46746; } else { } cur_bin = bnx2x_mcast_get_next_bin(o, cur_bin + 1); ldv_46748: ; if (cur_bin >= 0) { goto ldv_46747; } else { } ldv_46746: *rdata_idx = cnt; return (cur_bin); } } __inline static void bnx2x_mcast_hdl_pending_add_e2(struct bnx2x *bp , struct bnx2x_mcast_obj *o , struct bnx2x_pending_mcast_cmd *cmd_pos , int *line_idx ) { struct bnx2x_mcast_mac_elem *pmac_pos ; struct bnx2x_mcast_mac_elem *pmac_pos_n ; int cnt ; union bnx2x_mcast_config_data cfg_data ; struct list_head const *__mptr ; struct list_head const *__mptr___0 ; long tmp ; struct list_head const *__mptr___1 ; int tmp___0 ; { cnt = *line_idx; cfg_data.mac = 0; __mptr = (struct list_head const *)cmd_pos->data.macs_head.next; pmac_pos = (struct bnx2x_mcast_mac_elem *)__mptr; __mptr___0 = (struct list_head const *)pmac_pos->link.next; pmac_pos_n = (struct bnx2x_mcast_mac_elem *)__mptr___0; goto ldv_46768; ldv_46767: cfg_data.mac = (u8 *)(& pmac_pos->mac); (*(o->set_one_rule))(bp, o, cnt, & cfg_data, (enum bnx2x_mcast_cmd )cmd_pos->type); cnt = cnt + 1; tmp = ldv__builtin_expect((bp->msg_enable & 1048576) != 0, 0L); if (tmp != 0L) { printk("\rbnx2x: [%s:%d(%s)]About to configure %pM mcast MAC\n", "bnx2x_mcast_hdl_pending_add_e2", 2754, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (u8 *)(& pmac_pos->mac)); } else { } list_del(& pmac_pos->link); if (o->max_cmd_len <= cnt) { goto ldv_46766; } else { } pmac_pos = pmac_pos_n; __mptr___1 = (struct list_head const *)pmac_pos_n->link.next; pmac_pos_n = (struct bnx2x_mcast_mac_elem *)__mptr___1; ldv_46768: ; if ((unsigned long )(& pmac_pos->link) != (unsigned long )(& cmd_pos->data.macs_head)) { goto ldv_46767; } else { } ldv_46766: *line_idx = cnt; tmp___0 = list_empty((struct list_head const *)(& cmd_pos->data.macs_head)); if (tmp___0 != 0) { cmd_pos->done = 1; } else { } return; } } __inline static void bnx2x_mcast_hdl_pending_del_e2(struct bnx2x *bp , struct bnx2x_mcast_obj *o , struct bnx2x_pending_mcast_cmd *cmd_pos , int *line_idx ) { int cnt ; long tmp ; { cnt = *line_idx; goto ldv_46779; ldv_46778: (*(o->set_one_rule))(bp, o, cnt, 0, (enum bnx2x_mcast_cmd )cmd_pos->type); cnt = cnt + 1; cmd_pos->data.macs_num = cmd_pos->data.macs_num - 1U; tmp = ldv__builtin_expect((bp->msg_enable & 1048576) != 0, 0L); if (tmp != 0L) { printk("\rbnx2x: [%s:%d(%s)]Deleting MAC. %d left,cnt is %d\n", "bnx2x_mcast_hdl_pending_del_e2", 2786, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", cmd_pos->data.macs_num, cnt); } else { } if (o->max_cmd_len <= cnt) { goto ldv_46777; } else { } ldv_46779: ; if (cmd_pos->data.macs_num != 0U) { goto ldv_46778; } else { } ldv_46777: *line_idx = cnt; if (cmd_pos->data.macs_num == 0U) { cmd_pos->done = 1; } else { } return; } } __inline static void bnx2x_mcast_hdl_pending_restore_e2(struct bnx2x *bp , struct bnx2x_mcast_obj *o , struct bnx2x_pending_mcast_cmd *cmd_pos , int *line_idx ) { { cmd_pos->data.next_bin = (*(o->hdl_restore))(bp, o, cmd_pos->data.next_bin, line_idx); if (cmd_pos->data.next_bin < 0) { cmd_pos->done = 1; } else { cmd_pos->data.next_bin = cmd_pos->data.next_bin + 1; } return; } } __inline static int bnx2x_mcast_handle_pending_cmds_e2(struct bnx2x *bp , struct bnx2x_mcast_ramrod_params *p ) { struct bnx2x_pending_mcast_cmd *cmd_pos ; struct bnx2x_pending_mcast_cmd *cmd_pos_n ; int cnt ; struct bnx2x_mcast_obj *o ; struct list_head const *__mptr ; struct list_head const *__mptr___0 ; struct list_head const *__mptr___1 ; { cnt = 0; o = p->mcast_obj; __mptr = (struct list_head const *)o->pending_cmds_head.next; cmd_pos = (struct bnx2x_pending_mcast_cmd *)__mptr; __mptr___0 = (struct list_head const *)cmd_pos->link.next; cmd_pos_n = (struct bnx2x_pending_mcast_cmd *)__mptr___0; goto ldv_46808; ldv_46807: ; switch (cmd_pos->type) { case 0: bnx2x_mcast_hdl_pending_add_e2(bp, o, cmd_pos, & cnt); goto ldv_46801; case 2: bnx2x_mcast_hdl_pending_del_e2(bp, o, cmd_pos, & cnt); goto ldv_46801; case 3: bnx2x_mcast_hdl_pending_restore_e2(bp, o, cmd_pos, & cnt); goto ldv_46801; default: printk("\vbnx2x: [%s:%d(%s)]Unknown command: %d\n", "bnx2x_mcast_handle_pending_cmds_e2", 2841, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", cmd_pos->type); return (-22); } ldv_46801: ; if ((int )cmd_pos->done) { list_del(& cmd_pos->link); kfree((void const *)cmd_pos); } else { } if (o->max_cmd_len <= cnt) { goto ldv_46806; } else { } cmd_pos = cmd_pos_n; __mptr___1 = (struct list_head const *)cmd_pos_n->link.next; cmd_pos_n = (struct bnx2x_pending_mcast_cmd *)__mptr___1; ldv_46808: ; if ((unsigned long )(& cmd_pos->link) != (unsigned long )(& o->pending_cmds_head)) { goto ldv_46807; } else { } ldv_46806: ; return (cnt); } } __inline static void bnx2x_mcast_hdl_add(struct bnx2x *bp , struct bnx2x_mcast_obj *o , struct bnx2x_mcast_ramrod_params *p , int *line_idx ) { struct bnx2x_mcast_list_elem *mlist_pos ; union bnx2x_mcast_config_data cfg_data ; int cnt ; struct list_head const *__mptr ; long tmp ; struct list_head const *__mptr___0 ; { cfg_data.mac = 0; cnt = *line_idx; __mptr = (struct list_head const *)p->mcast_list.next; mlist_pos = (struct bnx2x_mcast_list_elem *)__mptr; goto ldv_46824; ldv_46823: cfg_data.mac = mlist_pos->mac; (*(o->set_one_rule))(bp, o, cnt, & cfg_data, 0); cnt = cnt + 1; tmp = ldv__builtin_expect((bp->msg_enable & 1048576) != 0, 0L); if (tmp != 0L) { printk("\rbnx2x: [%s:%d(%s)]About to configure %pM mcast MAC\n", "bnx2x_mcast_hdl_add", 2876, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", mlist_pos->mac); } else { } __mptr___0 = (struct list_head const *)mlist_pos->link.next; mlist_pos = (struct bnx2x_mcast_list_elem *)__mptr___0; ldv_46824: ; if ((unsigned long )(& mlist_pos->link) != (unsigned long )(& p->mcast_list)) { goto ldv_46823; } else { } *line_idx = cnt; return; } } __inline static void bnx2x_mcast_hdl_del(struct bnx2x *bp , struct bnx2x_mcast_obj *o , struct bnx2x_mcast_ramrod_params *p , int *line_idx ) { int cnt ; int i ; long tmp ; { cnt = *line_idx; i = 0; goto ldv_46836; ldv_46835: (*(o->set_one_rule))(bp, o, cnt, 0, 2); cnt = cnt + 1; tmp = ldv__builtin_expect((bp->msg_enable & 1048576) != 0, 0L); if (tmp != 0L) { printk("\rbnx2x: [%s:%d(%s)]Deleting MAC. %d left\n", "bnx2x_mcast_hdl_del", 2894, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (p->mcast_list_len - i) + -1); } else { } i = i + 1; ldv_46836: ; if (p->mcast_list_len > i) { goto ldv_46835; } else { } *line_idx = cnt; return; } } __inline static int bnx2x_mcast_handle_current_cmd(struct bnx2x *bp , struct bnx2x_mcast_ramrod_params *p , enum bnx2x_mcast_cmd cmd , int start_cnt ) { struct bnx2x_mcast_obj *o ; int cnt ; long tmp ; { o = p->mcast_obj; cnt = start_cnt; tmp = ldv__builtin_expect((bp->msg_enable & 1048576) != 0, 0L); if (tmp != 0L) { printk("\rbnx2x: [%s:%d(%s)]p->mcast_list_len=%d\n", "bnx2x_mcast_handle_current_cmd", 2920, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", p->mcast_list_len); } else { } switch ((unsigned int )cmd) { case 0U: bnx2x_mcast_hdl_add(bp, o, p, & cnt); goto ldv_46848; case 2U: bnx2x_mcast_hdl_del(bp, o, p, & cnt); goto ldv_46848; case 3U: (*(o->hdl_restore))(bp, o, 0, & cnt); goto ldv_46848; default: printk("\vbnx2x: [%s:%d(%s)]Unknown command: %d\n", "bnx2x_mcast_handle_current_cmd", 2936, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (unsigned int )cmd); return (-22); } ldv_46848: p->mcast_list_len = 0; return (cnt); } } static int bnx2x_mcast_validate_e2(struct bnx2x *bp , struct bnx2x_mcast_ramrod_params *p , enum bnx2x_mcast_cmd cmd ) { struct bnx2x_mcast_obj *o ; int reg_sz ; int tmp ; { o = p->mcast_obj; tmp = (*(o->get_registry_size))(o); reg_sz = tmp; switch ((unsigned int )cmd) { case 2U: (*(o->set_registry_size))(o, 0); case 3U: p->mcast_list_len = reg_sz; goto ldv_46861; case 0U: ; case 1U: (*(o->set_registry_size))(o, p->mcast_list_len + reg_sz); goto ldv_46861; default: printk("\vbnx2x: [%s:%d(%s)]Unknown command: %d\n", "bnx2x_mcast_validate_e2", 2981, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (unsigned int )cmd); return (-22); } ldv_46861: o->total_pending_num = o->total_pending_num + p->mcast_list_len; return (0); } } static void bnx2x_mcast_revert_e2(struct bnx2x *bp , struct bnx2x_mcast_ramrod_params *p , int old_num_bins ) { struct bnx2x_mcast_obj *o ; { o = p->mcast_obj; (*(o->set_registry_size))(o, old_num_bins); o->total_pending_num = o->total_pending_num - p->mcast_list_len; return; } } __inline static void bnx2x_mcast_set_rdata_hdr_e2(struct bnx2x *bp , struct bnx2x_mcast_ramrod_params *p , u8 len ) { struct bnx2x_raw_obj *r ; struct eth_multicast_rules_ramrod_data *data ; { r = & (p->mcast_obj)->raw; data = (struct eth_multicast_rules_ramrod_data *)r->rdata; data->header.echo = (r->cid & 131071U) | 1179648U; data->header.rule_cnt = len; return; } } __inline static int bnx2x_mcast_refresh_registry_e2(struct bnx2x *bp , struct bnx2x_mcast_obj *o ) { int i ; int cnt ; u64 elem ; { cnt = 0; i = 0; goto ldv_46890; ldv_46889: elem = o->registry.aprox_match.vec[i]; goto ldv_46887; ldv_46886: elem = (elem - 1ULL) & elem; cnt = cnt + 1; ldv_46887: ; if (elem != 0ULL) { goto ldv_46886; } else { } i = i + 1; ldv_46890: ; if (i <= 3) { goto ldv_46889; } else { } (*(o->set_registry_size))(o, cnt); return (0); } } static int bnx2x_mcast_setup_e2(struct bnx2x *bp , struct bnx2x_mcast_ramrod_params *p , enum bnx2x_mcast_cmd cmd ) { struct bnx2x_raw_obj *raw ; struct bnx2x_mcast_obj *o ; struct eth_multicast_rules_ramrod_data *data ; int cnt ; int rc ; int tmp ; int __ret_warn_on ; long tmp___0 ; int __ret_warn_on___0 ; long tmp___1 ; int tmp___2 ; { raw = & (p->mcast_obj)->raw; o = p->mcast_obj; data = (struct eth_multicast_rules_ramrod_data *)raw->rdata; cnt = 0; memset((void *)data, 0, 264UL); cnt = bnx2x_mcast_handle_pending_cmds_e2(bp, p); tmp = list_empty((struct list_head const *)(& o->pending_cmds_head)); if (tmp != 0) { (*(o->clear_sched))(o); } else { } if (p->mcast_list_len > 0) { cnt = bnx2x_mcast_handle_current_cmd(bp, p, cmd, cnt); } else { } o->total_pending_num = o->total_pending_num - cnt; __ret_warn_on = o->total_pending_num < 0; tmp___0 = ldv__builtin_expect(__ret_warn_on != 0, 0L); if (tmp___0 != 0L) { warn_slowpath_null("/work/ldvuser/exper_fp/work/current--X--drivers--X--defaultlinux-3.10-rc1.tar--X--32_7a--X--cpachecker/linux-3.10-rc1.tar/csd_deg_dscv/8504/dscv_tempdir/dscv/ri/32_7a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sp.c.prepared", 3085); } else { } ldv__builtin_expect(__ret_warn_on != 0, 0L); __ret_warn_on___0 = o->max_cmd_len < cnt; tmp___1 = ldv__builtin_expect(__ret_warn_on___0 != 0, 0L); if (tmp___1 != 0L) { warn_slowpath_null("/work/ldvuser/exper_fp/work/current--X--drivers--X--defaultlinux-3.10-rc1.tar--X--32_7a--X--cpachecker/linux-3.10-rc1.tar/csd_deg_dscv/8504/dscv_tempdir/dscv/ri/32_7a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sp.c.prepared", 3086); } else { } ldv__builtin_expect(__ret_warn_on___0 != 0, 0L); bnx2x_mcast_set_rdata_hdr_e2(bp, p, (int )((unsigned char )cnt)); if (o->total_pending_num == 0) { bnx2x_mcast_refresh_registry_e2(bp, o); } else { } tmp___2 = constant_test_bit(3U, (unsigned long const volatile *)(& p->ramrod_flags)); if (tmp___2 != 0) { (*(raw->clear_pending))(raw); return (0); } else { rc = bnx2x_sp_post(bp, 11, (int )raw->cid, (unsigned int )(raw->rdata_mapping >> 32), (unsigned int )raw->rdata_mapping, 0); if (rc != 0) { return (rc); } else { } return (1); } } } static int bnx2x_mcast_validate_e1h(struct bnx2x *bp , struct bnx2x_mcast_ramrod_params *p , enum bnx2x_mcast_cmd cmd ) { { if ((unsigned int )cmd == 2U || (unsigned int )cmd == 3U) { p->mcast_list_len = 1; } else { } return (0); } } static void bnx2x_mcast_revert_e1h(struct bnx2x *bp , struct bnx2x_mcast_ramrod_params *p , int old_num_bins ) { { return; } } __inline static void bnx2x_mcast_hdl_add_e1h(struct bnx2x *bp , struct bnx2x_mcast_obj *o , struct bnx2x_mcast_ramrod_params *p , u32 *mc_filter ) { struct bnx2x_mcast_list_elem *mlist_pos ; int bit ; struct list_head const *__mptr ; u8 tmp ; long tmp___0 ; struct list_head const *__mptr___0 ; { __mptr = (struct list_head const *)p->mcast_list.next; mlist_pos = (struct bnx2x_mcast_list_elem *)__mptr; goto ldv_46930; ldv_46929: tmp = bnx2x_mcast_bin_from_mac(mlist_pos->mac); bit = (int )tmp; *(mc_filter + (unsigned long )(bit >> 5)) = *(mc_filter + (unsigned long )(bit >> 5)) | (u32 )(1 << (bit & 31)); tmp___0 = ldv__builtin_expect((bp->msg_enable & 1048576) != 0, 0L); if (tmp___0 != 0L) { printk("\rbnx2x: [%s:%d(%s)]About to configure %pM mcast MAC, bin %d\n", "bnx2x_mcast_hdl_add_e1h", 3173, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", mlist_pos->mac, bit); } else { } o->registry.aprox_match.vec[bit >> 6] = o->registry.aprox_match.vec[bit >> 6] | (1ULL << (bit & 63)); __mptr___0 = (struct list_head const *)mlist_pos->link.next; mlist_pos = (struct bnx2x_mcast_list_elem *)__mptr___0; ldv_46930: ; if ((unsigned long )(& mlist_pos->link) != (unsigned long )(& p->mcast_list)) { goto ldv_46929; } else { } return; } } __inline static void bnx2x_mcast_hdl_restore_e1h(struct bnx2x *bp , struct bnx2x_mcast_obj *o , struct bnx2x_mcast_ramrod_params *p , u32 *mc_filter ) { int bit ; long tmp ; { bit = bnx2x_mcast_get_next_bin(o, 0); goto ldv_46941; ldv_46940: *(mc_filter + (unsigned long )(bit >> 5)) = *(mc_filter + (unsigned long )(bit >> 5)) | (u32 )(1 << (bit & 31)); tmp = ldv__builtin_expect((bp->msg_enable & 1048576) != 0, 0L); if (tmp != 0L) { printk("\rbnx2x: [%s:%d(%s)]About to set bin %d\n", "bnx2x_mcast_hdl_restore_e1h", 3191, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", bit); } else { } bit = bnx2x_mcast_get_next_bin(o, bit + 1); ldv_46941: ; if (bit >= 0) { goto ldv_46940; } else { } return; } } static int bnx2x_mcast_setup_e1h(struct bnx2x *bp , struct bnx2x_mcast_ramrod_params *p , enum bnx2x_mcast_cmd cmd ) { int i ; struct bnx2x_mcast_obj *o ; struct bnx2x_raw_obj *r ; u32 mc_filter[8U] ; unsigned int tmp ; long tmp___0 ; int tmp___1 ; { o = p->mcast_obj; r = & o->raw; tmp___1 = constant_test_bit(3U, (unsigned long const volatile *)(& p->ramrod_flags)); if (tmp___1 == 0) { mc_filter[0] = 0U; tmp = 1U; while (1) { if (tmp >= 8U) { break; } else { } mc_filter[tmp] = 0U; tmp = tmp + 1U; } switch ((unsigned int )cmd) { case 0U: bnx2x_mcast_hdl_add_e1h(bp, o, p, (u32 *)(& mc_filter)); goto ldv_46953; case 2U: tmp___0 = ldv__builtin_expect((bp->msg_enable & 1048576) != 0, 0L); if (tmp___0 != 0L) { printk("\rbnx2x: [%s:%d(%s)]Invalidating multicast MACs configuration\n", "bnx2x_mcast_setup_e1h", 3223, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } memset((void *)(& o->registry.aprox_match.vec), 0, 32UL); goto ldv_46953; case 3U: bnx2x_mcast_hdl_restore_e1h(bp, o, p, (u32 *)(& mc_filter)); goto ldv_46953; default: printk("\vbnx2x: [%s:%d(%s)]Unknown command: %d\n", "bnx2x_mcast_setup_e1h", 3235, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (unsigned int )cmd); return (-22); } ldv_46953: i = 0; goto ldv_46959; ldv_46958: writel(mc_filter[i], (void volatile *)bp->regview + (unsigned long )((((unsigned int )(bp->iro_arr + 203UL)->base + (unsigned int )((int )bp->pfid * (int )(bp->iro_arr + 203UL)->m1)) + (unsigned int )(i * 4)) + 4390912U)); i = i + 1; ldv_46959: ; if (i <= 7) { goto ldv_46958; } else { } } else { memset((void *)(& o->registry.aprox_match.vec), 0, 32UL); } (*(r->clear_pending))(r); return (0); } } static int bnx2x_mcast_validate_e1(struct bnx2x *bp , struct bnx2x_mcast_ramrod_params *p , enum bnx2x_mcast_cmd cmd ) { struct bnx2x_mcast_obj *o ; int reg_sz ; int tmp ; long tmp___0 ; long tmp___1 ; { o = p->mcast_obj; tmp = (*(o->get_registry_size))(o); reg_sz = tmp; switch ((unsigned int )cmd) { case 2U: (*(o->set_registry_size))(o, 0); case 3U: p->mcast_list_len = reg_sz; tmp___0 = ldv__builtin_expect((bp->msg_enable & 1048576) != 0, 0L); if (tmp___0 != 0L) { printk("\rbnx2x: [%s:%d(%s)]Command %d, p->mcast_list_len=%d\n", "bnx2x_mcast_validate_e1", 3270, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (unsigned int )cmd, p->mcast_list_len); } else { } goto ldv_46971; case 0U: ; case 1U: ; if (p->mcast_list_len > o->max_cmd_len) { printk("\vbnx2x: [%s:%d(%s)]Can\'t configure more than %d multicast MACs on 57710\n", "bnx2x_mcast_validate_e1", 3281, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", o->max_cmd_len); return (-22); } else { } tmp___1 = ldv__builtin_expect((bp->msg_enable & 1048576) != 0, 0L); if (tmp___1 != 0L) { printk("\rbnx2x: [%s:%d(%s)]p->mcast_list_len=%d\n", "bnx2x_mcast_validate_e1", 3288, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", p->mcast_list_len); } else { } if (p->mcast_list_len > 0) { (*(o->set_registry_size))(o, p->mcast_list_len); } else { } goto ldv_46971; default: printk("\vbnx2x: [%s:%d(%s)]Unknown command: %d\n", "bnx2x_mcast_validate_e1", 3295, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (unsigned int )cmd); return (-22); } ldv_46971: ; if (p->mcast_list_len != 0) { o->total_pending_num = o->total_pending_num + o->max_cmd_len; } else { } return (0); } } static void bnx2x_mcast_revert_e1(struct bnx2x *bp , struct bnx2x_mcast_ramrod_params *p , int old_num_macs ) { struct bnx2x_mcast_obj *o ; { o = p->mcast_obj; (*(o->set_registry_size))(o, old_num_macs); if (p->mcast_list_len != 0) { o->total_pending_num = o->total_pending_num - o->max_cmd_len; } else { } return; } } static void bnx2x_mcast_set_one_rule_e1(struct bnx2x *bp , struct bnx2x_mcast_obj *o , int idx , union bnx2x_mcast_config_data *cfg_data , enum bnx2x_mcast_cmd cmd ) { struct bnx2x_raw_obj *r ; struct mac_configuration_cmd *data ; { r = & o->raw; data = (struct mac_configuration_cmd *)r->rdata; if ((unsigned int )cmd == 0U || (unsigned int )cmd == 3U) { bnx2x_set_fw_mac_addr(& data->config_table[idx].msb_mac_addr, & data->config_table[idx].middle_mac_addr, & data->config_table[idx].lsb_mac_addr, cfg_data->mac); data->config_table[idx].vlan_id = 0U; data->config_table[idx].pf_id = r->func_id; data->config_table[idx].clients_bit_vector = (unsigned int )(1 << (int )r->cl_id); data->config_table[idx].flags = (unsigned int )data->config_table[idx].flags & 254U; data->config_table[idx].flags = (u8 )((unsigned int )data->config_table[idx].flags | 1U); } else { } return; } } __inline static void bnx2x_mcast_set_rdata_hdr_e1(struct bnx2x *bp , struct bnx2x_mcast_ramrod_params *p , u8 len ) { struct bnx2x_raw_obj *r ; struct mac_configuration_cmd *data ; u8 offset ; { r = & (p->mcast_obj)->raw; data = (struct mac_configuration_cmd *)r->rdata; offset = (bp->common.chip_id & 61440U) > 20480U ? (unsigned int )((u8 )((int )r->func_id + 1)) * 16U : (unsigned int )((u8 )((int )r->func_id + 1)) * 64U; data->hdr.offset = offset; data->hdr.client_id = 255U; data->hdr.echo = (r->cid & 131071U) | 1179648U; data->hdr.length = len; return; } } __inline static int bnx2x_mcast_handle_restore_cmd_e1(struct bnx2x *bp , struct bnx2x_mcast_obj *o , int start_idx , int *rdata_idx ) { struct bnx2x_mcast_mac_elem *elem ; int i ; union bnx2x_mcast_config_data cfg_data ; struct list_head const *__mptr ; long tmp ; struct list_head const *__mptr___0 ; { i = 0; cfg_data.mac = 0; __mptr = (struct list_head const *)o->registry.exact_match.macs.next; elem = (struct bnx2x_mcast_mac_elem *)__mptr; goto ldv_47013; ldv_47012: cfg_data.mac = (u8 *)(& elem->mac); (*(o->set_one_rule))(bp, o, i, & cfg_data, 3); i = i + 1; tmp = ldv__builtin_expect((bp->msg_enable & 1048576) != 0, 0L); if (tmp != 0L) { printk("\rbnx2x: [%s:%d(%s)]About to configure %pM mcast MAC\n", "bnx2x_mcast_handle_restore_cmd_e1", 3408, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", cfg_data.mac); } else { } __mptr___0 = (struct list_head const *)elem->link.next; elem = (struct bnx2x_mcast_mac_elem *)__mptr___0; ldv_47013: ; if ((unsigned long )(& elem->link) != (unsigned long )(& o->registry.exact_match.macs)) { goto ldv_47012; } else { } *rdata_idx = i; return (-1); } } __inline static int bnx2x_mcast_handle_pending_cmds_e1(struct bnx2x *bp , struct bnx2x_mcast_ramrod_params *p ) { struct bnx2x_pending_mcast_cmd *cmd_pos ; struct bnx2x_mcast_mac_elem *pmac_pos ; struct bnx2x_mcast_obj *o ; union bnx2x_mcast_config_data cfg_data ; int cnt ; int tmp ; struct list_head const *__mptr ; struct list_head const *__mptr___0 ; long tmp___0 ; struct list_head const *__mptr___1 ; long tmp___1 ; { o = p->mcast_obj; cfg_data.mac = 0; cnt = 0; tmp = list_empty((struct list_head const *)(& o->pending_cmds_head)); if (tmp != 0) { return (0); } else { } __mptr = (struct list_head const *)o->pending_cmds_head.next; cmd_pos = (struct bnx2x_pending_mcast_cmd *)__mptr; switch (cmd_pos->type) { case 0: __mptr___0 = (struct list_head const *)cmd_pos->data.macs_head.next; pmac_pos = (struct bnx2x_mcast_mac_elem *)__mptr___0; goto ldv_47033; ldv_47032: cfg_data.mac = (u8 *)(& pmac_pos->mac); (*(o->set_one_rule))(bp, o, cnt, & cfg_data, (enum bnx2x_mcast_cmd )cmd_pos->type); cnt = cnt + 1; tmp___0 = ldv__builtin_expect((bp->msg_enable & 1048576) != 0, 0L); if (tmp___0 != 0L) { printk("\rbnx2x: [%s:%d(%s)]About to configure %pM mcast MAC\n", "bnx2x_mcast_handle_pending_cmds_e1", 3444, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (u8 *)(& pmac_pos->mac)); } else { } __mptr___1 = (struct list_head const *)pmac_pos->link.next; pmac_pos = (struct bnx2x_mcast_mac_elem *)__mptr___1; ldv_47033: ; if ((unsigned long )(& pmac_pos->link) != (unsigned long )(& cmd_pos->data.macs_head)) { goto ldv_47032; } else { } goto ldv_47035; case 2: cnt = (int )cmd_pos->data.macs_num; tmp___1 = ldv__builtin_expect((bp->msg_enable & 1048576) != 0, 0L); if (tmp___1 != 0L) { printk("\rbnx2x: [%s:%d(%s)]About to delete %d multicast MACs\n", "bnx2x_mcast_handle_pending_cmds_e1", 3450, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", cnt); } else { } goto ldv_47035; case 3: (*(o->hdl_restore))(bp, o, 0, & cnt); goto ldv_47035; default: printk("\vbnx2x: [%s:%d(%s)]Unknown command: %d\n", "bnx2x_mcast_handle_pending_cmds_e1", 3458, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", cmd_pos->type); return (-22); } ldv_47035: list_del(& cmd_pos->link); kfree((void const *)cmd_pos); return (cnt); } } __inline static void bnx2x_get_fw_mac_addr(__le16 *fw_hi , __le16 *fw_mid , __le16 *fw_lo , u8 *mac ) { { *(mac + 1UL) = *((u8 *)fw_hi); *mac = *((u8 *)fw_hi + 1UL); *(mac + 3UL) = *((u8 *)fw_mid); *(mac + 2UL) = *((u8 *)fw_mid + 1UL); *(mac + 5UL) = *((u8 *)fw_lo); *(mac + 4UL) = *((u8 *)fw_lo + 1UL); return; } } __inline static int bnx2x_mcast_refresh_registry_e1(struct bnx2x *bp , struct bnx2x_mcast_obj *o ) { struct bnx2x_raw_obj *raw ; struct bnx2x_mcast_mac_elem *elem ; struct mac_configuration_cmd *data ; int i ; int len ; int tmp ; void *tmp___0 ; long tmp___1 ; struct list_head const *__mptr ; long tmp___2 ; { raw = & o->raw; data = (struct mac_configuration_cmd *)raw->rdata; if ((int )data->config_table[0].flags & 1) { len = (int )data->hdr.length; tmp = list_empty((struct list_head const *)(& o->registry.exact_match.macs)); if (tmp == 0) { return (0); } else { } tmp___0 = kcalloc((size_t )len, 24UL, 32U); elem = (struct bnx2x_mcast_mac_elem *)tmp___0; if ((unsigned long )elem == (unsigned long )((struct bnx2x_mcast_mac_elem *)0)) { printk("\vbnx2x: [%s:%d(%s)]Failed to allocate registry memory\n", "bnx2x_mcast_refresh_registry_e1", 3519, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); return (-12); } else { } i = 0; goto ldv_47056; ldv_47055: bnx2x_get_fw_mac_addr(& data->config_table[i].msb_mac_addr, & data->config_table[i].middle_mac_addr, & data->config_table[i].lsb_mac_addr, (u8 *)(& elem->mac)); tmp___1 = ldv__builtin_expect((bp->msg_enable & 1048576) != 0, 0L); if (tmp___1 != 0L) { printk("\rbnx2x: [%s:%d(%s)]Adding registry entry for [%pM]\n", "bnx2x_mcast_refresh_registry_e1", 3530, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (u8 *)(& elem->mac)); } else { } list_add_tail(& elem->link, & o->registry.exact_match.macs); i = i + 1; elem = elem + 1; ldv_47056: ; if (i < len) { goto ldv_47055; } else { } } else { __mptr = (struct list_head const *)o->registry.exact_match.macs.next; elem = (struct bnx2x_mcast_mac_elem *)__mptr; tmp___2 = ldv__builtin_expect((bp->msg_enable & 1048576) != 0, 0L); if (tmp___2 != 0L) { printk("\rbnx2x: [%s:%d(%s)]Deleting a registry\n", "bnx2x_mcast_refresh_registry_e1", 3537, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } kfree((void const *)elem); INIT_LIST_HEAD(& o->registry.exact_match.macs); } return (0); } } static int bnx2x_mcast_setup_e1(struct bnx2x *bp , struct bnx2x_mcast_ramrod_params *p , enum bnx2x_mcast_cmd cmd ) { struct bnx2x_mcast_obj *o ; struct bnx2x_raw_obj *raw ; struct mac_configuration_cmd *data ; int cnt ; int i ; int rc ; int tmp ; int __ret_warn_on ; long tmp___0 ; int tmp___1 ; { o = p->mcast_obj; raw = & o->raw; data = (struct mac_configuration_cmd *)raw->rdata; cnt = 0; memset((void *)data, 0, 1032UL); i = 0; goto ldv_47072; ldv_47071: data->config_table[i].flags = (unsigned int )data->config_table[i].flags & 254U; data->config_table[i].flags = data->config_table[i].flags; i = i + 1; ldv_47072: ; if (o->max_cmd_len > i) { goto ldv_47071; } else { } cnt = bnx2x_mcast_handle_pending_cmds_e1(bp, p); tmp = list_empty((struct list_head const *)(& o->pending_cmds_head)); if (tmp != 0) { (*(o->clear_sched))(o); } else { } if (cnt == 0) { cnt = bnx2x_mcast_handle_current_cmd(bp, p, cmd, 0); } else { } o->total_pending_num = o->total_pending_num - o->max_cmd_len; __ret_warn_on = o->max_cmd_len < cnt; tmp___0 = ldv__builtin_expect(__ret_warn_on != 0, 0L); if (tmp___0 != 0L) { warn_slowpath_null("/work/ldvuser/exper_fp/work/current--X--drivers--X--defaultlinux-3.10-rc1.tar--X--32_7a--X--cpachecker/linux-3.10-rc1.tar/csd_deg_dscv/8504/dscv_tempdir/dscv/ri/32_7a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sp.c.prepared", 3582); } else { } ldv__builtin_expect(__ret_warn_on != 0, 0L); bnx2x_mcast_set_rdata_hdr_e1(bp, p, (int )((unsigned char )cnt)); rc = bnx2x_mcast_refresh_registry_e1(bp, o); if (rc != 0) { return (rc); } else { } tmp___1 = constant_test_bit(3U, (unsigned long const volatile *)(& p->ramrod_flags)); if (tmp___1 != 0) { (*(raw->clear_pending))(raw); return (0); } else { rc = bnx2x_sp_post(bp, 13, (int )raw->cid, (unsigned int )(raw->rdata_mapping >> 32), (unsigned int )raw->rdata_mapping, 0); if (rc != 0) { return (rc); } else { } return (1); } } } static int bnx2x_mcast_get_registry_size_exact(struct bnx2x_mcast_obj *o ) { { return (o->registry.exact_match.num_macs_set); } } static int bnx2x_mcast_get_registry_size_aprox(struct bnx2x_mcast_obj *o ) { { return (o->registry.aprox_match.num_bins_set); } } static void bnx2x_mcast_set_registry_size_exact(struct bnx2x_mcast_obj *o , int n ) { { o->registry.exact_match.num_macs_set = n; return; } } static void bnx2x_mcast_set_registry_size_aprox(struct bnx2x_mcast_obj *o , int n ) { { o->registry.aprox_match.num_bins_set = n; return; } } int bnx2x_config_mcast(struct bnx2x *bp , struct bnx2x_mcast_ramrod_params *p , enum bnx2x_mcast_cmd cmd ) { struct bnx2x_mcast_obj *o ; struct bnx2x_raw_obj *r ; int rc ; int old_reg_size ; bool tmp ; int tmp___0 ; long tmp___1 ; bool tmp___2 ; int tmp___3 ; bool tmp___4 ; int tmp___5 ; { o = p->mcast_obj; r = & o->raw; rc = 0; old_reg_size = (*(o->get_registry_size))(o); rc = (*(o->validate))(bp, p, cmd); if (rc != 0) { return (rc); } else { } if (p->mcast_list_len == 0) { tmp = (*(o->check_sched))(o); if (tmp) { tmp___0 = 0; } else { tmp___0 = 1; } if (tmp___0) { return (0); } else { } } else { } tmp___1 = ldv__builtin_expect((bp->msg_enable & 1048576) != 0, 0L); if (tmp___1 != 0L) { printk("\rbnx2x: [%s:%d(%s)]o->total_pending_num=%d p->mcast_list_len=%d o->max_cmd_len=%d\n", "bnx2x_config_mcast", 3672, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", o->total_pending_num, p->mcast_list_len, o->max_cmd_len); } else { } tmp___2 = (*(r->check_pending))(r); if ((int )tmp___2 || (o->max_cmd_len > 0 && o->total_pending_num > o->max_cmd_len)) { rc = (*(o->enqueue_cmd))(bp, p->mcast_obj, p, cmd); if (rc < 0) { goto error_exit1; } else { } p->mcast_list_len = 0; } else { } tmp___4 = (*(r->check_pending))(r); if (tmp___4) { tmp___5 = 0; } else { tmp___5 = 1; } if (tmp___5) { (*(r->set_pending))(r); rc = (*(o->config_mcast))(bp, p, cmd); if (rc < 0) { goto error_exit2; } else { } tmp___3 = constant_test_bit(2U, (unsigned long const volatile *)(& p->ramrod_flags)); if (tmp___3 != 0) { rc = (*(o->wait_comp))(bp, o); } else { } } else { } return (rc); error_exit2: (*(r->clear_pending))(r); error_exit1: (*(o->revert))(bp, p, old_reg_size); return (rc); } } static void bnx2x_mcast_clear_sched(struct bnx2x_mcast_obj *o ) { { __asm__ volatile ("": : : "memory"); clear_bit(o->sched_state, (unsigned long volatile *)o->raw.pstate); __asm__ volatile ("": : : "memory"); return; } } static void bnx2x_mcast_set_sched(struct bnx2x_mcast_obj *o ) { { __asm__ volatile ("": : : "memory"); set_bit((unsigned int )o->sched_state, (unsigned long volatile *)o->raw.pstate); __asm__ volatile ("": : : "memory"); return; } } static bool bnx2x_mcast_check_sched(struct bnx2x_mcast_obj *o ) { int tmp ; { tmp = variable_test_bit(o->sched_state, (unsigned long const volatile *)o->raw.pstate); return (tmp != 0); } } static bool bnx2x_mcast_check_pending(struct bnx2x_mcast_obj *o ) { bool tmp ; bool tmp___0 ; int tmp___1 ; { tmp = (*(o->raw.check_pending))(& o->raw); if ((int )tmp) { tmp___1 = 1; } else { tmp___0 = (*(o->check_sched))(o); if ((int )tmp___0) { tmp___1 = 1; } else { tmp___1 = 0; } } return ((bool )tmp___1); } } void bnx2x_init_mcast_obj(struct bnx2x *bp , struct bnx2x_mcast_obj *mcast_obj , u8 mcast_cl_id , u32 mcast_cid , u8 func_id , u8 engine_id , void *rdata , dma_addr_t rdata_mapping , int state , unsigned long *pstate , bnx2x_obj_type type ) { { memset((void *)mcast_obj, 0, 256UL); bnx2x_init_raw_obj(& mcast_obj->raw, (int )mcast_cl_id, mcast_cid, (int )func_id, rdata, rdata_mapping, state, pstate, type); mcast_obj->engine_id = engine_id; INIT_LIST_HEAD(& mcast_obj->pending_cmds_head); mcast_obj->sched_state = 10; mcast_obj->check_sched = & bnx2x_mcast_check_sched; mcast_obj->set_sched = & bnx2x_mcast_set_sched; mcast_obj->clear_sched = & bnx2x_mcast_clear_sched; if (bp->common.chip_id >> 16 == 5710U) { mcast_obj->config_mcast = & bnx2x_mcast_setup_e1; mcast_obj->enqueue_cmd = & bnx2x_mcast_enqueue_cmd; mcast_obj->hdl_restore = & bnx2x_mcast_handle_restore_cmd_e1; mcast_obj->check_pending = & bnx2x_mcast_check_pending; if ((bp->common.chip_id & 61440U) > 20480U) { mcast_obj->max_cmd_len = 16; } else { mcast_obj->max_cmd_len = 64; } mcast_obj->wait_comp = & bnx2x_mcast_wait; mcast_obj->set_one_rule = & bnx2x_mcast_set_one_rule_e1; mcast_obj->validate = & bnx2x_mcast_validate_e1; mcast_obj->revert = & bnx2x_mcast_revert_e1; mcast_obj->get_registry_size = & bnx2x_mcast_get_registry_size_exact; mcast_obj->set_registry_size = & bnx2x_mcast_set_registry_size_exact; INIT_LIST_HEAD(& mcast_obj->registry.exact_match.macs); } else if (bp->common.chip_id >> 16 == 5711U || bp->common.chip_id >> 16 == 5712U) { mcast_obj->config_mcast = & bnx2x_mcast_setup_e1h; mcast_obj->enqueue_cmd = 0; mcast_obj->hdl_restore = 0; mcast_obj->check_pending = & bnx2x_mcast_check_pending; mcast_obj->max_cmd_len = -1; mcast_obj->wait_comp = & bnx2x_mcast_wait; mcast_obj->set_one_rule = 0; mcast_obj->validate = & bnx2x_mcast_validate_e1h; mcast_obj->revert = & bnx2x_mcast_revert_e1h; mcast_obj->get_registry_size = & bnx2x_mcast_get_registry_size_aprox; mcast_obj->set_registry_size = & bnx2x_mcast_set_registry_size_aprox; } else { mcast_obj->config_mcast = & bnx2x_mcast_setup_e2; mcast_obj->enqueue_cmd = & bnx2x_mcast_enqueue_cmd; mcast_obj->hdl_restore = & bnx2x_mcast_handle_restore_cmd_e2; mcast_obj->check_pending = & bnx2x_mcast_check_pending; mcast_obj->max_cmd_len = 16; mcast_obj->wait_comp = & bnx2x_mcast_wait; mcast_obj->set_one_rule = & bnx2x_mcast_set_one_rule_e2; mcast_obj->validate = & bnx2x_mcast_validate_e2; mcast_obj->revert = & bnx2x_mcast_revert_e2; mcast_obj->get_registry_size = & bnx2x_mcast_get_registry_size_aprox; mcast_obj->set_registry_size = & bnx2x_mcast_set_registry_size_aprox; } return; } } __inline static bool __atomic_add_ifless(atomic_t *v , int a , int u ) { int c ; int old ; long tmp ; long tmp___0 ; { c = atomic_read((atomic_t const *)v); ldv_47135: tmp = ldv__builtin_expect(c + a >= u, 0L); if (tmp != 0L) { return (0); } else { } old = atomic_cmpxchg(v, c, c + a); tmp___0 = ldv__builtin_expect(old == c, 1L); if (tmp___0 != 0L) { goto ldv_47134; } else { } c = old; goto ldv_47135; ldv_47134: ; return (1); } } __inline static bool __atomic_dec_ifmoe(atomic_t *v , int a , int u ) { int c ; int old ; long tmp ; long tmp___0 ; { c = atomic_read((atomic_t const *)v); ldv_47144: tmp = ldv__builtin_expect(c - a < u, 0L); if (tmp != 0L) { return (0); } else { } old = atomic_cmpxchg(v, c, c - a); tmp___0 = ldv__builtin_expect(old == c, 1L); if (tmp___0 != 0L) { goto ldv_47143; } else { } c = old; goto ldv_47144; ldv_47143: ; return (1); } } static bool bnx2x_credit_pool_get(struct bnx2x_credit_pool_obj *o , int cnt ) { bool rc ; { __asm__ volatile ("mfence": : : "memory"); rc = __atomic_dec_ifmoe(& o->credit, cnt, 0); __asm__ volatile ("mfence": : : "memory"); return (rc); } } static bool bnx2x_credit_pool_put(struct bnx2x_credit_pool_obj *o , int cnt ) { bool rc ; { __asm__ volatile ("mfence": : : "memory"); rc = __atomic_add_ifless(& o->credit, cnt, o->pool_sz + 1); __asm__ volatile ("mfence": : : "memory"); return (rc); } } static int bnx2x_credit_pool_check(struct bnx2x_credit_pool_obj *o ) { int cur_credit ; { __asm__ volatile ("mfence": : : "memory"); cur_credit = atomic_read((atomic_t const *)(& o->credit)); return (cur_credit); } } static bool bnx2x_credit_pool_always_true(struct bnx2x_credit_pool_obj *o , int cnt ) { { return (1); } } static bool bnx2x_credit_pool_get_entry(struct bnx2x_credit_pool_obj *o , int *offset ) { int idx ; int vec ; int i ; { *offset = -1; vec = 0; goto ldv_47175; ldv_47174: ; if (o->pool_mirror[vec] == 0ULL) { goto ldv_47170; } else { } idx = vec * 64; i = 0; goto ldv_47172; ldv_47171: ; if ((int )(o->pool_mirror[idx >> 6] >> (idx & 63)) & 1) { o->pool_mirror[idx >> 6] = o->pool_mirror[idx >> 6] & ~ (1ULL << (idx & 63)); *offset = o->base_pool_offset + idx; return (1); } else { } idx = idx + 1; i = i + 1; ldv_47172: ; if (i <= 63) { goto ldv_47171; } else { } ldv_47170: vec = vec + 1; ldv_47175: ; if (vec <= 3) { goto ldv_47174; } else { } return (0); } } static bool bnx2x_credit_pool_put_entry(struct bnx2x_credit_pool_obj *o , int offset ) { { if (o->base_pool_offset > offset) { return (0); } else { } offset = offset - o->base_pool_offset; if (o->pool_sz <= offset) { return (0); } else { } o->pool_mirror[offset >> 6] = o->pool_mirror[offset >> 6] | (1ULL << (offset & 63)); return (1); } } static bool bnx2x_credit_pool_put_entry_always_true(struct bnx2x_credit_pool_obj *o , int offset ) { { return (1); } } static bool bnx2x_credit_pool_get_entry_always_true(struct bnx2x_credit_pool_obj *o , int *offset ) { { *offset = -1; return (1); } } __inline static void bnx2x_init_credit_pool(struct bnx2x_credit_pool_obj *p , int base , int credit ) { { memset((void *)p, 0, 88UL); memset((void *)(& p->pool_mirror), 255, 32UL); atomic_set(& p->credit, credit); p->pool_sz = credit; p->base_pool_offset = base; __asm__ volatile ("mfence": : : "memory"); p->check = & bnx2x_credit_pool_check; if (credit >= 0) { p->put = & bnx2x_credit_pool_put; p->get = & bnx2x_credit_pool_get; p->put_entry = & bnx2x_credit_pool_put_entry; p->get_entry = & bnx2x_credit_pool_get_entry; } else { p->put = & bnx2x_credit_pool_always_true; p->get = & bnx2x_credit_pool_always_true; p->put_entry = & bnx2x_credit_pool_put_entry_always_true; p->get_entry = & bnx2x_credit_pool_get_entry_always_true; } if (base < 0) { p->put_entry = & bnx2x_credit_pool_put_entry_always_true; p->get_entry = & bnx2x_credit_pool_get_entry_always_true; } else { } return; } } void bnx2x_init_mac_credit_pool(struct bnx2x *bp , struct bnx2x_credit_pool_obj *p , u8 func_id , u8 func_num ) { int cam_sz ; { if (bp->common.chip_id >> 16 == 5710U) { if ((bp->common.chip_id & 61440U) <= 20480U) { cam_sz = 32; } else { cam_sz = -11; } bnx2x_init_credit_pool(p, (int )func_id * cam_sz, cam_sz); } else if (bp->common.chip_id >> 16 == 5711U || bp->common.chip_id >> 16 == 5712U) { if ((unsigned int )func_num != 0U) { if ((bp->common.chip_id & 61440U) <= 20480U) { cam_sz = 256 / ((int )func_num * 2); } else { cam_sz = 5; } bnx2x_init_credit_pool(p, (int )func_id * cam_sz, cam_sz); } else { bnx2x_init_credit_pool(p, 0, 0); } } else if ((unsigned int )func_num != 0U) { if ((bp->common.chip_id & 61440U) <= 20480U) { cam_sz = 272 / (int )func_num; } else { cam_sz = 5; } bnx2x_init_credit_pool(p, -1, cam_sz); } else { bnx2x_init_credit_pool(p, 0, 0); } return; } } void bnx2x_init_vlan_credit_pool(struct bnx2x *bp , struct bnx2x_credit_pool_obj *p , u8 func_id , u8 func_num ) { int credit ; { if (bp->common.chip_id >> 16 == 5710U || (bp->common.chip_id >> 16 == 5711U || bp->common.chip_id >> 16 == 5712U)) { bnx2x_init_credit_pool(p, 0, -1); } else if ((unsigned int )func_num != 0U) { credit = 272 / (int )func_num; bnx2x_init_credit_pool(p, (int )func_id * credit, credit); } else { bnx2x_init_credit_pool(p, 0, 0); } return; } } __inline static void bnx2x_debug_print_ind_table(struct bnx2x *bp , struct bnx2x_config_rss_params *p ) { int i ; long tmp ; long tmp___0 ; long tmp___1 ; long tmp___2 ; long tmp___3 ; long tmp___4 ; { tmp = ldv__builtin_expect((bp->msg_enable & 1048576) != 0, 0L); if (tmp != 0L) { printk("\rbnx2x: [%s:%d(%s)]Setting indirection table to:\n", "bnx2x_debug_print_ind_table", 4135, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } tmp___0 = ldv__builtin_expect((bp->msg_enable & 1048576) != 0, 0L); if (tmp___0 != 0L) { printk("\rbnx2x: [%s:%d(%s)]0x0000: ", "bnx2x_debug_print_ind_table", 4136, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } i = 0; goto ldv_47215; ldv_47214: tmp___1 = ldv__builtin_expect((bp->msg_enable & 1048576) != 0, 0L); if (tmp___1 != 0L) { printk("0x%02x ", (int )p->ind_table[i]); } else { } if (i + 1 <= 127 && ((i + 1) & 3) == 0) { tmp___2 = ldv__builtin_expect((bp->msg_enable & 1048576) != 0, 0L); if (tmp___2 != 0L) { printk("\n"); } else { } tmp___3 = ldv__builtin_expect((bp->msg_enable & 1048576) != 0, 0L); if (tmp___3 != 0L) { printk("\rbnx2x: [%s:%d(%s)]0x%04x: ", "bnx2x_debug_print_ind_table", 4144, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", i + 1); } else { } } else { } i = i + 1; ldv_47215: ; if (i <= 127) { goto ldv_47214; } else { } tmp___4 = ldv__builtin_expect((bp->msg_enable & 1048576) != 0, 0L); if (tmp___4 != 0L) { printk("\n"); } else { } return; } } static int bnx2x_setup_rss(struct bnx2x *bp , struct bnx2x_config_rss_params *p ) { struct bnx2x_rss_config_obj *o ; struct bnx2x_raw_obj *r ; struct eth_rss_update_ramrod_data *data ; u8 rss_mode ; int rc ; long tmp ; int tmp___0 ; int tmp___1 ; long tmp___2 ; int tmp___3 ; int tmp___4 ; int tmp___5 ; int tmp___6 ; int tmp___7 ; int tmp___8 ; long tmp___9 ; size_t __len ; void *__ret ; size_t __len___0 ; void *__ret___0 ; size_t __len___1 ; void *__ret___1 ; int tmp___10 ; { o = p->rss_obj; r = & o->raw; data = (struct eth_rss_update_ramrod_data *)r->rdata; rss_mode = 0U; memset((void *)data, 0, 184UL); tmp = ldv__builtin_expect((bp->msg_enable & 1048576) != 0, 0L); if (tmp != 0L) { printk("\rbnx2x: [%s:%d(%s)]Configuring RSS\n", "bnx2x_setup_rss", 4171, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } data->echo = (r->cid & 131071U) | (u32 )(r->state << 17); tmp___1 = constant_test_bit(0U, (unsigned long const volatile *)(& p->rss_flags)); if (tmp___1 != 0) { rss_mode = 0U; } else { tmp___0 = constant_test_bit(1U, (unsigned long const volatile *)(& p->rss_flags)); if (tmp___0 != 0) { rss_mode = 1U; } else { } } data->rss_mode = rss_mode; tmp___2 = ldv__builtin_expect((bp->msg_enable & 1048576) != 0, 0L); if (tmp___2 != 0L) { printk("\rbnx2x: [%s:%d(%s)]rss_mode=%d\n", "bnx2x_setup_rss", 4185, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )rss_mode); } else { } tmp___3 = constant_test_bit(3U, (unsigned long const volatile *)(& p->rss_flags)); if (tmp___3 != 0) { data->capabilities = (u8 )((unsigned int )data->capabilities | 1U); } else { } tmp___4 = constant_test_bit(4U, (unsigned long const volatile *)(& p->rss_flags)); if (tmp___4 != 0) { data->capabilities = (u8 )((unsigned int )data->capabilities | 2U); } else { } tmp___5 = constant_test_bit(5U, (unsigned long const volatile *)(& p->rss_flags)); if (tmp___5 != 0) { data->capabilities = (u8 )((unsigned int )data->capabilities | 4U); } else { } tmp___6 = constant_test_bit(6U, (unsigned long const volatile *)(& p->rss_flags)); if (tmp___6 != 0) { data->capabilities = (u8 )((unsigned int )data->capabilities | 8U); } else { } tmp___7 = constant_test_bit(7U, (unsigned long const volatile *)(& p->rss_flags)); if (tmp___7 != 0) { data->capabilities = (u8 )((unsigned int )data->capabilities | 16U); } else { } tmp___8 = constant_test_bit(8U, (unsigned long const volatile *)(& p->rss_flags)); if (tmp___8 != 0) { data->capabilities = (u8 )((unsigned int )data->capabilities | 32U); } else { } data->rss_result_mask = p->rss_result_mask; data->rss_engine_id = o->engine_id; tmp___9 = ldv__builtin_expect((bp->msg_enable & 1048576) != 0, 0L); if (tmp___9 != 0L) { printk("\rbnx2x: [%s:%d(%s)]rss_engine_id=%d\n", "bnx2x_setup_rss", 4218, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )data->rss_engine_id); } else { } __len = 128UL; if (__len > 63UL) { __ret = __memcpy((void *)(& data->indirection_table), (void const *)(& p->ind_table), __len); } else { __ret = __builtin_memcpy((void *)(& data->indirection_table), (void const *)(& p->ind_table), __len); } __len___0 = 128UL; if (__len___0 > 63UL) { __ret___0 = __memcpy((void *)(& o->ind_table), (void const *)(& p->ind_table), __len___0); } else { __ret___0 = __builtin_memcpy((void *)(& o->ind_table), (void const *)(& p->ind_table), __len___0); } if ((bp->msg_enable & 32) != 0) { bnx2x_debug_print_ind_table(bp, p); } else { } tmp___10 = constant_test_bit(2U, (unsigned long const volatile *)(& p->rss_flags)); if (tmp___10 != 0) { __len___1 = 40UL; if (__len___1 > 63UL) { __ret___1 = __memcpy((void *)(& data->rss_key), (void const *)(& p->rss_key), __len___1); } else { __ret___1 = __builtin_memcpy((void *)(& data->rss_key), (void const *)(& p->rss_key), __len___1); } data->capabilities = (u8 )((unsigned int )data->capabilities | 128U); } else { } rc = bnx2x_sp_post(bp, 12, (int )r->cid, (unsigned int )(r->rdata_mapping >> 32), (unsigned int )r->rdata_mapping, 0); if (rc < 0) { return (rc); } else { } return (1); } } void bnx2x_get_rss_ind_table(struct bnx2x_rss_config_obj *rss_obj , u8 *ind_table ) { size_t __len ; void *__ret ; { __len = 128UL; if (__len > 63UL) { __ret = __memcpy((void *)ind_table, (void const *)(& rss_obj->ind_table), __len); } else { __ret = __builtin_memcpy((void *)ind_table, (void const *)(& rss_obj->ind_table), __len); } return; } } int bnx2x_config_rss(struct bnx2x *bp , struct bnx2x_config_rss_params *p ) { int rc ; struct bnx2x_rss_config_obj *o ; struct bnx2x_raw_obj *r ; int tmp ; int tmp___0 ; { o = p->rss_obj; r = & o->raw; tmp = constant_test_bit(3U, (unsigned long const volatile *)(& p->ramrod_flags)); if (tmp != 0) { return (0); } else { } (*(r->set_pending))(r); rc = (*(o->config_rss))(bp, p); if (rc < 0) { (*(r->clear_pending))(r); return (rc); } else { } tmp___0 = constant_test_bit(2U, (unsigned long const volatile *)(& p->ramrod_flags)); if (tmp___0 != 0) { rc = (*(r->wait_comp))(bp, r); } else { } return (rc); } } void bnx2x_init_rss_config_obj(struct bnx2x *bp , struct bnx2x_rss_config_obj *rss_obj , u8 cl_id , u32 cid , u8 func_id , u8 engine_id , void *rdata , dma_addr_t rdata_mapping , int state , unsigned long *pstate , bnx2x_obj_type type ) { { bnx2x_init_raw_obj(& rss_obj->raw, (int )cl_id, cid, (int )func_id, rdata, rdata_mapping, state, pstate, type); rss_obj->engine_id = engine_id; rss_obj->config_rss = & bnx2x_setup_rss; return; } } int bnx2x_queue_state_change(struct bnx2x *bp , struct bnx2x_queue_state_params *params ) { struct bnx2x_queue_sp_obj *o ; int rc ; int pending_bit ; unsigned long *pending ; long tmp ; long tmp___0 ; int tmp___1 ; int tmp___2 ; int tmp___3 ; { o = params->q_obj; pending = & o->pending; rc = (*(o->check_transition))(bp, o, params); if (rc != 0) { printk("\vbnx2x: [%s:%d(%s)]check transition returned an error. rc %d\n", "bnx2x_queue_state_change", 4328, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", rc); return (-22); } else { } tmp = ldv__builtin_expect((bp->msg_enable & 1048576) != 0, 0L); if (tmp != 0L) { printk("\rbnx2x: [%s:%d(%s)]pending bit was=%lx\n", "bnx2x_queue_state_change", 4333, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", o->pending); } else { } pending_bit = (*(o->set_pending))(o, params); tmp___0 = ldv__builtin_expect((bp->msg_enable & 1048576) != 0, 0L); if (tmp___0 != 0L) { printk("\rbnx2x: [%s:%d(%s)]pending bit now=%lx\n", "bnx2x_queue_state_change", 4335, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", o->pending); } else { } tmp___2 = constant_test_bit(3U, (unsigned long const volatile *)(& params->ramrod_flags)); if (tmp___2 != 0) { (*(o->complete_cmd))(bp, o, (enum bnx2x_queue_cmd )pending_bit); } else { rc = (*(o->send_cmd))(bp, params); if (rc != 0) { o->next_state = 9; clear_bit(pending_bit, (unsigned long volatile *)pending); __asm__ volatile ("": : : "memory"); return (rc); } else { } tmp___1 = constant_test_bit(2U, (unsigned long const volatile *)(& params->ramrod_flags)); if (tmp___1 != 0) { rc = (*(o->wait_comp))(bp, o, (enum bnx2x_queue_cmd )pending_bit); if (rc != 0) { return (rc); } else { } return (0); } else { } } tmp___3 = variable_test_bit(pending_bit, (unsigned long const volatile *)pending); return (tmp___3 != 0); } } static int bnx2x_queue_set_pending(struct bnx2x_queue_sp_obj *obj , struct bnx2x_queue_state_params *params ) { enum bnx2x_queue_cmd cmd ; enum bnx2x_queue_cmd bit ; { cmd = params->cmd; if ((unsigned int )cmd == 4U || (unsigned int )cmd == 3U) { bit = 5; } else { bit = cmd; } set_bit((unsigned int )bit, (unsigned long volatile *)(& obj->pending)); return ((int )bit); } } static int bnx2x_queue_wait_comp(struct bnx2x *bp , struct bnx2x_queue_sp_obj *o , enum bnx2x_queue_cmd cmd ) { int tmp ; { tmp = bnx2x_state_wait(bp, (int )cmd, & o->pending); return (tmp); } } static int bnx2x_queue_comp_cmd(struct bnx2x *bp , struct bnx2x_queue_sp_obj *o , enum bnx2x_queue_cmd cmd ) { unsigned long cur_pending ; int tmp ; long tmp___0 ; long tmp___1 ; { cur_pending = o->pending; tmp = test_and_clear_bit((int )cmd, (unsigned long volatile *)(& cur_pending)); if (tmp == 0) { printk("\vbnx2x: [%s:%d(%s)]Bad MC reply %d for queue %d in state %d pending 0x%lx, next_state %d\n", "bnx2x_queue_comp_cmd", 4406, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (unsigned int )cmd, o->cids[0], (unsigned int )o->state, cur_pending, (unsigned int )o->next_state); return (-22); } else { } if ((int )o->next_tx_only >= (int )o->max_cos) { printk("\vbnx2x: [%s:%d(%s)]illegal value for next tx_only: %d. max cos was %d", "bnx2x_queue_comp_cmd", 4415, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )o->next_tx_only, (int )o->max_cos); } else { } tmp___0 = ldv__builtin_expect((bp->msg_enable & 1048576) != 0, 0L); if (tmp___0 != 0L) { printk("\rbnx2x: [%s:%d(%s)]Completing command %d for queue %d, setting state to %d\n", "bnx2x_queue_comp_cmd", 4419, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (unsigned int )cmd, o->cids[0], (unsigned int )o->next_state); } else { } if ((unsigned int )o->next_tx_only != 0U) { tmp___1 = ldv__builtin_expect((bp->msg_enable & 1048576) != 0, 0L); if (tmp___1 != 0L) { printk("\rbnx2x: [%s:%d(%s)]primary cid %d: num tx-only cons %d\n", "bnx2x_queue_comp_cmd", 4423, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", o->cids[0], (int )o->next_tx_only); } else { } } else { } o->state = o->next_state; o->num_tx_only = o->next_tx_only; o->next_state = 9; __asm__ volatile ("sfence": : : "memory"); clear_bit((int )cmd, (unsigned long volatile *)(& o->pending)); __asm__ volatile ("": : : "memory"); return (0); } } static void bnx2x_q_fill_setup_data_e2(struct bnx2x *bp , struct bnx2x_queue_state_params *cmd_params , struct client_init_ramrod_data *data ) { struct bnx2x_queue_setup_params *params ; int tmp ; { params = & cmd_params->params.setup; tmp = constant_test_bit(1U, (unsigned long const volatile *)(& params->flags)); data->rx.tpa_en = (u8 )((int )((signed char )data->rx.tpa_en) | (int )((signed char )((unsigned int )((unsigned char )tmp) * 2U))); return; } } static void bnx2x_q_fill_init_general_data(struct bnx2x *bp , struct bnx2x_queue_sp_obj *o , struct bnx2x_general_setup_params *params , struct client_init_general_data *gen_data , unsigned long *flags ) { int tmp ; int tmp___0 ; int tmp___1 ; int tmp___2 ; int tmp___3 ; long tmp___4 ; { gen_data->client_id = o->cl_id; tmp___0 = constant_test_bit(3U, (unsigned long const volatile *)flags); if (tmp___0 != 0) { gen_data->statistics_counter_id = params->stat_id; gen_data->statistics_en_flg = 1U; tmp = constant_test_bit(4U, (unsigned long const volatile *)flags); gen_data->statistics_zero_flg = (u8 )tmp; } else { gen_data->statistics_counter_id = 0U; } tmp___1 = constant_test_bit(12U, (unsigned long const volatile *)flags); gen_data->is_fcoe_flg = (u8 )tmp___1; tmp___2 = constant_test_bit(5U, (unsigned long const volatile *)flags); gen_data->activate_flg = (u8 )tmp___2; gen_data->sp_client_id = params->spcl_id; gen_data->mtu = params->mtu; gen_data->func_id = o->func_id; gen_data->cos = params->cos; tmp___3 = constant_test_bit(12U, (unsigned long const volatile *)flags); gen_data->traffic_type = tmp___3 != 0; tmp___4 = ldv__builtin_expect((bp->msg_enable & 1048576) != 0, 0L); if (tmp___4 != 0L) { printk("\rbnx2x: [%s:%d(%s)]flags: active %d, cos %d, stats en %d\n", "bnx2x_q_fill_init_general_data", 4485, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )gen_data->activate_flg, (int )gen_data->cos, (int )gen_data->statistics_en_flg); } else { } return; } } static void bnx2x_q_fill_init_tx_data(struct bnx2x_queue_sp_obj *o , struct bnx2x_txq_setup_params *params , struct client_init_tx_data *tx_data , unsigned long *flags ) { int tmp ; int tmp___0 ; int tmp___1 ; int tmp___2 ; int tmp___3 ; int tmp___4 ; int tmp___5 ; { tmp = constant_test_bit(17U, (unsigned long const volatile *)flags); tx_data->enforce_security_flg = (u8 )tmp; tx_data->default_vlan = params->default_vlan; tmp___0 = constant_test_bit(15U, (unsigned long const volatile *)flags); tx_data->default_vlan_flg = (u8 )tmp___0; tmp___1 = constant_test_bit(16U, (unsigned long const volatile *)flags); tx_data->tx_switching_flg = (u8 )tmp___1; tmp___2 = constant_test_bit(18U, (unsigned long const volatile *)flags); tx_data->anti_spoofing_flg = (u8 )tmp___2; tmp___3 = constant_test_bit(20U, (unsigned long const volatile *)flags); tx_data->force_default_pri_flg = (u8 )tmp___3; tmp___4 = constant_test_bit(22U, (unsigned long const volatile *)flags); tx_data->tunnel_lso_inc_ip_id = (u8 )tmp___4; tmp___5 = constant_test_bit(21U, (unsigned long const volatile *)flags); tx_data->tunnel_non_lso_pcsum_location = tmp___5 == 0; tx_data->tx_status_block_id = params->fw_sb_id; tx_data->tx_sb_index_number = params->sb_cq_index; tx_data->tss_leading_client_id = params->tss_leading_cl_id; tx_data->tx_bd_page_base.lo = (unsigned int )params->dscr_map; tx_data->tx_bd_page_base.hi = (unsigned int )(params->dscr_map >> 32); tx_data->state = 0U; return; } } static void bnx2x_q_fill_init_pause_data(struct bnx2x_queue_sp_obj *o , struct rxq_pause_params *params , struct client_init_rx_data *rx_data ) { { rx_data->cqe_pause_thr_low = params->rcq_th_lo; rx_data->cqe_pause_thr_high = params->rcq_th_hi; rx_data->bd_pause_thr_low = params->bd_th_lo; rx_data->bd_pause_thr_high = params->bd_th_hi; rx_data->sge_pause_thr_low = params->sge_th_lo; rx_data->sge_pause_thr_high = params->sge_th_hi; rx_data->rx_cos_mask = params->pri_map; return; } } static void bnx2x_q_fill_init_rx_data(struct bnx2x_queue_sp_obj *o , struct bnx2x_rxq_setup_params *params , struct client_init_rx_data *rx_data , unsigned long *flags ) { int tmp ; int tmp___0 ; int tmp___1 ; int tmp___2 ; int tmp___3 ; int tmp___4 ; int tmp___5 ; int tmp___6 ; { tmp = constant_test_bit(0U, (unsigned long const volatile *)flags); rx_data->tpa_en = (u8 )tmp; tmp___0 = constant_test_bit(2U, (unsigned long const volatile *)flags); rx_data->tpa_en = (u8 )((int )((signed char )rx_data->tpa_en) | (int )((signed char )((unsigned int )((unsigned char )tmp___0) * 4U))); rx_data->vmqueue_mode_en_flg = 0U; rx_data->cache_line_alignment_log_size = params->cache_line_log; tmp___1 = constant_test_bit(11U, (unsigned long const volatile *)flags); rx_data->enable_dynamic_hc = (u8 )tmp___1; rx_data->max_sges_for_packet = params->max_sges_pkt; rx_data->client_qzone_id = params->cl_qzone_id; rx_data->max_agg_size = params->tpa_agg_sz; rx_data->state = 9U; rx_data->drop_ip_cs_err_flg = 0U; rx_data->drop_tcp_cs_err_flg = 0U; rx_data->drop_ttl0_flg = 0U; rx_data->drop_udp_cs_err_flg = 0U; tmp___2 = constant_test_bit(7U, (unsigned long const volatile *)flags); rx_data->inner_vlan_removal_enable_flg = (u8 )tmp___2; tmp___3 = constant_test_bit(6U, (unsigned long const volatile *)flags); rx_data->outer_vlan_removal_enable_flg = (u8 )tmp___3; rx_data->status_block_id = params->fw_sb_id; rx_data->rx_sb_index_number = params->sb_cq_index; rx_data->max_tpa_queues = params->max_tpa_queues; rx_data->max_bytes_on_bd = params->buf_sz; rx_data->sge_buff_size = params->sge_buf_sz; rx_data->bd_page_base.lo = (unsigned int )params->dscr_map; rx_data->bd_page_base.hi = (unsigned int )(params->dscr_map >> 32); rx_data->sge_page_base.lo = (unsigned int )params->sge_map; rx_data->sge_page_base.hi = (unsigned int )(params->sge_map >> 32); rx_data->cqe_page_base.lo = (unsigned int )params->rcq_map; rx_data->cqe_page_base.hi = (unsigned int )(params->rcq_map >> 32); tmp___4 = constant_test_bit(13U, (unsigned long const volatile *)flags); rx_data->is_leading_rss = (u8 )tmp___4; tmp___5 = constant_test_bit(14U, (unsigned long const volatile *)flags); if (tmp___5 != 0) { rx_data->approx_mcast_engine_id = params->mcast_engine_id; rx_data->is_approx_mcast = 1U; } else { } rx_data->rss_engine_id = params->rss_engine_id; tmp___6 = constant_test_bit(19U, (unsigned long const volatile *)flags); rx_data->silent_vlan_removal_flg = (u8 )tmp___6; rx_data->silent_vlan_value = params->silent_removal_value; rx_data->silent_vlan_mask = params->silent_removal_mask; return; } } static void bnx2x_q_fill_setup_data_cmn(struct bnx2x *bp , struct bnx2x_queue_state_params *cmd_params , struct client_init_ramrod_data *data ) { { bnx2x_q_fill_init_general_data(bp, cmd_params->q_obj, & cmd_params->params.setup.gen_params, & data->general, & cmd_params->params.setup.flags); bnx2x_q_fill_init_tx_data(cmd_params->q_obj, & cmd_params->params.setup.txq_params, & data->tx, & cmd_params->params.setup.flags); bnx2x_q_fill_init_rx_data(cmd_params->q_obj, & cmd_params->params.setup.rxq_params, & data->rx, & cmd_params->params.setup.flags); bnx2x_q_fill_init_pause_data(cmd_params->q_obj, & cmd_params->params.setup.pause_params, & data->rx); return; } } static void bnx2x_q_fill_setup_tx_only(struct bnx2x *bp , struct bnx2x_queue_state_params *cmd_params , struct tx_queue_init_ramrod_data *data ) { long tmp ; { bnx2x_q_fill_init_general_data(bp, cmd_params->q_obj, & cmd_params->params.tx_only.gen_params, & data->general, & cmd_params->params.tx_only.flags); bnx2x_q_fill_init_tx_data(cmd_params->q_obj, & cmd_params->params.tx_only.txq_params, & data->tx, & cmd_params->params.tx_only.flags); tmp = ldv__builtin_expect((bp->msg_enable & 1048576) != 0, 0L); if (tmp != 0L) { printk("\rbnx2x: [%s:%d(%s)]cid %d, tx bd page lo %x hi %x", "bnx2x_q_fill_setup_tx_only", 4650, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (cmd_params->q_obj)->cids[0], data->tx.tx_bd_page_base.lo, data->tx.tx_bd_page_base.hi); } else { } return; } } __inline static int bnx2x_q_init(struct bnx2x *bp , struct bnx2x_queue_state_params *params ) { struct bnx2x_queue_sp_obj *o ; struct bnx2x_queue_init_params *init ; u16 hc_usec ; u8 cos ; int tmp ; int tmp___0 ; int tmp___1 ; int tmp___2 ; int tmp___3 ; int tmp___4 ; long tmp___5 ; long tmp___6 ; { o = params->q_obj; init = & params->params.init; tmp___0 = constant_test_bit(1U, (unsigned long const volatile *)(& o->type)); if (tmp___0 != 0) { tmp___1 = constant_test_bit(9U, (unsigned long const volatile *)(& init->tx.flags)); if (tmp___1 != 0) { hc_usec = (unsigned int )init->tx.hc_rate != 0U ? (u16 )(1000000 / (int )init->tx.hc_rate) : 0U; tmp = constant_test_bit(10U, (unsigned long const volatile *)(& init->tx.flags)); bnx2x_update_coalesce_sb_index(bp, (int )init->tx.fw_sb_id, (int )init->tx.sb_cq_index, tmp == 0, (int )hc_usec); } else { } } else { } tmp___3 = constant_test_bit(0U, (unsigned long const volatile *)(& o->type)); if (tmp___3 != 0) { tmp___4 = constant_test_bit(9U, (unsigned long const volatile *)(& init->rx.flags)); if (tmp___4 != 0) { hc_usec = (unsigned int )init->rx.hc_rate != 0U ? (u16 )(1000000 / (int )init->rx.hc_rate) : 0U; tmp___2 = constant_test_bit(10U, (unsigned long const volatile *)(& init->rx.flags)); bnx2x_update_coalesce_sb_index(bp, (int )init->rx.fw_sb_id, (int )init->rx.sb_cq_index, tmp___2 == 0, (int )hc_usec); } else { } } else { } cos = 0U; goto ldv_47342; ldv_47341: tmp___5 = ldv__builtin_expect((bp->msg_enable & 1048576) != 0, 0L); if (tmp___5 != 0L) { printk("\rbnx2x: [%s:%d(%s)]setting context validation. cid %d, cos %d\n", "bnx2x_q_init", 4697, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", o->cids[(int )cos], (int )cos); } else { } tmp___6 = ldv__builtin_expect((bp->msg_enable & 1048576) != 0, 0L); if (tmp___6 != 0L) { printk("\rbnx2x: [%s:%d(%s)]context pointer %p\n", "bnx2x_q_init", 4698, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", init->cxts[(int )cos]); } else { } bnx2x_set_ctx_validation(bp, init->cxts[(int )cos], o->cids[(int )cos]); cos = (u8 )((int )cos + 1); ldv_47342: ; if ((int )o->max_cos > (int )cos) { goto ldv_47341; } else { } (*(o->complete_cmd))(bp, o, 0); __asm__ volatile ("": : : "memory"); __asm__ volatile ("mfence": : : "memory"); return (0); } } __inline static int bnx2x_q_send_setup_e1x(struct bnx2x *bp , struct bnx2x_queue_state_params *params ) { struct bnx2x_queue_sp_obj *o ; struct client_init_ramrod_data *rdata ; dma_addr_t data_mapping ; int ramrod ; int tmp ; { o = params->q_obj; rdata = (struct client_init_ramrod_data *)o->rdata; data_mapping = o->rdata_mapping; ramrod = 1; memset((void *)rdata, 0, 120UL); bnx2x_q_fill_setup_data_cmn(bp, params, rdata); tmp = bnx2x_sp_post(bp, ramrod, (int )o->cids[0], (unsigned int )(data_mapping >> 32), (unsigned int )data_mapping, 0); return (tmp); } } __inline static int bnx2x_q_send_setup_e2(struct bnx2x *bp , struct bnx2x_queue_state_params *params ) { struct bnx2x_queue_sp_obj *o ; struct client_init_ramrod_data *rdata ; dma_addr_t data_mapping ; int ramrod ; int tmp ; { o = params->q_obj; rdata = (struct client_init_ramrod_data *)o->rdata; data_mapping = o->rdata_mapping; ramrod = 1; memset((void *)rdata, 0, 120UL); bnx2x_q_fill_setup_data_cmn(bp, params, rdata); bnx2x_q_fill_setup_data_e2(bp, params, rdata); tmp = bnx2x_sp_post(bp, ramrod, (int )o->cids[0], (unsigned int )(data_mapping >> 32), (unsigned int )data_mapping, 0); return (tmp); } } __inline static int bnx2x_q_send_setup_tx_only(struct bnx2x *bp , struct bnx2x_queue_state_params *params ) { struct bnx2x_queue_sp_obj *o ; struct tx_queue_init_ramrod_data *rdata ; dma_addr_t data_mapping ; int ramrod ; struct bnx2x_queue_setup_tx_only_params *tx_only_params ; u8 cid_index ; long tmp ; long tmp___0 ; int tmp___1 ; { o = params->q_obj; rdata = (struct tx_queue_init_ramrod_data *)o->rdata; data_mapping = o->rdata_mapping; ramrod = 4; tx_only_params = & params->params.tx_only; cid_index = tx_only_params->cid_index; if ((int )o->max_cos <= (int )cid_index) { printk("\vbnx2x: [%s:%d(%s)]queue[%d]: cid_index (%d) is out of range\n", "bnx2x_q_send_setup_tx_only", 4783, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )o->cl_id, (int )cid_index); return (-22); } else { } tmp = ldv__builtin_expect((bp->msg_enable & 1048576) != 0, 0L); if (tmp != 0L) { printk("\rbnx2x: [%s:%d(%s)]parameters received: cos: %d sp-id: %d\n", "bnx2x_q_send_setup_tx_only", 4789, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )tx_only_params->gen_params.cos, (int )tx_only_params->gen_params.spcl_id); } else { } memset((void *)rdata, 0, 40UL); bnx2x_q_fill_setup_tx_only(bp, params, rdata); tmp___0 = ldv__builtin_expect((bp->msg_enable & 1048576) != 0, 0L); if (tmp___0 != 0L) { printk("\rbnx2x: [%s:%d(%s)]sending tx-only ramrod: cid %d, client-id %d, sp-client id %d, cos %d\n", "bnx2x_q_send_setup_tx_only", 4799, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", o->cids[(int )cid_index], (int )rdata->general.client_id, (int )rdata->general.sp_client_id, (int )rdata->general.cos); } else { } tmp___1 = bnx2x_sp_post(bp, ramrod, (int )o->cids[(int )cid_index], (unsigned int )(data_mapping >> 32), (unsigned int )data_mapping, 0); return (tmp___1); } } static void bnx2x_q_fill_update_data(struct bnx2x *bp , struct bnx2x_queue_sp_obj *obj , struct bnx2x_queue_update_params *params , struct client_update_ramrod_data *data ) { 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 ; { data->client_id = obj->cl_id; data->func_id = obj->func_id; data->default_vlan = params->def_vlan; tmp = constant_test_bit(0U, (unsigned long const volatile *)(& params->update_flags)); data->inner_vlan_removal_enable_flg = (u8 )tmp; tmp___0 = constant_test_bit(1U, (unsigned long const volatile *)(& params->update_flags)); data->inner_vlan_removal_change_flg = (u8 )tmp___0; tmp___1 = constant_test_bit(2U, (unsigned long const volatile *)(& params->update_flags)); data->outer_vlan_removal_enable_flg = (u8 )tmp___1; tmp___2 = constant_test_bit(3U, (unsigned long const volatile *)(& params->update_flags)); data->outer_vlan_removal_change_flg = (u8 )tmp___2; tmp___3 = constant_test_bit(4U, (unsigned long const volatile *)(& params->update_flags)); data->anti_spoofing_enable_flg = (u8 )tmp___3; tmp___4 = constant_test_bit(5U, (unsigned long const volatile *)(& params->update_flags)); data->anti_spoofing_change_flg = (u8 )tmp___4; tmp___5 = constant_test_bit(6U, (unsigned long const volatile *)(& params->update_flags)); data->activate_flg = (u8 )tmp___5; tmp___6 = constant_test_bit(7U, (unsigned long const volatile *)(& params->update_flags)); data->activate_change_flg = (u8 )tmp___6; tmp___7 = constant_test_bit(8U, (unsigned long const volatile *)(& params->update_flags)); data->default_vlan_enable_flg = (u8 )tmp___7; tmp___8 = constant_test_bit(9U, (unsigned long const volatile *)(& params->update_flags)); data->default_vlan_change_flg = (u8 )tmp___8; tmp___9 = constant_test_bit(10U, (unsigned long const volatile *)(& params->update_flags)); data->silent_vlan_change_flg = (u8 )tmp___9; tmp___10 = constant_test_bit(11U, (unsigned long const volatile *)(& params->update_flags)); data->silent_vlan_removal_flg = (u8 )tmp___10; data->silent_vlan_value = params->silent_removal_value; data->silent_vlan_mask = params->silent_removal_mask; return; } } __inline static int bnx2x_q_send_update(struct bnx2x *bp , struct bnx2x_queue_state_params *params ) { struct bnx2x_queue_sp_obj *o ; struct client_update_ramrod_data *rdata ; dma_addr_t data_mapping ; struct bnx2x_queue_update_params *update_params ; u8 cid_index ; int tmp ; { o = params->q_obj; rdata = (struct client_update_ramrod_data *)o->rdata; data_mapping = o->rdata_mapping; update_params = & params->params.update; cid_index = update_params->cid_index; if ((int )o->max_cos <= (int )cid_index) { printk("\vbnx2x: [%s:%d(%s)]queue[%d]: cid_index (%d) is out of range\n", "bnx2x_q_send_update", 4886, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )o->cl_id, (int )cid_index); return (-22); } else { } memset((void *)rdata, 0, 32UL); bnx2x_q_fill_update_data(bp, o, update_params, rdata); tmp = bnx2x_sp_post(bp, 5, (int )o->cids[(int )cid_index], (unsigned int )(data_mapping >> 32), (unsigned int )data_mapping, 0); return (tmp); } } __inline static int bnx2x_q_send_deactivate(struct bnx2x *bp , struct bnx2x_queue_state_params *params ) { struct bnx2x_queue_update_params *update ; int tmp ; { update = & params->params.update; memset((void *)update, 0, 16UL); __set_bit(7, (unsigned long volatile *)(& update->update_flags)); tmp = bnx2x_q_send_update(bp, params); return (tmp); } } __inline static int bnx2x_q_send_activate(struct bnx2x *bp , struct bnx2x_queue_state_params *params ) { struct bnx2x_queue_update_params *update ; int tmp ; { update = & params->params.update; memset((void *)update, 0, 16UL); __set_bit(6, (unsigned long volatile *)(& update->update_flags)); __set_bit(7, (unsigned long volatile *)(& update->update_flags)); tmp = bnx2x_q_send_update(bp, params); return (tmp); } } __inline static int bnx2x_q_send_update_tpa(struct bnx2x *bp , struct bnx2x_queue_state_params *params ) { { return (-1); } } __inline static int bnx2x_q_send_halt(struct bnx2x *bp , struct bnx2x_queue_state_params *params ) { struct bnx2x_queue_sp_obj *o ; int tmp ; { o = params->q_obj; tmp = bnx2x_sp_post(bp, 2, (int )o->cids[0], 0U, (u32 )o->cl_id, 0); return (tmp); } } __inline static int bnx2x_q_send_cfc_del(struct bnx2x *bp , struct bnx2x_queue_state_params *params ) { struct bnx2x_queue_sp_obj *o ; u8 cid_idx ; int tmp ; { o = params->q_obj; cid_idx = params->params.cfc_del.cid_index; if ((int )o->max_cos <= (int )cid_idx) { printk("\vbnx2x: [%s:%d(%s)]queue[%d]: cid_index (%d) is out of range\n", "bnx2x_q_send_cfc_del", 4976, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )o->cl_id, (int )cid_idx); return (-22); } else { } tmp = bnx2x_sp_post(bp, 4, (int )o->cids[(int )cid_idx], 0U, 0U, 8); return (tmp); } } __inline static int bnx2x_q_send_terminate(struct bnx2x *bp , struct bnx2x_queue_state_params *params ) { struct bnx2x_queue_sp_obj *o ; u8 cid_index ; int tmp ; { o = params->q_obj; cid_index = params->params.terminate.cid_index; if ((int )o->max_cos <= (int )cid_index) { printk("\vbnx2x: [%s:%d(%s)]queue[%d]: cid_index (%d) is out of range\n", "bnx2x_q_send_terminate", 4992, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )o->cl_id, (int )cid_index); return (-22); } else { } tmp = bnx2x_sp_post(bp, 7, (int )o->cids[(int )cid_index], 0U, 0U, 0); return (tmp); } } __inline static int bnx2x_q_send_empty(struct bnx2x *bp , struct bnx2x_queue_state_params *params ) { struct bnx2x_queue_sp_obj *o ; int tmp ; { o = params->q_obj; tmp = bnx2x_sp_post(bp, 6, (int )o->cids[0], 0U, 0U, 0); return (tmp); } } __inline static int bnx2x_queue_send_cmd_cmn(struct bnx2x *bp , struct bnx2x_queue_state_params *params ) { 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 ; { switch ((unsigned int )params->cmd) { case 0U: tmp = bnx2x_q_init(bp, params); return (tmp); case 2U: tmp___0 = bnx2x_q_send_setup_tx_only(bp, params); return (tmp___0); case 3U: tmp___1 = bnx2x_q_send_deactivate(bp, params); return (tmp___1); case 4U: tmp___2 = bnx2x_q_send_activate(bp, params); return (tmp___2); case 5U: tmp___3 = bnx2x_q_send_update(bp, params); return (tmp___3); case 6U: tmp___4 = bnx2x_q_send_update_tpa(bp, params); return (tmp___4); case 7U: tmp___5 = bnx2x_q_send_halt(bp, params); return (tmp___5); case 8U: tmp___6 = bnx2x_q_send_cfc_del(bp, params); return (tmp___6); case 9U: tmp___7 = bnx2x_q_send_terminate(bp, params); return (tmp___7); case 10U: tmp___8 = bnx2x_q_send_empty(bp, params); return (tmp___8); default: printk("\vbnx2x: [%s:%d(%s)]Unknown command: %d\n", "bnx2x_queue_send_cmd_cmn", 5035, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (unsigned int )params->cmd); return (-22); } } } static int bnx2x_queue_send_cmd_e1x(struct bnx2x *bp , struct bnx2x_queue_state_params *params ) { int tmp ; int tmp___0 ; { switch ((unsigned int )params->cmd) { case 1U: tmp = bnx2x_q_send_setup_e1x(bp, params); return (tmp); case 0U: ; case 2U: ; case 3U: ; case 4U: ; case 5U: ; case 6U: ; case 7U: ; case 8U: ; case 9U: ; case 10U: tmp___0 = bnx2x_queue_send_cmd_cmn(bp, params); return (tmp___0); default: printk("\vbnx2x: [%s:%d(%s)]Unknown command: %d\n", "bnx2x_queue_send_cmd_e1x", 5058, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (unsigned int )params->cmd); return (-22); } } } static int bnx2x_queue_send_cmd_e2(struct bnx2x *bp , struct bnx2x_queue_state_params *params ) { int tmp ; int tmp___0 ; { switch ((unsigned int )params->cmd) { case 1U: tmp = bnx2x_q_send_setup_e2(bp, params); return (tmp); case 0U: ; case 2U: ; case 3U: ; case 4U: ; case 5U: ; case 6U: ; case 7U: ; case 8U: ; case 9U: ; case 10U: tmp___0 = bnx2x_queue_send_cmd_cmn(bp, params); return (tmp___0); default: printk("\vbnx2x: [%s:%d(%s)]Unknown command: %d\n", "bnx2x_queue_send_cmd_e2", 5081, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (unsigned int )params->cmd); return (-22); } } } static int bnx2x_queue_chk_transition(struct bnx2x *bp , struct bnx2x_queue_sp_obj *o , struct bnx2x_queue_state_params *params ) { enum bnx2x_q_state state ; enum bnx2x_q_state next_state ; enum bnx2x_queue_cmd cmd ; struct bnx2x_queue_update_params *update_params ; u8 next_tx_only ; int tmp ; int tmp___0 ; int tmp___1 ; int tmp___2 ; int tmp___3 ; int tmp___4 ; int tmp___5 ; int tmp___6 ; long tmp___7 ; long tmp___8 ; { state = o->state; next_state = 9; cmd = params->cmd; update_params = & params->params.update; next_tx_only = o->num_tx_only; tmp = constant_test_bit(3U, (unsigned long const volatile *)(& params->ramrod_flags)); if (tmp != 0) { o->pending = 0UL; o->next_state = 9; } else { } if (o->pending != 0UL) { printk("\vbnx2x: [%s:%d(%s)]Blocking transition since pending was %lx\n", "bnx2x_queue_chk_transition", 5127, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", o->pending); return (-16); } else { } switch ((unsigned int )state) { case 0U: ; if ((unsigned int )cmd == 0U) { next_state = 1; } else { } goto ldv_47487; case 1U: ; if ((unsigned int )cmd == 1U) { tmp___0 = constant_test_bit(5U, (unsigned long const volatile *)(& params->params.setup.flags)); if (tmp___0 != 0) { next_state = 2; } else { next_state = 5; } } else { } goto ldv_47487; case 2U: ; if ((unsigned int )cmd == 3U) { next_state = 5; } else if ((unsigned int )cmd == 10U || (unsigned int )cmd == 6U) { next_state = 2; } else if ((unsigned int )cmd == 2U) { next_state = 3; next_tx_only = 1U; } else if ((unsigned int )cmd == 7U) { next_state = 6; } else if ((unsigned int )cmd == 5U) { tmp___1 = constant_test_bit(7U, (unsigned long const volatile *)(& update_params->update_flags)); if (tmp___1 != 0) { tmp___2 = constant_test_bit(6U, (unsigned long const volatile *)(& update_params->update_flags)); if (tmp___2 == 0) { next_state = 5; } else { next_state = 2; } } else { next_state = 2; } } else { } goto ldv_47487; case 3U: ; if ((unsigned int )cmd == 9U) { next_state = 4; } else if ((unsigned int )cmd == 2U) { next_state = 3; next_tx_only = (unsigned int )o->num_tx_only + 1U; } else if ((unsigned int )cmd == 10U || (unsigned int )cmd == 6U) { next_state = 3; } else if ((unsigned int )cmd == 5U) { tmp___3 = constant_test_bit(7U, (unsigned long const volatile *)(& update_params->update_flags)); if (tmp___3 != 0) { tmp___4 = constant_test_bit(6U, (unsigned long const volatile *)(& update_params->update_flags)); if (tmp___4 == 0) { next_state = 5; } else { next_state = 3; } } else { next_state = 3; } } else { } goto ldv_47487; case 4U: ; if ((unsigned int )cmd == 8U) { next_tx_only = (unsigned int )o->num_tx_only + 255U; if ((unsigned int )next_tx_only == 0U) { next_state = 2; } else { next_state = 3; } } else { } goto ldv_47487; case 5U: ; if ((unsigned int )cmd == 4U) { next_state = 2; } else if ((unsigned int )cmd == 10U || (unsigned int )cmd == 6U) { next_state = 5; } else if ((unsigned int )cmd == 7U) { next_state = 6; } else if ((unsigned int )cmd == 5U) { tmp___5 = constant_test_bit(7U, (unsigned long const volatile *)(& update_params->update_flags)); if (tmp___5 != 0) { tmp___6 = constant_test_bit(6U, (unsigned long const volatile *)(& update_params->update_flags)); if (tmp___6 != 0) { if ((unsigned int )o->num_tx_only == 0U) { next_state = 2; } else { next_state = 3; } } else { next_state = 5; } } else { next_state = 5; } } else { } goto ldv_47487; case 6U: ; if ((unsigned int )cmd == 9U) { next_state = 7; } else { } goto ldv_47487; case 7U: ; if ((unsigned int )cmd == 8U) { next_state = 0; } else { } goto ldv_47487; default: printk("\vbnx2x: [%s:%d(%s)]Illegal state: %d\n", "bnx2x_queue_chk_transition", 5253, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (unsigned int )state); } ldv_47487: ; if ((unsigned int )next_state != 9U) { tmp___7 = ldv__builtin_expect((bp->msg_enable & 1048576) != 0, 0L); if (tmp___7 != 0L) { printk("\rbnx2x: [%s:%d(%s)]Good state transition: %d(%d)->%d\n", "bnx2x_queue_chk_transition", 5259, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (unsigned int )state, (unsigned int )cmd, (unsigned int )next_state); } else { } o->next_state = next_state; o->next_tx_only = next_tx_only; return (0); } else { } tmp___8 = ldv__builtin_expect((bp->msg_enable & 1048576) != 0, 0L); if (tmp___8 != 0L) { printk("\rbnx2x: [%s:%d(%s)]Bad state transition request: %d %d\n", "bnx2x_queue_chk_transition", 5265, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (unsigned int )state, (unsigned int )cmd); } else { } return (-22); } } void bnx2x_init_queue_obj(struct bnx2x *bp , struct bnx2x_queue_sp_obj *obj , u8 cl_id , u32 *cids , u8 cid_cnt , u8 func_id , void *rdata , dma_addr_t rdata_mapping , unsigned long type ) { long tmp ; size_t __len ; void *__ret ; { memset((void *)obj, 0, 104UL); tmp = ldv__builtin_expect((unsigned int )cid_cnt > 3U, 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 *)"/work/ldvuser/exper_fp/work/current--X--drivers--X--defaultlinux-3.10-rc1.tar--X--32_7a--X--cpachecker/linux-3.10-rc1.tar/csd_deg_dscv/8504/dscv_tempdir/dscv/ri/32_7a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sp.c.prepared"), "i" (5279), "i" (12UL)); ldv_47507: ; goto ldv_47507; } else { } __len = (unsigned long )cid_cnt * 4UL; __ret = __builtin_memcpy((void *)(& obj->cids), (void const *)cids, __len); obj->max_cos = cid_cnt; obj->cl_id = cl_id; obj->func_id = func_id; obj->rdata = rdata; obj->rdata_mapping = rdata_mapping; obj->type = type; obj->next_state = 9; if (bp->common.chip_id >> 16 == 5710U || (bp->common.chip_id >> 16 == 5711U || bp->common.chip_id >> 16 == 5712U)) { obj->send_cmd = & bnx2x_queue_send_cmd_e1x; } else { obj->send_cmd = & bnx2x_queue_send_cmd_e2; } obj->check_transition = & bnx2x_queue_chk_transition; obj->complete_cmd = & bnx2x_queue_comp_cmd; obj->wait_comp = & bnx2x_queue_wait_comp; obj->set_pending = & bnx2x_queue_set_pending; return; } } int bnx2x_get_q_logical_state(struct bnx2x *bp , struct bnx2x_queue_sp_obj *obj ) { { switch ((unsigned int )obj->state) { case 2U: ; case 3U: ; return (0); case 0U: ; case 1U: ; case 4U: ; case 5U: ; case 6U: ; case 7U: ; case 8U: ; return (1); default: ; return (-22); } } } enum bnx2x_func_state bnx2x_func_get_state(struct bnx2x *bp , struct bnx2x_func_sp_obj *o ) { { if (o->pending != 0UL) { return (4); } else { } __asm__ volatile ("lfence": : : "memory"); return (o->state); } } static int bnx2x_func_wait_comp(struct bnx2x *bp , struct bnx2x_func_sp_obj *o , enum bnx2x_func_cmd cmd ) { int tmp ; { tmp = bnx2x_state_wait(bp, (int )cmd, & o->pending); return (tmp); } } __inline static int bnx2x_func_state_change_comp(struct bnx2x *bp , struct bnx2x_func_sp_obj *o , enum bnx2x_func_cmd cmd ) { unsigned long cur_pending ; int tmp ; long tmp___0 ; { cur_pending = o->pending; tmp = test_and_clear_bit((int )cmd, (unsigned long volatile *)(& cur_pending)); if (tmp == 0) { printk("\vbnx2x: [%s:%d(%s)]Bad MC reply %d for func %d in state %d pending 0x%lx, next_state %d\n", "bnx2x_func_state_change_comp", 5366, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (unsigned int )cmd, (int )bp->pfid, (unsigned int )o->state, cur_pending, (unsigned int )o->next_state); return (-22); } else { } tmp___0 = ldv__builtin_expect((bp->msg_enable & 1048576) != 0, 0L); if (tmp___0 != 0L) { printk("\rbnx2x: [%s:%d(%s)]Completing command %d for func %d, setting state to %d\n", "bnx2x_func_state_change_comp", 5372, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (unsigned int )cmd, (int )bp->pfid, (unsigned int )o->next_state); } else { } o->state = o->next_state; o->next_state = 4; __asm__ volatile ("sfence": : : "memory"); clear_bit((int )cmd, (unsigned long volatile *)(& o->pending)); __asm__ volatile ("": : : "memory"); return (0); } } static int bnx2x_func_comp_cmd(struct bnx2x *bp , struct bnx2x_func_sp_obj *o , enum bnx2x_func_cmd cmd ) { int rc ; int tmp ; { tmp = bnx2x_func_state_change_comp(bp, o, cmd); rc = tmp; return (rc); } } static int bnx2x_func_chk_transition(struct bnx2x *bp , struct bnx2x_func_sp_obj *o , struct bnx2x_func_state_params *params ) { enum bnx2x_func_state state ; enum bnx2x_func_state next_state ; enum bnx2x_func_cmd cmd ; int tmp ; int tmp___0 ; int tmp___1 ; int tmp___2 ; int tmp___3 ; long tmp___4 ; long tmp___5 ; { state = o->state; next_state = 4; cmd = params->cmd; tmp = constant_test_bit(3U, (unsigned long const volatile *)(& params->ramrod_flags)); if (tmp != 0) { o->pending = 0UL; o->next_state = 4; } else { } if (o->pending != 0UL) { return (-16); } else { } switch ((unsigned int )state) { case 0U: ; if ((unsigned int )cmd == 0U) { next_state = 1; } else { } goto ldv_47556; case 1U: ; if ((unsigned int )cmd == 1U) { next_state = 2; } else if ((unsigned int )cmd == 3U) { next_state = 0; } else { } goto ldv_47556; case 2U: ; if ((unsigned int )cmd == 2U) { next_state = 1; } else if ((unsigned int )cmd == 4U) { tmp___2 = constant_test_bit(2U, (unsigned long const volatile *)(& o->pending)); if (tmp___2 == 0) { next_state = 2; } else { goto _L___1; } } else _L___1: /* CIL Label */ if ((unsigned int )cmd == 5U) { tmp___1 = constant_test_bit(2U, (unsigned long const volatile *)(& o->pending)); if (tmp___1 == 0) { next_state = 2; } else { goto _L___0; } } else _L___0: /* CIL Label */ if ((unsigned int )cmd == 8U) { tmp___0 = constant_test_bit(2U, (unsigned long const volatile *)(& o->pending)); if (tmp___0 == 0) { next_state = 2; } else { goto _L; } } else _L: /* CIL Label */ if ((unsigned int )cmd == 6U) { next_state = 3; } else { } goto ldv_47556; case 3U: ; if ((unsigned int )cmd == 8U) { tmp___3 = constant_test_bit(2U, (unsigned long const volatile *)(& o->pending)); if (tmp___3 == 0) { next_state = 3; } else { goto _L___2; } } else _L___2: /* CIL Label */ if ((unsigned int )cmd == 7U) { next_state = 2; } else { } goto ldv_47556; default: printk("\vbnx2x: [%s:%d(%s)]Unknown state: %d\n", "bnx2x_func_chk_transition", 5496, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (unsigned int )state); } ldv_47556: ; if ((unsigned int )next_state != 4U) { tmp___4 = ldv__builtin_expect((bp->msg_enable & 1048576) != 0, 0L); if (tmp___4 != 0L) { printk("\rbnx2x: [%s:%d(%s)]Good function state transition: %d(%d)->%d\n", "bnx2x_func_chk_transition", 5502, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (unsigned int )state, (unsigned int )cmd, (unsigned int )next_state); } else { } o->next_state = next_state; return (0); } else { } tmp___5 = ldv__builtin_expect((bp->msg_enable & 1048576) != 0, 0L); if (tmp___5 != 0L) { printk("\rbnx2x: [%s:%d(%s)]Bad function state transition request: %d %d\n", "bnx2x_func_chk_transition", 5508, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (unsigned int )state, (unsigned int )cmd); } else { } return (-22); } } __inline static int bnx2x_func_init_func(struct bnx2x *bp , struct bnx2x_func_sp_drv_ops const *drv ) { int tmp ; { tmp = (*(drv->init_hw_func))(bp); return (tmp); } } __inline static int bnx2x_func_init_port(struct bnx2x *bp , struct bnx2x_func_sp_drv_ops const *drv ) { int rc ; int tmp ; int tmp___0 ; { tmp = (*(drv->init_hw_port))(bp); rc = tmp; if (rc != 0) { return (rc); } else { } tmp___0 = bnx2x_func_init_func(bp, drv); return (tmp___0); } } __inline static int bnx2x_func_init_cmn_chip(struct bnx2x *bp , struct bnx2x_func_sp_drv_ops const *drv ) { int rc ; int tmp ; int tmp___0 ; { tmp = (*(drv->init_hw_cmn_chip))(bp); rc = tmp; if (rc != 0) { return (rc); } else { } tmp___0 = bnx2x_func_init_port(bp, drv); return (tmp___0); } } __inline static int bnx2x_func_init_cmn(struct bnx2x *bp , struct bnx2x_func_sp_drv_ops const *drv ) { int rc ; int tmp ; int tmp___0 ; { tmp = (*(drv->init_hw_cmn))(bp); rc = tmp; if (rc != 0) { return (rc); } else { } tmp___0 = bnx2x_func_init_port(bp, drv); return (tmp___0); } } static int bnx2x_func_hw_init(struct bnx2x *bp , struct bnx2x_func_state_params *params ) { u32 load_code ; struct bnx2x_func_sp_obj *o ; struct bnx2x_func_sp_drv_ops const *drv ; int rc ; long tmp ; { load_code = params->params.hw_init.load_phase; o = params->f_obj; drv = (struct bnx2x_func_sp_drv_ops const *)o->drv; rc = 0; tmp = ldv__builtin_expect((bp->msg_enable & 1048576) != 0, 0L); if (tmp != 0L) { printk("\rbnx2x: [%s:%d(%s)]function %d load_code %x\n", "bnx2x_func_hw_init", 5599, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )bp->pf_num, load_code); } else { } rc = (*(drv->gunzip_init))(bp); if (rc != 0) { return (rc); } else { } rc = (*(drv->init_fw))(bp); if (rc != 0) { printk("\vbnx2x: [%s:%d(%s)]Error loading firmware\n", "bnx2x_func_hw_init", 5609, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); goto init_err; } else { } switch (load_code) { case 269680640U: rc = bnx2x_func_init_cmn_chip(bp, drv); if (rc != 0) { goto init_err; } else { } goto ldv_47592; case 269484032U: rc = bnx2x_func_init_cmn(bp, drv); if (rc != 0) { goto init_err; } else { } goto ldv_47592; case 269549568U: rc = bnx2x_func_init_port(bp, drv); if (rc != 0) { goto init_err; } else { } goto ldv_47592; case 269615104U: rc = bnx2x_func_init_func(bp, drv); if (rc != 0) { goto init_err; } else { } goto ldv_47592; default: printk("\vbnx2x: [%s:%d(%s)]Unknown load_code (0x%x) from MCP\n", "bnx2x_func_hw_init", 5640, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", load_code); rc = -22; } ldv_47592: ; init_err: (*(drv->gunzip_end))(bp); if (rc == 0) { (*(o->complete_cmd))(bp, o, 0); } else { } return (rc); } } __inline static void bnx2x_func_reset_func(struct bnx2x *bp , struct bnx2x_func_sp_drv_ops const *drv ) { { (*(drv->reset_hw_func))(bp); return; } } __inline static void bnx2x_func_reset_port(struct bnx2x *bp , struct bnx2x_func_sp_drv_ops const *drv ) { { (*(drv->reset_hw_port))(bp); bnx2x_func_reset_func(bp, drv); return; } } __inline static void bnx2x_func_reset_cmn(struct bnx2x *bp , struct bnx2x_func_sp_drv_ops const *drv ) { { bnx2x_func_reset_port(bp, drv); (*(drv->reset_hw_cmn))(bp); return; } } __inline static int bnx2x_func_hw_reset(struct bnx2x *bp , struct bnx2x_func_state_params *params ) { u32 reset_phase ; struct bnx2x_func_sp_obj *o ; struct bnx2x_func_sp_drv_ops const *drv ; long tmp ; { reset_phase = params->params.hw_reset.reset_phase; o = params->f_obj; drv = (struct bnx2x_func_sp_drv_ops const *)o->drv; tmp = ldv__builtin_expect((bp->msg_enable & 1048576) != 0, 0L); if (tmp != 0L) { printk("\rbnx2x: [%s:%d(%s)]function %d reset_phase %x\n", "bnx2x_func_hw_reset", 5719, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )bp->pf_num, reset_phase); } else { } switch (reset_phase) { case 537919488U: bnx2x_func_reset_cmn(bp, drv); goto ldv_47618; case 537985024U: bnx2x_func_reset_port(bp, drv); goto ldv_47618; case 538050560U: bnx2x_func_reset_func(bp, drv); goto ldv_47618; default: printk("\vbnx2x: [%s:%d(%s)]Unknown reset_phase (0x%x) from MCP\n", "bnx2x_func_hw_reset", 5733, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", reset_phase); goto ldv_47618; } ldv_47618: (*(o->complete_cmd))(bp, o, 3); return (0); } } __inline static int bnx2x_func_send_start(struct bnx2x *bp , struct bnx2x_func_state_params *params ) { struct bnx2x_func_sp_obj *o ; struct function_start_data *rdata ; dma_addr_t data_mapping ; struct bnx2x_func_start_params *start_params ; int tmp ; { o = params->f_obj; rdata = (struct function_start_data *)o->rdata; data_mapping = o->rdata_mapping; start_params = & params->params.start; memset((void *)rdata, 0, 16UL); rdata->function_mode = (unsigned char )start_params->mf_mode; rdata->sd_vlan_tag = start_params->sd_vlan_tag; rdata->path_id = bp->common.chip_id >> 16 != 5710U && (bp->common.chip_id >> 16 != 5711U && bp->common.chip_id >> 16 != 5712U) ? (unsigned int )bp->pf_num & 1U : 0U; rdata->network_cos_mode = start_params->network_cos_mode; rdata->gre_tunnel_mode = start_params->gre_tunnel_mode; rdata->gre_tunnel_rss = start_params->gre_tunnel_rss; tmp = bnx2x_sp_post(bp, 1, 0, (unsigned int )(data_mapping >> 32), (unsigned int )data_mapping, 8); return (tmp); } } __inline static int bnx2x_func_send_switch_update(struct bnx2x *bp , struct bnx2x_func_state_params *params ) { struct bnx2x_func_sp_obj *o ; struct function_update_data *rdata ; dma_addr_t data_mapping ; struct bnx2x_func_switch_update_params *switch_update_params ; int tmp ; { o = params->f_obj; rdata = (struct function_update_data *)o->rdata; data_mapping = o->rdata_mapping; switch_update_params = & params->params.switch_update; memset((void *)rdata, 0, 24UL); rdata->tx_switch_suspend_change_flg = 1U; rdata->tx_switch_suspend = switch_update_params->suspend; rdata->echo = 0U; tmp = bnx2x_sp_post(bp, 3, 0, (unsigned int )(data_mapping >> 32), (unsigned int )data_mapping, 8); return (tmp); } } __inline static int bnx2x_func_send_afex_update(struct bnx2x *bp , struct bnx2x_func_state_params *params ) { struct bnx2x_func_sp_obj *o ; struct function_update_data *rdata ; dma_addr_t data_mapping ; struct bnx2x_func_afex_update_params *afex_update_params ; long tmp ; int tmp___0 ; { o = params->f_obj; rdata = (struct function_update_data *)o->afex_rdata; data_mapping = o->afex_rdata_mapping; afex_update_params = & params->params.afex_update; memset((void *)rdata, 0, 24UL); rdata->vif_id_change_flg = 1U; rdata->vif_id = afex_update_params->vif_id; rdata->afex_default_vlan_change_flg = 1U; rdata->afex_default_vlan = afex_update_params->afex_default_vlan; rdata->allowed_priorities_change_flg = 1U; rdata->allowed_priorities = afex_update_params->allowed_priorities; rdata->echo = 1U; tmp = ldv__builtin_expect((bp->msg_enable & 1048576) != 0, 0L); if (tmp != 0L) { printk("\rbnx2x: [%s:%d(%s)]afex: sending func_update vif_id 0x%x dvlan 0x%x prio 0x%x\n", "bnx2x_func_send_afex_update", 5827, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )rdata->vif_id, (int )rdata->afex_default_vlan, (int )rdata->allowed_priorities); } else { } tmp___0 = bnx2x_sp_post(bp, 3, 0, (unsigned int )(data_mapping >> 32), (unsigned int )data_mapping, 8); return (tmp___0); } } __inline static int bnx2x_func_send_afex_viflists(struct bnx2x *bp , struct bnx2x_func_state_params *params ) { struct bnx2x_func_sp_obj *o ; struct afex_vif_list_ramrod_data *rdata ; struct bnx2x_func_afex_viflists_params *afex_vif_params ; u64 *p_rdata ; long tmp ; int tmp___0 ; { o = params->f_obj; rdata = (struct afex_vif_list_ramrod_data *)o->afex_rdata; afex_vif_params = & params->params.afex_viflists; p_rdata = (u64 *)rdata; memset((void *)rdata, 0, 8UL); rdata->vif_list_index = afex_vif_params->vif_list_index; rdata->func_bit_map = afex_vif_params->func_bit_map; rdata->afex_vif_list_command = afex_vif_params->afex_vif_list_command; rdata->func_to_clear = afex_vif_params->func_to_clear; rdata->echo = afex_vif_params->afex_vif_list_command; tmp = ldv__builtin_expect((bp->msg_enable & 1048576) != 0, 0L); if (tmp != 0L) { printk("\rbnx2x: [%s:%d(%s)]afex: ramrod lists, cmd 0x%x index 0x%x func_bit_map 0x%x func_to_clr 0x%x\n", "bnx2x_func_send_afex_viflists", 5865, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )rdata->afex_vif_list_command, (int )rdata->vif_list_index, (int )rdata->func_bit_map, (int )rdata->func_to_clear); } else { } tmp___0 = bnx2x_sp_post(bp, 9, 0, (unsigned int )(*p_rdata >> 32), (unsigned int )*p_rdata, 8); return (tmp___0); } } __inline static int bnx2x_func_send_stop(struct bnx2x *bp , struct bnx2x_func_state_params *params ) { int tmp ; { tmp = bnx2x_sp_post(bp, 2, 0, 0U, 0U, 8); return (tmp); } } __inline static int bnx2x_func_send_tx_stop(struct bnx2x *bp , struct bnx2x_func_state_params *params ) { int tmp ; { tmp = bnx2x_sp_post(bp, 7, 0, 0U, 0U, 8); return (tmp); } } __inline static int bnx2x_func_send_tx_start(struct bnx2x *bp , struct bnx2x_func_state_params *params ) { struct bnx2x_func_sp_obj *o ; struct flow_control_configuration *rdata ; dma_addr_t data_mapping ; struct bnx2x_func_tx_start_params *tx_start_params ; int i ; int tmp ; { o = params->f_obj; rdata = (struct flow_control_configuration *)o->rdata; data_mapping = o->rdata_mapping; tx_start_params = & params->params.tx_start; memset((void *)rdata, 0, 40UL); rdata->dcb_enabled = tx_start_params->dcb_enabled; rdata->dcb_version = tx_start_params->dcb_version; rdata->dont_add_pri_0_en = tx_start_params->dont_add_pri_0_en; i = 0; goto ldv_47676; ldv_47675: rdata->traffic_type_to_priority_cos[i] = tx_start_params->traffic_type_to_priority_cos[i]; i = i + 1; ldv_47676: ; if ((unsigned int )i <= 7U) { goto ldv_47675; } else { } tmp = bnx2x_sp_post(bp, 8, 0, (unsigned int )(data_mapping >> 32), (unsigned int )data_mapping, 8); return (tmp); } } static int bnx2x_func_send_cmd(struct bnx2x *bp , struct bnx2x_func_state_params *params ) { 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 ; { switch ((unsigned int )params->cmd) { case 0U: tmp = bnx2x_func_hw_init(bp, params); return (tmp); case 1U: tmp___0 = bnx2x_func_send_start(bp, params); return (tmp___0); case 2U: tmp___1 = bnx2x_func_send_stop(bp, params); return (tmp___1); case 3U: tmp___2 = bnx2x_func_hw_reset(bp, params); return (tmp___2); case 4U: tmp___3 = bnx2x_func_send_afex_update(bp, params); return (tmp___3); case 5U: tmp___4 = bnx2x_func_send_afex_viflists(bp, params); return (tmp___4); case 6U: tmp___5 = bnx2x_func_send_tx_stop(bp, params); return (tmp___5); case 7U: tmp___6 = bnx2x_func_send_tx_start(bp, params); return (tmp___6); case 8U: tmp___7 = bnx2x_func_send_switch_update(bp, params); return (tmp___7); default: printk("\vbnx2x: [%s:%d(%s)]Unknown command: %d\n", "bnx2x_func_send_cmd", 5935, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (unsigned int )params->cmd); return (-22); } } } void bnx2x_init_func_obj(struct bnx2x *bp , struct bnx2x_func_sp_obj *obj , void *rdata , dma_addr_t rdata_mapping , void *afex_rdata , dma_addr_t afex_rdata_mapping , struct bnx2x_func_sp_drv_ops *drv_iface ) { struct lock_class_key __key ; { memset((void *)obj, 0, 256UL); __mutex_init(& obj->one_pending_mutex, "&obj->one_pending_mutex", & __key); obj->rdata = rdata; obj->rdata_mapping = rdata_mapping; obj->afex_rdata = afex_rdata; obj->afex_rdata_mapping = afex_rdata_mapping; obj->send_cmd = & bnx2x_func_send_cmd; obj->check_transition = & bnx2x_func_chk_transition; obj->complete_cmd = & bnx2x_func_comp_cmd; obj->wait_comp = & bnx2x_func_wait_comp; obj->drv = drv_iface; return; } } int bnx2x_func_state_change(struct bnx2x *bp , struct bnx2x_func_state_params *params ) { struct bnx2x_func_sp_obj *o ; int rc ; int cnt ; enum bnx2x_func_cmd cmd ; unsigned long *pending ; int tmp ; int tmp___0 ; int tmp___1 ; int tmp___2 ; { o = params->f_obj; cnt = 300; cmd = params->cmd; pending = & o->pending; ldv_mutex_lock_121(& o->one_pending_mutex); rc = (*(o->check_transition))(bp, o, params); if (rc == -16) { tmp = constant_test_bit(7U, (unsigned long const volatile *)(& params->ramrod_flags)); if (tmp != 0) { goto ldv_47713; ldv_47712: ldv_mutex_unlock_122(& o->one_pending_mutex); msleep(10U); ldv_mutex_lock_123(& o->one_pending_mutex); rc = (*(o->check_transition))(bp, o, params); ldv_47713: ; if (rc == -16) { cnt = cnt - 1; if (cnt > 0) { goto ldv_47712; } else { goto ldv_47714; } } else { } ldv_47714: ; if (rc == -16) { ldv_mutex_unlock_124(& o->one_pending_mutex); printk("\vbnx2x: [%s:%d(%s)]timeout waiting for previous ramrod completion\n", "bnx2x_func_state_change", 5997, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); return (rc); } else { } } else { goto _L; } } else _L: /* CIL Label */ if (rc != 0) { ldv_mutex_unlock_125(& o->one_pending_mutex); return (rc); } else { } set_bit((unsigned int )cmd, (unsigned long volatile *)pending); tmp___1 = constant_test_bit(3U, (unsigned long const volatile *)(& params->ramrod_flags)); if (tmp___1 != 0) { bnx2x_func_state_change_comp(bp, o, cmd); ldv_mutex_unlock_126(& o->one_pending_mutex); } else { rc = (*(o->send_cmd))(bp, params); ldv_mutex_unlock_127(& o->one_pending_mutex); if (rc != 0) { o->next_state = 4; clear_bit((int )cmd, (unsigned long volatile *)pending); __asm__ volatile ("": : : "memory"); return (rc); } else { } tmp___0 = constant_test_bit(2U, (unsigned long const volatile *)(& params->ramrod_flags)); if (tmp___0 != 0) { rc = (*(o->wait_comp))(bp, o, cmd); if (rc != 0) { return (rc); } else { } return (0); } else { } } tmp___2 = variable_test_bit((int )cmd, (unsigned long const volatile *)pending); return (tmp___2 != 0); } } void ldv_mutex_lock_113(struct mutex *ldv_func_arg1 ) { { ldv_mutex_lock_lock(ldv_func_arg1); mutex_lock(ldv_func_arg1); return; } } void ldv_mutex_unlock_114(struct mutex *ldv_func_arg1 ) { { ldv_mutex_unlock_lock(ldv_func_arg1); mutex_unlock(ldv_func_arg1); return; } } void ldv_mutex_lock_115(struct mutex *ldv_func_arg1 ) { { ldv_mutex_lock_mutex_of_device(ldv_func_arg1); mutex_lock(ldv_func_arg1); return; } } int ldv_mutex_trylock_116(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_117(struct mutex *ldv_func_arg1 ) { { ldv_mutex_unlock_mutex_of_device(ldv_func_arg1); mutex_unlock(ldv_func_arg1); return; } } void ldv_mutex_lock_121(struct mutex *ldv_func_arg1 ) { { ldv_mutex_lock_one_pending_mutex_of_bnx2x_func_sp_obj(ldv_func_arg1); mutex_lock(ldv_func_arg1); return; } } void ldv_mutex_unlock_122(struct mutex *ldv_func_arg1 ) { { ldv_mutex_unlock_one_pending_mutex_of_bnx2x_func_sp_obj(ldv_func_arg1); mutex_unlock(ldv_func_arg1); return; } } void ldv_mutex_lock_123(struct mutex *ldv_func_arg1 ) { { ldv_mutex_lock_one_pending_mutex_of_bnx2x_func_sp_obj(ldv_func_arg1); mutex_lock(ldv_func_arg1); return; } } void ldv_mutex_unlock_124(struct mutex *ldv_func_arg1 ) { { ldv_mutex_unlock_one_pending_mutex_of_bnx2x_func_sp_obj(ldv_func_arg1); mutex_unlock(ldv_func_arg1); return; } } void ldv_mutex_unlock_125(struct mutex *ldv_func_arg1 ) { { ldv_mutex_unlock_one_pending_mutex_of_bnx2x_func_sp_obj(ldv_func_arg1); mutex_unlock(ldv_func_arg1); return; } } void ldv_mutex_unlock_126(struct mutex *ldv_func_arg1 ) { { ldv_mutex_unlock_one_pending_mutex_of_bnx2x_func_sp_obj(ldv_func_arg1); mutex_unlock(ldv_func_arg1); return; } } void ldv_mutex_unlock_127(struct mutex *ldv_func_arg1 ) { { ldv_mutex_unlock_one_pending_mutex_of_bnx2x_func_sp_obj(ldv_func_arg1); mutex_unlock(ldv_func_arg1); return; } } extern void warn_slowpath_fmt(char const * , int const , char const * , ...) ; __inline static int mutex_is_locked(struct mutex *lock ) { int tmp ; { tmp = atomic_read((atomic_t const *)(& lock->count)); return (tmp != 1); } } __inline static int ldv_mutex_is_locked_148(struct mutex *lock ) ; __inline static int ldv_mutex_is_locked_149(struct mutex *lock ) ; __inline static int ldv_mutex_is_locked_150(struct mutex *lock ) ; int ldv_mutex_trylock_146(struct mutex *ldv_func_arg1 ) ; void ldv_mutex_unlock_144(struct mutex *ldv_func_arg1 ) ; void ldv_mutex_unlock_147(struct mutex *ldv_func_arg1 ) ; void ldv_mutex_unlock_152(struct mutex *ldv_func_arg1 ) ; void ldv_mutex_lock_143(struct mutex *ldv_func_arg1 ) ; void ldv_mutex_lock_145(struct mutex *ldv_func_arg1 ) ; void ldv_mutex_lock_151(struct mutex *ldv_func_arg1 ) ; int ldv_mutex_is_locked_op_mutex_of_bnx2x_virtf(struct mutex *lock ) ; void ldv_mutex_lock_vf2pf_mutex_of_bnx2x(struct mutex *lock ) ; void ldv_mutex_unlock_vf2pf_mutex_of_bnx2x(struct mutex *lock ) ; void bnx2x_lock_vf_pf_channel(struct bnx2x *bp , struct bnx2x_virtf *vf , enum channel_tlvs tlv ) ; void bnx2x_unlock_vf_pf_channel(struct bnx2x *bp , struct bnx2x_virtf *vf , enum channel_tlvs expected_tlv ) ; __inline static struct bnx2x_vf_queue *vfq_get(struct bnx2x_virtf *vf , u8 index ) { { return (vf->vfqs + (unsigned long )index); } } __inline static u8 vf_igu_sb(struct bnx2x_virtf *vf , u16 sb_idx ) { { return ((int )vf->igu_base_id + (int )((u8 )sb_idx)); } } __inline static u8 vf_hc_qzone(struct bnx2x_virtf *vf , u16 sb_idx ) { u8 tmp ; { tmp = vf_igu_sb(vf, (int )sb_idx); return (tmp); } } static u8 vfq_cl_id(struct bnx2x_virtf *vf , struct bnx2x_vf_queue *q ) { { return ((int )vf->igu_base_id + (int )((u8 )q->index)); } } __inline static u8 vfq_qzone_id(struct bnx2x_virtf *vf , struct bnx2x_vf_queue *q ) { u8 tmp ; { tmp = vfq_cl_id(vf, q); return (tmp); } } void bnx2x_vf_enable_mbx(struct bnx2x *bp , u8 abs_vfid ) ; int bnx2x_vf_acquire(struct bnx2x *bp , struct bnx2x_virtf *vf , struct vf_pf_resc_request *resc ) ; int bnx2x_vf_init(struct bnx2x *bp , struct bnx2x_virtf *vf , dma_addr_t *sb_map ) ; __inline static struct bnx2x_vfop *bnx2x_vfop_cur(struct bnx2x *bp , struct bnx2x_virtf *vf ) { int __ret_warn_on ; int tmp ; long tmp___0 ; int __ret_warn_on___0 ; int tmp___1 ; long tmp___2 ; struct list_head const *__mptr ; { tmp = ldv_mutex_is_locked_148(& vf->op_mutex); __ret_warn_on = tmp == 0; tmp___0 = ldv__builtin_expect(__ret_warn_on != 0, 0L); if (tmp___0 != 0L) { warn_slowpath_fmt("/work/ldvuser/exper_fp/inst/current/envs/linux-3.10-rc1.tar/linux-3.10-rc1/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.h", 517, "about to access vf op linked list but mutex was not locked!"); } else { } ldv__builtin_expect(__ret_warn_on != 0, 0L); tmp___1 = list_empty((struct list_head const *)(& vf->op_list_head)); __ret_warn_on___0 = tmp___1 != 0; tmp___2 = ldv__builtin_expect(__ret_warn_on___0 != 0, 0L); if (tmp___2 != 0L) { warn_slowpath_null("/work/ldvuser/exper_fp/inst/current/envs/linux-3.10-rc1.tar/linux-3.10-rc1/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.h", 518); } else { } ldv__builtin_expect(__ret_warn_on___0 != 0, 0L); __mptr = (struct list_head const *)vf->op_list_head.next; return ((struct bnx2x_vfop *)__mptr); } } __inline static struct bnx2x_vfop *bnx2x_vfop_add(struct bnx2x *bp , struct bnx2x_virtf *vf ) { struct bnx2x_vfop *vfop ; void *tmp ; int __ret_warn_on ; int tmp___0 ; long tmp___1 ; { tmp = kzalloc(64UL, 208U); vfop = (struct bnx2x_vfop *)tmp; tmp___0 = ldv_mutex_is_locked_149(& vf->op_mutex); __ret_warn_on = tmp___0 == 0; tmp___1 = ldv__builtin_expect(__ret_warn_on != 0, 0L); if (tmp___1 != 0L) { warn_slowpath_fmt("/work/ldvuser/exper_fp/inst/current/envs/linux-3.10-rc1.tar/linux-3.10-rc1/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.h", 527, "about to access vf op linked list but mutex was not locked!"); } else { } ldv__builtin_expect(__ret_warn_on != 0, 0L); if ((unsigned long )vfop != (unsigned long )((struct bnx2x_vfop *)0)) { INIT_LIST_HEAD(& vfop->link); list_add(& vfop->link, & vf->op_list_head); } else { } return (vfop); } } __inline static void bnx2x_vfop_end(struct bnx2x *bp , struct bnx2x_virtf *vf , struct bnx2x_vfop *vfop ) { long tmp ; long tmp___0 ; int __ret_warn_on ; int tmp___1 ; long tmp___2 ; long tmp___3 ; long tmp___4 ; struct bnx2x_vfop *cur_vfop ; long tmp___5 ; long tmp___6 ; int tmp___7 ; long tmp___8 ; long tmp___9 ; long tmp___10 ; int tmp___11 ; { tmp = ldv__builtin_expect((bp->msg_enable & 8388608) != 0, 0L); if (tmp != 0L) { printk("\r[%s:%d(%s)]rc was %d\n", "bnx2x_vfop_end", 539, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", vfop->rc); } else { } if (vfop->rc >= 0) { vfop->rc = 0; } else { } tmp___0 = ldv__builtin_expect((bp->msg_enable & 8388608) != 0, 0L); if (tmp___0 != 0L) { printk("\r[%s:%d(%s)]rc is now %d\n", "bnx2x_vfop_end", 542, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", vfop->rc); } else { } tmp___1 = ldv_mutex_is_locked_150(& vf->op_mutex); __ret_warn_on = tmp___1 == 0; tmp___2 = ldv__builtin_expect(__ret_warn_on != 0, 0L); if (tmp___2 != 0L) { warn_slowpath_fmt("/work/ldvuser/exper_fp/inst/current/envs/linux-3.10-rc1.tar/linux-3.10-rc1/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.h", 548, "about to access vf op linked list but mutex was not locked!"); } else { } ldv__builtin_expect(__ret_warn_on != 0, 0L); list_del(& vfop->link); tmp___7 = list_empty((struct list_head const *)(& vf->op_list_head)); if (tmp___7 != 0) { tmp___3 = ldv__builtin_expect((bp->msg_enable & 8388608) != 0, 0L); if (tmp___3 != 0L) { printk("\r[%s:%d(%s)]list was empty %d\n", "bnx2x_vfop_end", 552, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", vfop->rc); } else { } vf->op_rc = vfop->rc; tmp___4 = ldv__builtin_expect((bp->msg_enable & 8388608) != 0, 0L); if (tmp___4 != 0L) { printk("\r[%s:%d(%s)]copying rc vf->op_rc %d, vfop->rc %d\n", "bnx2x_vfop_end", 555, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", vf->op_rc, vfop->rc); } else { } } else { tmp___5 = ldv__builtin_expect((bp->msg_enable & 8388608) != 0, 0L); if (tmp___5 != 0L) { printk("\r[%s:%d(%s)]list not empty %d\n", "bnx2x_vfop_end", 559, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", vfop->rc); } else { } cur_vfop = bnx2x_vfop_cur(bp, vf); cur_vfop->rc = vfop->rc; tmp___6 = ldv__builtin_expect((bp->msg_enable & 8388608) != 0, 0L); if (tmp___6 != 0L) { printk("\r[%s:%d(%s)]copying rc vf->op_rc %d, vfop->rc %d\n", "bnx2x_vfop_end", 563, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", vf->op_rc, vfop->rc); } else { } } if ((unsigned long )vfop->done != (unsigned long )((void (*)(struct bnx2x * , struct bnx2x_virtf * ))0)) { tmp___8 = ldv__builtin_expect((bp->msg_enable & 8388608) != 0, 0L); if (tmp___8 != 0L) { printk("\r[%s:%d(%s)]calling done handler\n", "bnx2x_vfop_end", 568, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } (*(vfop->done))(bp, vf); } else { bnx2x_unlock_vf_pf_channel(bp, vf, 8); } tmp___9 = ldv__builtin_expect((bp->msg_enable & 8388608) != 0, 0L); if (tmp___9 != 0L) { printk("\r[%s:%d(%s)]done handler complete. vf->op_rc %d, vfop->rc %d\n", "bnx2x_vfop_end", 578, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", vf->op_rc, vfop->rc); } else { } tmp___11 = list_empty((struct list_head const *)(& vf->op_list_head)); if (tmp___11 != 0) { tmp___10 = ldv__builtin_expect((bp->msg_enable & 8388608) != 0, 0L); if (tmp___10 != 0L) { printk("\r[%s:%d(%s)]list was empty after done %d\n", "bnx2x_vfop_end", 584, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", vfop->rc); } else { } vf->op_wait_blocking = 0; } else { } kfree((void const *)vfop); return; } } __inline static int bnx2x_vfop_wait_blocking(struct bnx2x *bp , struct bnx2x_virtf *vf ) { int cnt ; int tmp ; { cnt = 5000; __might_sleep("/work/ldvuser/exper_fp/inst/current/envs/linux-3.10-rc1.tar/linux-3.10-rc1/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.h", 597, 0); goto ldv_44245; ldv_44244: ; if (! vf->op_wait_blocking) { return (0); } else { } usleep_range(1000UL, 2000UL); if (bp->panic != 0) { return (-5); } else { } ldv_44245: tmp = cnt; cnt = cnt - 1; if (tmp != 0) { goto ldv_44244; } else { } return (-16); } } __inline static int bnx2x_vfop_transition(struct bnx2x *bp , struct bnx2x_virtf *vf , void (*transition)(struct bnx2x * , struct bnx2x_virtf * ) , bool block ) { int tmp ; { if ((int )block) { vf->op_wait_blocking = 1; } else { } (*transition)(bp, vf); if ((int )block) { tmp = bnx2x_vfop_wait_blocking(bp, vf); return (tmp); } else { } return (0); } } void bnx2x_vfop_qctor_dump_tx(struct bnx2x *bp , struct bnx2x_virtf *vf , struct bnx2x_queue_init_params *init_params , struct bnx2x_queue_setup_params *setup_params , u16 q_idx , u16 sb_idx ) ; void bnx2x_vfop_qctor_dump_rx(struct bnx2x *bp , struct bnx2x_virtf *vf , struct bnx2x_queue_init_params *init_params , struct bnx2x_queue_setup_params *setup_params , u16 q_idx , u16 sb_idx ) ; void bnx2x_vfop_qctor_prep(struct bnx2x *bp , struct bnx2x_virtf *vf , struct bnx2x_vf_queue *q , struct bnx2x_vfop_qctor_params *p , unsigned long q_type ) ; int bnx2x_vfop_mac_list_cmd(struct bnx2x *bp , struct bnx2x_virtf *vf , struct bnx2x_vfop_cmd *cmd , struct bnx2x_vfop_filters *macs , int qid , bool drv_only ) ; int bnx2x_vfop_vlan_list_cmd(struct bnx2x *bp , struct bnx2x_virtf *vf , struct bnx2x_vfop_cmd *cmd , struct bnx2x_vfop_filters *vlans , int qid , bool drv_only ) ; int bnx2x_vfop_qsetup_cmd(struct bnx2x *bp , struct bnx2x_virtf *vf , struct bnx2x_vfop_cmd *cmd , int qid ) ; int bnx2x_vfop_qdown_cmd(struct bnx2x *bp , struct bnx2x_virtf *vf , struct bnx2x_vfop_cmd *cmd , int qid ) ; int bnx2x_vfop_mcast_cmd(struct bnx2x *bp , struct bnx2x_virtf *vf , struct bnx2x_vfop_cmd *cmd , bnx2x_mac_addr_t *mcasts , int mcast_num , bool drv_only ) ; int bnx2x_vfop_rxmode_cmd(struct bnx2x *bp , struct bnx2x_virtf *vf , struct bnx2x_vfop_cmd *cmd , int qid , unsigned long accept_flags ) ; int bnx2x_vfop_close_cmd(struct bnx2x *bp , struct bnx2x_virtf *vf , struct bnx2x_vfop_cmd *cmd ) ; int bnx2x_vfop_release_cmd(struct bnx2x *bp , struct bnx2x_virtf *vf , struct bnx2x_vfop_cmd *cmd ) ; void bnx2x_vf_release(struct bnx2x *bp , struct bnx2x_virtf *vf , bool block ) ; int bnx2x_vf_idx_by_abs_fid(struct bnx2x *bp , u16 abs_vfid ) ; u8 bnx2x_vf_max_queue_cnt(struct bnx2x *bp , struct bnx2x_virtf *vf ) ; int bnx2x_vf_flr_clnup_epilog(struct bnx2x *bp , u8 abs_vfid ) ; void bnx2x_vf_enable_access(struct bnx2x *bp , u8 abs_vfid ) ; void bnx2x_add_tlv(struct bnx2x *bp , void *tlvs_list , u16 offset , u16 type , u16 length ) ; void bnx2x_vfpf_prep(struct bnx2x *bp , struct vfpf_first_tlv *first_tlv , u16 type , u16 length ) ; void bnx2x_vfpf_finalize(struct bnx2x *bp , struct vfpf_first_tlv *first_tlv ) ; void bnx2x_dp_tlv_list(struct bnx2x *bp , void *tlvs_list ) ; bool bnx2x_tlv_supported(u16 tlvtype ) ; u32 bnx2x_crc_vf_bulletin(struct bnx2x *bp , struct pf_vf_bulletin_content *bulletin ) ; int bnx2x_post_vf_bulletin(struct bnx2x *bp , int vf ) ; int bnx2x_vfpf_teardown_queue(struct bnx2x *bp , int qidx ) ; __inline static void bnx2x_del_all_napi___1(struct bnx2x *bp ) { int i ; { i = 0; goto ldv_44805; ldv_44804: netif_napi_del(& (bp->fp + (unsigned long )i)->napi); i = i + 1; ldv_44805: ; if ((uint )i < bp->num_ethernet_queues) { goto ldv_44804; } else { } return; } } void bnx2x_add_tlv(struct bnx2x *bp , void *tlvs_list , u16 offset , u16 type , u16 length ) { struct channel_tlv *tl ; { tl = (struct channel_tlv *)tlvs_list + (unsigned long )offset; tl->type = type; tl->length = length; return; } } void bnx2x_vfpf_prep(struct bnx2x *bp , struct vfpf_first_tlv *first_tlv , u16 type , u16 length ) { long tmp ; { ldv_mutex_lock_151(& bp->vf2pf_mutex); tmp = ldv__builtin_expect((bp->msg_enable & 8388608) != 0, 0L); if (tmp != 0L) { printk("\r[%s:%d(%s)]preparing to send %d tlv over vf pf channel\n", "bnx2x_vfpf_prep", 114, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )type); } else { } memset((void *)bp->vf2pf_mbox, 0, 2048UL); bnx2x_add_tlv(bp, (void *)(& first_tlv->tl), 0, (int )type, (int )length); first_tlv->resp_msg_offset = 1024U; return; } } void bnx2x_vfpf_finalize(struct bnx2x *bp , struct vfpf_first_tlv *first_tlv ) { long tmp ; { tmp = ldv__builtin_expect((bp->msg_enable & 8388608) != 0, 0L); if (tmp != 0L) { printk("\r[%s:%d(%s)]done sending [%d] tlv over vf pf channel\n", "bnx2x_vfpf_finalize", 130, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )first_tlv->tl.type); } else { } ldv_mutex_unlock_152(& bp->vf2pf_mutex); return; } } void bnx2x_dp_tlv_list(struct bnx2x *bp , void *tlvs_list ) { int i ; struct channel_tlv *tlv ; long tmp ; int __ret_warn_on ; long tmp___0 ; long tmp___1 ; { i = 1; tlv = (struct channel_tlv *)tlvs_list; goto ldv_45069; ldv_45068: tmp = ldv__builtin_expect((bp->msg_enable & 8388608) != 0, 0L); if (tmp != 0L) { printk("\r[%s:%d(%s)]TLV number %d: type %d, length %d\n", "bnx2x_dp_tlv_list", 144, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", i, (int )tlv->type, (int )tlv->length); } else { } tlvs_list = tlvs_list + (unsigned long )tlv->length; tlv = (struct channel_tlv *)tlvs_list; i = i + 1; if (i > 50) { __ret_warn_on = 1; tmp___0 = ldv__builtin_expect(__ret_warn_on != 0, 0L); if (tmp___0 != 0L) { warn_slowpath_fmt("/work/ldvuser/exper_fp/work/current--X--drivers--X--defaultlinux-3.10-rc1.tar--X--32_7a--X--cpachecker/linux-3.10-rc1.tar/csd_deg_dscv/8504/dscv_tempdir/dscv/ri/32_7a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_vfpf.c.prepared", 156, "corrupt tlvs"); } else { } ldv__builtin_expect(__ret_warn_on != 0, 0L); return; } else { } ldv_45069: ; if ((unsigned int )tlv->type != 9U) { goto ldv_45068; } else { } tmp___1 = ldv__builtin_expect((bp->msg_enable & 8388608) != 0, 0L); if (tmp___1 != 0L) { printk("\r[%s:%d(%s)]TLV number %d: type %d, length %d\n", "bnx2x_dp_tlv_list", 163, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", i, (int )tlv->type, (int )tlv->length); } else { } return; } } bool bnx2x_tlv_supported(u16 tlvtype ) { { return ((bool )((unsigned int )tlvtype != 0U && (unsigned int )tlvtype <= 12U)); } } __inline static int bnx2x_pfvf_status_codes(int rc ) { { switch (rc) { case 0: ; return (1); case -12: ; return (4); default: ; return (2); } } } static int bnx2x_send_msg2pf(struct bnx2x *bp , u8 *done , dma_addr_t msg_mapping ) { struct cstorm_vf_zone_data *zone_data ; int tout ; int interval ; int __ret_warn_on ; long tmp ; long tmp___0 ; long tmp___1 ; { zone_data = (struct cstorm_vf_zone_data *)bp->regview + 30208U; tout = 600; interval = 100; if ((unsigned int )*done != 0U) { printk("\v[%s:%d(%s)]done was non zero before message to pf was sent\n", "bnx2x_send_msg2pf", 191, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); __ret_warn_on = 1; tmp = ldv__builtin_expect(__ret_warn_on != 0, 0L); if (tmp != 0L) { warn_slowpath_null("/work/ldvuser/exper_fp/work/current--X--drivers--X--defaultlinux-3.10-rc1.tar--X--32_7a--X--cpachecker/linux-3.10-rc1.tar/csd_deg_dscv/8504/dscv_tempdir/dscv/ri/32_7a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_vfpf.c.prepared", 192); } else { } ldv__builtin_expect(__ret_warn_on != 0, 0L); return (-22); } else { } writel((unsigned int )msg_mapping, (void volatile *)(& zone_data->non_trigger.vf_pf_channel.msg_addr_lo)); writel((unsigned int )(msg_mapping >> 32), (void volatile *)(& zone_data->non_trigger.vf_pf_channel.msg_addr_hi)); __asm__ volatile ("sfence": : : "memory"); writeb(1, (void volatile *)(& zone_data->trigger.vf_pf_channel.addr_valid)); goto ldv_45092; ldv_45091: msleep((unsigned int )interval); tout = tout + -1; tmp___0 = ldv__builtin_expect((bp->msg_enable & 8388608) != 0, 0L); if (tmp___0 != 0L) { printk("."); } else { } ldv_45092: ; if (tout >= 0 && (unsigned int )*done == 0U) { goto ldv_45091; } else { } if ((unsigned int )*done == 0U) { printk("\v[%s:%d(%s)]PF response has timed out\n", "bnx2x_send_msg2pf", 220, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); return (-11); } else { } tmp___1 = ldv__builtin_expect((bp->msg_enable & 1048576) != 0, 0L); if (tmp___1 != 0L) { printk("\r[%s:%d(%s)]Got a response from PF\n", "bnx2x_send_msg2pf", 223, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } return (0); } } static int bnx2x_get_vf_id(struct bnx2x *bp , u32 *vf_id ) { u32 me_reg ; int tout ; int interval ; int tmp ; { tout = 10; interval = 100; ldv_45103: me_reg = readl((void const volatile *)bp->doorbells); if ((me_reg & 256U) != 0U && (me_reg & 8U) == 0U) { goto ldv_45101; } else { } msleep((unsigned int )interval); printk("\v[%s:%d(%s)]Invalid ME register value: 0x%08x\n. Is pf driver up?", "bnx2x_get_vf_id", 241, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", me_reg); tmp = tout; tout = tout - 1; if (tmp > 0) { goto ldv_45103; } else { } ldv_45101: ; if ((me_reg & 256U) == 0U || (me_reg & 8U) != 0U) { printk("\v[%s:%d(%s)]Invalid ME register value: 0x%08x\n", "bnx2x_get_vf_id", 245, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", me_reg); return (-22); } else { } printk("\v[%s:%d(%s)]valid ME register value: 0x%08x\n", "bnx2x_get_vf_id", 249, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", me_reg); *vf_id = (me_reg & 32256U) >> 9; return (0); } } int bnx2x_vfpf_acquire(struct bnx2x *bp , u8 tx_count , u8 rx_count ) { int rc ; int attempts ; struct vfpf_acquire_tlv *req ; struct pfvf_acquire_resp_tlv *resp ; u32 vf_id ; bool resources_acquired ; int tmp ; long tmp___0 ; size_t __len ; void *__ret ; long tmp___1 ; long tmp___2 ; size_t __len___0 ; void *__ret___0 ; bool tmp___3 ; { rc = 0; attempts = 0; req = & (bp->vf2pf_mbox)->req.acquire; resp = & (bp->vf2pf_mbox)->resp.acquire_resp; resources_acquired = 0; bnx2x_vfpf_prep(bp, & req->first_tlv, 1, 32); tmp = bnx2x_get_vf_id(bp, & vf_id); if (tmp != 0) { rc = -11; goto out; } else { } req->vfdev_info.vf_id = (u8 )vf_id; req->vfdev_info.vf_os = 0U; req->resc_request.num_rxqs = rx_count; req->resc_request.num_txqs = tx_count; req->resc_request.num_sbs = bp->igu_sb_cnt; req->resc_request.num_mac_filters = 1U; req->resc_request.num_mc_filters = 10U; req->bulletin_addr = bp->pf2vf_bulletin_mapping; bnx2x_add_tlv(bp, (void *)req, (int )req->first_tlv.tl.length, 9, 8); bnx2x_dp_tlv_list(bp, (void *)req); goto ldv_45121; ldv_45120: tmp___0 = ldv__builtin_expect((bp->msg_enable & 1048576) != 0, 0L); if (tmp___0 != 0L) { printk("\r[%s:%d(%s)]attempting to acquire resources\n", "bnx2x_vfpf_acquire", 292, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } rc = bnx2x_send_msg2pf(bp, & resp->hdr.status, bp->vf2pf_mbox_mapping); if (rc != 0) { goto out; } else { } __len = 120UL; if (__len > 63UL) { __ret = __memcpy((void *)(& bp->acquire_resp), (void const *)resp, __len); } else { __ret = __builtin_memcpy((void *)(& bp->acquire_resp), (void const *)resp, __len); } attempts = attempts + 1; if ((unsigned int )bp->acquire_resp.hdr.status == 1U) { tmp___1 = ldv__builtin_expect((bp->msg_enable & 1048576) != 0, 0L); if (tmp___1 != 0L) { printk("\r[%s:%d(%s)]resources acquired\n", "bnx2x_vfpf_acquire", 312, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } resources_acquired = 1; } else if ((unsigned int )bp->acquire_resp.hdr.status == 4U && attempts <= 2) { tmp___2 = ldv__builtin_expect((bp->msg_enable & 1048576) != 0, 0L); if (tmp___2 != 0L) { printk("\r[%s:%d(%s)]PF unwilling to fulfill resource request. Try PF recommended amount\n", "bnx2x_vfpf_acquire", 318, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } req->resc_request.num_txqs = bp->acquire_resp.resc.num_txqs; req->resc_request.num_rxqs = bp->acquire_resp.resc.num_rxqs; req->resc_request.num_sbs = bp->acquire_resp.resc.num_sbs; req->resc_request.num_mac_filters = bp->acquire_resp.resc.num_mac_filters; req->resc_request.num_vlan_filters = bp->acquire_resp.resc.num_vlan_filters; req->resc_request.num_mc_filters = bp->acquire_resp.resc.num_mc_filters; memset((void *)(& (bp->vf2pf_mbox)->resp), 0, 1024UL); } else { printk("\v[%s:%d(%s)]Failed to get the requested amount of resources: %d. Breaking...\n", "bnx2x_vfpf_acquire", 340, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )bp->acquire_resp.hdr.status); rc = -11; goto out; } ldv_45121: ; if (! resources_acquired) { goto ldv_45120; } else { } bp->common.chip_id = bp->common.chip_id | (bp->acquire_resp.pfdev_info.chip_num & 65535U); bp->link_params.chip_id = bp->common.chip_id; bp->db_size = bp->acquire_resp.pfdev_info.db_size; bp->common.int_block = 1U; bp->common.chip_port_mode = 1U; bp->igu_dsb_id = 255U; bp->mf_ov = 0U; bp->mf_mode = 0U; bp->common.flash_size = 0; bp->flags = bp->flags | 57352U; bp->igu_sb_cnt = 1U; bp->igu_base_sb = bp->acquire_resp.resc.hw_sbs[0].hw_sb_id; strlcpy((char *)(& bp->fw_ver), (char const *)(& bp->acquire_resp.pfdev_info.fw_ver), 32UL); tmp___3 = is_valid_ether_addr((u8 const *)(& bp->acquire_resp.resc.current_mac_addr)); if ((int )tmp___3) { __len___0 = 6UL; if (__len___0 > 63UL) { __ret___0 = __memcpy((void *)(bp->dev)->dev_addr, (void const *)(& bp->acquire_resp.resc.current_mac_addr), __len___0); } else { __ret___0 = __builtin_memcpy((void *)(bp->dev)->dev_addr, (void const *)(& bp->acquire_resp.resc.current_mac_addr), __len___0); } } else { } out: bnx2x_vfpf_finalize(bp, & req->first_tlv); return (rc); } } int bnx2x_vfpf_release(struct bnx2x *bp ) { struct vfpf_release_tlv *req ; struct pfvf_general_resp_tlv *resp ; u32 rc ; u32 vf_id ; int tmp ; int tmp___0 ; long tmp___1 ; { req = & (bp->vf2pf_mbox)->req.release; resp = & (bp->vf2pf_mbox)->resp.general_resp; bnx2x_vfpf_prep(bp, & req->first_tlv, 7, 12); tmp = bnx2x_get_vf_id(bp, & vf_id); if (tmp != 0) { rc = 4294967285U; goto out; } else { } req->vf_id = (u16 )vf_id; bnx2x_add_tlv(bp, (void *)req, (int )req->first_tlv.tl.length, 9, 8); bnx2x_dp_tlv_list(bp, (void *)req); tmp___0 = bnx2x_send_msg2pf(bp, & resp->hdr.status, bp->vf2pf_mbox_mapping); rc = (u32 )tmp___0; if (rc != 0U) { goto out; } else { } if ((unsigned int )resp->hdr.status == 1U) { tmp___1 = ldv__builtin_expect((bp->msg_enable & 1048576) != 0, 0L); if (tmp___1 != 0L) { printk("\r[%s:%d(%s)]vf released\n", "bnx2x_vfpf_release", 405, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } } else { printk("\v[%s:%d(%s)]PF failed our release request - are we out of sync? response status: %d\n", "bnx2x_vfpf_release", 409, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )resp->hdr.status); rc = 4294967285U; goto out; } out: bnx2x_vfpf_finalize(bp, & req->first_tlv); return ((int )rc); } } int bnx2x_vfpf_init(struct bnx2x *bp ) { struct vfpf_init_tlv *req ; struct pfvf_general_resp_tlv *resp ; int rc ; int i ; long tmp ; { req = & (bp->vf2pf_mbox)->req.init; resp = & (bp->vf2pf_mbox)->resp.general_resp; bnx2x_vfpf_prep(bp, & req->first_tlv, 2, 152); i = 0; goto ldv_45143; ldv_45142: req->sb_addr[i] = (bp->fp + (unsigned long )i)->status_blk_mapping; i = i + 1; ldv_45143: ; if ((uint )i < bp->num_ethernet_queues) { goto ldv_45142; } else { } req->stats_addr = bp->fw_stats_data_mapping + 128ULL; bnx2x_add_tlv(bp, (void *)req, (int )req->first_tlv.tl.length, 9, 8); bnx2x_dp_tlv_list(bp, (void *)req); rc = bnx2x_send_msg2pf(bp, & resp->hdr.status, bp->vf2pf_mbox_mapping); if (rc != 0) { goto out; } else { } if ((unsigned int )resp->hdr.status != 1U) { printk("\v[%s:%d(%s)]INIT VF failed: %d. Breaking...\n", "bnx2x_vfpf_init", 451, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )resp->hdr.status); rc = -11; goto out; } else { } tmp = ldv__builtin_expect((bp->msg_enable & 1048576) != 0, 0L); if (tmp != 0L) { printk("\r[%s:%d(%s)]INIT VF Succeeded\n", "bnx2x_vfpf_init", 456, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } out: bnx2x_vfpf_finalize(bp, & req->first_tlv); return (rc); } } void bnx2x_vfpf_close_vf(struct bnx2x *bp ) { struct vfpf_close_tlv *req ; struct pfvf_general_resp_tlv *resp ; int i ; int rc ; u32 vf_id ; int tmp ; { req = & (bp->vf2pf_mbox)->req.close; resp = & (bp->vf2pf_mbox)->resp.general_resp; tmp = bnx2x_get_vf_id(bp, & vf_id); if (tmp != 0) { goto free_irq; } else { } i = 0; goto ldv_45158; ldv_45157: ; if ((bp->flags & 32768U) != 0U && (uint )i == (uint )bp->num_queues - bp->num_cnic_queues) { } else { bnx2x_vfpf_teardown_queue(bp, i); } i = i + 1; ldv_45158: ; if (bp->num_queues > i) { goto ldv_45157; } else { } bnx2x_vfpf_config_mac(bp, (bp->dev)->dev_addr, (int )(bp->fp)->index, 0); bnx2x_vfpf_prep(bp, & req->first_tlv, 6, 12); req->vf_id = (u16 )vf_id; bnx2x_add_tlv(bp, (void *)req, (int )req->first_tlv.tl.length, 9, 8); bnx2x_dp_tlv_list(bp, (void *)req); rc = bnx2x_send_msg2pf(bp, & resp->hdr.status, bp->vf2pf_mbox_mapping); if (rc != 0) { printk("\v[%s:%d(%s)]Sending CLOSE failed. rc was: %d\n", "bnx2x_vfpf_close_vf", 499, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", rc); } else if ((unsigned int )resp->hdr.status != 1U) { printk("\v[%s:%d(%s)]Sending CLOSE failed: pf response was %d\n", "bnx2x_vfpf_close_vf", 503, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )resp->hdr.status); } else { } bnx2x_vfpf_finalize(bp, & req->first_tlv); free_irq: bnx2x_netif_stop(bp, 0); bnx2x_del_all_napi___1(bp); bnx2x_free_irq(bp); return; } } int bnx2x_vfpf_setup_q(struct bnx2x *bp , int fp_idx ) { struct vfpf_setup_q_tlv *req ; struct pfvf_general_resp_tlv *resp ; struct bnx2x_fastpath *fp ; u16 tpa_agg_size ; u16 flags ; int rc ; u32 __min1 ; u32 __min1___0 ; u32 __min2 ; u32 __min2___0 ; long tmp ; int _min1 ; int _min2 ; { req = & (bp->vf2pf_mbox)->req.setup_q; resp = & (bp->vf2pf_mbox)->resp.general_resp; fp = bp->fp + (unsigned long )fp_idx; tpa_agg_size = 0U; flags = 0U; bnx2x_vfpf_prep(bp, & req->first_tlv, 3, 96); if ((unsigned int )fp->disable_tpa == 0U) { flags = (u16 )((unsigned int )flags | 1U); flags = (u16 )((unsigned int )flags | 2U); if ((unsigned int )fp->mode == 1U) { flags = (u16 )((unsigned int )flags | 4U); } else { } __min1___0 = 8U; __min2 = 17U; __min1 = (__min1___0 < __min2 ? __min1___0 : __min2) * 4096U; __min2___0 = 65535U; tpa_agg_size = (u16 )(__min1 < __min2___0 ? __min1 : __min2___0); } else { } flags = (u16 )((unsigned int )flags | 16U); flags = (u16 )((unsigned int )flags | 8U); flags = (u16 )((unsigned int )flags | 64U); tmp = ldv__builtin_expect((bp->msg_enable & 32) != 0, 0L); if (tmp != 0L) { printk("\r[%s:%d(%s)]vlan removal enabled\n", "bnx2x_vfpf_setup_q", 542, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } req->vf_qid = (u8 )fp_idx; req->param_valid = 3U; req->rxq.rcq_addr = fp->rx_comp_mapping; req->rxq.rcq_np_addr = fp->rx_comp_mapping + 4096ULL; req->rxq.rxq_addr = fp->rx_desc_mapping; req->rxq.sge_addr = fp->rx_sge_mapping; req->rxq.vf_sb = (u8 )fp_idx; req->rxq.sb_index = 1U; req->rxq.hc_rate = (unsigned int )bp->rx_ticks != 0U ? (u16 )(1000000 / (int )bp->rx_ticks) : 0U; req->rxq.mtu = (u16 )(bp->dev)->mtu; req->rxq.buf_sz = (u16 )fp->rx_buf_size; req->rxq.sge_buf_sz = 4096U; req->rxq.tpa_agg_sz = tpa_agg_size; req->rxq.max_sge_pkt = (u8 )(((unsigned long )(bp->dev)->mtu + 4095UL) >> 12); req->rxq.max_sge_pkt = req->rxq.max_sge_pkt; req->rxq.flags = flags; req->rxq.drop_flags = 0U; _min1 = 8; _min2 = 6; req->rxq.cache_line_log = (u8 )(_min1 < _min2 ? _min1 : _min2); req->rxq.stat_id = 65535U; req->txq.txq_addr = (fp->txdata_ptr[0])->tx_desc_mapping; req->txq.vf_sb = (u8 )fp_idx; req->txq.sb_index = 5U; req->txq.hc_rate = (unsigned int )bp->tx_ticks != 0U ? (u16 )(1000000 / (int )bp->tx_ticks) : 0U; req->txq.flags = (u32 )flags; req->txq.traffic_type = 0U; bnx2x_add_tlv(bp, (void *)req, (int )req->first_tlv.tl.length, 9, 8); bnx2x_dp_tlv_list(bp, (void *)req); rc = bnx2x_send_msg2pf(bp, & resp->hdr.status, bp->vf2pf_mbox_mapping); if (rc != 0) { printk("\v[%s:%d(%s)]Sending SETUP_Q message for queue[%d] failed!\n", "bnx2x_vfpf_setup_q", 586, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", fp_idx); } else { } if ((unsigned int )resp->hdr.status != 1U) { printk("\v[%s:%d(%s)]Status of SETUP_Q for queue[%d] is %d\n", "bnx2x_vfpf_setup_q", 590, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", fp_idx, (int )resp->hdr.status); rc = -22; } else { } bnx2x_vfpf_finalize(bp, & req->first_tlv); return (rc); } } int bnx2x_vfpf_teardown_queue(struct bnx2x *bp , int qidx ) { struct vfpf_q_op_tlv *req ; struct pfvf_general_resp_tlv *resp ; int rc ; { req = & (bp->vf2pf_mbox)->req.q_op; resp = & (bp->vf2pf_mbox)->resp.general_resp; bnx2x_vfpf_prep(bp, & req->first_tlv, 5, 12); req->vf_qid = (u8 )qidx; bnx2x_add_tlv(bp, (void *)req, (int )req->first_tlv.tl.length, 9, 8); bnx2x_dp_tlv_list(bp, (void *)req); rc = bnx2x_send_msg2pf(bp, & resp->hdr.status, bp->vf2pf_mbox_mapping); if (rc != 0) { printk("\v[%s:%d(%s)]Sending TEARDOWN for queue %d failed: %d\n", "bnx2x_vfpf_teardown_queue", 622, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", qidx, rc); goto out; } else { } if ((unsigned int )resp->hdr.status != 1U) { printk("\v[%s:%d(%s)]TEARDOWN for queue %d failed: %d\n", "bnx2x_vfpf_teardown_queue", 629, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", qidx, (int )resp->hdr.status); rc = -22; } else { } out: bnx2x_vfpf_finalize(bp, & req->first_tlv); return (rc); } } int bnx2x_vfpf_config_mac(struct bnx2x *bp , u8 *addr , u8 vf_qid , bool set ) { struct vfpf_set_q_filters_tlv *req ; struct pfvf_general_resp_tlv *resp ; struct pf_vf_bulletin_content bulletin ; int rc ; size_t __len ; void *__ret ; long tmp ; size_t __len___0 ; void *__ret___0 ; size_t __len___1 ; void *__ret___1 ; enum sample_bulletin_result tmp___0 ; { req = & (bp->vf2pf_mbox)->req.set_q_filters; resp = & (bp->vf2pf_mbox)->resp.general_resp; bulletin = (bp->pf2vf_bulletin)->content; rc = 0; bnx2x_vfpf_prep(bp, & req->first_tlv, 4, 596); req->flags = 1U; req->vf_qid = vf_qid; req->n_mac_vlan_filters = 1U; req->filters[0].flags = 1U; if ((int )set) { req->filters[0].flags = req->filters[0].flags | 256U; } else { } bnx2x_sample_bulletin(bp); __len = 6UL; if (__len > 63UL) { __ret = __memcpy((void *)(& req->filters[0].mac), (void const *)addr, __len); } else { __ret = __builtin_memcpy((void *)(& req->filters[0].mac), (void const *)addr, __len); } bnx2x_add_tlv(bp, (void *)req, (int )req->first_tlv.tl.length, 9, 8); bnx2x_dp_tlv_list(bp, (void *)req); rc = bnx2x_send_msg2pf(bp, & resp->hdr.status, bp->vf2pf_mbox_mapping); if (rc != 0) { printk("\v[%s:%d(%s)]failed to send message to pf. rc was %d\n", "bnx2x_vfpf_config_mac", 674, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", rc); goto out; } else { } goto ldv_45213; ldv_45212: tmp = ldv__builtin_expect((bp->msg_enable & 8388608) != 0, 0L); if (tmp != 0L) { printk("\r[%s:%d(%s)]vfpf SET MAC failed. Check bulletin board for new posts\n", "bnx2x_vfpf_config_mac", 681, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } __len___0 = 6UL; if (__len___0 > 63UL) { __ret___0 = __memcpy((void *)(bp->dev)->dev_addr, (void const *)(& bulletin.mac), __len___0); } else { __ret___0 = __builtin_memcpy((void *)(bp->dev)->dev_addr, (void const *)(& bulletin.mac), __len___0); } tmp___0 = bnx2x_sample_bulletin(bp); if ((unsigned int )tmp___0 == 1U) { __len___1 = 6UL; if (__len___1 > 63UL) { __ret___1 = __memcpy((void *)(& req->filters[0].mac), (void const *)(bp->dev)->dev_addr, __len___1); } else { __ret___1 = __builtin_memcpy((void *)(& req->filters[0].mac), (void const *)(bp->dev)->dev_addr, __len___1); } rc = bnx2x_send_msg2pf(bp, & resp->hdr.status, bp->vf2pf_mbox_mapping); } else { goto ldv_45211; } ldv_45213: ; if ((unsigned int )resp->hdr.status == 2U) { goto ldv_45212; } else { } ldv_45211: ; if ((unsigned int )resp->hdr.status != 1U) { printk("\v[%s:%d(%s)]vfpf SET MAC failed: %d\n", "bnx2x_vfpf_config_mac", 702, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )resp->hdr.status); rc = -22; } else { } out: bnx2x_vfpf_finalize(bp, & req->first_tlv); return (0); } } int bnx2x_vfpf_set_mcast(struct net_device *dev ) { struct bnx2x *bp ; void *tmp ; struct vfpf_set_q_filters_tlv *req ; struct pfvf_general_resp_tlv *resp ; int rc ; int i ; struct netdev_hw_addr *ha ; long tmp___0 ; long tmp___1 ; struct list_head const *__mptr ; long tmp___2 ; size_t __len ; void *__ret ; struct list_head const *__mptr___0 ; long tmp___3 ; { tmp = netdev_priv((struct net_device const *)dev); bp = (struct bnx2x *)tmp; req = & (bp->vf2pf_mbox)->req.set_q_filters; resp = & (bp->vf2pf_mbox)->resp.general_resp; i = 0; if ((unsigned int )bp->state != 12288U) { tmp___0 = ldv__builtin_expect((bp->msg_enable & 32) != 0, 0L); if (tmp___0 != 0L) { printk("\r[%s:%d(%s)]state is %x, returning\n", "bnx2x_vfpf_set_mcast", 720, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )bp->state); } else { } return (-22); } else { } bnx2x_vfpf_prep(bp, & req->first_tlv, 4, 596); tmp___1 = ldv__builtin_expect((bp->msg_enable & 32) != 0, 0L); if (tmp___1 != 0L) { printk("\r[%s:%d(%s)]dev->flags = %x\n", "bnx2x_vfpf_set_mcast", 729, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", dev->flags); } else { } __mptr = (struct list_head const *)dev->mc.list.next; ha = (struct netdev_hw_addr *)__mptr; goto ldv_45232; ldv_45231: tmp___2 = ldv__builtin_expect((bp->msg_enable & 32) != 0, 0L); if (tmp___2 != 0L) { printk("\r[%s:%d(%s)]Adding mcast MAC: %pM\n", "bnx2x_vfpf_set_mcast", 733, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (unsigned char *)(& ha->addr)); } else { } __len = 6UL; if (__len > 63UL) { __ret = __memcpy((void *)(& req->multicast) + (unsigned long )i, (void const *)(& ha->addr), __len); } else { __ret = __builtin_memcpy((void *)(& req->multicast) + (unsigned long )i, (void const *)(& ha->addr), __len); } i = i + 1; __mptr___0 = (struct list_head const *)ha->list.next; ha = (struct netdev_hw_addr *)__mptr___0; ldv_45232: ; if ((unsigned long )(& ha->list) != (unsigned long )(& dev->mc.list)) { goto ldv_45231; } else { } if (i > 31) { tmp___3 = ldv__builtin_expect((bp->msg_enable & 32) != 0, 0L); if (tmp___3 != 0L) { printk("\r[%s:%d(%s)]VF supports not more than %d multicast MAC addresses\n", "bnx2x_vfpf_set_mcast", 744, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", 32); } else { } return (-22); } else { } req->n_multicast = (u8 )i; req->flags = req->flags | 2U; req->vf_qid = 0U; bnx2x_add_tlv(bp, (void *)req, (int )req->first_tlv.tl.length, 9, 8); bnx2x_dp_tlv_list(bp, (void *)req); rc = bnx2x_send_msg2pf(bp, & resp->hdr.status, bp->vf2pf_mbox_mapping); if (rc != 0) { printk("\v[%s:%d(%s)]Sending a message failed: %d\n", "bnx2x_vfpf_set_mcast", 760, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", rc); goto out; } else { } if ((unsigned int )resp->hdr.status != 1U) { printk("\v[%s:%d(%s)]Set Rx mode/multicast failed: %d\n", "bnx2x_vfpf_set_mcast", 766, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )resp->hdr.status); rc = -22; } else { } out: bnx2x_vfpf_finalize(bp, & req->first_tlv); return (0); } } int bnx2x_vfpf_storm_rx_mode(struct bnx2x *bp ) { int mode ; struct vfpf_set_q_filters_tlv *req ; struct pfvf_general_resp_tlv *resp ; int rc ; long tmp ; { mode = (int )bp->rx_mode; req = & (bp->vf2pf_mbox)->req.set_q_filters; resp = & (bp->vf2pf_mbox)->resp.general_resp; bnx2x_vfpf_prep(bp, & req->first_tlv, 4, 596); tmp = ldv__builtin_expect((bp->msg_enable & 32) != 0, 0L); if (tmp != 0L) { printk("\r[%s:%d(%s)]Rx mode is %d\n", "bnx2x_vfpf_storm_rx_mode", 786, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", mode); } else { } switch (mode) { case 0: req->rx_mask = 0U; goto ldv_45244; case 1: req->rx_mask = 2U; req->rx_mask = req->rx_mask | 1U; req->rx_mask = req->rx_mask | 16U; goto ldv_45244; case 2: req->rx_mask = 8U; req->rx_mask = req->rx_mask | 1U; req->rx_mask = req->rx_mask | 16U; goto ldv_45244; case 3: req->rx_mask = 4U; req->rx_mask = req->rx_mask | 8U; req->rx_mask = req->rx_mask | 16U; goto ldv_45244; default: printk("\v[%s:%d(%s)]BAD rx mode (%d)\n", "bnx2x_vfpf_storm_rx_mode", 808, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", mode); rc = -22; goto out; } ldv_45244: req->flags = req->flags | 4U; req->vf_qid = 0U; bnx2x_add_tlv(bp, (void *)req, (int )req->first_tlv.tl.length, 9, 8); bnx2x_dp_tlv_list(bp, (void *)req); rc = bnx2x_send_msg2pf(bp, & resp->hdr.status, bp->vf2pf_mbox_mapping); if (rc != 0) { printk("\v[%s:%d(%s)]Sending a message failed: %d\n", "bnx2x_vfpf_storm_rx_mode", 825, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", rc); } else { } if ((unsigned int )resp->hdr.status != 1U) { printk("\v[%s:%d(%s)]Set Rx mode failed: %d\n", "bnx2x_vfpf_storm_rx_mode", 828, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )resp->hdr.status); rc = -22; } else { } out: bnx2x_vfpf_finalize(bp, & req->first_tlv); return (rc); } } static void storm_memset_vf_mbx_ack(struct bnx2x *bp , u16 abs_fid ) { u32 addr ; { addr = ((unsigned int )(bp->iro_arr + 155UL)->base + (unsigned int )((int )abs_fid * (int )(bp->iro_arr + 155UL)->m1)) + 4259840U; writeb(0, (void volatile *)bp->regview + (unsigned long )addr); return; } } static void storm_memset_vf_mbx_valid(struct bnx2x *bp , u16 abs_fid ) { u32 addr ; { addr = ((unsigned int )(bp->iro_arr + 156UL)->base + (unsigned int )((int )abs_fid * (int )(bp->iro_arr + 156UL)->m1)) + 4259840U; writeb(1, (void volatile *)bp->regview + (unsigned long )addr); return; } } void bnx2x_vf_enable_mbx(struct bnx2x *bp , u8 abs_vfid ) { { bnx2x_vf_flr_clnup_epilog(bp, (int )abs_vfid); storm_memset_vf_mbx_ack(bp, (int )abs_vfid); storm_memset_vf_mbx_valid(bp, (int )abs_vfid); bnx2x_vf_enable_access(bp, (int )abs_vfid); return; } } static int bnx2x_copy32_vf_dmae(struct bnx2x *bp , u8 from_vf , dma_addr_t pf_addr , u8 vfid , u32 vf_addr_hi , u32 vf_addr_lo , u32 len32 ) { struct dmae_command dmae ; int tmp ; { if (bp->common.chip_id >> 16 == 5710U || (bp->common.chip_id >> 16 == 5711U || bp->common.chip_id >> 16 == 5712U)) { printk("\v[%s:%d(%s)]Chip revision does not support VFs\n", "bnx2x_copy32_vf_dmae", 883, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); return (-3); } else { } if (bp->dmae_ready == 0) { printk("\v[%s:%d(%s)]DMAE is not ready, can not copy\n", "bnx2x_copy32_vf_dmae", 888, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); return (-3); } else { } bnx2x_prep_dmae_with_comp(bp, & dmae, 0, 1); if ((unsigned int )from_vf != 0U) { dmae.opcode_iov = (unsigned int )((u16 )vfid) | 64U; dmae.opcode = dmae.opcode | 524288U; dmae.src_addr_lo = vf_addr_lo; dmae.src_addr_hi = vf_addr_hi; dmae.dst_addr_lo = (unsigned int )pf_addr; dmae.dst_addr_hi = (unsigned int )(pf_addr >> 32); } else { dmae.opcode_iov = (u16 )((int )((short )((int )vfid << 8)) | 16384); dmae.opcode = dmae.opcode; dmae.src_addr_lo = (unsigned int )pf_addr; dmae.src_addr_hi = (unsigned int )(pf_addr >> 32); dmae.dst_addr_lo = vf_addr_lo; dmae.dst_addr_hi = vf_addr_hi; } dmae.len = (u16 )len32; bnx2x_dp_dmae(bp, & dmae, 524288); tmp = bnx2x_issue_dmae_with_comp(bp, & dmae); return (tmp); } } static void bnx2x_vf_mbx_resp(struct bnx2x *bp , struct bnx2x_virtf *vf ) { struct bnx2x_vf_mbx *mbx ; u64 vf_addr ; dma_addr_t pf_addr ; u16 length ; u16 type ; int rc ; struct pfvf_general_resp_tlv *resp ; int tmp ; long tmp___0 ; { mbx = (struct bnx2x_vf_mbx *)(& (bp->vfdb)->mbxs) + (unsigned long )vf->index; resp = & (mbx->msg)->resp.general_resp; type = mbx->first_tlv.tl.type; length = (unsigned int )type == 1U ? 120U : 8U; bnx2x_add_tlv(bp, (void *)resp, 0, (int )type, (int )length); tmp = bnx2x_pfvf_status_codes(vf->op_rc); resp->hdr.status = (u8 )tmp; bnx2x_add_tlv(bp, (void *)resp, (int )length, 9, 8); bnx2x_dp_tlv_list(bp, (void *)resp); tmp___0 = ldv__builtin_expect((bp->msg_enable & 8388608) != 0, 0L); if (tmp___0 != 0L) { printk("\r[%s:%d(%s)]mailbox vf address hi 0x%x, lo 0x%x, offset 0x%x\n", "bnx2x_vf_mbx_resp", 945, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", mbx->vf_addr_hi, mbx->vf_addr_lo, mbx->first_tlv.resp_msg_offset); } else { } vf_addr = (((unsigned long long )mbx->vf_addr_hi << 32) + (unsigned long long )mbx->vf_addr_lo) + (unsigned long long )mbx->first_tlv.resp_msg_offset; pf_addr = mbx->msg_mapping + 1024ULL; if ((unsigned int )resp->hdr.tl.length > 8U) { length = (unsigned int )resp->hdr.tl.length - 8U; vf_addr = vf_addr + 8ULL; pf_addr = pf_addr + 8ULL; rc = bnx2x_copy32_vf_dmae(bp, 0, pf_addr, (int )vf->abs_vfid, (unsigned int )(vf_addr >> 32), (unsigned int )vf_addr, (unsigned int )length / 4U); if (rc != 0) { printk("\v[%s:%d(%s)]Failed to copy response body to VF %d\n", "bnx2x_vf_mbx_resp", 966, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )vf->abs_vfid); goto mbx_error; } else { } vf_addr = vf_addr - 8ULL; pf_addr = pf_addr - 8ULL; } else { } storm_memset_vf_mbx_ack(bp, (int )vf->abs_vfid); __asm__ volatile ("": : : "memory"); mbx->flags = (unsigned int )mbx->flags & 254U; rc = bnx2x_copy32_vf_dmae(bp, 0, pf_addr, (int )vf->abs_vfid, (unsigned int )(vf_addr >> 32), (unsigned int )vf_addr, 2U); bnx2x_unlock_vf_pf_channel(bp, vf, (enum channel_tlvs )mbx->first_tlv.tl.type); if (rc != 0) { printk("\v[%s:%d(%s)]Failed to copy response status to VF %d\n", "bnx2x_vf_mbx_resp", 993, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )vf->abs_vfid); goto mbx_error; } else { } return; mbx_error: bnx2x_vf_release(bp, vf, 0); return; } } static void bnx2x_vf_mbx_acquire_resp(struct bnx2x *bp , struct bnx2x_virtf *vf , struct bnx2x_vf_mbx *mbx , int vfop_status ) { int i ; struct pfvf_acquire_resp_tlv *resp ; struct pf_vf_resc *resc ; u8 status ; int tmp ; u8 tmp___0 ; u8 tmp___1 ; struct pf_vf_bulletin_content *bulletin ; struct bnx2x_vf_queue *tmp___2 ; size_t __len ; void *__ret ; long tmp___3 ; long tmp___4 ; long tmp___5 ; long tmp___6 ; long tmp___7 ; long tmp___8 ; { resp = & (mbx->msg)->resp.acquire_resp; resc = & resp->resc; tmp = bnx2x_pfvf_status_codes(vfop_status); status = (u8 )tmp; memset((void *)resp, 0, 120UL); resp->pfdev_info.chip_num = bp->common.chip_id; resp->pfdev_info.db_size = 128U; resp->pfdev_info.indices_per_sb = 8U; resp->pfdev_info.pf_cap = 5U; bnx2x_fill_fw_str(bp, (char *)(& resp->pfdev_info.fw_ver), 32UL); if ((unsigned int )status == 4U || (unsigned int )status == 1U) { if ((int )vf->alloc_resc.num_rxqs != 0) { resc->num_rxqs = (u8 )((int )vf->alloc_resc.num_rxqs); } else { tmp___0 = bnx2x_vf_max_queue_cnt(bp, vf); resc->num_rxqs = tmp___0; } if ((int )vf->alloc_resc.num_txqs != 0) { resc->num_txqs = (u8 )((int )vf->alloc_resc.num_txqs); } else { tmp___1 = bnx2x_vf_max_queue_cnt(bp, vf); resc->num_txqs = tmp___1; } resc->num_sbs = vf->alloc_resc.num_sbs; resc->num_mac_filters = vf->alloc_resc.num_mac_filters; resc->num_vlan_filters = vf->alloc_resc.num_vlan_filters; resc->num_mc_filters = 0U; if ((unsigned int )status == 1U) { bulletin = (struct pf_vf_bulletin_content *)(bp->vfdb)->bulletin_dma.addr + (unsigned long )vf->index; i = 0; goto ldv_45307; ldv_45306: tmp___2 = vfq_get(vf, (int )((u8 )i)); resc->hw_qid[i] = vfq_qzone_id(vf, tmp___2); i = i + 1; ldv_45307: ; if ((int )vf->alloc_resc.num_rxqs > i) { goto ldv_45306; } else { } i = 0; goto ldv_45310; ldv_45309: resc->hw_sbs[i].hw_sb_id = vf_igu_sb(vf, (int )((u16 )i)); resc->hw_sbs[i].sb_qid = vf_hc_qzone(vf, (int )((u16 )i)); i = i + 1; ldv_45310: ; if ((int )vf->alloc_resc.num_sbs > i) { goto ldv_45309; } else { } if ((int )bulletin->valid_bitmap & 1) { __len = 6UL; if (__len > 63UL) { __ret = __memcpy((void *)(& resc->current_mac_addr), (void const *)(& bulletin->mac), __len); } else { __ret = __builtin_memcpy((void *)(& resc->current_mac_addr), (void const *)(& bulletin->mac), __len); } } else { } } else { } } else { } tmp___3 = ldv__builtin_expect((bp->msg_enable & 8388608) != 0, 0L); if (tmp___3 != 0L) { printk("\r[%s:%d(%s)]VF[%d] ACQUIRE_RESPONSE: pfdev_info- chip_num=0x%x, db_size=%d, idx_per_sb=%d, pf_cap=0x%x\nresources- n_rxq-%d, n_txq-%d, n_sbs-%d, n_macs-%d, n_vlans-%d, n_mcs-%d, fw_ver: \'%s\'\n", "bnx2x_vf_mbx_acquire_resp", 1070, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )vf->abs_vfid, resp->pfdev_info.chip_num, (int )resp->pfdev_info.db_size, (int )resp->pfdev_info.indices_per_sb, resp->pfdev_info.pf_cap, (int )resc->num_rxqs, (int )resc->num_txqs, (int )resc->num_sbs, (int )resc->num_mac_filters, (int )resc->num_vlan_filters, (int )resc->num_mc_filters, (char *)(& resp->pfdev_info.fw_ver)); } else { } tmp___4 = ldv__builtin_expect((bp->msg_enable & 8388608) != 0, 0L); if (tmp___4 != 0L) { printk("hw_qids- [ "); } else { } i = 0; goto ldv_45317; ldv_45316: tmp___5 = ldv__builtin_expect((bp->msg_enable & 8388608) != 0, 0L); if (tmp___5 != 0L) { printk("%d ", (int )resc->hw_qid[i]); } else { } i = i + 1; ldv_45317: ; if ((int )vf->alloc_resc.num_rxqs > i) { goto ldv_45316; } else { } tmp___6 = ldv__builtin_expect((bp->msg_enable & 8388608) != 0, 0L); if (tmp___6 != 0L) { printk("], sb_info- [ "); } else { } i = 0; goto ldv_45320; ldv_45319: tmp___7 = ldv__builtin_expect((bp->msg_enable & 8388608) != 0, 0L); if (tmp___7 != 0L) { printk("%d:%d ", (int )resc->hw_sbs[i].hw_sb_id, (int )resc->hw_sbs[i].sb_qid); } else { } i = i + 1; ldv_45320: ; if ((int )vf->alloc_resc.num_sbs > i) { goto ldv_45319; } else { } tmp___8 = ldv__builtin_expect((bp->msg_enable & 8388608) != 0, 0L); if (tmp___8 != 0L) { printk("]\n"); } else { } vf->op_rc = vfop_status; bnx2x_vf_mbx_resp(bp, vf); return; } } static void bnx2x_vf_mbx_acquire(struct bnx2x *bp , struct bnx2x_virtf *vf , struct bnx2x_vf_mbx *mbx ) { int rc ; struct vfpf_acquire_tlv *acquire ; long tmp ; { acquire = & (mbx->msg)->req.acquire; tmp = ldv__builtin_expect((bp->msg_enable & 8388608) != 0, 0L); if (tmp != 0L) { printk("\r[%s:%d(%s)]VF[%d] ACQUIRE: vfdev_info- vf_id %d, vf_os %d resources- n_rxq-%d, n_txq-%d, n_sbs-%d, n_macs-%d, n_vlans-%d, n_mcs-%d\n", "bnx2x_vf_mbx_acquire", 1100, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )vf->abs_vfid, (int )acquire->vfdev_info.vf_id, (int )acquire->vfdev_info.vf_os, (int )acquire->resc_request.num_rxqs, (int )acquire->resc_request.num_txqs, (int )acquire->resc_request.num_sbs, (int )acquire->resc_request.num_mac_filters, (int )acquire->resc_request.num_vlan_filters, (int )acquire->resc_request.num_mc_filters); } else { } rc = bnx2x_vf_acquire(bp, vf, & acquire->resc_request); vf->bulletin_map = acquire->bulletin_addr; bnx2x_vf_mbx_acquire_resp(bp, vf, mbx, rc); return; } } static void bnx2x_vf_mbx_init_vf(struct bnx2x *bp , struct bnx2x_virtf *vf , struct bnx2x_vf_mbx *mbx ) { struct vfpf_init_tlv *init ; { init = & (mbx->msg)->req.init; vf->spq_map = init->spq_addr; vf->fw_stat_map = init->stats_addr; vf->op_rc = bnx2x_vf_init(bp, vf, (dma_addr_t *)(& init->sb_addr)); bnx2x_vf_mbx_resp(bp, vf); return; } } static void bnx2x_vf_mbx_set_q_flags(struct bnx2x *bp , u32 mbx_q_flags , unsigned long *sp_q_flags ) { { if ((int )mbx_q_flags & 1) { __set_bit(0, (unsigned long volatile *)sp_q_flags); } else { } if ((mbx_q_flags & 2U) != 0U) { __set_bit(1, (unsigned long volatile *)sp_q_flags); } else { } if ((mbx_q_flags & 4U) != 0U) { __set_bit(2, (unsigned long volatile *)sp_q_flags); } else { } if ((mbx_q_flags & 16U) != 0U) { __set_bit(3, (unsigned long volatile *)sp_q_flags); } else { } if ((mbx_q_flags & 64U) != 0U) { __set_bit(7, (unsigned long volatile *)sp_q_flags); } else { } if ((mbx_q_flags & 128U) != 0U) { __set_bit(8, (unsigned long volatile *)sp_q_flags); } else { } if ((mbx_q_flags & 256U) != 0U) { __set_bit(9, (unsigned long volatile *)sp_q_flags); } else { } if ((mbx_q_flags & 512U) != 0U) { __set_bit(11, (unsigned long volatile *)sp_q_flags); } else { } if ((unsigned int )bp->mf_mode == 1U) { __set_bit(6, (unsigned long volatile *)sp_q_flags); } else { } return; } } static void bnx2x_vf_mbx_setup_q(struct bnx2x *bp , struct bnx2x_virtf *vf , struct bnx2x_vf_mbx *mbx ) { struct vfpf_setup_q_tlv *setup_q ; struct bnx2x_vfop_cmd cmd ; struct bnx2x_vf_queue *q ; struct bnx2x_vf_queue *tmp ; unsigned long q_type ; struct bnx2x_queue_init_params *init_p ; struct bnx2x_queue_setup_params *setup_p ; struct bnx2x_txq_setup_params *txq_params ; struct bnx2x_rxq_setup_params *rxq_params ; { setup_q = & (mbx->msg)->req.setup_q; cmd.done = & bnx2x_vf_mbx_resp; cmd.block = 0; if ((int )setup_q->vf_qid >= (int )vf->alloc_resc.num_rxqs) { printk("\v[%s:%d(%s)]vf_qid %d invalid, max queue count is %d\n", "bnx2x_vf_mbx_setup_q", 1164, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )setup_q->vf_qid, (int )vf->alloc_resc.num_rxqs); vf->op_rc = -22; goto response; } else { } if (((int )setup_q->param_valid & 3) != 0) { tmp = vfq_get(vf, (int )setup_q->vf_qid); q = tmp; q_type = 0UL; memset((void *)(& vf->op_params.qctor), 0, 248UL); setup_p = & vf->op_params.qctor.prep_qsetup; init_p = & vf->op_params.qctor.qstate.params.init; __set_bit(5, (unsigned long volatile *)(& setup_p->flags)); if (((int )setup_q->param_valid & 2) != 0) { txq_params = & setup_p->txq_params; __set_bit(1, (unsigned long volatile *)(& q_type)); q->sb_idx = (u16 )setup_q->txq.vf_sb; init_p->tx.hc_rate = setup_q->txq.hc_rate; init_p->tx.sb_cq_index = setup_q->txq.sb_index; bnx2x_vf_mbx_set_q_flags(bp, setup_q->txq.flags, & init_p->tx.flags); bnx2x_vf_mbx_set_q_flags(bp, setup_q->txq.flags, & setup_p->flags); txq_params->dscr_map = setup_q->txq.txq_addr; txq_params->sb_cq_index = setup_q->txq.sb_index; txq_params->traffic_type = (u16 )setup_q->txq.traffic_type; bnx2x_vfop_qctor_dump_tx(bp, vf, init_p, setup_p, (int )q->index, (int )q->sb_idx); } else { } if ((int )setup_q->param_valid & 1) { rxq_params = & setup_p->rxq_params; __set_bit(0, (unsigned long volatile *)(& q_type)); q->sb_idx = (u16 )setup_q->rxq.vf_sb; init_p->rx.hc_rate = setup_q->rxq.hc_rate; init_p->rx.sb_cq_index = setup_q->rxq.sb_index; bnx2x_vf_mbx_set_q_flags(bp, (u32 )setup_q->rxq.flags, & init_p->rx.flags); bnx2x_vf_mbx_set_q_flags(bp, (u32 )setup_q->rxq.flags, & setup_p->flags); setup_p->gen_params.mtu = setup_q->rxq.mtu; rxq_params->drop_flags = (u16 )setup_q->rxq.drop_flags; rxq_params->dscr_map = setup_q->rxq.rxq_addr; rxq_params->sge_map = setup_q->rxq.sge_addr; rxq_params->rcq_map = setup_q->rxq.rcq_addr; rxq_params->rcq_np_map = setup_q->rxq.rcq_np_addr; rxq_params->buf_sz = setup_q->rxq.buf_sz; rxq_params->tpa_agg_sz = setup_q->rxq.tpa_agg_sz; rxq_params->max_sges_pkt = setup_q->rxq.max_sge_pkt; rxq_params->sge_buf_sz = setup_q->rxq.sge_buf_sz; rxq_params->cache_line_log = setup_q->rxq.cache_line_log; rxq_params->sb_cq_index = setup_q->rxq.sb_index; bnx2x_vfop_qctor_dump_rx(bp, vf, init_p, setup_p, (int )q->index, (int )q->sb_idx); } else { } bnx2x_vfop_qctor_prep(bp, vf, q, & vf->op_params.qctor, q_type); vf->op_rc = bnx2x_vfop_qsetup_cmd(bp, vf, & cmd, (int )q->index); if (vf->op_rc != 0) { goto response; } else { } return; } else { } response: bnx2x_vf_mbx_resp(bp, vf); return; } } static int bnx2x_vf_mbx_macvlan_list(struct bnx2x *bp , struct bnx2x_virtf *vf , struct vfpf_set_q_filters_tlv *tlv , struct bnx2x_vfop_filters **pfl , u32 type_flag ) { int i ; int j ; struct bnx2x_vfop_filters *fl ; size_t fsz ; void *tmp ; struct vfpf_q_mac_vlan_filter *msg_filter ; int tmp___0 ; int tmp___1 ; { fl = 0; fsz = (unsigned long )tlv->n_mac_vlan_filters * 40UL + 24UL; tmp = kzalloc(fsz, 208U); fl = (struct bnx2x_vfop_filters *)tmp; if ((unsigned long )fl == (unsigned long )((struct bnx2x_vfop_filters *)0)) { return (-12); } else { } INIT_LIST_HEAD(& fl->head); i = 0; j = 0; goto ldv_45376; ldv_45375: msg_filter = (struct vfpf_q_mac_vlan_filter *)(& tlv->filters) + (unsigned long )i; if ((msg_filter->flags & type_flag) != type_flag) { goto ldv_45374; } else { } if (type_flag == 1U) { fl->filters[j].mac = (u8 *)(& msg_filter->mac); fl->filters[j].type = 1; } else { fl->filters[j].vid = msg_filter->vlan_tag; fl->filters[j].type = 2; } fl->filters[j].add = (msg_filter->flags & 256U) != 0U; tmp___0 = j; j = j + 1; list_add_tail(& fl->filters[tmp___0].link, & fl->head); ldv_45374: i = i + 1; ldv_45376: ; if ((int )tlv->n_mac_vlan_filters > i) { goto ldv_45375; } else { } tmp___1 = list_empty((struct list_head const *)(& fl->head)); if (tmp___1 != 0) { kfree((void const *)fl); } else { *pfl = fl; } return (0); } } static void bnx2x_vf_mbx_dp_q_filter(struct bnx2x *bp , int msglvl , int idx , struct vfpf_q_mac_vlan_filter *filter ) { long tmp ; long tmp___0 ; long tmp___1 ; long tmp___2 ; { tmp = ldv__builtin_expect((bp->msg_enable & msglvl) != 0, 0L); if (tmp != 0L) { printk("\r[%s:%d(%s)]MAC-VLAN[%d] -- flags=0x%x\n", "bnx2x_vf_mbx_dp_q_filter", 1326, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", idx, filter->flags); } else { } if ((filter->flags & 2U) != 0U) { tmp___0 = ldv__builtin_expect((bp->msg_enable & msglvl) != 0, 0L); if (tmp___0 != 0L) { printk(", vlan=%d", (int )filter->vlan_tag); } else { } } else { } if ((int )filter->flags & 1) { tmp___1 = ldv__builtin_expect((bp->msg_enable & msglvl) != 0, 0L); if (tmp___1 != 0L) { printk(", MAC=%pM", (u8 *)(& filter->mac)); } else { } } else { } tmp___2 = ldv__builtin_expect((bp->msg_enable & msglvl) != 0, 0L); if (tmp___2 != 0L) { printk("\n"); } else { } return; } } static void bnx2x_vf_mbx_dp_q_filters(struct bnx2x *bp , int msglvl , struct vfpf_set_q_filters_tlv *filters ) { int i ; long tmp ; long tmp___0 ; { if ((int )filters->flags & 1) { i = 0; goto ldv_45392; ldv_45391: bnx2x_vf_mbx_dp_q_filter(bp, msglvl, i, (struct vfpf_q_mac_vlan_filter *)(& filters->filters) + (unsigned long )i); i = i + 1; ldv_45392: ; if ((int )filters->n_mac_vlan_filters > i) { goto ldv_45391; } else { } } else { } if ((filters->flags & 4U) != 0U) { tmp = ldv__builtin_expect((bp->msg_enable & msglvl) != 0, 0L); if (tmp != 0L) { printk("\r[%s:%d(%s)]RX-MASK=0x%x\n", "bnx2x_vf_mbx_dp_q_filters", 1345, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", filters->rx_mask); } else { } } else { } if ((filters->flags & 2U) != 0U) { i = 0; goto ldv_45396; ldv_45395: tmp___0 = ldv__builtin_expect((bp->msg_enable & msglvl) != 0, 0L); if (tmp___0 != 0L) { printk("\r[%s:%d(%s)]MULTICAST=%pM\n", "bnx2x_vf_mbx_dp_q_filters", 1349, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (u8 *)(& filters->multicast) + (unsigned long )i); } else { } i = i + 1; ldv_45396: ; if ((int )filters->n_multicast > i) { goto ldv_45395; } else { } } else { } return; } } static void bnx2x_vfop_mbx_qfilters(struct bnx2x *bp , struct bnx2x_virtf *vf ) { int rc ; struct vfpf_set_q_filters_tlv *msg ; struct bnx2x_vfop *vfop ; struct bnx2x_vfop *tmp ; enum bnx2x_vfop_filters_state state ; struct bnx2x_vfop_cmd cmd ; long tmp___0 ; struct bnx2x_vfop_filters *fl ; struct bnx2x_vfop_filters *fl___0 ; unsigned long accept ; { msg = & (((struct bnx2x_vf_mbx *)(& (bp->vfdb)->mbxs) + (unsigned long )vf->index)->msg)->req.set_q_filters; tmp = bnx2x_vfop_cur(bp, vf); vfop = tmp; state = (enum bnx2x_vfop_filters_state )vfop->state; cmd.done = & bnx2x_vfop_mbx_qfilters; cmd.block = 0; tmp___0 = ldv__builtin_expect((bp->msg_enable & 8388608) != 0, 0L); if (tmp___0 != 0L) { printk("\r[%s:%d(%s)]STATE: %d\n", "bnx2x_vfop_mbx_qfilters", 1370, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (unsigned int )state); } else { } if (vfop->rc < 0) { goto op_err; } else { } switch ((unsigned int )state) { case 0U: vfop->state = 1; if ((int )msg->flags & 1) { fl = 0; vfop->rc = bnx2x_vf_mbx_macvlan_list(bp, vf, msg, & fl, 1U); if (vfop->rc != 0) { goto op_err; } else { } if ((unsigned long )fl != (unsigned long )((struct bnx2x_vfop_filters *)0)) { rc = bnx2x_vfop_mac_list_cmd(bp, vf, & cmd, fl, (int )msg->vf_qid, 0); if (rc != 0) { vfop->rc = rc; goto op_err; } else { } return; } else { } } else { } case 1U: vfop->state = 2; if ((int )msg->flags & 1) { fl___0 = 0; vfop->rc = bnx2x_vf_mbx_macvlan_list(bp, vf, msg, & fl___0, 2U); if (vfop->rc != 0) { goto op_err; } else { } if ((unsigned long )fl___0 != (unsigned long )((struct bnx2x_vfop_filters *)0)) { rc = bnx2x_vfop_vlan_list_cmd(bp, vf, & cmd, fl___0, (int )msg->vf_qid, 0); if (rc != 0) { vfop->rc = rc; goto op_err; } else { } return; } else { } } else { } case 2U: vfop->state = 3; if ((msg->flags & 4U) != 0U) { accept = 0UL; if ((int )msg->rx_mask & 1) { __set_bit(0, (unsigned long volatile *)(& accept)); } else { } if ((msg->rx_mask & 2U) != 0U) { __set_bit(1, (unsigned long volatile *)(& accept)); } else { } if ((msg->rx_mask & 4U) != 0U) { __set_bit(2, (unsigned long volatile *)(& accept)); } else { } if ((msg->rx_mask & 8U) != 0U) { __set_bit(3, (unsigned long volatile *)(& accept)); } else { } if ((msg->rx_mask & 16U) != 0U) { __set_bit(4, (unsigned long volatile *)(& accept)); } else { } __set_bit(6, (unsigned long volatile *)(& accept)); rc = bnx2x_vfop_rxmode_cmd(bp, vf, & cmd, (int )msg->vf_qid, accept); if (rc != 0) { vfop->rc = rc; goto op_err; } else { } return; } else { } case 3U: vfop->state = 4; if ((msg->flags & 2U) != 0U) { rc = bnx2x_vfop_mcast_cmd(bp, vf, & cmd, (bnx2x_mac_addr_t *)(& msg->multicast), (int )msg->n_multicast, 0); if (rc != 0) { vfop->rc = rc; goto op_err; } else { } return; } else { } op_done: ; case 4U: bnx2x_vfop_end(bp, vf, vfop); return; op_err: printk("\v[%s:%d(%s)]QFILTERS[%d:%d] error: rc %d\n", "bnx2x_vfop_mbx_qfilters", 1493, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )vf->abs_vfid, (int )msg->vf_qid, vfop->rc); goto op_done; default: printk("\v[%s:%d(%s)]Bad state %d\n", "bnx2x_vfop_mbx_qfilters", 1497, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (unsigned int )state); vfop->rc = -22; goto op_err; } } } static int bnx2x_vfop_mbx_qfilters_cmd(struct bnx2x *bp , struct bnx2x_virtf *vf , struct bnx2x_vfop_cmd *cmd ) { struct bnx2x_vfop *vfop ; struct bnx2x_vfop *tmp ; int tmp___0 ; { tmp = bnx2x_vfop_add(bp, vf); vfop = tmp; if ((unsigned long )vfop != (unsigned long )((struct bnx2x_vfop *)0)) { vfop->state = 0; vfop->op_p = & vf->op_params; vfop->transition = & bnx2x_vfop_mbx_qfilters; vfop->done = cmd->done; tmp___0 = bnx2x_vfop_transition(bp, vf, & bnx2x_vfop_mbx_qfilters, (int )cmd->block); return (tmp___0); } else { } return (-12); } } static void bnx2x_vf_mbx_set_q_filters(struct bnx2x *bp , struct bnx2x_virtf *vf , struct bnx2x_vf_mbx *mbx ) { struct vfpf_set_q_filters_tlv *filters ; struct pf_vf_bulletin_content *bulletin ; struct bnx2x_vfop_cmd cmd ; int tmp ; long tmp___0 ; { filters = & (mbx->msg)->req.set_q_filters; bulletin = (struct pf_vf_bulletin_content *)(bp->vfdb)->bulletin_dma.addr + (unsigned long )vf->index; cmd.done = & bnx2x_vf_mbx_resp; cmd.block = 0; if ((int )bulletin->valid_bitmap & 1) { if ((unsigned int )filters->n_mac_vlan_filters > 1U) { printk("\v[%s:%d(%s)]VF[%d] requested the addition of multiple macs after set_vf_mac ndo was called\n", "bnx2x_vf_mbx_set_q_filters", 1535, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )vf->abs_vfid); vf->op_rc = -1; goto response; } else { } if ((unsigned int )filters->n_mac_vlan_filters == 1U) { tmp = memcmp((void const *)(& ((struct vfpf_q_mac_vlan_filter *)(& filters->filters))->mac), (void const *)(& bulletin->mac), 6UL); if (tmp != 0) { printk("\v[%s:%d(%s)]VF[%d] requested the addition of a mac address not matching the one configured by set_vf_mac ndo\n", "bnx2x_vf_mbx_set_q_filters", 1544, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )vf->abs_vfid); vf->op_rc = -1; goto response; } else { } } else { } } else { } if ((int )filters->vf_qid > (int )vf->alloc_resc.num_rxqs) { goto response; } else { } tmp___0 = ldv__builtin_expect((bp->msg_enable & 8388608) != 0, 0L); if (tmp___0 != 0L) { printk("\r[%s:%d(%s)]VF[%d] Q_FILTERS: queue[%d]\n", "bnx2x_vf_mbx_set_q_filters", 1557, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )vf->abs_vfid, (int )filters->vf_qid); } else { } bnx2x_vf_mbx_dp_q_filters(bp, 8388608, filters); vf->op_rc = bnx2x_vfop_mbx_qfilters_cmd(bp, vf, & cmd); if (vf->op_rc != 0) { goto response; } else { } return; response: bnx2x_vf_mbx_resp(bp, vf); return; } } static void bnx2x_vf_mbx_teardown_q(struct bnx2x *bp , struct bnx2x_virtf *vf , struct bnx2x_vf_mbx *mbx ) { int qid ; struct bnx2x_vfop_cmd cmd ; long tmp ; { qid = (int )(mbx->msg)->req.q_op.vf_qid; cmd.done = & bnx2x_vf_mbx_resp; cmd.block = 0; tmp = ldv__builtin_expect((bp->msg_enable & 8388608) != 0, 0L); if (tmp != 0L) { printk("\r[%s:%d(%s)]VF[%d] Q_TEARDOWN: vf_qid=%d\n", "bnx2x_vf_mbx_teardown_q", 1581, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )vf->abs_vfid, qid); } else { } vf->op_rc = bnx2x_vfop_qdown_cmd(bp, vf, & cmd, qid); if (vf->op_rc != 0) { bnx2x_vf_mbx_resp(bp, vf); } else { } return; } } static void bnx2x_vf_mbx_close_vf(struct bnx2x *bp , struct bnx2x_virtf *vf , struct bnx2x_vf_mbx *mbx ) { struct bnx2x_vfop_cmd cmd ; long tmp ; { cmd.done = & bnx2x_vf_mbx_resp; cmd.block = 0; tmp = ldv__builtin_expect((bp->msg_enable & 8388608) != 0, 0L); if (tmp != 0L) { printk("\r[%s:%d(%s)]VF[%d] VF_CLOSE\n", "bnx2x_vf_mbx_close_vf", 1596, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )vf->abs_vfid); } else { } vf->op_rc = bnx2x_vfop_close_cmd(bp, vf, & cmd); if (vf->op_rc != 0) { bnx2x_vf_mbx_resp(bp, vf); } else { } return; } } static void bnx2x_vf_mbx_release_vf(struct bnx2x *bp , struct bnx2x_virtf *vf , struct bnx2x_vf_mbx *mbx ) { struct bnx2x_vfop_cmd cmd ; long tmp ; { cmd.done = & bnx2x_vf_mbx_resp; cmd.block = 0; tmp = ldv__builtin_expect((bp->msg_enable & 8388608) != 0, 0L); if (tmp != 0L) { printk("\r[%s:%d(%s)]VF[%d] VF_RELEASE\n", "bnx2x_vf_mbx_release_vf", 1611, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )vf->abs_vfid); } else { } vf->op_rc = bnx2x_vfop_release_cmd(bp, vf, & cmd); if (vf->op_rc != 0) { bnx2x_vf_mbx_resp(bp, vf); } else { } return; } } static void bnx2x_vf_mbx_request(struct bnx2x *bp , struct bnx2x_virtf *vf , struct bnx2x_vf_mbx *mbx ) { int i ; long tmp ; bool tmp___0 ; { tmp___0 = bnx2x_tlv_supported((int )mbx->first_tlv.tl.type); if ((int )tmp___0) { bnx2x_lock_vf_pf_channel(bp, vf, (enum channel_tlvs )mbx->first_tlv.tl.type); switch ((int )mbx->first_tlv.tl.type) { case 1: bnx2x_vf_mbx_acquire(bp, vf, mbx); goto ldv_45464; case 2: bnx2x_vf_mbx_init_vf(bp, vf, mbx); goto ldv_45464; case 3: bnx2x_vf_mbx_setup_q(bp, vf, mbx); goto ldv_45464; case 4: bnx2x_vf_mbx_set_q_filters(bp, vf, mbx); goto ldv_45464; case 5: bnx2x_vf_mbx_teardown_q(bp, vf, mbx); goto ldv_45464; case 6: bnx2x_vf_mbx_close_vf(bp, vf, mbx); goto ldv_45464; case 7: bnx2x_vf_mbx_release_vf(bp, vf, mbx); goto ldv_45464; } ldv_45464: ; } else { printk("\v[%s:%d(%s)]unknown TLV. type %d length %d. first 20 bytes of mailbox buffer:\n", "bnx2x_vf_mbx_request", 1664, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )mbx->first_tlv.tl.type, (int )mbx->first_tlv.tl.length); i = 0; goto ldv_45473; ldv_45472: tmp = ldv__builtin_expect((bp->msg_enable & 8388608) != 0, 0L); if (tmp != 0L) { printk("%x ", (int )(mbx->msg)->req.tlv_buf_size.tlv_buffer[i]); } else { } i = i + 1; ldv_45473: ; if (i <= 19) { goto ldv_45472; } else { } if ((unsigned int )vf->state == 1U) { vf->op_rc = 3; bnx2x_vf_mbx_resp(bp, vf); } else { bnx2x_unlock_vf_pf_channel(bp, vf, (enum channel_tlvs )mbx->first_tlv.tl.type); } } return; } } void bnx2x_vf_mbx(struct bnx2x *bp , struct vf_pf_event_data *vfpf_event ) { struct bnx2x_virtf *vf ; struct bnx2x_vf_mbx *mbx ; u8 vf_idx ; int rc ; long tmp ; int tmp___0 ; long tmp___1 ; { tmp = ldv__builtin_expect((bp->msg_enable & 8388608) != 0, 0L); if (tmp != 0L) { printk("\r[%s:%d(%s)]vf pf event received: vfid %d, address_hi %x, address lo %x", "bnx2x_vf_mbx", 1698, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )vfpf_event->vf_id, vfpf_event->msg_addr_hi, vfpf_event->msg_addr_lo); } else { } if ((u32 )vfpf_event->vf_id - (bp->vfdb)->sriov.first_vf_in_pf > (u32 )(bp->vfdb)->sriov.nr_virtfn) { printk("\v[%s:%d(%s)]Illegal vf_id %d max allowed: %d\n", "bnx2x_vf_mbx", 1705, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )vfpf_event->vf_id, (int )(bp->vfdb)->sriov.nr_virtfn); goto mbx_done; } else { } tmp___0 = bnx2x_vf_idx_by_abs_fid(bp, (int )vfpf_event->vf_id); vf_idx = (u8 )tmp___0; mbx = (struct bnx2x_vf_mbx *)(& (bp->vfdb)->mbxs) + (unsigned long )vf_idx; if ((int )mbx->flags & 1) { printk("\v[%s:%d(%s)]Previous message is still being processed, vf_id %d\n", "bnx2x_vf_mbx", 1716, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )vfpf_event->vf_id); goto mbx_done; } else { } vf = (bp->vfdb)->vfs + (unsigned long )vf_idx; mbx->vf_addr_hi = vfpf_event->msg_addr_hi; mbx->vf_addr_lo = vfpf_event->msg_addr_lo; tmp___1 = ldv__builtin_expect((bp->msg_enable & 8388608) != 0, 0L); if (tmp___1 != 0L) { printk("\r[%s:%d(%s)]mailbox vf address hi 0x%x, lo 0x%x, offset 0x%x\n", "bnx2x_vf_mbx", 1725, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", mbx->vf_addr_hi, mbx->vf_addr_lo, mbx->first_tlv.resp_msg_offset); } else { } rc = bnx2x_copy32_vf_dmae(bp, 1, mbx->msg_mapping, (int )vf->abs_vfid, mbx->vf_addr_hi, mbx->vf_addr_lo, 256U); if (rc != 0) { printk("\v[%s:%d(%s)]Failed to copy request VF %d\n", "bnx2x_vf_mbx", 1732, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )vf->abs_vfid); goto mbx_error; } else { } mbx->first_tlv = (mbx->msg)->req.first_tlv; bnx2x_vf_mbx_request(bp, vf, mbx); goto mbx_done; mbx_error: bnx2x_vf_release(bp, vf, 0); mbx_done: ; return; } } int bnx2x_post_vf_bulletin(struct bnx2x *bp , int vf ) { struct pf_vf_bulletin_content *bulletin ; dma_addr_t pf_addr ; dma_addr_t vf_addr ; int rc ; { bulletin = (struct pf_vf_bulletin_content *)(bp->vfdb)->bulletin_dma.addr + (unsigned long )vf; pf_addr = (bp->vfdb)->bulletin_dma.mapping + (unsigned long long )((unsigned long )vf * 32UL); vf_addr = ((bp->vfdb)->vfs + (unsigned long )vf)->bulletin_map; if ((unsigned int )((bp->vfdb)->vfs + (unsigned long )vf)->state != 2U && (unsigned int )((bp->vfdb)->vfs + (unsigned long )vf)->state != 1U) { return (0); } else { } bulletin->version = (u16 )((int )bulletin->version + 1); bulletin->length = 32U; bulletin->crc = bnx2x_crc_vf_bulletin(bp, bulletin); rc = bnx2x_copy32_vf_dmae(bp, 0, pf_addr, (int )((bp->vfdb)->vfs + (unsigned long )vf)->abs_vfid, (unsigned int )(vf_addr >> 32), (unsigned int )vf_addr, (unsigned int )bulletin->length / 4U); return (rc); } } void ldv_main7_sequence_infinite_withcheck_stateful(void) { struct bnx2x *var_group1 ; struct bnx2x_virtf *var_group2 ; int tmp ; int tmp___0 ; { LDV_IN_INTERRUPT = 1; ldv_initialize(); goto ldv_45521; ldv_45520: tmp = __VERIFIER_nondet_int(); switch (tmp) { case 0: ldv_handler_precall(); bnx2x_vf_mbx_resp(var_group1, var_group2); goto ldv_45513; case 1: ldv_handler_precall(); bnx2x_vfop_mbx_qfilters(var_group1, var_group2); goto ldv_45513; case 2: ldv_handler_precall(); bnx2x_vf_mbx_resp(var_group1, var_group2); goto ldv_45513; case 3: ldv_handler_precall(); bnx2x_vf_mbx_resp(var_group1, var_group2); goto ldv_45513; case 4: ldv_handler_precall(); bnx2x_vf_mbx_resp(var_group1, var_group2); goto ldv_45513; case 5: ldv_handler_precall(); bnx2x_vf_mbx_resp(var_group1, var_group2); goto ldv_45513; default: ; goto ldv_45513; } ldv_45513: ; ldv_45521: tmp___0 = __VERIFIER_nondet_int(); if (tmp___0 != 0) { goto ldv_45520; } else { } ldv_check_final_state(); return; } } void ldv_mutex_lock_143(struct mutex *ldv_func_arg1 ) { { ldv_mutex_lock_lock(ldv_func_arg1); mutex_lock(ldv_func_arg1); return; } } void ldv_mutex_unlock_144(struct mutex *ldv_func_arg1 ) { { ldv_mutex_unlock_lock(ldv_func_arg1); mutex_unlock(ldv_func_arg1); return; } } void ldv_mutex_lock_145(struct mutex *ldv_func_arg1 ) { { ldv_mutex_lock_mutex_of_device(ldv_func_arg1); mutex_lock(ldv_func_arg1); return; } } int ldv_mutex_trylock_146(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_147(struct mutex *ldv_func_arg1 ) { { ldv_mutex_unlock_mutex_of_device(ldv_func_arg1); mutex_unlock(ldv_func_arg1); return; } } __inline static int ldv_mutex_is_locked_148(struct mutex *lock ) { ldv_func_ret_type___4 ldv_func_res ; int tmp ; int tmp___0 ; { tmp = mutex_is_locked(lock); ldv_func_res = tmp; tmp___0 = ldv_mutex_is_locked_op_mutex_of_bnx2x_virtf(lock); return (tmp___0); return (ldv_func_res); } } __inline static int ldv_mutex_is_locked_149(struct mutex *lock ) { ldv_func_ret_type___5 ldv_func_res ; int tmp ; int tmp___0 ; { tmp = mutex_is_locked(lock); ldv_func_res = tmp; tmp___0 = ldv_mutex_is_locked_op_mutex_of_bnx2x_virtf(lock); return (tmp___0); return (ldv_func_res); } } __inline static int ldv_mutex_is_locked_150(struct mutex *lock ) { ldv_func_ret_type___6 ldv_func_res ; int tmp ; int tmp___0 ; { tmp = mutex_is_locked(lock); ldv_func_res = tmp; tmp___0 = ldv_mutex_is_locked_op_mutex_of_bnx2x_virtf(lock); return (tmp___0); return (ldv_func_res); } } void ldv_mutex_lock_151(struct mutex *ldv_func_arg1 ) { { ldv_mutex_lock_vf2pf_mutex_of_bnx2x(ldv_func_arg1); mutex_lock(ldv_func_arg1); return; } } void ldv_mutex_unlock_152(struct mutex *ldv_func_arg1 ) { { ldv_mutex_unlock_vf2pf_mutex_of_bnx2x(ldv_func_arg1); mutex_unlock(ldv_func_arg1); return; } } __inline static void list_move(struct list_head *list , struct list_head *head ) { { __list_del_entry(list); list_add(list, head); return; } } __inline static int ldv_mutex_is_locked_148(struct mutex *lock ) ; __inline static int ldv_mutex_is_locked_149(struct mutex *lock ) ; __inline static int ldv_mutex_is_locked_150(struct mutex *lock ) ; int ldv_mutex_trylock_166(struct mutex *ldv_func_arg1 ) ; void ldv_mutex_unlock_164(struct mutex *ldv_func_arg1 ) ; void ldv_mutex_unlock_167(struct mutex *ldv_func_arg1 ) ; void ldv_mutex_unlock_172(struct mutex *ldv_func_arg1 ) ; void ldv_mutex_lock_163(struct mutex *ldv_func_arg1 ) ; void ldv_mutex_lock_165(struct mutex *ldv_func_arg1 ) ; void ldv_mutex_lock_171(struct mutex *ldv_func_arg1 ) ; void ldv_mutex_lock_op_mutex_of_bnx2x_virtf(struct mutex *lock ) ; void ldv_mutex_unlock_op_mutex_of_bnx2x_virtf(struct mutex *lock ) ; extern int pci_find_ext_capability(struct pci_dev * , int ) ; extern struct pci_dev *pci_get_domain_bus_and_slot(int , unsigned int , unsigned int ) ; __inline static struct pci_dev *pci_get_bus_and_slot(unsigned int bus , unsigned int devfn ) { struct pci_dev *tmp ; { tmp = pci_get_domain_bus_and_slot(0, bus, devfn); return (tmp); } } 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_sriov(struct pci_dev * , int ) ; extern void pci_disable_sriov(struct pci_dev * ) ; __inline static bool vfq_is_leading(struct bnx2x_vf_queue *vfq ) { { return ((unsigned int )vfq->index == 0U); } } static u8 vfq_cl_id___0(struct bnx2x_virtf *vf , struct bnx2x_vf_queue *q ) { { return ((int )vf->igu_base_id + (int )((u8 )q->index)); } } __inline static u8 vfq_stat_id(struct bnx2x_virtf *vf , struct bnx2x_vf_queue *q ) { u8 tmp ; { tmp = vfq_cl_id___0(vf, q); return (tmp); } } __inline static struct bnx2x_vfop *bnx2x_vfop_cur___0(struct bnx2x *bp , struct bnx2x_virtf *vf ) { int __ret_warn_on ; int tmp ; long tmp___0 ; int __ret_warn_on___0 ; int tmp___1 ; long tmp___2 ; struct list_head const *__mptr ; { tmp = ldv_mutex_is_locked_148(& vf->op_mutex); __ret_warn_on = tmp == 0; tmp___0 = ldv__builtin_expect(__ret_warn_on != 0, 0L); if (tmp___0 != 0L) { warn_slowpath_fmt("/work/ldvuser/exper_fp/inst/current/envs/linux-3.10-rc1.tar/linux-3.10-rc1/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.h", 517, "about to access vf op linked list but mutex was not locked!"); } else { } ldv__builtin_expect(__ret_warn_on != 0, 0L); tmp___1 = list_empty((struct list_head const *)(& vf->op_list_head)); __ret_warn_on___0 = tmp___1 != 0; tmp___2 = ldv__builtin_expect(__ret_warn_on___0 != 0, 0L); if (tmp___2 != 0L) { warn_slowpath_null("/work/ldvuser/exper_fp/inst/current/envs/linux-3.10-rc1.tar/linux-3.10-rc1/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.h", 518); } else { } ldv__builtin_expect(__ret_warn_on___0 != 0, 0L); __mptr = (struct list_head const *)vf->op_list_head.next; return ((struct bnx2x_vfop *)__mptr); } } __inline static struct bnx2x_vfop *bnx2x_vfop_add___0(struct bnx2x *bp , struct bnx2x_virtf *vf ) { struct bnx2x_vfop *vfop ; void *tmp ; int __ret_warn_on ; int tmp___0 ; long tmp___1 ; { tmp = kzalloc(64UL, 208U); vfop = (struct bnx2x_vfop *)tmp; tmp___0 = ldv_mutex_is_locked_149(& vf->op_mutex); __ret_warn_on = tmp___0 == 0; tmp___1 = ldv__builtin_expect(__ret_warn_on != 0, 0L); if (tmp___1 != 0L) { warn_slowpath_fmt("/work/ldvuser/exper_fp/inst/current/envs/linux-3.10-rc1.tar/linux-3.10-rc1/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.h", 527, "about to access vf op linked list but mutex was not locked!"); } else { } ldv__builtin_expect(__ret_warn_on != 0, 0L); if ((unsigned long )vfop != (unsigned long )((struct bnx2x_vfop *)0)) { INIT_LIST_HEAD(& vfop->link); list_add(& vfop->link, & vf->op_list_head); } else { } return (vfop); } } __inline static void bnx2x_vfop_end___0(struct bnx2x *bp , struct bnx2x_virtf *vf , struct bnx2x_vfop *vfop ) { long tmp ; long tmp___0 ; int __ret_warn_on ; int tmp___1 ; long tmp___2 ; long tmp___3 ; long tmp___4 ; struct bnx2x_vfop *cur_vfop ; long tmp___5 ; long tmp___6 ; int tmp___7 ; long tmp___8 ; long tmp___9 ; long tmp___10 ; int tmp___11 ; { tmp = ldv__builtin_expect((bp->msg_enable & 8388608) != 0, 0L); if (tmp != 0L) { printk("\r[%s:%d(%s)]rc was %d\n", "bnx2x_vfop_end", 539, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", vfop->rc); } else { } if (vfop->rc >= 0) { vfop->rc = 0; } else { } tmp___0 = ldv__builtin_expect((bp->msg_enable & 8388608) != 0, 0L); if (tmp___0 != 0L) { printk("\r[%s:%d(%s)]rc is now %d\n", "bnx2x_vfop_end", 542, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", vfop->rc); } else { } tmp___1 = ldv_mutex_is_locked_150(& vf->op_mutex); __ret_warn_on = tmp___1 == 0; tmp___2 = ldv__builtin_expect(__ret_warn_on != 0, 0L); if (tmp___2 != 0L) { warn_slowpath_fmt("/work/ldvuser/exper_fp/inst/current/envs/linux-3.10-rc1.tar/linux-3.10-rc1/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.h", 548, "about to access vf op linked list but mutex was not locked!"); } else { } ldv__builtin_expect(__ret_warn_on != 0, 0L); list_del(& vfop->link); tmp___7 = list_empty((struct list_head const *)(& vf->op_list_head)); if (tmp___7 != 0) { tmp___3 = ldv__builtin_expect((bp->msg_enable & 8388608) != 0, 0L); if (tmp___3 != 0L) { printk("\r[%s:%d(%s)]list was empty %d\n", "bnx2x_vfop_end", 552, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", vfop->rc); } else { } vf->op_rc = vfop->rc; tmp___4 = ldv__builtin_expect((bp->msg_enable & 8388608) != 0, 0L); if (tmp___4 != 0L) { printk("\r[%s:%d(%s)]copying rc vf->op_rc %d, vfop->rc %d\n", "bnx2x_vfop_end", 555, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", vf->op_rc, vfop->rc); } else { } } else { tmp___5 = ldv__builtin_expect((bp->msg_enable & 8388608) != 0, 0L); if (tmp___5 != 0L) { printk("\r[%s:%d(%s)]list not empty %d\n", "bnx2x_vfop_end", 559, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", vfop->rc); } else { } cur_vfop = bnx2x_vfop_cur___0(bp, vf); cur_vfop->rc = vfop->rc; tmp___6 = ldv__builtin_expect((bp->msg_enable & 8388608) != 0, 0L); if (tmp___6 != 0L) { printk("\r[%s:%d(%s)]copying rc vf->op_rc %d, vfop->rc %d\n", "bnx2x_vfop_end", 563, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", vf->op_rc, vfop->rc); } else { } } if ((unsigned long )vfop->done != (unsigned long )((void (*)(struct bnx2x * , struct bnx2x_virtf * ))0)) { tmp___8 = ldv__builtin_expect((bp->msg_enable & 8388608) != 0, 0L); if (tmp___8 != 0L) { printk("\r[%s:%d(%s)]calling done handler\n", "bnx2x_vfop_end", 568, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } (*(vfop->done))(bp, vf); } else { bnx2x_unlock_vf_pf_channel(bp, vf, 8); } tmp___9 = ldv__builtin_expect((bp->msg_enable & 8388608) != 0, 0L); if (tmp___9 != 0L) { printk("\r[%s:%d(%s)]done handler complete. vf->op_rc %d, vfop->rc %d\n", "bnx2x_vfop_end", 578, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", vf->op_rc, vfop->rc); } else { } tmp___11 = list_empty((struct list_head const *)(& vf->op_list_head)); if (tmp___11 != 0) { tmp___10 = ldv__builtin_expect((bp->msg_enable & 8388608) != 0, 0L); if (tmp___10 != 0L) { printk("\r[%s:%d(%s)]list was empty after done %d\n", "bnx2x_vfop_end", 584, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", vfop->rc); } else { } vf->op_wait_blocking = 0; } else { } kfree((void const *)vfop); return; } } __inline static int bnx2x_vfop_wait_blocking___0(struct bnx2x *bp , struct bnx2x_virtf *vf ) { int cnt ; int tmp ; { cnt = 5000; __might_sleep("/work/ldvuser/exper_fp/inst/current/envs/linux-3.10-rc1.tar/linux-3.10-rc1/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.h", 597, 0); goto ldv_44514; ldv_44513: ; if (! vf->op_wait_blocking) { return (0); } else { } usleep_range(1000UL, 2000UL); if (bp->panic != 0) { return (-5); } else { } ldv_44514: tmp = cnt; cnt = cnt - 1; if (tmp != 0) { goto ldv_44513; } else { } return (-16); } } __inline static int bnx2x_vfop_transition___0(struct bnx2x *bp , struct bnx2x_virtf *vf , void (*transition)(struct bnx2x * , struct bnx2x_virtf * ) , bool block ) { int tmp ; { if ((int )block) { vf->op_wait_blocking = 1; } else { } (*transition)(bp, vf); if ((int )block) { tmp = bnx2x_vfop_wait_blocking___0(bp, vf); return (tmp); } else { } return (0); } } int bnx2x_vfop_vlan_set_cmd(struct bnx2x *bp , struct bnx2x_virtf *vf , struct bnx2x_vfop_cmd *cmd , int qid , u16 vid , bool add ) ; static void storm_memset_vf_to_pf___0(struct bnx2x *bp , u16 abs_fid , u16 pf_id ) { { writeb((int )((unsigned char )pf_id), (void volatile *)bp->regview + (unsigned long )(((unsigned int )(bp->iro_arr + 48UL)->base + (unsigned int )((int )abs_fid * (int )(bp->iro_arr + 48UL)->m1)) + 4325376U)); writeb((int )((unsigned char )pf_id), (void volatile *)bp->regview + (unsigned long )(((unsigned int )(bp->iro_arr + 150UL)->base + (unsigned int )((int )abs_fid * (int )(bp->iro_arr + 150UL)->m1)) + 4259840U)); writeb((int )((unsigned char )pf_id), (void volatile *)bp->regview + (unsigned long )(((unsigned int )(bp->iro_arr + 104UL)->base + (unsigned int )((int )abs_fid * (int )(bp->iro_arr + 104UL)->m1)) + 4390912U)); writeb((int )((unsigned char )pf_id), (void volatile *)bp->regview + (unsigned long )(((unsigned int )(bp->iro_arr + 179UL)->base + (unsigned int )((int )abs_fid * (int )(bp->iro_arr + 179UL)->m1)) + 4194304U)); return; } } static void storm_memset_func_en___0(struct bnx2x *bp , u16 abs_fid , u8 enable ) { { writeb((int )enable, (void volatile *)bp->regview + (unsigned long )(((unsigned int )(bp->iro_arr + 47UL)->base + (unsigned int )((int )abs_fid * (int )(bp->iro_arr + 47UL)->m1)) + 4325376U)); writeb((int )enable, (void volatile *)bp->regview + (unsigned long )(((unsigned int )(bp->iro_arr + 149UL)->base + (unsigned int )((int )abs_fid * (int )(bp->iro_arr + 149UL)->m1)) + 4259840U)); writeb((int )enable, (void volatile *)bp->regview + (unsigned long )(((unsigned int )(bp->iro_arr + 103UL)->base + (unsigned int )((int )abs_fid * (int )(bp->iro_arr + 103UL)->m1)) + 4390912U)); writeb((int )enable, (void volatile *)bp->regview + (unsigned long )(((unsigned int )(bp->iro_arr + 178UL)->base + (unsigned int )((int )abs_fid * (int )(bp->iro_arr + 178UL)->m1)) + 4194304U)); return; } } int bnx2x_vf_idx_by_abs_fid(struct bnx2x *bp , u16 abs_vfid ) { int idx ; { idx = 0; goto ldv_45804; ldv_45803: ; if ((int )((unsigned short )((bp->vfdb)->vfs + (unsigned long )idx)->abs_vfid) == (int )abs_vfid) { goto ldv_45802; } else { } idx = idx + 1; ldv_45804: ; if ((int )(bp->vfdb)->sriov.nr_virtfn > idx) { goto ldv_45803; } else { } ldv_45802: ; return (idx); } } static struct bnx2x_virtf *bnx2x_vf_by_abs_fid(struct bnx2x *bp , u16 abs_vfid ) { u16 idx ; int tmp ; { tmp = bnx2x_vf_idx_by_abs_fid(bp, (int )abs_vfid); idx = (unsigned short )tmp; return ((int )(bp->vfdb)->sriov.nr_virtfn > (int )idx ? (bp->vfdb)->vfs + (unsigned long )idx : 0); } } static void bnx2x_vf_igu_ack_sb(struct bnx2x *bp , struct bnx2x_virtf *vf , u8 igu_sb_id , u8 segment , u16 index , u8 op , u8 update ) { u32 ctl ; u32 igu_addr_data ; u32 igu_addr_ctl ; u32 func_encode ; u32 addr_encode ; struct igu_regular cmd_data ; long tmp ; long tmp___0 ; { igu_addr_data = 1245476U; igu_addr_ctl = 1245484U; func_encode = (u32 )vf->abs_vfid; addr_encode = (u32 )((int )igu_sb_id + 1280); cmd_data.sb_id_and_flags = 0U; cmd_data.reserved_2 = 0U; cmd_data.sb_id_and_flags = (u32 )((((int )index | ((int )segment << 21)) | ((int )update << 24)) | ((int )op << 25)); ctl = ((func_encode << 12) | addr_encode) | 1048576U; tmp = ldv__builtin_expect((bp->msg_enable & 8192) != 0, 0L); if (tmp != 0L) { printk("\r[%s:%d(%s)]write 0x%08x to IGU(via GRC) addr 0x%x\n", "bnx2x_vf_igu_ack_sb", 166, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", cmd_data.sb_id_and_flags, igu_addr_data); } else { } writel(cmd_data.sb_id_and_flags, (void volatile *)bp->regview + (unsigned long )igu_addr_data); __asm__ volatile ("": : : "memory"); __asm__ volatile ("": : : "memory"); tmp___0 = ldv__builtin_expect((bp->msg_enable & 8192) != 0, 0L); if (tmp___0 != 0L) { printk("\r[%s:%d(%s)]write 0x%08x to IGU(via GRC) addr 0x%x\n", "bnx2x_vf_igu_ack_sb", 172, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", ctl, igu_addr_ctl); } else { } writel(ctl, (void volatile *)bp->regview + (unsigned long )igu_addr_ctl); __asm__ volatile ("": : : "memory"); __asm__ volatile ("": : : "memory"); return; } } void bnx2x_vfop_qctor_dump_tx(struct bnx2x *bp , struct bnx2x_virtf *vf , struct bnx2x_queue_init_params *init_params , struct bnx2x_queue_setup_params *setup_params , u16 q_idx , u16 sb_idx ) { long tmp ; { tmp = ldv__builtin_expect((bp->msg_enable & 8388608) != 0, 0L); if (tmp != 0L) { printk("\r[%s:%d(%s)]VF[%d] Q_SETUP: txq[%d]-- vfsb=%d, sb-index=%d, hc-rate=%d, flags=0x%lx, traffic-type=%d", "bnx2x_vfop_qctor_dump_tx", 260, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )vf->abs_vfid, (int )q_idx, (int )sb_idx, (int )init_params->tx.sb_cq_index, (int )init_params->tx.hc_rate, setup_params->flags, (int )setup_params->txq_params.traffic_type); } else { } return; } } void bnx2x_vfop_qctor_dump_rx(struct bnx2x *bp , struct bnx2x_virtf *vf , struct bnx2x_queue_init_params *init_params , struct bnx2x_queue_setup_params *setup_params , u16 q_idx , u16 sb_idx ) { struct bnx2x_rxq_setup_params *rxq_params ; long tmp ; { rxq_params = & setup_params->rxq_params; tmp = ldv__builtin_expect((bp->msg_enable & 8388608) != 0, 0L); if (tmp != 0L) { printk("\r[%s:%d(%s)]VF[%d] Q_SETUP: rxq[%d]-- vfsb=%d, sb-index=%d, hc-rate=%d, mtu=%d, buf-size=%d\nsge-size=%d, max_sge_pkt=%d, tpa-agg-size=%d, flags=0x%lx, drop-flags=0x%x, cache-log=%d\n", "bnx2x_vfop_qctor_dump_rx", 284, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )vf->abs_vfid, (int )q_idx, (int )sb_idx, (int )init_params->rx.sb_cq_index, (int )init_params->rx.hc_rate, (int )setup_params->gen_params.mtu, (int )rxq_params->buf_sz, (int )rxq_params->sge_buf_sz, (int )rxq_params->max_sges_pkt, (int )rxq_params->tpa_agg_sz, setup_params->flags, (int )rxq_params->drop_flags, (int )rxq_params->cache_line_log); } else { } return; } } void bnx2x_vfop_qctor_prep(struct bnx2x *bp , struct bnx2x_virtf *vf , struct bnx2x_vf_queue *q , struct bnx2x_vfop_qctor_params *p , unsigned long q_type ) { struct bnx2x_queue_init_params *init_p ; struct bnx2x_queue_setup_params *setup_p ; int tmp ; int tmp___0 ; int tmp___1 ; bool tmp___2 ; struct bnx2x_rxq_setup_params *rxq_p ; int tmp___3 ; int tmp___4 ; int tmp___5 ; { init_p = & p->qstate.params.init; setup_p = & p->prep_qsetup; tmp = constant_test_bit(9U, (unsigned long const volatile *)(& init_p->rx.flags)); if (tmp != 0) { __set_bit(10, (unsigned long volatile *)(& init_p->rx.flags)); } else { } tmp___0 = constant_test_bit(9U, (unsigned long const volatile *)(& init_p->tx.flags)); if (tmp___0 != 0) { __set_bit(10, (unsigned long volatile *)(& init_p->tx.flags)); } else { } init_p->rx.fw_sb_id = vf_igu_sb(vf, (int )q->sb_idx); init_p->tx.fw_sb_id = vf_igu_sb(vf, (int )q->sb_idx); init_p->cxts[0] = q->cxt; setup_p->gen_params.spcl_id = vf->sp_cl_id; setup_p->gen_params.stat_id = vfq_stat_id(vf, q); if (((int )vf->cfg_flags & 2) != 0) { printk("\v[%s:%d(%s)]No support for pause to VFs (abs_vfid: %d)\n", "bnx2x_vfop_qctor_prep", 325, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )vf->abs_vfid); } else { } tmp___1 = constant_test_bit(3U, (unsigned long const volatile *)(& setup_p->flags)); if (tmp___1 != 0) { __set_bit(4, (unsigned long volatile *)(& setup_p->flags)); } else { } __set_bit(16, (unsigned long volatile *)(& setup_p->flags)); __set_bit(17, (unsigned long volatile *)(& setup_p->flags)); __set_bit(18, (unsigned long volatile *)(& setup_p->flags)); tmp___2 = vfq_is_leading(q); if ((int )tmp___2) { __set_bit(13, (unsigned long volatile *)(& setup_p->flags)); __set_bit(14, (unsigned long volatile *)(& setup_p->flags)); } else { } tmp___4 = constant_test_bit(0U, (unsigned long const volatile *)(& q_type)); if (tmp___4 != 0) { rxq_p = & setup_p->rxq_params; rxq_p->cl_qzone_id = vfq_stat_id(vf, q); rxq_p->fw_sb_id = vf_igu_sb(vf, (int )q->sb_idx); rxq_p->rss_engine_id = (unsigned int )vf->abs_vfid + 8U; tmp___3 = constant_test_bit(0U, (unsigned long const volatile *)(& setup_p->flags)); if (tmp___3 != 0) { rxq_p->max_tpa_queues = 8U; } else { } } else { } tmp___5 = constant_test_bit(1U, (unsigned long const volatile *)(& q_type)); if (tmp___5 != 0) { setup_p->txq_params.tss_leading_cl_id = (u8 )vf->leading_rss; setup_p->txq_params.fw_sb_id = vf_igu_sb(vf, (int )q->sb_idx); } else { } return; } } static void bnx2x_vfop_qctor(struct bnx2x *bp , struct bnx2x_virtf *vf ) { struct bnx2x_vfop *vfop ; struct bnx2x_vfop *tmp ; struct bnx2x_vfop_args_qctor *args ; struct bnx2x_queue_state_params *q_params ; enum bnx2x_vfop_qctor_state state ; long tmp___0 ; long tmp___1 ; int tmp___2 ; long tmp___3 ; long tmp___4 ; u8 tmp___5 ; { tmp = bnx2x_vfop_cur___0(bp, vf); vfop = tmp; args = & vfop->args.qctor; q_params = & (vfop->op_p)->qctor.qstate; state = (enum bnx2x_vfop_qctor_state )vfop->state; atomic_set(& vf->op_in_progress, 0); if (vfop->rc < 0) { goto op_err; } else { } tmp___0 = ldv__builtin_expect((bp->msg_enable & 8388608) != 0, 0L); if (tmp___0 != 0L) { printk("\r[%s:%d(%s)]vf[%d] STATE: %d\n", "bnx2x_vfop_qctor", 377, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )vf->abs_vfid, (unsigned int )state); } else { } switch ((unsigned int )state) { case 0U: tmp___2 = bnx2x_get_q_logical_state(bp, q_params->q_obj); if (tmp___2 == 0) { tmp___1 = ldv__builtin_expect((bp->msg_enable & 8388608) != 0, 0L); if (tmp___1 != 0L) { printk("\r[%s:%d(%s)]Entered qctor but queue was already up. Aborting gracefully\n", "bnx2x_vfop_qctor", 386, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } goto op_done; } else { } vfop->state = 1; q_params->cmd = 0; vfop->rc = bnx2x_queue_state_change(bp, q_params); if (vfop->rc < 0) { goto op_err; } else if (vfop->rc > 0) { goto op_pending; } else { tmp___3 = ldv__builtin_expect((bp->msg_enable & 8388608) != 0, 0L); if (tmp___3 != 0L) { printk("\r[%s:%d(%s)]no ramrod. scheduling\n", "bnx2x_vfop_qctor", 396, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } atomic_set(& vf->op_in_progress, 1); queue_delayed_work(bnx2x_wq, & bp->sp_task, 0UL); return; } case 1U: vfop->state = 2; (vfop->op_p)->qctor.qstate.params.setup = (vfop->op_p)->qctor.prep_qsetup; q_params->cmd = 1; vfop->rc = bnx2x_queue_state_change(bp, q_params); if (vfop->rc < 0) { goto op_err; } else if (vfop->rc > 0) { goto op_pending; } else { tmp___4 = ldv__builtin_expect((bp->msg_enable & 8388608) != 0, 0L); if (tmp___4 != 0L) { printk("\r[%s:%d(%s)]no ramrod. scheduling\n", "bnx2x_vfop_qctor", 409, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } atomic_set(& vf->op_in_progress, 1); queue_delayed_work(bnx2x_wq, & bp->sp_task, 0UL); return; } case 2U: tmp___5 = vf_igu_sb(vf, (int )args->sb_idx); bnx2x_vf_igu_ack_sb(bp, vf, (int )tmp___5, 0, 0, 0, 0); goto op_done; default: printk("\v[%s:%d(%s)]Bad state %d\n", "bnx2x_vfop_qctor", 418, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (unsigned int )state); vfop->rc = -22; goto op_err; } op_err: printk("\v[%s:%d(%s)]QCTOR[%d:%d] error: cmd %d, rc %d\n", "bnx2x_vfop_qctor", 422, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )vf->abs_vfid, args->qid, (unsigned int )q_params->cmd, vfop->rc); op_done: bnx2x_vfop_end___0(bp, vf, vfop); op_pending: ; return; } } static int bnx2x_vfop_qctor_cmd(struct bnx2x *bp , struct bnx2x_virtf *vf , struct bnx2x_vfop_cmd *cmd , int qid ) { struct bnx2x_vfop *vfop ; struct bnx2x_vfop *tmp ; int tmp___0 ; { tmp = bnx2x_vfop_add___0(bp, vf); vfop = tmp; if ((unsigned long )vfop != (unsigned long )((struct bnx2x_vfop *)0)) { vf->op_params.qctor.qstate.q_obj = & (vf->vfqs + (unsigned long )qid)->sp_obj; vfop->args.qctor.qid = qid; vfop->args.qctor.sb_idx = (vf->vfqs + (unsigned long )qid)->sb_idx; vfop->state = 0; vfop->op_p = & vf->op_params; vfop->transition = & bnx2x_vfop_qctor; vfop->done = cmd->done; tmp___0 = bnx2x_vfop_transition___0(bp, vf, & bnx2x_vfop_qctor, (int )cmd->block); return (tmp___0); } else { } return (-12); } } static void bnx2x_vfop_qdtor(struct bnx2x *bp , struct bnx2x_virtf *vf ) { struct bnx2x_vfop *vfop ; struct bnx2x_vfop *tmp ; struct bnx2x_vfop_args_qdtor *qdtor ; struct bnx2x_queue_state_params *q_params ; enum bnx2x_vfop_qdtor_state state ; long tmp___0 ; long tmp___1 ; int tmp___2 ; long tmp___3 ; long tmp___4 ; { tmp = bnx2x_vfop_cur___0(bp, vf); vfop = tmp; qdtor = & vfop->args.qdtor; q_params = & (vfop->op_p)->qctor.qstate; state = (enum bnx2x_vfop_qdtor_state )vfop->state; atomic_set(& vf->op_in_progress, 0); if (vfop->rc < 0) { goto op_err; } else { } tmp___0 = ldv__builtin_expect((bp->msg_enable & 8388608) != 0, 0L); if (tmp___0 != 0L) { printk("\r[%s:%d(%s)]vf[%d] STATE: %d\n", "bnx2x_vfop_qdtor", 463, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )vf->abs_vfid, (unsigned int )state); } else { } switch ((unsigned int )state) { case 0U: tmp___2 = bnx2x_get_q_logical_state(bp, q_params->q_obj); if (tmp___2 == 1) { tmp___1 = ldv__builtin_expect((bp->msg_enable & 8388608) != 0, 0L); if (tmp___1 != 0L) { printk("\r[%s:%d(%s)]Entered qdtor but queue was already stopped. Aborting gracefully\n", "bnx2x_vfop_qdtor", 472, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } goto op_done; } else { } vfop->state = 1; q_params->cmd = 7; vfop->rc = bnx2x_queue_state_change(bp, q_params); if (vfop->rc < 0) { goto op_err; } else if (vfop->rc > 0) { goto op_pending; } else { tmp___3 = ldv__builtin_expect((bp->msg_enable & 8388608) != 0, 0L); if (tmp___3 != 0L) { printk("\r[%s:%d(%s)]no ramrod. scheduling\n", "bnx2x_vfop_qdtor", 482, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } atomic_set(& vf->op_in_progress, 1); queue_delayed_work(bnx2x_wq, & bp->sp_task, 0UL); return; } case 1U: vfop->state = 2; q_params->cmd = 9; vfop->rc = bnx2x_queue_state_change(bp, q_params); if (vfop->rc < 0) { goto op_err; } else if (vfop->rc > 0) { goto op_pending; } else { tmp___4 = ldv__builtin_expect((bp->msg_enable & 8388608) != 0, 0L); if (tmp___4 != 0L) { printk("\r[%s:%d(%s)]no ramrod. scheduling\n", "bnx2x_vfop_qdtor", 491, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } atomic_set(& vf->op_in_progress, 1); queue_delayed_work(bnx2x_wq, & bp->sp_task, 0UL); return; } case 2U: vfop->state = 3; q_params->cmd = 8; vfop->rc = bnx2x_queue_state_change(bp, q_params); if (vfop->rc < 0) { goto op_err; } else if (vfop->rc > 0) { goto op_pending; } else { goto op_done; } op_err: printk("\v[%s:%d(%s)]QDTOR[%d:%d] error: cmd %d, rc %d\n", "bnx2x_vfop_qdtor", 503, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )vf->abs_vfid, qdtor->qid, (unsigned int )q_params->cmd, vfop->rc); op_done: ; case 3U: (qdtor->cxt)->ustorm_ag_context.cdu_usage = 0U; (qdtor->cxt)->xstorm_ag_context.cdu_reserved = 0U; bnx2x_vfop_end___0(bp, vf, vfop); return; default: printk("\v[%s:%d(%s)]Bad state %d\n", "bnx2x_vfop_qdtor", 512, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (unsigned int )state); vfop->rc = -22; goto op_err; } op_pending: ; return; } } static int bnx2x_vfop_qdtor_cmd(struct bnx2x *bp , struct bnx2x_virtf *vf , struct bnx2x_vfop_cmd *cmd , int qid ) { struct bnx2x_vfop *vfop ; struct bnx2x_vfop *tmp ; struct bnx2x_queue_state_params *qstate ; int tmp___0 ; long tmp___1 ; { tmp = bnx2x_vfop_add___0(bp, vf); vfop = tmp; if ((unsigned long )vfop != (unsigned long )((struct bnx2x_vfop *)0)) { qstate = & vf->op_params.qctor.qstate; memset((void *)qstate, 0, 136UL); qstate->q_obj = & (vf->vfqs + (unsigned long )qid)->sp_obj; vfop->args.qdtor.qid = qid; vfop->args.qdtor.cxt = (vf->vfqs + (unsigned long )qid)->cxt; vfop->state = 0; vfop->op_p = & vf->op_params; vfop->transition = & bnx2x_vfop_qdtor; vfop->done = cmd->done; tmp___0 = bnx2x_vfop_transition___0(bp, vf, & bnx2x_vfop_qdtor, (int )cmd->block); return (tmp___0); } else { } tmp___1 = ldv__builtin_expect((bp->msg_enable & 8388608) != 0, 0L); if (tmp___1 != 0L) { printk("\r[%s:%d(%s)]VF[%d] failed to add a vfop.\n", "bnx2x_vfop_qdtor_cmd", 540, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )vf->abs_vfid); } else { } return (-12); } } static void bnx2x_vf_set_igu_info(struct bnx2x *bp , u8 igu_sb_id , u8 abs_vfid ) { struct bnx2x_virtf *vf ; struct bnx2x_virtf *tmp ; { tmp = bnx2x_vf_by_abs_fid(bp, (int )abs_vfid); vf = tmp; if ((unsigned long )vf != (unsigned long )((struct bnx2x_virtf *)0)) { if ((unsigned int )vf->alloc_resc.num_sbs == 0U) { vf->igu_base_id = igu_sb_id; } else { } vf->alloc_resc.num_sbs = (u8 )((int )vf->alloc_resc.num_sbs + 1); } else { } return; } } __inline static void bnx2x_vfop_credit(struct bnx2x *bp , struct bnx2x_vfop *vfop , struct bnx2x_vlan_mac_obj *obj ) { struct bnx2x_vfop_args_filters *args ; int cnt ; struct list_head *pos ; { args = & vfop->args.filters; if (vfop->rc == 0 && (unsigned long )args->credit != (unsigned long )((atomic_t *)0)) { cnt = 0; pos = obj->head.next; goto ldv_45964; ldv_45963: cnt = cnt + 1; pos = pos->next; ldv_45964: ; if ((unsigned long )(& obj->head) != (unsigned long )pos) { goto ldv_45963; } else { } atomic_set(args->credit, cnt); } else { } return; } } static int bnx2x_vfop_set_user_req(struct bnx2x *bp , struct bnx2x_vfop_filter *pos , struct bnx2x_vlan_mac_data *user_req ) { size_t __len ; void *__ret ; { user_req->cmd = (int )pos->add ? 0 : 1; switch (pos->type) { case 1: __len = 6UL; if (__len > 63UL) { __ret = __memcpy((void *)(& user_req->u.mac.mac), (void const *)pos->mac, __len); } else { __ret = __builtin_memcpy((void *)(& user_req->u.mac.mac), (void const *)pos->mac, __len); } goto ldv_45975; case 2: user_req->u.vlan.vlan = pos->vid; goto ldv_45975; default: printk("\v[%s:%d(%s)]Invalid filter type, skipping\n", "bnx2x_vfop_set_user_req", 591, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); return (1); } ldv_45975: ; return (0); } } static int bnx2x_vfop_config_vlan0(struct bnx2x *bp , struct bnx2x_vlan_mac_ramrod_params *vlan_mac , bool add ) { int rc ; { vlan_mac->user_req.cmd = (int )add ? 0 : 1; vlan_mac->user_req.u.vlan.vlan = 0U; rc = bnx2x_config_vlan_mac(bp, vlan_mac); if (rc == -17) { rc = 0; } else { } return (rc); } } static int bnx2x_vfop_config_list(struct bnx2x *bp , struct bnx2x_vfop_filters *filters , struct bnx2x_vlan_mac_ramrod_params *vlan_mac ) { struct bnx2x_vfop_filter *pos ; struct bnx2x_vfop_filter *tmp ; struct list_head rollback_list ; struct list_head *filters_list ; struct bnx2x_vlan_mac_data *user_req ; int rc ; int cnt ; struct list_head const *__mptr ; struct list_head const *__mptr___0 ; int tmp___0 ; struct list_head const *__mptr___1 ; struct list_head const *__mptr___2 ; struct list_head const *__mptr___3 ; struct list_head const *__mptr___4 ; { filters_list = & filters->head; user_req = & vlan_mac->user_req; rc = 0; cnt = 0; INIT_LIST_HEAD(& rollback_list); __mptr = (struct list_head const *)filters_list->next; pos = (struct bnx2x_vfop_filter *)__mptr; __mptr___0 = (struct list_head const *)pos->link.next; tmp = (struct bnx2x_vfop_filter *)__mptr___0; goto ldv_46007; ldv_46006: tmp___0 = bnx2x_vfop_set_user_req(bp, pos, user_req); if (tmp___0 != 0) { goto ldv_46003; } else { } rc = bnx2x_config_vlan_mac(bp, vlan_mac); if (rc >= 0) { cnt = ((int )pos->add ? 1 : -1) + cnt; list_move(& pos->link, & rollback_list); rc = 0; } else if (rc == -17) { rc = 0; } else { printk("\v[%s:%d(%s)]Failed to add a new vlan_mac command\n", "bnx2x_vfop_config_list", 637, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); goto ldv_46005; } ldv_46003: pos = tmp; __mptr___1 = (struct list_head const *)tmp->link.next; tmp = (struct bnx2x_vfop_filter *)__mptr___1; ldv_46007: ; if ((unsigned long )(& pos->link) != (unsigned long )filters_list) { goto ldv_46006; } else { } ldv_46005: ; if (rc != 0 || filters->add_cnt < cnt) { printk("\v[%s:%d(%s)]error or too many rules added. Performing rollback\n", "bnx2x_vfop_config_list", 644, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); __mptr___2 = (struct list_head const *)rollback_list.next; pos = (struct bnx2x_vfop_filter *)__mptr___2; __mptr___3 = (struct list_head const *)pos->link.next; tmp = (struct bnx2x_vfop_filter *)__mptr___3; goto ldv_46015; ldv_46014: pos->add = (bool )(! ((int )pos->add != 0)); bnx2x_vfop_set_user_req(bp, pos, user_req); bnx2x_config_vlan_mac(bp, vlan_mac); list_del(& pos->link); pos = tmp; __mptr___4 = (struct list_head const *)tmp->link.next; tmp = (struct bnx2x_vfop_filter *)__mptr___4; ldv_46015: ; if ((unsigned long )(& pos->link) != (unsigned long )(& rollback_list)) { goto ldv_46014; } else { } cnt = 0; if (rc == 0) { rc = -22; } else { } } else { } filters->add_cnt = cnt; return (rc); } } static void bnx2x_vfop_vlan_mac(struct bnx2x *bp , struct bnx2x_virtf *vf ) { struct bnx2x_vfop *vfop ; struct bnx2x_vfop *tmp ; struct bnx2x_vlan_mac_ramrod_params *vlan_mac ; struct bnx2x_vlan_mac_obj *obj ; struct bnx2x_vfop_filters *filters ; enum bnx2x_vfop_vlan_mac_state state ; long tmp___0 ; bool tmp___3 ; long tmp___6 ; int tmp___7 ; { tmp = bnx2x_vfop_cur___0(bp, vf); vfop = tmp; vlan_mac = & (vfop->op_p)->vlan_mac; obj = vlan_mac->vlan_mac_obj; filters = vfop->args.filters.multi_filter; state = (enum bnx2x_vfop_vlan_mac_state )vfop->state; if (vfop->rc < 0) { goto op_err; } else { } tmp___0 = ldv__builtin_expect((bp->msg_enable & 8388608) != 0, 0L); if (tmp___0 != 0L) { printk("\r[%s:%d(%s)]vf[%d] STATE: %d\n", "bnx2x_vfop_vlan_mac", 672, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )vf->abs_vfid, (unsigned int )state); } else { } atomic_set(& vf->op_in_progress, 0); switch ((unsigned int )state) { case 1U: vfop->state = 2; vfop->rc = (*(obj->delete_all))(bp, obj, & vlan_mac->user_req.vlan_mac_flags, & vlan_mac->ramrod_flags); if (vfop->rc < 0) { goto op_err; } else if (vfop->rc > 0) { goto op_pending; } else { goto op_done; } case 0U: vfop->state = 2; vfop->rc = bnx2x_config_vlan_mac(bp, vlan_mac); if (vfop->rc == -17) { vfop->rc = 0; } else { } if (vfop->rc < 0) { goto op_err; } else if (vfop->rc > 0) { goto op_pending; } else { goto op_done; } case 2U: tmp___3 = (*(obj->raw.check_pending))(& obj->raw); vfop->rc = (int )tmp___3; if (vfop->rc < 0) { goto op_err; } else if (vfop->rc > 0) { goto op_pending; } else { goto op_done; } case 3U: vfop->state = 2; vfop->rc = bnx2x_vfop_config_list(bp, filters, vlan_mac); if (vfop->rc != 0) { goto op_err; } else { } set_bit(6U, (unsigned long volatile *)(& vlan_mac->ramrod_flags)); vfop->rc = bnx2x_config_vlan_mac(bp, vlan_mac); if (vfop->rc < 0) { goto op_err; } else if (vfop->rc > 0) { goto op_pending; } else { goto op_done; } case 4U: vfop->state = 5; vfop->rc = bnx2x_vfop_config_vlan0(bp, vlan_mac, 0); if (vfop->rc != 0) { goto op_err; } else { } vfop->rc = bnx2x_vfop_config_list(bp, filters, vlan_mac); if (vfop->rc == 0) { set_bit(6U, (unsigned long volatile *)(& vlan_mac->ramrod_flags)); vfop->rc = bnx2x_config_vlan_mac(bp, vlan_mac); } else { } if (vfop->rc < 0) { goto op_err; } else if (vfop->rc > 0) { goto op_pending; } else { tmp___6 = ldv__builtin_expect((bp->msg_enable & 8388608) != 0, 0L); if (tmp___6 != 0L) { printk("\r[%s:%d(%s)]no ramrod. scheduling\n", "bnx2x_vfop_vlan_mac", 733, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } atomic_set(& vf->op_in_progress, 1); queue_delayed_work(bnx2x_wq, & bp->sp_task, 0UL); return; } case 5U: vfop->state = 2; tmp___7 = list_empty((struct list_head const *)(& obj->head)); if (tmp___7 != 0) { vfop->rc = bnx2x_vfop_config_vlan0(bp, vlan_mac, 1); } else { } if (vfop->rc < 0) { goto op_err; } else if (vfop->rc > 0) { goto op_pending; } else { goto op_done; } default: printk("\v[%s:%d(%s)]Bad state %d\n", "bnx2x_vfop_vlan_mac", 745, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (unsigned int )state); vfop->rc = -22; goto op_err; } op_err: printk("\v[%s:%d(%s)]VLAN-MAC error: rc %d\n", "bnx2x_vfop_vlan_mac", 748, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", vfop->rc); op_done: kfree((void const *)filters); bnx2x_vfop_credit(bp, vfop, obj); bnx2x_vfop_end___0(bp, vf, vfop); op_pending: ; return; } } static void bnx2x_vfop_vlan_mac_prep_ramrod(struct bnx2x_vlan_mac_ramrod_params *ramrod , struct bnx2x_vfop_vlan_mac_flags *flags ) { struct bnx2x_vlan_mac_data *ureq ; { ureq = & ramrod->user_req; memset((void *)ramrod, 0, 56UL); if ((int )flags->drv_only) { set_bit(3U, (unsigned long volatile *)(& ramrod->ramrod_flags)); } else { } if ((int )flags->single_cmd) { set_bit(5U, (unsigned long volatile *)(& ramrod->ramrod_flags)); } else { } if ((int )flags->dont_consume) { set_bit(4U, (unsigned long volatile *)(& ureq->vlan_mac_flags)); } else { } ureq->cmd = (int )flags->add ? 0 : 1; return; } } __inline static void bnx2x_vfop_mac_prep_ramrod(struct bnx2x_vlan_mac_ramrod_params *ramrod , struct bnx2x_vfop_vlan_mac_flags *flags ) { { bnx2x_vfop_vlan_mac_prep_ramrod(ramrod, flags); set_bit(1U, (unsigned long volatile *)(& ramrod->user_req.vlan_mac_flags)); return; } } static int bnx2x_vfop_mac_delall_cmd(struct bnx2x *bp , struct bnx2x_virtf *vf , struct bnx2x_vfop_cmd *cmd , int qid , bool drv_only ) { struct bnx2x_vfop *vfop ; struct bnx2x_vfop *tmp ; struct bnx2x_vfop_args_filters filters ; struct bnx2x_vfop_vlan_mac_flags flags ; struct bnx2x_vlan_mac_ramrod_params *ramrod ; int tmp___0 ; { tmp = bnx2x_vfop_add___0(bp, vf); vfop = tmp; if ((unsigned long )vfop != (unsigned long )((struct bnx2x_vfop *)0)) { filters.multi_filter = 0; filters.credit = 0; flags.drv_only = drv_only; flags.dont_consume = (unsigned long )filters.credit != (unsigned long )((atomic_t *)0); flags.single_cmd = 1; flags.add = 0; ramrod = & vf->op_params.vlan_mac; bnx2x_vfop_mac_prep_ramrod(ramrod, & flags); ramrod->vlan_mac_obj = & (vf->vfqs + (unsigned long )qid)->mac_obj; vfop->args.filters = filters; vfop->state = 1; vfop->op_p = & vf->op_params; vfop->transition = & bnx2x_vfop_vlan_mac; vfop->done = cmd->done; tmp___0 = bnx2x_vfop_transition___0(bp, vf, & bnx2x_vfop_vlan_mac, (int )cmd->block); return (tmp___0); } else { } return (-12); } } int bnx2x_vfop_mac_list_cmd(struct bnx2x *bp , struct bnx2x_virtf *vf , struct bnx2x_vfop_cmd *cmd , struct bnx2x_vfop_filters *macs , int qid , bool drv_only ) { struct bnx2x_vfop *vfop ; struct bnx2x_vfop *tmp ; struct bnx2x_vfop_args_filters filters ; struct bnx2x_vfop_vlan_mac_flags flags ; struct bnx2x_vlan_mac_ramrod_params *ramrod ; int tmp___0 ; { tmp = bnx2x_vfop_add___0(bp, vf); vfop = tmp; if ((unsigned long )vfop != (unsigned long )((struct bnx2x_vfop *)0)) { filters.multi_filter = macs; filters.credit = 0; flags.drv_only = drv_only; flags.dont_consume = (unsigned long )filters.credit != (unsigned long )((atomic_t *)0); flags.single_cmd = 0; flags.add = 0; ramrod = & vf->op_params.vlan_mac; bnx2x_vfop_mac_prep_ramrod(ramrod, & flags); ramrod->vlan_mac_obj = & (vf->vfqs + (unsigned long )qid)->mac_obj; (filters.multi_filter)->add_cnt = 65536; vfop->args.filters = filters; vfop->state = 3; vfop->op_p = & vf->op_params; vfop->transition = & bnx2x_vfop_vlan_mac; vfop->done = cmd->done; tmp___0 = bnx2x_vfop_transition___0(bp, vf, & bnx2x_vfop_vlan_mac, (int )cmd->block); return (tmp___0); } else { } return (-12); } } int bnx2x_vfop_vlan_set_cmd(struct bnx2x *bp , struct bnx2x_virtf *vf , struct bnx2x_vfop_cmd *cmd , int qid , u16 vid , bool add ) { struct bnx2x_vfop *vfop ; struct bnx2x_vfop *tmp ; struct bnx2x_vfop_args_filters filters ; struct bnx2x_vfop_vlan_mac_flags flags ; struct bnx2x_vlan_mac_ramrod_params *ramrod ; int tmp___0 ; { tmp = bnx2x_vfop_add___0(bp, vf); vfop = tmp; if ((unsigned long )vfop != (unsigned long )((struct bnx2x_vfop *)0)) { filters.multi_filter = 0; filters.credit = & (vf->vfqs + (unsigned long )qid)->vlan_count; flags.drv_only = 0; flags.dont_consume = (unsigned long )filters.credit != (unsigned long )((atomic_t *)0); flags.single_cmd = 1; flags.add = add; ramrod = & vf->op_params.vlan_mac; bnx2x_vfop_vlan_mac_prep_ramrod(ramrod, & flags); ramrod->user_req.u.vlan.vlan = vid; ramrod->vlan_mac_obj = & (vf->vfqs + (unsigned long )qid)->vlan_obj; vfop->args.filters = filters; vfop->state = 0; vfop->op_p = & vf->op_params; vfop->transition = & bnx2x_vfop_vlan_mac; vfop->done = cmd->done; tmp___0 = bnx2x_vfop_transition___0(bp, vf, & bnx2x_vfop_vlan_mac, (int )cmd->block); return (tmp___0); } else { } return (-12); } } static int bnx2x_vfop_vlan_delall_cmd(struct bnx2x *bp , struct bnx2x_virtf *vf , struct bnx2x_vfop_cmd *cmd , int qid , bool drv_only ) { struct bnx2x_vfop *vfop ; struct bnx2x_vfop *tmp ; struct bnx2x_vfop_args_filters filters ; struct bnx2x_vfop_vlan_mac_flags flags ; struct bnx2x_vlan_mac_ramrod_params *ramrod ; int tmp___0 ; { tmp = bnx2x_vfop_add___0(bp, vf); vfop = tmp; if ((unsigned long )vfop != (unsigned long )((struct bnx2x_vfop *)0)) { filters.multi_filter = 0; filters.credit = & (vf->vfqs + (unsigned long )qid)->vlan_count; flags.drv_only = drv_only; flags.dont_consume = (unsigned long )filters.credit != (unsigned long )((atomic_t *)0); flags.single_cmd = 1; flags.add = 0; ramrod = & vf->op_params.vlan_mac; bnx2x_vfop_vlan_mac_prep_ramrod(ramrod, & flags); ramrod->vlan_mac_obj = & (vf->vfqs + (unsigned long )qid)->vlan_obj; vfop->args.filters = filters; vfop->state = 1; vfop->op_p = & vf->op_params; vfop->transition = & bnx2x_vfop_vlan_mac; vfop->done = cmd->done; tmp___0 = bnx2x_vfop_transition___0(bp, vf, & bnx2x_vfop_vlan_mac, (int )cmd->block); return (tmp___0); } else { } return (-12); } } int bnx2x_vfop_vlan_list_cmd(struct bnx2x *bp , struct bnx2x_virtf *vf , struct bnx2x_vfop_cmd *cmd , struct bnx2x_vfop_filters *vlans , int qid , bool drv_only ) { struct bnx2x_vfop *vfop ; struct bnx2x_vfop *tmp ; struct bnx2x_vfop_args_filters filters ; struct bnx2x_vfop_vlan_mac_flags flags ; struct bnx2x_vlan_mac_ramrod_params *ramrod ; int tmp___0 ; int tmp___1 ; { tmp = bnx2x_vfop_add___0(bp, vf); vfop = tmp; if ((unsigned long )vfop != (unsigned long )((struct bnx2x_vfop *)0)) { filters.multi_filter = vlans; filters.credit = & (vf->vfqs + (unsigned long )qid)->vlan_count; flags.drv_only = drv_only; flags.dont_consume = (unsigned long )filters.credit != (unsigned long )((atomic_t *)0); flags.single_cmd = 0; flags.add = 0; ramrod = & vf->op_params.vlan_mac; bnx2x_vfop_vlan_mac_prep_ramrod(ramrod, & flags); ramrod->vlan_mac_obj = & (vf->vfqs + (unsigned long )qid)->vlan_obj; tmp___0 = atomic_read((atomic_t const *)filters.credit); (filters.multi_filter)->add_cnt = (int )vf->alloc_resc.num_vlan_filters - tmp___0; vfop->args.filters = filters; vfop->state = 4; vfop->op_p = & vf->op_params; vfop->transition = & bnx2x_vfop_vlan_mac; vfop->done = cmd->done; tmp___1 = bnx2x_vfop_transition___0(bp, vf, & bnx2x_vfop_vlan_mac, (int )cmd->block); return (tmp___1); } else { } return (-12); } } static void bnx2x_vfop_qsetup(struct bnx2x *bp , struct bnx2x_virtf *vf ) { struct bnx2x_vfop *vfop ; struct bnx2x_vfop *tmp ; int qid ; enum bnx2x_vfop_qsetup_state state ; struct bnx2x_vfop_cmd cmd ; long tmp___0 ; { tmp = bnx2x_vfop_cur___0(bp, vf); vfop = tmp; qid = vfop->args.qctor.qid; state = (enum bnx2x_vfop_qsetup_state )vfop->state; cmd.done = & bnx2x_vfop_qsetup; cmd.block = 0; if (vfop->rc < 0) { goto op_err; } else { } tmp___0 = ldv__builtin_expect((bp->msg_enable & 8388608) != 0, 0L); if (tmp___0 != 0L) { printk("\r[%s:%d(%s)]vf[%d] STATE: %d\n", "bnx2x_vfop_qsetup", 1008, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )vf->abs_vfid, (unsigned int )state); } else { } switch ((unsigned int )state) { case 0U: vfop->state = 1; vfop->rc = bnx2x_vfop_qctor_cmd(bp, vf, & cmd, qid); if (vfop->rc != 0) { goto op_err; } else { } return; case 1U: ; if (qid != 0) { goto op_done; } else { } vfop->state = 2; vfop->rc = bnx2x_vfop_vlan_set_cmd(bp, vf, & cmd, qid, 0, 1); if (vfop->rc != 0) { goto op_err; } else { } return; op_err: printk("\v[%s:%d(%s)]QSETUP[%d:%d] error: rc %d\n", "bnx2x_vfop_qsetup", 1031, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )vf->abs_vfid, qid, vfop->rc); op_done: ; case 2U: vf->cfg_flags = (u16 )((unsigned int )vf->cfg_flags | 32U); __asm__ volatile ("": : : "memory"); set_bit(7U, (unsigned long volatile *)(& bp->sp_rtnl_state)); __asm__ volatile ("": : : "memory"); schedule_delayed_work(& bp->sp_rtnl_task, 0UL); bnx2x_vfop_end___0(bp, vf, vfop); return; default: printk("\v[%s:%d(%s)]Bad state %d\n", "bnx2x_vfop_qsetup", 1043, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (unsigned int )state); vfop->rc = -22; goto op_err; } } } int bnx2x_vfop_qsetup_cmd(struct bnx2x *bp , struct bnx2x_virtf *vf , struct bnx2x_vfop_cmd *cmd , int qid ) { struct bnx2x_vfop *vfop ; struct bnx2x_vfop *tmp ; int tmp___0 ; { tmp = bnx2x_vfop_add___0(bp, vf); vfop = tmp; if ((unsigned long )vfop != (unsigned long )((struct bnx2x_vfop *)0)) { vfop->args.qctor.qid = qid; vfop->state = 0; vfop->op_p = & vf->op_params; vfop->transition = & bnx2x_vfop_qsetup; vfop->done = cmd->done; tmp___0 = bnx2x_vfop_transition___0(bp, vf, & bnx2x_vfop_qsetup, (int )cmd->block); return (tmp___0); } else { } return (-12); } } static void bnx2x_vfop_qflr(struct bnx2x *bp , struct bnx2x_virtf *vf ) { struct bnx2x_vfop *vfop ; struct bnx2x_vfop *tmp ; int qid ; enum bnx2x_vfop_qflr_state state ; struct bnx2x_queue_state_params *qstate ; struct bnx2x_vfop_cmd cmd ; long tmp___0 ; long tmp___1 ; long tmp___2 ; { tmp = bnx2x_vfop_cur___0(bp, vf); vfop = tmp; qid = vfop->args.qx.qid; state = (enum bnx2x_vfop_qflr_state )vfop->state; atomic_set(& vf->op_in_progress, 0); if (vfop->rc < 0) { goto op_err; } else { } tmp___0 = ldv__builtin_expect((bp->msg_enable & 8388608) != 0, 0L); if (tmp___0 != 0L) { printk("\r[%s:%d(%s)]VF[%d] STATE: %d\n", "bnx2x_vfop_qflr", 1079, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )vf->abs_vfid, (unsigned int )state); } else { } cmd.done = & bnx2x_vfop_qflr; cmd.block = 0; switch ((unsigned int )state) { case 0U: vfop->state = 1; vfop->rc = bnx2x_vfop_vlan_delall_cmd(bp, vf, & cmd, qid, 1); if (vfop->rc != 0) { goto op_err; } else { } return; case 1U: vfop->state = 2; vfop->rc = bnx2x_vfop_mac_delall_cmd(bp, vf, & cmd, qid, 1); tmp___1 = ldv__builtin_expect((bp->msg_enable & 8388608) != 0, 0L); if (tmp___1 != 0L) { printk("\r[%s:%d(%s)]VF[%d] vfop->rc after bnx2x_vfop_mac_delall_cmd was %d", "bnx2x_vfop_qflr", 1099, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )vf->abs_vfid, vfop->rc); } else { } if (vfop->rc != 0) { goto op_err; } else { } return; case 2U: qstate = & (vfop->op_p)->qctor.qstate; memset((void *)qstate, 0, 136UL); qstate->q_obj = & (vf->vfqs + (unsigned long )qid)->sp_obj; vfop->state = 3; tmp___2 = ldv__builtin_expect((bp->msg_enable & 8388608) != 0, 0L); if (tmp___2 != 0L) { printk("\r[%s:%d(%s)]VF[%d] qstate during flr was %d\n", "bnx2x_vfop_qflr", 1111, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )vf->abs_vfid, (unsigned int )(qstate->q_obj)->state); } else { } if ((unsigned int )(qstate->q_obj)->state != 0U) { (qstate->q_obj)->state = 6; qstate->cmd = 9; vfop->rc = bnx2x_queue_state_change(bp, qstate); if (vfop->rc < 0) { goto op_err; } else if (vfop->rc > 0) { goto op_pending; } else { printk("\v[%s:%d(%s)]expected pending\n", "bnx2x_vfop_qflr", 1117, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } } else { goto op_done; } op_err: printk("\v[%s:%d(%s)]QFLR[%d:%d] error: rc %d\n", "bnx2x_vfop_qflr", 1124, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )vf->abs_vfid, qid, vfop->rc); op_done: ; case 3U: bnx2x_vfop_end___0(bp, vf, vfop); return; default: printk("\v[%s:%d(%s)]Bad state %d\n", "bnx2x_vfop_qflr", 1130, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (unsigned int )state); vfop->rc = -22; goto op_err; } op_pending: ; return; } } static int bnx2x_vfop_qflr_cmd(struct bnx2x *bp , struct bnx2x_virtf *vf , struct bnx2x_vfop_cmd *cmd , int qid ) { struct bnx2x_vfop *vfop ; struct bnx2x_vfop *tmp ; int tmp___0 ; { tmp = bnx2x_vfop_add___0(bp, vf); vfop = tmp; if ((unsigned long )vfop != (unsigned long )((struct bnx2x_vfop *)0)) { vfop->args.qx.qid = qid; vfop->state = 0; vfop->op_p = & vf->op_params; vfop->transition = & bnx2x_vfop_qflr; vfop->done = cmd->done; tmp___0 = bnx2x_vfop_transition___0(bp, vf, & bnx2x_vfop_qflr, (int )cmd->block); return (tmp___0); } else { } return (-12); } } static void bnx2x_vfop_mcast(struct bnx2x *bp , struct bnx2x_virtf *vf ) { struct bnx2x_vfop *vfop ; struct bnx2x_vfop *tmp ; struct bnx2x_mcast_ramrod_params *mcast ; struct bnx2x_raw_obj *raw ; struct bnx2x_vfop_args_mcast *args ; enum bnx2x_vfop_mcast_state state ; int i ; long tmp___0 ; long tmp___1 ; bool tmp___2 ; bool tmp___4 ; { tmp = bnx2x_vfop_cur___0(bp, vf); vfop = tmp; mcast = & (vfop->op_p)->mcast; raw = & (mcast->mcast_obj)->raw; args = & vfop->args.mc_list; state = (enum bnx2x_vfop_mcast_state )vfop->state; atomic_set(& vf->op_in_progress, 0); if (vfop->rc < 0) { goto op_err; } else { } tmp___0 = ldv__builtin_expect((bp->msg_enable & 8388608) != 0, 0L); if (tmp___0 != 0L) { printk("\r[%s:%d(%s)]vf[%d] STATE: %d\n", "bnx2x_vfop_mcast", 1168, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )vf->abs_vfid, (unsigned int )state); } else { } switch ((unsigned int )state) { case 0U: vfop->state = 1; vfop->rc = bnx2x_config_mcast(bp, mcast, 2); if (vfop->rc < 0) { goto op_err; } else if (vfop->rc > 0) { goto op_pending; } else { tmp___1 = ldv__builtin_expect((bp->msg_enable & 8388608) != 0, 0L); if (tmp___1 != 0L) { printk("\r[%s:%d(%s)]no ramrod. scheduling\n", "bnx2x_vfop_mcast", 1175, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } atomic_set(& vf->op_in_progress, 1); queue_delayed_work(bnx2x_wq, & bp->sp_task, 0UL); return; } case 1U: tmp___2 = (*(raw->check_pending))(raw); if ((int )tmp___2) { goto op_pending; } else { } if (args->mc_num != 0) { INIT_LIST_HEAD(& mcast->mcast_list); i = 0; goto ldv_46173; ldv_46172: list_add_tail(& (args->mc + (unsigned long )i)->link, & mcast->mcast_list); i = i + 1; ldv_46173: ; if (args->mc_num > i) { goto ldv_46172; } else { } vfop->state = 2; vfop->rc = bnx2x_config_mcast(bp, mcast, 0); } else { } if (vfop->rc < 0) { goto op_err; } else if (vfop->rc > 0) { goto op_pending; } else { goto op_done; } case 2U: tmp___4 = (*(raw->check_pending))(raw); vfop->rc = (int )tmp___4; if (vfop->rc < 0) { goto op_err; } else if (vfop->rc > 0) { goto op_pending; } else { goto op_done; } default: printk("\v[%s:%d(%s)]Bad state %d\n", "bnx2x_vfop_mcast", 1198, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (unsigned int )state); vfop->rc = -22; goto op_err; } op_err: printk("\v[%s:%d(%s)]MCAST CONFIG error: rc %d\n", "bnx2x_vfop_mcast", 1201, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", vfop->rc); op_done: kfree((void const *)args->mc); bnx2x_vfop_end___0(bp, vf, vfop); op_pending: ; return; } } int bnx2x_vfop_mcast_cmd(struct bnx2x *bp , struct bnx2x_virtf *vf , struct bnx2x_vfop_cmd *cmd , bnx2x_mac_addr_t *mcasts , int mcast_num , bool drv_only ) { struct bnx2x_vfop *vfop ; size_t mc_sz ; struct bnx2x_mcast_list_elem *mc ; void *tmp ; struct bnx2x_mcast_list_elem *tmp___0 ; int i ; struct bnx2x_mcast_ramrod_params *ramrod ; int tmp___1 ; { vfop = 0; mc_sz = (unsigned long )mcast_num * 24UL; if (mc_sz != 0UL) { tmp = kzalloc(mc_sz, 208U); tmp___0 = (struct bnx2x_mcast_list_elem *)tmp; } else { tmp___0 = 0; } mc = tmp___0; if (mc_sz == 0UL || (unsigned long )mc != (unsigned long )((struct bnx2x_mcast_list_elem *)0)) { vfop = bnx2x_vfop_add___0(bp, vf); if ((unsigned long )vfop != (unsigned long )((struct bnx2x_vfop *)0)) { ramrod = & vf->op_params.mcast; memset((void *)ramrod, 0, 40UL); ramrod->mcast_obj = & vf->mcast_obj; if ((int )drv_only) { set_bit(3U, (unsigned long volatile *)(& ramrod->ramrod_flags)); } else { } vfop->args.mc_list.mc_num = mcast_num; vfop->args.mc_list.mc = mc; i = 0; goto ldv_46191; ldv_46190: (mc + (unsigned long )i)->mac = (u8 *)mcasts + (unsigned long )i; i = i + 1; ldv_46191: ; if (i < mcast_num) { goto ldv_46190; } else { } vfop->state = 0; vfop->op_p = & vf->op_params; vfop->transition = & bnx2x_vfop_mcast; vfop->done = cmd->done; tmp___1 = bnx2x_vfop_transition___0(bp, vf, & bnx2x_vfop_mcast, (int )cmd->block); return (tmp___1); } else { kfree((void const *)mc); } } else { } return (-12); } } static void bnx2x_vfop_rxmode(struct bnx2x *bp , struct bnx2x_virtf *vf ) { struct bnx2x_vfop *vfop ; struct bnx2x_vfop *tmp ; struct bnx2x_rx_mode_ramrod_params *ramrod ; enum bnx2x_vfop_rxmode_state state ; long tmp___0 ; { tmp = bnx2x_vfop_cur___0(bp, vf); vfop = tmp; ramrod = & (vfop->op_p)->rx_mode; state = (enum bnx2x_vfop_rxmode_state )vfop->state; atomic_set(& vf->op_in_progress, 0); if (vfop->rc < 0) { goto op_err; } else { } tmp___0 = ldv__builtin_expect((bp->msg_enable & 8388608) != 0, 0L); if (tmp___0 != 0L) { printk("\r[%s:%d(%s)]vf[%d] STATE: %d\n", "bnx2x_vfop_rxmode", 1263, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )vf->abs_vfid, (unsigned int )state); } else { } switch ((unsigned int )state) { case 0U: vfop->state = 1; vfop->rc = bnx2x_config_rx_mode(bp, ramrod); if (vfop->rc < 0) { goto op_err; } else if (vfop->rc > 0) { goto op_pending; } else { goto op_done; } op_err: printk("\v[%s:%d(%s)]RXMODE error: rc %d\n", "bnx2x_vfop_rxmode", 1273, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", vfop->rc); op_done: ; case 1U: bnx2x_vfop_end___0(bp, vf, vfop); return; default: printk("\v[%s:%d(%s)]Bad state %d\n", "bnx2x_vfop_rxmode", 1279, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (unsigned int )state); vfop->rc = -22; goto op_err; } op_pending: ; return; } } int bnx2x_vfop_rxmode_cmd(struct bnx2x *bp , struct bnx2x_virtf *vf , struct bnx2x_vfop_cmd *cmd , int qid , unsigned long accept_flags ) { struct bnx2x_vf_queue *vfq ; struct bnx2x_vf_queue *tmp ; struct bnx2x_vfop *vfop ; struct bnx2x_vfop *tmp___0 ; struct bnx2x_rx_mode_ramrod_params *ramrod ; int tmp___1 ; { tmp = vfq_get(vf, (int )((u8 )qid)); vfq = tmp; tmp___0 = bnx2x_vfop_add___0(bp, vf); vfop = tmp___0; if ((unsigned long )vfop != (unsigned long )((struct bnx2x_vfop *)0)) { ramrod = & vf->op_params.rx_mode; memset((void *)ramrod, 0, 80UL); ramrod->cid = vfq->cid; ramrod->cl_id = vfq_cl_id___0(vf, vfq); ramrod->rx_mode_obj = & bp->rx_mode_obj; ramrod->func_id = (unsigned int )vf->abs_vfid + 8U; ramrod->rx_accept_flags = accept_flags; ramrod->tx_accept_flags = accept_flags; ramrod->pstate = & vf->filter_state; ramrod->state = 3; set_bit(3U, (unsigned long volatile *)(& vf->filter_state)); set_bit(1U, (unsigned long volatile *)(& ramrod->ramrod_flags)); set_bit(0U, (unsigned long volatile *)(& ramrod->ramrod_flags)); ramrod->rdata = (bp->vfdb)->sp_dma.addr + ((unsigned long )vf->index * 1176UL + 528UL); ramrod->rdata_mapping = ((bp->vfdb)->sp_dma.mapping + (unsigned long long )((unsigned long )vf->index * 1176UL)) + 528ULL; vfop->state = 0; vfop->op_p = & vf->op_params; vfop->transition = & bnx2x_vfop_rxmode; vfop->done = cmd->done; tmp___1 = bnx2x_vfop_transition___0(bp, vf, & bnx2x_vfop_rxmode, (int )cmd->block); return (tmp___1); } else { } return (-12); } } static void bnx2x_vfop_qdown(struct bnx2x *bp , struct bnx2x_virtf *vf ) { struct bnx2x_vfop *vfop ; struct bnx2x_vfop *tmp ; int qid ; enum bnx2x_vfop_qteardown_state state ; struct bnx2x_vfop_cmd cmd ; long tmp___0 ; long tmp___1 ; long tmp___2 ; long tmp___3 ; { tmp = bnx2x_vfop_cur___0(bp, vf); vfop = tmp; qid = vfop->args.qx.qid; state = (enum bnx2x_vfop_qteardown_state )vfop->state; if (vfop->rc < 0) { goto op_err; } else { } tmp___0 = ldv__builtin_expect((bp->msg_enable & 8388608) != 0, 0L); if (tmp___0 != 0L) { printk("\r[%s:%d(%s)]vf[%d] STATE: %d\n", "bnx2x_vfop_qdown", 1340, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )vf->abs_vfid, (unsigned int )state); } else { } cmd.done = & bnx2x_vfop_qdown; cmd.block = 0; switch ((unsigned int )state) { case 0U: vfop->state = 1; vfop->rc = bnx2x_vfop_rxmode_cmd(bp, vf, & cmd, qid, 0UL); if (vfop->rc != 0) { goto op_err; } else { } return; case 1U: vfop->state = 2; vfop->rc = bnx2x_vfop_vlan_delall_cmd(bp, vf, & cmd, qid, 0); if (vfop->rc != 0) { goto op_err; } else { } return; case 2U: vfop->state = 3; vfop->rc = bnx2x_vfop_mac_delall_cmd(bp, vf, & cmd, qid, 0); if (vfop->rc != 0) { goto op_err; } else { } return; case 3U: tmp___1 = ldv__builtin_expect((bp->msg_enable & 8388608) != 0, 0L); if (tmp___1 != 0L) { printk("\r[%s:%d(%s)]case: BNX2X_VFOP_QTEARDOWN_QDTOR\n", "bnx2x_vfop_qdown", 1372, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } vfop->state = 4; tmp___2 = ldv__builtin_expect((bp->msg_enable & 8388608) != 0, 0L); if (tmp___2 != 0L) { printk("\r[%s:%d(%s)]new state: BNX2X_VFOP_QTEARDOWN_DONE\n", "bnx2x_vfop_qdown", 1374, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } vfop->rc = bnx2x_vfop_qdtor_cmd(bp, vf, & cmd, qid); tmp___3 = ldv__builtin_expect((bp->msg_enable & 8388608) != 0, 0L); if (tmp___3 != 0L) { printk("\r[%s:%d(%s)]returned from cmd\n", "bnx2x_vfop_qdown", 1376, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } if (vfop->rc != 0) { goto op_err; } else { } return; op_err: printk("\v[%s:%d(%s)]QTEARDOWN[%d:%d] error: rc %d\n", "bnx2x_vfop_qdown", 1382, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )vf->abs_vfid, qid, vfop->rc); case 4U: bnx2x_vfop_end___0(bp, vf, vfop); return; default: printk("\v[%s:%d(%s)]Bad state %d\n", "bnx2x_vfop_qdown", 1388, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (unsigned int )state); vfop->rc = -22; goto op_err; } } } int bnx2x_vfop_qdown_cmd(struct bnx2x *bp , struct bnx2x_virtf *vf , struct bnx2x_vfop_cmd *cmd , int qid ) { struct bnx2x_vfop *vfop ; struct bnx2x_vfop *tmp ; int tmp___0 ; { tmp = bnx2x_vfop_add___0(bp, vf); vfop = tmp; if ((unsigned long )vfop != (unsigned long )((struct bnx2x_vfop *)0)) { vfop->args.qx.qid = qid; vfop->state = 0; vfop->op_p = & vf->op_params; vfop->transition = & bnx2x_vfop_qdown; vfop->done = cmd->done; tmp___0 = bnx2x_vfop_transition___0(bp, vf, & bnx2x_vfop_qdown, (int )cmd->block); return (tmp___0); } else { } return (-12); } } static void bnx2x_vf_enable_internal(struct bnx2x *bp , u8 enable ) { { writel((unsigned int )enable != 0U, (void volatile *)bp->regview + 37944U); return; } } static void bnx2x_vf_semi_clear_err(struct bnx2x *bp , u8 abs_vfid ) { { writel((unsigned int )abs_vfid, (void volatile *)bp->regview + 1573760U); writel((unsigned int )abs_vfid, (void volatile *)bp->regview + 3146624U); writel((unsigned int )abs_vfid, (void volatile *)bp->regview + 2098048U); writel((unsigned int )abs_vfid, (void volatile *)bp->regview + 2622336U); return; } } static void bnx2x_vf_pglue_clear_err(struct bnx2x *bp , u8 abs_vfid ) { u32 was_err_group ; u32 was_err_reg ; { was_err_group = (u32 )(((bp->common.chip_id >> 16 != 5710U && (bp->common.chip_id >> 16 != 5711U && bp->common.chip_id >> 16 != 5712U) ? ((int )bp->pf_num & 1) * 2 : 0) + (int )abs_vfid) >> 5); was_err_reg = 0U; switch (was_err_group) { case 0U: was_err_reg = 38008U; goto ldv_46255; case 1U: was_err_reg = 38012U; goto ldv_46255; case 2U: was_err_reg = 38016U; goto ldv_46255; case 3U: was_err_reg = 38004U; goto ldv_46255; } ldv_46255: writel(1U << ((int )abs_vfid & 31), (void volatile *)bp->regview + (unsigned long )was_err_reg); return; } } static void bnx2x_vf_igu_reset(struct bnx2x *bp , struct bnx2x_virtf *vf ) { int i ; u32 val ; unsigned int tmp ; long tmp___0 ; u8 igu_sb_id ; u8 tmp___1 ; { bnx2x_pretend_func(bp, (int )((unsigned short )((int )((short )((unsigned int )bp->pf_num | 8U)) | (int )((short )((int )vf->abs_vfid << 4))))); writel(0U, (void volatile *)bp->regview + 1245532U); writel(0U, (void volatile *)bp->regview + 1245536U); writel(0U, (void volatile *)bp->regview + 1245540U); writel(0U, (void volatile *)bp->regview + 1245544U); writel(0U, (void volatile *)bp->regview + 1245496U); writel(0U, (void volatile *)bp->regview + 1245500U); val = readl((void const volatile *)bp->regview + 1245552U); val = val | 3U; if (((int )vf->cfg_flags & 8) != 0) { val = val | 16U; } else { } val = val & 4294967283U; val = (u32 )((int )bp->pfid << 2) | val; writel(val, (void volatile *)bp->regview + 1245552U); tmp___0 = ldv__builtin_expect((bp->msg_enable & 8388608) != 0, 0L); if (tmp___0 != 0L) { tmp = readl((void const volatile *)bp->regview + 1245552U); printk("\r[%s:%d(%s)]value in IGU_REG_VF_CONFIGURATION of vf %d after write %x\n", "bnx2x_vf_igu_reset", 1479, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )vf->abs_vfid, tmp); } else { } bnx2x_pretend_func(bp, (int )bp->pf_num); i = 0; goto ldv_46268; ldv_46267: tmp___1 = vf_igu_sb(vf, (int )((u16 )i)); igu_sb_id = tmp___1; writel(0U, (void volatile *)bp->regview + (unsigned long )(((int )igu_sb_id + 313344) * 4)); bnx2x_igu_clear_sb_gen(bp, (int )vf->abs_vfid, (int )igu_sb_id, 0); bnx2x_vf_igu_ack_sb(bp, vf, (int )igu_sb_id, 0, 0, 1, 1); i = i + 1; ldv_46268: ; if ((int )vf->alloc_resc.num_sbs > i) { goto ldv_46267; } else { } return; } } void bnx2x_vf_enable_access(struct bnx2x *bp , u8 abs_vfid ) { long tmp ; { storm_memset_vf_to_pf___0(bp, (int )((unsigned int )((u16 )abs_vfid) + 8U), (int )bp->pfid); storm_memset_func_en___0(bp, (int )((unsigned int )((u16 )abs_vfid) + 8U), 1); bnx2x_vf_semi_clear_err(bp, (int )abs_vfid); bnx2x_vf_pglue_clear_err(bp, (int )abs_vfid); bnx2x_pretend_func(bp, (int )((unsigned short )((int )((short )((unsigned int )bp->pf_num | 8U)) | (int )((short )((int )abs_vfid << 4))))); tmp = ldv__builtin_expect((bp->msg_enable & 8388608) != 0, 0L); if (tmp != 0L) { printk("\r[%s:%d(%s)]enabling internal access for vf %x\n", "bnx2x_vf_enable_access", 1512, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )abs_vfid); } else { } bnx2x_vf_enable_internal(bp, 1); bnx2x_pretend_func(bp, (int )bp->pf_num); return; } } static void bnx2x_vf_enable_traffic(struct bnx2x *bp , struct bnx2x_virtf *vf ) { { bnx2x_vf_igu_reset(bp, vf); bnx2x_pretend_func(bp, (int )((unsigned short )((int )((short )((unsigned int )bp->pf_num | 8U)) | (int )((short )((int )vf->abs_vfid << 4))))); writel(0U, (void volatile *)bp->regview + 1311468U); bnx2x_pretend_func(bp, (int )bp->pf_num); return; } } static u8 bnx2x_vf_is_pcie_pending(struct bnx2x *bp , u8 abs_vfid ) { struct pci_dev *dev ; struct bnx2x_virtf *vf ; struct bnx2x_virtf *tmp ; u8 tmp___0 ; { tmp = bnx2x_vf_by_abs_fid(bp, (int )abs_vfid); vf = tmp; if ((unsigned long )vf == (unsigned long )((struct bnx2x_virtf *)0)) { goto unknown_dev; } else { } dev = pci_get_bus_and_slot(vf->bus, vf->devfn); if ((unsigned long )dev != (unsigned long )((struct pci_dev *)0)) { tmp___0 = bnx2x_is_pcie_pending(dev); return (tmp___0); } else { } unknown_dev: ; return (0U); } } int bnx2x_vf_flr_clnup_epilog(struct bnx2x *bp , u8 abs_vfid ) { u8 tmp ; { msleep(100U); tmp = bnx2x_vf_is_pcie_pending(bp, (int )abs_vfid); if ((unsigned int )tmp != 0U) { printk("\v[%s:%d(%s)]PCIE Transactions still pending\n", "bnx2x_vf_flr_clnup_epilog", 1551, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } return (0); } } static void bnx2x_iov_static_resc(struct bnx2x *bp , struct vf_pf_resc_request *resc ) { u16 vlan_count ; int tmp ; int tmp___0 ; { vlan_count = 0U; resc->num_rxqs = 0U; resc->num_txqs = 0U; resc->num_mac_filters = 1U; tmp = (*(bp->vlans_pool.check))(& bp->vlans_pool); vlan_count = (u16 )tmp; tmp___0 = __ilog2_u32((u32 )vlan_count); vlan_count = (u16 )(1 << tmp___0); resc->num_vlan_filters = (u8 )((int )vlan_count / (int )(bp->vfdb)->sriov.nr_virtfn); resc->num_mc_filters = 0U; return; } } static void bnx2x_vf_free_resc(struct bnx2x *bp , struct bnx2x_virtf *vf ) { { bnx2x_iov_static_resc(bp, & vf->alloc_resc); vf->state = 0U; return; } } static void bnx2x_vf_flr_clnup_hw(struct bnx2x *bp , struct bnx2x_virtf *vf ) { u32 poll_cnt ; u32 tmp ; int tmp___0 ; { tmp = bnx2x_flr_clnup_poll_count(bp); poll_cnt = tmp; bnx2x_pretend_func(bp, (int )((unsigned short )((int )((short )((unsigned int )bp->pf_num | 8U)) | (int )((short )((int )vf->abs_vfid << 4))))); bnx2x_flr_clnup_poll_hw_counter(bp, 1508128U, (char *)"DQ VF usage counter timed out", poll_cnt); bnx2x_pretend_func(bp, (int )bp->pf_num); tmp___0 = bnx2x_send_final_clnup(bp, (int )((unsigned int )vf->abs_vfid + 8U), poll_cnt); if (tmp___0 != 0) { printk("\v[%s:%d(%s)]VF[%d] Final cleanup timed-out\n", "bnx2x_vf_flr_clnup_hw", 1604, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )vf->abs_vfid); } else { } bnx2x_tx_hw_flushed(bp, poll_cnt); return; } } static void bnx2x_vfop_flr(struct bnx2x *bp , struct bnx2x_virtf *vf ) { struct bnx2x_vfop *vfop ; struct bnx2x_vfop *tmp ; struct bnx2x_vfop_args_qx *qx ; enum bnx2x_vfop_flr_state state ; struct bnx2x_vfop_cmd cmd ; long tmp___0 ; { tmp = bnx2x_vfop_cur___0(bp, vf); vfop = tmp; qx = & vfop->args.qx; state = (enum bnx2x_vfop_flr_state )vfop->state; cmd.done = & bnx2x_vfop_flr; cmd.block = 0; if (vfop->rc < 0) { goto op_err; } else { } tmp___0 = ldv__builtin_expect((bp->msg_enable & 8388608) != 0, 0L); if (tmp___0 != 0L) { printk("\r[%s:%d(%s)]vf[%d] STATE: %d\n", "bnx2x_vfop_flr", 1623, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )vf->abs_vfid, (unsigned int )state); } else { } switch ((unsigned int )state) { case 0U: qx->qid = qx->qid + 1; if (qx->qid < (int )vf->alloc_resc.num_rxqs) { vfop->rc = bnx2x_vfop_qflr_cmd(bp, vf, & cmd, qx->qid); if (vfop->rc != 0) { goto op_err; } else { } return; } else { } vfop->state = 1; vfop->rc = bnx2x_vfop_mcast_cmd(bp, vf, & cmd, 0, 0, 1); if (vfop->rc != 0) { goto op_err; } else { } return; case 1U: bnx2x_vf_flr_clnup_hw(bp, vf); bnx2x_vf_free_resc(bp, vf); bnx2x_vf_enable_mbx(bp, (int )vf->abs_vfid); goto op_done; default: printk("\v[%s:%d(%s)]Bad state %d\n", "bnx2x_vfop_flr", 1657, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (unsigned int )state); vfop->rc = -22; goto op_err; } op_err: printk("\v[%s:%d(%s)]VF[%d] FLR error: rc %d\n", "bnx2x_vfop_flr", 1660, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )vf->abs_vfid, vfop->rc); op_done: vf->flr_clnup_stage = 2U; bnx2x_vfop_end___0(bp, vf, vfop); bnx2x_unlock_vf_pf_channel(bp, vf, 10); return; } } static int bnx2x_vfop_flr_cmd(struct bnx2x *bp , struct bnx2x_virtf *vf , void (*done)(struct bnx2x * , struct bnx2x_virtf * ) ) { struct bnx2x_vfop *vfop ; struct bnx2x_vfop *tmp ; int tmp___0 ; { tmp = bnx2x_vfop_add___0(bp, vf); vfop = tmp; if ((unsigned long )vfop != (unsigned long )((struct bnx2x_vfop *)0)) { vfop->args.qx.qid = -1; vfop->state = 0; vfop->op_p = & vf->op_params; vfop->transition = & bnx2x_vfop_flr; vfop->done = done; tmp___0 = bnx2x_vfop_transition___0(bp, vf, & bnx2x_vfop_flr, 0); return (tmp___0); } else { } return (-12); } } static void bnx2x_vf_flr_clnup(struct bnx2x *bp , struct bnx2x_virtf *prev_vf ) { int i ; struct bnx2x_virtf *vf ; long tmp ; int tmp___0 ; long tmp___1 ; { i = (unsigned long )prev_vf != (unsigned long )((struct bnx2x_virtf *)0) ? (int )prev_vf->index + 1 : 0; next_vf_to_clean: ; goto ldv_46334; ldv_46333: i = i + 1; ldv_46334: ; if ((int )(bp->vfdb)->sriov.nr_virtfn > i && ((unsigned int )((bp->vfdb)->vfs + (unsigned long )i)->state != 3U || (unsigned int )((bp->vfdb)->vfs + (unsigned long )i)->flr_clnup_stage != 1U)) { goto ldv_46333; } else { } tmp = ldv__builtin_expect((bp->msg_enable & 8388608) != 0, 0L); if (tmp != 0L) { printk("\r[%s:%d(%s)]next vf to cleanup: %d. num of vfs: %d\n", "bnx2x_vf_flr_clnup", 1696, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", i, (int )(bp->vfdb)->sriov.nr_virtfn); } else { } if ((int )(bp->vfdb)->sriov.nr_virtfn > i) { vf = (bp->vfdb)->vfs + (unsigned long )i; bnx2x_lock_vf_pf_channel(bp, vf, 10); tmp___0 = bnx2x_vfop_flr_cmd(bp, vf, & bnx2x_vf_flr_clnup); if (tmp___0 != 0) { printk("\v[%s:%d(%s)]VF[%d]: FLR cleanup failed -ENOMEM\n", "bnx2x_vf_flr_clnup", 1707, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )vf->abs_vfid); vf->flr_clnup_stage = 2U; goto next_vf_to_clean; } else { } return; } else { } i = 0; goto ldv_46339; ldv_46338: vf = (bp->vfdb)->vfs + (unsigned long )i; if ((unsigned int )vf->flr_clnup_stage != 2U) { goto ldv_46337; } else { } vf->flr_clnup_stage = 3U; ldv_46337: i = i + 1; ldv_46339: ; if ((int )(bp->vfdb)->sriov.nr_virtfn > i) { goto ldv_46338; } else { } tmp___1 = ldv__builtin_expect((bp->msg_enable & 65536) != 0, 0L); if (tmp___1 != 0L) { printk("\r[%s:%d(%s)]DRV_STATUS_VF_DISABLED ACK for vfs 0x%x 0x%x\n", "bnx2x_vf_flr_clnup", 1734, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (bp->vfdb)->flrd_vfs[0], (bp->vfdb)->flrd_vfs[1]); } else { } i = 0; goto ldv_46342; ldv_46341: writel((bp->vfdb)->flrd_vfs[i], (void volatile *)(bp->regview + ((unsigned long )bp->common.shmem2_base + (((unsigned long )(((int )bp->pfid & 1) + ((int )bp->pfid >> 1) * ((bp->common.chip_id >> 16 == 5710U || (bp->common.chip_id >> 16 == 5711U || bp->common.chip_id >> 16 == 5712U)) || (unsigned int )bp->common.chip_port_mode == 0U ? 2 : 1)) * 2UL + (unsigned long )i) + 17UL) * 4UL))); i = i + 1; ldv_46342: ; if (i <= 1) { goto ldv_46341; } else { } bnx2x_fw_command(bp, 3221225472U, 0U); i = 0; goto ldv_46345; ldv_46344: writel(0U, (void volatile *)(bp->regview + ((unsigned long )bp->common.shmem2_base + (((unsigned long )(((int )bp->pfid & 1) + ((int )bp->pfid >> 1) * ((bp->common.chip_id >> 16 == 5710U || (bp->common.chip_id >> 16 == 5711U || bp->common.chip_id >> 16 == 5712U)) || (unsigned int )bp->common.chip_port_mode == 0U ? 2 : 1)) * 2UL + (unsigned long )i) + 17UL) * 4UL))); i = i + 1; ldv_46345: ; if (i <= 1) { goto ldv_46344; } else { } return; } } void bnx2x_vf_handle_flr_event(struct bnx2x *bp ) { int i ; long tmp ; struct bnx2x_virtf *vf ; u32 reset ; long tmp___0 ; { i = 0; goto ldv_46352; ldv_46351: (bp->vfdb)->flrd_vfs[i] = readl((void const volatile *)(bp->regview + ((unsigned long )bp->common.shmem2_base + ((unsigned long )i + 15UL) * 4UL))); i = i + 1; ldv_46352: ; if (i <= 1) { goto ldv_46351; } else { } tmp = ldv__builtin_expect((bp->msg_enable & 65536) != 0, 0L); if (tmp != 0L) { printk("\r[%s:%d(%s)]DRV_STATUS_VF_DISABLED received for vfs 0x%x 0x%x\n", "bnx2x_vf_handle_flr_event", 1758, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (bp->vfdb)->flrd_vfs[0], (bp->vfdb)->flrd_vfs[1]); } else { } i = 0; goto ldv_46358; ldv_46357: vf = (bp->vfdb)->vfs + (unsigned long )i; reset = 0U; if ((unsigned int )vf->abs_vfid <= 31U) { reset = (bp->vfdb)->flrd_vfs[0] & (u32 )(1 << (int )vf->abs_vfid); } else { reset = (bp->vfdb)->flrd_vfs[1] & (u32 )(1 << ((int )vf->abs_vfid + -32)); } if (reset != 0U) { vf->state = 3U; vf->flr_clnup_stage = 1U; tmp___0 = ldv__builtin_expect((bp->msg_enable & 8388608) != 0, 0L); if (tmp___0 != 0L) { printk("\r[%s:%d(%s)]Initiating Final cleanup for VF %d\n", "bnx2x_vf_handle_flr_event", 1777, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )vf->abs_vfid); } else { } } else { } i = i + 1; ldv_46358: ; if ((int )(bp->vfdb)->sriov.nr_virtfn > i) { goto ldv_46357; } else { } bnx2x_vf_flr_clnup(bp, 0); return; } } void bnx2x_iov_init_dq(struct bnx2x *bp ) { { if ((unsigned long )bp->vfdb == (unsigned long )((struct bnx2x_vfdb *)0)) { return; } else { } writel(0U, (void volatile *)bp->regview + 1507752U); writel(6U, (void volatile *)bp->regview + 1507820U); writel(256U, (void volatile *)bp->regview + 1507744U); writel(0U, (void volatile *)bp->regview + 1507748U); writel(4U, (void volatile *)bp->regview + 1507828U); writel(1U, (void volatile *)bp->regview + 1507864U); writel(0U, (void volatile *)bp->regview + 1507928U); writel(0U, (void volatile *)bp->regview + 1507992U); writel(131071U, (void volatile *)bp->regview + 1508056U); writel(131072U, (void volatile *)bp->regview + 1507812U); writel(4U, (void volatile *)bp->regview + 1508160U); return; } } void bnx2x_iov_init_dmae(struct bnx2x *bp ) { long tmp ; { tmp = ldv__builtin_expect((bp->msg_enable & 8388608) != 0, 0L); if (tmp != 0L) { printk("\r[%s:%d(%s)]SRIOV is %s\n", "bnx2x_iov_init_dmae", 1827, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (unsigned long )bp->vfdb != (unsigned long )((struct bnx2x_vfdb *)0) ? (char *)"ON" : (char *)"OFF"); } else { } if ((unsigned long )bp->vfdb == (unsigned long )((struct bnx2x_vfdb *)0)) { return; } else { } writel(0U, (void volatile *)bp->regview + 1056892U); return; } } static int bnx2x_vf_bus(struct bnx2x *bp , int vfid ) { struct pci_dev *dev ; struct bnx2x_sriov *iov ; { dev = bp->pdev; iov = & (bp->vfdb)->sriov; return ((int )((unsigned int )(dev->bus)->number + (((dev->devfn + (unsigned int )iov->offset) + (unsigned int )((int )iov->stride * vfid)) >> 8))); } } static int bnx2x_vf_devfn(struct bnx2x *bp , int vfid ) { struct pci_dev *dev ; struct bnx2x_sriov *iov ; { dev = bp->pdev; iov = & (bp->vfdb)->sriov; return ((int )((dev->devfn + (unsigned int )iov->offset) + (unsigned int )((int )iov->stride * vfid)) & 255); } } static void bnx2x_vf_set_bars(struct bnx2x *bp , struct bnx2x_virtf *vf ) { int i ; int n ; struct pci_dev *dev ; struct bnx2x_sriov *iov ; u64 start ; u32 size ; { dev = bp->pdev; iov = & (bp->vfdb)->sriov; i = 0; n = 0; goto ldv_46390; ldv_46389: start = dev->resource[i + 7].start; size = dev->resource[i + 7].start != 0ULL || dev->resource[i + 7].end != dev->resource[i + 7].start ? ((u32 )dev->resource[i + 7].end - (u32 )dev->resource[i + 7].start) + 1U : 0U; size = size / (u32 )iov->total; vf->bars[n].bar = (u64 )((u32 )vf->abs_vfid * size) + start; vf->bars[n].size = size; i = i + 2; n = n + 1; ldv_46390: ; if (i <= 5) { goto ldv_46389; } else { } return; } } static int bnx2x_ari_enabled(struct pci_dev *dev ) { { return ((unsigned long )(dev->bus)->self != (unsigned long )((struct pci_dev *)0) && (unsigned int )*((unsigned char *)(dev->bus)->self + 2250UL) != 0U); } } static void bnx2x_get_vf_igu_cam_info(struct bnx2x *bp ) { int sb_id ; u32 val ; u8 fid ; long tmp ; { sb_id = 0; goto ldv_46404; ldv_46403: val = readl((void const volatile *)bp->regview + (unsigned long )((sb_id + 312320) * 4)); if ((val & 1U) == 0U) { goto ldv_46401; } else { } fid = (u8 )((val & 16256U) >> 7); if (((int )fid & 64) == 0) { bnx2x_vf_set_igu_info(bp, (int )((u8 )sb_id), (int )fid & 63); } else { } tmp = ldv__builtin_expect((bp->msg_enable & 8388608) != 0, 0L); if (tmp != 0L) { printk("\r[%s:%d(%s)]%s[%d], igu_sb_id=%d, msix=%d\n", "bnx2x_get_vf_igu_cam_info", 1893, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", ((int )fid & 64) != 0 ? (char *)"PF" : (char *)"VF", ((int )fid & 64) != 0 ? (int )fid & 7 : (int )fid & 63, sb_id, (val & 126U) >> 1); } else { } ldv_46401: sb_id = sb_id + 1; ldv_46404: ; if (sb_id <= 135) { goto ldv_46403; } else { } return; } } static void __bnx2x_iov_free_vfdb(struct bnx2x *bp ) { { if ((unsigned long )bp->vfdb != (unsigned long )((struct bnx2x_vfdb *)0)) { kfree((void const *)(bp->vfdb)->vfqs); kfree((void const *)(bp->vfdb)->vfs); kfree((void const *)bp->vfdb); } else { } bp->vfdb = 0; return; } } static int bnx2x_sriov_pci_cfg_info(struct bnx2x *bp , struct bnx2x_sriov *iov ) { int pos ; struct pci_dev *dev ; long tmp ; { dev = bp->pdev; pos = pci_find_ext_capability(dev, 16); if (pos == 0) { printk("\v[%s:%d(%s)]failed to find SRIOV capability in device\n", "bnx2x_sriov_pci_cfg_info", 1914, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); return (-19); } else { } iov->pos = pos; tmp = ldv__builtin_expect((bp->msg_enable & 8388608) != 0, 0L); if (tmp != 0L) { printk("\r[%s:%d(%s)]sriov ext pos %d\n", "bnx2x_sriov_pci_cfg_info", 1919, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", pos); } else { } pci_read_config_word((struct pci_dev const *)dev, pos + 8, & iov->ctrl); pci_read_config_word((struct pci_dev const *)dev, pos + 14, & iov->total); pci_read_config_word((struct pci_dev const *)dev, pos + 12, & iov->initial); pci_read_config_word((struct pci_dev const *)dev, pos + 20, & iov->offset); pci_read_config_word((struct pci_dev const *)dev, pos + 22, & iov->stride); pci_read_config_dword((struct pci_dev const *)dev, pos + 28, & iov->pgsz); pci_read_config_dword((struct pci_dev const *)dev, pos + 4, & iov->cap); pci_read_config_byte((struct pci_dev const *)dev, pos + 18, & iov->link); return (0); } } static int bnx2x_sriov_info(struct bnx2x *bp , struct bnx2x_sriov *iov ) { u32 val ; int tmp ; long tmp___0 ; { tmp = bnx2x_sriov_pci_cfg_info(bp, iov); if (tmp != 0) { return (-19); } else { } iov->nres = 0; val = readl((void const volatile *)bp->regview + 9764U); iov->first_vf_in_pf = (val & 15U) * 8U - (bp->common.chip_id >> 16 != 5710U && (bp->common.chip_id >> 16 != 5711U && bp->common.chip_id >> 16 != 5712U) ? (u32 )(((int )bp->pf_num & 1) * 64) : 0U); tmp___0 = ldv__builtin_expect((bp->msg_enable & 8388608) != 0, 0L); if (tmp___0 != 0L) { printk("\r[%s:%d(%s)]IOV info[%d]: first vf %d, nres %d, cap 0x%x, ctrl 0x%x, total %d, initial %d, num vfs %d, offset %d, stride %d, page size 0x%x\n", "bnx2x_sriov_info", 1955, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )bp->pfid, iov->first_vf_in_pf, iov->nres, iov->cap, (int )iov->ctrl, (int )iov->total, (int )iov->initial, (int )iov->nr_virtfn, (int )iov->offset, (int )iov->stride, iov->pgsz); } else { } return (0); } } static u8 bnx2x_iov_get_max_queue_count(struct bnx2x *bp ) { int i ; u8 queue_count ; { queue_count = 0U; if ((unsigned long )bp->vfdb != (unsigned long )((struct bnx2x_vfdb *)0)) { i = 0; goto ldv_46428; ldv_46427: queue_count = (int )((bp->vfdb)->vfs + (unsigned long )i)->alloc_resc.num_sbs + (int )queue_count; i = i + 1; ldv_46428: ; if ((int )(bp->vfdb)->sriov.nr_virtfn > i) { goto ldv_46427; } else { } } else { } return (queue_count); } } int bnx2x_iov_init_one(struct bnx2x *bp , int int_mode_param , int num_vfs_param ) { int err ; int i ; int qcount ; struct bnx2x_sriov *iov ; struct pci_dev *dev ; int tmp ; int tmp___0 ; void *tmp___1 ; u16 __min1 ; u16 __min2 ; long tmp___2 ; void *tmp___3 ; struct lock_class_key __key ; u8 tmp___4 ; void *tmp___5 ; long tmp___6 ; { dev = bp->pdev; bp->vfdb = 0; if ((bp->flags & 4194304U) != 0U) { return (0); } else { } tmp = pci_find_ext_capability(dev, 16); if (tmp == 0) { return (0); } else { } if (bp->common.chip_id >> 16 == 5710U || (bp->common.chip_id >> 16 == 5711U || bp->common.chip_id >> 16 == 5712U)) { return (0); } else { } if (num_vfs_param == 0) { return (0); } else { } if (((int )bp->igu_sb_cnt - (int )bp->cnic_support) * 3 + (int )bp->cnic_support * 2 > 255) { printk("\v[%s:%d(%s)]PF cids %d are overspilling into vf space (starts at %d). Abort SRIOV\n", "bnx2x_iov_init_one", 2001, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", ((int )bp->igu_sb_cnt - (int )bp->cnic_support) * 3 + (int )bp->cnic_support * 2, 256); return (0); } else { } if (int_mode_param == 2 || int_mode_param == 1) { printk("\v[%s:%d(%s)]Forced MSI/INTx mode is incompatible with SRIOV\n", "bnx2x_iov_init_one", 2008, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); return (0); } else { } err = -5; tmp___0 = bnx2x_ari_enabled(bp->pdev); if (tmp___0 == 0) { printk("\v[%s:%d(%s)]ARI not supported (check pci bridge ARI forwarding), SRIOV can not be enabled\n", "bnx2x_iov_init_one", 2015, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); return (0); } else { } if ((bp->common.chip_id >> 16 == 5710U || (bp->common.chip_id >> 16 == 5711U || bp->common.chip_id >> 16 == 5712U)) || ((int )bp->common.int_block & 2) != 0) { printk("\v[%s:%d(%s)]IGU not normal mode, SRIOV can not be enabled\n", "bnx2x_iov_init_one", 2021, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); return (0); } else { } tmp___1 = kzalloc(2744UL, 208U); bp->vfdb = (struct bnx2x_vfdb *)tmp___1; if ((unsigned long )bp->vfdb == (unsigned long )((struct bnx2x_vfdb *)0)) { printk("\v[%s:%d(%s)]failed to allocate vf database\n", "bnx2x_iov_init_one", 2028, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); err = -12; goto failed; } else { } iov = & (bp->vfdb)->sriov; err = bnx2x_sriov_info(bp, iov); if (err != 0) { goto failed; } else { } if ((unsigned int )iov->total == 0U) { goto failed; } else { } __min1 = iov->total; __min2 = (u16 )num_vfs_param; iov->nr_virtfn = (u16 )((int )__min1 < (int )__min2 ? __min1 : __min2); tmp___2 = ldv__builtin_expect((bp->msg_enable & 8388608) != 0, 0L); if (tmp___2 != 0L) { printk("\r[%s:%d(%s)]num_vfs_param was %d, nr_virtfn was %d\n", "bnx2x_iov_init_one", 2050, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", num_vfs_param, (int )iov->nr_virtfn); } else { } tmp___3 = kzalloc((unsigned long )(bp->vfdb)->sriov.nr_virtfn * 1112UL, 208U); (bp->vfdb)->vfs = (struct bnx2x_virtf *)tmp___3; if ((unsigned long )(bp->vfdb)->vfs == (unsigned long )((struct bnx2x_virtf *)0)) { printk("\v[%s:%d(%s)]failed to allocate vf array\n", "bnx2x_iov_init_one", 2056, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); err = -12; goto failed; } else { } i = 0; goto ldv_46447; ldv_46446: ((bp->vfdb)->vfs + (unsigned long )i)->index = (u8 )i; ((bp->vfdb)->vfs + (unsigned long )i)->abs_vfid = (int )((u8 )iov->first_vf_in_pf) + (int )((u8 )i); ((bp->vfdb)->vfs + (unsigned long )i)->state = 0U; INIT_LIST_HEAD(& ((bp->vfdb)->vfs + (unsigned long )i)->op_list_head); __mutex_init(& ((bp->vfdb)->vfs + (unsigned long )i)->op_mutex, "&bnx2x_vf(bp, i, op_mutex)", & __key); ((bp->vfdb)->vfs + (unsigned long )i)->op_current = 0; i = i + 1; ldv_46447: ; if ((int )(bp->vfdb)->sriov.nr_virtfn > i) { goto ldv_46446; } else { } bnx2x_get_vf_igu_cam_info(bp); tmp___4 = bnx2x_iov_get_max_queue_count(bp); qcount = (int )tmp___4; tmp___5 = kzalloc((unsigned long )qcount * 896UL, 208U); (bp->vfdb)->vfqs = (struct bnx2x_vf_queue *)tmp___5; if ((unsigned long )(bp->vfdb)->vfqs == (unsigned long )((struct bnx2x_vf_queue *)0)) { printk("\v[%s:%d(%s)]failed to allocate vf queue array\n", "bnx2x_iov_init_one", 2081, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); err = -12; goto failed; } else { } return (0); failed: tmp___6 = ldv__builtin_expect((bp->msg_enable & 8388608) != 0, 0L); if (tmp___6 != 0L) { printk("\r[%s:%d(%s)]Failed err=%d\n", "bnx2x_iov_init_one", 2088, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", err); } else { } __bnx2x_iov_free_vfdb(bp); return (err); } } void bnx2x_iov_remove_one(struct bnx2x *bp ) { long tmp ; long tmp___0 ; { if ((unsigned long )bp->vfdb == (unsigned long )((struct bnx2x_vfdb *)0)) { return; } else { } tmp = ldv__builtin_expect((bp->msg_enable & 8388608) != 0, 0L); if (tmp != 0L) { printk("\r[%s:%d(%s)]about to call disable sriov\n", "bnx2x_iov_remove_one", 2099, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } pci_disable_sriov(bp->pdev); tmp___0 = ldv__builtin_expect((bp->msg_enable & 8388608) != 0, 0L); if (tmp___0 != 0L) { printk("\r[%s:%d(%s)]sriov disabled\n", "bnx2x_iov_remove_one", 2101, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } __bnx2x_iov_free_vfdb(bp); return; } } void bnx2x_iov_free_mem(struct bnx2x *bp ) { int i ; struct hw_dma *cxt ; { if ((unsigned long )bp->vfdb == (unsigned long )((struct bnx2x_vfdb *)0)) { return; } else { } i = 0; goto ldv_46459; ldv_46458: cxt = (struct hw_dma *)(& (bp->vfdb)->context) + (unsigned long )i; if ((unsigned long )cxt->addr != (unsigned long )((void *)0)) { dma_free_attrs(& (bp->pdev)->dev, cxt->size, cxt->addr, cxt->mapping, 0); cxt->addr = 0; cxt->mapping = 0ULL; } else { } i = i + 1; ldv_46459: ; if ((unsigned int )i <= 1U) { goto ldv_46458; } else { } if ((unsigned long )(bp->vfdb)->sp_dma.addr != (unsigned long )((void *)0)) { dma_free_attrs(& (bp->pdev)->dev, (bp->vfdb)->sp_dma.size, (bp->vfdb)->sp_dma.addr, (bp->vfdb)->sp_dma.mapping, 0); (bp->vfdb)->sp_dma.addr = 0; (bp->vfdb)->sp_dma.mapping = 0ULL; } else { } if ((unsigned long )(bp->vfdb)->mbx_dma.addr != (unsigned long )((void *)0)) { dma_free_attrs(& (bp->pdev)->dev, (bp->vfdb)->mbx_dma.size, (bp->vfdb)->mbx_dma.addr, (bp->vfdb)->mbx_dma.mapping, 0); (bp->vfdb)->mbx_dma.addr = 0; (bp->vfdb)->mbx_dma.mapping = 0ULL; } else { } if ((unsigned long )(bp->vfdb)->bulletin_dma.addr != (unsigned long )((void *)0)) { dma_free_attrs(& (bp->pdev)->dev, (bp->vfdb)->bulletin_dma.size, (bp->vfdb)->bulletin_dma.addr, (bp->vfdb)->bulletin_dma.mapping, 0); (bp->vfdb)->bulletin_dma.addr = 0; (bp->vfdb)->bulletin_dma.mapping = 0ULL; } else { } return; } } int bnx2x_iov_alloc_mem(struct bnx2x *bp ) { size_t tot_size ; int i ; int rc ; struct hw_dma *cxt ; size_t __min1 ; size_t __min2 ; int __y ; { rc = 0; if ((unsigned long )bp->vfdb == (unsigned long )((struct bnx2x_vfdb *)0)) { return (rc); } else { } tot_size = (unsigned long )((bp->vfdb)->sriov.first_vf_in_pf + (u32 )(bp->vfdb)->sriov.nr_virtfn) * 1024UL; i = 0; goto ldv_46473; ldv_46472: cxt = (struct hw_dma *)(& (bp->vfdb)->context) + (unsigned long )i; __min1 = tot_size; __min2 = 32768UL; cxt->size = __min1 < __min2 ? __min1 : __min2; if (cxt->size != 0UL) { cxt->addr = dma_alloc_attrs(& (bp->pdev)->dev, cxt->size, & cxt->mapping, 32976U, 0); if ((unsigned long )cxt->addr == (unsigned long )((void *)0)) { goto alloc_mem_err; } else { } } else { cxt->addr = 0; cxt->mapping = 0ULL; } tot_size = tot_size - cxt->size; i = i + 1; ldv_46473: ; if ((unsigned int )i <= 1U) { goto ldv_46472; } else { } tot_size = (unsigned long )(bp->vfdb)->sriov.nr_virtfn * 1176UL; (bp->vfdb)->sp_dma.addr = dma_alloc_attrs(& (bp->pdev)->dev, tot_size, & (bp->vfdb)->sp_dma.mapping, 32976U, 0); if ((unsigned long )(bp->vfdb)->sp_dma.addr == (unsigned long )((void *)0)) { goto alloc_mem_err; } else { } (bp->vfdb)->sp_dma.size = tot_size; __y = 8; tot_size = (unsigned long )(bp->vfdb)->sriov.nr_virtfn * ((((unsigned long )(__y + -1) + 2048UL) / (unsigned long )__y) * (unsigned long )__y); (bp->vfdb)->mbx_dma.addr = dma_alloc_attrs(& (bp->pdev)->dev, tot_size, & (bp->vfdb)->mbx_dma.mapping, 32976U, 0); if ((unsigned long )(bp->vfdb)->mbx_dma.addr == (unsigned long )((void *)0)) { goto alloc_mem_err; } else { } (bp->vfdb)->mbx_dma.size = tot_size; tot_size = (unsigned long )(bp->vfdb)->sriov.nr_virtfn * 32UL; (bp->vfdb)->bulletin_dma.addr = dma_alloc_attrs(& (bp->pdev)->dev, tot_size, & (bp->vfdb)->bulletin_dma.mapping, 32976U, 0); if ((unsigned long )(bp->vfdb)->bulletin_dma.addr == (unsigned long )((void *)0)) { goto alloc_mem_err; } else { } (bp->vfdb)->bulletin_dma.size = tot_size; return (0); alloc_mem_err: ; return (-12); } } static void bnx2x_vfq_init(struct bnx2x *bp , struct bnx2x_virtf *vf , struct bnx2x_vf_queue *q ) { u8 cl_id ; u8 tmp ; u8 func_id ; unsigned long q_type ; long tmp___0 ; bool tmp___1 ; { tmp = vfq_cl_id___0(vf, q); cl_id = tmp; func_id = (unsigned int )vf->abs_vfid + 8U; q_type = 0UL; set_bit(1U, (unsigned long volatile *)(& q_type)); set_bit(0U, (unsigned long volatile *)(& q_type)); bnx2x_init_queue_obj(bp, & q->sp_obj, (int )cl_id, & q->cid, 1, (int )func_id, (bp->vfdb)->sp_dma.addr + ((unsigned long )vf->index * 1176UL + 1056UL), ((bp->vfdb)->sp_dma.mapping + (unsigned long long )((unsigned long )vf->index * 1176UL)) + 1056ULL, q_type); tmp___0 = ldv__builtin_expect((bp->msg_enable & 8388608) != 0, 0L); if (tmp___0 != 0L) { printk("\r[%s:%d(%s)]initialized vf %d\'s queue object. func id set to %d\n", "bnx2x_vfq_init", 2201, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )vf->abs_vfid, (int )q->sp_obj.func_id); } else { } tmp___1 = vfq_is_leading(q); if ((int )tmp___1) { bnx2x_init_mac_obj(bp, & q->mac_obj, (int )cl_id, q->cid, (int )func_id, (bp->vfdb)->sp_dma.addr + (unsigned long )vf->index * 1176UL, (bp->vfdb)->sp_dma.mapping + (unsigned long long )((unsigned long )vf->index * 1176UL), 0, & vf->filter_state, 2, & bp->macs_pool); bnx2x_init_vlan_obj(bp, & q->vlan_obj, (int )cl_id, q->cid, (int )func_id, (bp->vfdb)->sp_dma.addr + ((unsigned long )vf->index * 1176UL + 264UL), ((bp->vfdb)->sp_dma.mapping + (unsigned long long )((unsigned long )vf->index * 1176UL)) + 264ULL, 1, & vf->filter_state, 2, & bp->vlans_pool); bnx2x_init_mcast_obj(bp, & vf->mcast_obj, (int )cl_id, q->cid, (int )func_id, (int )func_id, (bp->vfdb)->sp_dma.addr + ((unsigned long )vf->index * 1176UL + 792UL), ((bp->vfdb)->sp_dma.mapping + (unsigned long long )((unsigned long )vf->index * 1176UL)) + 792ULL, 9, & vf->filter_state, 2); vf->leading_rss = (int )cl_id; } else { } return; } } int bnx2x_iov_nic_init(struct bnx2x *bp ) { int vfid ; int qcount ; int i ; long tmp ; long tmp___0 ; struct bnx2x_virtf *vf ; int base_vf_cid ; union cdu_context *base_cxt ; long tmp___1 ; int __y ; int __y___0 ; struct bnx2x_virtf *vf___0 ; int tmp___2 ; int tmp___3 ; long tmp___4 ; { if ((unsigned long )bp->vfdb == (unsigned long )((struct bnx2x_vfdb *)0)) { tmp = ldv__builtin_expect((bp->msg_enable & 8388608) != 0, 0L); if (tmp != 0L) { printk("\r[%s:%d(%s)]vfdb was not allocated\n", "bnx2x_iov_nic_init", 2245, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } return (0); } else { } tmp___0 = ldv__builtin_expect((bp->msg_enable & 8388608) != 0, 0L); if (tmp___0 != 0L) { printk("\r[%s:%d(%s)]num of vfs: %d\n", "bnx2x_iov_nic_init", 2249, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )(bp->vfdb)->sriov.nr_virtfn); } else { } vfid = 0; goto ldv_46501; ldv_46500: vf = (bp->vfdb)->vfs + (unsigned long )vfid; base_vf_cid = (int )((bp->vfdb)->sriov.first_vf_in_pf + (u32 )vfid); base_cxt = (union cdu_context *)((struct hw_dma *)(& (bp->vfdb)->context) + (unsigned long )base_vf_cid / 32UL)->addr + ((unsigned long )base_vf_cid & 31UL); tmp___1 = ldv__builtin_expect((bp->msg_enable & 8388608) != 0, 0L); if (tmp___1 != 0L) { printk("\r[%s:%d(%s)]VF[%d] Max IGU SBs: %d, base vf cid 0x%x, base cid 0x%x, base cxt %p\n", "bnx2x_iov_nic_init", 2265, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )vf->abs_vfid, (int )vf->alloc_resc.num_sbs, base_vf_cid, base_vf_cid + 256, base_cxt); } else { } bnx2x_iov_static_resc(bp, & vf->alloc_resc); (*(bp->vlans_pool.get))(& bp->vlans_pool, (int )vf->alloc_resc.num_vlan_filters); vf->filter_state = 0UL; vf->sp_cl_id = (bp->fp)->cl_id; bnx2x_init_mcast_obj(bp, & vf->mcast_obj, 255, 255U, 255, 255, (bp->vfdb)->sp_dma.addr + ((unsigned long )vf->index * 1176UL + 792UL), ((bp->vfdb)->sp_dma.mapping + (unsigned long long )((unsigned long )vf->index * 1176UL)) + 792ULL, 9, & vf->filter_state, 2); __y = 8; ((struct bnx2x_vf_mbx *)(& (bp->vfdb)->mbxs) + (unsigned long )vfid)->msg = (struct bnx2x_vf_mbx_msg *)(bp->vfdb)->mbx_dma.addr + (unsigned long )vfid * ((((unsigned long )(__y + -1) + 2048UL) / (unsigned long )__y) * (unsigned long )__y); __y___0 = 8; ((struct bnx2x_vf_mbx *)(& (bp->vfdb)->mbxs) + (unsigned long )vfid)->msg_mapping = (bp->vfdb)->mbx_dma.mapping + (unsigned long long )((unsigned long )vfid * ((((unsigned long )(__y___0 + -1) + 2048UL) / (unsigned long )__y___0) * (unsigned long )__y___0)); bnx2x_vf_enable_mbx(bp, (int )vf->abs_vfid); vfid = vfid + 1; ldv_46501: ; if ((int )(bp->vfdb)->sriov.nr_virtfn > vfid) { goto ldv_46500; } else { } qcount = 0; i = 0; goto ldv_46505; ldv_46504: vf___0 = (bp->vfdb)->vfs + (unsigned long )i; tmp___2 = bnx2x_vf_bus(bp, i); vf___0->bus = (unsigned int )tmp___2; tmp___3 = bnx2x_vf_devfn(bp, i); vf___0->devfn = (unsigned int )tmp___3; bnx2x_vf_set_bars(bp, vf___0); tmp___4 = ldv__builtin_expect((bp->msg_enable & 8388608) != 0, 0L); if (tmp___4 != 0L) { printk("\r[%s:%d(%s)]VF info[%d]: bus 0x%x, devfn 0x%x, bar0 [0x%x, %d], bar1 [0x%x, %d], bar2 [0x%x, %d]\n", "bnx2x_iov_nic_init", 2318, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )vf___0->abs_vfid, vf___0->bus, vf___0->devfn, (unsigned int )vf___0->bars[0].bar, vf___0->bars[0].size, (unsigned int )vf___0->bars[1].bar, vf___0->bars[1].size, (unsigned int )vf___0->bars[2].bar, vf___0->bars[2].size); } else { } vf___0->vfqs = (bp->vfdb)->vfqs + (unsigned long )qcount; qcount = (int )((bp->vfdb)->vfs + (unsigned long )i)->alloc_resc.num_sbs + qcount; i = i + 1; ldv_46505: ; if ((int )(bp->vfdb)->sriov.nr_virtfn > i) { goto ldv_46504; } else { } return (0); } } int bnx2x_iov_chip_cleanup(struct bnx2x *bp ) { int i ; { if ((unsigned long )bp->vfdb == (unsigned long )((struct bnx2x_vfdb *)0)) { return (0); } else { } i = 0; goto ldv_46512; ldv_46511: bnx2x_vf_release(bp, (bp->vfdb)->vfs + (unsigned long )i, 1); i = i + 1; ldv_46512: ; if ((int )(bp->vfdb)->sriov.nr_virtfn > i) { goto ldv_46511; } else { } return (0); } } int bnx2x_iov_init_ilt(struct bnx2x *bp , u16 line ) { int i ; struct bnx2x_ilt *ilt ; struct hw_dma *hw_cxt ; { ilt = bp->ilt; if ((unsigned long )bp->vfdb == (unsigned long )((struct bnx2x_vfdb *)0)) { return ((int )line); } else { } i = 0; goto ldv_46522; ldv_46521: hw_cxt = (struct hw_dma *)(& (bp->vfdb)->context) + (unsigned long )i; (ilt->lines + (unsigned long )((int )line + i))->page = hw_cxt->addr; (ilt->lines + (unsigned long )((int )line + i))->page_mapping = hw_cxt->mapping; (ilt->lines + (unsigned long )((int )line + i))->size = (u32 )hw_cxt->size; i = i + 1; ldv_46522: ; if ((unsigned int )i <= 1U) { goto ldv_46521; } else { } return ((int )line + i); } } static u8 bnx2x_iov_is_vf_cid(struct bnx2x *bp , u16 cid ) { { return ((u8 )((unsigned int )cid > 255U && (int )cid + -256 <= 63)); } } static void bnx2x_vf_handle_classification_eqe(struct bnx2x *bp , struct bnx2x_vf_queue *vfq , union event_ring_elem *elem ) { unsigned long ramrod_flags ; int rc ; long tmp ; { ramrod_flags = 0UL; rc = 0; set_bit(6U, (unsigned long volatile *)(& ramrod_flags)); switch (elem->message.data.eth_event.echo >> 17) { case 0U: rc = (*(vfq->mac_obj.complete))(bp, & vfq->mac_obj, elem, & ramrod_flags); goto ldv_46536; case 1U: rc = (*(vfq->vlan_obj.complete))(bp, & vfq->vlan_obj, elem, & ramrod_flags); goto ldv_46536; default: printk("\v[%s:%d(%s)]Unsupported classification command: %d\n", "bnx2x_vf_handle_classification_eqe", 2391, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", elem->message.data.eth_event.echo); return; } ldv_46536: ; if (rc < 0) { printk("\v[%s:%d(%s)]Failed to schedule new commands: %d\n", "bnx2x_vf_handle_classification_eqe", 2395, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", rc); } else if (rc > 0) { tmp = ldv__builtin_expect((bp->msg_enable & 8388608) != 0, 0L); if (tmp != 0L) { printk("\r[%s:%d(%s)]Scheduled next pending commands...\n", "bnx2x_vf_handle_classification_eqe", 2397, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } } else { } return; } } static void bnx2x_vf_handle_mcast_eqe(struct bnx2x *bp , struct bnx2x_virtf *vf ) { struct bnx2x_mcast_ramrod_params rparam ; int rc ; bool tmp ; { rparam.mcast_obj = 0; rparam.ramrod_flags = 0UL; rparam.mcast_list.next = 0; rparam.mcast_list.prev = 0; rparam.mcast_list_len = 0; rparam.mcast_obj = & vf->mcast_obj; (*(vf->mcast_obj.raw.clear_pending))(& vf->mcast_obj.raw); tmp = (*(vf->mcast_obj.check_pending))(& vf->mcast_obj); if ((int )tmp) { rc = bnx2x_config_mcast(bp, & rparam, 1); if (rc < 0) { printk("\v[%s:%d(%s)]Failed to send pending mcast commands: %d\n", "bnx2x_vf_handle_mcast_eqe", 2415, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", rc); } else { } } else { } return; } } static void bnx2x_vf_handle_filters_eqe(struct bnx2x *bp , struct bnx2x_virtf *vf ) { { __asm__ volatile ("": : : "memory"); clear_bit(3, (unsigned long volatile *)(& vf->filter_state)); __asm__ volatile ("": : : "memory"); return; } } int bnx2x_iov_eq_sp_event(struct bnx2x *bp , union event_ring_elem *elem ) { struct bnx2x_virtf *vf ; int qidx ; int abs_vfid ; u8 opcode ; u16 cid ; long tmp ; long tmp___0 ; long tmp___1 ; long tmp___2 ; long tmp___3 ; u8 tmp___4 ; long tmp___5 ; struct bnx2x_vf_queue *tmp___6 ; struct bnx2x_vf_queue *tmp___7 ; long tmp___8 ; struct bnx2x_vf_queue *tmp___9 ; long tmp___10 ; long tmp___11 ; long tmp___12 ; long tmp___13 ; { qidx = 0; cid = 65535U; if ((unsigned long )bp->vfdb == (unsigned long )((struct bnx2x_vfdb *)0)) { return (1); } else { } opcode = elem->message.opcode; switch ((int )opcode) { case 3: cid = (u16 )elem->message.data.cfc_del_event.cid; tmp = ldv__builtin_expect((bp->msg_enable & 8388608) != 0, 0L); if (tmp != 0L) { printk("\r[%s:%d(%s)]checking cfc-del comp cid=%d\n", "bnx2x_iov_eq_sp_event", 2447, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )cid); } else { } goto ldv_46562; case 15: ; case 17: ; case 16: cid = (u16 )elem->message.data.eth_event.echo; tmp___0 = ldv__builtin_expect((bp->msg_enable & 8388608) != 0, 0L); if (tmp___0 != 0L) { printk("\r[%s:%d(%s)]checking filtering comp cid=%d\n", "bnx2x_iov_eq_sp_event", 2454, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )cid); } else { } goto ldv_46562; case 8: abs_vfid = (int )elem->message.data.vf_flr_event.vf_id; tmp___1 = ldv__builtin_expect((bp->msg_enable & 8388608) != 0, 0L); if (tmp___1 != 0L) { printk("\r[%s:%d(%s)]Got VF FLR notification abs_vfid=%d\n", "bnx2x_iov_eq_sp_event", 2459, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", abs_vfid); } else { } goto get_vf; case 9: abs_vfid = (int )elem->message.data.malicious_vf_event.vf_id; tmp___2 = ldv__builtin_expect((bp->msg_enable & 8388608) != 0, 0L); if (tmp___2 != 0L) { printk("\r[%s:%d(%s)]Got VF MALICIOUS notification abs_vfid=%d err_id=0x%x\n", "bnx2x_iov_eq_sp_event", 2464, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", abs_vfid, (int )elem->message.data.malicious_vf_event.err_id); } else { } goto get_vf; default: ; return (1); } ldv_46562: tmp___4 = bnx2x_iov_is_vf_cid(bp, (int )cid); if ((unsigned int )tmp___4 == 0U) { tmp___3 = ldv__builtin_expect((bp->msg_enable & 8388608) != 0, 0L); if (tmp___3 != 0L) { printk("\r[%s:%d(%s)]cid is outside vf range: %d\n", "bnx2x_iov_eq_sp_event", 2472, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )cid); } else { } return (1); } else { } qidx = 0; abs_vfid = (int )cid & 63; get_vf: vf = bnx2x_vf_by_abs_fid(bp, (int )((u16 )abs_vfid)); if ((unsigned long )vf == (unsigned long )((struct bnx2x_virtf *)0)) { printk("\v[%s:%d(%s)]EQ completion for unknown VF, cid %d, abs_vfid %d\n", "bnx2x_iov_eq_sp_event", 2487, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )cid, abs_vfid); return (0); } else { } switch ((int )opcode) { case 3: tmp___5 = ldv__builtin_expect((bp->msg_enable & 8388608) != 0, 0L); if (tmp___5 != 0L) { printk("\r[%s:%d(%s)]got VF [%d:%d] cfc delete ramrod\n", "bnx2x_iov_eq_sp_event", 2494, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )vf->abs_vfid, qidx); } else { } tmp___6 = vfq_get(vf, (int )((u8 )qidx)); tmp___7 = vfq_get(vf, (int )((u8 )qidx)); (*(tmp___6->sp_obj.complete_cmd))(bp, & tmp___7->sp_obj, 8); goto ldv_46571; case 15: tmp___8 = ldv__builtin_expect((bp->msg_enable & 8388608) != 0, 0L); if (tmp___8 != 0L) { printk("\r[%s:%d(%s)]got VF [%d:%d] set mac/vlan ramrod\n", "bnx2x_iov_eq_sp_event", 2502, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )vf->abs_vfid, qidx); } else { } tmp___9 = vfq_get(vf, (int )((u8 )qidx)); bnx2x_vf_handle_classification_eqe(bp, tmp___9, elem); goto ldv_46571; case 17: tmp___10 = ldv__builtin_expect((bp->msg_enable & 8388608) != 0, 0L); if (tmp___10 != 0L) { printk("\r[%s:%d(%s)]got VF [%d:%d] set mcast ramrod\n", "bnx2x_iov_eq_sp_event", 2507, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )vf->abs_vfid, qidx); } else { } bnx2x_vf_handle_mcast_eqe(bp, vf); goto ldv_46571; case 16: tmp___11 = ldv__builtin_expect((bp->msg_enable & 8388608) != 0, 0L); if (tmp___11 != 0L) { printk("\r[%s:%d(%s)]got VF [%d:%d] set rx-mode ramrod\n", "bnx2x_iov_eq_sp_event", 2512, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )vf->abs_vfid, qidx); } else { } bnx2x_vf_handle_filters_eqe(bp, vf); goto ldv_46571; case 8: tmp___12 = ldv__builtin_expect((bp->msg_enable & 8388608) != 0, 0L); if (tmp___12 != 0L) { printk("\r[%s:%d(%s)]got VF [%d] FLR notification\n", "bnx2x_iov_eq_sp_event", 2517, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )vf->abs_vfid); } else { } goto ldv_46571; case 9: tmp___13 = ldv__builtin_expect((bp->msg_enable & 8388608) != 0, 0L); if (tmp___13 != 0L) { printk("\r[%s:%d(%s)]Got VF MALICIOUS notification abs_vfid=%d error id %x\n", "bnx2x_iov_eq_sp_event", 2522, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", abs_vfid, (int )elem->message.data.malicious_vf_event.err_id); } else { } goto ldv_46571; } ldv_46571: bnx2x_iov_sp_event(bp, (int )cid, 0); return (0); } } static struct bnx2x_virtf *bnx2x_vf_by_cid(struct bnx2x *bp , int vf_cid ) { int abs_vfid ; struct bnx2x_virtf *tmp ; { abs_vfid = vf_cid & 63; tmp = bnx2x_vf_by_abs_fid(bp, (int )((u16 )abs_vfid)); return (tmp); } } void bnx2x_iov_set_queue_sp_obj(struct bnx2x *bp , int vf_cid , struct bnx2x_queue_sp_obj **q_obj ) { struct bnx2x_virtf *vf ; int q_index ; { if ((unsigned long )bp->vfdb == (unsigned long )((struct bnx2x_vfdb *)0)) { return; } else { } vf = bnx2x_vf_by_cid(bp, vf_cid); if ((unsigned long )vf != (unsigned long )((struct bnx2x_virtf *)0)) { q_index = 0; *q_obj = & (vf->vfqs + (unsigned long )q_index)->sp_obj; } else { printk("\v[%s:%d(%s)]No vf matching cid %d\n", "bnx2x_iov_set_queue_sp_obj", 2560, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", vf_cid); } return; } } void bnx2x_iov_sp_event(struct bnx2x *bp , int vf_cid , bool queue_work___0 ) { struct bnx2x_virtf *vf ; u8 tmp ; { if ((unsigned long )bp->vfdb == (unsigned long )((struct bnx2x_vfdb *)0)) { return; } else { tmp = bnx2x_iov_is_vf_cid(bp, (int )((u16 )vf_cid)); if ((unsigned int )tmp == 0U) { return; } else { } } vf = bnx2x_vf_by_cid(bp, vf_cid); if ((unsigned long )vf != (unsigned long )((struct bnx2x_virtf *)0)) { atomic_set(& vf->op_in_progress, 1); if ((int )queue_work___0) { queue_delayed_work(bnx2x_wq, & bp->sp_task, 0UL); } else { } } else { } return; } } void bnx2x_iov_adjust_stats_req(struct bnx2x *bp ) { int i ; int first_queue_query_index ; int num_queues_req ; dma_addr_t cur_data_offset ; struct stats_query_entry *cur_query_entry ; u8 stats_count ; bool is_fcoe ; long tmp ; int j ; struct bnx2x_virtf *vf ; long tmp___0 ; long tmp___1 ; struct bnx2x_vf_queue *rxq ; struct bnx2x_vf_queue *tmp___2 ; int tmp___3 ; long tmp___4 ; { stats_count = 0U; is_fcoe = 0; if ((unsigned long )bp->vfdb == (unsigned long )((struct bnx2x_vfdb *)0)) { return; } else { } if ((bp->flags & 32768U) == 0U) { is_fcoe = 1; } else { } num_queues_req = (int )(bp->num_ethernet_queues + (uint )is_fcoe); first_queue_query_index = (int )is_fcoe ? 3 : 2; tmp = ldv__builtin_expect((bp->msg_enable & 8388608) != 0, 0L); if (tmp != 0L) { printk("\r[%s:%d(%s)]BNX2X_NUM_ETH_QUEUES %d, is_fcoe %d, first_queue_query_index %d => determined the last non virtual statistics query index is %d. Will add queries on top of that\n", "bnx2x_iov_adjust_stats_req", 2604, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", bp->num_ethernet_queues, (int )is_fcoe, first_queue_query_index, first_queue_query_index + num_queues_req); } else { } cur_data_offset = (bp->fw_stats_data_mapping + (unsigned long long )((unsigned long )num_queues_req * 152UL)) + 128ULL; cur_query_entry = (struct stats_query_entry *)(& (bp->fw_stats_req)->query) + (unsigned long )(first_queue_query_index + num_queues_req); i = 0; goto ldv_46616; ldv_46615: vf = (bp->vfdb)->vfs + (unsigned long )i; if ((unsigned int )vf->state != 2U) { tmp___0 = ldv__builtin_expect((bp->msg_enable & 8388608) != 0, 0L); if (tmp___0 != 0L) { printk("\r[%s:%d(%s)]vf %d not enabled so no stats for it\n", "bnx2x_iov_adjust_stats_req", 2620, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )vf->abs_vfid); } else { } goto ldv_46609; } else { } tmp___1 = ldv__builtin_expect((bp->msg_enable & 8388608) != 0, 0L); if (tmp___1 != 0L) { printk("\r[%s:%d(%s)]add addresses for vf %d\n", "bnx2x_iov_adjust_stats_req", 2624, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )vf->abs_vfid); } else { } j = 0; goto ldv_46613; ldv_46612: tmp___2 = vfq_get(vf, (int )((u8 )j)); rxq = tmp___2; tmp___3 = bnx2x_get_q_logical_state(bp, & rxq->sp_obj); if (tmp___3 == 1) { goto ldv_46611; } else { } cur_query_entry->kind = 0U; cur_query_entry->index = vfq_cl_id___0(vf, rxq); cur_query_entry->funcID = (unsigned int )((unsigned short )vf->abs_vfid) + 8U; cur_query_entry->address.hi = (unsigned int )(vf->fw_stat_map >> 32); cur_query_entry->address.lo = (unsigned int )vf->fw_stat_map; tmp___4 = ldv__builtin_expect((bp->msg_enable & 8388608) != 0, 0L); if (tmp___4 != 0L) { printk("\r[%s:%d(%s)]added address %x %x for vf %d queue %d client %d\n", "bnx2x_iov_adjust_stats_req", 2646, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", cur_query_entry->address.hi, cur_query_entry->address.lo, (int )cur_query_entry->funcID, j, (int )cur_query_entry->index); } else { } cur_query_entry = cur_query_entry + 1; cur_data_offset = cur_data_offset + 152ULL; stats_count = (u8 )((int )stats_count + 1); ldv_46611: j = j + 1; ldv_46613: ; if ((int )vf->alloc_resc.num_rxqs > j) { goto ldv_46612; } else { } ldv_46609: i = i + 1; ldv_46616: ; if ((int )(bp->vfdb)->sriov.nr_virtfn > i) { goto ldv_46615; } else { } (bp->fw_stats_req)->hdr.cmd_num = (int )bp->fw_stats_num + (int )stats_count; return; } } void bnx2x_iov_sp_task(struct bnx2x *bp ) { int i ; long tmp ; struct bnx2x_virtf *vf ; long tmp___0 ; struct bnx2x_vfop *tmp___1 ; int tmp___2 ; int tmp___3 ; { if ((unsigned long )bp->vfdb == (unsigned long )((struct bnx2x_vfdb *)0)) { return; } else { } tmp = ldv__builtin_expect((bp->msg_enable & 8388608) != 0, 0L); if (tmp != 0L) { printk("\r[%s:%d(%s)]searching for pending vf operations\n", "bnx2x_iov_sp_task", 2664, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } i = 0; goto ldv_46625; ldv_46624: vf = (bp->vfdb)->vfs + (unsigned long )i; tmp___2 = list_empty((struct list_head const *)(& vf->op_list_head)); if (tmp___2 == 0) { tmp___3 = atomic_read((atomic_t const *)(& vf->op_in_progress)); if (tmp___3 != 0) { tmp___0 = ldv__builtin_expect((bp->msg_enable & 8388608) != 0, 0L); if (tmp___0 != 0L) { printk("\r[%s:%d(%s)]running pending op for vf %d\n", "bnx2x_iov_sp_task", 2670, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", i); } else { } tmp___1 = bnx2x_vfop_cur___0(bp, vf); (*(tmp___1->transition))(bp, vf); } else { } } else { } i = i + 1; ldv_46625: ; if ((int )(bp->vfdb)->sriov.nr_virtfn > i) { goto ldv_46624; } else { } return; } } static void bnx2x_vf_qtbl_set_q(struct bnx2x *bp , u8 abs_vfid , u8 qid , u8 enable ) { u32 reg ; u32 val ; { reg = (u32 )(((int )qid + 265472) * 4); val = (unsigned int )enable != 0U ? (unsigned int )abs_vfid | 64U : 0U; writel(val, (void volatile *)bp->regview + (unsigned long )reg); return; } } static void bnx2x_vf_clr_qtbl(struct bnx2x *bp , struct bnx2x_virtf *vf ) { int i ; struct bnx2x_vf_queue *tmp ; u8 tmp___0 ; { i = 0; goto ldv_46650; ldv_46649: tmp = vfq_get(vf, (int )((u8 )i)); tmp___0 = vfq_stat_id(vf, tmp); bnx2x_vf_qtbl_set_q(bp, (int )vf->abs_vfid, (int )tmp___0, 0); i = i + 1; ldv_46650: ; if ((int )vf->alloc_resc.num_rxqs > i) { goto ldv_46649; } else { } return; } } static void bnx2x_vf_igu_disable(struct bnx2x *bp , struct bnx2x_virtf *vf ) { u32 val ; { bnx2x_pretend_func(bp, (int )((unsigned short )((int )((short )((unsigned int )bp->pf_num | 8U)) | (int )((short )((int )vf->abs_vfid << 4))))); val = readl((void const volatile *)bp->regview + 1245552U); val = val & 4294967264U; writel(val, (void volatile *)bp->regview + 1245552U); bnx2x_pretend_func(bp, (int )bp->pf_num); return; } } u8 bnx2x_vf_max_queue_cnt(struct bnx2x *bp , struct bnx2x_virtf *vf ) { u8 __min1 ; u8 __min1___0 ; u8 __min2 ; u8 __min2___0 ; { __min1___0 = vf->alloc_resc.num_sbs; __min2 = 1U; __min1 = (u8 )((int )__min1___0 < (int )__min2 ? __min1___0 : __min2); __min2___0 = 16U; return ((u8 )((int )__min1 < (int )__min2___0 ? __min1 : __min2___0)); } } static int bnx2x_vf_chk_avail_resc(struct bnx2x *bp , struct bnx2x_virtf *vf , struct vf_pf_resc_request *req_resc ) { u8 rxq_cnt ; u8 tmp ; int tmp___0 ; u8 txq_cnt ; u8 tmp___1 ; int tmp___2 ; { if ((int )vf->alloc_resc.num_rxqs != 0) { tmp___0 = (u8 )((int )vf->alloc_resc.num_rxqs); } else { tmp = bnx2x_vf_max_queue_cnt(bp, vf); tmp___0 = tmp; } rxq_cnt = tmp___0; if ((int )vf->alloc_resc.num_txqs != 0) { tmp___2 = (u8 )((int )vf->alloc_resc.num_txqs); } else { tmp___1 = bnx2x_vf_max_queue_cnt(bp, vf); tmp___2 = tmp___1; } txq_cnt = tmp___2; return (((((int )req_resc->num_rxqs <= (int )rxq_cnt && (int )req_resc->num_txqs <= (int )txq_cnt) && (int )req_resc->num_sbs <= (int )vf->alloc_resc.num_sbs) && (int )req_resc->num_mac_filters <= (int )vf->alloc_resc.num_mac_filters) && (int )req_resc->num_vlan_filters <= (int )vf->alloc_resc.num_vlan_filters); } } int bnx2x_vf_acquire(struct bnx2x *bp , struct bnx2x_virtf *vf , struct vf_pf_resc_request *resc ) { int base_vf_cid ; union cdu_context *base_cxt ; int i ; long tmp ; int tmp___0 ; long tmp___1 ; int tmp___2 ; u8 tmp___3 ; u8 tmp___4 ; long tmp___5 ; long tmp___6 ; struct bnx2x_vf_queue *q ; struct bnx2x_vf_queue *tmp___7 ; long tmp___8 ; long tmp___9 ; { base_vf_cid = (int )((bp->vfdb)->sriov.first_vf_in_pf + (u32 )vf->index); base_cxt = (union cdu_context *)((struct hw_dma *)(& (bp->vfdb)->context) + (unsigned long )base_vf_cid / 32UL)->addr + ((unsigned long )base_vf_cid & 31UL); if ((unsigned int )vf->state == 1U) { tmp = ldv__builtin_expect((bp->msg_enable & 8388608) != 0, 0L); if (tmp != 0L) { printk("\r[%s:%d(%s)]VF[%d] Trying to re-acquire resources (VF was not released or FLR\'d)\n", "bnx2x_vf_acquire", 2762, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )vf->abs_vfid); } else { } tmp___0 = bnx2x_vf_chk_avail_resc(bp, vf, resc); if (tmp___0 == 0) { printk("\v[%s:%d(%s)]VF[%d] When re-acquiring resources, requested numbers must be <= then previously acquired numbers\n", "bnx2x_vf_acquire", 2766, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )vf->abs_vfid); return (-22); } else { } return (0); } else { } if ((unsigned int )vf->state != 0U && (unsigned int )vf->state != 3U) { printk("\v[%s:%d(%s)]VF[%d] Can not acquire a VF with state %d\n", "bnx2x_vf_acquire", 2775, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )vf->abs_vfid, (int )vf->state); return (-22); } else { } tmp___2 = bnx2x_vf_chk_avail_resc(bp, vf, resc); if (tmp___2 == 0) { tmp___1 = ldv__builtin_expect((bp->msg_enable & 8388608) != 0, 0L); if (tmp___1 != 0L) { printk("\r[%s:%d(%s)]cannot fulfill vf resource request. Placing maximal available values in response\n", "bnx2x_vf_acquire", 2785, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } return (-12); } else { } vf->alloc_resc.num_sbs = resc->num_sbs; if ((int )resc->num_rxqs != 0) { vf->alloc_resc.num_rxqs = (u8 )((int )resc->num_rxqs); } else { tmp___3 = bnx2x_vf_max_queue_cnt(bp, vf); vf->alloc_resc.num_rxqs = tmp___3; } if ((int )resc->num_txqs != 0) { vf->alloc_resc.num_txqs = (u8 )((int )resc->num_txqs); } else { tmp___4 = bnx2x_vf_max_queue_cnt(bp, vf); vf->alloc_resc.num_txqs = tmp___4; } if ((unsigned int )resc->num_mac_filters != 0U) { vf->alloc_resc.num_mac_filters = resc->num_mac_filters; } else { } if ((unsigned int )resc->num_vlan_filters != 0U) { vf->alloc_resc.num_vlan_filters = resc->num_vlan_filters; } else { } tmp___5 = ldv__builtin_expect((bp->msg_enable & 8388608) != 0, 0L); if (tmp___5 != 0L) { printk("\r[%s:%d(%s)]Fulfilling vf request: sb count %d, tx_count %d, rx_count %d, mac_rules_count %d, vlan_rules_count %d\n", "bnx2x_vf_acquire", 2803, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )vf->alloc_resc.num_sbs, (int )vf->alloc_resc.num_rxqs, (int )vf->alloc_resc.num_txqs, (int )vf->alloc_resc.num_mac_filters, (int )vf->alloc_resc.num_vlan_filters); } else { } if ((unsigned long )vf->vfqs == (unsigned long )((struct bnx2x_vf_queue *)0)) { tmp___6 = ldv__builtin_expect((bp->msg_enable & 8388608) != 0, 0L); if (tmp___6 != 0L) { printk("\r[%s:%d(%s)]vf->vfqs was not allocated\n", "bnx2x_vf_acquire", 2807, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } return (-22); } else { } i = 0; goto ldv_46685; ldv_46684: tmp___7 = vfq_get(vf, (int )((u8 )i)); q = tmp___7; if ((unsigned long )q == (unsigned long )((struct bnx2x_vf_queue *)0)) { tmp___8 = ldv__builtin_expect((bp->msg_enable & 8388608) != 0, 0L); if (tmp___8 != 0L) { printk("\r[%s:%d(%s)]q number %d was not allocated\n", "bnx2x_vf_acquire", 2815, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", i); } else { } return (-22); } else { } q->index = (u16 )i; q->cxt = & (base_cxt + (unsigned long )i)->eth; q->cid = (u32 )((base_vf_cid + 256) + i); tmp___9 = ldv__builtin_expect((bp->msg_enable & 8388608) != 0, 0L); if (tmp___9 != 0L) { printk("\r[%s:%d(%s)]VFQ[%d:%d]: index %d, cid 0x%x, cxt %p\n", "bnx2x_vf_acquire", 2824, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )vf->abs_vfid, i, (int )q->index, q->cid, q->cxt); } else { } bnx2x_vfq_init(bp, vf, q); i = i + 1; ldv_46685: ; if ((int )vf->alloc_resc.num_rxqs > i) { goto ldv_46684; } else { } vf->state = 1U; return (0); } } int bnx2x_vf_init(struct bnx2x *bp , struct bnx2x_virtf *vf , dma_addr_t *sb_map ) { struct bnx2x_func_init_params func_init ; u16 flags ; int i ; u8 tmp ; u8 tmp___0 ; long tmp___1 ; int tmp___2 ; struct bnx2x_vf_queue *tmp___3 ; u8 tmp___4 ; { func_init.fw_stat_map = 0ULL; func_init.spq_map = 0ULL; func_init.func_flgs = (unsigned short)0; func_init.func_id = (unsigned short)0; func_init.pf_id = (unsigned short)0; func_init.spq_prod = (unsigned short)0; flags = 0U; i = 0; goto ldv_46696; ldv_46695: tmp = vf_igu_sb(vf, (int )((u16 )i)); tmp___0 = vf_igu_sb(vf, (int )((u16 )i)); bnx2x_init_sb(bp, *(sb_map + (unsigned long )i), (int )vf->abs_vfid, 1, (int )tmp___0, (int )tmp); i = i + 1; ldv_46696: ; if ((int )vf->alloc_resc.num_sbs > i) { goto ldv_46695; } else { } if ((unsigned int )vf->state != 1U) { tmp___1 = ldv__builtin_expect((bp->msg_enable & 8388608) != 0, 0L); if (tmp___1 != 0L) { printk("\r[%s:%d(%s)]VF[%d] is not in VF_ACQUIRED, but %d\n", "bnx2x_vf_init", 2849, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )vf->abs_vfid, (int )vf->state); } else { } return (-22); } else { } tmp___2 = bnx2x_vf_flr_clnup_epilog(bp, (int )vf->abs_vfid); if (tmp___2 != 0) { return (-16); } else { } writel(0U, (void volatile *)bp->regview + (unsigned long )(((int )vf->abs_vfid + 311808) * 4)); if ((int )vf->cfg_flags & 1) { flags = (u16 )((unsigned int )flags | 18U); } else { } if (((int )vf->cfg_flags & 4) != 0) { flags = (u16 )((unsigned int )flags | 8U); } else { } if ((unsigned int )vf->alloc_resc.num_rxqs > 1U) { flags = (u16 )((unsigned int )flags | 1U); } else { } func_init.func_flgs = flags; func_init.pf_id = (u16 )bp->pfid; func_init.func_id = (unsigned int )((u16 )vf->abs_vfid) + 8U; func_init.fw_stat_map = vf->fw_stat_map; func_init.spq_map = vf->spq_map; func_init.spq_prod = 0U; bnx2x_func_init(bp, & func_init); bnx2x_vf_enable_access(bp, (int )vf->abs_vfid); bnx2x_vf_enable_traffic(bp, vf); i = 0; goto ldv_46700; ldv_46699: tmp___3 = vfq_get(vf, (int )((u8 )i)); tmp___4 = vfq_stat_id(vf, tmp___3); bnx2x_vf_qtbl_set_q(bp, (int )vf->abs_vfid, (int )tmp___4, 1); i = i + 1; ldv_46700: ; if ((int )vf->alloc_resc.num_rxqs > i) { goto ldv_46699; } else { } vf->state = 2U; bnx2x_post_vf_bulletin(bp, (int )vf->index); return (0); } } static void bnx2x_vfop_close(struct bnx2x *bp , struct bnx2x_virtf *vf ) { struct bnx2x_vfop *vfop ; struct bnx2x_vfop *tmp ; struct bnx2x_vfop_args_qx *qx ; enum bnx2x_vfop_close_state state ; struct bnx2x_vfop_cmd cmd ; long tmp___0 ; long tmp___1 ; long tmp___2 ; long tmp___3 ; { tmp = bnx2x_vfop_cur___0(bp, vf); vfop = tmp; qx = & vfop->args.qx; state = (enum bnx2x_vfop_close_state )vfop->state; cmd.done = & bnx2x_vfop_close; cmd.block = 0; if (vfop->rc < 0) { goto op_err; } else { } tmp___0 = ldv__builtin_expect((bp->msg_enable & 8388608) != 0, 0L); if (tmp___0 != 0L) { printk("\r[%s:%d(%s)]vf[%d] STATE: %d\n", "bnx2x_vfop_close", 2909, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )vf->abs_vfid, (unsigned int )state); } else { } switch ((unsigned int )state) { case 0U: qx->qid = qx->qid + 1; if (qx->qid < (int )vf->alloc_resc.num_rxqs) { vfop->rc = bnx2x_vfop_qdown_cmd(bp, vf, & cmd, qx->qid); if (vfop->rc != 0) { goto op_err; } else { } return; } else { } vfop->state = 1; vfop->rc = bnx2x_vfop_mcast_cmd(bp, vf, & cmd, 0, 0, 0); if (vfop->rc != 0) { goto op_err; } else { } return; case 1U: tmp___1 = ldv__builtin_expect((bp->msg_enable & 8388608) != 0, 0L); if (tmp___1 != 0L) { printk("\r[%s:%d(%s)]disabling igu\n", "bnx2x_vfop_close", 2931, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } bnx2x_vf_igu_disable(bp, vf); tmp___2 = ldv__builtin_expect((bp->msg_enable & 8388608) != 0, 0L); if (tmp___2 != 0L) { printk("\r[%s:%d(%s)]clearing qtbl\n", "bnx2x_vfop_close", 2935, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } bnx2x_vf_clr_qtbl(bp, vf); goto op_done; default: printk("\v[%s:%d(%s)]Bad state %d\n", "bnx2x_vfop_close", 2940, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (unsigned int )state); vfop->rc = -22; goto op_err; } op_err: printk("\v[%s:%d(%s)]VF[%d] CLOSE error: rc %d\n", "bnx2x_vfop_close", 2943, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )vf->abs_vfid, vfop->rc); op_done: vf->state = 1U; tmp___3 = ldv__builtin_expect((bp->msg_enable & 8388608) != 0, 0L); if (tmp___3 != 0L) { printk("\r[%s:%d(%s)]set state to acquired\n", "bnx2x_vfop_close", 2946, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } bnx2x_vfop_end___0(bp, vf, vfop); return; } } int bnx2x_vfop_close_cmd(struct bnx2x *bp , struct bnx2x_virtf *vf , struct bnx2x_vfop_cmd *cmd ) { struct bnx2x_vfop *vfop ; struct bnx2x_vfop *tmp ; int tmp___0 ; { tmp = bnx2x_vfop_add___0(bp, vf); vfop = tmp; if ((unsigned long )vfop != (unsigned long )((struct bnx2x_vfop *)0)) { vfop->args.qx.qid = -1; vfop->state = 0; vfop->op_p = & vf->op_params; vfop->transition = & bnx2x_vfop_close; vfop->done = cmd->done; tmp___0 = bnx2x_vfop_transition___0(bp, vf, & bnx2x_vfop_close, (int )cmd->block); return (tmp___0); } else { } return (-12); } } static void bnx2x_vfop_release(struct bnx2x *bp , struct bnx2x_virtf *vf ) { struct bnx2x_vfop *vfop ; struct bnx2x_vfop *tmp ; struct bnx2x_vfop_cmd cmd ; long tmp___0 ; long tmp___1 ; long tmp___2 ; long tmp___3 ; { tmp = bnx2x_vfop_cur___0(bp, vf); vfop = tmp; cmd.done = & bnx2x_vfop_release; cmd.block = 0; tmp___0 = ldv__builtin_expect((bp->msg_enable & 8388608) != 0, 0L); if (tmp___0 != 0L) { printk("\r[%s:%d(%s)]vfop->rc %d\n", "bnx2x_vfop_release", 2977, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", vfop->rc); } else { } if (vfop->rc < 0) { goto op_err; } else { } tmp___1 = ldv__builtin_expect((bp->msg_enable & 8388608) != 0, 0L); if (tmp___1 != 0L) { printk("\r[%s:%d(%s)]VF[%d] STATE: %s\n", "bnx2x_vfop_release", 2987, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )vf->abs_vfid, (unsigned int )vf->state != 0U ? ((unsigned int )vf->state != 1U ? ((unsigned int )vf->state != 2U ? ((unsigned int )vf->state == 3U ? (char *)"Reset" : (char *)"Unknown") : (char *)"Enabled") : (char *)"Acquired") : (char *)"Free"); } else { } switch ((int )vf->state) { case 2: vfop->rc = bnx2x_vfop_close_cmd(bp, vf, & cmd); if (vfop->rc != 0) { goto op_err; } else { } return; case 1: tmp___2 = ldv__builtin_expect((bp->msg_enable & 8388608) != 0, 0L); if (tmp___2 != 0L) { printk("\r[%s:%d(%s)]about to free resources\n", "bnx2x_vfop_release", 2997, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } bnx2x_vf_free_resc(bp, vf); tmp___3 = ldv__builtin_expect((bp->msg_enable & 8388608) != 0, 0L); if (tmp___3 != 0L) { printk("\r[%s:%d(%s)]vfop->rc %d\n", "bnx2x_vfop_release", 2999, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", vfop->rc); } else { } goto op_done; case 0: ; case 3: ; goto op_done; default: printk("\v[%s:%d(%s)]Bad state %d\n", "bnx2x_vfop_release", 3007, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )vf->state); vfop->rc = -22; goto op_err; } op_err: printk("\v[%s:%d(%s)]VF[%d] RELEASE error: rc %d\n", "bnx2x_vfop_release", 3010, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )vf->abs_vfid, vfop->rc); op_done: bnx2x_vfop_end___0(bp, vf, vfop); return; } } int bnx2x_vfop_release_cmd(struct bnx2x *bp , struct bnx2x_virtf *vf , struct bnx2x_vfop_cmd *cmd ) { struct bnx2x_vfop *vfop ; struct bnx2x_vfop *tmp ; int tmp___0 ; { tmp = bnx2x_vfop_add___0(bp, vf); vfop = tmp; if ((unsigned long )vfop != (unsigned long )((struct bnx2x_vfop *)0)) { vfop->state = -1; vfop->op_p = & vf->op_params; vfop->transition = & bnx2x_vfop_release; vfop->done = cmd->done; tmp___0 = bnx2x_vfop_transition___0(bp, vf, & bnx2x_vfop_release, (int )cmd->block); return (tmp___0); } else { } return (-12); } } void bnx2x_vf_release(struct bnx2x *bp , struct bnx2x_virtf *vf , bool block ) { struct bnx2x_vfop_cmd cmd ; int rc ; int __ret_warn_on ; long tmp ; { cmd.done = 0; cmd.block = block; bnx2x_lock_vf_pf_channel(bp, vf, 8); rc = bnx2x_vfop_release_cmd(bp, vf, & cmd); if (rc != 0) { __ret_warn_on = rc != 0; tmp = ldv__builtin_expect(__ret_warn_on != 0, 0L); if (tmp != 0L) { warn_slowpath_fmt("/work/ldvuser/exper_fp/work/current--X--drivers--X--defaultlinux-3.10-rc1.tar--X--32_7a--X--cpachecker/linux-3.10-rc1.tar/csd_deg_dscv/8504/dscv_tempdir/dscv/ri/32_7a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.c.prepared", 3046, "VF[%d] Failed to allocate resources for release op- rc=%d\n", (int )vf->abs_vfid, rc); } else { } ldv__builtin_expect(__ret_warn_on != 0, 0L); } else { } return; } } void bnx2x_lock_vf_pf_channel(struct bnx2x *bp , struct bnx2x_virtf *vf , enum channel_tlvs tlv ) { long tmp ; { ldv_mutex_lock_171(& vf->op_mutex); vf->op_current = tlv; tmp = ldv__builtin_expect((bp->msg_enable & 8388608) != 0, 0L); if (tmp != 0L) { printk("\r[%s:%d(%s)]VF[%d]: vf pf channel locked by %d\n", "bnx2x_lock_vf_pf_channel", 3076, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )vf->abs_vfid, (unsigned int )tlv); } else { } return; } } void bnx2x_unlock_vf_pf_channel(struct bnx2x *bp , struct bnx2x_virtf *vf , enum channel_tlvs expected_tlv ) { int __ret_warn_on ; long tmp ; long tmp___0 ; { __ret_warn_on = (unsigned int )vf->op_current != (unsigned int )expected_tlv; tmp = ldv__builtin_expect(__ret_warn_on != 0, 0L); if (tmp != 0L) { warn_slowpath_fmt("/work/ldvuser/exper_fp/work/current--X--drivers--X--defaultlinux-3.10-rc1.tar--X--32_7a--X--cpachecker/linux-3.10-rc1.tar/csd_deg_dscv/8504/dscv_tempdir/dscv/ri/32_7a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.c.prepared", 3084, "lock mismatch: expected %d found %d", (unsigned int )expected_tlv, (unsigned int )vf->op_current); } else { } ldv__builtin_expect(__ret_warn_on != 0, 0L); ldv_mutex_unlock_172(& vf->op_mutex); tmp___0 = ldv__builtin_expect((bp->msg_enable & 8388608) != 0, 0L); if (tmp___0 != 0L) { printk("\r[%s:%d(%s)]VF[%d]: vf pf channel unlocked by %d\n", "bnx2x_unlock_vf_pf_channel", 3091, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )vf->abs_vfid, (unsigned int )vf->op_current); } else { } vf->op_current = 0; return; } } int bnx2x_sriov_configure(struct pci_dev *dev , int num_vfs_param ) { struct bnx2x *bp ; void *tmp ; void *tmp___0 ; long tmp___1 ; int tmp___2 ; { tmp = pci_get_drvdata(dev); tmp___0 = netdev_priv((struct net_device const *)tmp); bp = (struct bnx2x *)tmp___0; tmp___1 = ldv__builtin_expect((bp->msg_enable & 8388608) != 0, 0L); if (tmp___1 != 0L) { printk("\r[%s:%d(%s)]bnx2x_sriov_configure called with %d, BNX2X_NR_VIRTFN(bp) was %d\n", "bnx2x_sriov_configure", 3103, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", num_vfs_param, (int )(bp->vfdb)->sriov.nr_virtfn); } else { } if ((unsigned int )bp->state != 12288U) { printk("\v[%s:%d(%s)]VF num configurtion via sysfs not supported while PF is down", "bnx2x_sriov_configure", 3107, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); return (-22); } else { } if ((int )(bp->vfdb)->sriov.nr_virtfn < num_vfs_param) { printk("\v[%s:%d(%s)]truncating requested number of VFs (%d) down to maximum allowed (%d)\n", "bnx2x_sriov_configure", 3114, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", num_vfs_param, (int )(bp->vfdb)->sriov.nr_virtfn); num_vfs_param = (int )(bp->vfdb)->sriov.nr_virtfn; } else { } bp->requested_nr_virtfn = (u16 )num_vfs_param; if (num_vfs_param == 0) { pci_disable_sriov(dev); return (0); } else { tmp___2 = bnx2x_enable_sriov(bp); return (tmp___2); } } } int bnx2x_enable_sriov(struct bnx2x *bp ) { int rc ; int req_vfs ; long tmp ; { rc = 0; req_vfs = (int )bp->requested_nr_virtfn; rc = pci_enable_sriov(bp->pdev, req_vfs); if (rc != 0) { printk("\v[%s:%d(%s)]pci_enable_sriov failed with %d\n", "bnx2x_enable_sriov", 3133, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", rc); return (rc); } else { } tmp = ldv__builtin_expect((bp->msg_enable & 8388608) != 0, 0L); if (tmp != 0L) { printk("\r[%s:%d(%s)]sriov enabled (%d vfs)\n", "bnx2x_enable_sriov", 3136, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", req_vfs); } else { } return (req_vfs); } } void bnx2x_pf_set_vfs_vlan(struct bnx2x *bp ) { int vfidx ; struct pf_vf_bulletin_content *bulletin ; long tmp ; { tmp = ldv__builtin_expect((bp->msg_enable & 8388608) != 0, 0L); if (tmp != 0L) { printk("\r[%s:%d(%s)]configuring vlan for VFs from sp-task\n", "bnx2x_pf_set_vfs_vlan", 3145, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); } else { } vfidx = 0; goto ldv_46798; ldv_46797: bulletin = (struct pf_vf_bulletin_content *)(bp->vfdb)->bulletin_dma.addr + (unsigned long )vfidx; if (((int )((bp->vfdb)->vfs + (unsigned long )vfidx)->cfg_flags & 32) != 0) { bnx2x_set_vf_vlan(bp->dev, vfidx, (int )bulletin->vlan, 0); } else { } vfidx = vfidx + 1; ldv_46798: ; if ((int )(bp->vfdb)->sriov.nr_virtfn > vfidx) { goto ldv_46797; } else { } return; } } void bnx2x_disable_sriov(struct bnx2x *bp ) { { pci_disable_sriov(bp->pdev); return; } } static int bnx2x_vf_ndo_sanity(struct bnx2x *bp , int vfidx , struct bnx2x_virtf *vf ) { { if ((unsigned long )bp->vfdb == (unsigned long )((struct bnx2x_vfdb *)0)) { printk("\v[%s:%d(%s)]vf ndo called though sriov is disabled\n", "bnx2x_vf_ndo_sanity", 3162, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); return (-22); } else { } if ((int )(bp->vfdb)->sriov.nr_virtfn <= vfidx) { printk("\v[%s:%d(%s)]vf ndo called for uninitialized VF. vfidx was %d BNX2X_NR_VIRTFN was %d\n", "bnx2x_vf_ndo_sanity", 3168, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", vfidx, (int )(bp->vfdb)->sriov.nr_virtfn); return (-22); } else { } if ((unsigned long )vf == (unsigned long )((struct bnx2x_virtf *)0)) { printk("\v[%s:%d(%s)]vf ndo called but vf was null. vfidx was %d\n", "bnx2x_vf_ndo_sanity", 3174, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", vfidx); return (-22); } else { } return (0); } } int bnx2x_get_vf_config(struct net_device *dev , int vfidx , struct ifla_vf_info *ivi ) { struct bnx2x *bp ; void *tmp ; struct bnx2x_virtf *vf ; struct bnx2x_vlan_mac_obj *mac_obj ; struct bnx2x_vlan_mac_obj *vlan_obj ; struct pf_vf_bulletin_content *bulletin ; int rc ; size_t __len ; void *__ret ; size_t __len___0 ; void *__ret___0 ; { tmp = netdev_priv((struct net_device const *)dev); bp = (struct bnx2x *)tmp; vf = (bp->vfdb)->vfs + (unsigned long )vfidx; mac_obj = & (vf->vfqs)->mac_obj; vlan_obj = & (vf->vfqs)->vlan_obj; bulletin = (struct pf_vf_bulletin_content *)(bp->vfdb)->bulletin_dma.addr + (unsigned long )vfidx; rc = bnx2x_vf_ndo_sanity(bp, vfidx, vf); if (rc != 0) { return (rc); } else { } if (((unsigned long )mac_obj == (unsigned long )((struct bnx2x_vlan_mac_obj *)0) || (unsigned long )vlan_obj == (unsigned long )((struct bnx2x_vlan_mac_obj *)0)) || (unsigned long )bulletin == (unsigned long )((struct pf_vf_bulletin_content *)0)) { printk("\v[%s:%d(%s)]VF partially initialized\n", "bnx2x_get_vf_config", 3196, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); return (-22); } else { } ivi->vf = (__u32 )vfidx; ivi->qos = 0U; ivi->tx_rate = 10000U; ivi->spoofchk = 1U; if ((unsigned int )vf->state == 2U) { (*(mac_obj->get_n_elements))(bp, mac_obj, 1, (u8 *)(& ivi->mac), 0, 6); (*(vlan_obj->get_n_elements))(bp, vlan_obj, 1, (u8 *)(& ivi->vlan), 0, 4); } else { if ((int )bulletin->valid_bitmap & 1) { __len = 6UL; if (__len > 63UL) { __ret = __memcpy((void *)(& ivi->mac), (void const *)(& bulletin->mac), __len); } else { __ret = __builtin_memcpy((void *)(& ivi->mac), (void const *)(& bulletin->mac), __len); } } else { memset((void *)(& ivi->mac), 0, 6UL); } if ((bulletin->valid_bitmap & 2ULL) != 0ULL) { __len___0 = 4UL; if (__len___0 > 63UL) { __ret___0 = __memcpy((void *)(& ivi->vlan), (void const *)(& bulletin->vlan), __len___0); } else { __ret___0 = __builtin_memcpy((void *)(& ivi->vlan), (void const *)(& bulletin->vlan), __len___0); } } else { memset((void *)(& ivi->vlan), 0, 4UL); } } return (0); } } int bnx2x_set_vf_mac(struct net_device *dev , int vfidx , u8 *mac ) { struct bnx2x *bp ; void *tmp ; int rc ; int q_logical_state ; struct bnx2x_virtf *vf ; struct pf_vf_bulletin_content *bulletin ; bool tmp___0 ; int tmp___1 ; size_t __len ; void *__ret ; unsigned long ramrod_flags ; struct bnx2x_vlan_mac_obj *mac_obj ; { tmp = netdev_priv((struct net_device const *)dev); bp = (struct bnx2x *)tmp; vf = (bp->vfdb)->vfs + (unsigned long )vfidx; bulletin = (struct pf_vf_bulletin_content *)(bp->vfdb)->bulletin_dma.addr + (unsigned long )vfidx; rc = bnx2x_vf_ndo_sanity(bp, vfidx, vf); if (rc != 0) { return (rc); } else { } tmp___0 = is_valid_ether_addr((u8 const *)mac); if (tmp___0) { tmp___1 = 0; } else { tmp___1 = 1; } if (tmp___1) { printk("\v[%s:%d(%s)]mac address invalid\n", "bnx2x_set_vf_mac", 3260, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); return (-22); } else { } bulletin->valid_bitmap = bulletin->valid_bitmap | 1ULL; __len = 6UL; if (__len > 63UL) { __ret = __memcpy((void *)(& bulletin->mac), (void const *)mac, __len); } else { __ret = __builtin_memcpy((void *)(& bulletin->mac), (void const *)mac, __len); } rc = bnx2x_post_vf_bulletin(bp, vfidx); if (rc != 0) { printk("\v[%s:%d(%s)]failed to update VF[%d] bulletin\n", "bnx2x_set_vf_mac", 3273, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", vfidx); return (rc); } else { } q_logical_state = bnx2x_get_q_logical_state(bp, & (vf->vfqs)->sp_obj); if ((unsigned int )vf->state == 2U && q_logical_state == 0) { ramrod_flags = 0UL; mac_obj = & (vf->vfqs)->mac_obj; bnx2x_lock_vf_pf_channel(bp, vf, 11); rc = bnx2x_del_all_macs(bp, mac_obj, 1, 1); if (rc != 0) { printk("\v[%s:%d(%s)]failed to delete eth macs\n", "bnx2x_set_vf_mac", 3292, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); return (-22); } else { } rc = bnx2x_del_all_macs(bp, mac_obj, 0, 1); if (rc != 0) { printk("\v[%s:%d(%s)]failed to delete uc_list macs\n", "bnx2x_set_vf_mac", 3299, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); return (-22); } else { } __set_bit(2, (unsigned long volatile *)(& ramrod_flags)); bnx2x_set_mac_one(bp, (u8 *)(& bulletin->mac), mac_obj, 1, 1, & ramrod_flags); bnx2x_unlock_vf_pf_channel(bp, vf, 11); } else { } return (0); } } int bnx2x_set_vf_vlan(struct net_device *dev , int vfidx , u16 vlan , u8 qos ) { struct bnx2x *bp ; void *tmp ; int rc ; int q_logical_state ; struct bnx2x_virtf *vf ; struct pf_vf_bulletin_content *bulletin ; long tmp___0 ; unsigned long ramrod_flags ; unsigned long vlan_mac_flags ; struct bnx2x_vlan_mac_obj *vlan_obj ; struct bnx2x_vlan_mac_ramrod_params ramrod_param ; struct bnx2x_queue_state_params q_params ; struct bnx2x_queue_update_params *update_params ; { tmp = netdev_priv((struct net_device const *)dev); bp = (struct bnx2x *)tmp; vf = (bp->vfdb)->vfs + (unsigned long )vfidx; bulletin = (struct pf_vf_bulletin_content *)(bp->vfdb)->bulletin_dma.addr + (unsigned long )vfidx; rc = bnx2x_vf_ndo_sanity(bp, vfidx, vf); if (rc != 0) { return (rc); } else { } if ((unsigned int )vlan > 4095U) { printk("\v[%s:%d(%s)]illegal vlan value %d\n", "bnx2x_set_vf_vlan", 3327, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", (int )vlan); return (-22); } else { } tmp___0 = ldv__builtin_expect((bp->msg_enable & 8388608) != 0, 0L); if (tmp___0 != 0L) { printk("\r[%s:%d(%s)]configuring VF %d with VLAN %d qos %d\n", "bnx2x_set_vf_vlan", 3332, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", vfidx, (int )vlan, 0); } else { } bulletin->valid_bitmap = bulletin->valid_bitmap | 2ULL; bulletin->vlan = vlan; q_logical_state = bnx2x_get_q_logical_state(bp, & (vf->vfqs)->sp_obj); if ((unsigned int )vf->state == 2U && q_logical_state == 0) { ramrod_flags = 0UL; vlan_mac_flags = 0UL; vlan_obj = & (vf->vfqs)->vlan_obj; q_params.q_obj = 0; q_params.cmd = 0; q_params.ramrod_flags = 0UL; q_params.params.setup.gen_params.stat_id = (unsigned char)0; q_params.params.setup.gen_params.spcl_id = (unsigned char)0; q_params.params.setup.gen_params.mtu = (unsigned short)0; q_params.params.setup.gen_params.cos = (unsigned char)0; q_params.params.setup.txq_params.dscr_map = 0ULL; q_params.params.setup.txq_params.fw_sb_id = (unsigned char)0; q_params.params.setup.txq_params.sb_cq_index = (unsigned char)0; q_params.params.setup.txq_params.cos = (unsigned char)0; q_params.params.setup.txq_params.traffic_type = (unsigned short)0; q_params.params.setup.txq_params.tss_leading_cl_id = (unsigned char)0; q_params.params.setup.txq_params.default_vlan = (unsigned short)0; q_params.params.setup.rxq_params.dscr_map = 0ULL; q_params.params.setup.rxq_params.sge_map = 0ULL; q_params.params.setup.rxq_params.rcq_map = 0ULL; q_params.params.setup.rxq_params.rcq_np_map = 0ULL; q_params.params.setup.rxq_params.drop_flags = (unsigned short)0; q_params.params.setup.rxq_params.buf_sz = (unsigned short)0; q_params.params.setup.rxq_params.fw_sb_id = (unsigned char)0; q_params.params.setup.rxq_params.cl_qzone_id = (unsigned char)0; q_params.params.setup.rxq_params.tpa_agg_sz = (unsigned short)0; q_params.params.setup.rxq_params.sge_buf_sz = (unsigned short)0; q_params.params.setup.rxq_params.max_sges_pkt = (unsigned char)0; q_params.params.setup.rxq_params.max_tpa_queues = (unsigned char)0; q_params.params.setup.rxq_params.rss_engine_id = (unsigned char)0; q_params.params.setup.rxq_params.mcast_engine_id = (unsigned char)0; q_params.params.setup.rxq_params.cache_line_log = (unsigned char)0; q_params.params.setup.rxq_params.sb_cq_index = (unsigned char)0; q_params.params.setup.rxq_params.silent_removal_value = (unsigned short)0; q_params.params.setup.rxq_params.silent_removal_mask = (unsigned short)0; q_params.params.setup.pause_params.bd_th_lo = (unsigned short)0; q_params.params.setup.pause_params.bd_th_hi = (unsigned short)0; q_params.params.setup.pause_params.rcq_th_lo = (unsigned short)0; q_params.params.setup.pause_params.rcq_th_hi = (unsigned short)0; q_params.params.setup.pause_params.sge_th_lo = (unsigned short)0; q_params.params.setup.pause_params.sge_th_hi = (unsigned short)0; q_params.params.setup.pause_params.pri_map = (unsigned short)0; q_params.params.setup.flags = 0UL; memset((void *)(& ramrod_param), 0, 56UL); bnx2x_lock_vf_pf_channel(bp, vf, 12); __set_bit(2, (unsigned long volatile *)(& ramrod_flags)); rc = (*(vlan_obj->delete_all))(bp, vlan_obj, & vlan_mac_flags, & ramrod_flags); if (rc != 0) { printk("\v[%s:%d(%s)]failed to delete vlans\n", "bnx2x_set_vf_vlan", 3366, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); return (-22); } else { } __set_bit(2, (unsigned long volatile *)(& q_params.ramrod_flags)); q_params.cmd = 5; q_params.q_obj = & (vf->vfqs)->sp_obj; update_params = & q_params.params.update; __set_bit(9, (unsigned long volatile *)(& update_params->update_flags)); __set_bit(10, (unsigned long volatile *)(& update_params->update_flags)); if ((unsigned int )vlan == 0U) { __clear_bit(8, (unsigned long volatile *)(& update_params->update_flags)); __clear_bit(11, (unsigned long volatile *)(& update_params->update_flags)); } else { __set_bit(2, (unsigned long volatile *)(& ramrod_flags)); ramrod_param.vlan_mac_obj = vlan_obj; ramrod_param.ramrod_flags = ramrod_flags; ramrod_param.user_req.u.vlan.vlan = vlan; ramrod_param.user_req.cmd = 0; rc = bnx2x_config_vlan_mac(bp, & ramrod_param); if (rc != 0) { printk("\v[%s:%d(%s)]failed to configure vlan\n", "bnx2x_set_vf_vlan", 3400, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); return (-22); } else { } update_params = & q_params.params.update; __set_bit(8, (unsigned long volatile *)(& update_params->update_flags)); __set_bit(11, (unsigned long volatile *)(& update_params->update_flags)); update_params->def_vlan = vlan; } rc = bnx2x_queue_state_change(bp, & q_params); if (rc != 0) { printk("\v[%s:%d(%s)]Failed to configure default VLAN\n", "bnx2x_set_vf_vlan", 3418, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?"); return (rc); } else { } vf->cfg_flags = (unsigned int )vf->cfg_flags & 65503U; bnx2x_unlock_vf_pf_channel(bp, vf, 12); } else { } return (0); } } u32 bnx2x_crc_vf_bulletin(struct bnx2x *bp , struct pf_vf_bulletin_content *bulletin ) { u32 tmp ; { tmp = crc32_le(0U, (unsigned char const *)bulletin + 4U, (unsigned long )bulletin->length - 4UL); return (tmp); } } enum sample_bulletin_result bnx2x_sample_bulletin(struct bnx2x *bp ) { struct pf_vf_bulletin_content bulletin ; int attempts ; u32 tmp ; u32 tmp___0 ; size_t __len ; void *__ret ; int tmp___1 ; size_t __len___0 ; void *__ret___0 ; { bulletin = (bp->pf2vf_bulletin)->content; if ((int )bp->old_bulletin.version == (int )bulletin.version) { return (0); } else { } if ((int )bp->old_bulletin.version != (int )(bp->pf2vf_bulletin)->content.version) { attempts = 0; goto ldv_46873; ldv_46872: bulletin = (bp->pf2vf_bulletin)->content; tmp = bnx2x_crc_vf_bulletin(bp, & bulletin); if (bulletin.crc == tmp) { goto ldv_46870; } else { } tmp___0 = bnx2x_crc_vf_bulletin(bp, & bulletin); printk("\v[%s:%d(%s)]bad crc on bulletin board. contained %x computed %x\n", "bnx2x_sample_bulletin", 3466, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", bulletin.crc, tmp___0); attempts = attempts + 1; ldv_46873: ; if (attempts <= 4) { goto ldv_46872; } else { } ldv_46870: ; if (attempts > 4) { printk("\v[%s:%d(%s)]pf to vf bulletin board crc was wrong %d consecutive times. Aborting\n", "bnx2x_sample_bulletin", 3470, (unsigned long )bp->dev != (unsigned long )((struct net_device *)0) ? (char *)(& (bp->dev)->name) : (char *)"?", attempts); return (2); } else { } } else { } if ((int )bulletin.valid_bitmap & 1) { tmp___1 = memcmp((void const *)(& bulletin.mac), (void const *)(& bp->old_bulletin.mac), 6UL); if (tmp___1 != 0) { __len = 6UL; if (__len > 63UL) { __ret = __memcpy((void *)(bp->dev)->dev_addr, (void const *)(& bulletin.mac), __len); } else { __ret = __builtin_memcpy((void *)(bp->dev)->dev_addr, (void const *)(& bulletin.mac), __len); } } else { } } else { } if ((bulletin.valid_bitmap & 2ULL) != 0ULL) { __len___0 = 4UL; if (__len___0 > 63UL) { __ret___0 = __memcpy((void *)(& bulletin.vlan), (void const *)(& bp->old_bulletin.vlan), __len___0); } else { __ret___0 = __builtin_memcpy((void *)(& bulletin.vlan), (void const *)(& bp->old_bulletin.vlan), __len___0); } } else { } bp->old_bulletin = bulletin; return (1); } } void *bnx2x_vf_doorbells(struct bnx2x *bp ) { { return (bp->regview + 31744UL); } } int bnx2x_vf_pci_alloc(struct bnx2x *bp ) { struct lock_class_key __key ; void *tmp ; void *tmp___0 ; { __mutex_init(& bp->vf2pf_mutex, "&bp->vf2pf_mutex", & __key); tmp = dma_alloc_attrs(& (bp->pdev)->dev, 2048UL, & bp->vf2pf_mbox_mapping, 32976U, 0); bp->vf2pf_mbox = (struct bnx2x_vf_mbx_msg *)tmp; if ((unsigned long )bp->vf2pf_mbox == (unsigned long )((struct bnx2x_vf_mbx_msg *)0)) { goto alloc_mem_err; } else { } tmp___0 = dma_alloc_attrs(& (bp->pdev)->dev, 512UL, & bp->pf2vf_bulletin_mapping, 32976U, 0); bp->pf2vf_bulletin = (union pf_vf_bulletin *)tmp___0; if ((unsigned long )bp->pf2vf_bulletin == (unsigned long )((union pf_vf_bulletin *)0)) { goto alloc_mem_err; } else { } return (0); alloc_mem_err: ; if ((unsigned long )bp->vf2pf_mbox != (unsigned long )((struct bnx2x_vf_mbx_msg *)0)) { dma_free_attrs(& (bp->pdev)->dev, 2048UL, (void *)bp->vf2pf_mbox, bp->vf2pf_mbox_mapping, 0); bp->vf2pf_mbox = 0; bp->vf2pf_mbox_mapping = 0ULL; } else { } if ((unsigned long )bp->vf2pf_mbox != (unsigned long )((struct bnx2x_vf_mbx_msg *)0)) { dma_free_attrs(& (bp->pdev)->dev, 512UL, (void *)bp->vf2pf_mbox, bp->vf2pf_mbox_mapping, 0); bp->vf2pf_mbox = 0; bp->vf2pf_mbox_mapping = 0ULL; } else { } return (-12); } } int bnx2x_open_epilog(struct bnx2x *bp ) { { if ((unsigned long )bp->vfdb != (unsigned long )((struct bnx2x_vfdb *)0) && (unsigned int )(bp->vfdb)->sriov.nr_virtfn != 0U) { __asm__ volatile ("": : : "memory"); set_bit(4U, (unsigned long volatile *)(& bp->sp_rtnl_state)); __asm__ volatile ("": : : "memory"); schedule_delayed_work(& bp->sp_rtnl_task, 0UL); } else { } return (0); } } void ldv_main8_sequence_infinite_withcheck_stateful(void) { struct bnx2x *var_group1 ; struct bnx2x_virtf *var_group2 ; int tmp ; int tmp___0 ; { LDV_IN_INTERRUPT = 1; ldv_initialize(); goto ldv_46916; ldv_46915: tmp = __VERIFIER_nondet_int(); switch (tmp) { case 0: ldv_handler_precall(); bnx2x_vfop_qsetup(var_group1, var_group2); goto ldv_46910; case 1: ldv_handler_precall(); bnx2x_vfop_flr(var_group1, var_group2); goto ldv_46910; case 2: ldv_handler_precall(); bnx2x_vfop_close(var_group1, var_group2); goto ldv_46910; case 3: ldv_handler_precall(); bnx2x_vfop_release(var_group1, var_group2); goto ldv_46910; default: ; goto ldv_46910; } ldv_46910: ; ldv_46916: tmp___0 = __VERIFIER_nondet_int(); if (tmp___0 != 0) { goto ldv_46915; } else { } ldv_check_final_state(); return; } } void ldv_mutex_lock_163(struct mutex *ldv_func_arg1 ) { { ldv_mutex_lock_lock(ldv_func_arg1); mutex_lock(ldv_func_arg1); return; } } void ldv_mutex_unlock_164(struct mutex *ldv_func_arg1 ) { { ldv_mutex_unlock_lock(ldv_func_arg1); mutex_unlock(ldv_func_arg1); return; } } void ldv_mutex_lock_165(struct mutex *ldv_func_arg1 ) { { ldv_mutex_lock_mutex_of_device(ldv_func_arg1); mutex_lock(ldv_func_arg1); return; } } int ldv_mutex_trylock_166(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_167(struct mutex *ldv_func_arg1 ) { { ldv_mutex_unlock_mutex_of_device(ldv_func_arg1); mutex_unlock(ldv_func_arg1); return; } } void ldv_mutex_lock_171(struct mutex *ldv_func_arg1 ) { { ldv_mutex_lock_op_mutex_of_bnx2x_virtf(ldv_func_arg1); mutex_lock(ldv_func_arg1); return; } } void ldv_mutex_unlock_172(struct mutex *ldv_func_arg1 ) { { ldv_mutex_unlock_op_mutex_of_bnx2x_virtf(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); } } static int ldv_mutex_cnic_mutex_of_bnx2x ; int ldv_mutex_lock_interruptible_cnic_mutex_of_bnx2x(struct mutex *lock ) { int nondetermined ; { if (ldv_mutex_cnic_mutex_of_bnx2x == 1) { } else { ldv_error(); } nondetermined = __VERIFIER_nondet_int(); if (nondetermined) { ldv_mutex_cnic_mutex_of_bnx2x = 2; return (0); } else { return (-4); } } } int ldv_mutex_lock_killable_cnic_mutex_of_bnx2x(struct mutex *lock ) { int nondetermined ; { if (ldv_mutex_cnic_mutex_of_bnx2x == 1) { } else { ldv_error(); } nondetermined = __VERIFIER_nondet_int(); if (nondetermined) { ldv_mutex_cnic_mutex_of_bnx2x = 2; return (0); } else { return (-4); } } } void ldv_mutex_lock_cnic_mutex_of_bnx2x(struct mutex *lock ) { { if (ldv_mutex_cnic_mutex_of_bnx2x == 1) { } else { ldv_error(); } ldv_mutex_cnic_mutex_of_bnx2x = 2; return; } } int ldv_mutex_trylock_cnic_mutex_of_bnx2x(struct mutex *lock ) { int is_mutex_held_by_another_thread ; { if (ldv_mutex_cnic_mutex_of_bnx2x == 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_cnic_mutex_of_bnx2x = 2; return (1); } } } int ldv_atomic_dec_and_mutex_lock_cnic_mutex_of_bnx2x(atomic_t *cnt , struct mutex *lock ) { int atomic_value_after_dec ; { if (ldv_mutex_cnic_mutex_of_bnx2x == 1) { } else { ldv_error(); } atomic_value_after_dec = __VERIFIER_nondet_int(); if (atomic_value_after_dec == 0) { ldv_mutex_cnic_mutex_of_bnx2x = 2; return (1); } else { } return (0); } } int ldv_mutex_is_locked_cnic_mutex_of_bnx2x(struct mutex *lock ) { int nondetermined ; { if (ldv_mutex_cnic_mutex_of_bnx2x == 1) { nondetermined = __VERIFIER_nondet_int(); if (nondetermined) { return (0); } else { return (1); } } else { return (1); } } } void ldv_mutex_unlock_cnic_mutex_of_bnx2x(struct mutex *lock ) { { if (ldv_mutex_cnic_mutex_of_bnx2x == 2) { } else { ldv_error(); } ldv_mutex_cnic_mutex_of_bnx2x = 1; return; } } static int ldv_mutex_fw_mb_mutex_of_bnx2x ; int ldv_mutex_lock_interruptible_fw_mb_mutex_of_bnx2x(struct mutex *lock ) { int nondetermined ; { if (ldv_mutex_fw_mb_mutex_of_bnx2x == 1) { } else { ldv_error(); } nondetermined = __VERIFIER_nondet_int(); if (nondetermined) { ldv_mutex_fw_mb_mutex_of_bnx2x = 2; return (0); } else { return (-4); } } } int ldv_mutex_lock_killable_fw_mb_mutex_of_bnx2x(struct mutex *lock ) { int nondetermined ; { if (ldv_mutex_fw_mb_mutex_of_bnx2x == 1) { } else { ldv_error(); } nondetermined = __VERIFIER_nondet_int(); if (nondetermined) { ldv_mutex_fw_mb_mutex_of_bnx2x = 2; return (0); } else { return (-4); } } } void ldv_mutex_lock_fw_mb_mutex_of_bnx2x(struct mutex *lock ) { { if (ldv_mutex_fw_mb_mutex_of_bnx2x == 1) { } else { ldv_error(); } ldv_mutex_fw_mb_mutex_of_bnx2x = 2; return; } } int ldv_mutex_trylock_fw_mb_mutex_of_bnx2x(struct mutex *lock ) { int is_mutex_held_by_another_thread ; { if (ldv_mutex_fw_mb_mutex_of_bnx2x == 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_fw_mb_mutex_of_bnx2x = 2; return (1); } } } int ldv_atomic_dec_and_mutex_lock_fw_mb_mutex_of_bnx2x(atomic_t *cnt , struct mutex *lock ) { int atomic_value_after_dec ; { if (ldv_mutex_fw_mb_mutex_of_bnx2x == 1) { } else { ldv_error(); } atomic_value_after_dec = __VERIFIER_nondet_int(); if (atomic_value_after_dec == 0) { ldv_mutex_fw_mb_mutex_of_bnx2x = 2; return (1); } else { } return (0); } } int ldv_mutex_is_locked_fw_mb_mutex_of_bnx2x(struct mutex *lock ) { int nondetermined ; { if (ldv_mutex_fw_mb_mutex_of_bnx2x == 1) { nondetermined = __VERIFIER_nondet_int(); if (nondetermined) { return (0); } else { return (1); } } else { return (1); } } } void ldv_mutex_unlock_fw_mb_mutex_of_bnx2x(struct mutex *lock ) { { if (ldv_mutex_fw_mb_mutex_of_bnx2x == 2) { } else { ldv_error(); } ldv_mutex_fw_mb_mutex_of_bnx2x = 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; } } static int ldv_mutex_one_pending_mutex_of_bnx2x_func_sp_obj ; int ldv_mutex_lock_interruptible_one_pending_mutex_of_bnx2x_func_sp_obj(struct mutex *lock ) { int nondetermined ; { if (ldv_mutex_one_pending_mutex_of_bnx2x_func_sp_obj == 1) { } else { ldv_error(); } nondetermined = __VERIFIER_nondet_int(); if (nondetermined) { ldv_mutex_one_pending_mutex_of_bnx2x_func_sp_obj = 2; return (0); } else { return (-4); } } } int ldv_mutex_lock_killable_one_pending_mutex_of_bnx2x_func_sp_obj(struct mutex *lock ) { int nondetermined ; { if (ldv_mutex_one_pending_mutex_of_bnx2x_func_sp_obj == 1) { } else { ldv_error(); } nondetermined = __VERIFIER_nondet_int(); if (nondetermined) { ldv_mutex_one_pending_mutex_of_bnx2x_func_sp_obj = 2; return (0); } else { return (-4); } } } void ldv_mutex_lock_one_pending_mutex_of_bnx2x_func_sp_obj(struct mutex *lock ) { { if (ldv_mutex_one_pending_mutex_of_bnx2x_func_sp_obj == 1) { } else { ldv_error(); } ldv_mutex_one_pending_mutex_of_bnx2x_func_sp_obj = 2; return; } } int ldv_mutex_trylock_one_pending_mutex_of_bnx2x_func_sp_obj(struct mutex *lock ) { int is_mutex_held_by_another_thread ; { if (ldv_mutex_one_pending_mutex_of_bnx2x_func_sp_obj == 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_one_pending_mutex_of_bnx2x_func_sp_obj = 2; return (1); } } } int ldv_atomic_dec_and_mutex_lock_one_pending_mutex_of_bnx2x_func_sp_obj(atomic_t *cnt , struct mutex *lock ) { int atomic_value_after_dec ; { if (ldv_mutex_one_pending_mutex_of_bnx2x_func_sp_obj == 1) { } else { ldv_error(); } atomic_value_after_dec = __VERIFIER_nondet_int(); if (atomic_value_after_dec == 0) { ldv_mutex_one_pending_mutex_of_bnx2x_func_sp_obj = 2; return (1); } else { } return (0); } } int ldv_mutex_is_locked_one_pending_mutex_of_bnx2x_func_sp_obj(struct mutex *lock ) { int nondetermined ; { if (ldv_mutex_one_pending_mutex_of_bnx2x_func_sp_obj == 1) { nondetermined = __VERIFIER_nondet_int(); if (nondetermined) { return (0); } else { return (1); } } else { return (1); } } } void ldv_mutex_unlock_one_pending_mutex_of_bnx2x_func_sp_obj(struct mutex *lock ) { { if (ldv_mutex_one_pending_mutex_of_bnx2x_func_sp_obj == 2) { } else { ldv_error(); } ldv_mutex_one_pending_mutex_of_bnx2x_func_sp_obj = 1; return; } } static int ldv_mutex_op_mutex_of_bnx2x_virtf ; int ldv_mutex_lock_interruptible_op_mutex_of_bnx2x_virtf(struct mutex *lock ) { int nondetermined ; { if (ldv_mutex_op_mutex_of_bnx2x_virtf == 1) { } else { ldv_error(); } nondetermined = __VERIFIER_nondet_int(); if (nondetermined) { ldv_mutex_op_mutex_of_bnx2x_virtf = 2; return (0); } else { return (-4); } } } int ldv_mutex_lock_killable_op_mutex_of_bnx2x_virtf(struct mutex *lock ) { int nondetermined ; { if (ldv_mutex_op_mutex_of_bnx2x_virtf == 1) { } else { ldv_error(); } nondetermined = __VERIFIER_nondet_int(); if (nondetermined) { ldv_mutex_op_mutex_of_bnx2x_virtf = 2; return (0); } else { return (-4); } } } void ldv_mutex_lock_op_mutex_of_bnx2x_virtf(struct mutex *lock ) { { if (ldv_mutex_op_mutex_of_bnx2x_virtf == 1) { } else { ldv_error(); } ldv_mutex_op_mutex_of_bnx2x_virtf = 2; return; } } int ldv_mutex_trylock_op_mutex_of_bnx2x_virtf(struct mutex *lock ) { int is_mutex_held_by_another_thread ; { if (ldv_mutex_op_mutex_of_bnx2x_virtf == 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_op_mutex_of_bnx2x_virtf = 2; return (1); } } } int ldv_atomic_dec_and_mutex_lock_op_mutex_of_bnx2x_virtf(atomic_t *cnt , struct mutex *lock ) { int atomic_value_after_dec ; { if (ldv_mutex_op_mutex_of_bnx2x_virtf == 1) { } else { ldv_error(); } atomic_value_after_dec = __VERIFIER_nondet_int(); if (atomic_value_after_dec == 0) { ldv_mutex_op_mutex_of_bnx2x_virtf = 2; return (1); } else { } return (0); } } int ldv_mutex_is_locked_op_mutex_of_bnx2x_virtf(struct mutex *lock ) { int nondetermined ; { if (ldv_mutex_op_mutex_of_bnx2x_virtf == 1) { nondetermined = __VERIFIER_nondet_int(); if (nondetermined) { return (0); } else { return (1); } } else { return (1); } } } void ldv_mutex_unlock_op_mutex_of_bnx2x_virtf(struct mutex *lock ) { { if (ldv_mutex_op_mutex_of_bnx2x_virtf == 2) { } else { ldv_error(); } ldv_mutex_op_mutex_of_bnx2x_virtf = 1; return; } } static int ldv_mutex_phy_mutex_of_bnx2x_port ; int ldv_mutex_lock_interruptible_phy_mutex_of_bnx2x_port(struct mutex *lock ) { int nondetermined ; { if (ldv_mutex_phy_mutex_of_bnx2x_port == 1) { } else { ldv_error(); } nondetermined = __VERIFIER_nondet_int(); if (nondetermined) { ldv_mutex_phy_mutex_of_bnx2x_port = 2; return (0); } else { return (-4); } } } int ldv_mutex_lock_killable_phy_mutex_of_bnx2x_port(struct mutex *lock ) { int nondetermined ; { if (ldv_mutex_phy_mutex_of_bnx2x_port == 1) { } else { ldv_error(); } nondetermined = __VERIFIER_nondet_int(); if (nondetermined) { ldv_mutex_phy_mutex_of_bnx2x_port = 2; return (0); } else { return (-4); } } } void ldv_mutex_lock_phy_mutex_of_bnx2x_port(struct mutex *lock ) { { if (ldv_mutex_phy_mutex_of_bnx2x_port == 1) { } else { ldv_error(); } ldv_mutex_phy_mutex_of_bnx2x_port = 2; return; } } int ldv_mutex_trylock_phy_mutex_of_bnx2x_port(struct mutex *lock ) { int is_mutex_held_by_another_thread ; { if (ldv_mutex_phy_mutex_of_bnx2x_port == 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_phy_mutex_of_bnx2x_port = 2; return (1); } } } int ldv_atomic_dec_and_mutex_lock_phy_mutex_of_bnx2x_port(atomic_t *cnt , struct mutex *lock ) { int atomic_value_after_dec ; { if (ldv_mutex_phy_mutex_of_bnx2x_port == 1) { } else { ldv_error(); } atomic_value_after_dec = __VERIFIER_nondet_int(); if (atomic_value_after_dec == 0) { ldv_mutex_phy_mutex_of_bnx2x_port = 2; return (1); } else { } return (0); } } int ldv_mutex_is_locked_phy_mutex_of_bnx2x_port(struct mutex *lock ) { int nondetermined ; { if (ldv_mutex_phy_mutex_of_bnx2x_port == 1) { nondetermined = __VERIFIER_nondet_int(); if (nondetermined) { return (0); } else { return (1); } } else { return (1); } } } void ldv_mutex_unlock_phy_mutex_of_bnx2x_port(struct mutex *lock ) { { if (ldv_mutex_phy_mutex_of_bnx2x_port == 2) { } else { ldv_error(); } ldv_mutex_phy_mutex_of_bnx2x_port = 1; return; } } static int ldv_mutex_vf2pf_mutex_of_bnx2x ; int ldv_mutex_lock_interruptible_vf2pf_mutex_of_bnx2x(struct mutex *lock ) { int nondetermined ; { if (ldv_mutex_vf2pf_mutex_of_bnx2x == 1) { } else { ldv_error(); } nondetermined = __VERIFIER_nondet_int(); if (nondetermined) { ldv_mutex_vf2pf_mutex_of_bnx2x = 2; return (0); } else { return (-4); } } } int ldv_mutex_lock_killable_vf2pf_mutex_of_bnx2x(struct mutex *lock ) { int nondetermined ; { if (ldv_mutex_vf2pf_mutex_of_bnx2x == 1) { } else { ldv_error(); } nondetermined = __VERIFIER_nondet_int(); if (nondetermined) { ldv_mutex_vf2pf_mutex_of_bnx2x = 2; return (0); } else { return (-4); } } } void ldv_mutex_lock_vf2pf_mutex_of_bnx2x(struct mutex *lock ) { { if (ldv_mutex_vf2pf_mutex_of_bnx2x == 1) { } else { ldv_error(); } ldv_mutex_vf2pf_mutex_of_bnx2x = 2; return; } } int ldv_mutex_trylock_vf2pf_mutex_of_bnx2x(struct mutex *lock ) { int is_mutex_held_by_another_thread ; { if (ldv_mutex_vf2pf_mutex_of_bnx2x == 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_vf2pf_mutex_of_bnx2x = 2; return (1); } } } int ldv_atomic_dec_and_mutex_lock_vf2pf_mutex_of_bnx2x(atomic_t *cnt , struct mutex *lock ) { int atomic_value_after_dec ; { if (ldv_mutex_vf2pf_mutex_of_bnx2x == 1) { } else { ldv_error(); } atomic_value_after_dec = __VERIFIER_nondet_int(); if (atomic_value_after_dec == 0) { ldv_mutex_vf2pf_mutex_of_bnx2x = 2; return (1); } else { } return (0); } } int ldv_mutex_is_locked_vf2pf_mutex_of_bnx2x(struct mutex *lock ) { int nondetermined ; { if (ldv_mutex_vf2pf_mutex_of_bnx2x == 1) { nondetermined = __VERIFIER_nondet_int(); if (nondetermined) { return (0); } else { return (1); } } else { return (1); } } } void ldv_mutex_unlock_vf2pf_mutex_of_bnx2x(struct mutex *lock ) { { if (ldv_mutex_vf2pf_mutex_of_bnx2x == 2) { } else { ldv_error(); } ldv_mutex_vf2pf_mutex_of_bnx2x = 1; return; } } void ldv_initialize(void) { { ldv_mutex_cnic_mutex_of_bnx2x = 1; ldv_mutex_fw_mb_mutex_of_bnx2x = 1; ldv_mutex_lock = 1; ldv_mutex_mutex_of_device = 1; ldv_mutex_one_pending_mutex_of_bnx2x_func_sp_obj = 1; ldv_mutex_op_mutex_of_bnx2x_virtf = 1; ldv_mutex_phy_mutex_of_bnx2x_port = 1; ldv_mutex_vf2pf_mutex_of_bnx2x = 1; return; } } void ldv_check_final_state(void) { { if (ldv_mutex_cnic_mutex_of_bnx2x == 1) { } else { ldv_error(); } if (ldv_mutex_fw_mb_mutex_of_bnx2x == 1) { } else { ldv_error(); } if (ldv_mutex_lock == 1) { } else { ldv_error(); } if (ldv_mutex_mutex_of_device == 1) { } else { ldv_error(); } if (ldv_mutex_one_pending_mutex_of_bnx2x_func_sp_obj == 1) { } else { ldv_error(); } if (ldv_mutex_op_mutex_of_bnx2x_virtf == 1) { } else { ldv_error(); } if (ldv_mutex_phy_mutex_of_bnx2x_port == 1) { } else { ldv_error(); } if (ldv_mutex_vf2pf_mutex_of_bnx2x == 1) { } else { ldv_error(); } return; } }