diff options
author | Vu Pham <vu@mellanox.com> | 2006-06-17 23:37:32 -0400 |
---|---|---|
committer | Roland Dreier <rolandd@cisco.com> | 2006-06-17 23:37:32 -0400 |
commit | 74b0a15b5e18e44206c98419745a472c3d28e561 (patch) | |
tree | 9aa9846193df826cc81d2072a0ca56a569ea9668 | |
parent | 52fb2b50c4baa1430064c1e6c1c7df473d469df1 (diff) |
IB/srp: Allow sg_tablesize to be adjusted
Make the sg_tablesize used by SRP adjustable at module load time via a
module parameter. Calculate the corresponding IU length required to
support this.
Signed-off-by: Vu Pham <vu@mellanox.com>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
-rw-r--r-- | drivers/infiniband/ulp/srp/ib_srp.c | 21 | ||||
-rw-r--r-- | drivers/infiniband/ulp/srp/ib_srp.h | 5 |
2 files changed, 17 insertions, 9 deletions
diff --git a/drivers/infiniband/ulp/srp/ib_srp.c b/drivers/infiniband/ulp/srp/ib_srp.c index 8e6b10369717..a01b73bb976e 100644 --- a/drivers/infiniband/ulp/srp/ib_srp.c +++ b/drivers/infiniband/ulp/srp/ib_srp.c | |||
@@ -62,6 +62,13 @@ MODULE_DESCRIPTION("InfiniBand SCSI RDMA Protocol initiator " | |||
62 | "v" DRV_VERSION " (" DRV_RELDATE ")"); | 62 | "v" DRV_VERSION " (" DRV_RELDATE ")"); |
63 | MODULE_LICENSE("Dual BSD/GPL"); | 63 | MODULE_LICENSE("Dual BSD/GPL"); |
64 | 64 | ||
65 | static int srp_sg_tablesize = SRP_DEF_SG_TABLESIZE; | ||
66 | static int srp_max_iu_len; | ||
67 | |||
68 | module_param(srp_sg_tablesize, int, 0444); | ||
69 | MODULE_PARM_DESC(srp_sg_tablesize, | ||
70 | "Max number of gather/scatter entries per I/O (default is 12)"); | ||
71 | |||
65 | static int topspin_workarounds = 1; | 72 | static int topspin_workarounds = 1; |
66 | 73 | ||
67 | module_param(topspin_workarounds, int, 0444); | 74 | module_param(topspin_workarounds, int, 0444); |
@@ -311,7 +318,7 @@ static int srp_send_req(struct srp_target_port *target) | |||
311 | 318 | ||
312 | req->priv.opcode = SRP_LOGIN_REQ; | 319 | req->priv.opcode = SRP_LOGIN_REQ; |
313 | req->priv.tag = 0; | 320 | req->priv.tag = 0; |
314 | req->priv.req_it_iu_len = cpu_to_be32(SRP_MAX_IU_LEN); | 321 | req->priv.req_it_iu_len = cpu_to_be32(srp_max_iu_len); |
315 | req->priv.req_buf_fmt = cpu_to_be16(SRP_BUF_FORMAT_DIRECT | | 322 | req->priv.req_buf_fmt = cpu_to_be16(SRP_BUF_FORMAT_DIRECT | |
316 | SRP_BUF_FORMAT_INDIRECT); | 323 | SRP_BUF_FORMAT_INDIRECT); |
317 | memcpy(req->priv.initiator_port_id, target->srp_host->initiator_port_id, 16); | 324 | memcpy(req->priv.initiator_port_id, target->srp_host->initiator_port_id, 16); |
@@ -953,7 +960,7 @@ static int srp_queuecommand(struct scsi_cmnd *scmnd, | |||
953 | goto err; | 960 | goto err; |
954 | 961 | ||
955 | dma_sync_single_for_cpu(target->srp_host->dev->dev->dma_device, iu->dma, | 962 | dma_sync_single_for_cpu(target->srp_host->dev->dev->dma_device, iu->dma, |
956 | SRP_MAX_IU_LEN, DMA_TO_DEVICE); | 963 | srp_max_iu_len, DMA_TO_DEVICE); |
957 | 964 | ||
958 | req = list_entry(target->free_reqs.next, struct srp_request, list); | 965 | req = list_entry(target->free_reqs.next, struct srp_request, list); |
959 | 966 | ||
@@ -986,7 +993,7 @@ static int srp_queuecommand(struct scsi_cmnd *scmnd, | |||
986 | } | 993 | } |
987 | 994 | ||
988 | dma_sync_single_for_device(target->srp_host->dev->dev->dma_device, iu->dma, | 995 | dma_sync_single_for_device(target->srp_host->dev->dev->dma_device, iu->dma, |
989 | SRP_MAX_IU_LEN, DMA_TO_DEVICE); | 996 | srp_max_iu_len, DMA_TO_DEVICE); |
990 | 997 | ||
991 | if (__srp_post_send(target, iu, len)) { | 998 | if (__srp_post_send(target, iu, len)) { |
992 | printk(KERN_ERR PFX "Send failed\n"); | 999 | printk(KERN_ERR PFX "Send failed\n"); |
@@ -1018,7 +1025,7 @@ static int srp_alloc_iu_bufs(struct srp_target_port *target) | |||
1018 | 1025 | ||
1019 | for (i = 0; i < SRP_SQ_SIZE + 1; ++i) { | 1026 | for (i = 0; i < SRP_SQ_SIZE + 1; ++i) { |
1020 | target->tx_ring[i] = srp_alloc_iu(target->srp_host, | 1027 | target->tx_ring[i] = srp_alloc_iu(target->srp_host, |
1021 | SRP_MAX_IU_LEN, | 1028 | srp_max_iu_len, |
1022 | GFP_KERNEL, DMA_TO_DEVICE); | 1029 | GFP_KERNEL, DMA_TO_DEVICE); |
1023 | if (!target->tx_ring[i]) | 1030 | if (!target->tx_ring[i]) |
1024 | goto err; | 1031 | goto err; |
@@ -1436,7 +1443,6 @@ static struct scsi_host_template srp_template = { | |||
1436 | .eh_host_reset_handler = srp_reset_host, | 1443 | .eh_host_reset_handler = srp_reset_host, |
1437 | .can_queue = SRP_SQ_SIZE, | 1444 | .can_queue = SRP_SQ_SIZE, |
1438 | .this_id = -1, | 1445 | .this_id = -1, |
1439 | .sg_tablesize = SRP_MAX_INDIRECT, | ||
1440 | .cmd_per_lun = SRP_SQ_SIZE, | 1446 | .cmd_per_lun = SRP_SQ_SIZE, |
1441 | .use_clustering = ENABLE_CLUSTERING, | 1447 | .use_clustering = ENABLE_CLUSTERING, |
1442 | .shost_attrs = srp_host_attrs | 1448 | .shost_attrs = srp_host_attrs |
@@ -1914,6 +1920,11 @@ static int __init srp_init_module(void) | |||
1914 | { | 1920 | { |
1915 | int ret; | 1921 | int ret; |
1916 | 1922 | ||
1923 | srp_template.sg_tablesize = srp_sg_tablesize; | ||
1924 | srp_max_iu_len = (sizeof (struct srp_cmd) + | ||
1925 | sizeof (struct srp_indirect_buf) + | ||
1926 | srp_sg_tablesize * 16); | ||
1927 | |||
1917 | ret = class_register(&srp_class); | 1928 | ret = class_register(&srp_class); |
1918 | if (ret) { | 1929 | if (ret) { |
1919 | printk(KERN_ERR PFX "couldn't register class infiniband_srp\n"); | 1930 | printk(KERN_ERR PFX "couldn't register class infiniband_srp\n"); |
diff --git a/drivers/infiniband/ulp/srp/ib_srp.h b/drivers/infiniband/ulp/srp/ib_srp.h index c071c3032700..033a44772ae3 100644 --- a/drivers/infiniband/ulp/srp/ib_srp.h +++ b/drivers/infiniband/ulp/srp/ib_srp.h | |||
@@ -56,7 +56,7 @@ enum { | |||
56 | SRP_DLID_REDIRECT = 2, | 56 | SRP_DLID_REDIRECT = 2, |
57 | 57 | ||
58 | SRP_MAX_LUN = 512, | 58 | SRP_MAX_LUN = 512, |
59 | SRP_MAX_IU_LEN = 256, | 59 | SRP_DEF_SG_TABLESIZE = 12, |
60 | 60 | ||
61 | SRP_RQ_SHIFT = 6, | 61 | SRP_RQ_SHIFT = 6, |
62 | SRP_RQ_SIZE = 1 << SRP_RQ_SHIFT, | 62 | SRP_RQ_SIZE = 1 << SRP_RQ_SHIFT, |
@@ -71,9 +71,6 @@ enum { | |||
71 | }; | 71 | }; |
72 | 72 | ||
73 | #define SRP_OP_RECV (1 << 31) | 73 | #define SRP_OP_RECV (1 << 31) |
74 | #define SRP_MAX_INDIRECT ((SRP_MAX_IU_LEN - \ | ||
75 | sizeof (struct srp_cmd) - \ | ||
76 | sizeof (struct srp_indirect_buf)) / 16) | ||
77 | 74 | ||
78 | enum srp_target_state { | 75 | enum srp_target_state { |
79 | SRP_TARGET_LIVE, | 76 | SRP_TARGET_LIVE, |