osaf/libs/agents/saf/clma/clma_api.c    |  22 +++++++++++++++-------
 osaf/libs/agents/saf/cpa/cpa_api.c      |  21 +++++++++++++--------
 osaf/libs/agents/saf/imma/imma_om_api.c |  24 ++++++++++++++++++++----
 osaf/libs/core/include/mds_papi.h       |   3 +++
 4 files changed, 51 insertions(+), 19 deletions(-)


 SAF API  functions that take an explicit timeout parameter are currently
 expect the user to always set this parameter to MIN timeout value.

 Now this patch  implements support for the  full range of timeout values i.e. 
[0, SA_TIME_MAX] ,
 since the underlying POSIX functions do support them.

  And for the testing:  need to done both the case when  the timeout happens 
and when it doesn't.
 Following are the list of SAF API  functions that take an explicit timeout 
parameter :

 saImmOmAdminOperationInvoke()
 saCkptCheckpointOpen()
 saClmClusterNodeGet()

diff --git a/osaf/libs/agents/saf/clma/clma_api.c 
b/osaf/libs/agents/saf/clma/clma_api.c
--- a/osaf/libs/agents/saf/clma/clma_api.c
+++ b/osaf/libs/agents/saf/clma/clma_api.c
@@ -1246,18 +1246,26 @@ static SaAisErrorT clmaclusternodeget(Sa
        }
 
        if (timeout < 0) {
-               TRACE("Timeout value is negative");
+               TRACE("saClmClusterNodeGet:Timeout value is negative");
                rc = SA_AIS_ERR_INVALID_PARAM;
                goto done;
-       }
+       } else if (timeout > ( SA_TIME_ONE_MILLISECOND * 
MDS_MAX_TIMEOUT_MILLISECOND)) {
+               /* Unfortunately the current MDS transport support only 
uint32_t type variable (232-1) for timeout parameter ,
+                  even though  SAF APIS supports SaTimeT (SaInt64T) type 
(263-1).
+                  So as work around currently if SAF API receives the higher 
value then  uint32_t (232-1) that it can hold , form now
+                  implicitly set  to max MDS supported value (4294967295 * 
10000000) ,  which is already very large  impractical value.
+
+                  In  Future solution : `[ticket:#1658] mds : Opensf transport 
should adopt the size of the
+                  timeout parameter from 32 bits to 64 bits`  will resolve the 
issue by matching both MDS transport and SAF API's
+                */             
+               TRACE_4("saClmClusterNodeGet: timeout > MDS_MAX_TIMEOUT setting 
to MDS max timeout value:%llu, clmHandle:%llx",
+                               (SA_TIME_ONE_MILLISECOND * 
MDS_MAX_TIMEOUT_MILLISECOND) , clmHandle);
+                timeout = (SA_TIME_ONE_MILLISECOND * 
MDS_MAX_TIMEOUT_MILLISECOND);
+        }
 
        /* convert SaTimeT into tens of milli seconds */
        timeout = m_CLMA_CONVERT_SATIME_TEN_MILLI_SEC(timeout);
-       if (timeout < CLM_API_MIN_TIMEOUT) {
-               TRACE("timeout is LESS THAN 100ms");
-               rc = SA_AIS_ERR_TIMEOUT;
-               goto done;
-       }
+       
        /* Check Whether CLMS is up or not */
        if (!clma_cb.clms_up) {
                TRACE("CLMS down");
diff --git a/osaf/libs/agents/saf/cpa/cpa_api.c 
b/osaf/libs/agents/saf/cpa/cpa_api.c
--- a/osaf/libs/agents/saf/cpa/cpa_api.c
+++ b/osaf/libs/agents/saf/cpa/cpa_api.c
@@ -893,7 +893,19 @@ SaAisErrorT saCkptCheckpointOpen(SaCkptH
                                SA_AIS_ERR_INVALID_PARAM, ckptHandle);
                TRACE_LEAVE2("API return code = %u", rc);
                return SA_AIS_ERR_INVALID_PARAM;
-       }
+       } else if (timeout > ( SA_TIME_ONE_MILLISECOND * 
MDS_MAX_TIMEOUT_MILLISECOND)) {
+               /* Unfortunately the current MDS transport support only 
uint32_t type variable (232-1) for timeout parameter ,
+                  even though  SAF APIS supports SaTimeT (SaInt64T) type 
(263-1).
+                  So as work around currently if SAF API receives the higher 
value then  uint32_t (232-1) that it can hold , form now
+                  implicitly set  to max MDS supported value (4294967295 * 
10000000) ,  which is already very large  impractical value.
+
+                  In  Future solution : `[ticket:#1658] mds : Opensf transport 
should adopt the size of the
+                  timeout parameter from 32 bits to 64 bits`  will resolve the 
issue by matching both MDS transport and SAF API's
+                */             
+               TRACE_4("Cpa CkptOpen: timeout > MDS_MAX_TIMEOUT setting to MDS 
max timeout value:%llu,ckptHandle:%llx",
+                               (SA_TIME_ONE_MILLISECOND * 
MDS_MAX_TIMEOUT_MILLISECOND) , ckptHandle);
+                timeout = (SA_TIME_ONE_MILLISECOND * 
MDS_MAX_TIMEOUT_MILLISECOND);
+        }
 
        
        /* Draft Validations */
