Commit Graph

73 Commits

Author SHA1 Message Date
Bart Van Assche
bbad4dfcaa - Fixed memory leak in srpt_handle_tsk_mgmt() error path.
- Modified srpt_build_cmd_rsp() and srpt_build_tskmgmt_rsp() such that
  these two functions now return the number of bytes of the response PDU
  built.
- Converted a printk() statement to TRACE_DBG().


git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@1029 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2009-08-08 15:02:19 +00:00
Bart Van Assche
375a72b685 Added more comments.
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@1028 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2009-08-08 14:59:28 +00:00
Bart Van Assche
1b516fab15 Implemented SRPT command state management. The SRPT target code does no
longer rely on the struct scst_cmd state managed by the SCST core.


git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@1026 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2009-08-08 11:52:46 +00:00
Bart Van Assche
79b9d3141c Fixed the following checkpatch complaint: return is not a function,
parentheses are not required.


git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@1019 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2009-08-06 13:42:28 +00:00
Bart Van Assche
7286d22319 Fixed data races on manipulation of the srpt_devices list by eliminating
this list. Only the number of IB devices is relevant for the SRPT
implementation. Introduced a new counter that tracks the number of IB
devices.


git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@1016 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2009-08-06 10:05:10 +00:00
Bart Van Assche
e9feb2e818 - Refactoring: split srpt_ch_qp_rtr_rts() into two functions, namely
srpt_ch_qp_rtr() and srpt_ch_qp_rts().
- Replaced dynamic memory allocation (kmalloc()/kfree()) in the aforementioned
  two functions by stack allocation.
- Compiles again on pre-2.6.22 kernels (RHEL / CentOS systems).


git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@1015 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2009-08-06 09:12:37 +00:00
Bart Van Assche
8ca3e36e99 - Fixed race conditions related to channel state manipulation.
- Inlined srpt_disconnect_channel().
- Modified error handling coding style in srpt_cm_req_recv() to the usual
  kernel coding style: upon error, jump to the error handling code.
- Added more comments.


git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@1014 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2009-08-05 19:48:16 +00:00
Bart Van Assche
6dc8835e7e - Bug fix: if processing of any of the SRP task management functions by
the SCST core fails (abort task, LUN reset, ...), an SRP_RSP PDU is
  now sent back to the initiator.
- Added more debug tracing statements.
- Improved readability of some parts of the source code.
- Added more comments.
- Partially reverted one hunk of r1003: while casting an unsigned 64-bit
  value to the type u64 and printing such values via %llx works fine on
  x86 systems, the same code triggers a compiler warning on PowerPC
  systems. So while r1003 changed some (unsigned long long) casts to (u64)
  casts, this revision changes these back to (unsigned long long) casts.


git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@1012 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2009-08-04 18:45:46 +00:00
Bart Van Assche
70110ec078 Fixed race conditions on RDMA channel manipulations found via source reading:
- Added a second argument to srpt_find_channel() that specified whether or not
  the channel should be removed from the channel list if found.
- Moved list_del() statement from the body of the srpt_release_channel()
  function to its callers.


git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@1005 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2009-08-03 16:00:36 +00:00
Bart Van Assche
7234de012f Multiple cosmetic source code changes.
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@1004 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2009-08-03 15:06:00 +00:00
Bart Van Assche
47d7742f4e - Enabled the LUN reset task management function.
- Changed return type of srpt_release_channel() from int to void
  because the return value did depend in a trivial way on the function
  arguments. Changed the return type of srpt_find_and_release_channel()
  and several of its callers also from int to void. Instead
  srpt_cm_handler() now directly sets its own return value.
- Converted a list_for_each_entry_safe() into a list_for_each_entry() loop
  because no elements are added or deleted in the loop body.
- Converted debug-printk() statements into TRACE_DBG().
- Changed indentation of one statement from 12 to 16 (was not reported by
  checkpatch).


git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@1003 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2009-08-02 18:57:48 +00:00
Bart Van Assche
7cb9d95684 Added even more comments.
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@1002 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2009-08-02 18:45:40 +00:00
Bart Van Assche
c49f89cec1 Whitespace-only change: fixed a checkpatch complaint.
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@1000 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2009-08-01 06:50:36 +00:00
Bart Van Assche
7c25f55ad9 Only call scst_tgt_cmd_done() if scst_rx_data() has not been called.
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@999 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2009-08-01 06:03:55 +00:00
Bart Van Assche
58eb630bd0 Fixed the issue that 'rmmod ib_srpt' with ongoing SRP I/O could trigger
a deadlock.


