Commit Graph

470 Commits

Author SHA1 Message Date
Shuhei Matsumoto
24cf63c47a iscsi: Change the ordering to alloc string of options at initialization
In JSON-RPC, string is allocated unconditionally in decode operation.
Hence if string is allocated in opts_init(), it will be overwritten without
any notice.

This patch is to keep compatibility to the config file and adjust to the
upcoming JSON-RPC for options initialization.

Change-Id: I6c16f2af7f34d052aabceb5bc4ebe2fc9d82714a
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-on: https://review.gerrithub.io/407846
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
2018-05-04 17:45:48 +00:00
Shuhei Matsumoto
c512303c30 iscsi: Don't ignore wrong value of parameters at initialization
In the current implementation, even if global parameters in the config file
are wrong, they are ignored and default values are applied.

Now JSON config file is under development and is a good chance to break with
past and change to reject wrong parameters.

This patch add verify() function into spdk_iscsi_initialize_iscsi_globals().

Besides, this patch fixes the return code of iscsi_initialize_global_params().

Change-Id: I708a1537746fe6ce22c36d1442f7eaf2a201830e
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-on: https://review.gerrithub.io/406021
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2018-05-04 17:45:48 +00:00
Shuhei Matsumoto
8712f366e0 iscsi: Separate set params from create pools at subsystem initialization
Change-Id: Ib540126d24a03ccd5f2a2ff01f36593f42520407
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-on: https://review.gerrithub.io/408452
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
2018-05-04 17:45:48 +00:00
Shuhei Matsumoto
e008db08e7 rpc: Add state_mask to each RPC method to make sets of RPCs
Add state_mask to each RPC method and state to RPC server, respectively.
State mask of RPC method is set at registration. State of RPC server
is changed according to the state of the SPDK.

When any RPC method is recieved, if the bit of the RPC server is on in
the state mask of the RPC method, it is allowed. Otherwise, it is
rejected.

When any RPC is rejected by state_mask control, the new error code
is returned to describe the error clearly.

Change-Id: I84e52b8725a286e9329d61c56f498aa2c8664ec1
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-on: https://review.gerrithub.io/407397
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: Pawel Wodkowski <pawelx.wodkowski@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
2018-05-03 19:48:15 +00:00
Daniel Verkamp
e608e8e54d iscsi: close connection array shm file descriptor
Store the file descriptor for the shm_open()'d connections array so we
can clean it up at shutdown.

Change-Id: Ia2727f837431cb1de2c077718412e70364135a5f
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-on: https://review.gerrithub.io/408533
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2018-04-23 16:15:37 +00:00
Daniel Verkamp
ec013016ed iscsi: fix nonsensical poll_group asserts
It doesn't make sense to assert(pg != NULL) after already dereferencing
the pg pointer.

Additionally, pg is pointing into the g_spdk_iscsi.poll_group array, so
it makes more sense to check that the poll_group array is non-NULL.

Change-Id: I167fed2bd73dc6a1894ff5b13d5bf3e5aa835f47
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-on: https://review.gerrithub.io/408234
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2018-04-19 15:37:42 -04:00
Pawel Wodkowski
e548df4ed1 iscsi: do static initialization of globals that allow it
Change-Id: If6db1fbdcf45f689e315c769ded0e0d8cd90aafd
Signed-off-by: Pawel Wodkowski <pawelx.wodkowski@intel.com>
Reviewed-on: https://review.gerrithub.io/407206
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2018-04-12 11:26:44 -04:00
Ben Walker
c0d6eb9d11 iscsi: Remove all uses of strncpy
strncpy is going to be added to the list of banned functions because
it does not guarantee strings are null terminated.

Change-Id: I5fe2f9e717bb65caf6fa26dca075aa974c7f7173
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-on: https://review.gerrithub.io/407021
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2018-04-11 10:23:09 -04:00
GangCao
3bce351916 iscsi: enable per-core cache for PDU data-out pool
With the preferred per core operation for the lockless
consideration, having some per core cache instead of
the shared gloal cache will help the performance.

Change-Id: Ib3cfaac5bad7062b15643d5b151d4c7c6051ddf1
Signed-off-by: GangCao <gang.cao@intel.com>
Reviewed-on: https://review.gerrithub.io/404533
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2018-04-03 11:57:17 -04:00
Pawel Wodkowski
35aefc9e84 app,lib: fix checking mmap return value
Some places use NULL to check for mmap failure but mmap return
MAP_FAILED in this case.

Change-Id: I4796fa52421da53c94223a9e8cc26ac04968f1d8
Signed-off-by: Pawel Wodkowski <pawelx.wodkowski@intel.com>
Reviewed-on: https://review.gerrithub.io/405648
Reviewed-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
2018-03-30 16:18:34 -04:00
GangCao
7954a8dc2a iscsi: update the spdk_iscsi_poll_group_poll handling
Change-Id: I9e385e2821592efb0bf7369ebd5a997c9113b5a7
Signed-off-by: GangCao <gang.cao@intel.com>
Reviewed-on: https://review.gerrithub.io/404081
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2018-03-19 15:56:27 -04:00
Shuhei Matsumoto
19b8d9b10a iscsi: Add the param MinConnectionPerSession to iSCSI options
The static variable g_connections_per_lcore can be configured by
.INI config file. However it had not been added in the iSCSI options
because it was not iSCSI global parameter.

This patch is necessary for JSON config file to configure it.

Change-Id: I12aa1d94dd467969a6853b9fb3f8a627d0d70766
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-on: https://review.gerrithub.io/403623
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2018-03-16 18:22:17 -04:00
Lance Hartmann
6450f07e4d iscsi: Re-word comment, simplify a return.
Re-word confusing comment in spdk_iscsi_read_pdu() and
simplify a return path in spdk_iscsi_handle_status_snack().

Change-Id: I15bd8b2f45d0e45cf4a4a34533ecb8af0a154531
Signed-off-by: Lance Hartmann <lance.hartmann@oracle.com>
Reviewed-on: https://review.gerrithub.io/404034
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2018-03-15 18:31:33 -04:00
Daniel Verkamp
21ef6ee50d iscsi: remove unused epoll/kqueue includes
The sock abstraction wraps these functions now, so the iSCSI layer
doesn't need to include them directly.

Change-Id: I900ed96a9cfb5d12c7fd190bc590d00846a47034
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-on: https://review.gerrithub.io/403879
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2018-03-15 15:52:05 -04:00
Lance Hartmann
3dcd1942ff iscsi: Handle spdk_get_pdu() failure in spdk_iscsi_execute()
Prepares spdk_iscsi_execute() to handle the case where
spdk_get_pdu() will return NULL in a future patch instead
of abort()'ing.

Change-Id: I8f7e46495db2c517970e7e5de6ace1b13159b42b
Signed-off-by: Lance Hartmann <lance.hartmann@oracle.com>
Reviewed-on: https://review.gerrithub.io/403883
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2018-03-15 15:48:50 -04:00
Lance Hartmann
b080d5a875 iscsi: Handle spdk_get_pdu() failure in spdk_iscsi_send_r2t()
Prepares spdk_iscsi_send_r2t() to handle the case where
spdk_get_pdu() will return NULL in a future patch instead
of abort()'ing.

Change-Id: Id18c39a7ea0ea748f1ecb842aee9a08594fb2a48
Signed-off-by: Lance Hartmann <lance.hartmann@oracle.com>
Reviewed-on: https://review.gerrithub.io/403878
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2018-03-15 15:48:50 -04:00
Lance Hartmann
6c07ca54f3 iscsi: Handle spdk_get_pdu() failure in spdk_iscsi_op_nopout()
Prepares spdk_iscsi_op_nopout() to handle the case where
spdk_get_pdu() will return NULL in a future patch instead
of abort()'ing.

Change-Id: I6a0563c14a1bddf219dd12de67f83b18d6fd82f4
Signed-off-by: Lance Hartmann <lance.hartmann@oracle.com>
Reviewed-on: https://review.gerrithub.io/403874
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2018-03-15 15:48:50 -04:00
Lance Hartmann
7734777a25 iscsi: Handle spdk_get_pdu() failure in spdk_iscsi_op_logout()
Prepares spdk_iscsi_op_logout() to handle the case where
spdk_get_pdu() will return NULL in a future patch instead
of abort()'ing.

Change-Id: I31f854741906023c734151e3b00b939cdafb2ec4
Signed-off-by: Lance Hartmann <lance.hartmann@oracle.com>
Reviewed-on: https://review.gerrithub.io/403864
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2018-03-15 15:48:50 -04:00
Lance Hartmann
a37939694c iscsi: Handle spdk_get_pdu() failure in spdk_iscsi_op_text()
Prepares spdk_iscsi_op_text() to handle the case where
spdk_get_pdu() will return NULL in a future patch instead
of abort()'ing.

Change-Id: I21036116936c50c5674e0d11bbb4a30938bf5336
Signed-off-by: Lance Hartmann <lance.hartmann@oracle.com>
Reviewed-on: https://review.gerrithub.io/403860
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2018-03-15 15:48:50 -04:00
Lance Hartmann
cb7661cdec lib: Handle spdk_get_pdu() failure in spdk_iscsi_op_login()
Prepares spdk_iscsi_op_login() to handle the case where
spdk_get_pdu() will return NULL in a future patch instead
of abort()'ing.

Change-Id: I95da4ff967667f6439330d7959c6937c55522e9a
Signed-off-by: Lance Hartmann <lance.hartmann@oracle.com>
Reviewed-on: https://review.gerrithub.io/403857
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2018-03-15 15:48:50 -04:00
Lance Hartmann
48fcd89135 lib: Handle spdk_get_pdu() failure in spdk_iscsi_reject()
Prepares spdk_iscsi_reject() to handle the case where
spdk_get_pdu() will return NULL in a future patch instead
of abort()'ing.

Change-Id: Id29bed20cedbb7c42b75fcb0ce6070f561d4a3d0
Signed-off-by: Lance Hartmann <lance.hartmann@oracle.com>
Reviewed-on: https://review.gerrithub.io/403856
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2018-03-15 15:48:50 -04:00
Lance Hartmann
f6e7137e72 lib: Handle spdk_get_pdu() failure in spdk_iscsi_read_pdu()
Prepares spdk_iscsi_read_pdu() to handle the case where
spdk_get_pdu() will return NULL in a future patch instead
of abort()'ing.

Change-Id: I9ccfbf41821fb90a203fd8ad026f42fac10e9dbc
Signed-off-by: Lance Hartmann <lance.hartmann@oracle.com>
Reviewed-on: https://review.gerrithub.io/403745
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2018-03-15 15:32:58 -04:00
Shuhei Matsumoto
372c5e1ec7 iscsi: Change the type of some negotiation params from uint32_t to bool
ImmediateData in negotation parameters can be controlled by the config
file and currently "Yes" or "No" are valid values of it in the config
file. "Yes" or "No" means almost bool. Additionally, ImmediateData is
defined as boolean value in the iSCSI specification as follows.

However ImmediateData is an uint32_t variable and 0 or 1 are used in
SPDK now.

In the upcoming JSON config file, boolean value should be set to
ImmediateData.

Hence change all variables and constants related with ImmediateData
to boolean in this patch.

InitialR2T, DataPDUInOrder, and DataSequenceInOrder are not controllable
by the config file but these are defined as boolean value in the
iSCSI specification.

Hence change them to bool too.

Besides, AllowDuplicateIsid is used almost as boolean value. Hence
change it to bool too.

InitialR2T=<boolean-value>
ImmediateData=<boolean-value>
DataPDUInOrder=<boolean-value>
DataSequenceInOrder=<boolean-value>

Change-Id: I9f98b219687b3600194563b1d6b85551f4586144
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-on: https://review.gerrithub.io/403237
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
2018-03-14 13:41:22 -04:00
Shuhei Matsumoto
7315fa5ab6 iscsi/rpc: Change the format of get_iscsi_globals about CHAP params
For the CHAP setting of iSCSI targets, JSON-RPC handles the
value of parameters directly and dump of iSCSI targets can be
used to construct directly.

For the CHAP setting of iSCSI discovery session, the same manner
will be applied.

Change-Id: I8731af4273cc89ee5c4ea2f97955e56e3bff202d
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-on: https://review.gerrithub.io/401076
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
2018-03-14 13:41:22 -04:00
GangCao
619a4f9418 iscsi: trace initiator and target name when handling nop
Trace the initiator and target name for debugging purpose.

Change-Id: I89230484072a7f12a58b4234abd1026a228f302a
Signed-off-by: GangCao <gang.cao@intel.com>
Reviewed-on: https://review.gerrithub.io/403690
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2018-03-13 13:59:48 -04:00
Roman Sudarikov
c3bc40a6ef io_channel: add return value to pollers
This will be used to track time used in pollers - each poller can now
indicate if it found any work to do or not.

For cases where it was obvious and the infrastructure was already in
place, existing pollers have been modified to return 0 or a positive
value to indicate whether work was done.  Other pollers have been
modified to return -1 by default, indicating that the poller isn't
indicating anything about whether work was performed.  This will allow
us to find un-annotated pollers easily in the future and fix them
incrementally.

Change-Id: Ifebfa56604a38434fac5c76ba7263267574ff199
Signed-off-by: Roman Sudarikov <roman.sudarikov@intel.com>
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-on: https://review.gerrithub.io/391042
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2018-03-13 11:16:20 -04:00
Ziye Yang
9c5c2cf7c8 lib/iscsi: Move last_nopin update in spdk_iscsi_send_nopin
If we are not in ffp phase, we do not need to update last_nopin

