IB/srp: Use FMRs to map gather/scatter lists
Create an SRP FMR pool on HCAs that support FMRs, and use FMRs to map gather/scatter lists that have more than one entry into a single memory region that appears virtually contiguous to the SRP target (which is the RDMA initiator). This patch bails out on FMR mapping for SCSI commands where the gather/scatter list cannot be mapped into a single FMR because there are sub-page-sized entries in middle of the list. An unaligned start or end of the list is OK. Based on a patch by Vu Pham <vuhuong@mellanox.com>. Signed-off-by: Roland Dreier <rolandd@cisco.com>
This commit is contained in:
@ -46,6 +46,7 @@
|
||||
#include <rdma/ib_verbs.h>
|
||||
#include <rdma/ib_sa.h>
|
||||
#include <rdma/ib_cm.h>
|
||||
#include <rdma/ib_fmr_pool.h>
|
||||
|
||||
enum {
|
||||
SRP_PATH_REC_TIMEOUT_MS = 1000,
|
||||
@ -62,7 +63,11 @@ enum {
|
||||
SRP_SQ_SIZE = SRP_RQ_SIZE - 1,
|
||||
SRP_CQ_SIZE = SRP_SQ_SIZE + SRP_RQ_SIZE,
|
||||
|
||||
SRP_TAG_TSK_MGMT = 1 << (SRP_RQ_SHIFT + 1)
|
||||
SRP_TAG_TSK_MGMT = 1 << (SRP_RQ_SHIFT + 1),
|
||||
|
||||
SRP_FMR_SIZE = 256,
|
||||
SRP_FMR_POOL_SIZE = 1024,
|
||||
SRP_FMR_DIRTY_SIZE = SRP_FMR_POOL_SIZE / 4
|
||||
};
|
||||
|
||||
#define SRP_OP_RECV (1 << 31)
|
||||
@ -77,15 +82,24 @@ enum srp_target_state {
|
||||
SRP_TARGET_REMOVED
|
||||
};
|
||||
|
||||
struct srp_host {
|
||||
u8 initiator_port_id[16];
|
||||
struct srp_device {
|
||||
struct list_head dev_list;
|
||||
struct ib_device *dev;
|
||||
u8 port;
|
||||
struct ib_pd *pd;
|
||||
struct ib_mr *mr;
|
||||
struct ib_fmr_pool *fmr_pool;
|
||||
int fmr_page_shift;
|
||||
int fmr_page_size;
|
||||
unsigned long fmr_page_mask;
|
||||
};
|
||||
|
||||
struct srp_host {
|
||||
u8 initiator_port_id[16];
|
||||
struct srp_device *dev;
|
||||
u8 port;
|
||||
struct class_device class_dev;
|
||||
struct list_head target_list;
|
||||
struct mutex target_mutex;
|
||||
struct mutex target_mutex;
|
||||
struct completion released;
|
||||
struct list_head list;
|
||||
};
|
||||
@ -95,6 +109,7 @@ struct srp_request {
|
||||
struct scsi_cmnd *scmnd;
|
||||
struct srp_iu *cmd;
|
||||
struct srp_iu *tsk_mgmt;
|
||||
struct ib_pool_fmr *fmr;
|
||||
/*
|
||||
* Fake scatterlist used when scmnd->use_sg==0. Can be killed
|
||||
* when the SCSI midlayer no longer generates non-SG commands.
|
||||
|
Reference in New Issue
Block a user