Skip to content

Commit 2dc98f0

Browse files
KAGA-KOKOdledford
authored andcommitted
IB/srpt: Use the source GID as session name
Use the source GID as session name instead of the initiator port ID from the SRP login request. The only functional change in this patch is that it changes the session name shown in debug messages. Note: the fifth argument that is passed to target_alloc_session() is what the SCSI target core uses as key for lookups in the ACL (access control list) information. Signed-off-by: Bart Van Assche <[email protected]> Signed-off-by: Doug Ledford <[email protected]>
1 parent ba60c84 commit 2dc98f0

File tree

2 files changed

+7
-8
lines changed

2 files changed

+7
-8
lines changed

drivers/infiniband/ulp/srpt/ib_srpt.c

+6-5
Original file line numberDiff line numberDiff line change
@@ -1989,6 +1989,7 @@ static int srpt_cm_req_recv(struct ib_cm_id *cm_id,
19891989
struct srp_login_rej *rej;
19901990
struct ib_cm_rep_param *rep_param;
19911991
struct srpt_rdma_ch *ch, *tmp_ch;
1992+
char i_port_id[36];
19921993
u32 it_iu_len;
19931994
int i, ret = 0;
19941995

@@ -2143,9 +2144,9 @@ static int srpt_cm_req_recv(struct ib_cm_id *cm_id,
21432144
goto destroy_ib;
21442145
}
21452146

2146-
srpt_format_guid(ch->ini_guid, sizeof(ch->ini_guid),
2147+
srpt_format_guid(ch->sess_name, sizeof(ch->sess_name),
21472148
&param->primary_path->dgid.global.interface_id);
2148-
snprintf(ch->sess_name, sizeof(ch->sess_name), "0x%016llx%016llx",
2149+
snprintf(i_port_id, sizeof(i_port_id), "0x%016llx%016llx",
21492150
be64_to_cpu(*(__be64 *)ch->i_port_id),
21502151
be64_to_cpu(*(__be64 *)(ch->i_port_id + 8)));
21512152

@@ -2154,16 +2155,16 @@ static int srpt_cm_req_recv(struct ib_cm_id *cm_id,
21542155
if (sport->port_guid_tpg.se_tpg_wwn)
21552156
ch->sess = target_alloc_session(&sport->port_guid_tpg, 0, 0,
21562157
TARGET_PROT_NORMAL,
2157-
ch->ini_guid, ch, NULL);
2158+
ch->sess_name, ch, NULL);
21582159
if (sport->port_gid_tpg.se_tpg_wwn && IS_ERR_OR_NULL(ch->sess))
21592160
ch->sess = target_alloc_session(&sport->port_gid_tpg, 0, 0,
2160-
TARGET_PROT_NORMAL, ch->sess_name, ch,
2161+
TARGET_PROT_NORMAL, i_port_id, ch,
21612162
NULL);
21622163
/* Retry without leading "0x" */
21632164
if (sport->port_gid_tpg.se_tpg_wwn && IS_ERR_OR_NULL(ch->sess))
21642165
ch->sess = target_alloc_session(&sport->port_gid_tpg, 0, 0,
21652166
TARGET_PROT_NORMAL,
2166-
ch->sess_name + 2, ch, NULL);
2167+
i_port_id + 2, ch, NULL);
21672168
if (IS_ERR_OR_NULL(ch->sess)) {
21682169
pr_info("Rejected login because no ACL has been configured yet for initiator %s.\n",
21692170
ch->sess_name);

drivers/infiniband/ulp/srpt/ib_srpt.h

+1-3
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,6 @@ enum rdma_ch_state {
269269
* @pkey: P_Key of the IB partition for this SRP channel.
270270
* @sess: Session information associated with this SRP channel.
271271
* @sess_name: Session name.
272-
* @ini_guid: Initiator port GUID.
273272
* @release_work: Allows scheduling of srpt_release_channel().
274273
*/
275274
struct srpt_rdma_ch {
@@ -297,8 +296,7 @@ struct srpt_rdma_ch {
297296
struct list_head cmd_wait_list;
298297
uint16_t pkey;
299298
struct se_session *sess;
300-
u8 sess_name[36];
301-
u8 ini_guid[24];
299+
u8 sess_name[24];
302300
struct work_struct release_work;
303301
};
304302

0 commit comments

Comments
 (0)