Commit 8f26c9ff authored by David Dillow's avatar David Dillow

IB/srp: rework mapping engine to use multiple FMR entries

Instead of forcing all of the S/G entries to fit in one FMR, and falling
back to indirect descriptors if that fails, allow the use of as many
FMRs as needed to map the request. This lays the groundwork for allowing
indirect descriptor tables that are larger than can fit in the command
IU, but should marginally improve performance now by reducing the number
of indirect descriptors needed.

We increase the minimum page size for the FMR pool to 4K, as larger
pages help increase the coverage of each FMR, and it is rare that the
kernel would send down a request with scattered 512 byte fragments.

This patch also move some of the target initialization code afte the
parsing of options, to keep it together with the new code that needs to
allocate memory based on the options given.
Signed-off-by: default avatarDavid Dillow <dillowda@ornl.gov>
parent 49248644
This diff is collapsed.
......@@ -71,7 +71,10 @@ enum {
SRP_FMR_SIZE = 256,
SRP_FMR_POOL_SIZE = 1024,
SRP_FMR_DIRTY_SIZE = SRP_FMR_POOL_SIZE / 4
SRP_FMR_DIRTY_SIZE = SRP_FMR_POOL_SIZE / 4,
SRP_MAP_ALLOW_FMR = 0,
SRP_MAP_NO_FMR = 1,
};
enum srp_target_state {
......@@ -93,9 +96,9 @@ struct srp_device {
struct ib_pd *pd;
struct ib_mr *mr;
struct ib_fmr_pool *fmr_pool;
int fmr_page_shift;
int fmr_page_size;
u64 fmr_page_mask;
int fmr_page_size;
int fmr_max_size;
};
struct srp_host {
......@@ -112,7 +115,9 @@ struct srp_request {
struct list_head list;
struct scsi_cmnd *scmnd;
struct srp_iu *cmd;
struct ib_pool_fmr *fmr;
struct ib_pool_fmr **fmr_list;
u64 *map_page;
short nfmr;
short index;
};
......@@ -181,4 +186,19 @@ struct srp_iu {
enum dma_data_direction direction;
};
struct srp_map_state {
struct ib_pool_fmr **next_fmr;
struct srp_direct_buf *desc;
u64 *pages;
dma_addr_t base_dma_addr;
u32 fmr_len;
u32 total_len;
unsigned int npages;
unsigned int nfmr;
unsigned int ndesc;
struct scatterlist *unmapped_sg;
int unmapped_index;
dma_addr_t unmapped_addr;
};
#endif /* IB_SRP_H */
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment