commit_title
stringlengths 13
124
| commit_body
stringlengths 0
1.9k
| release_summary
stringclasses 52
values | changes_summary
stringlengths 1
758
| release_affected_domains
stringclasses 33
values | release_affected_drivers
stringclasses 51
values | domain_of_changes
stringlengths 2
571
| language_set
stringclasses 983
values | diffstat_files
int64 1
300
| diffstat_insertions
int64 0
309k
| diffstat_deletions
int64 0
168k
| commit_diff
stringlengths 92
23.4M
| category
stringclasses 108
values | commit_hash
stringlengths 34
40
| related_people
stringlengths 0
370
| domain
stringclasses 21
values | subdomain
stringclasses 241
values | leaf_module
stringlengths 0
912
|
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
sched/core: rename schedutil_cpu_util() and allow rest of the kernel to use it
|
there is nothing schedutil specific in schedutil_cpu_util(), rename it to effective_cpu_util(). also create and expose another wrapper sched_cpu_util() which can be used by other parts of the kernel, like thermal core (that will be done in a later commit).
|
this release allows to map an uid to a different one in a mount; it also adds support for selecting the preemption model at runtime; support for a low-overhead memory error detector designed to be used in production; support for the acrn hypervisor designed for embedded systems; btrfs initial support for zoned devices, subpage blocks sizes and performance improvements; support for eager nfs writes; support for a thermal power management to control the surface temperature of embedded devices in an unified way; the napi polling can be moved to a kernel thread; and support for non-blocking path lookups. as always, there are many other features, new drivers, improvements and fixes.
|
makes the cpufreq_cooling driver reuse the cpu utilization metric provided by the scheduler instead of depending on idle and busy times of a cpu, which aren't that accurate to measure the busyness of a cpu for the next cycle
|
['core (various)', 'file systems', 'memory management', 'block layer', 'tracing, perf and bpf', 'virtualization', 'cryptography', 'security', 'networking', 'architectures x86 arm risc-v powerpc mips csky s390 pa-risc c6x']
|
['graphics', 'power management', 'storage', 'drivers in the staging area', 'networking', 'audio', 'tablets, touch screens, keyboards, mouses', 'tv tuners, webcams, video capturers', 'universal serial bus', 'serial peripheral interface (spi)', 'watchdog', 'serial', 'cpu frequency scaling', 'device voltage and frequency scaling', 'voltage, current regulators, power capping, power supply', 'real time clock (rtc)', 'pin controllers (pinctrl)', 'multi media card (mmc)', 'memory technology devices (mtd)', 'industrial i/o (iio)', 'multi function devices (mfd)', 'pulse-width modulation (pwm)', 'inter-integrated circuit (i2c + i3c)', 'hardware monitoring (hwmon)', 'general purpose i/o (gpio)', 'leds', 'dma engines', 'cryptography hardware acceleration', 'pci', 'non-transparent bridge (ntb)', 'thunderbolt', 'clock', 'phy ("physical layer" framework)', 'cxl (compute express link)', 'various']
|
['cpufreq_cooling', 'get effective cpu utilization from scheduler']
|
['h', 'c']
| 5
| 22
| 11
|
--- diff --git a/include/linux/sched.h b/include/linux/sched.h --- a/include/linux/sched.h +++ b/include/linux/sched.h +#ifdef config_smp +/* returns effective cpu energy utilization, as seen by the scheduler */ +unsigned long sched_cpu_util(int cpu, unsigned long max); +#endif /* config_smp */ + diff --git a/kernel/sched/core.c b/kernel/sched/core.c --- a/kernel/sched/core.c +++ b/kernel/sched/core.c -unsigned long schedutil_cpu_util(int cpu, unsigned long util_cfs, - unsigned long max, enum schedutil_type type, +unsigned long effective_cpu_util(int cpu, unsigned long util_cfs, + unsigned long max, enum cpu_util_type type, + +unsigned long sched_cpu_util(int cpu, unsigned long max) +{ + return effective_cpu_util(cpu, cpu_util_cfs(cpu_rq(cpu)), max, + energy_util, null); +} diff --git a/kernel/sched/cpufreq_schedutil.c b/kernel/sched/cpufreq_schedutil.c --- a/kernel/sched/cpufreq_schedutil.c +++ b/kernel/sched/cpufreq_schedutil.c - sg_cpu->util = schedutil_cpu_util(sg_cpu->cpu, cpu_util_cfs(rq), max, + sg_cpu->util = effective_cpu_util(sg_cpu->cpu, cpu_util_cfs(rq), max, diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c - sum_util += schedutil_cpu_util(cpu, util_cfs, cpu_cap, + sum_util += effective_cpu_util(cpu, util_cfs, cpu_cap, - cpu_util = schedutil_cpu_util(cpu, util_cfs, cpu_cap, + cpu_util = effective_cpu_util(cpu, util_cfs, cpu_cap, - * aligned with schedutil_cpu_util(). + * aligned with sched_cpu_util(). diff --git a/kernel/sched/sched.h b/kernel/sched/sched.h --- a/kernel/sched/sched.h +++ b/kernel/sched/sched.h - * enum schedutil_type - cpu utilization type + * enum cpu_util_type - cpu utilization type - * enum is used within schedutil_freq_util() to differentiate the types of + * enum is used within effective_cpu_util() to differentiate the types of -enum schedutil_type { +enum cpu_util_type { -unsigned long schedutil_cpu_util(int cpu, unsigned long util_cfs, - unsigned long max, enum schedutil_type type, +unsigned long effective_cpu_util(int cpu, unsigned long util_cfs, + unsigned long max, enum cpu_util_type type,
|
Power Management
|
a5418be9dffe70ccbb0b4bd5ea3881c81927e965
|
viresh kumar rafael j wysocki rafael j wysocki intel com
|
kernel
|
sched
| |
thermal: cpufreq_cooling: reuse sched_cpu_util() for smp platforms
|
several parts of the kernel are already using the effective cpu utilization (as seen by the scheduler) to get the current load on the cpu, do the same here instead of depending on the idle time of the cpu, which isn't that accurate comparatively.
|
this release allows to map an uid to a different one in a mount; it also adds support for selecting the preemption model at runtime; support for a low-overhead memory error detector designed to be used in production; support for the acrn hypervisor designed for embedded systems; btrfs initial support for zoned devices, subpage blocks sizes and performance improvements; support for eager nfs writes; support for a thermal power management to control the surface temperature of embedded devices in an unified way; the napi polling can be moved to a kernel thread; and support for non-blocking path lookups. as always, there are many other features, new drivers, improvements and fixes.
|
makes the cpufreq_cooling driver reuse the cpu utilization metric provided by the scheduler instead of depending on idle and busy times of a cpu, which aren't that accurate to measure the busyness of a cpu for the next cycle
|
['core (various)', 'file systems', 'memory management', 'block layer', 'tracing, perf and bpf', 'virtualization', 'cryptography', 'security', 'networking', 'architectures x86 arm risc-v powerpc mips csky s390 pa-risc c6x']
|
['graphics', 'power management', 'storage', 'drivers in the staging area', 'networking', 'audio', 'tablets, touch screens, keyboards, mouses', 'tv tuners, webcams, video capturers', 'universal serial bus', 'serial peripheral interface (spi)', 'watchdog', 'serial', 'cpu frequency scaling', 'device voltage and frequency scaling', 'voltage, current regulators, power capping, power supply', 'real time clock (rtc)', 'pin controllers (pinctrl)', 'multi media card (mmc)', 'memory technology devices (mtd)', 'industrial i/o (iio)', 'multi function devices (mfd)', 'pulse-width modulation (pwm)', 'inter-integrated circuit (i2c + i3c)', 'hardware monitoring (hwmon)', 'general purpose i/o (gpio)', 'leds', 'dma engines', 'cryptography hardware acceleration', 'pci', 'non-transparent bridge (ntb)', 'thunderbolt', 'clock', 'phy ("physical layer" framework)', 'cxl (compute express link)', 'various']
|
['cpufreq_cooling', 'get effective cpu utilization from scheduler']
|
['c']
| 1
| 55
| 14
|
--- diff --git a/drivers/thermal/cpufreq_cooling.c b/drivers/thermal/cpufreq_cooling.c --- a/drivers/thermal/cpufreq_cooling.c +++ b/drivers/thermal/cpufreq_cooling.c +#ifndef config_smp +#endif - * get_load() - get load for a cpu since last updated - * @cpufreq_cdev: &struct cpufreq_cooling_device for this cpu - * @cpu: cpu number - * @cpu_idx: index of the cpu in time_in_idle* + * get_load() - get load for a cpu + * @cpufreq_cdev: struct cpufreq_cooling_device for the cpu + * @cpu: cpu number + * @cpu_idx: index of the cpu in time_in_idle array +#ifdef config_smp +static u32 get_load(struct cpufreq_cooling_device *cpufreq_cdev, int cpu, + int cpu_idx) +{ + unsigned long max = arch_scale_cpu_capacity(cpu); + unsigned long util; + + util = sched_cpu_util(cpu, max); + return (util * 100) / max; +} +#else /* !config_smp */ +#endif /* config_smp */ +#ifdef config_smp +static inline int allocate_idle_time(struct cpufreq_cooling_device *cpufreq_cdev) +{ + return 0; +} + +static inline void free_idle_time(struct cpufreq_cooling_device *cpufreq_cdev) +{ +} +#else +static int allocate_idle_time(struct cpufreq_cooling_device *cpufreq_cdev) +{ + unsigned int num_cpus = cpumask_weight(cpufreq_cdev->policy->related_cpus); + + cpufreq_cdev->idle_time = kcalloc(num_cpus, + sizeof(*cpufreq_cdev->idle_time), + gfp_kernel); + if (!cpufreq_cdev->idle_time) + return -enomem; + + return 0; +} + +static void free_idle_time(struct cpufreq_cooling_device *cpufreq_cdev) +{ + kfree(cpufreq_cdev->idle_time); + cpufreq_cdev->idle_time = null; +} +#endif /* config_smp */ + - unsigned int i, num_cpus; + unsigned int i; - - num_cpus = cpumask_weight(policy->related_cpus); - cpufreq_cdev->idle_time = kcalloc(num_cpus, - sizeof(*cpufreq_cdev->idle_time), - gfp_kernel); - if (!cpufreq_cdev->idle_time) { - cdev = err_ptr(-enomem); + + ret = allocate_idle_time(cpufreq_cdev); + if (ret) { + cdev = err_ptr(ret); - kfree(cpufreq_cdev->idle_time); + free_idle_time(cpufreq_cdev); - kfree(cpufreq_cdev->idle_time); + free_idle_time(cpufreq_cdev);
|
Power Management
|
d1515851ca075ed98fe78ac6abf24ba2dd25a63b
|
viresh kumar
|
drivers
|
thermal
| |
scsi: ibmvfc: add vhost fields and defaults for mq enablement
|
introduce several new vhost fields for managing mq state of the adapter as well as initial defaults for mq enablement.
|
this release allows to map an uid to a different one in a mount; it also adds support for selecting the preemption model at runtime; support for a low-overhead memory error detector designed to be used in production; support for the acrn hypervisor designed for embedded systems; btrfs initial support for zoned devices, subpage blocks sizes and performance improvements; support for eager nfs writes; support for a thermal power management to control the surface temperature of embedded devices in an unified way; the napi polling can be moved to a kernel thread; and support for non-blocking path lookups. as always, there are many other features, new drivers, improvements and fixes.
|
initial mq development/enablement
|
['core (various)', 'file systems', 'memory management', 'block layer', 'tracing, perf and bpf', 'virtualization', 'cryptography', 'security', 'networking', 'architectures x86 arm risc-v powerpc mips csky s390 pa-risc c6x']
|
['graphics', 'power management', 'storage', 'drivers in the staging area', 'networking', 'audio', 'tablets, touch screens, keyboards, mouses', 'tv tuners, webcams, video capturers', 'universal serial bus', 'serial peripheral interface (spi)', 'watchdog', 'serial', 'cpu frequency scaling', 'device voltage and frequency scaling', 'voltage, current regulators, power capping, power supply', 'real time clock (rtc)', 'pin controllers (pinctrl)', 'multi media card (mmc)', 'memory technology devices (mtd)', 'industrial i/o (iio)', 'multi function devices (mfd)', 'pulse-width modulation (pwm)', 'inter-integrated circuit (i2c + i3c)', 'hardware monitoring (hwmon)', 'general purpose i/o (gpio)', 'leds', 'dma engines', 'cryptography hardware acceleration', 'pci', 'non-transparent bridge (ntb)', 'thunderbolt', 'clock', 'phy ("physical layer" framework)', 'cxl (compute express link)', 'various']
|
['scsi ', 'ibmvfc']
|
['h', 'c']
| 2
| 17
| 0
|
--- diff --git a/drivers/scsi/ibmvscsi/ibmvfc.c b/drivers/scsi/ibmvscsi/ibmvfc.c --- a/drivers/scsi/ibmvscsi/ibmvfc.c +++ b/drivers/scsi/ibmvscsi/ibmvfc.c + .host_tagset = 1, + shost->nr_hw_queues = ibmvfc_mq ? ibmvfc_scsi_hw_queues : 1; + + vhost->mq_enabled = ibmvfc_mq; + vhost->client_scsi_channels = ibmvfc_scsi_channels; + vhost->using_channels = 0; + vhost->do_enquiry = 1; + diff --git a/drivers/scsi/ibmvscsi/ibmvfc.h b/drivers/scsi/ibmvscsi/ibmvfc.h --- a/drivers/scsi/ibmvscsi/ibmvfc.h +++ b/drivers/scsi/ibmvscsi/ibmvfc.h +#define ibmvfc_mq 0 +#define ibmvfc_scsi_channels 0 +#define ibmvfc_scsi_hw_queues 1 +#define ibmvfc_mig_no_sub_to_crq 0 +#define ibmvfc_mig_no_n_to_m 0 + int mq_enabled; + int using_channels; + int do_enquiry; + int client_scsi_channels;
|
Storage
|
6ae208e5d2db6a99a8503a5571a775d27e8dd608
|
tyrel datwyler brian king brking linux vnet ibm com
|
drivers
|
scsi
|
ibmvscsi
|
scsi: ibmvfc: move event pool init/free routines
|
the next patch in this series reworks the event pool allocation calls to happen within the individual queue allocation routines instead of as independent calls.
|
this release allows to map an uid to a different one in a mount; it also adds support for selecting the preemption model at runtime; support for a low-overhead memory error detector designed to be used in production; support for the acrn hypervisor designed for embedded systems; btrfs initial support for zoned devices, subpage blocks sizes and performance improvements; support for eager nfs writes; support for a thermal power management to control the surface temperature of embedded devices in an unified way; the napi polling can be moved to a kernel thread; and support for non-blocking path lookups. as always, there are many other features, new drivers, improvements and fixes.
|
initial mq development/enablement
|
['core (various)', 'file systems', 'memory management', 'block layer', 'tracing, perf and bpf', 'virtualization', 'cryptography', 'security', 'networking', 'architectures x86 arm risc-v powerpc mips csky s390 pa-risc c6x']
|
['graphics', 'power management', 'storage', 'drivers in the staging area', 'networking', 'audio', 'tablets, touch screens, keyboards, mouses', 'tv tuners, webcams, video capturers', 'universal serial bus', 'serial peripheral interface (spi)', 'watchdog', 'serial', 'cpu frequency scaling', 'device voltage and frequency scaling', 'voltage, current regulators, power capping, power supply', 'real time clock (rtc)', 'pin controllers (pinctrl)', 'multi media card (mmc)', 'memory technology devices (mtd)', 'industrial i/o (iio)', 'multi function devices (mfd)', 'pulse-width modulation (pwm)', 'inter-integrated circuit (i2c + i3c)', 'hardware monitoring (hwmon)', 'general purpose i/o (gpio)', 'leds', 'dma engines', 'cryptography hardware acceleration', 'pci', 'non-transparent bridge (ntb)', 'thunderbolt', 'clock', 'phy ("physical layer" framework)', 'cxl (compute express link)', 'various']
|
['scsi ', 'ibmvfc']
|
['c']
| 1
| 76
| 75
|
--- diff --git a/drivers/scsi/ibmvscsi/ibmvfc.c b/drivers/scsi/ibmvscsi/ibmvfc.c --- a/drivers/scsi/ibmvscsi/ibmvfc.c +++ b/drivers/scsi/ibmvscsi/ibmvfc.c +/** + * ibmvfc_init_event_pool - allocates and initializes the event pool for a host + * @vhost: ibmvfc host who owns the event pool + * + * returns zero on success. + **/ +static int ibmvfc_init_event_pool(struct ibmvfc_host *vhost, + struct ibmvfc_queue *queue) +{ + int i; + struct ibmvfc_event_pool *pool = &queue->evt_pool; + + enter; + pool->size = max_requests + ibmvfc_num_internal_req; + pool->events = kcalloc(pool->size, sizeof(*pool->events), gfp_kernel); + if (!pool->events) + return -enomem; + + pool->iu_storage = dma_alloc_coherent(vhost->dev, + pool->size * sizeof(*pool->iu_storage), + &pool->iu_token, 0); + + if (!pool->iu_storage) { + kfree(pool->events); + return -enomem; + } + + init_list_head(&queue->sent); + init_list_head(&queue->free); + spin_lock_init(&queue->l_lock); + + for (i = 0; i < pool->size; ++i) { + struct ibmvfc_event *evt = &pool->events[i]; + + atomic_set(&evt->free, 1); + evt->crq.valid = 0x80; + evt->crq.ioba = cpu_to_be64(pool->iu_token + (sizeof(*evt->xfer_iu) * i)); + evt->xfer_iu = pool->iu_storage + i; + evt->vhost = vhost; + evt->queue = queue; + evt->ext_list = null; + list_add_tail(&evt->queue_list, &queue->free); + } + + leave; + return 0; +} + +/** + * ibmvfc_free_event_pool - frees memory of the event pool of a host + * @vhost: ibmvfc host who owns the event pool + * + **/ +static void ibmvfc_free_event_pool(struct ibmvfc_host *vhost, + struct ibmvfc_queue *queue) +{ + int i; + struct ibmvfc_event_pool *pool = &queue->evt_pool; + + enter; + for (i = 0; i < pool->size; ++i) { + list_del(&pool->events[i].queue_list); + bug_on(atomic_read(&pool->events[i].free) != 1); + if (pool->events[i].ext_list) + dma_pool_free(vhost->sg_pool, + pool->events[i].ext_list, + pool->events[i].ext_list_token); + } + + kfree(pool->events); + dma_free_coherent(vhost->dev, + pool->size * sizeof(*pool->iu_storage), + pool->iu_storage, pool->iu_token); + leave; +} + -/** - * ibmvfc_init_event_pool - allocates and initializes the event pool for a host - * @vhost: ibmvfc host who owns the event pool - * - * returns zero on success. - **/ -static int ibmvfc_init_event_pool(struct ibmvfc_host *vhost, - struct ibmvfc_queue *queue) -{ - int i; - struct ibmvfc_event_pool *pool = &queue->evt_pool; - - enter; - pool->size = max_requests + ibmvfc_num_internal_req; - pool->events = kcalloc(pool->size, sizeof(*pool->events), gfp_kernel); - if (!pool->events) - return -enomem; - - pool->iu_storage = dma_alloc_coherent(vhost->dev, - pool->size * sizeof(*pool->iu_storage), - &pool->iu_token, 0); - - if (!pool->iu_storage) { - kfree(pool->events); - return -enomem; - } - - init_list_head(&queue->sent); - init_list_head(&queue->free); - spin_lock_init(&queue->l_lock); - - for (i = 0; i < pool->size; ++i) { - struct ibmvfc_event *evt = &pool->events[i]; - atomic_set(&evt->free, 1); - evt->crq.valid = 0x80; - evt->crq.ioba = cpu_to_be64(pool->iu_token + (sizeof(*evt->xfer_iu) * i)); - evt->xfer_iu = pool->iu_storage + i; - evt->vhost = vhost; - evt->queue = queue; - evt->ext_list = null; - list_add_tail(&evt->queue_list, &queue->free); - } - - leave; - return 0; -} - -/** - * ibmvfc_free_event_pool - frees memory of the event pool of a host - * @vhost: ibmvfc host who owns the event pool - * - **/ -static void ibmvfc_free_event_pool(struct ibmvfc_host *vhost, - struct ibmvfc_queue *queue) -{ - int i; - struct ibmvfc_event_pool *pool = &queue->evt_pool; - - enter; - for (i = 0; i < pool->size; ++i) { - list_del(&pool->events[i].queue_list); - bug_on(atomic_read(&pool->events[i].free) != 1); - if (pool->events[i].ext_list) - dma_pool_free(vhost->sg_pool, - pool->events[i].ext_list, - pool->events[i].ext_list_token); - } - - kfree(pool->events); - dma_free_coherent(vhost->dev, - pool->size * sizeof(*pool->iu_storage), - pool->iu_storage, pool->iu_token); - leave; -} -
|
Storage
|
225acf5f1aba3b469c1f762cbd14cdb4bd7aefc5
|
tyrel datwyler
|
drivers
|
scsi
|
ibmvscsi
|
scsi: ibmvfc: init/free event pool during queue allocation/free
|
the event pool and crq used to be separate entities of the adapter host structure and as such were allocated and freed independently of each other. recent work as defined a generic queue structure with an event pool specific to each queue. as such the event pool for each queue shouldn't be allocated/freed independently, but instead performed as part of the queue allocation/free routines.
|
this release allows to map an uid to a different one in a mount; it also adds support for selecting the preemption model at runtime; support for a low-overhead memory error detector designed to be used in production; support for the acrn hypervisor designed for embedded systems; btrfs initial support for zoned devices, subpage blocks sizes and performance improvements; support for eager nfs writes; support for a thermal power management to control the surface temperature of embedded devices in an unified way; the napi polling can be moved to a kernel thread; and support for non-blocking path lookups. as always, there are many other features, new drivers, improvements and fixes.
|
initial mq development/enablement
|
['core (various)', 'file systems', 'memory management', 'block layer', 'tracing, perf and bpf', 'virtualization', 'cryptography', 'security', 'networking', 'architectures x86 arm risc-v powerpc mips csky s390 pa-risc c6x']
|
['graphics', 'power management', 'storage', 'drivers in the staging area', 'networking', 'audio', 'tablets, touch screens, keyboards, mouses', 'tv tuners, webcams, video capturers', 'universal serial bus', 'serial peripheral interface (spi)', 'watchdog', 'serial', 'cpu frequency scaling', 'device voltage and frequency scaling', 'voltage, current regulators, power capping, power supply', 'real time clock (rtc)', 'pin controllers (pinctrl)', 'multi media card (mmc)', 'memory technology devices (mtd)', 'industrial i/o (iio)', 'multi function devices (mfd)', 'pulse-width modulation (pwm)', 'inter-integrated circuit (i2c + i3c)', 'hardware monitoring (hwmon)', 'general purpose i/o (gpio)', 'leds', 'dma engines', 'cryptography hardware acceleration', 'pci', 'non-transparent bridge (ntb)', 'thunderbolt', 'clock', 'phy ("physical layer" framework)', 'cxl (compute express link)', 'various']
|
['scsi ', 'ibmvfc']
|
['c']
| 1
| 8
| 10
|
--- diff --git a/drivers/scsi/ibmvscsi/ibmvfc.c b/drivers/scsi/ibmvscsi/ibmvfc.c --- a/drivers/scsi/ibmvscsi/ibmvfc.c +++ b/drivers/scsi/ibmvscsi/ibmvfc.c + + ibmvfc_free_event_pool(vhost, queue); + if (ibmvfc_init_event_pool(vhost, queue)) { + dev_err(dev, "couldn't initialize event pool. "); + return -enomem; + } - if ((rc = ibmvfc_init_event_pool(vhost, &vhost->crq))) { - dev_err(dev, "couldn't initialize event pool. rc=%d ", rc); - goto release_crq; - } - - goto release_event_pool; + goto release_crq; -release_event_pool: - ibmvfc_free_event_pool(vhost, &vhost->crq); - ibmvfc_release_crq_queue(vhost); - ibmvfc_free_event_pool(vhost, &vhost->crq); + ibmvfc_release_crq_queue(vhost);
|
Storage
|
003d91a1393d7dad8351fd36eed90d6cb77dd232
|
tyrel datwyler
|
drivers
|
scsi
|
ibmvscsi
|
scsi: ibmvfc: add size parameter to ibmvfc_init_event_pool()
|
with the upcoming addition of sub-crqs the event pool size may vary per-queue.
|
this release allows to map an uid to a different one in a mount; it also adds support for selecting the preemption model at runtime; support for a low-overhead memory error detector designed to be used in production; support for the acrn hypervisor designed for embedded systems; btrfs initial support for zoned devices, subpage blocks sizes and performance improvements; support for eager nfs writes; support for a thermal power management to control the surface temperature of embedded devices in an unified way; the napi polling can be moved to a kernel thread; and support for non-blocking path lookups. as always, there are many other features, new drivers, improvements and fixes.
|
initial mq development/enablement
|
['core (various)', 'file systems', 'memory management', 'block layer', 'tracing, perf and bpf', 'virtualization', 'cryptography', 'security', 'networking', 'architectures x86 arm risc-v powerpc mips csky s390 pa-risc c6x']
|
['graphics', 'power management', 'storage', 'drivers in the staging area', 'networking', 'audio', 'tablets, touch screens, keyboards, mouses', 'tv tuners, webcams, video capturers', 'universal serial bus', 'serial peripheral interface (spi)', 'watchdog', 'serial', 'cpu frequency scaling', 'device voltage and frequency scaling', 'voltage, current regulators, power capping, power supply', 'real time clock (rtc)', 'pin controllers (pinctrl)', 'multi media card (mmc)', 'memory technology devices (mtd)', 'industrial i/o (iio)', 'multi function devices (mfd)', 'pulse-width modulation (pwm)', 'inter-integrated circuit (i2c + i3c)', 'hardware monitoring (hwmon)', 'general purpose i/o (gpio)', 'leds', 'dma engines', 'cryptography hardware acceleration', 'pci', 'non-transparent bridge (ntb)', 'thunderbolt', 'clock', 'phy ("physical layer" framework)', 'cxl (compute express link)', 'various']
|
['scsi ', 'ibmvfc']
|
['c']
| 1
| 16
| 9
|
--- diff --git a/drivers/scsi/ibmvscsi/ibmvfc.c b/drivers/scsi/ibmvscsi/ibmvfc.c --- a/drivers/scsi/ibmvscsi/ibmvfc.c +++ b/drivers/scsi/ibmvscsi/ibmvfc.c - struct ibmvfc_queue *queue) + struct ibmvfc_queue *queue, + unsigned int size) - pool->size = max_requests + ibmvfc_num_internal_req; - pool->events = kcalloc(pool->size, sizeof(*pool->events), gfp_kernel); + if (!size) + return 0; + + pool->size = size; + pool->events = kcalloc(size, sizeof(*pool->events), gfp_kernel); - pool->size * sizeof(*pool->iu_storage), + size * sizeof(*pool->iu_storage), - for (i = 0; i < pool->size; ++i) { + for (i = 0; i < size; ++i) { + unsigned int pool_size = 0; - if (ibmvfc_init_event_pool(vhost, queue)) { - dev_err(dev, "couldn't initialize event pool. "); - return -enomem; - } + pool_size = max_requests + ibmvfc_num_internal_req; + if (ibmvfc_init_event_pool(vhost, queue, pool_size)) { + dev_err(dev, "couldn't initialize event pool. "); + return -enomem; + } +
|
Storage
|
bb35ecb2a949d9f4be84343107826bc69f33e72c
|
tyrel datwyler
|
drivers
|
scsi
|
ibmvscsi
|
scsi: ibmvfc: define hcall wrapper for registering a sub-crq
|
sub-crqs are registred with firmware via a hypercall. abstract that interface into a simpler helper function.
|
this release allows to map an uid to a different one in a mount; it also adds support for selecting the preemption model at runtime; support for a low-overhead memory error detector designed to be used in production; support for the acrn hypervisor designed for embedded systems; btrfs initial support for zoned devices, subpage blocks sizes and performance improvements; support for eager nfs writes; support for a thermal power management to control the surface temperature of embedded devices in an unified way; the napi polling can be moved to a kernel thread; and support for non-blocking path lookups. as always, there are many other features, new drivers, improvements and fixes.
|
initial mq development/enablement
|
['core (various)', 'file systems', 'memory management', 'block layer', 'tracing, perf and bpf', 'virtualization', 'cryptography', 'security', 'networking', 'architectures x86 arm risc-v powerpc mips csky s390 pa-risc c6x']
|
['graphics', 'power management', 'storage', 'drivers in the staging area', 'networking', 'audio', 'tablets, touch screens, keyboards, mouses', 'tv tuners, webcams, video capturers', 'universal serial bus', 'serial peripheral interface (spi)', 'watchdog', 'serial', 'cpu frequency scaling', 'device voltage and frequency scaling', 'voltage, current regulators, power capping, power supply', 'real time clock (rtc)', 'pin controllers (pinctrl)', 'multi media card (mmc)', 'memory technology devices (mtd)', 'industrial i/o (iio)', 'multi function devices (mfd)', 'pulse-width modulation (pwm)', 'inter-integrated circuit (i2c + i3c)', 'hardware monitoring (hwmon)', 'general purpose i/o (gpio)', 'leds', 'dma engines', 'cryptography hardware acceleration', 'pci', 'non-transparent bridge (ntb)', 'thunderbolt', 'clock', 'phy ("physical layer" framework)', 'cxl (compute express link)', 'various']
|
['scsi ', 'ibmvfc']
|
['c']
| 1
| 14
| 0
|
--- diff --git a/drivers/scsi/ibmvscsi/ibmvfc.c b/drivers/scsi/ibmvscsi/ibmvfc.c --- a/drivers/scsi/ibmvscsi/ibmvfc.c +++ b/drivers/scsi/ibmvscsi/ibmvfc.c +static long h_reg_sub_crq(unsigned long unit_address, unsigned long ioba, + unsigned long length, unsigned long *cookie, + unsigned long *irq) +{ + unsigned long retbuf[plpar_hcall_bufsize]; + long rc; + + rc = plpar_hcall(h_reg_sub_crq, retbuf, unit_address, ioba, length); + *cookie = retbuf[0]; + *irq = retbuf[1]; + + return rc; +} +
|
Storage
|
9e6b6b81aafaf6e6d6d8f22e87b2cd9f2ffd66e8
|
tyrel datwyler brian king brking linux vnet ibm com
|
drivers
|
scsi
|
ibmvscsi
|
scsi: ibmvfc: add subordinate crq definitions
|
subordinate command response queues (sub crq) are used in conjunction with the primary crq when more than one queue is needed by the virtual i/o adapter. recent phyp firmware versions support sub crq's with ibmvfc adapters. this feature is a prerequisite for supporting multiple hardware backed submission queues in the vfc adapter.
|
this release allows to map an uid to a different one in a mount; it also adds support for selecting the preemption model at runtime; support for a low-overhead memory error detector designed to be used in production; support for the acrn hypervisor designed for embedded systems; btrfs initial support for zoned devices, subpage blocks sizes and performance improvements; support for eager nfs writes; support for a thermal power management to control the surface temperature of embedded devices in an unified way; the napi polling can be moved to a kernel thread; and support for non-blocking path lookups. as always, there are many other features, new drivers, improvements and fixes.
|
initial mq development/enablement
|
['core (various)', 'file systems', 'memory management', 'block layer', 'tracing, perf and bpf', 'virtualization', 'cryptography', 'security', 'networking', 'architectures x86 arm risc-v powerpc mips csky s390 pa-risc c6x']
|
['graphics', 'power management', 'storage', 'drivers in the staging area', 'networking', 'audio', 'tablets, touch screens, keyboards, mouses', 'tv tuners, webcams, video capturers', 'universal serial bus', 'serial peripheral interface (spi)', 'watchdog', 'serial', 'cpu frequency scaling', 'device voltage and frequency scaling', 'voltage, current regulators, power capping, power supply', 'real time clock (rtc)', 'pin controllers (pinctrl)', 'multi media card (mmc)', 'memory technology devices (mtd)', 'industrial i/o (iio)', 'multi function devices (mfd)', 'pulse-width modulation (pwm)', 'inter-integrated circuit (i2c + i3c)', 'hardware monitoring (hwmon)', 'general purpose i/o (gpio)', 'leds', 'dma engines', 'cryptography hardware acceleration', 'pci', 'non-transparent bridge (ntb)', 'thunderbolt', 'clock', 'phy ("physical layer" framework)', 'cxl (compute express link)', 'various']
|
['scsi ', 'ibmvfc']
|
['h']
| 1
| 21
| 0
|
--- diff --git a/drivers/scsi/ibmvscsi/ibmvfc.h b/drivers/scsi/ibmvscsi/ibmvfc.h --- a/drivers/scsi/ibmvscsi/ibmvfc.h +++ b/drivers/scsi/ibmvscsi/ibmvfc.h +struct ibmvfc_sub_crq { + struct ibmvfc_crq crq; + __be64 reserved[2]; +} __packed __aligned(8); + + ibmvfc_sub_crq_fmt, + struct ibmvfc_sub_crq *scrq; + + /* sub-crq fields */ + struct ibmvfc_host *vhost; + unsigned long cookie; + unsigned long vios_cookie; + unsigned long hw_irq; + unsigned long irq; + unsigned long hwq_id; + char name[32]; +}; + +struct ibmvfc_scsi_channels { + struct ibmvfc_queue *scrqs; + unsigned int active_queues;
|
Storage
|
6d07f129dce28855870e4371af6a99257635f557
|
tyrel datwyler
|
drivers
|
scsi
|
ibmvscsi
|
scsi: ibmvfc: add alloc/dealloc routines for scsi sub-crq channels
|
allocate a set of sub-crqs in advance. during channel setup the client and vios negotiate the number of queues the vios supports and the number that the client desires to request. its possible that the final channel resources allocated is less than requested, but the client is still responsible for sending handles for every queue it is hoping for.
|
this release allows to map an uid to a different one in a mount; it also adds support for selecting the preemption model at runtime; support for a low-overhead memory error detector designed to be used in production; support for the acrn hypervisor designed for embedded systems; btrfs initial support for zoned devices, subpage blocks sizes and performance improvements; support for eager nfs writes; support for a thermal power management to control the surface temperature of embedded devices in an unified way; the napi polling can be moved to a kernel thread; and support for non-blocking path lookups. as always, there are many other features, new drivers, improvements and fixes.
|
initial mq development/enablement
|
['core (various)', 'file systems', 'memory management', 'block layer', 'tracing, perf and bpf', 'virtualization', 'cryptography', 'security', 'networking', 'architectures x86 arm risc-v powerpc mips csky s390 pa-risc c6x']
|
['graphics', 'power management', 'storage', 'drivers in the staging area', 'networking', 'audio', 'tablets, touch screens, keyboards, mouses', 'tv tuners, webcams, video capturers', 'universal serial bus', 'serial peripheral interface (spi)', 'watchdog', 'serial', 'cpu frequency scaling', 'device voltage and frequency scaling', 'voltage, current regulators, power capping, power supply', 'real time clock (rtc)', 'pin controllers (pinctrl)', 'multi media card (mmc)', 'memory technology devices (mtd)', 'industrial i/o (iio)', 'multi function devices (mfd)', 'pulse-width modulation (pwm)', 'inter-integrated circuit (i2c + i3c)', 'hardware monitoring (hwmon)', 'general purpose i/o (gpio)', 'leds', 'dma engines', 'cryptography hardware acceleration', 'pci', 'non-transparent bridge (ntb)', 'thunderbolt', 'clock', 'phy ("physical layer" framework)', 'cxl (compute express link)', 'various']
|
['scsi ', 'ibmvfc']
|
['h', 'c']
| 2
| 126
| 0
|
--- diff --git a/drivers/scsi/ibmvscsi/ibmvfc.c b/drivers/scsi/ibmvscsi/ibmvfc.c --- a/drivers/scsi/ibmvscsi/ibmvfc.c +++ b/drivers/scsi/ibmvscsi/ibmvfc.c + struct ibmvfc_queue *scrq; + int i; + if (vhost->scsi_scrqs.scrqs) { + for (i = 0; i < ibmvfc_scsi_hw_queues; i++) { + scrq = &vhost->scsi_scrqs.scrqs[i]; + spin_lock(scrq->q_lock); + memset(scrq->msgs.scrq, 0, page_size); + scrq->cur = 0; + spin_unlock(scrq->q_lock); + } + } + + case ibmvfc_sub_crq_fmt: + fmt_size = sizeof(*queue->msgs.scrq); + /* we need one extra event for cancel commands */ + pool_size = max_requests + 1; + break; +static int ibmvfc_register_scsi_channel(struct ibmvfc_host *vhost, + int index) +{ + struct device *dev = vhost->dev; + struct vio_dev *vdev = to_vio_dev(dev); + struct ibmvfc_queue *scrq = &vhost->scsi_scrqs.scrqs[index]; + int rc = -enomem; + + enter; + + if (ibmvfc_alloc_queue(vhost, scrq, ibmvfc_sub_crq_fmt)) + return -enomem; + + rc = h_reg_sub_crq(vdev->unit_address, scrq->msg_token, page_size, + &scrq->cookie, &scrq->hw_irq); + + if (rc) { + dev_warn(dev, "error registering sub-crq: %d ", rc); + if (rc == h_parameter) + dev_warn_once(dev, "firmware may not support mq "); + goto reg_failed; + } + + scrq->hwq_id = index; + scrq->vhost = vhost; + + leave; + return 0; + +reg_failed: + ibmvfc_free_queue(vhost, scrq); + leave; + return rc; +} + +static void ibmvfc_deregister_scsi_channel(struct ibmvfc_host *vhost, int index) +{ + struct device *dev = vhost->dev; + struct vio_dev *vdev = to_vio_dev(dev); + struct ibmvfc_queue *scrq = &vhost->scsi_scrqs.scrqs[index]; + long rc; + + enter; + + do { + rc = plpar_hcall_norets(h_free_sub_crq, vdev->unit_address, + scrq->cookie); + } while (rc == h_busy || h_is_long_busy(rc)); + + if (rc) + dev_err(dev, "failed to free sub-crq[%d]: rc=%ld ", index, rc); + + ibmvfc_free_queue(vhost, scrq); + leave; +} + +static int ibmvfc_init_sub_crqs(struct ibmvfc_host *vhost) +{ + int i, j; + + enter; + + vhost->scsi_scrqs.scrqs = kcalloc(ibmvfc_scsi_hw_queues, + sizeof(*vhost->scsi_scrqs.scrqs), + gfp_kernel); + if (!vhost->scsi_scrqs.scrqs) + return -1; + + for (i = 0; i < ibmvfc_scsi_hw_queues; i++) { + if (ibmvfc_register_scsi_channel(vhost, i)) { + for (j = i; j > 0; j--) + ibmvfc_deregister_scsi_channel(vhost, j - 1); + kfree(vhost->scsi_scrqs.scrqs); + vhost->scsi_scrqs.scrqs = null; + vhost->scsi_scrqs.active_queues = 0; + leave; + return -1; + } + } + + leave; + return 0; +} + +static void ibmvfc_release_sub_crqs(struct ibmvfc_host *vhost) +{ + int i; + + enter; + if (!vhost->scsi_scrqs.scrqs) + return; + + for (i = 0; i < ibmvfc_scsi_hw_queues; i++) + ibmvfc_deregister_scsi_channel(vhost, i); + + kfree(vhost->scsi_scrqs.scrqs); + vhost->scsi_scrqs.scrqs = null; + vhost->scsi_scrqs.active_queues = 0; + leave; +} + + if (vhost->mq_enabled) { + rc = ibmvfc_init_sub_crqs(vhost); + if (rc) + dev_warn(dev, "failed to allocate sub-crqs. rc=%d ", rc); + } + + ibmvfc_release_sub_crqs(vhost); diff --git a/drivers/scsi/ibmvscsi/ibmvfc.h b/drivers/scsi/ibmvscsi/ibmvfc.h --- a/drivers/scsi/ibmvscsi/ibmvfc.h +++ b/drivers/scsi/ibmvscsi/ibmvfc.h + struct ibmvfc_scsi_channels scsi_scrqs;
|
Storage
|
3034ebe26389740bb6b4a463e05afb51dc93c336
|
tyrel datwyler
|
drivers
|
scsi
|
ibmvscsi
|
scsi: ibmvfc: add sub-crq irq enable/disable routine
|
each sub-crq has its own interrupt. a hypercall is required to toggle the irq state. provide the necessary mechanism via a helper function.
|
this release allows to map an uid to a different one in a mount; it also adds support for selecting the preemption model at runtime; support for a low-overhead memory error detector designed to be used in production; support for the acrn hypervisor designed for embedded systems; btrfs initial support for zoned devices, subpage blocks sizes and performance improvements; support for eager nfs writes; support for a thermal power management to control the surface temperature of embedded devices in an unified way; the napi polling can be moved to a kernel thread; and support for non-blocking path lookups. as always, there are many other features, new drivers, improvements and fixes.
|
initial mq development/enablement
|
['core (various)', 'file systems', 'memory management', 'block layer', 'tracing, perf and bpf', 'virtualization', 'cryptography', 'security', 'networking', 'architectures x86 arm risc-v powerpc mips csky s390 pa-risc c6x']
|
['graphics', 'power management', 'storage', 'drivers in the staging area', 'networking', 'audio', 'tablets, touch screens, keyboards, mouses', 'tv tuners, webcams, video capturers', 'universal serial bus', 'serial peripheral interface (spi)', 'watchdog', 'serial', 'cpu frequency scaling', 'device voltage and frequency scaling', 'voltage, current regulators, power capping, power supply', 'real time clock (rtc)', 'pin controllers (pinctrl)', 'multi media card (mmc)', 'memory technology devices (mtd)', 'industrial i/o (iio)', 'multi function devices (mfd)', 'pulse-width modulation (pwm)', 'inter-integrated circuit (i2c + i3c)', 'hardware monitoring (hwmon)', 'general purpose i/o (gpio)', 'leds', 'dma engines', 'cryptography hardware acceleration', 'pci', 'non-transparent bridge (ntb)', 'thunderbolt', 'clock', 'phy ("physical layer" framework)', 'cxl (compute express link)', 'various']
|
['scsi ', 'ibmvfc']
|
['c']
| 1
| 20
| 0
|
--- diff --git a/drivers/scsi/ibmvscsi/ibmvfc.c b/drivers/scsi/ibmvscsi/ibmvfc.c --- a/drivers/scsi/ibmvscsi/ibmvfc.c +++ b/drivers/scsi/ibmvscsi/ibmvfc.c +static int ibmvfc_toggle_scrq_irq(struct ibmvfc_queue *scrq, int enable) +{ + struct device *dev = scrq->vhost->dev; + struct vio_dev *vdev = to_vio_dev(dev); + unsigned long rc; + int irq_action = h_enable_vio_interrupt; + + if (!enable) + irq_action = h_disable_vio_interrupt; + + rc = plpar_hcall_norets(h_vioctl, vdev->unit_address, irq_action, + scrq->hw_irq, 0, 0); + + if (rc) + dev_err(dev, "couldn't %s sub-crq[%lu] irq. rc=%ld ", + enable ? "enable" : "disable", scrq->hwq_id, rc); + + return rc; +} +
|
Storage
|
d20046e64c099377f7e82583eb4ddf3a800fd19f
|
tyrel datwyler brian king brking linux vnet ibm com
|
drivers
|
scsi
|
ibmvscsi
|
scsi: ibmvfc: add handlers to drain and complete sub-crq responses
|
the logic for iterating over the sub-crq responses is similiar to that of the primary crq. add the necessary handlers for processing those responses.
|
this release allows to map an uid to a different one in a mount; it also adds support for selecting the preemption model at runtime; support for a low-overhead memory error detector designed to be used in production; support for the acrn hypervisor designed for embedded systems; btrfs initial support for zoned devices, subpage blocks sizes and performance improvements; support for eager nfs writes; support for a thermal power management to control the surface temperature of embedded devices in an unified way; the napi polling can be moved to a kernel thread; and support for non-blocking path lookups. as always, there are many other features, new drivers, improvements and fixes.
|
initial mq development/enablement
|
['core (various)', 'file systems', 'memory management', 'block layer', 'tracing, perf and bpf', 'virtualization', 'cryptography', 'security', 'networking', 'architectures x86 arm risc-v powerpc mips csky s390 pa-risc c6x']
|
['graphics', 'power management', 'storage', 'drivers in the staging area', 'networking', 'audio', 'tablets, touch screens, keyboards, mouses', 'tv tuners, webcams, video capturers', 'universal serial bus', 'serial peripheral interface (spi)', 'watchdog', 'serial', 'cpu frequency scaling', 'device voltage and frequency scaling', 'voltage, current regulators, power capping, power supply', 'real time clock (rtc)', 'pin controllers (pinctrl)', 'multi media card (mmc)', 'memory technology devices (mtd)', 'industrial i/o (iio)', 'multi function devices (mfd)', 'pulse-width modulation (pwm)', 'inter-integrated circuit (i2c + i3c)', 'hardware monitoring (hwmon)', 'general purpose i/o (gpio)', 'leds', 'dma engines', 'cryptography hardware acceleration', 'pci', 'non-transparent bridge (ntb)', 'thunderbolt', 'clock', 'phy ("physical layer" framework)', 'cxl (compute express link)', 'various']
|
['scsi ', 'ibmvfc']
|
['c']
| 1
| 86
| 0
|
--- diff --git a/drivers/scsi/ibmvscsi/ibmvfc.c b/drivers/scsi/ibmvscsi/ibmvfc.c --- a/drivers/scsi/ibmvscsi/ibmvfc.c +++ b/drivers/scsi/ibmvscsi/ibmvfc.c +static void ibmvfc_handle_scrq(struct ibmvfc_crq *crq, struct ibmvfc_host *vhost, + struct list_head *evt_doneq) +{ + struct ibmvfc_event *evt = (struct ibmvfc_event *)be64_to_cpu(crq->ioba); + + switch (crq->valid) { + case ibmvfc_crq_cmd_rsp: + break; + case ibmvfc_crq_xport_event: + return; + default: + dev_err(vhost->dev, "got and invalid message type 0x%02x ", crq->valid); + return; + } + + /* the only kind of payload crqs we should get are responses to + * things we send. make sure this response is to something we + * actually sent + */ + if (unlikely(!ibmvfc_valid_event(&evt->queue->evt_pool, evt))) { + dev_err(vhost->dev, "returned correlation_token 0x%08llx is invalid! ", + crq->ioba); + return; + } + + if (unlikely(atomic_read(&evt->free))) { + dev_err(vhost->dev, "received duplicate correlation_token 0x%08llx! ", + crq->ioba); + return; + } + + spin_lock(&evt->queue->l_lock); + list_move_tail(&evt->queue_list, evt_doneq); + spin_unlock(&evt->queue->l_lock); +} + +static struct ibmvfc_crq *ibmvfc_next_scrq(struct ibmvfc_queue *scrq) +{ + struct ibmvfc_crq *crq; + + crq = &scrq->msgs.scrq[scrq->cur].crq; + if (crq->valid & 0x80) { + if (++scrq->cur == scrq->size) + scrq->cur = 0; + rmb(); + } else + crq = null; + + return crq; +} + +static void ibmvfc_drain_sub_crq(struct ibmvfc_queue *scrq) +{ + struct ibmvfc_crq *crq; + struct ibmvfc_event *evt, *temp; + unsigned long flags; + int done = 0; + list_head(evt_doneq); + + spin_lock_irqsave(scrq->q_lock, flags); + while (!done) { + while ((crq = ibmvfc_next_scrq(scrq)) != null) { + ibmvfc_handle_scrq(crq, scrq->vhost, &evt_doneq); + crq->valid = 0; + wmb(); + } + + ibmvfc_toggle_scrq_irq(scrq, 1); + if ((crq = ibmvfc_next_scrq(scrq)) != null) { + ibmvfc_toggle_scrq_irq(scrq, 0); + ibmvfc_handle_scrq(crq, scrq->vhost, &evt_doneq); + crq->valid = 0; + wmb(); + } else + done = 1; + } + spin_unlock_irqrestore(scrq->q_lock, flags); + + list_for_each_entry_safe(evt, temp, &evt_doneq, queue_list) { + del_timer(&evt->timer); + list_del(&evt->queue_list); + ibmvfc_trc_end(evt); + evt->done(evt); + } +} +
|
Storage
|
1d956ad853fc70f611ea47cef1792385dc1de1b3
|
tyrel datwyler brian king brking linux vnet ibm com
|
drivers
|
scsi
|
ibmvscsi
|
scsi: ibmvfc: define sub-crq interrupt handler routine
|
simple handler that calls sub-crq drain routine directly.
|
this release allows to map an uid to a different one in a mount; it also adds support for selecting the preemption model at runtime; support for a low-overhead memory error detector designed to be used in production; support for the acrn hypervisor designed for embedded systems; btrfs initial support for zoned devices, subpage blocks sizes and performance improvements; support for eager nfs writes; support for a thermal power management to control the surface temperature of embedded devices in an unified way; the napi polling can be moved to a kernel thread; and support for non-blocking path lookups. as always, there are many other features, new drivers, improvements and fixes.
|
initial mq development/enablement
|
['core (various)', 'file systems', 'memory management', 'block layer', 'tracing, perf and bpf', 'virtualization', 'cryptography', 'security', 'networking', 'architectures x86 arm risc-v powerpc mips csky s390 pa-risc c6x']
|
['graphics', 'power management', 'storage', 'drivers in the staging area', 'networking', 'audio', 'tablets, touch screens, keyboards, mouses', 'tv tuners, webcams, video capturers', 'universal serial bus', 'serial peripheral interface (spi)', 'watchdog', 'serial', 'cpu frequency scaling', 'device voltage and frequency scaling', 'voltage, current regulators, power capping, power supply', 'real time clock (rtc)', 'pin controllers (pinctrl)', 'multi media card (mmc)', 'memory technology devices (mtd)', 'industrial i/o (iio)', 'multi function devices (mfd)', 'pulse-width modulation (pwm)', 'inter-integrated circuit (i2c + i3c)', 'hardware monitoring (hwmon)', 'general purpose i/o (gpio)', 'leds', 'dma engines', 'cryptography hardware acceleration', 'pci', 'non-transparent bridge (ntb)', 'thunderbolt', 'clock', 'phy ("physical layer" framework)', 'cxl (compute express link)', 'various']
|
['scsi ', 'ibmvfc']
|
['c']
| 1
| 10
| 0
|
--- diff --git a/drivers/scsi/ibmvscsi/ibmvfc.c b/drivers/scsi/ibmvscsi/ibmvfc.c --- a/drivers/scsi/ibmvscsi/ibmvfc.c +++ b/drivers/scsi/ibmvscsi/ibmvfc.c +static irqreturn_t ibmvfc_interrupt_scsi(int irq, void *scrq_instance) +{ + struct ibmvfc_queue *scrq = (struct ibmvfc_queue *)scrq_instance; + + ibmvfc_toggle_scrq_irq(scrq, 0); + ibmvfc_drain_sub_crq(scrq); + + return irq_handled; +} +
|
Storage
|
80a9e8eaed638e6bdb91232ff6717e23a30c1b5a
|
tyrel datwyler brian king brking linux vnet ibm com
|
drivers
|
scsi
|
ibmvscsi
|
scsi: ibmvfc: map/request irq and register sub-crq interrupt handler
|
create an irq mapping for the hw_irq number provided from phyp firmware. request an irq assigned our sub-crq interrupt handler. unmap these irqs at sub-crq teardown.
|
this release allows to map an uid to a different one in a mount; it also adds support for selecting the preemption model at runtime; support for a low-overhead memory error detector designed to be used in production; support for the acrn hypervisor designed for embedded systems; btrfs initial support for zoned devices, subpage blocks sizes and performance improvements; support for eager nfs writes; support for a thermal power management to control the surface temperature of embedded devices in an unified way; the napi polling can be moved to a kernel thread; and support for non-blocking path lookups. as always, there are many other features, new drivers, improvements and fixes.
|
initial mq development/enablement
|
['core (various)', 'file systems', 'memory management', 'block layer', 'tracing, perf and bpf', 'virtualization', 'cryptography', 'security', 'networking', 'architectures x86 arm risc-v powerpc mips csky s390 pa-risc c6x']
|
['graphics', 'power management', 'storage', 'drivers in the staging area', 'networking', 'audio', 'tablets, touch screens, keyboards, mouses', 'tv tuners, webcams, video capturers', 'universal serial bus', 'serial peripheral interface (spi)', 'watchdog', 'serial', 'cpu frequency scaling', 'device voltage and frequency scaling', 'voltage, current regulators, power capping, power supply', 'real time clock (rtc)', 'pin controllers (pinctrl)', 'multi media card (mmc)', 'memory technology devices (mtd)', 'industrial i/o (iio)', 'multi function devices (mfd)', 'pulse-width modulation (pwm)', 'inter-integrated circuit (i2c + i3c)', 'hardware monitoring (hwmon)', 'general purpose i/o (gpio)', 'leds', 'dma engines', 'cryptography hardware acceleration', 'pci', 'non-transparent bridge (ntb)', 'thunderbolt', 'clock', 'phy ("physical layer" framework)', 'cxl (compute express link)', 'various']
|
['scsi ', 'ibmvfc']
|
['c']
| 1
| 25
| 0
|
--- diff --git a/drivers/scsi/ibmvscsi/ibmvfc.c b/drivers/scsi/ibmvscsi/ibmvfc.c --- a/drivers/scsi/ibmvscsi/ibmvfc.c +++ b/drivers/scsi/ibmvscsi/ibmvfc.c + scrq->irq = irq_create_mapping(null, scrq->hw_irq); + + if (!scrq->irq) { + rc = -einval; + dev_err(dev, "error mapping sub-crq[%d] irq ", index); + goto irq_failed; + } + + snprintf(scrq->name, sizeof(scrq->name), "ibmvfc-%x-scsi%d", + vdev->unit_address, index); + rc = request_irq(scrq->irq, ibmvfc_interrupt_scsi, 0, scrq->name, scrq); + + if (rc) { + dev_err(dev, "couldn't register sub-crq[%d] irq ", index); + irq_dispose_mapping(scrq->irq); + goto irq_failed; + } + +irq_failed: + do { + plpar_hcall_norets(h_free_sub_crq, vdev->unit_address, scrq->cookie); + } while (rc == h_busy || h_is_long_busy(rc)); + free_irq(scrq->irq, scrq); + irq_dispose_mapping(scrq->irq); +
|
Storage
|
39e461fddff0c3bd6498c412724c3edf99a9cb9d
|
tyrel datwyler brian king brking linux vnet ibm com
|
drivers
|
scsi
|
ibmvscsi
|
scsi: ibmvfc: implement channel enquiry and setup commands
|
new npiv_enquiry_channel and npiv_setup_channel management datagrams (mads) were defined in a previous patchset. if the client advertises a desire to use channels and the partner vios is channel capable then the client must proceed with channel enquiry to determine the maximum number of channels the vios is capable of providing, and registering subcrqs via channel setup with the vios immediately following npiv login. this handshaking should not be performed for subsequent npiv logins unless the crq connection has been reset.
|
this release allows to map an uid to a different one in a mount; it also adds support for selecting the preemption model at runtime; support for a low-overhead memory error detector designed to be used in production; support for the acrn hypervisor designed for embedded systems; btrfs initial support for zoned devices, subpage blocks sizes and performance improvements; support for eager nfs writes; support for a thermal power management to control the surface temperature of embedded devices in an unified way; the napi polling can be moved to a kernel thread; and support for non-blocking path lookups. as always, there are many other features, new drivers, improvements and fixes.
|
initial mq development/enablement
|
['core (various)', 'file systems', 'memory management', 'block layer', 'tracing, perf and bpf', 'virtualization', 'cryptography', 'security', 'networking', 'architectures x86 arm risc-v powerpc mips csky s390 pa-risc c6x']
|
['graphics', 'power management', 'storage', 'drivers in the staging area', 'networking', 'audio', 'tablets, touch screens, keyboards, mouses', 'tv tuners, webcams, video capturers', 'universal serial bus', 'serial peripheral interface (spi)', 'watchdog', 'serial', 'cpu frequency scaling', 'device voltage and frequency scaling', 'voltage, current regulators, power capping, power supply', 'real time clock (rtc)', 'pin controllers (pinctrl)', 'multi media card (mmc)', 'memory technology devices (mtd)', 'industrial i/o (iio)', 'multi function devices (mfd)', 'pulse-width modulation (pwm)', 'inter-integrated circuit (i2c + i3c)', 'hardware monitoring (hwmon)', 'general purpose i/o (gpio)', 'leds', 'dma engines', 'cryptography hardware acceleration', 'pci', 'non-transparent bridge (ntb)', 'thunderbolt', 'clock', 'phy ("physical layer" framework)', 'cxl (compute express link)', 'various']
|
['scsi ', 'ibmvfc']
|
['h', 'c']
| 2
| 136
| 2
|
--- diff --git a/drivers/scsi/ibmvscsi/ibmvfc.c b/drivers/scsi/ibmvscsi/ibmvfc.c --- a/drivers/scsi/ibmvscsi/ibmvfc.c +++ b/drivers/scsi/ibmvscsi/ibmvfc.c + vhost->do_enquiry = 1; + vhost->using_channels = 0; +static void ibmvfc_channel_setup_done(struct ibmvfc_event *evt) +{ + struct ibmvfc_host *vhost = evt->vhost; + u32 mad_status = be16_to_cpu(evt->xfer_iu->channel_setup.common.status); + int level = ibmvfc_default_log_level; + + ibmvfc_free_event(evt); + + switch (mad_status) { + case ibmvfc_mad_success: + ibmvfc_dbg(vhost, "channel setup succeded "); + vhost->do_enquiry = 0; + break; + case ibmvfc_mad_failed: + level += ibmvfc_retry_host_init(vhost); + ibmvfc_log(vhost, level, "channel setup failed "); + fallthrough; + case ibmvfc_mad_driver_failed: + return; + default: + dev_err(vhost->dev, "invalid channel setup response: 0x%x ", + mad_status); + ibmvfc_link_down(vhost, ibmvfc_link_dead); + return; + } + + ibmvfc_set_host_action(vhost, ibmvfc_host_action_query); + wake_up(&vhost->work_wait_q); +} + +static void ibmvfc_channel_setup(struct ibmvfc_host *vhost) +{ + struct ibmvfc_channel_setup_mad *mad; + struct ibmvfc_channel_setup *setup_buf = vhost->channel_setup_buf; + struct ibmvfc_event *evt = ibmvfc_get_event(&vhost->crq); + + memset(setup_buf, 0, sizeof(*setup_buf)); + setup_buf->flags = cpu_to_be32(ibmvfc_cancel_channels); + + ibmvfc_init_event(evt, ibmvfc_channel_setup_done, ibmvfc_mad_format); + mad = &evt->iu.channel_setup; + memset(mad, 0, sizeof(*mad)); + mad->common.version = cpu_to_be32(1); + mad->common.opcode = cpu_to_be32(ibmvfc_channel_setup); + mad->common.length = cpu_to_be16(sizeof(*mad)); + mad->buffer.va = cpu_to_be64(vhost->channel_setup_dma); + mad->buffer.len = cpu_to_be32(sizeof(*vhost->channel_setup_buf)); + + ibmvfc_set_host_action(vhost, ibmvfc_host_action_init_wait); + + if (!ibmvfc_send_event(evt, vhost, default_timeout)) + ibmvfc_dbg(vhost, "sent channel setup "); + else + ibmvfc_link_down(vhost, ibmvfc_link_down); +} + +static void ibmvfc_channel_enquiry_done(struct ibmvfc_event *evt) +{ + struct ibmvfc_host *vhost = evt->vhost; + struct ibmvfc_channel_enquiry *rsp = &evt->xfer_iu->channel_enquiry; + u32 mad_status = be16_to_cpu(rsp->common.status); + int level = ibmvfc_default_log_level; + + switch (mad_status) { + case ibmvfc_mad_success: + ibmvfc_dbg(vhost, "channel enquiry succeeded "); + vhost->max_vios_scsi_channels = be32_to_cpu(rsp->num_scsi_subq_channels); + ibmvfc_free_event(evt); + break; + case ibmvfc_mad_failed: + level += ibmvfc_retry_host_init(vhost); + ibmvfc_log(vhost, level, "channel enquiry failed "); + fallthrough; + case ibmvfc_mad_driver_failed: + ibmvfc_free_event(evt); + return; + default: + dev_err(vhost->dev, "invalid channel enquiry response: 0x%x ", + mad_status); + ibmvfc_link_down(vhost, ibmvfc_link_dead); + ibmvfc_free_event(evt); + return; + } + + ibmvfc_channel_setup(vhost); +} + +static void ibmvfc_channel_enquiry(struct ibmvfc_host *vhost) +{ + struct ibmvfc_channel_enquiry *mad; + struct ibmvfc_event *evt = ibmvfc_get_event(&vhost->crq); + + ibmvfc_init_event(evt, ibmvfc_channel_enquiry_done, ibmvfc_mad_format); + mad = &evt->iu.channel_enquiry; + memset(mad, 0, sizeof(*mad)); + mad->common.version = cpu_to_be32(1); + mad->common.opcode = cpu_to_be32(ibmvfc_channel_enquiry); + mad->common.length = cpu_to_be16(sizeof(*mad)); + + if (ibmvfc_mig_no_sub_to_crq) + mad->flags |= cpu_to_be32(ibmvfc_no_channels_to_crq_support); + if (ibmvfc_mig_no_n_to_m) + mad->flags |= cpu_to_be32(ibmvfc_no_n_to_m_channels_support); + + ibmvfc_set_host_action(vhost, ibmvfc_host_action_init_wait); + + if (!ibmvfc_send_event(evt, vhost, default_timeout)) + ibmvfc_dbg(vhost, "send channel enquiry "); + else + ibmvfc_link_down(vhost, ibmvfc_link_dead); +} + - ibmvfc_set_host_action(vhost, ibmvfc_host_action_query); - wake_up(&vhost->work_wait_q); + + if (ibmvfc_check_caps(vhost, ibmvfc_can_support_channels) && vhost->do_enquiry) { + ibmvfc_channel_enquiry(vhost); + } else { + vhost->do_enquiry = 0; + ibmvfc_set_host_action(vhost, ibmvfc_host_action_query); + wake_up(&vhost->work_wait_q); + } + vhost->channel_setup_buf = dma_alloc_coherent(dev, sizeof(*vhost->channel_setup_buf), + &vhost->channel_setup_dma, + gfp_kernel); + + if (!vhost->channel_setup_buf) { + dev_err(dev, "couldn't allocate channel setup buffer "); + goto free_tgt_pool; + } + +free_tgt_pool: + mempool_destroy(vhost->tgt_pool); diff --git a/drivers/scsi/ibmvscsi/ibmvfc.h b/drivers/scsi/ibmvscsi/ibmvfc.h --- a/drivers/scsi/ibmvscsi/ibmvfc.h +++ b/drivers/scsi/ibmvscsi/ibmvfc.h + struct ibmvfc_channel_setup *channel_setup_buf; + dma_addr_t channel_setup_dma; + int max_vios_scsi_channels;
|
Storage
|
e95eef3fc0bcb3c5a3145c583f0d177f02381195
|
tyrel datwyler
|
drivers
|
scsi
|
ibmvscsi
|
scsi: ibmvfc: advertise client support for using hardware channels
|
previous patches have plumbed the necessary sub-crq interface and channel negotiation mads to fully channelize via hardware backed queues.
|
this release allows to map an uid to a different one in a mount; it also adds support for selecting the preemption model at runtime; support for a low-overhead memory error detector designed to be used in production; support for the acrn hypervisor designed for embedded systems; btrfs initial support for zoned devices, subpage blocks sizes and performance improvements; support for eager nfs writes; support for a thermal power management to control the surface temperature of embedded devices in an unified way; the napi polling can be moved to a kernel thread; and support for non-blocking path lookups. as always, there are many other features, new drivers, improvements and fixes.
|
initial mq development/enablement
|
['core (various)', 'file systems', 'memory management', 'block layer', 'tracing, perf and bpf', 'virtualization', 'cryptography', 'security', 'networking', 'architectures x86 arm risc-v powerpc mips csky s390 pa-risc c6x']
|
['graphics', 'power management', 'storage', 'drivers in the staging area', 'networking', 'audio', 'tablets, touch screens, keyboards, mouses', 'tv tuners, webcams, video capturers', 'universal serial bus', 'serial peripheral interface (spi)', 'watchdog', 'serial', 'cpu frequency scaling', 'device voltage and frequency scaling', 'voltage, current regulators, power capping, power supply', 'real time clock (rtc)', 'pin controllers (pinctrl)', 'multi media card (mmc)', 'memory technology devices (mtd)', 'industrial i/o (iio)', 'multi function devices (mfd)', 'pulse-width modulation (pwm)', 'inter-integrated circuit (i2c + i3c)', 'hardware monitoring (hwmon)', 'general purpose i/o (gpio)', 'leds', 'dma engines', 'cryptography hardware acceleration', 'pci', 'non-transparent bridge (ntb)', 'thunderbolt', 'clock', 'phy ("physical layer" framework)', 'cxl (compute express link)', 'various']
|
['scsi ', 'ibmvfc']
|
['c']
| 1
| 4
| 0
|
--- diff --git a/drivers/scsi/ibmvscsi/ibmvfc.c b/drivers/scsi/ibmvscsi/ibmvfc.c --- a/drivers/scsi/ibmvscsi/ibmvfc.c +++ b/drivers/scsi/ibmvscsi/ibmvfc.c + + if (vhost->mq_enabled || vhost->using_channels) + login_info->capabilities |= cpu_to_be64(ibmvfc_can_use_channels); +
|
Storage
|
c53408baa50297ec29641a973ce78856900d910a
|
tyrel datwyler
|
drivers
|
scsi
|
ibmvscsi
|
scsi: ibmvfc: set and track hw queue in ibmvfc_event struct
|
extract the hwq id from a scsi command and store it in the ibmvfc_event structure to identify which sub-crq to send the command down when channels are being utilized.
|
this release allows to map an uid to a different one in a mount; it also adds support for selecting the preemption model at runtime; support for a low-overhead memory error detector designed to be used in production; support for the acrn hypervisor designed for embedded systems; btrfs initial support for zoned devices, subpage blocks sizes and performance improvements; support for eager nfs writes; support for a thermal power management to control the surface temperature of embedded devices in an unified way; the napi polling can be moved to a kernel thread; and support for non-blocking path lookups. as always, there are many other features, new drivers, improvements and fixes.
|
initial mq development/enablement
|
['core (various)', 'file systems', 'memory management', 'block layer', 'tracing, perf and bpf', 'virtualization', 'cryptography', 'security', 'networking', 'architectures x86 arm risc-v powerpc mips csky s390 pa-risc c6x']
|
['graphics', 'power management', 'storage', 'drivers in the staging area', 'networking', 'audio', 'tablets, touch screens, keyboards, mouses', 'tv tuners, webcams, video capturers', 'universal serial bus', 'serial peripheral interface (spi)', 'watchdog', 'serial', 'cpu frequency scaling', 'device voltage and frequency scaling', 'voltage, current regulators, power capping, power supply', 'real time clock (rtc)', 'pin controllers (pinctrl)', 'multi media card (mmc)', 'memory technology devices (mtd)', 'industrial i/o (iio)', 'multi function devices (mfd)', 'pulse-width modulation (pwm)', 'inter-integrated circuit (i2c + i3c)', 'hardware monitoring (hwmon)', 'general purpose i/o (gpio)', 'leds', 'dma engines', 'cryptography hardware acceleration', 'pci', 'non-transparent bridge (ntb)', 'thunderbolt', 'clock', 'phy ("physical layer" framework)', 'cxl (compute express link)', 'various']
|
['scsi ', 'ibmvfc']
|
['h', 'c']
| 2
| 6
| 0
|
--- diff --git a/drivers/scsi/ibmvscsi/ibmvfc.c b/drivers/scsi/ibmvscsi/ibmvfc.c --- a/drivers/scsi/ibmvscsi/ibmvfc.c +++ b/drivers/scsi/ibmvscsi/ibmvfc.c + evt->hwq = 0; + u32 tag_and_hwq = blk_mq_unique_tag(cmnd->request); + u16 hwq = blk_mq_unique_tag_to_hwq(tag_and_hwq); + if (vhost->using_channels) + evt->hwq = hwq % vhost->scsi_scrqs.active_queues; diff --git a/drivers/scsi/ibmvscsi/ibmvfc.h b/drivers/scsi/ibmvscsi/ibmvfc.h --- a/drivers/scsi/ibmvscsi/ibmvfc.h +++ b/drivers/scsi/ibmvscsi/ibmvfc.h + u16 hwq;
|
Storage
|
cb72477be7290ce81ad81838039e106c194ab16f
|
tyrel datwyler brian king brking linux vnet ibm com
|
drivers
|
scsi
|
ibmvscsi
|
scsi: ibmvfc: send commands down hw sub-crq when channelized
|
when the client has negotiated the use of channels all vfcframes are required to go down a sub-crq channel or it is a protocoal violation. if the adapter state is channelized submit vfcframes to the appropriate sub-crq via the h_send_sub_crq() helper.
|
this release allows to map an uid to a different one in a mount; it also adds support for selecting the preemption model at runtime; support for a low-overhead memory error detector designed to be used in production; support for the acrn hypervisor designed for embedded systems; btrfs initial support for zoned devices, subpage blocks sizes and performance improvements; support for eager nfs writes; support for a thermal power management to control the surface temperature of embedded devices in an unified way; the napi polling can be moved to a kernel thread; and support for non-blocking path lookups. as always, there are many other features, new drivers, improvements and fixes.
|
initial mq development/enablement
|
['core (various)', 'file systems', 'memory management', 'block layer', 'tracing, perf and bpf', 'virtualization', 'cryptography', 'security', 'networking', 'architectures x86 arm risc-v powerpc mips csky s390 pa-risc c6x']
|
['graphics', 'power management', 'storage', 'drivers in the staging area', 'networking', 'audio', 'tablets, touch screens, keyboards, mouses', 'tv tuners, webcams, video capturers', 'universal serial bus', 'serial peripheral interface (spi)', 'watchdog', 'serial', 'cpu frequency scaling', 'device voltage and frequency scaling', 'voltage, current regulators, power capping, power supply', 'real time clock (rtc)', 'pin controllers (pinctrl)', 'multi media card (mmc)', 'memory technology devices (mtd)', 'industrial i/o (iio)', 'multi function devices (mfd)', 'pulse-width modulation (pwm)', 'inter-integrated circuit (i2c + i3c)', 'hardware monitoring (hwmon)', 'general purpose i/o (gpio)', 'leds', 'dma engines', 'cryptography hardware acceleration', 'pci', 'non-transparent bridge (ntb)', 'thunderbolt', 'clock', 'phy ("physical layer" framework)', 'cxl (compute express link)', 'various']
|
['scsi ', 'ibmvfc']
|
['c']
| 1
| 33
| 6
|
--- diff --git a/drivers/scsi/ibmvscsi/ibmvfc.c b/drivers/scsi/ibmvscsi/ibmvfc.c --- a/drivers/scsi/ibmvscsi/ibmvfc.c +++ b/drivers/scsi/ibmvscsi/ibmvfc.c +static int ibmvfc_send_sub_crq(struct ibmvfc_host *vhost, u64 cookie, u64 word1, + u64 word2, u64 word3, u64 word4) +{ + struct vio_dev *vdev = to_vio_dev(vhost->dev); + + return plpar_hcall_norets(h_send_sub_crq, vdev->unit_address, cookie, + word1, word2, word3, word4); +} + - if ((rc = ibmvfc_send_crq(vhost, be64_to_cpu(crq_as_u64[0]), - be64_to_cpu(crq_as_u64[1])))) { + if (evt->queue->fmt == ibmvfc_sub_crq_fmt) + rc = ibmvfc_send_sub_crq(vhost, + evt->queue->vios_cookie, + be64_to_cpu(crq_as_u64[0]), + be64_to_cpu(crq_as_u64[1]), + 0, 0); + else + rc = ibmvfc_send_crq(vhost, be64_to_cpu(crq_as_u64[0]), + be64_to_cpu(crq_as_u64[1])); + + if (rc) { + u16 scsi_channel; - evt = ibmvfc_get_event(&vhost->crq); + if (vhost->using_channels) { + scsi_channel = hwq % vhost->scsi_scrqs.active_queues; + evt = ibmvfc_get_event(&vhost->scsi_scrqs.scrqs[scsi_channel]); + evt->hwq = hwq % vhost->scsi_scrqs.active_queues; + } else + evt = ibmvfc_get_event(&vhost->crq); + - if (vhost->using_channels) - evt->hwq = hwq % vhost->scsi_scrqs.active_queues; - evt = ibmvfc_get_event(&vhost->crq); + if (vhost->using_channels) + evt = ibmvfc_get_event(&vhost->scsi_scrqs.scrqs[0]); + else + evt = ibmvfc_get_event(&vhost->crq); +
|
Storage
|
31750fbd7b6decc81d7736f236ea8be0f397df08
|
tyrel datwyler brian king brking linux vnet ibm com
|
drivers
|
scsi
|
ibmvscsi
|
scsi: ibmvfc: register sub-crq handles with vios during channel setup
|
if the ibmvfc client adapter requests channels it must submit a number of sub-crq handles matching the number of channels being requested. the vios in its response will overwrite the actual number of channel resources allocated which may be less than what was requested. the client then must store the vios sub-crq handle for each queue. this vios handle is needed as a parameter with h_send_sub_crq().
|
this release allows to map an uid to a different one in a mount; it also adds support for selecting the preemption model at runtime; support for a low-overhead memory error detector designed to be used in production; support for the acrn hypervisor designed for embedded systems; btrfs initial support for zoned devices, subpage blocks sizes and performance improvements; support for eager nfs writes; support for a thermal power management to control the surface temperature of embedded devices in an unified way; the napi polling can be moved to a kernel thread; and support for non-blocking path lookups. as always, there are many other features, new drivers, improvements and fixes.
|
initial mq development/enablement
|
['core (various)', 'file systems', 'memory management', 'block layer', 'tracing, perf and bpf', 'virtualization', 'cryptography', 'security', 'networking', 'architectures x86 arm risc-v powerpc mips csky s390 pa-risc c6x']
|
['graphics', 'power management', 'storage', 'drivers in the staging area', 'networking', 'audio', 'tablets, touch screens, keyboards, mouses', 'tv tuners, webcams, video capturers', 'universal serial bus', 'serial peripheral interface (spi)', 'watchdog', 'serial', 'cpu frequency scaling', 'device voltage and frequency scaling', 'voltage, current regulators, power capping, power supply', 'real time clock (rtc)', 'pin controllers (pinctrl)', 'multi media card (mmc)', 'memory technology devices (mtd)', 'industrial i/o (iio)', 'multi function devices (mfd)', 'pulse-width modulation (pwm)', 'inter-integrated circuit (i2c + i3c)', 'hardware monitoring (hwmon)', 'general purpose i/o (gpio)', 'leds', 'dma engines', 'cryptography hardware acceleration', 'pci', 'non-transparent bridge (ntb)', 'thunderbolt', 'clock', 'phy ("physical layer" framework)', 'cxl (compute express link)', 'various']
|
['scsi ', 'ibmvfc']
|
['c']
| 1
| 31
| 1
|
--- diff --git a/drivers/scsi/ibmvscsi/ibmvfc.c b/drivers/scsi/ibmvscsi/ibmvfc.c --- a/drivers/scsi/ibmvscsi/ibmvfc.c +++ b/drivers/scsi/ibmvscsi/ibmvfc.c + struct ibmvfc_channel_setup *setup = vhost->channel_setup_buf; + struct ibmvfc_scsi_channels *scrqs = &vhost->scsi_scrqs; + int flags, active_queues, i; + flags = be32_to_cpu(setup->flags); + active_queues = be32_to_cpu(setup->num_scsi_subq_channels); + scrqs->active_queues = active_queues; + + if (flags & ibmvfc_channels_canceled) { + ibmvfc_dbg(vhost, "channels canceled "); + vhost->using_channels = 0; + } else { + if (active_queues) + vhost->using_channels = 1; + for (i = 0; i < active_queues; i++) + scrqs->scrqs[i].vios_cookie = + be64_to_cpu(setup->channel_handles[i]); + + ibmvfc_dbg(vhost, "using %u channels ", + vhost->scsi_scrqs.active_queues); + } + struct ibmvfc_scsi_channels *scrqs = &vhost->scsi_scrqs; + unsigned int num_channels = + min(vhost->client_scsi_channels, vhost->max_vios_scsi_channels); + int i; - setup_buf->flags = cpu_to_be32(ibmvfc_cancel_channels); + if (num_channels == 0) + setup_buf->flags = cpu_to_be32(ibmvfc_cancel_channels); + else { + setup_buf->num_scsi_subq_channels = cpu_to_be32(num_channels); + for (i = 0; i < num_channels; i++) + setup_buf->channel_handles[i] = cpu_to_be64(scrqs->scrqs[i].cookie); + }
|
Storage
|
b88a5d9b7f56e4c53d3a0d47d50a954461a1a72b
|
tyrel datwyler brian king brking linux vnet ibm com
|
drivers
|
scsi
|
ibmvscsi
|
scsi: ibmvfc: add cancel mad initialization helper
|
add a helper routine for initializing a cancel mad. this will be useful for a channelized client that needs to send cancel commands down every channel commands were sent for a particular lun.
|
this release allows to map an uid to a different one in a mount; it also adds support for selecting the preemption model at runtime; support for a low-overhead memory error detector designed to be used in production; support for the acrn hypervisor designed for embedded systems; btrfs initial support for zoned devices, subpage blocks sizes and performance improvements; support for eager nfs writes; support for a thermal power management to control the surface temperature of embedded devices in an unified way; the napi polling can be moved to a kernel thread; and support for non-blocking path lookups. as always, there are many other features, new drivers, improvements and fixes.
|
initial mq development/enablement
|
['core (various)', 'file systems', 'memory management', 'block layer', 'tracing, perf and bpf', 'virtualization', 'cryptography', 'security', 'networking', 'architectures x86 arm risc-v powerpc mips csky s390 pa-risc c6x']
|
['graphics', 'power management', 'storage', 'drivers in the staging area', 'networking', 'audio', 'tablets, touch screens, keyboards, mouses', 'tv tuners, webcams, video capturers', 'universal serial bus', 'serial peripheral interface (spi)', 'watchdog', 'serial', 'cpu frequency scaling', 'device voltage and frequency scaling', 'voltage, current regulators, power capping, power supply', 'real time clock (rtc)', 'pin controllers (pinctrl)', 'multi media card (mmc)', 'memory technology devices (mtd)', 'industrial i/o (iio)', 'multi function devices (mfd)', 'pulse-width modulation (pwm)', 'inter-integrated circuit (i2c + i3c)', 'hardware monitoring (hwmon)', 'general purpose i/o (gpio)', 'leds', 'dma engines', 'cryptography hardware acceleration', 'pci', 'non-transparent bridge (ntb)', 'thunderbolt', 'clock', 'phy ("physical layer" framework)', 'cxl (compute express link)', 'various']
|
['scsi ', 'ibmvfc']
|
['c']
| 1
| 40
| 28
|
--- diff --git a/drivers/scsi/ibmvscsi/ibmvfc.c b/drivers/scsi/ibmvscsi/ibmvfc.c --- a/drivers/scsi/ibmvscsi/ibmvfc.c +++ b/drivers/scsi/ibmvscsi/ibmvfc.c +static struct ibmvfc_event *ibmvfc_init_tmf(struct ibmvfc_queue *queue, + struct scsi_device *sdev, + int type) +{ + struct ibmvfc_host *vhost = shost_priv(sdev->host); + struct scsi_target *starget = scsi_target(sdev); + struct fc_rport *rport = starget_to_rport(starget); + struct ibmvfc_event *evt; + struct ibmvfc_tmf *tmf; + + evt = ibmvfc_get_event(queue); + ibmvfc_init_event(evt, ibmvfc_sync_completion, ibmvfc_mad_format); + + tmf = &evt->iu.tmf; + memset(tmf, 0, sizeof(*tmf)); + if (ibmvfc_check_caps(vhost, ibmvfc_handle_vf_wwpn)) { + tmf->common.version = cpu_to_be32(2); + tmf->target_wwpn = cpu_to_be64(rport->port_name); + } else { + tmf->common.version = cpu_to_be32(1); + } + tmf->common.opcode = cpu_to_be32(ibmvfc_tmf_mad); + tmf->common.length = cpu_to_be16(sizeof(*tmf)); + tmf->scsi_id = cpu_to_be64(rport->port_id); + int_to_scsilun(sdev->lun, &tmf->lun); + if (!ibmvfc_check_caps(vhost, ibmvfc_can_suppress_abts)) + type &= ~ibmvfc_tmf_suppress_abts; + if (vhost->state == ibmvfc_active) + tmf->flags = cpu_to_be32((type | ibmvfc_tmf_lua_valid)); + else + tmf->flags = cpu_to_be32(((type & ibmvfc_tmf_suppress_abts) | ibmvfc_tmf_lua_valid)); + tmf->cancel_key = cpu_to_be32((unsigned long)sdev->hostdata); + tmf->my_cancel_key = cpu_to_be32((unsigned long)starget->hostdata); + + init_completion(&evt->comp); + + return evt; +} + - struct scsi_target *starget = scsi_target(sdev); - struct fc_rport *rport = starget_to_rport(starget); - struct ibmvfc_tmf *tmf; - evt = ibmvfc_get_event(&vhost->crq); - ibmvfc_init_event(evt, ibmvfc_sync_completion, ibmvfc_mad_format); - - tmf = &evt->iu.tmf; - memset(tmf, 0, sizeof(*tmf)); - if (ibmvfc_check_caps(vhost, ibmvfc_handle_vf_wwpn)) { - tmf->common.version = cpu_to_be32(2); - tmf->target_wwpn = cpu_to_be64(rport->port_name); - } else { - tmf->common.version = cpu_to_be32(1); - } - tmf->common.opcode = cpu_to_be32(ibmvfc_tmf_mad); - tmf->common.length = cpu_to_be16(sizeof(*tmf)); - tmf->scsi_id = cpu_to_be64(rport->port_id); - int_to_scsilun(sdev->lun, &tmf->lun); - if (!ibmvfc_check_caps(vhost, ibmvfc_can_suppress_abts)) - type &= ~ibmvfc_tmf_suppress_abts; - if (vhost->state == ibmvfc_active) - tmf->flags = cpu_to_be32((type | ibmvfc_tmf_lua_valid)); - else - tmf->flags = cpu_to_be32(((type & ibmvfc_tmf_suppress_abts) | ibmvfc_tmf_lua_valid)); - tmf->cancel_key = cpu_to_be32((unsigned long)sdev->hostdata); - tmf->my_cancel_key = cpu_to_be32((unsigned long)starget->hostdata); - + evt = ibmvfc_init_tmf(&vhost->crq, sdev, type); - init_completion(&evt->comp);
|
Storage
|
a61236da7f9cfb8be7392d6396553cd7c263831f
|
tyrel datwyler brian king brking linux vnet ibm com
|
drivers
|
scsi
|
ibmvscsi
|
scsi: ibmvfc: send cancel mad down each hw scsi channel
|
in general the client needs to send cancel mads and task management commands down the same channel as the command(s) intended to cancel or abort. the client assigns cancel keys per lun and thus must send a cancel down each channel commands were submitted for that lun. further, the client then must wait for those cancel completions prior to submitting a lun reset or abort task set.
|
this release allows to map an uid to a different one in a mount; it also adds support for selecting the preemption model at runtime; support for a low-overhead memory error detector designed to be used in production; support for the acrn hypervisor designed for embedded systems; btrfs initial support for zoned devices, subpage blocks sizes and performance improvements; support for eager nfs writes; support for a thermal power management to control the surface temperature of embedded devices in an unified way; the napi polling can be moved to a kernel thread; and support for non-blocking path lookups. as always, there are many other features, new drivers, improvements and fixes.
|
initial mq development/enablement
|
['core (various)', 'file systems', 'memory management', 'block layer', 'tracing, perf and bpf', 'virtualization', 'cryptography', 'security', 'networking', 'architectures x86 arm risc-v powerpc mips csky s390 pa-risc c6x']
|
['graphics', 'power management', 'storage', 'drivers in the staging area', 'networking', 'audio', 'tablets, touch screens, keyboards, mouses', 'tv tuners, webcams, video capturers', 'universal serial bus', 'serial peripheral interface (spi)', 'watchdog', 'serial', 'cpu frequency scaling', 'device voltage and frequency scaling', 'voltage, current regulators, power capping, power supply', 'real time clock (rtc)', 'pin controllers (pinctrl)', 'multi media card (mmc)', 'memory technology devices (mtd)', 'industrial i/o (iio)', 'multi function devices (mfd)', 'pulse-width modulation (pwm)', 'inter-integrated circuit (i2c + i3c)', 'hardware monitoring (hwmon)', 'general purpose i/o (gpio)', 'leds', 'dma engines', 'cryptography hardware acceleration', 'pci', 'non-transparent bridge (ntb)', 'thunderbolt', 'clock', 'phy ("physical layer" framework)', 'cxl (compute express link)', 'various']
|
['scsi ', 'ibmvfc']
|
['h', 'c']
| 2
| 100
| 12
|
--- diff --git a/drivers/scsi/ibmvscsi/ibmvfc.c b/drivers/scsi/ibmvscsi/ibmvfc.c --- a/drivers/scsi/ibmvscsi/ibmvfc.c +++ b/drivers/scsi/ibmvscsi/ibmvfc.c -/** - * ibmvfc_cancel_all - cancel all outstanding commands to the device - * @sdev: scsi device to cancel commands - * @type: type of error recovery being performed - * - * this sends a cancel to the vios for the specified device. this does - * not send any abort to the actual device. that must be done separately. - * - * returns: - * 0 on success / other on failure - **/ -static int ibmvfc_cancel_all(struct scsi_device *sdev, int type) +static int ibmvfc_cancel_all_mq(struct scsi_device *sdev, int type) +{ + struct ibmvfc_host *vhost = shost_priv(sdev->host); + struct ibmvfc_event *evt, *found_evt, *temp; + struct ibmvfc_queue *queues = vhost->scsi_scrqs.scrqs; + unsigned long flags; + int num_hwq, i; + int fail = 0; + list_head(cancelq); + u16 status; + + enter; + spin_lock_irqsave(vhost->host->host_lock, flags); + num_hwq = vhost->scsi_scrqs.active_queues; + for (i = 0; i < num_hwq; i++) { + spin_lock(queues[i].q_lock); + spin_lock(&queues[i].l_lock); + found_evt = null; + list_for_each_entry(evt, &queues[i].sent, queue_list) { + if (evt->cmnd && evt->cmnd->device == sdev) { + found_evt = evt; + break; + } + } + spin_unlock(&queues[i].l_lock); + + if (found_evt && vhost->logged_in) { + evt = ibmvfc_init_tmf(&queues[i], sdev, type); + evt->sync_iu = &queues[i].cancel_rsp; + ibmvfc_send_event(evt, vhost, default_timeout); + list_add_tail(&evt->cancel, &cancelq); + } + + spin_unlock(queues[i].q_lock); + } + spin_unlock_irqrestore(vhost->host->host_lock, flags); + + if (list_empty(&cancelq)) { + if (vhost->log_level > ibmvfc_default_log_level) + sdev_printk(kern_info, sdev, "no events found to cancel "); + return 0; + } + + sdev_printk(kern_info, sdev, "cancelling outstanding commands. "); + + list_for_each_entry_safe(evt, temp, &cancelq, cancel) { + wait_for_completion(&evt->comp); + status = be16_to_cpu(evt->queue->cancel_rsp.mad_common.status); + list_del(&evt->cancel); + ibmvfc_free_event(evt); + + if (status != ibmvfc_mad_success) { + sdev_printk(kern_warning, sdev, "cancel failed with rc=%x ", status); + switch (status) { + case ibmvfc_mad_driver_failed: + case ibmvfc_mad_crq_error: + /* host adapter most likely going through reset, return success to + * the caller will wait for the command being cancelled to get returned + */ + break; + default: + fail = 1; + break; + } + } + } + + if (fail) + return -eio; + + sdev_printk(kern_info, sdev, "successfully cancelled outstanding commands "); + leave; + return 0; +} + +static int ibmvfc_cancel_all_sq(struct scsi_device *sdev, int type) +/** + * ibmvfc_cancel_all - cancel all outstanding commands to the device + * @sdev: scsi device to cancel commands + * @type: type of error recovery being performed + * + * this sends a cancel to the vios for the specified device. this does + * not send any abort to the actual device. that must be done separately. + * + * returns: + * 0 on success / other on failure + **/ +static int ibmvfc_cancel_all(struct scsi_device *sdev, int type) +{ + struct ibmvfc_host *vhost = shost_priv(sdev->host); + + if (vhost->mq_enabled && vhost->using_channels) + return ibmvfc_cancel_all_mq(sdev, type); + else + return ibmvfc_cancel_all_sq(sdev, type); +} + diff --git a/drivers/scsi/ibmvscsi/ibmvfc.h b/drivers/scsi/ibmvscsi/ibmvfc.h --- a/drivers/scsi/ibmvscsi/ibmvfc.h +++ b/drivers/scsi/ibmvscsi/ibmvfc.h + struct list_head cancel; + union ibmvfc_iu cancel_rsp; +
|
Storage
|
a835f386f9709504a99346be011da92b5ea905e5
|
tyrel datwyler
|
drivers
|
scsi
|
ibmvscsi
|
scsi: ibmvfc: purge scsi channels after transport loss/reset
|
grab the queue and list lock for each sub-crq and add any uncompleted events to the host purge list.
|
this release allows to map an uid to a different one in a mount; it also adds support for selecting the preemption model at runtime; support for a low-overhead memory error detector designed to be used in production; support for the acrn hypervisor designed for embedded systems; btrfs initial support for zoned devices, subpage blocks sizes and performance improvements; support for eager nfs writes; support for a thermal power management to control the surface temperature of embedded devices in an unified way; the napi polling can be moved to a kernel thread; and support for non-blocking path lookups. as always, there are many other features, new drivers, improvements and fixes.
|
initial mq development/enablement
|
['core (various)', 'file systems', 'memory management', 'block layer', 'tracing, perf and bpf', 'virtualization', 'cryptography', 'security', 'networking', 'architectures x86 arm risc-v powerpc mips csky s390 pa-risc c6x']
|
['graphics', 'power management', 'storage', 'drivers in the staging area', 'networking', 'audio', 'tablets, touch screens, keyboards, mouses', 'tv tuners, webcams, video capturers', 'universal serial bus', 'serial peripheral interface (spi)', 'watchdog', 'serial', 'cpu frequency scaling', 'device voltage and frequency scaling', 'voltage, current regulators, power capping, power supply', 'real time clock (rtc)', 'pin controllers (pinctrl)', 'multi media card (mmc)', 'memory technology devices (mtd)', 'industrial i/o (iio)', 'multi function devices (mfd)', 'pulse-width modulation (pwm)', 'inter-integrated circuit (i2c + i3c)', 'hardware monitoring (hwmon)', 'general purpose i/o (gpio)', 'leds', 'dma engines', 'cryptography hardware acceleration', 'pci', 'non-transparent bridge (ntb)', 'thunderbolt', 'clock', 'phy ("physical layer" framework)', 'cxl (compute express link)', 'various']
|
['scsi ', 'ibmvfc']
|
['c']
| 1
| 16
| 0
|
--- diff --git a/drivers/scsi/ibmvscsi/ibmvfc.c b/drivers/scsi/ibmvscsi/ibmvfc.c --- a/drivers/scsi/ibmvscsi/ibmvfc.c +++ b/drivers/scsi/ibmvscsi/ibmvfc.c + struct ibmvfc_queue *queues = vhost->scsi_scrqs.scrqs; + int hwqs = 0; + int i; + + if (vhost->using_channels) + hwqs = vhost->scsi_scrqs.active_queues; + + for (i = 0; i < hwqs; i++) { + spin_lock_irqsave(queues[i].q_lock, flags); + spin_lock(&queues[i].l_lock); + list_for_each_entry_safe(evt, pos, &queues[i].sent, queue_list) + ibmvfc_fail_request(evt, error_code); + list_splice_init(&queues[i].sent, &vhost->purge); + spin_unlock(&queues[i].l_lock); + spin_unlock_irqrestore(queues[i].q_lock, flags); + }
|
Storage
|
7eb3ccd884aec8591f78b5a5b39b6783db681c99
|
tyrel datwyler brian king brking linux vnet ibm com
|
drivers
|
scsi
|
ibmvscsi
|
scsi: ibmvfc: enable mq and set reasonable defaults
|
turn on mq by default and set sane values for the upper limit on hw queues for the scsi host, and number of hw scsi channels to request from the partner vios.
|
this release allows to map an uid to a different one in a mount; it also adds support for selecting the preemption model at runtime; support for a low-overhead memory error detector designed to be used in production; support for the acrn hypervisor designed for embedded systems; btrfs initial support for zoned devices, subpage blocks sizes and performance improvements; support for eager nfs writes; support for a thermal power management to control the surface temperature of embedded devices in an unified way; the napi polling can be moved to a kernel thread; and support for non-blocking path lookups. as always, there are many other features, new drivers, improvements and fixes.
|
initial mq development/enablement
|
['core (various)', 'file systems', 'memory management', 'block layer', 'tracing, perf and bpf', 'virtualization', 'cryptography', 'security', 'networking', 'architectures x86 arm risc-v powerpc mips csky s390 pa-risc c6x']
|
['graphics', 'power management', 'storage', 'drivers in the staging area', 'networking', 'audio', 'tablets, touch screens, keyboards, mouses', 'tv tuners, webcams, video capturers', 'universal serial bus', 'serial peripheral interface (spi)', 'watchdog', 'serial', 'cpu frequency scaling', 'device voltage and frequency scaling', 'voltage, current regulators, power capping, power supply', 'real time clock (rtc)', 'pin controllers (pinctrl)', 'multi media card (mmc)', 'memory technology devices (mtd)', 'industrial i/o (iio)', 'multi function devices (mfd)', 'pulse-width modulation (pwm)', 'inter-integrated circuit (i2c + i3c)', 'hardware monitoring (hwmon)', 'general purpose i/o (gpio)', 'leds', 'dma engines', 'cryptography hardware acceleration', 'pci', 'non-transparent bridge (ntb)', 'thunderbolt', 'clock', 'phy ("physical layer" framework)', 'cxl (compute express link)', 'various']
|
['scsi ', 'ibmvfc']
|
['h']
| 1
| 3
| 3
|
--- diff --git a/drivers/scsi/ibmvscsi/ibmvfc.h b/drivers/scsi/ibmvscsi/ibmvfc.h --- a/drivers/scsi/ibmvscsi/ibmvfc.h +++ b/drivers/scsi/ibmvscsi/ibmvfc.h -#define ibmvfc_mq 0 -#define ibmvfc_scsi_channels 0 -#define ibmvfc_scsi_hw_queues 1 +#define ibmvfc_mq 1 +#define ibmvfc_scsi_channels 8 +#define ibmvfc_scsi_hw_queues 8
|
Storage
|
9000cb998bcfcf8cee253e37180ee87c292e9c18
|
tyrel datwyler brian king brking linux vnet ibm com
|
drivers
|
scsi
|
ibmvscsi
|
scsi: ibmvfc: provide modules parameters for mq settings
|
add the various module parameter toggles for adjusting the mq characteristics at boot/load time as well as a device attribute for changing the client scsi channel request amount.
|
this release allows to map an uid to a different one in a mount; it also adds support for selecting the preemption model at runtime; support for a low-overhead memory error detector designed to be used in production; support for the acrn hypervisor designed for embedded systems; btrfs initial support for zoned devices, subpage blocks sizes and performance improvements; support for eager nfs writes; support for a thermal power management to control the surface temperature of embedded devices in an unified way; the napi polling can be moved to a kernel thread; and support for non-blocking path lookups. as always, there are many other features, new drivers, improvements and fixes.
|
initial mq development/enablement
|
['core (various)', 'file systems', 'memory management', 'block layer', 'tracing, perf and bpf', 'virtualization', 'cryptography', 'security', 'networking', 'architectures x86 arm risc-v powerpc mips csky s390 pa-risc c6x']
|
['graphics', 'power management', 'storage', 'drivers in the staging area', 'networking', 'audio', 'tablets, touch screens, keyboards, mouses', 'tv tuners, webcams, video capturers', 'universal serial bus', 'serial peripheral interface (spi)', 'watchdog', 'serial', 'cpu frequency scaling', 'device voltage and frequency scaling', 'voltage, current regulators, power capping, power supply', 'real time clock (rtc)', 'pin controllers (pinctrl)', 'multi media card (mmc)', 'memory technology devices (mtd)', 'industrial i/o (iio)', 'multi function devices (mfd)', 'pulse-width modulation (pwm)', 'inter-integrated circuit (i2c + i3c)', 'hardware monitoring (hwmon)', 'general purpose i/o (gpio)', 'leds', 'dma engines', 'cryptography hardware acceleration', 'pci', 'non-transparent bridge (ntb)', 'thunderbolt', 'clock', 'phy ("physical layer" framework)', 'cxl (compute express link)', 'various']
|
['scsi ', 'ibmvfc']
|
['h', 'c']
| 2
| 67
| 9
|
--- diff --git a/drivers/scsi/ibmvscsi/ibmvfc.c b/drivers/scsi/ibmvscsi/ibmvfc.c --- a/drivers/scsi/ibmvscsi/ibmvfc.c +++ b/drivers/scsi/ibmvscsi/ibmvfc.c +static unsigned int mq_enabled = ibmvfc_mq; +static unsigned int nr_scsi_hw_queues = ibmvfc_scsi_hw_queues; +static unsigned int nr_scsi_channels = ibmvfc_scsi_channels; +static unsigned int mig_channels_only = ibmvfc_mig_no_sub_to_crq; +static unsigned int mig_no_less_channels = ibmvfc_mig_no_n_to_m; + +module_param_named(mq, mq_enabled, uint, s_irugo); +module_parm_desc(mq, "enable multiqueue support. " + "[default=" __stringify(ibmvfc_mq) "]"); +module_param_named(scsi_host_queues, nr_scsi_hw_queues, uint, s_irugo); +module_parm_desc(scsi_host_queues, "number of scsi host submission queues. " + "[default=" __stringify(ibmvfc_scsi_hw_queues) "]"); +module_param_named(scsi_hw_channels, nr_scsi_channels, uint, s_irugo); +module_parm_desc(scsi_hw_channels, "number of hw scsi channels to request. " + "[default=" __stringify(ibmvfc_scsi_channels) "]"); +module_param_named(mig_channels_only, mig_channels_only, uint, s_irugo); +module_parm_desc(mig_channels_only, "prevent migration to non-channelized system. " + "[default=" __stringify(ibmvfc_mig_no_sub_to_crq) "]"); +module_param_named(mig_no_less_channels, mig_no_less_channels, uint, s_irugo); +module_parm_desc(mig_no_less_channels, "prevent migration to system with less channels. " + "[default=" __stringify(ibmvfc_mig_no_n_to_m) "]"); + - for (i = 0; i < ibmvfc_scsi_hw_queues; i++) { + for (i = 0; i < nr_scsi_hw_queues; i++) { +static ssize_t ibmvfc_show_scsi_channels(struct device *dev, + struct device_attribute *attr, char *buf) +{ + struct scsi_host *shost = class_to_shost(dev); + struct ibmvfc_host *vhost = shost_priv(shost); + unsigned long flags = 0; + int len; + + spin_lock_irqsave(shost->host_lock, flags); + len = snprintf(buf, page_size, "%d ", vhost->client_scsi_channels); + spin_unlock_irqrestore(shost->host_lock, flags); + return len; +} + +static ssize_t ibmvfc_store_scsi_channels(struct device *dev, + struct device_attribute *attr, + const char *buf, size_t count) +{ + struct scsi_host *shost = class_to_shost(dev); + struct ibmvfc_host *vhost = shost_priv(shost); + unsigned long flags = 0; + unsigned int channels; + + spin_lock_irqsave(shost->host_lock, flags); + channels = simple_strtoul(buf, null, 10); + vhost->client_scsi_channels = min(channels, nr_scsi_hw_queues); + ibmvfc_hard_reset_host(vhost); + spin_unlock_irqrestore(shost->host_lock, flags); + return strlen(buf); +} + +static device_attr(nr_scsi_channels, s_irugo | s_iwusr, + ibmvfc_show_scsi_channels, ibmvfc_store_scsi_channels); + &dev_attr_nr_scsi_channels, - if (ibmvfc_mig_no_sub_to_crq) + if (mig_channels_only) - if (ibmvfc_mig_no_n_to_m) + if (mig_no_less_channels) - vhost->scsi_scrqs.scrqs = kcalloc(ibmvfc_scsi_hw_queues, + vhost->scsi_scrqs.scrqs = kcalloc(nr_scsi_hw_queues, - for (i = 0; i < ibmvfc_scsi_hw_queues; i++) { + for (i = 0; i < nr_scsi_hw_queues; i++) { - for (i = 0; i < ibmvfc_scsi_hw_queues; i++) + for (i = 0; i < nr_scsi_hw_queues; i++) + unsigned int max_scsi_queues = ibmvfc_max_scsi_queues; - shost->nr_hw_queues = ibmvfc_mq ? ibmvfc_scsi_hw_queues : 1; + shost->nr_hw_queues = mq_enabled ? min(max_scsi_queues, nr_scsi_hw_queues) : 1; - vhost->mq_enabled = ibmvfc_mq; - vhost->client_scsi_channels = ibmvfc_scsi_channels; + vhost->mq_enabled = mq_enabled; + vhost->client_scsi_channels = min(shost->nr_hw_queues, nr_scsi_channels); diff --git a/drivers/scsi/ibmvscsi/ibmvfc.h b/drivers/scsi/ibmvscsi/ibmvfc.h --- a/drivers/scsi/ibmvscsi/ibmvfc.h +++ b/drivers/scsi/ibmvscsi/ibmvfc.h +#define ibmvfc_max_scsi_queues 16
|
Storage
|
032d1900869f3478cdbecc42e9f54feb03ffa730
|
tyrel datwyler brian king brking linux vnet ibm com
|
drivers
|
scsi
|
ibmvscsi
|
scsi: ibmvfc: define generic queue structure for crqs
|
the primary and async crqs are nearly identical outside of the format and length of each message entry in the dma mapped page that represents the queue data. these queues can be represented with a generic queue structure that uses a union to differentiate between message format of the mapped page.
|
this release allows to map an uid to a different one in a mount; it also adds support for selecting the preemption model at runtime; support for a low-overhead memory error detector designed to be used in production; support for the acrn hypervisor designed for embedded systems; btrfs initial support for zoned devices, subpage blocks sizes and performance improvements; support for eager nfs writes; support for a thermal power management to control the surface temperature of embedded devices in an unified way; the napi polling can be moved to a kernel thread; and support for non-blocking path lookups. as always, there are many other features, new drivers, improvements and fixes.
|
mq preparatory locking work
|
['core (various)', 'file systems', 'memory management', 'block layer', 'tracing, perf and bpf', 'virtualization', 'cryptography', 'security', 'networking', 'architectures x86 arm risc-v powerpc mips csky s390 pa-risc c6x']
|
['graphics', 'power management', 'storage', 'drivers in the staging area', 'networking', 'audio', 'tablets, touch screens, keyboards, mouses', 'tv tuners, webcams, video capturers', 'universal serial bus', 'serial peripheral interface (spi)', 'watchdog', 'serial', 'cpu frequency scaling', 'device voltage and frequency scaling', 'voltage, current regulators, power capping, power supply', 'real time clock (rtc)', 'pin controllers (pinctrl)', 'multi media card (mmc)', 'memory technology devices (mtd)', 'industrial i/o (iio)', 'multi function devices (mfd)', 'pulse-width modulation (pwm)', 'inter-integrated circuit (i2c + i3c)', 'hardware monitoring (hwmon)', 'general purpose i/o (gpio)', 'leds', 'dma engines', 'cryptography hardware acceleration', 'pci', 'non-transparent bridge (ntb)', 'thunderbolt', 'clock', 'phy ("physical layer" framework)', 'cxl (compute express link)', 'various']
|
['scsi ', 'ibmvfc']
|
['h', 'c']
| 2
| 107
| 62
|
--- diff --git a/drivers/scsi/ibmvscsi/ibmvfc.c b/drivers/scsi/ibmvscsi/ibmvfc.c --- a/drivers/scsi/ibmvscsi/ibmvfc.c +++ b/drivers/scsi/ibmvscsi/ibmvfc.c - memset(vhost->async_crq.msgs, 0, page_size); + memset(vhost->async_crq.msgs.async, 0, page_size); +/** + * ibmvfc_free_queue - deallocate queue + * @vhost: ibmvfc host struct + * @queue: ibmvfc queue struct + * + * unmaps dma and deallocates page for messages + **/ +static void ibmvfc_free_queue(struct ibmvfc_host *vhost, + struct ibmvfc_queue *queue) +{ + struct device *dev = vhost->dev; + + dma_unmap_single(dev, queue->msg_token, page_size, dma_bidirectional); + free_page((unsigned long)queue->msgs.handle); + queue->msgs.handle = null; +} + - struct ibmvfc_crq_queue *crq = &vhost->crq; + struct ibmvfc_queue *crq = &vhost->crq; - dma_unmap_single(vhost->dev, crq->msg_token, page_size, dma_bidirectional); - free_page((unsigned long)crq->msgs); + + ibmvfc_free_queue(vhost, crq); - struct ibmvfc_crq_queue *crq = &vhost->crq; + struct ibmvfc_queue *crq = &vhost->crq; - memset(crq->msgs, 0, page_size); + memset(crq->msgs.crq, 0, page_size); + struct ibmvfc_queue *async_crq = &vhost->async_crq; - login_info->async.len = cpu_to_be32(vhost->async_crq.size * sizeof(*vhost->async_crq.msgs)); + login_info->async.len = cpu_to_be32(async_crq->size * + sizeof(*async_crq->msgs.async)); - struct ibmvfc_async_crq_queue *async_crq = &vhost->async_crq; + struct ibmvfc_queue *async_crq = &vhost->async_crq; - crq = &async_crq->msgs[async_crq->cur]; + crq = &async_crq->msgs.async[async_crq->cur]; - struct ibmvfc_crq_queue *queue = &vhost->crq; + struct ibmvfc_queue *queue = &vhost->crq; - crq = &queue->msgs[queue->cur]; + crq = &queue->msgs.crq[queue->cur]; +/** + * ibmvfc_alloc_queue - allocate queue + * @vhost: ibmvfc host struct + * @queue: ibmvfc queue to allocate + * @fmt: queue format to allocate + * + * returns: + * 0 on success / non-zero on failure + **/ +static int ibmvfc_alloc_queue(struct ibmvfc_host *vhost, + struct ibmvfc_queue *queue, + enum ibmvfc_msg_fmt fmt) +{ + struct device *dev = vhost->dev; + size_t fmt_size; + + enter; + switch (fmt) { + case ibmvfc_crq_fmt: + fmt_size = sizeof(*queue->msgs.crq); + break; + case ibmvfc_async_fmt: + fmt_size = sizeof(*queue->msgs.async); + break; + default: + dev_warn(dev, "unknown command/response queue message format: %d ", fmt); + return -einval; + } + + queue->msgs.handle = (void *)get_zeroed_page(gfp_kernel); + if (!queue->msgs.handle) + return -enomem; + + queue->msg_token = dma_map_single(dev, queue->msgs.handle, page_size, + dma_bidirectional); + + if (dma_mapping_error(dev, queue->msg_token)) { + free_page((unsigned long)queue->msgs.handle); + queue->msgs.handle = null; + return -enomem; + } + + queue->cur = 0; + queue->fmt = fmt; + queue->size = page_size / fmt_size; + return 0; +} + - struct ibmvfc_crq_queue *crq = &vhost->crq; + struct ibmvfc_queue *crq = &vhost->crq; - crq->msgs = (struct ibmvfc_crq *)get_zeroed_page(gfp_kernel); - - if (!crq->msgs) + if (ibmvfc_alloc_queue(vhost, crq, ibmvfc_crq_fmt)) - crq->size = page_size / sizeof(*crq->msgs); - crq->msg_token = dma_map_single(dev, crq->msgs, - page_size, dma_bidirectional); - - if (dma_mapping_error(dev, crq->msg_token)) - goto map_failed; - - crq->cur = 0; - dma_unmap_single(dev, crq->msg_token, page_size, dma_bidirectional); -map_failed: - free_page((unsigned long)crq->msgs); + ibmvfc_free_queue(vhost, crq); - struct ibmvfc_async_crq_queue *async_q = &vhost->async_crq; + struct ibmvfc_queue *async_q = &vhost->async_crq; - dma_unmap_single(vhost->dev, async_q->msg_token, - async_q->size * sizeof(*async_q->msgs), dma_bidirectional); - free_page((unsigned long)async_q->msgs); + ibmvfc_free_queue(vhost, async_q); - struct ibmvfc_async_crq_queue *async_q = &vhost->async_crq; + struct ibmvfc_queue *async_q = &vhost->async_crq; - async_q->msgs = (struct ibmvfc_async_crq *)get_zeroed_page(gfp_kernel); - if (!async_q->msgs) { - dev_err(dev, "couldn't allocate async queue. "); + if (ibmvfc_alloc_queue(vhost, async_q, ibmvfc_async_fmt)) { + dev_err(dev, "couldn't allocate/map async queue. "); - async_q->size = page_size / sizeof(struct ibmvfc_async_crq); - async_q->msg_token = dma_map_single(dev, async_q->msgs, - async_q->size * sizeof(*async_q->msgs), - dma_bidirectional); - - if (dma_mapping_error(dev, async_q->msg_token)) { - dev_err(dev, "failed to map async queue "); - goto free_async_crq; - } - - dma_unmap_single(dev, async_q->msg_token, - async_q->size * sizeof(*async_q->msgs), dma_bidirectional); -free_async_crq: - free_page((unsigned long)async_q->msgs); + ibmvfc_free_queue(vhost, async_q); diff --git a/drivers/scsi/ibmvscsi/ibmvfc.h b/drivers/scsi/ibmvscsi/ibmvfc.h --- a/drivers/scsi/ibmvscsi/ibmvfc.h +++ b/drivers/scsi/ibmvscsi/ibmvfc.h -struct ibmvfc_crq_queue { - struct ibmvfc_crq *msgs; - int size, cur; - dma_addr_t msg_token; -}; - -struct ibmvfc_async_crq_queue { - struct ibmvfc_async_crq *msgs; - int size, cur; - dma_addr_t msg_token; -}; - +enum ibmvfc_msg_fmt { + ibmvfc_crq_fmt = 0, + ibmvfc_async_fmt, +}; + +union ibmvfc_msgs { + void *handle; + struct ibmvfc_crq *crq; + struct ibmvfc_async_crq *async; +}; + +struct ibmvfc_queue { + union ibmvfc_msgs msgs; + dma_addr_t msg_token; + enum ibmvfc_msg_fmt fmt; + int size, cur; +}; + - struct ibmvfc_crq_queue crq; - struct ibmvfc_async_crq_queue async_crq; + struct ibmvfc_queue crq; + struct ibmvfc_queue async_crq;
|
Storage
|
f8968665af2861e044b54d87e64f1ad9ab4e206b
|
tyrel datwyler
|
drivers
|
scsi
|
ibmvscsi
|
scsi: ibmvfc: make command event pool queue specific
|
there is currently a single command event pool per host. in anticipation of providing multiple queues add a per-queue event pool definition and reimplement the existing crq to use its queue defined event pool for command submission and completion.
|
this release allows to map an uid to a different one in a mount; it also adds support for selecting the preemption model at runtime; support for a low-overhead memory error detector designed to be used in production; support for the acrn hypervisor designed for embedded systems; btrfs initial support for zoned devices, subpage blocks sizes and performance improvements; support for eager nfs writes; support for a thermal power management to control the surface temperature of embedded devices in an unified way; the napi polling can be moved to a kernel thread; and support for non-blocking path lookups. as always, there are many other features, new drivers, improvements and fixes.
|
mq preparatory locking work
|
['core (various)', 'file systems', 'memory management', 'block layer', 'tracing, perf and bpf', 'virtualization', 'cryptography', 'security', 'networking', 'architectures x86 arm risc-v powerpc mips csky s390 pa-risc c6x']
|
['graphics', 'power management', 'storage', 'drivers in the staging area', 'networking', 'audio', 'tablets, touch screens, keyboards, mouses', 'tv tuners, webcams, video capturers', 'universal serial bus', 'serial peripheral interface (spi)', 'watchdog', 'serial', 'cpu frequency scaling', 'device voltage and frequency scaling', 'voltage, current regulators, power capping, power supply', 'real time clock (rtc)', 'pin controllers (pinctrl)', 'multi media card (mmc)', 'memory technology devices (mtd)', 'industrial i/o (iio)', 'multi function devices (mfd)', 'pulse-width modulation (pwm)', 'inter-integrated circuit (i2c + i3c)', 'hardware monitoring (hwmon)', 'general purpose i/o (gpio)', 'leds', 'dma engines', 'cryptography hardware acceleration', 'pci', 'non-transparent bridge (ntb)', 'thunderbolt', 'clock', 'phy ("physical layer" framework)', 'cxl (compute express link)', 'various']
|
['scsi ', 'ibmvfc']
|
['h', 'c']
| 2
| 55
| 50
|
--- diff --git a/drivers/scsi/ibmvscsi/ibmvfc.c b/drivers/scsi/ibmvscsi/ibmvfc.c --- a/drivers/scsi/ibmvscsi/ibmvfc.c +++ b/drivers/scsi/ibmvscsi/ibmvfc.c - struct ibmvfc_host *vhost = evt->vhost; - struct ibmvfc_event_pool *pool = &vhost->pool; + struct ibmvfc_event_pool *pool = &evt->queue->evt_pool; - list_add_tail(&evt->queue, &vhost->free); + list_add_tail(&evt->queue_list, &evt->queue->free); - list_del(&evt->queue); + list_del(&evt->queue_list); - list_for_each_entry_safe(evt, pos, &vhost->sent, queue) + list_for_each_entry_safe(evt, pos, &vhost->crq.sent, queue_list) -static int ibmvfc_init_event_pool(struct ibmvfc_host *vhost) +static int ibmvfc_init_event_pool(struct ibmvfc_host *vhost, + struct ibmvfc_queue *queue) - struct ibmvfc_event_pool *pool = &vhost->pool; + struct ibmvfc_event_pool *pool = &queue->evt_pool; + init_list_head(&queue->sent); + init_list_head(&queue->free); + + evt->queue = queue; - list_add_tail(&evt->queue, &vhost->free); + list_add_tail(&evt->queue_list, &queue->free); -static void ibmvfc_free_event_pool(struct ibmvfc_host *vhost) +static void ibmvfc_free_event_pool(struct ibmvfc_host *vhost, + struct ibmvfc_queue *queue) - struct ibmvfc_event_pool *pool = &vhost->pool; + struct ibmvfc_event_pool *pool = &queue->evt_pool; - list_del(&pool->events[i].queue); + list_del(&pool->events[i].queue_list); -static struct ibmvfc_event *ibmvfc_get_event(struct ibmvfc_host *vhost) +static struct ibmvfc_event *ibmvfc_get_event(struct ibmvfc_queue *queue) - bug_on(list_empty(&vhost->free)); - evt = list_entry(vhost->free.next, struct ibmvfc_event, queue); + bug_on(list_empty(&queue->free)); + evt = list_entry(queue->free.next, struct ibmvfc_event, queue_list); - list_del(&evt->queue); + list_del(&evt->queue_list); - list_add_tail(&evt->queue, &vhost->sent); + list_add_tail(&evt->queue_list, &evt->queue->sent); - list_del(&evt->queue); + list_del(&evt->queue_list); - evt = ibmvfc_get_event(vhost); + evt = ibmvfc_get_event(&vhost->crq); - evt = ibmvfc_get_event(vhost); + evt = ibmvfc_get_event(&vhost->crq); - evt = ibmvfc_get_event(vhost); + evt = ibmvfc_get_event(&vhost->crq); - evt = ibmvfc_get_event(vhost); + evt = ibmvfc_get_event(&vhost->crq); - evt = ibmvfc_get_event(vhost); + evt = ibmvfc_get_event(&vhost->crq); - list_for_each_entry(evt, &vhost->sent, queue) { + list_for_each_entry(evt, &vhost->crq.sent, queue_list) { - list_for_each_entry(evt, &vhost->sent, queue) { + list_for_each_entry(evt, &vhost->crq.sent, queue_list) { - list_for_each_entry(evt, &vhost->sent, queue) { + list_for_each_entry(evt, &vhost->crq.sent, queue_list) { - evt = ibmvfc_get_event(vhost); + evt = ibmvfc_get_event(&vhost->crq); - list_for_each_entry(evt, &vhost->sent, queue) { + list_for_each_entry(evt, &vhost->crq.sent, queue_list) { - evt = ibmvfc_get_event(vhost); + evt = ibmvfc_get_event(&vhost->crq); - if (unlikely(!ibmvfc_valid_event(&vhost->pool, evt))) { + if (unlikely(!ibmvfc_valid_event(&vhost->crq.evt_pool, evt))) { - list_del(&evt->queue); + list_del(&evt->queue_list); - evt = ibmvfc_get_event(vhost); + evt = ibmvfc_get_event(&vhost->crq); - evt = ibmvfc_get_event(vhost); + evt = ibmvfc_get_event(&vhost->crq); - evt = ibmvfc_get_event(vhost); + evt = ibmvfc_get_event(&vhost->crq); - evt = ibmvfc_get_event(vhost); + evt = ibmvfc_get_event(&vhost->crq); - evt = ibmvfc_get_event(vhost); + evt = ibmvfc_get_event(&vhost->crq); - evt = ibmvfc_get_event(vhost); + evt = ibmvfc_get_event(&vhost->crq); - evt = ibmvfc_get_event(vhost); + evt = ibmvfc_get_event(&vhost->crq); - struct ibmvfc_event *evt = ibmvfc_get_event(vhost); + struct ibmvfc_event *evt = ibmvfc_get_event(&vhost->crq); - struct ibmvfc_event *evt = ibmvfc_get_event(vhost); + struct ibmvfc_event *evt = ibmvfc_get_event(&vhost->crq); - if (list_empty(&vhost->sent) && + if (list_empty(&vhost->crq.sent) && - evt = ibmvfc_get_event(vhost); + evt = ibmvfc_get_event(&vhost->crq); - init_list_head(&vhost->sent); - init_list_head(&vhost->free); - if ((rc = ibmvfc_init_event_pool(vhost))) { + if ((rc = ibmvfc_init_event_pool(vhost, &vhost->crq))) { - ibmvfc_free_event_pool(vhost); + ibmvfc_free_event_pool(vhost, &vhost->crq); - ibmvfc_free_event_pool(vhost); + ibmvfc_free_event_pool(vhost, &vhost->crq); diff --git a/drivers/scsi/ibmvscsi/ibmvfc.h b/drivers/scsi/ibmvscsi/ibmvfc.h --- a/drivers/scsi/ibmvscsi/ibmvfc.h +++ b/drivers/scsi/ibmvscsi/ibmvfc.h - struct list_head queue; + struct list_head queue_list; + struct ibmvfc_queue *queue; + + struct ibmvfc_event_pool evt_pool; + struct list_head sent; + struct list_head free; - struct list_head sent; - struct list_head free; - struct ibmvfc_event_pool pool;
|
Storage
|
e4b26f3db86498e79b6731c2216684293e3be19b
|
tyrel datwyler brian king brking linux vnet ibm com
|
drivers
|
scsi
|
ibmvscsi
|
scsi: ibmvfc: define per-queue state/list locks
|
define per-queue locks for protecting queue state and event pool sent/free lists. the evt list lock is initially redundant but it allows the driver to be modified in the follow-up patches to relax the queue locking around submissions and completions.
|
this release allows to map an uid to a different one in a mount; it also adds support for selecting the preemption model at runtime; support for a low-overhead memory error detector designed to be used in production; support for the acrn hypervisor designed for embedded systems; btrfs initial support for zoned devices, subpage blocks sizes and performance improvements; support for eager nfs writes; support for a thermal power management to control the surface temperature of embedded devices in an unified way; the napi polling can be moved to a kernel thread; and support for non-blocking path lookups. as always, there are many other features, new drivers, improvements and fixes.
|
mq preparatory locking work
|
['core (various)', 'file systems', 'memory management', 'block layer', 'tracing, perf and bpf', 'virtualization', 'cryptography', 'security', 'networking', 'architectures x86 arm risc-v powerpc mips csky s390 pa-risc c6x']
|
['graphics', 'power management', 'storage', 'drivers in the staging area', 'networking', 'audio', 'tablets, touch screens, keyboards, mouses', 'tv tuners, webcams, video capturers', 'universal serial bus', 'serial peripheral interface (spi)', 'watchdog', 'serial', 'cpu frequency scaling', 'device voltage and frequency scaling', 'voltage, current regulators, power capping, power supply', 'real time clock (rtc)', 'pin controllers (pinctrl)', 'multi media card (mmc)', 'memory technology devices (mtd)', 'industrial i/o (iio)', 'multi function devices (mfd)', 'pulse-width modulation (pwm)', 'inter-integrated circuit (i2c + i3c)', 'hardware monitoring (hwmon)', 'general purpose i/o (gpio)', 'leds', 'dma engines', 'cryptography hardware acceleration', 'pci', 'non-transparent bridge (ntb)', 'thunderbolt', 'clock', 'phy ("physical layer" framework)', 'cxl (compute express link)', 'various']
|
['scsi ', 'ibmvfc']
|
['h', 'c']
| 2
| 80
| 20
|
--- diff --git a/drivers/scsi/ibmvscsi/ibmvfc.c b/drivers/scsi/ibmvscsi/ibmvfc.c --- a/drivers/scsi/ibmvscsi/ibmvfc.c +++ b/drivers/scsi/ibmvscsi/ibmvfc.c + int index = atomic_inc_return(&vhost->trace_index) & ibmvfc_trace_index_mask; - entry = &vhost->trace[vhost->trace_index++]; + entry = &vhost->trace[index]; - struct ibmvfc_trace_entry *entry = &vhost->trace[vhost->trace_index++]; + struct ibmvfc_trace_entry *entry; + int index = atomic_inc_return(&vhost->trace_index) & ibmvfc_trace_index_mask; + entry = &vhost->trace[index]; + spin_lock(vhost->crq.q_lock); + spin_unlock(vhost->crq.q_lock); + unsigned long flags; + + spin_lock_irqsave(&evt->queue->l_lock, flags); + if (evt->eh_comp) + complete(evt->eh_comp); + spin_unlock_irqrestore(&evt->queue->l_lock, flags); - if (evt->eh_comp) - complete(evt->eh_comp); - +/** + * ibmvfc_complete_purge - complete failed command list + * @purge_list: list head of failed commands + * + * this function runs completions on commands to fail as a result of a + * host reset or platform migration. caller must hold host_lock. + **/ +static void ibmvfc_complete_purge(struct list_head *purge_list) +{ + struct ibmvfc_event *evt, *pos; + + list_for_each_entry_safe(evt, pos, purge_list, queue_list) { + list_del(&evt->queue_list); + ibmvfc_trc_end(evt); + evt->done(evt); + } +} + - list_del(&evt->queue_list); - ibmvfc_trc_end(evt); - evt->done(evt); + unsigned long flags; + spin_lock_irqsave(&vhost->crq.l_lock, flags); + list_splice_init(&vhost->crq.sent, &vhost->purge); + spin_unlock_irqrestore(&vhost->crq.l_lock, flags); + spin_lock_init(&queue->l_lock); + unsigned long flags; + spin_lock_irqsave(&queue->l_lock, flags); + spin_unlock_irqrestore(&queue->l_lock, flags); + unsigned long flags; - list_add_tail(&evt->queue_list, &evt->queue->sent); + spin_lock_irqsave(&evt->queue->l_lock, flags); + list_add_tail(&evt->queue_list, &evt->queue->sent); + + spin_unlock_irqrestore(&evt->queue->l_lock, flags); - } else + } else { + spin_unlock_irqrestore(&evt->queue->l_lock, flags); + } - if (evt->eh_comp) - complete(evt->eh_comp); - - spin_lock_irqsave(vhost->host->host_lock, flags); + spin_lock_irqsave(&vhost->crq.l_lock, flags); - spin_unlock_irqrestore(vhost->host->host_lock, flags); + spin_unlock_irqrestore(&vhost->crq.l_lock, flags); - spin_lock_irqsave(vhost->host->host_lock, flags); + spin_lock_irqsave(&vhost->crq.l_lock, flags); - spin_unlock_irqrestore(vhost->host->host_lock, flags); + spin_unlock_irqrestore(&vhost->crq.l_lock, flags); - spin_lock_irqsave(vhost->host->host_lock, flags); + spin_lock_irqsave(vhost->host->host_lock, flags); + spin_lock(&vhost->crq.l_lock); + spin_unlock(&vhost->crq.l_lock); - spin_lock_irqsave(vhost->host->host_lock, flags); + spin_lock_irqsave(vhost->host->host_lock, flags); + spin_lock(&vhost->crq.l_lock); + spin_unlock(&vhost->crq.l_lock); + spin_lock(&evt->queue->l_lock); + spin_unlock(&evt->queue->l_lock); + spin_lock(vhost->crq.q_lock); + spin_unlock(vhost->crq.q_lock); + list_head(purge); + list_splice_init(&vhost->purge, &purge); + ibmvfc_complete_purge(&purge); + list_splice_init(&vhost->purge, &purge); + ibmvfc_complete_purge(&purge); + spin_lock_init(&queue->_lock); + queue->q_lock = &queue->_lock; + + atomic_set(&vhost->trace_index, -1); + init_list_head(&vhost->purge); + list_head(purge); + list_splice_init(&vhost->purge, &purge); + ibmvfc_complete_purge(&purge); diff --git a/drivers/scsi/ibmvscsi/ibmvfc.h b/drivers/scsi/ibmvscsi/ibmvfc.h --- a/drivers/scsi/ibmvscsi/ibmvfc.h +++ b/drivers/scsi/ibmvscsi/ibmvfc.h + spinlock_t _lock; + spinlock_t *q_lock; + spinlock_t l_lock; +#define ibmvfc_trace_index_mask (ibmvfc_num_trace_entries - 1) - u32 trace_index:ibmvfc_num_trace_index_bits; + atomic_t trace_index; + struct list_head purge;
|
Storage
|
57e80e0bc108589a5373a1f2e2ef5f0e6ad5e55b
|
tyrel datwyler brian king brking linux vnet ibm com
|
drivers
|
scsi
|
ibmvscsi
|
scsi: ibmvfc: complete commands outside the host/queue lock
|
drain the command queue and place all commands on a completion list. perform command completion on that list outside the host/queue locks. further, move purged command compeletions outside the host_lock as well.
|
this release allows to map an uid to a different one in a mount; it also adds support for selecting the preemption model at runtime; support for a low-overhead memory error detector designed to be used in production; support for the acrn hypervisor designed for embedded systems; btrfs initial support for zoned devices, subpage blocks sizes and performance improvements; support for eager nfs writes; support for a thermal power management to control the surface temperature of embedded devices in an unified way; the napi polling can be moved to a kernel thread; and support for non-blocking path lookups. as always, there are many other features, new drivers, improvements and fixes.
|
mq preparatory locking work
|
['core (various)', 'file systems', 'memory management', 'block layer', 'tracing, perf and bpf', 'virtualization', 'cryptography', 'security', 'networking', 'architectures x86 arm risc-v powerpc mips csky s390 pa-risc c6x']
|
['graphics', 'power management', 'storage', 'drivers in the staging area', 'networking', 'audio', 'tablets, touch screens, keyboards, mouses', 'tv tuners, webcams, video capturers', 'universal serial bus', 'serial peripheral interface (spi)', 'watchdog', 'serial', 'cpu frequency scaling', 'device voltage and frequency scaling', 'voltage, current regulators, power capping, power supply', 'real time clock (rtc)', 'pin controllers (pinctrl)', 'multi media card (mmc)', 'memory technology devices (mtd)', 'industrial i/o (iio)', 'multi function devices (mfd)', 'pulse-width modulation (pwm)', 'inter-integrated circuit (i2c + i3c)', 'hardware monitoring (hwmon)', 'general purpose i/o (gpio)', 'leds', 'dma engines', 'cryptography hardware acceleration', 'pci', 'non-transparent bridge (ntb)', 'thunderbolt', 'clock', 'phy ("physical layer" framework)', 'cxl (compute express link)', 'various']
|
['scsi ', 'ibmvfc']
|
['h', 'c']
| 2
| 47
| 14
|
--- diff --git a/drivers/scsi/ibmvscsi/ibmvfc.c b/drivers/scsi/ibmvscsi/ibmvfc.c --- a/drivers/scsi/ibmvscsi/ibmvfc.c +++ b/drivers/scsi/ibmvscsi/ibmvfc.c - * host reset or platform migration. caller must hold host_lock. + * host reset or platform migration. +/** + * ibmvfc_locked_done - calls evt completion with host_lock held + * @evt: ibmvfc evt to complete + * + * all non-scsi command completion callbacks have the expectation that the + * host_lock is held. this callback is used by ibmvfc_init_event to wrap a + * mad evt with the host_lock. + **/ +static void ibmvfc_locked_done(struct ibmvfc_event *evt) +{ + unsigned long flags; + + spin_lock_irqsave(evt->vhost->host->host_lock, flags); + evt->_done(evt); + spin_unlock_irqrestore(evt->vhost->host->host_lock, flags); +} + - evt->crq.format = format; - evt->done = done; + evt->crq.format = format; + if (format == ibmvfc_cmd_format) + evt->done = done; + else { + evt->_done = done; + evt->done = ibmvfc_locked_done; + } + unsigned long flags; + spin_lock_irqsave(vhost->host->host_lock, flags); + spin_unlock_irqrestore(vhost->host->host_lock, flags); -static void ibmvfc_handle_crq(struct ibmvfc_crq *crq, struct ibmvfc_host *vhost) +static void ibmvfc_handle_crq(struct ibmvfc_crq *crq, struct ibmvfc_host *vhost, + struct list_head *evt_doneq) - del_timer(&evt->timer); - list_del(&evt->queue_list); + list_move_tail(&evt->queue_list, evt_doneq); - ibmvfc_trc_end(evt); - evt->done(evt); + struct ibmvfc_event *evt, *temp; + list_head(evt_doneq); - ibmvfc_handle_crq(crq, vhost); + ibmvfc_handle_crq(crq, vhost, &evt_doneq); - ibmvfc_handle_crq(crq, vhost); + ibmvfc_handle_crq(crq, vhost, &evt_doneq); + + list_for_each_entry_safe(evt, temp, &evt_doneq, queue_list) { + del_timer(&evt->timer); + list_del(&evt->queue_list); + ibmvfc_trc_end(evt); + evt->done(evt); + } - ibmvfc_complete_purge(&purge); + ibmvfc_complete_purge(&purge); - ibmvfc_complete_purge(&purge); + ibmvfc_complete_purge(&purge); - ibmvfc_complete_purge(&purge); + ibmvfc_complete_purge(&purge); diff --git a/drivers/scsi/ibmvscsi/ibmvfc.h b/drivers/scsi/ibmvscsi/ibmvfc.h --- a/drivers/scsi/ibmvscsi/ibmvfc.h +++ b/drivers/scsi/ibmvscsi/ibmvfc.h - void (*done) (struct ibmvfc_event *); + void (*done)(struct ibmvfc_event *evt); + void (*_done)(struct ibmvfc_event *evt);
|
Storage
|
1f4a4a19508d61bf4dc6fb24ab7c1496d391a133
|
tyrel datwyler brian king brking linux vnet ibm com
|
drivers
|
scsi
|
ibmvscsi
|
scsi: ibmvfc: relax locking around ibmvfc_queuecommand()
|
the driver's queuecommand routine is still wrapped to hold the host lock for the duration of the call. this will become problematic when moving to multiple queues due to the lock contention preventing asynchronous submissions to mulitple queues. there is no real legitimate reason to hold the host lock, and previous patches have insured proper protection of moving ibmvfc_event objects between free and sent lists.
|
this release allows to map an uid to a different one in a mount; it also adds support for selecting the preemption model at runtime; support for a low-overhead memory error detector designed to be used in production; support for the acrn hypervisor designed for embedded systems; btrfs initial support for zoned devices, subpage blocks sizes and performance improvements; support for eager nfs writes; support for a thermal power management to control the surface temperature of embedded devices in an unified way; the napi polling can be moved to a kernel thread; and support for non-blocking path lookups. as always, there are many other features, new drivers, improvements and fixes.
|
mq preparatory locking work
|
['core (various)', 'file systems', 'memory management', 'block layer', 'tracing, perf and bpf', 'virtualization', 'cryptography', 'security', 'networking', 'architectures x86 arm risc-v powerpc mips csky s390 pa-risc c6x']
|
['graphics', 'power management', 'storage', 'drivers in the staging area', 'networking', 'audio', 'tablets, touch screens, keyboards, mouses', 'tv tuners, webcams, video capturers', 'universal serial bus', 'serial peripheral interface (spi)', 'watchdog', 'serial', 'cpu frequency scaling', 'device voltage and frequency scaling', 'voltage, current regulators, power capping, power supply', 'real time clock (rtc)', 'pin controllers (pinctrl)', 'multi media card (mmc)', 'memory technology devices (mtd)', 'industrial i/o (iio)', 'multi function devices (mfd)', 'pulse-width modulation (pwm)', 'inter-integrated circuit (i2c + i3c)', 'hardware monitoring (hwmon)', 'general purpose i/o (gpio)', 'leds', 'dma engines', 'cryptography hardware acceleration', 'pci', 'non-transparent bridge (ntb)', 'thunderbolt', 'clock', 'phy ("physical layer" framework)', 'cxl (compute express link)', 'various']
|
['scsi ', 'ibmvfc']
|
['c']
| 1
| 4
| 8
|
--- diff --git a/drivers/scsi/ibmvscsi/ibmvfc.c b/drivers/scsi/ibmvscsi/ibmvfc.c --- a/drivers/scsi/ibmvscsi/ibmvfc.c +++ b/drivers/scsi/ibmvscsi/ibmvfc.c -static int ibmvfc_queuecommand_lck(struct scsi_cmnd *cmnd, - void (*done) (struct scsi_cmnd *)) +static int ibmvfc_queuecommand(struct scsi_host *shost, struct scsi_cmnd *cmnd) - struct ibmvfc_host *vhost = shost_priv(cmnd->device->host); + struct ibmvfc_host *vhost = shost_priv(shost); - done(cmnd); + cmnd->scsi_done(cmnd); - cmnd->scsi_done = done; - done(cmnd); + cmnd->scsi_done(cmnd); -static def_scsi_qcmd(ibmvfc_queuecommand) -
|
Storage
|
654080d02edb60a5842cae9cf14ff83fd352305f
|
tyrel datwyler brian king brking linux vnet ibm com
|
drivers
|
scsi
|
ibmvscsi
|
scsi: lpfc: implement health checking when aborting i/o
|
several errors have occurred where the adapter stops or fails but does not raise the register values for the driver to detect failure. thus driver is unaware of the failure. the failure typically results in i/o timeouts, the i/o timeout handler failing (after several seconds), and the error handler escalating recovery policy and resulting in more errors. eventually, the driver is in a position where things have spiraled and it can't do recovery because other recovery ops are still outstanding and it becomes unusable.
|
this release allows to map an uid to a different one in a mount; it also adds support for selecting the preemption model at runtime; support for a low-overhead memory error detector designed to be used in production; support for the acrn hypervisor designed for embedded systems; btrfs initial support for zoned devices, subpage blocks sizes and performance improvements; support for eager nfs writes; support for a thermal power management to control the surface temperature of embedded devices in an unified way; the napi polling can be moved to a kernel thread; and support for non-blocking path lookups. as always, there are many other features, new drivers, improvements and fixes.
|
implement health checking when aborting i/o
|
['core (various)', 'file systems', 'memory management', 'block layer', 'tracing, perf and bpf', 'virtualization', 'cryptography', 'security', 'networking', 'architectures x86 arm risc-v powerpc mips csky s390 pa-risc c6x']
|
['graphics', 'power management', 'storage', 'drivers in the staging area', 'networking', 'audio', 'tablets, touch screens, keyboards, mouses', 'tv tuners, webcams, video capturers', 'universal serial bus', 'serial peripheral interface (spi)', 'watchdog', 'serial', 'cpu frequency scaling', 'device voltage and frequency scaling', 'voltage, current regulators, power capping, power supply', 'real time clock (rtc)', 'pin controllers (pinctrl)', 'multi media card (mmc)', 'memory technology devices (mtd)', 'industrial i/o (iio)', 'multi function devices (mfd)', 'pulse-width modulation (pwm)', 'inter-integrated circuit (i2c + i3c)', 'hardware monitoring (hwmon)', 'general purpose i/o (gpio)', 'leds', 'dma engines', 'cryptography hardware acceleration', 'pci', 'non-transparent bridge (ntb)', 'thunderbolt', 'clock', 'phy ("physical layer" framework)', 'cxl (compute express link)', 'various']
|
['scsi ', 'lpfc']
|
['h', 'c']
| 10
| 178
| 75
|
--- diff --git a/drivers/scsi/lpfc/lpfc.h b/drivers/scsi/lpfc/lpfc.h --- a/drivers/scsi/lpfc/lpfc.h +++ b/drivers/scsi/lpfc/lpfc.h +#define hba_hbeat_inp 0x4000000 /* mbox hbeat is in progress */ +#define hba_hbeat_tmo 0x8000000 /* hbeat initiated after timeout */ - uint8_t hb_outstanding; diff --git a/drivers/scsi/lpfc/lpfc_attr.c b/drivers/scsi/lpfc/lpfc_attr.c --- a/drivers/scsi/lpfc/lpfc_attr.c +++ b/drivers/scsi/lpfc/lpfc_attr.c + else if (strncmp(buf, "heartbeat", sizeof("heartbeat") - 1) == 0) + lpfc_issue_hb_tmo(phba); diff --git a/drivers/scsi/lpfc/lpfc_crtn.h b/drivers/scsi/lpfc/lpfc_crtn.h --- a/drivers/scsi/lpfc/lpfc_crtn.h +++ b/drivers/scsi/lpfc/lpfc_crtn.h +int lpfc_issue_hb_mbox(struct lpfc_hba *phba); +void lpfc_issue_hb_tmo(struct lpfc_hba *phba); diff --git a/drivers/scsi/lpfc/lpfc_els.c b/drivers/scsi/lpfc/lpfc_els.c --- a/drivers/scsi/lpfc/lpfc_els.c +++ b/drivers/scsi/lpfc/lpfc_els.c + /* make sure hba is alive */ + lpfc_issue_hb_tmo(phba); + + /* make sure hba is alive */ + lpfc_issue_hb_tmo(phba); + + /* make sure hba is alive */ + lpfc_issue_hb_tmo(phba); + diff --git a/drivers/scsi/lpfc/lpfc_hbadisc.c b/drivers/scsi/lpfc/lpfc_hbadisc.c --- a/drivers/scsi/lpfc/lpfc_hbadisc.c +++ b/drivers/scsi/lpfc/lpfc_hbadisc.c + /* make sure hba is alive */ + lpfc_issue_hb_tmo(phba); + diff --git a/drivers/scsi/lpfc/lpfc_init.c b/drivers/scsi/lpfc/lpfc_init.c --- a/drivers/scsi/lpfc/lpfc_init.c +++ b/drivers/scsi/lpfc/lpfc_init.c - phba->hb_outstanding = 0; + phba->hba_flag &= ~(hba_hbeat_inp | hba_hbeat_tmo); - phba->hb_outstanding = 0; + phba->hba_flag &= ~(hba_hbeat_inp | hba_hbeat_tmo); - /* check and reset heart-beat timer is necessary */ + /* check and reset heart-beat timer if necessary */ +/** + * lpfc_issue_hb_mbox - issues heart-beat mailbox command + * @phba: pointer to lpfc hba data structure. + * + * if a hb mbox is not already in progrees, this routine will allocate + * a lpfc_mboxq_t, populate it with a mbx_heartbeat (0x31) command, + * and issue it. the hba_hbeat_inp flag means the command is in progress. + **/ +int +lpfc_issue_hb_mbox(struct lpfc_hba *phba) +{ + lpfc_mboxq_t *pmboxq; + int retval; + + /* is a heartbeat mbox already in progress */ + if (phba->hba_flag & hba_hbeat_inp) + return 0; + + pmboxq = mempool_alloc(phba->mbox_mem_pool, gfp_kernel); + if (!pmboxq) + return -enomem; + + lpfc_heart_beat(phba, pmboxq); + pmboxq->mbox_cmpl = lpfc_hb_mbox_cmpl; + pmboxq->vport = phba->pport; + retval = lpfc_sli_issue_mbox(phba, pmboxq, mbx_nowait); + + if (retval != mbx_busy && retval != mbx_success) { + mempool_free(pmboxq, phba->mbox_mem_pool); + return -enxio; + } + phba->hba_flag |= hba_hbeat_inp; + + return 0; +} + +/** + * lpfc_issue_hb_tmo - signals heartbeat timer to issue mbox command + * @phba: pointer to lpfc hba data structure. + * + * the heartbeat timer (every 5 sec) will fire. if the hba_hbeat_tmo + * flag is set, it will force a mbx_heartbeat mbox command, regardless + * of the value of lpfc_enable_hba_heartbeat. + * if lpfc_enable_hba_heartbeat is set, the timeout routine will always + * try to issue a mbx_heartbeat mbox command. + **/ +void +lpfc_issue_hb_tmo(struct lpfc_hba *phba) +{ + if (phba->cfg_enable_hba_heartbeat) + return; + phba->hba_flag |= hba_hbeat_tmo; +} + - lpfc_mboxq_t *pmboxq; - int retval, i; + int retval = 0; + int i, tmo; - spin_lock_irq(&phba->pport->work_port_lock); - - if (time_after(phba->last_completion_time + - msecs_to_jiffies(1000 * lpfc_hb_mbox_interval), - jiffies)) { - spin_unlock_irq(&phba->pport->work_port_lock); - if (!phba->hb_outstanding) - mod_timer(&phba->hb_tmofunc, - jiffies + - msecs_to_jiffies(1000 * lpfc_hb_mbox_interval)); - else - mod_timer(&phba->hb_tmofunc, - jiffies + - msecs_to_jiffies(1000 * lpfc_hb_mbox_timeout)); - return; - } - spin_unlock_irq(&phba->pport->work_port_lock); - - if (!phba->hb_outstanding) { + /* if ios are completing, no need to issue a mbx_heartbeat */ + spin_lock_irq(&phba->pport->work_port_lock); + if (time_after(phba->last_completion_time + + msecs_to_jiffies(1000 * lpfc_hb_mbox_interval), + jiffies)) { + spin_unlock_irq(&phba->pport->work_port_lock); + if (phba->hba_flag & hba_hbeat_inp) + tmo = (1000 * lpfc_hb_mbox_timeout); + else + tmo = (1000 * lpfc_hb_mbox_interval); + goto out; + } + spin_unlock_irq(&phba->pport->work_port_lock); + + /* check if a mbx_heartbeat is already in progress */ + if (phba->hba_flag & hba_hbeat_inp) { + /* + * if heart beat timeout called with hba_hbeat_inp set + * we need to give the hb mailbox cmd a chance to + * complete or tmo. + */ + lpfc_printf_log(phba, kern_warning, log_init, + "0459 adapter heartbeat still outstanding: " + "last compl time was %d ms. ", + jiffies_to_msecs(jiffies + - phba->last_completion_time)); + tmo = (1000 * lpfc_hb_mbox_timeout); + } else { - pmboxq = mempool_alloc(phba->mbox_mem_pool, - gfp_kernel); - if (!pmboxq) { - mod_timer(&phba->hb_tmofunc, - jiffies + - msecs_to_jiffies(1000 * - lpfc_hb_mbox_interval)); - return; - } - lpfc_heart_beat(phba, pmboxq); - pmboxq->mbox_cmpl = lpfc_hb_mbox_cmpl; - pmboxq->vport = phba->pport; - retval = lpfc_sli_issue_mbox(phba, pmboxq, - mbx_nowait); - - if (retval != mbx_busy && - retval != mbx_success) { - mempool_free(pmboxq, - phba->mbox_mem_pool); - mod_timer(&phba->hb_tmofunc, - jiffies + - msecs_to_jiffies(1000 * - lpfc_hb_mbox_interval)); - return; + retval = lpfc_issue_hb_mbox(phba); + if (retval) { + tmo = (1000 * lpfc_hb_mbox_interval); + goto out; - phba->hb_outstanding = 1; - mod_timer(&phba->hb_tmofunc, - jiffies + - msecs_to_jiffies(1000 * lpfc_hb_mbox_timeout)); - return; - } else { - /* - * if heart beat timeout called with hb_outstanding set - * we need to give the hb mailbox cmd a chance to - * complete or tmo. - */ - lpfc_printf_log(phba, kern_warning, log_init, - "0459 adapter heartbeat still out" - "standing:last compl time was %d ms. ", - jiffies_to_msecs(jiffies - - phba->last_completion_time)); - mod_timer(&phba->hb_tmofunc, - jiffies + - msecs_to_jiffies(1000 * lpfc_hb_mbox_timeout)); + tmo = (1000 * lpfc_hb_mbox_timeout); + goto out; - mod_timer(&phba->hb_tmofunc, - jiffies + - msecs_to_jiffies(1000 * lpfc_hb_mbox_interval)); + /* check to see if we want to force a mbx_heartbeat */ + if (phba->hba_flag & hba_hbeat_tmo) { + retval = lpfc_issue_hb_mbox(phba); + if (retval) + tmo = (1000 * lpfc_hb_mbox_interval); + else + tmo = (1000 * lpfc_hb_mbox_timeout); + goto out; + } + tmo = (1000 * lpfc_hb_mbox_interval); +out: + mod_timer(&phba->hb_tmofunc, jiffies + msecs_to_jiffies(tmo)); - phba->hb_outstanding = 0; + phba->hba_flag &= ~(hba_hbeat_inp | hba_hbeat_tmo); diff --git a/drivers/scsi/lpfc/lpfc_nportdisc.c b/drivers/scsi/lpfc/lpfc_nportdisc.c --- a/drivers/scsi/lpfc/lpfc_nportdisc.c +++ b/drivers/scsi/lpfc/lpfc_nportdisc.c + /* make sure hba is alive */ + lpfc_issue_hb_tmo(phba); diff --git a/drivers/scsi/lpfc/lpfc_nvme.c b/drivers/scsi/lpfc/lpfc_nvme.c --- a/drivers/scsi/lpfc/lpfc_nvme.c +++ b/drivers/scsi/lpfc/lpfc_nvme.c + + /* make sure hba is alive */ + lpfc_issue_hb_tmo(phba); + + + /* make sure hba is alive */ + lpfc_issue_hb_tmo(phba); + diff --git a/drivers/scsi/lpfc/lpfc_scsi.c b/drivers/scsi/lpfc/lpfc_scsi.c --- a/drivers/scsi/lpfc/lpfc_scsi.c +++ b/drivers/scsi/lpfc/lpfc_scsi.c + /* make sure hba is alive */ + lpfc_issue_hb_tmo(phba); + diff --git a/drivers/scsi/lpfc/lpfc_sli.c b/drivers/scsi/lpfc/lpfc_sli.c --- a/drivers/scsi/lpfc/lpfc_sli.c +++ b/drivers/scsi/lpfc/lpfc_sli.c + /* make sure hba is alive */ + lpfc_issue_hb_tmo(phba); - phba->hb_outstanding = 0; + phba->hba_flag &= ~(hba_hbeat_inp | hba_hbeat_tmo); + /* make sure hba is alive */ + lpfc_issue_hb_tmo(phba); + - lpfc_mbox_cmpl_put(phba, pmb); + + /* do not queue mbx_heartbeat to the worker + * thread for processing. + */ + if (pmbox->mbxcommand == mbx_heartbeat) { + /* process mbox now */ + phba->sli.mbox_active = null; + phba->sli.sli_flag &= + ~lpfc_sli_mbox_active; + if (pmb->mbox_cmpl) + pmb->mbox_cmpl(phba, pmb); + } else { + /* queue to worker thread to process */ + lpfc_mbox_cmpl_put(phba, pmb); + } - /* there is mailbox completion work to do */ + /* do not queue mbx_heartbeat to the worker thread for processing. */ + if (pmbox->mbxcommand == mbx_heartbeat) { + spin_lock_irqsave(&phba->hbalock, iflags); + /* release the mailbox command posting token */ + phba->sli.sli_flag &= ~lpfc_sli_mbox_active; + phba->sli.mbox_active = null; + if (bf_get(lpfc_trailer_consumed, mcqe)) + lpfc_sli4_mq_release(phba->sli4_hba.mbx_wq); + spin_unlock_irqrestore(&phba->hbalock, iflags); + + /* post the next mbox command, if there is one */ + lpfc_sli4_post_async_mbox(phba); + + /* process cmpl now */ + if (pmb->mbox_cmpl) + pmb->mbox_cmpl(phba, pmb); + return false; + } + + /* there is mailbox completion work to queue to the worker thread */
|
Storage
|
a22d73b655a8ec6d41f08790e28ee19dc55d0d33
|
james smart
|
drivers
|
scsi
|
lpfc
|
scsi: mpt3sas: add support for shared host tagset for cpu hotplug
|
mpt fusion adapters can steer completions to individual queues and we now have support for shared host-wide tags in the i/o stack. the addition of the host-wide tags allows us to enable multiqueue support for mpt fusion adapters. once host-wise tags are enabled, the cpu hotplug feature is also supported.
|
this release allows to map an uid to a different one in a mount; it also adds support for selecting the preemption model at runtime; support for a low-overhead memory error detector designed to be used in production; support for the acrn hypervisor designed for embedded systems; btrfs initial support for zoned devices, subpage blocks sizes and performance improvements; support for eager nfs writes; support for a thermal power management to control the surface temperature of embedded devices in an unified way; the napi polling can be moved to a kernel thread; and support for non-blocking path lookups. as always, there are many other features, new drivers, improvements and fixes.
|
add support for shared host tagset for cpu hotplug
|
['core (various)', 'file systems', 'memory management', 'block layer', 'tracing, perf and bpf', 'virtualization', 'cryptography', 'security', 'networking', 'architectures x86 arm risc-v powerpc mips csky s390 pa-risc c6x']
|
['graphics', 'power management', 'storage', 'drivers in the staging area', 'networking', 'audio', 'tablets, touch screens, keyboards, mouses', 'tv tuners, webcams, video capturers', 'universal serial bus', 'serial peripheral interface (spi)', 'watchdog', 'serial', 'cpu frequency scaling', 'device voltage and frequency scaling', 'voltage, current regulators, power capping, power supply', 'real time clock (rtc)', 'pin controllers (pinctrl)', 'multi media card (mmc)', 'memory technology devices (mtd)', 'industrial i/o (iio)', 'multi function devices (mfd)', 'pulse-width modulation (pwm)', 'inter-integrated circuit (i2c + i3c)', 'hardware monitoring (hwmon)', 'general purpose i/o (gpio)', 'leds', 'dma engines', 'cryptography hardware acceleration', 'pci', 'non-transparent bridge (ntb)', 'thunderbolt', 'clock', 'phy ("physical layer" framework)', 'cxl (compute express link)', 'various']
|
['scsi ', 'mpt3sas']
|
['h', 'c']
| 3
| 75
| 18
|
--- diff --git a/drivers/scsi/mpt3sas/mpt3sas_base.c b/drivers/scsi/mpt3sas/mpt3sas_base.c --- a/drivers/scsi/mpt3sas/mpt3sas_base.c +++ b/drivers/scsi/mpt3sas/mpt3sas_base.c - return ioc->cpu_msix_table[raw_smp_processor_id()]; -} + if (scmd && ioc->shost->nr_hw_queues > 1) { + u32 tag = blk_mq_unique_tag(scmd->request); -/** - * _base_sdev_nr_inflight_request -get number of inflight requests - * of a request queue. - * @q: request_queue object - * - * returns number of inflight request of a request queue. - */ -inline unsigned long -_base_sdev_nr_inflight_request(struct request_queue *q) -{ - struct blk_mq_hw_ctx *hctx = q->queue_hw_ctx[0]; + return blk_mq_unique_tag_to_hwq(tag) + + ioc->high_iops_queues; + } - return atomic_read(&hctx->nr_active); + return ioc->cpu_msix_table[raw_smp_processor_id()]; - - if (_base_sdev_nr_inflight_request(scmd->device->request_queue) > + + if (atomic_read(&scmd->device->device_busy) > - unsigned int tag = scmd->request->tag; + u32 tag, unique_tag; + + unique_tag = blk_mq_unique_tag(scmd->request); + tag = blk_mq_unique_tag_to_tag(unique_tag); + + /* + * store hw queue number corresponding to the tag. + * this hw queue number is used later to determine + * the unique_tag using the logic below. this unique_tag + * is used to retrieve the scmd pointer corresponding + * to tag using scsi_host_find_tag() api. + * + * tag = smid - 1; + * unique_tag = ioc->io_queue_num[tag] << blk_mq_unique_tag_bits | tag; + */ + ioc->io_queue_num[tag] = blk_mq_unique_tag_to_hwq(unique_tag); + ioc->io_queue_num[smid - 1] = 0; + + kfree(ioc->io_queue_num); + ioc->io_queue_num = null; + + ioc->io_queue_num = kcalloc(ioc->scsiio_depth, + sizeof(u16), gfp_kernel); + if (!ioc->io_queue_num) + goto out; diff --git a/drivers/scsi/mpt3sas/mpt3sas_base.h b/drivers/scsi/mpt3sas/mpt3sas_base.h --- a/drivers/scsi/mpt3sas/mpt3sas_base.h +++ b/drivers/scsi/mpt3sas/mpt3sas_base.h + u16 *io_queue_num; diff --git a/drivers/scsi/mpt3sas/mpt3sas_scsih.c b/drivers/scsi/mpt3sas/mpt3sas_scsih.c --- a/drivers/scsi/mpt3sas/mpt3sas_scsih.c +++ b/drivers/scsi/mpt3sas/mpt3sas_scsih.c +#include <linux/blk-mq-pci.h> +static int host_tagset_enable = 1; +module_param(host_tagset_enable, int, 0444); +module_parm_desc(host_tagset_enable, + "shared host tagset enable/disable default: enable(1)"); + + u16 tag = smid - 1; - u32 unique_tag = smid - 1; + u32 unique_tag = + ioc->io_queue_num[tag] << blk_mq_unique_tag_bits | tag; +/** + * scsih_map_queues - map reply queues with request queues + * @shost: scsi host pointer + */ +static int scsih_map_queues(struct scsi_host *shost) +{ + struct mpt3sas_adapter *ioc = + (struct mpt3sas_adapter *)shost->hostdata; + + if (ioc->shost->nr_hw_queues == 1) + return 0; + + return blk_mq_pci_map_queues(&shost->tag_set.map[hctx_type_default], + ioc->pdev, ioc->high_iops_queues); +} + + .map_queues = scsih_map_queues, + shost->host_tagset = 0; + shost->nr_hw_queues = 1; + + if (ioc->is_gen35_ioc && ioc->reply_queue_count > 1 && + host_tagset_enable && ioc->smp_affinity_enable) { + + shost->host_tagset = 1; + shost->nr_hw_queues = + ioc->reply_queue_count - ioc->high_iops_queues; + + dev_info(&ioc->pdev->dev, + "max scsiio mpt commands: %d shared with nr_hw_queues = %d ", + shost->can_queue, shost->nr_hw_queues); + } +
|
Storage
|
664f0dce20580837c7fa136a03b3a9fc43034104
|
sreekanth reddy
|
drivers
|
scsi
|
mpt3sas
|
scsi: qla2xxx: implementation to get and manage host, target stats and initiator port
|
this statistics will help in debugging process and checking specific error counts. it also provides a capability to isolate the port or bring it out of isolation.
|
this release allows to map an uid to a different one in a mount; it also adds support for selecting the preemption model at runtime; support for a low-overhead memory error detector designed to be used in production; support for the acrn hypervisor designed for embedded systems; btrfs initial support for zoned devices, subpage blocks sizes and performance improvements; support for eager nfs writes; support for a thermal power management to control the surface temperature of embedded devices in an unified way; the napi polling can be moved to a kernel thread; and support for non-blocking path lookups. as always, there are many other features, new drivers, improvements and fixes.
|
implementation to get and manage host, target stats and initiator port
|
['core (various)', 'file systems', 'memory management', 'block layer', 'tracing, perf and bpf', 'virtualization', 'cryptography', 'security', 'networking', 'architectures x86 arm risc-v powerpc mips csky s390 pa-risc c6x']
|
['graphics', 'power management', 'storage', 'drivers in the staging area', 'networking', 'audio', 'tablets, touch screens, keyboards, mouses', 'tv tuners, webcams, video capturers', 'universal serial bus', 'serial peripheral interface (spi)', 'watchdog', 'serial', 'cpu frequency scaling', 'device voltage and frequency scaling', 'voltage, current regulators, power capping, power supply', 'real time clock (rtc)', 'pin controllers (pinctrl)', 'multi media card (mmc)', 'memory technology devices (mtd)', 'industrial i/o (iio)', 'multi function devices (mfd)', 'pulse-width modulation (pwm)', 'inter-integrated circuit (i2c + i3c)', 'hardware monitoring (hwmon)', 'general purpose i/o (gpio)', 'leds', 'dma engines', 'cryptography hardware acceleration', 'pci', 'non-transparent bridge (ntb)', 'thunderbolt', 'clock', 'phy ("physical layer" framework)', 'cxl (compute express link)', 'various']
|
['scsi ', 'qla2xxx']
|
['h', 'c']
| 10
| 718
| 0
|
--- diff --git a/drivers/scsi/qla2xxx/qla_attr.c b/drivers/scsi/qla2xxx/qla_attr.c --- a/drivers/scsi/qla2xxx/qla_attr.c +++ b/drivers/scsi/qla2xxx/qla_attr.c + if (vha->hw->flags.port_isolated) { + ql_log(ql_log_info, vha, 0x706e, + "port is isolated, returning. "); + return -einval; + } + + if (vha->hw->flags.port_isolated) + return 0; + diff --git a/drivers/scsi/qla2xxx/qla_bsg.c b/drivers/scsi/qla2xxx/qla_bsg.c --- a/drivers/scsi/qla2xxx/qla_bsg.c +++ b/drivers/scsi/qla2xxx/qla_bsg.c +#include "qla_gbl.h" +static int +qla2x00_manage_host_stats(struct bsg_job *bsg_job) +{ + scsi_qla_host_t *vha = shost_priv(fc_bsg_to_shost(bsg_job)); + struct fc_bsg_reply *bsg_reply = bsg_job->reply; + struct ql_vnd_mng_host_stats_param *req_data; + struct ql_vnd_mng_host_stats_resp rsp_data; + u32 req_data_len; + int ret = 0; + + if (!vha->flags.online) { + ql_log(ql_log_warn, vha, 0x0000, "host is not online. "); + return -eio; + } + + req_data_len = bsg_job->request_payload.payload_len; + + if (req_data_len != sizeof(struct ql_vnd_mng_host_stats_param)) { + ql_log(ql_log_warn, vha, 0x0000, "req_data_len invalid. "); + return -eio; + } + + req_data = kzalloc(sizeof(*req_data), gfp_kernel); + if (!req_data) { + ql_log(ql_log_warn, vha, 0x0000, "req_data memory allocation failure. "); + return -enomem; + } + + /* copy the request buffer in req_data */ + sg_copy_to_buffer(bsg_job->request_payload.sg_list, + bsg_job->request_payload.sg_cnt, req_data, + req_data_len); + + switch (req_data->action) { + case qla_stop: + ret = qla2xxx_stop_stats(vha->host, req_data->stat_type); + break; + case qla_start: + ret = qla2xxx_start_stats(vha->host, req_data->stat_type); + break; + case qla_clear: + ret = qla2xxx_reset_stats(vha->host, req_data->stat_type); + break; + default: + ql_log(ql_log_warn, vha, 0x0000, "invalid action. "); + ret = -eio; + break; + } + + kfree(req_data); + + /* prepare response */ + rsp_data.status = ret; + bsg_job->reply_payload.payload_len = sizeof(struct ql_vnd_mng_host_stats_resp); + + bsg_reply->reply_data.vendor_reply.vendor_rsp[0] = ext_status_ok; + bsg_reply->reply_payload_rcv_len = + sg_copy_from_buffer(bsg_job->reply_payload.sg_list, + bsg_job->reply_payload.sg_cnt, + &rsp_data, + sizeof(struct ql_vnd_mng_host_stats_resp)); + + bsg_reply->result = did_ok; + bsg_job_done(bsg_job, bsg_reply->result, + bsg_reply->reply_payload_rcv_len); + + return ret; +} + +static int +qla2x00_get_host_stats(struct bsg_job *bsg_job) +{ + scsi_qla_host_t *vha = shost_priv(fc_bsg_to_shost(bsg_job)); + struct fc_bsg_reply *bsg_reply = bsg_job->reply; + struct ql_vnd_stats_param *req_data; + struct ql_vnd_host_stats_resp rsp_data; + u32 req_data_len; + int ret = 0; + u64 ini_entry_count = 0; + u64 entry_count = 0; + u64 tgt_num = 0; + u64 tmp_stat_type = 0; + u64 response_len = 0; + void *data; + + req_data_len = bsg_job->request_payload.payload_len; + + if (req_data_len != sizeof(struct ql_vnd_stats_param)) { + ql_log(ql_log_warn, vha, 0x0000, "req_data_len invalid. "); + return -eio; + } + + req_data = kzalloc(sizeof(*req_data), gfp_kernel); + if (!req_data) { + ql_log(ql_log_warn, vha, 0x0000, "req_data memory allocation failure. "); + return -enomem; + } + + /* copy the request buffer in req_data */ + sg_copy_to_buffer(bsg_job->request_payload.sg_list, + bsg_job->request_payload.sg_cnt, req_data, req_data_len); + + /* copy stat type to work on it */ + tmp_stat_type = req_data->stat_type; + + if (tmp_stat_type & qla2xx_tgt_sht_lnk_down) { + /* num of tgts connected to this host */ + tgt_num = qla2x00_get_num_tgts(vha); + /* unset bit_17 */ + tmp_stat_type &= ~(1 << 17); + } + + /* total ini stats */ + ini_entry_count = qla2x00_count_set_bits(tmp_stat_type); + + /* total number of entries */ + entry_count = ini_entry_count + tgt_num; + + response_len = sizeof(struct ql_vnd_host_stats_resp) + + (sizeof(struct ql_vnd_stat_entry) * entry_count); + + if (response_len > bsg_job->reply_payload.payload_len) { + rsp_data.status = ext_status_buffer_too_small; + bsg_reply->reply_data.vendor_reply.vendor_rsp[0] = ext_status_buffer_too_small; + bsg_job->reply_payload.payload_len = sizeof(struct ql_vnd_mng_host_stats_resp); + + bsg_reply->reply_payload_rcv_len = + sg_copy_from_buffer(bsg_job->reply_payload.sg_list, + bsg_job->reply_payload.sg_cnt, &rsp_data, + sizeof(struct ql_vnd_mng_host_stats_resp)); + + bsg_reply->result = did_ok; + bsg_job_done(bsg_job, bsg_reply->result, + bsg_reply->reply_payload_rcv_len); + goto host_stat_out; + } + + data = kzalloc(response_len, gfp_kernel); + + ret = qla2xxx_get_ini_stats(fc_bsg_to_shost(bsg_job), req_data->stat_type, + data, response_len); + + rsp_data.status = ext_status_ok; + bsg_reply->reply_data.vendor_reply.vendor_rsp[0] = ext_status_ok; + + bsg_reply->reply_payload_rcv_len = sg_copy_from_buffer(bsg_job->reply_payload.sg_list, + bsg_job->reply_payload.sg_cnt, + data, response_len); + bsg_reply->result = did_ok; + bsg_job_done(bsg_job, bsg_reply->result, + bsg_reply->reply_payload_rcv_len); + + kfree(data); +host_stat_out: + kfree(req_data); + return ret; +} + +static struct fc_rport * +qla2xxx_find_rport(scsi_qla_host_t *vha, uint32_t tgt_num) +{ + fc_port_t *fcport = null; + + list_for_each_entry(fcport, &vha->vp_fcports, list) { + if (fcport->rport->number == tgt_num) + return fcport->rport; + } + return null; +} + +static int +qla2x00_get_tgt_stats(struct bsg_job *bsg_job) +{ + scsi_qla_host_t *vha = shost_priv(fc_bsg_to_shost(bsg_job)); + struct fc_bsg_reply *bsg_reply = bsg_job->reply; + struct ql_vnd_tgt_stats_param *req_data; + u32 req_data_len; + int ret = 0; + u64 response_len = 0; + struct ql_vnd_tgt_stats_resp *data = null; + struct fc_rport *rport = null; + + if (!vha->flags.online) { + ql_log(ql_log_warn, vha, 0x0000, "host is not online. "); + return -eio; + } + + req_data_len = bsg_job->request_payload.payload_len; + + if (req_data_len != sizeof(struct ql_vnd_stat_entry)) { + ql_log(ql_log_warn, vha, 0x0000, "req_data_len invalid. "); + return -eio; + } + + req_data = kzalloc(sizeof(*req_data), gfp_kernel); + if (!req_data) { + ql_log(ql_log_warn, vha, 0x0000, "req_data memory allocation failure. "); + return -enomem; + } + + /* copy the request buffer in req_data */ + sg_copy_to_buffer(bsg_job->request_payload.sg_list, + bsg_job->request_payload.sg_cnt, + req_data, req_data_len); + + response_len = sizeof(struct ql_vnd_tgt_stats_resp) + + sizeof(struct ql_vnd_stat_entry); + + /* structure + size for one entry */ + data = kzalloc(response_len, gfp_kernel); + if (!data) { + kfree(req_data); + return -enomem; + } + + if (response_len > bsg_job->reply_payload.payload_len) { + data->status = ext_status_buffer_too_small; + bsg_reply->reply_data.vendor_reply.vendor_rsp[0] = ext_status_buffer_too_small; + bsg_job->reply_payload.payload_len = sizeof(struct ql_vnd_mng_host_stats_resp); + + bsg_reply->reply_payload_rcv_len = + sg_copy_from_buffer(bsg_job->reply_payload.sg_list, + bsg_job->reply_payload.sg_cnt, &data, + sizeof(struct ql_vnd_tgt_stats_resp)); + + bsg_reply->result = did_ok; + bsg_job_done(bsg_job, bsg_reply->result, + bsg_reply->reply_payload_rcv_len); + goto tgt_stat_out; + } + + rport = qla2xxx_find_rport(vha, req_data->tgt_id); + if (!rport) { + ql_log(ql_log_warn, vha, 0x0000, "target %d not found. ", req_data->tgt_id); + ret = ext_status_invalid_param; + data->status = ext_status_invalid_param; + goto reply; + } + + ret = qla2xxx_get_tgt_stats(fc_bsg_to_shost(bsg_job), req_data->stat_type, + rport, (void *)data, response_len); + + bsg_reply->reply_data.vendor_reply.vendor_rsp[0] = ext_status_ok; +reply: + bsg_reply->reply_payload_rcv_len = + sg_copy_from_buffer(bsg_job->reply_payload.sg_list, + bsg_job->reply_payload.sg_cnt, data, + response_len); + bsg_reply->result = did_ok; + bsg_job_done(bsg_job, bsg_reply->result, + bsg_reply->reply_payload_rcv_len); + +tgt_stat_out: + kfree(data); + kfree(req_data); + + return ret; +} + +static int +qla2x00_manage_host_port(struct bsg_job *bsg_job) +{ + scsi_qla_host_t *vha = shost_priv(fc_bsg_to_shost(bsg_job)); + struct fc_bsg_reply *bsg_reply = bsg_job->reply; + struct ql_vnd_mng_host_port_param *req_data; + struct ql_vnd_mng_host_port_resp rsp_data; + u32 req_data_len; + int ret = 0; + + req_data_len = bsg_job->request_payload.payload_len; + + if (req_data_len != sizeof(struct ql_vnd_mng_host_port_param)) { + ql_log(ql_log_warn, vha, 0x0000, "req_data_len invalid. "); + return -eio; + } + + req_data = kzalloc(sizeof(*req_data), gfp_kernel); + if (!req_data) { + ql_log(ql_log_warn, vha, 0x0000, "req_data memory allocation failure. "); + return -enomem; + } + + /* copy the request buffer in req_data */ + sg_copy_to_buffer(bsg_job->request_payload.sg_list, + bsg_job->request_payload.sg_cnt, req_data, req_data_len); + + switch (req_data->action) { + case qla_enable: + ret = qla2xxx_enable_port(vha->host); + break; + case qla_disable: + ret = qla2xxx_disable_port(vha->host); + break; + default: + ql_log(ql_log_warn, vha, 0x0000, "invalid action. "); + ret = -eio; + break; + } + + kfree(req_data); + + /* prepare response */ + rsp_data.status = ret; + bsg_reply->reply_data.vendor_reply.vendor_rsp[0] = ext_status_ok; + bsg_job->reply_payload.payload_len = sizeof(struct ql_vnd_mng_host_port_resp); + + bsg_reply->reply_payload_rcv_len = + sg_copy_from_buffer(bsg_job->reply_payload.sg_list, + bsg_job->reply_payload.sg_cnt, &rsp_data, + sizeof(struct ql_vnd_mng_host_port_resp)); + bsg_reply->result = did_ok; + bsg_job_done(bsg_job, bsg_reply->result, + bsg_reply->reply_payload_rcv_len); + + return ret; +} + + case ql_vnd_manage_host_stats: + return qla2x00_manage_host_stats(bsg_job); + + case ql_vnd_get_host_stats: + return qla2x00_get_host_stats(bsg_job); + + case ql_vnd_get_tgt_stats: + return qla2x00_get_tgt_stats(bsg_job); + + case ql_vnd_manage_host_port: + return qla2x00_manage_host_port(bsg_job); + + /* disable port will bring down the chip, allow enable command */ + if (bsg_request->rqst_data.h_vendor.vendor_cmd[0] == ql_vnd_manage_host_port || + bsg_request->rqst_data.h_vendor.vendor_cmd[0] == ql_vnd_get_host_stats) + goto skip_chip_chk; + + if (vha->hw->flags.port_isolated) { + bsg_reply->result = did_error; + /* operation not permitted */ + return -eperm; + } + +skip_chip_chk: diff --git a/drivers/scsi/qla2xxx/qla_bsg.h b/drivers/scsi/qla2xxx/qla_bsg.h --- a/drivers/scsi/qla2xxx/qla_bsg.h +++ b/drivers/scsi/qla2xxx/qla_bsg.h +#define ql_vnd_manage_host_stats 0x23 +#define ql_vnd_get_host_stats 0x24 +#define ql_vnd_get_tgt_stats 0x25 +#define ql_vnd_manage_host_port 0x26 +#define ext_status_buffer_too_small 16 diff --git a/drivers/scsi/qla2xxx/qla_def.h b/drivers/scsi/qla2xxx/qla_def.h --- a/drivers/scsi/qla2xxx/qla_def.h +++ b/drivers/scsi/qla2xxx/qla_def.h + + u64 tgt_short_link_down_cnt; + u64 tgt_link_down_time; + u64 dev_loss_tmo; + uint32_t port_isolated:1; + + u64 hw_err_cnt; + u64 interface_err_cnt; + u64 cmd_timeout_cnt; + u64 reset_cmd_err_cnt; + u64 link_down_time; + u64 short_link_down_cnt; +enum ql_vnd_host_stat_action { + qla_stop = 0, + qla_start, + qla_clear, +}; + +struct ql_vnd_mng_host_stats_param { + u32 stat_type; + enum ql_vnd_host_stat_action action; +} __packed; + +struct ql_vnd_mng_host_stats_resp { + u32 status; +} __packed; + +struct ql_vnd_stats_param { + u32 stat_type; +} __packed; + +struct ql_vnd_tgt_stats_param { + s32 tgt_id; + u32 stat_type; +} __packed; + +enum ql_vnd_host_port_action { + qla_enable = 0, + qla_disable, +}; + +struct ql_vnd_mng_host_port_param { + enum ql_vnd_host_port_action action; +} __packed; + +struct ql_vnd_mng_host_port_resp { + u32 status; +} __packed; + +struct ql_vnd_stat_entry { + u32 stat_type; /* failure type */ + u32 tgt_num; /* target num */ + u64 cnt; /* counter value */ +} __packed; + +struct ql_vnd_stats { + u64 entry_count; /* num of entries */ + u64 rservd; + struct ql_vnd_stat_entry entry[0]; /* place holder of entries */ +} __packed; + +struct ql_vnd_host_stats_resp { + u32 status; + struct ql_vnd_stats stats; +} __packed; + +struct ql_vnd_tgt_stats_resp { + u32 status; + struct ql_vnd_stats stats; +} __packed; + diff --git a/drivers/scsi/qla2xxx/qla_gbl.h b/drivers/scsi/qla2xxx/qla_gbl.h --- a/drivers/scsi/qla2xxx/qla_gbl.h +++ b/drivers/scsi/qla2xxx/qla_gbl.h + +#define qla2xx_hw_error bit_0 +#define qla2xx_sht_lnk_dwn bit_1 +#define qla2xx_int_err bit_2 +#define qla2xx_cmd_timeout bit_3 +#define qla2xx_reset_cmd_err bit_4 +#define qla2xx_tgt_sht_lnk_down bit_17 + +#define qla2xx_max_link_down_time 100 + +int qla2xxx_start_stats(struct scsi_host *shost, u32 flags); +int qla2xxx_stop_stats(struct scsi_host *shost, u32 flags); +int qla2xxx_reset_stats(struct scsi_host *shost, u32 flags); + +int qla2xxx_get_ini_stats(struct scsi_host *shost, u32 flags, void *data, u64 size); +int qla2xxx_get_tgt_stats(struct scsi_host *shost, u32 flags, + struct fc_rport *rport, void *data, u64 size); +int qla2xxx_disable_port(struct scsi_host *shost); +int qla2xxx_enable_port(struct scsi_host *shost); + +uint64_t qla2x00_get_num_tgts(scsi_qla_host_t *vha); +uint64_t qla2x00_count_set_bits(u32 num); + diff --git a/drivers/scsi/qla2xxx/qla_gs.c b/drivers/scsi/qla2xxx/qla_gs.c --- a/drivers/scsi/qla2xxx/qla_gs.c +++ b/drivers/scsi/qla2xxx/qla_gs.c + fcport->tgt_link_down_time = 0; diff --git a/drivers/scsi/qla2xxx/qla_init.c b/drivers/scsi/qla2xxx/qla_init.c --- a/drivers/scsi/qla2xxx/qla_init.c +++ b/drivers/scsi/qla2xxx/qla_init.c + fcport->tgt_link_down_time = qla2xx_max_link_down_time; + fcport->tgt_short_link_down_cnt = 0; + fcport->dev_loss_tmo = 0; + fcport->dev_loss_tmo = rport->dev_loss_tmo; + if (fcport->tgt_link_down_time < fcport->dev_loss_tmo) { + fcport->tgt_short_link_down_cnt++; + fcport->tgt_link_down_time = qla2xx_max_link_down_time; + } + + if (vha->hw->flags.port_isolated) + return status; + + if (vha->hw->flags.port_isolated) { + qla2x00_abort_isp_cleanup(vha); + return status; + } + + +uint64_t +qla2x00_count_set_bits(uint32_t num) +{ + /* brian kernighan's algorithm */ + u64 count = 0; + + while (num) { + num &= (num - 1); + count++; + } + return count; +} + +uint64_t +qla2x00_get_num_tgts(scsi_qla_host_t *vha) +{ + fc_port_t *f, *tf; + u64 count = 0; + + f = null; + tf = null; + + list_for_each_entry_safe(f, tf, &vha->vp_fcports, list) { + if (f->port_type != fct_target) + continue; + count++; + } + return count; +} + +int qla2xxx_reset_stats(struct scsi_host *host, u32 flags) +{ + scsi_qla_host_t *vha = shost_priv(host); + fc_port_t *fcport = null; + unsigned long int_flags; + + if (flags & qla2xx_hw_error) + vha->hw_err_cnt = 0; + if (flags & qla2xx_sht_lnk_dwn) + vha->short_link_down_cnt = 0; + if (flags & qla2xx_int_err) + vha->interface_err_cnt = 0; + if (flags & qla2xx_cmd_timeout) + vha->cmd_timeout_cnt = 0; + if (flags & qla2xx_reset_cmd_err) + vha->reset_cmd_err_cnt = 0; + if (flags & qla2xx_tgt_sht_lnk_down) { + spin_lock_irqsave(&vha->hw->tgt.sess_lock, int_flags); + list_for_each_entry(fcport, &vha->vp_fcports, list) { + fcport->tgt_short_link_down_cnt = 0; + fcport->tgt_link_down_time = qla2xx_max_link_down_time; + } + spin_unlock_irqrestore(&vha->hw->tgt.sess_lock, int_flags); + } + vha->link_down_time = qla2xx_max_link_down_time; + return 0; +} + +int qla2xxx_start_stats(struct scsi_host *host, u32 flags) +{ + return qla2xxx_reset_stats(host, flags); +} + +int qla2xxx_stop_stats(struct scsi_host *host, u32 flags) +{ + return qla2xxx_reset_stats(host, flags); +} + +int qla2xxx_get_ini_stats(struct scsi_host *host, u32 flags, + void *data, u64 size) +{ + scsi_qla_host_t *vha = shost_priv(host); + struct ql_vnd_host_stats_resp *resp = (struct ql_vnd_host_stats_resp *)data; + struct ql_vnd_stats *rsp_data = &resp->stats; + u64 ini_entry_count = 0; + u64 i = 0; + u64 entry_count = 0; + u64 num_tgt = 0; + u32 tmp_stat_type = 0; + fc_port_t *fcport = null; + unsigned long int_flags; + + /* copy stat type to work on it */ + tmp_stat_type = flags; + + if (tmp_stat_type & bit_17) { + num_tgt = qla2x00_get_num_tgts(vha); + /* unset bit_17 */ + tmp_stat_type &= ~(1 << 17); + } + ini_entry_count = qla2x00_count_set_bits(tmp_stat_type); + + entry_count = ini_entry_count + num_tgt; + + rsp_data->entry_count = entry_count; + + i = 0; + if (flags & qla2xx_hw_error) { + rsp_data->entry[i].stat_type = qla2xx_hw_error; + rsp_data->entry[i].tgt_num = 0x0; + rsp_data->entry[i].cnt = vha->hw_err_cnt; + i++; + } + + if (flags & qla2xx_sht_lnk_dwn) { + rsp_data->entry[i].stat_type = qla2xx_sht_lnk_dwn; + rsp_data->entry[i].tgt_num = 0x0; + rsp_data->entry[i].cnt = vha->short_link_down_cnt; + i++; + } + + if (flags & qla2xx_int_err) { + rsp_data->entry[i].stat_type = qla2xx_int_err; + rsp_data->entry[i].tgt_num = 0x0; + rsp_data->entry[i].cnt = vha->interface_err_cnt; + i++; + } + + if (flags & qla2xx_cmd_timeout) { + rsp_data->entry[i].stat_type = qla2xx_cmd_timeout; + rsp_data->entry[i].tgt_num = 0x0; + rsp_data->entry[i].cnt = vha->cmd_timeout_cnt; + i++; + } + + if (flags & qla2xx_reset_cmd_err) { + rsp_data->entry[i].stat_type = qla2xx_reset_cmd_err; + rsp_data->entry[i].tgt_num = 0x0; + rsp_data->entry[i].cnt = vha->reset_cmd_err_cnt; + i++; + } + + /* i will continue from previous loop, as target + * entries are after initiator + */ + if (flags & qla2xx_tgt_sht_lnk_down) { + spin_lock_irqsave(&vha->hw->tgt.sess_lock, int_flags); + list_for_each_entry(fcport, &vha->vp_fcports, list) { + if (fcport->port_type != fct_target) + continue; + if (!fcport->rport) + continue; + rsp_data->entry[i].stat_type = qla2xx_tgt_sht_lnk_down; + rsp_data->entry[i].tgt_num = fcport->rport->number; + rsp_data->entry[i].cnt = fcport->tgt_short_link_down_cnt; + i++; + } + spin_unlock_irqrestore(&vha->hw->tgt.sess_lock, int_flags); + } + resp->status = ext_status_ok; + + return 0; +} + +int qla2xxx_get_tgt_stats(struct scsi_host *host, u32 flags, + struct fc_rport *rport, void *data, u64 size) +{ + struct ql_vnd_tgt_stats_resp *tgt_data = data; + fc_port_t *fcport = *(fc_port_t **)rport->dd_data; + + tgt_data->status = 0; + tgt_data->stats.entry_count = 1; + tgt_data->stats.entry[0].stat_type = flags; + tgt_data->stats.entry[0].tgt_num = rport->number; + tgt_data->stats.entry[0].cnt = fcport->tgt_short_link_down_cnt; + + return 0; +} + +int qla2xxx_disable_port(struct scsi_host *host) +{ + scsi_qla_host_t *vha = shost_priv(host); + + vha->hw->flags.port_isolated = 1; + + if (qla2x00_chip_is_down(vha)) + return 0; + + if (vha->flags.online) { + qla2x00_abort_isp_cleanup(vha); + qla2x00_wait_for_sess_deletion(vha); + } + + return 0; +} + +int qla2xxx_enable_port(struct scsi_host *host) +{ + scsi_qla_host_t *vha = shost_priv(host); + + vha->hw->flags.port_isolated = 0; + /* set the flag to 1, so that isp_abort can proceed */ + vha->flags.online = 1; + set_bit(isp_abort_needed, &vha->dpc_flags); + qla2xxx_wake_dpc(vha); + + return 0; +} diff --git a/drivers/scsi/qla2xxx/qla_isr.c b/drivers/scsi/qla2xxx/qla_isr.c --- a/drivers/scsi/qla2xxx/qla_isr.c +++ b/drivers/scsi/qla2xxx/qla_isr.c + + vha->hw_err_cnt++; + + vha->hw_err_cnt++; + + vha->hw_err_cnt++; + + if (vha->link_down_time < vha->hw->port_down_retry_count) { + vha->short_link_down_cnt++; + vha->link_down_time = qla2xx_max_link_down_time; + } + + vha->link_down_time = 0; + vha->interface_err_cnt++; + vha->hw_err_cnt++; + vha->interface_err_cnt++; + + vha->interface_err_cnt++; + + vha->hw_err_cnt++; + vha->hw_err_cnt++; + vha->hw_err_cnt++; diff --git a/drivers/scsi/qla2xxx/qla_mbx.c b/drivers/scsi/qla2xxx/qla_mbx.c --- a/drivers/scsi/qla2xxx/qla_mbx.c +++ b/drivers/scsi/qla2xxx/qla_mbx.c + vha->hw_err_cnt++; + vha->hw_err_cnt++; + vha->hw_err_cnt++; + vha->hw_err_cnt++; + vha->hw_err_cnt++; + vha->hw_err_cnt++; + vha->hw_err_cnt++; + vha->hw_err_cnt++; + vha->hw_err_cnt++; diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c --- a/drivers/scsi/qla2xxx/qla_os.c +++ b/drivers/scsi/qla2xxx/qla_os.c + vha->cmd_timeout_cnt++; + + vha->reset_cmd_err_cnt++; + qla2xxx_reset_stats(host, qla2xx_hw_error | qla2xx_sht_lnk_dwn | + qla2xx_int_err | qla2xx_cmd_timeout | + qla2xx_reset_cmd_err | qla2xx_tgt_sht_lnk_down); + + fcport->tgt_short_link_down_cnt = 0; + unsigned long flags; + fc_port_t *fcport = null; + if (vha->link_down_time < qla2xx_max_link_down_time) + vha->link_down_time++; + + spin_lock_irqsave(&vha->hw->tgt.sess_lock, flags); + list_for_each_entry(fcport, &vha->vp_fcports, list) { + if (fcport->tgt_link_down_time < qla2xx_max_link_down_time) + fcport->tgt_link_down_time++; + } + spin_unlock_irqrestore(&vha->hw->tgt.sess_lock, flags); +
|
Storage
|
dbf1f53cfd238090c69f92725b91208b97eb53fe
|
saurav kashyap himanshu madhani himanshu madhani oracle com
|
drivers
|
scsi
|
qla2xxx
|
scsi: qla2xxx: add error counters to debugfs node
|
display error counters via debugfs node.
|
this release allows to map an uid to a different one in a mount; it also adds support for selecting the preemption model at runtime; support for a low-overhead memory error detector designed to be used in production; support for the acrn hypervisor designed for embedded systems; btrfs initial support for zoned devices, subpage blocks sizes and performance improvements; support for eager nfs writes; support for a thermal power management to control the surface temperature of embedded devices in an unified way; the napi polling can be moved to a kernel thread; and support for non-blocking path lookups. as always, there are many other features, new drivers, improvements and fixes.
|
add error counters to debugfs node
|
['core (various)', 'file systems', 'memory management', 'block layer', 'tracing, perf and bpf', 'virtualization', 'cryptography', 'security', 'networking', 'architectures x86 arm risc-v powerpc mips csky s390 pa-risc c6x']
|
['graphics', 'power management', 'storage', 'drivers in the staging area', 'networking', 'audio', 'tablets, touch screens, keyboards, mouses', 'tv tuners, webcams, video capturers', 'universal serial bus', 'serial peripheral interface (spi)', 'watchdog', 'serial', 'cpu frequency scaling', 'device voltage and frequency scaling', 'voltage, current regulators, power capping, power supply', 'real time clock (rtc)', 'pin controllers (pinctrl)', 'multi media card (mmc)', 'memory technology devices (mtd)', 'industrial i/o (iio)', 'multi function devices (mfd)', 'pulse-width modulation (pwm)', 'inter-integrated circuit (i2c + i3c)', 'hardware monitoring (hwmon)', 'general purpose i/o (gpio)', 'leds', 'dma engines', 'cryptography hardware acceleration', 'pci', 'non-transparent bridge (ntb)', 'thunderbolt', 'clock', 'phy ("physical layer" framework)', 'cxl (compute express link)', 'various']
|
['scsi ', 'qla2xxx']
|
['c']
| 1
| 28
| 0
|
--- diff --git a/drivers/scsi/qla2xxx/qla_dfs.c b/drivers/scsi/qla2xxx/qla_dfs.c --- a/drivers/scsi/qla2xxx/qla_dfs.c +++ b/drivers/scsi/qla2xxx/qla_dfs.c + fc_port_t *fcport = null; + + if (qla2x00_chip_is_down(vha)) + return 0; + + seq_puts(s, " "); + seq_puts(s, "initiator error counters "); + seq_printf(s, "hw error count = %14lld ", + vha->hw_err_cnt); + seq_printf(s, "link down count = %14lld ", + vha->short_link_down_cnt); + seq_printf(s, "interface err count = %14lld ", + vha->interface_err_cnt); + seq_printf(s, "cmd timeout count = %14lld ", + vha->cmd_timeout_cnt); + seq_printf(s, "reset count = %14lld ", + vha->reset_cmd_err_cnt); + seq_puts(s, " "); + + list_for_each_entry(fcport, &vha->vp_fcports, list) { + if (!fcport || !fcport->rport) + continue; + + seq_printf(s, "target num = %7d link down count = %14lld ", + fcport->rport->number, fcport->tgt_short_link_down_cnt); + } + seq_puts(s, " "); +
|
Storage
|
307862e6697a153a5645c75d86682b75ea471369
|
saurav kashyap himanshu madhani himanshu madhani oracle com
|
drivers
|
scsi
|
qla2xxx
|
scsi: scsi_transport_fc: add store capability to rport port_state in sysfs
|
add store capability to the rport port_state using sysfs under fc_remote_ports/rport-*/port_state.
|
this release allows to map an uid to a different one in a mount; it also adds support for selecting the preemption model at runtime; support for a low-overhead memory error detector designed to be used in production; support for the acrn hypervisor designed for embedded systems; btrfs initial support for zoned devices, subpage blocks sizes and performance improvements; support for eager nfs writes; support for a thermal power management to control the surface temperature of embedded devices in an unified way; the napi polling can be moved to a kernel thread; and support for non-blocking path lookups. as always, there are many other features, new drivers, improvements and fixes.
|
add store capability to rport port_state in sysfs
|
['core (various)', 'file systems', 'memory management', 'block layer', 'tracing, perf and bpf', 'virtualization', 'cryptography', 'security', 'networking', 'architectures x86 arm risc-v powerpc mips csky s390 pa-risc c6x']
|
['graphics', 'power management', 'storage', 'drivers in the staging area', 'networking', 'audio', 'tablets, touch screens, keyboards, mouses', 'tv tuners, webcams, video capturers', 'universal serial bus', 'serial peripheral interface (spi)', 'watchdog', 'serial', 'cpu frequency scaling', 'device voltage and frequency scaling', 'voltage, current regulators, power capping, power supply', 'real time clock (rtc)', 'pin controllers (pinctrl)', 'multi media card (mmc)', 'memory technology devices (mtd)', 'industrial i/o (iio)', 'multi function devices (mfd)', 'pulse-width modulation (pwm)', 'inter-integrated circuit (i2c + i3c)', 'hardware monitoring (hwmon)', 'general purpose i/o (gpio)', 'leds', 'dma engines', 'cryptography hardware acceleration', 'pci', 'non-transparent bridge (ntb)', 'thunderbolt', 'clock', 'phy ("physical layer" framework)', 'cxl (compute express link)', 'various']
|
['scsi ', 'scsi_transport_fc']
|
['c']
| 1
| 54
| 2
|
- marginal: this interface will set scmd_noretries_abort bit in - online: this interface will clear scmd_noretries_abort bit in --- diff --git a/drivers/scsi/scsi_transport_fc.c b/drivers/scsi/scsi_transport_fc.c --- a/drivers/scsi/scsi_transport_fc.c +++ b/drivers/scsi/scsi_transport_fc.c -fc_private_rport_rd_enum_attr(port_state, fc_portstate_max_namelen); +static ssize_t fc_rport_set_marginal_state(struct device *dev, + struct device_attribute *attr, + const char *buf, size_t count) +{ + struct fc_rport *rport = transport_class_to_rport(dev); + enum fc_port_state port_state; + int ret = 0; + + ret = get_fc_port_state_match(buf, &port_state); + if (ret) + return -einval; + if (port_state == fc_portstate_marginal) { + /* + * change the state to marginal only if the + * current rport state is online + * allow only online->marginal + */ + if (rport->port_state == fc_portstate_online) + rport->port_state = port_state; + else + return -einval; + } else if (port_state == fc_portstate_online) { + /* + * change the state to online only if the + * current rport state is marginal + * allow only marginal->online + */ + if (rport->port_state == fc_portstate_marginal) + rport->port_state = port_state; + else + return -einval; + } else + return -einval; + return count; +} + +static ssize_t +show_fc_rport_port_state(struct device *dev, + struct device_attribute *attr, char *buf) +{ + const char *name; + struct fc_rport *rport = transport_class_to_rport(dev); + + name = get_fc_port_state_name(rport->port_state); + if (!name) + return -einval; + + return snprintf(buf, 20, "%s ", name); +} + +static fc_device_attr(rport, port_state, 0444 | 0200, + show_fc_rport_port_state, fc_rport_set_marginal_state); + - setup_private_rport_attribute_rd(port_state); + setup_private_rport_attribute_rw(port_state);
|
Storage
|
afdd1126940068ef06c2b4b08b85a47a3eafba5b
|
muneendra kumar
|
drivers
|
scsi
| |
scsi: ufs: add "wb_on" sysfs node to control wb on/off
|
currently ufs writebooster driver uses clock scaling up/down to set wb on/off. for the platforms which don't support ufshcd_cap_clk_scaling, wb will be always on. provide a sysfs attribute to enable/disable wb during runtime. write 1/0 to "wb_on" sysfs node to enable/disable ufs wb.
|
this release allows to map an uid to a different one in a mount; it also adds support for selecting the preemption model at runtime; support for a low-overhead memory error detector designed to be used in production; support for the acrn hypervisor designed for embedded systems; btrfs initial support for zoned devices, subpage blocks sizes and performance improvements; support for eager nfs writes; support for a thermal power management to control the surface temperature of embedded devices in an unified way; the napi polling can be moved to a kernel thread; and support for non-blocking path lookups. as always, there are many other features, new drivers, improvements and fixes.
|
add "wb_on" sysfs node to control wb on/off
|
['core (various)', 'file systems', 'memory management', 'block layer', 'tracing, perf and bpf', 'virtualization', 'cryptography', 'security', 'networking', 'architectures x86 arm risc-v powerpc mips csky s390 pa-risc c6x']
|
['graphics', 'power management', 'storage', 'drivers in the staging area', 'networking', 'audio', 'tablets, touch screens, keyboards, mouses', 'tv tuners, webcams, video capturers', 'universal serial bus', 'serial peripheral interface (spi)', 'watchdog', 'serial', 'cpu frequency scaling', 'device voltage and frequency scaling', 'voltage, current regulators, power capping, power supply', 'real time clock (rtc)', 'pin controllers (pinctrl)', 'multi media card (mmc)', 'memory technology devices (mtd)', 'industrial i/o (iio)', 'multi function devices (mfd)', 'pulse-width modulation (pwm)', 'inter-integrated circuit (i2c + i3c)', 'hardware monitoring (hwmon)', 'general purpose i/o (gpio)', 'leds', 'dma engines', 'cryptography hardware acceleration', 'pci', 'non-transparent bridge (ntb)', 'thunderbolt', 'clock', 'phy ("physical layer" framework)', 'cxl (compute express link)', 'various']
|
['scsi ', 'ufs']
|
['h', 'c']
| 3
| 49
| 2
|
--- diff --git a/drivers/scsi/ufs/ufs-sysfs.c b/drivers/scsi/ufs/ufs-sysfs.c --- a/drivers/scsi/ufs/ufs-sysfs.c +++ b/drivers/scsi/ufs/ufs-sysfs.c +static ssize_t wb_on_show(struct device *dev, struct device_attribute *attr, + char *buf) +{ + struct ufs_hba *hba = dev_get_drvdata(dev); + + return sysfs_emit(buf, "%d ", hba->wb_enabled); +} + +static ssize_t wb_on_store(struct device *dev, struct device_attribute *attr, + const char *buf, size_t count) +{ + struct ufs_hba *hba = dev_get_drvdata(dev); + unsigned int wb_enable; + ssize_t res; + + if (!ufshcd_is_wb_allowed(hba) || ufshcd_is_clkscaling_supported(hba)) { + /* + * if the platform supports ufshcd_cap_clk_scaling, turn wb + * on/off will be done while clock scaling up/down. + */ + dev_warn(dev, "to control wb through wb_on is not allowed! "); + return -eopnotsupp; + } + + if (kstrtouint(buf, 0, &wb_enable)) + return -einval; + + if (wb_enable != 0 && wb_enable != 1) + return -einval; + + down(&hba->host_sem); + if (!ufshcd_is_user_access_allowed(hba)) { + res = -ebusy; + goto out; + } + + pm_runtime_get_sync(hba->dev); + res = ufshcd_wb_ctrl(hba, wb_enable); + pm_runtime_put_sync(hba->dev); +out: + up(&hba->host_sem); + return res < 0 ? res : count; +} + +static device_attr_rw(wb_on); + &dev_attr_wb_on.attr, diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c --- a/drivers/scsi/ufs/ufshcd.c +++ b/drivers/scsi/ufs/ufshcd.c -static int ufshcd_wb_ctrl(struct ufs_hba *hba, bool enable); -static int ufshcd_wb_ctrl(struct ufs_hba *hba, bool enable) +int ufshcd_wb_ctrl(struct ufs_hba *hba, bool enable) diff --git a/drivers/scsi/ufs/ufshcd.h b/drivers/scsi/ufs/ufshcd.h --- a/drivers/scsi/ufs/ufshcd.h +++ b/drivers/scsi/ufs/ufshcd.h +int ufshcd_wb_ctrl(struct ufs_hba *hba, bool enable); +
|
Storage
|
8e834ca551add86fd549b0830f36ec2f26d08667
|
bean huo avri altman avri altman wdc com stanley chu stanley chu mediatek com
|
drivers
|
scsi
|
ufs
|
scsi: ufs: ufs-debugfs: add error counters
|
people testing have a need to know how many errors might be occurring over time. add error counters and expose them via debugfs.
|
this release allows to map an uid to a different one in a mount; it also adds support for selecting the preemption model at runtime; support for a low-overhead memory error detector designed to be used in production; support for the acrn hypervisor designed for embedded systems; btrfs initial support for zoned devices, subpage blocks sizes and performance improvements; support for eager nfs writes; support for a thermal power management to control the surface temperature of embedded devices in an unified way; the napi polling can be moved to a kernel thread; and support for non-blocking path lookups. as always, there are many other features, new drivers, improvements and fixes.
|
add error counters
|
['core (various)', 'file systems', 'memory management', 'block layer', 'tracing, perf and bpf', 'virtualization', 'cryptography', 'security', 'networking', 'architectures x86 arm risc-v powerpc mips csky s390 pa-risc c6x']
|
['graphics', 'power management', 'storage', 'drivers in the staging area', 'networking', 'audio', 'tablets, touch screens, keyboards, mouses', 'tv tuners, webcams, video capturers', 'universal serial bus', 'serial peripheral interface (spi)', 'watchdog', 'serial', 'cpu frequency scaling', 'device voltage and frequency scaling', 'voltage, current regulators, power capping, power supply', 'real time clock (rtc)', 'pin controllers (pinctrl)', 'multi media card (mmc)', 'memory technology devices (mtd)', 'industrial i/o (iio)', 'multi function devices (mfd)', 'pulse-width modulation (pwm)', 'inter-integrated circuit (i2c + i3c)', 'hardware monitoring (hwmon)', 'general purpose i/o (gpio)', 'leds', 'dma engines', 'cryptography hardware acceleration', 'pci', 'non-transparent bridge (ntb)', 'thunderbolt', 'clock', 'phy ("physical layer" framework)', 'cxl (compute express link)', 'various']
|
['scsi ', 'ufs', 'ufs-debugfs']
|
['h', 'c', 'makefile']
| 5
| 111
| 4
|
--- diff --git a/drivers/scsi/ufs/makefile b/drivers/scsi/ufs/makefile --- a/drivers/scsi/ufs/makefile +++ b/drivers/scsi/ufs/makefile + +# the link order is important here. ufshcd-core must initialize +# before vendor drivers. +obj-$(config_scsi_ufshcd) += ufshcd-core.o +ufshcd-core-y += ufshcd.o ufs-sysfs.o +ufshcd-core-$(config_debug_fs) += ufs-debugfs.o +ufshcd-core-$(config_scsi_ufs_bsg) += ufs_bsg.o +ufshcd-core-$(config_scsi_ufs_crypto) += ufshcd-crypto.o + -obj-$(config_scsi_ufshcd) += ufshcd-core.o -ufshcd-core-y += ufshcd.o ufs-sysfs.o -ufshcd-core-$(config_scsi_ufs_bsg) += ufs_bsg.o -ufshcd-core-$(config_scsi_ufs_crypto) += ufshcd-crypto.o diff --git a/drivers/scsi/ufs/ufs-debugfs.c b/drivers/scsi/ufs/ufs-debugfs.c --- /dev/null +++ b/drivers/scsi/ufs/ufs-debugfs.c +// spdx-license-identifier: gpl-2.0 +// copyright (c) 2020 intel corporation + +#include <linux/debugfs.h> + +#include "ufs-debugfs.h" +#include "ufshcd.h" + +static struct dentry *ufs_debugfs_root; + +void __init ufs_debugfs_init(void) +{ + ufs_debugfs_root = debugfs_create_dir("ufshcd", null); +} + +void __exit ufs_debugfs_exit(void) +{ + debugfs_remove_recursive(ufs_debugfs_root); +} + +static int ufs_debugfs_stats_show(struct seq_file *s, void *data) +{ + struct ufs_hba *hba = s->private; + struct ufs_event_hist *e = hba->ufs_stats.event; + +#define prt(fmt, typ) \ + seq_printf(s, fmt, e[ufs_evt_ ## typ].cnt) + + prt("phy adapter layer errors (except linereset): %llu ", pa_err); + prt("data link layer errors: %llu ", dl_err); + prt("network layer errors: %llu ", nl_err); + prt("transport layer errors: %llu ", tl_err); + prt("generic dme errors: %llu ", dme_err); + prt("auto-hibernate errors: %llu ", auto_hibern8_err); + prt("is fatal errors (cefes, sbfes, hcfes, dfes): %llu ", fatal_err); + prt("dme link startup errors: %llu ", link_startup_fail); + prt("pm resume errors: %llu ", resume_err); + prt("pm suspend errors : %llu ", suspend_err); + prt("logical unit resets: %llu ", dev_reset); + prt("host resets: %llu ", host_reset); + prt("scsi command aborts: %llu ", abort); +#undef prt + return 0; +} +define_show_attribute(ufs_debugfs_stats); + +void ufs_debugfs_hba_init(struct ufs_hba *hba) +{ + hba->debugfs_root = debugfs_create_dir(dev_name(hba->dev), ufs_debugfs_root); + debugfs_create_file("stats", 0400, hba->debugfs_root, hba, &ufs_debugfs_stats_fops); +} + +void ufs_debugfs_hba_exit(struct ufs_hba *hba) +{ + debugfs_remove_recursive(hba->debugfs_root); +} diff --git a/drivers/scsi/ufs/ufs-debugfs.h b/drivers/scsi/ufs/ufs-debugfs.h --- /dev/null +++ b/drivers/scsi/ufs/ufs-debugfs.h +/* spdx-license-identifier: gpl-2.0 */ +/* copyright (c) 2020 intel corporation + */ + +#ifndef __ufs_debugfs_h__ +#define __ufs_debugfs_h__ + +struct ufs_hba; + +#ifdef config_debug_fs +void __init ufs_debugfs_init(void); +void __exit ufs_debugfs_exit(void); +void ufs_debugfs_hba_init(struct ufs_hba *hba); +void ufs_debugfs_hba_exit(struct ufs_hba *hba); +#else +static inline void ufs_debugfs_init(void) {} +static inline void ufs_debugfs_exit(void) {} +static inline void ufs_debugfs_hba_init(struct ufs_hba *hba) {} +static inline void ufs_debugfs_hba_exit(struct ufs_hba *hba) {} +#endif + +#endif diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c --- a/drivers/scsi/ufs/ufshcd.c +++ b/drivers/scsi/ufs/ufshcd.c +#include "ufs-debugfs.h" + e->cnt += 1; + ufs_debugfs_hba_init(hba); + + ufs_debugfs_hba_exit(hba); +static int __init ufshcd_core_init(void) +{ + ufs_debugfs_init(); + return 0; +} + +static void __exit ufshcd_core_exit(void) +{ + ufs_debugfs_exit(); +} + +module_init(ufshcd_core_init); +module_exit(ufshcd_core_exit); + diff --git a/drivers/scsi/ufs/ufshcd.h b/drivers/scsi/ufs/ufshcd.h --- a/drivers/scsi/ufs/ufshcd.h +++ b/drivers/scsi/ufs/ufshcd.h + * @cnt: error counter + unsigned long long cnt; +#ifdef config_debug_fs + struct dentry *debugfs_root; +#endif
|
Storage
|
b6cacaf2044fd9b82e5ceac88d8d17e04a01982f
|
adrian hunter
|
drivers
|
scsi
|
ufs
|
scsi: hisi_sas: enable debugfs support by default
|
add a config option to enable debugfs support by default. and if debugfs support is enabled by default, dump count default value is increased to 50 as generally users want something bigger than the current default in that situation.
|
this release allows to map an uid to a different one in a mount; it also adds support for selecting the preemption model at runtime; support for a low-overhead memory error detector designed to be used in production; support for the acrn hypervisor designed for embedded systems; btrfs initial support for zoned devices, subpage blocks sizes and performance improvements; support for eager nfs writes; support for a thermal power management to control the surface temperature of embedded devices in an unified way; the napi polling can be moved to a kernel thread; and support for non-blocking path lookups. as always, there are many other features, new drivers, improvements and fixes.
|
enable debugfs support by default
|
['core (various)', 'file systems', 'memory management', 'block layer', 'tracing, perf and bpf', 'virtualization', 'cryptography', 'security', 'networking', 'architectures x86 arm risc-v powerpc mips csky s390 pa-risc c6x']
|
['graphics', 'power management', 'storage', 'drivers in the staging area', 'networking', 'audio', 'tablets, touch screens, keyboards, mouses', 'tv tuners, webcams, video capturers', 'universal serial bus', 'serial peripheral interface (spi)', 'watchdog', 'serial', 'cpu frequency scaling', 'device voltage and frequency scaling', 'voltage, current regulators, power capping, power supply', 'real time clock (rtc)', 'pin controllers (pinctrl)', 'multi media card (mmc)', 'memory technology devices (mtd)', 'industrial i/o (iio)', 'multi function devices (mfd)', 'pulse-width modulation (pwm)', 'inter-integrated circuit (i2c + i3c)', 'hardware monitoring (hwmon)', 'general purpose i/o (gpio)', 'leds', 'dma engines', 'cryptography hardware acceleration', 'pci', 'non-transparent bridge (ntb)', 'thunderbolt', 'clock', 'phy ("physical layer" framework)', 'cxl (compute express link)', 'various']
|
['scsi ', 'hisi_sas']
|
['kconfig', 'c']
| 2
| 17
| 2
|
--- diff --git a/drivers/scsi/hisi_sas/kconfig b/drivers/scsi/hisi_sas/kconfig --- a/drivers/scsi/hisi_sas/kconfig +++ b/drivers/scsi/hisi_sas/kconfig + +config scsi_hisi_sas_debugfs_default_enable + bool "hisilicon sas debugging default enable" + depends on scsi_hisi_sas + help + set y to default enable debugfs for scsi_hisi_sas diff --git a/drivers/scsi/hisi_sas/hisi_sas_main.c b/drivers/scsi/hisi_sas/hisi_sas_main.c --- a/drivers/scsi/hisi_sas/hisi_sas_main.c +++ b/drivers/scsi/hisi_sas/hisi_sas_main.c +#if is_enabled(config_scsi_hisi_sas_debugfs_default_enable) +#define debugfs_enable_default "enabled" +bool hisi_sas_debugfs_enable = true; +u32 hisi_sas_debugfs_dump_count = 50; +#else +#define debugfs_enable_default "disabled" +u32 hisi_sas_debugfs_dump_count = 1; +#endif + -module_parm_desc(hisi_sas_debugfs_enable, "enable driver debugfs (default disabled)"); +module_parm_desc(hisi_sas_debugfs_enable, + "enable driver debugfs (default "debugfs_enable_default")"); -u32 hisi_sas_debugfs_dump_count = 1;
|
Storage
|
1dbe61bf7d760547d16ccf057572e641a653ad4a
|
luo jiaxing
|
drivers
|
scsi
|
hisi_sas
|
scsi: hisi_sas: add trace fifo debugfs support
|
the controller provides trace fifo dfx tool to assist link fault debugging and link optimization. this tool can be helpful when debugging link faults without sas analyzers. each phy has an independent trace fifo interface.
|
this release allows to map an uid to a different one in a mount; it also adds support for selecting the preemption model at runtime; support for a low-overhead memory error detector designed to be used in production; support for the acrn hypervisor designed for embedded systems; btrfs initial support for zoned devices, subpage blocks sizes and performance improvements; support for eager nfs writes; support for a thermal power management to control the surface temperature of embedded devices in an unified way; the napi polling can be moved to a kernel thread; and support for non-blocking path lookups. as always, there are many other features, new drivers, improvements and fixes.
|
add trace fifo debugfs support
|
['core (various)', 'file systems', 'memory management', 'block layer', 'tracing, perf and bpf', 'virtualization', 'cryptography', 'security', 'networking', 'architectures x86 arm risc-v powerpc mips csky s390 pa-risc c6x']
|
['graphics', 'power management', 'storage', 'drivers in the staging area', 'networking', 'audio', 'tablets, touch screens, keyboards, mouses', 'tv tuners, webcams, video capturers', 'universal serial bus', 'serial peripheral interface (spi)', 'watchdog', 'serial', 'cpu frequency scaling', 'device voltage and frequency scaling', 'voltage, current regulators, power capping, power supply', 'real time clock (rtc)', 'pin controllers (pinctrl)', 'multi media card (mmc)', 'memory technology devices (mtd)', 'industrial i/o (iio)', 'multi function devices (mfd)', 'pulse-width modulation (pwm)', 'inter-integrated circuit (i2c + i3c)', 'hardware monitoring (hwmon)', 'general purpose i/o (gpio)', 'leds', 'dma engines', 'cryptography hardware acceleration', 'pci', 'non-transparent bridge (ntb)', 'thunderbolt', 'clock', 'phy ("physical layer" framework)', 'cxl (compute express link)', 'various']
|
['scsi ', 'hisi_sas']
|
['h', 'c']
| 2
| 266
| 0
|
--- diff --git a/drivers/scsi/hisi_sas/hisi_sas.h b/drivers/scsi/hisi_sas/hisi_sas.h --- a/drivers/scsi/hisi_sas/hisi_sas.h +++ b/drivers/scsi/hisi_sas/hisi_sas.h +#define hisi_sas_fifo_data_dw_size 32 +struct hisi_sas_debugfs_fifo { + u32 signal_sel; + u32 dump_msk; + u32 dump_mode; + u32 trigger; + u32 trigger_msk; + u32 trigger_mode; + u32 rd_data[hisi_sas_fifo_data_dw_size]; +}; + + + /* trace fifo */ + struct hisi_sas_debugfs_fifo fifo; + struct dentry *debugfs_fifo_dentry; diff --git a/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c b/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c --- a/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c +++ b/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c +#define dfx_fifo_ctrl (port_base + 0x3a0) +#define dfx_fifo_ctrl_trigger_mode_off 0 +#define dfx_fifo_ctrl_trigger_mode_msk (0x7 << dfx_fifo_ctrl_trigger_mode_off) +#define dfx_fifo_ctrl_dump_mode_off 3 +#define dfx_fifo_ctrl_dump_mode_msk (0x7 << dfx_fifo_ctrl_dump_mode_off) +#define dfx_fifo_ctrl_signal_sel_off 6 +#define dfx_fifo_ctrl_signal_sel_msk (0xf << dfx_fifo_ctrl_signal_sel_off) +#define dfx_fifo_ctrl_dump_disable_off 10 +#define dfx_fifo_ctrl_dump_disable_msk (0x1 << dfx_fifo_ctrl_dump_disable_off) +#define dfx_fifo_trigger (port_base + 0x3a4) +#define dfx_fifo_trigger_msk (port_base + 0x3a8) +#define dfx_fifo_dump_msk (port_base + 0x3ac) +#define dfx_fifo_rd_data (port_base + 0x3b0) +enum fifo_dump_mode_v3_hw { + fifo_dump_forver = (1u << 0), + fifo_dump_after_trigger = (1u << 1), + fifo_dump_untill_trigger = (1u << 2), +}; + +enum fifo_trigger_mode_v3_hw { + fifo_trigger_edge = (1u << 0), + fifo_trigger_same_level = (1u << 1), + fifo_trigger_diff_level = (1u << 2), +}; + +static int debugfs_is_fifo_config_valid_v3_hw(struct hisi_sas_phy *phy) +{ + struct hisi_hba *hisi_hba = phy->hisi_hba; + + if (phy->fifo.signal_sel > 0xf) { + dev_info(hisi_hba->dev, "invalid signal select: %u ", + phy->fifo.signal_sel); + return -einval; + } + + switch (phy->fifo.dump_mode) { + case fifo_dump_forver: + case fifo_dump_after_trigger: + case fifo_dump_untill_trigger: + break; + default: + dev_info(hisi_hba->dev, "invalid dump mode: %u ", + phy->fifo.dump_mode); + return -einval; + } + + /* when fifo_dump_forver, no need to check trigger_mode */ + if (phy->fifo.dump_mode == fifo_dump_forver) + return 0; + + switch (phy->fifo.trigger_mode) { + case fifo_trigger_edge: + case fifo_trigger_same_level: + case fifo_trigger_diff_level: + break; + default: + dev_info(hisi_hba->dev, "invalid trigger mode: %u ", + phy->fifo.trigger_mode); + return -einval; + } + return 0; +} + +static int debugfs_update_fifo_config_v3_hw(struct hisi_sas_phy *phy) +{ + u32 trigger_mode = phy->fifo.trigger_mode; + u32 signal_sel = phy->fifo.signal_sel; + u32 dump_mode = phy->fifo.dump_mode; + struct hisi_hba *hisi_hba = phy->hisi_hba; + int phy_no = phy->sas_phy.id; + u32 reg_val; + int res; + + /* check the validity of trace fifo configuration */ + res = debugfs_is_fifo_config_valid_v3_hw(phy); + if (res) + return res; + + reg_val = hisi_sas_phy_read32(hisi_hba, phy_no, dfx_fifo_ctrl); + /* disable trace fifo before update configuration */ + reg_val |= dfx_fifo_ctrl_dump_disable_msk; + + /* update trace fifo configuration */ + reg_val &= ~(dfx_fifo_ctrl_dump_mode_msk | + dfx_fifo_ctrl_signal_sel_msk | + dfx_fifo_ctrl_trigger_mode_msk); + + reg_val |= ((trigger_mode << dfx_fifo_ctrl_trigger_mode_off) | + (dump_mode << dfx_fifo_ctrl_dump_mode_off) | + (signal_sel << dfx_fifo_ctrl_signal_sel_off)); + hisi_sas_phy_write32(hisi_hba, phy_no, dfx_fifo_ctrl, reg_val); + + hisi_sas_phy_write32(hisi_hba, phy_no, dfx_fifo_dump_msk, + phy->fifo.dump_msk); + + hisi_sas_phy_write32(hisi_hba, phy_no, dfx_fifo_trigger, + phy->fifo.trigger); + + hisi_sas_phy_write32(hisi_hba, phy_no, dfx_fifo_trigger_msk, + phy->fifo.trigger_msk); + + /* enable trace fifo after updated configuration */ + reg_val = hisi_sas_phy_read32(hisi_hba, phy_no, dfx_fifo_ctrl); + reg_val &= ~dfx_fifo_ctrl_dump_disable_msk; + hisi_sas_phy_write32(hisi_hba, phy_no, dfx_fifo_ctrl, reg_val); + + return 0; +} + +static ssize_t debugfs_fifo_update_cfg_v3_hw_write(struct file *filp, + const char __user *buf, + size_t count, loff_t *ppos) +{ + struct hisi_sas_phy *phy = filp->private_data; + bool update; + int val; + + val = kstrtobool_from_user(buf, count, &update); + if (val) + return val; + + if (update != 1) + return -einval; + + val = debugfs_update_fifo_config_v3_hw(phy); + if (val) + return val; + + return count; +} + +static const struct file_operations debugfs_fifo_update_cfg_v3_hw_fops = { + .open = simple_open, + .write = debugfs_fifo_update_cfg_v3_hw_write, + .owner = this_module, +}; + +static void debugfs_read_fifo_data_v3_hw(struct hisi_sas_phy *phy) +{ + struct hisi_hba *hisi_hba = phy->hisi_hba; + u32 *buf = phy->fifo.rd_data; + int phy_no = phy->sas_phy.id; + u32 val; + int i; + + memset(buf, 0, sizeof(phy->fifo.rd_data)); + + /* disable trace fifo before read data */ + val = hisi_sas_phy_read32(hisi_hba, phy_no, dfx_fifo_ctrl); + val |= dfx_fifo_ctrl_dump_disable_msk; + hisi_sas_phy_write32(hisi_hba, phy_no, dfx_fifo_ctrl, val); + + for (i = 0; i < hisi_sas_fifo_data_dw_size; i++) { + val = hisi_sas_phy_read32(hisi_hba, phy_no, + dfx_fifo_rd_data); + buf[i] = val; + } + + /* enable trace fifo after read data */ + val = hisi_sas_phy_read32(hisi_hba, phy_no, dfx_fifo_ctrl); + val &= ~dfx_fifo_ctrl_dump_disable_msk; + hisi_sas_phy_write32(hisi_hba, phy_no, dfx_fifo_ctrl, val); +} + +static int debugfs_fifo_data_v3_hw_show(struct seq_file *s, void *p) +{ + struct hisi_sas_phy *phy = s->private; + + debugfs_read_fifo_data_v3_hw(phy); + + debugfs_show_row_32_v3_hw(s, 0, hisi_sas_fifo_data_dw_size * 4, + phy->fifo.rd_data); + + return 0; +} +define_show_attribute(debugfs_fifo_data_v3_hw); + +static void debugfs_fifo_init_v3_hw(struct hisi_hba *hisi_hba) +{ + int phy_no; + + hisi_hba->debugfs_fifo_dentry = + debugfs_create_dir("fifo", hisi_hba->debugfs_dir); + + for (phy_no = 0; phy_no < hisi_hba->n_phy; phy_no++) { + struct hisi_sas_phy *phy = &hisi_hba->phy[phy_no]; + struct dentry *port_dentry; + char name[256]; + u32 val; + + /* get default configuration for trace fifo */ + val = hisi_sas_phy_read32(hisi_hba, phy_no, dfx_fifo_ctrl); + val &= dfx_fifo_ctrl_dump_mode_msk; + val >>= dfx_fifo_ctrl_dump_mode_off; + phy->fifo.dump_mode = val; + + val = hisi_sas_phy_read32(hisi_hba, phy_no, dfx_fifo_ctrl); + val &= dfx_fifo_ctrl_trigger_mode_msk; + val >>= dfx_fifo_ctrl_trigger_mode_off; + phy->fifo.trigger_mode = val; + + val = hisi_sas_phy_read32(hisi_hba, phy_no, dfx_fifo_ctrl); + val &= dfx_fifo_ctrl_signal_sel_msk; + val >>= dfx_fifo_ctrl_signal_sel_off; + phy->fifo.signal_sel = val; + + val = hisi_sas_phy_read32(hisi_hba, phy_no, dfx_fifo_dump_msk); + phy->fifo.dump_msk = val; + + val = hisi_sas_phy_read32(hisi_hba, phy_no, dfx_fifo_trigger); + phy->fifo.trigger = val; + val = hisi_sas_phy_read32(hisi_hba, phy_no, dfx_fifo_trigger_msk); + phy->fifo.trigger_msk = val; + + snprintf(name, 256, "%d", phy_no); + port_dentry = debugfs_create_dir(name, + hisi_hba->debugfs_fifo_dentry); + + debugfs_create_file("update_config", 0200, port_dentry, phy, + &debugfs_fifo_update_cfg_v3_hw_fops); + + debugfs_create_file("signal_sel", 0600, port_dentry, + &phy->fifo.signal_sel, + &debugfs_v3_hw_fops); + + debugfs_create_file("dump_msk", 0600, port_dentry, + &phy->fifo.dump_msk, + &debugfs_v3_hw_fops); + + debugfs_create_file("dump_mode", 0600, port_dentry, + &phy->fifo.dump_mode, + &debugfs_v3_hw_fops); + + debugfs_create_file("trigger_mode", 0600, port_dentry, + &phy->fifo.trigger_mode, + &debugfs_v3_hw_fops); + + debugfs_create_file("trigger", 0600, port_dentry, + &phy->fifo.trigger, + &debugfs_v3_hw_fops); + + debugfs_create_file("trigger_msk", 0600, port_dentry, + &phy->fifo.trigger_msk, + &debugfs_v3_hw_fops); + + debugfs_create_file("fifo_data", 0400, port_dentry, phy, + &debugfs_fifo_data_v3_hw_fops); + } +} + + debugfs_fifo_init_v3_hw(hisi_hba);
|
Storage
|
cd96fe600cc4924d8d0cc6e3161870219c0d2c12
|
luo jiaxing
|
drivers
|
scsi
|
hisi_sas
|
scsi: drop gdth driver
|
the gdth driver refers to a scsi parallel, pci-only hba raid adapter which was manufactured by the now-defunct icp vortex company, later acquired by adaptec and superseded by the aacraid series of controllers. the driver itself would require a major overhaul before any modifications can be attempted, but seeing that it's unlikely to have any users left it should rather be removed completely.
|
this release allows to map an uid to a different one in a mount; it also adds support for selecting the preemption model at runtime; support for a low-overhead memory error detector designed to be used in production; support for the acrn hypervisor designed for embedded systems; btrfs initial support for zoned devices, subpage blocks sizes and performance improvements; support for eager nfs writes; support for a thermal power management to control the surface temperature of embedded devices in an unified way; the napi polling can be moved to a kernel thread; and support for non-blocking path lookups. as always, there are many other features, new drivers, improvements and fixes.
|
drop gdth driver
|
['core (various)', 'file systems', 'memory management', 'block layer', 'tracing, perf and bpf', 'virtualization', 'cryptography', 'security', 'networking', 'architectures x86 arm risc-v powerpc mips csky s390 pa-risc c6x']
|
['graphics', 'power management', 'storage', 'drivers in the staging area', 'networking', 'audio', 'tablets, touch screens, keyboards, mouses', 'tv tuners, webcams, video capturers', 'universal serial bus', 'serial peripheral interface (spi)', 'watchdog', 'serial', 'cpu frequency scaling', 'device voltage and frequency scaling', 'voltage, current regulators, power capping, power supply', 'real time clock (rtc)', 'pin controllers (pinctrl)', 'multi media card (mmc)', 'memory technology devices (mtd)', 'industrial i/o (iio)', 'multi function devices (mfd)', 'pulse-width modulation (pwm)', 'inter-integrated circuit (i2c + i3c)', 'hardware monitoring (hwmon)', 'general purpose i/o (gpio)', 'leds', 'dma engines', 'cryptography hardware acceleration', 'pci', 'non-transparent bridge (ntb)', 'thunderbolt', 'clock', 'phy ("physical layer" framework)', 'cxl (compute express link)', 'various']
|
['scsi ']
|
['c', 'h', 'kconfig', 'rst', 'makefile']
| 11
| 1
| 6,183
|
--- diff --git a/documentation/kbuild/makefiles.rst b/documentation/kbuild/makefiles.rst --- a/documentation/kbuild/makefiles.rst +++ b/documentation/kbuild/makefiles.rst - cflags_gdth.o = # -ddebug_gdth=2 -d__serial__ -d__com2__ \ - -dgdth_statistics - these two lines specify compilation flags for aha152x.o and gdth.o. + this line specify compilation flags for aha152x.o. diff --git a/documentation/process/magic-number.rst b/documentation/process/magic-number.rst --- a/documentation/process/magic-number.rst +++ b/documentation/process/magic-number.rst -gdtioctl_magic 0x06030f07 gdth_iowr_str ''drivers/scsi/gdth_ioctl.h'' -dpmem_magic 0xc0ffee11 gdt_pci_sram ''drivers/scsi/gdth.h'' diff --git a/documentation/scsi/scsi-parameters.rst b/documentation/scsi/scsi-parameters.rst --- a/documentation/scsi/scsi-parameters.rst +++ b/documentation/scsi/scsi-parameters.rst - gdth= [hw,scsi] - see header of drivers/scsi/gdth.c. - diff --git a/documentation/userspace-api/ioctl/ioctl-number.rst b/documentation/userspace-api/ioctl/ioctl-number.rst --- a/documentation/userspace-api/ioctl/ioctl-number.rst +++ b/documentation/userspace-api/ioctl/ioctl-number.rst -'j' 00-1f drivers/scsi/gdth_ioctl.h diff --git a/drivers/scsi/kconfig b/drivers/scsi/kconfig --- a/drivers/scsi/kconfig +++ b/drivers/scsi/kconfig -config scsi_gdth - tristate "intel/icp (former gdt scsi disk array) raid controller support" - depends on pci && scsi - help - formerly called gdt scsi disk array controller support. - - this is a driver for raid/scsi disk array controllers (eisa/isa/pci) - manufactured by intel corporation/icp vortex gmbh. it is documented - in the kernel source in <file:drivers/scsi/gdth.c> and - <file:drivers/scsi/gdth.h>. - - to compile this driver as a module, choose m here: the - module will be called gdth. - diff --git a/drivers/scsi/makefile b/drivers/scsi/makefile --- a/drivers/scsi/makefile +++ b/drivers/scsi/makefile -cflags_gdth.o = # -ddebug_gdth=2 -d__serial__ -d__com2__ -dgdth_statistics -obj-$(config_scsi_gdth) += gdth.o diff --git a/drivers/scsi/gdth.c b/drivers/scsi/gdth.c --- a/drivers/scsi/gdth.c +++ /dev/null -// spdx-license-identifier: gpl-2.0-or-later -/************************************************************************ - * linux driver for * - * icp vortex gmbh: gdt pci disk array controllers * - * intel corporation: storage raid controllers * - * * - * gdth.c * - * copyright (c) 1995-06 icp vortex gmbh, achim leubner * - * copyright (c) 2002-04 intel corporation * - * copyright (c) 2003-06 adaptec inc. * - * <achim_leubner@adaptec.com> * - * * - * additions/fixes: * - * boji tony kannanthanam <boji.t.kannanthanam@intel.com> * - * johannes dinner <johannes_dinner@adaptec.com> * - * * - * * - * linux kernel 2.6.x supported * - * * - ************************************************************************/ - -/* all gdt disk array controllers are fully supported by this driver. - * this includes the pci scsi disk array controllers and the - * pci fibre channel disk array controllers. see gdth.h for a complete - * list of all controller types. - * - * after the optional list of irq values, other possible - * command line options are: - * disable:y disable driver - * disable:n enable driver - * reserve_mode:0 reserve no drives for the raw service - * reserve_mode:1 reserve all not init., removable drives - * reserve_mode:2 reserve all not init. drives - * reserve_list:h,b,t,l,h,b,t,l,... reserve particular drive(s) with - * h- controller no., b- channel no., - * t- target id, l- lun - * reverse_scan:y reverse scan order for pci controllers - * reverse_scan:n scan pci controllers like bios - * max_ids:x x - target id count per channel (1..maxid) - * rescan:y rescan all channels/ids - * rescan:n use all devices found until now - * hdr_channel:x x - number of virtual bus for host drives - * shared_access:y disable driver reserve/release protocol to - * access a shared resource from several nodes, - * appropriate controller firmware required - * shared_access:n enable driver reserve/release protocol - * force_dma32:y use only 32 bit dma mode - * force_dma32:n use 64 bit dma mode, if supported - * - * the default values are: "gdth=disable:n,reserve_mode:1,reverse_scan:n, - * max_ids:127,rescan:n,hdr_channel:0, - * shared_access:y,force_dma32:n". - * here is another example: "gdth=reserve_list:0,1,2,0,0,1,3,0,rescan:y". - * - * when loading the gdth driver as a module, the same options are available. - * you can set the irqs with "irq=...". however, the syntax to specify the - * options changes slightly. you must replace all ',' between options - * with ' ' and all ':' with '=' and you must use - * '1' in place of 'y' and '0' in place of 'n'. - * - * default: "modprobe gdth disable=0 reserve_mode=1 reverse_scan=0 - * max_ids=127 rescan=0 hdr_channel=0 shared_access=0 - * force_dma32=0" - * the other example: "modprobe gdth reserve_list=0,1,2,0,0,1,3,0 rescan=1". - */ - -/* the meaning of the scsi_pointer members in this driver is as follows: - * ptr: chaining - * this_residual: unused - * buffer: unused - * dma_handle: unused - * buffers_residual: unused - * status: unused - * message: unused - * have_data_in: unused - * sent_command: unused - * phase: unused - */ - -/* statistics */ -#define gdth_statistics - -#include <linux/module.h> - -#include <linux/version.h> -#include <linux/kernel.h> -#include <linux/types.h> -#include <linux/pci.h> -#include <linux/string.h> -#include <linux/ctype.h> -#include <linux/ioport.h> -#include <linux/delay.h> -#include <linux/interrupt.h> -#include <linux/in.h> -#include <linux/proc_fs.h> -#include <linux/time.h> -#include <linux/timer.h> -#include <linux/dma-mapping.h> -#include <linux/list.h> -#include <linux/mutex.h> -#include <linux/slab.h> -#include <linux/reboot.h> - -#include <asm/dma.h> -#include <asm/io.h> -#include <linux/uaccess.h> -#include <linux/spinlock.h> -#include <linux/blkdev.h> -#include <linux/scatterlist.h> - -#include "scsi.h" -#include <scsi/scsi_host.h> -#include "gdth.h" - -static define_mutex(gdth_mutex); -static void gdth_delay(int milliseconds); -static void gdth_eval_mapping(u32 size, u32 *cyls, int *heads, int *secs); -static irqreturn_t gdth_interrupt(int irq, void *dev_id); -static irqreturn_t __gdth_interrupt(gdth_ha_str *ha, - int gdth_from_wait, int* pindex); -static int gdth_sync_event(gdth_ha_str *ha, int service, u8 index, - struct scsi_cmnd *scp); -static int gdth_async_event(gdth_ha_str *ha); -static void gdth_log_event(gdth_evt_data *dvr, char *buffer); - -static void gdth_putq(gdth_ha_str *ha, struct scsi_cmnd *scp, u8 priority); -static void gdth_next(gdth_ha_str *ha); -static int gdth_fill_raw_cmd(gdth_ha_str *ha, struct scsi_cmnd *scp, u8 b); -static int gdth_special_cmd(gdth_ha_str *ha, struct scsi_cmnd *scp); -static gdth_evt_str *gdth_store_event(gdth_ha_str *ha, u16 source, - u16 idx, gdth_evt_data *evt); -static int gdth_read_event(gdth_ha_str *ha, int handle, gdth_evt_str *estr); -static void gdth_readapp_event(gdth_ha_str *ha, u8 application, - gdth_evt_str *estr); -static void gdth_clear_events(void); - -static void gdth_copy_internal_data(gdth_ha_str *ha, struct scsi_cmnd *scp, - char *buffer, u16 count); -static int gdth_internal_cache_cmd(gdth_ha_str *ha, struct scsi_cmnd *scp); -static int gdth_fill_cache_cmd(gdth_ha_str *ha, struct scsi_cmnd *scp, - u16 hdrive); - -static void gdth_enable_int(gdth_ha_str *ha); -static int gdth_test_busy(gdth_ha_str *ha); -static int gdth_get_cmd_index(gdth_ha_str *ha); -static void gdth_release_event(gdth_ha_str *ha); -static int gdth_wait(gdth_ha_str *ha, int index,u32 time); -static int gdth_internal_cmd(gdth_ha_str *ha, u8 service, u16 opcode, - u32 p1, u64 p2,u64 p3); -static int gdth_search_drives(gdth_ha_str *ha); -static int gdth_analyse_hdrive(gdth_ha_str *ha, u16 hdrive); - -static const char *gdth_ctr_name(gdth_ha_str *ha); - -static int gdth_open(struct inode *inode, struct file *filep); -static int gdth_close(struct inode *inode, struct file *filep); -static long gdth_unlocked_ioctl(struct file *filep, unsigned int cmd, - unsigned long arg); - -static void gdth_flush(gdth_ha_str *ha); -static int gdth_queuecommand(struct scsi_host *h, struct scsi_cmnd *cmd); -static int __gdth_queuecommand(gdth_ha_str *ha, struct scsi_cmnd *scp, - struct gdth_cmndinfo *cmndinfo); -static void gdth_scsi_done(struct scsi_cmnd *scp); - -#ifdef debug_gdth -static u8 debugstate = debug_gdth; -#define trace(a) {if (debugstate==1) {printk a;}} -#define trace2(a) {if (debugstate==1 || debugstate==2) {printk a;}} -#define trace3(a) {if (debugstate!=0) {printk a;}} -#else /* !debug */ -#define trace(a) -#define trace2(a) -#define trace3(a) -#endif - -#ifdef gdth_statistics -static u32 max_rq=0, max_index=0, max_sg=0; -static u32 act_ints=0, act_ios=0, act_stats=0, act_rq=0; -static struct timer_list gdth_timer; -#endif - -#define ptr2ushort(a) (u16)(unsigned long)(a) -#define gdtoffsof(a,b) (size_t)&(((a*)0)->b) -#define index_ok(i,t) ((i)<array_size(t)) - -#define bus_l2p(a,b) ((b)>(a)->virt_bus ? (b-1):(b)) - -static u8 gdth_polling; /* polling if true */ -static int gdth_ctr_count = 0; /* controller count */ -static list_head(gdth_instances); /* controller list */ -static u8 gdth_write_through = false; /* write through */ -static gdth_evt_str ebuffer[max_events]; /* event buffer */ -static int elastidx; -static int eoldidx; -static int major; - -#define din 1 /* in data direction */ -#define dou 2 /* out data direction */ -#define dno din /* no data transfer */ -#define dun din /* unknown data direction */ -static u8 gdth_direction_tab[0x100] = { - dno,dno,din,din,dou,din,din,dou,din,dun,dou,dou,dun,dun,dun,din, - dno,din,din,dou,din,dou,dno,dno,dou,dno,din,dno,din,dou,dno,dun, - din,dun,din,dun,dou,din,dun,dun,din,din,dou,dno,dun,din,dou,dou, - dou,dou,dou,dno,din,dno,dno,din,dou,dou,dou,dou,din,dou,din,dou, - dou,dou,din,din,din,dno,dun,dno,dno,dno,dun,dno,dou,din,dun,dun, - dun,dun,dun,dun,dun,dou,dun,dun,dun,dun,din,dun,dun,dun,dun,dun, - dun,dun,dun,dun,dun,dun,dun,dun,dun,dun,dun,dun,dun,dun,dun,dun, - dun,dun,dun,dun,dun,dun,dun,dun,dun,dun,dun,dun,dun,dun,dun,dun, - dun,dun,dun,dun,dun,dun,dun,dun,din,dun,dou,dun,dun,dun,dun,dun, - dun,dun,dun,dun,dun,dun,dun,dun,dun,dun,dun,dun,dun,dun,din,dun, - dun,dun,dun,dun,dun,dno,dno,dun,din,dno,dou,dun,dno,dun,dou,dou, - dou,dou,dou,dno,dun,din,dou,din,din,dun,dun,dun,dun,dun,dun,dun, - dun,dun,dou,dun,dun,dun,dun,dun,dun,dun,dun,dun,dun,dun,dun,dun, - dun,dun,dun,dun,dun,dun,dun,dun,dun,dun,dun,dun,dun,dun,dun,dun, - dun,dun,dun,dun,dun,dun,dun,dun,dun,dun,dou,dun,dun,dun,dun,dun, - dun,dun,dun,dun,dun,dun,dun,dun,dun,dun,dun,dun,dun,dun,dun,dun -}; - -/* lilo and modprobe/insmod parameters */ -/* disable driver flag */ -static int disable __initdata = 0; -/* reserve flag */ -static int reserve_mode = 1; -/* reserve list */ -static int reserve_list[max_res_args] = -{0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, - 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, - 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff}; -/* scan order for pci controllers */ -static int reverse_scan = 0; -/* virtual channel for the host drives */ -static int hdr_channel = 0; -/* max. ids per channel */ -static int max_ids = maxid; -/* rescan all ids */ -static int rescan = 0; -/* shared access */ -static int shared_access = 1; -/* 64 bit dma mode, support for drives > 2 tb, if force_dma32 = 0 */ -static int force_dma32 = 0; - -/* parameters for modprobe/insmod */ -module_param(disable, int, 0); -module_param(reserve_mode, int, 0); -module_param_array(reserve_list, int, null, 0); -module_param(reverse_scan, int, 0); -module_param(hdr_channel, int, 0); -module_param(max_ids, int, 0); -module_param(rescan, int, 0); -module_param(shared_access, int, 0); -module_param(force_dma32, int, 0); -module_author("achim leubner"); -module_license("gpl"); - -/* ioctl interface */ -static const struct file_operations gdth_fops = { - .unlocked_ioctl = gdth_unlocked_ioctl, - .open = gdth_open, - .release = gdth_close, - .llseek = noop_llseek, -}; - -#include "gdth_proc.h" -#include "gdth_proc.c" - -static gdth_ha_str *gdth_find_ha(int hanum) -{ - gdth_ha_str *ha; - - list_for_each_entry(ha, &gdth_instances, list) - if (hanum == ha->hanum) - return ha; - - return null; -} - -static struct gdth_cmndinfo *gdth_get_cmndinfo(gdth_ha_str *ha) -{ - struct gdth_cmndinfo *priv = null; - unsigned long flags; - int i; - - spin_lock_irqsave(&ha->smp_lock, flags); - - for (i=0; i<gdth_maxcmds; ++i) { - if (ha->cmndinfo[i].index == 0) { - priv = &ha->cmndinfo[i]; - memset(priv, 0, sizeof(*priv)); - priv->index = i+1; - break; - } - } - - spin_unlock_irqrestore(&ha->smp_lock, flags); - - return priv; -} - -static void gdth_put_cmndinfo(struct gdth_cmndinfo *priv) -{ - bug_on(!priv); - priv->index = 0; -} - -static void gdth_delay(int milliseconds) -{ - if (milliseconds == 0) { - udelay(1); - } else { - mdelay(milliseconds); - } -} - -static void gdth_scsi_done(struct scsi_cmnd *scp) -{ - struct gdth_cmndinfo *cmndinfo = gdth_cmnd_priv(scp); - int internal_command = cmndinfo->internal_command; - - trace2(("gdth_scsi_done() ")); - - gdth_put_cmndinfo(cmndinfo); - scp->host_scribble = null; - - if (internal_command) - complete((struct completion *)scp->request); - else - scp->scsi_done(scp); -} - -static int __gdth_execute(struct scsi_device *sdev, gdth_cmd_str *gdtcmd, - char *cmnd, int timeout, u32 *info) -{ - gdth_ha_str *ha = shost_priv(sdev->host); - struct scsi_cmnd *scp; - struct gdth_cmndinfo cmndinfo; - declare_completion_onstack(wait); - int rval; - - scp = kzalloc(sizeof(*scp), gfp_kernel); - if (!scp) - return -enomem; - - scp->sense_buffer = kzalloc(scsi_sense_buffersize, gfp_kernel); - if (!scp->sense_buffer) { - kfree(scp); - return -enomem; - } - - scp->device = sdev; - memset(&cmndinfo, 0, sizeof(cmndinfo)); - - /* use request field to save the ptr. to completion struct. */ - scp->request = (struct request *)&wait; - scp->cmd_len = 12; - scp->cmnd = cmnd; - cmndinfo.priority = ioctl_pri; - cmndinfo.internal_cmd_str = gdtcmd; - cmndinfo.internal_command = 1; - - trace(("__gdth_execute() cmd 0x%x ", scp->cmnd[0])); - __gdth_queuecommand(ha, scp, &cmndinfo); - - wait_for_completion(&wait); - - rval = cmndinfo.status; - if (info) - *info = cmndinfo.info; - kfree(scp->sense_buffer); - kfree(scp); - return rval; -} - -int gdth_execute(struct scsi_host *shost, gdth_cmd_str *gdtcmd, char *cmnd, - int timeout, u32 *info) -{ - struct scsi_device *sdev = scsi_get_host_dev(shost); - int rval = __gdth_execute(sdev, gdtcmd, cmnd, timeout, info); - - scsi_free_host_dev(sdev); - return rval; -} - -static void gdth_eval_mapping(u32 size, u32 *cyls, int *heads, int *secs) -{ - *cyls = size /heads/secs; - if (*cyls <= maxcyls) { - *heads = heads; - *secs = secs; - } else { /* too high for 64*32 */ - *cyls = size /medheads/medsecs; - if (*cyls <= maxcyls) { - *heads = medheads; - *secs = medsecs; - } else { /* too high for 127*63 */ - *cyls = size /bigheads/bigsecs; - *heads = bigheads; - *secs = bigsecs; - } - } -} - -static bool gdth_search_vortex(u16 device) -{ - if (device <= pci_device_id_vortex_gdt6555) - return true; - if (device >= pci_device_id_vortex_gdt6x17rp && - device <= pci_device_id_vortex_gdtmaxrp) - return true; - if (device == pci_device_id_vortex_gdtnewrx || - device == pci_device_id_vortex_gdtnewrx2) - return true; - return false; -} - -static int gdth_pci_probe_one(gdth_pci_str *pcistr, gdth_ha_str **ha_out); -static int gdth_pci_init_one(struct pci_dev *pdev, - const struct pci_device_id *ent); -static void gdth_pci_remove_one(struct pci_dev *pdev); -static void gdth_remove_one(gdth_ha_str *ha); - -/* vortex only makes raid controllers. - * we do not really want to specify all 550 ids here, so wildcard match. - */ -static const struct pci_device_id gdthtable[] = { - { pci_vdevice(vortex, pci_any_id) }, - { pci_vdevice(intel, pci_device_id_intel_src) }, - { pci_vdevice(intel, pci_device_id_intel_src_xscale) }, - { } /* terminate list */ -}; -module_device_table(pci, gdthtable); - -static struct pci_driver gdth_pci_driver = { - .name = "gdth", - .id_table = gdthtable, - .probe = gdth_pci_init_one, - .remove = gdth_pci_remove_one, -}; - -static void gdth_pci_remove_one(struct pci_dev *pdev) -{ - gdth_ha_str *ha = pci_get_drvdata(pdev); - - list_del(&ha->list); - gdth_remove_one(ha); - - pci_disable_device(pdev); -} - -static int gdth_pci_init_one(struct pci_dev *pdev, - const struct pci_device_id *ent) -{ - u16 vendor = pdev->vendor; - u16 device = pdev->device; - unsigned long base0, base1, base2; - int rc; - gdth_pci_str gdth_pcistr; - gdth_ha_str *ha = null; - - trace(("gdth_search_dev() cnt %d vendor %x device %x ", - gdth_ctr_count, vendor, device)); - - memset(&gdth_pcistr, 0, sizeof(gdth_pcistr)); - - if (vendor == pci_vendor_id_vortex && !gdth_search_vortex(device)) - return -enodev; - - rc = pci_enable_device(pdev); - if (rc) - return rc; - - if (gdth_ctr_count >= maxha) - return -ebusy; - - /* gdt pci controller found, resources are already in pdev */ - gdth_pcistr.pdev = pdev; - base0 = pci_resource_flags(pdev, 0); - base1 = pci_resource_flags(pdev, 1); - base2 = pci_resource_flags(pdev, 2); - if (device <= pci_device_id_vortex_gdt6000b || /* gdt6000/b */ - device >= pci_device_id_vortex_gdt6x17rp) { /* mpr */ - if (!(base0 & ioresource_mem)) - return -enodev; - gdth_pcistr.dpmem = pci_resource_start(pdev, 0); - } else { /* gdt6110, gdt6120, .. */ - if (!(base0 & ioresource_mem) || - !(base2 & ioresource_mem) || - !(base1 & ioresource_io)) - return -enodev; - gdth_pcistr.dpmem = pci_resource_start(pdev, 2); - gdth_pcistr.io = pci_resource_start(pdev, 1); - } - trace2(("controller found at %d/%d, irq %d, dpmem 0x%lx ", - gdth_pcistr.pdev->bus->number, - pci_slot(gdth_pcistr.pdev->devfn), - gdth_pcistr.irq, - gdth_pcistr.dpmem)); - - rc = gdth_pci_probe_one(&gdth_pcistr, &ha); - if (rc) - return rc; - - return 0; -} - -static int gdth_init_pci(struct pci_dev *pdev, gdth_pci_str *pcistr, - gdth_ha_str *ha) -{ - register gdt6_dpram_str __iomem *dp6_ptr; - register gdt6c_dpram_str __iomem *dp6c_ptr; - register gdt6m_dpram_str __iomem *dp6m_ptr; - u32 retries; - u8 prot_ver; - u16 command; - int i, found = false; - - trace(("gdth_init_pci() ")); - - if (pdev->vendor == pci_vendor_id_intel) - ha->oem_id = oem_id_intel; - else - ha->oem_id = oem_id_icp; - ha->brd_phys = (pdev->bus->number << 8) | (pdev->devfn & 0xf8); - ha->stype = (u32)pdev->device; - ha->irq = pdev->irq; - ha->pdev = pdev; - - if (ha->pdev->device <= pci_device_id_vortex_gdt6000b) { /* gdt6000/b */ - trace2(("init_pci() dpmem %lx irq %d ",pcistr->dpmem,ha->irq)); - ha->brd = ioremap(pcistr->dpmem, sizeof(gdt6_dpram_str)); - if (ha->brd == null) { - printk("gdt-pci: initialization error (dpmem remap error) "); - return 0; - } - /* check and reset interface area */ - dp6_ptr = ha->brd; - writel(dpmem_magic, &dp6_ptr->u); - if (readl(&dp6_ptr->u) != dpmem_magic) { - printk("gdt-pci: cannot access dpmem at 0x%lx (shadowed?) ", - pcistr->dpmem); - found = false; - for (i = 0xc8000; i < 0xe8000; i += 0x4000) { - iounmap(ha->brd); - ha->brd = ioremap(i, sizeof(u16)); - if (ha->brd == null) { - printk("gdt-pci: initialization error (dpmem remap error) "); - return 0; - } - if (readw(ha->brd) != 0xffff) { - trace2(("init_pci_old() address 0x%x busy ", i)); - continue; - } - iounmap(ha->brd); - pci_write_config_dword(pdev, pci_base_address_0, i); - ha->brd = ioremap(i, sizeof(gdt6_dpram_str)); - if (ha->brd == null) { - printk("gdt-pci: initialization error (dpmem remap error) "); - return 0; - } - dp6_ptr = ha->brd; - writel(dpmem_magic, &dp6_ptr->u); - if (readl(&dp6_ptr->u) == dpmem_magic) { - printk("gdt-pci: use free address at 0x%x ", i); - found = true; - break; - } - } - if (!found) { - printk("gdt-pci: no free address found! "); - iounmap(ha->brd); - return 0; - } - } - memset_io(&dp6_ptr->u, 0, sizeof(dp6_ptr->u)); - if (readl(&dp6_ptr->u) != 0) { - printk("gdt-pci: initialization error (dpmem write error) "); - iounmap(ha->brd); - return 0; - } - - /* disable board interrupts, deinit services */ - writeb(0xff, &dp6_ptr->io.irqdel); - writeb(0x00, &dp6_ptr->io.irqen); - writeb(0x00, &dp6_ptr->u.ic.s_status); - writeb(0x00, &dp6_ptr->u.ic.cmd_index); - - writel(pcistr->dpmem, &dp6_ptr->u.ic.s_info[0]); - writeb(0xff, &dp6_ptr->u.ic.s_cmd_indx); - writeb(0, &dp6_ptr->io.event); - retries = init_retries; - gdth_delay(20); - while (readb(&dp6_ptr->u.ic.s_status) != 0xff) { - if (--retries == 0) { - printk("gdt-pci: initialization error (deinit failed) "); - iounmap(ha->brd); - return 0; - } - gdth_delay(1); - } - prot_ver = (u8)readl(&dp6_ptr->u.ic.s_info[0]); - writeb(0, &dp6_ptr->u.ic.s_status); - writeb(0xff, &dp6_ptr->io.irqdel); - if (prot_ver != protocol_version) { - printk("gdt-pci: illegal protocol version "); - iounmap(ha->brd); - return 0; - } - - ha->type = gdt_pci; - ha->ic_all_size = sizeof(dp6_ptr->u); - - /* special command to controller bios */ - writel(0x00, &dp6_ptr->u.ic.s_info[0]); - writel(0x00, &dp6_ptr->u.ic.s_info[1]); - writel(0x00, &dp6_ptr->u.ic.s_info[2]); - writel(0x00, &dp6_ptr->u.ic.s_info[3]); - writeb(0xfe, &dp6_ptr->u.ic.s_cmd_indx); - writeb(0, &dp6_ptr->io.event); - retries = init_retries; - gdth_delay(20); - while (readb(&dp6_ptr->u.ic.s_status) != 0xfe) { - if (--retries == 0) { - printk("gdt-pci: initialization error "); - iounmap(ha->brd); - return 0; - } - gdth_delay(1); - } - writeb(0, &dp6_ptr->u.ic.s_status); - writeb(0xff, &dp6_ptr->io.irqdel); - - ha->dma64_support = 0; - - } else if (ha->pdev->device <= pci_device_id_vortex_gdt6555) { /* gdt6110, ... */ - ha->plx = (gdt6c_plx_regs *)pcistr->io; - trace2(("init_pci_new() dpmem %lx irq %d ", - pcistr->dpmem,ha->irq)); - ha->brd = ioremap(pcistr->dpmem, sizeof(gdt6c_dpram_str)); - if (ha->brd == null) { - printk("gdt-pci: initialization error (dpmem remap error) "); - iounmap(ha->brd); - return 0; - } - /* check and reset interface area */ - dp6c_ptr = ha->brd; - writel(dpmem_magic, &dp6c_ptr->u); - if (readl(&dp6c_ptr->u) != dpmem_magic) { - printk("gdt-pci: cannot access dpmem at 0x%lx (shadowed?) ", - pcistr->dpmem); - found = false; - for (i = 0xc8000; i < 0xe8000; i += 0x4000) { - iounmap(ha->brd); - ha->brd = ioremap(i, sizeof(u16)); - if (ha->brd == null) { - printk("gdt-pci: initialization error (dpmem remap error) "); - return 0; - } - if (readw(ha->brd) != 0xffff) { - trace2(("init_pci_plx() address 0x%x busy ", i)); - continue; - } - iounmap(ha->brd); - pci_write_config_dword(pdev, pci_base_address_2, i); - ha->brd = ioremap(i, sizeof(gdt6c_dpram_str)); - if (ha->brd == null) { - printk("gdt-pci: initialization error (dpmem remap error) "); - return 0; - } - dp6c_ptr = ha->brd; - writel(dpmem_magic, &dp6c_ptr->u); - if (readl(&dp6c_ptr->u) == dpmem_magic) { - printk("gdt-pci: use free address at 0x%x ", i); - found = true; - break; - } - } - if (!found) { - printk("gdt-pci: no free address found! "); - iounmap(ha->brd); - return 0; - } - } - memset_io(&dp6c_ptr->u, 0, sizeof(dp6c_ptr->u)); - if (readl(&dp6c_ptr->u) != 0) { - printk("gdt-pci: initialization error (dpmem write error) "); - iounmap(ha->brd); - return 0; - } - - /* disable board interrupts, deinit services */ - outb(0x00,ptr2ushort(&ha->plx->control1)); - outb(0xff,ptr2ushort(&ha->plx->edoor_reg)); - - writeb(0x00, &dp6c_ptr->u.ic.s_status); - writeb(0x00, &dp6c_ptr->u.ic.cmd_index); - - writel(pcistr->dpmem, &dp6c_ptr->u.ic.s_info[0]); - writeb(0xff, &dp6c_ptr->u.ic.s_cmd_indx); - - outb(1,ptr2ushort(&ha->plx->ldoor_reg)); - - retries = init_retries; - gdth_delay(20); - while (readb(&dp6c_ptr->u.ic.s_status) != 0xff) { - if (--retries == 0) { - printk("gdt-pci: initialization error (deinit failed) "); - iounmap(ha->brd); - return 0; - } - gdth_delay(1); - } - prot_ver = (u8)readl(&dp6c_ptr->u.ic.s_info[0]); - writeb(0, &dp6c_ptr->u.ic.status); - if (prot_ver != protocol_version) { - printk("gdt-pci: illegal protocol version "); - iounmap(ha->brd); - return 0; - } - - ha->type = gdt_pcinew; - ha->ic_all_size = sizeof(dp6c_ptr->u); - - /* special command to controller bios */ - writel(0x00, &dp6c_ptr->u.ic.s_info[0]); - writel(0x00, &dp6c_ptr->u.ic.s_info[1]); - writel(0x00, &dp6c_ptr->u.ic.s_info[2]); - writel(0x00, &dp6c_ptr->u.ic.s_info[3]); - writeb(0xfe, &dp6c_ptr->u.ic.s_cmd_indx); - - outb(1,ptr2ushort(&ha->plx->ldoor_reg)); - - retries = init_retries; - gdth_delay(20); - while (readb(&dp6c_ptr->u.ic.s_status) != 0xfe) { - if (--retries == 0) { - printk("gdt-pci: initialization error "); - iounmap(ha->brd); - return 0; - } - gdth_delay(1); - } - writeb(0, &dp6c_ptr->u.ic.s_status); - - ha->dma64_support = 0; - - } else { /* mpr */ - trace2(("init_pci_mpr() dpmem %lx irq %d ",pcistr->dpmem,ha->irq)); - ha->brd = ioremap(pcistr->dpmem, sizeof(gdt6m_dpram_str)); - if (ha->brd == null) { - printk("gdt-pci: initialization error (dpmem remap error) "); - return 0; - } - - /* manipulate config. space to enable dpmem, start rp controller */ - pci_read_config_word(pdev, pci_command, &command); - command |= 6; - pci_write_config_word(pdev, pci_command, command); - gdth_delay(1); - - dp6m_ptr = ha->brd; - - /* ensure that it is safe to access the non hw portions of dpmem. - * aditional check needed for xscale based raid controllers */ - while( ((int)readb(&dp6m_ptr->i960r.sema0_reg) ) & 3 ) - gdth_delay(1); - - /* check and reset interface area */ - writel(dpmem_magic, &dp6m_ptr->u); - if (readl(&dp6m_ptr->u) != dpmem_magic) { - printk("gdt-pci: cannot access dpmem at 0x%lx (shadowed?) ", - pcistr->dpmem); - found = false; - for (i = 0xc8000; i < 0xe8000; i += 0x4000) { - iounmap(ha->brd); - ha->brd = ioremap(i, sizeof(u16)); - if (ha->brd == null) { - printk("gdt-pci: initialization error (dpmem remap error) "); - return 0; - } - if (readw(ha->brd) != 0xffff) { - trace2(("init_pci_mpr() address 0x%x busy ", i)); - continue; - } - iounmap(ha->brd); - pci_write_config_dword(pdev, pci_base_address_0, i); - ha->brd = ioremap(i, sizeof(gdt6m_dpram_str)); - if (ha->brd == null) { - printk("gdt-pci: initialization error (dpmem remap error) "); - return 0; - } - dp6m_ptr = ha->brd; - writel(dpmem_magic, &dp6m_ptr->u); - if (readl(&dp6m_ptr->u) == dpmem_magic) { - printk("gdt-pci: use free address at 0x%x ", i); - found = true; - break; - } - } - if (!found) { - printk("gdt-pci: no free address found! "); - iounmap(ha->brd); - return 0; - } - } - memset_io(&dp6m_ptr->u, 0, sizeof(dp6m_ptr->u)); - - /* disable board interrupts, deinit services */ - writeb(readb(&dp6m_ptr->i960r.edoor_en_reg) | 4, - &dp6m_ptr->i960r.edoor_en_reg); - writeb(0xff, &dp6m_ptr->i960r.edoor_reg); - writeb(0x00, &dp6m_ptr->u.ic.s_status); - writeb(0x00, &dp6m_ptr->u.ic.cmd_index); - - writel(pcistr->dpmem, &dp6m_ptr->u.ic.s_info[0]); - writeb(0xff, &dp6m_ptr->u.ic.s_cmd_indx); - writeb(1, &dp6m_ptr->i960r.ldoor_reg); - retries = init_retries; - gdth_delay(20); - while (readb(&dp6m_ptr->u.ic.s_status) != 0xff) { - if (--retries == 0) { - printk("gdt-pci: initialization error (deinit failed) "); - iounmap(ha->brd); - return 0; - } - gdth_delay(1); - } - prot_ver = (u8)readl(&dp6m_ptr->u.ic.s_info[0]); - writeb(0, &dp6m_ptr->u.ic.s_status); - if (prot_ver != protocol_version) { - printk("gdt-pci: illegal protocol version "); - iounmap(ha->brd); - return 0; - } - - ha->type = gdt_pcimpr; - ha->ic_all_size = sizeof(dp6m_ptr->u); - - /* special command to controller bios */ - writel(0x00, &dp6m_ptr->u.ic.s_info[0]); - writel(0x00, &dp6m_ptr->u.ic.s_info[1]); - writel(0x00, &dp6m_ptr->u.ic.s_info[2]); - writel(0x00, &dp6m_ptr->u.ic.s_info[3]); - writeb(0xfe, &dp6m_ptr->u.ic.s_cmd_indx); - writeb(1, &dp6m_ptr->i960r.ldoor_reg); - retries = init_retries; - gdth_delay(20); - while (readb(&dp6m_ptr->u.ic.s_status) != 0xfe) { - if (--retries == 0) { - printk("gdt-pci: initialization error "); - iounmap(ha->brd); - return 0; - } - gdth_delay(1); - } - writeb(0, &dp6m_ptr->u.ic.s_status); - - /* read fw version to detect 64-bit dma support */ - writeb(0xfd, &dp6m_ptr->u.ic.s_cmd_indx); - writeb(1, &dp6m_ptr->i960r.ldoor_reg); - retries = init_retries; - gdth_delay(20); - while (readb(&dp6m_ptr->u.ic.s_status) != 0xfd) { - if (--retries == 0) { - printk("gdt-pci: initialization error (deinit failed) "); - iounmap(ha->brd); - return 0; - } - gdth_delay(1); - } - prot_ver = (u8)(readl(&dp6m_ptr->u.ic.s_info[0]) >> 16); - writeb(0, &dp6m_ptr->u.ic.s_status); - if (prot_ver < 0x2b) /* fw < x.43: no 64-bit dma support */ - ha->dma64_support = 0; - else - ha->dma64_support = 1; - } - - return 1; -} - -/* controller protocol functions */ - -static void gdth_enable_int(gdth_ha_str *ha) -{ - unsigned long flags; - gdt6_dpram_str __iomem *dp6_ptr; - gdt6m_dpram_str __iomem *dp6m_ptr; - - trace(("gdth_enable_int() hanum %d ",ha->hanum)); - spin_lock_irqsave(&ha->smp_lock, flags); - - if (ha->type == gdt_pci) { - dp6_ptr = ha->brd; - writeb(1, &dp6_ptr->io.irqdel); - writeb(0, &dp6_ptr->u.ic.cmd_index); - writeb(1, &dp6_ptr->io.irqen); - } else if (ha->type == gdt_pcinew) { - outb(0xff, ptr2ushort(&ha->plx->edoor_reg)); - outb(0x03, ptr2ushort(&ha->plx->control1)); - } else if (ha->type == gdt_pcimpr) { - dp6m_ptr = ha->brd; - writeb(0xff, &dp6m_ptr->i960r.edoor_reg); - writeb(readb(&dp6m_ptr->i960r.edoor_en_reg) & ~4, - &dp6m_ptr->i960r.edoor_en_reg); - } - spin_unlock_irqrestore(&ha->smp_lock, flags); -} - -/* return istatus if interrupt was from this card else 0 */ -static u8 gdth_get_status(gdth_ha_str *ha) -{ - u8 istatus = 0; - - trace(("gdth_get_status() irq %d ctr_count %d ", ha->irq, gdth_ctr_count)); - - if (ha->type == gdt_pci) - istatus = - readb(&((gdt6_dpram_str __iomem *)ha->brd)->u.ic.cmd_index); - else if (ha->type == gdt_pcinew) - istatus = inb(ptr2ushort(&ha->plx->edoor_reg)); - else if (ha->type == gdt_pcimpr) - istatus = - readb(&((gdt6m_dpram_str __iomem *)ha->brd)->i960r.edoor_reg); - - return istatus; -} - -static int gdth_test_busy(gdth_ha_str *ha) -{ - register int gdtsema0 = 0; - - trace(("gdth_test_busy() hanum %d ", ha->hanum)); - - if (ha->type == gdt_pci) - gdtsema0 = (int)readb(&((gdt6_dpram_str __iomem *)ha->brd)->u.ic.sema0); - else if (ha->type == gdt_pcinew) - gdtsema0 = (int)inb(ptr2ushort(&ha->plx->sema0_reg)); - else if (ha->type == gdt_pcimpr) - gdtsema0 = - (int)readb(&((gdt6m_dpram_str __iomem *)ha->brd)->i960r.sema0_reg); - - return (gdtsema0 & 1); -} - - -static int gdth_get_cmd_index(gdth_ha_str *ha) -{ - int i; - - trace(("gdth_get_cmd_index() hanum %d ", ha->hanum)); - - for (i=0; i<gdth_maxcmds; ++i) { - if (ha->cmd_tab[i].cmnd == unused_cmnd) { - ha->cmd_tab[i].cmnd = ha->pccb->requestbuffer; - ha->cmd_tab[i].service = ha->pccb->service; - ha->pccb->commandindex = (u32)i+2; - return (i+2); - } - } - return 0; -} - - -static void gdth_set_sema0(gdth_ha_str *ha) -{ - trace(("gdth_set_sema0() hanum %d ", ha->hanum)); - - if (ha->type == gdt_pci) { - writeb(1, &((gdt6_dpram_str __iomem *)ha->brd)->u.ic.sema0); - } else if (ha->type == gdt_pcinew) { - outb(1, ptr2ushort(&ha->plx->sema0_reg)); - } else if (ha->type == gdt_pcimpr) { - writeb(1, &((gdt6m_dpram_str __iomem *)ha->brd)->i960r.sema0_reg); - } -} - - -static void gdth_copy_command(gdth_ha_str *ha) -{ - register gdth_cmd_str *cmd_ptr; - register gdt6m_dpram_str __iomem *dp6m_ptr; - register gdt6c_dpram_str __iomem *dp6c_ptr; - gdt6_dpram_str __iomem *dp6_ptr; - u16 cp_count,dp_offset,cmd_no; - - trace(("gdth_copy_command() hanum %d ", ha->hanum)); - - cp_count = ha->cmd_len; - dp_offset= ha->cmd_offs_dpmem; - cmd_no = ha->cmd_cnt; - cmd_ptr = ha->pccb; - - ++ha->cmd_cnt; - - /* set cpcount dword aligned */ - if (cp_count & 3) - cp_count += (4 - (cp_count & 3)); - - ha->cmd_offs_dpmem += cp_count; - - /* set offset and service, copy command to dpmem */ - if (ha->type == gdt_pci) { - dp6_ptr = ha->brd; - writew(dp_offset + dpmem_command_offset, - &dp6_ptr->u.ic.comm_queue[cmd_no].offset); - writew((u16)cmd_ptr->service, - &dp6_ptr->u.ic.comm_queue[cmd_no].serv_id); - memcpy_toio(&dp6_ptr->u.ic.gdt_dpr_cmd[dp_offset],cmd_ptr,cp_count); - } else if (ha->type == gdt_pcinew) { - dp6c_ptr = ha->brd; - writew(dp_offset + dpmem_command_offset, - &dp6c_ptr->u.ic.comm_queue[cmd_no].offset); - writew((u16)cmd_ptr->service, - &dp6c_ptr->u.ic.comm_queue[cmd_no].serv_id); - memcpy_toio(&dp6c_ptr->u.ic.gdt_dpr_cmd[dp_offset],cmd_ptr,cp_count); - } else if (ha->type == gdt_pcimpr) { - dp6m_ptr = ha->brd; - writew(dp_offset + dpmem_command_offset, - &dp6m_ptr->u.ic.comm_queue[cmd_no].offset); - writew((u16)cmd_ptr->service, - &dp6m_ptr->u.ic.comm_queue[cmd_no].serv_id); - memcpy_toio(&dp6m_ptr->u.ic.gdt_dpr_cmd[dp_offset],cmd_ptr,cp_count); - } -} - - -static void gdth_release_event(gdth_ha_str *ha) -{ - trace(("gdth_release_event() hanum %d ", ha->hanum)); - -#ifdef gdth_statistics - { - u32 i,j; - for (i=0,j=0; j<gdth_maxcmds; ++j) { - if (ha->cmd_tab[j].cmnd != unused_cmnd) - ++i; - } - if (max_index < i) { - max_index = i; - trace3(("gdt: max_index = %d ",(u16)i)); - } - } -#endif - - if (ha->pccb->opcode == gdt_init) - ha->pccb->service |= 0x80; - - if (ha->type == gdt_pci) { - writeb(0, &((gdt6_dpram_str __iomem *)ha->brd)->io.event); - } else if (ha->type == gdt_pcinew) { - outb(1, ptr2ushort(&ha->plx->ldoor_reg)); - } else if (ha->type == gdt_pcimpr) { - writeb(1, &((gdt6m_dpram_str __iomem *)ha->brd)->i960r.ldoor_reg); - } -} - -static int gdth_wait(gdth_ha_str *ha, int index, u32 time) -{ - int answer_found = false; - int wait_index = 0; - - trace(("gdth_wait() hanum %d index %d time %d ", ha->hanum, index, time)); - - if (index == 0) - return 1; /* no wait required */ - - do { - __gdth_interrupt(ha, true, &wait_index); - if (wait_index == index) { - answer_found = true; - break; - } - gdth_delay(1); - } while (--time); - - while (gdth_test_busy(ha)) - gdth_delay(0); - - return (answer_found); -} - - -static int gdth_internal_cmd(gdth_ha_str *ha, u8 service, u16 opcode, - u32 p1, u64 p2, u64 p3) -{ - register gdth_cmd_str *cmd_ptr; - int retries,index; - - trace2(("gdth_internal_cmd() service %d opcode %d ",service,opcode)); - - cmd_ptr = ha->pccb; - memset((char*)cmd_ptr,0,sizeof(gdth_cmd_str)); - - /* make command */ - for (retries = init_retries;;) { - cmd_ptr->service = service; - cmd_ptr->requestbuffer = internal_cmnd; - if (!(index=gdth_get_cmd_index(ha))) { - trace(("gdt: no free command index found ")); - return 0; - } - gdth_set_sema0(ha); - cmd_ptr->opcode = opcode; - cmd_ptr->boardnode = localboard; - if (service == cacheservice) { - if (opcode == gdt_ioctl) { - cmd_ptr->u.ioctl.subfunc = p1; - cmd_ptr->u.ioctl.channel = (u32)p2; - cmd_ptr->u.ioctl.param_size = (u16)p3; - cmd_ptr->u.ioctl.p_param = ha->scratch_phys; - } else { - if (ha->cache_feat & gdt_64bit) { - cmd_ptr->u.cache64.deviceno = (u16)p1; - cmd_ptr->u.cache64.blockno = p2; - } else { - cmd_ptr->u.cache.deviceno = (u16)p1; - cmd_ptr->u.cache.blockno = (u32)p2; - } - } - } else if (service == scsirawservice) { - if (ha->raw_feat & gdt_64bit) { - cmd_ptr->u.raw64.direction = p1; - cmd_ptr->u.raw64.bus = (u8)p2; - cmd_ptr->u.raw64.target = (u8)p3; - cmd_ptr->u.raw64.lun = (u8)(p3 >> 8); - } else { - cmd_ptr->u.raw.direction = p1; - cmd_ptr->u.raw.bus = (u8)p2; - cmd_ptr->u.raw.target = (u8)p3; - cmd_ptr->u.raw.lun = (u8)(p3 >> 8); - } - } else if (service == screenservice) { - if (opcode == gdt_realtime) { - *(u32 *)&cmd_ptr->u.screen.su.data[0] = p1; - *(u32 *)&cmd_ptr->u.screen.su.data[4] = (u32)p2; - *(u32 *)&cmd_ptr->u.screen.su.data[8] = (u32)p3; - } - } - ha->cmd_len = sizeof(gdth_cmd_str); - ha->cmd_offs_dpmem = 0; - ha->cmd_cnt = 0; - gdth_copy_command(ha); - gdth_release_event(ha); - gdth_delay(20); - if (!gdth_wait(ha, index, init_timeout)) { - printk("gdt: initialization error (timeout service %d) ",service); - return 0; - } - if (ha->status != s_bsy || --retries == 0) - break; - gdth_delay(1); - } - - return (ha->status != s_ok ? 0:1); -} - - -/* search for devices */ - -static int gdth_search_drives(gdth_ha_str *ha) -{ - u16 cdev_cnt, i; - int ok; - u32 bus_no, drv_cnt, drv_no, j; - gdth_getch_str *chn; - gdth_drlist_str *drl; - gdth_iochan_str *ioc; - gdth_raw_iochan_str *iocr; - gdth_arcdl_str *alst; - gdth_alist_str *alst2; - gdth_oem_str_ioctl *oemstr; - - trace(("gdth_search_drives() hanum %d ", ha->hanum)); - ok = 0; - - /* initialize controller services, at first: screen service */ - ha->screen_feat = 0; - if (!force_dma32) { - ok = gdth_internal_cmd(ha, screenservice, gdt_x_init_scr, 0, 0, 0); - if (ok) - ha->screen_feat = gdt_64bit; - } - if (force_dma32 || (!ok && ha->status == (u16)s_nofunc)) - ok = gdth_internal_cmd(ha, screenservice, gdt_init, 0, 0, 0); - if (!ok) { - printk("gdt-ha %d: initialization error screen service (code %d) ", - ha->hanum, ha->status); - return 0; - } - trace2(("gdth_search_drives(): screenservice initialized ")); - - /* unfreeze all ios */ - gdth_internal_cmd(ha, cacheservice, gdt_unfreeze_io, 0, 0, 0); - - /* initialize cache service */ - ha->cache_feat = 0; - if (!force_dma32) { - ok = gdth_internal_cmd(ha, cacheservice, gdt_x_init_host, linux_os, - 0, 0); - if (ok) - ha->cache_feat = gdt_64bit; - } - if (force_dma32 || (!ok && ha->status == (u16)s_nofunc)) - ok = gdth_internal_cmd(ha, cacheservice, gdt_init, linux_os, 0, 0); - if (!ok) { - printk("gdt-ha %d: initialization error cache service (code %d) ", - ha->hanum, ha->status); - return 0; - } - trace2(("gdth_search_drives(): cacheservice initialized ")); - cdev_cnt = (u16)ha->info; - ha->fw_vers = ha->service; - - /* detect number of buses - try new ioctl */ - iocr = (gdth_raw_iochan_str *)ha->pscratch; - iocr->hdr.version = 0xffffffff; - iocr->hdr.list_entries = maxbus; - iocr->hdr.first_chan = 0; - iocr->hdr.last_chan = maxbus-1; - iocr->hdr.list_offset = gdtoffsof(gdth_raw_iochan_str, list[0]); - if (gdth_internal_cmd(ha, cacheservice, gdt_ioctl, iochan_raw_desc, - invalid_channel,sizeof(gdth_raw_iochan_str))) { - trace2(("iochan_raw_desc supported! ")); - ha->bus_cnt = iocr->hdr.chan_count; - for (bus_no = 0; bus_no < ha->bus_cnt; ++bus_no) { - if (iocr->list[bus_no].proc_id < maxid) - ha->bus_id[bus_no] = iocr->list[bus_no].proc_id; - else - ha->bus_id[bus_no] = 0xff; - } - } else { - /* old method */ - chn = (gdth_getch_str *)ha->pscratch; - for (bus_no = 0; bus_no < maxbus; ++bus_no) { - chn->channel_no = bus_no; - if (!gdth_internal_cmd(ha, cacheservice, gdt_ioctl, - scsi_chan_cnt | l_ctrl_pattern, - io_channel | invalid_channel, - sizeof(gdth_getch_str))) { - if (bus_no == 0) { - printk("gdt-ha %d: error detecting channel count (0x%x) ", - ha->hanum, ha->status); - return 0; - } - break; - } - if (chn->siop_id < maxid) - ha->bus_id[bus_no] = chn->siop_id; - else - ha->bus_id[bus_no] = 0xff; - } - ha->bus_cnt = (u8)bus_no; - } - trace2(("gdth_search_drives() %d channels ",ha->bus_cnt)); - - /* read cache configuration */ - if (!gdth_internal_cmd(ha, cacheservice, gdt_ioctl, cache_info, - invalid_channel,sizeof(gdth_cinfo_str))) { - printk("gdt-ha %d: initialization error cache service (code %d) ", - ha->hanum, ha->status); - return 0; - } - ha->cpar = ((gdth_cinfo_str *)ha->pscratch)->cpar; - trace2(("gdth_search_drives() cinfo: vs %x sta %d str %d dw %d b %d ", - ha->cpar.version,ha->cpar.state,ha->cpar.strategy, - ha->cpar.write_back,ha->cpar.block_size)); - - /* read board info and features */ - ha->more_proc = false; - if (gdth_internal_cmd(ha, cacheservice, gdt_ioctl, board_info, - invalid_channel,sizeof(gdth_binfo_str))) { - memcpy(&ha->binfo, (gdth_binfo_str *)ha->pscratch, - sizeof(gdth_binfo_str)); - if (gdth_internal_cmd(ha, cacheservice, gdt_ioctl, board_features, - invalid_channel,sizeof(gdth_bfeat_str))) { - trace2(("board_info/board_features supported ")); - ha->bfeat = *(gdth_bfeat_str *)ha->pscratch; - ha->more_proc = true; - } - } else { - trace2(("board_info requires firmware >= 1.10/2.08 ")); - strcpy(ha->binfo.type_string, gdth_ctr_name(ha)); - } - trace2(("controller name: %s ",ha->binfo.type_string)); - - /* read more informations */ - if (ha->more_proc) { - /* physical drives, channel addresses */ - ioc = (gdth_iochan_str *)ha->pscratch; - ioc->hdr.version = 0xffffffff; - ioc->hdr.list_entries = maxbus; - ioc->hdr.first_chan = 0; - ioc->hdr.last_chan = maxbus-1; - ioc->hdr.list_offset = gdtoffsof(gdth_iochan_str, list[0]); - if (gdth_internal_cmd(ha, cacheservice, gdt_ioctl, iochan_desc, - invalid_channel,sizeof(gdth_iochan_str))) { - for (bus_no = 0; bus_no < ha->bus_cnt; ++bus_no) { - ha->raw[bus_no].address = ioc->list[bus_no].address; - ha->raw[bus_no].local_no = ioc->list[bus_no].local_no; - } - } else { - for (bus_no = 0; bus_no < ha->bus_cnt; ++bus_no) { - ha->raw[bus_no].address = io_channel; - ha->raw[bus_no].local_no = bus_no; - } - } - for (bus_no = 0; bus_no < ha->bus_cnt; ++bus_no) { - chn = (gdth_getch_str *)ha->pscratch; - chn->channel_no = ha->raw[bus_no].local_no; - if (gdth_internal_cmd(ha, cacheservice, gdt_ioctl, - scsi_chan_cnt | l_ctrl_pattern, - ha->raw[bus_no].address | invalid_channel, - sizeof(gdth_getch_str))) { - ha->raw[bus_no].pdev_cnt = chn->drive_cnt; - trace2(("channel %d: %d phys. drives ", - bus_no,chn->drive_cnt)); - } - if (ha->raw[bus_no].pdev_cnt > 0) { - drl = (gdth_drlist_str *)ha->pscratch; - drl->sc_no = ha->raw[bus_no].local_no; - drl->sc_cnt = ha->raw[bus_no].pdev_cnt; - if (gdth_internal_cmd(ha, cacheservice, gdt_ioctl, - scsi_dr_list | l_ctrl_pattern, - ha->raw[bus_no].address | invalid_channel, - sizeof(gdth_drlist_str))) { - for (j = 0; j < ha->raw[bus_no].pdev_cnt; ++j) - ha->raw[bus_no].id_list[j] = drl->sc_list[j]; - } else { - ha->raw[bus_no].pdev_cnt = 0; - } - } - } - - /* logical drives */ - if (gdth_internal_cmd(ha, cacheservice, gdt_ioctl, cache_drv_cnt, - invalid_channel,sizeof(u32))) { - drv_cnt = *(u32 *)ha->pscratch; - if (gdth_internal_cmd(ha, cacheservice, gdt_ioctl, cache_drv_list, - invalid_channel,drv_cnt * sizeof(u32))) { - for (j = 0; j < drv_cnt; ++j) { - drv_no = ((u32 *)ha->pscratch)[j]; - if (drv_no < max_ldrives) { - ha->hdr[drv_no].is_logdrv = true; - trace2(("drive %d is log. drive ",drv_no)); - } - } - } - alst = (gdth_arcdl_str *)ha->pscratch; - alst->entries_avail = max_ldrives; - alst->first_entry = 0; - alst->list_offset = gdtoffsof(gdth_arcdl_str, list[0]); - if (gdth_internal_cmd(ha, cacheservice, gdt_ioctl, - array_drv_list2 | la_ctrl_pattern, - invalid_channel, sizeof(gdth_arcdl_str) + - (alst->entries_avail-1) * sizeof(gdth_alist_str))) { - for (j = 0; j < alst->entries_init; ++j) { - ha->hdr[j].is_arraydrv = alst->list[j].is_arrayd; - ha->hdr[j].is_master = alst->list[j].is_master; - ha->hdr[j].is_parity = alst->list[j].is_parity; - ha->hdr[j].is_hotfix = alst->list[j].is_hotfix; - ha->hdr[j].master_no = alst->list[j].cd_handle; - } - } else if (gdth_internal_cmd(ha, cacheservice, gdt_ioctl, - array_drv_list | la_ctrl_pattern, - 0, 35 * sizeof(gdth_alist_str))) { - for (j = 0; j < 35; ++j) { - alst2 = &((gdth_alist_str *)ha->pscratch)[j]; - ha->hdr[j].is_arraydrv = alst2->is_arrayd; - ha->hdr[j].is_master = alst2->is_master; - ha->hdr[j].is_parity = alst2->is_parity; - ha->hdr[j].is_hotfix = alst2->is_hotfix; - ha->hdr[j].master_no = alst2->cd_handle; - } - } - } - } - - /* initialize raw service */ - ha->raw_feat = 0; - if (!force_dma32) { - ok = gdth_internal_cmd(ha, scsirawservice, gdt_x_init_raw, 0, 0, 0); - if (ok) - ha->raw_feat = gdt_64bit; - } - if (force_dma32 || (!ok && ha->status == (u16)s_nofunc)) - ok = gdth_internal_cmd(ha, scsirawservice, gdt_init, 0, 0, 0); - if (!ok) { - printk("gdt-ha %d: initialization error raw service (code %d) ", - ha->hanum, ha->status); - return 0; - } - trace2(("gdth_search_drives(): rawservice initialized ")); - - /* set/get features raw service (scatter/gather) */ - if (gdth_internal_cmd(ha, scsirawservice, gdt_set_feat, scatter_gather, - 0, 0)) { - trace2(("gdth_search_drives(): set features rawservice ok ")); - if (gdth_internal_cmd(ha, scsirawservice, gdt_get_feat, 0, 0, 0)) { - trace2(("gdth_search_dr(): get feat rawservice %d ", - ha->info)); - ha->raw_feat |= (u16)ha->info; - } - } - - /* set/get features cache service (equal to raw service) */ - if (gdth_internal_cmd(ha, cacheservice, gdt_set_feat, 0, - scatter_gather,0)) { - trace2(("gdth_search_drives(): set features cacheservice ok ")); - if (gdth_internal_cmd(ha, cacheservice, gdt_get_feat, 0, 0, 0)) { - trace2(("gdth_search_dr(): get feat cacheserv. %d ", - ha->info)); - ha->cache_feat |= (u16)ha->info; - } - } - - /* reserve drives for raw service */ - if (reserve_mode != 0) { - gdth_internal_cmd(ha, scsirawservice, gdt_reserve_all, - reserve_mode == 1 ? 1 : 3, 0, 0); - trace2(("gdth_search_drives(): reserve_all code %d ", - ha->status)); - } - for (i = 0; i < max_res_args; i += 4) { - if (reserve_list[i] == ha->hanum && reserve_list[i+1] < ha->bus_cnt && - reserve_list[i+2] < ha->tid_cnt && reserve_list[i+3] < maxlun) { - trace2(("gdth_search_drives(): reserve ha %d bus %d id %d lun %d ", - reserve_list[i], reserve_list[i+1], - reserve_list[i+2], reserve_list[i+3])); - if (!gdth_internal_cmd(ha, scsirawservice, gdt_reserve, 0, - reserve_list[i+1], reserve_list[i+2] | - (reserve_list[i+3] << 8))) { - printk("gdt-ha %d: error raw service (reserve, code %d) ", - ha->hanum, ha->status); - } - } - } - - /* determine oem string using ioctl */ - oemstr = (gdth_oem_str_ioctl *)ha->pscratch; - oemstr->params.ctl_version = 0x01; - oemstr->params.buffer_size = sizeof(oemstr->text); - if (gdth_internal_cmd(ha, cacheservice, gdt_ioctl, - cache_read_oem_string_record,invalid_channel, - sizeof(gdth_oem_str_ioctl))) { - trace2(("gdth_search_drives(): cache_read_oem_string_record ok ")); - printk("gdt-ha %d: vendor: %s name: %s ", - ha->hanum, oemstr->text.oem_company_name, ha->binfo.type_string); - /* save the host drive inquiry data */ - strlcpy(ha->oem_name,oemstr->text.scsi_host_drive_inquiry_vendor_id, - sizeof(ha->oem_name)); - } else { - /* old method, based on pci id */ - trace2(("gdth_search_drives(): cache_read_oem_string_record failed ")); - printk("gdt-ha %d: name: %s ", - ha->hanum, ha->binfo.type_string); - if (ha->oem_id == oem_id_intel) - strlcpy(ha->oem_name,"intel ", sizeof(ha->oem_name)); - else - strlcpy(ha->oem_name,"icp ", sizeof(ha->oem_name)); - } - - /* scanning for host drives */ - for (i = 0; i < cdev_cnt; ++i) - gdth_analyse_hdrive(ha, i); - - trace(("gdth_search_drives() ok ")); - return 1; -} - -static int gdth_analyse_hdrive(gdth_ha_str *ha, u16 hdrive) -{ - u32 drv_cyls; - int drv_hds, drv_secs; - - trace(("gdth_analyse_hdrive() hanum %d drive %d ", ha->hanum, hdrive)); - if (hdrive >= max_hdrives) - return 0; - - if (!gdth_internal_cmd(ha, cacheservice, gdt_info, hdrive, 0, 0)) - return 0; - ha->hdr[hdrive].present = true; - ha->hdr[hdrive].size = ha->info; - - /* evaluate mapping (sectors per head, heads per cylinder) */ - ha->hdr[hdrive].size &= ~secs32; - if (ha->info2 == 0) { - gdth_eval_mapping(ha->hdr[hdrive].size,&drv_cyls,&drv_hds,&drv_secs); - } else { - drv_hds = ha->info2 & 0xff; - drv_secs = (ha->info2 >> 8) & 0xff; - drv_cyls = (u32)ha->hdr[hdrive].size / drv_hds / drv_secs; - } - ha->hdr[hdrive].heads = (u8)drv_hds; - ha->hdr[hdrive].secs = (u8)drv_secs; - /* round size */ - ha->hdr[hdrive].size = drv_cyls * drv_hds * drv_secs; - - if (ha->cache_feat & gdt_64bit) { - if (gdth_internal_cmd(ha, cacheservice, gdt_x_info, hdrive, 0, 0) - && ha->info2 != 0) { - ha->hdr[hdrive].size = ((u64)ha->info2 << 32) | ha->info; - } - } - trace2(("gdth_search_dr() cdr. %d size %d hds %d scs %d ", - hdrive,ha->hdr[hdrive].size,drv_hds,drv_secs)); - - /* get informations about device */ - if (gdth_internal_cmd(ha, cacheservice, gdt_devtype, hdrive, 0, 0)) { - trace2(("gdth_search_dr() cache drive %d devtype %d ", - hdrive,ha->info)); - ha->hdr[hdrive].devtype = (u16)ha->info; - } - - /* cluster info */ - if (gdth_internal_cmd(ha, cacheservice, gdt_clust_info, hdrive, 0, 0)) { - trace2(("gdth_search_dr() cache drive %d cluster info %d ", - hdrive,ha->info)); - if (!shared_access) - ha->hdr[hdrive].cluster_type = (u8)ha->info; - } - - /* r/w attributes */ - if (gdth_internal_cmd(ha, cacheservice, gdt_rw_attribs, hdrive, 0, 0)) { - trace2(("gdth_search_dr() cache drive %d r/w attrib. %d ", - hdrive,ha->info)); - ha->hdr[hdrive].rw_attribs = (u8)ha->info; - } - - return 1; -} - - -/* command queueing/sending functions */ - -static void gdth_putq(gdth_ha_str *ha, struct scsi_cmnd *scp, u8 priority) -{ - struct gdth_cmndinfo *cmndinfo = gdth_cmnd_priv(scp); - register struct scsi_cmnd *pscp; - register struct scsi_cmnd *nscp; - unsigned long flags; - - trace(("gdth_putq() priority %d ",priority)); - spin_lock_irqsave(&ha->smp_lock, flags); - - if (!cmndinfo->internal_command) - cmndinfo->priority = priority; - - if (ha->req_first==null) { - ha->req_first = scp; /* queue was empty */ - scp->scp.ptr = null; - } else { /* queue not empty */ - pscp = ha->req_first; - nscp = (struct scsi_cmnd *)pscp->scp.ptr; - /* priority: 0-highest,..,0xff-lowest */ - while (nscp && gdth_cmnd_priv(nscp)->priority <= priority) { - pscp = nscp; - nscp = (struct scsi_cmnd *)pscp->scp.ptr; - } - pscp->scp.ptr = (char *)scp; - scp->scp.ptr = (char *)nscp; - } - spin_unlock_irqrestore(&ha->smp_lock, flags); - -#ifdef gdth_statistics - flags = 0; - for (nscp=ha->req_first; nscp; nscp=(struct scsi_cmnd*)nscp->scp.ptr) - ++flags; - if (max_rq < flags) { - max_rq = flags; - trace3(("gdt: max_rq = %d ",(u16)max_rq)); - } -#endif -} - -static void gdth_next(gdth_ha_str *ha) -{ - register struct scsi_cmnd *pscp; - register struct scsi_cmnd *nscp; - u8 b, t, l, firsttime; - u8 this_cmd, next_cmd; - unsigned long flags = 0; - int cmd_index; - - trace(("gdth_next() hanum %d ", ha->hanum)); - if (!gdth_polling) - spin_lock_irqsave(&ha->smp_lock, flags); - - ha->cmd_cnt = ha->cmd_offs_dpmem = 0; - this_cmd = firsttime = true; - next_cmd = gdth_polling ? false:true; - cmd_index = 0; - - for (nscp = pscp = ha->req_first; nscp; nscp = (struct scsi_cmnd *)nscp->scp.ptr) { - struct gdth_cmndinfo *nscp_cmndinfo = gdth_cmnd_priv(nscp); - if (nscp != pscp && nscp != (struct scsi_cmnd *)pscp->scp.ptr) - pscp = (struct scsi_cmnd *)pscp->scp.ptr; - if (!nscp_cmndinfo->internal_command) { - b = nscp->device->channel; - t = nscp->device->id; - l = nscp->device->lun; - if (nscp_cmndinfo->priority >= default_pri) { - if ((b != ha->virt_bus && ha->raw[bus_l2p(ha,b)].lock) || - (b == ha->virt_bus && t < max_hdrives && ha->hdr[t].lock)) - continue; - } - } else - b = t = l = 0; - - if (firsttime) { - if (gdth_test_busy(ha)) { /* controller busy ? */ - trace(("gdth_next() controller %d busy ! ", ha->hanum)); - if (!gdth_polling) { - spin_unlock_irqrestore(&ha->smp_lock, flags); - return; - } - while (gdth_test_busy(ha)) - gdth_delay(1); - } - firsttime = false; - } - - if (!nscp_cmndinfo->internal_command) { - if (nscp_cmndinfo->phase == -1) { - nscp_cmndinfo->phase = cacheservice; /* default: cache svc. */ - if (nscp->cmnd[0] == test_unit_ready) { - trace2(("test_unit_ready bus %d id %d lun %d ", - b, t, l)); - /* test_unit_ready -> set scan mode */ - if ((ha->scan_mode & 0x0f) == 0) { - if (b == 0 && t == 0 && l == 0) { - ha->scan_mode |= 1; - trace2(("scan mode: 0x%x ", ha->scan_mode)); - } - } else if ((ha->scan_mode & 0x0f) == 1) { - if (b == 0 && ((t == 0 && l == 1) || - (t == 1 && l == 0))) { - nscp_cmndinfo->opcode = gdt_scan_start; - nscp_cmndinfo->phase = ((ha->scan_mode & 0x10 ? 1:0) << 8) - | scsirawservice; - ha->scan_mode = 0x12; - trace2(("scan mode: 0x%x (scan_start) ", - ha->scan_mode)); - } else { - ha->scan_mode &= 0x10; - trace2(("scan mode: 0x%x ", ha->scan_mode)); - } - } else if (ha->scan_mode == 0x12) { - if (b == ha->bus_cnt && t == ha->tid_cnt-1) { - nscp_cmndinfo->phase = scsirawservice; - nscp_cmndinfo->opcode = gdt_scan_end; - ha->scan_mode &= 0x10; - trace2(("scan mode: 0x%x (scan_end) ", - ha->scan_mode)); - } - } - } - if (b == ha->virt_bus && nscp->cmnd[0] != inquiry && - nscp->cmnd[0] != read_capacity && nscp->cmnd[0] != mode_sense && - (ha->hdr[t].cluster_type & cluster_drive)) { - /* always gdt_clust_info! */ - nscp_cmndinfo->opcode = gdt_clust_info; - } - } - } - - if (nscp_cmndinfo->opcode != -1) { - if ((nscp_cmndinfo->phase & 0xff) == cacheservice) { - if (!(cmd_index=gdth_fill_cache_cmd(ha, nscp, t))) - this_cmd = false; - next_cmd = false; - } else if ((nscp_cmndinfo->phase & 0xff) == scsirawservice) { - if (!(cmd_index=gdth_fill_raw_cmd(ha, nscp, bus_l2p(ha, b)))) - this_cmd = false; - next_cmd = false; - } else { - memset((char*)nscp->sense_buffer,0,16); - nscp->sense_buffer[0] = 0x70; - nscp->sense_buffer[2] = not_ready; - nscp->result = (did_ok << 16) | (check_condition << 1); - if (!nscp_cmndinfo->wait_for_completion) - nscp_cmndinfo->wait_for_completion++; - else - gdth_scsi_done(nscp); - } - } else if (gdth_cmnd_priv(nscp)->internal_command) { - if (!(cmd_index=gdth_special_cmd(ha, nscp))) - this_cmd = false; - next_cmd = false; - } else if (b != ha->virt_bus) { - if (ha->raw[bus_l2p(ha,b)].io_cnt[t] >= gdth_max_raw || - !(cmd_index=gdth_fill_raw_cmd(ha, nscp, bus_l2p(ha, b)))) - this_cmd = false; - else - ha->raw[bus_l2p(ha,b)].io_cnt[t]++; - } else if (t >= max_hdrives || !ha->hdr[t].present || l != 0) { - trace2(("command 0x%x to bus %d id %d lun %d -> ignore ", - nscp->cmnd[0], b, t, l)); - nscp->result = did_bad_target << 16; - if (!nscp_cmndinfo->wait_for_completion) - nscp_cmndinfo->wait_for_completion++; - else - gdth_scsi_done(nscp); - } else { - switch (nscp->cmnd[0]) { - case test_unit_ready: - case inquiry: - case request_sense: - case read_capacity: - case verify: - case start_stop: - case mode_sense: - case service_action_in_16: - trace(("cache cmd %x/%x/%x/%x/%x/%x ",nscp->cmnd[0], - nscp->cmnd[1],nscp->cmnd[2],nscp->cmnd[3], - nscp->cmnd[4],nscp->cmnd[5])); - if (ha->hdr[t].media_changed && nscp->cmnd[0] != inquiry) { - /* return unit_attention */ - trace2(("cmd 0x%x target %d: unit_attention ", - nscp->cmnd[0], t)); - ha->hdr[t].media_changed = false; - memset((char*)nscp->sense_buffer,0,16); - nscp->sense_buffer[0] = 0x70; - nscp->sense_buffer[2] = unit_attention; - nscp->result = (did_ok << 16) | (check_condition << 1); - if (!nscp_cmndinfo->wait_for_completion) - nscp_cmndinfo->wait_for_completion++; - else - gdth_scsi_done(nscp); - } else if (gdth_internal_cache_cmd(ha, nscp)) - gdth_scsi_done(nscp); - break; - - case allow_medium_removal: - trace(("cache cmd %x/%x/%x/%x/%x/%x ",nscp->cmnd[0], - nscp->cmnd[1],nscp->cmnd[2],nscp->cmnd[3], - nscp->cmnd[4],nscp->cmnd[5])); - if ( (nscp->cmnd[4]&1) && !(ha->hdr[t].devtype&1) ) { - trace(("prevent r. nonremov. drive->do nothing ")); - nscp->result = did_ok << 16; - nscp->sense_buffer[0] = 0; - if (!nscp_cmndinfo->wait_for_completion) - nscp_cmndinfo->wait_for_completion++; - else - gdth_scsi_done(nscp); - } else { - nscp->cmnd[3] = (ha->hdr[t].devtype&1) ? 1:0; - trace(("prevent/allow r. %d rem. drive %d ", - nscp->cmnd[4],nscp->cmnd[3])); - if (!(cmd_index=gdth_fill_cache_cmd(ha, nscp, t))) - this_cmd = false; - } - break; - - case reserve: - case release: - trace2(("cache cmd %s ",nscp->cmnd[0] == reserve ? - "reserve" : "release")); - if (!(cmd_index=gdth_fill_cache_cmd(ha, nscp, t))) - this_cmd = false; - break; - - case read_6: - case write_6: - case read_10: - case write_10: - case read_16: - case write_16: - if (ha->hdr[t].media_changed) { - /* return unit_attention */ - trace2(("cmd 0x%x target %d: unit_attention ", - nscp->cmnd[0], t)); - ha->hdr[t].media_changed = false; - memset((char*)nscp->sense_buffer,0,16); - nscp->sense_buffer[0] = 0x70; - nscp->sense_buffer[2] = unit_attention; - nscp->result = (did_ok << 16) | (check_condition << 1); - if (!nscp_cmndinfo->wait_for_completion) - nscp_cmndinfo->wait_for_completion++; - else - gdth_scsi_done(nscp); - } else if (!(cmd_index=gdth_fill_cache_cmd(ha, nscp, t))) - this_cmd = false; - break; - - default: - trace2(("cache cmd %x/%x/%x/%x/%x/%x unknown ",nscp->cmnd[0], - nscp->cmnd[1],nscp->cmnd[2],nscp->cmnd[3], - nscp->cmnd[4],nscp->cmnd[5])); - printk("gdt-ha %d: unknown scsi command 0x%x to cache service ! ", - ha->hanum, nscp->cmnd[0]); - nscp->result = did_abort << 16; - if (!nscp_cmndinfo->wait_for_completion) - nscp_cmndinfo->wait_for_completion++; - else - gdth_scsi_done(nscp); - break; - } - } - - if (!this_cmd) - break; - if (nscp == ha->req_first) - ha->req_first = pscp = (struct scsi_cmnd *)nscp->scp.ptr; - else - pscp->scp.ptr = nscp->scp.ptr; - if (!next_cmd) - break; - } - - if (ha->cmd_cnt > 0) { - gdth_release_event(ha); - } - - if (!gdth_polling) - spin_unlock_irqrestore(&ha->smp_lock, flags); - - if (gdth_polling && ha->cmd_cnt > 0) { - if (!gdth_wait(ha, cmd_index, poll_timeout)) - printk("gdt-ha %d: command %d timed out ! ", - ha->hanum, cmd_index); - } -} - -/* - * gdth_copy_internal_data() - copy to/from a buffer onto a scsi_cmnd's - * buffers, kmap_atomic() as needed. - */ -static void gdth_copy_internal_data(gdth_ha_str *ha, struct scsi_cmnd *scp, - char *buffer, u16 count) -{ - u16 cpcount,i, max_sg = scsi_sg_count(scp); - u16 cpsum,cpnow; - struct scatterlist *sl; - char *address; - - cpcount = min_t(u16, count, scsi_bufflen(scp)); - - if (cpcount) { - cpsum=0; - scsi_for_each_sg(scp, sl, max_sg, i) { - unsigned long flags; - cpnow = (u16)sl->length; - trace(("copy_internal() now %d sum %d count %d %d ", - cpnow, cpsum, cpcount, scsi_bufflen(scp))); - if (cpsum+cpnow > cpcount) - cpnow = cpcount - cpsum; - cpsum += cpnow; - if (!sg_page(sl)) { - printk("gdt-ha %d: invalid sc/gt element in gdth_copy_internal_data() ", - ha->hanum); - return; - } - local_irq_save(flags); - address = kmap_atomic(sg_page(sl)) + sl->offset; - memcpy(address, buffer, cpnow); - flush_dcache_page(sg_page(sl)); - kunmap_atomic(address); - local_irq_restore(flags); - if (cpsum == cpcount) - break; - buffer += cpnow; - } - } else if (count) { - printk("gdt-ha %d: scsi command with no buffers but data transfer expected! ", - ha->hanum); - warn_on(1); - } -} - -static int gdth_internal_cache_cmd(gdth_ha_str *ha, struct scsi_cmnd *scp) -{ - u8 t; - gdth_inq_data inq; - gdth_rdcap_data rdc; - gdth_sense_data sd; - gdth_modep_data mpd; - struct gdth_cmndinfo *cmndinfo = gdth_cmnd_priv(scp); - - t = scp->device->id; - trace(("gdth_internal_cache_cmd() cmd 0x%x hdrive %d ", - scp->cmnd[0],t)); - - scp->result = did_ok << 16; - scp->sense_buffer[0] = 0; - - switch (scp->cmnd[0]) { - case test_unit_ready: - case verify: - case start_stop: - trace2(("test/verify/start hdrive %d ",t)); - break; - - case inquiry: - trace2(("inquiry hdrive %d devtype %d ", - t,ha->hdr[t].devtype)); - inq.type_qual = (ha->hdr[t].devtype&4) ? type_rom:type_disk; - /* you can here set all disks to removable, if you want to do - a flush using the allow_medium_removal command */ - inq.modif_rmb = 0x00; - if ((ha->hdr[t].devtype & 1) || - (ha->hdr[t].cluster_type & cluster_drive)) - inq.modif_rmb = 0x80; - inq.version = 2; - inq.resp_aenc = 2; - inq.add_length= 32; - strcpy(inq.vendor,ha->oem_name); - snprintf(inq.product, sizeof(inq.product), "host drive #%02d",t); - strcpy(inq.revision," "); - gdth_copy_internal_data(ha, scp, (char*)&inq, sizeof(gdth_inq_data)); - break; - - case request_sense: - trace2(("request sense hdrive %d ",t)); - sd.errorcode = 0x70; - sd.segno = 0x00; - sd.key = no_sense; - sd.info = 0; - sd.add_length= 0; - gdth_copy_internal_data(ha, scp, (char*)&sd, sizeof(gdth_sense_data)); - break; - - case mode_sense: - trace2(("mode sense hdrive %d ",t)); - memset((char*)&mpd,0,sizeof(gdth_modep_data)); - mpd.hd.data_length = sizeof(gdth_modep_data); - mpd.hd.dev_par = (ha->hdr[t].devtype&2) ? 0x80:0; - mpd.hd.bd_length = sizeof(mpd.bd); - mpd.bd.block_length[0] = (sector_size & 0x00ff0000) >> 16; - mpd.bd.block_length[1] = (sector_size & 0x0000ff00) >> 8; - mpd.bd.block_length[2] = (sector_size & 0x000000ff); - gdth_copy_internal_data(ha, scp, (char*)&mpd, sizeof(gdth_modep_data)); - break; - - case read_capacity: - trace2(("read capacity hdrive %d ",t)); - if (ha->hdr[t].size > (u64)0xffffffff) - rdc.last_block_no = 0xffffffff; - else - rdc.last_block_no = cpu_to_be32(ha->hdr[t].size-1); - rdc.block_length = cpu_to_be32(sector_size); - gdth_copy_internal_data(ha, scp, (char*)&rdc, sizeof(gdth_rdcap_data)); - break; - - case service_action_in_16: - if ((scp->cmnd[1] & 0x1f) == sai_read_capacity_16 && - (ha->cache_feat & gdt_64bit)) { - gdth_rdcap16_data rdc16; - - trace2(("read capacity (16) hdrive %d ",t)); - rdc16.last_block_no = cpu_to_be64(ha->hdr[t].size-1); - rdc16.block_length = cpu_to_be32(sector_size); - gdth_copy_internal_data(ha, scp, (char*)&rdc16, - sizeof(gdth_rdcap16_data)); - } else { - scp->result = did_abort << 16; - } - break; - - default: - trace2(("internal cache cmd 0x%x unknown ",scp->cmnd[0])); - break; - } - - if (!cmndinfo->wait_for_completion) - cmndinfo->wait_for_completion++; - else - return 1; - - return 0; -} - -static int gdth_fill_cache_cmd(gdth_ha_str *ha, struct scsi_cmnd *scp, - u16 hdrive) -{ - register gdth_cmd_str *cmdp; - struct gdth_cmndinfo *cmndinfo = gdth_cmnd_priv(scp); - u32 cnt, blockcnt; - u64 no, blockno; - int i, cmd_index, read_write, sgcnt, mode64; - - cmdp = ha->pccb; - trace(("gdth_fill_cache_cmd() cmd 0x%x cmdsize %d hdrive %d ", - scp->cmnd[0],scp->cmd_len,hdrive)); - - mode64 = (ha->cache_feat & gdt_64bit) ? true : false; - /* test for read_16, write_16 if !mode64 ? --- - not required, should not occur due to error return on - read_capacity_16 */ - - cmdp->service = cacheservice; - cmdp->requestbuffer = scp; - /* search free command index */ - if (!(cmd_index=gdth_get_cmd_index(ha))) { - trace(("gdt: no free command index found ")); - return 0; - } - /* if it's the first command, set command semaphore */ - if (ha->cmd_cnt == 0) - gdth_set_sema0(ha); - - /* fill command */ - read_write = 0; - if (cmndinfo->opcode != -1) - cmdp->opcode = cmndinfo->opcode; /* special cache cmd. */ - else if (scp->cmnd[0] == reserve) - cmdp->opcode = gdt_reserve_drv; - else if (scp->cmnd[0] == release) - cmdp->opcode = gdt_release_drv; - else if (scp->cmnd[0] == allow_medium_removal) { - if (scp->cmnd[4] & 1) /* prevent ? */ - cmdp->opcode = gdt_mount; - else if (scp->cmnd[3] & 1) /* removable drive ? */ - cmdp->opcode = gdt_unmount; - else - cmdp->opcode = gdt_flush; - } else if (scp->cmnd[0] == write_6 || scp->cmnd[0] == write_10 || - scp->cmnd[0] == write_12 || scp->cmnd[0] == write_16 - ) { - read_write = 1; - if (gdth_write_through || ((ha->hdr[hdrive].rw_attribs & 1) && - (ha->cache_feat & gdt_wr_through))) - cmdp->opcode = gdt_write_thr; - else - cmdp->opcode = gdt_write; - } else { - read_write = 2; - cmdp->opcode = gdt_read; - } - - cmdp->boardnode = localboard; - if (mode64) { - cmdp->u.cache64.deviceno = hdrive; - cmdp->u.cache64.blockno = 1; - cmdp->u.cache64.sg_canz = 0; - } else { - cmdp->u.cache.deviceno = hdrive; - cmdp->u.cache.blockno = 1; - cmdp->u.cache.sg_canz = 0; - } - - if (read_write) { - if (scp->cmd_len == 16) { - memcpy(&no, &scp->cmnd[2], sizeof(u64)); - blockno = be64_to_cpu(no); - memcpy(&cnt, &scp->cmnd[10], sizeof(u32)); - blockcnt = be32_to_cpu(cnt); - } else if (scp->cmd_len == 10) { - memcpy(&no, &scp->cmnd[2], sizeof(u32)); - blockno = be32_to_cpu(no); - memcpy(&cnt, &scp->cmnd[7], sizeof(u16)); - blockcnt = be16_to_cpu(cnt); - } else { - memcpy(&no, &scp->cmnd[0], sizeof(u32)); - blockno = be32_to_cpu(no) & 0x001ffffful; - blockcnt= scp->cmnd[4]==0 ? 0x100 : scp->cmnd[4]; - } - if (mode64) { - cmdp->u.cache64.blockno = blockno; - cmdp->u.cache64.blockcnt = blockcnt; - } else { - cmdp->u.cache.blockno = (u32)blockno; - cmdp->u.cache.blockcnt = blockcnt; - } - - if (scsi_bufflen(scp)) { - cmndinfo->dma_dir = (read_write == 1 ? - dma_to_device : dma_from_device); - sgcnt = dma_map_sg(&ha->pdev->dev, scsi_sglist(scp), - scsi_sg_count(scp), cmndinfo->dma_dir); - if (mode64) { - struct scatterlist *sl; - - cmdp->u.cache64.destaddr= (u64)-1; - cmdp->u.cache64.sg_canz = sgcnt; - scsi_for_each_sg(scp, sl, sgcnt, i) { - cmdp->u.cache64.sg_lst[i].sg_ptr = sg_dma_address(sl); - cmdp->u.cache64.sg_lst[i].sg_len = sg_dma_len(sl); - } - } else { - struct scatterlist *sl; - - cmdp->u.cache.destaddr= 0xffffffff; - cmdp->u.cache.sg_canz = sgcnt; - scsi_for_each_sg(scp, sl, sgcnt, i) { - cmdp->u.cache.sg_lst[i].sg_ptr = sg_dma_address(sl); - cmdp->u.cache.sg_lst[i].sg_len = sg_dma_len(sl); - } - } - -#ifdef gdth_statistics - if (max_sg < (u32)sgcnt) { - max_sg = (u32)sgcnt; - trace3(("gdt: max_sg = %d ",max_sg)); - } -#endif - - } - } - /* evaluate command size, check space */ - if (mode64) { - trace(("cache cmd: addr. %x sganz %x sgptr0 %x sglen0 %x ", - cmdp->u.cache64.destaddr,cmdp->u.cache64.sg_canz, - cmdp->u.cache64.sg_lst[0].sg_ptr, - cmdp->u.cache64.sg_lst[0].sg_len)); - trace(("cache cmd: cmd %d blockno. %d, blockcnt %d ", - cmdp->opcode,cmdp->u.cache64.blockno,cmdp->u.cache64.blockcnt)); - ha->cmd_len = gdtoffsof(gdth_cmd_str,u.cache64.sg_lst) + - (u16)cmdp->u.cache64.sg_canz * sizeof(gdth_sg64_str); - } else { - trace(("cache cmd: addr. %x sganz %x sgptr0 %x sglen0 %x ", - cmdp->u.cache.destaddr,cmdp->u.cache.sg_canz, - cmdp->u.cache.sg_lst[0].sg_ptr, - cmdp->u.cache.sg_lst[0].sg_len)); - trace(("cache cmd: cmd %d blockno. %d, blockcnt %d ", - cmdp->opcode,cmdp->u.cache.blockno,cmdp->u.cache.blockcnt)); - ha->cmd_len = gdtoffsof(gdth_cmd_str,u.cache.sg_lst) + - (u16)cmdp->u.cache.sg_canz * sizeof(gdth_sg_str); - } - if (ha->cmd_len & 3) - ha->cmd_len += (4 - (ha->cmd_len & 3)); - - if (ha->cmd_cnt > 0) { - if ((ha->cmd_offs_dpmem + ha->cmd_len + dpmem_command_offset) > - ha->ic_all_size) { - trace2(("gdth_fill_cache() dpmem overflow ")); - ha->cmd_tab[cmd_index-2].cmnd = unused_cmnd; - return 0; - } - } - - /* copy command */ - gdth_copy_command(ha); - return cmd_index; -} - -static int gdth_fill_raw_cmd(gdth_ha_str *ha, struct scsi_cmnd *scp, u8 b) -{ - register gdth_cmd_str *cmdp; - u16 i; - dma_addr_t sense_paddr; - int cmd_index, sgcnt, mode64; - u8 t,l; - struct gdth_cmndinfo *cmndinfo; - - t = scp->device->id; - l = scp->device->lun; - cmdp = ha->pccb; - trace(("gdth_fill_raw_cmd() cmd 0x%x bus %d id %d lun %d ", - scp->cmnd[0],b,t,l)); - - mode64 = (ha->raw_feat & gdt_64bit) ? true : false; - - cmdp->service = scsirawservice; - cmdp->requestbuffer = scp; - /* search free command index */ - if (!(cmd_index=gdth_get_cmd_index(ha))) { - trace(("gdt: no free command index found ")); - return 0; - } - /* if it's the first command, set command semaphore */ - if (ha->cmd_cnt == 0) - gdth_set_sema0(ha); - - cmndinfo = gdth_cmnd_priv(scp); - /* fill command */ - if (cmndinfo->opcode != -1) { - cmdp->opcode = cmndinfo->opcode; /* special raw cmd. */ - cmdp->boardnode = localboard; - if (mode64) { - cmdp->u.raw64.direction = (cmndinfo->phase >> 8); - trace2(("special raw cmd 0x%x param 0x%x ", - cmdp->opcode, cmdp->u.raw64.direction)); - /* evaluate command size */ - ha->cmd_len = gdtoffsof(gdth_cmd_str,u.raw64.sg_lst); - } else { - cmdp->u.raw.direction = (cmndinfo->phase >> 8); - trace2(("special raw cmd 0x%x param 0x%x ", - cmdp->opcode, cmdp->u.raw.direction)); - /* evaluate command size */ - ha->cmd_len = gdtoffsof(gdth_cmd_str,u.raw.sg_lst); - } - - } else { - sense_paddr = dma_map_single(&ha->pdev->dev, scp->sense_buffer, 16, - dma_from_device); - - cmndinfo->sense_paddr = sense_paddr; - cmdp->opcode = gdt_write; /* always */ - cmdp->boardnode = localboard; - if (mode64) { - cmdp->u.raw64.reserved = 0; - cmdp->u.raw64.mdisc_time = 0; - cmdp->u.raw64.mcon_time = 0; - cmdp->u.raw64.clen = scp->cmd_len; - cmdp->u.raw64.target = t; - cmdp->u.raw64.lun = l; - cmdp->u.raw64.bus = b; - cmdp->u.raw64.priority = 0; - cmdp->u.raw64.sdlen = scsi_bufflen(scp); - cmdp->u.raw64.sense_len = 16; - cmdp->u.raw64.sense_data = sense_paddr; - cmdp->u.raw64.direction = - gdth_direction_tab[scp->cmnd[0]]==dou ? gdth_data_out:gdth_data_in; - memcpy(cmdp->u.raw64.cmd,scp->cmnd,16); - cmdp->u.raw64.sg_ranz = 0; - } else { - cmdp->u.raw.reserved = 0; - cmdp->u.raw.mdisc_time = 0; - cmdp->u.raw.mcon_time = 0; - cmdp->u.raw.clen = scp->cmd_len; - cmdp->u.raw.target = t; - cmdp->u.raw.lun = l; - cmdp->u.raw.bus = b; - cmdp->u.raw.priority = 0; - cmdp->u.raw.link_p = 0; - cmdp->u.raw.sdlen = scsi_bufflen(scp); - cmdp->u.raw.sense_len = 16; - cmdp->u.raw.sense_data = sense_paddr; - cmdp->u.raw.direction = - gdth_direction_tab[scp->cmnd[0]]==dou ? gdth_data_out:gdth_data_in; - memcpy(cmdp->u.raw.cmd,scp->cmnd,12); - cmdp->u.raw.sg_ranz = 0; - } - - if (scsi_bufflen(scp)) { - cmndinfo->dma_dir = dma_bidirectional; - sgcnt = dma_map_sg(&ha->pdev->dev, scsi_sglist(scp), - scsi_sg_count(scp), cmndinfo->dma_dir); - if (mode64) { - struct scatterlist *sl; - - cmdp->u.raw64.sdata = (u64)-1; - cmdp->u.raw64.sg_ranz = sgcnt; - scsi_for_each_sg(scp, sl, sgcnt, i) { - cmdp->u.raw64.sg_lst[i].sg_ptr = sg_dma_address(sl); - cmdp->u.raw64.sg_lst[i].sg_len = sg_dma_len(sl); - } - } else { - struct scatterlist *sl; - - cmdp->u.raw.sdata = 0xffffffff; - cmdp->u.raw.sg_ranz = sgcnt; - scsi_for_each_sg(scp, sl, sgcnt, i) { - cmdp->u.raw.sg_lst[i].sg_ptr = sg_dma_address(sl); - cmdp->u.raw.sg_lst[i].sg_len = sg_dma_len(sl); - } - } - -#ifdef gdth_statistics - if (max_sg < sgcnt) { - max_sg = sgcnt; - trace3(("gdt: max_sg = %d ",sgcnt)); - } -#endif - - } - if (mode64) { - trace(("raw cmd: addr. %x sganz %x sgptr0 %x sglen0 %x ", - cmdp->u.raw64.sdata,cmdp->u.raw64.sg_ranz, - cmdp->u.raw64.sg_lst[0].sg_ptr, - cmdp->u.raw64.sg_lst[0].sg_len)); - /* evaluate command size */ - ha->cmd_len = gdtoffsof(gdth_cmd_str,u.raw64.sg_lst) + - (u16)cmdp->u.raw64.sg_ranz * sizeof(gdth_sg64_str); - } else { - trace(("raw cmd: addr. %x sganz %x sgptr0 %x sglen0 %x ", - cmdp->u.raw.sdata,cmdp->u.raw.sg_ranz, - cmdp->u.raw.sg_lst[0].sg_ptr, - cmdp->u.raw.sg_lst[0].sg_len)); - /* evaluate command size */ - ha->cmd_len = gdtoffsof(gdth_cmd_str,u.raw.sg_lst) + - (u16)cmdp->u.raw.sg_ranz * sizeof(gdth_sg_str); - } - } - /* check space */ - if (ha->cmd_len & 3) - ha->cmd_len += (4 - (ha->cmd_len & 3)); - - if (ha->cmd_cnt > 0) { - if ((ha->cmd_offs_dpmem + ha->cmd_len + dpmem_command_offset) > - ha->ic_all_size) { - trace2(("gdth_fill_raw() dpmem overflow ")); - ha->cmd_tab[cmd_index-2].cmnd = unused_cmnd; - return 0; - } - } - - /* copy command */ - gdth_copy_command(ha); - return cmd_index; -} - -static int gdth_special_cmd(gdth_ha_str *ha, struct scsi_cmnd *scp) -{ - register gdth_cmd_str *cmdp; - struct gdth_cmndinfo *cmndinfo = gdth_cmnd_priv(scp); - int cmd_index; - - cmdp= ha->pccb; - trace2(("gdth_special_cmd(): ")); - - *cmdp = *cmndinfo->internal_cmd_str; - cmdp->requestbuffer = scp; - - /* search free command index */ - if (!(cmd_index=gdth_get_cmd_index(ha))) { - trace(("gdt: no free command index found ")); - return 0; - } - - /* if it's the first command, set command semaphore */ - if (ha->cmd_cnt == 0) - gdth_set_sema0(ha); - - /* evaluate command size, check space */ - if (cmdp->opcode == gdt_ioctl) { - trace2(("ioctl ")); - ha->cmd_len = - gdtoffsof(gdth_cmd_str,u.ioctl.p_param) + sizeof(u64); - } else if (cmdp->service == cacheservice) { - trace2(("cache command %d ",cmdp->opcode)); - if (ha->cache_feat & gdt_64bit) - ha->cmd_len = - gdtoffsof(gdth_cmd_str,u.cache64.sg_lst) + sizeof(gdth_sg64_str); - else - ha->cmd_len = - gdtoffsof(gdth_cmd_str,u.cache.sg_lst) + sizeof(gdth_sg_str); - } else if (cmdp->service == scsirawservice) { - trace2(("raw command %d ",cmdp->opcode)); - if (ha->raw_feat & gdt_64bit) - ha->cmd_len = - gdtoffsof(gdth_cmd_str,u.raw64.sg_lst) + sizeof(gdth_sg64_str); - else - ha->cmd_len = - gdtoffsof(gdth_cmd_str,u.raw.sg_lst) + sizeof(gdth_sg_str); - } - - if (ha->cmd_len & 3) - ha->cmd_len += (4 - (ha->cmd_len & 3)); - - if (ha->cmd_cnt > 0) { - if ((ha->cmd_offs_dpmem + ha->cmd_len + dpmem_command_offset) > - ha->ic_all_size) { - trace2(("gdth_special_cmd() dpmem overflow ")); - ha->cmd_tab[cmd_index-2].cmnd = unused_cmnd; - return 0; - } - } - - /* copy command */ - gdth_copy_command(ha); - return cmd_index; -} - - -/* controller event handling functions */ -static gdth_evt_str *gdth_store_event(gdth_ha_str *ha, u16 source, - u16 idx, gdth_evt_data *evt) -{ - gdth_evt_str *e; - - /* no gdth_lock_ha() ! */ - trace2(("gdth_store_event() source %d idx %d ", source, idx)); - if (source == 0) /* no source -> no event */ - return null; - - if (ebuffer[elastidx].event_source == source && - ebuffer[elastidx].event_idx == idx && - ((evt->size != 0 && ebuffer[elastidx].event_data.size != 0 && - !memcmp((char *)&ebuffer[elastidx].event_data.eu, - (char *)&evt->eu, evt->size)) || - (evt->size == 0 && ebuffer[elastidx].event_data.size == 0 && - !strcmp((char *)&ebuffer[elastidx].event_data.event_string, - (char *)&evt->event_string)))) { - e = &ebuffer[elastidx]; - e->last_stamp = (u32)ktime_get_real_seconds(); - ++e->same_count; - } else { - if (ebuffer[elastidx].event_source != 0) { /* entry not free ? */ - ++elastidx; - if (elastidx == max_events) - elastidx = 0; - if (elastidx == eoldidx) { /* reached mark ? */ - ++eoldidx; - if (eoldidx == max_events) - eoldidx = 0; - } - } - e = &ebuffer[elastidx]; - e->event_source = source; - e->event_idx = idx; - e->first_stamp = e->last_stamp = (u32)ktime_get_real_seconds(); - e->same_count = 1; - e->event_data = *evt; - e->application = 0; - } - return e; -} - -static int gdth_read_event(gdth_ha_str *ha, int handle, gdth_evt_str *estr) -{ - gdth_evt_str *e; - int eindex; - unsigned long flags; - - trace2(("gdth_read_event() handle %d ", handle)); - spin_lock_irqsave(&ha->smp_lock, flags); - if (handle == -1) - eindex = eoldidx; - else - eindex = handle; - estr->event_source = 0; - - if (eindex < 0 || eindex >= max_events) { - spin_unlock_irqrestore(&ha->smp_lock, flags); - return eindex; - } - e = &ebuffer[eindex]; - if (e->event_source != 0) { - if (eindex != elastidx) { - if (++eindex == max_events) - eindex = 0; - } else { - eindex = -1; - } - memcpy(estr, e, sizeof(gdth_evt_str)); - } - spin_unlock_irqrestore(&ha->smp_lock, flags); - return eindex; -} - -static void gdth_readapp_event(gdth_ha_str *ha, - u8 application, gdth_evt_str *estr) -{ - gdth_evt_str *e; - int eindex; - unsigned long flags; - u8 found = false; - - trace2(("gdth_readapp_event() app. %d ", application)); - spin_lock_irqsave(&ha->smp_lock, flags); - eindex = eoldidx; - for (;;) { - e = &ebuffer[eindex]; - if (e->event_source == 0) - break; - if ((e->application & application) == 0) { - e->application |= application; - found = true; - break; - } - if (eindex == elastidx) - break; - if (++eindex == max_events) - eindex = 0; - } - if (found) - memcpy(estr, e, sizeof(gdth_evt_str)); - else - estr->event_source = 0; - spin_unlock_irqrestore(&ha->smp_lock, flags); -} - -static void gdth_clear_events(void) -{ - trace(("gdth_clear_events()")); - - eoldidx = elastidx = 0; - ebuffer[0].event_source = 0; -} - - -/* scsi interface functions */ - -static irqreturn_t __gdth_interrupt(gdth_ha_str *ha, - int gdth_from_wait, int* pindex) -{ - gdt6m_dpram_str __iomem *dp6m_ptr = null; - gdt6_dpram_str __iomem *dp6_ptr; - struct scsi_cmnd *scp; - int rval, i; - u8 istatus; - u16 service; - unsigned long flags = 0; - - trace(("gdth_interrupt() irq %d ", ha->irq)); - - /* if polling and not from gdth_wait() -> return */ - if (gdth_polling) { - if (!gdth_from_wait) { - return irq_handled; - } - } - - if (!gdth_polling) - spin_lock_irqsave(&ha->smp_lock, flags); - - /* search controller */ - istatus = gdth_get_status(ha); - if (istatus == 0) { - /* spurious interrupt */ - if (!gdth_polling) - spin_unlock_irqrestore(&ha->smp_lock, flags); - return irq_handled; - } - -#ifdef gdth_statistics - ++act_ints; -#endif - - if (ha->type == gdt_pci) { - dp6_ptr = ha->brd; - if (istatus & 0x80) { /* error flag */ - istatus &= ~0x80; - ha->status = readw(&dp6_ptr->u.ic.status); - trace2(("gdth_interrupt() error %d/%d ",istatus,ha->status)); - } else /* no error */ - ha->status = s_ok; - ha->info = readl(&dp6_ptr->u.ic.info[0]); - ha->service = readw(&dp6_ptr->u.ic.service); - ha->info2 = readl(&dp6_ptr->u.ic.info[1]); - - writeb(0xff, &dp6_ptr->io.irqdel); /* acknowledge interrupt */ - writeb(0, &dp6_ptr->u.ic.cmd_index);/* reset command index */ - writeb(0, &dp6_ptr->io.sema1); /* reset status semaphore */ - } else if (ha->type == gdt_pcinew) { - if (istatus & 0x80) { /* error flag */ - istatus &= ~0x80; - ha->status = inw(ptr2ushort(&ha->plx->status)); - trace2(("gdth_interrupt() error %d/%d ",istatus,ha->status)); - } else - ha->status = s_ok; - ha->info = inl(ptr2ushort(&ha->plx->info[0])); - ha->service = inw(ptr2ushort(&ha->plx->service)); - ha->info2 = inl(ptr2ushort(&ha->plx->info[1])); - - outb(0xff, ptr2ushort(&ha->plx->edoor_reg)); - outb(0x00, ptr2ushort(&ha->plx->sema1_reg)); - } else if (ha->type == gdt_pcimpr) { - dp6m_ptr = ha->brd; - if (istatus & 0x80) { /* error flag */ - istatus &= ~0x80; - ha->status = readw(&dp6m_ptr->i960r.status); - trace2(("gdth_interrupt() error %d/%d ",istatus,ha->status)); - } else /* no error */ - ha->status = s_ok; - - ha->info = readl(&dp6m_ptr->i960r.info[0]); - ha->service = readw(&dp6m_ptr->i960r.service); - ha->info2 = readl(&dp6m_ptr->i960r.info[1]); - - /* event string */ - if (istatus == asyncindex) { - if (ha->service != screenservice && - (ha->fw_vers & 0xff) >= 0x1a) { - ha->dvr.severity = readb - (&((gdt6m_dpram_str __iomem *)ha->brd)->i960r.severity); - for (i = 0; i < 256; ++i) { - ha->dvr.event_string[i] = readb - (&((gdt6m_dpram_str __iomem *)ha->brd)->i960r.evt_str[i]); - if (ha->dvr.event_string[i] == 0) - break; - } - } - } - writeb(0xff, &dp6m_ptr->i960r.edoor_reg); - writeb(0, &dp6m_ptr->i960r.sema1_reg); - } else { - trace2(("gdth_interrupt() unknown controller type ")); - if (!gdth_polling) - spin_unlock_irqrestore(&ha->smp_lock, flags); - return irq_handled; - } - - trace(("gdth_interrupt() index %d stat %d info %d ", - istatus,ha->status,ha->info)); - - if (gdth_from_wait) { - *pindex = (int)istatus; - } - - if (istatus == asyncindex) { - trace2(("gdth_interrupt() async. event ")); - gdth_async_event(ha); - if (!gdth_polling) - spin_unlock_irqrestore(&ha->smp_lock, flags); - gdth_next(ha); - return irq_handled; - } - - if (istatus == spezindex) { - trace2(("service unknown or not initialized ! ")); - ha->dvr.size = sizeof(ha->dvr.eu.driver); - ha->dvr.eu.driver.ionode = ha->hanum; - gdth_store_event(ha, es_driver, 4, &ha->dvr); - if (!gdth_polling) - spin_unlock_irqrestore(&ha->smp_lock, flags); - return irq_handled; - } - scp = ha->cmd_tab[istatus-2].cmnd; - service = ha->cmd_tab[istatus-2].service; - ha->cmd_tab[istatus-2].cmnd = unused_cmnd; - if (scp == unused_cmnd) { - trace2(("gdth_interrupt() index to unused command (%d) ",istatus)); - ha->dvr.size = sizeof(ha->dvr.eu.driver); - ha->dvr.eu.driver.ionode = ha->hanum; - ha->dvr.eu.driver.index = istatus; - gdth_store_event(ha, es_driver, 1, &ha->dvr); - if (!gdth_polling) - spin_unlock_irqrestore(&ha->smp_lock, flags); - return irq_handled; - } - if (scp == internal_cmnd) { - trace(("gdth_interrupt() answer to internal command ")); - if (!gdth_polling) - spin_unlock_irqrestore(&ha->smp_lock, flags); - return irq_handled; - } - - trace(("gdth_interrupt() sync. status ")); - rval = gdth_sync_event(ha,service,istatus,scp); - if (!gdth_polling) - spin_unlock_irqrestore(&ha->smp_lock, flags); - if (rval == 2) { - gdth_putq(ha, scp, gdth_cmnd_priv(scp)->priority); - } else if (rval == 1) { - gdth_scsi_done(scp); - } - - gdth_next(ha); - return irq_handled; -} - -static irqreturn_t gdth_interrupt(int irq, void *dev_id) -{ - gdth_ha_str *ha = dev_id; - - return __gdth_interrupt(ha, false, null); -} - -static int gdth_sync_event(gdth_ha_str *ha, int service, u8 index, - struct scsi_cmnd *scp) -{ - gdth_msg_str *msg; - gdth_cmd_str *cmdp; - u8 b, t; - struct gdth_cmndinfo *cmndinfo = gdth_cmnd_priv(scp); - - cmdp = ha->pccb; - trace(("gdth_sync_event() serv %d status %d ", - service,ha->status)); - - if (service == screenservice) { - msg = ha->pmsg; - trace(("len: %d, answer: %d, ext: %d, alen: %d ", - msg->msg_len,msg->msg_answer,msg->msg_ext,msg->msg_alen)); - if (msg->msg_len > msglen+1) - msg->msg_len = msglen+1; - if (msg->msg_len) - if (!(msg->msg_answer && msg->msg_ext)) { - msg->msg_text[msg->msg_len] = ''; - printk("%s",msg->msg_text); - } - - if (msg->msg_ext && !msg->msg_answer) { - while (gdth_test_busy(ha)) - gdth_delay(0); - cmdp->service = screenservice; - cmdp->requestbuffer = screen_cmnd; - gdth_get_cmd_index(ha); - gdth_set_sema0(ha); - cmdp->opcode = gdt_read; - cmdp->boardnode = localboard; - cmdp->u.screen.reserved = 0; - cmdp->u.screen.su.msg.msg_handle= msg->msg_handle; - cmdp->u.screen.su.msg.msg_addr = ha->msg_phys; - ha->cmd_offs_dpmem = 0; - ha->cmd_len = gdtoffsof(gdth_cmd_str,u.screen.su.msg.msg_addr) - + sizeof(u64); - ha->cmd_cnt = 0; - gdth_copy_command(ha); - gdth_release_event(ha); - return 0; - } - - if (msg->msg_answer && msg->msg_alen) { - /* default answers (getchar() not possible) */ - if (msg->msg_alen == 1) { - msg->msg_alen = 0; - msg->msg_len = 1; - msg->msg_text[0] = 0; - } else { - msg->msg_alen -= 2; - msg->msg_len = 2; - msg->msg_text[0] = 1; - msg->msg_text[1] = 0; - } - msg->msg_ext = 0; - msg->msg_answer = 0; - while (gdth_test_busy(ha)) - gdth_delay(0); - cmdp->service = screenservice; - cmdp->requestbuffer = screen_cmnd; - gdth_get_cmd_index(ha); - gdth_set_sema0(ha); - cmdp->opcode = gdt_write; - cmdp->boardnode = localboard; - cmdp->u.screen.reserved = 0; - cmdp->u.screen.su.msg.msg_handle= msg->msg_handle; - cmdp->u.screen.su.msg.msg_addr = ha->msg_phys; - ha->cmd_offs_dpmem = 0; - ha->cmd_len = gdtoffsof(gdth_cmd_str,u.screen.su.msg.msg_addr) - + sizeof(u64); - ha->cmd_cnt = 0; - gdth_copy_command(ha); - gdth_release_event(ha); - return 0; - } - printk(" "); - - } else { - b = scp->device->channel; - t = scp->device->id; - if (cmndinfo->opcode == -1 && b != ha->virt_bus) { - ha->raw[bus_l2p(ha,b)].io_cnt[t]--; - } - /* cache or raw service */ - if (ha->status == s_bsy) { - trace2(("controller busy -> retry ! ")); - if (cmndinfo->opcode == gdt_mount) - cmndinfo->opcode = gdt_clust_info; - /* retry */ - return 2; - } - if (scsi_bufflen(scp)) - dma_unmap_sg(&ha->pdev->dev, scsi_sglist(scp), scsi_sg_count(scp), - cmndinfo->dma_dir); - - if (cmndinfo->sense_paddr) - dma_unmap_page(&ha->pdev->dev, cmndinfo->sense_paddr, 16, - dma_from_device); - - if (ha->status == s_ok) { - cmndinfo->status = s_ok; - cmndinfo->info = ha->info; - if (cmndinfo->opcode != -1) { - trace2(("gdth_sync_event(): special cmd 0x%x ok ", - cmndinfo->opcode)); - /* special commands gdt_clust_info/gdt_mount ? */ - if (cmndinfo->opcode == gdt_clust_info) { - ha->hdr[t].cluster_type = (u8)ha->info; - if (!(ha->hdr[t].cluster_type & - cluster_mounted)) { - /* not mounted -> mount */ - cmndinfo->opcode = gdt_mount; - if (ha->hdr[t].cluster_type & - cluster_reserved) { - /* cluster drive reserved (on the other node) */ - cmndinfo->phase = -2; /* reservation conflict */ - } - } else { - cmndinfo->opcode = -1; - } - } else { - if (cmndinfo->opcode == gdt_mount) { - ha->hdr[t].cluster_type |= cluster_mounted; - ha->hdr[t].media_changed = true; - } else if (cmndinfo->opcode == gdt_unmount) { - ha->hdr[t].cluster_type &= ~cluster_mounted; - ha->hdr[t].media_changed = true; - } - cmndinfo->opcode = -1; - } - /* retry */ - cmndinfo->priority = high_pri; - return 2; - } else { - /* reserve/release ? */ - if (scp->cmnd[0] == reserve) { - ha->hdr[t].cluster_type |= cluster_reserved; - } else if (scp->cmnd[0] == release) { - ha->hdr[t].cluster_type &= ~cluster_reserved; - } - scp->result = did_ok << 16; - scp->sense_buffer[0] = 0; - } - } else { - cmndinfo->status = ha->status; - cmndinfo->info = ha->info; - - if (cmndinfo->opcode != -1) { - trace2(("gdth_sync_event(): special cmd 0x%x error 0x%x ", - cmndinfo->opcode, ha->status)); - if (cmndinfo->opcode == gdt_scan_start || - cmndinfo->opcode == gdt_scan_end) { - cmndinfo->opcode = -1; - /* retry */ - cmndinfo->priority = high_pri; - return 2; - } - memset((char*)scp->sense_buffer,0,16); - scp->sense_buffer[0] = 0x70; - scp->sense_buffer[2] = not_ready; - scp->result = (did_ok << 16) | (check_condition << 1); - } else if (service == cacheservice) { - if (ha->status == s_cache_unknown && - (ha->hdr[t].cluster_type & - cluster_reserve_state) == cluster_reserve_state) { - /* bus reset -> force gdt_clust_info */ - ha->hdr[t].cluster_type &= ~cluster_reserved; - } - memset((char*)scp->sense_buffer,0,16); - if (ha->status == (u16)s_cache_reserv) { - scp->result = (did_ok << 16) | (reservation_conflict << 1); - } else { - scp->sense_buffer[0] = 0x70; - scp->sense_buffer[2] = not_ready; - scp->result = (did_ok << 16) | (check_condition << 1); - } - if (!cmndinfo->internal_command) { - ha->dvr.size = sizeof(ha->dvr.eu.sync); - ha->dvr.eu.sync.ionode = ha->hanum; - ha->dvr.eu.sync.service = service; - ha->dvr.eu.sync.status = ha->status; - ha->dvr.eu.sync.info = ha->info; - ha->dvr.eu.sync.hostdrive = t; - if (ha->status >= 0x8000) - gdth_store_event(ha, es_sync, 0, &ha->dvr); - else - gdth_store_event(ha, es_sync, service, &ha->dvr); - } - } else { - /* sense buffer filled from controller firmware (dma) */ - if (ha->status != s_raw_scsi || ha->info >= 0x100) { - scp->result = did_bad_target << 16; - } else { - scp->result = (did_ok << 16) | ha->info; - } - } - } - if (!cmndinfo->wait_for_completion) - cmndinfo->wait_for_completion++; - else - return 1; - } - - return 0; -} - -static char *async_cache_tab[] = { -/* 0*/ " " - "gdt ha %u, service %u, async. status %u/%lu unknown", -/* 1*/ " " - "gdt ha %u, service %u, async. status %u/%lu unknown", -/* 2*/ "" - "gdt ha %u, host drive %lu not ready", -/* 3*/ "" - "gdt ha %u, host drive %lu: reassign not successful and/or data error on reassigned blocks. drive may crash in the future and should be replaced", -/* 4*/ "" - "gdt ha %u, mirror update on host drive %lu failed", -/* 5*/ "" - "gdt ha %u, mirror drive %lu failed", -/* 6*/ "" - "gdt ha %u, mirror drive %lu: reassign not successful and/or data error on reassigned blocks. drive may crash in the future and should be replaced", -/* 7*/ "" - "gdt ha %u, host drive %lu write protected", -/* 8*/ "" - "gdt ha %u, media changed in host drive %lu", -/* 9*/ "" - "gdt ha %u, host drive %lu is offline", -/*10*/ "" - "gdt ha %u, media change of mirror drive %lu", -/*11*/ "" - "gdt ha %u, mirror drive %lu is write protected", -/*12*/ "" - "gdt ha %u, general error on host drive %lu. please check the devices of this drive!", -/*13*/ "" - "gdt ha %u, array drive %u: cache drive %u failed", -/*14*/ "" - "gdt ha %u, array drive %u: fail state entered", -/*15*/ "" - "gdt ha %u, array drive %u: error", -/*16*/ "" - "gdt ha %u, array drive %u: failed drive replaced by cache drive %u", -/*17*/ "" - "gdt ha %u, array drive %u: parity build failed", -/*18*/ "" - "gdt ha %u, array drive %u: drive rebuild failed", -/*19*/ "" - "gdt ha %u, test of hot fix %u failed", -/*20*/ "" - "gdt ha %u, array drive %u: drive build finished successfully", -/*21*/ "" - "gdt ha %u, array drive %u: drive rebuild finished successfully", -/*22*/ "" - "gdt ha %u, array drive %u: hot fix %u activated", -/*23*/ "" - "gdt ha %u, host drive %u: processing of i/o aborted due to serious drive error", -/*24*/ "" - "gdt ha %u, mirror update on cache drive %u completed", -/*25*/ "" - "gdt ha %u, mirror update on cache drive %lu failed", -/*26*/ "" - "gdt ha %u, array drive %u: drive rebuild started", -/*27*/ " " - "gdt ha %u, fault bus %u: shelf ok detected", -/*28*/ " " - "gdt ha %u, fault bus %u: shelf not ok detected", -/*29*/ " " - "gdt ha %u, fault bus %u, id %u: auto hot plug started", -/*30*/ " " - "gdt ha %u, fault bus %u, id %u: new disk detected", -/*31*/ " " - "gdt ha %u, fault bus %u, id %u: old disk detected", -/*32*/ " " - "gdt ha %u, fault bus %u, id %u: plugging an active disk is invalid", -/*33*/ " " - "gdt ha %u, fault bus %u, id %u: invalid device detected", -/*34*/ " " - "gdt ha %u, fault bus %u, id %u: insufficient disk capacity (%lu mb required)", -/*35*/ " " - "gdt ha %u, fault bus %u, id %u: disk write protected", -/*36*/ " " - "gdt ha %u, fault bus %u, id %u: disk not available", -/*37*/ " " - "gdt ha %u, fault bus %u: swap detected (%lu)", -/*38*/ " " - "gdt ha %u, fault bus %u, id %u: auto hot plug finished successfully", -/*39*/ " " - "gdt ha %u, fault bus %u, id %u: auto hot plug aborted due to user hot plug", -/*40*/ " " - "gdt ha %u, fault bus %u, id %u: auto hot plug aborted", -/*41*/ " " - "gdt ha %u, fault bus %u, id %u: auto hot plug for hot fix started", -/*42*/ "" - "gdt ha %u, array drive %u: drive build started", -/*43*/ "" - "gdt ha %u, dram parity error detected", -/*44*/ "" - "gdt ha %u, mirror drive %u: update started", -/*45*/ "" - "gdt ha %u, mirror drive %u: hot fix %u activated", -/*46*/ "" - "gdt ha %u, array drive %u: no matching pool hot fix drive available", -/*47*/ "" - "gdt ha %u, array drive %u: pool hot fix drive available", -/*48*/ "" - "gdt ha %u, mirror drive %u: no matching pool hot fix drive available", -/*49*/ "" - "gdt ha %u, mirror drive %u: pool hot fix drive available", -/*50*/ " " - "gdt ha %u, scsi bus %u, id %u: ignore_wide_residue message received", -/*51*/ "" - "gdt ha %u, array drive %u: expand started", -/*52*/ "" - "gdt ha %u, array drive %u: expand finished successfully", -/*53*/ "" - "gdt ha %u, array drive %u: expand failed", -/*54*/ "" - "gdt ha %u, cpu temperature critical", -/*55*/ "" - "gdt ha %u, cpu temperature ok", -/*56*/ "" - "gdt ha %u, host drive %lu created", -/*57*/ "" - "gdt ha %u, array drive %u: expand restarted", -/*58*/ "" - "gdt ha %u, array drive %u: expand stopped", -/*59*/ "" - "gdt ha %u, mirror drive %u: drive build quited", -/*60*/ "" - "gdt ha %u, array drive %u: parity build quited", -/*61*/ "" - "gdt ha %u, array drive %u: drive rebuild quited", -/*62*/ "" - "gdt ha %u, array drive %u: parity verify started", -/*63*/ "" - "gdt ha %u, array drive %u: parity verify done", -/*64*/ "" - "gdt ha %u, array drive %u: parity verify failed", -/*65*/ "" - "gdt ha %u, array drive %u: parity error detected", -/*66*/ "" - "gdt ha %u, array drive %u: parity verify quited", -/*67*/ "" - "gdt ha %u, host drive %u reserved", -/*68*/ "" - "gdt ha %u, host drive %u mounted and released", -/*69*/ "" - "gdt ha %u, host drive %u released", -/*70*/ "" - "gdt ha %u, dram error detected and corrected with ecc", -/*71*/ "" - "gdt ha %u, uncorrectable dram error detected with ecc", -/*72*/ " " - "gdt ha %u, scsi bus %u, id %u, lun %u: reassigning block", -/*73*/ "" - "gdt ha %u, host drive %u resetted locally", -/*74*/ "" - "gdt ha %u, host drive %u resetted remotely", -/*75*/ "" - "gdt ha %u, async. status 75 unknown", -}; - - -static int gdth_async_event(gdth_ha_str *ha) -{ - gdth_cmd_str *cmdp; - - cmdp= ha->pccb; - trace2(("gdth_async_event() ha %d serv %d ", - ha->hanum, ha->service)); - - if (ha->service == screenservice) { - if (ha->status == msg_request) { - while (gdth_test_busy(ha)) - gdth_delay(0); - cmdp->service = screenservice; - cmdp->requestbuffer = screen_cmnd; - gdth_set_sema0(ha); - cmdp->opcode = gdt_read; - cmdp->boardnode = localboard; - cmdp->u.screen.reserved = 0; - cmdp->u.screen.su.msg.msg_handle= msg_inv_handle; - cmdp->u.screen.su.msg.msg_addr = ha->msg_phys; - ha->cmd_offs_dpmem = 0; - ha->cmd_len = gdtoffsof(gdth_cmd_str,u.screen.su.msg.msg_addr) - + sizeof(u64); - ha->cmd_cnt = 0; - gdth_copy_command(ha); - printk("[pci %d/%d] ",(u16)(ha->brd_phys>>8), - (u16)((ha->brd_phys>>3)&0x1f)); - gdth_release_event(ha); - } - - } else { - if (ha->type == gdt_pcimpr && - (ha->fw_vers & 0xff) >= 0x1a) { - ha->dvr.size = 0; - ha->dvr.eu.async.ionode = ha->hanum; - ha->dvr.eu.async.status = ha->status; - /* severity and event_string already set! */ - } else { - ha->dvr.size = sizeof(ha->dvr.eu.async); - ha->dvr.eu.async.ionode = ha->hanum; - ha->dvr.eu.async.service = ha->service; - ha->dvr.eu.async.status = ha->status; - ha->dvr.eu.async.info = ha->info; - *(u32 *)ha->dvr.eu.async.scsi_coord = ha->info2; - } - gdth_store_event( ha, es_async, ha->service, &ha->dvr ); - gdth_log_event( &ha->dvr, null ); - - /* new host drive from expand? */ - if (ha->service == cacheservice && ha->status == 56) { - trace2(("gdth_async_event(): new host drive %d created ", - (u16)ha->info)); - /* gdth_analyse_hdrive(hanum, (u16)ha->info); */ - } - } - return 1; -} - -static void gdth_log_event(gdth_evt_data *dvr, char *buffer) -{ - gdth_stackframe stack; - char *f = null; - int i,j; - - trace2(("gdth_log_event() ")); - if (dvr->size == 0) { - if (buffer == null) { - printk("adapter %d: %s ",dvr->eu.async.ionode,dvr->event_string); - } else { - sprintf(buffer,"adapter %d: %s ", - dvr->eu.async.ionode,dvr->event_string); - } - } else if (dvr->eu.async.service == cacheservice && - index_ok(dvr->eu.async.status, async_cache_tab)) { - trace2(("gdt: async. event cache service, event no.: %d ", - dvr->eu.async.status)); - - f = async_cache_tab[dvr->eu.async.status]; - - /* i: parameter to push, j: stack element to fill */ - for (j=0,i=1; i < f[0]; i+=2) { - switch (f[i+1]) { - case 4: - stack.b[j++] = *(u32*)&dvr->eu.stream[(int)f[i]]; - break; - case 2: - stack.b[j++] = *(u16*)&dvr->eu.stream[(int)f[i]]; - break; - case 1: - stack.b[j++] = *(u8*)&dvr->eu.stream[(int)f[i]]; - break; - default: - break; - } - } - - if (buffer == null) { - printk(&f[(int)f[0]],stack); - printk(" "); - } else { - sprintf(buffer,&f[(int)f[0]],stack); - } - - } else { - if (buffer == null) { - printk("gdt ha %u, unknown async. event service %d event no. %d ", - dvr->eu.async.ionode,dvr->eu.async.service,dvr->eu.async.status); - } else { - sprintf(buffer,"gdt ha %u, unknown async. event service %d event no. %d", - dvr->eu.async.ionode,dvr->eu.async.service,dvr->eu.async.status); - } - } -} - -#ifdef gdth_statistics -static u8 gdth_timer_running; - -static void gdth_timeout(struct timer_list *unused) -{ - u32 i; - struct scsi_cmnd *nscp; - gdth_ha_str *ha; - unsigned long flags; - - if(unlikely(list_empty(&gdth_instances))) { - gdth_timer_running = 0; - return; - } - - ha = list_first_entry(&gdth_instances, gdth_ha_str, list); - spin_lock_irqsave(&ha->smp_lock, flags); - - for (act_stats=0,i=0; i<gdth_maxcmds; ++i) - if (ha->cmd_tab[i].cmnd != unused_cmnd) - ++act_stats; - - for (act_rq=0, - nscp=ha->req_first; nscp; nscp=(struct scsi_cmnd*)nscp->scp.ptr) - ++act_rq; - - trace2(("gdth_to(): ints %d, ios %d, act_stats %d, act_rq %d ", - act_ints, act_ios, act_stats, act_rq)); - act_ints = act_ios = 0; - - gdth_timer.expires = jiffies + 30 * hz; - add_timer(&gdth_timer); - spin_unlock_irqrestore(&ha->smp_lock, flags); -} - -static void gdth_timer_init(void) -{ - if (gdth_timer_running) - return; - gdth_timer_running = 1; - trace2(("gdth_detect(): initializing timer ! ")); - gdth_timer.expires = jiffies + hz; - add_timer(&gdth_timer); -} -#else -static inline void gdth_timer_init(void) -{ -} -#endif - - -static const char *gdth_ctr_name(gdth_ha_str *ha) -{ - trace2(("gdth_ctr_name() ")); - - if (ha->type == gdt_pci) { - switch (ha->pdev->device) { - case pci_device_id_vortex_gdt60x0: - return("gdt6000/6020/6050"); - case pci_device_id_vortex_gdt6000b: - return("gdt6000b/6010"); - } - } - /* new controllers (gdt_pcinew, gdt_pcimpr, ..) use board_info ioctl! */ - - return(""); -} - -static const char *gdth_info(struct scsi_host *shp) -{ - gdth_ha_str *ha = shost_priv(shp); - - trace2(("gdth_info() ")); - return ((const char *)ha->binfo.type_string); -} - -static enum blk_eh_timer_return gdth_timed_out(struct scsi_cmnd *scp) -{ - gdth_ha_str *ha = shost_priv(scp->device->host); - struct gdth_cmndinfo *cmndinfo = gdth_cmnd_priv(scp); - u8 b, t; - unsigned long flags; - enum blk_eh_timer_return retval = blk_eh_done; - - trace(("%s() cmd 0x%x ", scp->cmnd[0], __func__)); - b = scp->device->channel; - t = scp->device->id; - - /* - * we don't really honor the command timeout, but we try to - * honor 6 times of the actual command timeout! so reset the - * timer if this is less than 6th timeout on this command! - */ - if (++cmndinfo->timeout_count < 6) - retval = blk_eh_reset_timer; - - /* reset the timeout if it is locked io */ - spin_lock_irqsave(&ha->smp_lock, flags); - if ((b != ha->virt_bus && ha->raw[bus_l2p(ha, b)].lock) || - (b == ha->virt_bus && t < max_hdrives && ha->hdr[t].lock)) { - trace2(("%s(): locked io, reset timeout ", __func__)); - retval = blk_eh_reset_timer; - } - spin_unlock_irqrestore(&ha->smp_lock, flags); - - return retval; -} - - -static int gdth_eh_bus_reset(struct scsi_cmnd *scp) -{ - gdth_ha_str *ha = shost_priv(scp->device->host); - int i; - unsigned long flags; - struct scsi_cmnd *cmnd; - u8 b; - - trace2(("gdth_eh_bus_reset() ")); - - b = scp->device->channel; - - /* clear command tab */ - spin_lock_irqsave(&ha->smp_lock, flags); - for (i = 0; i < gdth_maxcmds; ++i) { - cmnd = ha->cmd_tab[i].cmnd; - if (!special_scp(cmnd) && cmnd->device->channel == b) - ha->cmd_tab[i].cmnd = unused_cmnd; - } - spin_unlock_irqrestore(&ha->smp_lock, flags); - - if (b == ha->virt_bus) { - /* host drives */ - for (i = 0; i < max_hdrives; ++i) { - if (ha->hdr[i].present) { - spin_lock_irqsave(&ha->smp_lock, flags); - gdth_polling = true; - while (gdth_test_busy(ha)) - gdth_delay(0); - if (gdth_internal_cmd(ha, cacheservice, - gdt_clust_reset, i, 0, 0)) - ha->hdr[i].cluster_type &= ~cluster_reserved; - gdth_polling = false; - spin_unlock_irqrestore(&ha->smp_lock, flags); - } - } - } else { - /* raw devices */ - spin_lock_irqsave(&ha->smp_lock, flags); - for (i = 0; i < maxid; ++i) - ha->raw[bus_l2p(ha,b)].io_cnt[i] = 0; - gdth_polling = true; - while (gdth_test_busy(ha)) - gdth_delay(0); - gdth_internal_cmd(ha, scsirawservice, gdt_reset_bus, - bus_l2p(ha,b), 0, 0); - gdth_polling = false; - spin_unlock_irqrestore(&ha->smp_lock, flags); - } - return success; -} - -static int gdth_bios_param(struct scsi_device *sdev,struct block_device *bdev,sector_t cap,int *ip) -{ - u8 b, t; - gdth_ha_str *ha = shost_priv(sdev->host); - struct scsi_device *sd; - unsigned capacity; - - sd = sdev; - capacity = cap; - b = sd->channel; - t = sd->id; - trace2(("gdth_bios_param() ha %d bus %d target %d ", ha->hanum, b, t)); - - if (b != ha->virt_bus || ha->hdr[t].heads == 0) { - /* raw device or host drive without mapping information */ - trace2(("evaluate mapping ")); - gdth_eval_mapping(capacity,&ip[2],&ip[0],&ip[1]); - } else { - ip[0] = ha->hdr[t].heads; - ip[1] = ha->hdr[t].secs; - ip[2] = capacity / ip[0] / ip[1]; - } - - trace2(("gdth_bios_param(): %d heads, %d secs, %d cyls ", - ip[0],ip[1],ip[2])); - return 0; -} - - -static int gdth_queuecommand_lck(struct scsi_cmnd *scp, - void (*done)(struct scsi_cmnd *)) -{ - gdth_ha_str *ha = shost_priv(scp->device->host); - struct gdth_cmndinfo *cmndinfo; - - trace(("gdth_queuecommand() cmd 0x%x ", scp->cmnd[0])); - - cmndinfo = gdth_get_cmndinfo(ha); - bug_on(!cmndinfo); - - scp->scsi_done = done; - cmndinfo->timeout_count = 0; - cmndinfo->priority = default_pri; - - return __gdth_queuecommand(ha, scp, cmndinfo); -} - -static def_scsi_qcmd(gdth_queuecommand) - -static int __gdth_queuecommand(gdth_ha_str *ha, struct scsi_cmnd *scp, - struct gdth_cmndinfo *cmndinfo) -{ - scp->host_scribble = (unsigned char *)cmndinfo; - cmndinfo->wait_for_completion = 1; - cmndinfo->phase = -1; - cmndinfo->opcode = -1; - -#ifdef gdth_statistics - ++act_ios; -#endif - - gdth_putq(ha, scp, cmndinfo->priority); - gdth_next(ha); - return 0; -} - - -static int gdth_open(struct inode *inode, struct file *filep) -{ - gdth_ha_str *ha; - - mutex_lock(&gdth_mutex); - list_for_each_entry(ha, &gdth_instances, list) { - if (!ha->sdev) - ha->sdev = scsi_get_host_dev(ha->shost); - } - mutex_unlock(&gdth_mutex); - - trace(("gdth_open() ")); - return 0; -} - -static int gdth_close(struct inode *inode, struct file *filep) -{ - trace(("gdth_close() ")); - return 0; -} - -static int ioc_event(void __user *arg) -{ - gdth_ioctl_event evt; - gdth_ha_str *ha; - unsigned long flags; - - if (copy_from_user(&evt, arg, sizeof(gdth_ioctl_event))) - return -efault; - ha = gdth_find_ha(evt.ionode); - if (!ha) - return -efault; - - if (evt.erase == 0xff) { - if (evt.event.event_source == es_test) - evt.event.event_data.size=sizeof(evt.event.event_data.eu.test); - else if (evt.event.event_source == es_driver) - evt.event.event_data.size=sizeof(evt.event.event_data.eu.driver); - else if (evt.event.event_source == es_sync) - evt.event.event_data.size=sizeof(evt.event.event_data.eu.sync); - else - evt.event.event_data.size=sizeof(evt.event.event_data.eu.async); - spin_lock_irqsave(&ha->smp_lock, flags); - gdth_store_event(ha, evt.event.event_source, evt.event.event_idx, - &evt.event.event_data); - spin_unlock_irqrestore(&ha->smp_lock, flags); - } else if (evt.erase == 0xfe) { - gdth_clear_events(); - } else if (evt.erase == 0) { - evt.handle = gdth_read_event(ha, evt.handle, &evt.event); - } else { - gdth_readapp_event(ha, evt.erase, &evt.event); - } - if (copy_to_user(arg, &evt, sizeof(gdth_ioctl_event))) - return -efault; - return 0; -} - -static int ioc_lockdrv(void __user *arg) -{ - gdth_ioctl_lockdrv ldrv; - u8 i, j; - unsigned long flags; - gdth_ha_str *ha; - - if (copy_from_user(&ldrv, arg, sizeof(gdth_ioctl_lockdrv))) - return -efault; - ha = gdth_find_ha(ldrv.ionode); - if (!ha) - return -efault; - - for (i = 0; i < ldrv.drive_cnt && i < max_hdrives; ++i) { - j = ldrv.drives[i]; - if (j >= max_hdrives || !ha->hdr[j].present) - continue; - if (ldrv.lock) { - spin_lock_irqsave(&ha->smp_lock, flags); - ha->hdr[j].lock = 1; - spin_unlock_irqrestore(&ha->smp_lock, flags); - gdth_wait_completion(ha, ha->bus_cnt, j); - } else { - spin_lock_irqsave(&ha->smp_lock, flags); - ha->hdr[j].lock = 0; - spin_unlock_irqrestore(&ha->smp_lock, flags); - gdth_next(ha); - } - } - return 0; -} - -static int ioc_resetdrv(void __user *arg, char *cmnd) -{ - gdth_ioctl_reset res; - gdth_cmd_str cmd; - gdth_ha_str *ha; - int rval; - - if (copy_from_user(&res, arg, sizeof(gdth_ioctl_reset)) || - res.number >= max_hdrives) - return -efault; - ha = gdth_find_ha(res.ionode); - if (!ha) - return -efault; - - if (!ha->hdr[res.number].present) - return 0; - memset(&cmd, 0, sizeof(gdth_cmd_str)); - cmd.service = cacheservice; - cmd.opcode = gdt_clust_reset; - if (ha->cache_feat & gdt_64bit) - cmd.u.cache64.deviceno = res.number; - else - cmd.u.cache.deviceno = res.number; - - rval = __gdth_execute(ha->sdev, &cmd, cmnd, 30, null); - if (rval < 0) - return rval; - res.status = rval; - - if (copy_to_user(arg, &res, sizeof(gdth_ioctl_reset))) - return -efault; - return 0; -} - -static void gdth_ioc_cacheservice(gdth_ha_str *ha, gdth_ioctl_general *gen, - u64 paddr) -{ - if (ha->cache_feat & gdt_64bit) { - /* copy elements from 32-bit ioctl structure */ - gen->command.u.cache64.blockcnt = gen->command.u.cache.blockcnt; - gen->command.u.cache64.blockno = gen->command.u.cache.blockno; - gen->command.u.cache64.deviceno = gen->command.u.cache.deviceno; - - if (ha->cache_feat & scatter_gather) { - gen->command.u.cache64.destaddr = (u64)-1; - gen->command.u.cache64.sg_canz = 1; - gen->command.u.cache64.sg_lst[0].sg_ptr = paddr; - gen->command.u.cache64.sg_lst[0].sg_len = gen->data_len; - gen->command.u.cache64.sg_lst[1].sg_len = 0; - } else { - gen->command.u.cache64.destaddr = paddr; - gen->command.u.cache64.sg_canz = 0; - } - } else { - if (ha->cache_feat & scatter_gather) { - gen->command.u.cache.destaddr = 0xffffffff; - gen->command.u.cache.sg_canz = 1; - gen->command.u.cache.sg_lst[0].sg_ptr = (u32)paddr; - gen->command.u.cache.sg_lst[0].sg_len = gen->data_len; - gen->command.u.cache.sg_lst[1].sg_len = 0; - } else { - gen->command.u.cache.destaddr = paddr; - gen->command.u.cache.sg_canz = 0; - } - } -} - -static void gdth_ioc_scsiraw(gdth_ha_str *ha, gdth_ioctl_general *gen, - u64 paddr) -{ - if (ha->raw_feat & gdt_64bit) { - /* copy elements from 32-bit ioctl structure */ - char cmd[16]; - - gen->command.u.raw64.sense_len = gen->command.u.raw.sense_len; - gen->command.u.raw64.bus = gen->command.u.raw.bus; - gen->command.u.raw64.lun = gen->command.u.raw.lun; - gen->command.u.raw64.target = gen->command.u.raw.target; - memcpy(cmd, gen->command.u.raw.cmd, 16); - memcpy(gen->command.u.raw64.cmd, cmd, 16); - gen->command.u.raw64.clen = gen->command.u.raw.clen; - gen->command.u.raw64.sdlen = gen->command.u.raw.sdlen; - gen->command.u.raw64.direction = gen->command.u.raw.direction; - - /* addresses */ - if (ha->raw_feat & scatter_gather) { - gen->command.u.raw64.sdata = (u64)-1; - gen->command.u.raw64.sg_ranz = 1; - gen->command.u.raw64.sg_lst[0].sg_ptr = paddr; - gen->command.u.raw64.sg_lst[0].sg_len = gen->data_len; - gen->command.u.raw64.sg_lst[1].sg_len = 0; - } else { - gen->command.u.raw64.sdata = paddr; - gen->command.u.raw64.sg_ranz = 0; - } - - gen->command.u.raw64.sense_data = paddr + gen->data_len; - } else { - if (ha->raw_feat & scatter_gather) { - gen->command.u.raw.sdata = 0xffffffff; - gen->command.u.raw.sg_ranz = 1; - gen->command.u.raw.sg_lst[0].sg_ptr = (u32)paddr; - gen->command.u.raw.sg_lst[0].sg_len = gen->data_len; - gen->command.u.raw.sg_lst[1].sg_len = 0; - } else { - gen->command.u.raw.sdata = paddr; - gen->command.u.raw.sg_ranz = 0; - } - - gen->command.u.raw.sense_data = (u32)paddr + gen->data_len; - } -} - -static int ioc_general(void __user *arg, char *cmnd) -{ - gdth_ioctl_general gen; - gdth_ha_str *ha; - char *buf = null; - dma_addr_t paddr; - int rval; - - if (copy_from_user(&gen, arg, sizeof(gdth_ioctl_general))) - return -efault; - ha = gdth_find_ha(gen.ionode); - if (!ha) - return -efault; - - if (gen.data_len > int_max) - return -einval; - if (gen.sense_len > int_max) - return -einval; - if (gen.data_len + gen.sense_len > int_max) - return -einval; - - if (gen.data_len + gen.sense_len > 0) { - buf = dma_alloc_coherent(&ha->pdev->dev, - gen.data_len + gen.sense_len, &paddr, - gfp_kernel); - if (!buf) - return -efault; - - rval = -efault; - if (copy_from_user(buf, arg + sizeof(gdth_ioctl_general), - gen.data_len + gen.sense_len)) - goto out_free_buf; - - if (gen.command.opcode == gdt_ioctl) - gen.command.u.ioctl.p_param = paddr; - else if (gen.command.service == cacheservice) - gdth_ioc_cacheservice(ha, &gen, paddr); - else if (gen.command.service == scsirawservice) - gdth_ioc_scsiraw(ha, &gen, paddr); - else - goto out_free_buf; - } - - rval = __gdth_execute(ha->sdev, &gen.command, cmnd, gen.timeout, - &gen.info); - if (rval < 0) - goto out_free_buf; - gen.status = rval; - - rval = -efault; - if (copy_to_user(arg + sizeof(gdth_ioctl_general), buf, - gen.data_len + gen.sense_len)) - goto out_free_buf; - if (copy_to_user(arg, &gen, - sizeof(gdth_ioctl_general) - sizeof(gdth_cmd_str))) - goto out_free_buf; - - rval = 0; -out_free_buf: - if (buf) - dma_free_coherent(&ha->pdev->dev, gen.data_len + gen.sense_len, - buf, paddr); - return rval; -} - -static int ioc_hdrlist(void __user *arg, char *cmnd) -{ - gdth_ioctl_rescan *rsc; - gdth_cmd_str *cmd; - gdth_ha_str *ha; - u8 i; - int rc = -enomem; - u32 cluster_type = 0; - - rsc = kmalloc(sizeof(*rsc), gfp_kernel); - cmd = kmalloc(sizeof(*cmd), gfp_kernel); - if (!rsc || !cmd) - goto free_fail; - - if (copy_from_user(rsc, arg, sizeof(gdth_ioctl_rescan)) || - (null == (ha = gdth_find_ha(rsc->ionode)))) { - rc = -efault; - goto free_fail; - } - memset(cmd, 0, sizeof(gdth_cmd_str)); - - for (i = 0; i < max_hdrives; ++i) { - if (!ha->hdr[i].present) { - rsc->hdr_list[i].bus = 0xff; - continue; - } - rsc->hdr_list[i].bus = ha->virt_bus; - rsc->hdr_list[i].target = i; - rsc->hdr_list[i].lun = 0; - rsc->hdr_list[i].cluster_type = ha->hdr[i].cluster_type; - if (ha->hdr[i].cluster_type & cluster_drive) { - cmd->service = cacheservice; - cmd->opcode = gdt_clust_info; - if (ha->cache_feat & gdt_64bit) - cmd->u.cache64.deviceno = i; - else - cmd->u.cache.deviceno = i; - if (__gdth_execute(ha->sdev, cmd, cmnd, 30, &cluster_type) == s_ok) - rsc->hdr_list[i].cluster_type = cluster_type; - } - } - - if (copy_to_user(arg, rsc, sizeof(gdth_ioctl_rescan))) - rc = -efault; - else - rc = 0; - -free_fail: - kfree(rsc); - kfree(cmd); - return rc; -} - -static int ioc_rescan(void __user *arg, char *cmnd) -{ - gdth_ioctl_rescan *rsc; - gdth_cmd_str *cmd; - u16 i, status, hdr_cnt; - u32 info; - int cyls, hds, secs; - int rc = -enomem; - unsigned long flags; - gdth_ha_str *ha; - - rsc = kmalloc(sizeof(*rsc), gfp_kernel); - cmd = kmalloc(sizeof(*cmd), gfp_kernel); - if (!cmd || !rsc) - goto free_fail; - - if (copy_from_user(rsc, arg, sizeof(gdth_ioctl_rescan)) || - (null == (ha = gdth_find_ha(rsc->ionode)))) { - rc = -efault; - goto free_fail; - } - memset(cmd, 0, sizeof(gdth_cmd_str)); - - if (rsc->flag == 0) { - /* old method: re-init. cache service */ - cmd->service = cacheservice; - if (ha->cache_feat & gdt_64bit) { - cmd->opcode = gdt_x_init_host; - cmd->u.cache64.deviceno = linux_os; - } else { - cmd->opcode = gdt_init; - cmd->u.cache.deviceno = linux_os; - } - - status = __gdth_execute(ha->sdev, cmd, cmnd, 30, &info); - i = 0; - hdr_cnt = (status == s_ok ? (u16)info : 0); - } else { - i = rsc->hdr_no; - hdr_cnt = i + 1; - } - - for (; i < hdr_cnt && i < max_hdrives; ++i) { - cmd->service = cacheservice; - cmd->opcode = gdt_info; - if (ha->cache_feat & gdt_64bit) - cmd->u.cache64.deviceno = i; - else - cmd->u.cache.deviceno = i; - - status = __gdth_execute(ha->sdev, cmd, cmnd, 30, &info); - - spin_lock_irqsave(&ha->smp_lock, flags); - rsc->hdr_list[i].bus = ha->virt_bus; - rsc->hdr_list[i].target = i; - rsc->hdr_list[i].lun = 0; - if (status != s_ok) { - ha->hdr[i].present = false; - } else { - ha->hdr[i].present = true; - ha->hdr[i].size = info; - /* evaluate mapping */ - ha->hdr[i].size &= ~secs32; - gdth_eval_mapping(ha->hdr[i].size,&cyls,&hds,&secs); - ha->hdr[i].heads = hds; - ha->hdr[i].secs = secs; - /* round size */ - ha->hdr[i].size = cyls * hds * secs; - } - spin_unlock_irqrestore(&ha->smp_lock, flags); - if (status != s_ok) - continue; - - /* extended info, if gdt_64bit, for drives > 2 tb */ - /* but we need ha->info2, not yet stored in scp->scp */ - - /* devtype, cluster info, r/w attribs */ - cmd->service = cacheservice; - cmd->opcode = gdt_devtype; - if (ha->cache_feat & gdt_64bit) - cmd->u.cache64.deviceno = i; - else - cmd->u.cache.deviceno = i; - - status = __gdth_execute(ha->sdev, cmd, cmnd, 30, &info); - - spin_lock_irqsave(&ha->smp_lock, flags); - ha->hdr[i].devtype = (status == s_ok ? (u16)info : 0); - spin_unlock_irqrestore(&ha->smp_lock, flags); - - cmd->service = cacheservice; - cmd->opcode = gdt_clust_info; - if (ha->cache_feat & gdt_64bit) - cmd->u.cache64.deviceno = i; - else - cmd->u.cache.deviceno = i; - - status = __gdth_execute(ha->sdev, cmd, cmnd, 30, &info); - - spin_lock_irqsave(&ha->smp_lock, flags); - ha->hdr[i].cluster_type = - ((status == s_ok && !shared_access) ? (u16)info : 0); - spin_unlock_irqrestore(&ha->smp_lock, flags); - rsc->hdr_list[i].cluster_type = ha->hdr[i].cluster_type; - - cmd->service = cacheservice; - cmd->opcode = gdt_rw_attribs; - if (ha->cache_feat & gdt_64bit) - cmd->u.cache64.deviceno = i; - else - cmd->u.cache.deviceno = i; - - status = __gdth_execute(ha->sdev, cmd, cmnd, 30, &info); - - spin_lock_irqsave(&ha->smp_lock, flags); - ha->hdr[i].rw_attribs = (status == s_ok ? (u16)info : 0); - spin_unlock_irqrestore(&ha->smp_lock, flags); - } - - if (copy_to_user(arg, rsc, sizeof(gdth_ioctl_rescan))) - rc = -efault; - else - rc = 0; - -free_fail: - kfree(rsc); - kfree(cmd); - return rc; -} - -static int gdth_ioctl(struct file *filep, unsigned int cmd, unsigned long arg) -{ - gdth_ha_str *ha; - struct scsi_cmnd *scp; - unsigned long flags; - char cmnd[max_command_size]; - void __user *argp = (void __user *)arg; - - memset(cmnd, 0xff, 12); - - trace(("gdth_ioctl() cmd 0x%x ", cmd)); - - switch (cmd) { - case gdtioctl_ctrcnt: - { - int cnt = gdth_ctr_count; - if (put_user(cnt, (int __user *)argp)) - return -efault; - break; - } - - case gdtioctl_drvers: - { - int ver = (gdth_version<<8) | gdth_subversion; - if (put_user(ver, (int __user *)argp)) - return -efault; - break; - } - - case gdtioctl_osvers: - { - gdth_ioctl_osvers osv; - - osv.version = (u8)(linux_version_code >> 16); - osv.subversion = (u8)(linux_version_code >> 8); - osv.revision = (u16)(linux_version_code & 0xff); - if (copy_to_user(argp, &osv, sizeof(gdth_ioctl_osvers))) - return -efault; - break; - } - - case gdtioctl_ctrtype: - { - gdth_ioctl_ctrtype ctrt; - - if (copy_from_user(&ctrt, argp, sizeof(gdth_ioctl_ctrtype)) || - (null == (ha = gdth_find_ha(ctrt.ionode)))) - return -efault; - - if (ha->type != gdt_pcimpr) { - ctrt.type = (u8)((ha->stype<<4) + 6); - } else { - ctrt.type = (ha->oem_id == oem_id_intel ? 0xfd : 0xfe); - if (ha->stype >= 0x300) - ctrt.ext_type = 0x6000 | ha->pdev->subsystem_device; - else - ctrt.ext_type = 0x6000 | ha->stype; - } - ctrt.device_id = ha->pdev->device; - ctrt.sub_device_id = ha->pdev->subsystem_device; - ctrt.info = ha->brd_phys; - ctrt.oem_id = ha->oem_id; - if (copy_to_user(argp, &ctrt, sizeof(gdth_ioctl_ctrtype))) - return -efault; - break; - } - - case gdtioctl_general: - return ioc_general(argp, cmnd); - - case gdtioctl_event: - return ioc_event(argp); - - case gdtioctl_lockdrv: - return ioc_lockdrv(argp); - - case gdtioctl_lockchn: - { - gdth_ioctl_lockchn lchn; - u8 i, j; - - if (copy_from_user(&lchn, argp, sizeof(gdth_ioctl_lockchn)) || - (null == (ha = gdth_find_ha(lchn.ionode)))) - return -efault; - - i = lchn.channel; - if (i < ha->bus_cnt) { - if (lchn.lock) { - spin_lock_irqsave(&ha->smp_lock, flags); - ha->raw[i].lock = 1; - spin_unlock_irqrestore(&ha->smp_lock, flags); - for (j = 0; j < ha->tid_cnt; ++j) - gdth_wait_completion(ha, i, j); - } else { - spin_lock_irqsave(&ha->smp_lock, flags); - ha->raw[i].lock = 0; - spin_unlock_irqrestore(&ha->smp_lock, flags); - for (j = 0; j < ha->tid_cnt; ++j) - gdth_next(ha); - } - } - break; - } - - case gdtioctl_rescan: - return ioc_rescan(argp, cmnd); - - case gdtioctl_hdrlist: - return ioc_hdrlist(argp, cmnd); - - case gdtioctl_reset_bus: - { - gdth_ioctl_reset res; - int rval; - - if (copy_from_user(&res, argp, sizeof(gdth_ioctl_reset)) || - (null == (ha = gdth_find_ha(res.ionode)))) - return -efault; - - scp = kzalloc(sizeof(*scp), gfp_kernel); - if (!scp) - return -enomem; - scp->device = ha->sdev; - scp->cmd_len = 12; - scp->device->channel = res.number; - rval = gdth_eh_bus_reset(scp); - res.status = (rval == success ? s_ok : s_generr); - kfree(scp); - - if (copy_to_user(argp, &res, sizeof(gdth_ioctl_reset))) - return -efault; - break; - } - - case gdtioctl_reset_drv: - return ioc_resetdrv(argp, cmnd); - - default: - break; - } - return 0; -} - -static long gdth_unlocked_ioctl(struct file *file, unsigned int cmd, - unsigned long arg) -{ - int ret; - - mutex_lock(&gdth_mutex); - ret = gdth_ioctl(file, cmd, arg); - mutex_unlock(&gdth_mutex); - - return ret; -} - -/* flush routine */ -static void gdth_flush(gdth_ha_str *ha) -{ - int i; - gdth_cmd_str gdtcmd; - char cmnd[max_command_size]; - memset(cmnd, 0xff, max_command_size); - - trace2(("gdth_flush() hanum %d ", ha->hanum)); - - for (i = 0; i < max_hdrives; ++i) { - if (ha->hdr[i].present) { - gdtcmd.boardnode = localboard; - gdtcmd.service = cacheservice; - gdtcmd.opcode = gdt_flush; - if (ha->cache_feat & gdt_64bit) { - gdtcmd.u.cache64.deviceno = i; - gdtcmd.u.cache64.blockno = 1; - gdtcmd.u.cache64.sg_canz = 0; - } else { - gdtcmd.u.cache.deviceno = i; - gdtcmd.u.cache.blockno = 1; - gdtcmd.u.cache.sg_canz = 0; - } - trace2(("gdth_flush(): flush ha %d drive %d ", ha->hanum, i)); - - gdth_execute(ha->shost, &gdtcmd, cmnd, 30, null); - } - } -} - -/* configure lun */ -static int gdth_slave_configure(struct scsi_device *sdev) -{ - sdev->skip_ms_page_3f = 1; - sdev->skip_ms_page_8 = 1; - return 0; -} - -static struct scsi_host_template gdth_template = { - .name = "gdt scsi disk array controller", - .info = gdth_info, - .queuecommand = gdth_queuecommand, - .eh_bus_reset_handler = gdth_eh_bus_reset, - .slave_configure = gdth_slave_configure, - .bios_param = gdth_bios_param, - .show_info = gdth_show_info, - .write_info = gdth_set_info, - .eh_timed_out = gdth_timed_out, - .proc_name = "gdth", - .can_queue = gdth_maxcmds, - .this_id = -1, - .sg_tablesize = gdth_maxsg, - .cmd_per_lun = gdth_maxc_p_l, - .unchecked_isa_dma = 1, - .no_write_same = 1, -}; - -static int gdth_pci_probe_one(gdth_pci_str *pcistr, gdth_ha_str **ha_out) -{ - struct scsi_host *shp; - gdth_ha_str *ha; - dma_addr_t scratch_dma_handle = 0; - int error, i; - struct pci_dev *pdev = pcistr->pdev; - - *ha_out = null; - - shp = scsi_host_alloc(&gdth_template, sizeof(gdth_ha_str)); - if (!shp) - return -enomem; - ha = shost_priv(shp); - - error = -enodev; - if (!gdth_init_pci(pdev, pcistr, ha)) - goto out_host_put; - - /* controller found and initialized */ - printk("configuring gdt-pci ha at %d/%d irq %u ", - pdev->bus->number, - pci_slot(pdev->devfn), - ha->irq); - - error = request_irq(ha->irq, gdth_interrupt, - irqf_shared, "gdth", ha); - if (error) { - printk("gdt-pci: unable to allocate irq "); - goto out_host_put; - } - - shp->unchecked_isa_dma = 0; - shp->irq = ha->irq; - shp->dma_channel = 0xff; - - ha->hanum = gdth_ctr_count++; - ha->shost = shp; - - ha->pccb = &ha->cmdext; - ha->ccb_phys = 0l; - - error = -enomem; - - ha->pscratch = dma_alloc_coherent(&ha->pdev->dev, gdth_scratch, - &scratch_dma_handle, gfp_kernel); - if (!ha->pscratch) - goto out_free_irq; - ha->scratch_phys = scratch_dma_handle; - - ha->pmsg = dma_alloc_coherent(&ha->pdev->dev, sizeof(gdth_msg_str), - &scratch_dma_handle, gfp_kernel); - if (!ha->pmsg) - goto out_free_pscratch; - ha->msg_phys = scratch_dma_handle; - - ha->scratch_busy = false; - ha->req_first = null; - ha->tid_cnt = pdev->device >= 0x200 ? maxid : max_hdrives; - if (max_ids > 0 && max_ids < ha->tid_cnt) - ha->tid_cnt = max_ids; - for (i = 0; i < gdth_maxcmds; ++i) - ha->cmd_tab[i].cmnd = unused_cmnd; - ha->scan_mode = rescan ? 0x10 : 0; - - error = -enodev; - if (!gdth_search_drives(ha)) { - printk("gdt-pci %d: error during device scan ", ha->hanum); - goto out_free_pmsg; - } - - if (hdr_channel < 0 || hdr_channel > ha->bus_cnt) - hdr_channel = ha->bus_cnt; - ha->virt_bus = hdr_channel; - - /* 64-bit dma only supported from fw >= x.43 */ - if (!(ha->cache_feat & ha->raw_feat & ha->screen_feat & gdt_64bit) || - !ha->dma64_support) { - if (dma_set_mask(&pdev->dev, dma_bit_mask(32))) { - printk(kern_warning "gdt-pci %d: " - "unable to set 32-bit dma ", ha->hanum); - goto out_free_pmsg; - } - } else { - shp->max_cmd_len = 16; - if (!dma_set_mask(&pdev->dev, dma_bit_mask(64))) { - printk("gdt-pci %d: 64-bit dma enabled ", ha->hanum); - } else if (dma_set_mask(&pdev->dev, dma_bit_mask(32))) { - printk(kern_warning "gdt-pci %d: " - "unable to set 64/32-bit dma ", ha->hanum); - goto out_free_pmsg; - } - } - - shp->max_id = ha->tid_cnt; - shp->max_lun = maxlun; - shp->max_channel = ha->bus_cnt; - - spin_lock_init(&ha->smp_lock); - gdth_enable_int(ha); - - error = scsi_add_host(shp, &pdev->dev); - if (error) - goto out_free_pmsg; - list_add_tail(&ha->list, &gdth_instances); - - pci_set_drvdata(ha->pdev, ha); - gdth_timer_init(); - - scsi_scan_host(shp); - - *ha_out = ha; - - return 0; - - out_free_pmsg: - dma_free_coherent(&ha->pdev->dev, sizeof(gdth_msg_str), - ha->pmsg, ha->msg_phys); - out_free_pscratch: - dma_free_coherent(&ha->pdev->dev, gdth_scratch, - ha->pscratch, ha->scratch_phys); - out_free_irq: - free_irq(ha->irq, ha); - gdth_ctr_count--; - out_host_put: - scsi_host_put(shp); - return error; -} - -static void gdth_remove_one(gdth_ha_str *ha) -{ - struct scsi_host *shp = ha->shost; - - trace2(("gdth_remove_one() ")); - - scsi_remove_host(shp); - - gdth_flush(ha); - - if (ha->sdev) { - scsi_free_host_dev(ha->sdev); - ha->sdev = null; - } - - if (shp->irq) - free_irq(shp->irq,ha); - - if (ha->pscratch) - dma_free_coherent(&ha->pdev->dev, gdth_scratch, - ha->pscratch, ha->scratch_phys); - if (ha->pmsg) - dma_free_coherent(&ha->pdev->dev, sizeof(gdth_msg_str), - ha->pmsg, ha->msg_phys); - if (ha->ccb_phys) - dma_unmap_single(&ha->pdev->dev, ha->ccb_phys, - sizeof(gdth_cmd_str), dma_bidirectional); - - scsi_host_put(shp); -} - -static int gdth_halt(struct notifier_block *nb, unsigned long event, void *buf) -{ - gdth_ha_str *ha; - - trace2(("gdth_halt() event %d ", (int)event)); - if (event != sys_restart && event != sys_halt && event != sys_power_off) - return notify_done; - - list_for_each_entry(ha, &gdth_instances, list) - gdth_flush(ha); - - return notify_ok; -} - -static struct notifier_block gdth_notifier = { - gdth_halt, null, 0 -}; - -static int __init gdth_init(void) -{ - if (disable) { - printk("gdt-ha: controller driver disabled from" - " command line ! "); - return 0; - } - - printk("gdt-ha: storage raid controller driver. version: %s ", - gdth_version_str); - - /* initializations */ - gdth_polling = true; - gdth_clear_events(); - timer_setup(&gdth_timer, gdth_timeout, 0); - - /* scanning for pci controllers */ - if (pci_register_driver(&gdth_pci_driver)) { - gdth_ha_str *ha; - - list_for_each_entry(ha, &gdth_instances, list) - gdth_remove_one(ha); - return -enodev; - } - - trace2(("gdth_detect() %d controller detected ", gdth_ctr_count)); - - major = register_chrdev(0,"gdth", &gdth_fops); - register_reboot_notifier(&gdth_notifier); - gdth_polling = false; - return 0; -} - -static void __exit gdth_exit(void) -{ - gdth_ha_str *ha; - - unregister_chrdev(major, "gdth"); - unregister_reboot_notifier(&gdth_notifier); - -#ifdef gdth_statistics - del_timer_sync(&gdth_timer); -#endif - - pci_unregister_driver(&gdth_pci_driver); - - list_for_each_entry(ha, &gdth_instances, list) - gdth_remove_one(ha); -} - -module_init(gdth_init); -module_exit(gdth_exit); - -#ifndef module -static void __init internal_setup(char *str,int *ints) -{ - int i; - char *cur_str, *argv; - - trace2(("internal_setup() str %s ints[0] %d ", - str ? str:"null", ints ? ints[0]:0)); - - /* analyse string */ - argv = str; - while (argv && (cur_str = strchr(argv, ':'))) { - int val = 0, c = *++cur_str; - - if (c == 'n' || c == 'n') - val = 0; - else if (c == 'y' || c == 'y') - val = 1; - else - val = (int)simple_strtoul(cur_str, null, 0); - - if (!strncmp(argv, "disable:", 8)) - disable = val; - else if (!strncmp(argv, "reserve_mode:", 13)) - reserve_mode = val; - else if (!strncmp(argv, "reverse_scan:", 13)) - reverse_scan = val; - else if (!strncmp(argv, "hdr_channel:", 12)) - hdr_channel = val; - else if (!strncmp(argv, "max_ids:", 8)) - max_ids = val; - else if (!strncmp(argv, "rescan:", 7)) - rescan = val; - else if (!strncmp(argv, "shared_access:", 14)) - shared_access = val; - else if (!strncmp(argv, "reserve_list:", 13)) { - reserve_list[0] = val; - for (i = 1; i < max_res_args; i++) { - cur_str = strchr(cur_str, ','); - if (!cur_str) - break; - if (!isdigit((int)*++cur_str)) { - --cur_str; - break; - } - reserve_list[i] = - (int)simple_strtoul(cur_str, null, 0); - } - if (!cur_str) - break; - argv = ++cur_str; - continue; - } - - if ((argv = strchr(argv, ','))) - ++argv; - } -} - -static int __init option_setup(char *str) -{ - int ints[maxha]; - char *cur = str; - int i = 1; - - trace2(("option_setup() str %s ", str ? str:"null")); - - while (cur && isdigit(*cur) && i < maxha) { - ints[i++] = simple_strtoul(cur, null, 0); - if ((cur = strchr(cur, ',')) != null) cur++; - } - - ints[0] = i - 1; - internal_setup(cur, ints); - return 1; -} - -__setup("gdth=", option_setup); -#endif diff --git a/drivers/scsi/gdth.h b/drivers/scsi/gdth.h --- a/drivers/scsi/gdth.h +++ /dev/null -/* spdx-license-identifier: gpl-2.0 */ -#ifndef _gdth_h -#define _gdth_h - -/* - * header file for the gdt disk array/storage raid controllers driver for linux - * - * gdth.h copyright (c) 1995-06 icp vortex, achim leubner - * see gdth.c for further informations and - * below for supported controller types - * - * <achim_leubner@adaptec.com> - * - * $id: gdth.h,v 1.58 2006/01/11 16:14:09 achim exp $ - */ - -#include <linux/types.h> - -#ifndef true -#define true 1 -#endif -#ifndef false -#define false 0 -#endif - -/* defines, macros */ - -/* driver version */ -#define gdth_version_str "3.05" -#define gdth_version 3 -#define gdth_subversion 5 - -/* protocol version */ -#define protocol_version 1 - -/* oem ids */ -#define oem_id_icp 0x941c -#define oem_id_intel 0x8000 - -/* controller classes */ -#define gdt_pci 0x03 /* pci controller */ -#define gdt_pcinew 0x04 /* new pci controller */ -#define gdt_pcimpr 0x05 /* pci mpr controller */ - -#ifndef pci_device_id_vortex_gdt60x0 -/* gdt_pci */ -#define pci_device_id_vortex_gdt60x0 0 /* gdt6000/6020/6050 */ -#define pci_device_id_vortex_gdt6000b 1 /* gdt6000b/6010 */ -/* gdt_pcinew */ -#define pci_device_id_vortex_gdt6x10 2 /* gdt6110/6510 */ -#define pci_device_id_vortex_gdt6x20 3 /* gdt6120/6520 */ -#define pci_device_id_vortex_gdt6530 4 /* gdt6530 */ -#define pci_device_id_vortex_gdt6550 5 /* gdt6550 */ -/* gdt_pcinew, wide/ultra scsi controllers */ -#define pci_device_id_vortex_gdt6x17 6 /* gdt6117/6517 */ -#define pci_device_id_vortex_gdt6x27 7 /* gdt6127/6527 */ -#define pci_device_id_vortex_gdt6537 8 /* gdt6537 */ -#define pci_device_id_vortex_gdt6557 9 /* gdt6557/6557-ecc */ -/* gdt_pcinew, wide scsi controllers */ -#define pci_device_id_vortex_gdt6x15 10 /* gdt6115/6515 */ -#define pci_device_id_vortex_gdt6x25 11 /* gdt6125/6525 */ -#define pci_device_id_vortex_gdt6535 12 /* gdt6535 */ -#define pci_device_id_vortex_gdt6555 13 /* gdt6555/6555-ecc */ -#endif - -#ifndef pci_device_id_vortex_gdt6x17rp -/* gdt_mpr, rp series, wide/ultra scsi */ -#define pci_device_id_vortex_gdt6x17rp 0x100 /* gdt6117rp/gdt6517rp */ -#define pci_device_id_vortex_gdt6x27rp 0x101 /* gdt6127rp/gdt6527rp */ -#define pci_device_id_vortex_gdt6537rp 0x102 /* gdt6537rp */ -#define pci_device_id_vortex_gdt6557rp 0x103 /* gdt6557rp */ -/* gdt_mpr, rp series, narrow/ultra scsi */ -#define pci_device_id_vortex_gdt6x11rp 0x104 /* gdt6111rp/gdt6511rp */ -#define pci_device_id_vortex_gdt6x21rp 0x105 /* gdt6121rp/gdt6521rp */ -#endif -#ifndef pci_device_id_vortex_gdt6x17rd -/* gdt_mpr, rd series, wide/ultra scsi */ -#define pci_device_id_vortex_gdt6x17rd 0x110 /* gdt6117rd/gdt6517rd */ -#define pci_device_id_vortex_gdt6x27rd 0x111 /* gdt6127rd/gdt6527rd */ -#define pci_device_id_vortex_gdt6537rd 0x112 /* gdt6537rd */ -#define pci_device_id_vortex_gdt6557rd 0x113 /* gdt6557rd */ -/* gdt_mpr, rd series, narrow/ultra scsi */ -#define pci_device_id_vortex_gdt6x11rd 0x114 /* gdt6111rd/gdt6511rd */ -#define pci_device_id_vortex_gdt6x21rd 0x115 /* gdt6121rd/gdt6521rd */ -/* gdt_mpr, rd series, wide/ultra2 scsi */ -#define pci_device_id_vortex_gdt6x18rd 0x118 /* gdt6118rd/gdt6518rd/ - gdt6618rd */ -#define pci_device_id_vortex_gdt6x28rd 0x119 /* gdt6128rd/gdt6528rd/ - gdt6628rd */ -#define pci_device_id_vortex_gdt6x38rd 0x11a /* gdt6538rd/gdt6638rd */ -#define pci_device_id_vortex_gdt6x58rd 0x11b /* gdt6558rd/gdt6658rd */ -/* gdt_mpr, rn series (64-bit pci), wide/ultra2 scsi */ -#define pci_device_id_vortex_gdt7x18rn 0x168 /* gdt7118rn/gdt7518rn/ - gdt7618rn */ -#define pci_device_id_vortex_gdt7x28rn 0x169 /* gdt7128rn/gdt7528rn/ - gdt7628rn */ -#define pci_device_id_vortex_gdt7x38rn 0x16a /* gdt7538rn/gdt7638rn */ -#define pci_device_id_vortex_gdt7x58rn 0x16b /* gdt7558rn/gdt7658rn */ -#endif - -#ifndef pci_device_id_vortex_gdt6x19rd -/* gdt_mpr, rd series, fibre channel */ -#define pci_device_id_vortex_gdt6x19rd 0x210 /* gdt6519rd/gdt6619rd */ -#define pci_device_id_vortex_gdt6x29rd 0x211 /* gdt6529rd/gdt6629rd */ -/* gdt_mpr, rn series (64-bit pci), fibre channel */ -#define pci_device_id_vortex_gdt7x19rn 0x260 /* gdt7519rn/gdt7619rn */ -#define pci_device_id_vortex_gdt7x29rn 0x261 /* gdt7529rn/gdt7629rn */ -#endif - -#ifndef pci_device_id_vortex_gdtmaxrp -/* gdt_mpr, last device id */ -#define pci_device_id_vortex_gdtmaxrp 0x2ff -#endif - -#ifndef pci_device_id_vortex_gdtnewrx -/* new gdt rx controller */ -#define pci_device_id_vortex_gdtnewrx 0x300 -#endif - -#ifndef pci_device_id_vortex_gdtnewrx2 -/* new(2) gdt rx controller */ -#define pci_device_id_vortex_gdtnewrx2 0x301 -#endif - -#ifndef pci_device_id_intel_src -/* intel storage raid controller */ -#define pci_device_id_intel_src 0x600 -#endif - -#ifndef pci_device_id_intel_src_xscale -/* intel storage raid controller */ -#define pci_device_id_intel_src_xscale 0x601 -#endif - -/* limits */ -#define gdth_scratch page_size /* 4kb scratch buffer */ -#define gdth_maxcmds 120 -#define gdth_maxc_p_l 16 /* max. cmds per lun */ -#define gdth_max_raw 2 /* max. cmds per raw device */ -#define maxoffsets 128 -#define maxha 16 -#define maxid 127 -#define maxlun 8 -#define maxbus 6 -#define max_events 100 /* event buffer count */ -#define max_res_args 40 /* device reservation, - must be a multiple of 4 */ -#define maxcyls 1024 -#define heads 64 -#define secs 32 /* mapping 64*32 */ -#define medheads 127 -#define medsecs 63 /* mapping 127*63 */ -#define bigheads 255 -#define bigsecs 63 /* mapping 255*63 */ - -/* special command ptr. */ -#define unused_cmnd ((struct scsi_cmnd *)-1) -#define internal_cmnd ((struct scsi_cmnd *)-2) -#define screen_cmnd ((struct scsi_cmnd *)-3) -#define special_scp(p) (p==unused_cmnd || p==internal_cmnd || p==screen_cmnd) - -/* controller services */ -#define scsirawservice 3 -#define cacheservice 9 -#define screenservice 11 - -/* screenservice defines */ -#define msg_inv_handle -1 /* special message handle */ -#define msglen 16 /* size of message text */ -#define msg_size 34 /* size of message structure */ -#define msg_request 0 /* async. event: message */ - -/* dpmem constants */ -#define dpmem_magic 0xc0ffee11 -#define ic_header_bytes 48 -#define ic_queue_bytes 4 -#define dpmem_command_offset ic_header_bytes+ic_queue_bytes*maxoffsets - -/* cluster_type constants */ -#define cluster_drive 1 -#define cluster_mounted 2 -#define cluster_reserved 4 -#define cluster_reserve_state (cluster_drive|cluster_mounted|cluster_reserved) - -/* commands for all services, cache service */ -#define gdt_init 0 /* service initialization */ -#define gdt_read 1 /* read command */ -#define gdt_write 2 /* write command */ -#define gdt_info 3 /* information about devices */ -#define gdt_flush 4 /* flush dirty cache buffers */ -#define gdt_ioctl 5 /* ioctl command */ -#define gdt_devtype 9 /* additional information */ -#define gdt_mount 10 /* mount cache device */ -#define gdt_unmount 11 /* unmount cache device */ -#define gdt_set_feat 12 /* set feat. (scatter/gather) */ -#define gdt_get_feat 13 /* get features */ -#define gdt_write_thr 16 /* write through */ -#define gdt_read_thr 17 /* read through */ -#define gdt_ext_info 18 /* extended info */ -#define gdt_reset 19 /* controller reset */ -#define gdt_reserve_drv 20 /* reserve host drive */ -#define gdt_release_drv 21 /* release host drive */ -#define gdt_clust_info 22 /* cluster info */ -#define gdt_rw_attribs 23 /* r/w attribs (write thru,..)*/ -#define gdt_clust_reset 24 /* releases the cluster drives*/ -#define gdt_freeze_io 25 /* freezes all ios */ -#define gdt_unfreeze_io 26 /* unfreezes all ios */ -#define gdt_x_init_host 29 /* ext. init: 64 bit support */ -#define gdt_x_info 30 /* ext. info for drives>2tb */ - -/* raw service commands */ -#define gdt_reserve 14 /* reserve dev. to raw serv. */ -#define gdt_release 15 /* release device */ -#define gdt_reserve_all 16 /* reserve all devices */ -#define gdt_release_all 17 /* release all devices */ -#define gdt_reset_bus 18 /* reset bus */ -#define gdt_scan_start 19 /* start device scan */ -#define gdt_scan_end 20 /* stop device scan */ -#define gdt_x_init_raw 21 /* ext. init: 64 bit support */ - -/* screen service commands */ -#define gdt_realtime 3 /* realtime clock to screens. */ -#define gdt_x_init_scr 4 /* ext. init: 64 bit support */ - -/* ioctl command defines */ -#define scsi_dr_info 0x00 /* scsi drive info */ -#define scsi_chan_cnt 0x05 /* scsi channel count */ -#define scsi_dr_list 0x06 /* scsi drive list */ -#define scsi_def_cnt 0x15 /* grown/primary defects */ -#define dsk_statistics 0x4b /* scsi disk statistics */ -#define iochan_desc 0x5d /* description of io channel */ -#define iochan_raw_desc 0x5e /* description of raw io chn. */ -#define l_ctrl_pattern 0x20000000l /* scsi ioctl mask */ -#define array_info 0x12 /* array drive info */ -#define array_drv_list 0x0f /* array drive list */ -#define array_drv_list2 0x34 /* array drive list (new) */ -#define la_ctrl_pattern 0x10000000l /* array ioctl mask */ -#define cache_drv_cnt 0x01 /* cache drive count */ -#define cache_drv_list 0x02 /* cache drive list */ -#define cache_info 0x04 /* cache info */ -#define cache_config 0x05 /* cache configuration */ -#define cache_drv_info 0x07 /* cache drive info */ -#define board_features 0x15 /* controller features */ -#define board_info 0x28 /* controller info */ -#define set_perf_modes 0x82 /* set mode (coalescing,..) */ -#define get_perf_modes 0x83 /* get mode */ -#define cache_read_oem_string_record 0x84 /* read oem string record */ -#define host_get 0x10001l /* get host drive list */ -#define io_channel 0x00020000l /* default io channel */ -#define invalid_channel 0x0000ffffl /* invalid channel */ - -/* service errors */ -#define s_ok 1 /* no error */ -#define s_generr 6 /* general error */ -#define s_bsy 7 /* controller busy */ -#define s_cache_unknown 12 /* cache serv.: drive unknown */ -#define s_raw_scsi 12 /* raw serv.: target error */ -#define s_raw_ill 0xff /* raw serv.: illegal */ -#define s_nofunc -2 /* unknown function */ -#define s_cache_reserv -24 /* cache: reserv. conflict */ - -/* timeout values */ -#define init_retries 100000 /* 100000 * 1ms = 100s */ -#define init_timeout 100000 /* 100000 * 1ms = 100s */ -#define poll_timeout 10000 /* 10000 * 1ms = 10s */ - -/* priorities */ -#define default_pri 0x20 -#define ioctl_pri 0x10 -#define high_pri 0x08 - -/* data directions */ -#define gdth_data_in 0x01000000l /* data from target */ -#define gdth_data_out 0x00000000l /* data to target */ - -/* other defines */ -#define linux_os 8 /* used for cache optim. */ -#define secs32 0x1f /* round capacity */ -#define bios_id_offs 0x10 /* offset contr-id in isabios */ -#define localboard 0 /* board node always 0 */ -#define asyncindex 0 /* cmd index async. event */ -#define spezindex 1 /* cmd index unknown service */ -#define coalindex (gdth_maxcmds + 2) - -/* features */ -#define scatter_gather 1 /* s/g feature */ -#define gdt_wr_through 0x100 /* write_through supported */ -#define gdt_64bit 0x200 /* 64bit / drv>2tb support */ - -#include "gdth_ioctl.h" - -/* screenservice message */ -typedef struct { - u32 msg_handle; /* message handle */ - u32 msg_len; /* size of message */ - u32 msg_alen; /* answer length */ - u8 msg_answer; /* answer flag */ - u8 msg_ext; /* more messages */ - u8 msg_reserved[2]; - char msg_text[msglen+2]; /* the message text */ -} __attribute__((packed)) gdth_msg_str; - - -/* ioctl data structures */ - -/* status coalescing buffer for returning multiple requests per interrupt */ -typedef struct { - u32 status; - u32 ext_status; - u32 info0; - u32 info1; -} __attribute__((packed)) gdth_coal_status; - -/* performance mode data structure */ -typedef struct { - u32 version; /* the version of this ioctl structure. */ - u32 st_mode; /* 0=dis., 1=st_buf_addr1 valid, 2=both */ - u32 st_buff_addr1; /* physical address of status buffer 1 */ - u32 st_buff_u_addr1; /* reserved for 64 bit addressing */ - u32 st_buff_indx1; /* reserved command idx. for this buffer */ - u32 st_buff_addr2; /* physical address of status buffer 1 */ - u32 st_buff_u_addr2; /* reserved for 64 bit addressing */ - u32 st_buff_indx2; /* reserved command idx. for this buffer */ - u32 st_buff_size; /* size of each buffer in bytes */ - u32 cmd_mode; /* 0 = mode disabled, 1 = cmd_buff_addr1 */ - u32 cmd_buff_addr1; /* physical address of cmd buffer 1 */ - u32 cmd_buff_u_addr1; /* reserved for 64 bit addressing */ - u32 cmd_buff_indx1; /* cmd buf addr1 unique identifier */ - u32 cmd_buff_addr2; /* physical address of cmd buffer 1 */ - u32 cmd_buff_u_addr2; /* reserved for 64 bit addressing */ - u32 cmd_buff_indx2; /* cmd buf addr1 unique identifier */ - u32 cmd_buff_size; /* size of each cmd buffer in bytes */ - u32 reserved1; - u32 reserved2; -} __attribute__((packed)) gdth_perf_modes; - -/* scsi drive info */ -typedef struct { - u8 vendor[8]; /* vendor string */ - u8 product[16]; /* product string */ - u8 revision[4]; /* revision */ - u32 sy_rate; /* current rate for sync. tr. */ - u32 sy_max_rate; /* max. rate for sync. tr. */ - u32 no_ldrive; /* belongs to this log. drv.*/ - u32 blkcnt; /* number of blocks */ - u16 blksize; /* size of block in bytes */ - u8 available; /* flag: access is available */ - u8 init; /* medium is initialized */ - u8 devtype; /* scsi devicetype */ - u8 rm_medium; /* medium is removable */ - u8 wp_medium; /* medium is write protected */ - u8 ansi; /* scsi i/ii or iii? */ - u8 protocol; /* same as ansi */ - u8 sync; /* flag: sync. transfer enab. */ - u8 disc; /* flag: disconnect enabled */ - u8 queueing; /* flag: command queing enab. */ - u8 cached; /* flag: caching enabled */ - u8 target_id; /* target id of device */ - u8 lun; /* lun id of device */ - u8 orphan; /* flag: drive fragment */ - u32 last_error; /* sense key or drive state */ - u32 last_result; /* result of last command */ - u32 check_errors; /* err. in last surface check */ - u8 percent; /* progress for surface check */ - u8 last_check; /* ioctrl operation */ - u8 res[2]; - u32 flags; /* from 1.19/2.19: raw reserv.*/ - u8 multi_bus; /* multi bus dev? (fibre ch.) */ - u8 mb_status; /* status: available? */ - u8 res2[2]; - u8 mb_alt_status; /* status on second bus */ - u8 mb_alt_bid; /* number of second bus */ - u8 mb_alt_tid; /* target id on second bus */ - u8 res3; - u8 fc_flag; /* from 1.22/2.22: info valid?*/ - u8 res4; - u16 fc_frame_size; /* frame size (bytes) */ - char wwn[8]; /* world wide name */ -} __attribute__((packed)) gdth_diskinfo_str; - -/* get scsi channel count */ -typedef struct { - u32 channel_no; /* number of channel */ - u32 drive_cnt; /* drive count */ - u8 siop_id; /* scsi processor id */ - u8 siop_state; /* scsi processor state */ -} __attribute__((packed)) gdth_getch_str; - -/* get scsi drive numbers */ -typedef struct { - u32 sc_no; /* scsi channel */ - u32 sc_cnt; /* sc_list[] elements */ - u32 sc_list[maxid]; /* minor device numbers */ -} __attribute__((packed)) gdth_drlist_str; - -/* get grown/primary defect count */ -typedef struct { - u8 sddc_type; /* 0x08: grown, 0x10: prim. */ - u8 sddc_format; /* list entry format */ - u8 sddc_len; /* list entry length */ - u8 sddc_res; - u32 sddc_cnt; /* entry count */ -} __attribute__((packed)) gdth_defcnt_str; - -/* disk statistics */ -typedef struct { - u32 bid; /* scsi channel */ - u32 first; /* first scsi disk */ - u32 entries; /* number of elements */ - u32 count; /* (r) number of init. el. */ - u32 mon_time; /* time stamp */ - struct { - u8 tid; /* target id */ - u8 lun; /* lun */ - u8 res[2]; - u32 blk_size; /* block size in bytes */ - u32 rd_count; /* bytes read */ - u32 wr_count; /* bytes written */ - u32 rd_blk_count; /* blocks read */ - u32 wr_blk_count; /* blocks written */ - u32 retries; /* retries */ - u32 reassigns; /* reassigns */ - } __attribute__((packed)) list[1]; -} __attribute__((packed)) gdth_dskstat_str; - -/* io channel header */ -typedef struct { - u32 version; /* version (-1ul: newest) */ - u8 list_entries; /* list entry count */ - u8 first_chan; /* first channel number */ - u8 last_chan; /* last channel number */ - u8 chan_count; /* (r) channel count */ - u32 list_offset; /* offset of list[0] */ -} __attribute__((packed)) gdth_iochan_header; - -/* get io channel description */ -typedef struct { - gdth_iochan_header hdr; - struct { - u32 address; /* channel address */ - u8 type; /* type (scsi, fcal) */ - u8 local_no; /* local number */ - u16 features; /* channel features */ - } __attribute__((packed)) list[maxbus]; -} __attribute__((packed)) gdth_iochan_str; - -/* get raw io channel description */ -typedef struct { - gdth_iochan_header hdr; - struct { - u8 proc_id; /* processor id */ - u8 proc_defect; /* defect ? */ - u8 reserved[2]; - } __attribute__((packed)) list[maxbus]; -} __attribute__((packed)) gdth_raw_iochan_str; - -/* array drive component */ -typedef struct { - u32 al_controller; /* controller id */ - u8 al_cache_drive; /* cache drive number */ - u8 al_status; /* cache drive state */ - u8 al_res[2]; -} __attribute__((packed)) gdth_arraycomp_str; - -/* array drive information */ -typedef struct { - u8 ai_type; /* array type (raid0,4,5) */ - u8 ai_cache_drive_cnt; /* active cachedrives */ - u8 ai_state; /* array drive state */ - u8 ai_master_cd; /* master cachedrive */ - u32 ai_master_controller; /* id of master controller */ - u32 ai_size; /* user capacity [sectors] */ - u32 ai_striping_size; /* striping size [sectors] */ - u32 ai_secsize; /* sector size [bytes] */ - u32 ai_err_info; /* failed cache drive */ - u8 ai_name[8]; /* name of the array drive */ - u8 ai_controller_cnt; /* number of controllers */ - u8 ai_removable; /* flag: removable */ - u8 ai_write_protected; /* flag: write protected */ - u8 ai_devtype; /* type: always direct access */ - gdth_arraycomp_str ai_drives[35]; /* drive components: */ - u8 ai_drive_entries; /* number of drive components */ - u8 ai_protected; /* protection flag */ - u8 ai_verify_state; /* state of a parity verify */ - u8 ai_ext_state; /* extended array drive state */ - u8 ai_expand_state; /* array expand state (>=2.18)*/ - u8 ai_reserved[3]; -} __attribute__((packed)) gdth_arrayinf_str; - -/* get array drive list */ -typedef struct { - u32 controller_no; /* controller no. */ - u8 cd_handle; /* master cachedrive */ - u8 is_arrayd; /* flag: is array drive? */ - u8 is_master; /* flag: is array master? */ - u8 is_parity; /* flag: is parity drive? */ - u8 is_hotfix; /* flag: is hotfix drive? */ - u8 res[3]; -} __attribute__((packed)) gdth_alist_str; - -typedef struct { - u32 entries_avail; /* allocated entries */ - u32 entries_init; /* returned entries */ - u32 first_entry; /* first entry number */ - u32 list_offset; /* offset of following list */ - gdth_alist_str list[1]; /* list */ -} __attribute__((packed)) gdth_arcdl_str; - -/* cache info/config ioctl */ -typedef struct { - u32 version; /* firmware version */ - u16 state; /* cache state (on/off) */ - u16 strategy; /* cache strategy */ - u16 write_back; /* write back state (on/off) */ - u16 block_size; /* cache block size */ -} __attribute__((packed)) gdth_cpar_str; - -typedef struct { - u32 csize; /* cache size */ - u32 read_cnt; /* read/write counter */ - u32 write_cnt; - u32 tr_hits; /* hits */ - u32 sec_hits; - u32 sec_miss; /* misses */ -} __attribute__((packed)) gdth_cstat_str; - -typedef struct { - gdth_cpar_str cpar; - gdth_cstat_str cstat; -} __attribute__((packed)) gdth_cinfo_str; - -/* cache drive info */ -typedef struct { - u8 cd_name[8]; /* cache drive name */ - u32 cd_devtype; /* scsi devicetype */ - u32 cd_ldcnt; /* number of log. drives */ - u32 cd_last_error; /* last error */ - u8 cd_initialized; /* drive is initialized */ - u8 cd_removable; /* media is removable */ - u8 cd_write_protected; /* write protected */ - u8 cd_flags; /* pool hot fix? */ - u32 ld_blkcnt; /* number of blocks */ - u32 ld_blksize; /* blocksize */ - u32 ld_dcnt; /* number of disks */ - u32 ld_slave; /* log. drive index */ - u32 ld_dtype; /* type of logical drive */ - u32 ld_last_error; /* last error */ - u8 ld_name[8]; /* log. drive name */ - u8 ld_error; /* error */ -} __attribute__((packed)) gdth_cdrinfo_str; - -/* oem string */ -typedef struct { - u32 ctl_version; - u32 file_major_version; - u32 file_minor_version; - u32 buffer_size; - u32 cpy_count; - u32 ext_error; - u32 oem_id; - u32 board_id; -} __attribute__((packed)) gdth_oem_str_params; - -typedef struct { - u8 product_0_1_name[16]; - u8 product_4_5_name[16]; - u8 product_cluster_name[16]; - u8 product_reserved[16]; - u8 scsi_cluster_target_vendor_id[16]; - u8 cluster_raid_fw_name[16]; - u8 oem_brand_name[16]; - u8 oem_raid_type[16]; - u8 bios_type[13]; - u8 bios_title[50]; - u8 oem_company_name[37]; - u32 pci_id_1; - u32 pci_id_2; - u8 validation_status[80]; - u8 reserved_1[4]; - u8 scsi_host_drive_inquiry_vendor_id[16]; - u8 library_file_template[16]; - u8 reserved_2[16]; - u8 tool_name_1[32]; - u8 tool_name_2[32]; - u8 tool_name_3[32]; - u8 oem_contact_1[84]; - u8 oem_contact_2[84]; - u8 oem_contact_3[84]; -} __attribute__((packed)) gdth_oem_str; - -typedef struct { - gdth_oem_str_params params; - gdth_oem_str text; -} __attribute__((packed)) gdth_oem_str_ioctl; - -/* board features */ -typedef struct { - u8 chaining; /* chaining supported */ - u8 striping; /* striping (raid-0) supp. */ - u8 mirroring; /* mirroring (raid-1) supp. */ - u8 raid; /* raid-4/5/10 supported */ -} __attribute__((packed)) gdth_bfeat_str; - -/* board info ioctl */ -typedef struct { - u32 ser_no; /* serial no. */ - u8 oem_id[2]; /* oem id */ - u16 ep_flags; /* eprom flags */ - u32 proc_id; /* processor id */ - u32 memsize; /* memory size (bytes) */ - u8 mem_banks; /* memory banks */ - u8 chan_type; /* channel type */ - u8 chan_count; /* channel count */ - u8 rdongle_pres; /* dongle present? */ - u32 epr_fw_ver; /* (eprom) firmware version */ - u32 upd_fw_ver; /* (update) firmware version */ - u32 upd_revision; /* update revision */ - char type_string[16]; /* controller name */ - char raid_string[16]; /* raid firmware name */ - u8 update_pres; /* update present? */ - u8 xor_pres; /* xor engine present? */ - u8 prom_type; /* rom type (eprom/flash) */ - u8 prom_count; /* number of rom devices */ - u32 dup_pres; /* duplexing module present? */ - u32 chan_pres; /* number of expansion chn. */ - u32 mem_pres; /* memory expansion inst. ? */ - u8 ft_bus_system; /* fault bus supported? */ - u8 subtype_valid; /* board_subtype valid? */ - u8 board_subtype; /* subtype/hardware level */ - u8 ramparity_pres; /* ram parity check hardware? */ -} __attribute__((packed)) gdth_binfo_str; - -/* get host drive info */ -typedef struct { - char name[8]; /* host drive name */ - u32 size; /* size (sectors) */ - u8 host_drive; /* host drive number */ - u8 log_drive; /* log. drive (master) */ - u8 reserved; - u8 rw_attribs; /* r/w attribs */ - u32 start_sec; /* start sector */ -} __attribute__((packed)) gdth_hentry_str; - -typedef struct { - u32 entries; /* entry count */ - u32 offset; /* offset of entries */ - u8 secs_p_head; /* sectors/head */ - u8 heads_p_cyl; /* heads/cylinder */ - u8 reserved; - u8 clust_drvtype; /* cluster drive type */ - u32 location; /* controller number */ - gdth_hentry_str entry[max_hdrives]; /* entries */ -} __attribute__((packed)) gdth_hget_str; - - -/* dpram structures */ - -/* interface area isa/pci */ -typedef struct { - u8 s_cmd_indx; /* special command */ - u8 volatile s_status; /* status special command */ - u16 reserved1; - u32 s_info[4]; /* add. info special command */ - u8 volatile sema0; /* command semaphore */ - u8 reserved2[3]; - u8 cmd_index; /* command number */ - u8 reserved3[3]; - u16 volatile status; /* command status */ - u16 service; /* service(for async.events) */ - u32 info[2]; /* additional info */ - struct { - u16 offset; /* command offs. in the dpram*/ - u16 serv_id; /* service */ - } __attribute__((packed)) comm_queue[maxoffsets]; /* command queue */ - u32 bios_reserved[2]; - u8 gdt_dpr_cmd[1]; /* commands */ -} __attribute__((packed)) gdt_dpr_if; - -/* sram structure pci controllers */ -typedef struct { - u32 magic; /* controller id from bios */ - u16 need_deinit; /* switch betw. bios/driver */ - u8 switch_support; /* see need_deinit */ - u8 padding[9]; - u8 os_used[16]; /* os code per service */ - u8 unused[28]; - u8 fw_magic; /* contr. id from firmware */ -} __attribute__((packed)) gdt_pci_sram; - -/* dpram isa controllers */ -typedef struct { - union { - struct { - u8 bios_used[0x3c00-32]; /* 15kb - 32bytes bios */ - u16 need_deinit; /* switch betw. bios/driver */ - u8 switch_support; /* see need_deinit */ - u8 padding[9]; - u8 os_used[16]; /* os code per service */ - } __attribute__((packed)) dp_sram; - u8 bios_area[0x4000]; /* 16kb reserved for bios */ - } bu; - union { - gdt_dpr_if ic; /* interface area */ - u8 if_area[0x3000]; /* 12kb for interface */ - } u; - struct { - u8 memlock; /* write protection dpram */ - u8 event; /* release event */ - u8 irqen; /* board interrupts enable */ - u8 irqdel; /* acknowledge board int. */ - u8 volatile sema1; /* status semaphore */ - u8 rq; /* irq/drq configuration */ - } __attribute__((packed)) io; -} __attribute__((packed)) gdt2_dpram_str; - -/* dpram pci controllers */ -typedef struct { - union { - gdt_dpr_if ic; /* interface area */ - u8 if_area[0xff0-sizeof(gdt_pci_sram)]; - } u; - gdt_pci_sram gdt6sr; /* sram structure */ - struct { - u8 unused0[1]; - u8 volatile sema1; /* command semaphore */ - u8 unused1[3]; - u8 irqen; /* board interrupts enable */ - u8 unused2[2]; - u8 event; /* release event */ - u8 unused3[3]; - u8 irqdel; /* acknowledge board int. */ - u8 unused4[3]; - } __attribute__((packed)) io; -} __attribute__((packed)) gdt6_dpram_str; - -/* plx register structure (new pci controllers) */ -typedef struct { - u8 cfg_reg; /* dpram cfg.(2:below 1mb,0:anywhere)*/ - u8 unused1[0x3f]; - u8 volatile sema0_reg; /* command semaphore */ - u8 volatile sema1_reg; /* status semaphore */ - u8 unused2[2]; - u16 volatile status; /* command status */ - u16 service; /* service */ - u32 info[2]; /* additional info */ - u8 unused3[0x10]; - u8 ldoor_reg; /* pci to local doorbell */ - u8 unused4[3]; - u8 volatile edoor_reg; /* local to pci doorbell */ - u8 unused5[3]; - u8 control0; /* control0 register(unused) */ - u8 control1; /* board interrupts enable */ - u8 unused6[0x16]; -} __attribute__((packed)) gdt6c_plx_regs; - -/* dpram new pci controllers */ -typedef struct { - union { - gdt_dpr_if ic; /* interface area */ - u8 if_area[0x4000-sizeof(gdt_pci_sram)]; - } u; - gdt_pci_sram gdt6sr; /* sram structure */ -} __attribute__((packed)) gdt6c_dpram_str; - -/* i960 register structure (pci mpr controllers) */ -typedef struct { - u8 unused1[16]; - u8 volatile sema0_reg; /* command semaphore */ - u8 unused2; - u8 volatile sema1_reg; /* status semaphore */ - u8 unused3; - u16 volatile status; /* command status */ - u16 service; /* service */ - u32 info[2]; /* additional info */ - u8 ldoor_reg; /* pci to local doorbell */ - u8 unused4[11]; - u8 volatile edoor_reg; /* local to pci doorbell */ - u8 unused5[7]; - u8 edoor_en_reg; /* board interrupts enable */ - u8 unused6[27]; - u32 unused7[939]; - u32 severity; - char evt_str[256]; /* event string */ -} __attribute__((packed)) gdt6m_i960_regs; - -/* dpram pci mpr controllers */ -typedef struct { - gdt6m_i960_regs i960r; /* 4kb i960 registers */ - union { - gdt_dpr_if ic; /* interface area */ - u8 if_area[0x3000-sizeof(gdt_pci_sram)]; - } u; - gdt_pci_sram gdt6sr; /* sram structure */ -} __attribute__((packed)) gdt6m_dpram_str; - - -/* pci resources */ -typedef struct { - struct pci_dev *pdev; - unsigned long dpmem; /* dpram address */ - unsigned long io; /* io address */ -} gdth_pci_str; - - -/* controller information structure */ -typedef struct { - struct scsi_host *shost; - struct list_head list; - u16 hanum; - u16 oem_id; /* oem */ - u16 type; /* controller class */ - u32 stype; /* subtype (pci: device id) */ - u16 fw_vers; /* firmware version */ - u16 cache_feat; /* feat. cache serv. (s/g,..)*/ - u16 raw_feat; /* feat. raw service (s/g,..)*/ - u16 screen_feat; /* feat. raw service (s/g,..)*/ - void __iomem *brd; /* dpram address */ - u32 brd_phys; /* slot number/bios address */ - gdt6c_plx_regs *plx; /* plx regs (new pci contr.) */ - gdth_cmd_str cmdext; - gdth_cmd_str *pccb; /* address command structure */ - u32 ccb_phys; /* phys. address */ -#ifdef int_coal - gdth_coal_status *coal_stat; /* buffer for coalescing int.*/ - u64 coal_stat_phys; /* phys. address */ -#endif - char *pscratch; /* scratch (dma) buffer */ - u64 scratch_phys; /* phys. address */ - u8 scratch_busy; /* in use? */ - u8 dma64_support; /* 64-bit dma supported? */ - gdth_msg_str *pmsg; /* message buffer */ - u64 msg_phys; /* phys. address */ - u8 scan_mode; /* current scan mode */ - u8 irq; /* irq */ - u8 drq; /* drq (isa controllers) */ - u16 status; /* command status */ - u16 service; /* service/firmware ver./.. */ - u32 info; - u32 info2; /* additional info */ - struct scsi_cmnd *req_first; /* top of request queue */ - struct { - u8 present; /* flag: host drive present? */ - u8 is_logdrv; /* flag: log. drive (master)? */ - u8 is_arraydrv; /* flag: array drive? */ - u8 is_master; /* flag: array drive master? */ - u8 is_parity; /* flag: parity drive? */ - u8 is_hotfix; /* flag: hotfix drive? */ - u8 master_no; /* number of master drive */ - u8 lock; /* drive locked? (hot plug) */ - u8 heads; /* mapping */ - u8 secs; - u16 devtype; /* further information */ - u64 size; /* capacity */ - u8 ldr_no; /* log. drive no. */ - u8 rw_attribs; /* r/w attributes */ - u8 cluster_type; /* cluster properties */ - u8 media_changed; /* flag:mount/unmount occurred */ - u32 start_sec; /* start sector */ - } hdr[max_ldrives]; /* host drives */ - struct { - u8 lock; /* channel locked? (hot plug) */ - u8 pdev_cnt; /* physical device count */ - u8 local_no; /* local channel number */ - u8 io_cnt[maxid]; /* current io count */ - u32 address; /* channel address */ - u32 id_list[maxid]; /* ids of the phys. devices */ - } raw[maxbus]; /* scsi channels */ - struct { - struct scsi_cmnd *cmnd; /* pending request */ - u16 service; /* service */ - } cmd_tab[gdth_maxcmds]; /* table of pend. requests */ - struct gdth_cmndinfo { /* per-command private info */ - int index; - int internal_command; /* don't call scsi_done */ - gdth_cmd_str *internal_cmd_str; /* crier for internal messages*/ - dma_addr_t sense_paddr; /* sense dma-addr */ - u8 priority; - int timeout_count; /* # of timeout calls */ - volatile int wait_for_completion; - u16 status; - u32 info; - enum dma_data_direction dma_dir; - int phase; /* ???? */ - int opcode; - } cmndinfo[gdth_maxcmds]; /* index==0 is free */ - u8 bus_cnt; /* scsi bus count */ - u8 tid_cnt; /* target id count */ - u8 bus_id[maxbus]; /* iop ids */ - u8 virt_bus; /* number of virtual bus */ - u8 more_proc; /* more /proc info supported */ - u16 cmd_cnt; /* command count in dpram */ - u16 cmd_len; /* length of actual command */ - u16 cmd_offs_dpmem; /* actual offset in dpram */ - u16 ic_all_size; /* sizeof dpram interf. area */ - gdth_cpar_str cpar; /* controller cache par. */ - gdth_bfeat_str bfeat; /* controller features */ - gdth_binfo_str binfo; /* controller info */ - gdth_evt_data dvr; /* event structure */ - spinlock_t smp_lock; - struct pci_dev *pdev; - char oem_name[8]; -#ifdef gdth_dma_statistics - unsigned long dma32_cnt, dma64_cnt; /* statistics: dma buffer */ -#endif - struct scsi_device *sdev; -} gdth_ha_str; - -static inline struct gdth_cmndinfo *gdth_cmnd_priv(struct scsi_cmnd* cmd) -{ - return (struct gdth_cmndinfo *)cmd->host_scribble; -} - -/* inquiry data format */ -typedef struct { - u8 type_qual; - u8 modif_rmb; - u8 version; - u8 resp_aenc; - u8 add_length; - u8 reserved1; - u8 reserved2; - u8 misc; - u8 vendor[8]; - u8 product[16]; - u8 revision[4]; -} __attribute__((packed)) gdth_inq_data; - -/* read_capacity data format */ -typedef struct { - u32 last_block_no; - u32 block_length; -} __attribute__((packed)) gdth_rdcap_data; - -/* read_capacity (16) data format */ -typedef struct { - u64 last_block_no; - u32 block_length; -} __attribute__((packed)) gdth_rdcap16_data; - -/* request_sense data format */ -typedef struct { - u8 errorcode; - u8 segno; - u8 key; - u32 info; - u8 add_length; - u32 cmd_info; - u8 adsc; - u8 adsq; - u8 fruc; - u8 key_spec[3]; -} __attribute__((packed)) gdth_sense_data; - -/* mode_sense data format */ -typedef struct { - struct { - u8 data_length; - u8 med_type; - u8 dev_par; - u8 bd_length; - } __attribute__((packed)) hd; - struct { - u8 dens_code; - u8 block_count[3]; - u8 reserved; - u8 block_length[3]; - } __attribute__((packed)) bd; -} __attribute__((packed)) gdth_modep_data; - -/* stack frame */ -typedef struct { - unsigned long b[10]; /* 32/64 bit compiler ! */ -} __attribute__((packed)) gdth_stackframe; - - -/* function prototyping */ - -int gdth_show_info(struct seq_file *, struct scsi_host *); -int gdth_set_info(struct scsi_host *, char *, int); - -#endif diff --git a/drivers/scsi/gdth_ioctl.h b/drivers/scsi/gdth_ioctl.h --- a/drivers/scsi/gdth_ioctl.h +++ /dev/null -/* spdx-license-identifier: gpl-2.0 */ -#ifndef _gdth_ioctl_h -#define _gdth_ioctl_h - -/* gdth_ioctl.h - * $id: gdth_ioctl.h,v 1.14 2004/02/19 15:43:15 achim exp $ - */ - -/* ioctls */ -#define gdtioctl_mask ('j'<<8) -#define gdtioctl_general (gdtioctl_mask | 0) /* general ioctl */ -#define gdtioctl_drvers (gdtioctl_mask | 1) /* get driver version */ -#define gdtioctl_ctrtype (gdtioctl_mask | 2) /* get controller type */ -#define gdtioctl_osvers (gdtioctl_mask | 3) /* get os version */ -#define gdtioctl_hdrlist (gdtioctl_mask | 4) /* get host drive list */ -#define gdtioctl_ctrcnt (gdtioctl_mask | 5) /* get controller count */ -#define gdtioctl_lockdrv (gdtioctl_mask | 6) /* lock host drive */ -#define gdtioctl_lockchn (gdtioctl_mask | 7) /* lock channel */ -#define gdtioctl_event (gdtioctl_mask | 8) /* read controller events */ -#define gdtioctl_scsi (gdtioctl_mask | 9) /* scsi command */ -#define gdtioctl_reset_bus (gdtioctl_mask |10) /* reset scsi bus */ -#define gdtioctl_rescan (gdtioctl_mask |11) /* rescan host drives */ -#define gdtioctl_reset_drv (gdtioctl_mask |12) /* reset (remote) drv. res. */ - -#define gdtioctl_magic 0xaffe0004 -#define event_size 294 -#define gdth_maxsg 32 /* max. s/g elements */ - -#define max_ldrives 255 /* max. log. drive count */ -#define max_hdrives max_ldrives /* max. host drive count */ - -/* scatter/gather element */ -typedef struct { - u32 sg_ptr; /* address */ - u32 sg_len; /* length */ -} __attribute__((packed)) gdth_sg_str; - -/* scatter/gather element - 64bit addresses */ -typedef struct { - u64 sg_ptr; /* address */ - u32 sg_len; /* length */ -} __attribute__((packed)) gdth_sg64_str; - -/* command structure */ -typedef struct { - u32 boardnode; /* board node (always 0) */ - u32 commandindex; /* command number */ - u16 opcode; /* the command (read,..) */ - union { - struct { - u16 deviceno; /* number of cache drive */ - u32 blockno; /* block number */ - u32 blockcnt; /* block count */ - u32 destaddr; /* dest. addr. (if s/g: -1) */ - u32 sg_canz; /* s/g element count */ - gdth_sg_str sg_lst[gdth_maxsg]; /* s/g list */ - } __attribute__((packed)) cache; /* cache service cmd. str. */ - struct { - u16 deviceno; /* number of cache drive */ - u64 blockno; /* block number */ - u32 blockcnt; /* block count */ - u64 destaddr; /* dest. addr. (if s/g: -1) */ - u32 sg_canz; /* s/g element count */ - gdth_sg64_str sg_lst[gdth_maxsg]; /* s/g list */ - } __attribute__((packed)) cache64; /* cache service cmd. str. */ - struct { - u16 param_size; /* size of p_param buffer */ - u32 subfunc; /* ioctl function */ - u32 channel; /* device */ - u64 p_param; /* buffer */ - } __attribute__((packed)) ioctl; /* ioctl command structure */ - struct { - u16 reserved; - union { - struct { - u32 msg_handle; /* message handle */ - u64 msg_addr; /* message buffer address */ - } __attribute__((packed)) msg; - u8 data[12]; /* buffer for rtc data, ... */ - } su; - } __attribute__((packed)) screen; /* screen service cmd. str. */ - struct { - u16 reserved; - u32 direction; /* data direction */ - u32 mdisc_time; /* disc. time (0: no timeout)*/ - u32 mcon_time; /* connect time(0: no to.) */ - u32 sdata; /* dest. addr. (if s/g: -1) */ - u32 sdlen; /* data length (bytes) */ - u32 clen; /* scsi cmd. length(6,10,12) */ - u8 cmd[12]; /* scsi command */ - u8 target; /* target id */ - u8 lun; /* lun */ - u8 bus; /* scsi bus number */ - u8 priority; /* only 0 used */ - u32 sense_len; /* sense data length */ - u32 sense_data; /* sense data addr. */ - u32 link_p; /* linked cmds (not supp.) */ - u32 sg_ranz; /* s/g element count */ - gdth_sg_str sg_lst[gdth_maxsg]; /* s/g list */ - } __attribute__((packed)) raw; /* raw service cmd. struct. */ - struct { - u16 reserved; - u32 direction; /* data direction */ - u32 mdisc_time; /* disc. time (0: no timeout)*/ - u32 mcon_time; /* connect time(0: no to.) */ - u64 sdata; /* dest. addr. (if s/g: -1) */ - u32 sdlen; /* data length (bytes) */ - u32 clen; /* scsi cmd. length(6,..,16) */ - u8 cmd[16]; /* scsi command */ - u8 target; /* target id */ - u8 lun; /* lun */ - u8 bus; /* scsi bus number */ - u8 priority; /* only 0 used */ - u32 sense_len; /* sense data length */ - u64 sense_data; /* sense data addr. */ - u32 sg_ranz; /* s/g element count */ - gdth_sg64_str sg_lst[gdth_maxsg]; /* s/g list */ - } __attribute__((packed)) raw64; /* raw service cmd. struct. */ - } u; - /* additional variables */ - u8 service; /* controller service */ - u8 reserved; - u16 status; /* command result */ - u32 info; /* additional information */ - void *requestbuffer; /* request buffer */ -} __attribute__((packed)) gdth_cmd_str; - -/* controller event structure */ -#define es_async 1 -#define es_driver 2 -#define es_test 3 -#define es_sync 4 -typedef struct { - u16 size; /* size of structure */ - union { - char stream[16]; - struct { - u16 ionode; - u16 service; - u32 index; - } __attribute__((packed)) driver; - struct { - u16 ionode; - u16 service; - u16 status; - u32 info; - u8 scsi_coord[3]; - } __attribute__((packed)) async; - struct { - u16 ionode; - u16 service; - u16 status; - u32 info; - u16 hostdrive; - u8 scsi_coord[3]; - u8 sense_key; - } __attribute__((packed)) sync; - struct { - u32 l1, l2, l3, l4; - } __attribute__((packed)) test; - } eu; - u32 severity; - u8 event_string[256]; -} __attribute__((packed)) gdth_evt_data; - -typedef struct { - u32 first_stamp; - u32 last_stamp; - u16 same_count; - u16 event_source; - u16 event_idx; - u8 application; - u8 reserved; - gdth_evt_data event_data; -} __attribute__((packed)) gdth_evt_str; - -/* gdtioctl_general */ -typedef struct { - u16 ionode; /* controller number */ - u16 timeout; /* timeout */ - u32 info; /* error info */ - u16 status; /* status */ - unsigned long data_len; /* data buffer size */ - unsigned long sense_len; /* sense buffer size */ - gdth_cmd_str command; /* command */ -} gdth_ioctl_general; - -/* gdtioctl_lockdrv */ -typedef struct { - u16 ionode; /* controller number */ - u8 lock; /* lock/unlock */ - u8 drive_cnt; /* drive count */ - u16 drives[max_hdrives]; /* drives */ -} gdth_ioctl_lockdrv; - -/* gdtioctl_lockchn */ -typedef struct { - u16 ionode; /* controller number */ - u8 lock; /* lock/unlock */ - u8 channel; /* channel */ -} gdth_ioctl_lockchn; - -/* gdtioctl_osvers */ -typedef struct { - u8 version; /* os version */ - u8 subversion; /* os subversion */ - u16 revision; /* revision */ -} gdth_ioctl_osvers; - -/* gdtioctl_ctrtype */ -typedef struct { - u16 ionode; /* controller number */ - u8 type; /* controller type */ - u16 info; /* slot etc. */ - u16 oem_id; /* oem id */ - u16 bios_ver; /* not used */ - u16 access; /* not used */ - u16 ext_type; /* extended type */ - u16 device_id; /* device id */ - u16 sub_device_id; /* sub device id */ -} gdth_ioctl_ctrtype; - -/* gdtioctl_event */ -typedef struct { - u16 ionode; - int erase; /* erase event? */ - int handle; /* event handle */ - gdth_evt_str event; -} gdth_ioctl_event; - -/* gdtioctl_rescan/gdtioctl_hdrlist */ -typedef struct { - u16 ionode; /* controller number */ - u8 flag; /* add/remove */ - u16 hdr_no; /* drive no. */ - struct { - u8 bus; /* scsi bus */ - u8 target; /* target id */ - u8 lun; /* lun */ - u8 cluster_type; /* cluster properties */ - } hdr_list[max_hdrives]; /* index is host drive number */ -} gdth_ioctl_rescan; - -/* gdtioctl_reset_bus/gdtioctl_reset_drv */ -typedef struct { - u16 ionode; /* controller number */ - u16 number; /* bus/host drive number */ - u16 status; /* status */ -} gdth_ioctl_reset; - -#endif diff --git a/drivers/scsi/gdth_proc.c b/drivers/scsi/gdth_proc.c --- a/drivers/scsi/gdth_proc.c +++ /dev/null -// spdx-license-identifier: gpl-2.0 -/* gdth_proc.c - * $id: gdth_proc.c,v 1.43 2006/01/11 16:15:00 achim exp $ - */ - -#include <linux/completion.h> -#include <linux/slab.h> - -int gdth_set_info(struct scsi_host *host, char *buffer, int length) -{ - gdth_ha_str *ha = shost_priv(host); - int ret_val = -einval; - - trace2(("gdth_set_info() ha %d ",ha->hanum,)); - - if (length >= 4) { - if (strncmp(buffer,"gdth",4) == 0) { - buffer += 5; - length -= 5; - ret_val = gdth_set_asc_info(host, buffer, length, ha); - } - } - - return ret_val; -} - -static int gdth_set_asc_info(struct scsi_host *host, char *buffer, - int length, gdth_ha_str *ha) -{ - int orig_length, drive, wb_mode; - int i, found; - gdth_cmd_str gdtcmd; - gdth_cpar_str *pcpar; - - char cmnd[max_command_size]; - memset(cmnd, 0xff, 12); - memset(&gdtcmd, 0, sizeof(gdth_cmd_str)); - - trace2(("gdth_set_asc_info() ha %d ",ha->hanum)); - orig_length = length + 5; - drive = -1; - wb_mode = 0; - found = false; - - if (length >= 5 && strncmp(buffer,"flush",5)==0) { - buffer += 6; - length -= 6; - if (length && *buffer>='0' && *buffer<='9') { - drive = (int)(*buffer-'0'); - ++buffer; --length; - if (length && *buffer>='0' && *buffer<='9') { - drive = drive*10 + (int)(*buffer-'0'); - ++buffer; --length; - } - printk("gdt: flushing host drive %d .. ",drive); - } else { - printk("gdt: flushing all host drives .. "); - } - for (i = 0; i < max_hdrives; ++i) { - if (ha->hdr[i].present) { - if (drive != -1 && i != drive) - continue; - found = true; - gdtcmd.service = cacheservice; - gdtcmd.opcode = gdt_flush; - if (ha->cache_feat & gdt_64bit) { - gdtcmd.u.cache64.deviceno = i; - gdtcmd.u.cache64.blockno = 1; - } else { - gdtcmd.u.cache.deviceno = i; - gdtcmd.u.cache.blockno = 1; - } - - gdth_execute(host, &gdtcmd, cmnd, 30, null); - } - } - if (!found) - printk(" no host drive found ! "); - else - printk("done. "); - return(orig_length); - } - - if (length >= 7 && strncmp(buffer,"wbp_off",7)==0) { - buffer += 8; - length -= 8; - printk("gdt: disabling write back permanently .. "); - wb_mode = 1; - } else if (length >= 6 && strncmp(buffer,"wbp_on",6)==0) { - buffer += 7; - length -= 7; - printk("gdt: enabling write back permanently .. "); - wb_mode = 2; - } else if (length >= 6 && strncmp(buffer,"wb_off",6)==0) { - buffer += 7; - length -= 7; - printk("gdt: disabling write back commands .. "); - if (ha->cache_feat & gdt_wr_through) { - gdth_write_through = true; - printk("done. "); - } else { - printk("not supported ! "); - } - return(orig_length); - } else if (length >= 5 && strncmp(buffer,"wb_on",5)==0) { - buffer += 6; - length -= 6; - printk("gdt: enabling write back commands .. "); - gdth_write_through = false; - printk("done. "); - return(orig_length); - } - - if (wb_mode) { - unsigned long flags; - - build_bug_on(sizeof(gdth_cpar_str) > gdth_scratch); - - spin_lock_irqsave(&ha->smp_lock, flags); - if (ha->scratch_busy) { - spin_unlock_irqrestore(&ha->smp_lock, flags); - return -ebusy; - } - ha->scratch_busy = true; - spin_unlock_irqrestore(&ha->smp_lock, flags); - - pcpar = (gdth_cpar_str *)ha->pscratch; - memcpy( pcpar, &ha->cpar, sizeof(gdth_cpar_str) ); - gdtcmd.service = cacheservice; - gdtcmd.opcode = gdt_ioctl; - gdtcmd.u.ioctl.p_param = ha->scratch_phys; - gdtcmd.u.ioctl.param_size = sizeof(gdth_cpar_str); - gdtcmd.u.ioctl.subfunc = cache_config; - gdtcmd.u.ioctl.channel = invalid_channel; - pcpar->write_back = wb_mode==1 ? 0:1; - - gdth_execute(host, &gdtcmd, cmnd, 30, null); - - spin_lock_irqsave(&ha->smp_lock, flags); - ha->scratch_busy = false; - spin_unlock_irqrestore(&ha->smp_lock, flags); - - printk("done. "); - return(orig_length); - } - - printk("gdt: unknown command: %s length: %d ",buffer,length); - return(-einval); -} - -int gdth_show_info(struct seq_file *m, struct scsi_host *host) -{ - gdth_ha_str *ha = shost_priv(host); - int hlen; - int id, i, j, k, sec, flag; - int no_mdrv = 0, drv_no, is_mirr; - u32 cnt; - dma_addr_t paddr; - int rc = -enomem; - - gdth_cmd_str *gdtcmd; - gdth_evt_str *estr; - char hrec[277]; - - char *buf; - gdth_dskstat_str *pds; - gdth_diskinfo_str *pdi; - gdth_arrayinf_str *pai; - gdth_defcnt_str *pdef; - gdth_cdrinfo_str *pcdi; - gdth_hget_str *phg; - char cmnd[max_command_size]; - - gdtcmd = kmalloc(sizeof(*gdtcmd), gfp_kernel); - estr = kmalloc(sizeof(*estr), gfp_kernel); - if (!gdtcmd || !estr) - goto free_fail; - - memset(cmnd, 0xff, 12); - memset(gdtcmd, 0, sizeof(gdth_cmd_str)); - - trace2(("gdth_get_info() ha %d ",ha->hanum)); - - - /* request is i.e. "cat /proc/scsi/gdth/0" */ - /* format: %-15s %-10s %-15s %s */ - /* driver parameters */ - seq_puts(m, "driver parameters: "); - if (reserve_list[0] == 0xff) - strcpy(hrec, "--"); - else { - hlen = sprintf(hrec, "%d", reserve_list[0]); - for (i = 1; i < max_res_args; i++) { - if (reserve_list[i] == 0xff) - break; - hlen += scnprintf(hrec + hlen, 161 - hlen, ",%d", reserve_list[i]); - } - } - seq_printf(m, - " reserve_mode: %d reserve_list: %s ", - reserve_mode, hrec); - seq_printf(m, - " max_ids: %-3d hdr_channel: %d ", - max_ids, hdr_channel); - - /* controller information */ - seq_puts(m, " disk array controller information: "); - seq_printf(m, - " number: %d name: %s ", - ha->hanum, ha->binfo.type_string); - - seq_printf(m, - " driver ver.: %-10s firmware ver.: ", - gdth_version_str); - if (ha->more_proc) - seq_printf(m, "%d.%02d.%02d-%c%03x ", - (u8)(ha->binfo.upd_fw_ver>>24), - (u8)(ha->binfo.upd_fw_ver>>16), - (u8)(ha->binfo.upd_fw_ver), - ha->bfeat.raid ? 'r':'n', - ha->binfo.upd_revision); - else - seq_printf(m, "%d.%02d ", (u8)(ha->cpar.version>>8), - (u8)(ha->cpar.version)); - - if (ha->more_proc) - /* more information: 1. about controller */ - seq_printf(m, - " serial no.: 0x%8x cache ram size: %d kb ", - ha->binfo.ser_no, ha->binfo.memsize / 1024); - - if (ha->more_proc) { - size_t size = max_t(size_t, gdth_scratch, sizeof(gdth_hget_str)); - - /* more information: 2. about physical devices */ - seq_puts(m, " physical devices:"); - flag = false; - - buf = dma_alloc_coherent(&ha->pdev->dev, size, &paddr, gfp_kernel); - if (!buf) - goto stop_output; - for (i = 0; i < ha->bus_cnt; ++i) { - /* 2.a statistics (and retries/reassigns) */ - trace2(("pdr_statistics() chn %d ",i)); - pds = (gdth_dskstat_str *)(buf + gdth_scratch/4); - gdtcmd->service = cacheservice; - gdtcmd->opcode = gdt_ioctl; - gdtcmd->u.ioctl.p_param = paddr + gdth_scratch/4; - gdtcmd->u.ioctl.param_size = 3*gdth_scratch/4; - gdtcmd->u.ioctl.subfunc = dsk_statistics | l_ctrl_pattern; - gdtcmd->u.ioctl.channel = ha->raw[i].address | invalid_channel; - pds->bid = ha->raw[i].local_no; - pds->first = 0; - pds->entries = ha->raw[i].pdev_cnt; - cnt = (3*gdth_scratch/4 - 5 * sizeof(u32)) / - sizeof(pds->list[0]); - if (pds->entries > cnt) - pds->entries = cnt; - - if (gdth_execute(host, gdtcmd, cmnd, 30, null) != s_ok) - pds->count = 0; - - /* other ioctls must fit into area gdth_scratch/4 */ - for (j = 0; j < ha->raw[i].pdev_cnt; ++j) { - /* 2.b drive info */ - trace2(("scsi_drv_info() chn %d dev %d ", - i, ha->raw[i].id_list[j])); - pdi = (gdth_diskinfo_str *)buf; - gdtcmd->service = cacheservice; - gdtcmd->opcode = gdt_ioctl; - gdtcmd->u.ioctl.p_param = paddr; - gdtcmd->u.ioctl.param_size = sizeof(gdth_diskinfo_str); - gdtcmd->u.ioctl.subfunc = scsi_dr_info | l_ctrl_pattern; - gdtcmd->u.ioctl.channel = - ha->raw[i].address | ha->raw[i].id_list[j]; - - if (gdth_execute(host, gdtcmd, cmnd, 30, null) == s_ok) { - strncpy(hrec,pdi->vendor,8); - strncpy(hrec+8,pdi->product,16); - strncpy(hrec+24,pdi->revision,4); - hrec[28] = 0; - seq_printf(m, - " chn/id/lun: %c/%02d/%d name: %s ", - 'a'+i,pdi->target_id,pdi->lun,hrec); - flag = true; - pdi->no_ldrive &= 0xffff; - if (pdi->no_ldrive == 0xffff) - strcpy(hrec,"--"); - else - sprintf(hrec,"%d",pdi->no_ldrive); - seq_printf(m, - " capacity [mb]: %-6d to log. drive: %s ", - pdi->blkcnt/(1024*1024/pdi->blksize), - hrec); - } else { - pdi->devtype = 0xff; - } - - if (pdi->devtype == 0) { - /* search retries/reassigns */ - for (k = 0; k < pds->count; ++k) { - if (pds->list[k].tid == pdi->target_id && - pds->list[k].lun == pdi->lun) { - seq_printf(m, - " retries: %-6d reassigns: %d ", - pds->list[k].retries, - pds->list[k].reassigns); - break; - } - } - /* 2.c grown defects */ - trace2(("scsi_drv_defcnt() chn %d dev %d ", - i, ha->raw[i].id_list[j])); - pdef = (gdth_defcnt_str *)buf; - gdtcmd->service = cacheservice; - gdtcmd->opcode = gdt_ioctl; - gdtcmd->u.ioctl.p_param = paddr; - gdtcmd->u.ioctl.param_size = sizeof(gdth_defcnt_str); - gdtcmd->u.ioctl.subfunc = scsi_def_cnt | l_ctrl_pattern; - gdtcmd->u.ioctl.channel = - ha->raw[i].address | ha->raw[i].id_list[j]; - pdef->sddc_type = 0x08; - - if (gdth_execute(host, gdtcmd, cmnd, 30, null) == s_ok) { - seq_printf(m, - " grown defects: %d ", - pdef->sddc_cnt); - } - } - } - } - - if (!flag) - seq_puts(m, " -- "); - - /* 3. about logical drives */ - seq_puts(m, " logical drives:"); - flag = false; - - for (i = 0; i < max_ldrives; ++i) { - if (!ha->hdr[i].is_logdrv) - continue; - drv_no = i; - j = k = 0; - is_mirr = false; - do { - /* 3.a log. drive info */ - trace2(("cache_drv_info() drive no %d ",drv_no)); - pcdi = (gdth_cdrinfo_str *)buf; - gdtcmd->service = cacheservice; - gdtcmd->opcode = gdt_ioctl; - gdtcmd->u.ioctl.p_param = paddr; - gdtcmd->u.ioctl.param_size = sizeof(gdth_cdrinfo_str); - gdtcmd->u.ioctl.subfunc = cache_drv_info; - gdtcmd->u.ioctl.channel = drv_no; - if (gdth_execute(host, gdtcmd, cmnd, 30, null) != s_ok) - break; - pcdi->ld_dtype >>= 16; - j++; - if (pcdi->ld_dtype > 2) { - strcpy(hrec, "missing"); - } else if (pcdi->ld_error & 1) { - strcpy(hrec, "fault"); - } else if (pcdi->ld_error & 2) { - strcpy(hrec, "invalid"); - k++; j--; - } else { - strcpy(hrec, "ok"); - } - - if (drv_no == i) { - seq_printf(m, - " number: %-2d status: %s ", - drv_no, hrec); - flag = true; - no_mdrv = pcdi->cd_ldcnt; - if (no_mdrv > 1 || pcdi->ld_slave != -1) { - is_mirr = true; - strcpy(hrec, "raid-1"); - } else if (pcdi->ld_dtype == 0) { - strcpy(hrec, "disk"); - } else if (pcdi->ld_dtype == 1) { - strcpy(hrec, "raid-0"); - } else if (pcdi->ld_dtype == 2) { - strcpy(hrec, "chain"); - } else { - strcpy(hrec, "???"); - } - seq_printf(m, - " capacity [mb]: %-6d type: %s ", - pcdi->ld_blkcnt/(1024*1024/pcdi->ld_blksize), - hrec); - } else { - seq_printf(m, - " slave number: %-2d status: %s ", - drv_no & 0x7fff, hrec); - } - drv_no = pcdi->ld_slave; - } while (drv_no != -1); - - if (is_mirr) - seq_printf(m, - " missing drv.: %-2d invalid drv.: %d ", - no_mdrv - j - k, k); - - if (!ha->hdr[i].is_arraydrv) - strcpy(hrec, "--"); - else - sprintf(hrec, "%d", ha->hdr[i].master_no); - seq_printf(m, - " to array drv.: %s ", hrec); - } - - if (!flag) - seq_puts(m, " -- "); - - /* 4. about array drives */ - seq_puts(m, " array drives:"); - flag = false; - - for (i = 0; i < max_ldrives; ++i) { - if (!(ha->hdr[i].is_arraydrv && ha->hdr[i].is_master)) - continue; - /* 4.a array drive info */ - trace2(("array_info() drive no %d ",i)); - pai = (gdth_arrayinf_str *)buf; - gdtcmd->service = cacheservice; - gdtcmd->opcode = gdt_ioctl; - gdtcmd->u.ioctl.p_param = paddr; - gdtcmd->u.ioctl.param_size = sizeof(gdth_arrayinf_str); - gdtcmd->u.ioctl.subfunc = array_info | la_ctrl_pattern; - gdtcmd->u.ioctl.channel = i; - if (gdth_execute(host, gdtcmd, cmnd, 30, null) == s_ok) { - if (pai->ai_state == 0) - strcpy(hrec, "idle"); - else if (pai->ai_state == 2) - strcpy(hrec, "build"); - else if (pai->ai_state == 4) - strcpy(hrec, "ready"); - else if (pai->ai_state == 6) - strcpy(hrec, "fail"); - else if (pai->ai_state == 8 || pai->ai_state == 10) - strcpy(hrec, "rebuild"); - else - strcpy(hrec, "error"); - if (pai->ai_ext_state & 0x10) - strcat(hrec, "/expand"); - else if (pai->ai_ext_state & 0x1) - strcat(hrec, "/patch"); - seq_printf(m, - " number: %-2d status: %s ", - i,hrec); - flag = true; - - if (pai->ai_type == 0) - strcpy(hrec, "raid-0"); - else if (pai->ai_type == 4) - strcpy(hrec, "raid-4"); - else if (pai->ai_type == 5) - strcpy(hrec, "raid-5"); - else - strcpy(hrec, "raid-10"); - seq_printf(m, - " capacity [mb]: %-6d type: %s ", - pai->ai_size/(1024*1024/pai->ai_secsize), - hrec); - } - } - - if (!flag) - seq_puts(m, " -- "); - - /* 5. about host drives */ - seq_puts(m, " host drives:"); - flag = false; - - for (i = 0; i < max_ldrives; ++i) { - if (!ha->hdr[i].is_logdrv || - (ha->hdr[i].is_arraydrv && !ha->hdr[i].is_master)) - continue; - /* 5.a get host drive list */ - trace2(("host_get() drv_no %d ",i)); - phg = (gdth_hget_str *)buf; - gdtcmd->service = cacheservice; - gdtcmd->opcode = gdt_ioctl; - gdtcmd->u.ioctl.p_param = paddr; - gdtcmd->u.ioctl.param_size = sizeof(gdth_hget_str); - gdtcmd->u.ioctl.subfunc = host_get | la_ctrl_pattern; - gdtcmd->u.ioctl.channel = i; - phg->entries = max_hdrives; - phg->offset = gdtoffsof(gdth_hget_str, entry[0]); - if (gdth_execute(host, gdtcmd, cmnd, 30, null) == s_ok) { - ha->hdr[i].ldr_no = i; - ha->hdr[i].rw_attribs = 0; - ha->hdr[i].start_sec = 0; - } else { - for (j = 0; j < phg->entries; ++j) { - k = phg->entry[j].host_drive; - if (k >= max_ldrives) - continue; - ha->hdr[k].ldr_no = phg->entry[j].log_drive; - ha->hdr[k].rw_attribs = phg->entry[j].rw_attribs; - ha->hdr[k].start_sec = phg->entry[j].start_sec; - } - } - } - dma_free_coherent(&ha->pdev->dev, size, buf, paddr); - - for (i = 0; i < max_hdrives; ++i) { - if (!(ha->hdr[i].present)) - continue; - - seq_printf(m, - " number: %-2d arr/log. drive: %d ", - i, ha->hdr[i].ldr_no); - flag = true; - - seq_printf(m, - " capacity [mb]: %-6d start sector: %d ", - (u32)(ha->hdr[i].size/2048), ha->hdr[i].start_sec); - } - - if (!flag) - seq_puts(m, " -- "); - } - - /* controller events */ - seq_puts(m, " controller events: "); - - for (id = -1;;) { - id = gdth_read_event(ha, id, estr); - if (estr->event_source == 0) - break; - if (estr->event_data.eu.driver.ionode == ha->hanum && - estr->event_source == es_async) { - gdth_log_event(&estr->event_data, hrec); - - /* - * elapsed seconds subtraction with unsigned operands is - * safe from wrap around in year 2106. executes as: - * operand a + (2's complement operand b) + 1 - */ - - sec = (int)((u32)ktime_get_real_seconds() - estr->first_stamp); - if (sec < 0) sec = 0; - seq_printf(m," date- %02d:%02d:%02d %s ", - sec/3600, sec%3600/60, sec%60, hrec); - } - if (id == -1) - break; - } -stop_output: - rc = 0; -free_fail: - kfree(gdtcmd); - kfree(estr); - return rc; -} - -static void gdth_wait_completion(gdth_ha_str *ha, int busnum, int id) -{ - unsigned long flags; - int i; - struct scsi_cmnd *scp; - struct gdth_cmndinfo *cmndinfo; - u8 b, t; - - spin_lock_irqsave(&ha->smp_lock, flags); - - for (i = 0; i < gdth_maxcmds; ++i) { - scp = ha->cmd_tab[i].cmnd; - cmndinfo = gdth_cmnd_priv(scp); - - b = scp->device->channel; - t = scp->device->id; - if (!special_scp(scp) && t == (u8)id && - b == (u8)busnum) { - cmndinfo->wait_for_completion = 0; - spin_unlock_irqrestore(&ha->smp_lock, flags); - while (!cmndinfo->wait_for_completion) - barrier(); - spin_lock_irqsave(&ha->smp_lock, flags); - } - } - spin_unlock_irqrestore(&ha->smp_lock, flags); -} diff --git a/drivers/scsi/gdth_proc.h b/drivers/scsi/gdth_proc.h --- a/drivers/scsi/gdth_proc.h +++ /dev/null -/* spdx-license-identifier: gpl-2.0 */ -#ifndef _gdth_proc_h -#define _gdth_proc_h - -/* gdth_proc.h - * $id: gdth_proc.h,v 1.16 2004/01/14 13:09:01 achim exp $ - */ - -int gdth_execute(struct scsi_host *shost, gdth_cmd_str *gdtcmd, char *cmnd, - int timeout, u32 *info); - -static int gdth_set_asc_info(struct scsi_host *host, char *buffer, - int length, gdth_ha_str *ha); - -static void gdth_wait_completion(gdth_ha_str *ha, int busnum, int id); - -#endif -
|
Storage
|
0653c358d2dc7904c5553c5a9f2cbadc236e3f60
|
hannes reinecke
|
drivers
|
scsi
|
ioctl
|
nvme: support command retry delay for admin command
|
the controller can request a delay retrying a failed command by setting the command retry delay (crd) field in the completion queue entry.
|
this release allows to map an uid to a different one in a mount; it also adds support for selecting the preemption model at runtime; support for a low-overhead memory error detector designed to be used in production; support for the acrn hypervisor designed for embedded systems; btrfs initial support for zoned devices, subpage blocks sizes and performance improvements; support for eager nfs writes; support for a thermal power management to control the surface temperature of embedded devices in an unified way; the napi polling can be moved to a kernel thread; and support for non-blocking path lookups. as always, there are many other features, new drivers, improvements and fixes.
|
support command retry delay for admin command
|
['core (various)', 'file systems', 'memory management', 'block layer', 'tracing, perf and bpf', 'virtualization', 'cryptography', 'security', 'networking', 'architectures x86 arm risc-v powerpc mips csky s390 pa-risc c6x']
|
['graphics', 'power management', 'storage', 'drivers in the staging area', 'networking', 'audio', 'tablets, touch screens, keyboards, mouses', 'tv tuners, webcams, video capturers', 'universal serial bus', 'serial peripheral interface (spi)', 'watchdog', 'serial', 'cpu frequency scaling', 'device voltage and frequency scaling', 'voltage, current regulators, power capping, power supply', 'real time clock (rtc)', 'pin controllers (pinctrl)', 'multi media card (mmc)', 'memory technology devices (mtd)', 'industrial i/o (iio)', 'multi function devices (mfd)', 'pulse-width modulation (pwm)', 'inter-integrated circuit (i2c + i3c)', 'hardware monitoring (hwmon)', 'general purpose i/o (gpio)', 'leds', 'dma engines', 'cryptography hardware acceleration', 'pci', 'non-transparent bridge (ntb)', 'thunderbolt', 'clock', 'phy ("physical layer" framework)', 'cxl (compute express link)', 'various']
|
['nvme']
|
['c']
| 1
| 2
| 3
|
--- diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c --- a/drivers/nvme/host/core.c +++ b/drivers/nvme/host/core.c - struct nvme_ns *ns = req->q->queuedata; - if (ns && crd) - delay = ns->ctrl->crdt[crd - 1] * 100; + if (crd) + delay = nvme_req(req)->ctrl->crdt[crd - 1] * 100;
|
Storage
|
f9063a53274d25a878310db3fb645bfa9e49c917
|
minwoo im
|
drivers
|
nvme
|
host
|
media: allegro: move driver out of staging
|
the stateful encoder api was finalized. nothing is blocking the driver from being moved out of staging.
|
this release allows to map an uid to a different one in a mount; it also adds support for selecting the preemption model at runtime; support for a low-overhead memory error detector designed to be used in production; support for the acrn hypervisor designed for embedded systems; btrfs initial support for zoned devices, subpage blocks sizes and performance improvements; support for eager nfs writes; support for a thermal power management to control the surface temperature of embedded devices in an unified way; the napi polling can be moved to a kernel thread; and support for non-blocking path lookups. as always, there are many other features, new drivers, improvements and fixes.
|
move driver out of staging
|
['core (various)', 'file systems', 'memory management', 'block layer', 'tracing, perf and bpf', 'virtualization', 'cryptography', 'security', 'networking', 'architectures x86 arm risc-v powerpc mips csky s390 pa-risc c6x']
|
['graphics', 'power management', 'storage', 'drivers in the staging area', 'networking', 'audio', 'tablets, touch screens, keyboards, mouses', 'tv tuners, webcams, video capturers', 'universal serial bus', 'serial peripheral interface (spi)', 'watchdog', 'serial', 'cpu frequency scaling', 'device voltage and frequency scaling', 'voltage, current regulators, power capping, power supply', 'real time clock (rtc)', 'pin controllers (pinctrl)', 'multi media card (mmc)', 'memory technology devices (mtd)', 'industrial i/o (iio)', 'multi function devices (mfd)', 'pulse-width modulation (pwm)', 'inter-integrated circuit (i2c + i3c)', 'hardware monitoring (hwmon)', 'general purpose i/o (gpio)', 'leds', 'dma engines', 'cryptography hardware acceleration', 'pci', 'non-transparent bridge (ntb)', 'thunderbolt', 'clock', 'phy ("physical layer" framework)', 'cxl (compute express link)', 'various']
|
['allegro']
|
['c', 'h', 'kconfig', 'todo', 'maintainers', 'makefile']
| 13
| 17
| 24
|
--- diff --git a/maintainers b/maintainers --- a/maintainers +++ b/maintainers -f: drivers/staging/media/allegro-dvt/ +f: drivers/media/platform/allegro-dvt/ diff --git a/drivers/media/platform/kconfig b/drivers/media/platform/kconfig --- a/drivers/media/platform/kconfig +++ b/drivers/media/platform/kconfig +config video_allegro_dvt + tristate "allegro dvt video ip core" + depends on video_dev && video_v4l2 + depends on arch_zynqmp || compile_test + select v4l2_mem2mem_dev + select videobuf2_dma_contig + select regmap_mmio + help + support for the encoder video ip core by allegro dvt. this core is + found for example on the xilinx zynqmp soc in the ev family and is + called vcu in the reference manual. + + to compile this driver as a module, choose m here: the module + will be called allegro. + diff --git a/drivers/media/platform/makefile b/drivers/media/platform/makefile --- a/drivers/media/platform/makefile +++ b/drivers/media/platform/makefile +obj-$(config_video_allegro_dvt) += allegro-dvt/ diff --git a/drivers/staging/media/allegro-dvt/makefile b/drivers/media/platform/allegro-dvt/makefile diff --git a/drivers/staging/media/allegro-dvt/allegro-core.c b/drivers/media/platform/allegro-dvt/allegro-core.c diff --git a/drivers/staging/media/allegro-dvt/allegro-mail.c b/drivers/media/platform/allegro-dvt/allegro-mail.c diff --git a/drivers/staging/media/allegro-dvt/allegro-mail.h b/drivers/media/platform/allegro-dvt/allegro-mail.h diff --git a/drivers/staging/media/allegro-dvt/nal-h264.c b/drivers/media/platform/allegro-dvt/nal-h264.c diff --git a/drivers/staging/media/allegro-dvt/nal-h264.h b/drivers/media/platform/allegro-dvt/nal-h264.h diff --git a/drivers/staging/media/kconfig b/drivers/staging/media/kconfig --- a/drivers/staging/media/kconfig +++ b/drivers/staging/media/kconfig -source "drivers/staging/media/allegro-dvt/kconfig" - diff --git a/drivers/staging/media/makefile b/drivers/staging/media/makefile --- a/drivers/staging/media/makefile +++ b/drivers/staging/media/makefile -obj-$(config_video_allegro_dvt) += allegro-dvt/ diff --git a/drivers/staging/media/allegro-dvt/kconfig b/drivers/staging/media/allegro-dvt/kconfig --- a/drivers/staging/media/allegro-dvt/kconfig +++ /dev/null -# spdx-license-identifier: gpl-2.0 -config video_allegro_dvt - tristate "allegro dvt video ip core" - depends on video_dev && video_v4l2 - depends on arch_zynqmp || compile_test - select v4l2_mem2mem_dev - select videobuf2_dma_contig - select regmap - select regmap_mmio - help - support for the encoder video ip core by allegro dvt. this core is - found for example on the xilinx zynqmp soc in the ev family and is - called vcu in the reference manual. - - to compile this driver as a module, choose m here: the module - will be called allegro. diff --git a/drivers/staging/media/allegro-dvt/todo b/drivers/staging/media/allegro-dvt/todo --- a/drivers/staging/media/allegro-dvt/todo +++ /dev/null -todo: - -- this driver is waiting for the stateful encoder spec and corresponding - v4l2-compliance tests to be finalized.
|
Drivers in the Staging area
|
d74d4e2359ec7985831192f9b5ee22ed5e55b81c
|
michael tretter
|
drivers
|
staging
|
allegro-dvt, media, platform
|
staging: comedi: adl_pci7x3x: add interrupt handling for pci-7230
|
on the adlink pci-7230, digital input channels 0 and 1 can be used as external interrupt sources. a rising edge on each input latches a corresponding local interrupt input of the pci interface chip. writing a "clear irq" register clears both latches.
|
this release allows to map an uid to a different one in a mount; it also adds support for selecting the preemption model at runtime; support for a low-overhead memory error detector designed to be used in production; support for the acrn hypervisor designed for embedded systems; btrfs initial support for zoned devices, subpage blocks sizes and performance improvements; support for eager nfs writes; support for a thermal power management to control the surface temperature of embedded devices in an unified way; the napi polling can be moved to a kernel thread; and support for non-blocking path lookups. as always, there are many other features, new drivers, improvements and fixes.
|
add interrupt handling for pci-7230
|
['core (various)', 'file systems', 'memory management', 'block layer', 'tracing, perf and bpf', 'virtualization', 'cryptography', 'security', 'networking', 'architectures x86 arm risc-v powerpc mips csky s390 pa-risc c6x']
|
['graphics', 'power management', 'storage', 'drivers in the staging area', 'networking', 'audio', 'tablets, touch screens, keyboards, mouses', 'tv tuners, webcams, video capturers', 'universal serial bus', 'serial peripheral interface (spi)', 'watchdog', 'serial', 'cpu frequency scaling', 'device voltage and frequency scaling', 'voltage, current regulators, power capping, power supply', 'real time clock (rtc)', 'pin controllers (pinctrl)', 'multi media card (mmc)', 'memory technology devices (mtd)', 'industrial i/o (iio)', 'multi function devices (mfd)', 'pulse-width modulation (pwm)', 'inter-integrated circuit (i2c + i3c)', 'hardware monitoring (hwmon)', 'general purpose i/o (gpio)', 'leds', 'dma engines', 'cryptography hardware acceleration', 'pci', 'non-transparent bridge (ntb)', 'thunderbolt', 'clock', 'phy ("physical layer" framework)', 'cxl (compute express link)', 'various']
|
['comedi', 'adl_pci7x3x']
|
['c']
| 1
| 274
| 10
|
--- diff --git a/drivers/staging/comedi/drivers/adl_pci7x3x.c b/drivers/staging/comedi/drivers/adl_pci7x3x.c --- a/drivers/staging/comedi/drivers/adl_pci7x3x.c +++ b/drivers/staging/comedi/drivers/adl_pci7x3x.c - * updated: thu, 02 aug 2012 14:27:46 -0700 - * status: untested + * updated: fri, 20 nov 2020 14:49:36 +0000 + * status: works (tested on pci-7230) - * pci-7230 - 2 subdevices: 0 - 16 input, 1 - 16 output + * pci-7230 - 4 subdevices: 0 - 16 input, 1 - 16 output, + * 2 - irq_idi0, 3 - irq_idi1 - * lines of msb. interrupts are not currently supported by this - * driver. + * lines of msb. + * + * currently, this driver only supports interrupts for pci-7230. +#include "plx9052.h" + -#define pci7x3x_dio_reg 0x00 -#define pci743x_dio_reg 0x04 +#define pci7x3x_dio_reg 0x0000 /* in the digio port area */ +#define pci743x_dio_reg 0x0004 + +#define adl_pt_clrirq 0x0040 /* in the digio port area */ -enum apci1516_boardid { +#define linti1_en_act_idi0 (plx9052_intcsr_li1enab | plx9052_intcsr_li1stat) +#define linti2_en_act_idi1 (plx9052_intcsr_li2enab | plx9052_intcsr_li2stat) +#define en_pci_lint2h_lint1h \ + (plx9052_intcsr_pcienab | plx9052_intcsr_li2pol | plx9052_intcsr_li1pol) + +enum adl_pci7x3x_boardid { + int irq_nchan; - .nsubdevs = 2, + .nsubdevs = 4, /* idi, ido, irq_idi0, irq_idi1 */ + .irq_nchan = 2, +struct adl_pci7x3x_dev_private_data { + unsigned long lcr_io_base; + unsigned int int_ctrl; +}; + +struct adl_pci7x3x_sd_private_data { + spinlock_t subd_slock; /* spin-lock for cmd_running */ + unsigned long port_offset; + short int cmd_running; +}; + +static void process_irq(struct comedi_device *dev, unsigned int subdev, + unsigned short intcsr) +{ + struct comedi_subdevice *s = &dev->subdevices[subdev]; + struct adl_pci7x3x_sd_private_data *sd_priv = s->private; + unsigned long reg = sd_priv->port_offset; + struct comedi_async *async_p = s->async; + + if (async_p) { + unsigned short val = inw(dev->iobase + reg); + + spin_lock(&sd_priv->subd_slock); + if (sd_priv->cmd_running) + comedi_buf_write_samples(s, &val, 1); + spin_unlock(&sd_priv->subd_slock); + comedi_handle_events(dev, s); + } +} + +static irqreturn_t adl_pci7x3x_interrupt(int irq, void *p_device) +{ + struct comedi_device *dev = p_device; + struct adl_pci7x3x_dev_private_data *dev_private = dev->private; + unsigned long cpu_flags; + unsigned int intcsr; + bool li1stat, li2stat; + + if (!dev->attached) { + /* ignore interrupt before device fully attached. */ + /* might not even have allocated subdevices yet! */ + return irq_none; + } + + /* check if we are source of interrupt */ + spin_lock_irqsave(&dev->spinlock, cpu_flags); + intcsr = inl(dev_private->lcr_io_base + plx9052_intcsr); + li1stat = (intcsr & linti1_en_act_idi0) == linti1_en_act_idi0; + li2stat = (intcsr & linti2_en_act_idi1) == linti2_en_act_idi1; + if (li1stat || li2stat) { + /* clear all current interrupt flags */ + /* fixme: reset all 2 int flags */ + outb(0x00, dev->iobase + adl_pt_clrirq); + } + spin_unlock_irqrestore(&dev->spinlock, cpu_flags); + + /* subdev 2, 3 = isolated digin , on "scsi2" jack!*/ + + if (li1stat) /* 0x0005 linti1 is enabled && idi0 is 1 */ + process_irq(dev, 2, intcsr); + + if (li2stat) /* 0x0028 linti2 is enabled && idi1 is 1 */ + process_irq(dev, 3, intcsr); + + return irq_retval(li1stat || li2stat); +} + +static int adl_pci7x3x_asy_cmdtest(struct comedi_device *dev, + struct comedi_subdevice *s, + struct comedi_cmd *cmd) +{ + int err = 0; + + /* step 1 : check if triggers are trivially valid */ + + err |= comedi_check_trigger_src(&cmd->start_src, trig_now); + err |= comedi_check_trigger_src(&cmd->scan_begin_src, trig_ext); + err |= comedi_check_trigger_src(&cmd->convert_src, trig_follow); + err |= comedi_check_trigger_src(&cmd->scan_end_src, trig_count); + err |= comedi_check_trigger_src(&cmd->stop_src, trig_none); + + if (err) + return 1; + + /* step 2a : make sure trigger sources are unique */ + /* step 2b : and mutually compatible */ + + /* step 3: check if arguments are trivially valid */ + + err |= comedi_check_trigger_arg_is(&cmd->start_arg, 0); + err |= comedi_check_trigger_arg_is(&cmd->scan_begin_arg, 0); + err |= comedi_check_trigger_arg_is(&cmd->convert_arg, 0); + err |= comedi_check_trigger_arg_is(&cmd->scan_end_arg, + cmd->chanlist_len); + err |= comedi_check_trigger_arg_is(&cmd->stop_arg, 0); + + if (err) + return 3; + + /* step 4: fix up any arguments */ + + /* step 5: check channel list if it exists */ + + return 0; +} + +static int adl_pci7x3x_asy_cmd(struct comedi_device *dev, + struct comedi_subdevice *s) +{ + struct adl_pci7x3x_dev_private_data *dev_private = dev->private; + struct adl_pci7x3x_sd_private_data *sd_priv = s->private; + unsigned long cpu_flags; + unsigned int int_enab; + + if (s->index == 2) { + /* enable linti1 == idi sdi[0] ch 0 irq acthigh */ + int_enab = plx9052_intcsr_li1enab; + } else { + /* enable linti2 == idi sdi[0] ch 1 irq acthigh */ + int_enab = plx9052_intcsr_li2enab; + } + + spin_lock_irqsave(&dev->spinlock, cpu_flags); + dev_private->int_ctrl |= int_enab; + outl(dev_private->int_ctrl, dev_private->lcr_io_base + plx9052_intcsr); + spin_unlock_irqrestore(&dev->spinlock, cpu_flags); + + spin_lock_irqsave(&sd_priv->subd_slock, cpu_flags); + sd_priv->cmd_running = 1; + spin_unlock_irqrestore(&sd_priv->subd_slock, cpu_flags); + + return 0; +} + +static int adl_pci7x3x_asy_cancel(struct comedi_device *dev, + struct comedi_subdevice *s) +{ + struct adl_pci7x3x_dev_private_data *dev_private = dev->private; + struct adl_pci7x3x_sd_private_data *sd_priv = s->private; + unsigned long cpu_flags; + unsigned int int_enab; + + spin_lock_irqsave(&sd_priv->subd_slock, cpu_flags); + sd_priv->cmd_running = 0; + spin_unlock_irqrestore(&sd_priv->subd_slock, cpu_flags); + /* disable interrupts */ + if (s->index == 2) + int_enab = plx9052_intcsr_li1enab; + else + int_enab = plx9052_intcsr_li2enab; + spin_lock_irqsave(&dev->spinlock, cpu_flags); + dev_private->int_ctrl &= ~int_enab; + outl(dev_private->int_ctrl, dev_private->lcr_io_base + plx9052_intcsr); + spin_unlock_irqrestore(&dev->spinlock, cpu_flags); + + return 0; +} + +/* same as _di_insn_bits because the irq-pins are the di-ports */ +static int adl_pci7x3x_dirq_insn_bits(struct comedi_device *dev, + struct comedi_subdevice *s, + struct comedi_insn *insn, + unsigned int *data) +{ + struct adl_pci7x3x_sd_private_data *sd_priv = s->private; + unsigned long reg = (unsigned long)sd_priv->port_offset; + + data[1] = inl(dev->iobase + reg); + + return insn->n; +} + +static int adl_pci7x3x_reset(struct comedi_device *dev) +{ + struct adl_pci7x3x_dev_private_data *dev_private = dev->private; + + /* disable interrupts */ + dev_private->int_ctrl = 0x00; /* disable pci + linti2 + linti1 */ + outl(dev_private->int_ctrl, dev_private->lcr_io_base + plx9052_intcsr); + + return 0; +} + + struct adl_pci7x3x_dev_private_data *dev_private; + int ic; + dev_private = comedi_alloc_devpriv(dev, sizeof(*dev_private)); + if (!dev_private) + return -enomem; + + dev_private->lcr_io_base = pci_resource_start(pcidev, 1); + + adl_pci7x3x_reset(dev); + + if (board->irq_nchan) { + /* discard all evtl. old irqs */ + outb(0x00, dev->iobase + adl_pt_clrirq); + + if (pcidev->irq) { + ret = request_irq(pcidev->irq, adl_pci7x3x_interrupt, + irqf_shared, dev->board_name, dev); + if (ret == 0) { + dev->irq = pcidev->irq; + /* 0x52 pci + idi ch 1 ch 0 irq off acthigh */ + dev_private->int_ctrl = en_pci_lint2h_lint1h; + outl(dev_private->int_ctrl, + dev_private->lcr_io_base + plx9052_intcsr); + } + } + } + for (ic = 0; ic < board->irq_nchan; ++ic) { + struct adl_pci7x3x_sd_private_data *sd_priv; + + nchan = 1; + + s = &dev->subdevices[subdev]; + /* isolated digital inputs 0 or 1 */ + s->type = comedi_subd_di; + s->subdev_flags = sdf_readable; + s->n_chan = nchan; + s->maxdata = 1; + s->insn_bits = adl_pci7x3x_dirq_insn_bits; + s->range_table = &range_digital; + + sd_priv = comedi_alloc_spriv(s, sizeof(*sd_priv)); + if (!sd_priv) + return -enomem; + + spin_lock_init(&sd_priv->subd_slock); + sd_priv->port_offset = pci7x3x_dio_reg; + sd_priv->cmd_running = 0; + + if (dev->irq) { + dev->read_subdev = s; + s->type = comedi_subd_di; + s->subdev_flags = sdf_readable | sdf_cmd_read; + s->len_chanlist = 1; + s->do_cmdtest = adl_pci7x3x_asy_cmdtest; + s->do_cmd = adl_pci7x3x_asy_cmd; + s->cancel = adl_pci7x3x_asy_cancel; + } + + subdev++; + } + +static void adl_pci7x3x_detach(struct comedi_device *dev) +{ + if (dev->iobase) + adl_pci7x3x_reset(dev); + comedi_pci_detach(dev); +} + - .detach = comedi_pci_detach, + .detach = adl_pci7x3x_detach,
|
Drivers in the Staging area
|
115dbad485a72205c4b122fe43d8274c5ef68153
|
bernd harries
|
drivers
|
staging
|
comedi, drivers
|
staging: comedi: adv_pci_dio: add interrupt handling for pci-1730
|
on the advantech pci-1730, four digital inputs (di0, di1, idi0 and idi1) can be used as external interrupt sources. each input can be programmed to latch an interrupt bit on either a rising edge or a falling edge (but not both).
|
this release allows to map an uid to a different one in a mount; it also adds support for selecting the preemption model at runtime; support for a low-overhead memory error detector designed to be used in production; support for the acrn hypervisor designed for embedded systems; btrfs initial support for zoned devices, subpage blocks sizes and performance improvements; support for eager nfs writes; support for a thermal power management to control the surface temperature of embedded devices in an unified way; the napi polling can be moved to a kernel thread; and support for non-blocking path lookups. as always, there are many other features, new drivers, improvements and fixes.
|
add interrupt handling for pci-1730
|
['core (various)', 'file systems', 'memory management', 'block layer', 'tracing, perf and bpf', 'virtualization', 'cryptography', 'security', 'networking', 'architectures x86 arm risc-v powerpc mips csky s390 pa-risc c6x']
|
['graphics', 'power management', 'storage', 'drivers in the staging area', 'networking', 'audio', 'tablets, touch screens, keyboards, mouses', 'tv tuners, webcams, video capturers', 'universal serial bus', 'serial peripheral interface (spi)', 'watchdog', 'serial', 'cpu frequency scaling', 'device voltage and frequency scaling', 'voltage, current regulators, power capping, power supply', 'real time clock (rtc)', 'pin controllers (pinctrl)', 'multi media card (mmc)', 'memory technology devices (mtd)', 'industrial i/o (iio)', 'multi function devices (mfd)', 'pulse-width modulation (pwm)', 'inter-integrated circuit (i2c + i3c)', 'hardware monitoring (hwmon)', 'general purpose i/o (gpio)', 'leds', 'dma engines', 'cryptography hardware acceleration', 'pci', 'non-transparent bridge (ntb)', 'thunderbolt', 'clock', 'phy ("physical layer" framework)', 'cxl (compute express link)', 'various']
|
['comedi', 'adv_pci_dio']
|
['c']
| 1
| 261
| 12
|
--- diff --git a/drivers/staging/comedi/drivers/adv_pci_dio.c b/drivers/staging/comedi/drivers/adv_pci_dio.c --- a/drivers/staging/comedi/drivers/adv_pci_dio.c +++ b/drivers/staging/comedi/drivers/adv_pci_dio.c -#define pci173x_int_en_reg 0x08 /* r/w: enable/disable */ -#define pci173x_int_rf_reg 0x0c /* r/w: falling/rising edge */ -#define pci173x_int_clr_reg 0x10 /* r/w: clear */ +#define pci173x_int_en_reg 0x0008 /* r/w: enable/disable */ +#define pci173x_int_rf_reg 0x000c /* r/w: falling/rising edge */ +#define pci173x_int_flag_reg 0x0010 /* r: status */ +#define pci173x_int_clr_reg 0x0010 /* w: clear */ + +#define pci173x_int_idi0 0x01 /* idi0 edge occurred */ +#define pci173x_int_idi1 0x02 /* idi1 edge occurred */ +#define pci173x_int_di0 0x04 /* di0 edge occurred */ +#define pci173x_int_di1 0x08 /* di1 edge occurred */ +#define pci_dio_max_irq_subdevs 4 /* 4 x 1 input irq channels max */ - unsigned long addr; /* pci address ofset */ + unsigned long addr; /* pci address offset */ +}; + +struct dio_irq_subd_data { + unsigned short int_en; /* interrupt enable/status bit */ + unsigned long addr; /* pci address offset */ + struct dio_irq_subd_data sdirq[pci_dio_max_irq_subdevs]; - .nsubdevs = 5, + /* di, idi, do, ido, id, irq_di0, irq_di1, irq_idi0, irq_idi1 */ + .nsubdevs = 9, + .sdirq[0] = { pci173x_int_di0, 0x02, }, /* di 0 */ + .sdirq[1] = { pci173x_int_di1, 0x02, }, /* di 1 */ + .sdirq[2] = { pci173x_int_idi0, 0x00, }, /* iso di 0 */ + .sdirq[3] = { pci173x_int_idi1, 0x00, }, /* iso di 1 */ +struct pci_dio_dev_private_data { + int boardtype; + int irq_subd; + unsigned short int_ctrl; +}; + +struct pci_dio_sd_private_data { + spinlock_t subd_slock; /* spin-lock for cmd_running */ + unsigned long port_offset; + short int cmd_running; +}; + +static void process_irq(struct comedi_device *dev, unsigned int subdev, + unsigned char irqflags) +{ + struct comedi_subdevice *s = &dev->subdevices[subdev]; + struct pci_dio_sd_private_data *sd_priv = s->private; + unsigned long reg = sd_priv->port_offset; + struct comedi_async *async_p = s->async; + + if (async_p) { + unsigned short val = inw(dev->iobase + reg); + + spin_lock(&sd_priv->subd_slock); + if (sd_priv->cmd_running) + comedi_buf_write_samples(s, &val, 1); + spin_unlock(&sd_priv->subd_slock); + comedi_handle_events(dev, s); + } +} + +static irqreturn_t pci_dio_interrupt(int irq, void *p_device) +{ + struct comedi_device *dev = p_device; + struct pci_dio_dev_private_data *dev_private = dev->private; + const struct dio_boardtype *board = dev->board_ptr; + unsigned long cpu_flags; + unsigned char irqflags; + int i; + + if (!dev->attached) { + /* ignore interrupt before device fully attached. */ + /* might not even have allocated subdevices yet! */ + return irq_none; + } + + /* check if we are source of interrupt */ + spin_lock_irqsave(&dev->spinlock, cpu_flags); + irqflags = inb(dev->iobase + pci173x_int_flag_reg); + if (!(irqflags & 0x0f)) { + spin_unlock_irqrestore(&dev->spinlock, cpu_flags); + return irq_none; + } + + /* clear all current interrupt flags */ + outb(irqflags, dev->iobase + pci173x_int_clr_reg); + spin_unlock_irqrestore(&dev->spinlock, cpu_flags); + + /* check irq subdevice triggers */ + for (i = 0; i < pci_dio_max_irq_subdevs; i++) { + if (irqflags & board->sdirq[i].int_en) + process_irq(dev, dev_private->irq_subd + i, irqflags); + } + + return irq_handled; +} + +static int pci_dio_asy_cmdtest(struct comedi_device *dev, + struct comedi_subdevice *s, + struct comedi_cmd *cmd) +{ + int err = 0; + + /* step 1 : check if triggers are trivially valid */ + + err |= comedi_check_trigger_src(&cmd->start_src, trig_now); + err |= comedi_check_trigger_src(&cmd->scan_begin_src, trig_ext); + err |= comedi_check_trigger_src(&cmd->convert_src, trig_follow); + err |= comedi_check_trigger_src(&cmd->scan_end_src, trig_count); + err |= comedi_check_trigger_src(&cmd->stop_src, trig_none); + + if (err) + return 1; + + /* step 2a : make sure trigger sources are unique */ + /* step 2b : and mutually compatible */ + + /* step 3: check if arguments are trivially valid */ + + err |= comedi_check_trigger_arg_is(&cmd->start_arg, 0); + err |= comedi_check_trigger_arg_is(&cmd->scan_begin_arg, 0); + err |= comedi_check_trigger_arg_is(&cmd->convert_arg, 0); + err |= comedi_check_trigger_arg_is(&cmd->scan_end_arg, + cmd->chanlist_len); + err |= comedi_check_trigger_arg_is(&cmd->stop_arg, 0); + + if (err) + return 3; + + /* step 4: fix up any arguments */ + + /* step 5: check channel list if it exists */ + + return 0; +} + +static int pci_dio_asy_cmd(struct comedi_device *dev, + struct comedi_subdevice *s) +{ + struct pci_dio_dev_private_data *dev_private = dev->private; + struct pci_dio_sd_private_data *sd_priv = s->private; + const struct dio_boardtype *board = dev->board_ptr; + unsigned long cpu_flags; + unsigned short int_en; + + int_en = board->sdirq[s->index - dev_private->irq_subd].int_en; + + spin_lock_irqsave(&dev->spinlock, cpu_flags); + dev_private->int_ctrl |= int_en; /* enable interrupt source */ + outb(dev_private->int_ctrl, dev->iobase + pci173x_int_en_reg); + spin_unlock_irqrestore(&dev->spinlock, cpu_flags); + + spin_lock_irqsave(&sd_priv->subd_slock, cpu_flags); + sd_priv->cmd_running = 1; + spin_unlock_irqrestore(&sd_priv->subd_slock, cpu_flags); + + return 0; +} + +static int pci_dio_asy_cancel(struct comedi_device *dev, + struct comedi_subdevice *s) +{ + struct pci_dio_dev_private_data *dev_private = dev->private; + struct pci_dio_sd_private_data *sd_priv = s->private; + const struct dio_boardtype *board = dev->board_ptr; + unsigned long cpu_flags; + unsigned short int_en; + + spin_lock_irqsave(&sd_priv->subd_slock, cpu_flags); + sd_priv->cmd_running = 0; + spin_unlock_irqrestore(&sd_priv->subd_slock, cpu_flags); + + int_en = board->sdirq[s->index - dev_private->irq_subd].int_en; + + spin_lock_irqsave(&dev->spinlock, cpu_flags); + dev_private->int_ctrl &= ~int_en; + outb(dev_private->int_ctrl, dev->iobase + pci173x_int_en_reg); + spin_unlock_irqrestore(&dev->spinlock, cpu_flags); + + return 0; +} + +/* same as _insn_bits_di_ because the irq-pins are the di-ports */ +static int pci_dio_insn_bits_dirq_b(struct comedi_device *dev, + struct comedi_subdevice *s, + struct comedi_insn *insn, + unsigned int *data) +{ + struct pci_dio_sd_private_data *sd_priv = s->private; + unsigned long reg = (unsigned long)sd_priv->port_offset; + unsigned long iobase = dev->iobase + reg; + + data[1] = inb(iobase); + + return insn->n; +} + + struct pci_dio_dev_private_data *dev_private = dev->private; - outb(0, dev->iobase + pci173x_int_en_reg); + dev_private->int_ctrl = 0x00; + outb(dev_private->int_ctrl, dev->iobase + pci173x_int_en_reg); + /* reset all 4 int flags */ - outb(0, dev->iobase + pci173x_int_rf_reg); + /* rising edge => irq . on all 4 pins */ + outb(0x00, dev->iobase + pci173x_int_rf_reg); - const struct diosubd_data *d; + struct pci_dio_dev_private_data *dev_private; + dev_private = comedi_alloc_devpriv(dev, sizeof(*dev_private)); + if (!dev_private) + return -enomem; + + dev_private->boardtype = context; + /* request irq if device has irq subdevices */ + if (board->sdirq[0].int_en && pcidev->irq) { + ret = request_irq(pcidev->irq, pci_dio_interrupt, irqf_shared, + dev->board_name, dev); + if (ret == 0) + dev->irq = pcidev->irq; + } + - d = &board->sdi[i]; + const struct diosubd_data *d = &board->sdi[i]; + + - d = &board->sdo[i]; + const struct diosubd_data *d = &board->sdo[i]; + - d = &board->sdio[i]; + const struct diosubd_data *d = &board->sdio[i]; + + dev_private->irq_subd = subdev; /* first interrupt subdevice index */ + for (i = 0; i < pci_dio_max_irq_subdevs; ++i) { + struct pci_dio_sd_private_data *sd_priv = null; + const struct dio_irq_subd_data *d = &board->sdirq[i]; + + if (d->int_en) { + s = &dev->subdevices[subdev++]; + s->type = comedi_subd_di; + s->subdev_flags = sdf_readable; + s->n_chan = 1; + s->maxdata = 1; + s->range_table = &range_digital; + s->insn_bits = pci_dio_insn_bits_dirq_b; + sd_priv = comedi_alloc_spriv(s, sizeof(*sd_priv)); + if (!sd_priv) + return -enomem; + + spin_lock_init(&sd_priv->subd_slock); + sd_priv->port_offset = d->addr; + sd_priv->cmd_running = 0; + + if (dev->irq) { + dev->read_subdev = s; + s->type = comedi_subd_di; + s->subdev_flags = sdf_readable | sdf_cmd_read; + s->len_chanlist = 1; + s->do_cmdtest = pci_dio_asy_cmdtest; + s->do_cmd = pci_dio_asy_cmd; + s->cancel = pci_dio_asy_cancel; + } + } + } + +static void pci_dio_detach(struct comedi_device *dev) +{ + struct pci_dio_dev_private_data *dev_private = dev->private; + int boardtype = dev_private->boardtype; + + if (dev->iobase) + pci_dio_reset(dev, boardtype); + comedi_pci_detach(dev); +} + - .detach = comedi_pci_detach, + .detach = pci_dio_detach,
|
Drivers in the Staging area
|
2e0e629d0f62541d0f82f6e3f7a64aab8fb3e989
|
bernd harries
|
drivers
|
staging
|
comedi, drivers
|
staging: qlge: coredump via devlink health reporter
|
$ devlink health dump show device reporter coredump -p -j { "core registers": { "segment": 1, "values": [ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ] }, "test logic regs": { "segment": 2, "values": [ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ] }, "rmii registers": { "segment": 3, "values": [ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ] }, ... "sem registers": { "segment": 50, "values": [ 0,0,0,0 ] } }
|
this release allows to map an uid to a different one in a mount; it also adds support for selecting the preemption model at runtime; support for a low-overhead memory error detector designed to be used in production; support for the acrn hypervisor designed for embedded systems; btrfs initial support for zoned devices, subpage blocks sizes and performance improvements; support for eager nfs writes; support for a thermal power management to control the surface temperature of embedded devices in an unified way; the napi polling can be moved to a kernel thread; and support for non-blocking path lookups. as always, there are many other features, new drivers, improvements and fixes.
|
coredump via devlink health reporter
|
['core (various)', 'file systems', 'memory management', 'block layer', 'tracing, perf and bpf', 'virtualization', 'cryptography', 'security', 'networking', 'architectures x86 arm risc-v powerpc mips csky s390 pa-risc c6x']
|
['graphics', 'power management', 'storage', 'drivers in the staging area', 'networking', 'audio', 'tablets, touch screens, keyboards, mouses', 'tv tuners, webcams, video capturers', 'universal serial bus', 'serial peripheral interface (spi)', 'watchdog', 'serial', 'cpu frequency scaling', 'device voltage and frequency scaling', 'voltage, current regulators, power capping, power supply', 'real time clock (rtc)', 'pin controllers (pinctrl)', 'multi media card (mmc)', 'memory technology devices (mtd)', 'industrial i/o (iio)', 'multi function devices (mfd)', 'pulse-width modulation (pwm)', 'inter-integrated circuit (i2c + i3c)', 'hardware monitoring (hwmon)', 'general purpose i/o (gpio)', 'leds', 'dma engines', 'cryptography hardware acceleration', 'pci', 'non-transparent bridge (ntb)', 'thunderbolt', 'clock', 'phy ("physical layer" framework)', 'cxl (compute express link)', 'various']
|
['qlge']
|
['c']
| 1
| 126
| 6
|
--- diff --git a/drivers/staging/qlge/qlge_devlink.c b/drivers/staging/qlge/qlge_devlink.c --- a/drivers/staging/qlge/qlge_devlink.c +++ b/drivers/staging/qlge/qlge_devlink.c -static int -qlge_reporter_coredump(struct devlink_health_reporter *reporter, - struct devlink_fmsg *fmsg, void *priv_ctx, - struct netlink_ext_ack *extack) +static int qlge_fill_seg_(struct devlink_fmsg *fmsg, + struct mpi_coredump_segment_header *seg_header, + u32 *reg_data) - return 0; + int regs_num = (seg_header->seg_size + - sizeof(struct mpi_coredump_segment_header)) / sizeof(u32); + int err; + int i; + + err = devlink_fmsg_pair_nest_start(fmsg, seg_header->description); + if (err) + return err; + err = devlink_fmsg_obj_nest_start(fmsg); + if (err) + return err; + err = devlink_fmsg_u32_pair_put(fmsg, "segment", seg_header->seg_num); + if (err) + return err; + err = devlink_fmsg_arr_pair_nest_start(fmsg, "values"); + if (err) + return err; + for (i = 0; i < regs_num; i++) { + err = devlink_fmsg_u32_put(fmsg, *reg_data); + if (err) + return err; + reg_data++; + } + err = devlink_fmsg_obj_nest_end(fmsg); + if (err) + return err; + err = devlink_fmsg_arr_pair_nest_end(fmsg); + if (err) + return err; + err = devlink_fmsg_pair_nest_end(fmsg); + return err; +} + +#define fill_seg(seg_hdr, seg_regs) \ + do { \ + err = qlge_fill_seg_(fmsg, &dump->seg_hdr, dump->seg_regs); \ + if (err) { \ + kvfree(dump); \ + return err; \ + } \ + } while (0) + +static int qlge_reporter_coredump(struct devlink_health_reporter *reporter, + struct devlink_fmsg *fmsg, void *priv_ctx, + struct netlink_ext_ack *extack) +{ + int err = 0; + + struct qlge_adapter *qdev = devlink_health_reporter_priv(reporter); + struct qlge_mpi_coredump *dump; + + if (!netif_running(qdev->ndev)) + return 0; + + dump = kvmalloc(sizeof(*dump), gfp_kernel); + if (!dump) + return -enomem; + + err = qlge_core_dump(qdev, dump); + if (err) { + kvfree(dump); + return err; + } + + qlge_soft_reset_mpi_risc(qdev); + + fill_seg(core_regs_seg_hdr, mpi_core_regs); + fill_seg(test_logic_regs_seg_hdr, test_logic_regs); + fill_seg(rmii_regs_seg_hdr, rmii_regs); + fill_seg(fcmac1_regs_seg_hdr, fcmac1_regs); + fill_seg(fcmac2_regs_seg_hdr, fcmac2_regs); + fill_seg(fc1_mbx_regs_seg_hdr, fc1_mbx_regs); + fill_seg(ide_regs_seg_hdr, ide_regs); + fill_seg(nic1_mbx_regs_seg_hdr, nic1_mbx_regs); + fill_seg(smbus_regs_seg_hdr, smbus_regs); + fill_seg(fc2_mbx_regs_seg_hdr, fc2_mbx_regs); + fill_seg(nic2_mbx_regs_seg_hdr, nic2_mbx_regs); + fill_seg(i2c_regs_seg_hdr, i2c_regs); + fill_seg(memc_regs_seg_hdr, memc_regs); + fill_seg(pbus_regs_seg_hdr, pbus_regs); + fill_seg(mde_regs_seg_hdr, mde_regs); + fill_seg(nic_regs_seg_hdr, nic_regs); + fill_seg(nic2_regs_seg_hdr, nic2_regs); + fill_seg(xgmac1_seg_hdr, xgmac1); + fill_seg(xgmac2_seg_hdr, xgmac2); + fill_seg(code_ram_seg_hdr, code_ram); + fill_seg(memc_ram_seg_hdr, memc_ram); + fill_seg(xaui_an_hdr, serdes_xaui_an); + fill_seg(xaui_hss_pcs_hdr, serdes_xaui_hss_pcs); + fill_seg(xfi_an_hdr, serdes_xfi_an); + fill_seg(xfi_train_hdr, serdes_xfi_train); + fill_seg(xfi_hss_pcs_hdr, serdes_xfi_hss_pcs); + fill_seg(xfi_hss_tx_hdr, serdes_xfi_hss_tx); + fill_seg(xfi_hss_rx_hdr, serdes_xfi_hss_rx); + fill_seg(xfi_hss_pll_hdr, serdes_xfi_hss_pll); + + err = qlge_fill_seg_(fmsg, &dump->misc_nic_seg_hdr, + (u32 *)&dump->misc_nic_info); + if (err) { + kvfree(dump); + return err; + } + + fill_seg(intr_states_seg_hdr, intr_states); + fill_seg(cam_entries_seg_hdr, cam_entries); + fill_seg(nic_routing_words_seg_hdr, nic_routing_words); + fill_seg(ets_seg_hdr, ets); + fill_seg(probe_dump_seg_hdr, probe_dump); + fill_seg(routing_reg_seg_hdr, routing_regs); + fill_seg(mac_prot_reg_seg_hdr, mac_prot_regs); + fill_seg(xaui2_an_hdr, serdes2_xaui_an); + fill_seg(xaui2_hss_pcs_hdr, serdes2_xaui_hss_pcs); + fill_seg(xfi2_an_hdr, serdes2_xfi_an); + fill_seg(xfi2_train_hdr, serdes2_xfi_train); + fill_seg(xfi2_hss_pcs_hdr, serdes2_xfi_hss_pcs); + fill_seg(xfi2_hss_tx_hdr, serdes2_xfi_hss_tx); + fill_seg(xfi2_hss_rx_hdr, serdes2_xfi_hss_rx); + fill_seg(xfi2_hss_pll_hdr, serdes2_xfi_hss_pll); + fill_seg(sem_regs_seg_hdr, sem_regs); + + kvfree(dump); + return err; - .name = "dummy", + .name = "coredump",
|
Drivers in the Staging area
|
1053c27804dfad0eb247ab3c16d5f61d9aba5562
|
coiby xu
|
drivers
|
staging
|
qlge
|
staging: qlge: support force_coredump option for devlink health dump
|
with force_coredump module parameter set, devlink health dump will reset the mpi risc first which takes 5 secs to be finished.
|
this release allows to map an uid to a different one in a mount; it also adds support for selecting the preemption model at runtime; support for a low-overhead memory error detector designed to be used in production; support for the acrn hypervisor designed for embedded systems; btrfs initial support for zoned devices, subpage blocks sizes and performance improvements; support for eager nfs writes; support for a thermal power management to control the surface temperature of embedded devices in an unified way; the napi polling can be moved to a kernel thread; and support for non-blocking path lookups. as always, there are many other features, new drivers, improvements and fixes.
|
support force_coredump option for devlink health dump
|
['core (various)', 'file systems', 'memory management', 'block layer', 'tracing, perf and bpf', 'virtualization', 'cryptography', 'security', 'networking', 'architectures x86 arm risc-v powerpc mips csky s390 pa-risc c6x']
|
['graphics', 'power management', 'storage', 'drivers in the staging area', 'networking', 'audio', 'tablets, touch screens, keyboards, mouses', 'tv tuners, webcams, video capturers', 'universal serial bus', 'serial peripheral interface (spi)', 'watchdog', 'serial', 'cpu frequency scaling', 'device voltage and frequency scaling', 'voltage, current regulators, power capping, power supply', 'real time clock (rtc)', 'pin controllers (pinctrl)', 'multi media card (mmc)', 'memory technology devices (mtd)', 'industrial i/o (iio)', 'multi function devices (mfd)', 'pulse-width modulation (pwm)', 'inter-integrated circuit (i2c + i3c)', 'hardware monitoring (hwmon)', 'general purpose i/o (gpio)', 'leds', 'dma engines', 'cryptography hardware acceleration', 'pci', 'non-transparent bridge (ntb)', 'thunderbolt', 'clock', 'phy ("physical layer" framework)', 'cxl (compute express link)', 'various']
|
['qlge']
|
['c']
| 1
| 13
| 0
|
--- diff --git a/drivers/staging/qlge/qlge_devlink.c b/drivers/staging/qlge/qlge_devlink.c --- a/drivers/staging/qlge/qlge_devlink.c +++ b/drivers/staging/qlge/qlge_devlink.c + wait_queue_head_t wait; + if (test_bit(ql_frc_coredump, &qdev->flags)) { + if (qlge_own_firmware(qdev)) { + qlge_queue_fw_error(qdev); + init_waitqueue_head(&wait); + wait_event_timeout(wait, 0, 5 * hz); + } else { + netif_err(qdev, ifup, qdev->ndev, + "force coredump failed because this nic function doesn't own the firmware "); + return -eperm; + } + } +
|
Drivers in the Staging area
|
2352cf40fb7c8c1407534767551f9ead6a736f20
|
coiby xu
|
drivers
|
staging
|
qlge
|
staging: rtl8188eu: add edimax ew-7811un v2 to device table
|
the edimax ew-7811un v2 uses an rtl8188eu chipset and works with this driver.
|
this release allows to map an uid to a different one in a mount; it also adds support for selecting the preemption model at runtime; support for a low-overhead memory error detector designed to be used in production; support for the acrn hypervisor designed for embedded systems; btrfs initial support for zoned devices, subpage blocks sizes and performance improvements; support for eager nfs writes; support for a thermal power management to control the surface temperature of embedded devices in an unified way; the napi polling can be moved to a kernel thread; and support for non-blocking path lookups. as always, there are many other features, new drivers, improvements and fixes.
|
add edimax ew-7811un v2 to device table
|
['core (various)', 'file systems', 'memory management', 'block layer', 'tracing, perf and bpf', 'virtualization', 'cryptography', 'security', 'networking', 'architectures x86 arm risc-v powerpc mips csky s390 pa-risc c6x']
|
['graphics', 'power management', 'storage', 'drivers in the staging area', 'networking', 'audio', 'tablets, touch screens, keyboards, mouses', 'tv tuners, webcams, video capturers', 'universal serial bus', 'serial peripheral interface (spi)', 'watchdog', 'serial', 'cpu frequency scaling', 'device voltage and frequency scaling', 'voltage, current regulators, power capping, power supply', 'real time clock (rtc)', 'pin controllers (pinctrl)', 'multi media card (mmc)', 'memory technology devices (mtd)', 'industrial i/o (iio)', 'multi function devices (mfd)', 'pulse-width modulation (pwm)', 'inter-integrated circuit (i2c + i3c)', 'hardware monitoring (hwmon)', 'general purpose i/o (gpio)', 'leds', 'dma engines', 'cryptography hardware acceleration', 'pci', 'non-transparent bridge (ntb)', 'thunderbolt', 'clock', 'phy ("physical layer" framework)', 'cxl (compute express link)', 'various']
|
['rtl8188eu']
|
['c']
| 1
| 1
| 0
|
--- diff --git a/drivers/staging/rtl8188eu/os_dep/usb_intf.c b/drivers/staging/rtl8188eu/os_dep/usb_intf.c --- a/drivers/staging/rtl8188eu/os_dep/usb_intf.c +++ b/drivers/staging/rtl8188eu/os_dep/usb_intf.c + {usb_device(0x7392, 0xb811)}, /* edimax ew-7811un v2 */
|
Drivers in the Staging area
|
7a8d2f1908a59003e55ef8691d09efb7fbc51625
|
martin kaiser
|
drivers
|
staging
|
os_dep, rtl8188eu
|
media: staging: media: imx: kconfig: support video_imx7_csi for imx8m
|
as described in nxps' linux tree, the imx8m soc includes the same csi bridge hardware that is part of imx7d. we should be able to use the "fsl,imx7-csi" driver for imx8m directly.
|
this release allows to map an uid to a different one in a mount; it also adds support for selecting the preemption model at runtime; support for a low-overhead memory error detector designed to be used in production; support for the acrn hypervisor designed for embedded systems; btrfs initial support for zoned devices, subpage blocks sizes and performance improvements; support for eager nfs writes; support for a thermal power management to control the surface temperature of embedded devices in an unified way; the napi polling can be moved to a kernel thread; and support for non-blocking path lookups. as always, there are many other features, new drivers, improvements and fixes.
|
support video_imx7_csi for imx8m
|
['core (various)', 'file systems', 'memory management', 'block layer', 'tracing, perf and bpf', 'virtualization', 'cryptography', 'security', 'networking', 'architectures x86 arm risc-v powerpc mips csky s390 pa-risc c6x']
|
['graphics', 'power management', 'storage', 'drivers in the staging area', 'networking', 'audio', 'tablets, touch screens, keyboards, mouses', 'tv tuners, webcams, video capturers', 'universal serial bus', 'serial peripheral interface (spi)', 'watchdog', 'serial', 'cpu frequency scaling', 'device voltage and frequency scaling', 'voltage, current regulators, power capping, power supply', 'real time clock (rtc)', 'pin controllers (pinctrl)', 'multi media card (mmc)', 'memory technology devices (mtd)', 'industrial i/o (iio)', 'multi function devices (mfd)', 'pulse-width modulation (pwm)', 'inter-integrated circuit (i2c + i3c)', 'hardware monitoring (hwmon)', 'general purpose i/o (gpio)', 'leds', 'dma engines', 'cryptography hardware acceleration', 'pci', 'non-transparent bridge (ntb)', 'thunderbolt', 'clock', 'phy ("physical layer" framework)', 'cxl (compute express link)', 'various']
|
['staging', 'media', 'imx', 'kconfig']
|
['kconfig', 'makefile']
| 2
| 6
| 5
|
--- diff --git a/drivers/staging/media/imx/kconfig b/drivers/staging/media/imx/kconfig --- a/drivers/staging/media/imx/kconfig +++ b/drivers/staging/media/imx/kconfig - depends on video_v4l2 && imx_ipuv3_core + depends on video_v4l2 -menu "i.mx5/6/7 media sub devices" +menu "i.mx5/6/7/8 media sub devices" + depends on imx_ipuv3_core - tristate "i.mx6ul/l / i.mx7 camera sensor interface driver" + tristate "i.mx6ul/l / i.mx7 / i.mx8m camera sensor interface driver" - i.mx6ul/l or i.mx7. + i.mx6ul/l, i.mx7 or i.mx8m. diff --git a/drivers/staging/media/imx/makefile b/drivers/staging/media/imx/makefile --- a/drivers/staging/media/imx/makefile +++ b/drivers/staging/media/imx/makefile -obj-$(config_video_imx_media) += imx6-media.o +obj-$(config_video_imx_csi) += imx6-media.o
|
Drivers in the Staging area
|
b9dbfebb18ef2def4966eb6d10a04d0cf83d29a3
|
martin kepplinger
|
drivers
|
staging
|
imx, media
|
media: tegra-video: use zero crop settings if subdev has no get_selection
|
currently try format implementation doesn't check if subdevice has get_selection ops implemented and returns -einval on error from direct v4l2_subdev_call of get_selection.
|
this release allows to map an uid to a different one in a mount; it also adds support for selecting the preemption model at runtime; support for a low-overhead memory error detector designed to be used in production; support for the acrn hypervisor designed for embedded systems; btrfs initial support for zoned devices, subpage blocks sizes and performance improvements; support for eager nfs writes; support for a thermal power management to control the surface temperature of embedded devices in an unified way; the napi polling can be moved to a kernel thread; and support for non-blocking path lookups. as always, there are many other features, new drivers, improvements and fixes.
|
add support for capturing from hdmi-to-csi bridge
|
['core (various)', 'file systems', 'memory management', 'block layer', 'tracing, perf and bpf', 'virtualization', 'cryptography', 'security', 'networking', 'architectures x86 arm risc-v powerpc mips csky s390 pa-risc c6x']
|
['graphics', 'power management', 'storage', 'drivers in the staging area', 'networking', 'audio', 'tablets, touch screens, keyboards, mouses', 'tv tuners, webcams, video capturers', 'universal serial bus', 'serial peripheral interface (spi)', 'watchdog', 'serial', 'cpu frequency scaling', 'device voltage and frequency scaling', 'voltage, current regulators, power capping, power supply', 'real time clock (rtc)', 'pin controllers (pinctrl)', 'multi media card (mmc)', 'memory technology devices (mtd)', 'industrial i/o (iio)', 'multi function devices (mfd)', 'pulse-width modulation (pwm)', 'inter-integrated circuit (i2c + i3c)', 'hardware monitoring (hwmon)', 'general purpose i/o (gpio)', 'leds', 'dma engines', 'cryptography hardware acceleration', 'pci', 'non-transparent bridge (ntb)', 'thunderbolt', 'clock', 'phy ("physical layer" framework)', 'cxl (compute express link)', 'various']
|
['tegra-video']
|
['c']
| 1
| 12
| 5
|
--- diff --git a/drivers/staging/media/tegra-video/vi.c b/drivers/staging/media/tegra-video/vi.c --- a/drivers/staging/media/tegra-video/vi.c +++ b/drivers/staging/media/tegra-video/vi.c - ret = v4l2_subdev_call(subdev, pad, get_selection, null, &sdsel); - if (ret) - return -einval; - pad_cfg->try_crop.width = sdsel.r.width; - pad_cfg->try_crop.height = sdsel.r.height; + if (!v4l2_subdev_has_op(subdev, pad, get_selection)) { + pad_cfg->try_crop.width = 0; + pad_cfg->try_crop.height = 0; + } else { + ret = v4l2_subdev_call(subdev, pad, get_selection, + null, &sdsel); + if (ret) + return -einval; + + pad_cfg->try_crop.width = sdsel.r.width; + pad_cfg->try_crop.height = sdsel.r.height; + }
|
Drivers in the Staging area
|
56f64b82356b7494ca58d31652317c2f009d8ca1
|
sowjanya komatineni
|
drivers
|
staging
|
media, tegra-video
|
media: tegra-video: enable vi pixel transform for yuv and rgb formats
|
vi pixel transforms converts source pixel data to selected destination pixel formats in memory and aligns properly.
|
this release allows to map an uid to a different one in a mount; it also adds support for selecting the preemption model at runtime; support for a low-overhead memory error detector designed to be used in production; support for the acrn hypervisor designed for embedded systems; btrfs initial support for zoned devices, subpage blocks sizes and performance improvements; support for eager nfs writes; support for a thermal power management to control the surface temperature of embedded devices in an unified way; the napi polling can be moved to a kernel thread; and support for non-blocking path lookups. as always, there are many other features, new drivers, improvements and fixes.
|
add support for capturing from hdmi-to-csi bridge
|
['core (various)', 'file systems', 'memory management', 'block layer', 'tracing, perf and bpf', 'virtualization', 'cryptography', 'security', 'networking', 'architectures x86 arm risc-v powerpc mips csky s390 pa-risc c6x']
|
['graphics', 'power management', 'storage', 'drivers in the staging area', 'networking', 'audio', 'tablets, touch screens, keyboards, mouses', 'tv tuners, webcams, video capturers', 'universal serial bus', 'serial peripheral interface (spi)', 'watchdog', 'serial', 'cpu frequency scaling', 'device voltage and frequency scaling', 'voltage, current regulators, power capping, power supply', 'real time clock (rtc)', 'pin controllers (pinctrl)', 'multi media card (mmc)', 'memory technology devices (mtd)', 'industrial i/o (iio)', 'multi function devices (mfd)', 'pulse-width modulation (pwm)', 'inter-integrated circuit (i2c + i3c)', 'hardware monitoring (hwmon)', 'general purpose i/o (gpio)', 'leds', 'dma engines', 'cryptography hardware acceleration', 'pci', 'non-transparent bridge (ntb)', 'thunderbolt', 'clock', 'phy ("physical layer" framework)', 'cxl (compute express link)', 'various']
|
['tegra-video']
|
['c']
| 1
| 14
| 1
|
--- diff --git a/drivers/staging/media/tegra-video/tegra210.c b/drivers/staging/media/tegra-video/tegra210.c --- a/drivers/staging/media/tegra-video/tegra210.c +++ b/drivers/staging/media/tegra-video/tegra210.c + u32 bypass_pixel_transform = bit(bypass_pxl_transform_offset); + + /* + * vi pixel transformation unit converts source pixels data format + * into selected destination pixel format and aligns properly while + * interfacing with memory packer. + * this pixel transformation should be enabled for yuv and rgb + * formats and should be bypassed for raw formats as raw formats + * only support direct to memory. + */ + if (chan->pg_mode || data_type == tegra_image_dt_yuv422_8 || + data_type == tegra_image_dt_rgb888) + bypass_pixel_transform = 0; - ((chan->pg_mode ? 0 : 1) << bypass_pxl_transform_offset) | + bypass_pixel_transform |
|
Drivers in the Staging area
|
c1bcc54728253a83dd61b27b9da553116ae433be
|
sowjanya komatineni
|
drivers
|
staging
|
media, tegra-video
|
media: tegra-video: fix v4l2 pixel format rgb and yuv
|
v4l2 pixel format is incorrect for rgb and yuv formats.
|
this release allows to map an uid to a different one in a mount; it also adds support for selecting the preemption model at runtime; support for a low-overhead memory error detector designed to be used in production; support for the acrn hypervisor designed for embedded systems; btrfs initial support for zoned devices, subpage blocks sizes and performance improvements; support for eager nfs writes; support for a thermal power management to control the surface temperature of embedded devices in an unified way; the napi polling can be moved to a kernel thread; and support for non-blocking path lookups. as always, there are many other features, new drivers, improvements and fixes.
|
add support for capturing from hdmi-to-csi bridge
|
['core (various)', 'file systems', 'memory management', 'block layer', 'tracing, perf and bpf', 'virtualization', 'cryptography', 'security', 'networking', 'architectures x86 arm risc-v powerpc mips csky s390 pa-risc c6x']
|
['graphics', 'power management', 'storage', 'drivers in the staging area', 'networking', 'audio', 'tablets, touch screens, keyboards, mouses', 'tv tuners, webcams, video capturers', 'universal serial bus', 'serial peripheral interface (spi)', 'watchdog', 'serial', 'cpu frequency scaling', 'device voltage and frequency scaling', 'voltage, current regulators, power capping, power supply', 'real time clock (rtc)', 'pin controllers (pinctrl)', 'multi media card (mmc)', 'memory technology devices (mtd)', 'industrial i/o (iio)', 'multi function devices (mfd)', 'pulse-width modulation (pwm)', 'inter-integrated circuit (i2c + i3c)', 'hardware monitoring (hwmon)', 'general purpose i/o (gpio)', 'leds', 'dma engines', 'cryptography hardware acceleration', 'pci', 'non-transparent bridge (ntb)', 'thunderbolt', 'clock', 'phy ("physical layer" framework)', 'cxl (compute express link)', 'various']
|
['tegra-video']
|
['c']
| 1
| 10
| 10
|
--- diff --git a/drivers/staging/media/tegra-video/tegra210.c b/drivers/staging/media/tegra-video/tegra210.c --- a/drivers/staging/media/tegra-video/tegra210.c +++ b/drivers/staging/media/tegra-video/tegra210.c - tegra210_video_fmt(rgb888, 24, rgb888_1x24, 4, t_a8r8g8b8, rgb24), + tegra210_video_fmt(rgb888, 24, rgb888_1x24, 4, t_a8r8g8b8, xbgr32), - xbgr32), + rgbx32), - tegra210_video_fmt(yuv422_8, 16, uyvy8_1x16, 2, t_u8_y8__v8_y8, uyvy), - tegra210_video_fmt(yuv422_8, 16, vyuy8_1x16, 2, t_v8_y8__u8_y8, vyuy), - tegra210_video_fmt(yuv422_8, 16, yuyv8_1x16, 2, t_y8_u8__y8_v8, yuyv), - tegra210_video_fmt(yuv422_8, 16, yvyu8_1x16, 2, t_y8_v8__y8_u8, yvyu), + tegra210_video_fmt(yuv422_8, 16, uyvy8_1x16, 2, t_u8_y8__v8_y8, yvyu), + tegra210_video_fmt(yuv422_8, 16, vyuy8_1x16, 2, t_v8_y8__u8_y8, yuyv), + tegra210_video_fmt(yuv422_8, 16, yuyv8_1x16, 2, t_y8_u8__y8_v8, vyuy), + tegra210_video_fmt(yuv422_8, 16, yvyu8_1x16, 2, t_y8_v8__y8_u8, uyvy), - tegra210_video_fmt(yuv422_8, 16, uyvy8_2x8, 2, t_u8_y8__v8_y8, uyvy), - tegra210_video_fmt(yuv422_8, 16, vyuy8_2x8, 2, t_v8_y8__u8_y8, vyuy), - tegra210_video_fmt(yuv422_8, 16, yuyv8_2x8, 2, t_y8_u8__y8_v8, yuyv), - tegra210_video_fmt(yuv422_8, 16, yvyu8_2x8, 2, t_y8_v8__y8_u8, yvyu), + tegra210_video_fmt(yuv422_8, 16, uyvy8_2x8, 2, t_u8_y8__v8_y8, yvyu), + tegra210_video_fmt(yuv422_8, 16, vyuy8_2x8, 2, t_v8_y8__u8_y8, yuyv), + tegra210_video_fmt(yuv422_8, 16, yuyv8_2x8, 2, t_y8_u8__y8_v8, vyuy), + tegra210_video_fmt(yuv422_8, 16, yvyu8_2x8, 2, t_y8_v8__y8_u8, uyvy),
|
Drivers in the Staging area
|
689bfcac95d5ab17ba27fc9a423e7f676ed38fab
|
sowjanya komatineni
|
drivers
|
staging
|
media, tegra-video
|
media: tegra-video: add support for v4l2_pix_fmt_nv16
|
nv16 are two-plane versions of yuv422 format.
|
this release allows to map an uid to a different one in a mount; it also adds support for selecting the preemption model at runtime; support for a low-overhead memory error detector designed to be used in production; support for the acrn hypervisor designed for embedded systems; btrfs initial support for zoned devices, subpage blocks sizes and performance improvements; support for eager nfs writes; support for a thermal power management to control the surface temperature of embedded devices in an unified way; the napi polling can be moved to a kernel thread; and support for non-blocking path lookups. as always, there are many other features, new drivers, improvements and fixes.
|
add support for capturing from hdmi-to-csi bridge
|
['core (various)', 'file systems', 'memory management', 'block layer', 'tracing, perf and bpf', 'virtualization', 'cryptography', 'security', 'networking', 'architectures x86 arm risc-v powerpc mips csky s390 pa-risc c6x']
|
['graphics', 'power management', 'storage', 'drivers in the staging area', 'networking', 'audio', 'tablets, touch screens, keyboards, mouses', 'tv tuners, webcams, video capturers', 'universal serial bus', 'serial peripheral interface (spi)', 'watchdog', 'serial', 'cpu frequency scaling', 'device voltage and frequency scaling', 'voltage, current regulators, power capping, power supply', 'real time clock (rtc)', 'pin controllers (pinctrl)', 'multi media card (mmc)', 'memory technology devices (mtd)', 'industrial i/o (iio)', 'multi function devices (mfd)', 'pulse-width modulation (pwm)', 'inter-integrated circuit (i2c + i3c)', 'hardware monitoring (hwmon)', 'general purpose i/o (gpio)', 'leds', 'dma engines', 'cryptography hardware acceleration', 'pci', 'non-transparent bridge (ntb)', 'thunderbolt', 'clock', 'phy ("physical layer" framework)', 'cxl (compute express link)', 'various']
|
['tegra-video']
|
['c']
| 2
| 15
| 0
|
--- diff --git a/drivers/staging/media/tegra-video/tegra210.c b/drivers/staging/media/tegra-video/tegra210.c --- a/drivers/staging/media/tegra-video/tegra210.c +++ b/drivers/staging/media/tegra-video/tegra210.c + u32 sizeimage = chan->format.sizeimage; + /* + * program surface 1 for uv plane with offset sizeimage from y plane. + */ + if (chan->fmtinfo->fourcc == v4l2_pix_fmt_nv16) { + vi_csi_write(chan, tegra_vi_csi_surface1_offset_msb, + ((u64)buf->addr + sizeimage / 2) >> 32); + vi_csi_write(chan, tegra_vi_csi_surface1_offset_lsb, + buf->addr + sizeimage / 2); + vi_csi_write(chan, tegra_vi_csi_surface1_stride, + bytes_per_line); + } + diff --git a/drivers/staging/media/tegra-video/vi.c b/drivers/staging/media/tegra-video/vi.c --- a/drivers/staging/media/tegra-video/vi.c +++ b/drivers/staging/media/tegra-video/vi.c + if (pix->pixelformat == v4l2_pix_fmt_nv16) + pix->sizeimage *= 2;
|
Drivers in the Staging area
|
fbef4d6bb92e99e309cae1d251821ef22979a7f1
|
sowjanya komatineni
|
drivers
|
staging
|
media, tegra-video
|
media: tegra-video: add dv timing support
|
this patch adds below v4l2 dv timing ioctls to support hdmi-to-csi bridges.
|
this release allows to map an uid to a different one in a mount; it also adds support for selecting the preemption model at runtime; support for a low-overhead memory error detector designed to be used in production; support for the acrn hypervisor designed for embedded systems; btrfs initial support for zoned devices, subpage blocks sizes and performance improvements; support for eager nfs writes; support for a thermal power management to control the surface temperature of embedded devices in an unified way; the napi polling can be moved to a kernel thread; and support for non-blocking path lookups. as always, there are many other features, new drivers, improvements and fixes.
|
add support for capturing from hdmi-to-csi bridge
|
['core (various)', 'file systems', 'memory management', 'block layer', 'tracing, perf and bpf', 'virtualization', 'cryptography', 'security', 'networking', 'architectures x86 arm risc-v powerpc mips csky s390 pa-risc c6x']
|
['graphics', 'power management', 'storage', 'drivers in the staging area', 'networking', 'audio', 'tablets, touch screens, keyboards, mouses', 'tv tuners, webcams, video capturers', 'universal serial bus', 'serial peripheral interface (spi)', 'watchdog', 'serial', 'cpu frequency scaling', 'device voltage and frequency scaling', 'voltage, current regulators, power capping, power supply', 'real time clock (rtc)', 'pin controllers (pinctrl)', 'multi media card (mmc)', 'memory technology devices (mtd)', 'industrial i/o (iio)', 'multi function devices (mfd)', 'pulse-width modulation (pwm)', 'inter-integrated circuit (i2c + i3c)', 'hardware monitoring (hwmon)', 'general purpose i/o (gpio)', 'leds', 'dma engines', 'cryptography hardware acceleration', 'pci', 'non-transparent bridge (ntb)', 'thunderbolt', 'clock', 'phy ("physical layer" framework)', 'cxl (compute express link)', 'various']
|
['tegra-video']
|
['c']
| 1
| 99
| 0
|
--- diff --git a/drivers/staging/media/tegra-video/vi.c b/drivers/staging/media/tegra-video/vi.c --- a/drivers/staging/media/tegra-video/vi.c +++ b/drivers/staging/media/tegra-video/vi.c +#include <media/v4l2-dv-timings.h> +static int tegra_channel_g_dv_timings(struct file *file, void *fh, + struct v4l2_dv_timings *timings) +{ + struct tegra_vi_channel *chan = video_drvdata(file); + struct v4l2_subdev *subdev; + + subdev = tegra_channel_get_remote_source_subdev(chan); + if (!v4l2_subdev_has_op(subdev, video, g_dv_timings)) + return -enotty; + + return v4l2_device_call_until_err(chan->video.v4l2_dev, 0, + video, g_dv_timings, timings); +} + +static int tegra_channel_s_dv_timings(struct file *file, void *fh, + struct v4l2_dv_timings *timings) +{ + struct tegra_vi_channel *chan = video_drvdata(file); + struct v4l2_subdev *subdev; + struct v4l2_bt_timings *bt = &timings->bt; + struct v4l2_dv_timings curr_timings; + int ret; + + subdev = tegra_channel_get_remote_source_subdev(chan); + if (!v4l2_subdev_has_op(subdev, video, s_dv_timings)) + return -enotty; + + ret = tegra_channel_g_dv_timings(file, fh, &curr_timings); + if (ret) + return ret; + + if (v4l2_match_dv_timings(timings, &curr_timings, 0, false)) + return 0; + + if (vb2_is_busy(&chan->queue)) + return -ebusy; + + ret = v4l2_device_call_until_err(chan->video.v4l2_dev, 0, + video, s_dv_timings, timings); + if (ret) + return ret; + + chan->format.width = bt->width; + chan->format.height = bt->height; + chan->format.bytesperline = bt->width * chan->fmtinfo->bpp; + chan->format.sizeimage = chan->format.bytesperline * bt->height; + tegra_channel_fmt_align(chan, &chan->format, chan->fmtinfo->bpp); + + return 0; +} + +static int tegra_channel_query_dv_timings(struct file *file, void *fh, + struct v4l2_dv_timings *timings) +{ + struct tegra_vi_channel *chan = video_drvdata(file); + struct v4l2_subdev *subdev; + + subdev = tegra_channel_get_remote_source_subdev(chan); + if (!v4l2_subdev_has_op(subdev, video, query_dv_timings)) + return -enotty; + + return v4l2_device_call_until_err(chan->video.v4l2_dev, 0, + video, query_dv_timings, timings); +} + +static int tegra_channel_enum_dv_timings(struct file *file, void *fh, + struct v4l2_enum_dv_timings *timings) +{ + struct tegra_vi_channel *chan = video_drvdata(file); + struct v4l2_subdev *subdev; + + subdev = tegra_channel_get_remote_source_subdev(chan); + if (!v4l2_subdev_has_op(subdev, pad, enum_dv_timings)) + return -enotty; + + return v4l2_subdev_call(subdev, pad, enum_dv_timings, timings); +} + +static int tegra_channel_dv_timings_cap(struct file *file, void *fh, + struct v4l2_dv_timings_cap *cap) +{ + struct tegra_vi_channel *chan = video_drvdata(file); + struct v4l2_subdev *subdev; + + subdev = tegra_channel_get_remote_source_subdev(chan); + if (!v4l2_subdev_has_op(subdev, pad, dv_timings_cap)) + return -enotty; + + return v4l2_subdev_call(subdev, pad, dv_timings_cap, cap); +} + + if (v4l2_subdev_has_op(subdev, pad, dv_timings_cap)) + inp->capabilities = v4l2_in_cap_dv_timings; + .vidioc_g_dv_timings = tegra_channel_g_dv_timings, + .vidioc_s_dv_timings = tegra_channel_s_dv_timings, + .vidioc_query_dv_timings = tegra_channel_query_dv_timings, + .vidioc_enum_dv_timings = tegra_channel_enum_dv_timings, + .vidioc_dv_timings_cap = tegra_channel_dv_timings_cap,
|
Drivers in the Staging area
|
4281d115a4eba3b7767a214ed09613c2e1f0c4ea
|
sowjanya komatineni
|
drivers
|
staging
|
media, tegra-video
|
media: tegra-video: add support for edid ioctl ops
|
this patch adds support for edid get and set v4l2 ioctl ops to use with hdmi to csi bridges.
|
this release allows to map an uid to a different one in a mount; it also adds support for selecting the preemption model at runtime; support for a low-overhead memory error detector designed to be used in production; support for the acrn hypervisor designed for embedded systems; btrfs initial support for zoned devices, subpage blocks sizes and performance improvements; support for eager nfs writes; support for a thermal power management to control the surface temperature of embedded devices in an unified way; the napi polling can be moved to a kernel thread; and support for non-blocking path lookups. as always, there are many other features, new drivers, improvements and fixes.
|
add support for capturing from hdmi-to-csi bridge
|
['core (various)', 'file systems', 'memory management', 'block layer', 'tracing, perf and bpf', 'virtualization', 'cryptography', 'security', 'networking', 'architectures x86 arm risc-v powerpc mips csky s390 pa-risc c6x']
|
['graphics', 'power management', 'storage', 'drivers in the staging area', 'networking', 'audio', 'tablets, touch screens, keyboards, mouses', 'tv tuners, webcams, video capturers', 'universal serial bus', 'serial peripheral interface (spi)', 'watchdog', 'serial', 'cpu frequency scaling', 'device voltage and frequency scaling', 'voltage, current regulators, power capping, power supply', 'real time clock (rtc)', 'pin controllers (pinctrl)', 'multi media card (mmc)', 'memory technology devices (mtd)', 'industrial i/o (iio)', 'multi function devices (mfd)', 'pulse-width modulation (pwm)', 'inter-integrated circuit (i2c + i3c)', 'hardware monitoring (hwmon)', 'general purpose i/o (gpio)', 'leds', 'dma engines', 'cryptography hardware acceleration', 'pci', 'non-transparent bridge (ntb)', 'thunderbolt', 'clock', 'phy ("physical layer" framework)', 'cxl (compute express link)', 'various']
|
['tegra-video']
|
['c']
| 1
| 28
| 0
|
--- diff --git a/drivers/staging/media/tegra-video/vi.c b/drivers/staging/media/tegra-video/vi.c --- a/drivers/staging/media/tegra-video/vi.c +++ b/drivers/staging/media/tegra-video/vi.c +static int tegra_channel_g_edid(struct file *file, void *fh, + struct v4l2_edid *edid) +{ + struct tegra_vi_channel *chan = video_drvdata(file); + struct v4l2_subdev *subdev; + + subdev = tegra_channel_get_remote_source_subdev(chan); + if (!v4l2_subdev_has_op(subdev, pad, get_edid)) + return -enotty; + + return v4l2_subdev_call(subdev, pad, get_edid, edid); +} + +static int tegra_channel_s_edid(struct file *file, void *fh, + struct v4l2_edid *edid) +{ + struct tegra_vi_channel *chan = video_drvdata(file); + struct v4l2_subdev *subdev; + + subdev = tegra_channel_get_remote_source_subdev(chan); + if (!v4l2_subdev_has_op(subdev, pad, set_edid)) + return -enotty; + + return v4l2_subdev_call(subdev, pad, set_edid, edid); +} + + .vidioc_g_edid = tegra_channel_g_edid, + .vidioc_s_edid = tegra_channel_s_edid,
|
Drivers in the Staging area
|
52b21a0aed900b99b4fc5ee3d71d55d36e7f4621
|
sowjanya komatineni
|
drivers
|
staging
|
media, tegra-video
|
media: tegra-video: add support for vidioc_log_status ioctl
|
this patch adds support for log_status ioctl.
|
this release allows to map an uid to a different one in a mount; it also adds support for selecting the preemption model at runtime; support for a low-overhead memory error detector designed to be used in production; support for the acrn hypervisor designed for embedded systems; btrfs initial support for zoned devices, subpage blocks sizes and performance improvements; support for eager nfs writes; support for a thermal power management to control the surface temperature of embedded devices in an unified way; the napi polling can be moved to a kernel thread; and support for non-blocking path lookups. as always, there are many other features, new drivers, improvements and fixes.
|
add support for capturing from hdmi-to-csi bridge
|
['core (various)', 'file systems', 'memory management', 'block layer', 'tracing, perf and bpf', 'virtualization', 'cryptography', 'security', 'networking', 'architectures x86 arm risc-v powerpc mips csky s390 pa-risc c6x']
|
['graphics', 'power management', 'storage', 'drivers in the staging area', 'networking', 'audio', 'tablets, touch screens, keyboards, mouses', 'tv tuners, webcams, video capturers', 'universal serial bus', 'serial peripheral interface (spi)', 'watchdog', 'serial', 'cpu frequency scaling', 'device voltage and frequency scaling', 'voltage, current regulators, power capping, power supply', 'real time clock (rtc)', 'pin controllers (pinctrl)', 'multi media card (mmc)', 'memory technology devices (mtd)', 'industrial i/o (iio)', 'multi function devices (mfd)', 'pulse-width modulation (pwm)', 'inter-integrated circuit (i2c + i3c)', 'hardware monitoring (hwmon)', 'general purpose i/o (gpio)', 'leds', 'dma engines', 'cryptography hardware acceleration', 'pci', 'non-transparent bridge (ntb)', 'thunderbolt', 'clock', 'phy ("physical layer" framework)', 'cxl (compute express link)', 'various']
|
['tegra-video']
|
['c']
| 1
| 10
| 0
|
--- diff --git a/drivers/staging/media/tegra-video/vi.c b/drivers/staging/media/tegra-video/vi.c --- a/drivers/staging/media/tegra-video/vi.c +++ b/drivers/staging/media/tegra-video/vi.c +static int tegra_channel_log_status(struct file *file, void *fh) +{ + struct tegra_vi_channel *chan = video_drvdata(file); + + v4l2_device_call_all(chan->video.v4l2_dev, 0, core, log_status); + + return 0; +} + + .vidioc_log_status = tegra_channel_log_status,
|
Drivers in the Staging area
|
6a4d30ce09ba13ee49cf928dee53c51209a678dc
|
sowjanya komatineni
|
drivers
|
staging
|
media, tegra-video
|
media: tegra-video: add support for v4l2_event_source_change
|
current implementation uses v4l2_ctrl_subscribe_event() and this does not handle v4l2_event_source_change.
|
this release allows to map an uid to a different one in a mount; it also adds support for selecting the preemption model at runtime; support for a low-overhead memory error detector designed to be used in production; support for the acrn hypervisor designed for embedded systems; btrfs initial support for zoned devices, subpage blocks sizes and performance improvements; support for eager nfs writes; support for a thermal power management to control the surface temperature of embedded devices in an unified way; the napi polling can be moved to a kernel thread; and support for non-blocking path lookups. as always, there are many other features, new drivers, improvements and fixes.
|
add support for capturing from hdmi-to-csi bridge
|
['core (various)', 'file systems', 'memory management', 'block layer', 'tracing, perf and bpf', 'virtualization', 'cryptography', 'security', 'networking', 'architectures x86 arm risc-v powerpc mips csky s390 pa-risc c6x']
|
['graphics', 'power management', 'storage', 'drivers in the staging area', 'networking', 'audio', 'tablets, touch screens, keyboards, mouses', 'tv tuners, webcams, video capturers', 'universal serial bus', 'serial peripheral interface (spi)', 'watchdog', 'serial', 'cpu frequency scaling', 'device voltage and frequency scaling', 'voltage, current regulators, power capping, power supply', 'real time clock (rtc)', 'pin controllers (pinctrl)', 'multi media card (mmc)', 'memory technology devices (mtd)', 'industrial i/o (iio)', 'multi function devices (mfd)', 'pulse-width modulation (pwm)', 'inter-integrated circuit (i2c + i3c)', 'hardware monitoring (hwmon)', 'general purpose i/o (gpio)', 'leds', 'dma engines', 'cryptography hardware acceleration', 'pci', 'non-transparent bridge (ntb)', 'thunderbolt', 'clock', 'phy ("physical layer" framework)', 'cxl (compute express link)', 'various']
|
['tegra-video']
|
['c']
| 1
| 13
| 1
|
--- diff --git a/drivers/staging/media/tegra-video/vi.c b/drivers/staging/media/tegra-video/vi.c --- a/drivers/staging/media/tegra-video/vi.c +++ b/drivers/staging/media/tegra-video/vi.c +static int +tegra_channel_subscribe_event(struct v4l2_fh *fh, + const struct v4l2_event_subscription *sub) +{ + switch (sub->type) { + case v4l2_event_source_change: + return v4l2_event_subscribe(fh, sub, 4, null); + } + + return v4l2_ctrl_subscribe_event(fh, sub); +} + - .vidioc_subscribe_event = v4l2_ctrl_subscribe_event, + .vidioc_subscribe_event = tegra_channel_subscribe_event,
|
Drivers in the Staging area
|
2be21e68345b5cfb908ba47aa38c3a49583a0760
|
sowjanya komatineni
|
drivers
|
staging
|
media, tegra-video
|
media: tegra-video: implement v4l2 device notify callback
|
implement v4l2 device notify callback to handle v4l2_event_source_change event from subdevices.
|
this release allows to map an uid to a different one in a mount; it also adds support for selecting the preemption model at runtime; support for a low-overhead memory error detector designed to be used in production; support for the acrn hypervisor designed for embedded systems; btrfs initial support for zoned devices, subpage blocks sizes and performance improvements; support for eager nfs writes; support for a thermal power management to control the surface temperature of embedded devices in an unified way; the napi polling can be moved to a kernel thread; and support for non-blocking path lookups. as always, there are many other features, new drivers, improvements and fixes.
|
add support for capturing from hdmi-to-csi bridge
|
['core (various)', 'file systems', 'memory management', 'block layer', 'tracing, perf and bpf', 'virtualization', 'cryptography', 'security', 'networking', 'architectures x86 arm risc-v powerpc mips csky s390 pa-risc c6x']
|
['graphics', 'power management', 'storage', 'drivers in the staging area', 'networking', 'audio', 'tablets, touch screens, keyboards, mouses', 'tv tuners, webcams, video capturers', 'universal serial bus', 'serial peripheral interface (spi)', 'watchdog', 'serial', 'cpu frequency scaling', 'device voltage and frequency scaling', 'voltage, current regulators, power capping, power supply', 'real time clock (rtc)', 'pin controllers (pinctrl)', 'multi media card (mmc)', 'memory technology devices (mtd)', 'industrial i/o (iio)', 'multi function devices (mfd)', 'pulse-width modulation (pwm)', 'inter-integrated circuit (i2c + i3c)', 'hardware monitoring (hwmon)', 'general purpose i/o (gpio)', 'leds', 'dma engines', 'cryptography hardware acceleration', 'pci', 'non-transparent bridge (ntb)', 'thunderbolt', 'clock', 'phy ("physical layer" framework)', 'cxl (compute express link)', 'various']
|
['tegra-video']
|
['c']
| 2
| 21
| 0
|
--- diff --git a/drivers/staging/media/tegra-video/vi.c b/drivers/staging/media/tegra-video/vi.c --- a/drivers/staging/media/tegra-video/vi.c +++ b/drivers/staging/media/tegra-video/vi.c + subdev = tegra_channel_get_remote_source_subdev(chan); + v4l2_set_subdev_hostdata(subdev, chan); + diff --git a/drivers/staging/media/tegra-video/video.c b/drivers/staging/media/tegra-video/video.c --- a/drivers/staging/media/tegra-video/video.c +++ b/drivers/staging/media/tegra-video/video.c +#include <media/v4l2-event.h> + +static void tegra_v4l2_dev_notify(struct v4l2_subdev *sd, + unsigned int notification, void *arg) +{ + struct tegra_vi_channel *chan; + const struct v4l2_event *ev = arg; + + if (notification != v4l2_device_notify_event) + return; + + chan = v4l2_get_subdev_hostdata(sd); + v4l2_event_queue(&chan->video, arg); + if (ev->type == v4l2_event_source_change && vb2_is_streaming(&chan->queue)) + vb2_queue_error(&chan->queue); +} + + vid->v4l2_dev.notify = tegra_v4l2_dev_notify;
|
Drivers in the Staging area
|
4fe27eb68caca9db1324ee958140cf4a83ecdc9a
|
sowjanya komatineni
|
drivers
|
staging
|
media, tegra-video
|
media: v4l2-fwnode: update v4l2_fwnode_csi2_max_data_lanes to 8
|
some csi2 receivers support 8 data lanes.
|
this release allows to map an uid to a different one in a mount; it also adds support for selecting the preemption model at runtime; support for a low-overhead memory error detector designed to be used in production; support for the acrn hypervisor designed for embedded systems; btrfs initial support for zoned devices, subpage blocks sizes and performance improvements; support for eager nfs writes; support for a thermal power management to control the surface temperature of embedded devices in an unified way; the napi polling can be moved to a kernel thread; and support for non-blocking path lookups. as always, there are many other features, new drivers, improvements and fixes.
|
add support for capturing from hdmi-to-csi bridge
|
['core (various)', 'file systems', 'memory management', 'block layer', 'tracing, perf and bpf', 'virtualization', 'cryptography', 'security', 'networking', 'architectures x86 arm risc-v powerpc mips csky s390 pa-risc c6x']
|
['graphics', 'power management', 'storage', 'drivers in the staging area', 'networking', 'audio', 'tablets, touch screens, keyboards, mouses', 'tv tuners, webcams, video capturers', 'universal serial bus', 'serial peripheral interface (spi)', 'watchdog', 'serial', 'cpu frequency scaling', 'device voltage and frequency scaling', 'voltage, current regulators, power capping, power supply', 'real time clock (rtc)', 'pin controllers (pinctrl)', 'multi media card (mmc)', 'memory technology devices (mtd)', 'industrial i/o (iio)', 'multi function devices (mfd)', 'pulse-width modulation (pwm)', 'inter-integrated circuit (i2c + i3c)', 'hardware monitoring (hwmon)', 'general purpose i/o (gpio)', 'leds', 'dma engines', 'cryptography hardware acceleration', 'pci', 'non-transparent bridge (ntb)', 'thunderbolt', 'clock', 'phy ("physical layer" framework)', 'cxl (compute express link)', 'various']
|
['tegra-video']
|
['h']
| 1
| 1
| 1
|
--- diff --git a/include/media/v4l2-fwnode.h b/include/media/v4l2-fwnode.h --- a/include/media/v4l2-fwnode.h +++ b/include/media/v4l2-fwnode.h -#define v4l2_fwnode_csi2_max_data_lanes 4 +#define v4l2_fwnode_csi2_max_data_lanes 8
|
Drivers in the Staging area
|
8f81888bec5c0a5f27083ca58024fb80fe902393
|
sowjanya komatineni
|
include
|
media
| |
media: dt-bindings: tegra: update csi data-lanes to maximum 8 lanes
|
tegra vi/csi hardware don't have native 8 lane csi rx port.
|
this release allows to map an uid to a different one in a mount; it also adds support for selecting the preemption model at runtime; support for a low-overhead memory error detector designed to be used in production; support for the acrn hypervisor designed for embedded systems; btrfs initial support for zoned devices, subpage blocks sizes and performance improvements; support for eager nfs writes; support for a thermal power management to control the surface temperature of embedded devices in an unified way; the napi polling can be moved to a kernel thread; and support for non-blocking path lookups. as always, there are many other features, new drivers, improvements and fixes.
|
add support for capturing from hdmi-to-csi bridge
|
['core (various)', 'file systems', 'memory management', 'block layer', 'tracing, perf and bpf', 'virtualization', 'cryptography', 'security', 'networking', 'architectures x86 arm risc-v powerpc mips csky s390 pa-risc c6x']
|
['graphics', 'power management', 'storage', 'drivers in the staging area', 'networking', 'audio', 'tablets, touch screens, keyboards, mouses', 'tv tuners, webcams, video capturers', 'universal serial bus', 'serial peripheral interface (spi)', 'watchdog', 'serial', 'cpu frequency scaling', 'device voltage and frequency scaling', 'voltage, current regulators, power capping, power supply', 'real time clock (rtc)', 'pin controllers (pinctrl)', 'multi media card (mmc)', 'memory technology devices (mtd)', 'industrial i/o (iio)', 'multi function devices (mfd)', 'pulse-width modulation (pwm)', 'inter-integrated circuit (i2c + i3c)', 'hardware monitoring (hwmon)', 'general purpose i/o (gpio)', 'leds', 'dma engines', 'cryptography hardware acceleration', 'pci', 'non-transparent bridge (ntb)', 'thunderbolt', 'clock', 'phy ("physical layer" framework)', 'cxl (compute express link)', 'various']
|
['tegra-video']
|
['txt']
| 1
| 2
| 2
|
--- diff --git a/documentation/devicetree/bindings/display/tegra/nvidia,tegra20-host1x.txt b/documentation/devicetree/bindings/display/tegra/nvidia,tegra20-host1x.txt --- a/documentation/devicetree/bindings/display/tegra/nvidia,tegra20-host1x.txt +++ b/documentation/devicetree/bindings/display/tegra/nvidia,tegra20-host1x.txt - - data-lanes: an array of data lane from 1 to 4. valid array - lengths are 1/2/4. + - data-lanes: an array of data lane from 1 to 8. valid array + lengths are 1/2/4/8. - remote-endpoint: phandle to sensor 'endpoint' node.
|
Drivers in the Staging area
|
f8c9dd2b826d8f1c23b8e86d5e4135a668a7bdd4
|
sowjanya komatineni
|
documentation
|
devicetree
|
bindings, display, tegra
|
media: tegra-video: add support for x8 captures with gang ports
|
tegra vi/csi hardware don't have native 8 lane capture support.
|
this release allows to map an uid to a different one in a mount; it also adds support for selecting the preemption model at runtime; support for a low-overhead memory error detector designed to be used in production; support for the acrn hypervisor designed for embedded systems; btrfs initial support for zoned devices, subpage blocks sizes and performance improvements; support for eager nfs writes; support for a thermal power management to control the surface temperature of embedded devices in an unified way; the napi polling can be moved to a kernel thread; and support for non-blocking path lookups. as always, there are many other features, new drivers, improvements and fixes.
|
add support for capturing from hdmi-to-csi bridge
|
['core (various)', 'file systems', 'memory management', 'block layer', 'tracing, perf and bpf', 'virtualization', 'cryptography', 'security', 'networking', 'architectures x86 arm risc-v powerpc mips csky s390 pa-risc c6x']
|
['graphics', 'power management', 'storage', 'drivers in the staging area', 'networking', 'audio', 'tablets, touch screens, keyboards, mouses', 'tv tuners, webcams, video capturers', 'universal serial bus', 'serial peripheral interface (spi)', 'watchdog', 'serial', 'cpu frequency scaling', 'device voltage and frequency scaling', 'voltage, current regulators, power capping, power supply', 'real time clock (rtc)', 'pin controllers (pinctrl)', 'multi media card (mmc)', 'memory technology devices (mtd)', 'industrial i/o (iio)', 'multi function devices (mfd)', 'pulse-width modulation (pwm)', 'inter-integrated circuit (i2c + i3c)', 'hardware monitoring (hwmon)', 'general purpose i/o (gpio)', 'leds', 'dma engines', 'cryptography hardware acceleration', 'pci', 'non-transparent bridge (ntb)', 'thunderbolt', 'clock', 'phy ("physical layer" framework)', 'cxl (compute express link)', 'various']
|
['tegra-video']
|
['h', 'c']
| 5
| 362
| 149
|
--- diff --git a/drivers/staging/media/tegra-video/csi.c b/drivers/staging/media/tegra-video/csi.c --- a/drivers/staging/media/tegra-video/csi.c +++ b/drivers/staging/media/tegra-video/csi.c + u8 csi_port_num, - int clk_idx = (csi_chan->csi_port_num >> 1) + 1; + int clk_idx = (csi_port_num >> 1) + 1; - int ret = 0; + int ret = 0, i; - chan->csi_port_num = port_num; - chan->numlanes = lanes; + /* + * each csi brick has maximum of 4 lanes. + * for lanes more than 4, use multiple of immediate csi bricks as gang. + */ + if (lanes <= csi_lanes_per_brick) { + chan->numlanes = lanes; + chan->numgangports = 1; + } else { + chan->numlanes = csi_lanes_per_brick; + chan->numgangports = lanes / csi_lanes_per_brick; + } + + for (i = 0; i < chan->numgangports; i++) + chan->csi_port_nums[i] = port_num + i * csi_ports_per_brick; + - if (!lanes || ((lanes & (lanes - 1)) != 0)) { + /* + * each csi brick has maximum 4 data lanes. + * for lanes more than 4, validate lanes to be multiple of 4 + * so multiple of consecutive csi bricks can be ganged up for + * streaming. + */ + if (!lanes || ((lanes & (lanes - 1)) != 0) || + (lanes > csi_lanes_per_brick && ((portno & 1) != 0))) { - chan->csi_port_num); + chan->csi_port_nums[0]); - chan->csi_port_num, ret); + chan->csi_port_nums[0], ret); diff --git a/drivers/staging/media/tegra-video/csi.h b/drivers/staging/media/tegra-video/csi.h --- a/drivers/staging/media/tegra-video/csi.h +++ b/drivers/staging/media/tegra-video/csi.h +#define csi_lanes_per_brick 4 + +/* maximum 2 csi x4 ports can be ganged up for streaming */ +#define gang_ports_max 2 - * @numlanes: number of lanes used per port/channel - * @csi_port_num: csi channel port number + * @numgangports: number of immediate ports ganged up to meet the + * channel bus-width + * @numlanes: number of lanes used per port + * @csi_port_nums: csi channel port numbers + u8 numgangports; - u8 csi_port_num; + u8 csi_port_nums[gang_ports_max]; + u8 csi_port_num, diff --git a/drivers/staging/media/tegra-video/tegra210.c b/drivers/staging/media/tegra-video/tegra210.c --- a/drivers/staging/media/tegra-video/tegra210.c +++ b/drivers/staging/media/tegra-video/tegra210.c -static void vi_csi_write(struct tegra_vi_channel *chan, unsigned int addr, - u32 val) +static void vi_csi_write(struct tegra_vi_channel *chan, u8 portno, + unsigned int addr, u32 val) - vi_csi_base = chan->vi->iomem + tegra210_vi_csi_base(chan->portno); + vi_csi_base = chan->vi->iomem + tegra210_vi_csi_base(portno); -static u32 vi_csi_read(struct tegra_vi_channel *chan, unsigned int addr) +static u32 vi_csi_read(struct tegra_vi_channel *chan, u8 portno, + unsigned int addr) - vi_csi_base = chan->vi->iomem + tegra210_vi_csi_base(chan->portno); + vi_csi_base = chan->vi->iomem + tegra210_vi_csi_base(portno); -static int tegra_channel_capture_setup(struct tegra_vi_channel *chan) +static int tegra_channel_capture_setup(struct tegra_vi_channel *chan, + u8 portno) - vi_csi_write(chan, tegra_vi_csi_error_status, 0xffffffff); - vi_csi_write(chan, tegra_vi_csi_image_def, + /* + * for x8 source streaming, the source image is split onto two x4 ports + * with left half to first x4 port and right half to second x4 port. + * so, use split width and corresponding word count for each x4 port. + */ + if (chan->numgangports > 1) { + width = width >> 1; + word_count = (width * chan->fmtinfo->bit_width) / 8; + } + + vi_csi_write(chan, portno, tegra_vi_csi_error_status, 0xffffffff); + vi_csi_write(chan, portno, tegra_vi_csi_image_def, - vi_csi_write(chan, tegra_vi_csi_image_dt, data_type); - vi_csi_write(chan, tegra_vi_csi_image_size_wc, word_count); - vi_csi_write(chan, tegra_vi_csi_image_size, + vi_csi_write(chan, portno, tegra_vi_csi_image_dt, data_type); + vi_csi_write(chan, portno, tegra_vi_csi_image_size_wc, word_count); + vi_csi_write(chan, portno, tegra_vi_csi_image_size, -static void tegra_channel_vi_soft_reset(struct tegra_vi_channel *chan) +static void tegra_channel_vi_soft_reset(struct tegra_vi_channel *chan, + u8 portno) - vi_csi_write(chan, tegra_vi_csi_sw_reset, 0xf); + vi_csi_write(chan, portno, tegra_vi_csi_sw_reset, 0xf); - vi_csi_write(chan, tegra_vi_csi_sw_reset, 0x0); + vi_csi_write(chan, portno, tegra_vi_csi_sw_reset, 0x0); -static void tegra_channel_capture_error_recover(struct tegra_vi_channel *chan) +static void tegra_channel_capture_error_recover(struct tegra_vi_channel *chan, + u8 portno) - val = vi_csi_read(chan, tegra_vi_csi_error_status); + val = vi_csi_read(chan, portno, tegra_vi_csi_error_status); - vi_csi_write(chan, tegra_vi_csi_error_status, val); + vi_csi_write(chan, portno, tegra_vi_csi_error_status, val); - tegra_channel_vi_soft_reset(chan); - tegra_channel_capture_setup(chan); + tegra_channel_vi_soft_reset(chan, portno); + tegra_channel_capture_setup(chan, portno); -static int tegra_channel_capture_frame(struct tegra_vi_channel *chan, - struct tegra_channel_buffer *buf) +static void tegra_channel_vi_buffer_setup(struct tegra_vi_channel *chan, + u8 portno, u32 buf_offset, + struct tegra_channel_buffer *buf) - u32 thresh, value, frame_start, mw_ack_done; - int bytes_per_line = chan->format.bytesperline; + int bytesperline = chan->format.bytesperline; - int err; - vi_csi_write(chan, tegra_vi_csi_surface0_offset_msb, - (u64)buf->addr >> 32); - vi_csi_write(chan, tegra_vi_csi_surface0_offset_lsb, buf->addr); - vi_csi_write(chan, tegra_vi_csi_surface0_stride, bytes_per_line); + vi_csi_write(chan, portno, tegra_vi_csi_surface0_offset_msb, + ((u64)buf->addr + buf_offset) >> 32); + vi_csi_write(chan, portno, tegra_vi_csi_surface0_offset_lsb, + buf->addr + buf_offset); + vi_csi_write(chan, portno, tegra_vi_csi_surface0_stride, bytesperline); + if (chan->fmtinfo->fourcc != v4l2_pix_fmt_nv16) + return; - if (chan->fmtinfo->fourcc == v4l2_pix_fmt_nv16) { - vi_csi_write(chan, tegra_vi_csi_surface1_offset_msb, - ((u64)buf->addr + sizeimage / 2) >> 32); - vi_csi_write(chan, tegra_vi_csi_surface1_offset_lsb, - buf->addr + sizeimage / 2); - vi_csi_write(chan, tegra_vi_csi_surface1_stride, - bytes_per_line); - } - - /* - * tegra vi block interacts with host1x syncpt for synchronizing - * programmed condition of capture state and hardware operation. - * frame start and memory write acknowledge syncpts has their own - * fifo of depth 2. - * - * syncpoint trigger conditions set through vi_incr_syncpt register - * are added to hw syncpt fifo and when the hw triggers, syncpt - * condition is removed from the fifo and counter at syncpoint index - * will be incremented by the hardware and software can wait for - * counter to reach threshold to synchronize capturing frame with the - * hardware capture events. - */ + vi_csi_write(chan, portno, tegra_vi_csi_surface1_offset_msb, + (((u64)buf->addr + sizeimage / 2) + buf_offset) >> 32); + vi_csi_write(chan, portno, tegra_vi_csi_surface1_offset_lsb, + buf->addr + sizeimage / 2 + buf_offset); + vi_csi_write(chan, portno, tegra_vi_csi_surface1_stride, bytesperline); +} - /* increase channel syncpoint threshold for frame_start */ - thresh = host1x_syncpt_incr_max(chan->frame_start_sp, 1); +static int tegra_channel_capture_frame(struct tegra_vi_channel *chan, + struct tegra_channel_buffer *buf) +{ + u32 thresh, value, frame_start, mw_ack_done; + u32 fs_thresh[gang_ports_max]; + u8 *portnos = chan->portnos; + int gang_bpl = (chan->format.width >> 1) * chan->fmtinfo->bpp; + u32 buf_offset; + bool capture_timedout = false; + int err, i; + + for (i = 0; i < chan->numgangports; i++) { + /* + * align buffers side-by-side for all consecutive x4 ports + * in gang ports using bytes per line based on source split + * width. + */ + buf_offset = i * roundup(gang_bpl, surface_align_bytes); + tegra_channel_vi_buffer_setup(chan, portnos[i], buf_offset, + buf); - /* program frame_start trigger condition syncpt request */ - frame_start = vi_csi_pp_frame_start(chan->portno); - value = vi_cfg_vi_incr_syncpt_cond(frame_start) | - host1x_syncpt_id(chan->frame_start_sp); - tegra_vi_write(chan, tegra_vi_cfg_vi_incr_syncpt, value); + /* + * tegra vi block interacts with host1x syncpt to synchronize + * programmed condition and hardware operation for capture. + * frame start and memory write acknowledge syncpts has their + * own fifo of depth 2. + * + * syncpoint trigger conditions set through vi_incr_syncpt + * register are added to hw syncpt fifo and when hw triggers, + * syncpt condition is removed from the fifo and counter at + * syncpoint index will be incremented by the hardware and + * software can wait for counter to reach threshold to + * synchronize capturing frame with hardware capture events. + */ - /* increase channel syncpoint threshold for mw_ack_done */ - buf->mw_ack_sp_thresh = host1x_syncpt_incr_max(chan->mw_ack_sp, 1); + /* increase channel syncpoint threshold for frame_start */ + thresh = host1x_syncpt_incr_max(chan->frame_start_sp[i], 1); + fs_thresh[i] = thresh; + + /* program frame_start trigger condition syncpt request */ + frame_start = vi_csi_pp_frame_start(portnos[i]); + value = vi_cfg_vi_incr_syncpt_cond(frame_start) | + host1x_syncpt_id(chan->frame_start_sp[i]); + tegra_vi_write(chan, tegra_vi_cfg_vi_incr_syncpt, value); + + /* increase channel syncpoint threshold for mw_ack_done */ + thresh = host1x_syncpt_incr_max(chan->mw_ack_sp[i], 1); + buf->mw_ack_sp_thresh[i] = thresh; + + /* program mw_ack_done trigger condition syncpt request */ + mw_ack_done = vi_csi_mw_ack_done(portnos[i]); + value = vi_cfg_vi_incr_syncpt_cond(mw_ack_done) | + host1x_syncpt_id(chan->mw_ack_sp[i]); + tegra_vi_write(chan, tegra_vi_cfg_vi_incr_syncpt, value); + } - /* program mw_ack_done trigger condition syncpt request */ - mw_ack_done = vi_csi_mw_ack_done(chan->portno); - value = vi_cfg_vi_incr_syncpt_cond(mw_ack_done) | - host1x_syncpt_id(chan->mw_ack_sp); - tegra_vi_write(chan, tegra_vi_cfg_vi_incr_syncpt, value); + /* enable single shot capture after all ganged ports are ready */ + for (i = 0; i < chan->numgangports; i++) + vi_csi_write(chan, portnos[i], tegra_vi_csi_single_shot, + single_shot_capture); - /* enable single shot capture */ - vi_csi_write(chan, tegra_vi_csi_single_shot, single_shot_capture); + for (i = 0; i < chan->numgangports; i++) { + /* + * wait for syncpt counter to reach frame start event threshold + */ + err = host1x_syncpt_wait(chan->frame_start_sp[i], fs_thresh[i], + tegra_vi_syncpt_wait_timeout, &value); + if (err) { + capture_timedout = true; + /* increment syncpoint counter for timedout events */ + host1x_syncpt_incr(chan->frame_start_sp[i]); + spin_lock(&chan->sp_incr_lock[i]); + host1x_syncpt_incr(chan->mw_ack_sp[i]); + spin_unlock(&chan->sp_incr_lock[i]); + /* clear errors and recover */ + tegra_channel_capture_error_recover(chan, portnos[i]); + } + } - /* wait for syncpt counter to reach frame start event threshold */ - err = host1x_syncpt_wait(chan->frame_start_sp, thresh, - tegra_vi_syncpt_wait_timeout, &value); - if (err) { + if (capture_timedout) { - /* increment syncpoint counter for timedout events */ - host1x_syncpt_incr(chan->frame_start_sp); - spin_lock(&chan->sp_incr_lock); - host1x_syncpt_incr(chan->mw_ack_sp); - spin_unlock(&chan->sp_incr_lock); - /* clear errors and recover */ - tegra_channel_capture_error_recover(chan); - int ret; + bool capture_timedout = false; + int ret, i; - /* wait for syncpt counter to reach mw_ack_done event threshold */ - ret = host1x_syncpt_wait(chan->mw_ack_sp, buf->mw_ack_sp_thresh, - tegra_vi_syncpt_wait_timeout, &value); - if (ret) { - dev_err_ratelimited(&chan->video.dev, - "mw_ack_done syncpt timeout: %d ", ret); - state = vb2_buf_state_error; - /* increment syncpoint counter for timedout event */ - spin_lock(&chan->sp_incr_lock); - host1x_syncpt_incr(chan->mw_ack_sp); - spin_unlock(&chan->sp_incr_lock); + for (i = 0; i < chan->numgangports; i++) { + /* + * wait for syncpt counter to reach mw_ack_done event threshold + */ + ret = host1x_syncpt_wait(chan->mw_ack_sp[i], + buf->mw_ack_sp_thresh[i], + tegra_vi_syncpt_wait_timeout, &value); + if (ret) { + capture_timedout = true; + state = vb2_buf_state_error; + /* increment syncpoint counter for timedout event */ + spin_lock(&chan->sp_incr_lock[i]); + host1x_syncpt_incr(chan->mw_ack_sp[i]); + spin_unlock(&chan->sp_incr_lock[i]); + } + if (capture_timedout) + dev_err_ratelimited(&chan->video.dev, + "mw_ack_done syncpt timeout: %d ", ret); - int ret; + u8 *portnos = chan->portnos; + int ret, i; - /* clear errors */ - val = vi_csi_read(chan, tegra_vi_csi_error_status); - vi_csi_write(chan, tegra_vi_csi_error_status, val); - + /* clear syncpt errors */ - tegra_channel_capture_setup(chan); + /* clear csi errors and do capture setup for all ports in gang mode */ + for (i = 0; i < chan->numgangports; i++) { + val = vi_csi_read(chan, portnos[i], tegra_vi_csi_error_status); + vi_csi_write(chan, portnos[i], tegra_vi_csi_error_status, val); + + tegra_channel_capture_setup(chan, portnos[i]); + } + -static void tegra210_csi_error_recover(struct tegra_csi_channel *csi_chan) +static void tegra210_csi_port_recover(struct tegra_csi_channel *csi_chan, + u8 portno) - unsigned int portno = csi_chan->csi_port_num; -static int tegra210_csi_start_streaming(struct tegra_csi_channel *csi_chan) +static void tegra210_csi_error_recover(struct tegra_csi_channel *csi_chan) +{ + u8 *portnos = csi_chan->csi_port_nums; + int i; + + for (i = 0; i < csi_chan->numgangports; i++) + tegra210_csi_port_recover(csi_chan, portnos[i]); +} + +static int +tegra210_csi_port_start_streaming(struct tegra_csi_channel *csi_chan, + u8 portno) - unsigned int portno = csi_chan->csi_port_num; - tegra_csi_calc_settle_time(csi_chan, &clk_settle_time, + tegra_csi_calc_settle_time(csi_chan, portno, &clk_settle_time, -static void tegra210_csi_stop_streaming(struct tegra_csi_channel *csi_chan) +static void +tegra210_csi_port_stop_streaming(struct tegra_csi_channel *csi_chan, u8 portno) - unsigned int portno = csi_chan->csi_port_num; +static int tegra210_csi_start_streaming(struct tegra_csi_channel *csi_chan) +{ + u8 *portnos = csi_chan->csi_port_nums; + int ret, i; + + for (i = 0; i < csi_chan->numgangports; i++) { + ret = tegra210_csi_port_start_streaming(csi_chan, portnos[i]); + if (ret) + goto stream_start_fail; + } + + return 0; + +stream_start_fail: + for (i = i - 1; i >= 0; i--) + tegra210_csi_port_stop_streaming(csi_chan, portnos[i]); + + return ret; +} + +static void tegra210_csi_stop_streaming(struct tegra_csi_channel *csi_chan) +{ + u8 *portnos = csi_chan->csi_port_nums; + int i; + + for (i = 0; i < csi_chan->numgangports; i++) + tegra210_csi_port_stop_streaming(csi_chan, portnos[i]); +} + diff --git a/drivers/staging/media/tegra-video/vi.c b/drivers/staging/media/tegra-video/vi.c --- a/drivers/staging/media/tegra-video/vi.c +++ b/drivers/staging/media/tegra-video/vi.c -#define surface_align_bytes 64 +static void tegra_channel_update_gangports(struct tegra_vi_channel *chan) +{ + if (chan->format.width <= 1920) + chan->numgangports = 1; + else + chan->numgangports = chan->totalports; +} + + tegra_channel_update_gangports(chan); + tegra_channel_update_gangports(chan); + tegra_channel_update_gangports(chan); +static void tegra_channel_host1x_syncpts_free(struct tegra_vi_channel *chan) +{ + int i; + + for (i = 0; i < chan->numgangports; i++) { + host1x_syncpt_free(chan->mw_ack_sp[i]); + host1x_syncpt_free(chan->frame_start_sp[i]); + } +} + - host1x_syncpt_free(chan->mw_ack_sp); - host1x_syncpt_free(chan->frame_start_sp); + tegra_channel_host1x_syncpts_free(chan); +static int tegra_channel_host1x_syncpt_init(struct tegra_vi_channel *chan) +{ + struct tegra_vi *vi = chan->vi; + unsigned long flags = host1x_syncpt_client_managed; + struct host1x_syncpt *fs_sp; + struct host1x_syncpt *mw_sp; + int ret, i; + + for (i = 0; i < chan->numgangports; i++) { + fs_sp = host1x_syncpt_request(&vi->client, flags); + if (!fs_sp) { + dev_err(vi->dev, "failed to request frame start syncpoint "); + ret = -enomem; + goto free_syncpts; + } + + mw_sp = host1x_syncpt_request(&vi->client, flags); + if (!mw_sp) { + dev_err(vi->dev, "failed to request memory ack syncpoint "); + host1x_syncpt_free(fs_sp); + ret = -enomem; + goto free_syncpts; + } + + chan->frame_start_sp[i] = fs_sp; + chan->mw_ack_sp[i] = mw_sp; + spin_lock_init(&chan->sp_incr_lock[i]); + } + + return 0; + +free_syncpts: + tegra_channel_host1x_syncpts_free(chan); + return ret; +} + - unsigned long flags = host1x_syncpt_client_managed; - spin_lock_init(&chan->sp_incr_lock); - chan->frame_start_sp = host1x_syncpt_request(&vi->client, flags); - if (!chan->frame_start_sp) { - dev_err(vi->dev, "failed to request frame start syncpoint "); - return -enomem; - } - - chan->mw_ack_sp = host1x_syncpt_request(&vi->client, flags); - if (!chan->mw_ack_sp) { - dev_err(vi->dev, "failed to request memory ack syncpoint "); - ret = -enomem; - goto free_fs_syncpt; - } + ret = tegra_channel_host1x_syncpt_init(chan); + if (ret) + return ret; - goto free_mw_ack_syncpt; + goto free_syncpts; - dev_name(vi->dev), "output", chan->portno); + dev_name(vi->dev), "output", chan->portnos[0]); -free_mw_ack_syncpt: - host1x_syncpt_free(chan->mw_ack_sp); -free_fs_syncpt: - host1x_syncpt_free(chan->frame_start_sp); +free_syncpts: + tegra_channel_host1x_syncpts_free(chan); - struct device_node *node) + struct device_node *node, unsigned int lanes) + unsigned int i; - chan->portno = port_num; + chan->portnos[0] = port_num; + /* + * for data lanes more than maximum csi lanes per brick, multiple of + * x4 ports are used simultaneously for capture. + */ + if (lanes <= csi_lanes_per_brick) + chan->totalports = 1; + else + chan->totalports = lanes / csi_lanes_per_brick; + chan->numgangports = chan->totalports; + + for (i = 1; i < chan->totalports; i++) + chan->portnos[i] = chan->portnos[0] + i * csi_ports_per_brick; + - ret = tegra_vi_channel_alloc(vi, port_num, vi->dev->of_node); + ret = tegra_vi_channel_alloc(vi, port_num, + vi->dev->of_node, 2); + struct device_node *parent; + struct v4l2_fwnode_endpoint v4l2_ep = { .bus_type = 0 }; + unsigned int lanes; + parent = of_graph_get_remote_port_parent(ep); + of_node_put(ep); + if (!parent) + continue; + + ep = of_graph_get_endpoint_by_regs(parent, 0, 0); + of_node_put(parent); + ret = v4l2_fwnode_endpoint_parse(of_fwnode_handle(ep), + &v4l2_ep); - ret = tegra_vi_channel_alloc(vi, port_num, port); + if (ret) + continue; + + lanes = v4l2_ep.bus.mipi_csi2.num_data_lanes; + ret = tegra_vi_channel_alloc(vi, port_num, port, lanes); - chan->portno, ret); + chan->portnos[0], ret); - remote = fwnode_graph_get_remote_node(fwnode, chan->portno, 0); + remote = fwnode_graph_get_remote_node(fwnode, chan->portnos[0], + 0); - chan->portno, ret); + chan->portnos[0], ret); - goto free_chans; + goto cleanup_chans; +cleanup_chans: + list_for_each_entry(chan, &vi->vi_chans, list) + tegra_channel_cleanup(chan); diff --git a/drivers/staging/media/tegra-video/vi.h b/drivers/staging/media/tegra-video/vi.h --- a/drivers/staging/media/tegra-video/vi.h +++ b/drivers/staging/media/tegra-video/vi.h +#include "csi.h" + +#define surface_align_bytes 64 - * @portno: vi channel port number + * @portnos: vi channel port numbers + * @totalports: total number of ports used for this channel + * @numgangports: number of ports combined together as a gang for capture - struct host1x_syncpt *frame_start_sp; - struct host1x_syncpt *mw_ack_sp; + struct host1x_syncpt *frame_start_sp[gang_ports_max]; + struct host1x_syncpt *mw_ack_sp[gang_ports_max]; - spinlock_t sp_incr_lock; + spinlock_t sp_incr_lock[gang_ports_max]; - unsigned char portno; + unsigned char portnos[gang_ports_max]; + u8 totalports; + u8 numgangports; - u32 mw_ack_sp_thresh; + u32 mw_ack_sp_thresh[gang_ports_max];
|
Drivers in the Staging area
|
2ac4035a78c93330025d005009c132f5552ce4bc
|
sowjanya komatineni
|
drivers
|
staging
|
media, tegra-video
|
media: tegra-video: add custom v4l2 control v4l2_cid_tegra_syncpt_timeout_retry
|
this patch adds custom v4l2 control for syncpt timeout retry to continue capture on error for specified retries count through this control.
|
this release allows to map an uid to a different one in a mount; it also adds support for selecting the preemption model at runtime; support for a low-overhead memory error detector designed to be used in production; support for the acrn hypervisor designed for embedded systems; btrfs initial support for zoned devices, subpage blocks sizes and performance improvements; support for eager nfs writes; support for a thermal power management to control the surface temperature of embedded devices in an unified way; the napi polling can be moved to a kernel thread; and support for non-blocking path lookups. as always, there are many other features, new drivers, improvements and fixes.
|
add support for capturing from hdmi-to-csi bridge
|
['core (various)', 'file systems', 'memory management', 'block layer', 'tracing, perf and bpf', 'virtualization', 'cryptography', 'security', 'networking', 'architectures x86 arm risc-v powerpc mips csky s390 pa-risc c6x']
|
['graphics', 'power management', 'storage', 'drivers in the staging area', 'networking', 'audio', 'tablets, touch screens, keyboards, mouses', 'tv tuners, webcams, video capturers', 'universal serial bus', 'serial peripheral interface (spi)', 'watchdog', 'serial', 'cpu frequency scaling', 'device voltage and frequency scaling', 'voltage, current regulators, power capping, power supply', 'real time clock (rtc)', 'pin controllers (pinctrl)', 'multi media card (mmc)', 'memory technology devices (mtd)', 'industrial i/o (iio)', 'multi function devices (mfd)', 'pulse-width modulation (pwm)', 'inter-integrated circuit (i2c + i3c)', 'hardware monitoring (hwmon)', 'general purpose i/o (gpio)', 'leds', 'dma engines', 'cryptography hardware acceleration', 'pci', 'non-transparent bridge (ntb)', 'thunderbolt', 'clock', 'phy ("physical layer" framework)', 'cxl (compute express link)', 'various']
|
['tegra-video']
|
['h', 'c']
| 3
| 38
| 2
|
--- diff --git a/drivers/staging/media/tegra-video/tegra210.c b/drivers/staging/media/tegra-video/tegra210.c --- a/drivers/staging/media/tegra-video/tegra210.c +++ b/drivers/staging/media/tegra-video/tegra210.c + unsigned int retries = 0; - if (err) + if (!err) { + retries = 0; + continue; + } + + if (retries++ > chan->syncpt_timeout_retry) + else + err = 0; diff --git a/drivers/staging/media/tegra-video/vi.c b/drivers/staging/media/tegra-video/vi.c --- a/drivers/staging/media/tegra-video/vi.c +++ b/drivers/staging/media/tegra-video/vi.c -#if is_enabled(config_video_tegra_tpg) + case v4l2_cid_tegra_syncpt_timeout_retry: + chan->syncpt_timeout_retry = ctrl->val; + break; +#if is_enabled(config_video_tegra_tpg) +#else +static const struct v4l2_ctrl_config syncpt_timeout_ctrl = { + .ops = &vi_ctrl_ops, + .id = v4l2_cid_tegra_syncpt_timeout_retry, + .name = "syncpt timeout retry", + .type = v4l2_ctrl_type_integer, + .min = 1, + .max = 10000, + .step = 1, + .def = 5, +}; + /* custom control */ + v4l2_ctrl_new_custom(&chan->ctrl_handler, &syncpt_timeout_ctrl, null); + if (chan->ctrl_handler.error) { + dev_err(chan->vi->dev, "failed to add %s ctrl handler: %d ", + syncpt_timeout_ctrl.name, + chan->ctrl_handler.error); + v4l2_ctrl_handler_free(&chan->ctrl_handler); + return chan->ctrl_handler.error; + } + diff --git a/drivers/staging/media/tegra-video/vi.h b/drivers/staging/media/tegra-video/vi.h --- a/drivers/staging/media/tegra-video/vi.h +++ b/drivers/staging/media/tegra-video/vi.h +#define v4l2_cid_tegra_syncpt_timeout_retry (v4l2_ctrl_class_camera | 0x1001) + + * @syncpt_timeout_retry: syncpt timeout retry count for the capture + unsigned int syncpt_timeout_retry;
|
Drivers in the Staging area
|
a45c39b8295f39930095f5a3693762f3ea454205
|
sowjanya komatineni
|
drivers
|
staging
|
media, tegra-video
|
bluetooth: btqca: add support to read fw build version for wcn3991 btsoc
|
add support to read fw build version from debugfs node. this info can be read from /sys/kernel/debug/bluetooth/hci0/firmware_info
|
this release allows to map an uid to a different one in a mount; it also adds support for selecting the preemption model at runtime; support for a low-overhead memory error detector designed to be used in production; support for the acrn hypervisor designed for embedded systems; btrfs initial support for zoned devices, subpage blocks sizes and performance improvements; support for eager nfs writes; support for a thermal power management to control the surface temperature of embedded devices in an unified way; the napi polling can be moved to a kernel thread; and support for non-blocking path lookups. as always, there are many other features, new drivers, improvements and fixes.
|
add support to read fw build version for wcn3991 btsoc
|
['core (various)', 'file systems', 'memory management', 'block layer', 'tracing, perf and bpf', 'virtualization', 'cryptography', 'security', 'networking', 'architectures x86 arm risc-v powerpc mips csky s390 pa-risc c6x']
|
['graphics', 'power management', 'storage', 'drivers in the staging area', 'networking', 'audio', 'tablets, touch screens, keyboards, mouses', 'tv tuners, webcams, video capturers', 'universal serial bus', 'serial peripheral interface (spi)', 'watchdog', 'serial', 'cpu frequency scaling', 'device voltage and frequency scaling', 'voltage, current regulators, power capping, power supply', 'real time clock (rtc)', 'pin controllers (pinctrl)', 'multi media card (mmc)', 'memory technology devices (mtd)', 'industrial i/o (iio)', 'multi function devices (mfd)', 'pulse-width modulation (pwm)', 'inter-integrated circuit (i2c + i3c)', 'hardware monitoring (hwmon)', 'general purpose i/o (gpio)', 'leds', 'dma engines', 'cryptography hardware acceleration', 'pci', 'non-transparent bridge (ntb)', 'thunderbolt', 'clock', 'phy ("physical layer" framework)', 'cxl (compute express link)', 'various']
|
['bluetooth ', 'btqca']
|
['h', 'c']
| 2
| 55
| 0
|
--- diff --git a/drivers/bluetooth/btqca.c b/drivers/bluetooth/btqca.c --- a/drivers/bluetooth/btqca.c +++ b/drivers/bluetooth/btqca.c +static int qca_read_fw_build_info(struct hci_dev *hdev) +{ + struct sk_buff *skb; + struct edl_event_hdr *edl; + char cmd, build_label[qca_fw_build_ver_len]; + int build_lbl_len, err = 0; + + bt_dev_dbg(hdev, "qca read fw build info"); + + cmd = edl_get_build_info_cmd; + skb = __hci_cmd_sync_ev(hdev, edl_patch_cmd_opcode, edl_patch_cmd_len, + &cmd, 0, hci_init_timeout); + if (is_err(skb)) { + err = ptr_err(skb); + bt_dev_err(hdev, "reading qca fw build info failed (%d)", + err); + return err; + } + + edl = (struct edl_event_hdr *)(skb->data); + if (!edl) { + bt_dev_err(hdev, "qca read fw build info with no header"); + err = -eilseq; + goto out; + } + + if (edl->cresp != edl_cmd_req_res_evt || + edl->rtype != edl_get_build_info_cmd) { + bt_dev_err(hdev, "qca wrong packet received %d %d", edl->cresp, + edl->rtype); + err = -eio; + goto out; + } + + build_lbl_len = edl->data[0]; + if (build_lbl_len <= qca_fw_build_ver_len - 1) { + memcpy(build_label, edl->data + 1, build_lbl_len); + *(build_label + build_lbl_len) = ''; + } + + hci_set_fw_info(hdev, "%s", build_label); + +out: + kfree_skb(skb); + return err; +} + + if (soc_type == qca_wcn3991) { + /* get fw build info */ + err = qca_read_fw_build_info(hdev); + if (err < 0) + return err; + } + diff --git a/drivers/bluetooth/btqca.h b/drivers/bluetooth/btqca.h --- a/drivers/bluetooth/btqca.h +++ b/drivers/bluetooth/btqca.h +#define edl_get_build_info_cmd (0x20)
|
Networking
|
c0187b0bd3e94c48050687d87b2c3c9fbae98ae9
|
venkata lakshmi narayana gubba
|
drivers
|
bluetooth
| |
bluetooth: btqca: enable msft extension for qualcomm wcn399x
|
the following qualcomm wcn399x bluetooth controllers support the microsoft vendor extension and they are using 0xfd70 for vsmsftopcode. -wcn3990 -wcn3991 -wcn3998
|
this release allows to map an uid to a different one in a mount; it also adds support for selecting the preemption model at runtime; support for a low-overhead memory error detector designed to be used in production; support for the acrn hypervisor designed for embedded systems; btrfs initial support for zoned devices, subpage blocks sizes and performance improvements; support for eager nfs writes; support for a thermal power management to control the surface temperature of embedded devices in an unified way; the napi polling can be moved to a kernel thread; and support for non-blocking path lookups. as always, there are many other features, new drivers, improvements and fixes.
|
enable msft extension for qualcomm wcn399x
|
['core (various)', 'file systems', 'memory management', 'block layer', 'tracing, perf and bpf', 'virtualization', 'cryptography', 'security', 'networking', 'architectures x86 arm risc-v powerpc mips csky s390 pa-risc c6x']
|
['graphics', 'power management', 'storage', 'drivers in the staging area', 'networking', 'audio', 'tablets, touch screens, keyboards, mouses', 'tv tuners, webcams, video capturers', 'universal serial bus', 'serial peripheral interface (spi)', 'watchdog', 'serial', 'cpu frequency scaling', 'device voltage and frequency scaling', 'voltage, current regulators, power capping, power supply', 'real time clock (rtc)', 'pin controllers (pinctrl)', 'multi media card (mmc)', 'memory technology devices (mtd)', 'industrial i/o (iio)', 'multi function devices (mfd)', 'pulse-width modulation (pwm)', 'inter-integrated circuit (i2c + i3c)', 'hardware monitoring (hwmon)', 'general purpose i/o (gpio)', 'leds', 'dma engines', 'cryptography hardware acceleration', 'pci', 'non-transparent bridge (ntb)', 'thunderbolt', 'clock', 'phy ("physical layer" framework)', 'cxl (compute express link)', 'various']
|
['bluetooth ', 'btqca']
|
['c']
| 1
| 13
| 0
|
-wcn3990 -wcn3991 -wcn3998 - boot the device with wcn3991 and verify info print in dmesg. --- diff --git a/drivers/bluetooth/btqca.c b/drivers/bluetooth/btqca.c --- a/drivers/bluetooth/btqca.c +++ b/drivers/bluetooth/btqca.c + /* wcn399x supports the microsoft vendor extension with 0xfd70 as the + * vsmsftopcode. + */ + switch (soc_type) { + case qca_wcn3990: + case qca_wcn3991: + case qca_wcn3998: + hci_set_msft_opcode(hdev, 0xfd70); + break; + default: + break; + } +
|
Networking
|
eaf19b0c47d142eedec34f7043f574fa3834c8b7
|
miao chen chou
|
drivers
|
bluetooth
| |
bluetooth: btrtl: enable msft extension for rtl8822ce controller
|
the realtek rtl8822ce bluetooth controller support microsoft vendor extension and it uses 0xfcf0 for vsmsftopcode.
|
this release allows to map an uid to a different one in a mount; it also adds support for selecting the preemption model at runtime; support for a low-overhead memory error detector designed to be used in production; support for the acrn hypervisor designed for embedded systems; btrfs initial support for zoned devices, subpage blocks sizes and performance improvements; support for eager nfs writes; support for a thermal power management to control the surface temperature of embedded devices in an unified way; the napi polling can be moved to a kernel thread; and support for non-blocking path lookups. as always, there are many other features, new drivers, improvements and fixes.
|
enable msft extension for rtl8822ce controller
|
['core (various)', 'file systems', 'memory management', 'block layer', 'tracing, perf and bpf', 'virtualization', 'cryptography', 'security', 'networking', 'architectures x86 arm risc-v powerpc mips csky s390 pa-risc c6x']
|
['graphics', 'power management', 'storage', 'drivers in the staging area', 'networking', 'audio', 'tablets, touch screens, keyboards, mouses', 'tv tuners, webcams, video capturers', 'universal serial bus', 'serial peripheral interface (spi)', 'watchdog', 'serial', 'cpu frequency scaling', 'device voltage and frequency scaling', 'voltage, current regulators, power capping, power supply', 'real time clock (rtc)', 'pin controllers (pinctrl)', 'multi media card (mmc)', 'memory technology devices (mtd)', 'industrial i/o (iio)', 'multi function devices (mfd)', 'pulse-width modulation (pwm)', 'inter-integrated circuit (i2c + i3c)', 'hardware monitoring (hwmon)', 'general purpose i/o (gpio)', 'leds', 'dma engines', 'cryptography hardware acceleration', 'pci', 'non-transparent bridge (ntb)', 'thunderbolt', 'clock', 'phy ("physical layer" framework)', 'cxl (compute express link)', 'various']
|
['bluetooth ', 'btrtl']
|
['c']
| 1
| 6
| 0
|
- boot the test device with rtl8822ce and verify the info print in --- diff --git a/drivers/bluetooth/btrtl.c b/drivers/bluetooth/btrtl.c --- a/drivers/bluetooth/btrtl.c +++ b/drivers/bluetooth/btrtl.c + /* rtl8822ce supports the microsoft vendor extension and uses 0xfcf0 + * for vsmsftopcode. + */ + if (lmp_subver == rtl_rom_lmp_8822b) + hci_set_msft_opcode(hdev, 0xfcf0); +
|
Networking
|
673fae14f24052ead45e0446d1c3c829bd2f2e64
|
miao chen chou
|
drivers
|
bluetooth
| |
bluetooth: btrtl: enable central-peripheral role
|
enable the central-peripheral role on rtl8822ce. this enables creating connections while there is an existing connection in the slave role.
|
this release allows to map an uid to a different one in a mount; it also adds support for selecting the preemption model at runtime; support for a low-overhead memory error detector designed to be used in production; support for the acrn hypervisor designed for embedded systems; btrfs initial support for zoned devices, subpage blocks sizes and performance improvements; support for eager nfs writes; support for a thermal power management to control the surface temperature of embedded devices in an unified way; the napi polling can be moved to a kernel thread; and support for non-blocking path lookups. as always, there are many other features, new drivers, improvements and fixes.
|
enable central-peripheral role
|
['core (various)', 'file systems', 'memory management', 'block layer', 'tracing, perf and bpf', 'virtualization', 'cryptography', 'security', 'networking', 'architectures x86 arm risc-v powerpc mips csky s390 pa-risc c6x']
|
['graphics', 'power management', 'storage', 'drivers in the staging area', 'networking', 'audio', 'tablets, touch screens, keyboards, mouses', 'tv tuners, webcams, video capturers', 'universal serial bus', 'serial peripheral interface (spi)', 'watchdog', 'serial', 'cpu frequency scaling', 'device voltage and frequency scaling', 'voltage, current regulators, power capping, power supply', 'real time clock (rtc)', 'pin controllers (pinctrl)', 'multi media card (mmc)', 'memory technology devices (mtd)', 'industrial i/o (iio)', 'multi function devices (mfd)', 'pulse-width modulation (pwm)', 'inter-integrated circuit (i2c + i3c)', 'hardware monitoring (hwmon)', 'general purpose i/o (gpio)', 'leds', 'dma engines', 'cryptography hardware acceleration', 'pci', 'non-transparent bridge (ntb)', 'thunderbolt', 'clock', 'phy ("physical layer" framework)', 'cxl (compute express link)', 'various']
|
['bluetooth ', 'btrtl']
|
['c']
| 1
| 13
| 2
|
--- diff --git a/drivers/bluetooth/btrtl.c b/drivers/bluetooth/btrtl.c --- a/drivers/bluetooth/btrtl.c +++ b/drivers/bluetooth/btrtl.c - btrtl_free(btrtl_dev); - + /* enable central-peripheral role (able to create new connections with + * an existing connection in slave role). + */ + switch (btrtl_dev->ic_info->lmp_subver) { + case rtl_rom_lmp_8822b: + set_bit(hci_quirk_valid_le_states, &hdev->quirks); + break; + default: + rtl_dev_dbg(hdev, "central-peripheral role not enabled."); + break; + } + + btrtl_free(btrtl_dev);
|
Networking
|
05672a2c14a4ea20b7e31a1d8d847292c2b60c10
|
abhishek pandit subedi
|
drivers
|
bluetooth
| |
bluetooth: btusb: add protocol support for mediatek mt7921u usb devices
|
there is mt7921 firmware download mechanism
|
this release allows to map an uid to a different one in a mount; it also adds support for selecting the preemption model at runtime; support for a low-overhead memory error detector designed to be used in production; support for the acrn hypervisor designed for embedded systems; btrfs initial support for zoned devices, subpage blocks sizes and performance improvements; support for eager nfs writes; support for a thermal power management to control the surface temperature of embedded devices in an unified way; the napi polling can be moved to a kernel thread; and support for non-blocking path lookups. as always, there are many other features, new drivers, improvements and fixes.
|
add protocol support for mediatek mt7921u usb devices
|
['core (various)', 'file systems', 'memory management', 'block layer', 'tracing, perf and bpf', 'virtualization', 'cryptography', 'security', 'networking', 'architectures x86 arm risc-v powerpc mips csky s390 pa-risc c6x']
|
['graphics', 'power management', 'storage', 'drivers in the staging area', 'networking', 'audio', 'tablets, touch screens, keyboards, mouses', 'tv tuners, webcams, video capturers', 'universal serial bus', 'serial peripheral interface (spi)', 'watchdog', 'serial', 'cpu frequency scaling', 'device voltage and frequency scaling', 'voltage, current regulators, power capping, power supply', 'real time clock (rtc)', 'pin controllers (pinctrl)', 'multi media card (mmc)', 'memory technology devices (mtd)', 'industrial i/o (iio)', 'multi function devices (mfd)', 'pulse-width modulation (pwm)', 'inter-integrated circuit (i2c + i3c)', 'hardware monitoring (hwmon)', 'general purpose i/o (gpio)', 'leds', 'dma engines', 'cryptography hardware acceleration', 'pci', 'non-transparent bridge (ntb)', 'thunderbolt', 'clock', 'phy ("physical layer" framework)', 'cxl (compute express link)', 'various']
|
['bluetooth ', 'btusb']
|
['c']
| 1
| 200
| 0
|
--- diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c --- a/drivers/bluetooth/btusb.c +++ b/drivers/bluetooth/btusb.c +/* it is for mt79xx download rom patch*/ +#define mtk_fw_rom_patch_header_size 32 +#define mtk_fw_rom_patch_gd_size 64 +#define mtk_fw_rom_patch_sec_map_size 64 +#define mtk_sec_map_common_size 12 +#define mtk_sec_map_need_send_size 52 +struct btmtk_patch_header { + u8 datetime[16]; + u8 platform[4]; + __le16 hwver; + __le16 swver; + __le32 magicnum; +} __packed; + +struct btmtk_global_desc { + __le32 patch_ver; + __le32 sub_sys; + __le32 feature_opt; + __le32 section_num; +} __packed; + +struct btmtk_section_map { + __le32 sectype; + __le32 secoffset; + __le32 secsize; + union { + __le32 u4secspec[13]; + struct { + __le32 dladdr; + __le32 dlsize; + __le32 seckeyidx; + __le32 alignlen; + __le32 sectype; + __le32 dlmodecrctype; + __le32 crc; + __le32 reserved[6]; + } bin_info_spec; + }; +} __packed; + + case btmtk_wmt_patch_dwnld: + if (wmt_evt->whdr.flag == 2) + status = btmtk_wmt_patch_done; + else if (wmt_evt->whdr.flag == 1) + status = btmtk_wmt_patch_progress; + else + status = btmtk_wmt_patch_undone; + break; +static int btusb_mtk_setup_firmware_79xx(struct hci_dev *hdev, const char *fwname) +{ + struct btmtk_hci_wmt_params wmt_params; + struct btmtk_patch_header *patchhdr = null; + struct btmtk_global_desc *globaldesc = null; + struct btmtk_section_map *sectionmap; + const struct firmware *fw; + const u8 *fw_ptr; + const u8 *fw_bin_ptr; + size_t fw_size; + int err, dlen, i, status; + u8 flag, first_block, retry; + u32 section_num, dl_size, section_offset; + u8 cmd[64]; + + err = request_firmware(&fw, fwname, &hdev->dev); + if (err < 0) { + bt_dev_err(hdev, "failed to load firmware file (%d)", err); + return err; + } + + fw_ptr = fw->data; + fw_bin_ptr = fw_ptr; + fw_size = fw->size; + patchhdr = (struct btmtk_patch_header *)fw_ptr; + globaldesc = (struct btmtk_global_desc *)(fw_ptr + mtk_fw_rom_patch_header_size); + section_num = globaldesc->section_num; + + for (i = 0; i < section_num; i++) { + first_block = 1; + fw_ptr = fw_bin_ptr; + sectionmap = (struct btmtk_section_map *)(fw_ptr + mtk_fw_rom_patch_header_size + + mtk_fw_rom_patch_gd_size + mtk_fw_rom_patch_sec_map_size * i); + + section_offset = sectionmap->secoffset; + dl_size = sectionmap->bin_info_spec.dlsize; + + if (dl_size > 0) { + retry = 20; + while (retry > 0) { + cmd[0] = 0; /* 0 means legacy dl mode. */ + memcpy(cmd + 1, + fw_ptr + mtk_fw_rom_patch_header_size + + mtk_fw_rom_patch_gd_size + mtk_fw_rom_patch_sec_map_size * i + + mtk_sec_map_common_size, + mtk_sec_map_need_send_size + 1); + + wmt_params.op = btmtk_wmt_patch_dwnld; + wmt_params.status = &status; + wmt_params.flag = 0; + wmt_params.dlen = mtk_sec_map_need_send_size + 1; + wmt_params.data = &cmd; + + err = btusb_mtk_hci_wmt_sync(hdev, &wmt_params); + if (err < 0) { + bt_dev_err(hdev, "failed to send wmt patch dwnld (%d)", + err); + goto err_release_fw; + } + + if (status == btmtk_wmt_patch_undone) { + break; + } else if (status == btmtk_wmt_patch_progress) { + msleep(100); + retry--; + } else if (status == btmtk_wmt_patch_done) { + goto next_section; + } else { + bt_dev_err(hdev, "failed wmt patch dwnld status (%d)", + status); + goto err_release_fw; + } + } + + fw_ptr += section_offset; + wmt_params.op = btmtk_wmt_patch_dwnld; + wmt_params.status = null; + + while (dl_size > 0) { + dlen = min_t(int, 250, dl_size); + if (first_block == 1) { + flag = 1; + first_block = 0; + } else if (dl_size - dlen <= 0) { + flag = 3; + } else { + flag = 2; + } + + wmt_params.flag = flag; + wmt_params.dlen = dlen; + wmt_params.data = fw_ptr; + + err = btusb_mtk_hci_wmt_sync(hdev, &wmt_params); + if (err < 0) { + bt_dev_err(hdev, "failed to send wmt patch dwnld (%d)", + err); + goto err_release_fw; + } + + dl_size -= dlen; + fw_ptr += dlen; + } + } +next_section: + continue; + } + /* wait a few moments for firmware activation done */ + usleep_range(100000, 120000); + +err_release_fw: + release_firmware(fw); + + return err; +} + + char fw_bin_name[64]; + u32 fw_version; + if (!dev_id) { + err = btusb_mtk_id_get(data, 0x70010200, &dev_id); + if (err < 0) { + bt_dev_err(hdev, "failed to get device id (%d)", err); + return err; + } + err = btusb_mtk_id_get(data, 0x80021004, &fw_version); + if (err < 0) { + bt_dev_err(hdev, "failed to get fw version (%d)", err); + return err; + } + } + + case 0x7961: + snprintf(fw_bin_name, sizeof(fw_bin_name), + "mediatek/bt_ram_code_mt%04x_1_%x_hdr.bin", + dev_id & 0xffff, (fw_version & 0xff) + 1); + err = btusb_mtk_setup_firmware_79xx(hdev, fw_bin_name); + + /* enable bluetooth protocol */ + param = 1; + wmt_params.op = btmtk_wmt_func_ctrl; + wmt_params.flag = 0; + wmt_params.dlen = sizeof(param); + wmt_params.data = ¶m; + wmt_params.status = null; + + err = btusb_mtk_hci_wmt_sync(hdev, &wmt_params); + if (err < 0) { + bt_dev_err(hdev, "failed to send wmt func ctrl (%d)", err); + return err; + } + goto done; +done:
|
Networking
|
fc342c4dc408754f50f19dc832152fbb4b73f1e6
|
mark chen
|
drivers
|
bluetooth
| |
bluetooth: btusb: add support for garfieldpeak controller
|
vid:pid -> 8087:0033
|
this release allows to map an uid to a different one in a mount; it also adds support for selecting the preemption model at runtime; support for a low-overhead memory error detector designed to be used in production; support for the acrn hypervisor designed for embedded systems; btrfs initial support for zoned devices, subpage blocks sizes and performance improvements; support for eager nfs writes; support for a thermal power management to control the surface temperature of embedded devices in an unified way; the napi polling can be moved to a kernel thread; and support for non-blocking path lookups. as always, there are many other features, new drivers, improvements and fixes.
|
add support for garfieldpeak controller
|
['core (various)', 'file systems', 'memory management', 'block layer', 'tracing, perf and bpf', 'virtualization', 'cryptography', 'security', 'networking', 'architectures x86 arm risc-v powerpc mips csky s390 pa-risc c6x']
|
['graphics', 'power management', 'storage', 'drivers in the staging area', 'networking', 'audio', 'tablets, touch screens, keyboards, mouses', 'tv tuners, webcams, video capturers', 'universal serial bus', 'serial peripheral interface (spi)', 'watchdog', 'serial', 'cpu frequency scaling', 'device voltage and frequency scaling', 'voltage, current regulators, power capping, power supply', 'real time clock (rtc)', 'pin controllers (pinctrl)', 'multi media card (mmc)', 'memory technology devices (mtd)', 'industrial i/o (iio)', 'multi function devices (mfd)', 'pulse-width modulation (pwm)', 'inter-integrated circuit (i2c + i3c)', 'hardware monitoring (hwmon)', 'general purpose i/o (gpio)', 'leds', 'dma engines', 'cryptography hardware acceleration', 'pci', 'non-transparent bridge (ntb)', 'thunderbolt', 'clock', 'phy ("physical layer" framework)', 'cxl (compute express link)', 'various']
|
['bluetooth ', 'btusb']
|
['c']
| 1
| 2
| 0
|
--- diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c --- a/drivers/bluetooth/btusb.c +++ b/drivers/bluetooth/btusb.c + { usb_device(0x8087, 0x0033), .driver_info = btusb_intel_newgen | + btusb_wideband_speech},
|
Networking
|
f01bb2a368809a8bbb13a51a331d044b605317a8
|
kiran k
|
drivers
|
bluetooth
| |
bluetooth: btusb: enable msft extension for intel controllers
|
the intel jeffersonpeak, harrisonpeak and cyclonepeak bluetooth controllers support the microsoft vendor extension and they are using 0xfc1e for vsmsftopcode.
|
this release allows to map an uid to a different one in a mount; it also adds support for selecting the preemption model at runtime; support for a low-overhead memory error detector designed to be used in production; support for the acrn hypervisor designed for embedded systems; btrfs initial support for zoned devices, subpage blocks sizes and performance improvements; support for eager nfs writes; support for a thermal power management to control the surface temperature of embedded devices in an unified way; the napi polling can be moved to a kernel thread; and support for non-blocking path lookups. as always, there are many other features, new drivers, improvements and fixes.
|
enable msft extension for intel controllers
|
['core (various)', 'file systems', 'memory management', 'block layer', 'tracing, perf and bpf', 'virtualization', 'cryptography', 'security', 'networking', 'architectures x86 arm risc-v powerpc mips csky s390 pa-risc c6x']
|
['graphics', 'power management', 'storage', 'drivers in the staging area', 'networking', 'audio', 'tablets, touch screens, keyboards, mouses', 'tv tuners, webcams, video capturers', 'universal serial bus', 'serial peripheral interface (spi)', 'watchdog', 'serial', 'cpu frequency scaling', 'device voltage and frequency scaling', 'voltage, current regulators, power capping, power supply', 'real time clock (rtc)', 'pin controllers (pinctrl)', 'multi media card (mmc)', 'memory technology devices (mtd)', 'industrial i/o (iio)', 'multi function devices (mfd)', 'pulse-width modulation (pwm)', 'inter-integrated circuit (i2c + i3c)', 'hardware monitoring (hwmon)', 'general purpose i/o (gpio)', 'leds', 'dma engines', 'cryptography hardware acceleration', 'pci', 'non-transparent bridge (ntb)', 'thunderbolt', 'clock', 'phy ("physical layer" framework)', 'cxl (compute express link)', 'various']
|
['bluetooth ', 'btusb']
|
['c']
| 1
| 3
| 0
|
- boot the test devices with harrisonpeak and verify info print in --- diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c --- a/drivers/bluetooth/btusb.c +++ b/drivers/bluetooth/btusb.c + case 0x11: /* jfp */ + case 0x13: /* hrp */ + case 0x14: /* ccp */
|
Networking
|
7a45bcb49a39b1aad9a18eb226ad4f86bdbd2119
|
miao chen chou
|
drivers
|
bluetooth
| |
bluetooth: hci_bcm: add support for iso packets
|
this enables bcm driver to properly handle iso packets.
|
this release allows to map an uid to a different one in a mount; it also adds support for selecting the preemption model at runtime; support for a low-overhead memory error detector designed to be used in production; support for the acrn hypervisor designed for embedded systems; btrfs initial support for zoned devices, subpage blocks sizes and performance improvements; support for eager nfs writes; support for a thermal power management to control the surface temperature of embedded devices in an unified way; the napi polling can be moved to a kernel thread; and support for non-blocking path lookups. as always, there are many other features, new drivers, improvements and fixes.
|
add support for iso packets
|
['core (various)', 'file systems', 'memory management', 'block layer', 'tracing, perf and bpf', 'virtualization', 'cryptography', 'security', 'networking', 'architectures x86 arm risc-v powerpc mips csky s390 pa-risc c6x']
|
['graphics', 'power management', 'storage', 'drivers in the staging area', 'networking', 'audio', 'tablets, touch screens, keyboards, mouses', 'tv tuners, webcams, video capturers', 'universal serial bus', 'serial peripheral interface (spi)', 'watchdog', 'serial', 'cpu frequency scaling', 'device voltage and frequency scaling', 'voltage, current regulators, power capping, power supply', 'real time clock (rtc)', 'pin controllers (pinctrl)', 'multi media card (mmc)', 'memory technology devices (mtd)', 'industrial i/o (iio)', 'multi function devices (mfd)', 'pulse-width modulation (pwm)', 'inter-integrated circuit (i2c + i3c)', 'hardware monitoring (hwmon)', 'general purpose i/o (gpio)', 'leds', 'dma engines', 'cryptography hardware acceleration', 'pci', 'non-transparent bridge (ntb)', 'thunderbolt', 'clock', 'phy ("physical layer" framework)', 'cxl (compute express link)', 'various']
|
['bluetooth ', 'hci_bcm']
|
['c']
| 1
| 1
| 0
|
--- diff --git a/drivers/bluetooth/hci_bcm.c b/drivers/bluetooth/hci_bcm.c --- a/drivers/bluetooth/hci_bcm.c +++ b/drivers/bluetooth/hci_bcm.c + { h4_recv_iso, .recv = hci_recv_frame },
|
Networking
|
9edd1de7108f9f672a329a5c69ce257cc610c509
|
jakub pawlowski
|
drivers
|
bluetooth
| |
bluetooth: hci_h5: add support for binding rtl8723ds with device tree
|
rtl8723ds could be handled by btrtl-driver, so add ability to bind it using device tree.
|
this release allows to map an uid to a different one in a mount; it also adds support for selecting the preemption model at runtime; support for a low-overhead memory error detector designed to be used in production; support for the acrn hypervisor designed for embedded systems; btrfs initial support for zoned devices, subpage blocks sizes and performance improvements; support for eager nfs writes; support for a thermal power management to control the surface temperature of embedded devices in an unified way; the napi polling can be moved to a kernel thread; and support for non-blocking path lookups. as always, there are many other features, new drivers, improvements and fixes.
|
add support for binding rtl8723ds with device tree
|
['core (various)', 'file systems', 'memory management', 'block layer', 'tracing, perf and bpf', 'virtualization', 'cryptography', 'security', 'networking', 'architectures x86 arm risc-v powerpc mips csky s390 pa-risc c6x']
|
['graphics', 'power management', 'storage', 'drivers in the staging area', 'networking', 'audio', 'tablets, touch screens, keyboards, mouses', 'tv tuners, webcams, video capturers', 'universal serial bus', 'serial peripheral interface (spi)', 'watchdog', 'serial', 'cpu frequency scaling', 'device voltage and frequency scaling', 'voltage, current regulators, power capping, power supply', 'real time clock (rtc)', 'pin controllers (pinctrl)', 'multi media card (mmc)', 'memory technology devices (mtd)', 'industrial i/o (iio)', 'multi function devices (mfd)', 'pulse-width modulation (pwm)', 'inter-integrated circuit (i2c + i3c)', 'hardware monitoring (hwmon)', 'general purpose i/o (gpio)', 'leds', 'dma engines', 'cryptography hardware acceleration', 'pci', 'non-transparent bridge (ntb)', 'thunderbolt', 'clock', 'phy ("physical layer" framework)', 'cxl (compute express link)', 'various']
|
['bluetooth ', 'hci_h5']
|
['c']
| 1
| 2
| 0
|
--- diff --git a/drivers/bluetooth/hci_h5.c b/drivers/bluetooth/hci_h5.c --- a/drivers/bluetooth/hci_h5.c +++ b/drivers/bluetooth/hci_h5.c + { .compatible = "realtek,rtl8723ds-bt", + .data = (const void *)&rtl_vnd },
|
Networking
|
f272f185d259e2d574b4868fe8fb0ee56f3c2cfa
|
john eric kamps
|
drivers
|
bluetooth
| |
rdma/core: introduce and use api to read port immutable data
|
currently mlx5 driver caches port gid table length for 2 ports. it is also cached by ib core as port immutable data.
|
this release allows to map an uid to a different one in a mount; it also adds support for selecting the preemption model at runtime; support for a low-overhead memory error detector designed to be used in production; support for the acrn hypervisor designed for embedded systems; btrfs initial support for zoned devices, subpage blocks sizes and performance improvements; support for eager nfs writes; support for a thermal power management to control the surface temperature of embedded devices in an unified way; the napi polling can be moved to a kernel thread; and support for non-blocking path lookups. as always, there are many other features, new drivers, improvements and fixes.
|
introduce and use api to read port immutable data
|
['core (various)', 'file systems', 'memory management', 'block layer', 'tracing, perf and bpf', 'virtualization', 'cryptography', 'security', 'networking', 'architectures x86 arm risc-v powerpc mips csky s390 pa-risc c6x']
|
['graphics', 'power management', 'storage', 'drivers in the staging area', 'networking', 'audio', 'tablets, touch screens, keyboards, mouses', 'tv tuners, webcams, video capturers', 'universal serial bus', 'serial peripheral interface (spi)', 'watchdog', 'serial', 'cpu frequency scaling', 'device voltage and frequency scaling', 'voltage, current regulators, power capping, power supply', 'real time clock (rtc)', 'pin controllers (pinctrl)', 'multi media card (mmc)', 'memory technology devices (mtd)', 'industrial i/o (iio)', 'multi function devices (mfd)', 'pulse-width modulation (pwm)', 'inter-integrated circuit (i2c + i3c)', 'hardware monitoring (hwmon)', 'general purpose i/o (gpio)', 'leds', 'dma engines', 'cryptography hardware acceleration', 'pci', 'non-transparent bridge (ntb)', 'thunderbolt', 'clock', 'phy ("physical layer" framework)', 'cxl (compute express link)', 'various']
|
['rdma/infiniband ']
|
['h', 'c']
| 5
| 23
| 58
|
--- diff --git a/drivers/infiniband/core/device.c b/drivers/infiniband/core/device.c --- a/drivers/infiniband/core/device.c +++ b/drivers/infiniband/core/device.c +/** + * ib_port_immutable_read() - read rdma port's immutable data + * @dev - ib device + * @port - port number whose immutable data to read. it starts with index 1 and + * valid upto including rdma_end_port(). + */ +const struct ib_port_immutable* +ib_port_immutable_read(struct ib_device *dev, unsigned int port) +{ + warn_on(!rdma_is_port_valid(dev, port)); + return &dev->port_data[port].immutable; +} +export_symbol(ib_port_immutable_read); + diff --git a/drivers/infiniband/hw/mlx5/main.c b/drivers/infiniband/hw/mlx5/main.c --- a/drivers/infiniband/hw/mlx5/main.c +++ b/drivers/infiniband/hw/mlx5/main.c -static int __get_port_caps(struct mlx5_ib_dev *dev, u8 port) -{ - struct ib_port_attr *pprops = null; - int err = -enomem; - - pprops = kzalloc(sizeof(*pprops), gfp_kernel); - if (!pprops) - goto out; - - err = mlx5_ib_query_port(&dev->ib_dev, port, pprops); - if (err) { - mlx5_ib_warn(dev, "query_port %d failed %d ", - port, err); - goto out; - } - - dev->port_caps[port - 1].gid_table_len = pprops->gid_tbl_len; - mlx5_ib_dbg(dev, "port %d: pkey_table_len %d, gid_table_len %d ", - port, dev->pkey_table_len, pprops->gid_tbl_len); - -out: - kfree(pprops); - return err; -} - -static int get_port_caps(struct mlx5_ib_dev *dev, u8 port) -{ - /* for representors use port 1, is this is the only native - * port - */ - if (dev->is_rep) - return __get_port_caps(dev, 1); - return __get_port_caps(dev, port); -} - - err = get_port_caps(ibdev, mlx5_core_native_port_num(mpi->mdev)); - if (err) - goto unbind; - - if (!bound) { - get_port_caps(dev, i + 1); + if (!bound) - } - if (!mlx5_core_mp_enabled(mdev)) { - for (i = 1; i <= dev->num_ports; i++) { - err = get_port_caps(dev, i); - if (err) - break; - } - } else { - err = get_port_caps(dev, mlx5_core_native_port_num(mdev)); - } - if (err) - goto err_mp; - diff --git a/drivers/infiniband/hw/mlx5/mlx5_ib.h b/drivers/infiniband/hw/mlx5/mlx5_ib.h --- a/drivers/infiniband/hw/mlx5/mlx5_ib.h +++ b/drivers/infiniband/hw/mlx5/mlx5_ib.h - int gid_table_len; diff --git a/drivers/infiniband/hw/mlx5/qp.c b/drivers/infiniband/hw/mlx5/qp.c --- a/drivers/infiniband/hw/mlx5/qp.c +++ b/drivers/infiniband/hw/mlx5/qp.c - if (grh->sgid_index >= - dev->port_caps[port - 1].gid_table_len) { + const struct ib_port_immutable *immutable; + + immutable = ib_port_immutable_read(&dev->ib_dev, port); + if (grh->sgid_index >= immutable->gid_tbl_len) { - dev->port_caps[port - 1].gid_table_len); + immutable->gid_tbl_len); diff --git a/include/rdma/ib_verbs.h b/include/rdma/ib_verbs.h --- a/include/rdma/ib_verbs.h +++ b/include/rdma/ib_verbs.h + +const struct ib_port_immutable* +ib_port_immutable_read(struct ib_device *dev, unsigned int port);
|
Networking
|
7416790e22452bfa86de6b55638eacf7780c8f6f
|
parav pandit
|
include
|
rdma
|
core, hw, mlx5
|
rdma/hns: add support of direct wqe
|
direct wqe is a mechanism to fill wqe directly into the hardware. in the case of light load, the wqe will be filled into pcie bar space of the hardware, this will reduce one memory access operation and therefore reduce the latency.
|
this release allows to map an uid to a different one in a mount; it also adds support for selecting the preemption model at runtime; support for a low-overhead memory error detector designed to be used in production; support for the acrn hypervisor designed for embedded systems; btrfs initial support for zoned devices, subpage blocks sizes and performance improvements; support for eager nfs writes; support for a thermal power management to control the surface temperature of embedded devices in an unified way; the napi polling can be moved to a kernel thread; and support for non-blocking path lookups. as always, there are many other features, new drivers, improvements and fixes.
|
add support of direct wqe
|
['core (various)', 'file systems', 'memory management', 'block layer', 'tracing, perf and bpf', 'virtualization', 'cryptography', 'security', 'networking', 'architectures x86 arm risc-v powerpc mips csky s390 pa-risc c6x']
|
['graphics', 'power management', 'storage', 'drivers in the staging area', 'networking', 'audio', 'tablets, touch screens, keyboards, mouses', 'tv tuners, webcams, video capturers', 'universal serial bus', 'serial peripheral interface (spi)', 'watchdog', 'serial', 'cpu frequency scaling', 'device voltage and frequency scaling', 'voltage, current regulators, power capping, power supply', 'real time clock (rtc)', 'pin controllers (pinctrl)', 'multi media card (mmc)', 'memory technology devices (mtd)', 'industrial i/o (iio)', 'multi function devices (mfd)', 'pulse-width modulation (pwm)', 'inter-integrated circuit (i2c + i3c)', 'hardware monitoring (hwmon)', 'general purpose i/o (gpio)', 'leds', 'dma engines', 'cryptography hardware acceleration', 'pci', 'non-transparent bridge (ntb)', 'thunderbolt', 'clock', 'phy ("physical layer" framework)', 'cxl (compute express link)', 'various']
|
['rdma/infiniband ', 'hns']
|
['h', 'c']
| 3
| 62
| 1
|
--- diff --git a/drivers/infiniband/hw/hns/hns_roce_device.h b/drivers/infiniband/hw/hns/hns_roce_device.h --- a/drivers/infiniband/hw/hns/hns_roce_device.h +++ b/drivers/infiniband/hw/hns/hns_roce_device.h +#define hns_roce_dwqe_size 65536 +enum { + hns_roce_qp_cap_direct_wqe = bit(5), +}; + + void __iomem *mem_base; diff --git a/drivers/infiniband/hw/hns/hns_roce_hw_v2.c b/drivers/infiniband/hw/hns/hns_roce_hw_v2.c --- a/drivers/infiniband/hw/hns/hns_roce_hw_v2.c +++ b/drivers/infiniband/hw/hns/hns_roce_hw_v2.c + qp->sl = to_hr_ah(ud_wr(wr)->ah)->av.sl; + + /* indicates data on new bar, 0 : sq doorbell, 1 : dwqe */ + roce_set_bit(sq_db.byte_4, v2_db_flag_s, 0); +static void hns_roce_write512(struct hns_roce_dev *hr_dev, u64 *val, + u64 __iomem *dest) +{ +#define hns_roce_write_times 8 + struct hns_roce_v2_priv *priv = (struct hns_roce_v2_priv *)hr_dev->priv; + struct hnae3_handle *handle = priv->handle; + const struct hnae3_ae_ops *ops = handle->ae_algo->ops; + int i; + + if (!hr_dev->dis_db && !ops->get_hw_reset_stat(handle)) + for (i = 0; i < hns_roce_write_times; i++) + writeq_relaxed(*(val + i), dest + i); +} + +static void write_dwqe(struct hns_roce_dev *hr_dev, struct hns_roce_qp *qp, + void *wqe) +{ + struct hns_roce_v2_rc_send_wqe *rc_sq_wqe = wqe; + + /* all kinds of directwqe have the same header field layout */ + roce_set_bit(rc_sq_wqe->byte_4, v2_rc_send_wqe_byte_4_flag_s, 1); + roce_set_field(rc_sq_wqe->byte_4, v2_rc_send_wqe_byte_4_db_sl_l_m, + v2_rc_send_wqe_byte_4_db_sl_l_s, qp->sl); + roce_set_field(rc_sq_wqe->byte_4, v2_rc_send_wqe_byte_4_db_sl_h_m, + v2_rc_send_wqe_byte_4_db_sl_h_s, qp->sl >> 2); + roce_set_field(rc_sq_wqe->byte_4, v2_rc_send_wqe_byte_4_wqe_index_m, + v2_rc_send_wqe_byte_4_wqe_index_s, qp->sq.head); + + hns_roce_write512(hr_dev, wqe, hr_dev->mem_base + + hns_roce_dwqe_size * qp->ibqp.qp_num); +} + - update_sq_db(hr_dev, qp); + + if (nreq == 1 && qp->sq.head == qp->sq.tail + 1 && + (qp->en_flags & hns_roce_qp_cap_direct_wqe)) + write_dwqe(hr_dev, qp, wqe); + else + update_sq_db(hr_dev, qp); + hr_dev->mem_base = handle->rinfo.roce_mem_base; diff --git a/drivers/infiniband/hw/hns/hns_roce_hw_v2.h b/drivers/infiniband/hw/hns/hns_roce_hw_v2.h --- a/drivers/infiniband/hw/hns/hns_roce_hw_v2.h +++ b/drivers/infiniband/hw/hns/hns_roce_hw_v2.h +#define v2_db_flag_s 31 + +#define v2_rc_send_wqe_byte_4_db_sl_l_s 5 +#define v2_rc_send_wqe_byte_4_db_sl_l_m genmask(6, 5) + +#define v2_rc_send_wqe_byte_4_db_sl_h_s 13 +#define v2_rc_send_wqe_byte_4_db_sl_h_m genmask(14, 13) + +#define v2_rc_send_wqe_byte_4_wqe_index_s 15 +#define v2_rc_send_wqe_byte_4_wqe_index_m genmask(30, 15) + +#define v2_rc_send_wqe_byte_4_flag_s 31 +
|
Networking
|
01584a5edcc4a04ed4b993f75b6cc4bcf3c21818
|
yixing liu
|
drivers
|
infiniband
|
hns, hw
|
ath10k: add new debug level for sta related logs
|
add new level ath10k_dbg_sta debug_mask for printing sta related logs. this will be useful to check the debug logs of connection and changes related to station.
|
this release allows to map an uid to a different one in a mount; it also adds support for selecting the preemption model at runtime; support for a low-overhead memory error detector designed to be used in production; support for the acrn hypervisor designed for embedded systems; btrfs initial support for zoned devices, subpage blocks sizes and performance improvements; support for eager nfs writes; support for a thermal power management to control the surface temperature of embedded devices in an unified way; the napi polling can be moved to a kernel thread; and support for non-blocking path lookups. as always, there are many other features, new drivers, improvements and fixes.
|
add new debug level for sta related logs
|
['core (various)', 'file systems', 'memory management', 'block layer', 'tracing, perf and bpf', 'virtualization', 'cryptography', 'security', 'networking', 'architectures x86 arm risc-v powerpc mips csky s390 pa-risc c6x']
|
['graphics', 'power management', 'storage', 'drivers in the staging area', 'networking', 'audio', 'tablets, touch screens, keyboards, mouses', 'tv tuners, webcams, video capturers', 'universal serial bus', 'serial peripheral interface (spi)', 'watchdog', 'serial', 'cpu frequency scaling', 'device voltage and frequency scaling', 'voltage, current regulators, power capping, power supply', 'real time clock (rtc)', 'pin controllers (pinctrl)', 'multi media card (mmc)', 'memory technology devices (mtd)', 'industrial i/o (iio)', 'multi function devices (mfd)', 'pulse-width modulation (pwm)', 'inter-integrated circuit (i2c + i3c)', 'hardware monitoring (hwmon)', 'general purpose i/o (gpio)', 'leds', 'dma engines', 'cryptography hardware acceleration', 'pci', 'non-transparent bridge (ntb)', 'thunderbolt', 'clock', 'phy ("physical layer" framework)', 'cxl (compute express link)', 'various']
|
['ath10k ']
|
['h', 'c']
| 3
| 13
| 12
|
--- diff --git a/drivers/net/wireless/ath/ath10k/debug.h b/drivers/net/wireless/ath/ath10k/debug.h --- a/drivers/net/wireless/ath/ath10k/debug.h +++ b/drivers/net/wireless/ath/ath10k/debug.h + ath10k_dbg_sta = 0x00400000, diff --git a/drivers/net/wireless/ath/ath10k/mac.c b/drivers/net/wireless/ath/ath10k/mac.c --- a/drivers/net/wireless/ath/ath10k/mac.c +++ b/drivers/net/wireless/ath/ath10k/mac.c - ath10k_dbg(ar, ath10k_dbg_mac, "mac update sta %pm peer bw %d phymode %d ", + ath10k_dbg(ar, ath10k_dbg_sta, "mac update sta %pm peer bw %d phymode %d ", - ath10k_dbg(ar, ath10k_dbg_mac, "mac update sta %pm nss %d ", + ath10k_dbg(ar, ath10k_dbg_sta, "mac update sta %pm nss %d ", - ath10k_dbg(ar, ath10k_dbg_mac, "mac update sta %pm smps %d ", + ath10k_dbg(ar, ath10k_dbg_sta, "mac update sta %pm smps %d ", - ath10k_dbg(ar, ath10k_dbg_mac, "mac update sta %pm supp rates ", + ath10k_dbg(ar, ath10k_dbg_sta, "mac update sta %pm supp rates ", - ath10k_dbg(ar, ath10k_dbg_mac, + ath10k_dbg(ar, ath10k_dbg_sta, - ath10k_dbg(ar, ath10k_dbg_mac, + ath10k_dbg(ar, ath10k_dbg_sta, - ath10k_dbg(ar, ath10k_dbg_mac, "mac sta %pm associated ", + ath10k_dbg(ar, ath10k_dbg_sta, "mac sta %pm associated ", - ath10k_dbg(ar, ath10k_dbg_mac, "mac tdls sta %pm authorized ", + ath10k_dbg(ar, ath10k_dbg_sta, "mac tdls sta %pm authorized ", - ath10k_dbg(ar, ath10k_dbg_mac, "mac sta %pm disassociated ", + ath10k_dbg(ar, ath10k_dbg_sta, "mac sta %pm disassociated ", - ath10k_dbg(ar, ath10k_dbg_mac, + ath10k_dbg(ar, ath10k_dbg_sta, diff --git a/drivers/net/wireless/ath/ath10k/wmi.c b/drivers/net/wireless/ath/ath10k/wmi.c --- a/drivers/net/wireless/ath/ath10k/wmi.c +++ b/drivers/net/wireless/ath/ath10k/wmi.c - ath10k_dbg(ar, ath10k_dbg_wmi, "wmi event peer sta kickout %pm ", + ath10k_dbg(ar, ath10k_dbg_sta, "wmi event peer sta kickout %pm ", - ath10k_dbg(ar, ath10k_dbg_wmi, + ath10k_dbg(ar, ath10k_dbg_sta,
|
Networking
|
97614c59cb72b26ebebec4334921c9ae8fb895e6
|
tamizh chelvam
|
drivers
|
net
|
ath, ath10k, wireless
|
ath10k: allow dynamic sar power limits via common api
|
ath10k assigns ath10k_mac_set_sar_specs to ath10k_ops, and this function is called when user space application calls nl80211_cmd_set_sar_specs. ath10k also registers sar type, and supported frequency ranges to wiphy so user space can query sar capabilities.
|
this release allows to map an uid to a different one in a mount; it also adds support for selecting the preemption model at runtime; support for a low-overhead memory error detector designed to be used in production; support for the acrn hypervisor designed for embedded systems; btrfs initial support for zoned devices, subpage blocks sizes and performance improvements; support for eager nfs writes; support for a thermal power management to control the surface temperature of embedded devices in an unified way; the napi polling can be moved to a kernel thread; and support for non-blocking path lookups. as always, there are many other features, new drivers, improvements and fixes.
|
allow dynamic sar power limits via common api
|
['core (various)', 'file systems', 'memory management', 'block layer', 'tracing, perf and bpf', 'virtualization', 'cryptography', 'security', 'networking', 'architectures x86 arm risc-v powerpc mips csky s390 pa-risc c6x']
|
['graphics', 'power management', 'storage', 'drivers in the staging area', 'networking', 'audio', 'tablets, touch screens, keyboards, mouses', 'tv tuners, webcams, video capturers', 'universal serial bus', 'serial peripheral interface (spi)', 'watchdog', 'serial', 'cpu frequency scaling', 'device voltage and frequency scaling', 'voltage, current regulators, power capping, power supply', 'real time clock (rtc)', 'pin controllers (pinctrl)', 'multi media card (mmc)', 'memory technology devices (mtd)', 'industrial i/o (iio)', 'multi function devices (mfd)', 'pulse-width modulation (pwm)', 'inter-integrated circuit (i2c + i3c)', 'hardware monitoring (hwmon)', 'general purpose i/o (gpio)', 'leds', 'dma engines', 'cryptography hardware acceleration', 'pci', 'non-transparent bridge (ntb)', 'thunderbolt', 'clock', 'phy ("physical layer" framework)', 'cxl (compute express link)', 'various']
|
['ath10k ']
|
['h', 'c']
| 4
| 192
| 59
|
--- diff --git a/drivers/net/wireless/ath/ath10k/core.c b/drivers/net/wireless/ath/ath10k/core.c --- a/drivers/net/wireless/ath/ath10k/core.c +++ b/drivers/net/wireless/ath/ath10k/core.c + .dynamic_sar_support = false, + .dynamic_sar_support = false, + .dynamic_sar_support = false, + .dynamic_sar_support = true, + .dynamic_sar_support = false, + .dynamic_sar_support = false, + .dynamic_sar_support = false, + .dynamic_sar_support = true, + .dynamic_sar_support = false, + .dynamic_sar_support = false, + .dynamic_sar_support = false, + .dynamic_sar_support = false, + .dynamic_sar_support = false, + .dynamic_sar_support = false, + .dynamic_sar_support = false, + .dynamic_sar_support = true, diff --git a/drivers/net/wireless/ath/ath10k/core.h b/drivers/net/wireless/ath/ath10k/core.h --- a/drivers/net/wireless/ath/ath10k/core.h +++ b/drivers/net/wireless/ath/ath10k/core.h + s32 tx_power_2g_limit; + s32 tx_power_5g_limit; + diff --git a/drivers/net/wireless/ath/ath10k/hw.h b/drivers/net/wireless/ath/ath10k/hw.h --- a/drivers/net/wireless/ath/ath10k/hw.h +++ b/drivers/net/wireless/ath/ath10k/hw.h + + bool dynamic_sar_support; diff --git a/drivers/net/wireless/ath/ath10k/mac.c b/drivers/net/wireless/ath/ath10k/mac.c --- a/drivers/net/wireless/ath/ath10k/mac.c +++ b/drivers/net/wireless/ath/ath10k/mac.c +static const struct cfg80211_sar_freq_ranges ath10k_sar_freq_ranges[] = { + {.start_freq = 2402, .end_freq = 2494 }, + {.start_freq = 5170, .end_freq = 5875 }, +}; + +static const struct cfg80211_sar_capa ath10k_sar_capa = { + .type = nl80211_sar_type_power, + .num_freq_ranges = (array_size(ath10k_sar_freq_ranges)), + .freq_ranges = &ath10k_sar_freq_ranges[0], +}; + +static bool ath10k_mac_is_connected(struct ath10k *ar) +{ + struct ath10k_vif *arvif; + + list_for_each_entry(arvif, &ar->arvifs, list) { + if (arvif->is_up && arvif->vdev_type == wmi_vdev_type_sta) + return true; + } + + return false; +} + +static int ath10k_mac_txpower_setup(struct ath10k *ar, int txpower) +{ + int ret; + u32 param; + int tx_power_2g, tx_power_5g; + bool connected; + + lockdep_assert_held(&ar->conf_mutex); + + /* ath10k internally uses unit of 0.5 dbm so multiply by 2 */ + tx_power_2g = txpower * 2; + tx_power_5g = txpower * 2; + + connected = ath10k_mac_is_connected(ar); + + if (connected && ar->tx_power_2g_limit) + if (tx_power_2g > ar->tx_power_2g_limit) + tx_power_2g = ar->tx_power_2g_limit; + + if (connected && ar->tx_power_5g_limit) + if (tx_power_5g > ar->tx_power_5g_limit) + tx_power_5g = ar->tx_power_5g_limit; + + ath10k_dbg(ar, ath10k_dbg_mac, "mac txpower 2g: %d, 5g: %d ", + tx_power_2g, tx_power_5g); + + param = ar->wmi.pdev_param->txpower_limit2g; + ret = ath10k_wmi_pdev_set_param(ar, param, tx_power_2g); + if (ret) { + ath10k_warn(ar, "failed to set 2g txpower %d: %d ", + tx_power_2g, ret); + return ret; + } + + param = ar->wmi.pdev_param->txpower_limit5g; + ret = ath10k_wmi_pdev_set_param(ar, param, tx_power_5g); + if (ret) { + ath10k_warn(ar, "failed to set 5g txpower %d: %d ", + tx_power_5g, ret); + return ret; + } + + return 0; +} + +static int ath10k_mac_txpower_recalc(struct ath10k *ar) +{ + struct ath10k_vif *arvif; + int ret, txpower = -1; + + lockdep_assert_held(&ar->conf_mutex); + + list_for_each_entry(arvif, &ar->arvifs, list) { + /* txpower not initialized yet? */ + if (arvif->txpower == int_min) + continue; + + if (txpower == -1) + txpower = arvif->txpower; + else + txpower = min(txpower, arvif->txpower); + } + + if (txpower == -1) + return 0; + + ret = ath10k_mac_txpower_setup(ar, txpower); + if (ret) { + ath10k_warn(ar, "failed to setup tx power %d: %d ", + txpower, ret); + return ret; + } + + return 0; +} + +static int ath10k_mac_set_sar_power(struct ath10k *ar) +{ + if (!ar->hw_params.dynamic_sar_support) + return -eopnotsupp; + + if (!ath10k_mac_is_connected(ar)) + return 0; + + /* if connected, then arvif->txpower must be valid */ + return ath10k_mac_txpower_recalc(ar); +} + +static int ath10k_mac_set_sar_specs(struct ieee80211_hw *hw, + const struct cfg80211_sar_specs *sar) +{ + const struct cfg80211_sar_sub_specs *sub_specs; + struct ath10k *ar = hw->priv; + u32 i; + int ret; + + mutex_lock(&ar->conf_mutex); + + if (!ar->hw_params.dynamic_sar_support) { + ret = -eopnotsupp; + goto err; + } + + if (!sar || sar->type != nl80211_sar_type_power || + sar->num_sub_specs == 0) { + ret = -einval; + goto err; + } + + sub_specs = sar->sub_specs; + + /* 0dbm is not a practical value for ath10k, so use 0 + * as no sar limitation on it. + */ + ar->tx_power_2g_limit = 0; + ar->tx_power_5g_limit = 0; + + /* note the power is in 0.25dbm unit, while ath10k uses + * 0.5dbm unit. + */ + for (i = 0; i < sar->num_sub_specs; i++) { + if (sub_specs->freq_range_index == 0) + ar->tx_power_2g_limit = sub_specs->power / 2; + else if (sub_specs->freq_range_index == 1) + ar->tx_power_5g_limit = sub_specs->power / 2; + + sub_specs++; + } + + ret = ath10k_mac_set_sar_power(ar); + if (ret) { + ath10k_warn(ar, "failed to set sar power: %d", ret); + goto err; + } + +err: + mutex_unlock(&ar->conf_mutex); + return ret; +} + + ath10k_mac_set_sar_power(ar); + + ath10k_mac_txpower_recalc(ar); + -static int ath10k_mac_txpower_setup(struct ath10k *ar, int txpower) -{ - int ret; - u32 param; - - lockdep_assert_held(&ar->conf_mutex); - - ath10k_dbg(ar, ath10k_dbg_mac, "mac txpower %d ", txpower); - - param = ar->wmi.pdev_param->txpower_limit2g; - ret = ath10k_wmi_pdev_set_param(ar, param, txpower * 2); - if (ret) { - ath10k_warn(ar, "failed to set 2g txpower %d: %d ", - txpower, ret); - return ret; - } - - param = ar->wmi.pdev_param->txpower_limit5g; - ret = ath10k_wmi_pdev_set_param(ar, param, txpower * 2); - if (ret) { - ath10k_warn(ar, "failed to set 5g txpower %d: %d ", - txpower, ret); - return ret; - } - - return 0; -} - -static int ath10k_mac_txpower_recalc(struct ath10k *ar) -{ - struct ath10k_vif *arvif; - int ret, txpower = -1; - - lockdep_assert_held(&ar->conf_mutex); - - list_for_each_entry(arvif, &ar->arvifs, list) { - /* txpower not initialized yet? */ - if (arvif->txpower == int_min) - continue; - - if (txpower == -1) - txpower = arvif->txpower; - else - txpower = min(txpower, arvif->txpower); - } - - if (txpower == -1) - return 0; - - ret = ath10k_mac_txpower_setup(ar, txpower); - if (ret) { - ath10k_warn(ar, "failed to setup tx power %d: %d ", - txpower, ret); - return ret; - } - - return 0; -} - + .set_sar_specs = ath10k_mac_set_sar_specs, + if (ar->hw_params.dynamic_sar_support) + ar->hw->wiphy->sar_capa = &ath10k_sar_capa; +
|
Networking
|
442545ba5452b50c471fd5cd04b7688945c8a7da
|
carl huang
|
drivers
|
net
|
ath, ath10k, wireless
|
ath11k: add support to configure spatial reuse parameter set
|
the spr parameter set comprises obss pd threshold for srg and non srg and bitmap of bss color and partial bssid. this adds support to configure fields of spr element to firmware.
|
this release allows to map an uid to a different one in a mount; it also adds support for selecting the preemption model at runtime; support for a low-overhead memory error detector designed to be used in production; support for the acrn hypervisor designed for embedded systems; btrfs initial support for zoned devices, subpage blocks sizes and performance improvements; support for eager nfs writes; support for a thermal power management to control the surface temperature of embedded devices in an unified way; the napi polling can be moved to a kernel thread; and support for non-blocking path lookups. as always, there are many other features, new drivers, improvements and fixes.
|
add support to configure spatial reuse parameter set
|
['core (various)', 'file systems', 'memory management', 'block layer', 'tracing, perf and bpf', 'virtualization', 'cryptography', 'security', 'networking', 'architectures x86 arm risc-v powerpc mips csky s390 pa-risc c6x']
|
['graphics', 'power management', 'storage', 'drivers in the staging area', 'networking', 'audio', 'tablets, touch screens, keyboards, mouses', 'tv tuners, webcams, video capturers', 'universal serial bus', 'serial peripheral interface (spi)', 'watchdog', 'serial', 'cpu frequency scaling', 'device voltage and frequency scaling', 'voltage, current regulators, power capping, power supply', 'real time clock (rtc)', 'pin controllers (pinctrl)', 'multi media card (mmc)', 'memory technology devices (mtd)', 'industrial i/o (iio)', 'multi function devices (mfd)', 'pulse-width modulation (pwm)', 'inter-integrated circuit (i2c + i3c)', 'hardware monitoring (hwmon)', 'general purpose i/o (gpio)', 'leds', 'dma engines', 'cryptography hardware acceleration', 'pci', 'non-transparent bridge (ntb)', 'thunderbolt', 'clock', 'phy ("physical layer" framework)', 'cxl (compute express link)', 'various']
|
['ath11k']
|
['h', 'c']
| 6
| 447
| 5
|
--- diff --git a/drivers/net/wireless/ath/ath11k/debugfs_htt_stats.c b/drivers/net/wireless/ath/ath11k/debugfs_htt_stats.c --- a/drivers/net/wireless/ath/ath11k/debugfs_htt_stats.c +++ b/drivers/net/wireless/ath/ath11k/debugfs_htt_stats.c + len += htt_dbg_out(buf + len, buf_len - len, "non-srg opportunities = %u ", + htt_stats_buf->num_non_srg_opportunities); + len += htt_dbg_out(buf + len, buf_len - len, "non-srg tried ppdu = %u ", + htt_stats_buf->num_non_srg_ppdu_tried); + len += htt_dbg_out(buf + len, buf_len - len, "non-srg success ppdu = %u ", + htt_stats_buf->num_non_srg_ppdu_success); + len += htt_dbg_out(buf + len, buf_len - len, "srg opportunies = %u ", + htt_stats_buf->num_srg_opportunities); + len += htt_dbg_out(buf + len, buf_len - len, "srg tried ppdu = %u ", + htt_stats_buf->num_srg_ppdu_tried); + len += htt_dbg_out(buf + len, buf_len - len, "srg success ppdu = %u ", + htt_stats_buf->num_srg_ppdu_success); diff --git a/drivers/net/wireless/ath/ath11k/debugfs_htt_stats.h b/drivers/net/wireless/ath/ath11k/debugfs_htt_stats.h --- a/drivers/net/wireless/ath/ath11k/debugfs_htt_stats.h +++ b/drivers/net/wireless/ath/ath11k/debugfs_htt_stats.h - u32 num_obss_tx_ppdu_success; - u32 num_obss_tx_ppdu_failure; + u32 num_obss_tx_ppdu_success; + u32 num_obss_tx_ppdu_failure; + u32 num_sr_tx_transmissions; + u32 num_spatial_reuse_opportunities; + u32 num_non_srg_opportunities; + u32 num_non_srg_ppdu_tried; + u32 num_non_srg_ppdu_success; + u32 num_srg_opportunities; + u32 num_srg_ppdu_tried; + u32 num_srg_ppdu_success; + u32 num_psr_opportunities; + u32 num_psr_ppdu_tried; + u32 num_psr_ppdu_success; diff --git a/drivers/net/wireless/ath/ath11k/mac.c b/drivers/net/wireless/ath/ath11k/mac.c --- a/drivers/net/wireless/ath/ath11k/mac.c +++ b/drivers/net/wireless/ath/ath11k/mac.c +static int ath11k_mac_config_obss_pd(struct ath11k *ar, + struct ieee80211_he_obss_pd *he_obss_pd) +{ + u32 bitmap[2], param_id, param_val, pdev_id; + int ret; + s8 non_srg_th = 0, srg_th = 0; + + pdev_id = ar->pdev->pdev_id; + + /* set and enable srg/non-srg obss pd threshold */ + param_id = wmi_pdev_param_set_cmd_obss_pd_threshold; + if (test_bit(ath11k_flag_monitor_enabled, &ar->monitor_flags)) { + ret = ath11k_wmi_pdev_set_param(ar, param_id, 0, pdev_id); + if (ret) + ath11k_warn(ar->ab, + "failed to set obss_pd_threshold for pdev: %u ", + pdev_id); + return ret; + } + + ath11k_dbg(ar->ab, ath11k_dbg_mac, + "mac obss pd sr_ctrl %x non_srg_thres %u srg_max %u ", + he_obss_pd->sr_ctrl, he_obss_pd->non_srg_max_offset, + he_obss_pd->max_offset); + + param_val = 0; + + if (he_obss_pd->sr_ctrl & + ieee80211_he_spr_non_srg_obss_pd_sr_disallowed) { + non_srg_th = ath11k_obss_pd_max_threshold; + } else { + if (he_obss_pd->sr_ctrl & ieee80211_he_spr_non_srg_offset_present) + non_srg_th = (ath11k_obss_pd_max_threshold + + he_obss_pd->non_srg_max_offset); + else + non_srg_th = ath11k_obss_pd_non_srg_max_threshold; + + param_val |= ath11k_obss_pd_non_srg_en; + } + + if (he_obss_pd->sr_ctrl & ieee80211_he_spr_srg_information_present) { + srg_th = ath11k_obss_pd_max_threshold + he_obss_pd->max_offset; + param_val |= ath11k_obss_pd_srg_en; + } + + if (test_bit(wmi_tlv_service_srg_srp_spatial_reuse_support, + ar->ab->wmi_ab.svc_map)) { + param_val |= ath11k_obss_pd_threshold_in_dbm; + param_val |= field_prep(genmask(15, 8), srg_th); + } else { + non_srg_th -= ath11k_default_noise_floor; + /* srg not supported and threshold in db */ + param_val &= ~(ath11k_obss_pd_srg_en | + ath11k_obss_pd_threshold_in_dbm); + } + + param_val |= (non_srg_th & genmask(7, 0)); + ret = ath11k_wmi_pdev_set_param(ar, param_id, param_val, pdev_id); + if (ret) { + ath11k_warn(ar->ab, + "failed to set obss_pd_threshold for pdev: %u ", + pdev_id); + return ret; + } + + /* enable obss pd for all access category */ + param_id = wmi_pdev_param_set_cmd_obss_pd_per_ac; + param_val = 0xf; + ret = ath11k_wmi_pdev_set_param(ar, param_id, param_val, pdev_id); + if (ret) { + ath11k_warn(ar->ab, + "failed to set obss_pd_per_ac for pdev: %u ", + pdev_id); + return ret; + } + + /* set sr prohibit */ + param_id = wmi_pdev_param_enable_sr_prohibit; + param_val = !!(he_obss_pd->sr_ctrl & + ieee80211_he_spr_hesiga_sr_val15_allowed); + ret = ath11k_wmi_pdev_set_param(ar, param_id, param_val, pdev_id); + if (ret) { + ath11k_warn(ar->ab, "failed to set sr_prohibit for pdev: %u ", + pdev_id); + return ret; + } + + if (!test_bit(wmi_tlv_service_srg_srp_spatial_reuse_support, + ar->ab->wmi_ab.svc_map)) + return 0; + + /* set srg bss color bitmap */ + memcpy(bitmap, he_obss_pd->bss_color_bitmap, sizeof(bitmap)); + ret = ath11k_wmi_pdev_set_srg_bss_color_bitmap(ar, bitmap); + if (ret) { + ath11k_warn(ar->ab, + "failed to set bss_color_bitmap for pdev: %u ", + pdev_id); + return ret; + } + + /* set srg partial bssid bitmap */ + memcpy(bitmap, he_obss_pd->partial_bssid_bitmap, sizeof(bitmap)); + ret = ath11k_wmi_pdev_set_srg_patial_bssid_bitmap(ar, bitmap); + if (ret) { + ath11k_warn(ar->ab, + "failed to set partial_bssid_bitmap for pdev: %u ", + pdev_id); + return ret; + } + + memset(bitmap, 0xff, sizeof(bitmap)); + + /* enable all bss colors for srg */ + ret = ath11k_wmi_pdev_srg_obss_color_enable_bitmap(ar, bitmap); + if (ret) { + ath11k_warn(ar->ab, + "failed to set srg_color_en_bitmap pdev: %u ", + pdev_id); + return ret; + } + + /* enable all patial bssid mask for srg */ + ret = ath11k_wmi_pdev_srg_obss_bssid_enable_bitmap(ar, bitmap); + if (ret) { + ath11k_warn(ar->ab, + "failed to set srg_bssid_en_bitmap pdev: %u ", + pdev_id); + return ret; + } + + /* enable all bss colors for non-srg */ + ret = ath11k_wmi_pdev_non_srg_obss_color_enable_bitmap(ar, bitmap); + if (ret) { + ath11k_warn(ar->ab, + "failed to set non_srg_color_en_bitmap pdev: %u ", + pdev_id); + return ret; + } + + /* enable all patial bssid mask for non-srg */ + ret = ath11k_wmi_pdev_non_srg_obss_bssid_enable_bitmap(ar, bitmap); + if (ret) { + ath11k_warn(ar->ab, + "failed to set non_srg_bssid_en_bitmap pdev: %u ", + pdev_id); + return ret; + } + + return 0; +} + - ath11k_wmi_send_obss_spr_cmd(ar, arvif->vdev_id, - &info->he_obss_pd); + ath11k_mac_config_obss_pd(ar, &info->he_obss_pd); diff --git a/drivers/net/wireless/ath/ath11k/mac.h b/drivers/net/wireless/ath/ath11k/mac.h --- a/drivers/net/wireless/ath/ath11k/mac.h +++ b/drivers/net/wireless/ath/ath11k/mac.h +#define ath11k_obss_pd_max_threshold -82 +#define ath11k_obss_pd_non_srg_max_threshold -62 +#define ath11k_obss_pd_threshold_in_dbm bit(29) +#define ath11k_obss_pd_srg_en bit(30) +#define ath11k_obss_pd_non_srg_en bit(31) + diff --git a/drivers/net/wireless/ath/ath11k/wmi.c b/drivers/net/wireless/ath/ath11k/wmi.c --- a/drivers/net/wireless/ath/ath11k/wmi.c +++ b/drivers/net/wireless/ath/ath11k/wmi.c +int +ath11k_wmi_pdev_set_srg_bss_color_bitmap(struct ath11k *ar, u32 *bitmap) +{ + struct ath11k_pdev_wmi *wmi = ar->wmi; + struct ath11k_base *ab = wmi->wmi_ab->ab; + struct wmi_pdev_obss_pd_bitmap_cmd *cmd; + struct sk_buff *skb; + int ret, len; + + len = sizeof(*cmd); + + skb = ath11k_wmi_alloc_skb(wmi->wmi_ab, len); + if (!skb) + return -enomem; + + cmd = (struct wmi_pdev_obss_pd_bitmap_cmd *)skb->data; + cmd->tlv_header = field_prep(wmi_tlv_tag, + wmi_tag_pdev_srg_bss_color_bitmap_cmd) | + field_prep(wmi_tlv_len, len - tlv_hdr_size); + cmd->pdev_id = ar->pdev->pdev_id; + memcpy(cmd->bitmap, bitmap, sizeof(cmd->bitmap)); + + ath11k_dbg(ar->ab, ath11k_dbg_wmi, + "obss pd pdev_id %d bss color bitmap %08x %08x ", + cmd->pdev_id, cmd->bitmap[0], cmd->bitmap[1]); + + ret = ath11k_wmi_cmd_send(wmi, skb, + wmi_pdev_set_srg_bss_color_bitmap_cmdid); + if (ret) { + ath11k_warn(ab, + "failed to send wmi_pdev_set_srg_bss_color_bitmap_cmdid"); + dev_kfree_skb(skb); + } + + return ret; +} + +int +ath11k_wmi_pdev_set_srg_patial_bssid_bitmap(struct ath11k *ar, u32 *bitmap) +{ + struct ath11k_pdev_wmi *wmi = ar->wmi; + struct ath11k_base *ab = wmi->wmi_ab->ab; + struct wmi_pdev_obss_pd_bitmap_cmd *cmd; + struct sk_buff *skb; + int ret, len; + + len = sizeof(*cmd); + + skb = ath11k_wmi_alloc_skb(wmi->wmi_ab, len); + if (!skb) + return -enomem; + + cmd = (struct wmi_pdev_obss_pd_bitmap_cmd *)skb->data; + cmd->tlv_header = + field_prep(wmi_tlv_tag, + wmi_tag_pdev_srg_partial_bssid_bitmap_cmd) | + field_prep(wmi_tlv_len, len - tlv_hdr_size); + cmd->pdev_id = ar->pdev->pdev_id; + memcpy(cmd->bitmap, bitmap, sizeof(cmd->bitmap)); + + ath11k_dbg(ar->ab, ath11k_dbg_wmi, + "obss pd pdev_id %d partial bssid bitmap %08x %08x ", + cmd->pdev_id, cmd->bitmap[0], cmd->bitmap[1]); + + ret = ath11k_wmi_cmd_send(wmi, skb, + wmi_pdev_set_srg_partial_bssid_bitmap_cmdid); + if (ret) { + ath11k_warn(ab, + "failed to send wmi_pdev_set_srg_partial_bssid_bitmap_cmdid"); + dev_kfree_skb(skb); + } + + return ret; +} + +int +ath11k_wmi_pdev_srg_obss_color_enable_bitmap(struct ath11k *ar, u32 *bitmap) +{ + struct ath11k_pdev_wmi *wmi = ar->wmi; + struct ath11k_base *ab = wmi->wmi_ab->ab; + struct wmi_pdev_obss_pd_bitmap_cmd *cmd; + struct sk_buff *skb; + int ret, len; + + len = sizeof(*cmd); + + skb = ath11k_wmi_alloc_skb(wmi->wmi_ab, len); + if (!skb) + return -enomem; + + cmd = (struct wmi_pdev_obss_pd_bitmap_cmd *)skb->data; + cmd->tlv_header = + field_prep(wmi_tlv_tag, + wmi_tag_pdev_srg_obss_color_enable_bitmap_cmd) | + field_prep(wmi_tlv_len, len - tlv_hdr_size); + cmd->pdev_id = ar->pdev->pdev_id; + memcpy(cmd->bitmap, bitmap, sizeof(cmd->bitmap)); + + ath11k_dbg(ar->ab, ath11k_dbg_wmi, + "obss pd srg pdev_id %d bss color enable bitmap %08x %08x ", + cmd->pdev_id, cmd->bitmap[0], cmd->bitmap[1]); + + ret = ath11k_wmi_cmd_send(wmi, skb, + wmi_pdev_set_srg_obss_color_enable_bitmap_cmdid); + if (ret) { + ath11k_warn(ab, + "failed to send wmi_pdev_set_srg_obss_color_enable_bitmap_cmdid"); + dev_kfree_skb(skb); + } + + return ret; +} + +int +ath11k_wmi_pdev_srg_obss_bssid_enable_bitmap(struct ath11k *ar, u32 *bitmap) +{ + struct ath11k_pdev_wmi *wmi = ar->wmi; + struct ath11k_base *ab = wmi->wmi_ab->ab; + struct wmi_pdev_obss_pd_bitmap_cmd *cmd; + struct sk_buff *skb; + int ret, len; + + len = sizeof(*cmd); + + skb = ath11k_wmi_alloc_skb(wmi->wmi_ab, len); + if (!skb) + return -enomem; + + cmd = (struct wmi_pdev_obss_pd_bitmap_cmd *)skb->data; + cmd->tlv_header = + field_prep(wmi_tlv_tag, + wmi_tag_pdev_srg_obss_bssid_enable_bitmap_cmd) | + field_prep(wmi_tlv_len, len - tlv_hdr_size); + cmd->pdev_id = ar->pdev->pdev_id; + memcpy(cmd->bitmap, bitmap, sizeof(cmd->bitmap)); + + ath11k_dbg(ar->ab, ath11k_dbg_wmi, + "obss pd srg pdev_id %d bssid enable bitmap %08x %08x ", + cmd->pdev_id, cmd->bitmap[0], cmd->bitmap[1]); + + ret = ath11k_wmi_cmd_send(wmi, skb, + wmi_pdev_set_srg_obss_bssid_enable_bitmap_cmdid); + if (ret) { + ath11k_warn(ab, + "failed to send wmi_pdev_set_srg_obss_bssid_enable_bitmap_cmdid"); + dev_kfree_skb(skb); + } + + return ret; +} + +int +ath11k_wmi_pdev_non_srg_obss_color_enable_bitmap(struct ath11k *ar, u32 *bitmap) +{ + struct ath11k_pdev_wmi *wmi = ar->wmi; + struct ath11k_base *ab = wmi->wmi_ab->ab; + struct wmi_pdev_obss_pd_bitmap_cmd *cmd; + struct sk_buff *skb; + int ret, len; + + len = sizeof(*cmd); + + skb = ath11k_wmi_alloc_skb(wmi->wmi_ab, len); + if (!skb) + return -enomem; + + cmd = (struct wmi_pdev_obss_pd_bitmap_cmd *)skb->data; + cmd->tlv_header = + field_prep(wmi_tlv_tag, + wmi_tag_pdev_non_srg_obss_color_enable_bitmap_cmd) | + field_prep(wmi_tlv_len, len - tlv_hdr_size); + cmd->pdev_id = ar->pdev->pdev_id; + memcpy(cmd->bitmap, bitmap, sizeof(cmd->bitmap)); + + ath11k_dbg(ar->ab, ath11k_dbg_wmi, + "obss pd non_srg pdev_id %d bss color enable bitmap %08x %08x ", + cmd->pdev_id, cmd->bitmap[0], cmd->bitmap[1]); + + ret = ath11k_wmi_cmd_send(wmi, skb, + wmi_pdev_set_non_srg_obss_color_enable_bitmap_cmdid); + if (ret) { + ath11k_warn(ab, + "failed to send wmi_pdev_set_non_srg_obss_color_enable_bitmap_cmdid"); + dev_kfree_skb(skb); + } + + return ret; +} + +int +ath11k_wmi_pdev_non_srg_obss_bssid_enable_bitmap(struct ath11k *ar, u32 *bitmap) +{ + struct ath11k_pdev_wmi *wmi = ar->wmi; + struct ath11k_base *ab = wmi->wmi_ab->ab; + struct wmi_pdev_obss_pd_bitmap_cmd *cmd; + struct sk_buff *skb; + int ret, len; + + len = sizeof(*cmd); + + skb = ath11k_wmi_alloc_skb(wmi->wmi_ab, len); + if (!skb) + return -enomem; + + cmd = (struct wmi_pdev_obss_pd_bitmap_cmd *)skb->data; + cmd->tlv_header = + field_prep(wmi_tlv_tag, + wmi_tag_pdev_non_srg_obss_bssid_enable_bitmap_cmd) | + field_prep(wmi_tlv_len, len - tlv_hdr_size); + cmd->pdev_id = ar->pdev->pdev_id; + memcpy(cmd->bitmap, bitmap, sizeof(cmd->bitmap)); + + ath11k_dbg(ar->ab, ath11k_dbg_wmi, + "obss pd non_srg pdev_id %d bssid enable bitmap %08x %08x ", + cmd->pdev_id, cmd->bitmap[0], cmd->bitmap[1]); + + ret = ath11k_wmi_cmd_send(wmi, skb, + wmi_pdev_set_non_srg_obss_bssid_enable_bitmap_cmdid); + if (ret) { + ath11k_warn(ab, + "failed to send wmi_pdev_set_non_srg_obss_bssid_enable_bitmap_cmdid"); + dev_kfree_skb(skb); + } + + return ret; +} + diff --git a/drivers/net/wireless/ath/ath11k/wmi.h b/drivers/net/wireless/ath/ath11k/wmi.h --- a/drivers/net/wireless/ath/ath11k/wmi.h +++ b/drivers/net/wireless/ath/ath11k/wmi.h + wmi_pdev_set_rap_config_cmdid, + wmi_pdev_dsm_filter_cmdid, + wmi_pdev_frame_inject_cmdid, + wmi_pdev_tbtt_offset_sync_cmdid, + wmi_pdev_set_srg_bss_color_bitmap_cmdid, + wmi_pdev_set_srg_partial_bssid_bitmap_cmdid, + wmi_pdev_set_srg_obss_color_enable_bitmap_cmdid, + wmi_pdev_set_srg_obss_bssid_enable_bitmap_cmdid, + wmi_pdev_set_non_srg_obss_color_enable_bitmap_cmdid, + wmi_pdev_set_non_srg_obss_bssid_enable_bitmap_cmdid, + wmi_pdev_param_set_cmd_obss_pd_threshold = 0xbc, + wmi_pdev_param_set_cmd_obss_pd_per_ac = 0xbe, + wmi_pdev_param_enable_sr_prohibit = 0xc6, - /* todo add all the missing cmds */ + wmi_tag_pdev_srg_bss_color_bitmap_cmd = 0x37b, + wmi_tag_pdev_srg_partial_bssid_bitmap_cmd, + wmi_tag_pdev_srg_obss_color_enable_bitmap_cmd = 0x381, + wmi_tag_pdev_srg_obss_bssid_enable_bitmap_cmd, + wmi_tag_pdev_non_srg_obss_color_enable_bitmap_cmd, + wmi_tag_pdev_non_srg_obss_bssid_enable_bitmap_cmd, + wmi_tlv_service_srg_srp_spatial_reuse_support = 249, +struct wmi_pdev_obss_pd_bitmap_cmd { + u32 tlv_header; + u32 pdev_id; + u32 bitmap[2]; +} __packed; + +int ath11k_wmi_pdev_set_srg_bss_color_bitmap(struct ath11k *ar, u32 *bitmap); +int ath11k_wmi_pdev_set_srg_patial_bssid_bitmap(struct ath11k *ar, u32 *bitmap); +int ath11k_wmi_pdev_srg_obss_color_enable_bitmap(struct ath11k *ar, + u32 *bitmap); +int ath11k_wmi_pdev_srg_obss_bssid_enable_bitmap(struct ath11k *ar, + u32 *bitmap); +int ath11k_wmi_pdev_non_srg_obss_color_enable_bitmap(struct ath11k *ar, + u32 *bitmap); +int ath11k_wmi_pdev_non_srg_obss_bssid_enable_bitmap(struct ath11k *ar, + u32 *bitmap);
|
Networking
|
b56b08aec57dd17404793a76f1b28663b955d95f
|
rajkumar manoharan muna sinada msinada codeaurora org
|
drivers
|
net
|
ath, ath11k, wireless
|
net: axienet: support dynamic switching between 1000basex and sgmii
|
newer versions of the xilinx axi ethernet core (specifically version 7.2 or later) allow the core to be configured with a phy interface mode of "both", allowing either 1000basex or sgmii modes to be selected at runtime. add support for this in the driver to allow better support for applications which can use both fiber and copper sfp modules.
|
this release allows to map an uid to a different one in a mount; it also adds support for selecting the preemption model at runtime; support for a low-overhead memory error detector designed to be used in production; support for the acrn hypervisor designed for embedded systems; btrfs initial support for zoned devices, subpage blocks sizes and performance improvements; support for eager nfs writes; support for a thermal power management to control the surface temperature of embedded devices in an unified way; the napi polling can be moved to a kernel thread; and support for non-blocking path lookups. as always, there are many other features, new drivers, improvements and fixes.
|
support dynamic switching between 1000basex and sgmii
|
['core (various)', 'file systems', 'memory management', 'block layer', 'tracing, perf and bpf', 'virtualization', 'cryptography', 'security', 'networking', 'architectures x86 arm risc-v powerpc mips csky s390 pa-risc c6x']
|
['graphics', 'power management', 'storage', 'drivers in the staging area', 'networking', 'audio', 'tablets, touch screens, keyboards, mouses', 'tv tuners, webcams, video capturers', 'universal serial bus', 'serial peripheral interface (spi)', 'watchdog', 'serial', 'cpu frequency scaling', 'device voltage and frequency scaling', 'voltage, current regulators, power capping, power supply', 'real time clock (rtc)', 'pin controllers (pinctrl)', 'multi media card (mmc)', 'memory technology devices (mtd)', 'industrial i/o (iio)', 'multi function devices (mfd)', 'pulse-width modulation (pwm)', 'inter-integrated circuit (i2c + i3c)', 'hardware monitoring (hwmon)', 'general purpose i/o (gpio)', 'leds', 'dma engines', 'cryptography hardware acceleration', 'pci', 'non-transparent bridge (ntb)', 'thunderbolt', 'clock', 'phy ("physical layer" framework)', 'cxl (compute express link)', 'various']
|
['axienet']
|
['h', 'c']
| 2
| 71
| 18
|
--- diff --git a/drivers/net/ethernet/xilinx/xilinx_axienet.h b/drivers/net/ethernet/xilinx/xilinx_axienet.h --- a/drivers/net/ethernet/xilinx/xilinx_axienet.h +++ b/drivers/net/ethernet/xilinx/xilinx_axienet.h +/* xilinx pcs/pma phy register for switching 1000basex or sgmii */ +#define xlnx_mii_std_select_reg 0x11 +#define xlnx_mii_std_select_sgmii bit(0) + + * @phylink: pointer to phylink instance + * @phylink_config: phylink configuration settings + * @pcs_phy: reference to pcs/pma phy if used + * @switch_x_sgmii: whether switchable 1000basex/sgmii mode is enabled in the core + * @clk: clock for axi bus - * @dma_err_tasklet: tasklet structure to process axi dma errors + * @dma_err_task: work structure to process axi dma errors + * @eth_irq: ethernet core irq number - * @last_link: phy link state in which the phy was negotiated earlier + * @tx_bd_num: size of tx buffer descriptor ring + * @rx_bd_num: size of rx buffer descriptor ring - /* connection to phy device */ - /* reference to pcs/pma phy if used */ - /* clock for axi bus */ + bool switch_x_sgmii; + - /* mdio bus data */ - struct mii_bus *mii_bus; /* mii bus reference */ - u8 mii_clk_div; /* mii bus clock divider value */ + struct mii_bus *mii_bus; + u8 mii_clk_div; - /* io registers, dma functions and irqs */ - u32 options; /* current options word */ + u32 options; - /* buffer descriptors */ diff --git a/drivers/net/ethernet/xilinx/xilinx_axienet_main.c b/drivers/net/ethernet/xilinx/xilinx_axienet_main.c --- a/drivers/net/ethernet/xilinx/xilinx_axienet_main.c +++ b/drivers/net/ethernet/xilinx/xilinx_axienet_main.c - if (state->interface != phy_interface_mode_na && - state->interface != lp->phy_mode) { - netdev_warn(ndev, "cannot use phy mode %s, supported: %s ", - phy_modes(state->interface), - phy_modes(lp->phy_mode)); - bitmap_zero(supported, __ethtool_link_mode_mask_nbits); - return; + switch (state->interface) { + case phy_interface_mode_na: + break; + case phy_interface_mode_1000basex: + case phy_interface_mode_sgmii: + if (lp->switch_x_sgmii) + break; + fallthrough; + default: + if (state->interface != lp->phy_mode) { + netdev_warn(ndev, "cannot use phy mode %s, supported: %s ", + phy_modes(state->interface), + phy_modes(lp->phy_mode)); + bitmap_zero(supported, __ethtool_link_mode_mask_nbits); + return; + } +static int axienet_mac_prepare(struct phylink_config *config, unsigned int mode, + phy_interface_t iface) +{ + struct net_device *ndev = to_net_dev(config->dev); + struct axienet_local *lp = netdev_priv(ndev); + int ret; + + switch (iface) { + case phy_interface_mode_sgmii: + case phy_interface_mode_1000basex: + if (!lp->switch_x_sgmii) + return 0; + + ret = mdiobus_write(lp->pcs_phy->bus, + lp->pcs_phy->addr, + xlnx_mii_std_select_reg, + iface == phy_interface_mode_sgmii ? + xlnx_mii_std_select_sgmii : 0); + if (ret < 0) + netdev_warn(ndev, "failed to switch phy interface: %d ", + ret); + return ret; + default: + return 0; + } +} + + .mac_prepare = axienet_mac_prepare, + lp->switch_x_sgmii = of_property_read_bool(pdev->dev.of_node, + "xlnx,switch-x-sgmii"); + + if (lp->switch_x_sgmii && lp->phy_mode != phy_interface_mode_sgmii && + lp->phy_mode != phy_interface_mode_1000basex) { + dev_err(&pdev->dev, "xlnx,switch-x-sgmii only supported with sgmii or 1000basex "); + ret = -einval; + goto free_netdev; + }
|
Networking
|
6c8f06bb2e5147b2c25bdd726365df8416c13987
|
robert hancock
|
drivers
|
net
|
ethernet, xilinx
|
bcm63xx_enet: add bql support
|
add byte queue limits support to reduce/remove bufferbloat in bcm63xx_enet.
|
this release allows to map an uid to a different one in a mount; it also adds support for selecting the preemption model at runtime; support for a low-overhead memory error detector designed to be used in production; support for the acrn hypervisor designed for embedded systems; btrfs initial support for zoned devices, subpage blocks sizes and performance improvements; support for eager nfs writes; support for a thermal power management to control the surface temperature of embedded devices in an unified way; the napi polling can be moved to a kernel thread; and support for non-blocking path lookups. as always, there are many other features, new drivers, improvements and fixes.
|
add bql support
|
['core (various)', 'file systems', 'memory management', 'block layer', 'tracing, perf and bpf', 'virtualization', 'cryptography', 'security', 'networking', 'architectures x86 arm risc-v powerpc mips csky s390 pa-risc c6x']
|
['graphics', 'power management', 'storage', 'drivers in the staging area', 'networking', 'audio', 'tablets, touch screens, keyboards, mouses', 'tv tuners, webcams, video capturers', 'universal serial bus', 'serial peripheral interface (spi)', 'watchdog', 'serial', 'cpu frequency scaling', 'device voltage and frequency scaling', 'voltage, current regulators, power capping, power supply', 'real time clock (rtc)', 'pin controllers (pinctrl)', 'multi media card (mmc)', 'memory technology devices (mtd)', 'industrial i/o (iio)', 'multi function devices (mfd)', 'pulse-width modulation (pwm)', 'inter-integrated circuit (i2c + i3c)', 'hardware monitoring (hwmon)', 'general purpose i/o (gpio)', 'leds', 'dma engines', 'cryptography hardware acceleration', 'pci', 'non-transparent bridge (ntb)', 'thunderbolt', 'clock', 'phy ("physical layer" framework)', 'cxl (compute express link)', 'various']
|
['bcm63xx_enet ']
|
['c']
| 1
| 9
| 0
|
--- diff --git a/drivers/net/ethernet/broadcom/bcm63xx_enet.c b/drivers/net/ethernet/broadcom/bcm63xx_enet.c --- a/drivers/net/ethernet/broadcom/bcm63xx_enet.c +++ b/drivers/net/ethernet/broadcom/bcm63xx_enet.c + unsigned int bytes; + bytes = 0; + bytes += skb->len; + netdev_completed_queue(dev, released, bytes); + + netdev_sent_queue(dev, skb->len); + + netdev_reset_queue(dev); + netdev_reset_queue(dev);
|
Networking
|
4c59b0f5543db80abbbe9efdd9b25e7899501db5
|
sieng piaw liew florian fainelli f fainelli gmail com
|
drivers
|
net
|
broadcom, ethernet
|
bcm63xx_enet: add xmit_more support
|
support bulking hardware tx queue by using netdev_xmit_more().
|
this release allows to map an uid to a different one in a mount; it also adds support for selecting the preemption model at runtime; support for a low-overhead memory error detector designed to be used in production; support for the acrn hypervisor designed for embedded systems; btrfs initial support for zoned devices, subpage blocks sizes and performance improvements; support for eager nfs writes; support for a thermal power management to control the surface temperature of embedded devices in an unified way; the napi polling can be moved to a kernel thread; and support for non-blocking path lookups. as always, there are many other features, new drivers, improvements and fixes.
|
add xmit_more support
|
['core (various)', 'file systems', 'memory management', 'block layer', 'tracing, perf and bpf', 'virtualization', 'cryptography', 'security', 'networking', 'architectures x86 arm risc-v powerpc mips csky s390 pa-risc c6x']
|
['graphics', 'power management', 'storage', 'drivers in the staging area', 'networking', 'audio', 'tablets, touch screens, keyboards, mouses', 'tv tuners, webcams, video capturers', 'universal serial bus', 'serial peripheral interface (spi)', 'watchdog', 'serial', 'cpu frequency scaling', 'device voltage and frequency scaling', 'voltage, current regulators, power capping, power supply', 'real time clock (rtc)', 'pin controllers (pinctrl)', 'multi media card (mmc)', 'memory technology devices (mtd)', 'industrial i/o (iio)', 'multi function devices (mfd)', 'pulse-width modulation (pwm)', 'inter-integrated circuit (i2c + i3c)', 'hardware monitoring (hwmon)', 'general purpose i/o (gpio)', 'leds', 'dma engines', 'cryptography hardware acceleration', 'pci', 'non-transparent bridge (ntb)', 'thunderbolt', 'clock', 'phy ("physical layer" framework)', 'cxl (compute express link)', 'various']
|
['bcm63xx_enet ']
|
['c']
| 1
| 2
| 1
|
--- diff --git a/drivers/net/ethernet/broadcom/bcm63xx_enet.c b/drivers/net/ethernet/broadcom/bcm63xx_enet.c --- a/drivers/net/ethernet/broadcom/bcm63xx_enet.c +++ b/drivers/net/ethernet/broadcom/bcm63xx_enet.c - enet_dmac_writel(priv, priv->dma_chan_en_mask, + if (!netdev_xmit_more() || !priv->tx_desc_count) + enet_dmac_writel(priv, priv->dma_chan_en_mask,
|
Networking
|
375281d3a6dcabaa98f489ee412aedca6d99dffb
|
sieng piaw liew florian fainelli f fainelli gmail com
|
drivers
|
net
|
broadcom, ethernet
|
bnxt_en: update firmware interface to 1.10.2.11.
|
updates to backing store apis, qos profiles, and push buffer initial index support.
|
this release allows to map an uid to a different one in a mount; it also adds support for selecting the preemption model at runtime; support for a low-overhead memory error detector designed to be used in production; support for the acrn hypervisor designed for embedded systems; btrfs initial support for zoned devices, subpage blocks sizes and performance improvements; support for eager nfs writes; support for a thermal power management to control the surface temperature of embedded devices in an unified way; the napi polling can be moved to a kernel thread; and support for non-blocking path lookups. as always, there are many other features, new drivers, improvements and fixes.
|
update firmware interface to 1.10.2.11
|
['core (various)', 'file systems', 'memory management', 'block layer', 'tracing, perf and bpf', 'virtualization', 'cryptography', 'security', 'networking', 'architectures x86 arm risc-v powerpc mips csky s390 pa-risc c6x']
|
['graphics', 'power management', 'storage', 'drivers in the staging area', 'networking', 'audio', 'tablets, touch screens, keyboards, mouses', 'tv tuners, webcams, video capturers', 'universal serial bus', 'serial peripheral interface (spi)', 'watchdog', 'serial', 'cpu frequency scaling', 'device voltage and frequency scaling', 'voltage, current regulators, power capping, power supply', 'real time clock (rtc)', 'pin controllers (pinctrl)', 'multi media card (mmc)', 'memory technology devices (mtd)', 'industrial i/o (iio)', 'multi function devices (mfd)', 'pulse-width modulation (pwm)', 'inter-integrated circuit (i2c + i3c)', 'hardware monitoring (hwmon)', 'general purpose i/o (gpio)', 'leds', 'dma engines', 'cryptography hardware acceleration', 'pci', 'non-transparent bridge (ntb)', 'thunderbolt', 'clock', 'phy ("physical layer" framework)', 'cxl (compute express link)', 'various']
|
['bnxt_en']
|
['h', 'c']
| 3
| 203
| 53
|
--- diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethernet/broadcom/bnxt/bnxt.c --- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c + u32 req_len = sizeof(req); + if (req_len > bp->hwrm_max_ext_req_len) + req_len = bnxt_backing_store_cfg_legacy_len; - return hwrm_send_message(bp, &req, sizeof(req), hwrm_cmd_timeout); + return hwrm_send_message(bp, &req, req_len, hwrm_cmd_timeout); diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.h b/drivers/net/ethernet/broadcom/bnxt/bnxt.h --- a/drivers/net/ethernet/broadcom/bnxt/bnxt.h +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.h +#define bnxt_backing_store_cfg_legacy_len 256 + diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt_hsi.h b/drivers/net/ethernet/broadcom/bnxt/bnxt_hsi.h --- a/drivers/net/ethernet/broadcom/bnxt/bnxt_hsi.h +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt_hsi.h - * copyright (c) 2018-2020 broadcom inc. + * copyright (c) 2018-2021 broadcom inc. + #define hwrm_vnic_update 0x4bul + #define hwrm_queue_vlanpri_qcaps 0x83ul + #define hwrm_queue_vlanpri2pri_qcfg 0x84ul + #define hwrm_queue_vlanpri2pri_cfg 0x85ul + #define hwrm_fw_livepatch_query 0xbeul + #define hwrm_fw_livepatch 0xbful + #define hwrm_func_spd_cfg 0x19aul + #define hwrm_func_spd_qcfg 0x19bul + #define hwrm_mfg_soc_image 0x20cul + #define hwrm_mfg_soc_qstatus 0x20dul + #define hwrm_mfg_param_seeprom_sync 0x20eul + #define hwrm_mfg_param_seeprom_read 0x20ful + #define hwrm_mfg_param_seeprom_health 0x210ul + #define hwrm_tf_em_hash_insert 0x2ecul -#define hwrm_version_update 1 -#define hwrm_version_rsvd 68 -#define hwrm_version_str "1.10.1.68" +#define hwrm_version_update 2 +#define hwrm_version_rsvd 11 +#define hwrm_version_str "1.10.2.11" - #define ver_get_resp_flags_dev_not_rdy 0x1ul - #define ver_get_resp_flags_ext_ver_avail 0x2ul + #define ver_get_resp_flags_dev_not_rdy 0x1ul + #define ver_get_resp_flags_ext_ver_avail 0x2ul + #define ver_get_resp_flags_dev_not_rdy_backing_store 0x4ul + #define async_event_cmpl_event_id_max_rgtr_event_id 0x42ul + #define async_event_cmpl_reset_notify_event_data2_fw_status_code_mask 0xfffful + #define async_event_cmpl_reset_notify_event_data2_fw_status_code_sft 0 - #define async_event_cmpl_reset_notify_event_data1_reason_code_last async_event_cmpl_reset_notify_event_data1_reason_code_fw_exception_non_fatal + #define async_event_cmpl_reset_notify_event_data1_reason_code_fast_reset (0x4ul << 8) + #define async_event_cmpl_reset_notify_event_data1_reason_code_last async_event_cmpl_reset_notify_event_data1_reason_code_fast_reset + #define func_qcaps_resp_flags_ext_evb_mode_cfg_not_supported 0x100ul + #define func_qcaps_resp_flags_ext_soc_spd_supported 0x200ul + #define func_qcaps_resp_flags_ext_fw_livepatch_supported 0x400ul + #define func_qcaps_resp_flags_ext_fast_reset_capable 0x800ul + #define func_qcfg_resp_flags_fast_reset_allowed 0x1000ul + #define func_drv_rgtr_req_flags_fast_reset_support 0x80ul -/* hwrm_func_backing_store_qcaps_output (size:640b/80b) */ +/* hwrm_func_backing_store_qcaps_output (size:704b/88b) */ - __le32 rsvd; - __le16 rsvd1; + __le16 ctx_init_mask; + #define func_backing_store_qcaps_resp_ctx_init_mask_qp 0x1ul + #define func_backing_store_qcaps_resp_ctx_init_mask_srq 0x2ul + #define func_backing_store_qcaps_resp_ctx_init_mask_cq 0x4ul + #define func_backing_store_qcaps_resp_ctx_init_mask_vnic 0x8ul + #define func_backing_store_qcaps_resp_ctx_init_mask_stat 0x10ul + #define func_backing_store_qcaps_resp_ctx_init_mask_mrav 0x20ul + u8 qp_init_offset; + u8 srq_init_offset; + u8 cq_init_offset; + u8 vnic_init_offset; + u8 stat_init_offset; + u8 mrav_init_offset; + u8 rsvd[6]; -/* hwrm_func_backing_store_cfg_input (size:2048b/256b) */ +/* hwrm_func_backing_store_cfg_input (size:2432b/304b) */ - #define func_backing_store_cfg_req_enables_qp 0x1ul - #define func_backing_store_cfg_req_enables_srq 0x2ul - #define func_backing_store_cfg_req_enables_cq 0x4ul - #define func_backing_store_cfg_req_enables_vnic 0x8ul - #define func_backing_store_cfg_req_enables_stat 0x10ul - #define func_backing_store_cfg_req_enables_tqm_sp 0x20ul - #define func_backing_store_cfg_req_enables_tqm_ring0 0x40ul - #define func_backing_store_cfg_req_enables_tqm_ring1 0x80ul - #define func_backing_store_cfg_req_enables_tqm_ring2 0x100ul - #define func_backing_store_cfg_req_enables_tqm_ring3 0x200ul - #define func_backing_store_cfg_req_enables_tqm_ring4 0x400ul - #define func_backing_store_cfg_req_enables_tqm_ring5 0x800ul - #define func_backing_store_cfg_req_enables_tqm_ring6 0x1000ul - #define func_backing_store_cfg_req_enables_tqm_ring7 0x2000ul - #define func_backing_store_cfg_req_enables_mrav 0x4000ul - #define func_backing_store_cfg_req_enables_tim 0x8000ul + #define func_backing_store_cfg_req_enables_qp 0x1ul + #define func_backing_store_cfg_req_enables_srq 0x2ul + #define func_backing_store_cfg_req_enables_cq 0x4ul + #define func_backing_store_cfg_req_enables_vnic 0x8ul + #define func_backing_store_cfg_req_enables_stat 0x10ul + #define func_backing_store_cfg_req_enables_tqm_sp 0x20ul + #define func_backing_store_cfg_req_enables_tqm_ring0 0x40ul + #define func_backing_store_cfg_req_enables_tqm_ring1 0x80ul + #define func_backing_store_cfg_req_enables_tqm_ring2 0x100ul + #define func_backing_store_cfg_req_enables_tqm_ring3 0x200ul + #define func_backing_store_cfg_req_enables_tqm_ring4 0x400ul + #define func_backing_store_cfg_req_enables_tqm_ring5 0x800ul + #define func_backing_store_cfg_req_enables_tqm_ring6 0x1000ul + #define func_backing_store_cfg_req_enables_tqm_ring7 0x2000ul + #define func_backing_store_cfg_req_enables_mrav 0x4000ul + #define func_backing_store_cfg_req_enables_tim 0x8000ul + #define func_backing_store_cfg_req_enables_tqm_ring8 0x10000ul + #define func_backing_store_cfg_req_enables_tqm_ring9 0x20000ul + #define func_backing_store_cfg_req_enables_tqm_ring10 0x40000ul + u8 tqm_ring8_pg_size_tqm_ring_lvl; + #define func_backing_store_cfg_req_ring8_tqm_ring_lvl_mask 0xful + #define func_backing_store_cfg_req_ring8_tqm_ring_lvl_sft 0 + #define func_backing_store_cfg_req_ring8_tqm_ring_lvl_lvl_0 0x0ul + #define func_backing_store_cfg_req_ring8_tqm_ring_lvl_lvl_1 0x1ul + #define func_backing_store_cfg_req_ring8_tqm_ring_lvl_lvl_2 0x2ul + #define func_backing_store_cfg_req_ring8_tqm_ring_lvl_last func_backing_store_cfg_req_ring8_tqm_ring_lvl_lvl_2 + #define func_backing_store_cfg_req_ring8_tqm_ring_pg_size_mask 0xf0ul + #define func_backing_store_cfg_req_ring8_tqm_ring_pg_size_sft 4 + #define func_backing_store_cfg_req_ring8_tqm_ring_pg_size_pg_4k (0x0ul << 4) + #define func_backing_store_cfg_req_ring8_tqm_ring_pg_size_pg_8k (0x1ul << 4) + #define func_backing_store_cfg_req_ring8_tqm_ring_pg_size_pg_64k (0x2ul << 4) + #define func_backing_store_cfg_req_ring8_tqm_ring_pg_size_pg_2m (0x3ul << 4) + #define func_backing_store_cfg_req_ring8_tqm_ring_pg_size_pg_8m (0x4ul << 4) + #define func_backing_store_cfg_req_ring8_tqm_ring_pg_size_pg_1g (0x5ul << 4) + #define func_backing_store_cfg_req_ring8_tqm_ring_pg_size_last func_backing_store_cfg_req_ring8_tqm_ring_pg_size_pg_1g + u8 ring8_unused[3]; + __le32 tqm_ring8_num_entries; + __le64 tqm_ring8_page_dir; + u8 tqm_ring9_pg_size_tqm_ring_lvl; + #define func_backing_store_cfg_req_ring9_tqm_ring_lvl_mask 0xful + #define func_backing_store_cfg_req_ring9_tqm_ring_lvl_sft 0 + #define func_backing_store_cfg_req_ring9_tqm_ring_lvl_lvl_0 0x0ul + #define func_backing_store_cfg_req_ring9_tqm_ring_lvl_lvl_1 0x1ul + #define func_backing_store_cfg_req_ring9_tqm_ring_lvl_lvl_2 0x2ul + #define func_backing_store_cfg_req_ring9_tqm_ring_lvl_last func_backing_store_cfg_req_ring9_tqm_ring_lvl_lvl_2 + #define func_backing_store_cfg_req_ring9_tqm_ring_pg_size_mask 0xf0ul + #define func_backing_store_cfg_req_ring9_tqm_ring_pg_size_sft 4 + #define func_backing_store_cfg_req_ring9_tqm_ring_pg_size_pg_4k (0x0ul << 4) + #define func_backing_store_cfg_req_ring9_tqm_ring_pg_size_pg_8k (0x1ul << 4) + #define func_backing_store_cfg_req_ring9_tqm_ring_pg_size_pg_64k (0x2ul << 4) + #define func_backing_store_cfg_req_ring9_tqm_ring_pg_size_pg_2m (0x3ul << 4) + #define func_backing_store_cfg_req_ring9_tqm_ring_pg_size_pg_8m (0x4ul << 4) + #define func_backing_store_cfg_req_ring9_tqm_ring_pg_size_pg_1g (0x5ul << 4) + #define func_backing_store_cfg_req_ring9_tqm_ring_pg_size_last func_backing_store_cfg_req_ring9_tqm_ring_pg_size_pg_1g + u8 ring9_unused[3]; + __le32 tqm_ring9_num_entries; + __le64 tqm_ring9_page_dir; + u8 tqm_ring10_pg_size_tqm_ring_lvl; + #define func_backing_store_cfg_req_ring10_tqm_ring_lvl_mask 0xful + #define func_backing_store_cfg_req_ring10_tqm_ring_lvl_sft 0 + #define func_backing_store_cfg_req_ring10_tqm_ring_lvl_lvl_0 0x0ul + #define func_backing_store_cfg_req_ring10_tqm_ring_lvl_lvl_1 0x1ul + #define func_backing_store_cfg_req_ring10_tqm_ring_lvl_lvl_2 0x2ul + #define func_backing_store_cfg_req_ring10_tqm_ring_lvl_last func_backing_store_cfg_req_ring10_tqm_ring_lvl_lvl_2 + #define func_backing_store_cfg_req_ring10_tqm_ring_pg_size_mask 0xf0ul + #define func_backing_store_cfg_req_ring10_tqm_ring_pg_size_sft 4 + #define func_backing_store_cfg_req_ring10_tqm_ring_pg_size_pg_4k (0x0ul << 4) + #define func_backing_store_cfg_req_ring10_tqm_ring_pg_size_pg_8k (0x1ul << 4) + #define func_backing_store_cfg_req_ring10_tqm_ring_pg_size_pg_64k (0x2ul << 4) + #define func_backing_store_cfg_req_ring10_tqm_ring_pg_size_pg_2m (0x3ul << 4) + #define func_backing_store_cfg_req_ring10_tqm_ring_pg_size_pg_8m (0x4ul << 4) + #define func_backing_store_cfg_req_ring10_tqm_ring_pg_size_pg_1g (0x5ul << 4) + #define func_backing_store_cfg_req_ring10_tqm_ring_pg_size_last func_backing_store_cfg_req_ring10_tqm_ring_pg_size_pg_1g + u8 ring10_unused[3]; + __le32 tqm_ring10_num_entries; + __le64 tqm_ring10_page_dir; + #define port_phy_qcfg_resp_option_flags_signal_mode_known 0x2ul - #define port_phy_qcaps_resp_flags_rsvd1_mask 0xc0ul - #define port_phy_qcaps_resp_flags_rsvd1_sft 6 + #define port_phy_qcaps_resp_flags_fw_managed_link_down 0x40ul + #define port_phy_qcaps_resp_flags_rsvd1 0x80ul - u8 unused_0; + u8 queue_id0_service_profile_type; + #define queue_qportcfg_resp_queue_id0_service_profile_type_roce 0x1ul + #define queue_qportcfg_resp_queue_id0_service_profile_type_nic 0x2ul + #define queue_qportcfg_resp_queue_id0_service_profile_type_cnp 0x4ul - u8 unused_1[7]; + u8 queue_id1_service_profile_type; + #define queue_qportcfg_resp_queue_id1_service_profile_type_roce 0x1ul + #define queue_qportcfg_resp_queue_id1_service_profile_type_nic 0x2ul + #define queue_qportcfg_resp_queue_id1_service_profile_type_cnp 0x4ul + u8 queue_id2_service_profile_type; + #define queue_qportcfg_resp_queue_id2_service_profile_type_roce 0x1ul + #define queue_qportcfg_resp_queue_id2_service_profile_type_nic 0x2ul + #define queue_qportcfg_resp_queue_id2_service_profile_type_cnp 0x4ul + u8 queue_id3_service_profile_type; + #define queue_qportcfg_resp_queue_id3_service_profile_type_roce 0x1ul + #define queue_qportcfg_resp_queue_id3_service_profile_type_nic 0x2ul + #define queue_qportcfg_resp_queue_id3_service_profile_type_cnp 0x4ul + u8 queue_id4_service_profile_type; + #define queue_qportcfg_resp_queue_id4_service_profile_type_roce 0x1ul + #define queue_qportcfg_resp_queue_id4_service_profile_type_nic 0x2ul + #define queue_qportcfg_resp_queue_id4_service_profile_type_cnp 0x4ul + u8 queue_id5_service_profile_type; + #define queue_qportcfg_resp_queue_id5_service_profile_type_roce 0x1ul + #define queue_qportcfg_resp_queue_id5_service_profile_type_nic 0x2ul + #define queue_qportcfg_resp_queue_id5_service_profile_type_cnp 0x4ul + u8 queue_id6_service_profile_type; + #define queue_qportcfg_resp_queue_id6_service_profile_type_roce 0x1ul + #define queue_qportcfg_resp_queue_id6_service_profile_type_nic 0x2ul + #define queue_qportcfg_resp_queue_id6_service_profile_type_cnp 0x4ul + u8 queue_id7_service_profile_type; + #define queue_qportcfg_resp_queue_id7_service_profile_type_roce 0x1ul + #define queue_qportcfg_resp_queue_id7_service_profile_type_nic 0x2ul + #define queue_qportcfg_resp_queue_id7_service_profile_type_cnp 0x4ul - #define vnic_alloc_req_flags_default 0x1ul - u8 unused_0[4]; + #define vnic_alloc_req_flags_default 0x1ul + #define vnic_alloc_req_flags_virtio_net_fid_valid 0x2ul + __le16 virtio_net_fid; + u8 unused_0[2]; + #define vnic_qcaps_resp_flags_vnic_state_cap 0x400ul + #define vnic_qcaps_resp_flags_virtio_net_vnic_alloc_cap 0x800ul - u8 unused_0[3]; + u8 push_buffer_index; + #define ring_alloc_resp_push_buffer_index_ping_buffer 0x0ul + #define ring_alloc_resp_push_buffer_index_pong_buffer 0x1ul + #define ring_alloc_resp_push_buffer_index_last ring_alloc_resp_push_buffer_index_pong_buffer + u8 unused_0[2]; - u8 unused_0[4]; + u8 push_buffer_index; + #define ring_reset_resp_push_buffer_index_ping_buffer 0x0ul + #define ring_reset_resp_push_buffer_index_pong_buffer 0x1ul + #define ring_reset_resp_push_buffer_index_last ring_reset_resp_push_buffer_index_pong_buffer + u8 unused_0[3]; - #define cfa_adv_flow_mgnt_qcaps_resp_flags_flow_hnd_16bit_supported 0x1ul - #define cfa_adv_flow_mgnt_qcaps_resp_flags_flow_hnd_64bit_supported 0x2ul - #define cfa_adv_flow_mgnt_qcaps_resp_flags_flow_batch_delete_supported 0x4ul - #define cfa_adv_flow_mgnt_qcaps_resp_flags_flow_reset_all_supported 0x8ul - #define cfa_adv_flow_mgnt_qcaps_resp_flags_ntuple_flow_dest_func_supported 0x10ul - #define cfa_adv_flow_mgnt_qcaps_resp_flags_tx_eem_flow_supported 0x20ul - #define cfa_adv_flow_mgnt_qcaps_resp_flags_rx_eem_flow_supported 0x40ul - #define cfa_adv_flow_mgnt_qcaps_resp_flags_flow_counter_alloc_supported 0x80ul - #define cfa_adv_flow_mgnt_qcaps_resp_flags_rfs_ring_tbl_idx_supported 0x100ul - #define cfa_adv_flow_mgnt_qcaps_resp_flags_untagged_vlan_supported 0x200ul - #define cfa_adv_flow_mgnt_qcaps_resp_flags_xdp_supported 0x400ul - #define cfa_adv_flow_mgnt_qcaps_resp_flags_l2_header_source_fields_supported 0x800ul - #define cfa_adv_flow_mgnt_qcaps_resp_flags_ntuple_flow_rx_arp_supported 0x1000ul - #define cfa_adv_flow_mgnt_qcaps_resp_flags_rfs_ring_tbl_idx_v2_supported 0x2000ul - #define cfa_adv_flow_mgnt_qcaps_resp_flags_ntuple_flow_rx_ethertype_ip_supported 0x4000ul + #define cfa_adv_flow_mgnt_qcaps_resp_flags_flow_hnd_16bit_supported 0x1ul + #define cfa_adv_flow_mgnt_qcaps_resp_flags_flow_hnd_64bit_supported 0x2ul + #define cfa_adv_flow_mgnt_qcaps_resp_flags_flow_batch_delete_supported 0x4ul + #define cfa_adv_flow_mgnt_qcaps_resp_flags_flow_reset_all_supported 0x8ul + #define cfa_adv_flow_mgnt_qcaps_resp_flags_ntuple_flow_dest_func_supported 0x10ul + #define cfa_adv_flow_mgnt_qcaps_resp_flags_tx_eem_flow_supported 0x20ul + #define cfa_adv_flow_mgnt_qcaps_resp_flags_rx_eem_flow_supported 0x40ul + #define cfa_adv_flow_mgnt_qcaps_resp_flags_flow_counter_alloc_supported 0x80ul + #define cfa_adv_flow_mgnt_qcaps_resp_flags_rfs_ring_tbl_idx_supported 0x100ul + #define cfa_adv_flow_mgnt_qcaps_resp_flags_untagged_vlan_supported 0x200ul + #define cfa_adv_flow_mgnt_qcaps_resp_flags_xdp_supported 0x400ul + #define cfa_adv_flow_mgnt_qcaps_resp_flags_l2_header_source_fields_supported 0x800ul + #define cfa_adv_flow_mgnt_qcaps_resp_flags_ntuple_flow_rx_arp_supported 0x1000ul + #define cfa_adv_flow_mgnt_qcaps_resp_flags_rfs_ring_tbl_idx_v2_supported 0x2000ul + #define cfa_adv_flow_mgnt_qcaps_resp_flags_ntuple_flow_rx_ethertype_ip_supported 0x4000ul + #define cfa_adv_flow_mgnt_qcaps_resp_flags_truflow_capable 0x8000ul + #define cfa_adv_flow_mgnt_qcaps_resp_flags_l2_filter_traffic_type_l2_roce_supported 0x10000ul - #define struct_hdr_struct_id_last struct_hdr_struct_id_rss_v2 + #define struct_hdr_struct_id_msix_per_vf 0xc8ul + #define struct_hdr_struct_id_last struct_hdr_struct_id_msix_per_vf + #define coredump_data_hdr_flags_length_actual_len_mask 0xfffffful + #define coredump_data_hdr_flags_length_actual_len_sft 0 + #define coredump_data_hdr_flags_length_indirect_access 0x1000000ul -
|
Networking
|
16db6323042f39b6f49148969e9d03d11265bc1b
|
michael chan
|
drivers
|
net
|
bnxt, broadcom, ethernet
|
brcmfmac: add support for cqm rssi notifications
|
add support for cqm rssi measurement reporting and advertise the nl80211_ext_feature_cqm_rssi_list feature. this enables a userspace supplicant such as iwd to be notified of changes in the rssi for roaming and signal monitoring purposes.
|
this release allows to map an uid to a different one in a mount; it also adds support for selecting the preemption model at runtime; support for a low-overhead memory error detector designed to be used in production; support for the acrn hypervisor designed for embedded systems; btrfs initial support for zoned devices, subpage blocks sizes and performance improvements; support for eager nfs writes; support for a thermal power management to control the surface temperature of embedded devices in an unified way; the napi polling can be moved to a kernel thread; and support for non-blocking path lookups. as always, there are many other features, new drivers, improvements and fixes.
|
add support for cqm rssi notifications
|
['core (various)', 'file systems', 'memory management', 'block layer', 'tracing, perf and bpf', 'virtualization', 'cryptography', 'security', 'networking', 'architectures x86 arm risc-v powerpc mips csky s390 pa-risc c6x']
|
['graphics', 'power management', 'storage', 'drivers in the staging area', 'networking', 'audio', 'tablets, touch screens, keyboards, mouses', 'tv tuners, webcams, video capturers', 'universal serial bus', 'serial peripheral interface (spi)', 'watchdog', 'serial', 'cpu frequency scaling', 'device voltage and frequency scaling', 'voltage, current regulators, power capping, power supply', 'real time clock (rtc)', 'pin controllers (pinctrl)', 'multi media card (mmc)', 'memory technology devices (mtd)', 'industrial i/o (iio)', 'multi function devices (mfd)', 'pulse-width modulation (pwm)', 'inter-integrated circuit (i2c + i3c)', 'hardware monitoring (hwmon)', 'general purpose i/o (gpio)', 'leds', 'dma engines', 'cryptography hardware acceleration', 'pci', 'non-transparent bridge (ntb)', 'thunderbolt', 'clock', 'phy ("physical layer" framework)', 'cxl (compute express link)', 'various']
|
['brcmfmac ']
|
['h', 'c']
| 3
| 121
| 0
|
--- diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c +static int brcmf_cfg80211_set_cqm_rssi_range_config(struct wiphy *wiphy, + struct net_device *ndev, + s32 rssi_low, s32 rssi_high) +{ + struct brcmf_cfg80211_vif *vif; + struct brcmf_if *ifp; + int err = 0; + + brcmf_dbg(trace, "low=%d high=%d", rssi_low, rssi_high); + + ifp = netdev_priv(ndev); + vif = ifp->vif; + + if (rssi_low != vif->cqm_rssi_low || rssi_high != vif->cqm_rssi_high) { + /* the firmware will send an event when the rssi is less than or + * equal to a configured level and the previous rssi event was + * less than or equal to a different level. set a third level + * so that we also detect the transition from rssi <= rssi_high + * to rssi > rssi_high. + */ + struct brcmf_rssi_event_le config = { + .rate_limit_msec = cpu_to_le32(0), + .rssi_level_num = 3, + .rssi_levels = { + clamp_val(rssi_low, s8_min, s8_max - 2), + clamp_val(rssi_high, s8_min + 1, s8_max - 1), + s8_max, + }, + }; + + err = brcmf_fil_iovar_data_set(ifp, "rssi_event", &config, + sizeof(config)); + if (err) { + err = -einval; + } else { + vif->cqm_rssi_low = rssi_low; + vif->cqm_rssi_high = rssi_high; + } + } + + return err; +} + .set_cqm_rssi_range_config = brcmf_cfg80211_set_cqm_rssi_range_config, +static s32 brcmf_notify_rssi(struct brcmf_if *ifp, + const struct brcmf_event_msg *e, void *data) +{ + struct brcmf_cfg80211_vif *vif = ifp->vif; + struct brcmf_rssi_be *info = data; + s32 rssi, snr, noise; + s32 low, high, last; + + if (e->datalen < sizeof(*info)) { + brcmf_err("insufficient rssi event data "); + return 0; + } + + rssi = be32_to_cpu(info->rssi); + snr = be32_to_cpu(info->snr); + noise = be32_to_cpu(info->noise); + + low = vif->cqm_rssi_low; + high = vif->cqm_rssi_high; + last = vif->cqm_rssi_last; + + brcmf_dbg(trace, "rssi=%d snr=%d noise=%d low=%d high=%d last=%d ", + rssi, snr, noise, low, high, last); + + vif->cqm_rssi_last = rssi; + + if (rssi <= low || rssi == 0) { + brcmf_dbg(info, "low rssi=%d ", rssi); + cfg80211_cqm_rssi_notify(ifp->ndev, + nl80211_cqm_rssi_threshold_event_low, + rssi, gfp_kernel); + } else if (rssi > high) { + brcmf_dbg(info, "high rssi=%d ", rssi); + cfg80211_cqm_rssi_notify(ifp->ndev, + nl80211_cqm_rssi_threshold_event_high, + rssi, gfp_kernel); + } + + return 0; +} + + brcmf_fweh_register(cfg->pub, brcmf_e_rssi, brcmf_notify_rssi); + wiphy_ext_feature_set(wiphy, nl80211_ext_feature_cqm_rssi_list); + diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.h b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.h --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.h +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.h + * @cqm_rssi_low: lower rssi limit for cqm monitoring + * @cqm_rssi_high: upper rssi limit for cqm monitoring + * @cqm_rssi_last: last rssi reading for cqm monitoring + s32 cqm_rssi_low; + s32 cqm_rssi_high; + s32 cqm_rssi_last; diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwil_types.h b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwil_types.h --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwil_types.h +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwil_types.h +/** + * struct brcmf_rssi_be - rssi threshold event format + * + * @rssi: receive signal strength (in dbm) + * @snr: signal-noise ratio + * @noise: noise (in dbm) + */ +struct brcmf_rssi_be { + __be32 rssi; + __be32 snr; + __be32 noise; +}; + +#define brcmf_max_rssi_levels 8 + +/** + * struct brcm_rssi_event_le - rssi_event iovar format + * + * @rate_limit_msec: rssi event rate limit + * @rssi_level_num: number of supplied rssi levels + * @rssi_levels: rssi levels in ascending order + */ +struct brcmf_rssi_event_le { + __le32 rate_limit_msec; + s8 rssi_level_num; + s8 rssi_levels[brcmf_max_rssi_levels]; +}; +
|
Networking
|
7dd56ea45a6686719a9d05c3e3f946a85809d322
|
alvin ipraga arend van spriel arend vanspriel broadcom com
|
drivers
|
net
|
brcm80211, brcmfmac, broadcom, wireless
|
brcmfmac: support bcm4365e with 43666 chipcommon chip id
|
this adds support for the bcm43666/4 which seems to be using the same firmware as bcm4366 (4366c0). i found it in the netgear r8000p router.
|
this release allows to map an uid to a different one in a mount; it also adds support for selecting the preemption model at runtime; support for a low-overhead memory error detector designed to be used in production; support for the acrn hypervisor designed for embedded systems; btrfs initial support for zoned devices, subpage blocks sizes and performance improvements; support for eager nfs writes; support for a thermal power management to control the surface temperature of embedded devices in an unified way; the napi polling can be moved to a kernel thread; and support for non-blocking path lookups. as always, there are many other features, new drivers, improvements and fixes.
|
support bcm4365e with 43666 chipcommon chip id
|
['core (various)', 'file systems', 'memory management', 'block layer', 'tracing, perf and bpf', 'virtualization', 'cryptography', 'security', 'networking', 'architectures x86 arm risc-v powerpc mips csky s390 pa-risc c6x']
|
['graphics', 'power management', 'storage', 'drivers in the staging area', 'networking', 'audio', 'tablets, touch screens, keyboards, mouses', 'tv tuners, webcams, video capturers', 'universal serial bus', 'serial peripheral interface (spi)', 'watchdog', 'serial', 'cpu frequency scaling', 'device voltage and frequency scaling', 'voltage, current regulators, power capping, power supply', 'real time clock (rtc)', 'pin controllers (pinctrl)', 'multi media card (mmc)', 'memory technology devices (mtd)', 'industrial i/o (iio)', 'multi function devices (mfd)', 'pulse-width modulation (pwm)', 'inter-integrated circuit (i2c + i3c)', 'hardware monitoring (hwmon)', 'general purpose i/o (gpio)', 'leds', 'dma engines', 'cryptography hardware acceleration', 'pci', 'non-transparent bridge (ntb)', 'thunderbolt', 'clock', 'phy ("physical layer" framework)', 'cxl (compute express link)', 'various']
|
['brcmfmac ']
|
['h', 'c']
| 3
| 3
| 0
|
--- diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.c --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.c +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.c + case brcm_cc_43666_chip_id: diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c + brcmf_fw_entry(brcm_cc_43666_chip_id, 0xfffffff0, 4366c), diff --git a/drivers/net/wireless/broadcom/brcm80211/include/brcm_hw_ids.h b/drivers/net/wireless/broadcom/brcm80211/include/brcm_hw_ids.h --- a/drivers/net/wireless/broadcom/brcm80211/include/brcm_hw_ids.h +++ b/drivers/net/wireless/broadcom/brcm80211/include/brcm_hw_ids.h +#define brcm_cc_43666_chip_id 43666
|
Networking
|
f4add10399f9cba42a45ac4b0e0dc5e4943f8546
|
rafa mi ecki arend van spriel arend vanspriel broadcom com
|
drivers
|
net
|
brcm80211, brcmfmac, broadcom, include, wireless
|
net: broadcom: bcm4908enet: add bcm4908 controller driver
|
bcm4908 socs family uses ethernel controller that includes unimac but uses different dma engine (than other controllers) and requires different programming.
|
this release allows to map an uid to a different one in a mount; it also adds support for selecting the preemption model at runtime; support for a low-overhead memory error detector designed to be used in production; support for the acrn hypervisor designed for embedded systems; btrfs initial support for zoned devices, subpage blocks sizes and performance improvements; support for eager nfs writes; support for a thermal power management to control the surface temperature of embedded devices in an unified way; the napi polling can be moved to a kernel thread; and support for non-blocking path lookups. as always, there are many other features, new drivers, improvements and fixes.
|
add bcm4908 controller driver
|
['core (various)', 'file systems', 'memory management', 'block layer', 'tracing, perf and bpf', 'virtualization', 'cryptography', 'security', 'networking', 'architectures x86 arm risc-v powerpc mips csky s390 pa-risc c6x']
|
['graphics', 'power management', 'storage', 'drivers in the staging area', 'networking', 'audio', 'tablets, touch screens, keyboards, mouses', 'tv tuners, webcams, video capturers', 'universal serial bus', 'serial peripheral interface (spi)', 'watchdog', 'serial', 'cpu frequency scaling', 'device voltage and frequency scaling', 'voltage, current regulators, power capping, power supply', 'real time clock (rtc)', 'pin controllers (pinctrl)', 'multi media card (mmc)', 'memory technology devices (mtd)', 'industrial i/o (iio)', 'multi function devices (mfd)', 'pulse-width modulation (pwm)', 'inter-integrated circuit (i2c + i3c)', 'hardware monitoring (hwmon)', 'general purpose i/o (gpio)', 'leds', 'dma engines', 'cryptography hardware acceleration', 'pci', 'non-transparent bridge (ntb)', 'thunderbolt', 'clock', 'phy ("physical layer" framework)', 'cxl (compute express link)', 'various']
|
['broadcom', 'bcm4908enet']
|
['c', 'h', 'kconfig', 'maintainers', 'makefile']
| 5
| 790
| 0
|
--- diff --git a/maintainers b/maintainers --- a/maintainers +++ b/maintainers +broadcom bcm4908 ethernet driver +m: rafa miecki <rafal@milecki.pl> +m: bcm-kernel-feedback-list@broadcom.com +l: netdev@vger.kernel.org +s: maintained +f: documentation/devicetree/bindings/net/brcm,bcm4908enet.yaml +f: drivers/net/ethernet/broadcom/bcm4908enet.* +f: drivers/net/ethernet/broadcom/unimac.h + diff --git a/drivers/net/ethernet/broadcom/kconfig b/drivers/net/ethernet/broadcom/kconfig --- a/drivers/net/ethernet/broadcom/kconfig +++ b/drivers/net/ethernet/broadcom/kconfig +config bcm4908enet + tristate "broadcom bcm4908 internal mac support" + depends on arch_bcm4908 || compile_test + default y + help + this driver supports ethernet controller integrated into broadcom + bcm4908 family socs. + diff --git a/drivers/net/ethernet/broadcom/makefile b/drivers/net/ethernet/broadcom/makefile --- a/drivers/net/ethernet/broadcom/makefile +++ b/drivers/net/ethernet/broadcom/makefile +obj-$(config_bcm4908enet) += bcm4908enet.o diff --git a/drivers/net/ethernet/broadcom/bcm4908enet.c b/drivers/net/ethernet/broadcom/bcm4908enet.c --- /dev/null +++ b/drivers/net/ethernet/broadcom/bcm4908enet.c +// spdx-license-identifier: gpl-2.0-only +/* + * copyright (c) 2021 rafa miecki <rafal@milecki.pl> + */ + +#include <linux/delay.h> +#include <linux/etherdevice.h> +#include <linux/interrupt.h> +#include <linux/module.h> +#include <linux/of.h> +#include <linux/platform_device.h> +#include <linux/slab.h> +#include <linux/string.h> + +#include "bcm4908enet.h" +#include "unimac.h" + +#define enet_dma_ch_rx_cfg enet_dma_ch0_cfg +#define enet_dma_ch_tx_cfg enet_dma_ch1_cfg +#define enet_dma_ch_rx_state_ram enet_dma_ch0_state_ram +#define enet_dma_ch_tx_state_ram enet_dma_ch1_state_ram + +#define enet_tx_bds_num 200 +#define enet_rx_bds_num 200 +#define enet_rx_bds_num_max 8192 + +#define enet_dma_int_defaults (enet_dma_ch_cfg_int_done | \ + enet_dma_ch_cfg_int_no_desc | \ + enet_dma_ch_cfg_int_buff_done) +#define enet_dma_max_burst_len 8 /* in 64 bit words */ + +#define enet_mtu_min 60 +#define enet_mtu_max 1500 /* is it possible to support 2044? */ +#define enet_mtu_max_extra_size 32 /* l2 */ + +struct bcm4908enet_dma_ring_bd { + __le32 ctl; + __le32 addr; +} __packed; + +struct bcm4908enet_dma_ring_slot { + struct sk_buff *skb; + unsigned int len; + dma_addr_t dma_addr; +}; + +struct bcm4908enet_dma_ring { + int is_tx; + int read_idx; + int write_idx; + int length; + u16 cfg_block; + u16 st_ram_block; + + union { + void *cpu_addr; + struct bcm4908enet_dma_ring_bd *buf_desc; + }; + dma_addr_t dma_addr; + + struct bcm4908enet_dma_ring_slot *slots; +}; + +struct bcm4908enet { + struct device *dev; + struct net_device *netdev; + struct napi_struct napi; + void __iomem *base; + + struct bcm4908enet_dma_ring tx_ring; + struct bcm4908enet_dma_ring rx_ring; +}; + +/*** + * r/w ops + */ + +static inline u32 enet_read(struct bcm4908enet *enet, u16 offset) +{ + return readl(enet->base + offset); +} + +static inline void enet_write(struct bcm4908enet *enet, u16 offset, u32 value) +{ + writel(value, enet->base + offset); +} + +static inline void enet_maskset(struct bcm4908enet *enet, u16 offset, u32 mask, u32 set) +{ + u32 val; + + warn_on(set & ~mask); + + val = enet_read(enet, offset); + val = (val & ~mask) | (set & mask); + enet_write(enet, offset, val); +} + +static inline void enet_set(struct bcm4908enet *enet, u16 offset, u32 set) +{ + enet_maskset(enet, offset, set, set); +} + +static inline u32 enet_umac_read(struct bcm4908enet *enet, u16 offset) +{ + return enet_read(enet, enet_unimac + offset); +} + +static inline void enet_umac_write(struct bcm4908enet *enet, u16 offset, u32 value) +{ + enet_write(enet, enet_unimac + offset, value); +} + +static inline void enet_umac_maskset(struct bcm4908enet *enet, u16 offset, u32 mask, u32 set) +{ + enet_maskset(enet, enet_unimac + offset, mask, set); +} + +static inline void enet_umac_set(struct bcm4908enet *enet, u16 offset, u32 set) +{ + enet_set(enet, enet_unimac + offset, set); +} + +/*** + * helpers + */ + +static void bcm4908enet_intrs_on(struct bcm4908enet *enet) +{ + enet_write(enet, enet_dma_ch_rx_cfg + enet_dma_ch_cfg_int_mask, enet_dma_int_defaults); +} + +static void bcm4908enet_intrs_off(struct bcm4908enet *enet) +{ + enet_write(enet, enet_dma_ch_rx_cfg + enet_dma_ch_cfg_int_mask, 0); +} + +static void bcm4908enet_intrs_ack(struct bcm4908enet *enet) +{ + enet_write(enet, enet_dma_ch_rx_cfg + enet_dma_ch_cfg_int_stat, enet_dma_int_defaults); +} + +/*** + * dma + */ + +static int bcm4908_dma_alloc_buf_descs(struct bcm4908enet *enet, struct bcm4908enet_dma_ring *ring) +{ + int size = ring->length * sizeof(struct bcm4908enet_dma_ring_bd); + struct device *dev = enet->dev; + + ring->cpu_addr = dma_alloc_coherent(dev, size, &ring->dma_addr, gfp_kernel); + if (!ring->cpu_addr) + return -enomem; + + if (((uintptr_t)ring->cpu_addr) & (0x40 - 1)) { + dev_err(dev, "invalid dma ring alignment "); + goto err_free_buf_descs; + } + + ring->slots = kzalloc(ring->length * sizeof(*ring->slots), gfp_kernel); + if (!ring->slots) + goto err_free_buf_descs; + + memset(ring->cpu_addr, 0, size); + + ring->read_idx = 0; + ring->write_idx = 0; + + return 0; + +err_free_buf_descs: + dma_free_coherent(dev, size, ring->cpu_addr, ring->dma_addr); + return -enomem; +} + +static void bcm4908enet_dma_free(struct bcm4908enet *enet) +{ + struct bcm4908enet_dma_ring *tx_ring = &enet->tx_ring; + struct bcm4908enet_dma_ring *rx_ring = &enet->rx_ring; + struct device *dev = enet->dev; + int size; + + size = rx_ring->length * sizeof(struct bcm4908enet_dma_ring_bd); + if (rx_ring->cpu_addr) + dma_free_coherent(dev, size, rx_ring->cpu_addr, rx_ring->dma_addr); + kfree(rx_ring->slots); + + size = tx_ring->length * sizeof(struct bcm4908enet_dma_ring_bd); + if (tx_ring->cpu_addr) + dma_free_coherent(dev, size, tx_ring->cpu_addr, tx_ring->dma_addr); + kfree(tx_ring->slots); +} + +static int bcm4908enet_dma_alloc(struct bcm4908enet *enet) +{ + struct bcm4908enet_dma_ring *tx_ring = &enet->tx_ring; + struct bcm4908enet_dma_ring *rx_ring = &enet->rx_ring; + struct device *dev = enet->dev; + int err; + + tx_ring->length = enet_tx_bds_num; + tx_ring->is_tx = 1; + tx_ring->cfg_block = enet_dma_ch_tx_cfg; + tx_ring->st_ram_block = enet_dma_ch_tx_state_ram; + err = bcm4908_dma_alloc_buf_descs(enet, tx_ring); + if (err) { + dev_err(dev, "failed to alloc tx buf descriptors: %d ", err); + return err; + } + + rx_ring->length = enet_rx_bds_num; + rx_ring->is_tx = 0; + rx_ring->cfg_block = enet_dma_ch_rx_cfg; + rx_ring->st_ram_block = enet_dma_ch_rx_state_ram; + err = bcm4908_dma_alloc_buf_descs(enet, rx_ring); + if (err) { + dev_err(dev, "failed to alloc rx buf descriptors: %d ", err); + bcm4908enet_dma_free(enet); + return err; + } + + return 0; +} + +static void bcm4908enet_dma_reset(struct bcm4908enet *enet) +{ + struct bcm4908enet_dma_ring *rings[] = { &enet->rx_ring, &enet->tx_ring }; + int i; + + /* disable the dma controller and channel */ + for (i = 0; i < array_size(rings); i++) + enet_write(enet, rings[i]->cfg_block + enet_dma_ch_cfg, 0); + enet_maskset(enet, enet_dma_controller_cfg, enet_dma_ctrl_cfg_master_en, 0); + + /* reset channels state */ + for (i = 0; i < array_size(rings); i++) { + struct bcm4908enet_dma_ring *ring = rings[i]; + + enet_write(enet, ring->st_ram_block + enet_dma_ch_state_ram_base_desc_ptr, 0); + enet_write(enet, ring->st_ram_block + enet_dma_ch_state_ram_state_data, 0); + enet_write(enet, ring->st_ram_block + enet_dma_ch_state_ram_desc_len_status, 0); + enet_write(enet, ring->st_ram_block + enet_dma_ch_state_ram_desc_base_bufptr, 0); + } +} + +static int bcm4908enet_dma_alloc_rx_buf(struct bcm4908enet *enet, unsigned int idx) +{ + struct bcm4908enet_dma_ring_bd *buf_desc = &enet->rx_ring.buf_desc[idx]; + struct bcm4908enet_dma_ring_slot *slot = &enet->rx_ring.slots[idx]; + struct device *dev = enet->dev; + u32 tmp; + int err; + + slot->len = enet_mtu_max + enet_mtu_max_extra_size; + + slot->skb = netdev_alloc_skb(enet->netdev, slot->len); + if (!slot->skb) + return -enomem; + + slot->dma_addr = dma_map_single(dev, slot->skb->data, slot->len, dma_from_device); + err = dma_mapping_error(dev, slot->dma_addr); + if (err) { + dev_err(dev, "failed to map dma buffer: %d ", err); + kfree_skb(slot->skb); + slot->skb = null; + return err; + } + + tmp = slot->len << dma_ctl_len_desc_buflength_shift; + tmp |= dma_ctl_status_own; + if (idx == enet->rx_ring.length - 1) + tmp |= dma_ctl_status_wrap; + buf_desc->ctl = cpu_to_le32(tmp); + buf_desc->addr = cpu_to_le32(slot->dma_addr); + + return 0; +} + +static void bcm4908enet_dma_ring_init(struct bcm4908enet *enet, + struct bcm4908enet_dma_ring *ring) +{ + int reset_channel = 0; /* we support only 1 main channel (with tx and rx) */ + int reset_subch = ring->is_tx ? 1 : 0; + + /* reset the dma channel */ + enet_write(enet, enet_dma_ctrl_channel_reset, bit(reset_channel * 2 + reset_subch)); + enet_write(enet, enet_dma_ctrl_channel_reset, 0); + + enet_write(enet, ring->cfg_block + enet_dma_ch_cfg, 0); + enet_write(enet, ring->cfg_block + enet_dma_ch_cfg_max_burst, enet_dma_max_burst_len); + enet_write(enet, ring->cfg_block + enet_dma_ch_cfg_int_mask, 0); + + enet_write(enet, ring->st_ram_block + enet_dma_ch_state_ram_base_desc_ptr, + (uint32_t)ring->dma_addr); +} + +static void bcm4908enet_dma_uninit(struct bcm4908enet *enet) +{ + struct bcm4908enet_dma_ring *rx_ring = &enet->rx_ring; + struct bcm4908enet_dma_ring_slot *slot; + struct device *dev = enet->dev; + int i; + + for (i = rx_ring->length - 1; i >= 0; i--) { + slot = &rx_ring->slots[i]; + if (!slot->skb) + continue; + dma_unmap_single(dev, slot->dma_addr, slot->len, dma_from_device); + kfree_skb(slot->skb); + slot->skb = null; + } +} + +static int bcm4908enet_dma_init(struct bcm4908enet *enet) +{ + struct bcm4908enet_dma_ring *rx_ring = &enet->rx_ring; + struct device *dev = enet->dev; + int err; + int i; + + for (i = 0; i < rx_ring->length; i++) { + err = bcm4908enet_dma_alloc_rx_buf(enet, i); + if (err) { + dev_err(dev, "failed to alloc rx buffer: %d ", err); + bcm4908enet_dma_uninit(enet); + return err; + } + } + + bcm4908enet_dma_ring_init(enet, &enet->tx_ring); + bcm4908enet_dma_ring_init(enet, &enet->rx_ring); + + return 0; +} + +static void bcm4908enet_dma_tx_ring_ensable(struct bcm4908enet *enet, + struct bcm4908enet_dma_ring *ring) +{ + enet_write(enet, ring->cfg_block + enet_dma_ch_cfg, enet_dma_ch_cfg_enable); +} + +static void bcm4908enet_dma_tx_ring_disable(struct bcm4908enet *enet, + struct bcm4908enet_dma_ring *ring) +{ + enet_write(enet, ring->cfg_block + enet_dma_ch_cfg, 0); +} + +static void bcm4908enet_dma_rx_ring_enable(struct bcm4908enet *enet, + struct bcm4908enet_dma_ring *ring) +{ + enet_set(enet, ring->cfg_block + enet_dma_ch_cfg, enet_dma_ch_cfg_enable); +} + +static void bcm4908enet_dma_rx_ring_disable(struct bcm4908enet *enet, + struct bcm4908enet_dma_ring *ring) +{ + unsigned long deadline; + u32 tmp; + + enet_maskset(enet, ring->cfg_block + enet_dma_ch_cfg, enet_dma_ch_cfg_enable, 0); + + deadline = jiffies + usecs_to_jiffies(2000); + do { + tmp = enet_read(enet, ring->cfg_block + enet_dma_ch_cfg); + if (!(tmp & enet_dma_ch_cfg_enable)) + return; + enet_maskset(enet, ring->cfg_block + enet_dma_ch_cfg, enet_dma_ch_cfg_enable, 0); + usleep_range(10, 30); + } while (!time_after_eq(jiffies, deadline)); + + dev_warn(enet->dev, "timeout waiting for dma tx stop "); +} + +/*** + * ethernet driver + */ + +static void bcm4908enet_gmac_init(struct bcm4908enet *enet) +{ + u32 cmd; + + cmd = enet_umac_read(enet, umac_cmd); + enet_umac_write(enet, umac_cmd, cmd | cmd_sw_reset); + enet_umac_write(enet, umac_cmd, cmd & ~cmd_sw_reset); + + enet_set(enet, enet_flush, enet_flush_rxfifo_flush | enet_flush_txfifo_flush); + enet_maskset(enet, enet_flush, enet_flush_rxfifo_flush | enet_flush_txfifo_flush, 0); + + enet_set(enet, enet_mib_ctrl, enet_mib_ctrl_clr_mib); + enet_maskset(enet, enet_mib_ctrl, enet_mib_ctrl_clr_mib, 0); + + cmd = enet_umac_read(enet, umac_cmd); + cmd &= ~(cmd_speed_mask << cmd_speed_shift); + cmd &= ~cmd_tx_en; + cmd &= ~cmd_rx_en; + cmd |= cmd_speed_1000 << cmd_speed_shift; + enet_umac_write(enet, umac_cmd, cmd); + + enet_maskset(enet, enet_gmac_status, + enet_gmac_status_eth_speed_mask | + enet_gmac_status_hd | + enet_gmac_status_auto_cfg_en | + enet_gmac_status_link_up, + enet_gmac_status_eth_speed_1000 | + enet_gmac_status_auto_cfg_en | + enet_gmac_status_link_up); +} + +static irqreturn_t bcm4908enet_irq_handler(int irq, void *dev_id) +{ + struct bcm4908enet *enet = dev_id; + + bcm4908enet_intrs_off(enet); + bcm4908enet_intrs_ack(enet); + + napi_schedule(&enet->napi); + + return irq_handled; +} + +static int bcm4908enet_open(struct net_device *netdev) +{ + struct bcm4908enet *enet = netdev_priv(netdev); + struct device *dev = enet->dev; + int err; + + err = request_irq(netdev->irq, bcm4908enet_irq_handler, 0, "enet", enet); + if (err) { + dev_err(dev, "failed to request irq %d: %d ", netdev->irq, err); + return err; + } + + bcm4908enet_gmac_init(enet); + bcm4908enet_dma_reset(enet); + bcm4908enet_dma_init(enet); + + enet_umac_set(enet, umac_cmd, cmd_tx_en | cmd_rx_en); + + enet_set(enet, enet_dma_controller_cfg, enet_dma_ctrl_cfg_master_en); + enet_maskset(enet, enet_dma_controller_cfg, enet_dma_ctrl_cfg_flowc_ch1_en, 0); + bcm4908enet_dma_rx_ring_enable(enet, &enet->rx_ring); + + napi_enable(&enet->napi); + netif_carrier_on(netdev); + netif_start_queue(netdev); + + bcm4908enet_intrs_ack(enet); + bcm4908enet_intrs_on(enet); + + return 0; +} + +static int bcm4908enet_stop(struct net_device *netdev) +{ + struct bcm4908enet *enet = netdev_priv(netdev); + + netif_stop_queue(netdev); + netif_carrier_off(netdev); + napi_disable(&enet->napi); + + bcm4908enet_dma_rx_ring_disable(enet, &enet->rx_ring); + bcm4908enet_dma_tx_ring_disable(enet, &enet->tx_ring); + + bcm4908enet_dma_uninit(enet); + + free_irq(enet->netdev->irq, enet); + + return 0; +} + +static int bcm4908enet_start_xmit(struct sk_buff *skb, struct net_device *netdev) +{ + struct bcm4908enet *enet = netdev_priv(netdev); + struct bcm4908enet_dma_ring *ring = &enet->tx_ring; + struct bcm4908enet_dma_ring_slot *slot; + struct device *dev = enet->dev; + struct bcm4908enet_dma_ring_bd *buf_desc; + int free_buf_descs; + u32 tmp; + + /* free transmitted skbs */ + while (ring->read_idx != ring->write_idx) { + buf_desc = &ring->buf_desc[ring->read_idx]; + if (buf_desc->ctl & dma_ctl_status_own) + break; + slot = &ring->slots[ring->read_idx]; + + dma_unmap_single(dev, slot->dma_addr, slot->len, dma_to_device); + dev_kfree_skb(slot->skb); + if (++ring->read_idx == ring->length) + ring->read_idx = 0; + } + + /* don't use the last empty buf descriptor */ + if (ring->read_idx <= ring->write_idx) + free_buf_descs = ring->read_idx - ring->write_idx + ring->length; + else + free_buf_descs = ring->read_idx - ring->write_idx; + if (free_buf_descs < 2) + return netdev_tx_busy; + + /* hardware removes own bit after sending data */ + buf_desc = &ring->buf_desc[ring->write_idx]; + if (unlikely(le32_to_cpu(buf_desc->ctl) & dma_ctl_status_own)) { + netif_stop_queue(netdev); + return netdev_tx_busy; + } + + slot = &ring->slots[ring->write_idx]; + slot->skb = skb; + slot->len = skb->len; + slot->dma_addr = dma_map_single(dev, skb->data, skb->len, dma_to_device); + if (unlikely(dma_mapping_error(dev, slot->dma_addr))) + return netdev_tx_busy; + + tmp = skb->len << dma_ctl_len_desc_buflength_shift; + tmp |= dma_ctl_status_own; + tmp |= dma_ctl_status_sop; + tmp |= dma_ctl_status_eop; + tmp |= dma_ctl_status_append_crc; + if (ring->write_idx + 1 == ring->length - 1) + tmp |= dma_ctl_status_wrap; + + buf_desc->addr = cpu_to_le32((uint32_t)slot->dma_addr); + buf_desc->ctl = cpu_to_le32(tmp); + + bcm4908enet_dma_tx_ring_ensable(enet, &enet->tx_ring); + + if (++ring->write_idx == ring->length - 1) + ring->write_idx = 0; + enet->netdev->stats.tx_bytes += skb->len; + enet->netdev->stats.tx_packets++; + + return netdev_tx_ok; +} + +static int bcm4908enet_poll(struct napi_struct *napi, int weight) +{ + struct bcm4908enet *enet = container_of(napi, struct bcm4908enet, napi); + struct device *dev = enet->dev; + int handled = 0; + + while (handled < weight) { + struct bcm4908enet_dma_ring_bd *buf_desc; + struct bcm4908enet_dma_ring_slot slot; + u32 ctl; + int len; + int err; + + buf_desc = &enet->rx_ring.buf_desc[enet->rx_ring.read_idx]; + ctl = le32_to_cpu(buf_desc->ctl); + if (ctl & dma_ctl_status_own) + break; + + slot = enet->rx_ring.slots[enet->rx_ring.read_idx]; + + /* provide new buffer before unpinning the old one */ + err = bcm4908enet_dma_alloc_rx_buf(enet, enet->rx_ring.read_idx); + if (err) + break; + + if (++enet->rx_ring.read_idx == enet->rx_ring.length) + enet->rx_ring.read_idx = 0; + + len = (ctl & dma_ctl_len_desc_buflength) >> dma_ctl_len_desc_buflength_shift; + + if (len < enet_mtu_min || + (ctl & (dma_ctl_status_sop | dma_ctl_status_eop)) != (dma_ctl_status_sop | dma_ctl_status_eop)) { + enet->netdev->stats.rx_dropped++; + break; + } + + dma_unmap_single(dev, slot.dma_addr, slot.len, dma_from_device); + + skb_put(slot.skb, len - 4 + 2); + slot.skb->protocol = eth_type_trans(slot.skb, enet->netdev); + netif_receive_skb(slot.skb); + + enet->netdev->stats.rx_packets++; + enet->netdev->stats.rx_bytes += len; + } + + if (handled < weight) { + napi_complete_done(napi, handled); + bcm4908enet_intrs_on(enet); + } + + return handled; +} + +static const struct net_device_ops bcm96xx_netdev_ops = { + .ndo_open = bcm4908enet_open, + .ndo_stop = bcm4908enet_stop, + .ndo_start_xmit = bcm4908enet_start_xmit, + .ndo_set_mac_address = eth_mac_addr, +}; + +static int bcm4908enet_probe(struct platform_device *pdev) +{ + struct device *dev = &pdev->dev; + struct net_device *netdev; + struct bcm4908enet *enet; + int err; + + netdev = devm_alloc_etherdev(dev, sizeof(*enet)); + if (!netdev) + return -enomem; + + enet = netdev_priv(netdev); + enet->dev = dev; + enet->netdev = netdev; + + enet->base = devm_platform_ioremap_resource(pdev, 0); + if (is_err(enet->base)) { + dev_err(dev, "failed to map registers: %ld ", ptr_err(enet->base)); + return ptr_err(enet->base); + } + + netdev->irq = platform_get_irq_byname(pdev, "rx"); + if (netdev->irq < 0) + return netdev->irq; + + dma_set_coherent_mask(dev, dma_bit_mask(32)); + + err = bcm4908enet_dma_alloc(enet); + if (err) + return err; + + set_netdev_dev(netdev, &pdev->dev); + eth_hw_addr_random(netdev); + netdev->netdev_ops = &bcm96xx_netdev_ops; + netdev->min_mtu = eth_zlen; + netdev->mtu = enet_mtu_max; + netdev->max_mtu = enet_mtu_max; + netif_napi_add(netdev, &enet->napi, bcm4908enet_poll, 64); + + err = register_netdev(netdev); + if (err) { + bcm4908enet_dma_free(enet); + return err; + } + + platform_set_drvdata(pdev, enet); + + return 0; +} + +static int bcm4908enet_remove(struct platform_device *pdev) +{ + struct bcm4908enet *enet = platform_get_drvdata(pdev); + + unregister_netdev(enet->netdev); + netif_napi_del(&enet->napi); + bcm4908enet_dma_free(enet); + + return 0; +} + +static const struct of_device_id bcm4908enet_of_match[] = { + { .compatible = "brcm,bcm4908enet"}, + {}, +}; + +static struct platform_driver bcm4908enet_driver = { + .driver = { + .name = "bcm4908enet", + .of_match_table = bcm4908enet_of_match, + }, + .probe = bcm4908enet_probe, + .remove = bcm4908enet_remove, +}; +module_platform_driver(bcm4908enet_driver); + +module_license("gpl v2"); +module_device_table(of, bcm4908enet_of_match); diff --git a/drivers/net/ethernet/broadcom/bcm4908enet.h b/drivers/net/ethernet/broadcom/bcm4908enet.h --- /dev/null +++ b/drivers/net/ethernet/broadcom/bcm4908enet.h +/* spdx-license-identifier: gpl-2.0-only */ +#ifndef __bcm4908enet_h +#define __bcm4908enet_h + +#define enet_control 0x000 +#define enet_mib_ctrl 0x004 +#define enet_mib_ctrl_clr_mib 0x00000001 +#define enet_rx_err_mask 0x008 +#define enet_mib_max_pkt_size 0x00c +#define enet_mib_max_pkt_size_val 0x00003fff +#define enet_diag_out 0x01c +#define enet_enable_drop_pkt 0x020 +#define enet_irq_enable 0x024 +#define enet_irq_enable_ovfl 0x00000001 +#define enet_gmac_status 0x028 +#define enet_gmac_status_eth_speed_mask 0x00000003 +#define enet_gmac_status_eth_speed_10 0x00000000 +#define enet_gmac_status_eth_speed_100 0x00000001 +#define enet_gmac_status_eth_speed_1000 0x00000002 +#define enet_gmac_status_hd 0x00000004 +#define enet_gmac_status_auto_cfg_en 0x00000008 +#define enet_gmac_status_link_up 0x00000010 +#define enet_irq_status 0x02c +#define enet_irq_status_ovfl 0x00000001 +#define enet_overflow_counter 0x030 +#define enet_flush 0x034 +#define enet_flush_rxfifo_flush 0x00000001 +#define enet_flush_txfifo_flush 0x00000002 +#define enet_rsv_select 0x038 +#define enet_bp_force 0x03c +#define enet_bp_force_force 0x00000001 +#define enet_dma_rx_ok_to_send_count 0x040 +#define enet_dma_rx_ok_to_send_count_val 0x0000000f +#define enet_tx_crc_ctrl 0x044 +#define enet_mib 0x200 +#define enet_unimac 0x400 +#define enet_dma 0x800 +#define enet_dma_controller_cfg 0x800 +#define enet_dma_ctrl_cfg_master_en 0x00000001 +#define enet_dma_ctrl_cfg_flowc_ch1_en 0x00000002 +#define enet_dma_ctrl_cfg_flowc_ch3_en 0x00000004 +#define enet_dma_flowctl_ch1_thresh_lo 0x804 +#define enet_dma_flowctl_ch1_thresh_hi 0x808 +#define enet_dma_flowctl_ch1_alloc 0x80c +#define enet_dma_flowctl_ch1_alloc_force 0x80000000 +#define enet_dma_flowctl_ch3_thresh_lo 0x810 +#define enet_dma_flowctl_ch3_thresh_hi 0x814 +#define enet_dma_flowctl_ch3_alloc 0x818 +#define enet_dma_flowctl_ch5_thresh_lo 0x81c +#define enet_dma_flowctl_ch5_thresh_hi 0x820 +#define enet_dma_flowctl_ch5_alloc 0x824 +#define enet_dma_flowctl_ch7_thresh_lo 0x828 +#define enet_dma_flowctl_ch7_thresh_hi 0x82c +#define enet_dma_flowctl_ch7_alloc 0x830 +#define enet_dma_ctrl_channel_reset 0x834 +#define enet_dma_ctrl_channel_debug 0x838 +#define enet_dma_ctrl_global_interrupt_status 0x840 +#define enet_dma_ctrl_global_interrupt_mask 0x844 +#define enet_dma_ch0_cfg 0xa00 /* rx */ +#define enet_dma_ch1_cfg 0xa10 /* tx */ +#define enet_dma_ch0_state_ram 0xc00 /* rx */ +#define enet_dma_ch1_state_ram 0xc10 /* tx */ + +#define enet_dma_ch_cfg 0x00 /* assorted configuration */ +#define enet_dma_ch_cfg_enable 0x00000001 /* set to enable channel */ +#define enet_dma_ch_cfg_pkt_halt 0x00000002 /* idle after an eop flag is detected */ +#define enet_dma_ch_cfg_burst_halt 0x00000004 /* idle after finish current memory burst */ +#define enet_dma_ch_cfg_int_stat 0x04 /* interrupts control and status */ +#define enet_dma_ch_cfg_int_mask 0x08 /* interrupts mask */ +#define enet_dma_ch_cfg_int_buff_done 0x00000001 /* buffer done */ +#define enet_dma_ch_cfg_int_done 0x00000002 /* packet xfer complete */ +#define enet_dma_ch_cfg_int_no_desc 0x00000004 /* no valid descriptors */ +#define enet_dma_ch_cfg_int_rx_error 0x00000008 /* rxdma detect client protocol error */ +#define enet_dma_ch_cfg_max_burst 0x0c /* max burst length permitted */ +#define enet_dma_ch_cfg_max_burst_descsize_sel 0x00040000 /* dma descriptor size selection */ +#define enet_dma_ch_cfg_size 0x10 + +#define enet_dma_ch_state_ram_base_desc_ptr 0x00 /* descriptor ring start address */ +#define enet_dma_ch_state_ram_state_data 0x04 /* state/bytes done/ring offset */ +#define enet_dma_ch_state_ram_desc_len_status 0x08 /* buffer descriptor status and len */ +#define enet_dma_ch_state_ram_desc_base_bufptr 0x0c /* buffer descrpitor current processing */ +#define enet_dma_ch_state_ram_size 0x10 + +#define dma_ctl_status_append_crc 0x00000100 +#define dma_ctl_status_append_brcm_tag 0x00000200 +#define dma_ctl_status_prio 0x00000c00 /* prio for tx */ +#define dma_ctl_status_wrap 0x00001000 /* */ +#define dma_ctl_status_sop 0x00002000 /* first buffer in packet */ +#define dma_ctl_status_eop 0x00004000 /* last buffer in packet */ +#define dma_ctl_status_own 0x00008000 /* cleared by dma, set by sw */ +#define dma_ctl_len_desc_buflength 0x0fff0000 +#define dma_ctl_len_desc_buflength_shift 16 +#define dma_ctl_len_desc_multicast 0x40000000 +#define dma_ctl_len_desc_usefpm 0x80000000 + +#endif
|
Networking
|
4feffeadbcb2e5b11cbbf191a33c245b74a5837b
|
rafa mi ecki
|
drivers
|
net
|
broadcom, ethernet
|
can: dev: can_put_echo_skb(): add software tx timestamps
|
call skb_tx_timestamp() within can_put_echo_skb() so that a software tx timestamp gets attached to the skb.
|
this release allows to map an uid to a different one in a mount; it also adds support for selecting the preemption model at runtime; support for a low-overhead memory error detector designed to be used in production; support for the acrn hypervisor designed for embedded systems; btrfs initial support for zoned devices, subpage blocks sizes and performance improvements; support for eager nfs writes; support for a thermal power management to control the surface temperature of embedded devices in an unified way; the napi polling can be moved to a kernel thread; and support for non-blocking path lookups. as always, there are many other features, new drivers, improvements and fixes.
|
add software tx timestamps
|
['core (various)', 'file systems', 'memory management', 'block layer', 'tracing, perf and bpf', 'virtualization', 'cryptography', 'security', 'networking', 'architectures x86 arm risc-v powerpc mips csky s390 pa-risc c6x']
|
['graphics', 'power management', 'storage', 'drivers in the staging area', 'networking', 'audio', 'tablets, touch screens, keyboards, mouses', 'tv tuners, webcams, video capturers', 'universal serial bus', 'serial peripheral interface (spi)', 'watchdog', 'serial', 'cpu frequency scaling', 'device voltage and frequency scaling', 'voltage, current regulators, power capping, power supply', 'real time clock (rtc)', 'pin controllers (pinctrl)', 'multi media card (mmc)', 'memory technology devices (mtd)', 'industrial i/o (iio)', 'multi function devices (mfd)', 'pulse-width modulation (pwm)', 'inter-integrated circuit (i2c + i3c)', 'hardware monitoring (hwmon)', 'general purpose i/o (gpio)', 'leds', 'dma engines', 'cryptography hardware acceleration', 'pci', 'non-transparent bridge (ntb)', 'thunderbolt', 'clock', 'phy ("physical layer" framework)', 'cxl (compute express link)', 'various']
|
['can ']
|
['c']
| 1
| 2
| 0
|
--- diff --git a/drivers/net/can/dev/skb.c b/drivers/net/can/dev/skb.c --- a/drivers/net/can/dev/skb.c +++ b/drivers/net/can/dev/skb.c + skb_tx_timestamp(skb); +
|
Networking
|
741b91f1b0ea34f00f6a7d4539b767c409291fcf
|
vincent mailhol
|
drivers
|
net
|
can, dev
|
can: kvaser_usb: add support for usbcan pro 4xhs
|
add support for kvaser usbcan pro 4xhs.
|
this release allows to map an uid to a different one in a mount; it also adds support for selecting the preemption model at runtime; support for a low-overhead memory error detector designed to be used in production; support for the acrn hypervisor designed for embedded systems; btrfs initial support for zoned devices, subpage blocks sizes and performance improvements; support for eager nfs writes; support for a thermal power management to control the surface temperature of embedded devices in an unified way; the napi polling can be moved to a kernel thread; and support for non-blocking path lookups. as always, there are many other features, new drivers, improvements and fixes.
|
add support for usbcan pro 4xhs
|
['core (various)', 'file systems', 'memory management', 'block layer', 'tracing, perf and bpf', 'virtualization', 'cryptography', 'security', 'networking', 'architectures x86 arm risc-v powerpc mips csky s390 pa-risc c6x']
|
['graphics', 'power management', 'storage', 'drivers in the staging area', 'networking', 'audio', 'tablets, touch screens, keyboards, mouses', 'tv tuners, webcams, video capturers', 'universal serial bus', 'serial peripheral interface (spi)', 'watchdog', 'serial', 'cpu frequency scaling', 'device voltage and frequency scaling', 'voltage, current regulators, power capping, power supply', 'real time clock (rtc)', 'pin controllers (pinctrl)', 'multi media card (mmc)', 'memory technology devices (mtd)', 'industrial i/o (iio)', 'multi function devices (mfd)', 'pulse-width modulation (pwm)', 'inter-integrated circuit (i2c + i3c)', 'hardware monitoring (hwmon)', 'general purpose i/o (gpio)', 'leds', 'dma engines', 'cryptography hardware acceleration', 'pci', 'non-transparent bridge (ntb)', 'thunderbolt', 'clock', 'phy ("physical layer" framework)', 'cxl (compute express link)', 'various']
|
['can ', 'kvaser_usb']
|
['kconfig', 'c']
| 2
| 4
| 1
|
--- diff --git a/drivers/net/can/usb/kconfig b/drivers/net/can/usb/kconfig --- a/drivers/net/can/usb/kconfig +++ b/drivers/net/can/usb/kconfig - kvaser memorator pro 5xhs - kvaser usbcan light 4xhs - kvaser usbcan pro 2xhs v2 + - kvaser usbcan pro 4xhs - kvaser usbcan pro 5xhs - kvaser u100 - kvaser u100p diff --git a/drivers/net/can/usb/kvaser_usb/kvaser_usb_core.c b/drivers/net/can/usb/kvaser_usb/kvaser_usb_core.c --- a/drivers/net/can/usb/kvaser_usb/kvaser_usb_core.c +++ b/drivers/net/can/usb/kvaser_usb/kvaser_usb_core.c +#define usb_usbcan_pro_4hs_product_id 276 - usb_u100s_product_id + usb_usbcan_pro_4hs_product_id + { usb_device(kvaser_vendor_id, usb_usbcan_pro_4hs_product_id) },
|
Networking
|
7507479c46b120c37ef83e59be7683a526e98e1a
|
jimmy assarsson
|
drivers
|
net
|
can, kvaser_usb, usb
|
can: mcp251xfd: add bql support
|
this patch adds bql support to the driver. support for netdev_xmit_more() will be added in a separate patch series.
|
this release allows to map an uid to a different one in a mount; it also adds support for selecting the preemption model at runtime; support for a low-overhead memory error detector designed to be used in production; support for the acrn hypervisor designed for embedded systems; btrfs initial support for zoned devices, subpage blocks sizes and performance improvements; support for eager nfs writes; support for a thermal power management to control the surface temperature of embedded devices in an unified way; the napi polling can be moved to a kernel thread; and support for non-blocking path lookups. as always, there are many other features, new drivers, improvements and fixes.
|
add bql support
|
['core (various)', 'file systems', 'memory management', 'block layer', 'tracing, perf and bpf', 'virtualization', 'cryptography', 'security', 'networking', 'architectures x86 arm risc-v powerpc mips csky s390 pa-risc c6x']
|
['graphics', 'power management', 'storage', 'drivers in the staging area', 'networking', 'audio', 'tablets, touch screens, keyboards, mouses', 'tv tuners, webcams, video capturers', 'universal serial bus', 'serial peripheral interface (spi)', 'watchdog', 'serial', 'cpu frequency scaling', 'device voltage and frequency scaling', 'voltage, current regulators, power capping, power supply', 'real time clock (rtc)', 'pin controllers (pinctrl)', 'multi media card (mmc)', 'memory technology devices (mtd)', 'industrial i/o (iio)', 'multi function devices (mfd)', 'pulse-width modulation (pwm)', 'inter-integrated circuit (i2c + i3c)', 'hardware monitoring (hwmon)', 'general purpose i/o (gpio)', 'leds', 'dma engines', 'cryptography hardware acceleration', 'pci', 'non-transparent bridge (ntb)', 'thunderbolt', 'clock', 'phy ("physical layer" framework)', 'cxl (compute express link)', 'various']
|
['can ', 'mcp251xfd']
|
['c']
| 1
| 17
| 4
|
--- diff --git a/drivers/net/can/spi/mcp251xfd/mcp251xfd-core.c b/drivers/net/can/spi/mcp251xfd/mcp251xfd-core.c --- a/drivers/net/can/spi/mcp251xfd/mcp251xfd-core.c +++ b/drivers/net/can/spi/mcp251xfd/mcp251xfd-core.c + netdev_reset_queue(priv->ndev); + - const struct mcp251xfd_hw_tef_obj *hw_tef_obj) + const struct mcp251xfd_hw_tef_obj *hw_tef_obj, + unsigned int *frame_len_ptr) - hw_tef_obj->ts, null); + hw_tef_obj->ts, + frame_len_ptr); + unsigned int total_frame_len = 0; - err = mcp251xfd_handle_tefif_one(priv, &hw_tef_obj[i]); + unsigned int frame_len; + + err = mcp251xfd_handle_tefif_one(priv, &hw_tef_obj[i], &frame_len); + + total_frame_len += frame_len; + netdev_completed_queue(priv->ndev, len, total_frame_len); + unsigned int frame_len; - can_put_echo_skb(skb, ndev, tx_head, 0); + frame_len = can_skb_get_frame_len(skb); + can_put_echo_skb(skb, ndev, tx_head, frame_len); + netdev_sent_queue(priv->ndev, frame_len);
|
Networking
|
4162e18e949ba520d5116ac0323500355479a00e
|
marc kleine budde
|
drivers
|
net
|
can, mcp251xfd, spi
|
can: mcp251xfd: add len8_dlc support
|
this patch adds support for the classical can raw dlc functionality to send and receive dlc values from 9 ... 15 to the mcp251xfd driver.
|
this release allows to map an uid to a different one in a mount; it also adds support for selecting the preemption model at runtime; support for a low-overhead memory error detector designed to be used in production; support for the acrn hypervisor designed for embedded systems; btrfs initial support for zoned devices, subpage blocks sizes and performance improvements; support for eager nfs writes; support for a thermal power management to control the surface temperature of embedded devices in an unified way; the napi polling can be moved to a kernel thread; and support for non-blocking path lookups. as always, there are many other features, new drivers, improvements and fixes.
|
add len8_dlc support
|
['core (various)', 'file systems', 'memory management', 'block layer', 'tracing, perf and bpf', 'virtualization', 'cryptography', 'security', 'networking', 'architectures x86 arm risc-v powerpc mips csky s390 pa-risc c6x']
|
['graphics', 'power management', 'storage', 'drivers in the staging area', 'networking', 'audio', 'tablets, touch screens, keyboards, mouses', 'tv tuners, webcams, video capturers', 'universal serial bus', 'serial peripheral interface (spi)', 'watchdog', 'serial', 'cpu frequency scaling', 'device voltage and frequency scaling', 'voltage, current regulators, power capping, power supply', 'real time clock (rtc)', 'pin controllers (pinctrl)', 'multi media card (mmc)', 'memory technology devices (mtd)', 'industrial i/o (iio)', 'multi function devices (mfd)', 'pulse-width modulation (pwm)', 'inter-integrated circuit (i2c + i3c)', 'hardware monitoring (hwmon)', 'general purpose i/o (gpio)', 'leds', 'dma engines', 'cryptography hardware acceleration', 'pci', 'non-transparent bridge (ntb)', 'thunderbolt', 'clock', 'phy ("physical layer" framework)', 'cxl (compute express link)', 'various']
|
['can ', 'mcp251xfd']
|
['c']
| 1
| 15
| 8
|
--- diff --git a/drivers/net/can/spi/mcp251xfd/mcp251xfd-core.c b/drivers/net/can/spi/mcp251xfd/mcp251xfd-core.c --- a/drivers/net/can/spi/mcp251xfd/mcp251xfd-core.c +++ b/drivers/net/can/spi/mcp251xfd/mcp251xfd-core.c + u8 dlc; + dlc = field_get(mcp251xfd_obj_flags_dlc, hw_rx_obj->flags); + - u8 dlc; - dlc = field_get(mcp251xfd_obj_flags_dlc, hw_rx_obj->flags); - cfd->len = can_cc_dlc2len(field_get(mcp251xfd_obj_flags_dlc, - hw_rx_obj->flags)); + can_frame_set_cc_len((struct can_frame *)cfd, dlc, + priv->can.ctrlmode); - dlc = can_fd_len2dlc(cfd->len); - flags |= field_prep(mcp251xfd_obj_flags_seq_mcp2518fd_mask, seq) | - field_prep(mcp251xfd_obj_flags_dlc, dlc); + flags |= field_prep(mcp251xfd_obj_flags_seq_mcp2518fd_mask, seq); + + dlc = can_fd_len2dlc(cfd->len); + } else { + dlc = can_get_cc_dlc((struct can_frame *)cfd, + priv->can.ctrlmode); + flags |= field_prep(mcp251xfd_obj_flags_dlc, dlc); + - can_ctrlmode_fd | can_ctrlmode_fd_non_iso; + can_ctrlmode_fd | can_ctrlmode_fd_non_iso | + can_ctrlmode_cc_len8_dlc;
|
Networking
|
86f1e3b1dd9f08408b12405059e2ab3cf9690066
|
marc kleine budde
|
drivers
|
net
|
can, mcp251xfd, spi
|
can: tcan4x5x: add support for half-duplex controllers
|
this patch adds back support for half-duplex controllers, which was removed in the last patch.
|
this release allows to map an uid to a different one in a mount; it also adds support for selecting the preemption model at runtime; support for a low-overhead memory error detector designed to be used in production; support for the acrn hypervisor designed for embedded systems; btrfs initial support for zoned devices, subpage blocks sizes and performance improvements; support for eager nfs writes; support for a thermal power management to control the surface temperature of embedded devices in an unified way; the napi polling can be moved to a kernel thread; and support for non-blocking path lookups. as always, there are many other features, new drivers, improvements and fixes.
|
add support for half-duplex controllers
|
['core (various)', 'file systems', 'memory management', 'block layer', 'tracing, perf and bpf', 'virtualization', 'cryptography', 'security', 'networking', 'architectures x86 arm risc-v powerpc mips csky s390 pa-risc c6x']
|
['graphics', 'power management', 'storage', 'drivers in the staging area', 'networking', 'audio', 'tablets, touch screens, keyboards, mouses', 'tv tuners, webcams, video capturers', 'universal serial bus', 'serial peripheral interface (spi)', 'watchdog', 'serial', 'cpu frequency scaling', 'device voltage and frequency scaling', 'voltage, current regulators, power capping, power supply', 'real time clock (rtc)', 'pin controllers (pinctrl)', 'multi media card (mmc)', 'memory technology devices (mtd)', 'industrial i/o (iio)', 'multi function devices (mfd)', 'pulse-width modulation (pwm)', 'inter-integrated circuit (i2c + i3c)', 'hardware monitoring (hwmon)', 'general purpose i/o (gpio)', 'leds', 'dma engines', 'cryptography hardware acceleration', 'pci', 'non-transparent bridge (ntb)', 'thunderbolt', 'clock', 'phy ("physical layer" framework)', 'cxl (compute express link)', 'various']
|
['can ', 'tcan4x5x']
|
['c']
| 1
| 15
| 6
|
--- diff --git a/drivers/net/can/m_can/tcan4x5x-regmap.c b/drivers/net/can/m_can/tcan4x5x-regmap.c --- a/drivers/net/can/m_can/tcan4x5x-regmap.c +++ b/drivers/net/can/m_can/tcan4x5x-regmap.c - struct spi_transfer xfer[] = { + struct spi_transfer xfer[2] = { - xfer[0].rx_buf = buf_rx; - xfer[0].len = sizeof(buf_tx->cmd) + val_len; + if (spi->controller->flags & spi_controller_half_duplex) { + xfer[0].len = sizeof(buf_tx->cmd); + + xfer[1].rx_buf = val_buf; + xfer[1].len = val_len; + spi_message_add_tail(&xfer[1], &msg); + } else { + xfer[0].rx_buf = buf_rx; + xfer[0].len = sizeof(buf_tx->cmd) + val_len; - if (tcan4x5x_sanitize_spi) - memset(buf_tx->data, 0x0, val_len); + if (tcan4x5x_sanitize_spi) + memset(buf_tx->data, 0x0, val_len); + } - memcpy(val_buf, buf_rx->data, val_len); + if (!(spi->controller->flags & spi_controller_half_duplex)) + memcpy(val_buf, buf_rx->data, val_len);
|
Networking
|
0460ecaeba90f418f29f9ea57d994429c8f88a4e
|
marc kleine budde dan murphy dmurphy ti com sean nyekjaer sean geanix com
|
drivers
|
net
|
can, m_can
|
dpaa2-eth: add support for rx vlan filtering
|
declare rx vlan filtering as supported and user-changeable only when there are vlan filtering entries available on the dpni object. even then, rx-vlan-filtering is by default disabled. also, populate the .ndo_vlan_rx_add_vid() and .ndo_vlan_rx_kill_vid() callbacks for adding and removing a specific vlan from the vlan table.
|
this release allows to map an uid to a different one in a mount; it also adds support for selecting the preemption model at runtime; support for a low-overhead memory error detector designed to be used in production; support for the acrn hypervisor designed for embedded systems; btrfs initial support for zoned devices, subpage blocks sizes and performance improvements; support for eager nfs writes; support for a thermal power management to control the surface temperature of embedded devices in an unified way; the napi polling can be moved to a kernel thread; and support for non-blocking path lookups. as always, there are many other features, new drivers, improvements and fixes.
|
add support for rx vlan filtering
|
['core (various)', 'file systems', 'memory management', 'block layer', 'tracing, perf and bpf', 'virtualization', 'cryptography', 'security', 'networking', 'architectures x86 arm risc-v powerpc mips csky s390 pa-risc c6x']
|
['graphics', 'power management', 'storage', 'drivers in the staging area', 'networking', 'audio', 'tablets, touch screens, keyboards, mouses', 'tv tuners, webcams, video capturers', 'universal serial bus', 'serial peripheral interface (spi)', 'watchdog', 'serial', 'cpu frequency scaling', 'device voltage and frequency scaling', 'voltage, current regulators, power capping, power supply', 'real time clock (rtc)', 'pin controllers (pinctrl)', 'multi media card (mmc)', 'memory technology devices (mtd)', 'industrial i/o (iio)', 'multi function devices (mfd)', 'pulse-width modulation (pwm)', 'inter-integrated circuit (i2c + i3c)', 'hardware monitoring (hwmon)', 'general purpose i/o (gpio)', 'leds', 'dma engines', 'cryptography hardware acceleration', 'pci', 'non-transparent bridge (ntb)', 'thunderbolt', 'clock', 'phy ("physical layer" framework)', 'cxl (compute express link)', 'various']
|
['dpaa2-eth ']
|
['h', 'c']
| 4
| 184
| 0
|
--- diff --git a/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c b/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c --- a/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c +++ b/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c +static int dpaa2_eth_set_rx_vlan_filtering(struct dpaa2_eth_priv *priv, + bool enable) +{ + int err; + + err = dpni_enable_vlan_filter(priv->mc_io, 0, priv->mc_token, enable); + + if (err) { + netdev_err(priv->net_dev, + "dpni_enable_vlan_filter failed "); + return err; + } + + return 0; +} + +static int dpaa2_eth_rx_add_vid(struct net_device *net_dev, + __be16 vlan_proto, u16 vid) +{ + struct dpaa2_eth_priv *priv = netdev_priv(net_dev); + int err; + + err = dpni_add_vlan_id(priv->mc_io, 0, priv->mc_token, + vid, 0, 0, 0); + + if (err) { + netdev_warn(priv->net_dev, + "could not add the vlan id %u ", + vid); + return err; + } + + return 0; +} + +static int dpaa2_eth_rx_kill_vid(struct net_device *net_dev, + __be16 vlan_proto, u16 vid) +{ + struct dpaa2_eth_priv *priv = netdev_priv(net_dev); + int err; + + err = dpni_remove_vlan_id(priv->mc_io, 0, priv->mc_token, vid); + + if (err) { + netdev_warn(priv->net_dev, + "could not remove the vlan id %u ", + vid); + return err; + } + + return 0; +} + + if (changed & netif_f_hw_vlan_ctag_filter) { + enable = !!(features & netif_f_hw_vlan_ctag_filter); + err = dpaa2_eth_set_rx_vlan_filtering(priv, enable); + if (err) + return err; + } + + .ndo_vlan_rx_add_vid = dpaa2_eth_rx_add_vid, + .ndo_vlan_rx_kill_vid = dpaa2_eth_rx_kill_vid + if (priv->dpni_attrs.vlan_filter_entries) + net_dev->hw_features |= netif_f_hw_vlan_ctag_filter; + diff --git a/drivers/net/ethernet/freescale/dpaa2/dpni-cmd.h b/drivers/net/ethernet/freescale/dpaa2/dpni-cmd.h --- a/drivers/net/ethernet/freescale/dpaa2/dpni-cmd.h +++ b/drivers/net/ethernet/freescale/dpaa2/dpni-cmd.h +#define dpni_cmdid_enable_vlan_filter dpni_cmd(0x230) +#define dpni_cmdid_add_vlan_id dpni_cmd_v2(0x231) +#define dpni_cmdid_remove_vlan_id dpni_cmd(0x232) + +struct dpni_cmd_enable_vlan_filter { + /* only the lsb */ + u8 en; +}; + +struct dpni_cmd_vlan_id { + u8 flags; + u8 tc_id; + u8 flow_id; + u8 pad; + __le16 vlan_id; +}; + diff --git a/drivers/net/ethernet/freescale/dpaa2/dpni.c b/drivers/net/ethernet/freescale/dpaa2/dpni.c --- a/drivers/net/ethernet/freescale/dpaa2/dpni.c +++ b/drivers/net/ethernet/freescale/dpaa2/dpni.c +/** + * dpni_enable_vlan_filter() - enable/disable vlan filtering mode + * @mc_io: pointer to mc portal's i/o object + * @cmd_flags: command flags; one or more of 'mc_cmd_flag_' + * @token: token of dpni object + * @en: set to '1' to enable; '0' to disable + * + * return: '0' on success; error code otherwise. + */ +int dpni_enable_vlan_filter(struct fsl_mc_io *mc_io, + u32 cmd_flags, + u16 token, + u32 en) +{ + struct dpni_cmd_enable_vlan_filter *cmd_params; + struct fsl_mc_command cmd = { 0 }; + + /* prepare command */ + cmd.header = mc_encode_cmd_header(dpni_cmdid_enable_vlan_filter, + cmd_flags, + token); + cmd_params = (struct dpni_cmd_enable_vlan_filter *)cmd.params; + dpni_set_field(cmd_params->en, enable, en); + + /* send command to mc*/ + return mc_send_command(mc_io, &cmd); +} + +/** + * dpni_add_vlan_id() - add vlan id filter + * @mc_io: pointer to mc portal's i/o object + * @cmd_flags: command flags; one or more of 'mc_cmd_flag_' + * @token: token of dpni object + * @vlan_id: vlan id to add + * @flags: 0 - tc_id and flow_id will be ignored. + * pkt with this vlan_id will be passed to the next + * classification stages + * dpni_vlan_set_queue_action + * pkt with this vlan_id will be forward directly to + * queue defined by the tc_id and flow_id + * + * @tc_id: traffic class selection (0-7) + * @flow_id: selects the specific queue out of the set allocated for the + * same as tc_id. value must be in range 0 to num_queues - 1 + * + * return: '0' on success; error code otherwise. + */ +int dpni_add_vlan_id(struct fsl_mc_io *mc_io, u32 cmd_flags, u16 token, + u16 vlan_id, u8 flags, u8 tc_id, u8 flow_id) +{ + struct dpni_cmd_vlan_id *cmd_params; + struct fsl_mc_command cmd = { 0 }; + + /* prepare command */ + cmd.header = mc_encode_cmd_header(dpni_cmdid_add_vlan_id, + cmd_flags, + token); + cmd_params = (struct dpni_cmd_vlan_id *)cmd.params; + cmd_params->flags = flags; + cmd_params->tc_id = tc_id; + cmd_params->flow_id = flow_id; + cmd_params->vlan_id = cpu_to_le16(vlan_id); + + /* send command to mc*/ + return mc_send_command(mc_io, &cmd); +} + +/** + * dpni_remove_vlan_id() - remove vlan id filter + * @mc_io: pointer to mc portal's i/o object + * @cmd_flags: command flags; one or more of 'mc_cmd_flag_' + * @token: token of dpni object + * @vlan_id: vlan id to remove + * + * return: '0' on success; error code otherwise. + */ +int dpni_remove_vlan_id(struct fsl_mc_io *mc_io, u32 cmd_flags, u16 token, + u16 vlan_id) +{ + struct dpni_cmd_vlan_id *cmd_params; + struct fsl_mc_command cmd = { 0 }; + + /* prepare command */ + cmd.header = mc_encode_cmd_header(dpni_cmdid_remove_vlan_id, + cmd_flags, + token); + cmd_params = (struct dpni_cmd_vlan_id *)cmd.params; + cmd_params->vlan_id = cpu_to_le16(vlan_id); + + /* send command to mc*/ + return mc_send_command(mc_io, &cmd); +} + diff --git a/drivers/net/ethernet/freescale/dpaa2/dpni.h b/drivers/net/ethernet/freescale/dpaa2/dpni.h --- a/drivers/net/ethernet/freescale/dpaa2/dpni.h +++ b/drivers/net/ethernet/freescale/dpaa2/dpni.h +int dpni_enable_vlan_filter(struct fsl_mc_io *mc_io, u32 cmd_flags, u16 token, + u32 en); + +int dpni_add_vlan_id(struct fsl_mc_io *mc_io, u32 cmd_flags, u16 token, + u16 vlan_id, u8 flags, u8 tc_id, u8 flow_id); + +int dpni_remove_vlan_id(struct fsl_mc_io *mc_io, u32 cmd_flags, u16 token, + u16 vlan_id); +
|
Networking
|
70b32d8276feef23b9b2c50c1128a7d6252e2b47
|
ionut robert aron
|
drivers
|
net
|
dpaa2, ethernet, freescale
|
net: dpaa2-mac: add 1000base-x support
|
now that pcs-lynx supports 1000base-x, add support for this interface mode to dpaa2-mac. pcs-lynx can be switched at runtime between sgmii and 1000base-x mode, so allow dpaa2-mac to switch between these as well.
|
this release allows to map an uid to a different one in a mount; it also adds support for selecting the preemption model at runtime; support for a low-overhead memory error detector designed to be used in production; support for the acrn hypervisor designed for embedded systems; btrfs initial support for zoned devices, subpage blocks sizes and performance improvements; support for eager nfs writes; support for a thermal power management to control the surface temperature of embedded devices in an unified way; the napi polling can be moved to a kernel thread; and support for non-blocking path lookups. as always, there are many other features, new drivers, improvements and fixes.
|
add 1000base-x support
|
['core (various)', 'file systems', 'memory management', 'block layer', 'tracing, perf and bpf', 'virtualization', 'cryptography', 'security', 'networking', 'architectures x86 arm risc-v powerpc mips csky s390 pa-risc c6x']
|
['graphics', 'power management', 'storage', 'drivers in the staging area', 'networking', 'audio', 'tablets, touch screens, keyboards, mouses', 'tv tuners, webcams, video capturers', 'universal serial bus', 'serial peripheral interface (spi)', 'watchdog', 'serial', 'cpu frequency scaling', 'device voltage and frequency scaling', 'voltage, current regulators, power capping, power supply', 'real time clock (rtc)', 'pin controllers (pinctrl)', 'multi media card (mmc)', 'memory technology devices (mtd)', 'industrial i/o (iio)', 'multi function devices (mfd)', 'pulse-width modulation (pwm)', 'inter-integrated circuit (i2c + i3c)', 'hardware monitoring (hwmon)', 'general purpose i/o (gpio)', 'leds', 'dma engines', 'cryptography hardware acceleration', 'pci', 'non-transparent bridge (ntb)', 'thunderbolt', 'clock', 'phy ("physical layer" framework)', 'cxl (compute express link)', 'various']
|
['dpaa2-eth ']
|
['c']
| 1
| 17
| 3
|
--- diff --git a/drivers/net/ethernet/freescale/dpaa2/dpaa2-mac.c b/drivers/net/ethernet/freescale/dpaa2/dpaa2-mac.c --- a/drivers/net/ethernet/freescale/dpaa2/dpaa2-mac.c +++ b/drivers/net/ethernet/freescale/dpaa2/dpaa2-mac.c + /* we can switch between sgmii and 1000base-x at runtime with + * pcs-lynx + */ + case phy_interface_mode_sgmii: + case phy_interface_mode_1000basex: + if (mac->pcs && + (mac->if_mode == phy_interface_mode_sgmii || + mac->if_mode == phy_interface_mode_1000basex)) + return false; + return interface != mac->if_mode; + - case phy_interface_mode_sgmii: + case phy_interface_mode_1000basex: - phylink_set(mask, 10baset_full); - phylink_set(mask, 100baset_full); + phylink_set(mask, 1000basex_full); + if (state->interface == phy_interface_mode_1000basex) + break; + phylink_set(mask, 100baset_full); + phylink_set(mask, 10baset_full);
|
Networking
|
46c518c8145bb23702d5b860c1bcdc7c51bdc3d4
|
russell king
|
drivers
|
net
|
dpaa2, ethernet, freescale
|
net: dpaa2-mac: add backplane link mode support
|
add support for backplane link mode, which is, according to discussions with nxp earlier in the year, is a mode where the os (linux) is able to manage the pcs and serdes itself.
|
this release allows to map an uid to a different one in a mount; it also adds support for selecting the preemption model at runtime; support for a low-overhead memory error detector designed to be used in production; support for the acrn hypervisor designed for embedded systems; btrfs initial support for zoned devices, subpage blocks sizes and performance improvements; support for eager nfs writes; support for a thermal power management to control the surface temperature of embedded devices in an unified way; the napi polling can be moved to a kernel thread; and support for non-blocking path lookups. as always, there are many other features, new drivers, improvements and fixes.
|
add backplane link mode support
|
['core (various)', 'file systems', 'memory management', 'block layer', 'tracing, perf and bpf', 'virtualization', 'cryptography', 'security', 'networking', 'architectures x86 arm risc-v powerpc mips csky s390 pa-risc c6x']
|
['graphics', 'power management', 'storage', 'drivers in the staging area', 'networking', 'audio', 'tablets, touch screens, keyboards, mouses', 'tv tuners, webcams, video capturers', 'universal serial bus', 'serial peripheral interface (spi)', 'watchdog', 'serial', 'cpu frequency scaling', 'device voltage and frequency scaling', 'voltage, current regulators, power capping, power supply', 'real time clock (rtc)', 'pin controllers (pinctrl)', 'multi media card (mmc)', 'memory technology devices (mtd)', 'industrial i/o (iio)', 'multi function devices (mfd)', 'pulse-width modulation (pwm)', 'inter-integrated circuit (i2c + i3c)', 'hardware monitoring (hwmon)', 'general purpose i/o (gpio)', 'leds', 'dma engines', 'cryptography hardware acceleration', 'pci', 'non-transparent bridge (ntb)', 'thunderbolt', 'clock', 'phy ("physical layer" framework)', 'cxl (compute express link)', 'various']
|
['dpaa2-eth ']
|
['h', 'c']
| 2
| 6
| 3
|
--- diff --git a/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.h b/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.h --- a/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.h +++ b/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.h - if (priv->mac && priv->mac->attr.link_type == dpmac_link_type_phy) + if (priv->mac && + (priv->mac->attr.link_type == dpmac_link_type_phy || + priv->mac->attr.link_type == dpmac_link_type_backplane)) diff --git a/drivers/net/ethernet/freescale/dpaa2/dpaa2-mac.c b/drivers/net/ethernet/freescale/dpaa2/dpaa2-mac.c --- a/drivers/net/ethernet/freescale/dpaa2/dpaa2-mac.c +++ b/drivers/net/ethernet/freescale/dpaa2/dpaa2-mac.c - if (mac->attr.link_type == dpmac_link_type_phy && - mac->attr.eth_if != dpmac_eth_if_rgmii) { + if ((mac->attr.link_type == dpmac_link_type_phy && + mac->attr.eth_if != dpmac_eth_if_rgmii) || + mac->attr.link_type == dpmac_link_type_backplane) {
|
Networking
|
085f1776fa03bc771876aabf086de11f3e2ce59c
|
russell king
|
drivers
|
net
|
dpaa2, ethernet, freescale
|
net: dsa: add arrow speedchips xrs700x driver
|
add a driver with initial support for the arrow speedchips xrs7000 series of gigabit ethernet switch chips which are typically used in critical networking applications.
|
this release allows to map an uid to a different one in a mount; it also adds support for selecting the preemption model at runtime; support for a low-overhead memory error detector designed to be used in production; support for the acrn hypervisor designed for embedded systems; btrfs initial support for zoned devices, subpage blocks sizes and performance improvements; support for eager nfs writes; support for a thermal power management to control the surface temperature of embedded devices in an unified way; the napi polling can be moved to a kernel thread; and support for non-blocking path lookups. as always, there are many other features, new drivers, improvements and fixes.
|
add arrow speedchips xrs700x driver
|
['core (various)', 'file systems', 'memory management', 'block layer', 'tracing, perf and bpf', 'virtualization', 'cryptography', 'security', 'networking', 'architectures x86 arm risc-v powerpc mips csky s390 pa-risc c6x']
|
['graphics', 'power management', 'storage', 'drivers in the staging area', 'networking', 'audio', 'tablets, touch screens, keyboards, mouses', 'tv tuners, webcams, video capturers', 'universal serial bus', 'serial peripheral interface (spi)', 'watchdog', 'serial', 'cpu frequency scaling', 'device voltage and frequency scaling', 'voltage, current regulators, power capping, power supply', 'real time clock (rtc)', 'pin controllers (pinctrl)', 'multi media card (mmc)', 'memory technology devices (mtd)', 'industrial i/o (iio)', 'multi function devices (mfd)', 'pulse-width modulation (pwm)', 'inter-integrated circuit (i2c + i3c)', 'hardware monitoring (hwmon)', 'general purpose i/o (gpio)', 'leds', 'dma engines', 'cryptography hardware acceleration', 'pci', 'non-transparent bridge (ntb)', 'thunderbolt', 'clock', 'phy ("physical layer" framework)', 'cxl (compute express link)', 'various']
|
['dsa ']
|
['h', 'kconfig', 'c', 'makefile']
| 9
| 1,213
| 0
|
--- diff --git a/drivers/net/dsa/kconfig b/drivers/net/dsa/kconfig --- a/drivers/net/dsa/kconfig +++ b/drivers/net/dsa/kconfig +source "drivers/net/dsa/xrs700x/kconfig" + diff --git a/drivers/net/dsa/makefile b/drivers/net/dsa/makefile --- a/drivers/net/dsa/makefile +++ b/drivers/net/dsa/makefile +obj-y += xrs700x/ diff --git a/drivers/net/dsa/xrs700x/kconfig b/drivers/net/dsa/xrs700x/kconfig --- /dev/null +++ b/drivers/net/dsa/xrs700x/kconfig +# spdx-license-identifier: gpl-2.0-only +config net_dsa_xrs700x + tristate + depends on net_dsa + select net_dsa_tag_xrs700x + select regmap + help + this enables support for arrow speedchips xrs7003/7004 gigabit + ethernet switches. + +config net_dsa_xrs700x_i2c + tristate "arrow xrs7000x series switch in i2c mode" + depends on net_dsa && i2c + select net_dsa_xrs700x + select regmap_i2c + help + enable i2c support for arrow speedchips xrs7003/7004 gigabit ethernet + switches. + +config net_dsa_xrs700x_mdio + tristate "arrow xrs7000x series switch in mdio mode" + depends on net_dsa + select net_dsa_xrs700x + help + enable mdio support for arrow speedchips xrs7003/7004 gigabit ethernet + switches. diff --git a/drivers/net/dsa/xrs700x/makefile b/drivers/net/dsa/xrs700x/makefile --- /dev/null +++ b/drivers/net/dsa/xrs700x/makefile +# spdx-license-identifier: gpl-2.0-only +obj-$(config_net_dsa_xrs700x) += xrs700x.o +obj-$(config_net_dsa_xrs700x_i2c) += xrs700x_i2c.o +obj-$(config_net_dsa_xrs700x_mdio) += xrs700x_mdio.o diff --git a/drivers/net/dsa/xrs700x/xrs700x.c b/drivers/net/dsa/xrs700x/xrs700x.c --- /dev/null +++ b/drivers/net/dsa/xrs700x/xrs700x.c +// spdx-license-identifier: gpl-2.0 +/* + * copyright (c) 2020 novatech llc + * george mccollister <george.mccollister@gmail.com> + */ + +#include <net/dsa.h> +#include <linux/if_bridge.h> +#include <linux/of_device.h> +#include "xrs700x.h" +#include "xrs700x_reg.h" + +#define xrs700x_mib_interval msecs_to_jiffies(3000) + +#define xrs7003e_id 0x100 +#define xrs7003f_id 0x101 +#define xrs7004e_id 0x200 +#define xrs7004f_id 0x201 + +const struct xrs700x_info xrs7003e_info = {xrs7003e_id, "xrs7003e", 3}; +export_symbol(xrs7003e_info); + +const struct xrs700x_info xrs7003f_info = {xrs7003f_id, "xrs7003f", 3}; +export_symbol(xrs7003f_info); + +const struct xrs700x_info xrs7004e_info = {xrs7004e_id, "xrs7004e", 4}; +export_symbol(xrs7004e_info); + +const struct xrs700x_info xrs7004f_info = {xrs7004f_id, "xrs7004f", 4}; +export_symbol(xrs7004f_info); + +struct xrs700x_regfield { + struct reg_field rf; + struct regmap_field **rmf; +}; + +struct xrs700x_mib { + unsigned int offset; + const char *name; + int stats64_offset; +}; + +#define xrs700x_mib_ethtool_only(o, n) {o, n, -1} +#define xrs700x_mib(o, n, m) {o, n, offsetof(struct rtnl_link_stats64, m)} + +static const struct xrs700x_mib xrs700x_mibs[] = { + xrs700x_mib(xrs_rx_good_octets_l, "rx_good_octets", rx_bytes), + xrs700x_mib_ethtool_only(xrs_rx_bad_octets_l, "rx_bad_octets"), + xrs700x_mib(xrs_rx_unicast_l, "rx_unicast", rx_packets), + xrs700x_mib(xrs_rx_broadcast_l, "rx_broadcast", rx_packets), + xrs700x_mib(xrs_rx_multicast_l, "rx_multicast", multicast), + xrs700x_mib(xrs_rx_undersize_l, "rx_undersize", rx_length_errors), + xrs700x_mib(xrs_rx_fragments_l, "rx_fragments", rx_length_errors), + xrs700x_mib(xrs_rx_oversize_l, "rx_oversize", rx_length_errors), + xrs700x_mib(xrs_rx_jabber_l, "rx_jabber", rx_length_errors), + xrs700x_mib(xrs_rx_err_l, "rx_err", rx_errors), + xrs700x_mib(xrs_rx_crc_l, "rx_crc", rx_crc_errors), + xrs700x_mib_ethtool_only(xrs_rx_64_l, "rx_64"), + xrs700x_mib_ethtool_only(xrs_rx_65_127_l, "rx_65_127"), + xrs700x_mib_ethtool_only(xrs_rx_128_255_l, "rx_128_255"), + xrs700x_mib_ethtool_only(xrs_rx_256_511_l, "rx_256_511"), + xrs700x_mib_ethtool_only(xrs_rx_512_1023_l, "rx_512_1023"), + xrs700x_mib_ethtool_only(xrs_rx_1024_1536_l, "rx_1024_1536"), + xrs700x_mib_ethtool_only(xrs_rx_hsr_prp_l, "rx_hsr_prp"), + xrs700x_mib_ethtool_only(xrs_rx_wronglan_l, "rx_wronglan"), + xrs700x_mib_ethtool_only(xrs_rx_duplicate_l, "rx_duplicate"), + xrs700x_mib(xrs_tx_octets_l, "tx_octets", tx_bytes), + xrs700x_mib(xrs_tx_unicast_l, "tx_unicast", tx_packets), + xrs700x_mib(xrs_tx_broadcast_l, "tx_broadcast", tx_packets), + xrs700x_mib(xrs_tx_multicast_l, "tx_multicast", tx_packets), + xrs700x_mib_ethtool_only(xrs_tx_hsr_prp_l, "tx_hsr_prp"), + xrs700x_mib(xrs_priq_drop_l, "priq_drop", tx_dropped), + xrs700x_mib(xrs_early_drop_l, "early_drop", tx_dropped), +}; + +static void xrs700x_get_strings(struct dsa_switch *ds, int port, + u32 stringset, u8 *data) +{ + int i; + + if (stringset != eth_ss_stats) + return; + + for (i = 0; i < array_size(xrs700x_mibs); i++) { + strscpy(data, xrs700x_mibs[i].name, eth_gstring_len); + data += eth_gstring_len; + } +} + +static int xrs700x_get_sset_count(struct dsa_switch *ds, int port, int sset) +{ + if (sset != eth_ss_stats) + return -eopnotsupp; + + return array_size(xrs700x_mibs); +} + +static void xrs700x_read_port_counters(struct xrs700x *priv, int port) +{ + struct xrs700x_port *p = &priv->ports[port]; + struct rtnl_link_stats64 stats; + int i; + + memset(&stats, 0, sizeof(stats)); + + mutex_lock(&p->mib_mutex); + + /* capture counter values */ + regmap_write(priv->regmap, xrs_cnt_ctrl(port), 1); + + for (i = 0; i < array_size(xrs700x_mibs); i++) { + unsigned int high = 0, low = 0, reg; + + reg = xrs700x_mibs[i].offset + xrs_port_offset * port; + regmap_read(priv->regmap, reg, &low); + regmap_read(priv->regmap, reg + 2, &high); + + p->mib_data[i] += (high << 16) | low; + + if (xrs700x_mibs[i].stats64_offset >= 0) { + u8 *s = (u8 *)&stats + xrs700x_mibs[i].stats64_offset; + *(u64 *)s += p->mib_data[i]; + } + } + + /* multicast must be added to rx_packets (which already includes + * unicast and broadcast) + */ + stats.rx_packets += stats.multicast; + + u64_stats_update_begin(&p->syncp); + p->stats64 = stats; + u64_stats_update_end(&p->syncp); + + mutex_unlock(&p->mib_mutex); +} + +static void xrs700x_mib_work(struct work_struct *work) +{ + struct xrs700x *priv = container_of(work, struct xrs700x, + mib_work.work); + int i; + + for (i = 0; i < priv->ds->num_ports; i++) + xrs700x_read_port_counters(priv, i); + + schedule_delayed_work(&priv->mib_work, xrs700x_mib_interval); +} + +static void xrs700x_get_ethtool_stats(struct dsa_switch *ds, int port, + u64 *data) +{ + struct xrs700x *priv = ds->priv; + struct xrs700x_port *p = &priv->ports[port]; + + xrs700x_read_port_counters(priv, port); + + mutex_lock(&p->mib_mutex); + memcpy(data, p->mib_data, sizeof(*data) * array_size(xrs700x_mibs)); + mutex_unlock(&p->mib_mutex); +} + +static void xrs700x_get_stats64(struct dsa_switch *ds, int port, + struct rtnl_link_stats64 *s) +{ + struct xrs700x *priv = ds->priv; + struct xrs700x_port *p = &priv->ports[port]; + unsigned int start; + + do { + start = u64_stats_fetch_begin(&p->syncp); + *s = p->stats64; + } while (u64_stats_fetch_retry(&p->syncp, start)); +} + +static int xrs700x_setup_regmap_range(struct xrs700x *priv) +{ + struct xrs700x_regfield regfields[] = { + { + .rf = reg_field_id(xrs_port_state(0), 0, 1, + priv->ds->num_ports, + xrs_port_offset), + .rmf = &priv->ps_forward + }, + { + .rf = reg_field_id(xrs_port_state(0), 2, 3, + priv->ds->num_ports, + xrs_port_offset), + .rmf = &priv->ps_management + }, + { + .rf = reg_field_id(xrs_port_state(0), 4, 9, + priv->ds->num_ports, + xrs_port_offset), + .rmf = &priv->ps_sel_speed + }, + { + .rf = reg_field_id(xrs_port_state(0), 10, 11, + priv->ds->num_ports, + xrs_port_offset), + .rmf = &priv->ps_cur_speed + } + }; + int i = 0; + + for (; i < array_size(regfields); i++) { + *regfields[i].rmf = devm_regmap_field_alloc(priv->dev, + priv->regmap, + regfields[i].rf); + if (is_err(*regfields[i].rmf)) + return ptr_err(*regfields[i].rmf); + } + + return 0; +} + +static enum dsa_tag_protocol xrs700x_get_tag_protocol(struct dsa_switch *ds, + int port, + enum dsa_tag_protocol m) +{ + return dsa_tag_proto_xrs700x; +} + +static int xrs700x_reset(struct dsa_switch *ds) +{ + struct xrs700x *priv = ds->priv; + unsigned int val; + int ret; + + ret = regmap_write(priv->regmap, xrs_general, xrs_general_reset); + if (ret) + goto error; + + ret = regmap_read_poll_timeout(priv->regmap, xrs_general, + val, !(val & xrs_general_reset), + 10, 1000); +error: + if (ret) { + dev_err_ratelimited(priv->dev, "error resetting switch: %d ", + ret); + } + + return ret; +} + +static void xrs700x_port_stp_state_set(struct dsa_switch *ds, int port, + u8 state) +{ + struct xrs700x *priv = ds->priv; + unsigned int bpdus = 1; + unsigned int val; + + switch (state) { + case br_state_disabled: + bpdus = 0; + fallthrough; + case br_state_blocking: + case br_state_listening: + val = xrs_port_disabled; + break; + case br_state_learning: + val = xrs_port_learning; + break; + case br_state_forwarding: + val = xrs_port_forwarding; + break; + default: + dev_err(ds->dev, "invalid stp state: %d ", state); + return; + } + + regmap_fields_write(priv->ps_forward, port, val); + + /* enable/disable inbound policy added by xrs700x_port_add_bpdu_ipf() + * which allows bpdu forwarding to the cpu port when the front facing + * port is in disabled/learning state. + */ + regmap_update_bits(priv->regmap, xrs_eth_addr_cfg(port, 0), 1, bpdus); + + dev_dbg_ratelimited(priv->dev, "%s - port: %d, state: %u, val: 0x%x ", + __func__, port, state, val); +} + +/* add an inbound policy filter which matches the bpdu destination mac + * and forwards to the cpu port. leave the policy disabled, it will be + * enabled as needed. + */ +static int xrs700x_port_add_bpdu_ipf(struct dsa_switch *ds, int port) +{ + struct xrs700x *priv = ds->priv; + unsigned int val = 0; + int i = 0; + int ret; + + /* compare all 48 bits of the destination mac address. */ + ret = regmap_write(priv->regmap, xrs_eth_addr_cfg(port, 0), 48 << 2); + if (ret) + return ret; + + /* match bpdu destination 01:80:c2:00:00:00 */ + for (i = 0; i < sizeof(eth_stp_addr); i += 2) { + ret = regmap_write(priv->regmap, xrs_eth_addr_0(port, 0) + i, + eth_stp_addr[i] | + (eth_stp_addr[i + 1] << 8)); + if (ret) + return ret; + } + + /* mirror bpdu to cpu port */ + for (i = 0; i < ds->num_ports; i++) { + if (dsa_is_cpu_port(ds, i)) + val |= bit(i); + } + + ret = regmap_write(priv->regmap, xrs_eth_addr_fwd_mirror(port, 0), val); + if (ret) + return ret; + + ret = regmap_write(priv->regmap, xrs_eth_addr_fwd_allow(port, 0), 0); + if (ret) + return ret; + + return 0; +} + +static int xrs700x_port_setup(struct dsa_switch *ds, int port) +{ + bool cpu_port = dsa_is_cpu_port(ds, port); + struct xrs700x *priv = ds->priv; + unsigned int val = 0; + int ret, i; + + xrs700x_port_stp_state_set(ds, port, br_state_disabled); + + /* disable forwarding to non-cpu ports */ + for (i = 0; i < ds->num_ports; i++) { + if (!dsa_is_cpu_port(ds, i)) + val |= bit(i); + } + + /* 1 = disable forwarding to the port */ + ret = regmap_write(priv->regmap, xrs_port_fwd_mask(port), val); + if (ret) + return ret; + + val = cpu_port ? xrs_port_mode_management : xrs_port_mode_normal; + ret = regmap_fields_write(priv->ps_management, port, val); + if (ret) + return ret; + + if (!cpu_port) { + ret = xrs700x_port_add_bpdu_ipf(ds, port); + if (ret) + return ret; + } + + return 0; +} + +static int xrs700x_setup(struct dsa_switch *ds) +{ + struct xrs700x *priv = ds->priv; + int ret, i; + + ret = xrs700x_reset(ds); + if (ret) + return ret; + + for (i = 0; i < ds->num_ports; i++) { + ret = xrs700x_port_setup(ds, i); + if (ret) + return ret; + } + + schedule_delayed_work(&priv->mib_work, xrs700x_mib_interval); + + return 0; +} + +static void xrs700x_teardown(struct dsa_switch *ds) +{ + struct xrs700x *priv = ds->priv; + + cancel_delayed_work_sync(&priv->mib_work); +} + +static void xrs700x_phylink_validate(struct dsa_switch *ds, int port, + unsigned long *supported, + struct phylink_link_state *state) +{ + __ethtool_declare_link_mode_mask(mask) = { 0, }; + + switch (port) { + case 0: + break; + case 1: + case 2: + case 3: + phylink_set(mask, 1000baset_full); + break; + default: + bitmap_zero(supported, __ethtool_link_mode_mask_nbits); + dev_err(ds->dev, "unsupported port: %i ", port); + return; + } + + phylink_set_port_modes(mask); + + /* the switch only supports full duplex. */ + phylink_set(mask, 10baset_full); + phylink_set(mask, 100baset_full); + + bitmap_and(supported, supported, mask, + __ethtool_link_mode_mask_nbits); + bitmap_and(state->advertising, state->advertising, mask, + __ethtool_link_mode_mask_nbits); +} + +static void xrs700x_mac_link_up(struct dsa_switch *ds, int port, + unsigned int mode, phy_interface_t interface, + struct phy_device *phydev, + int speed, int duplex, + bool tx_pause, bool rx_pause) +{ + struct xrs700x *priv = ds->priv; + unsigned int val; + + switch (speed) { + case speed_1000: + val = xrs_port_speed_1000; + break; + case speed_100: + val = xrs_port_speed_100; + break; + case speed_10: + val = xrs_port_speed_10; + break; + default: + return; + } + + regmap_fields_write(priv->ps_sel_speed, port, val); + + dev_dbg_ratelimited(priv->dev, "%s: port: %d mode: %u speed: %u ", + __func__, port, mode, speed); +} + +static int xrs700x_bridge_common(struct dsa_switch *ds, int port, + struct net_device *bridge, bool join) +{ + unsigned int i, cpu_mask = 0, mask = 0; + struct xrs700x *priv = ds->priv; + int ret; + + for (i = 0; i < ds->num_ports; i++) { + if (dsa_is_cpu_port(ds, i)) + continue; + + cpu_mask |= bit(i); + + if (dsa_to_port(ds, i)->bridge_dev == bridge) + continue; + + mask |= bit(i); + } + + for (i = 0; i < ds->num_ports; i++) { + if (dsa_to_port(ds, i)->bridge_dev != bridge) + continue; + + /* 1 = disable forwarding to the port */ + ret = regmap_write(priv->regmap, xrs_port_fwd_mask(i), mask); + if (ret) + return ret; + } + + if (!join) { + ret = regmap_write(priv->regmap, xrs_port_fwd_mask(port), + cpu_mask); + if (ret) + return ret; + } + + return 0; +} + +static int xrs700x_bridge_join(struct dsa_switch *ds, int port, + struct net_device *bridge) +{ + return xrs700x_bridge_common(ds, port, bridge, true); +} + +static void xrs700x_bridge_leave(struct dsa_switch *ds, int port, + struct net_device *bridge) +{ + xrs700x_bridge_common(ds, port, bridge, false); +} + +static const struct dsa_switch_ops xrs700x_ops = { + .get_tag_protocol = xrs700x_get_tag_protocol, + .setup = xrs700x_setup, + .teardown = xrs700x_teardown, + .port_stp_state_set = xrs700x_port_stp_state_set, + .phylink_validate = xrs700x_phylink_validate, + .phylink_mac_link_up = xrs700x_mac_link_up, + .get_strings = xrs700x_get_strings, + .get_sset_count = xrs700x_get_sset_count, + .get_ethtool_stats = xrs700x_get_ethtool_stats, + .get_stats64 = xrs700x_get_stats64, + .port_bridge_join = xrs700x_bridge_join, + .port_bridge_leave = xrs700x_bridge_leave, +}; + +static int xrs700x_detect(struct xrs700x *priv) +{ + const struct xrs700x_info *info; + unsigned int id; + int ret; + + ret = regmap_read(priv->regmap, xrs_dev_id0, &id); + if (ret) { + dev_err(priv->dev, "error %d while reading switch id. ", + ret); + return ret; + } + + info = of_device_get_match_data(priv->dev); + if (!info) + return -einval; + + if (info->id == id) { + priv->ds->num_ports = info->num_ports; + dev_info(priv->dev, "%s detected. ", info->name); + return 0; + } + + dev_err(priv->dev, "expected switch id 0x%x but found 0x%x. ", + info->id, id); + + return -enodev; +} + +struct xrs700x *xrs700x_switch_alloc(struct device *base, void *devpriv) +{ + struct dsa_switch *ds; + struct xrs700x *priv; + + ds = devm_kzalloc(base, sizeof(*ds), gfp_kernel); + if (!ds) + return null; + + ds->dev = base; + + priv = devm_kzalloc(base, sizeof(*priv), gfp_kernel); + if (!priv) + return null; + + init_delayed_work(&priv->mib_work, xrs700x_mib_work); + + ds->ops = &xrs700x_ops; + ds->priv = priv; + priv->dev = base; + + priv->ds = ds; + priv->priv = devpriv; + + return priv; +} +export_symbol(xrs700x_switch_alloc); + +static int xrs700x_alloc_port_mib(struct xrs700x *priv, int port) +{ + struct xrs700x_port *p = &priv->ports[port]; + + p->mib_data = devm_kcalloc(priv->dev, array_size(xrs700x_mibs), + sizeof(*p->mib_data), gfp_kernel); + if (!p->mib_data) + return -enomem; + + mutex_init(&p->mib_mutex); + u64_stats_init(&p->syncp); + + return 0; +} + +int xrs700x_switch_register(struct xrs700x *priv) +{ + int ret; + int i; + + ret = xrs700x_detect(priv); + if (ret) + return ret; + + ret = xrs700x_setup_regmap_range(priv); + if (ret) + return ret; + + priv->ports = devm_kcalloc(priv->dev, priv->ds->num_ports, + sizeof(*priv->ports), gfp_kernel); + if (!priv->ports) + return -enomem; + + for (i = 0; i < priv->ds->num_ports; i++) { + ret = xrs700x_alloc_port_mib(priv, i); + if (ret) + return ret; + } + + return dsa_register_switch(priv->ds); +} +export_symbol(xrs700x_switch_register); + +void xrs700x_switch_remove(struct xrs700x *priv) +{ + dsa_unregister_switch(priv->ds); +} +export_symbol(xrs700x_switch_remove); + +module_author("george mccollister <george.mccollister@gmail.com>"); +module_description("arrow speedchips xrs700x dsa driver"); +module_license("gpl v2"); diff --git a/drivers/net/dsa/xrs700x/xrs700x.h b/drivers/net/dsa/xrs700x/xrs700x.h --- /dev/null +++ b/drivers/net/dsa/xrs700x/xrs700x.h +/* spdx-license-identifier: gpl-2.0 */ +#include <linux/device.h> +#include <linux/mutex.h> +#include <linux/regmap.h> +#include <linux/workqueue.h> +#include <linux/u64_stats_sync.h> +#include <uapi/linux/if_link.h> + +struct xrs700x_info { + unsigned int id; + const char *name; + size_t num_ports; +}; + +extern const struct xrs700x_info xrs7003e_info; +extern const struct xrs700x_info xrs7003f_info; +extern const struct xrs700x_info xrs7004e_info; +extern const struct xrs700x_info xrs7004f_info; + +struct xrs700x_port { + struct mutex mib_mutex; /* protects mib_data */ + u64 *mib_data; + struct rtnl_link_stats64 stats64; + struct u64_stats_sync syncp; +}; + +struct xrs700x { + struct dsa_switch *ds; + struct device *dev; + void *priv; + struct regmap *regmap; + struct regmap_field *ps_forward; + struct regmap_field *ps_management; + struct regmap_field *ps_sel_speed; + struct regmap_field *ps_cur_speed; + struct delayed_work mib_work; + struct xrs700x_port *ports; +}; + +struct xrs700x *xrs700x_switch_alloc(struct device *base, void *devpriv); +int xrs700x_switch_register(struct xrs700x *priv); +void xrs700x_switch_remove(struct xrs700x *priv); diff --git a/drivers/net/dsa/xrs700x/xrs700x_i2c.c b/drivers/net/dsa/xrs700x/xrs700x_i2c.c --- /dev/null +++ b/drivers/net/dsa/xrs700x/xrs700x_i2c.c +// spdx-license-identifier: gpl-2.0 +/* + * copyright (c) 2020 novatech llc + * george mccollister <george.mccollister@gmail.com> + */ + +#include <linux/bits.h> +#include <linux/i2c.h> +#include <linux/module.h> +#include "xrs700x.h" +#include "xrs700x_reg.h" + +static int xrs700x_i2c_reg_read(void *context, unsigned int reg, + unsigned int *val) +{ + struct device *dev = context; + struct i2c_client *i2c = to_i2c_client(dev); + unsigned char buf[4]; + int ret; + + buf[0] = reg >> 23 & 0xff; + buf[1] = reg >> 15 & 0xff; + buf[2] = reg >> 7 & 0xff; + buf[3] = (reg & 0x7f) << 1; + + ret = i2c_master_send(i2c, buf, sizeof(buf)); + if (ret < 0) { + dev_err(dev, "xrs i2c_master_send returned %d ", ret); + return ret; + } + + ret = i2c_master_recv(i2c, buf, 2); + if (ret < 0) { + dev_err(dev, "xrs i2c_master_recv returned %d ", ret); + return ret; + } + + *val = buf[0] << 8 | buf[1]; + + return 0; +} + +static int xrs700x_i2c_reg_write(void *context, unsigned int reg, + unsigned int val) +{ + struct device *dev = context; + struct i2c_client *i2c = to_i2c_client(dev); + unsigned char buf[6]; + int ret; + + buf[0] = reg >> 23 & 0xff; + buf[1] = reg >> 15 & 0xff; + buf[2] = reg >> 7 & 0xff; + buf[3] = (reg & 0x7f) << 1 | 1; + buf[4] = val >> 8 & 0xff; + buf[5] = val & 0xff; + + ret = i2c_master_send(i2c, buf, sizeof(buf)); + if (ret < 0) { + dev_err(dev, "xrs i2c_master_send returned %d ", ret); + return ret; + } + + return 0; +} + +static const struct regmap_config xrs700x_i2c_regmap_config = { + .val_bits = 16, + .reg_stride = 2, + .reg_bits = 32, + .pad_bits = 0, + .write_flag_mask = 0, + .read_flag_mask = 0, + .reg_read = xrs700x_i2c_reg_read, + .reg_write = xrs700x_i2c_reg_write, + .max_register = 0, + .cache_type = regcache_none, + .reg_format_endian = regmap_endian_big, + .val_format_endian = regmap_endian_big +}; + +static int xrs700x_i2c_probe(struct i2c_client *i2c, + const struct i2c_device_id *i2c_id) +{ + struct xrs700x *priv; + int ret; + + priv = xrs700x_switch_alloc(&i2c->dev, i2c); + if (!priv) + return -enomem; + + priv->regmap = devm_regmap_init(&i2c->dev, null, &i2c->dev, + &xrs700x_i2c_regmap_config); + if (is_err(priv->regmap)) { + ret = ptr_err(priv->regmap); + dev_err(&i2c->dev, "failed to initialize regmap: %d ", ret); + return ret; + } + + i2c_set_clientdata(i2c, priv); + + ret = xrs700x_switch_register(priv); + + /* main dsa driver may not be started yet. */ + if (ret) + return ret; + + return 0; +} + +static int xrs700x_i2c_remove(struct i2c_client *i2c) +{ + struct xrs700x *priv = i2c_get_clientdata(i2c); + + xrs700x_switch_remove(priv); + + return 0; +} + +static const struct i2c_device_id xrs700x_i2c_id[] = { + { "xrs700x-switch", 0 }, + {}, +}; + +module_device_table(i2c, xrs700x_i2c_id); + +static const struct of_device_id xrs700x_i2c_dt_ids[] = { + { .compatible = "arrow,xrs7003e", .data = &xrs7003e_info }, + { .compatible = "arrow,xrs7003f", .data = &xrs7003f_info }, + { .compatible = "arrow,xrs7004e", .data = &xrs7004e_info }, + { .compatible = "arrow,xrs7004f", .data = &xrs7004f_info }, + {}, +}; +module_device_table(of, xrs700x_i2c_dt_ids); + +static struct i2c_driver xrs700x_i2c_driver = { + .driver = { + .name = "xrs700x-i2c", + .of_match_table = of_match_ptr(xrs700x_i2c_dt_ids), + }, + .probe = xrs700x_i2c_probe, + .remove = xrs700x_i2c_remove, + .id_table = xrs700x_i2c_id, +}; + +module_i2c_driver(xrs700x_i2c_driver); + +module_author("george mccollister <george.mccollister@gmail.com>"); +module_description("arrow speedchips xrs700x dsa i2c driver"); +module_license("gpl v2"); diff --git a/drivers/net/dsa/xrs700x/xrs700x_mdio.c b/drivers/net/dsa/xrs700x/xrs700x_mdio.c --- /dev/null +++ b/drivers/net/dsa/xrs700x/xrs700x_mdio.c +// spdx-license-identifier: gpl-2.0 +/* + * copyright (c) 2020 novatech llc + * george mccollister <george.mccollister@gmail.com> + */ + +#include <linux/bitfield.h> +#include <linux/bits.h> +#include <linux/mdio.h> +#include <linux/module.h> +#include <linux/phy.h> +#include <linux/if_vlan.h> +#include "xrs700x.h" +#include "xrs700x_reg.h" + +#define xrs_mdio_iba0 0x10 +#define xrs_mdio_iba1 0x11 +#define xrs_mdio_ibd 0x14 + +#define xrs_ib_read 0x0 +#define xrs_ib_write 0x1 + +static int xrs700x_mdio_reg_read(void *context, unsigned int reg, + unsigned int *val) +{ + struct mdio_device *mdiodev = context; + struct device *dev = &mdiodev->dev; + u16 uval; + int ret; + + uval = (u16)field_get(genmask(31, 16), reg); + + ret = mdiobus_write(mdiodev->bus, mdiodev->addr, xrs_mdio_iba1, uval); + if (ret < 0) { + dev_err(dev, "xrs mdiobus_write returned %d ", ret); + return ret; + } + + uval = (u16)((reg & genmask(15, 1)) | xrs_ib_read); + + ret = mdiobus_write(mdiodev->bus, mdiodev->addr, xrs_mdio_iba0, uval); + if (ret < 0) { + dev_err(dev, "xrs mdiobus_write returned %d ", ret); + return ret; + } + + ret = mdiobus_read(mdiodev->bus, mdiodev->addr, xrs_mdio_ibd); + if (ret < 0) { + dev_err(dev, "xrs mdiobus_read returned %d ", ret); + return ret; + } + + *val = (unsigned int)ret; + + return 0; +} + +static int xrs700x_mdio_reg_write(void *context, unsigned int reg, + unsigned int val) +{ + struct mdio_device *mdiodev = context; + struct device *dev = &mdiodev->dev; + u16 uval; + int ret; + + ret = mdiobus_write(mdiodev->bus, mdiodev->addr, xrs_mdio_ibd, (u16)val); + if (ret < 0) { + dev_err(dev, "xrs mdiobus_write returned %d ", ret); + return ret; + } + + uval = (u16)field_get(genmask(31, 16), reg); + + ret = mdiobus_write(mdiodev->bus, mdiodev->addr, xrs_mdio_iba1, uval); + if (ret < 0) { + dev_err(dev, "xrs mdiobus_write returned %d ", ret); + return ret; + } + + uval = (u16)((reg & genmask(15, 1)) | xrs_ib_write); + + ret = mdiobus_write(mdiodev->bus, mdiodev->addr, xrs_mdio_iba0, uval); + if (ret < 0) { + dev_err(dev, "xrs mdiobus_write returned %d ", ret); + return ret; + } + + return 0; +} + +static const struct regmap_config xrs700x_mdio_regmap_config = { + .val_bits = 16, + .reg_stride = 2, + .reg_bits = 32, + .pad_bits = 0, + .write_flag_mask = 0, + .read_flag_mask = 0, + .reg_read = xrs700x_mdio_reg_read, + .reg_write = xrs700x_mdio_reg_write, + .max_register = xrs_vlan(vlan_n_vid - 1), + .cache_type = regcache_none, + .reg_format_endian = regmap_endian_big, + .val_format_endian = regmap_endian_big +}; + +static int xrs700x_mdio_probe(struct mdio_device *mdiodev) +{ + struct xrs700x *priv; + int ret; + + priv = xrs700x_switch_alloc(&mdiodev->dev, mdiodev); + if (!priv) + return -enomem; + + priv->regmap = devm_regmap_init(&mdiodev->dev, null, mdiodev, + &xrs700x_mdio_regmap_config); + if (is_err(priv->regmap)) { + ret = ptr_err(priv->regmap); + dev_err(&mdiodev->dev, "failed to initialize regmap: %d ", ret); + return ret; + } + + dev_set_drvdata(&mdiodev->dev, priv); + + ret = xrs700x_switch_register(priv); + + /* main dsa driver may not be started yet. */ + if (ret) + return ret; + + return 0; +} + +static void xrs700x_mdio_remove(struct mdio_device *mdiodev) +{ + struct xrs700x *priv = dev_get_drvdata(&mdiodev->dev); + + xrs700x_switch_remove(priv); +} + +static const struct of_device_id xrs700x_mdio_dt_ids[] = { + { .compatible = "arrow,xrs7003e", .data = &xrs7003e_info }, + { .compatible = "arrow,xrs7003f", .data = &xrs7003f_info }, + { .compatible = "arrow,xrs7004e", .data = &xrs7004e_info }, + { .compatible = "arrow,xrs7004f", .data = &xrs7004f_info }, + {}, +}; +module_device_table(of, xrs700x_mdio_dt_ids); + +static struct mdio_driver xrs700x_mdio_driver = { + .mdiodrv.driver = { + .name = "xrs700x-mdio", + .of_match_table = xrs700x_mdio_dt_ids, + }, + .probe = xrs700x_mdio_probe, + .remove = xrs700x_mdio_remove, +}; + +mdio_module_driver(xrs700x_mdio_driver); + +module_author("george mccollister <george.mccollister@gmail.com>"); +module_description("arrow speedchips xrs700x dsa mdio driver"); +module_license("gpl v2"); diff --git a/drivers/net/dsa/xrs700x/xrs700x_reg.h b/drivers/net/dsa/xrs700x/xrs700x_reg.h --- /dev/null +++ b/drivers/net/dsa/xrs700x/xrs700x_reg.h +/* spdx-license-identifier: gpl-2.0 */ + +/* register base addresses */ +#define xrs_device_id_base 0x0 +#define xrs_gpio_base 0x10000 +#define xrs_port_offset 0x10000 +#define xrs_port_base(x) (0x200000 + xrs_port_offset * (x)) +#define xrs_rtc_base 0x280000 +#define xrs_ts_offset 0x8000 +#define xrs_ts_base(x) (0x290000 + xrs_ts_offset * (x)) +#define xrs_switch_conf_base 0x300000 + +/* device identification registers */ +#define xrs_dev_id0 (xrs_device_id_base + 0) +#define xrs_dev_id1 (xrs_device_id_base + 2) +#define xrs_int_id0 (xrs_device_id_base + 4) +#define xrs_int_id1 (xrs_device_id_base + 6) +#define xrs_rev_id (xrs_device_id_base + 8) + +/* gpio registers */ +#define xrs_config0 (xrs_gpio_base + 0x1000) +#define xrs_input_status0 (xrs_gpio_base + 0x1002) +#define xrs_config1 (xrs_gpio_base + 0x1004) +#define xrs_input_status1 (xrs_gpio_base + 0x1006) +#define xrs_config2 (xrs_gpio_base + 0x1008) +#define xrs_input_status2 (xrs_gpio_base + 0x100a) + +/* port configuration registers */ +#define xrs_port_gen_base(x) (xrs_port_base(x) + 0x0) +#define xrs_port_hsr_base(x) (xrs_port_base(x) + 0x2000) +#define xrs_port_ptp_base(x) (xrs_port_base(x) + 0x4000) +#define xrs_port_cnt_base(x) (xrs_port_base(x) + 0x6000) +#define xrs_port_ipo_base(x) (xrs_port_base(x) + 0x8000) + +/* port configuration registers - general and state */ +#define xrs_port_state(x) (xrs_port_gen_base(x) + 0x0) +#define xrs_port_forwarding 0 +#define xrs_port_learning 1 +#define xrs_port_disabled 2 +#define xrs_port_mode_normal 0 +#define xrs_port_mode_management 1 +#define xrs_port_speed_1000 0x12 +#define xrs_port_speed_100 0x20 +#define xrs_port_speed_10 0x30 +#define xrs_port_vlan(x) (xrs_port_gen_base(x) + 0x10) +#define xrs_port_vlan0_mapping(x) (xrs_port_gen_base(x) + 0x12) +#define xrs_port_fwd_mask(x) (xrs_port_gen_base(x) + 0x14) +#define xrs_port_vlan_prio(x) (xrs_port_gen_base(x) + 0x16) + +/* port configuration registers - hsr/prp */ +#define xrs_hsr_cfg(x) (xrs_port_hsr_base(x) + 0x0) + +/* port configuration registers - ptp */ +#define xrs_ptp_rx_sync_delay_ns_lo(x) (xrs_port_ptp_base(x) + 0x2) +#define xrs_ptp_rx_sync_delay_ns_hi(x) (xrs_port_ptp_base(x) + 0x4) +#define xrs_ptp_rx_event_delay_ns(x) (xrs_port_ptp_base(x) + 0xa) +#define xrs_ptp_tx_event_delay_ns(x) (xrs_port_ptp_base(x) + 0x12) + +/* port configuration registers - counter */ +#define xrs_cnt_ctrl(x) (xrs_port_cnt_base(x) + 0x0) +#define xrs_rx_good_octets_l (xrs_port_cnt_base(0) + 0x200) +#define xrs_rx_good_octets_h (xrs_port_cnt_base(0) + 0x202) +#define xrs_rx_bad_octets_l (xrs_port_cnt_base(0) + 0x204) +#define xrs_rx_bad_octets_h (xrs_port_cnt_base(0) + 0x206) +#define xrs_rx_unicast_l (xrs_port_cnt_base(0) + 0x208) +#define xrs_rx_unicast_h (xrs_port_cnt_base(0) + 0x20a) +#define xrs_rx_broadcast_l (xrs_port_cnt_base(0) + 0x20c) +#define xrs_rx_broadcast_h (xrs_port_cnt_base(0) + 0x20e) +#define xrs_rx_multicast_l (xrs_port_cnt_base(0) + 0x210) +#define xrs_rx_multicast_h (xrs_port_cnt_base(0) + 0x212) +#define xrs_rx_undersize_l (xrs_port_cnt_base(0) + 0x214) +#define xrs_rx_undersize_h (xrs_port_cnt_base(0) + 0x216) +#define xrs_rx_fragments_l (xrs_port_cnt_base(0) + 0x218) +#define xrs_rx_fragments_h (xrs_port_cnt_base(0) + 0x21a) +#define xrs_rx_oversize_l (xrs_port_cnt_base(0) + 0x21c) +#define xrs_rx_oversize_h (xrs_port_cnt_base(0) + 0x21e) +#define xrs_rx_jabber_l (xrs_port_cnt_base(0) + 0x220) +#define xrs_rx_jabber_h (xrs_port_cnt_base(0) + 0x222) +#define xrs_rx_err_l (xrs_port_cnt_base(0) + 0x224) +#define xrs_rx_err_h (xrs_port_cnt_base(0) + 0x226) +#define xrs_rx_crc_l (xrs_port_cnt_base(0) + 0x228) +#define xrs_rx_crc_h (xrs_port_cnt_base(0) + 0x22a) +#define xrs_rx_64_l (xrs_port_cnt_base(0) + 0x22c) +#define xrs_rx_64_h (xrs_port_cnt_base(0) + 0x22e) +#define xrs_rx_65_127_l (xrs_port_cnt_base(0) + 0x230) +#define xrs_rx_65_127_h (xrs_port_cnt_base(0) + 0x232) +#define xrs_rx_128_255_l (xrs_port_cnt_base(0) + 0x234) +#define xrs_rx_128_255_h (xrs_port_cnt_base(0) + 0x236) +#define xrs_rx_256_511_l (xrs_port_cnt_base(0) + 0x238) +#define xrs_rx_256_511_h (xrs_port_cnt_base(0) + 0x23a) +#define xrs_rx_512_1023_l (xrs_port_cnt_base(0) + 0x23c) +#define xrs_rx_512_1023_h (xrs_port_cnt_base(0) + 0x23e) +#define xrs_rx_1024_1536_l (xrs_port_cnt_base(0) + 0x240) +#define xrs_rx_1024_1536_h (xrs_port_cnt_base(0) + 0x242) +#define xrs_rx_hsr_prp_l (xrs_port_cnt_base(0) + 0x244) +#define xrs_rx_hsr_prp_h (xrs_port_cnt_base(0) + 0x246) +#define xrs_rx_wronglan_l (xrs_port_cnt_base(0) + 0x248) +#define xrs_rx_wronglan_h (xrs_port_cnt_base(0) + 0x24a) +#define xrs_rx_duplicate_l (xrs_port_cnt_base(0) + 0x24c) +#define xrs_rx_duplicate_h (xrs_port_cnt_base(0) + 0x24e) +#define xrs_tx_octets_l (xrs_port_cnt_base(0) + 0x280) +#define xrs_tx_octets_h (xrs_port_cnt_base(0) + 0x282) +#define xrs_tx_unicast_l (xrs_port_cnt_base(0) + 0x284) +#define xrs_tx_unicast_h (xrs_port_cnt_base(0) + 0x286) +#define xrs_tx_broadcast_l (xrs_port_cnt_base(0) + 0x288) +#define xrs_tx_broadcast_h (xrs_port_cnt_base(0) + 0x28a) +#define xrs_tx_multicast_l (xrs_port_cnt_base(0) + 0x28c) +#define xrs_tx_multicast_h (xrs_port_cnt_base(0) + 0x28e) +#define xrs_tx_hsr_prp_l (xrs_port_cnt_base(0) + 0x290) +#define xrs_tx_hsr_prp_h (xrs_port_cnt_base(0) + 0x292) +#define xrs_priq_drop_l (xrs_port_cnt_base(0) + 0x2c0) +#define xrs_priq_drop_h (xrs_port_cnt_base(0) + 0x2c2) +#define xrs_early_drop_l (xrs_port_cnt_base(0) + 0x2c4) +#define xrs_early_drop_h (xrs_port_cnt_base(0) + 0x2c6) + +/* port configuration registers - inbound policy 0 - 15 */ +#define xrs_eth_addr_cfg(x, p) (xrs_port_ipo_base(x) + \ + (p) * 0x20 + 0x0) +#define xrs_eth_addr_fwd_allow(x, p) (xrs_port_ipo_base(x) + \ + (p) * 0x20 + 0x2) +#define xrs_eth_addr_fwd_mirror(x, p) (xrs_port_ipo_base(x) + \ + (p) * 0x20 + 0x4) +#define xrs_eth_addr_0(x, p) (xrs_port_ipo_base(x) + \ + (p) * 0x20 + 0x8) +#define xrs_eth_addr_1(x, p) (xrs_port_ipo_base(x) + \ + (p) * 0x20 + 0xa) +#define xrs_eth_addr_2(x, p) (xrs_port_ipo_base(x) + \ + (p) * 0x20 + 0xc) + +/* rtc registers */ +#define xrs_cur_nsec0 (xrs_rtc_base + 0x1004) +#define xrs_cur_nsec1 (xrs_rtc_base + 0x1006) +#define xrs_cur_sec0 (xrs_rtc_base + 0x1008) +#define xrs_cur_sec1 (xrs_rtc_base + 0x100a) +#define xrs_cur_sec2 (xrs_rtc_base + 0x100c) +#define xrs_time_cc0 (xrs_rtc_base + 0x1010) +#define xrs_time_cc1 (xrs_rtc_base + 0x1012) +#define xrs_time_cc2 (xrs_rtc_base + 0x1014) +#define xrs_step_size0 (xrs_rtc_base + 0x1020) +#define xrs_step_size1 (xrs_rtc_base + 0x1022) +#define xrs_step_size2 (xrs_rtc_base + 0x1024) +#define xrs_adjust_nsec0 (xrs_rtc_base + 0x1034) +#define xrs_adjust_nsec1 (xrs_rtc_base + 0x1036) +#define xrs_adjust_sec0 (xrs_rtc_base + 0x1038) +#define xrs_adjust_sec1 (xrs_rtc_base + 0x103a) +#define xrs_adjust_sec2 (xrs_rtc_base + 0x103c) +#define xrs_time_cmd (xrs_rtc_base + 0x1040) + +/* time stamper registers */ +#define xrs_ts_ctrl(x) (xrs_ts_base(x) + 0x1000) +#define xrs_ts_int_mask(x) (xrs_ts_base(x) + 0x1008) +#define xrs_ts_int_status(x) (xrs_ts_base(x) + 0x1010) +#define xrs_ts_nsec0(x) (xrs_ts_base(x) + 0x1104) +#define xrs_ts_nsec1(x) (xrs_ts_base(x) + 0x1106) +#define xrs_ts_sec0(x) (xrs_ts_base(x) + 0x1108) +#define xrs_ts_sec1(x) (xrs_ts_base(x) + 0x110a) +#define xrs_ts_sec2(x) (xrs_ts_base(x) + 0x110c) +#define xrs_pnct0(x) (xrs_ts_base(x) + 0x1110) +#define xrs_pnct1(x) (xrs_ts_base(x) + 0x1112) + +/* switch configuration registers */ +#define xrs_switch_gen_base (xrs_switch_conf_base + 0x0) +#define xrs_switch_ts_base (xrs_switch_conf_base + 0x2000) +#define xrs_switch_vlan_base (xrs_switch_conf_base + 0x4000) + +/* switch configuration registers - general */ +#define xrs_general (xrs_switch_gen_base + 0x10) +#define xrs_general_time_trailer bit(9) +#define xrs_general_mod_sync bit(10) +#define xrs_general_cut_thru bit(13) +#define xrs_general_clr_mac_tbl bit(14) +#define xrs_general_reset bit(15) +#define xrs_mt_clear_mask (xrs_switch_gen_base + 0x12) +#define xrs_address_aging (xrs_switch_gen_base + 0x20) +#define xrs_ts_ctrl_tx (xrs_switch_gen_base + 0x28) +#define xrs_ts_ctrl_rx (xrs_switch_gen_base + 0x2a) +#define xrs_int_mask (xrs_switch_gen_base + 0x2c) +#define xrs_int_status (xrs_switch_gen_base + 0x2e) +#define xrs_mac_table0 (xrs_switch_gen_base + 0x200) +#define xrs_mac_table1 (xrs_switch_gen_base + 0x202) +#define xrs_mac_table2 (xrs_switch_gen_base + 0x204) +#define xrs_mac_table3 (xrs_switch_gen_base + 0x206) + +/* switch configuration registers - frame timestamp */ +#define xrs_tx_ts_ns_lo(t) (xrs_switch_ts_base + 0x80 * (t) + 0x0) +#define xrs_tx_ts_ns_hi(t) (xrs_switch_ts_base + 0x80 * (t) + 0x2) +#define xrs_tx_ts_s_lo(t) (xrs_switch_ts_base + 0x80 * (t) + 0x4) +#define xrs_tx_ts_s_hi(t) (xrs_switch_ts_base + 0x80 * (t) + 0x6) +#define xrs_tx_ts_hdr(t, h) (xrs_switch_ts_base + 0x80 * (t) + \ + 0x2 * (h) + 0xe) +#define xrs_rx_ts_ns_lo(t) (xrs_switch_ts_base + 0x80 * (t) + \ + 0x200) +#define xrs_rx_ts_ns_hi(t) (xrs_switch_ts_base + 0x80 * (t) + \ + 0x202) +#define xrs_rx_ts_s_lo(t) (xrs_switch_ts_base + 0x80 * (t) + \ + 0x204) +#define xrs_rx_ts_s_hi(t) (xrs_switch_ts_base + 0x80 * (t) + \ + 0x206) +#define xrs_rx_ts_hdr(t, h) (xrs_switch_ts_base + 0x80 * (t) + \ + 0x2 * (h) + 0xe) + +/* switch configuration registers - vlan */ +#define xrs_vlan(v) (xrs_switch_vlan_base + 0x2 * (v))
|
Networking
|
ee00b24f32eb822f55190efd1078fe572e931d5c
|
george mccollister
|
drivers
|
net
|
dsa, xrs700x
|
net: dsa: automatically bring up dsa master when opening user port
|
dsa wants the master interface to be open before the user port is due to historical reasons. the promiscuity of interfaces that are down used to have issues, as referenced lennert buytenhek in commit df02c6ff2e39 ("dsa: fix master interface allmulti/promisc handling").
|
this release allows to map an uid to a different one in a mount; it also adds support for selecting the preemption model at runtime; support for a low-overhead memory error detector designed to be used in production; support for the acrn hypervisor designed for embedded systems; btrfs initial support for zoned devices, subpage blocks sizes and performance improvements; support for eager nfs writes; support for a thermal power management to control the surface temperature of embedded devices in an unified way; the napi polling can be moved to a kernel thread; and support for non-blocking path lookups. as always, there are many other features, new drivers, improvements and fixes.
|
automatically bring up dsa master when opening user port
|
['core (various)', 'file systems', 'memory management', 'block layer', 'tracing, perf and bpf', 'virtualization', 'cryptography', 'security', 'networking', 'architectures x86 arm risc-v powerpc mips csky s390 pa-risc c6x']
|
['graphics', 'power management', 'storage', 'drivers in the staging area', 'networking', 'audio', 'tablets, touch screens, keyboards, mouses', 'tv tuners, webcams, video capturers', 'universal serial bus', 'serial peripheral interface (spi)', 'watchdog', 'serial', 'cpu frequency scaling', 'device voltage and frequency scaling', 'voltage, current regulators, power capping, power supply', 'real time clock (rtc)', 'pin controllers (pinctrl)', 'multi media card (mmc)', 'memory technology devices (mtd)', 'industrial i/o (iio)', 'multi function devices (mfd)', 'pulse-width modulation (pwm)', 'inter-integrated circuit (i2c + i3c)', 'hardware monitoring (hwmon)', 'general purpose i/o (gpio)', 'leds', 'dma engines', 'cryptography hardware acceleration', 'pci', 'non-transparent bridge (ntb)', 'thunderbolt', 'clock', 'phy ("physical layer" framework)', 'cxl (compute express link)', 'various']
|
['dsa ']
|
['c', 'rst']
| 2
| 5
| 6
|
--- diff --git a/documentation/networking/dsa/dsa.rst b/documentation/networking/dsa/dsa.rst --- a/documentation/networking/dsa/dsa.rst +++ b/documentation/networking/dsa/dsa.rst -slave network devices check that the master network device is up before allowing -you to administratively bring up these slave network devices. a common -configuration mistake is forgetting to bring up the master network device first. - diff --git a/net/dsa/slave.c b/net/dsa/slave.c --- a/net/dsa/slave.c +++ b/net/dsa/slave.c - if (!(master->flags & iff_up)) - return -enetdown; + err = dev_open(master, null); + if (err < 0) { + netdev_err(dev, "failed to open master %s ", master->name); + goto out; + }
|
Networking
|
9d5ef190e5615a7b63af89f88c4106a5bc127974
|
vladimir oltean
|
documentation
|
networking
|
dsa
|
net: dsa: b53: support setting learning on port
|
add support for being able to set the learning attribute on port, and make sure that the standalone ports start up with learning disabled.
|
this release allows to map an uid to a different one in a mount; it also adds support for selecting the preemption model at runtime; support for a low-overhead memory error detector designed to be used in production; support for the acrn hypervisor designed for embedded systems; btrfs initial support for zoned devices, subpage blocks sizes and performance improvements; support for eager nfs writes; support for a thermal power management to control the surface temperature of embedded devices in an unified way; the napi polling can be moved to a kernel thread; and support for non-blocking path lookups. as always, there are many other features, new drivers, improvements and fixes.
|
support setting learning on port
|
['core (various)', 'file systems', 'memory management', 'block layer', 'tracing, perf and bpf', 'virtualization', 'cryptography', 'security', 'networking', 'architectures x86 arm risc-v powerpc mips csky s390 pa-risc c6x']
|
['graphics', 'power management', 'storage', 'drivers in the staging area', 'networking', 'audio', 'tablets, touch screens, keyboards, mouses', 'tv tuners, webcams, video capturers', 'universal serial bus', 'serial peripheral interface (spi)', 'watchdog', 'serial', 'cpu frequency scaling', 'device voltage and frequency scaling', 'voltage, current regulators, power capping, power supply', 'real time clock (rtc)', 'pin controllers (pinctrl)', 'multi media card (mmc)', 'memory technology devices (mtd)', 'industrial i/o (iio)', 'multi function devices (mfd)', 'pulse-width modulation (pwm)', 'inter-integrated circuit (i2c + i3c)', 'hardware monitoring (hwmon)', 'general purpose i/o (gpio)', 'leds', 'dma engines', 'cryptography hardware acceleration', 'pci', 'non-transparent bridge (ntb)', 'thunderbolt', 'clock', 'phy ("physical layer" framework)', 'cxl (compute express link)', 'various']
|
['dsa ', 'b53']
|
['h', 'c']
| 3
| 21
| 15
|
--- diff --git a/drivers/net/dsa/b53/b53_common.c b/drivers/net/dsa/b53/b53_common.c --- a/drivers/net/dsa/b53/b53_common.c +++ b/drivers/net/dsa/b53/b53_common.c +static void b53_port_set_learning(struct b53_device *dev, int port, + bool learning) +{ + u16 reg; + + b53_read16(dev, b53_ctrl_page, b53_dis_learning, ®); + if (learning) + reg &= ~bit(port); + else + reg |= bit(port); + b53_write16(dev, b53_ctrl_page, b53_dis_learning, reg); +} + + b53_port_set_learning(dev, port, false); + b53_port_set_learning(dev, port, false); - if (flags.mask & ~(br_flood | br_mcast_flood)) + if (flags.mask & ~(br_flood | br_mcast_flood | br_learning)) + if (flags.mask & br_learning) + b53_port_set_learning(ds->priv, port, + !!(flags.val & br_learning)); diff --git a/drivers/net/dsa/b53/b53_regs.h b/drivers/net/dsa/b53/b53_regs.h --- a/drivers/net/dsa/b53/b53_regs.h +++ b/drivers/net/dsa/b53/b53_regs.h +#define b53_dis_learning 0x3c diff --git a/drivers/net/dsa/bcm_sf2.c b/drivers/net/dsa/bcm_sf2.c --- a/drivers/net/dsa/bcm_sf2.c +++ b/drivers/net/dsa/bcm_sf2.c - /* enable learning */ - reg = core_readl(priv, core_dis_learn); - reg &= ~bit(port); - core_writel(priv, reg, core_dis_learn); - - if (priv->brcm_tag_mask & bit(port)) { + if (priv->brcm_tag_mask & bit(port)) - /* disable learning on asp port */ - if (port == 7) { - reg = core_readl(priv, core_dis_learn); - reg |= bit(port); - core_writel(priv, reg, core_dis_learn); - } - } -
|
Networking
|
f9b3827ee66cfcf297d0acd6ecf33653a5f297ef
|
florian fainelli
|
drivers
|
net
|
b53, dsa
|
net: dsa: bcm_sf2: support bcm4908's integrated switch
|
bcm4908 family socs come with integrated starfighter 2 switch. its registers layout it a mix of bcm7278 and bcm7445. it has 5 integrated phys and 8 ports. it also supports rgmii and serdes.
|
this release allows to map an uid to a different one in a mount; it also adds support for selecting the preemption model at runtime; support for a low-overhead memory error detector designed to be used in production; support for the acrn hypervisor designed for embedded systems; btrfs initial support for zoned devices, subpage blocks sizes and performance improvements; support for eager nfs writes; support for a thermal power management to control the surface temperature of embedded devices in an unified way; the napi polling can be moved to a kernel thread; and support for non-blocking path lookups. as always, there are many other features, new drivers, improvements and fixes.
|
support bcm4908's integrated switch
|
['core (various)', 'file systems', 'memory management', 'block layer', 'tracing, perf and bpf', 'virtualization', 'cryptography', 'security', 'networking', 'architectures x86 arm risc-v powerpc mips csky s390 pa-risc c6x']
|
['graphics', 'power management', 'storage', 'drivers in the staging area', 'networking', 'audio', 'tablets, touch screens, keyboards, mouses', 'tv tuners, webcams, video capturers', 'universal serial bus', 'serial peripheral interface (spi)', 'watchdog', 'serial', 'cpu frequency scaling', 'device voltage and frequency scaling', 'voltage, current regulators, power capping, power supply', 'real time clock (rtc)', 'pin controllers (pinctrl)', 'multi media card (mmc)', 'memory technology devices (mtd)', 'industrial i/o (iio)', 'multi function devices (mfd)', 'pulse-width modulation (pwm)', 'inter-integrated circuit (i2c + i3c)', 'hardware monitoring (hwmon)', 'general purpose i/o (gpio)', 'leds', 'dma engines', 'cryptography hardware acceleration', 'pci', 'non-transparent bridge (ntb)', 'thunderbolt', 'clock', 'phy ("physical layer" framework)', 'cxl (compute express link)', 'various']
|
['dsa ', 'bcm_sf2']
|
['h', 'c']
| 4
| 49
| 3
|
--- diff --git a/drivers/net/dsa/b53/b53_common.c b/drivers/net/dsa/b53/b53_common.c --- a/drivers/net/dsa/b53/b53_common.c +++ b/drivers/net/dsa/b53/b53_common.c + /* starfighter 2 */ + { + .chip_id = bcm4908_device_id, + .dev_name = "bcm4908", + .vlans = 4096, + .enabled_ports = 0x1bf, + .arl_bins = 4, + .arl_buckets = 256, + .cpu_port = 8, /* todo: ports 4, 5, 8 */ + .vta_regs = b53_vta_regs, + .duplex_reg = b53_duplex_stat_ge, + .jumbo_pm_reg = b53_jumbo_port_mask, + .jumbo_size_reg = b53_jumbo_max_size, + }, diff --git a/drivers/net/dsa/b53/b53_priv.h b/drivers/net/dsa/b53/b53_priv.h --- a/drivers/net/dsa/b53/b53_priv.h +++ b/drivers/net/dsa/b53/b53_priv.h + bcm4908_device_id = 0x4908, diff --git a/drivers/net/dsa/bcm_sf2.c b/drivers/net/dsa/bcm_sf2.c --- a/drivers/net/dsa/bcm_sf2.c +++ b/drivers/net/dsa/bcm_sf2.c - if (priv->type == bcm7445_device_id) + if (priv->type == bcm4908_device_id || + priv->type == bcm7445_device_id) - if (priv->type == bcm7445_device_id) + if (priv->type == bcm4908_device_id || + priv->type == bcm7445_device_id) - if (priv->type == bcm7445_device_id) + if (priv->type == bcm4908_device_id || + priv->type == bcm7445_device_id) +static const u16 bcm_sf2_4908_reg_offsets[] = { + [reg_switch_cntrl] = 0x00, + [reg_switch_status] = 0x04, + [reg_dir_data_write] = 0x08, + [reg_dir_data_read] = 0x0c, + [reg_switch_revision] = 0x10, + [reg_phy_revision] = 0x14, + [reg_sphy_cntrl] = 0x24, + [reg_crossbar] = 0xc8, + [reg_rgmii_0_cntrl] = 0xe0, + [reg_rgmii_1_cntrl] = 0xec, + [reg_rgmii_2_cntrl] = 0xf8, + [reg_led_0_cntrl] = 0x40, + [reg_led_1_cntrl] = 0x4c, + [reg_led_2_cntrl] = 0x58, +}; + +static const struct bcm_sf2_of_data bcm_sf2_4908_data = { + .type = bcm4908_device_id, + .core_reg_align = 0, + .reg_offsets = bcm_sf2_4908_reg_offsets, + .num_cfp_rules = 0, /* fixme */ +}; + + { .compatible = "brcm,bcm4908-switch", + .data = &bcm_sf2_4908_data + }, diff --git a/drivers/net/dsa/bcm_sf2_regs.h b/drivers/net/dsa/bcm_sf2_regs.h --- a/drivers/net/dsa/bcm_sf2_regs.h +++ b/drivers/net/dsa/bcm_sf2_regs.h + reg_crossbar,
|
Networking
|
73b7a6047971aa6ce4a70fc4901964d14f077171
|
rafa mi ecki florian fainelli f fainelli gmail com
|
drivers
|
net
|
b53, dsa
|
net: dsa: tag_8021q: add helpers to deduce whether a vlan id is rx or tx vlan
|
the sja1105 implementation can be blind about this, but the felix driver doesn't do exactly what it's being told, so it needs to know whether it is a tx or an rx vlan, so it can install the appropriate type of tcam rule.
|
this release allows to map an uid to a different one in a mount; it also adds support for selecting the preemption model at runtime; support for a low-overhead memory error detector designed to be used in production; support for the acrn hypervisor designed for embedded systems; btrfs initial support for zoned devices, subpage blocks sizes and performance improvements; support for eager nfs writes; support for a thermal power management to control the surface temperature of embedded devices in an unified way; the napi polling can be moved to a kernel thread; and support for non-blocking path lookups. as always, there are many other features, new drivers, improvements and fixes.
|
tag_8021q for ocelot switches
|
['core (various)', 'file systems', 'memory management', 'block layer', 'tracing, perf and bpf', 'virtualization', 'cryptography', 'security', 'networking', 'architectures x86 arm risc-v powerpc mips csky s390 pa-risc c6x']
|
['graphics', 'power management', 'storage', 'drivers in the staging area', 'networking', 'audio', 'tablets, touch screens, keyboards, mouses', 'tv tuners, webcams, video capturers', 'universal serial bus', 'serial peripheral interface (spi)', 'watchdog', 'serial', 'cpu frequency scaling', 'device voltage and frequency scaling', 'voltage, current regulators, power capping, power supply', 'real time clock (rtc)', 'pin controllers (pinctrl)', 'multi media card (mmc)', 'memory technology devices (mtd)', 'industrial i/o (iio)', 'multi function devices (mfd)', 'pulse-width modulation (pwm)', 'inter-integrated circuit (i2c + i3c)', 'hardware monitoring (hwmon)', 'general purpose i/o (gpio)', 'leds', 'dma engines', 'cryptography hardware acceleration', 'pci', 'non-transparent bridge (ntb)', 'thunderbolt', 'clock', 'phy ("physical layer" framework)', 'cxl (compute express link)', 'various']
|
['dsa ']
|
['h', 'c']
| 2
| 27
| 2
|
--- diff --git a/include/linux/dsa/8021q.h b/include/linux/dsa/8021q.h --- a/include/linux/dsa/8021q.h +++ b/include/linux/dsa/8021q.h +bool vid_is_dsa_8021q_rxvlan(u16 vid); + +bool vid_is_dsa_8021q_txvlan(u16 vid); + +bool vid_is_dsa_8021q_rxvlan(u16 vid) +{ + return false; +} + +bool vid_is_dsa_8021q_txvlan(u16 vid) +{ + return false; +} + diff --git a/net/dsa/tag_8021q.c b/net/dsa/tag_8021q.c --- a/net/dsa/tag_8021q.c +++ b/net/dsa/tag_8021q.c +bool vid_is_dsa_8021q_rxvlan(u16 vid) +{ + return (vid & dsa_8021q_dir_mask) == dsa_8021q_dir_rx; +} +export_symbol_gpl(vid_is_dsa_8021q_rxvlan); + +bool vid_is_dsa_8021q_txvlan(u16 vid) +{ + return (vid & dsa_8021q_dir_mask) == dsa_8021q_dir_tx; +} +export_symbol_gpl(vid_is_dsa_8021q_txvlan); + - return ((vid & dsa_8021q_dir_mask) == dsa_8021q_dir_rx || - (vid & dsa_8021q_dir_mask) == dsa_8021q_dir_tx); + return vid_is_dsa_8021q_rxvlan(vid) || vid_is_dsa_8021q_txvlan(vid);
|
Networking
|
9c7caf28068421c9e0d1faea437e35e6b8983ac6
|
vladimir oltean florian fainelli f fainelli gmail com
|
include
|
linux
|
dsa
|
net: mscc: ocelot: export vcap structures to include/soc/mscc
|
the felix driver will need to preinstall some vcap filters for its tag_8021q implementation (outside of the tc-flower offload logic), so these need to be exported to the common includes.
|
this release allows to map an uid to a different one in a mount; it also adds support for selecting the preemption model at runtime; support for a low-overhead memory error detector designed to be used in production; support for the acrn hypervisor designed for embedded systems; btrfs initial support for zoned devices, subpage blocks sizes and performance improvements; support for eager nfs writes; support for a thermal power management to control the surface temperature of embedded devices in an unified way; the napi polling can be moved to a kernel thread; and support for non-blocking path lookups. as always, there are many other features, new drivers, improvements and fixes.
|
tag_8021q for ocelot switches
|
['core (various)', 'file systems', 'memory management', 'block layer', 'tracing, perf and bpf', 'virtualization', 'cryptography', 'security', 'networking', 'architectures x86 arm risc-v powerpc mips csky s390 pa-risc c6x']
|
['graphics', 'power management', 'storage', 'drivers in the staging area', 'networking', 'audio', 'tablets, touch screens, keyboards, mouses', 'tv tuners, webcams, video capturers', 'universal serial bus', 'serial peripheral interface (spi)', 'watchdog', 'serial', 'cpu frequency scaling', 'device voltage and frequency scaling', 'voltage, current regulators, power capping, power supply', 'real time clock (rtc)', 'pin controllers (pinctrl)', 'multi media card (mmc)', 'memory technology devices (mtd)', 'industrial i/o (iio)', 'multi function devices (mfd)', 'pulse-width modulation (pwm)', 'inter-integrated circuit (i2c + i3c)', 'hardware monitoring (hwmon)', 'general purpose i/o (gpio)', 'leds', 'dma engines', 'cryptography hardware acceleration', 'pci', 'non-transparent bridge (ntb)', 'thunderbolt', 'clock', 'phy ("physical layer" framework)', 'cxl (compute express link)', 'various']
|
['dsa ']
|
['h', 'c']
| 4
| 294
| 291
|
--- diff --git a/drivers/net/ethernet/mscc/ocelot_net.c b/drivers/net/ethernet/mscc/ocelot_net.c --- a/drivers/net/ethernet/mscc/ocelot_net.c +++ b/drivers/net/ethernet/mscc/ocelot_net.c +#include <net/pkt_cls.h> diff --git a/drivers/net/ethernet/mscc/ocelot_vcap.c b/drivers/net/ethernet/mscc/ocelot_vcap.c --- a/drivers/net/ethernet/mscc/ocelot_vcap.c +++ b/drivers/net/ethernet/mscc/ocelot_vcap.c +export_symbol(ocelot_vcap_filter_add); +export_symbol(ocelot_vcap_filter_del); diff --git a/drivers/net/ethernet/mscc/ocelot_vcap.h b/drivers/net/ethernet/mscc/ocelot_vcap.h --- a/drivers/net/ethernet/mscc/ocelot_vcap.h +++ b/drivers/net/ethernet/mscc/ocelot_vcap.h -#include "ocelot_police.h" -#include <net/sch_generic.h> -#include <net/pkt_cls.h> +#include <soc/mscc/ocelot_vcap.h> +#include <net/flow_offload.h> -struct ocelot_ipv4 { - u8 addr[4]; -}; - -enum ocelot_vcap_bit { - ocelot_vcap_bit_any, - ocelot_vcap_bit_0, - ocelot_vcap_bit_1 -}; - -struct ocelot_vcap_u8 { - u8 value[1]; - u8 mask[1]; -}; - -struct ocelot_vcap_u16 { - u8 value[2]; - u8 mask[2]; -}; - -struct ocelot_vcap_u24 { - u8 value[3]; - u8 mask[3]; -}; - -struct ocelot_vcap_u32 { - u8 value[4]; - u8 mask[4]; -}; - -struct ocelot_vcap_u40 { - u8 value[5]; - u8 mask[5]; -}; - -struct ocelot_vcap_u48 { - u8 value[6]; - u8 mask[6]; -}; - -struct ocelot_vcap_u64 { - u8 value[8]; - u8 mask[8]; -}; - -struct ocelot_vcap_u128 { - u8 value[16]; - u8 mask[16]; -}; - -struct ocelot_vcap_vid { - u16 value; - u16 mask; -}; - -struct ocelot_vcap_ipv4 { - struct ocelot_ipv4 value; - struct ocelot_ipv4 mask; -}; - -struct ocelot_vcap_udp_tcp { - u16 value; - u16 mask; -}; - -struct ocelot_vcap_port { - u8 value; - u8 mask; -}; - -enum ocelot_vcap_key_type { - ocelot_vcap_key_any, - ocelot_vcap_key_etype, - ocelot_vcap_key_llc, - ocelot_vcap_key_snap, - ocelot_vcap_key_arp, - ocelot_vcap_key_ipv4, - ocelot_vcap_key_ipv6 -}; - -struct ocelot_vcap_key_vlan { - struct ocelot_vcap_vid vid; /* vlan id (12 bit) */ - struct ocelot_vcap_u8 pcp; /* pcp (3 bit) */ - enum ocelot_vcap_bit dei; /* dei */ - enum ocelot_vcap_bit tagged; /* tagged/untagged frame */ -}; - -struct ocelot_vcap_key_etype { - struct ocelot_vcap_u48 dmac; - struct ocelot_vcap_u48 smac; - struct ocelot_vcap_u16 etype; - struct ocelot_vcap_u16 data; /* mac data */ -}; - -struct ocelot_vcap_key_llc { - struct ocelot_vcap_u48 dmac; - struct ocelot_vcap_u48 smac; - - /* llc header: dsap at byte 0, ssap at byte 1, control at byte 2 */ - struct ocelot_vcap_u32 llc; -}; - -struct ocelot_vcap_key_snap { - struct ocelot_vcap_u48 dmac; - struct ocelot_vcap_u48 smac; - - /* snap header: organization code at byte 0, type at byte 3 */ - struct ocelot_vcap_u40 snap; -}; - -struct ocelot_vcap_key_arp { - struct ocelot_vcap_u48 smac; - enum ocelot_vcap_bit arp; /* opcode arp/rarp */ - enum ocelot_vcap_bit req; /* opcode request/reply */ - enum ocelot_vcap_bit unknown; /* opcode unknown */ - enum ocelot_vcap_bit smac_match; /* sender mac matches smac */ - enum ocelot_vcap_bit dmac_match; /* target mac matches dmac */ - - /**< protocol addr. length 4, hardware length 6 */ - enum ocelot_vcap_bit length; - - enum ocelot_vcap_bit ip; /* protocol address type ip */ - enum ocelot_vcap_bit ethernet; /* hardware address type ethernet */ - struct ocelot_vcap_ipv4 sip; /* sender ip address */ - struct ocelot_vcap_ipv4 dip; /* target ip address */ -}; - -struct ocelot_vcap_key_ipv4 { - enum ocelot_vcap_bit ttl; /* ttl zero */ - enum ocelot_vcap_bit fragment; /* fragment */ - enum ocelot_vcap_bit options; /* header options */ - struct ocelot_vcap_u8 ds; - struct ocelot_vcap_u8 proto; /* protocol */ - struct ocelot_vcap_ipv4 sip; /* source ip address */ - struct ocelot_vcap_ipv4 dip; /* destination ip address */ - struct ocelot_vcap_u48 data; /* not udp/tcp: ip data */ - struct ocelot_vcap_udp_tcp sport; /* udp/tcp: source port */ - struct ocelot_vcap_udp_tcp dport; /* udp/tcp: destination port */ - enum ocelot_vcap_bit tcp_fin; - enum ocelot_vcap_bit tcp_syn; - enum ocelot_vcap_bit tcp_rst; - enum ocelot_vcap_bit tcp_psh; - enum ocelot_vcap_bit tcp_ack; - enum ocelot_vcap_bit tcp_urg; - enum ocelot_vcap_bit sip_eq_dip; /* sip equals dip */ - enum ocelot_vcap_bit sport_eq_dport; /* sport equals dport */ - enum ocelot_vcap_bit seq_zero; /* tcp sequence number is zero */ -}; - -struct ocelot_vcap_key_ipv6 { - struct ocelot_vcap_u8 proto; /* ipv6 protocol */ - struct ocelot_vcap_u128 sip; /* ipv6 source (byte 0-7 ignored) */ - struct ocelot_vcap_u128 dip; /* ipv6 destination (byte 0-7 ignored) */ - enum ocelot_vcap_bit ttl; /* ttl zero */ - struct ocelot_vcap_u8 ds; - struct ocelot_vcap_u48 data; /* not udp/tcp: ip data */ - struct ocelot_vcap_udp_tcp sport; - struct ocelot_vcap_udp_tcp dport; - enum ocelot_vcap_bit tcp_fin; - enum ocelot_vcap_bit tcp_syn; - enum ocelot_vcap_bit tcp_rst; - enum ocelot_vcap_bit tcp_psh; - enum ocelot_vcap_bit tcp_ack; - enum ocelot_vcap_bit tcp_urg; - enum ocelot_vcap_bit sip_eq_dip; /* sip equals dip */ - enum ocelot_vcap_bit sport_eq_dport; /* sport equals dport */ - enum ocelot_vcap_bit seq_zero; /* tcp sequence number is zero */ -}; - -enum ocelot_mask_mode { - ocelot_mask_mode_none, - ocelot_mask_mode_permit_deny, - ocelot_mask_mode_policy, - ocelot_mask_mode_redirect, -}; - -enum ocelot_es0_tag { - ocelot_no_es0_tag, - ocelot_es0_tag, - ocelot_force_port_tag, - ocelot_force_untag, -}; - -enum ocelot_tag_tpid_sel { - ocelot_tag_tpid_sel_8021q, - ocelot_tag_tpid_sel_8021ad, -}; - -struct ocelot_vcap_action { - union { - /* vcap es0 */ - struct { - enum ocelot_es0_tag push_outer_tag; - enum ocelot_es0_tag push_inner_tag; - enum ocelot_tag_tpid_sel tag_a_tpid_sel; - int tag_a_vid_sel; - int tag_a_pcp_sel; - u16 vid_a_val; - u8 pcp_a_val; - u8 dei_a_val; - enum ocelot_tag_tpid_sel tag_b_tpid_sel; - int tag_b_vid_sel; - int tag_b_pcp_sel; - u16 vid_b_val; - u8 pcp_b_val; - u8 dei_b_val; - }; - - /* vcap is1 */ - struct { - bool vid_replace_ena; - u16 vid; - bool vlan_pop_cnt_ena; - int vlan_pop_cnt; - bool pcp_dei_ena; - u8 pcp; - u8 dei; - bool qos_ena; - u8 qos_val; - u8 pag_override_mask; - u8 pag_val; - }; - - /* vcap is2 */ - struct { - bool cpu_copy_ena; - u8 cpu_qu_num; - enum ocelot_mask_mode mask_mode; - unsigned long port_mask; - bool police_ena; - struct ocelot_policer pol; - u32 pol_ix; - }; - }; -}; - -struct ocelot_vcap_stats { - u64 bytes; - u64 pkts; - u64 used; -}; - -enum ocelot_vcap_filter_type { - ocelot_vcap_filter_dummy, - ocelot_vcap_filter_pag, - ocelot_vcap_filter_offload, -}; - -struct ocelot_vcap_filter { - struct list_head list; - - enum ocelot_vcap_filter_type type; - int block_id; - int goto_target; - int lookup; - u8 pag; - u16 prio; - u32 id; - - struct ocelot_vcap_action action; - struct ocelot_vcap_stats stats; - /* for vcap is1 and is2 */ - unsigned long ingress_port_mask; - /* for vcap es0 */ - struct ocelot_vcap_port ingress_port; - struct ocelot_vcap_port egress_port; - - enum ocelot_vcap_bit dmac_mc; - enum ocelot_vcap_bit dmac_bc; - struct ocelot_vcap_key_vlan vlan; - - enum ocelot_vcap_key_type key_type; - union { - /* ocelot_vcap_key_any: no specific fields */ - struct ocelot_vcap_key_etype etype; - struct ocelot_vcap_key_llc llc; - struct ocelot_vcap_key_snap snap; - struct ocelot_vcap_key_arp arp; - struct ocelot_vcap_key_ipv4 ipv4; - struct ocelot_vcap_key_ipv6 ipv6; - } key; -}; - -int ocelot_vcap_filter_add(struct ocelot *ocelot, - struct ocelot_vcap_filter *rule, - struct netlink_ext_ack *extack); -int ocelot_vcap_filter_del(struct ocelot *ocelot, - struct ocelot_vcap_filter *rule); diff --git a/include/soc/mscc/ocelot_vcap.h b/include/soc/mscc/ocelot_vcap.h --- a/include/soc/mscc/ocelot_vcap.h +++ b/include/soc/mscc/ocelot_vcap.h +struct ocelot_ipv4 { + u8 addr[4]; +}; + +enum ocelot_vcap_bit { + ocelot_vcap_bit_any, + ocelot_vcap_bit_0, + ocelot_vcap_bit_1 +}; + +struct ocelot_vcap_u8 { + u8 value[1]; + u8 mask[1]; +}; + +struct ocelot_vcap_u16 { + u8 value[2]; + u8 mask[2]; +}; + +struct ocelot_vcap_u24 { + u8 value[3]; + u8 mask[3]; +}; + +struct ocelot_vcap_u32 { + u8 value[4]; + u8 mask[4]; +}; + +struct ocelot_vcap_u40 { + u8 value[5]; + u8 mask[5]; +}; + +struct ocelot_vcap_u48 { + u8 value[6]; + u8 mask[6]; +}; + +struct ocelot_vcap_u64 { + u8 value[8]; + u8 mask[8]; +}; + +struct ocelot_vcap_u128 { + u8 value[16]; + u8 mask[16]; +}; + +struct ocelot_vcap_vid { + u16 value; + u16 mask; +}; + +struct ocelot_vcap_ipv4 { + struct ocelot_ipv4 value; + struct ocelot_ipv4 mask; +}; + +struct ocelot_vcap_udp_tcp { + u16 value; + u16 mask; +}; + +struct ocelot_vcap_port { + u8 value; + u8 mask; +}; + +enum ocelot_vcap_key_type { + ocelot_vcap_key_any, + ocelot_vcap_key_etype, + ocelot_vcap_key_llc, + ocelot_vcap_key_snap, + ocelot_vcap_key_arp, + ocelot_vcap_key_ipv4, + ocelot_vcap_key_ipv6 +}; + +struct ocelot_vcap_key_vlan { + struct ocelot_vcap_vid vid; /* vlan id (12 bit) */ + struct ocelot_vcap_u8 pcp; /* pcp (3 bit) */ + enum ocelot_vcap_bit dei; /* dei */ + enum ocelot_vcap_bit tagged; /* tagged/untagged frame */ +}; + +struct ocelot_vcap_key_etype { + struct ocelot_vcap_u48 dmac; + struct ocelot_vcap_u48 smac; + struct ocelot_vcap_u16 etype; + struct ocelot_vcap_u16 data; /* mac data */ +}; + +struct ocelot_vcap_key_llc { + struct ocelot_vcap_u48 dmac; + struct ocelot_vcap_u48 smac; + + /* llc header: dsap at byte 0, ssap at byte 1, control at byte 2 */ + struct ocelot_vcap_u32 llc; +}; + +struct ocelot_vcap_key_snap { + struct ocelot_vcap_u48 dmac; + struct ocelot_vcap_u48 smac; + + /* snap header: organization code at byte 0, type at byte 3 */ + struct ocelot_vcap_u40 snap; +}; + +struct ocelot_vcap_key_arp { + struct ocelot_vcap_u48 smac; + enum ocelot_vcap_bit arp; /* opcode arp/rarp */ + enum ocelot_vcap_bit req; /* opcode request/reply */ + enum ocelot_vcap_bit unknown; /* opcode unknown */ + enum ocelot_vcap_bit smac_match; /* sender mac matches smac */ + enum ocelot_vcap_bit dmac_match; /* target mac matches dmac */ + + /**< protocol addr. length 4, hardware length 6 */ + enum ocelot_vcap_bit length; + + enum ocelot_vcap_bit ip; /* protocol address type ip */ + enum ocelot_vcap_bit ethernet; /* hardware address type ethernet */ + struct ocelot_vcap_ipv4 sip; /* sender ip address */ + struct ocelot_vcap_ipv4 dip; /* target ip address */ +}; + +struct ocelot_vcap_key_ipv4 { + enum ocelot_vcap_bit ttl; /* ttl zero */ + enum ocelot_vcap_bit fragment; /* fragment */ + enum ocelot_vcap_bit options; /* header options */ + struct ocelot_vcap_u8 ds; + struct ocelot_vcap_u8 proto; /* protocol */ + struct ocelot_vcap_ipv4 sip; /* source ip address */ + struct ocelot_vcap_ipv4 dip; /* destination ip address */ + struct ocelot_vcap_u48 data; /* not udp/tcp: ip data */ + struct ocelot_vcap_udp_tcp sport; /* udp/tcp: source port */ + struct ocelot_vcap_udp_tcp dport; /* udp/tcp: destination port */ + enum ocelot_vcap_bit tcp_fin; + enum ocelot_vcap_bit tcp_syn; + enum ocelot_vcap_bit tcp_rst; + enum ocelot_vcap_bit tcp_psh; + enum ocelot_vcap_bit tcp_ack; + enum ocelot_vcap_bit tcp_urg; + enum ocelot_vcap_bit sip_eq_dip; /* sip equals dip */ + enum ocelot_vcap_bit sport_eq_dport; /* sport equals dport */ + enum ocelot_vcap_bit seq_zero; /* tcp sequence number is zero */ +}; + +struct ocelot_vcap_key_ipv6 { + struct ocelot_vcap_u8 proto; /* ipv6 protocol */ + struct ocelot_vcap_u128 sip; /* ipv6 source (byte 0-7 ignored) */ + struct ocelot_vcap_u128 dip; /* ipv6 destination (byte 0-7 ignored) */ + enum ocelot_vcap_bit ttl; /* ttl zero */ + struct ocelot_vcap_u8 ds; + struct ocelot_vcap_u48 data; /* not udp/tcp: ip data */ + struct ocelot_vcap_udp_tcp sport; + struct ocelot_vcap_udp_tcp dport; + enum ocelot_vcap_bit tcp_fin; + enum ocelot_vcap_bit tcp_syn; + enum ocelot_vcap_bit tcp_rst; + enum ocelot_vcap_bit tcp_psh; + enum ocelot_vcap_bit tcp_ack; + enum ocelot_vcap_bit tcp_urg; + enum ocelot_vcap_bit sip_eq_dip; /* sip equals dip */ + enum ocelot_vcap_bit sport_eq_dport; /* sport equals dport */ + enum ocelot_vcap_bit seq_zero; /* tcp sequence number is zero */ +}; + +enum ocelot_mask_mode { + ocelot_mask_mode_none, + ocelot_mask_mode_permit_deny, + ocelot_mask_mode_policy, + ocelot_mask_mode_redirect, +}; + +enum ocelot_es0_tag { + ocelot_no_es0_tag, + ocelot_es0_tag, + ocelot_force_port_tag, + ocelot_force_untag, +}; + +enum ocelot_tag_tpid_sel { + ocelot_tag_tpid_sel_8021q, + ocelot_tag_tpid_sel_8021ad, +}; + +struct ocelot_vcap_action { + union { + /* vcap es0 */ + struct { + enum ocelot_es0_tag push_outer_tag; + enum ocelot_es0_tag push_inner_tag; + enum ocelot_tag_tpid_sel tag_a_tpid_sel; + int tag_a_vid_sel; + int tag_a_pcp_sel; + u16 vid_a_val; + u8 pcp_a_val; + u8 dei_a_val; + enum ocelot_tag_tpid_sel tag_b_tpid_sel; + int tag_b_vid_sel; + int tag_b_pcp_sel; + u16 vid_b_val; + u8 pcp_b_val; + u8 dei_b_val; + }; + + /* vcap is1 */ + struct { + bool vid_replace_ena; + u16 vid; + bool vlan_pop_cnt_ena; + int vlan_pop_cnt; + bool pcp_dei_ena; + u8 pcp; + u8 dei; + bool qos_ena; + u8 qos_val; + u8 pag_override_mask; + u8 pag_val; + }; + + /* vcap is2 */ + struct { + bool cpu_copy_ena; + u8 cpu_qu_num; + enum ocelot_mask_mode mask_mode; + unsigned long port_mask; + bool police_ena; + struct ocelot_policer pol; + u32 pol_ix; + }; + }; +}; + +struct ocelot_vcap_stats { + u64 bytes; + u64 pkts; + u64 used; +}; + +enum ocelot_vcap_filter_type { + ocelot_vcap_filter_dummy, + ocelot_vcap_filter_pag, + ocelot_vcap_filter_offload, +}; + +struct ocelot_vcap_filter { + struct list_head list; + + enum ocelot_vcap_filter_type type; + int block_id; + int goto_target; + int lookup; + u8 pag; + u16 prio; + u32 id; + + struct ocelot_vcap_action action; + struct ocelot_vcap_stats stats; + /* for vcap is1 and is2 */ + unsigned long ingress_port_mask; + /* for vcap es0 */ + struct ocelot_vcap_port ingress_port; + struct ocelot_vcap_port egress_port; + + enum ocelot_vcap_bit dmac_mc; + enum ocelot_vcap_bit dmac_bc; + struct ocelot_vcap_key_vlan vlan; + + enum ocelot_vcap_key_type key_type; + union { + /* ocelot_vcap_key_any: no specific fields */ + struct ocelot_vcap_key_etype etype; + struct ocelot_vcap_key_llc llc; + struct ocelot_vcap_key_snap snap; + struct ocelot_vcap_key_arp arp; + struct ocelot_vcap_key_ipv4 ipv4; + struct ocelot_vcap_key_ipv6 ipv6; + } key; +}; + +int ocelot_vcap_filter_add(struct ocelot *ocelot, + struct ocelot_vcap_filter *rule, + struct netlink_ext_ack *extack); +int ocelot_vcap_filter_del(struct ocelot *ocelot, + struct ocelot_vcap_filter *rule); +
|
Networking
|
0e9bb4e9d93f2711897b8e2a613899f7b8a15a3b
|
vladimir oltean florian fainelli f fainelli gmail com
|
include
|
soc
|
ethernet, mscc
|
net: mscc: ocelot: store a namespaced vcap filter id
|
we will be adding some private vcap filters that should not interfere in any way with the filters added using tc-flower. so we need to allocate some ids which will not be used by tc.
|
this release allows to map an uid to a different one in a mount; it also adds support for selecting the preemption model at runtime; support for a low-overhead memory error detector designed to be used in production; support for the acrn hypervisor designed for embedded systems; btrfs initial support for zoned devices, subpage blocks sizes and performance improvements; support for eager nfs writes; support for a thermal power management to control the surface temperature of embedded devices in an unified way; the napi polling can be moved to a kernel thread; and support for non-blocking path lookups. as always, there are many other features, new drivers, improvements and fixes.
|
tag_8021q for ocelot switches
|
['core (various)', 'file systems', 'memory management', 'block layer', 'tracing, perf and bpf', 'virtualization', 'cryptography', 'security', 'networking', 'architectures x86 arm risc-v powerpc mips csky s390 pa-risc c6x']
|
['graphics', 'power management', 'storage', 'drivers in the staging area', 'networking', 'audio', 'tablets, touch screens, keyboards, mouses', 'tv tuners, webcams, video capturers', 'universal serial bus', 'serial peripheral interface (spi)', 'watchdog', 'serial', 'cpu frequency scaling', 'device voltage and frequency scaling', 'voltage, current regulators, power capping, power supply', 'real time clock (rtc)', 'pin controllers (pinctrl)', 'multi media card (mmc)', 'memory technology devices (mtd)', 'industrial i/o (iio)', 'multi function devices (mfd)', 'pulse-width modulation (pwm)', 'inter-integrated circuit (i2c + i3c)', 'hardware monitoring (hwmon)', 'general purpose i/o (gpio)', 'leds', 'dma engines', 'cryptography hardware acceleration', 'pci', 'non-transparent bridge (ntb)', 'thunderbolt', 'clock', 'phy ("physical layer" framework)', 'cxl (compute express link)', 'various']
|
['dsa ']
|
['h', 'c']
| 4
| 24
| 9
|
--- diff --git a/drivers/net/ethernet/mscc/ocelot_flower.c b/drivers/net/ethernet/mscc/ocelot_flower.c --- a/drivers/net/ethernet/mscc/ocelot_flower.c +++ b/drivers/net/ethernet/mscc/ocelot_flower.c - filter->id = f->cookie; + filter->id.cookie = f->cookie; + filter->id.tc_offload = true; - filter = ocelot_vcap_block_find_filter_by_id(block, f->cookie); + filter = ocelot_vcap_block_find_filter_by_id(block, f->cookie, true); - filter = ocelot_vcap_block_find_filter_by_id(block, f->cookie); + filter = ocelot_vcap_block_find_filter_by_id(block, f->cookie, true); diff --git a/drivers/net/ethernet/mscc/ocelot_vcap.c b/drivers/net/ethernet/mscc/ocelot_vcap.c --- a/drivers/net/ethernet/mscc/ocelot_vcap.c +++ b/drivers/net/ethernet/mscc/ocelot_vcap.c +static bool ocelot_vcap_filter_equal(const struct ocelot_vcap_filter *a, + const struct ocelot_vcap_filter *b) +{ + return !memcmp(&a->id, &b->id, sizeof(struct ocelot_vcap_id)); +} + - if (filter->id == tmp->id) + if (ocelot_vcap_filter_equal(filter, tmp)) -ocelot_vcap_block_find_filter_by_id(struct ocelot_vcap_block *block, int id) +ocelot_vcap_block_find_filter_by_id(struct ocelot_vcap_block *block, int cookie, + bool tc_offload) - if (filter->id == id) + if (filter->id.tc_offload == tc_offload && + filter->id.cookie == cookie) - if (tmp->id == filter->id) { + if (ocelot_vcap_filter_equal(filter, tmp)) { diff --git a/drivers/net/ethernet/mscc/ocelot_vcap.h b/drivers/net/ethernet/mscc/ocelot_vcap.h --- a/drivers/net/ethernet/mscc/ocelot_vcap.h +++ b/drivers/net/ethernet/mscc/ocelot_vcap.h -ocelot_vcap_block_find_filter_by_id(struct ocelot_vcap_block *block, int id); +ocelot_vcap_block_find_filter_by_id(struct ocelot_vcap_block *block, int id, + bool tc_offload); diff --git a/include/soc/mscc/ocelot_vcap.h b/include/soc/mscc/ocelot_vcap.h --- a/include/soc/mscc/ocelot_vcap.h +++ b/include/soc/mscc/ocelot_vcap.h +struct ocelot_vcap_id { + unsigned long cookie; + bool tc_offload; +}; + - u32 id; + struct ocelot_vcap_id id;
|
Networking
|
50c6cc5b9283efdbf72162dee467bd68c7167807
|
vladimir oltean
|
include
|
soc
|
ethernet, mscc
|
net: mscc: ocelot: reapply bridge forwarding mask on bonding join/leave
|
applying the bridge forwarding mask currently is done only on the stp state changes for any port. but it depends on both stp state changes, and bonding interface state changes. export the bit that recalculates the forwarding mask so that it could be reused, and call it when a port starts and stops offloading a bonding interface.
|
this release allows to map an uid to a different one in a mount; it also adds support for selecting the preemption model at runtime; support for a low-overhead memory error detector designed to be used in production; support for the acrn hypervisor designed for embedded systems; btrfs initial support for zoned devices, subpage blocks sizes and performance improvements; support for eager nfs writes; support for a thermal power management to control the surface temperature of embedded devices in an unified way; the napi polling can be moved to a kernel thread; and support for non-blocking path lookups. as always, there are many other features, new drivers, improvements and fixes.
|
tag_8021q for ocelot switches
|
['core (various)', 'file systems', 'memory management', 'block layer', 'tracing, perf and bpf', 'virtualization', 'cryptography', 'security', 'networking', 'architectures x86 arm risc-v powerpc mips csky s390 pa-risc c6x']
|
['graphics', 'power management', 'storage', 'drivers in the staging area', 'networking', 'audio', 'tablets, touch screens, keyboards, mouses', 'tv tuners, webcams, video capturers', 'universal serial bus', 'serial peripheral interface (spi)', 'watchdog', 'serial', 'cpu frequency scaling', 'device voltage and frequency scaling', 'voltage, current regulators, power capping, power supply', 'real time clock (rtc)', 'pin controllers (pinctrl)', 'multi media card (mmc)', 'memory technology devices (mtd)', 'industrial i/o (iio)', 'multi function devices (mfd)', 'pulse-width modulation (pwm)', 'inter-integrated circuit (i2c + i3c)', 'hardware monitoring (hwmon)', 'general purpose i/o (gpio)', 'leds', 'dma engines', 'cryptography hardware acceleration', 'pci', 'non-transparent bridge (ntb)', 'thunderbolt', 'clock', 'phy ("physical layer" framework)', 'cxl (compute express link)', 'various']
|
['dsa ']
|
['c']
| 1
| 36
| 27
|
--- diff --git a/drivers/net/ethernet/mscc/ocelot.c b/drivers/net/ethernet/mscc/ocelot.c --- a/drivers/net/ethernet/mscc/ocelot.c +++ b/drivers/net/ethernet/mscc/ocelot.c +static void ocelot_apply_bridge_fwd_mask(struct ocelot *ocelot) +{ + int port; + + /* apply fwd mask. the loop is needed to add/remove the current port as + * a source for the other ports. + */ + for (port = 0; port < ocelot->num_phys_ports; port++) { + if (ocelot->bridge_fwd_mask & bit(port)) { + unsigned long mask = ocelot->bridge_fwd_mask & ~bit(port); + int lag; + + for (lag = 0; lag < ocelot->num_phys_ports; lag++) { + unsigned long bond_mask = ocelot->lags[lag]; + + if (!bond_mask) + continue; + + if (bond_mask & bit(port)) { + mask &= ~bond_mask; + break; + } + } + + ocelot_write_rix(ocelot, mask, + ana_pgid_pgid, pgid_src + port); + } else { + ocelot_write_rix(ocelot, 0, + ana_pgid_pgid, pgid_src + port); + } + } +} + - int p, i; - /* apply fwd mask. the loop is needed to add/remove the current port as - * a source for the other ports. - */ - for (p = 0; p < ocelot->num_phys_ports; p++) { - if (ocelot->bridge_fwd_mask & bit(p)) { - unsigned long mask = ocelot->bridge_fwd_mask & ~bit(p); - - for (i = 0; i < ocelot->num_phys_ports; i++) { - unsigned long bond_mask = ocelot->lags[i]; - - if (!bond_mask) - continue; - - if (bond_mask & bit(p)) { - mask &= ~bond_mask; - break; - } - } - - ocelot_write_rix(ocelot, mask, - ana_pgid_pgid, pgid_src + p); - } else { - ocelot_write_rix(ocelot, 0, - ana_pgid_pgid, pgid_src + p); - } - } + ocelot_apply_bridge_fwd_mask(ocelot); + ocelot_apply_bridge_fwd_mask(ocelot); + ocelot_apply_bridge_fwd_mask(ocelot);
|
Networking
|
9b521250bff4dd04592651bb8fab07ecfcd2fb64
|
vladimir oltean
|
drivers
|
net
|
ethernet, mscc
|
net: mscc: ocelot: don't use npi tag prefix for the cpu port module
|
context: ocelot switches put the injection/extraction frame header in front of the ethernet header. when used in npi mode, a dsa master would see junk instead of the destination mac address, and it would most likely drop the packets. so the ocelot frame header can have an optional prefix, which is just "ff:ff:ff:ff:ff:fe > ff:ff:ff:ff:ff:ff" padding put before the actual tag (still before the real ethernet header) such that the dsa master thinks it's looking at a broadcast frame with a strange ethertype.
|
this release allows to map an uid to a different one in a mount; it also adds support for selecting the preemption model at runtime; support for a low-overhead memory error detector designed to be used in production; support for the acrn hypervisor designed for embedded systems; btrfs initial support for zoned devices, subpage blocks sizes and performance improvements; support for eager nfs writes; support for a thermal power management to control the surface temperature of embedded devices in an unified way; the napi polling can be moved to a kernel thread; and support for non-blocking path lookups. as always, there are many other features, new drivers, improvements and fixes.
|
tag_8021q for ocelot switches
|
['core (various)', 'file systems', 'memory management', 'block layer', 'tracing, perf and bpf', 'virtualization', 'cryptography', 'security', 'networking', 'architectures x86 arm risc-v powerpc mips csky s390 pa-risc c6x']
|
['graphics', 'power management', 'storage', 'drivers in the staging area', 'networking', 'audio', 'tablets, touch screens, keyboards, mouses', 'tv tuners, webcams, video capturers', 'universal serial bus', 'serial peripheral interface (spi)', 'watchdog', 'serial', 'cpu frequency scaling', 'device voltage and frequency scaling', 'voltage, current regulators, power capping, power supply', 'real time clock (rtc)', 'pin controllers (pinctrl)', 'multi media card (mmc)', 'memory technology devices (mtd)', 'industrial i/o (iio)', 'multi function devices (mfd)', 'pulse-width modulation (pwm)', 'inter-integrated circuit (i2c + i3c)', 'hardware monitoring (hwmon)', 'general purpose i/o (gpio)', 'leds', 'dma engines', 'cryptography hardware acceleration', 'pci', 'non-transparent bridge (ntb)', 'thunderbolt', 'clock', 'phy ("physical layer" framework)', 'cxl (compute express link)', 'various']
|
['dsa ']
|
['h', 'c']
| 4
| 12
| 14
|
--- diff --git a/drivers/net/dsa/ocelot/felix.c b/drivers/net/dsa/ocelot/felix.c --- a/drivers/net/dsa/ocelot/felix.c +++ b/drivers/net/dsa/ocelot/felix.c - ocelot->inj_prefix = ocelot_tag_prefix_short; - ocelot->xtr_prefix = ocelot_tag_prefix_short; + ocelot->npi_inj_prefix = ocelot_tag_prefix_short; + ocelot->npi_xtr_prefix = ocelot_tag_prefix_short; - ocelot->xtr_prefix); + ocelot->npi_xtr_prefix); - ocelot->inj_prefix); + ocelot->npi_inj_prefix); diff --git a/drivers/net/ethernet/mscc/ocelot.c b/drivers/net/ethernet/mscc/ocelot.c --- a/drivers/net/ethernet/mscc/ocelot.c +++ b/drivers/net/ethernet/mscc/ocelot.c - if (ocelot->inj_prefix == ocelot_tag_prefix_short) + if (ocelot->npi_inj_prefix == ocelot_tag_prefix_short) - else if (ocelot->inj_prefix == ocelot_tag_prefix_long) + else if (ocelot->npi_inj_prefix == ocelot_tag_prefix_long) - if (ocelot->inj_prefix == ocelot_tag_prefix_short) + if (ocelot->npi_inj_prefix == ocelot_tag_prefix_short) - else if (ocelot->inj_prefix == ocelot_tag_prefix_long) + else if (ocelot->npi_inj_prefix == ocelot_tag_prefix_long) - ocelot->xtr_prefix); + ocelot_tag_prefix_none); - ocelot->inj_prefix); + ocelot_tag_prefix_none); diff --git a/drivers/net/ethernet/mscc/ocelot_vsc7514.c b/drivers/net/ethernet/mscc/ocelot_vsc7514.c --- a/drivers/net/ethernet/mscc/ocelot_vsc7514.c +++ b/drivers/net/ethernet/mscc/ocelot_vsc7514.c - ocelot->inj_prefix = ocelot_tag_prefix_none; - ocelot->xtr_prefix = ocelot_tag_prefix_none; diff --git a/include/soc/mscc/ocelot.h b/include/soc/mscc/ocelot.h --- a/include/soc/mscc/ocelot.h +++ b/include/soc/mscc/ocelot.h - enum ocelot_tag_prefix inj_prefix; - enum ocelot_tag_prefix xtr_prefix; + enum ocelot_tag_prefix npi_inj_prefix; + enum ocelot_tag_prefix npi_xtr_prefix;
|
Networking
|
cacea62fcdda5656cb5b8104e73a00e043b61730
|
vladimir oltean
|
include
|
soc
|
dsa, ethernet, mscc, ocelot
|
net: dsa: document the existing switch tree notifiers and add a new one
|
the existence of dsa_broadcast has generated some confusion in the past: https://www.mail-archive.com/netdev@vger.kernel.org/msg365042.html
|
this release allows to map an uid to a different one in a mount; it also adds support for selecting the preemption model at runtime; support for a low-overhead memory error detector designed to be used in production; support for the acrn hypervisor designed for embedded systems; btrfs initial support for zoned devices, subpage blocks sizes and performance improvements; support for eager nfs writes; support for a thermal power management to control the surface temperature of embedded devices in an unified way; the napi polling can be moved to a kernel thread; and support for non-blocking path lookups. as always, there are many other features, new drivers, improvements and fixes.
|
tag_8021q for ocelot switches
|
['core (various)', 'file systems', 'memory management', 'block layer', 'tracing, perf and bpf', 'virtualization', 'cryptography', 'security', 'networking', 'architectures x86 arm risc-v powerpc mips csky s390 pa-risc c6x']
|
['graphics', 'power management', 'storage', 'drivers in the staging area', 'networking', 'audio', 'tablets, touch screens, keyboards, mouses', 'tv tuners, webcams, video capturers', 'universal serial bus', 'serial peripheral interface (spi)', 'watchdog', 'serial', 'cpu frequency scaling', 'device voltage and frequency scaling', 'voltage, current regulators, power capping, power supply', 'real time clock (rtc)', 'pin controllers (pinctrl)', 'multi media card (mmc)', 'memory technology devices (mtd)', 'industrial i/o (iio)', 'multi function devices (mfd)', 'pulse-width modulation (pwm)', 'inter-integrated circuit (i2c + i3c)', 'hardware monitoring (hwmon)', 'general purpose i/o (gpio)', 'leds', 'dma engines', 'cryptography hardware acceleration', 'pci', 'non-transparent bridge (ntb)', 'thunderbolt', 'clock', 'phy ("physical layer" framework)', 'cxl (compute express link)', 'various']
|
['dsa ']
|
['h', 'c']
| 3
| 58
| 23
|
--- diff --git a/net/dsa/dsa2.c b/net/dsa/dsa2.c --- a/net/dsa/dsa2.c +++ b/net/dsa/dsa2.c +/** + * dsa_tree_notify - execute code for all switches in a dsa switch tree. + * @dst: collection of struct dsa_switch devices to notify. + * @e: event, must be of type dsa_notifier_* + * @v: event-specific value. + * + * given a struct dsa_switch_tree, this can be used to run a function once for + * each member dsa switch. the other alternative of traversing the tree is only + * through its ports list, which does not uniquely list the switches. + */ +int dsa_tree_notify(struct dsa_switch_tree *dst, unsigned long e, void *v) +{ + struct raw_notifier_head *nh = &dst->nh; + int err; + + err = raw_notifier_call_chain(nh, e, v); + + return notifier_to_errno(err); +} + +/** + * dsa_broadcast - notify all dsa trees in the system. + * @e: event, must be of type dsa_notifier_* + * @v: event-specific value. + * + * can be used to notify the switching fabric of events such as cross-chip + * bridging between disjoint trees (such as islands of tagger-compatible + * switches bridged by an incompatible middle switch). + */ +int dsa_broadcast(unsigned long e, void *v) +{ + struct dsa_switch_tree *dst; + int err = 0; + + list_for_each_entry(dst, &dsa_tree_list, list) { + err = dsa_tree_notify(dst, e, v); + if (err) + break; + } + + return err; +} + diff --git a/net/dsa/dsa_priv.h b/net/dsa/dsa_priv.h --- a/net/dsa/dsa_priv.h +++ b/net/dsa/dsa_priv.h +int dsa_tree_notify(struct dsa_switch_tree *dst, unsigned long e, void *v); +int dsa_broadcast(unsigned long e, void *v); diff --git a/net/dsa/port.c b/net/dsa/port.c --- a/net/dsa/port.c +++ b/net/dsa/port.c -static int dsa_broadcast(unsigned long e, void *v) -{ - struct dsa_switch_tree *dst; - int err = 0; - - list_for_each_entry(dst, &dsa_tree_list, list) { - struct raw_notifier_head *nh = &dst->nh; - - err = raw_notifier_call_chain(nh, e, v); - err = notifier_to_errno(err); - if (err) - break; - } - - return err; -} - +/** + * dsa_port_notify - notify the switching fabric of changes to a port + * @dp: port on which change occurred + * @e: event, must be of type dsa_notifier_* + * @v: event-specific value. + * + * notify all switches in the dsa tree that this port's switch belongs to, + * including this switch itself, of an event. allows the other switches to + * reconfigure themselves for cross-chip operations. can also be used to + * reconfigure ports without net_devices (cpu ports, dsa links) whenever + * a user port's state changes. + */ - struct raw_notifier_head *nh = &dp->ds->dst->nh; - int err; - - err = raw_notifier_call_chain(nh, e, v); - - return notifier_to_errno(err); + return dsa_tree_notify(dp->ds->dst, e, v);
|
Networking
|
886f8e26f5397827f031bce48f3138040d88ffb3
|
vladimir oltean
|
net
|
dsa
| |
net: dsa: keep a copy of the tagging protocol in the dsa switch tree
|
cascading dsa switches can be done multiple ways. there is the brute force approach / tag stacking, where one upstream switch, located between leaf switches and the host ethernet controller, will just happily transport the dsa header of those leaf switches as payload. for this kind of setups, dsa works without any special kind of treatment compared to a single switch - they just aren't aware of each other. then there's the approach where the upstream switch understands the tags it transports from its leaves below, as it doesn't push a tag of its own, but it routes based on the source port & switch id information present in that tag (as opposed to dmac & vid) and it strips the tag when egressing a front-facing port. currently only marvell implements the latter, and marvell dsa trees contain only marvell switches.
|
this release allows to map an uid to a different one in a mount; it also adds support for selecting the preemption model at runtime; support for a low-overhead memory error detector designed to be used in production; support for the acrn hypervisor designed for embedded systems; btrfs initial support for zoned devices, subpage blocks sizes and performance improvements; support for eager nfs writes; support for a thermal power management to control the surface temperature of embedded devices in an unified way; the napi polling can be moved to a kernel thread; and support for non-blocking path lookups. as always, there are many other features, new drivers, improvements and fixes.
|
tag_8021q for ocelot switches
|
['core (various)', 'file systems', 'memory management', 'block layer', 'tracing, perf and bpf', 'virtualization', 'cryptography', 'security', 'networking', 'architectures x86 arm risc-v powerpc mips csky s390 pa-risc c6x']
|
['graphics', 'power management', 'storage', 'drivers in the staging area', 'networking', 'audio', 'tablets, touch screens, keyboards, mouses', 'tv tuners, webcams, video capturers', 'universal serial bus', 'serial peripheral interface (spi)', 'watchdog', 'serial', 'cpu frequency scaling', 'device voltage and frequency scaling', 'voltage, current regulators, power capping, power supply', 'real time clock (rtc)', 'pin controllers (pinctrl)', 'multi media card (mmc)', 'memory technology devices (mtd)', 'industrial i/o (iio)', 'multi function devices (mfd)', 'pulse-width modulation (pwm)', 'inter-integrated circuit (i2c + i3c)', 'hardware monitoring (hwmon)', 'general purpose i/o (gpio)', 'leds', 'dma engines', 'cryptography hardware acceleration', 'pci', 'non-transparent bridge (ntb)', 'thunderbolt', 'clock', 'phy ("physical layer" framework)', 'cxl (compute express link)', 'various']
|
['dsa ']
|
['h', 'c']
| 2
| 30
| 13
|
--- diff --git a/include/net/dsa.h b/include/net/dsa.h --- a/include/net/dsa.h +++ b/include/net/dsa.h + /* tagging protocol operations */ + const struct dsa_device_ops *tag_ops; + - /* cpu port tagging operations used by master or slave devices */ + /* copy of the tagging protocol operations, for quicker access + * in the data path. valid only for the cpu ports. + */ diff --git a/net/dsa/dsa2.c b/net/dsa/dsa2.c --- a/net/dsa/dsa2.c +++ b/net/dsa/dsa2.c + if (dst->tag_ops) + dsa_tag_driver_put(dst->tag_ops); - dsa_tag_driver_put(dp->tag_ops); - const struct dsa_device_ops *tag_ops; - tag_ops = dsa_tag_driver_get(tag_protocol); - if (is_err(tag_ops)) { - if (ptr_err(tag_ops) == -enoprotoopt) - return -eprobe_defer; - dev_warn(ds->dev, "no tagger for this switch "); - dp->master = null; - return ptr_err(tag_ops); + if (dst->tag_ops) { + if (dst->tag_ops->proto != tag_protocol) { + dev_err(ds->dev, + "a dsa switch tree can have only one tagging protocol "); + return -einval; + } + /* in the case of multiple cpu ports per switch, the tagging + * protocol is still reference-counted only per switch tree, so + * nothing to do here. + */ + } else { + dst->tag_ops = dsa_tag_driver_get(tag_protocol); + if (is_err(dst->tag_ops)) { + if (ptr_err(dst->tag_ops) == -enoprotoopt) + return -eprobe_defer; + dev_warn(ds->dev, "no tagger for this switch "); + dp->master = null; + return ptr_err(dst->tag_ops); + } - dp->filter = tag_ops->filter; - dp->rcv = tag_ops->rcv; - dp->tag_ops = tag_ops; + dp->filter = dst->tag_ops->filter; + dp->rcv = dst->tag_ops->rcv; + dp->tag_ops = dst->tag_ops;
|
Networking
|
357f203bb3b529fa7471494c7ad6a7a54d070353
|
vladimir oltean
|
include
|
net
| |
net: dsa: allow changing the tag protocol via the "tagging" device attribute
|
currently dsa exposes the following sysfs: $ cat /sys/class/net/eno2/dsa/tagging ocelot
|
this release allows to map an uid to a different one in a mount; it also adds support for selecting the preemption model at runtime; support for a low-overhead memory error detector designed to be used in production; support for the acrn hypervisor designed for embedded systems; btrfs initial support for zoned devices, subpage blocks sizes and performance improvements; support for eager nfs writes; support for a thermal power management to control the surface temperature of embedded devices in an unified way; the napi polling can be moved to a kernel thread; and support for non-blocking path lookups. as always, there are many other features, new drivers, improvements and fixes.
|
tag_8021q for ocelot switches
|
['core (various)', 'file systems', 'memory management', 'block layer', 'tracing, perf and bpf', 'virtualization', 'cryptography', 'security', 'networking', 'architectures x86 arm risc-v powerpc mips csky s390 pa-risc c6x']
|
['graphics', 'power management', 'storage', 'drivers in the staging area', 'networking', 'audio', 'tablets, touch screens, keyboards, mouses', 'tv tuners, webcams, video capturers', 'universal serial bus', 'serial peripheral interface (spi)', 'watchdog', 'serial', 'cpu frequency scaling', 'device voltage and frequency scaling', 'voltage, current regulators, power capping, power supply', 'real time clock (rtc)', 'pin controllers (pinctrl)', 'multi media card (mmc)', 'memory technology devices (mtd)', 'industrial i/o (iio)', 'multi function devices (mfd)', 'pulse-width modulation (pwm)', 'inter-integrated circuit (i2c + i3c)', 'hardware monitoring (hwmon)', 'general purpose i/o (gpio)', 'leds', 'dma engines', 'cryptography hardware acceleration', 'pci', 'non-transparent bridge (ntb)', 'thunderbolt', 'clock', 'phy ("physical layer" framework)', 'cxl (compute express link)', 'various']
|
['dsa ']
|
['h', 'sysfs-class-net-dsa', 'c']
| 9
| 235
| 18
|
- the .get_tag_protocol is currently only called at probe time, to load - the driver should manage by itself the initial setup of tagging - 10.0.0.1 ping statistics - --- diff --git a/documentation/abi/testing/sysfs-class-net-dsa b/documentation/abi/testing/sysfs-class-net-dsa --- a/documentation/abi/testing/sysfs-class-net-dsa +++ b/documentation/abi/testing/sysfs-class-net-dsa - string indicating the type of tagging protocol used by the - dsa slave network device. + on read, this file returns a string indicating the type of + tagging protocol used by the dsa network devices that are + attached to this master interface. + on write, this file changes the tagging protocol of the + attached dsa switches, if this operation is supported by the + driver. changing the tagging protocol must be done with the dsa + interfaces and the master interface all administratively down. + see the "name" field of each registered struct dsa_device_ops + for a list of valid values. diff --git a/include/net/dsa.h b/include/net/dsa.h --- a/include/net/dsa.h +++ b/include/net/dsa.h + /* + * tagging protocol helpers called for the cpu ports and dsa links. + * @get_tag_protocol retrieves the initial tagging protocol and is + * mandatory. switches which can operate using multiple tagging + * protocols should implement @change_tag_protocol and report in + * @get_tag_protocol the tagger in current use. + */ + int (*change_tag_protocol)(struct dsa_switch *ds, int port, + enum dsa_tag_protocol proto); diff --git a/net/dsa/dsa.c b/net/dsa/dsa.c --- a/net/dsa/dsa.c +++ b/net/dsa/dsa.c +/* function takes a reference on the module owning the tagger, + * so dsa_tag_driver_put must be called afterwards. + */ +const struct dsa_device_ops *dsa_find_tagger_by_name(const char *buf) +{ + const struct dsa_device_ops *ops = err_ptr(-enoprotoopt); + struct dsa_tag_driver *dsa_tag_driver; + + mutex_lock(&dsa_tag_drivers_lock); + list_for_each_entry(dsa_tag_driver, &dsa_tag_drivers_list, list) { + const struct dsa_device_ops *tmp = dsa_tag_driver->ops; + + if (!sysfs_streq(buf, tmp->name)) + continue; + + if (!try_module_get(dsa_tag_driver->owner)) + break; + + ops = tmp; + break; + } + mutex_unlock(&dsa_tag_drivers_lock); + + return ops; +} + diff --git a/net/dsa/dsa2.c b/net/dsa/dsa2.c --- a/net/dsa/dsa2.c +++ b/net/dsa/dsa2.c +/* since the dsa/tagging sysfs device attribute is per master, the assumption + * is that all dsa switches within a tree share the same tagger, otherwise + * they would have formed disjoint trees (different "dsa,member" values). + */ +int dsa_tree_change_tag_proto(struct dsa_switch_tree *dst, + struct net_device *master, + const struct dsa_device_ops *tag_ops, + const struct dsa_device_ops *old_tag_ops) +{ + struct dsa_notifier_tag_proto_info info; + struct dsa_port *dp; + int err = -ebusy; + + if (!rtnl_trylock()) + return restart_syscall(); + + /* at the moment we don't allow changing the tag protocol under + * traffic. the rtnl_mutex also happens to serialize concurrent + * attempts to change the tagging protocol. if we ever lift the iff_up + * restriction, there needs to be another mutex which serializes this. + */ + if (master->flags & iff_up) + goto out_unlock; + + list_for_each_entry(dp, &dst->ports, list) { + if (!dsa_is_user_port(dp->ds, dp->index)) + continue; + + if (dp->slave->flags & iff_up) + goto out_unlock; + } + + info.tag_ops = tag_ops; + err = dsa_tree_notify(dst, dsa_notifier_tag_proto, &info); + if (err) + goto out_unwind_tagger; + + dst->tag_ops = tag_ops; + + rtnl_unlock(); + + return 0; + +out_unwind_tagger: + info.tag_ops = old_tag_ops; + dsa_tree_notify(dst, dsa_notifier_tag_proto, &info); +out_unlock: + rtnl_unlock(); + return err; +} + - dp->filter = dst->tag_ops->filter; - dp->rcv = dst->tag_ops->rcv; - dp->tag_ops = dst->tag_ops; + dsa_port_set_tag_protocol(dp, dst->tag_ops); diff --git a/net/dsa/dsa_priv.h b/net/dsa/dsa_priv.h --- a/net/dsa/dsa_priv.h +++ b/net/dsa/dsa_priv.h + dsa_notifier_tag_proto, +/* dsa_notifier_tag_proto_* */ +struct dsa_notifier_tag_proto_info { + const struct dsa_device_ops *tag_ops; +}; + +const struct dsa_device_ops *dsa_find_tagger_by_name(const char *buf); +void dsa_port_set_tag_protocol(struct dsa_port *cpu_dp, + const struct dsa_device_ops *tag_ops); +void dsa_slave_setup_tagger(struct net_device *slave); +int dsa_slave_change_mtu(struct net_device *dev, int new_mtu); +int dsa_tree_change_tag_proto(struct dsa_switch_tree *dst, + struct net_device *master, + const struct dsa_device_ops *tag_ops, + const struct dsa_device_ops *old_tag_ops); diff --git a/net/dsa/master.c b/net/dsa/master.c --- a/net/dsa/master.c +++ b/net/dsa/master.c -static device_attr_ro(tagging); + +static ssize_t tagging_store(struct device *d, struct device_attribute *attr, + const char *buf, size_t count) +{ + const struct dsa_device_ops *new_tag_ops, *old_tag_ops; + struct net_device *dev = to_net_dev(d); + struct dsa_port *cpu_dp = dev->dsa_ptr; + int err; + + old_tag_ops = cpu_dp->tag_ops; + new_tag_ops = dsa_find_tagger_by_name(buf); + /* bad tagger name, or module is not loaded? */ + if (is_err(new_tag_ops)) + return ptr_err(new_tag_ops); + + if (new_tag_ops == old_tag_ops) + /* drop the temporarily held duplicate reference, since + * the dsa switch tree uses this tagger. + */ + goto out; + + err = dsa_tree_change_tag_proto(cpu_dp->ds->dst, dev, new_tag_ops, + old_tag_ops); + if (err) { + /* on failure the old tagger is restored, so we don't need the + * driver for the new one. + */ + dsa_tag_driver_put(new_tag_ops); + return err; + } + + /* on success we no longer need the module for the old tagging protocol + */ +out: + dsa_tag_driver_put(old_tag_ops); + return count; +} +static device_attr_rw(tagging); diff --git a/net/dsa/port.c b/net/dsa/port.c --- a/net/dsa/port.c +++ b/net/dsa/port.c +void dsa_port_set_tag_protocol(struct dsa_port *cpu_dp, + const struct dsa_device_ops *tag_ops) +{ + cpu_dp->filter = tag_ops->filter; + cpu_dp->rcv = tag_ops->rcv; + cpu_dp->tag_ops = tag_ops; +} + diff --git a/net/dsa/slave.c b/net/dsa/slave.c --- a/net/dsa/slave.c +++ b/net/dsa/slave.c -static int dsa_slave_change_mtu(struct net_device *dev, int new_mtu) +int dsa_slave_change_mtu(struct net_device *dev, int new_mtu) +void dsa_slave_setup_tagger(struct net_device *slave) +{ + struct dsa_port *dp = dsa_slave_to_port(slave); + struct dsa_slave_priv *p = netdev_priv(slave); + const struct dsa_port *cpu_dp = dp->cpu_dp; + struct net_device *master = cpu_dp->master; + + if (cpu_dp->tag_ops->tail_tag) + slave->needed_tailroom = cpu_dp->tag_ops->overhead; + else + slave->needed_headroom = cpu_dp->tag_ops->overhead; + /* try to save one extra realloc later in the tx path (in the master) + * by also inheriting the master's needed headroom and tailroom. + * the 8021q driver also does this. + */ + slave->needed_headroom += master->needed_headroom; + slave->needed_tailroom += master->needed_tailroom; + + p->xmit = cpu_dp->tag_ops->xmit; +} + - if (cpu_dp->tag_ops->tail_tag) - slave_dev->needed_tailroom = cpu_dp->tag_ops->overhead; - else - slave_dev->needed_headroom = cpu_dp->tag_ops->overhead; - /* try to save one extra realloc later in the tx path (in the master) - * by also inheriting the master's needed headroom and tailroom. - * the 8021q driver also does this. - */ - slave_dev->needed_headroom += master->needed_headroom; - slave_dev->needed_tailroom += master->needed_tailroom; - p->xmit = cpu_dp->tag_ops->xmit; + dsa_slave_setup_tagger(slave_dev); diff --git a/net/dsa/switch.c b/net/dsa/switch.c --- a/net/dsa/switch.c +++ b/net/dsa/switch.c +static bool dsa_switch_tag_proto_match(struct dsa_switch *ds, int port, + struct dsa_notifier_tag_proto_info *info) +{ + if (dsa_is_cpu_port(ds, port) || dsa_is_dsa_port(ds, port)) + return true; + + return false; +} + +static int dsa_switch_change_tag_proto(struct dsa_switch *ds, + struct dsa_notifier_tag_proto_info *info) +{ + const struct dsa_device_ops *tag_ops = info->tag_ops; + int port, err; + + if (!ds->ops->change_tag_protocol) + return -eopnotsupp; + + assert_rtnl(); + + for (port = 0; port < ds->num_ports; port++) { + if (dsa_switch_tag_proto_match(ds, port, info)) { + err = ds->ops->change_tag_protocol(ds, port, + tag_ops->proto); + if (err) + return err; + + if (dsa_is_cpu_port(ds, port)) + dsa_port_set_tag_protocol(dsa_to_port(ds, port), + tag_ops); + } + } + + /* now that changing the tag protocol can no longer fail, let's update + * the remaining bits which are "duplicated for faster access", and the + * bits that depend on the tagger, such as the mtu. + */ + for (port = 0; port < ds->num_ports; port++) { + if (dsa_is_user_port(ds, port)) { + struct net_device *slave; + + slave = dsa_to_port(ds, port)->slave; + dsa_slave_setup_tagger(slave); + + /* rtnl_mutex is held in dsa_tree_change_tag_proto */ + dsa_slave_change_mtu(slave, slave->mtu); + } + } + + return 0; +} + + case dsa_notifier_tag_proto: + err = dsa_switch_change_tag_proto(ds, info); + break;
|
Networking
|
53da0ebaad102626f56495e0967a614f89a2acc8
|
vladimir oltean
|
documentation
|
abi
|
testing
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.