Commit Graph

219 Commits

Author SHA1 Message Date
Alexander Motin
a6222dd789 Remove more legacy of parallel SCSI. 2020-11-24 22:43:27 +00:00
Alexander Motin
0b19f90a43 Make handlers and atpds overflows unlikely.
- Allocate 256 handlers more than payload commands for management purposes.
 - Increase maximum number of handlers from 8K to 16K by tuning the format.
 - Just to be safe limit the number of payload commands to 16K - 256.
 - Limit number of target exchanges in mixed mode to the number of atpds.
 - If we still somehow get out of atpds -- return BUSY, since we really are.
2020-11-22 04:29:55 +00:00
Alexander Motin
254c652b6d Do not parent all busdma tags to the payload tag.
There is not much to inherit any more, may create more problems than solve.
Instead parent them all directly to upstream.

While there, add missed payload tag and tune scratch tag destructions.
2020-11-22 04:10:13 +00:00
Alexander Motin
b8e2395ec5 Increase queue depths from 1024/256 to 8192/1024 IOCBs.
Qlogic chips store S/G lists in the same queue as requests themselves.  In
the worst case 1MB I/O may require up to 52 IOCBs, that means queue of 1024
IOCBs can store only 19 of such requests.  The increase reduces chances of
overflow, while we should be able to afford additional 512KB of RAM per HBA.
The Linux driver uses comparable numbers.

While there, decouple ATIO queue size from response queue size.  There is
no reason for them to be equal.
2020-11-20 19:36:34 +00:00
Alexander Motin
f6854a0cd5 Cleanup DMA handling.
- Make isp_start() to set all the IOCB fields aside of S/G list, removing
extra information from isp_send_cmd(), now only doing S/G lists and sending.
 - Turn DMA setup/free from being card and PCI-specific into OS-specific,
instead add new card-specific method for isp_send_cmd().  Previously this
function was a monster handling all the cards.
 - Remove double error code translation.
2020-11-20 18:02:04 +00:00
Alexander Motin
dae0ba753c Fix r367857 build without ISP_TARGET_MODE. 2020-11-20 02:03:58 +00:00
Alexander Motin
1b760be482 Remove parallel SCSI and 1/2Gb FC support from isp(4).
This removes 288KB (36%) of the driver code and zillions of hacks and
workarounds, making single driver uniformly support several different
generations of hardware interfaces, not counting minor card variations.
After years of the hopeless fight, I don't think it worth to continue
support for hardware obsolete for 15-20 years.  Instead much cleaner
now code should allow to move forward toward better locking, multiple
queues and other cool features.

All the remaining Qlogic cards starting from 4Gb 24xx to 32Gb 27xx use
the same hardware/firmware interface with minor incremental improvements,
so it seems to be a good new starting point.  Except one PCI-X model all
all of them are PCIe and so still usable in modern systems.

Discussed with:	ken, scottl, jpaetzel, imp
Relnotes:	yes
2020-11-20 01:15:48 +00:00
Alexander Motin
cf770ba3e9 Move ecmd memory allocation itto separate DMA tag.
Ecmd memory is not directly related to the request queue, only referenced
from it sometimes in target mode.  Separate allocation should be easier
in case of fragmented memory and can be skipped when target is not built.

MFC after:	1 month
2020-11-18 03:43:03 +00:00
Alexander Motin
9cca0e7ee5 Remove bus_dma locking/sleeping when not needed.
MFC after:	1 month
2020-11-18 02:54:05 +00:00
Warner Losh
58aa35d429 Remove sparc64 kernel support
Remove all sparc64 specific files
Remove all sparc64 ifdefs
Removee indireeect sparc64 ifdefs
2020-02-03 17:35:11 +00:00
Edward Tomasz Napierala
e52fba212d Make isp(4) suggest loading ispfw(4) when it fails to attach.
It cannot load it automatically at boot, because the root filesystem
is not there yet. An alternative would be adding ispfw(4) to GENERIC,
but it's an additional 1MB.