Change-Id: I289beec8437d7117b6261483c333bf5db5fbd11f
Signed-off-by: Ziye Yang <optimistyzy@gmail.com>
Reviewed-on: https://review.gerrithub.io/403166
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
2018-03-09 15:48:03 -05:00
Shuhei Matsumoto
4492fd6cc8 iscsi: Check the combination of CHAP params for discovery before applied
In the upcoming JSON config file, CHAP parameters for discovery will
be specified simply by the value of them.

This is as same as JSON-RPC for target node but different from .INI
config file.

If CHAP parameters are specified by the value of them, the combination
of them must be checked before applied to iSCSI globals.

Change-Id: Idf663796f97581366da945abb8dc351f3975ceae
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-on: https://review.gerrithub.io/403235
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2018-03-09 13:52:04 -05:00
Shuhei Matsumoto
ed3e889fcd iscsi: Change type CHAP parameters for discovery from int to bool
Currently CHAP parameters for discovery are handled as bool but
they are defined as int. Hence change their type from int to bool
as done for target node previously.

Change-Id: I1e815946d4bdececcdd7cc873a725afbbcb98e50
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-on: https://review.gerrithub.io/403234
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2018-03-09 13:52:04 -05:00
Shuhei Matsumoto
3af8e26df8 iscsi: Change function names of iSCSI subsystem configuration
Portal, portal group, initiator group, and target node don't use fixed size
array anymore. To use the same naming rule in iSCSI subsystem and in SPDK
is helpful to understand and maintain. Current naming rule is not bad but
to use unified and compact name is prioritized at this time.

This patch changes function names as follows:
- spdk_iscsi_init_tgt_nodes() -> spdk_iscsi_parse_tgt_nodes()
- spdk_cf_add_iscsi_tgt_node() -> spdk_iscsi_parse_tgt_node()

- spdk_iscsi_portal_grp_array_create() -> spdk_iscsi_parse_portal_grps()
- spdk_iscsi_portal_grp_create_from_configfile() -> spdk_iscsi_parse_portal_grp()
- spdk_iscsi_portal_create_from_configline() -> spdk_iscsi_parse_portal()
- spdk_iscsi_portal_grp_array_destroy() -> spdk_iscsi_portal_grps_destroy()

- spdk_iscsi_init_grp_array_create() -> spdk_iscsi_parse_init_grps()
- spdk_iscsi_init_grp_create_from_configfile() -> spdk_iscsi_parse_init_grp()
- spdk_iscsi_init_grp_array_destroy() -> spdk_iscsi_init_grps_destroy()

For example "parse" is already used to explain the operation in portal_grp.c.
Hence using "parse" is familiar and not strange in iSCSI.

Change-Id: Ieff952069d39bd96b7afa1586bfff927968accc2
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-on: https://review.gerrithub.io/403149
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
2018-03-09 13:52:04 -05:00
Shuhei Matsumoto
185aeaa1af iscsi: Aggregate all init operations of iSCSI globals into a function
Some variables of struct spdk_iscsi_globals are initialized by using
.INI config file but others are initialized without using .INI config
file.

This patch aggregates all initialization operations into a function
spdk_iscsi_initialize_iscsi_globals().

Next patch move the code to read .INI config file from
spdk_iscsi_initialize_iscsi_globals() to spdk_iscsi_parse_iscsi_globals()
to make implementation cleaner.

The purpose of the patch series is
- to separate iSCSI subsystem initialization and iSCSI subsystem
  configuration, and
- to develop a new JSON-RPC by reusing the separated iSCSI subsystem
  initialization.

Change-Id: I0bda0de1d8bf1ba5e4b4e5157949fd300ec9ff9d
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-on: https://review.gerrithub.io/403148
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
2018-03-09 13:52:04 -05:00
Shuhei Matsumoto
9f9ca64422 iscsi: Introduce options structure to iSCSI global params initialization
Upcoming JSON config file will support iSCSI global params initialization.
This patch is an effort for JSON config file to reuse the current code as
much as possible.

SPDK's other libraries use options structure effectively, and hence
iSCSI library also utilizes it.

The purpose of the patch series is
- to separate iSCSI subsystem initialization and iSCSI subsystem
  configuration, and
- to develop a new JSON-RPC by reusing the separated iSCSI subsystem
  initialization.

Change-Id: I9936a4cac4048adaa5d69233f156887376d7cde1
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-on: https://review.gerrithub.io/403147
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
2018-03-09 13:52:04 -05:00
Ziye Yang
f09b9c2ed1 lib/iscsi: Set last_nopin when the connection transfers in ffp
Change-Id: Ib2d38a8c744d2d4951f3503cb029ea6b26bb9eaa
Signed-off-by: Ziye Yang <optimistyzy@gmail.com>
Reviewed-on: https://review.gerrithub.io/403119
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2018-03-08 19:09:40 -05:00
Shuhei Matsumoto
1dd0a513a8 iscsi: Extract iSCSI subsystem initialization into a function
This patch extracts iSCSI subsystem initialization by .INI config file
into a function spdk_iscsi_parse_iscsi_globals().

Naming rule was adopted from NVMf-tgt.

By these two patches,
iSCSI subsystem init is done in spdk_iscsi_parse_iscsi_globals().
iscsi subsystem config is done in spdk_iscsi_parse_iscsi_configuration().

The purpose of the patch series is
- to separate iSCSI subsystem initialization and iSCSI subsystem
  configuration, and
- to develop a new JSON-RPC by reusing the separated iSCSI subsystem
  initialization.

Change-Id: Ibafb0b62cbb0aa23dd6dd6007dad0345293e65b8
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-on: https://review.gerrithub.io/403146
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2018-03-08 12:37:29 -05:00
Shuhei Matsumoto
a11b2f3058 iscsi: Move poll_group init to the end of iSCSI subsystem init
iSCSI poll_group initialization must be completed before starting JSON-RPC.
This doesn't have any dependency to the other iSCSI subsystem
initialization and completes asynchronously. Hence thisis good to be placed
at the end of iSCSI subsystem initialization.

Besides, object creation of iSCSI configurable components started after
poll_group initialization by .INI config file is aggregated into a function
spdk_iscsi_parse_iscsi_configuration().

Naming rule was adopted from NVMf-tgt.

The purpose of the patch series is
- to separate iSCSI subsystem initialization and iSCSI subsystem
  configuration, and
- to develop a new JSON-RPC by reusing the separated iSCSI subsystem
  initialization.

Change-Id: I44421803268361f53840a7e47f07ce95c13d1139
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-on: https://review.gerrithub.io/403145
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2018-03-08 12:37:29 -05:00
Shuhei Matsumoto
43062f2245 iscsi: Pass the callback to poll group initialization as an argument
The next patch will move the location and change the callback of poll
group initialization. Besides it is probable for JSON config file to
change the callback of poll group initialization.

Passing callback as argument increases visibility and flexibility of
code.

Change-Id: Ie4bfd2c60a112bb7c697110ef0efc30a2c098dc8
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-on: https://review.gerrithub.io/403144
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2018-03-08 12:37:29 -05:00
Shuhei Matsumoto
d999e6af7d iscsi: Move connection init right after iSCSI global params init
Pool of iSCSI connections and related variables are initialized in
initialize_iscsi_conns().

Currently initialize_iscsi_conns() is located after configuration of
target nodes by .INI config file.

Configuration of target nodes can be done by JSON-RPC but connection
initialization must be completed before starting JSON-RPC.

iSCSI connections don't belong to iSCSI global params directly and
hence move connection initialization right after initialization of
iSCSI global params.

The purpose of the patch series is
- to separate iSCSI subsystem initialization and iSCSI subsystem
  configuration, and
- to develop a new JSON-RPC by reusing the separated iSCSI subsystem
  initialization.

Change-Id: I183365b84aa205790b27adf7cc1f632b932195aa
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-on: https://review.gerrithub.io/403143
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2018-03-08 12:37:29 -05:00
Shuhei Matsumoto
180af18cc7 iscsi: Move PDU, session, and task pool init into iSCSI global params init
iSCSI subsystem have a pool for PDU, session, and task, respectively.

They belong to the struct spdk_iscsi_globals and are initialized by
using the parameters of the struct spdk_iscsi_globals.

Hence their initialization should be located just behind the setup of
parameters of the struct spdk_iscsi_globals.

The purpose of the patch series is
- to separate iSCSI subsystem initialization and iSCSI subsystem
  configuration, and
- to develop a new JSON-RPC by reusing the separated iSCSI subsystem
  initialization.

Change-Id: Ie39f63ee24c547dcd31a1a06d72d915e8c272864
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-on: https://review.gerrithub.io/403142
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2018-03-08 12:37:29 -05:00
Shuhei Matsumoto
ef02d13d3e iscsi: Move PG and IG configuration right before target nodes configuration
Object creation of portal, portal group, and initiator group can be
done by JSON-RPC.

This patch moves object creation of portal, portal group, and initiator
group right before object creation of target node.

The purpose of the patch series is
- to separate iSCSI subsystem initialization and iSCSI subsystem
  configuration, and
- to develop a new JSON-RPC by reusing the separated iSCSI subsystem
  initialization.

Change-Id: If78beabb478923e7c920c09b16e42d6f8aa55775
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-on: https://review.gerrithub.io/403141
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2018-03-08 12:37:29 -05:00
Shuhei Matsumoto
6ef949f276 iscsi: Extract TAILQ_INIT from IG, PG, and target nodes configuration
There are four configurable components, portal, portal group, target node,
and initiator group in iSCSI.

They have a TAILQ to manage their objects, respectively.
Currently each TAILQ initialization is done together with its object
creation by .INI config file.

This patch separates TAILQ initialization from object creation for four
configurable components in iSCSI.

The purpose of the patch series is
- to separate iSCSI subsystem initialization and iSCSI subsystem
  configuration, and
- to develop a new JSON-RPC by reusing the separated iSCSI subsystem
  initialization.

Change-Id: Ia4ac3f06f15acef671e785904f4c687e5d189fbe
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-on: https://review.gerrithub.io/403140
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2018-03-08 12:37:29 -05:00
Ziye Yang
0c1003e983 lib/iscsi: change type of spdk_iscsi_send_nopin to void
Change-Id: Ie7a940efde885dbf0bb7c085fd17c3991dfa3341
Signed-off-by: Ziye Yang <optimistyzy@gmail.com>
Reviewed-on: https://review.gerrithub.io/403165
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2018-03-08 12:11:24 -05:00
Shuhei Matsumoto
230833d8ce iscsi: Remove the variable ntargets from iscsi global params
The variable ntargets in the struct spdk_iscsi_globals was needed
previously because iSCSI target node was managed by a fixed size
array.

Now iSCSI target node is managed by a linked list and ntargets
doesn't take any meaningful role now.

Change-Id: I1805d7a6a6ce40efa4d18f198fbb9104bee43b26
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-on: https://review.gerrithub.io/402976
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
2018-03-07 19:07:09 -05:00
Shuhei Matsumoto
d4d33783ee iscsi: Any value specified by user is not set to DefaultTime2Retain
Even if the value specified by user through the config file is correct,
the default value is always set to DefaultTime2Retain.

Change-Id: Ifdf44e743419813b728a1423c441df59cc90c0a1
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-on: https://review.gerrithub.io/402635
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
2018-03-07 19:07:09 -05:00
Ziye Yang
86922ce0cd lib/iscsi: Remove spdk_iscsi_conn_fn in conn
Also remove the related login and full feature
function

Change-Id: Ia2d0a6617910134c889d1322b53830fe26b9e956
Signed-off-by: Ziye Yang <optimistyzy@gmail.com>
Reviewed-on: https://review.gerrithub.io/402486
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
2018-03-07 10:14:17 -05:00
Ziye Yang
da9f21680b lib/iscsi: Remove spdk_iscsi_conn_check_state
This patch will also re-export spdk_iscsi_conn_destruct

Change-Id: I7d6cbba33294c84398a919d888c8b375e901e09e
Signed-off-by: Ziye Yang <optimistyzy@gmail.com>
Reviewed-on: https://review.gerrithub.io/402485
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2018-03-07 10:14:17 -05:00
Shuhei Matsumoto
76d023fd56 iscsi: pthread_mutex_lock is called before pthread_mutex_init
iSCSI's global mutex is used in spdk_iscsi_portal_grp_create()
before it is initialized by pthread_mutex_init().

A mutex filled with zero bytes has been accepted by now but
this should be fixed.

Change-Id: I2e197bec8da2f781c8c4f6e2a2caf9924b0a4369
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-on: https://review.gerrithub.io/402497
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
2018-03-06 16:20:39 -05:00
Ziye Yang
b86af2c8d2 lib/iscsi: Extract spdk_iscsi_conn_migration
Put it in the iscsi.c

Change-Id: Ifb2843fb7c78f9ca948eac60704547b8b0635bf0
Signed-off-by: Ziye Yang <optimistyzy@gmail.com>
Reviewed-on: https://review.gerrithub.io/402484
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2018-03-06 15:50:54 -05:00
Ziye Yang
d4d03a5ecf lib/iscsi: Make spdk_iscsi_conn_destruct a static function
Change-Id: I044a9980454cf9a0719477e606df104f377b3b43
Signed-off-by: Ziye Yang <optimistyzy@gmail.com>
Reviewed-on: https://review.gerrithub.io/402642
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
2018-03-06 14:44:53 -05:00
Daniel Verkamp
8a6ba58cb4 scripts/check_format: check for spaces before tabs
Automatically detect more whitespace errors.

