]> git.openfabrics.org - ~shefty/rdma-win.git/commitdiff
[MTHCA] added some sanity checks
authorleonidk <leonidk@ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86>
Wed, 20 Sep 2006 12:20:09 +0000 (12:20 +0000)
committerleonidk <leonidk@ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86>
Wed, 20 Sep 2006 12:20:09 +0000 (12:20 +0000)
git-svn-id: svn://openib.tc.cornell.edu/gen1@503 ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86

trunk/hw/mthca/kernel/hca_verbs.c

index 2484c0cd0cc85ecc8cfe9b1dddb16c4fb947469b..79551576f16b115426d4bb94e6fd2880e3bf0b15 100644 (file)
@@ -147,6 +147,12 @@ mlnx_query_ca (
                        p_umv_buf->status = status = IB_UNSUPPORTED;\r
                        goto err_user_unsupported;\r
        }\r
+\r
+       if( !cl_is_blockable() ) {\r
+                       status = IB_UNSUPPORTED;\r
+                       goto err_unsupported;\r
+       }\r
+\r
        if (NULL == p_byte_count) {\r
                status = IB_INVALID_PARAMETER;\r
                goto err_byte_count;\r
@@ -306,6 +312,7 @@ err_query_port:
 err_alloc_ports:\r
 err_query_device:\r
 err_byte_count:        \r
+err_unsupported:\r
 err_user_unsupported:\r
        if( status != IB_INSUFFICIENT_MEMORY && status != IB_SUCCESS )\r
                HCA_PRINT(TRACE_LEVEL_ERROR     , HCA_DBG_SHIM  ,("completes with ERROR status %s\n", IB_GET_ERR_STR(status)));\r
@@ -337,6 +344,17 @@ mlnx_modify_ca (
 \r
        HCA_ENTER(HCA_DBG_SHIM);\r
 \r
+       //sanity check\r
+       if( !cl_is_blockable() ) {\r
+                       status = IB_UNSUPPORTED;\r
+                       goto err_unsupported;\r
+       }\r
+       \r
+       if (port_num < start_port(ib_dev) || port_num > end_port(ib_dev)) {\r
+               status = IB_INVALID_PORT;\r
+               goto err_port;\r
+       }\r
+\r
        // prepare parameters\r
        RtlZeroMemory(&props, sizeof(props));\r
        SET_CAP_MOD(IB_CA_MOD_IS_SM, sm, IB_PORT_SM);\r
@@ -357,6 +375,8 @@ mlnx_modify_ca (
        status =        IB_SUCCESS;\r
 \r
 err_modify_port:\r
+err_port:\r
+err_unsupported:\r
        HCA_PRINT_EXIT(TRACE_LEVEL_ERROR  , HCA_DBG_SHIM  ,("completes with ERROR status %s\n", IB_GET_ERR_STR(status)));\r
        return status;\r
 }\r