IB/srp: Add RDMA/CM support

Since the SRP_LOGIN_REQ defined in the SRP standard is larger than
what fits in the RDMA/CM login request private data, introduce a new
login request format for the RDMA/CM.

Note: since srp_daemon and ibsrpdm rely on the subnet manager and
since there is no equivalent of the IB subnet manager in non-IB
networks, login has to be performed manually for non-IB networks.

Signed-off-by: Bart Van Assche <bart.vanassche@wdc.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
This commit is contained in:
Bart Van Assche 2018-01-22 14:27:12 -08:00 committed by Doug Ledford
parent 172856eac7
commit 19f313438c
3 changed files with 603 additions and 151 deletions

File diff suppressed because it is too large Load Diff

View File

@ -45,6 +45,7 @@
#include <rdma/ib_sa.h> #include <rdma/ib_sa.h>
#include <rdma/ib_cm.h> #include <rdma/ib_cm.h>
#include <rdma/ib_fmr_pool.h> #include <rdma/ib_fmr_pool.h>
#include <rdma/rdma_cm.h>
enum { enum {
SRP_PATH_REC_TIMEOUT_MS = 1000, SRP_PATH_REC_TIMEOUT_MS = 1000,
@ -153,11 +154,18 @@ struct srp_rdma_ch {
struct completion done; struct completion done;
int status; int status;
struct sa_path_rec path; union {
struct ib_sa_query *path_query; struct ib_cm {
int path_query_id; struct sa_path_rec path;
struct ib_sa_query *path_query;
int path_query_id;
struct ib_cm_id *cm_id;
} ib_cm;
struct rdma_cm {
struct rdma_cm_id *cm_id;
} rdma_cm;
};
struct ib_cm_id *cm_id;
struct srp_iu **tx_ring; struct srp_iu **tx_ring;
struct srp_iu **rx_ring; struct srp_iu **rx_ring;
struct srp_request *req_ring; struct srp_request *req_ring;
@ -182,6 +190,7 @@ struct srp_target_port {
/* read only in the hot path */ /* read only in the hot path */
u32 global_rkey; u32 global_rkey;
struct srp_rdma_ch *ch; struct srp_rdma_ch *ch;
struct net *net;
u32 ch_count; u32 ch_count;
u32 lkey; u32 lkey;
enum srp_target_state state; enum srp_target_state state;
@ -194,7 +203,6 @@ struct srp_target_port {
union ib_gid sgid; union ib_gid sgid;
__be64 id_ext; __be64 id_ext;
__be64 ioc_guid; __be64 ioc_guid;
__be64 service_id;
__be64 initiator_ext; __be64 initiator_ext;
u16 io_class; u16 io_class;
struct srp_host *srp_host; struct srp_host *srp_host;
@ -210,8 +218,28 @@ struct srp_target_port {
int comp_vector; int comp_vector;
int tl_retry_count; int tl_retry_count;
union ib_gid orig_dgid; bool using_rdma_cm;
__be16 pkey;
union {
struct {
__be64 service_id;
union ib_gid orig_dgid;
__be16 pkey;
} ib_cm;
struct {
union {
struct sockaddr_in ip4;
struct sockaddr_in6 ip6;
struct sockaddr_storage ss;
} src;
union {
struct sockaddr_in ip4;
struct sockaddr_in6 ip6;
struct sockaddr_storage ss;
} dst;
bool src_specified;
} rdma_cm;
};
u32 rq_tmo_jiffies; u32 rq_tmo_jiffies;

View File

@ -129,6 +129,23 @@ struct srp_login_req {
u8 target_port_id[16]; u8 target_port_id[16];
}; };
/**
* struct srp_login_req_rdma - RDMA/CM login parameters.
*
* RDMA/CM over InfiniBand can only carry 92 - 36 = 56 bytes of private
* data. The %srp_login_req_rdma structure contains the same information as
* %srp_login_req but with the reserved data removed.
*/
struct srp_login_req_rdma {
u64 tag;
__be16 req_buf_fmt;
u8 req_flags;
u8 opcode;
__be32 req_it_iu_len;
u8 initiator_port_id[16];
u8 target_port_id[16];
};
/* /*
* The SRP spec defines the size of the LOGIN_RSP structure to be 52 * The SRP spec defines the size of the LOGIN_RSP structure to be 52
* bytes, so it needs to be packed to avoid having it padded to 56 * bytes, so it needs to be packed to avoid having it padded to 56