All existing cases are fixed; only whitespace change (verify with
diff -w) except for one comment style fixup in include/spdk/nvme.h.

Change-Id: If750e54b9c8e3421ea6feda5f20184a31431631e
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-on: https://review.gerrithub.io/402360
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
2018-03-05 11:09:13 -05:00
Ziye Yang
51029af4d7 lib/iscsi: Add a check for poll_group
If this polling group is not initialized, we do not
need to destroy the polling group.

Change-Id: I5a94412d7f42b05d4a457c8652e2f465190fbe6e
Signed-off-by: Ziye Yang <optimistyzy@gmail.com>
Reviewed-on: https://review.gerrithub.io/401362
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2018-03-02 13:33:54 -05:00
Ziye Yang
650e9ed56e lib/iscsi: rename spdk_iscsi_conn_execute
Change-Id: Ic11e65c07738017a2534fbff58101957a8381fc4
Signed-off-by: Ziye Yang <optimistyzy@gmail.com>
Reviewed-on: https://review.gerrithub.io/401976
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2018-03-02 12:53:01 -05:00
Ziye Yang
38fb230249 lib/iscsi: move location of spdk_iscsi_conn_handle_queued_datain_tasks
The better location is to put this function in
the end of process_read_task_completion which can match
the the same function call in spdk_iscsi_op_scsi_read.

Change-Id: I7dbfb23e2c469e0be22e148299643a99b93c8018
Signed-off-by: Ziye Yang <optimistyzy@gmail.com>
Reviewed-on: https://review.gerrithub.io/401985
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2018-03-02 12:32:06 -05:00
Ziye Yang
8642813403 lib/iscsi: add a check in spdk_iscsi_conn_sock_cb
Since we have two pollers for each iSCSI polling group,
so it could be possible that the nop_poller to set
iSCSI connection in existed or existing state.
So add a check here, which means the incoming data
is too late.

Change-Id: I94e5090b005c35c9eb5d7eedbd7acdae67327f94
Signed-off-by: Ziye Yang <optimistyzy@gmail.com>
Reviewed-on: https://review.gerrithub.io/402039
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2018-03-02 11:43:40 -05:00
Ziye Yang
6140f2d147 lib/iscsi: Refactor spdk_iscsi_conn_execute
Purpose: To make the logic clear.

Change-Id: I6176f359a23816b316e92b63ee2e5d5175ae7e7b
Signed-off-by: Ziye Yang <optimistyzy@gmail.com>
Reviewed-on: https://review.gerrithub.io/401772
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2018-02-28 23:23:09 -05:00
Ziye Yang
1a907f11fd lib/iscsi: Add nop_poller for iscsi polling group.
Change-Id: I7f0f64845a5b980632991e7b6d130e4be60ffa20
Signed-off-by: Ziye Yang <optimistyzy@gmail.com>
Reviewed-on: https://review.gerrithub.io/401749
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2018-02-28 23:23:09 -05:00
Ziye Yang
cc5e5b9e50 iscsi: Enable the sock fd group polling mechanism
This patch is used to implement the sock fd event group
polling mechanism if there are incoming data from network
(read event in SPDK iSCSI target side) , thus we can awake
many connections one time, and it can reduce the system call
overhead.

Change-Id: I76c26a89ef9365d7e1ccec616985e7435253896b
Signed-off-by: Ziye Yang <optimistyzy@gmail.com>
Reviewed-on: https://review.gerrithub.io/399796
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2018-02-27 12:56:04 -05:00
Ziye Yang
1f94a99933 lib/iscsi: Change the function name of spdk_iscsi_conn_stop_poller
The iSCSI connection does not have the poller anymore, so
change the name

Change-Id: I534f72998c6bcc73ad9caf5e8f700751acd95c99
Signed-off-by: Ziye Yang <optimistyzy@gmail.com>
Reviewed-on: https://review.gerrithub.io/401372
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
2018-02-26 13:07:40 -05:00
Jim Harris
d95bb23258 iscsi: unregister poll groups on shutdown
Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: Ic2bae1c750d2c9b35bded8ed96c3b84832690ce2

Reviewed-on: https://review.gerrithub.io/401479
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
2018-02-26 11:52:43 -05:00
Shuhei Matsumoto
afe51a1556 iscsi: Adjust variable's name to JSON for iSCSI CHAP
During converting type of CHAP params of target from int to bool
for JSON, changed names of them to be consistent with others.

In this patch, adjust variable name of struct to of JSON.

Change-Id: I1ccbfa11d57479dc55680835eb80e111bd24d9a3
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-on: https://review.gerrithub.io/400928
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
2018-02-23 18:56:11 -05:00
Shuhei Matsumoto
36fc9b2d09 iscsi/rpc: Convert type of CHAP params of target from int to bool
This is a TODO from long ago. Complete this while adjusting dump()
and construct() format of target.

Besides names of variables and parameters about CHAP are not unified
between JSON-RPC and SPDK internal. JSON-RPC's wording looks better
and adjust SPDK internal to JSON-RPC.

Change-Id: I89bcd1ce13a11f7d63a62d51ef094dd302186d37
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-on: https://review.gerrithub.io/400201
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
2018-02-23 18:56:11 -05:00
Shuhei Matsumoto
b94ba1ee7a iscsi/rpc: Convert type of data/header digest params of target from int to bool
This is a TODO from long ago. Complete this while adjusting dump()
and construct() format of target.

Change-Id: I44348ec404cae8882086a1a71a65914c9bafccc3
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-on: https://review.gerrithub.io/400202
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2018-02-23 18:56:11 -05:00
Ziye Yang
4578890716 iscsi: create a iSCSI poll group for each core
This patch adds a iSCSI poll group for each core,
thus we can poll a group of connections instead of one
by one on each core.

Change-Id: I9cd82c8c0f7f6e7b3ee34034339638199bfca5da
Signed-off-by: Ziye Yang <optimistyzy@gmail.com>
Reviewed-on: https://review.gerrithub.io/399565
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
2018-02-23 18:54:07 -05:00
Ziye Yang
a2c6b71614 lib/iscsi: Make iscsi subsystem init in an asynchronous way
Prepared for adding spdk iscsi poll group.

Change-Id: I8cca51fcf6ca0d51982b8f28d52c4d102ce1fd73
Signed-off-by: Ziye Yang <optimistyzy@gmail.com>
Reviewed-on: https://review.gerrithub.io/400903
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2018-02-23 15:45:19 -05:00
Shuhei Matsumoto
f35f395b82 iscsi/rpc: Adjust format of bdev_name_id_pair between dump and construct
JSON format of bdev_name_id_pair is different between
construct_target_node() and get_target_nodes().

construct_target_nodes() uses the following format:

    "lun_ids": [
      1
    ],
    "bdev_names": [
      "Malloc0"
    ]

get_target_nodes() uses the following format:

    "luns": [
      {
        "lun_id": 0,
        "bdev_name": "lvs_1/lbd_1"
      },
    ]

The second format is better than the first format. Hence unify to
the second format.

Change-Id: If097e41ada0f2fe3754691cee0a0774db97c4ebb
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-on: https://review.gerrithub.io/399993
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2018-02-21 15:07:48 -05:00
Shuhei Matsumoto
3b4e5493d9 iscsi/rpc: Adjust PG:IG map format between dump() and construct()
For the following JSON-RPC:
1) get_target_nodes
2) construct_target_node
3) add_pg_ig_maps
4) delete_pg_ig_maps
JSON format is not unified yet.

1) uses the following:
    "pg_ig_maps": [
      {
        "ig_tag": 1,
        "pg_tag": 1
      }

2), 3), and 4) use the following:
    "ig_tags": [
      1
    ],
    "pg_tags": [
      1
    ],

the first format is better than the second format. Hence unify to
the first format.

Change-Id: I6cc19115001b9c9ba9db5c87db1def7c0b3bd80c
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-on: https://review.gerrithub.io/400203
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
2018-02-21 15:07:48 -05:00
Jim Harris
2ecab7bd6a net: remove ability to override default net_framework
In early days of SPDK, there was an experimental userspace
TCP stack called libuns.  The SPDK iSCSI target supported
using either the default POSIX/kernel TCP stack or this
libuns TCP stack.

libuns is no longer in use, but work has started on
supporting the FD.io VPP TCP userspace stack.  Abstractions
are being put in place to allow *both* the POSIX and VPP
stacks simultaneously.

So remove the concept of a "default" net_framework that is
defined with weak symbols that can be overridden by another
object file.  While here, also remove the "clear_socket_association"
concept which was specific to libuns.

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: I8a0385ca5ae113e34a637f835d8d69f8d510433e

Reviewed-on: https://review.gerrithub.io/400328
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
2018-02-21 12:40:30 -05:00
Shuhei Matsumoto
7ee8684c84 iscsi/rpc: Extract dump config into functions
This patch is a preparation to match response of dump with request
of construct (load).

Change-Id: I08d0e860ecd842fabf2bbea0b888a60ffd51b055
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-on: https://review.gerrithub.io/399992
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
2018-02-15 15:40:02 -05:00
Shuhei Matsumoto
2982a74df9 iscsi&rpc: Add new initiator information to an existing initiator group
Adding new initiator to an existing initiator group to allow login
will be usual. This patch support the following JSON-RPC commands:
- add_initiators_to_initiator_group
- delete_initiators_from_initiator_group

Both initiator's name and netmask are optional but already added
name or netmask cannot be added.

Test code is added too.

Change-Id: Ic101210b9d00c2b36e37ece23fcba8cfe8e44eb8
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-on: https://review.gerrithub.io/398361
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
2018-02-15 11:28:19 -05:00
Jim Harris
e3f2a3949d sock: add sock_group abstraction
For now, this provides common abstraction for Linux epoll
and FreeBSD kqueue.  It also provides the basis for future
changes where alternate userspace TCP stacks have their own
mechanism for polling a group of descriptors.

While here, remove old epoll/kqueue code in iscsi/conn.c that
was commented out when the iSCSI idle connection code was
recently removed - we now have a real implementation of it
in sock.c so the original code is no longer needed as a
reference.

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: I664ae32a5ff4d37711b7f534149eb0eb35942335

Reviewed-on: https://review.gerrithub.io/398969
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
2018-02-13 19:25:22 -05:00
Jim Harris
4b10029435 net, iscsi: add struct spdk_sock abstraction
This provides an abstraction layer around TCP
sockets.  Previously we just used fd integers, but
we don't want to be tied to integers for alternative
userspace TCP stacks.

Future patches will do more work to enable multiple
implementations of this abstraction.  For now, just
get the abstraction in place for POSIX sockets and
make all of the iSCSI changes associated with it.

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: I9a825e9e02eb6927c8702d205665c626f57b3771

Reviewed-on: https://review.gerrithub.io/398861
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Ziye Yang <optimistyzy@gmail.com>
2018-02-12 12:30:39 -05:00
Jim Harris
67c9ea6ad9 net: add sock.h
The socket-related code was already broken out into
lib/net/sock.c, so break out the header portions
from include/spdk/net.h into its own sock.h.

This prepares for some upcoming changes in how
TCP sockets are abstracted, to enable alternative
userspace TCP stack implementations to be used with
SPDK.

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: I40b162e72ea80c235b49f10b17c2085fcfb385d4
Reviewed-on: https://review.gerrithub.io/398851
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: Ziye Yang <optimistyzy@gmail.com>
Reviewed-by: <shuhei.matsumoto.xt@hitachi.com>
2018-02-08 12:05:54 -05:00
Shuhei Matsumoto
13cffa4a0d iscsi: Consolidating checking uniqueness of IG into register/unregister
Checking uniqueness of initiator group is done without mutex and
before register/unregister. This is not thread-safe.

This patch is a preparation to dynamic addition of initiator
information to existing initiator groups.

Change-Id: I44f48c857210522eee70d14bc3735ec73b0c5c6f
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-on: https://review.gerrithub.io/397032
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
2018-02-06 10:54:42 -05:00
Shuhei Matsumoto
2ea005f0a9 iscsi: Unify the ordering of PG create_op between conf-file and JSON-RPC
Orderings of portal group create operation are diferrent between
config file and JSON-RPC. Unification is necessary for correct
concurrency control and the global accept poller like NVMf-tgt.
Hence unify the ordering of operations in this patch.

Common ordering of portal group create operation between configuration
file  and JSON-RPC after this patch is the following:
 - create a portal group
 - create portals
 - add the portals to the portal group
 - open the portals of the portal group
 - add the portal group to the global portal group list

After this patch, the gap between listening socket and accepting socket
will be increased a little when portals groups are creted by config file.
However this will cause no issue because of the TCP backlog and resend
mechanism.

Besides, necessary concurrency control is added and minor refactoring
is done.

About portal group delete operation, orderings of application shutdown
and JSON-RPC are already unified.

Change-Id: I1db7ef4400388127134d7734c68e138a4573b734
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-on: https://review.gerrithub.io/396848
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
2018-02-06 10:54:42 -05:00
Shuhei Matsumoto
04c6347b4e iscsi: Consolidate checking uniqueness of PG into register/unregister
Checking uniqueness of portal group is done without mutex and
before register/unregister. This is not thread-safe.

Hence this patch is added to ensure PG uniqueness.

A little related refactoring is also done.

Change-Id: Iaa3b5e380f2be5cfdaa2d69f9f2763c98954b0c3
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-on: https://review.gerrithub.io/396847
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
2018-02-06 10:54:42 -05:00
Shuhei Matsumoto
950065042c iscsi: Ensure uniqueness of network portal by mutex
Network portal must be unique globally but mutex is not added yet.
This patch is added to ensure it.