Reviewed by:	mav
MFC after:	2 weeks
Sponsored by:	Klara Inc.
Differential Revision:	https://reviews.freebsd.org/D19369
2019-04-28 15:08:57 +00:00
Alexander Motin
1f8c4546a8 Limit 24xx adapters to only MSI interrupts by default.
This was actually the known good configuration we used before.
Single MSI-X configuration doesn't even work there on my tests, just due
to lack of documentation not sure whether by design or I am doing something
wrong.

PR:		233654
MFC after:	1 week
2019-02-28 21:07:16 +00:00
Alexander Motin
8ebb14b1c6 Limit 24xx adapters to only one MSI-X interrupt by default.
These are 4Gb/s and pretty old and slow now, so I see no reason to fight
for their performance over stability.

PR:		233654
MFC after:	1 week
Sponsored by:	iXsystems, Inc.
2019-02-28 15:36:03 +00:00
Alexander Motin
17ec774693 Add to isp(4) tunables to limit MSI/MSI-X usage.
There are some problem reports possibly related to the new driver use of
multiple interrupts on older cards.  Hopefully this allow to workaround
them.

MFC after:	1 week
Sponsored by:	iXsystems, Inc.
2019-02-28 15:24:00 +00:00
Alexander Motin
14e084ada5 Add support for Enhanced Gen 5 (16Gb) and Gen 6 (32Gb) QLogic FC HBAs.
MFC after:	2 weeks
Sponsored by:	iXsystems, Inc.
2018-02-28 16:24:32 +00:00
Pedro F. Giffuni
718cf2ccb9 sys/dev: further adoption of SPDX licensing ID tags.
Mainly focus on files that use BSD 2-Clause license, however the tool I
was using misidentified many licenses so this was mostly a manual - error
prone - task.

The Software Package Data Exchange (SPDX) group provides a specification
to make it easier for automated tools to detect and summarize well known
opensource licenses. We are gradually adopting the specification, noting
that the tags are considered only advisory and do not, in any way,
superceed or replace the license texts.
2017-11-27 14:52:40 +00:00
Alexander Motin
7e31684ea4 Unify initiator and target DMA setup and command sending.
The code is so alike that it is pointless to keep it separate.

MFC after:	2 weeks
2017-03-24 14:44:03 +00:00
Alexander Motin
cf8242898d Remove another remnants left after r246713.
MFC after:	2 weeks
2017-03-21 14:14:11 +00:00
Alexander Motin
97dfdd4efa Remove some dead code left after r246713.
MFC after:	2 weeks
2017-03-21 13:49:43 +00:00
Alexander Motin
13d9c92192 Clean/unify some macro usage.
MFC after:	2 weeks
2017-03-21 10:34:34 +00:00
Alexander Motin
abdc2e314b Addition to r315579: drop the lock while allocating IRQs.
MFC after:	12 days
2017-03-21 08:56:13 +00:00
Alexander Motin
08826086fe Add initial support for multiple MSI-X vectors.
For 24xx and above use 2 vectors (default and response queue).
For 26xx and above use 3 vectors (default, response and ATIO queues).
Due to global lock interrupt hardlers never run simultaneously now, but
at least this allows to save one regitster read per interrupt.

MFC after:	2 weeks
2017-03-19 19:11:40 +00:00
Alexander Motin
0e6bc811e4 Refactor interrupt handling.
Instead of single isp_intr() function doing all possible magic, introduce
four different functions to handle mailbox operation completions, async
events, response and ATIO queues.  The goal is to isolate different code
paths to make code more readable, and to make easier support for multiple
interrupt vectors.  Even oldest hardware in many cases can identify what
code path it should run on interrupt.  Contemporary hardware can assign
them to different interrupt vectors.

MFC after:	2 weeks
2017-03-15 14:58:29 +00:00
Alexander Motin
b0a66d29b8 Fix ancient bug from r84597, which broke 23xx after r315234.
MFC after:	13 days
2017-03-15 10:33:44 +00:00
Alexander Motin
a1fa02673a Improvements around attach, reset and detach.
This change fixes DMA resource leak on driver unload.  Also it removes
DMA resources allocation for hardcoded number of requests before fetching
the real number from firmware.  Also it prepares ground for more flexible
IRQs allocation according to firmware capabilities.