git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@998 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2009-07-31 11:40:10 +00:00
Bart Van Assche
f5097d6263 Whitespace-only changes: fixed checkpatch complaints introduced in the previous commit.
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@997 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2009-07-31 11:33:26 +00:00
Bart Van Assche
221ce1846b Added more comments.
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@996 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2009-07-31 11:27:54 +00:00
Bart Van Assche
745a852fbe - Fixed a buffer overrun: a service entry name occupying 35 bytes was
written into a buffer with a size of 32 bytes. Enlarged the buffer
  to 36 bytes.
- Converted sprintf() calls to snprintf() calls.
- Added more TRACE_ENTRY() / TRACE_EXIT() statements.


git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@992 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2009-07-30 12:48:06 +00:00
Bart Van Assche
57f4019ed5 Moved /sys/class/infiniband_srpt/trace_level to
/proc/scsi_tgt/ib_srpt/trace_level such that the behavior of the
ib_srpt target is consistent with that of other SCST drivers.


git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@991 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2009-07-30 08:32:23 +00:00
Bart Van Assche
3bf7d6dca1 Compiles again with tracing disabled.
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@990 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2009-07-30 06:38:15 +00:00
Bart Van Assche
3e18defd73 Should have been included in the previous commit (r988).
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@989 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2009-07-29 18:14:41 +00:00
Bart Van Assche
5d67fefe37 - Fixed a race condition found via source reading: srpt_remove_one() did not
wait until srpt_refresh_port_work() finished. This race condition could be
  triggered during module removal.
- Added a kernel module parameter called "trace_flag" that allows to set the
  trace flags for the ib_srpt module before module initialization starts.
- Added sysfs variable /sys/class/infiniband_srpt/trace_level that allows to
  display and to modify the enabled trace flags in a human-readable form.
- Added several TRACE_ENTRY() / TRACE_EXIT() statements.
- Added more comments.


git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@988 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2009-07-29 16:57:00 +00:00
Bart Van Assche
2de35d6ad4 Fixed the following issue reported by lockdep:
------------[ cut here ]------------
WARNING: at kernel/lockdep.c:2197 trace_hardirqs_on_caller+0x14c/0x1b0()
Call Trace:
 <IRQ>
 [<ffffffff8024636f>] warn_slowpath+0xaf/0x110
 [<ffffffff8026e1be>] ? check_usage_forwards+0x5e/0xc0
 [<ffffffff8026e818>] ? mark_lock+0x538/0xcc0
 [<ffffffff802ccfc1>] ? cache_alloc_refill+0x191/0x2b0
 [<ffffffff804ee62b>] ? _spin_unlock_irq+0x2b/0x40
 [<ffffffff8026f23c>] trace_hardirqs_on_caller+0x14c/0x1b0
 [<ffffffff8026f2ad>] trace_hardirqs_on+0xd/0x10
 [<ffffffff804ee62b>] _spin_unlock_irq+0x2b/0x40
 [<ffffffffa0657711>] srpt_handle_new_iu+0x2f1/0x630 [ib_srpt]
 [<ffffffffa0657bab>] srpt_completion+0x15b/0x300 [ib_srpt]
 [<ffffffffa04321f2>] mlx4_ib_cq_comp+0x12/0x20 [mlx4_ib]
 [<ffffffffa01f42aa>] mlx4_cq_completion+0x3a/0x80 [mlx4_core]
 [<ffffffffa01f5585>] mlx4_eq_int+0x295/0x2a0 [mlx4_core]
 [<ffffffffa01f561f>] mlx4_msi_x_interrupt+0xf/0x20 [mlx4_core]
 [<ffffffff80288565>] handle_IRQ_event+0x35/0x70
 [<ffffffff8028a144>] handle_edge_irq+0xb4/0x150
 [<ffffffff8020eb71>] do_IRQ+0x81/0x110
 [<ffffffff8020ced3>] ret_from_intr+0x0/0xf
 <EOI>
 [<ffffffff803b1a88>] ? cfb_imageblit+0x578/0x5a0
 [<ffffffff803aaf09>] ? bit_putcs+0x3d9/0x6a0
 [<ffffffff8026f252>] ? trace_hardirqs_on_caller+0x162/0x1b0
 [<ffffffff8026f2ad>] ? trace_hardirqs_on+0xd/0x10
 [<ffffffff804eb425>] ? thread_return+0x3d/0x928
 [<ffffffff803ab49b>] ? soft_cursor+0x1ab/0x220
 [<ffffffff803aaac7>] ? bit_cursor+0x647/0x6b0
 [<ffffffff803a4a9b>] ? fbcon_putcs+0x1cb/0x320
 [<ffffffff803aab30>] ? bit_putcs+0x0/0x6a0
 [<ffffffff803a7506>] ? fbcon_redraw+0x166/0x1d0
 [<ffffffff803a7770>] ? fbcon_scroll+0x200/0xd50
 [<ffffffff803f7af0>] ? scrup+0x100/0x110
 [<ffffffff803f7c7d>] ? lf+0x6d/0x70
 [<ffffffff803fbb1d>] ? do_con_write+0x9dd/0x2300
 [<ffffffff8026eff6>] ? mark_held_locks+0x56/0xa0
 [<ffffffff8026f252>] ? trace_hardirqs_on_caller+0x162/0x1b0
 [<ffffffff803fd499>] ? con_write+0x19/0x30
 [<ffffffff803ea683>] ? n_tty_write+0x383/0x480
 [<ffffffff8026f2ad>] ? trace_hardirqs_on+0xd/0x10
 [<ffffffff8023d7d0>] ? default_wake_function+0x0/0x10
 [<ffffffff803e76f4>] ? tty_write+0x1b4/0x280
 [<ffffffff803ea300>] ? n_tty_write+0x0/0x480
 [<ffffffff802d312b>] ? vfs_write+0xcb/0x170
 [<ffffffff802d32c0>] ? sys_write+0x50/0x90
 [<ffffffff8020c51b>] ? system_call_fastpath+0x16/0x1b
 ---[ end trace 954f4d9b9b9cdecc ]---


git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@931 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2009-07-03 19:15:15 +00:00
Bart Van Assche
23e57ce05d Compiles now against vanilla 2.6.18 kernel headers.
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@926 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2009-06-29 19:00:10 +00:00
Bart Van Assche
010750bf7c Ported to 2.6.30 kernel.
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@898 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2009-06-14 07:45:12 +00:00
Bart Van Assche
262a538807 - Compiles again on RHEL 5.
- RHEL 5 + OFED: fixed kernel oops that was triggered by the reception of
  an asynchronous InfiniBand event.


git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@880 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2009-05-22 06:39:42 +00:00
Bart Van Assche
4f8bd9a517 Removed the scst_released synchronization object because the previous
commit made it superfluous.


git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@879 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2009-05-21 12:41:53 +00:00
Bart Van Assche
7519550fcb Moved scst_register() call from srpt_detect() to srpt_add_one(). Added
call to scst_unregister() in srpt_remove_one(). Result:
- The kernel oops triggered by loading the ib_srpt kernel module before
  the InfiniBand subnet manager became active is now fixed.
- It is now possible to log in via the SRP protocol through HCA's that
  became active after the ib_srpt kernel module finished module
  initialization.


git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@878 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2009-05-21 12:34:11 +00:00
Bart Van Assche
106acdb7d6 - Switched to a more traditional error handling style with regard to MAD
handler registration: sport->mad_agent is now reset to NULL when MAD
  handler registration fails.
- Fixed bug in srpt_refresh_port(): this function now returns a negative
  value instead of zero when MAD registration fails.