Change-Id: I3cdd85fd524b0da767d3cd83022e0637f3a32bc9
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-on: https://review.gerrithub.io/396846
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
2018-02-06 10:54:42 -05:00
Jim Harris
89859d3118 iscsi: use temporary poller when PDUs cannot all be flushed
This removes PDU flushing from the main connection poller -
all PDU flushing is now done inline when the PDU is completed,
or from the context of the new flush poller.

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: I703cb451d4b548e7f75892e31a7927b511fb4f55

Reviewed-on: https://review.gerrithub.io/395543
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Ziye Yang <optimistyzy@gmail.com>
2018-02-05 15:24:28 -05:00
Jim Harris
a1bbed818e iscsi: flush PDUs immediately instead of waiting for poller
Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: I39152be9653316a24135cde497662cfbc8f68e3a

Reviewed-on: https://review.gerrithub.io/395523
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Ziye Yang <optimistyzy@gmail.com>
2018-02-05 15:24:28 -05:00
Tomasz Kulasek
601bcbcf66 util: extend cpumask to hold more than 64 cpus
Fixes github issue #218.

This patch introduces spdk_cpuset object to store and manipulate
the set of individual CPUs. The main objective of this object is
to replace cpumask declared as uint64_t and extend the limitation
of supported CPUs (lcores) above 64 CPUs.

spdk_cpuset is always allocated dynamically and accessed by opaque
pointer, what makes it easier to extend in the future without
breaking API/ABI.

This patch also extends parsing function allowing to set cpumask
using a list of cpus e.g. "[0-4,10,12]" sets mask of 0,1,2,3,4,10,12
as well as hexadecimal string with and without "0x" prefix.

Change-Id: I475c3ba7fab629021a22e03176e57e400dd24a49
Signed-off-by: Tomasz Kulasek <tomaszx.kulasek@intel.com>
Reviewed-on: https://review.gerrithub.io/390794
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2018-01-25 18:51:50 -05:00
Shuhei Matsumoto
8f9028deb3 iscsi/rpc: Fix completeness of dump of iSCSI global params
To use JSON dump of iSCSI global parameters as configuration file,
at bootup, it must have completeness.

This patch fixes the following:
- DefaultTime2Wait was not contained.
- MinConnectionsPerCore was not contained.
- Converting only 0 to "None" for dump is not efficient.

Change-Id: I740e6938c216c5c62df6ee70b0ceac40fd0cac00
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-on: https://review.gerrithub.io/396100
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
2018-01-24 18:32:37 -05:00
Jim Harris
22bdcdc39b iscsi: reuse spdk_iscsi_conn_stop_poller
Similar functionality is needed when migrating a connection
to its new core after login.  So make spdk_iscsi_conn_stop_poller
reusable for that case, and call it in the login migration path.

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: Ie014a2e50d6ed02165317deab85c943225953197

Reviewed-on: https://review.gerrithub.io/395857
Reviewed-by: <shuhei.matsumoto.xt@hitachi.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2018-01-24 15:39:05 -05:00
Jim Harris
20528e262d iscsi: simplify spdk_iscsi_conn_stop_poller()
All calls to this function now use spdk_env_get_current_core()
as lcore, so remove this parameter.

All calls to this function also use _spdk_iscsi_conn_free() as
the stop_fn, so remove that parameter as well - just call that
function directly from the callsites and eliminate the extra
event.

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: I639e63d26fbfcc054137d9b453be2927e2c1f625

Reviewed-on: https://review.gerrithub.io/395854
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: <shuhei.matsumoto.xt@hitachi.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2018-01-24 15:39:05 -05:00
Jim Harris
5aa90453cb iscsi: move spdk_iscsi_conn_get_migrate_event inline
This function is now only called from one place, and moving
this inline will simplify some future patches which will
consolidate the login and full-feature pollers.

No functional change.

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: I7d4e6973882c7b579e341283648317e8e06d998a

Reviewed-on: https://review.gerrithub.io/395853
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: <shuhei.matsumoto.xt@hitachi.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2018-01-24 15:39:05 -05:00
Jim Harris
4d48d87a7f iscsi: remove idle connection handling
Some upcoming changes will effectively render this moot
anyways by adding an epoll/kqueue descriptor to poll
on in all cases (not just connections that have been
idle for 5ms).

The epoll/kqueue code was just ifdef'd out instead
of removed - some of this code will be useful
and reusable with minimal changes in the upcoming
patches.

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: I0c354390537e6369cb3c32e78a59c300dec6d098

Reviewed-on: https://review.gerrithub.io/395553
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: <shuhei.matsumoto.xt@hitachi.com>
2018-01-22 23:22:17 -05:00
Jim Harris
8c2b8ca7d7 iscsi: put spdk_iscsi_conn_write_pdu() in lib/iscsi/conn.c
This function was originally named spdk_iscsi_write_pdu()
in lib/iscsi/iscsi.c.  Since this is an operation on a
connection, add "conn" to the name and move it to conn.c.

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: Iaad022907d43788108d5b2660306abcf5e94040d

Reviewed-on: https://review.gerrithub.io/395522
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: <shuhei.matsumoto.xt@hitachi.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
2018-01-22 23:22:17 -05:00
Jim Harris
936eb59d8d iscsi: use return code to determine if all PDUs were flushed
This will enable some future enhancements where the main
iSCSI connection poller will not try to flush PDUs, we will
just start a separate poller to periodically flush PDUs in that
case.

This is all part of broader scheme to enable epoll() for
iSCSI.  Making these changes allows us to avoid using epoll()
to signal when TCP buffer space is available.

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: I6fe9314e386673fcc87bb15580ef808838c55a7b

Reviewed-on: https://review.gerrithub.io/395521
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: <shuhei.matsumoto.xt@hitachi.com>
2018-01-22 23:22:17 -05:00
Shuhei Matsumoto
632f0ced75 iscsi/rpc: Set processor affinity of connection through JSON-RPC
Currently setting cpumask to portal is possible only through
iSCSI.conf. This patch makes possible for any user to set cpumask
through JSON-RPC too.

The following are done in this patch:
- To keep compatibility, cpumask parameter handled as optional.
- Python test code is added.
- Current python script for JSON-RPC does not work correctly for
  IPv6 and the issue is fixed.

Change-Id: I42ef397ce95040a36db4430417a35e9e97527477
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-on: https://review.gerrithub.io/391728
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
2018-01-22 15:54:48 -05:00
Jim Harris
7bae25dfcd iscsi: remove flush timeout
This concept was added very early in the SPDK iSCSI target
development process when there was a high focus on maximizing
throughput on a single iSCSI connection with 512-byte reads.

Realistically, in multi-connection environments focused on
predominantly 4KB (or more) workloads, this concept loses its
effectiveness - it is relatively rare that PDUs from multiple
I/O would coalesce within the default 8us flush timeout period.

There were no users of flush timeout in the SPDK tree - it was
not even documented in the iSCSI configuration file example and
there was no way to modify it at run time.  So leave the change
out of the CHANGELOG.

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: I08c3e959fb3945dc2c9cb89248305d0c88aa778f

Reviewed-on: https://review.gerrithub.io/395520
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
2018-01-22 13:37:31 -05:00
Shuhei Matsumoto
f587197d21 iscsi&iscsi/ut: Unify cpumask decode between iSCSI.conf and JSON-RPC
Currently cpumask cannot be specified for each portal when it is
created by JSON-RPC and portal group creation is not unified
between iSCSI.conf and JSON-RPC.

This patch does the following:
 - cpumask string is decoded in spdk_iscsi_portal_create() which
   is common between iSCSI.conf and JSON-RPC.
 - parsing configline of portal is difficult to understand and
   hence it is refactored.
 - UT code is added.

 JSON-RPC will be added by the next patch.

Change-Id: I13b9989263fae5facff260de32a55ec99f5d5a06
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-on: https://review.gerrithub.io/392447
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2018-01-19 15:47:57 -05:00
Shuhei Matsumoto
afc97ddcf7 iscsi/rpc: Configure Header/Data digest through JSON-RPC
This patch makes possible to set and get Header Digest and Data
Digest of target.

Change-Id: I1d1b892f9dfb747c0f5ad8fc4fddef40929b4143
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-on: https://review.gerrithub.io/394482
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
2018-01-17 12:41:29 -05:00
Shuhei Matsumoto
de70d712fb iscsi: Check CHAP params when a target is created by JSON-RPC
When a target is created by iSCSI.conf, only valid CHAP params
are passed to spdk_iscsi_tgt_node_construct().

When a target is created by JSON-RPC, help information encourages
users to specify valid CHAP params but
spdk_iscsi_tgt_node_construct() does not check CHAP params and
users can create targets whose CHAP params are invalid.

Change-Id: I7e9057a982f21f04782481cda74208a139c1fdad
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-on: https://review.gerrithub.io/394481
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2018-01-17 12:41:29 -05:00
Shuhei Matsumoto
f04569140c rpc/iscsi: Adding an LUN to an existing target
Add JSON-RPC to add an LUN to an existing target. The parameter
lun_id is optinal and if skipped, the lowest free LUN ID will be
assigned.

This JSON-RPC is tested in iscsi_tgt/rpc_config.

Change-Id: I010619f2d4ccec89c589bb0618466b4d15949ebb
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-on: https://review.gerrithub.io/385181
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2018-01-17 12:41:29 -05:00
Shuhei Matsumoto
3b3c6002c9 iscsi: Add LUN to an existing target (not runtime)
Removing an LUN from an existing iSCSI target is possible by
removing the corresponding BDEV. However adding an LUN to an
existing iSCSI target is not possible yet.

Add a new function spdk_iscsi_tgt_node_add_lun() and related
functions first toward supporting this function.

JSON-RPC for this operation will be submitted an another patch.

Informing the newly added LUN to the initiator is not included
in this patch. Hence this operation is possible only for any
inactive target.

Change-Id: I3a28f4d75a17126e49c9d12ce64c3ad68f231840
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-on: https://review.gerrithub.io/385180
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2018-01-17 12:41:29 -05:00
Shuhei Matsumoto
583e969922 scsi: remove lun name
There is no need to keep a lun name anymore - we always
use the bdev name as the lun name so it is not providing any
additional value. This also keeps us from associating
the same bdev with different LUNs on different iSCSI target
nodes or vhost-scsi controllers.

Side effect of this change is:

1) Use "bdev_name" across the APIs to make it more clear
   what these names refer to.

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I3d42fde22087352ce1d5dc80178bd8c5cac8cb7c
Reviewed-on: https://review.gerrithub.io/390843
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2018-01-11 18:37:34 -05:00
Cunyin Chang
96e930fc13 iscsi: Fix the potential core dump issue for hotplug test case.
when test hotplug case with large write command which need r2t, after the
device hot removed, the outstanding r2t commands are waitting for data out PDU,
and the primary commands probably already return with error, then the lun
could be deleted, later the related data out PDU will received and try to send
other r2t, this patch make sure the r2t command sent smoothly even the device
hot removed.

Change-Id: I49061d1258e65cb0964526f755d870ebe7095920
Signed-off-by: Cunyin Chang <cunyin.chang@intel.com>
Reviewed-on: https://review.gerrithub.io/394321
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2018-01-11 14:37:08 -05:00
Xiaodong Liu
9802eb0e48 iscsi: remove pointless comparasion
Change-Id: I343d2f1a8f3327ad030a786633bbe9e8c66c14fc
Signed-off-by: Xiaodong Liu <xiaodong.liu@intel.com>
Reviewed-on: https://review.gerrithub.io/394138
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Ziye Yang <optimistyzy@gmail.com>
Reviewed-by: <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2018-01-11 10:58:57 -05:00
Daniel Verkamp
e45437aba7 scsi, iscsi: move task->parent to iSCSI task
The SCSI layer no longer needs to know about the parent/subtask
relationship maintained by iSCSI.

Change-Id: Ia6f7c5367c5b656bd7521ed1abb6d0f713a0500b
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-on: https://review.gerrithub.io/393697
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: <shuhei.matsumoto.xt@hitachi.com>
2018-01-05 00:01:37 -05:00
Shuhei Matsumoto
60f1d52605 iscsi: restore data_transferred accumulation for read
In the patch 393582, by analyzing the code,
accumulation of write completion to bdev was duplicated by
data_transferred and bytes_completed.

Hence accumulation of data_transferred for write was intended
to be removed.

However by mistake accumulation of data_transferred for read
was removed.

In this patch restore accumulation of data_transferred for
read and remove accumlation of data_transferred for write.

Test code to catch this degradation will be added by another
patch soon.

Change-Id: Iea9883e8ef1bfb0bdf00e291712e6faf2fad281f
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-on: https://review.gerrithub.io/393713
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: Ziye Yang <optimistyzy@gmail.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2018-01-04 20:18:19 -05:00
Shuhei Matsumoto
8bb603da82 iscsi: Remove duplication of the variable for write completion to bdev
This patch will follow the change 393212 by Daniel.

For read command:
- primary's scsi.bytes_completed is for read completion from bdev.
- primary's scsi.data_transferred si for send completion to initiator.

Two variables have its own meaning, respectively.

However for write command:
- both primary's scsi.bytes_completed and scsi.data_transferred are
  for write completion to bdev.

Hence for write we should use only either one and it looks that
bytes_completed will be appropriate.

Change-Id: I991c00170ad3651fe926173657e8a49a9a38d02a
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-on: https://review.gerrithub.io/393582
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2018-01-04 15:41:51 -05:00
Daniel Verkamp
380b3fc878 scsi, iscsi: accumulate data_transferred in iSCSI
Each SCSI task should only report its data_transferred; the
parent/subtask relationship should be handled in iSCSI.

