Commit Graph

293 Commits

Author SHA1 Message Date
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