|
41 | 41 | #include <linux/string.h>
|
42 | 42 | #include <linux/delay.h>
|
43 | 43 | #include <linux/atomic.h>
|
| 44 | +#include <rdma/ib_cache.h> |
44 | 45 | #include <scsi/scsi_proto.h>
|
45 | 46 | #include <scsi/scsi_tcq.h>
|
46 | 47 | #include <target/target_core_base.h>
|
@@ -1057,7 +1058,12 @@ static int srpt_init_ch_qp(struct srpt_rdma_ch *ch, struct ib_qp *qp)
|
1057 | 1058 | attr->qp_state = IB_QPS_INIT;
|
1058 | 1059 | attr->qp_access_flags = IB_ACCESS_LOCAL_WRITE;
|
1059 | 1060 | attr->port_num = ch->sport->port;
|
1060 |
| - attr->pkey_index = 0; |
| 1061 | + |
| 1062 | + ret = ib_find_cached_pkey(ch->sport->sdev->device, ch->sport->port, |
| 1063 | + ch->pkey, &attr->pkey_index); |
| 1064 | + if (ret < 0) |
| 1065 | + pr_err("Translating pkey %#x failed (%d) - using index 0\n", |
| 1066 | + ch->pkey, ret); |
1061 | 1067 |
|
1062 | 1068 | ret = ib_modify_qp(qp, attr,
|
1063 | 1069 | IB_QP_STATE | IB_QP_ACCESS_FLAGS | IB_QP_PORT |
|
@@ -1994,9 +2000,10 @@ static int srpt_cm_req_recv(struct ib_cm_id *cm_id,
|
1994 | 2000 |
|
1995 | 2001 | it_iu_len = be32_to_cpu(req->req_it_iu_len);
|
1996 | 2002 |
|
1997 |
| - pr_info("Received SRP_LOGIN_REQ with i_port_id %pI6, t_port_id %pI6 and it_iu_len %d on port %d (guid=%pI6)\n", |
| 2003 | + pr_info("Received SRP_LOGIN_REQ with i_port_id %pI6, t_port_id %pI6 and it_iu_len %d on port %d (guid=%pI6); pkey %#04x\n", |
1998 | 2004 | req->initiator_port_id, req->target_port_id, it_iu_len,
|
1999 |
| - param->port, &sport->gid); |
| 2005 | + param->port, &sport->gid, |
| 2006 | + be16_to_cpu(param->primary_path->pkey)); |
2000 | 2007 |
|
2001 | 2008 | rsp = kzalloc(sizeof(*rsp), GFP_KERNEL);
|
2002 | 2009 | rej = kzalloc(sizeof(*rej), GFP_KERNEL);
|
@@ -2073,6 +2080,7 @@ static int srpt_cm_req_recv(struct ib_cm_id *cm_id,
|
2073 | 2080 |
|
2074 | 2081 | init_rcu_head(&ch->rcu);
|
2075 | 2082 | kref_init(&ch->kref);
|
| 2083 | + ch->pkey = be16_to_cpu(param->primary_path->pkey); |
2076 | 2084 | ch->zw_cqe.done = srpt_zerolength_write_done;
|
2077 | 2085 | INIT_WORK(&ch->release_work, srpt_release_channel_work);
|
2078 | 2086 | memcpy(ch->i_port_id, req->initiator_port_id, 16);
|
|
0 commit comments