Change-Id: Ibece110fd8cca4e94648942fe6b5e004a4fd8a80
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-on: https://review.gerrithub.io/393212
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2018-01-04 15:01:30 -05:00
Pawel Wodkowski
891c12a63c util: add spdk_strerror() wrapper with TLS support
This patch remove need for additional buffer when translating error code
to string.

Change-Id: Iaa60088b5c450581d3cdddbb425119b17d55a44b
Signed-off-by: Pawel Wodkowski <pawelx.wodkowski@intel.com>
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-on: https://review.gerrithub.io/386114
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2018-01-04 15:00:09 -05:00
Ziye Yang
2f700bd9ec iscsi/conn: remove the libuns related comments.
Change-Id: I7df72b21f78ab7f0fe0389b478072330bbbd4215
Signed-off-by: Ziye Yang <optimistyzy@gmail.com>
Reviewed-on: https://review.gerrithub.io/393015
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
2018-01-03 14:03:18 -05:00
Shuhei Matsumoto
41bfe2049d iscsi: Sequence error of Data-out PDU when ERL=0
SPDK drops the connection when it observes any sequence error of
Data-out PDU when ERL = 0. This is too severe and change dropping
the connection to Reject response.

This issue was detected by libiscsi test suite.

Change-Id: Ic8f50ce55c4e73c8517f726e8cf0e4ff8a0953df
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-on: https://review.gerrithub.io/391158
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2018-01-03 13:50:42 -05:00
Daniel Verkamp
85f55b7383 scsi, iscsi: move lun_id field to iSCSI task
This is not used in the generic SCSI layer.

