Commit 2ad18f40 authored by Claes Sjofors's avatar Claes Sjofors

qcom embryo to open/close link

parent bbac8458
...@@ -2091,6 +2091,32 @@ action_thread () ...@@ -2091,6 +2091,32 @@ action_thread ()
send_action( lp, get.type.s); send_action( lp, get.type.s);
break; break;
case qmon_eMsgTypeAction_Connect: {
sLink *lp;
sEseg *sp;
pwr_tNodeId nid;
nid = *(pwr_tNodeId *)msg;
lp = get_link(nid, NULL);
if ( !lp)
break;
lp->np->link[lp->lix].birth = time_Clock(NULL, NULL);
sp = create_connect(lp);
que_Put(NULL, &lp->q_in, &sp->c.le, sp);
break;
}
case qmon_eMsgTypeAction_Disconnect: {
sLink *lp;
pwr_tNodeId nid;
nid = *(pwr_tNodeId *)msg;
lp = get_link(nid, NULL);
if ( !lp)
break;
link_disconnect(lp);
break;
}
default: ; default: ;
} }
break; break;
...@@ -2122,6 +2148,8 @@ send_action ( ...@@ -2122,6 +2148,8 @@ send_action (
timelog( 1, "qmon send NodePassive"); timelog( 1, "qmon send NodePassive");
sp->head.flags.b.event = eEvent_redcomPassive; sp->head.flags.b.event = eEvent_redcomPassive;
break; break;
default:
return 0;
} }
sp->lp = lp; sp->lp = lp;
sp->c.action = eAction_export; sp->c.action = eAction_export;
......
...@@ -43,7 +43,9 @@ ...@@ -43,7 +43,9 @@
typedef enum { typedef enum {
qmon_eMsgTypeAction_NodeActive, qmon_eMsgTypeAction_NodeActive,
qmon_eMsgTypeAction_NodePassive qmon_eMsgTypeAction_NodePassive,
qmon_eMsgTypeAction_Connect,
qmon_eMsgTypeAction_Disconnect
} qmon_eMsgTypeAction; } qmon_eMsgTypeAction;
#endif #endif
\ No newline at end of file
...@@ -42,6 +42,7 @@ ...@@ -42,6 +42,7 @@
#include "rt_errh.h" #include "rt_errh.h"
#include "rt_qcom.h" #include "rt_qcom.h"
#include "rt_qdb.h" #include "rt_qdb.h"
#include "rt_qmon.h"
#include "rt_qcom_msg.h" #include "rt_qcom_msg.h"
#include "rt_qdb_msg.h" #include "rt_qdb_msg.h"
...@@ -1329,6 +1330,51 @@ qcom_SetRedundancyState ( ...@@ -1329,6 +1330,51 @@ qcom_SetRedundancyState (
qdb->my_node->redundancy_state = state; qdb->my_node->redundancy_state = state;
} }
/**
* Send a connect action message to rt_qmon
*/
void
qcom_LinkConnect(
pwr_tNodeId nid
)
{
pwr_tStatus sts;
qcom_sPut put;
qcom_sQid qmon_qid = {qcom_cImonAction, 0};
memset( &put, 0, sizeof(put));
put.type.b = (qcom_eBtype) qmon_cMsgClassAction;
put.type.s = (qcom_eStype) qmon_eMsgTypeAction_Connect;
put.size = sizeof(pwr_tNodeId);
put.data = qcom_Alloc( &sts, put.size);
*(pwr_tNodeId *)put.data = nid;
put.allocate = 0;
qcom_Put( &sts, &qmon_qid, &put);
}
/**
* Send a disconnect action message to rt_qmon
*/
void
qcom_LinkDisconnect(
pwr_tNodeId nid
)
{
pwr_tStatus sts;
qcom_sPut put;
qcom_sQid qmon_qid = {qcom_cImonAction, 0};
memset( &put, 0, sizeof(put));
put.type.b = (qcom_eBtype) qmon_cMsgClassAction;
put.type.s = (qcom_eStype) qmon_eMsgTypeAction_Disconnect;
put.size = sizeof(pwr_tNodeId);
put.data = qcom_Alloc( &sts, put.size);
*(pwr_tNodeId *)put.data = nid;
put.allocate = 0;
qcom_Put( &sts, &qmon_qid, &put);
}
/* /*
......
...@@ -450,6 +450,15 @@ qcom_SetRedundancyState ( ...@@ -450,6 +450,15 @@ qcom_SetRedundancyState (
pwr_eRedundancyState state pwr_eRedundancyState state
); );
void
qcom_LinkConnect(
pwr_tNodeId nid
);
void
qcom_LinkDisconnect(
pwr_tNodeId nid
);
bool_t bool_t
...@@ -468,4 +477,4 @@ xdr_qcom_sQid(XDR *xdrs, qcom_sQid *objp); ...@@ -468,4 +477,4 @@ xdr_qcom_sQid(XDR *xdrs, qcom_sQid *objp);
#endif #endif
/** @} */ /** @} */
/** @} */ /** @} */
\ No newline at end of file
...@@ -138,6 +138,8 @@ static int exit_func( menu_ctx ctx, ...@@ -138,6 +138,8 @@ static int exit_func( menu_ctx ctx,
int *flag); int *flag);
static int classhier_func( menu_ctx ctx, static int classhier_func( menu_ctx ctx,
int *flag); int *flag);
static int qcom_func( menu_ctx ctx,
int *flag);
static int rtt_login_func( menu_ctx ctx, static int rtt_login_func( menu_ctx ctx,
int *flag); int *flag);
static int rtt_show_object_add( static int rtt_show_object_add(
...@@ -4463,6 +4465,104 @@ static int classhier_func( menu_ctx ctx, ...@@ -4463,6 +4465,104 @@ static int classhier_func( menu_ctx ctx,
return sts; return sts;
} }
/*************************************************************************
*
* Name: qcom_func()
*
* Type int
*
* Type Parameter IOGF Description
* menu_ctx ctx I rtt context.
*
* Description:
* Connect and disconnect qcom.
*
**************************************************************************/
static int qcom_func( menu_ctx ctx,
int *flag)
{
int sts;
char arg1_str[80];
int arg1_sts;
arg1_sts = rtt_get_qualifier( "rtt_arg1", arg1_str);
if ( cdh_NoCaseStrncmp( arg1_str, "CONNECT", strlen( arg1_str)) == 0) {
/* Command is "QCOM CONNECT" */
char node_str[80];
qcom_sNode node;
pwr_tNid nid;
int found;
/* Check authorization */
if ( !(rtt_priv & RTT_PRIV_SYS) ) {
rtt_message('E',"Not authorized for this operation");
return RTT__NOPICTURE;
}
if ( EVEN( rtt_get_qualifier( "/NODE", node_str))) {
rtt_message('E',"Enter node");
return RTT__HOLDCOMMAND;
}
found = 0;
for (nid = qcom_cNNid; qcom_NextNode(&sts, &node, nid); nid = node.nid) {
if ( cdh_NoCaseStrcmp( node_str, node.name) == 0) {
found = 1;
break;
}
}
if ( !found) {
rtt_message('E',"Unknown node");
return RTT__NOPICTURE;
}
qcom_LinkConnect( node.nid);
}
else if ( cdh_NoCaseStrncmp( arg1_str, "DISCONNECT", strlen( arg1_str)) == 0) {
/* Command is "QCOM CONNECT" */
char node_str[80];
qcom_sNode node;
pwr_tNid nid;
int found;
/* Check authorization */
if ( !(rtt_priv & RTT_PRIV_SYS) ) {
rtt_message('E',"Not authorized for this operation");
return RTT__NOPICTURE;
}
if ( EVEN( rtt_get_qualifier( "/NODE", node_str))) {
rtt_message('E',"Enter node");
return RTT__HOLDCOMMAND;
}
found = 0;
for (nid = qcom_cNNid; qcom_NextNode(&sts, &node, nid); nid = node.nid) {
if ( cdh_NoCaseStrcmp( node_str, node.name) == 0) {
found = 1;
break;
}
}
if ( !found) {
rtt_message('E',"Unknown node");
return RTT__NOPICTURE;
}
qcom_LinkDisconnect( node.nid);
}
else {
rtt_message('E', "Syntax error");
return RTT__HOLDCOMMAND;
}
return RTT__SUCCESS;
}
/************************************************************************* /*************************************************************************
* *
* Name: rtt_login_func() * Name: rtt_login_func()
...@@ -4689,6 +4789,11 @@ rtt_t_comtbl rtt_command_table[] = { ...@@ -4689,6 +4789,11 @@ rtt_t_comtbl rtt_command_table[] = {
&classhier_func, &classhier_func,
{ ""} { ""}
}, },
{
"QCOM",
&qcom_func,
{ "rtt_arg1", "/NODE", ""}
},
{ {
"CREATE", "CREATE",
&rtt_create_func, &rtt_create_func,
...@@ -11188,4 +11293,4 @@ static int rtt_qual_to_time( char *in_str, ...@@ -11188,4 +11293,4 @@ static int rtt_qual_to_time( char *in_str,
if (EVEN(sts)) return sts; if (EVEN(sts)) return sts;
} }
return RTT__SUCCESS; return RTT__SUCCESS;
} }
\ No newline at end of file
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment