diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2016-05-20 17:35:07 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2016-05-20 17:35:07 -0400 |
commit | 76b584d3125a1f7d8b64e9c522a4555bc2844bde (patch) | |
tree | c75dc6b134eeae650372df7c6179f1e43a95953b /drivers/target | |
parent | 7992893c5a9fdffa42117f6f749359466e06bdf6 (diff) | |
parent | c16d2750a08c8ccaf98d65f287a8aec91bb9610d (diff) |
Merge tag 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dledford/rdma
Pull rdma updates from Doug Ledford:
"Primary 4.7 merge window changes
- Updates to the new Intel X722 iWARP driver
- Updates to the hfi1 driver
- Fixes for the iw_cxgb4 driver
- Misc core fixes
- Generic RDMA READ/WRITE API addition
- SRP updates
- Misc ipoib updates
- Minor mlx5 updates"
* tag 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dledford/rdma: (148 commits)
IB/mlx5: Fire the CQ completion handler from tasklet
net/mlx5_core: Use tasklet for user-space CQ completion events
IB/core: Do not require CAP_NET_ADMIN for packet sniffing
IB/mlx4: Fix unaligned access in send_reply_to_slave
IB/mlx5: Report Scatter FCS device capability when supported
IB/mlx5: Add Scatter FCS support for Raw Packet QP
IB/core: Add Scatter FCS create flag
IB/core: Add Raw Scatter FCS device capability
IB/core: Add extended device capability flags
i40iw: pass hw_stats by reference rather than by value
i40iw: Remove unnecessary synchronize_irq() before free_irq()
i40iw: constify i40iw_vf_cqp_ops structure
IB/mlx5: Add UARs write-combining and non-cached mapping
IB/mlx5: Allow mapping the free running counter on PROT_EXEC
IB/mlx4: Use list_for_each_entry_safe
IB/SA: Use correct free function
IB/core: Fix a potential array overrun in CMA and SA agent
IB/core: Remove unnecessary check in ibnl_rcv_msg
IB/IWPM: Fix a potential skb leak
RDMA/nes: replace custom print_hex_dump()
...
Diffstat (limited to 'drivers/target')
-rw-r--r-- | drivers/target/target_core_transport.c | 32 | ||||
-rw-r--r-- | drivers/target/target_core_xcopy.c | 2 |
2 files changed, 19 insertions, 15 deletions
diff --git a/drivers/target/target_core_transport.c b/drivers/target/target_core_transport.c index ab2bf12975e1..590384a2bf8b 100644 --- a/drivers/target/target_core_transport.c +++ b/drivers/target/target_core_transport.c | |||
@@ -2195,7 +2195,7 @@ queue_full: | |||
2195 | transport_handle_queue_full(cmd, cmd->se_dev); | 2195 | transport_handle_queue_full(cmd, cmd->se_dev); |
2196 | } | 2196 | } |
2197 | 2197 | ||
2198 | static inline void transport_free_sgl(struct scatterlist *sgl, int nents) | 2198 | void target_free_sgl(struct scatterlist *sgl, int nents) |
2199 | { | 2199 | { |
2200 | struct scatterlist *sg; | 2200 | struct scatterlist *sg; |
2201 | int count; | 2201 | int count; |
@@ -2205,6 +2205,7 @@ static inline void transport_free_sgl(struct scatterlist *sgl, int nents) | |||
2205 | 2205 | ||
2206 | kfree(sgl); | 2206 | kfree(sgl); |
2207 | } | 2207 | } |
2208 | EXPORT_SYMBOL(target_free_sgl); | ||
2208 | 2209 | ||
2209 | static inline void transport_reset_sgl_orig(struct se_cmd *cmd) | 2210 | static inline void transport_reset_sgl_orig(struct se_cmd *cmd) |
2210 | { | 2211 | { |
@@ -2225,7 +2226,7 @@ static inline void transport_reset_sgl_orig(struct se_cmd *cmd) | |||
2225 | static inline void transport_free_pages(struct se_cmd *cmd) | 2226 | static inline void transport_free_pages(struct se_cmd *cmd) |
2226 | { | 2227 | { |
2227 | if (!(cmd->se_cmd_flags & SCF_PASSTHROUGH_PROT_SG_TO_MEM_NOALLOC)) { | 2228 | if (!(cmd->se_cmd_flags & SCF_PASSTHROUGH_PROT_SG_TO_MEM_NOALLOC)) { |
2228 | transport_free_sgl(cmd->t_prot_sg, cmd->t_prot_nents); | 2229 | target_free_sgl(cmd->t_prot_sg, cmd->t_prot_nents); |
2229 | cmd->t_prot_sg = NULL; | 2230 | cmd->t_prot_sg = NULL; |
2230 | cmd->t_prot_nents = 0; | 2231 | cmd->t_prot_nents = 0; |
2231 | } | 2232 | } |
@@ -2236,7 +2237,7 @@ static inline void transport_free_pages(struct se_cmd *cmd) | |||
2236 | * SG_TO_MEM_NOALLOC to function with COMPARE_AND_WRITE | 2237 | * SG_TO_MEM_NOALLOC to function with COMPARE_AND_WRITE |
2237 | */ | 2238 | */ |
2238 | if (cmd->se_cmd_flags & SCF_COMPARE_AND_WRITE) { | 2239 | if (cmd->se_cmd_flags & SCF_COMPARE_AND_WRITE) { |
2239 | transport_free_sgl(cmd->t_bidi_data_sg, | 2240 | target_free_sgl(cmd->t_bidi_data_sg, |
2240 | cmd->t_bidi_data_nents); | 2241 | cmd->t_bidi_data_nents); |
2241 | cmd->t_bidi_data_sg = NULL; | 2242 | cmd->t_bidi_data_sg = NULL; |
2242 | cmd->t_bidi_data_nents = 0; | 2243 | cmd->t_bidi_data_nents = 0; |
@@ -2246,11 +2247,11 @@ static inline void transport_free_pages(struct se_cmd *cmd) | |||
2246 | } | 2247 | } |
2247 | transport_reset_sgl_orig(cmd); | 2248 | transport_reset_sgl_orig(cmd); |
2248 | 2249 | ||
2249 | transport_free_sgl(cmd->t_data_sg, cmd->t_data_nents); | 2250 | target_free_sgl(cmd->t_data_sg, cmd->t_data_nents); |
2250 | cmd->t_data_sg = NULL; | 2251 | cmd->t_data_sg = NULL; |
2251 | cmd->t_data_nents = 0; | 2252 | cmd->t_data_nents = 0; |
2252 | 2253 | ||
2253 | transport_free_sgl(cmd->t_bidi_data_sg, cmd->t_bidi_data_nents); | 2254 | target_free_sgl(cmd->t_bidi_data_sg, cmd->t_bidi_data_nents); |
2254 | cmd->t_bidi_data_sg = NULL; | 2255 | cmd->t_bidi_data_sg = NULL; |
2255 | cmd->t_bidi_data_nents = 0; | 2256 | cmd->t_bidi_data_nents = 0; |
2256 | } | 2257 | } |
@@ -2324,20 +2325,22 @@ EXPORT_SYMBOL(transport_kunmap_data_sg); | |||
2324 | 2325 | ||
2325 | int | 2326 | int |
2326 | target_alloc_sgl(struct scatterlist **sgl, unsigned int *nents, u32 length, | 2327 | target_alloc_sgl(struct scatterlist **sgl, unsigned int *nents, u32 length, |
2327 | bool zero_page) | 2328 | bool zero_page, bool chainable) |
2328 | { | 2329 | { |
2329 | struct scatterlist *sg; | 2330 | struct scatterlist *sg; |
2330 | struct page *page; | 2331 | struct page *page; |
2331 | gfp_t zero_flag = (zero_page) ? __GFP_ZERO : 0; | 2332 | gfp_t zero_flag = (zero_page) ? __GFP_ZERO : 0; |
2332 | unsigned int nent; | 2333 | unsigned int nalloc, nent; |
2333 | int i = 0; | 2334 | int i = 0; |
2334 | 2335 | ||
2335 | nent = DIV_ROUND_UP(length, PAGE_SIZE); | 2336 | nalloc = nent = DIV_ROUND_UP(length, PAGE_SIZE); |
2336 | sg = kmalloc(sizeof(struct scatterlist) * nent, GFP_KERNEL); | 2337 | if (chainable) |
2338 | nalloc++; | ||
2339 | sg = kmalloc_array(nalloc, sizeof(struct scatterlist), GFP_KERNEL); | ||
2337 | if (!sg) | 2340 | if (!sg) |
2338 | return -ENOMEM; | 2341 | return -ENOMEM; |
2339 | 2342 | ||
2340 | sg_init_table(sg, nent); | 2343 | sg_init_table(sg, nalloc); |
2341 | 2344 | ||
2342 | while (length) { | 2345 | while (length) { |
2343 | u32 page_len = min_t(u32, length, PAGE_SIZE); | 2346 | u32 page_len = min_t(u32, length, PAGE_SIZE); |
@@ -2361,6 +2364,7 @@ out: | |||
2361 | kfree(sg); | 2364 | kfree(sg); |
2362 | return -ENOMEM; | 2365 | return -ENOMEM; |
2363 | } | 2366 | } |
2367 | EXPORT_SYMBOL(target_alloc_sgl); | ||
2364 | 2368 | ||
2365 | /* | 2369 | /* |
2366 | * Allocate any required resources to execute the command. For writes we | 2370 | * Allocate any required resources to execute the command. For writes we |
@@ -2376,7 +2380,7 @@ transport_generic_new_cmd(struct se_cmd *cmd) | |||
2376 | if (cmd->prot_op != TARGET_PROT_NORMAL && | 2380 | if (cmd->prot_op != TARGET_PROT_NORMAL && |
2377 | !(cmd->se_cmd_flags & SCF_PASSTHROUGH_PROT_SG_TO_MEM_NOALLOC)) { | 2381 | !(cmd->se_cmd_flags & SCF_PASSTHROUGH_PROT_SG_TO_MEM_NOALLOC)) { |
2378 | ret = target_alloc_sgl(&cmd->t_prot_sg, &cmd->t_prot_nents, | 2382 | ret = target_alloc_sgl(&cmd->t_prot_sg, &cmd->t_prot_nents, |
2379 | cmd->prot_length, true); | 2383 | cmd->prot_length, true, false); |
2380 | if (ret < 0) | 2384 | if (ret < 0) |
2381 | return TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE; | 2385 | return TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE; |
2382 | } | 2386 | } |
@@ -2401,13 +2405,13 @@ transport_generic_new_cmd(struct se_cmd *cmd) | |||
2401 | 2405 | ||
2402 | ret = target_alloc_sgl(&cmd->t_bidi_data_sg, | 2406 | ret = target_alloc_sgl(&cmd->t_bidi_data_sg, |
2403 | &cmd->t_bidi_data_nents, | 2407 | &cmd->t_bidi_data_nents, |
2404 | bidi_length, zero_flag); | 2408 | bidi_length, zero_flag, false); |
2405 | if (ret < 0) | 2409 | if (ret < 0) |
2406 | return TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE; | 2410 | return TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE; |
2407 | } | 2411 | } |
2408 | 2412 | ||
2409 | ret = target_alloc_sgl(&cmd->t_data_sg, &cmd->t_data_nents, | 2413 | ret = target_alloc_sgl(&cmd->t_data_sg, &cmd->t_data_nents, |
2410 | cmd->data_length, zero_flag); | 2414 | cmd->data_length, zero_flag, false); |
2411 | if (ret < 0) | 2415 | if (ret < 0) |
2412 | return TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE; | 2416 | return TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE; |
2413 | } else if ((cmd->se_cmd_flags & SCF_COMPARE_AND_WRITE) && | 2417 | } else if ((cmd->se_cmd_flags & SCF_COMPARE_AND_WRITE) && |
@@ -2421,7 +2425,7 @@ transport_generic_new_cmd(struct se_cmd *cmd) | |||
2421 | 2425 | ||
2422 | ret = target_alloc_sgl(&cmd->t_bidi_data_sg, | 2426 | ret = target_alloc_sgl(&cmd->t_bidi_data_sg, |
2423 | &cmd->t_bidi_data_nents, | 2427 | &cmd->t_bidi_data_nents, |
2424 | caw_length, zero_flag); | 2428 | caw_length, zero_flag, false); |
2425 | if (ret < 0) | 2429 | if (ret < 0) |
2426 | return TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE; | 2430 | return TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE; |
2427 | } | 2431 | } |
diff --git a/drivers/target/target_core_xcopy.c b/drivers/target/target_core_xcopy.c index 47fe94ee10b8..75cd85426ae3 100644 --- a/drivers/target/target_core_xcopy.c +++ b/drivers/target/target_core_xcopy.c | |||
@@ -563,7 +563,7 @@ static int target_xcopy_setup_pt_cmd( | |||
563 | 563 | ||
564 | if (alloc_mem) { | 564 | if (alloc_mem) { |
565 | rc = target_alloc_sgl(&cmd->t_data_sg, &cmd->t_data_nents, | 565 | rc = target_alloc_sgl(&cmd->t_data_sg, &cmd->t_data_nents, |
566 | cmd->data_length, false); | 566 | cmd->data_length, false, false); |
567 | if (rc < 0) { | 567 | if (rc < 0) { |
568 | ret = rc; | 568 | ret = rc; |
569 | goto out; | 569 | goto out; |