MFC after:	2 weeks
2017-03-14 08:03:56 +00:00
Pedro F. Giffuni
4d24901ac9 sys/dev: Replace zero with NULL for pointers.
Makes things easier to read, plus architectures may set NULL to something
different than zero.

Found with:	devel/coccinelle
MFC after:	3 weeks
2017-02-20 03:43:12 +00:00
Kenneth D. Merry
08167db8d6 Turn on FC-Tape by default in the isp(4) driver.
FC-Tape provides additional link level error recovery, and is
highly recommended for tape devices.  It will only be turned on for
a given target if the target supports it.

Without this setting, we default to whatever FC-Tape setting is in
NVRAM on the card.

This can be overridden by setting the following loader tunable, for
example for isp0:

hint.isp.0.nofctape=1

sys/conf/options:
	Add a new kernel config option, ISP_FCTAPE_OFF, that
	defaults the FC-Tape configuration to off.

sys/dev/isp/isp_pci.c:
	If ISP_FCTAPE_OFF is defined, turn off FC-Tape.  Otherwise,
	turn it on if the card supports it.

share/man/man4/isp.4:
	Add a description of FC-Tape to the isp(4) man page.

	Add descriptions of the fctape and nofctape options, as well as the
	ISP_FCTAPE_OFF kernel configuration option.

	Add the ispfw module and kernel drivers to the suggested
	configurations at the top of the man page so that users are less
	likely to leave it out.  The driver works well with the included
	firmware, but may not work at all with whatever firmware the user
	has flashed on their card.

MFC after:	3 days
Sponsored by:	Spectra Logic
2016-12-20 21:17:07 +00:00
Edward Tomasz Napierala
dd49c93695 Remove NULL checks after M_WAITOK allocations from isp(4).
MFC after:	1 month
Sponsored by:	The FreeBSD Foundation
2016-05-15 08:36:12 +00:00
Alexander Motin
4ff970c462 Allocate separate DMA area for synchronous IOCB execution.
Usually IOCBs should be put on queue for asynchronous processing and should
not require additional DMA memory.  But there are some cases like aborts and
resets that for external reasons has to be synchronous.  Give those cases
separate 2*64 byte DMA area to decouple them from other DMA scratch area
users, using it for asynchronous requests.
2016-04-12 14:19:19 +00:00
Alexander Motin
14849e2c85 Split DMA buffers for request, response and ATIO queues. 2015-12-27 06:16:02 +00:00
Alexander Motin
7d191fdb97 Use single DMA tag for scratch areas of all virtual ports. 2015-12-26 09:16:05 +00:00
Alexander Motin
970ceb2fd5 Unify handles allocation for initiator and target IOCBs.
I am not sure why this was split long ago, but I see no reason for it.
At this point this unification just slightly reduces memory usage, but
as next step I plan to reuse shared handle space for other IOCB types.
2015-12-25 13:03:18 +00:00
Alexander Motin
d876d6c34a Add MSI-X support for 26XX cards.
Unlike previous, this generation does not support regular MSIs any more.
2015-12-15 04:51:50 +00:00
Alexander Motin
67eeadd2bd Add PCI ID for 16G QLogic chips in FCoE mode.
I haven't tested FCoE really yet, but the driver attaches fine.
2015-12-09 22:52:37 +00:00
Alexander Motin
cd201b7b55 Make 16Gig chips to use new queue pointer registers.
While 24xx-style ATIO and reply queue registers seems like still working,
request queue doesn't.  So instead of that use registers from PCI BAR(4).
2015-12-04 19:46:49 +00:00
Alexander Motin
218be0b2ee Add initial support for 16Gbps FC QLogic chips.
I still don't know how to read NVRAM there, so WWNs and other parameters
are incorrect, but other then that driver seems like attaching normally.
2015-12-02 20:22:50 +00:00
Alexander Motin
e561aa79fb One more round of port scanner rewrite.
- Make scan aborted by event restart immediately and infinitely.
 - Improve handling of some loop events from firmware.
 - Remove loop down timer, adding its functionality to scanner thread.
 - Some more unification and simplification.
