Skip to content

Commit c0dc941

Browse files
hreineckeNicholas Bellinger
authored andcommitted
target_core_alua: Store supported ALUA states
The supported ALUA states might be different for individual devices, so store it in a separate field. (nab: Remove unnecessary line continuation) Signed-off-by: Hannes Reinecke <hare@suse.de> Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
1 parent 73f3bf5 commit c0dc941

3 files changed

Lines changed: 20 additions & 6 deletions

File tree

‎drivers/target/target_core_alua.c‎

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -117,12 +117,7 @@ target_emulate_report_target_port_groups(struct se_cmd *cmd)
117117
/*
118118
* Set supported ASYMMETRIC ACCESS State bits
119119
*/
120-
buf[off] = 0x80; /* T_SUP */
121-
buf[off] |= 0x40; /* O_SUP */
122-
buf[off] |= 0x8; /* U_SUP */
123-
buf[off] |= 0x4; /* S_SUP */
124-
buf[off] |= 0x2; /* AN_SUP */
125-
buf[off++] |= 0x1; /* AO_SUP */
120+
buf[off++] |= tg_pt_gp->tg_pt_gp_alua_supported_states;
126121
/*
127122
* TARGET PORT GROUP
128123
*/
@@ -1367,6 +1362,13 @@ struct t10_alua_tg_pt_gp *core_alua_allocate_tg_pt_gp(struct se_device *dev,
13671362
tg_pt_gp->tg_pt_gp_trans_delay_msecs = ALUA_DEFAULT_TRANS_DELAY_MSECS;
13681363
tg_pt_gp->tg_pt_gp_implicit_trans_secs = ALUA_DEFAULT_IMPLICIT_TRANS_SECS;
13691364

1365+
/*
1366+
* Enable all supported states
1367+
*/
1368+
tg_pt_gp->tg_pt_gp_alua_supported_states =
1369+
ALUA_T_SUP | ALUA_O_SUP |
1370+
ALUA_U_SUP | ALUA_S_SUP | ALUA_AN_SUP | ALUA_AO_SUP;
1371+
13701372
if (def_group) {
13711373
spin_lock(&dev->t10_alua.tg_pt_gps_lock);
13721374
tg_pt_gp->tg_pt_gp_id =

‎drivers/target/target_core_alua.h‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,17 @@
2222
#define ALUA_ACCESS_STATE_OFFLINE 0xe
2323
#define ALUA_ACCESS_STATE_TRANSITION 0xf
2424

25+
/*
26+
* from spc4r36j section 6.37 Table 306
27+
*/
28+
#define ALUA_T_SUP 0x80
29+
#define ALUA_O_SUP 0x40
30+
#define ALUA_LBD_SUP 0x10
31+
#define ALUA_U_SUP 0x08
32+
#define ALUA_S_SUP 0x04
33+
#define ALUA_AN_SUP 0x02
34+
#define ALUA_AO_SUP 0x01
35+
2536
/*
2637
* REPORT_TARGET_PORT_GROUP STATUS CODE
2738
*

‎include/target/target_core_base.h‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -283,6 +283,7 @@ struct t10_alua_lu_gp_member {
283283
struct t10_alua_tg_pt_gp {
284284
u16 tg_pt_gp_id;
285285
int tg_pt_gp_valid_id;
286+
int tg_pt_gp_alua_supported_states;
286287
int tg_pt_gp_alua_access_status;
287288
int tg_pt_gp_alua_access_type;
288289
int tg_pt_gp_nonop_delay_msecs;

0 commit comments

Comments
 (0)