Commit Graph

284 Commits

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