Fixes: 8eba104b73 ("iscsi: Fix the bug for hotplug when read IO is
running.")

Change-Id: Ie0715ea0ee5084eaf1321ba2f65f7bfa674c663a
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-on: https://review.gerrithub.io/393211
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2018-01-03 12:09:57 -05:00
Daniel Verkamp
543cb17248 build: remove $(ENV_CFLAGS) where not necessary
Only Makefiles for libraries that directly depend on DPDK (rather than
the SPDK env abstraction) should add $(ENV_CFLAGS).

Change-Id: Ifdf44d3ef8c42bbf7f20edd524b330d00658235b
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-on: https://review.gerrithub.io/392818
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2018-01-03 12:05:59 -05:00
Daniel Verkamp
61c1493785 iscsi: disallow netmask prefix of 0 bits
Netmasks with 0 bits of prefix do not make sense.  For example,
192.168.1.2/0 would allow hosts from any address, but this is
indicated with a special "ANY" value rather than a normal netmask.

Netmask prefixes of the full address size (e.g. 32 for IPv4 and 128 for
IPv6) are still allowed, since this represents a valid configuration
that matches a single specific address.

This also allows the IPv4 netmask math to be done entirely in uint32_t
instead of promoting to unsigned long long to avoid undefined behavior
when bits == 0 (shift count would have been 32 in that case).

Change-Id: I021b718e6a46f628c96a358edae816de81cd8929
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-on: https://review.gerrithub.io/392969
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2018-01-03 12:02:06 -05:00
Daniel Verkamp
026dd8c6b5 iscsi: remove errno lookups for allocations
The only errno value that can usefully be returned from malloc(),
calloc(), realloc(), strdup(), etc. is ENOMEM, so there's no need to
translate the errno value to a string for the error message.

Change-Id: I8e8bd4f12ec4f3b99649760e397e1bc71cca7eff
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-on: https://review.gerrithub.io/392985
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: <shuhei.matsumoto.xt@hitachi.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
2017-12-29 13:48:29 -05:00
Shuhei Matsumoto
a58611d513 iscsi: Remove unused macro constants
Remove unused macro constants of iSCSI.
MAX_PORTAL, MAX_INITIATOR, MAX_NETMASK are still used to determine
buffer size for JSON-RPC and iSCSI.conf and are not removed in
this patch yet.

Change-Id: I3036dc472eca09eff7fa3f6ea7e8e28b0978358f
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-on: https://review.gerrithub.io/392912
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2017-12-27 12:49:32 -05:00
Shuhei Matsumoto
f53462b432 iscsi: ANY does not work as wild card netmask of ACL (degradation)
A few previous changes replaced ALL by ANY for the initiator group
because ANY was normal for this case. ANY was tested enough for
the initiator name of the initiator group but not tested for
the netmask of the initiator group.

Hence the previous changes caused degradation.
This is the bug fix and UT code is added together.

Change-Id: Idf7642dd4c111a4788aca31a0105b3497631aecd
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-on: https://review.gerrithub.io/392923
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2017-12-26 17:21:50 -05:00
Ziye Yang
82ac638d80 iscsi/portal_grp: make some functions into static and remove unused ones
1 Some functions should be static.
2 For the unused API, we delete them first. When it is used, we should add
them back.

Change-Id: I2c39e8bef96155fc71801c76534955d9cf6cb0bd
Signed-off-by: Ziye Yang <optimistyzy@gmail.com>
Reviewed-on: https://review.gerrithub.io/392721
Reviewed-by: <shuhei.matsumoto.xt@hitachi.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
2017-12-26 11:16:47 -05:00
Ziye Yang
40dbe37f63 iscsi: make spdk_del_connection_queued_task into static
No need to export this function, since it is only
used in lib/iscsi.c

Change-Id: Ib5fc3d54e45d0b5696413788a6a98278e9c2dfef
Signed-off-by: Ziye Yang <optimistyzy@gmail.com>
Reviewed-on: https://review.gerrithub.io/392716
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
2017-12-26 11:14:38 -05:00
Ziye Yang
57199e1e89 iscsi: change name of function spdk_iscsi_conn_handle_queued_tasks
Reason: It only handles the queue datain tasks. After the changing,
it would be more accurate for the code reading.

Change-Id: I87999f811810cadd4b58d99be1cdeba0a1a7503f
Signed-off-by: Ziye Yang <optimistyzy@gmail.com>
Reviewed-on: https://review.gerrithub.io/392719
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: <shuhei.matsumoto.xt@hitachi.com>
2017-12-26 11:13:47 -05:00
Ziye Yang
1b7ce80530 env: export spdk_env_get_last_core function.
Also use this function in iscsi/conn.c

Change-Id: I25f6da175eddb12c4ac2624d695c2c43c871d8e8
Signed-off-by: Ziye Yang <optimistyzy@gmail.com>
Reviewed-on: https://review.gerrithub.io/392713
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2017-12-23 15:08:24 -05:00
Ziye Yang
4547ce65a8 iscsi: make some functions into static
No need to export these functions since they are not
used by other files.

Change-Id: Iab5d44667cc0d57ec105e90a71d434cc4e07f4f5
Signed-off-by: Ziye Yang <optimistyzy@gmail.com>
Reviewed-on: https://review.gerrithub.io/392590
Reviewed-by: <shuhei.matsumoto.xt@hitachi.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2017-12-21 12:19:44 -05:00
Ziye Yang
50d0957b5e iscsi/conn: remove rte_config.h header
For g_num_connections, we should create an proper
array size, we cannot directly create it by the size:
spdk_env_get_core_count(). The reason is that the
core mask can be non-continuous,e.g., 0x1001, thus
for effient access, we create a large array size with
last_core +1, although we will have some space waste,
but this will not be big, but still maintain the fast
array index acccess.

Change-Id: I95e1fc34e0816ac2f8764880c0d0e629f43a5dc4
Signed-off-by: Ziye Yang <optimistyzy@gmail.com>
Reviewed-on: https://review.gerrithub.io/391909
Reviewed-by: <shuhei.matsumoto.xt@hitachi.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2017-12-21 11:50:49 -05:00
Shuhei Matsumoto
b65443be6e iscsi: Allow to set cpumask more than active cores for iSCSI connection
Currently the cpumask must be a subset of the reactor mask.

However, this is different from sched_setaffinity() function
and taskset command of FreeBSD and Linux.  The latter will
be familier for more people. Hence the later is adopted.

The following is quoted from the FreeBSD Man Page of taskset:

  The CPU affinity is represented as a bitmask, with the lowest
  order bit corresponding to the first logical CPU and the
  highest order bit corresponding to the last logical CPU.

  Not all CPUs may exist on a given system but a mask may specify
  more CPUs than are present.

  A retrieved mask will reflect only the bits that correspond to
  CPUs physically on the system.

  If an invalid mask is given (i.e., one that corresponds to no
  valid CPUs on the current system) an error is returned.

  The masks are typically given in hexadecimal.

Change-Id: I7e0d2e029569bfc986f7fcdf78048791ab389f72
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-on: https://review.gerrithub.io/392446
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2017-12-20 15:19:04 -05:00
Shuhei Matsumoto
0241b85bc1 iscsi: Remove DPDK dependency and simplify load balancing
Load balancing for idle iSCSI connections uses the RTE EAL Launch
state and uses DPDK RTE EAL API.

But all SPDK reactors will exit simultaneously because each SPDK
reactor checks if the global state is RUNNING to exit.

Hence calling rte_eal_get_lcore_state() is not necessary.

When the reactor hot-plug function is supported, this implementation
will be reconsidered together.

Change-Id: I34eaf3e42b5b7deae6473d2bfaf0910aaa9da6de
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-on: https://review.gerrithub.io/391339
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2017-12-20 15:17:15 -05:00
Shuhei Matsumoto
855d8e032a iscsi: change master_lcore to first_core for idle connection management
Currently idle iSCSI connections are managed by the master lcore,
but the master lcore is like BSP of OS and for initialization.

To manage idle iSCSI connections it is important that the core is
consistent.

Hence the first core is better than the master lcore.

In this patch the following are changed together:
- Errors of kqueue() and epoll_create1() are not related with master
  lcore. "master lcore" is removed and errno is added into the log.
- In spdk_iscsi_conn_allocate_reactor(), when cpumask is 0, 0 is
  selected as core number. 0 is not safe and first_core is used instead.

In spdk_iscsi_conn_allocate_reactor(), when first_core is used instead
of master_lcore, we may observe some contradiction in the following
code. But few changes are done in this patch.

In the current implementation we can assume the first lcore is
equal to the master lcore and the following code will be removed
in the subsequent patch.

/*
 * DPDK returns WAIT for the master lcore instead of RUNNING.
 * So we always treat the reactor on master core as RUNNING.
 */
if (i == master_lcore) {
    state = RUNNING;
} else {
    state = rte_eal_get_lcore_state(i);
}

Change-Id: I6cac06c27b289db5ea1f9452e33489286c64d2fa
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-on: https://review.gerrithub.io/391338
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2017-12-20 15:17:15 -05:00
Shuhei Matsumoto
7767990829 iscsi: Unexpected usage of RTE EAL Launch in load balancing
Before removing the DPDK dependency from the iSCSI connection
load balancing, this should be done.

In spdk_iscsi_conn_allocate_reactor(cpumask)

- if any lcore[i]'s state is FINISHED, the caller calls
  rte_eal_wait_lcore(i). But the purpose of rte_eal_wait_lcore()
  is to check if the slave is in a WAIT state before calling
  rte_eal_remote_launch(). The meaning of this usage is not clear.

- If the state of lcore[i] is WAIT or FINISHED, the reactor does
  not run on the lcore[i]. iSCSI connections consist of not reactor
  but poller. Hence selecting lcore[i] with the state WAIT or
  FINISHED does not look correct.

Change-Id: If8c420f2d16dc44e77f8963f5732faa52e3d829b
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-on: https://review.gerrithub.io/391332
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Ziye Yang <optimistyzy@gmail.com>
2017-12-20 15:17:15 -05:00
Shuhei Matsumoto
8fd2882fb2 etc/spdk/iscsi.conf.in: How to use cpumask for the connection
User can specify processor affinity for each iSCSI connection
by specifying cpumask in the configuration file.

However the example of iscsi.conf.in does not have any description
about this. Hence it is very difficult for user to use this.

The portal group section of the config dump file has the same
description. Hence it is also changed.

Change-Id: I6e7b3bb67e10e78f4a47165525f023555080f146
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-on: https://review.gerrithub.io/391510
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
2017-12-20 11:31:45 -05:00
Shuhei Matsumoto
28ff7a0da7 iscsi: Set cpumask to all available CPUs when PG is created JSON-RPC
Currently the default setting of cpumask of network portal is
different between iSCSI.conf and JSON-RPC.

When a network portal is created by iSCSI.conf, its cpumask is
set to all available CPUs by default. However when it is created
by JSON-RPC, its cpumask is set to 0 by default.

Auto test 'test/iscsi_tgt/idle_migration creates a network portal
by JSON-RPC. Hence the auto test cannot test the load balancing
function of iSCSI target.

Change-Id: I2685172cb9259b643f6d18d4660a8425dcef3f5d
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-on: https://review.gerrithub.io/391898
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
2017-12-19 15:22:05 -05:00
Shuhei Matsumoto
b37d1b60f1 scsi&test/iscsi_tgt: SCSI device == iSCSI name
In the iSCSI specification, the SCSI device name is defined to be
the iSCSI name of the node.

However, when g_spdk_iscsi.nodebase is used, the SCSI device name
is made of the device specific string (the part of IQN after the
colon).

The size of the temporary buffer fullname[MAX_TMPBUF] in
spdk_iscsi_tgt_node_construct() is 1024 and the size of
spdk_scsi_dev.name is 255. The former is larger than the later.

However the max length of IQN, EUI, NAA are 223, 20, and 36,
respectively. All are less than 255.

Hence even if we use fullname as the SCSI device name, no overflow
will occur. Even if fullname is more than 255, strncpy() does not
write more than 255 in spdk_scsi_dev_construct().

It's possible to check the length of iSCSI name strictly, but I
will do the least in this patch.

Change-Id: Icc6655fcd846797720867c10e316d2951c664030
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-on: https://review.gerrithub.io/390360
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2017-12-19 13:34:03 -05:00
Shuhei Matsumoto
81673d0c25 iscsi: Remove use of perror for malloc, strdup, and writev failure
All SPDK libraries should use the spdk/log.h family of functions
for logging.

Change-Id: I2b8ac30f2901b325784552f0016f1058ae2cd577
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-on: https://review.gerrithub.io/391687
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2017-12-19 11:41:43 -05:00
Shuhei Matsumoto
d777bfd148 iscsi: Remove nested, duplicated, or unreferenced file inclusion
When header files include other header files, it can be difficult
to read the chain of relationships. Hence remove obvious nested
header inclusion.

Remove obvious unreferenced header inclusion too.

Change-Id: I13b1c4e107da8c1a93fae4a0e3c3ee273887aab0
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-on: https://review.gerrithub.io/391363
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2017-12-14 11:30:05 -05:00
Shuhei Matsumoto
06beb0249f iscsi/rpc&test/iscsi_tgt: get iSCSI global params
SPDK does not provide casual way to get iSCSI global parameters
set by iSCSI.conf. Hence test/iscsi_tgt have to use hard-coded
value for iSCSI target's nodebase.

NVMeOF provide similar JSON-RPC dump_nvmf_subsystem().

Change-Id: I1a53572f707e83cfd18369475b2565c6390a4d2d
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-on: https://review.gerrithub.io/391323
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2017-12-14 11:30:05 -05:00
Daniel Verkamp
c2009e9e85 scsi: remove spdk_scsi_dev_print() function
Replace the single call to spdk_scsi_dev_print() with a reimplementation
using public SCSI API functions, and also using the SPDK logging
framework instead of printf().

Change-Id: Ifa455f9e6a4a07a35d5dec311a61e9a8afaa0227
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-on: https://review.gerrithub.io/391320
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2017-12-12 18:04:20 -05:00
Shuhei Matsumoto
11774a35a8 iscsi: Stale pointer when deleting PG and then IG
This bug is detected by test/iscsi_tgt/rpc_config

Due to the PG-IG map tree, IG-map is added to PG-map.
When PG was deleted first, PG-map was not deleted but PG was
deleted because PG-map has IG-maps.

PG-IG map tree was designed such that when PG was deleted first,
delete all IG-maps belonging to the PG-map, the PG-map, and then
PG.

By this change stale pointer which will cause memory leak is
removed.

Change-Id: I15c2ef48bad34608e53d0b44459c90a0cffda24d
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-on: https://review.gerrithub.io/391321
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2017-12-12 12:46:14 -05:00
Ziye Yang
e78188042c iscsi: Use spdk_mempool for session and pdu related pool
Purpose: To remove the dpdk dependency for iSCSI.

Change-Id: I01ef910496d2029ba755dd6d0c06d61c248b8dfe
Signed-off-by: Ziye Yang <optimistyzy@gmail.com>
Reviewed-on: https://review.gerrithub.io/390938
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: <shuhei.matsumoto.xt@hitachi.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2017-12-11 19:42:21 -05:00
Daniel Verkamp
59970a89be astyle: enforce braces around single-line statements
Require braces around all conditional statements, e.g.:

    if (cond)
        statement();

becomes:

    if (cond) {
        statement();
    }

This is the style used through most of the SPDK code, but several
exceptions crept in over time.  Add the astyle option to make sure we
are consistent.

Change-Id: I5a71980147fe8dfb471ff42e8bc06db2124a1a7f
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-on: https://review.gerrithub.io/390914
Reviewed-by: <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2017-12-11 11:19:32 -05:00
Shuhei Matsumoto
7e5ec29a0e rpc/iscsi: Dynamic reconfiguration of PG-IG maps
Based on the PG-IG map tree implmentation, the following new
JSON-RPC commands are supported:
 - add_pg_ig_maps
 - delete_pg_ig_maps

Change-Id: Iebc48e379aa8e06b5e7d57935845d6fd53f7f826
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-on: https://review.gerrithub.io/379936
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
2017-12-07 12:28:02 -05:00
Shuhei Matsumoto
35cd600535 iscsi: Dynamic reconfiguration of PG-IG maps
This patch add the internal mechanism to add/remove PG-IG maps
to/from an existing iSCSI target.

Next patch will add new JSON-RPC commands and python scripts.

Change-Id: Ib75d180197c5cb679ebfd21324dc36790b50a7aa
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-on: https://review.gerrithub.io/389667
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
2017-12-07 12:28:02 -05:00
Shuhei Matsumoto
02814cd34b iscsi: Change protcol error from drop conn to reject
In iSCSI specification RFC7143, there is the following description
in the section 7.13:

  All violations of iSCSI PDU exchange sequences specified in this
  document are also protocol errors.

Any protocol error should be handled as iSCSI Reject response whose
the reject reason is Protocol Error.

However current implementation handles a minor PDU error as Drop
connection. This is too severe and change the code from Drop
connection to Reject response.

This issue was detected by libiscsi test suite.

Change-Id: Ie85c56f5dd523445530ec1ff71eda4f594ab73a0
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-on: https://review.gerrithub.io/389941
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
2017-12-07 12:28:02 -05:00
Shuhei Matsumoto
50ec73894c iscsi: Support SCSI port removal when PG map is removed
Currently even if PG mapping is removed from iSCSI target,
corresponding SCSI port is not removed. Hence dynamic
reconfiguration of PG to existing iSCSI target is not supported.

This patch supports dynamic SCSI port removal when the
corresponding PG mapping is removed from the existing target.

Some refactoring for SCSI port addition is also done

Change-Id: Ib06bc10743eb088d023f425742e39bb24f1b0df1
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-on: https://review.gerrithub.io/389056
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2017-12-07 12:28:02 -05:00
Daniel Verkamp
ea1c15791f log: rename SPDK_TRACE_* to SPDK_LOG_*
Disambiguate the log components from the trace functionality
(include/spdk/trace.h).

The internal spdk_trace_flag structure and related functions will be
renamed in a later commit - this is just a find and replace on
SPDK_TRACE_* and SPDK_LOG_REGISTER_TRACE_FLAG().

Change-Id: I617bd5a9fbe35ffb44ae6020b292658c094a0ad6
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-on: https://review.gerrithub.io/376421
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2017-12-07 12:23:19 -05:00
Shuhei Matsumoto
e6fea425c9 iscsi: Make MaxQueueDepth configurable by config file
MaxQueueDepth is configurable for NVMf target by configuration
file. This patch makes this flexibility possible for iSCSI target
too. Increasing macro-defined constant for MaxQueueDepth consume
extra memory regardless of the necessity and hence it may be
better to avoid that.

Change-Id: I7fa9cf86b02c5a8b16411d4b4d356c6e6c0dc3eb
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-on: https://review.gerrithub.io/388552
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2017-12-07 11:45:08 -05:00
Tomasz Zawadzki
5f1cf6cb1f net/iscsi: change close() to spdk_sock_close()
All TCP socket operations in iSCSI should go through
functions defined in sock.c.
Two close() calls did not, so they are fixed in this patch.

Change-Id: Ia5a87fd4085eb5b7e6732dc7a505e19994669a7e
Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-on: https://review.gerrithub.io/390568
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2017-12-06 17:37:55 -05:00
Ziye Yang
8acb3630d0 iscsi: let task_pool use spdk_mempool related functions
Change-Id: I054b0f20fa502f30ae3802f95ef108fc92132ff5
Signed-off-by: Ziye Yang <optimistyzy@gmail.com>
Reviewed-on: https://review.gerrithub.io/390558
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2017-12-06 17:03:15 -05:00
Shuhei Matsumoto
c5e5047d99 iscsi: Manage PG-IG maps of the target by linked list
This patch is a preparation for dynamic reconfiguration of PG-IG maps.

Current PG-IG map is implemented by a fixed-size array. Linked list
will make much easier to support dynamic reconfiguration of PG-IG maps.

Current:
target - (1..n) ---> PG_map (1..1) -> PG
                 |
                 --> IG_map (1..1) -> IG

This proposal:
target - (1..n) -> PG_map --- (1..1) -> PG
                           |
                           -- (1..m) -> IG_map - (1..1) -> IG

Change-Id: I92f668b81cdd8003aff222926f8f1ed96b61e56d
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-on: https://review.gerrithub.io/385532
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
2017-12-04 14:21:13 -05:00
Shuhei Matsumoto
863eb9e04e iscsi: Remove gropu_state from IG and PG
By supporting the management based on linked list for PG and IG
the group state of PG and IG are no longer necessary.

Change-Id: I249424cacd2d27dda4e4cb2182442d0d1e9bfb8e
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-on: https://review.gerrithub.io/388863
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
2017-12-04 11:28:52 -05:00
Shuhei Matsumoto
f4e892fe14 iscsi: make target management thread-safe by linked list
Current fixed sized array for iSCSI target is not thread safe.
When newly created targets are inserted into the array, multiple
targets may be inserted into the same position. Linked list is
better than fixed size array to support dynamic reconfiguration.

Change-Id: I4db5a3ec16844db06e0cfcd2aef1f97952f15afa
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-on: https://review.gerrithub.io/385371
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
2017-12-04 11:28:52 -05:00
Shuhei Matsumoto
c2f38258f9 iscsi: Remove redundant repetition from ACL
The results of access control procedure for login in the
spdk_iscsi_tgt_node_access() is defined in the following table:

   +------------------------------+
   |iscsi name |netmask  |result  |
   +------------------------------+
   +------------------------------+
   |denied     |-        |denied  |
   +------------------------------+
   |allowed    |allowed  |allowed |
   +------------------------------+
   |allowed    |denied   |next IG |
   +------------------------------+
   |not found  |-        |next IG |
   +------------------------------+

However current implementation have redundant repetition in the
spdk_iscsi_tgt_node_access() and the above definition is not
visible. Hence refactor spdk_iscsi_tgt_node_access().

Besides refactor spdk_iscsi_tgt_node_allow_iscsi_name() because
it has redundant repetition too.

Add UT code for these changes.

Change-Id: If06d87c1246c85439ee0482149bd887a7b53b169
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-on: https://review.gerrithub.io/379935
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
2017-12-04 11:28:52 -05:00
Shuhei Matsumoto
1674f37ac9 iscsi: Rename access control functions of target
Naming rule of access control of iSCSI target does not reveal its
intention. Hence change it before refactoring to avoid unnecessary
repeated procedure.

Change-Id: I4064ec0a5a2b52244b6de3958ee2ab41342d1a57
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-on: https://review.gerrithub.io/381248
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
2017-12-04 11:28:52 -05:00
Shuhei Matsumoto
eee268fea8 iscsi: Replace "ALL" by "ANY" for access control
In the accessibility control of iSCSI target, "ALL" is used to allow
ANY IP address-port pair or iSCSI name of initiators. However iSCSI
targets cannot know ALL initiators beforehand.

Hence "ANY" will be better than "ALL" and will avoid misunderstanding.

Comments and iscsi_tgt test code are also changed and UT code is added.

Change-Id: Id004d819df6e9ee89f6c1db2e4b4c149be062733
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-on: https://review.gerrithub.io/385168
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
2017-12-04 11:28:52 -05:00
Ben Walker
9c35e39c54 event: Move spdk_poller_register to io_channel
Make this generic and not directly dependent on
the event framework. That way our libraries can
register pollers without adding a dependency.

Change-Id: I7ad7a7ddc131596ca1791a7b0f43dabfda050f5f
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-on: https://review.gerrithub.io/387690
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
2017-11-28 12:30:37 -05:00
Shuhei Matsumoto
4df5329092 iscsi: stop using "OK/NG" for comments in ACL
"OK/NG" may be only used in Japan. It may cause misunderstanding.
Hence remove "OK/NG" or change to "Allowed/Denied".

Access control of iSCSI target follows further refactoring.
Hence to save the amount of change, "OK/NG"s are mainly removed.

Change-Id: I1f2ef9bc2be21caa86a6ae98377b6d6b3f85386a
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-on: https://review.gerrithub.io/385075
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2017-11-22 11:17:13 -05:00
Shuhei Matsumoto
b8705bf48c iscsi: manage IG's name and mask by linked list
To add initiators to an existing target, manage name and netmask
of initiator group by linked list. It is not easy for array to
detect duplication and change configuration.

Change-Id: Id9e77740e24ac309a33d8de1be37663681160d94
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-on: https://review.gerrithub.io/379932
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ziye Yang <optimistyzy@gmail.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
2017-11-21 16:06:30 -05:00
Shuhei Matsumoto
92ef1a64ec iscsi and ut/iscsi: return code to fail of IG creation
spdk_iscsi_init_grp_create_from_configfile() returns 0 even if
creating an initiator group (IG) is failed due to empty netmask or
initiator name. This will be unexpected behavior for end users.
Hence change the return code from 0 to -ENVAL for this failure.

Besides do the following.

Change other error return codes in the function by using errno too.

Current IG don't have any UT code in repository. UT code to confirm
this fix is also submitted.

Change-Id: Ic918feb5c6a3e772b325664d881b2673b553a217
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-on: https://review.gerrithub.io/384408
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
2017-11-21 16:06:30 -05:00
Ben Walker
00b02039c5 event: Pollers must now be unregistered from the thread they run on.
Change-Id: I8ea8c59a0c67176c0c0c39abf807afad61ff3828
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-on: https://review.gerrithub.io/387689
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
2017-11-17 11:11:23 -05:00
Ben Walker
fcb4776fe7 event: Pollers must now be registered from the thread they run on.
Change-Id: I864cd8a6c206dfbe62fcb3f72275c1ae51aa4ed7
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-on: https://review.gerrithub.io/387688
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
2017-11-17 11:11:23 -05:00
Ben Walker
4927c20681 iscsi: Treat unregistering pollers as a synchronous operation
We always unregister pollers from the core they're running on,
so we don't need the async completion event when unregistering
them. To avoid changing the logic, create events instead.

Change-Id: Ib50d93e1578684bea69200d89a5e0d383acc8cfe
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-on: https://review.gerrithub.io/387685
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
2017-11-17 11:11:23 -05:00
Ben Walker
435138b76d scsi: Register all pollers to the current core
Register all pollers to the current core. If necessary, send
an event to the correct core before registering.

Change-Id: Ie34cc8b11143a58c0f621c87c409a3d09d929648
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-on: https://review.gerrithub.io/387682
Reviewed-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
2017-11-17 11:11:23 -05:00
Dariusz Stojaczyk
db704770d6 env/dpdk: use rte_virt2iova instead of rte_virt2phys for DPDK 17.11
DPDK 17.11-rc3 switched to IOVA-centric
addressing. The old API is still available,
but is deprecated.

Change-Id: I7b54a1e626e39368acd2190dec725dbf30c7a5de
Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/387654
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2017-11-15 17:52:05 -05:00
Shuhei Matsumoto
7bcb08c02b iscsi: Load balancing of iSCSI target is not working
When an iSCSI connection is closed, spdk_iscsi_conn_stop_poller()
is called in spdk_iscsi_conn_destruct() or
spdk_iscsi_conn_check_shutdown().

However, through both paths, g_num_connections[] is decremented
twice:
 (1) in spdk_iscsi_conn_stop_poller()
 (2) in spdk_iscsi_conn_free()
This behavior makes g_num_connections[] negative unexpectedly and
for some cases load balancing does not work and the same CPU is
always selected.

How to fix:
spdk_iscsi_conn_stop_poller() is called in the following functions:
- spdk_iscsi_conn_check_shutdown()
- spdk_iscsi_conn_destruct()
- spdk_iscsi_conn_handle_idle().

[Idea 1]
Remove the code to decrement g_num_connections[] from
spdk_iscsi_conn_free().

[Idea 2]
Remove the code to decrement g_num_connections[] from
spdk_iscsi_conn_stop_poller(). Add the code to decrement
g_num_connections[] to __add_idle_conn().

[Idea 1] is simple because just only one line is deleted.

[Idea 2] may be more symmetric than [Idea 1] but to find the right
place to add the code in __add_idle_conn() is not clear and
difficult.

Hence [Idea 1] is proposed.

[Idea 1] may not be the optimal one and more refactoring may be
done.

Change-Id: I81050f4a0e7b3ddd40896f46ab2eb8de14bbcb3a
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-on: https://review.gerrithub.io/384026
Reviewed-by: Cunyin Chang <cunyin.chang@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
2017-11-15 13:25:06 -05:00
Shuhei Matsumoto
f9bf9cdd1c iscsi: change the return value of ACL func to bool
The following functions returns 1 and 0 for succcess and error,
respectively:
- spdk_iscsi_tgt_node_allow_ipv6()
- spdk_iscsi_tgt_node_allow_ipv4()
- spdk_iscsi_tgt_node_allow_netmask()
- spdk_iscsi_tgt_node_access()

Using bool for this purpose will avoid our misunderstanding.

Change-Id: I927876e0503c0eee5364e829a4713f9a345996f6
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-on: https://review.gerrithub.io/383664
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
2017-11-14 15:44:40 -05:00
Shuhei Matsumoto
92a6988676 iscsi: delete global PG tag check from SendTargets
In the Appendix C. SendTargets Operation in the iSCSI Specification
(RFC7143), there is the following description:

  In a Discovery session, a target MUST return all path information
  (IP address-port pairs and Target Portal Group Tags) for the
  targets on the target Network Entity that the requesting
  initiator is authorized to access.

However no description such that Target Portal Group Tag is used
to check authorization of the requesting initiator.

Moreover, according to the iSCSI Specification (RFC7143),
Target Portal Group Tag is unique within an iSCSI Target Node.

  Tarrget Portal Group Tag identifies a portal group within an
  iSCSI node.

However, current SPDK uses Target Portal Group Tag to check
authorization of the requesting initiator by mistake. This
implementation does not have any compatibility with other storage.

Hence delete the code related with Target Portal Group Tag from
SendTargets function.

Change-Id: If4b79f0d8fe8f5892a798e4f6716045fd18cf0a4
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-on: https://review.gerrithub.io/383660
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
2017-11-14 15:44:40 -05:00
Shuhei Matsumoto
335fb0e85f net&iscsi: force overwrite "*" and "[*]" by wildcard
SPDK have used "*" and "[*]" as wildcard address
for iSCSI network portal. These abbreviations may be convenient
but unusual. If "*" or "[*]" is used, output warning message
and forcefully overwrite "*" or "[*]" by "0.0.0.0" or "[::]"
respectively.

After confirming that the usage of "*" and "[*]" is not used any
more, the code for "*" and "[*]" will be deleted.

Change-Id: Ibb8fb0d4598ffa1f7b1690ad6afd10d5ae162612
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-on: https://review.gerrithub.io/383556
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2017-11-14 15:44:40 -05:00
Jim Harris
618c8f9040 iscsi: cleanup iscsi_subsystem.c
1) Replace some perror() calls with SPDK_ERRLOG
2) Use spdk_conf_section_get_boolval() to simplify the code

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: I2a6d0773b09ad16ea35cb6d2f18a9e0977dba31c

