uvp/av: complete all processing in pre_create/destroy_av() calls
authorshefty <shefty@ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86>
Wed, 23 Jul 2008 21:13:05 +0000 (21:13 +0000)
committershefty <shefty@ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86>
Wed, 23 Jul 2008 21:13:05 +0000 (21:13 +0000)
According to the documentation, if a UVP returns IB_VERBS_PROCESSING_DONE
from a pre() IOCTL call, then all verbs related processing has completed.
The mthca pre_create_av() and pre_destroy_av() uvp implementation can
both return IB_VERBS_PROCESSING_DONE, but requires that users still call
post_create_av() and post_destroy_av().  Fix the mthca UVP to complete all
processing in the pre() IOCTL calls when returning IB_VERBS_PROCESSING_DONE,
and update IBAL to remove unnecessary post() IOCTL calls.

Signed-off-by: Sean Hefty <sean.hefty@intel.com>
git-svn-id: svn://openib.tc.cornell.edu/gen1/trunk@1442 ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86

core/al/user/ual_av.c
hw/mthca/user/mlnx_ual_av.c

index a97358d..4d7bb4a 100644 (file)
@@ -68,21 +68,10 @@ ual_create_av(
        {\r
                status = uvp_intf.pre_create_av( h_pd->h_ci_pd,\r
                        p_av_attr, &ioctl_buf.in.umv_buf, &h_av->h_ci_av );\r
-               if( status == IB_VERBS_PROCESSING_DONE )\r
+               if( status != IB_SUCCESS )\r
                {\r
-                       /* Creation is done entirely in user mode.  Issue the post call */\r
-                       if( uvp_intf.post_create_av )\r
-                       {\r
-                               uvp_intf.post_create_av( h_pd->h_ci_pd,\r
-                                       IB_SUCCESS, &h_av->h_ci_av, &ioctl_buf.in.umv_buf );\r
-                       }\r
                        AL_EXIT( AL_DBG_AV );\r
-                       return IB_SUCCESS;\r
-               }\r
-               else if( status != IB_SUCCESS )\r
-               {\r
-                       AL_EXIT( AL_DBG_AV );\r
-                       return status;\r
+                       return (status == IB_VERBS_PROCESSING_DONE) ? IB_SUCCESS : status;\r
                }\r
        }\r
 \r
@@ -186,19 +175,10 @@ ual_destroy_av(
                status = uvp_intf.pre_destroy_av( h_av->h_ci_av );\r
                CL_ASSERT( (status == IB_SUCCESS) ||\r
                        (status == IB_VERBS_PROCESSING_DONE) );\r
-               if( status == IB_VERBS_PROCESSING_DONE )\r
-               {\r
-                       /* Destruction is done in user mode. Issue the post call */\r
-                       if( uvp_intf.post_destroy_av )\r
-                               uvp_intf.post_destroy_av( h_av->h_ci_av, IB_SUCCESS );\r
-\r
-                       AL_EXIT( AL_DBG_AV );\r
-                       return IB_SUCCESS;\r
-               }\r
-               else if( status != IB_SUCCESS )\r
+               if( status != IB_SUCCESS )\r
                {\r
                        AL_EXIT( AL_DBG_AV );\r
-                       return status;\r
+                       return (status == IB_VERBS_PROCESSING_DONE) ? IB_SUCCESS : status;\r
                }\r
        }\r
 \r
index 25c8ebd..d3a76fc 100644 (file)
 #include "mlnx_ual_av.tmh"\r
 #endif\r
 \r
+static void\r
+__post_create_av (\r
+       IN              const ib_pd_handle_t    h_uvp_pd,\r
+       IN              ib_api_status_t                 ioctl_status,\r
+       IN OUT  ib_av_handle_t                  *ph_uvp_av,\r
+       IN OUT  ci_umv_buf_t                    *p_umv_buf);\r
+\r
 \r
 uint8_t\r
 gid_to_index_lookup (\r
@@ -192,9 +199,10 @@ __pre_create_av (
                p_create_av->mr.access_flags = 0;       //local read\r
                status = IB_SUCCESS;\r
        }\r
-       else\r
+       else {\r
+               __post_create_av(h_uvp_pd, IB_SUCCESS, ph_uvp_av, p_umv_buf);\r
                status = IB_VERBS_PROCESSING_DONE;\r
-\r
+       }\r
        goto end;\r
 \r
 err_mem:       \r
@@ -351,8 +359,11 @@ __pre_destroy_av (
        UVP_ENTER(UVP_DBG_AV);\r
        if (mthca_ah->in_kernel)\r
                status = IB_SUCCESS;\r
-       else\r
+       else {\r
+               mthca_free_av(mthca_ah);\r
+               cl_free(mthca_ah);\r
                status = IB_VERBS_PROCESSING_DONE;\r
+       }\r
        UVP_EXIT(UVP_DBG_AV);\r
        return status;\r
 }\r