diff --git a/kernel/mars_client.c b/kernel/mars_client.c index 12ccbeb9..c59afacb 100644 --- a/kernel/mars_client.c +++ b/kernel/mars_client.c @@ -566,6 +566,8 @@ int receiver_thread(void *data) } switch (cmd.cmd_code & CMD_FLAG_MASK) { + case CMD_NOP: + break; case CMD_NOTIFY: mars_trigger(); break; diff --git a/kernel/mars_net.c b/kernel/mars_net.c index 66a6a561..da180926 100644 --- a/kernel/mars_net.c +++ b/kernel/mars_net.c @@ -1181,6 +1181,7 @@ EXPORT_SYMBOL_GPL(_mars_recv_struct); const struct meta mars_cmd_meta[] = { META_INI_SUB(cmd_stamp, struct mars_cmd, mars_lamport_time_meta), + META_INI(cmd_proto, struct mars_cmd, FIELD_INT), META_INI(cmd_code, struct mars_cmd, FIELD_INT), META_INI(cmd_int1, struct mars_cmd, FIELD_INT), META_INI(cmd_str1, struct mars_cmd, FIELD_STRING), @@ -1191,6 +1192,7 @@ int mars_send_cmd(struct mars_socket *msock, struct mars_cmd *cmd, bool cork) { int status; + cmd->cmd_proto = MARS_PROTO_LEVEL; status = desc_send_struct(msock, cmd, mars_cmd_meta, cork); return status; } @@ -1200,6 +1202,8 @@ int _mars_recv_cmd(struct mars_socket *msock, struct mars_cmd *cmd, int line) int status; status = desc_recv_struct(msock, cmd, mars_cmd_meta, line); + if (status >= 0) + msock->s_remote_proto_level = cmd->cmd_proto; return status; } diff --git a/kernel/mars_net.h b/kernel/mars_net.h index 23bec4a9..994e7d1c 100644 --- a/kernel/mars_net.h +++ b/kernel/mars_net.h @@ -33,6 +33,8 @@ extern int mars_net_default_port; extern bool mars_net_is_alive; +#define MARS_PROTO_LEVEL 1 + #define MAX_FIELD_LEN 32 #define MAX_DESC_CACHE 16 @@ -63,6 +65,7 @@ struct mars_socket { struct socket *s_socket; void *s_buffer; atomic_t s_count; + int s_remote_proto_level; /* corresponds to MARS_PROTO_LEVEL of remote site */ int s_pos; int s_debug_nr; int s_send_abort; @@ -110,6 +113,7 @@ enum { struct mars_cmd { struct lamport_time cmd_stamp; // for automatic lamport clock + int cmd_proto; int cmd_code; int cmd_int1; //int cmd_int2;