@@ -985,13 +997,6 @@ SaAisErrorT saCkptCheckpointOpen(SaCkptH
        /* convert the timeout to 10 ms value and add it to the sync send 
timeout */
        time_out = m_CPSV_CONVERT_SATIME_TEN_MILLI_SEC(timeout);
 
-       if (time_out < CPSV_WAIT_TIME) {
-               rc = SA_AIS_ERR_TIMEOUT;
-               TRACE_4("Cpa CkptOpen failed Api failed with return 
value:%d,ckptHandle:%llx,timeout:%llu",
-                               rc, ckptHandle, timeout);
-               goto mds_send_fail;
-       }
-
        evt.info.cpnd.info.openReq.timeout = timeout;
 
        /* Unlock before MDS Send */
diff --git a/osaf/libs/agents/saf/imma/imma_om_api.c 
b/osaf/libs/agents/saf/imma/imma_om_api.c
--- a/osaf/libs/agents/saf/imma/imma_om_api.c
+++ b/osaf/libs/agents/saf/imma/imma_om_api.c
@@ -3672,6 +3672,26 @@ static SaAisErrorT admin_op_invoke_commo
        bool opNamePar = false;
        TRACE_ENTER();
 
+        if (timeout < 0 ) {
+                TRACE_4("saImmOmAdminOperationInvoke: failed invalid timeout 
return value:%d,immHandle:%llx",
+                                SA_AIS_ERR_INVALID_PARAM, immHandle);
+               rc = SA_AIS_ERR_INVALID_PARAM;
+               goto done;
+        } else if (timeout > ( SA_TIME_ONE_MILLISECOND * 
MDS_MAX_TIMEOUT_MILLISECOND)) {
+               /* Unfortunately the current MDS transport support only 
uint32_t type variable (232-1) for timeout parameter ,
+                  even though  SAF APIS supports SaTimeT (SaInt64T) type 
(263-1).
+                  So as work around currently if SAF API receives the higher 
value then  uint32_t (232-1) that it can hold , form now
+                  implicitly set  to max MDS supported value (4294967295 * 
10000000) ,  which is already very large  impractical value.
+
+                  In  Future solution : `[ticket:#1658] mds : Opensf transport 
should adopt the size of the
+                  timeout parameter from 32 bits to 64 bits`  will resolve the 
issue by matching both MDS transport and SAF API's
+                */             
+               TRACE_4("saImmOmAdminOperationInvoke: timeout > MDS_MAX_TIMEOUT 
setting to MDS max timeout value:%llu,immHandle:%llx",
+                               (SA_TIME_ONE_MILLISECOND * 
MDS_MAX_TIMEOUT_MILLISECOND) , immHandle);
+                timeout = (SA_TIME_ONE_MILLISECOND * 
MDS_MAX_TIMEOUT_MILLISECOND);
+        }
+        
+
        if (cb->sv_id == 0) {
                TRACE_2("ERR_BAD_HANDLE: No initialized handle exists!");
                return SA_AIS_ERR_BAD_HANDLE;
@@ -3781,10 +3801,6 @@ static SaAisErrorT admin_op_invoke_commo
           timeout */
        timeout = m_IMMSV_CONVERT_SATIME_TEN_MILLI_SEC(timeout);
 
-       if (timeout < NCS_SAF_MIN_ACCEPT_TIME) {
-               timeout = IMMSV_WAIT_TIME;
-       }
-
        if((rc = imma_proc_increment_pending_reply(cl_node, true)) != 
SA_AIS_OK) {
                TRACE_4("ERR_LIBRARY: Overlapping use of IMM handle by multiple 
threads");
                goto bad_sync;
diff --git a/osaf/libs/core/include/mds_papi.h 
b/osaf/libs/core/include/mds_papi.h
--- a/osaf/libs/core/include/mds_papi.h
+++ b/osaf/libs/core/include/mds_papi.h
@@ -199,6 +199,9 @@ extern "C" {
 
 #define MDS_MAX_PROCESS_NAME_LEN (255 + 32) /* Process Name + PID No/Slot 
info/Tipc reference */
 
+       /*MDS takes  timeout in 10 ms value for sync send() timeout */
+#define MDS_MAX_TIMEOUT_MILLISECOND 42949672950 /*((2^32 -1 * 10) */
+
 /**************************************************************************
  * SVC_NAME  of Service : A well known name that a service 
  ***************************************************************************/

------------------------------------------------------------------------------
Site24x7 APM Insight: Get Deep Visibility into Application Performance
APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
Monitor end-to-end web transactions and take corrective actions now
Troubleshoot faster and improve end-user experience. Signup Now!
http://pubads.g.doubleclick.net/gampad/clk?id=272487151&iu=/4140
_______________________________________________
Opensaf-devel mailing list
Opensaf-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/opensaf-devel

Reply via email to