From acb0022445d2c0c024db181a867fd3d66a9fd04d Mon Sep 17 00:00:00 2001 From: shefty Date: Fri, 20 Jun 2008 04:32:14 +0000 Subject: [PATCH] winverbs: add patch to fix uvp checks of ci_umv_buf p_inout_buf pointer Signed-off-by: Sean Hefty git-svn-id: svn://openib.tc.cornell.edu/gen1@1292 ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86 --- branches/winverbs/patches/inout_buf.txt | 291 +++++++++++++++++++ branches/winverbs/patches/inout_buf_desc.txt | 9 + branches/winverbs/patches/series.txt | 2 +- 3 files changed, 301 insertions(+), 1 deletion(-) create mode 100644 branches/winverbs/patches/inout_buf.txt create mode 100644 branches/winverbs/patches/inout_buf_desc.txt diff --git a/branches/winverbs/patches/inout_buf.txt b/branches/winverbs/patches/inout_buf.txt new file mode 100644 index 00000000..036b16b9 --- /dev/null +++ b/branches/winverbs/patches/inout_buf.txt @@ -0,0 +1,291 @@ +diff -up trunk\hw\mthca\user/mlnx_ual_av.c branches\winverbs\hw\mthca\user/mlnx_ual_av.c +--- trunk\hw\mthca\user/mlnx_ual_av.c 2008-05-20 00:30:00.036125000 -0700 ++++ branches\winverbs\hw\mthca\user/mlnx_ual_av.c 2008-06-18 22:58:54.296875000 -0700 +@@ -168,13 +168,11 @@ __pre_create_av ( + } + + // allocate parameters +- if( !p_umv_buf->p_inout_buf ) { +- p_umv_buf->p_inout_buf = cl_zalloc( size ); +- if( !p_umv_buf->p_inout_buf ) +- { +- status = IB_INSUFFICIENT_MEMORY; +- goto err_mem; +- } ++ p_umv_buf->p_inout_buf = cl_zalloc( size ); ++ if( !p_umv_buf->p_inout_buf ) ++ { ++ status = IB_INSUFFICIENT_MEMORY; ++ goto err_mem; + } + + // fill the parameters +diff -up trunk\hw\mthca\user/mlnx_ual_ca.c branches\winverbs\hw\mthca\user/mlnx_ual_ca.c +--- trunk\hw\mthca\user/mlnx_ual_ca.c 2008-05-05 09:47:15.842125000 -0700 ++++ branches\winverbs\hw\mthca\user/mlnx_ual_ca.c 2008-06-18 22:58:54.203125000 -0700 +@@ -55,14 +55,11 @@ __pre_open_ca ( + UVP_ENTER(UVP_DBG_SHIM); + if( p_umv_buf ) + { ++ p_umv_buf->p_inout_buf = cl_zalloc( sizeof(struct ibv_get_context_resp) ); + if( !p_umv_buf->p_inout_buf ) + { +- p_umv_buf->p_inout_buf = cl_zalloc( sizeof(struct ibv_get_context_resp) ); +- if( !p_umv_buf->p_inout_buf ) +- { +- status = IB_INSUFFICIENT_MEMORY; +- goto err_memory; +- } ++ status = IB_INSUFFICIENT_MEMORY; ++ goto err_memory; + } + p_umv_buf->input_size = p_umv_buf->output_size = sizeof(struct ibv_get_context_resp); + p_umv_buf->command = TRUE; +diff -up trunk\hw\mthca\user/mlnx_ual_cq.c branches\winverbs\hw\mthca\user/mlnx_ual_cq.c +--- trunk\hw\mthca\user/mlnx_ual_cq.c 2008-05-05 09:47:15.904625000 -0700 ++++ branches\winverbs\hw\mthca\user/mlnx_ual_cq.c 2008-06-18 22:58:54.125000000 -0700 +@@ -62,14 +62,11 @@ __pre_create_cq ( + + CL_ASSERT(p_umv_buf); + ++ p_umv_buf->p_inout_buf = cl_zalloc( size ); + if( !p_umv_buf->p_inout_buf ) + { +- p_umv_buf->p_inout_buf = cl_zalloc( size ); +- if( !p_umv_buf->p_inout_buf ) +- { +- status = IB_INSUFFICIENT_MEMORY; +- goto err_memory; +- } ++ status = IB_INSUFFICIENT_MEMORY; ++ goto err_memory; + } + p_umv_buf->input_size = sizeof(struct ibv_create_cq); + p_umv_buf->output_size = sizeof(struct ibv_create_cq_resp); +diff -up trunk\hw\mthca\user/mlnx_ual_pd.c branches\winverbs\hw\mthca\user/mlnx_ual_pd.c +--- trunk\hw\mthca\user/mlnx_ual_pd.c 2008-05-05 09:47:15.779625000 -0700 ++++ branches\winverbs\hw\mthca\user/mlnx_ual_pd.c 2008-06-18 22:58:54.062500000 -0700 +@@ -54,14 +54,11 @@ __pre_allocate_pd ( + + CL_ASSERT(p_umv_buf); + ++ p_umv_buf->p_inout_buf = cl_zalloc( sizeof(struct ibv_alloc_pd_resp) ); + if( !p_umv_buf->p_inout_buf ) + { +- p_umv_buf->p_inout_buf = cl_zalloc( sizeof(struct ibv_alloc_pd_resp) ); +- if( !p_umv_buf->p_inout_buf ) +- { +- status = IB_INSUFFICIENT_MEMORY; +- goto err_memory; +- } ++ status = IB_INSUFFICIENT_MEMORY; ++ goto err_memory; + } + p_umv_buf->input_size = p_umv_buf->output_size = sizeof(struct ibv_alloc_pd_resp); + p_umv_buf->command = TRUE; +diff -up trunk\hw\mthca\user/mlnx_ual_qp.c branches\winverbs\hw\mthca\user/mlnx_ual_qp.c +--- trunk\hw\mthca\user/mlnx_ual_qp.c 2008-06-18 22:53:44.015625000 -0700 ++++ branches\winverbs\hw\mthca\user/mlnx_ual_qp.c 2008-06-18 22:58:53.984375000 -0700 +@@ -99,14 +99,11 @@ __pre_create_qp ( + + CL_ASSERT(p_umv_buf); + ++ p_umv_buf->p_inout_buf = cl_zalloc( size ); + if( !p_umv_buf->p_inout_buf ) + { +- p_umv_buf->p_inout_buf = cl_zalloc( size ); +- if( !p_umv_buf->p_inout_buf ) +- { +- status = IB_INSUFFICIENT_MEMORY; +- goto err_memory; +- } ++ status = IB_INSUFFICIENT_MEMORY; ++ goto err_memory; + } + p_umv_buf->input_size = sizeof(struct ibv_create_qp); + p_umv_buf->output_size = sizeof(struct ibv_create_qp_resp); +@@ -224,14 +221,11 @@ __pre_modify_qp ( + + CL_ASSERT(p_umv_buf); + ++ p_umv_buf->p_inout_buf = cl_zalloc( sizeof(struct ibv_modify_qp_resp) ); + if( !p_umv_buf->p_inout_buf ) + { +- p_umv_buf->p_inout_buf = cl_zalloc( sizeof(struct ibv_modify_qp_resp) ); +- if( !p_umv_buf->p_inout_buf ) +- { +- status = IB_INSUFFICIENT_MEMORY; +- goto err_memory; +- } ++ status = IB_INSUFFICIENT_MEMORY; ++ goto err_memory; + } + p_umv_buf->input_size = 0; + p_umv_buf->output_size = sizeof(struct ibv_modify_qp_resp); +diff -up trunk\hw\mthca\user/mlnx_ual_srq.c branches\winverbs\hw\mthca\user/mlnx_ual_srq.c +--- trunk\hw\mthca\user/mlnx_ual_srq.c 2008-05-05 09:47:16.123375000 -0700 ++++ branches\winverbs\hw\mthca\user/mlnx_ual_srq.c 2008-06-18 22:58:53.843750000 -0700 +@@ -96,14 +96,11 @@ __pre_create_srq ( + goto err_params; + } + ++ p_umv_buf->p_inout_buf = cl_zalloc( size ); + if( !p_umv_buf->p_inout_buf ) + { +- p_umv_buf->p_inout_buf = cl_zalloc( size ); +- if( !p_umv_buf->p_inout_buf ) +- { +- status = IB_INSUFFICIENT_MEMORY; +- goto err_memory; +- } ++ status = IB_INSUFFICIENT_MEMORY; ++ goto err_memory; + } + p_umv_buf->input_size = sizeof(struct ibv_create_srq); + p_umv_buf->output_size = sizeof(struct ibv_create_srq_resp); +--- trunk\hw\mlx4\user\hca\verbs.c 2008-06-18 22:53:44.000000000 -0700 ++++ branches\winverbs\hw\mlx4\user\hca\verbs.c 2008-06-18 23:17:03.453125000 -0700 +@@ -59,14 +59,11 @@ mlx4_pre_open_ca ( + + if( p_umv_buf ) + { ++ p_umv_buf->p_inout_buf = cl_zalloc( sizeof(struct ibv_get_context_resp) ); + if( !p_umv_buf->p_inout_buf ) + { +- p_umv_buf->p_inout_buf = cl_zalloc( sizeof(struct ibv_get_context_resp) ); +- if( !p_umv_buf->p_inout_buf ) +- { +- status = IB_INSUFFICIENT_MEMORY; +- goto end; +- } ++ status = IB_INSUFFICIENT_MEMORY; ++ goto end; + } + p_umv_buf->input_size = 0; + p_umv_buf->output_size = sizeof(struct ibv_get_context_resp); +@@ -233,14 +230,11 @@ mlx4_pre_alloc_pd ( + + CL_ASSERT(context && p_umv_buf); + ++ p_umv_buf->p_inout_buf = cl_malloc( sizeof(struct ibv_alloc_pd_resp) ); + if( !p_umv_buf->p_inout_buf ) + { +- p_umv_buf->p_inout_buf = cl_malloc( sizeof(struct ibv_alloc_pd_resp) ); +- if( !p_umv_buf->p_inout_buf ) +- { +- status = IB_INSUFFICIENT_MEMORY; +- goto end; +- } ++ status = IB_INSUFFICIENT_MEMORY; ++ goto end; + } + p_umv_buf->input_size = 0; + p_umv_buf->output_size = sizeof(struct ibv_alloc_pd_resp); +@@ -333,14 +327,11 @@ mlx4_pre_create_cq ( + + CL_ASSERT(h_uvp_ca && p_umv_buf); + ++ p_umv_buf->p_inout_buf = cl_malloc( size ); + if( !p_umv_buf->p_inout_buf ) + { +- p_umv_buf->p_inout_buf = cl_malloc( size ); +- if( !p_umv_buf->p_inout_buf ) +- { +- status = IB_INSUFFICIENT_MEMORY; +- goto err_umv_buf; +- } ++ status = IB_INSUFFICIENT_MEMORY; ++ goto err_umv_buf; + } + p_umv_buf->input_size = sizeof(struct ibv_create_cq); + p_umv_buf->output_size = sizeof(struct ibv_create_cq_resp); +@@ -492,14 +483,11 @@ mlx4_pre_create_srq ( + + CL_ASSERT(p_umv_buf); + ++ p_umv_buf->p_inout_buf = cl_malloc( size ); + if( !p_umv_buf->p_inout_buf ) + { +- p_umv_buf->p_inout_buf = cl_malloc( size ); +- if( !p_umv_buf->p_inout_buf ) +- { +- status = IB_INSUFFICIENT_MEMORY; +- goto err_memory; +- } ++ status = IB_INSUFFICIENT_MEMORY; ++ goto err_memory; + } + p_umv_buf->input_size = sizeof(struct ibv_create_srq); + p_umv_buf->output_size = sizeof(struct ibv_create_srq_resp); +@@ -694,14 +682,11 @@ mlx4_pre_create_qp ( + + CL_ASSERT(p_umv_buf); + ++ p_umv_buf->p_inout_buf = cl_malloc(size); + if( !p_umv_buf->p_inout_buf ) + { +- p_umv_buf->p_inout_buf = cl_malloc(size); +- if( !p_umv_buf->p_inout_buf ) +- { +- status = IB_INSUFFICIENT_MEMORY; +- goto err_memory; +- } ++ status = IB_INSUFFICIENT_MEMORY; ++ goto err_memory; + } + p_umv_buf->input_size = sizeof(struct ibv_create_qp); + p_umv_buf->output_size = sizeof(struct ibv_create_qp_resp); +@@ -947,14 +932,11 @@ mlx4_pre_modify_qp ( + + CL_ASSERT(p_umv_buf); + ++ p_umv_buf->p_inout_buf = cl_malloc(sizeof(struct ibv_modify_qp_resp)); + if( !p_umv_buf->p_inout_buf ) + { +- p_umv_buf->p_inout_buf = cl_malloc(sizeof(struct ibv_modify_qp_resp)); +- if( !p_umv_buf->p_inout_buf ) +- { +- status = IB_INSUFFICIENT_MEMORY; +- goto err_memory; +- } ++ status = IB_INSUFFICIENT_MEMORY; ++ goto err_memory; + } + p_umv_buf->input_size = 0; + p_umv_buf->output_size = sizeof(struct ibv_modify_qp_resp); +@@ -1415,14 +1397,11 @@ mlx4_pre_create_xrc_srq ( + + CL_ASSERT(p_umv_buf); + ++ p_umv_buf->p_inout_buf = cl_malloc( size ); + if( !p_umv_buf->p_inout_buf ) + { +- p_umv_buf->p_inout_buf = cl_malloc( size ); +- if( !p_umv_buf->p_inout_buf ) +- { +- status = IB_INSUFFICIENT_MEMORY; +- goto err_memory; +- } ++ status = IB_INSUFFICIENT_MEMORY; ++ goto err_memory; + } + p_umv_buf->input_size = sizeof(struct ibv_create_srq); + p_umv_buf->output_size = sizeof(struct ibv_create_srq_resp); +@@ -1551,14 +1530,11 @@ mlx4_pre_open_xrc_domain ( + + CL_ASSERT(h_uvp_ca && p_umv_buf); + ++ p_umv_buf->p_inout_buf = cl_malloc( size ); + if( !p_umv_buf->p_inout_buf ) + { +- p_umv_buf->p_inout_buf = cl_malloc( size ); +- if( !p_umv_buf->p_inout_buf ) +- { +- status = IB_INSUFFICIENT_MEMORY; +- goto err_umv_buf; +- } ++ status = IB_INSUFFICIENT_MEMORY; ++ goto err_umv_buf; + } + p_umv_buf->input_size = sizeof(struct ibv_open_xrc_domain); + p_umv_buf->output_size = sizeof(struct ibv_open_xrc_domain_resp); diff --git a/branches/winverbs/patches/inout_buf_desc.txt b/branches/winverbs/patches/inout_buf_desc.txt new file mode 100644 index 00000000..635db0af --- /dev/null +++ b/branches/winverbs/patches/inout_buf_desc.txt @@ -0,0 +1,9 @@ +uvp/ci_umv_buf: always allocate uvp buffer + +The UVP controls the ci_umv_buf, but does allocate the p_inout_buf if it +is non-zero. However, the uvp frees the buffer later. It should always +allocate the buffer, since the caller does not know the required size and +cannot allocate it on the uvp's behalf. This avoids an unneeded +initialization by the caller, and the if check by the uvp. + +Signed-off-by: Sean Hefty diff --git a/branches/winverbs/patches/series.txt b/branches/winverbs/patches/series.txt index 437b3848..99dffedf 100644 --- a/branches/winverbs/patches/series.txt +++ b/branches/winverbs/patches/series.txt @@ -6,4 +6,4 @@ poll_cq.txt uvp_if.txt query_if.txt align_wr_wc.txt - +inout_buf.txt -- 2.46.0