2015-11-26 13:04:58 +00:00
Alexander Motin
e3a0bc583b Remove "disable" hint, which duplicates system-wide "disabled". 2015-11-23 20:44:49 +00:00
Alexander Motin
a4ccb5d682 Fix target mode support for Qlogic 2200 FC adapters.
Now target mode works for all supported FC adapters except ancient 2100,
which is not tested.
2015-11-23 15:49:50 +00:00
Alexander Motin
3e6deb330e Rip off target mode support for parallel SCSI QLogic adapters.
Hacks to enable target mode there complicated code, while didn't really
work.  And for outdated hardware fixing it is not really interesting.

Initiator mode tested with Qlogic 1080 adapter is still working fine.
2015-11-23 10:06:19 +00:00
Alexander Motin
ffe6ea0581 Increase maximal value of vports tunable to 254.
I am not sure this value is really viable yet, but that is what chips
officially support in NPIV mode (in loop mode maximum is 125).
2015-11-21 21:44:11 +00:00
Alexander Motin
dfd246496a Formalize/unify chip (re-)inits. 2015-10-25 10:49:05 +00:00
Alexander Motin
c07b9e0752 Disable full bus scan by CAM for FC adapters.
FC port database code already notifies CAM about all devices.  Additional
full scan is just a waste of time, that by definition won't find anything
that is not present in port database.
2015-10-23 08:53:32 +00:00
Alexander Motin
6ce548a105 Some polishing and unification in ISR code. 2015-10-23 08:26:45 +00:00
Alexander Motin
21c2207ffc Update firmware images for Qlogic 24xx/25xx from 5.5.0 to 7.3.0.
This also removes separate "_multi" images, since this funcationality is
now in base, and there is simply no new images without it for years.
2015-10-20 12:27:59 +00:00
Alexander Motin
07f56f1cc9 Add dev.isp.X.role sysctl in addition to tunable.
It (mostly) allows to enable/disable initiator mode in run time.
Target mode control is blocked here to force coordination with CTL.

While there, add separate tunables/sysctls for virtual channels.
2015-06-23 16:13:20 +00:00
John Baldwin
aced5239b2 Add missing calls to bus_dmamap_unload() when freeing static DMA
allocations.

Reviewed by:	scottl
2014-06-13 18:20:44 +00:00
Alexander Motin
07d925fa2f Use relaxed (write-only) memory barriers when writing some of queue index
registers (for now on ISP2400+).  We never read those registers back and
AFAIK their semantics does not require any immediate reaction on write.
2013-11-10 23:48:16 +00:00
Scott Long
c68534f1d5 Update PCI drivers to no longer look at the MEMIO-enabled bit in the PCI
command register.  The lazy BAR allocation code in FreeBSD sometimes
disables this bit when it detects a range conflict, and will re-enable
it on demand when a driver allocates the BAR.  Thus, the bit is no longer
a reliable indication of capability, and should not be checked.  This
results in the elimination of a lot of code from drivers, and also gives
the opportunity to simplify a lot of drivers to use a helper API to set
the busmaster enable bit.

This changes fixes some recent reports of disk controllers and their
associated drives/enclosures disappearing during boot.

Submitted by:	jhb
Reviewed by:	jfv, marius, achadd, achim
MFC after:	1 day
2013-08-12 23:30:01 +00:00
Konstantin Belousov
dd0b4fb6d5 Reform the busdma API so that new types may be added without modifying
every architecture's busdma_machdep.c.  It is done by unifying the
bus_dmamap_load_buffer() routines so that they may be called from MI
code.  The MD busdma is then given a chance to do any final processing
in the complete() callback.

The cam changes unify the bus_dmamap_load* handling in cam drivers.

The arm and mips implementations are updated to track virtual
addresses for sync().  Previously this was done in a type specific
way.  Now it is done in a generic way by recording the list of
virtuals in the map.

Submitted by:	jeff (sponsored by EMC/Isilon)
Reviewed by:	kan (previous version), scottl,
	mjacob (isp(4), no objections for target mode changes)
Discussed with:	     ian (arm changes)
Tested by:	marius (sparc64), mips (jmallet), isci(4) on x86 (jharris),
	amd64 (Fabian Keil <freebsd-listen@fabiankeil.de>)
2013-02-12 16:57:20 +00:00