Reviewed-on: https://review.gerrithub.io/386666
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2017-11-13 14:58:34 -05:00
Jim Harris
d97476efdf iscsi: shutdown iscsi library as part of subsystem fini path
With the new asynchronous subsystem finish framework, we can
drive shutdown of existing connections as part of the subsystem
finish path instead of a separate spdk_iscsi_shutdown function
called as the shutdown function in response to SIGINT.

This is a step towards enabling a single target app that
supports multiple protocols (i.e. iSCSI + vhost + NVMe-oF).

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: Id9f596a8091912a72ab7eb93cb45a46fdb130a48

Reviewed-on: https://review.gerrithub.io/386695
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
2017-11-13 14:57:49 -05:00
Jim Harris
6bef902ca5 rpc: add default UNIX domain socket listen address
RPC is a default feature required for almost all usages,
so enable RPC by default, but with a UNIX domain socket
for security reasons.

-r can now be used from the command line to specify
an alternative RPC listen address from the default
/var/tmp/spdk.sock.

Remove the Enable parameter from the Rpc config section
but still allow specifying an alternative listen address
using the Listen parameter as an alternative to the
command line option.  This keeps backward compatibility
for this release for anyone using the configuration file
still.

Remove the Rpc sections from all configuration files
that were using them, except for those that specified
alternate TCP ports for multi-process test cases.  We
can fix these later to use an alternate UNIX domain
socket and to use the command line instead.

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: Ife0d03fcab638c67b659f1eb85348ddc2b55c4c4
Reviewed-on: https://review.gerrithub.io/386561
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2017-11-13 14:57:49 -05:00
Jim Harris
df7cf89394 iscsi, vhost, nvmf: allow running without config file
If the default config file does not exist, keep the
app's config_file options field as NULL, so that the
app code will not fail when trying to open a non-existent
file.

Also leverage the recent iSCSI and NVMe-oF refactoring,
to just skip trying to read config file parameters if no
config file exists (or the requisite section in the config
file is not present).  vhost already handled this so it did
not need to be modified.

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: Ic32f0a7a8ce85322a8effd537b62d14732d7b82e

Reviewed-on: https://review.gerrithub.io/385497
Reviewed-by: <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
2017-11-03 18:42:53 -04:00
Jim Harris
33a14041bb iscsi: make Mutual infer CHAP for DiscoveryAuthMethod options
Previously users would have to pass CHAP and Mutual as
separate words on the DiscoveryAuthMethod line - but
this was problematic since then we would have to check
that the user did not specify Mutual without CHAP.

So instead just make Mutual infer CHAP.

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: I183d59145abb97198984541157522d6483b18e7c

Reviewed-on: https://review.gerrithub.io/385495
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
2017-11-03 18:42:53 -04:00
Jim Harris
28544c4bad iscsi: ignore invalid parameters
Some invalid parameters would result in an immediate app exit, while
others such as DefaultTime2Wait would adjust an invalid value
rather than causing an app exit.

Instead, be consistent and just ignore any invalid values, with an
error message.

One exception is the CHAP + Mutual check - this will be fixed
in a separate patch.

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: I867e4a2a5685aec73df5e556d529b0356a9c3070

Reviewed-on: https://review.gerrithub.io/385494
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
2017-11-03 18:42:53 -04:00
Jim Harris
e19368049f iscsi: add spdk_iscsi_read_parameters_from_config_file()
Move all of the code related to reading global iSCSI
parameters to a new function.

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: Iccbb75996b29b0b7a87c602042f13aaf7935d7e1

Reviewed-on: https://review.gerrithub.io/385493
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
2017-11-03 18:42:53 -04:00
Jim Harris
6ffb301539 iscsi: add spdk_iscsi_log_globals()
spdk_iscsi_app_read_parameters() does an SPDK_DEBUGLOG
for each of the global parameters - consolidate these
and move them to a separate function.

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: If1543f9f5846420bf75f7a4aebaf540106f1df69

Reviewed-on: https://review.gerrithub.io/385492
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: <shuhei.matsumoto.xt@hitachi.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2017-11-03 18:42:53 -04:00
Jim Harris
b64b9814c2 iscsi: separate config file param access from defaults
Modify spdk_iscsi_app_read_parameters() so that it sets
up all of the default values first, and then reads the
config file to update any parameters that may have been
specified.

This is in preparation for breaking out the config file
reading into a separate function that can be skipped
if no config file is available.  In this case it will just
use the defaults.

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: I0b9026ea87d171be22085a6baca24e2022cb58dd