git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@877 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2009-05-21 11:28:09 +00:00
Bart Van Assche
00dcebdb41 Fixed bug that was introduced through the previous commit (r875): a warning message was printed by srpt_remove_one() when sdev != NULL instead of when sdev == NULL.
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@876 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2009-05-21 10:57:20 +00:00
Bart Van Assche
b2d0960b57 Moved the code for freeing the ring of I/O context structures to a separate function.
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@875 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2009-05-21 06:54:42 +00:00
Bart Van Assche
2959a19435 Moved the code for unregistering the MAD agent into a separate function.
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@874 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2009-05-21 06:33:38 +00:00
Bart Van Assche
7617a71367 Added more comments.
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@863 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2009-05-19 17:58:06 +00:00
Bart Van Assche
5347e3f509 Reverted r857 because the coding style of r856 is believed to be what is expected upstream instead of the coding style of r857.
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@860 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2009-05-19 16:41:09 +00:00
Bart Van Assche
f3d5d989ca Cleaned up changes introduced in r855.
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@857 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2009-05-16 11:24:45 +00:00
Bart Van Assche
812d04fa03 Added more comments.
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@856 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2009-05-16 11:20:52 +00:00
Bart Van Assche
76bdb860f0 Split srpt_handle_new_iu() in smaller functions.
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@855 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2009-05-16 07:34:41 +00:00
Bart Van Assche
c521377609 ib_srpt.c compiles now on RHEL 5.x systems where OFED has been installed.
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@820 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2009-05-04 18:57:04 +00:00
Vladislav Bolkhovitin
f572d4ff79 - Copyrights updated.
- Other minor updates



git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@803 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2009-04-27 19:01:28 +00:00
Bart Van Assche
c712d12f40 The function srpt_cm_req_recv() now returns an error code instead of 0
when an SRP login request is rejected. This fixes a memory leak: the
InfiniBand core (drivers/infiniband/core/cm.c) only calls cm_free_work()
when the registered cm_handler function, i.e. srpt_cm_req_recv()
returns an error code. This patch has been submitted by by Frank Zago.


git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@800 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2009-04-26 09:10:52 +00:00
Bart Van Assche
c3d3378bc2 Made show_login_info() work for InfiniBand HCA's with more than two
ports. show_login_info() produces the information that can be retrieved
from /sys/class/infiniband_srpt/srpt-*/login_info. Note: as of today
there do not yet exist any InfiniBand HCA's with more than two ports.
Thanks to Frank Zago for reporting this issue.



git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@799 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2009-04-26 08:39:06 +00:00
Vladislav Bolkhovitin
d3d5666f5d Cleanups
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@682 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2009-03-03 17:00:53 +00:00
Vladislav Bolkhovitin
48addc3482 Modified patch from Bart Van Assche <bart.vanassche@gmail.com>
It, hopefully, fixes compilation problems on CentOS 5.2 as well as on vanilla kernels <2.6.28


git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@638 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2009-01-23 19:51:54 +00:00
Vladislav Bolkhovitin
de25580abb Checkpatch fix
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@616 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2008-12-10 15:55:16 +00:00
Vladislav Bolkhovitin
26cde4de56 Make soft IRQ context default
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@594 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2008-12-03 18:01:42 +00:00
Vladislav Bolkhovitin
e967b30f95 Small cleanup of unused code
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@566 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2008-11-10 17:23:23 +00:00
Vladislav Bolkhovitin
06905f3e57 Follow-up improvements to r556
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@558 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2008-10-31 16:17:08 +00:00
Vladislav Bolkhovitin
3379376993 - Fixed incorrect SCST state used on error path
- Small cleanups
 - ToDo entry added


git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@557 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2008-10-31 11:16:47 +00:00
Vladislav Bolkhovitin
90c831b838 Cleanup removing usage of in_atomic(). Particularly, now target drivers and dev handlers need to explicitly supply preferred execution context in scst_cmd_done() and scst_tgt_cmd_done().
WARNING! This commit changes external SCST interface, so it can break compilation of your out of SCST SVN tree target driver or dev handler. To fix it, simply supply the preferred exection context to scst_cmd_done() and/or scst_tgt_cmd_done().

Thanks to Bart Van Assche <bart.vanassche@gmail.com> for pointing on it.



git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@556 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2008-10-31 10:49:25 +00:00
Vladislav Bolkhovitin
0b2be958e9 The patch below makes the srpt driver compile against the 2.6.27 kernel
headers.

Signed-off-by: Bart Van Assche <bart.vanassche@gmail.com>
Acked-by: Vu Pham <vu@mellanox.com>



git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@551 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2008-10-30 12:34:48 +00:00