mirror of
https://github.com/SCST-project/scst.git
synced 2026-05-17 10:41:26 +00:00
ib_srpt: Add P_Key support
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@4980 d57e44dd-8a1f-0410-8b47-8ef2f437770f
This commit is contained in:
@@ -1155,7 +1155,7 @@ static int srpt_init_ch_qp(struct srpt_rdma_ch *ch, struct ib_qp *qp)
|
||||
attr->qp_access_flags = IB_ACCESS_LOCAL_WRITE | IB_ACCESS_REMOTE_READ |
|
||||
IB_ACCESS_REMOTE_WRITE;
|
||||
attr->port_num = ch->sport->port;
|
||||
attr->pkey_index = 0;
|
||||
attr->pkey_index = ch->pkey_index;
|
||||
|
||||
ret = ib_modify_qp(qp, attr,
|
||||
IB_QP_STATE | IB_QP_ACCESS_FLAGS | IB_QP_PORT |
|
||||
@@ -2515,6 +2515,14 @@ static int srpt_cm_req_recv(struct ib_cm_id *cm_id,
|
||||
}
|
||||
|
||||
kref_init(&ch->kref);
|
||||
ret = ib_find_pkey(sdev->device, sport->port,
|
||||
be16_to_cpu(param->primary_path->pkey),
|
||||
&ch->pkey_index);
|
||||
if (ret < 0) {
|
||||
ch->pkey_index = 0;
|
||||
PRINT_ERROR("Translating pkey %#x failed (%d) - using index 0",
|
||||
be16_to_cpu(param->primary_path->pkey), ret);
|
||||
}
|
||||
memcpy(ch->i_port_id, req->initiator_port_id, 16);
|
||||
memcpy(ch->t_port_id, req->target_port_id, 16);
|
||||
ch->sport = sport;
|
||||
|
||||
@@ -314,6 +314,7 @@ enum rdma_ch_state {
|
||||
* @cmd_wait_list: list of SCST commands that arrived before the RTU event. This
|
||||
* list contains struct srpt_ioctx elements and is protected
|
||||
* against concurrent modification by the cm_id spinlock.
|
||||
* @pkey_index: P_Key index of the IB partition for this SRP channel.
|
||||
* @scst_sess: SCST session information associated with this SRP channel.
|
||||
* @sess_name: SCST session name.
|
||||
*/
|
||||
@@ -341,6 +342,7 @@ struct srpt_rdma_ch {
|
||||
enum rdma_ch_state state;
|
||||
struct list_head list;
|
||||
struct list_head cmd_wait_list;
|
||||
uint16_t pkey_index;
|
||||
bool dreq_received;
|
||||
bool last_wqe_received;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user