Reviewed-on: https://review.gerrithub.io/385491
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
2017-11-03 18:42:53 -04:00
Shuhei Matsumoto
fed2667127 iscsi and ut/iscsi: deny initiator grp w/ empty netmask
spdk_iscsi_tgt_node_access() (in lib/iscsi/tgt_node.c) regards
empty netmask of IG as ALL (allow all initiator's IP address).
However any user cannot create IG whose netmask is empty by both
JSON-RPC and config file. Instead user can create IG whose
netmask is ALL.

The code to regard empty netmask of IG as ALL never run in production.
Hence delete the code and add UT to confirm the fix.

Change-Id: Ib7206d0986db9093cfb6b36191be26293ff6c67a
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-on: https://review.gerrithub.io/382920
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Ziye Yang <optimistyzy@gmail.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2017-11-03 14:08:47 -04:00
Shuhei Matsumoto
e5c6b9c761 iscsi: turn <add/delete name&mask of IG> into functions
Group the code fragments of add/delete name and mask of initiators
and create spdk_iscsi_init_grp_add/delete_initiators/netmasks()
functions. Memory alloc/free is done in these functions.

Change-Id: I40f2873c5336a05813c0e34797c109386eda4229
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-on: https://review.gerrithub.io/381246
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ziye Yang <optimistyzy@gmail.com>
2017-11-03 14:08:47 -04:00
Shuhei Matsumoto
e5f7f8ba4a iscsi: delete spdk_iscsi_init_grp_destroy_by_tag()
This function is not used and there is already similar one.
Hence delete this function.

Change-Id: Iff290c4762cf5da7211382e367e5b137ab8fbf7d
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-on: https://review.gerrithub.io/381245
Reviewed-by: John Kariuki <John.K.Kariuki@intel.com>
Reviewed-by: Ziye Yang <optimistyzy@gmail.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2017-11-03 14:08:47 -04:00
Jim Harris
11bd19c80c iscsi: remove global data members for non-configurable parameters
FirstBurstLength, MaxBurstLength and MaxRecvDataSegmentLength
cannot be configured, so there is no need to keep global data
members for these parameters - just use the default #defines
instead.

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: I4b47e00a5594da8ec0b87192be4a23c4a2145bde

Reviewed-on: https://review.gerrithub.io/385490
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2017-11-03 12:18:02 -04:00
Jim Harris
ed2f2d9d0e iscsi: remove configuration for unsupported parameters
Our iSCSI target does not support disabling InitialR2T,
DataPDUInOrder and DataSequenceInOrder, and will fail
if someone tries to disable them in the config file.

So instead, just do not support these parameters at all.
This simplifies the code and reduces confusion.

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: Icf1e01a6d12b758404769f77aa3f6221e6e3ee0d

Reviewed-on: https://review.gerrithub.io/385489
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: <shuhei.matsumoto.xt@hitachi.com>
2017-11-03 12:18:02 -04:00
Jim Harris
cce7b3078d iscsi: remove global MaxOutstandingR2T parameter
This was not used anywhere - sessions default to
DEFAULT_MAXOUTSTANDINGR2T and never look at the global
MaxOutstandingR2T value.

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: Ia4874d8d747063f729061124194b60d15ad3ddac

Reviewed-on: https://review.gerrithub.io/385488
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: <shuhei.matsumoto.xt@hitachi.com>
2017-11-03 12:18:02 -04:00
Shuhei Matsumoto
f678097d50 iscsi: add spdk_iscsi_init_grp_create() function
init_grp.c has init_grp_destroy() function but does not have
init_grp_create() function. Hence add init_grp_create() function.
init_grp_create() function check duplication of init groups.

Change-Id: I49c64254846ae4edd7a0bb2cf3250fb6f53239f4
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-on: https://review.gerrithub.io/381243
Reviewed-by: John Kariuki <John.K.Kariuki@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ziye Yang <optimistyzy@gmail.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
2017-10-19 13:11:09 -04:00
Tomasz Zawadzki
4768b198da iscsi: wait with spdk_app_stop until poller is unregistered
Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Change-Id: I9218b618544def301a4509eda1b266390a80dba5
Reviewed-on: https://review.gerrithub.io/382830
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
2017-10-18 12:32:28 -04:00
Shuhei Matsumoto
a07416d8d0 iscsi: delete spdk_iscsi_find_init_grp() function.
the function of spdk_iscsi_find_init_grp() is duplicated with
of spdk_iscsi_init_grp_find_by_tag(). The later one should be kept.
Hence delete former one.

Change-Id: I8d397648bd400550445de49c8a7731f0932f5324
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-on: https://review.gerrithub.io/381244
Reviewed-by: John Kariuki <John.K.Kariuki@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2017-10-16 19:27:35 -04:00
Shuhei Matsumoto
6bb01df6d7 iscsi: delete spdk_iscsi_init_grp_deletable() function
This function was only useful for old (and incorrect) iSCSI
topology with SPDK. Hence this function can be removed.

Change-Id: I6147382b0731a896df3c988fae0173923a9a85fc
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-on: https://review.gerrithub.io/381242
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: John Kariuki <John.K.Kariuki@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
2017-10-13 18:38:55 -04:00
Tomasz Zawadzki
b1ccfaca01 subsystem: remove fini return code
Closing the framework has to go through all subsystems
without failure, so return codes are unnecessary.

Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Change-Id: I53c9b4df12d2357e641130869f398b18637e6ff7
Reviewed-on: https://review.gerrithub.io/381681
Reviewed-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
2017-10-10 10:56:34 -04:00
Shuhei Matsumoto
666dc8af4e iscsi: login poller per portal and portal cache
A few foundational change to support safe removal of portal.
- global login poller -> login poller per portal
- Caching portal data for active connection

Change-Id: I62f4d90c9ac11a433ad47421b2b0c69bfc3c70b7
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-on: https://review.gerrithub.io/379930
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
2017-10-06 17:00:45 -04:00
Shuhei Matsumoto
4185f77862 iscsi: check duplication of portal by portal list
Check duplication of registration of portals by using a global
portal list

Change-Id: I608fc9bd4473c11e69686e6474892f3f4272cd53
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-on: https://review.gerrithub.io/379929
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
2017-10-06 17:00:45 -04:00
Shuhei Matsumoto
0b4a37d86b iscsi: turn the <open/close portal> code into functions
Group the code fragments of open/close portal procedure
and create spdk_iscsi_portal_open/close() function.

Change-Id: Id6e291f3f6e5a926f3ea0d01741a200fa64db81b
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-on: https://review.gerrithub.io/379934
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
2017-10-06 17:00:45 -04:00
Shuhei Matsumoto
72500a9f45 iscsi: delete spdk_iscsi_portal_grp_deletable()
This function was only useful for old (and incorrect) iSCSI topology.
Hence this function can be removed.

Change-Id: I1898f6a5fbffd27a55904a55cd137dafbbdf5946
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-on: https://review.gerrithub.io/381241
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
2017-10-06 17:00:45 -04:00
Daniel Verkamp
1e33a802b4 iscsi: fix layout of logout request reason field
The Logout Request reason field is the low 7 bits of byte byte 1; the
last bit of byte 1 is specified to be always 1, and we shouldn't
consider it to be part of the reason field.

The existing debug print code was parsing the reason field correctly (by
masking it against 0x7f), but it's simpler to just make the reason field
into a bitfield of the proper size; this fixes the real bug in the
reqh->reason != 0 check, which did not use the 0x7f mask.

Fixes GitHub issue #198.

Change-Id: I4813da2236c70dc1761e303b34d321750ee36626
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-on: https://review.gerrithub.io/378658
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Ziye Yang <optimistyzy@gmail.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2017-09-22 16:11:11 -04:00
Daniel Verkamp
932a186b4c log: remove uses of SPDK_TRACE_DEBUG
Replace SPDK_TRACE_DEBUG with component-specific flags.

Change-Id: Iee7eafab5e6ac8713f247323a18552b5afb0e86a
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-on: https://review.gerrithub.io/375834
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2017-08-29 15:07:13 -04:00
Daniel Verkamp
d92f0f75ca log: rename SPDK_TRACELOG to SPDK_DEBUGLOG
This matches the name to the behavior and prepares for addition of a new
log macro for "info" log level.

Change-Id: I94ccd49face4309d3368e399528776ab140748c4
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-on: https://review.gerrithub.io/375833
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2017-08-29 13:25:58 -04:00
Dariusz Stojaczyk
2705f6f10d Fixed all SPDK_LOG() calls without newline char
Change-Id: Ib9a6b3e7584c5edd8f8c0f8cd20349d86651a5a2
Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/374780
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Pawel Wodkowski <pawelx.wodkowski@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2017-08-18 18:56:51 -04:00
Seth Howell
4d43844f4d lib: replace strerror with strerror_r
replaces all references to strerror in the spdk lib directory with
references to the thread safe strerror_r

Change-Id: I80d946cce3299007ee10500b93f7e1c8e503ee41
Signed-off-by: Seth Howell <seth.howell@intel.com>
Reviewed-on: https://review.gerrithub.io/374012
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
2017-08-15 16:47:01 -04:00
Cunyin Chang
cd94507607 iscsi: Handle the error case for large IO read.
There is one scenario, when one large read IO is splitted into several
subtasks 1 - N, and the subtask N return successful, it will be stored
in the subtask_list of primary task, but the other tasks could return
error, then when we try to return the subtask N, it will failed, this patch
will make sure the large read IO command return correctly if any of the
subtasks failed.

Change-Id: Ie6bcb79a081acf30f4e4c177c0f7568495ff2b71
Signed-off-by: Cunyin Chang <cunyin.chang@intel.com>
Reviewed-on: https://review.gerrithub.io/373450
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
2017-08-15 16:43:50 -04:00
Cunyin Chang
a171aba831 iscsi: Fix the corner case when test hotplug with iscsi tgt.
Change-Id: If6d2f3ba4f03430c5d1ceac6fc819d696656e607
Signed-off-by: Cunyin Chang <cunyin.chang@intel.com>
Reviewed-on: https://review.gerrithub.io/373425
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
2017-08-15 16:43:50 -04:00
Daniel Verkamp
23f6039b1f iscsi: free strings in construct_target_node RPC
All strings decoded by spdk_json_decode_string() need a corresponding
free() statement.

Change-Id: I5896eada11deed791c5f1579db992aa382e02f82
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-on: https://review.gerrithub.io/373404
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2017-08-09 13:24:40 -04:00
Daniel Verkamp
ae60710ab8 util: add CRC32 utility functions
Factor out the iSCSI and GPT CRC32 functions into generic library
functions.

Change-Id: I1f1a5f3968a983b663a51bd984500492eeb12605
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-on: https://review.gerrithub.io/370765
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2017-08-02 19:47:35 -04:00
Cunyin Chang
e0e038ec00 iscsi: Fix the bug for hotplug when test with write IO need R2T.
This patch fix the bug for hotplug when test with write IO load which
need r2t, when the data out data pdus received at target side, the target
will try to add subtasks to the luns they are belong to, but the lun
probably invalid at this moment because we hot remove it.

Change-Id: I3d45dc6b7837944c105c2cca70e63dd4b608706b
Signed-off-by: Cunyin Chang <cunyin.chang@intel.com>
Reviewed-on: https://review.gerrithub.io/371823
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2017-08-01 21:35:54 -04:00
Cunyin Chang
8eba104b73 iscsi: Fix the bug for hotplug when read IO is running.
after move the spdk_iscsi_conn_handle_queued_tasks() into
spdk_iscsi_conn_execute(), we should handle the situation when the
lun has been removed and then try to access spdk_iscsi_conn_handle_queued_tasks().

Change-Id: I9ac7a5203b49274347c9ee9fbf19558ca87557ed
Signed-off-by: Cunyin Chang <cunyin.chang@intel.com>
Reviewed-on: https://review.gerrithub.io/371813
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2017-08-01 21:35:54 -04:00
Jan Kryl
2019ebf43e Make iscsi app to work on freebsd
Change-Id: Ic4221e044eb5af92aa06e468eb989bee285022af
Signed-off-by: Jan Kryl <jan.kryl@nexenta.com>
Reviewed-on: https://review.gerrithub.io/371303
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2017-08-01 13:42:02 -04:00
Cunyin Chang
40b74cd343 iscsi: optimization of large read process.
This patch move the spdk_iscsi_conn_handle_queued_tasks() to the main
loop of connection poller, make the logic more clear, it will also fix
one issue of hotplug:
for large read command, it has the potential risk:
one task will be split into N subtaks, when primary task return error and
try to send data in pdu, it will call spdk_iscsi_conn_handle_queued_tasks(),
the primary task is pending now, and all the subtasks will return error from
lun layer synchronous, this make the primary task return from the function
spdk_iscsi_transfer_in() after all the other subtaks, but when the N - 1 subtask
return from function spdk_iscsi_transfer_in(), it meet the condition:
primary->bytes_completed == primary->scsi.transfer_len
then it will send response pdu, after this, the primary task return from
spdk_iscsi_transfer_in(), it also meet the condition, so it will also try
to send response pdu, this will make the application run into error.

Change-Id: I72206c1ce303f5fb6bd650713742d5819a88a30f
Signed-off-by: Cunyin Chang <cunyin.chang@intel.com>
Reviewed-on: https://review.gerrithub.io/370339
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
2017-07-20 12:03:34 -04:00
Seth Howell
f03f5e7de8 iscsi: change iscsi_bhs_scsi_req variable names.
These variable names are changed to retain conformity with astyle 3.0.1. Astyle 3.0.1 recognizes 'final' as a keyword and incorrectly formats the iscsi_spec.h file breaking the build. Names were changed to avoid this case and maintain consistency within the struct.

Change-Id: I39c29d768c0ddfd459a9e9212c29cf564dad1963
Signed-off-by: Seth Howell <seth.howell@intel.com>
Reviewed-on: https://review.gerrithub.io/369905
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2017-07-18 13:14:16 -04:00
Daniel Verkamp
740e5dc50b iscsi: refactor and simplify digest calculations
Factor out the common PDU header and data digest calculations into
helper functions in iscsi.c.  This eliminates the need for the crc32c.c
iSCSI-specific padding functions spdk_fixup_crc32c() and spdk_crc32c(),
so remove them.

Change-Id: I8cbf269c43177d7483f1df2e7ce9ce83776e7169
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-on: https://review.gerrithub.io/369312
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2017-07-17 14:18:07 -04:00
Daniel Verkamp
e283c385e7 iscsi: fix AHS handling
Previously, we had a pdu->ahs pointer that was always NULL (never set
anywhere), and we would try to read data into this NULL pointer if the
initiator ever sent a PDU with a non-zero TotalAHSLength.

Rename the existing ahs_data array in the PDU to just "ahs" to minimize
the necessary changes.  We never actually dereference the ahs structure,
so its type is not important. (We can cast it later if we add support
for anything that requires an AHS.)

Change-Id: I10d19a6e0d99f326794cbe6469eacedadc634c67
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-on: https://review.gerrithub.io/369315
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2017-07-14 11:14:21 -04:00
Dariusz Stojaczyk
fa15dc611a scsi: removed dev->maxlun field
This variable was misleading and unnecessary. Replaced all it's
occurences with SPDK_SCSI_DEV_MAX_LUN.

Change-Id: Iaaf9ed5efb60f9a89585121d2fbec7b43c3723e9
Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/368115
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Pawel Wodkowski <pawelx.wodkowski@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2017-07-12 13:16:55 -04:00
Daniel Verkamp
2bdec64fbf jsonrpc: modify API to pass request to handler
This will enable asynchronous request handling in a future patch, and it
also removes the need for the RPC handlers to know about request id and
the JSON-RPC rules about notification-only requests.

Change-Id: I25aaa8e48bff8d5594ffcccecb61842b1e31ec3c
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-on: https://review.gerrithub.io/368225
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2017-07-06 13:48:12 -04:00
Dariusz Stojaczyk
72343bcf23 scsi: added lun hotremove callback
Added optional callback inside scsi lun hotremove, so that higher-level
abstraction can be notified about hotremove.

Change-Id: I5f1bd8160e3d770a484068dd73928bc2b64c876f
Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/367309
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2017-06-30 16:32:47 -04:00
Daniel Verkamp
65bd6422ee iscsi: remove pointless assert(task != NULL)
We already dereference task in the line above, and all callers ensure
that task is not NULL already.

Change-Id: Iff23503959116083375082b1ab022a156438cc8b
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-on: https://review.gerrithub.io/367109
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2017-06-27 14:01:59 -04:00
Daniel Verkamp
9b509a2944 iscsi: fix declaration after statement
Change-Id: Iee88b34165b3530c52301511ff1bd13c2680ea55
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-on: https://review.gerrithub.io/367123
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2017-06-27 13:57:06 -04:00