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() ...
This commit is contained in:
@@ -2195,7 +2195,7 @@ queue_full:
|
||||
transport_handle_queue_full(cmd, cmd->se_dev);
|
||||
}
|
||||
|
||||
static inline void transport_free_sgl(struct scatterlist *sgl, int nents)
|
||||
void target_free_sgl(struct scatterlist *sgl, int nents)
|
||||
{
|
||||
struct scatterlist *sg;
|
||||
int count;
|
||||
@@ -2205,6 +2205,7 @@ static inline void transport_free_sgl(struct scatterlist *sgl, int nents)
|
||||
|
||||
kfree(sgl);
|
||||
}
|
||||
EXPORT_SYMBOL(target_free_sgl);
|
||||
|
||||
static inline void transport_reset_sgl_orig(struct se_cmd *cmd)
|
||||
{
|
||||
@@ -2225,7 +2226,7 @@ static inline void transport_reset_sgl_orig(struct se_cmd *cmd)
|
||||
static inline void transport_free_pages(struct se_cmd *cmd)
|
||||
{
|
||||
if (!(cmd->se_cmd_flags & SCF_PASSTHROUGH_PROT_SG_TO_MEM_NOALLOC)) {
|
||||
transport_free_sgl(cmd->t_prot_sg, cmd->t_prot_nents);
|
||||
target_free_sgl(cmd->t_prot_sg, cmd->t_prot_nents);
|
||||
cmd->t_prot_sg = NULL;
|
||||
cmd->t_prot_nents = 0;
|
||||
}
|
||||
@@ -2236,7 +2237,7 @@ static inline void transport_free_pages(struct se_cmd *cmd)
|
||||
* SG_TO_MEM_NOALLOC to function with COMPARE_AND_WRITE
|
||||
*/
|
||||
if (cmd->se_cmd_flags & SCF_COMPARE_AND_WRITE) {
|
||||
transport_free_sgl(cmd->t_bidi_data_sg,
|
||||
target_free_sgl(cmd->t_bidi_data_sg,
|
||||
cmd->t_bidi_data_nents);
|
||||
cmd->t_bidi_data_sg = NULL;
|
||||
cmd->t_bidi_data_nents = 0;
|
||||
@@ -2246,11 +2247,11 @@ static inline void transport_free_pages(struct se_cmd *cmd)
|
||||
}
|
||||
transport_reset_sgl_orig(cmd);
|
||||
|
||||
transport_free_sgl(cmd->t_data_sg, cmd->t_data_nents);
|
||||
target_free_sgl(cmd->t_data_sg, cmd->t_data_nents);
|
||||
cmd->t_data_sg = NULL;
|
||||
cmd->t_data_nents = 0;
|
||||
|
||||
transport_free_sgl(cmd->t_bidi_data_sg, cmd->t_bidi_data_nents);
|
||||
target_free_sgl(cmd->t_bidi_data_sg, cmd->t_bidi_data_nents);
|
||||
cmd->t_bidi_data_sg = NULL;
|
||||
cmd->t_bidi_data_nents = 0;
|
||||
}
|
||||
@@ -2324,20 +2325,22 @@ EXPORT_SYMBOL(transport_kunmap_data_sg);
|
||||
|
||||
int
|
||||
target_alloc_sgl(struct scatterlist **sgl, unsigned int *nents, u32 length,
|
||||
bool zero_page)
|
||||
bool zero_page, bool chainable)
|
||||
{
|
||||
struct scatterlist *sg;
|
||||
struct page *page;
|
||||
gfp_t zero_flag = (zero_page) ? __GFP_ZERO : 0;
|
||||
unsigned int nent;
|
||||
unsigned int nalloc, nent;
|
||||
int i = 0;
|
||||
|
||||
nent = DIV_ROUND_UP(length, PAGE_SIZE);
|
||||
sg = kmalloc(sizeof(struct scatterlist) * nent, GFP_KERNEL);
|
||||
nalloc = nent = DIV_ROUND_UP(length, PAGE_SIZE);
|
||||
if (chainable)
|
||||
nalloc++;
|
||||
sg = kmalloc_array(nalloc, sizeof(struct scatterlist), GFP_KERNEL);
|
||||
if (!sg)
|
||||
return -ENOMEM;
|
||||
|
||||
sg_init_table(sg, nent);
|
||||
sg_init_table(sg, nalloc);
|
||||
|
||||
while (length) {
|
||||
u32 page_len = min_t(u32, length, PAGE_SIZE);
|
||||
@@ -2361,6 +2364,7 @@ out:
|
||||
kfree(sg);
|
||||
return -ENOMEM;
|
||||
}
|
||||
EXPORT_SYMBOL(target_alloc_sgl);
|
||||
|
||||
/*
|
||||
* Allocate any required resources to execute the command. For writes we
|
||||
@@ -2376,7 +2380,7 @@ transport_generic_new_cmd(struct se_cmd *cmd)
|
||||
if (cmd->prot_op != TARGET_PROT_NORMAL &&
|
||||
!(cmd->se_cmd_flags & SCF_PASSTHROUGH_PROT_SG_TO_MEM_NOALLOC)) {
|
||||
ret = target_alloc_sgl(&cmd->t_prot_sg, &cmd->t_prot_nents,
|
||||
cmd->prot_length, true);
|
||||
cmd->prot_length, true, false);
|
||||
if (ret < 0)
|
||||
return TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE;
|
||||
}
|
||||
@@ -2401,13 +2405,13 @@ transport_generic_new_cmd(struct se_cmd *cmd)
|
||||
|
||||
ret = target_alloc_sgl(&cmd->t_bidi_data_sg,
|
||||
&cmd->t_bidi_data_nents,
|
||||
bidi_length, zero_flag);
|
||||
bidi_length, zero_flag, false);
|
||||
if (ret < 0)
|
||||
return TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE;
|
||||
}
|
||||
|
||||
ret = target_alloc_sgl(&cmd->t_data_sg, &cmd->t_data_nents,
|
||||
cmd->data_length, zero_flag);
|
||||
cmd->data_length, zero_flag, false);
|
||||
if (ret < 0)
|
||||
return TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE;
|
||||
} else if ((cmd->se_cmd_flags & SCF_COMPARE_AND_WRITE) &&
|
||||
@@ -2421,7 +2425,7 @@ transport_generic_new_cmd(struct se_cmd *cmd)
|
||||
|
||||
ret = target_alloc_sgl(&cmd->t_bidi_data_sg,
|
||||
&cmd->t_bidi_data_nents,
|
||||
caw_length, zero_flag);
|
||||
caw_length, zero_flag, false);
|
||||
if (ret < 0)
|
||||
return TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE;
|
||||
}
|
||||
|
@@ -563,7 +563,7 @@ static int target_xcopy_setup_pt_cmd(
|
||||
|
||||
if (alloc_mem) {
|
||||
rc = target_alloc_sgl(&cmd->t_data_sg, &cmd->t_data_nents,
|
||||
cmd->data_length, false);
|
||||
cmd->data_length, false, false);
|
||||
if (rc < 0) {
|
||||
ret = rc;
|
||||
goto out;
|
||||
|
Reference in New Issue
Block a user