Add aaa-12 add options reply

RCA:
SOL:
修改人:zhangtao
检视人:zhangtao
This commit is contained in:
zhangtaohz 2019-06-14 17:55:53 +08:00
parent 651bc0bc85
commit 5624defecf
3 changed files with 18 additions and 5 deletions

View File

@ -3,6 +3,11 @@
#include "trace_def.h" #include "trace_def.h"
typedef enum {
REPLY_OP_NO_NEED = 0x0,
REPLY_OP_NEED
} reply_op_t;
enum { enum {
TRACE_MSG_POLICY_REQ = 0x0, TRACE_MSG_POLICY_REQ = 0x0,
TRACE_MSG_POLICY_REPLY TRACE_MSG_POLICY_REPLY
@ -11,6 +16,7 @@ enum {
typedef struct _trace_hdr { typedef struct _trace_hdr {
u32 ver; u32 ver;
u32 seq; u32 seq;
reply_op_t is_reply;
} trace_hdr_t; } trace_hdr_t;
typedef struct _trace_req { typedef struct _trace_req {

View File

@ -49,6 +49,10 @@ static int trace_rcv_policy(struct sk_buff *skb, struct nlmsghdr *nlh)
return 1; return 1;
} }
if (hdr->is_reply == REPLY_OP_NO_NEED) {
return 0;
}
reply_skb = nlmsg_new(TRACE_REPLY_SZ, GFP_KERNEL); reply_skb = nlmsg_new(TRACE_REPLY_SZ, GFP_KERNEL);
if (reply_skb == NULL) { if (reply_skb == NULL) {
printk(KERN_ERR"Allocating skb memory is failure"); printk(KERN_ERR"Allocating skb memory is failure");

View File

@ -146,7 +146,7 @@ static void *cb_thread(void *arg)
} }
static trace_ret_t cfg_channel_send(const uint32_t seq, const trace_policy_t *policy) static trace_ret_t cfg_channel_send(const uint32_t seq, const trace_policy_t *policy, const reply_op_t is_reply)
{ {
char buf[TRACE_POLICY_BUF_SZ + 10]; char buf[TRACE_POLICY_BUF_SZ + 10];
struct nlmsghdr *hdr = (struct nlmsghdr *)buf; struct nlmsghdr *hdr = (struct nlmsghdr *)buf;
@ -306,6 +306,7 @@ static trace_ret_t __policy_async_exec(const trace_policy_t *in,
void *tmp_arg; void *tmp_arg;
struct sysinfo info; struct sysinfo info;
uint32_t seq, i; uint32_t seq, i;
reply_op_t is_reply = REPLY_OP_NO_NEED;
seq = __sync_add_and_fetch(&g_sessionid, 1); seq = __sync_add_and_fetch(&g_sessionid, 1);
SYSLOG_DEBUG("The seq of the message is %u", seq); SYSLOG_DEBUG("The seq of the message is %u", seq);
@ -335,9 +336,11 @@ static trace_ret_t __policy_async_exec(const trace_policy_t *in,
SYSLOG_ERR("cbarg which is been added is failure"); SYSLOG_ERR("cbarg which is been added is failure");
goto END; goto END;
} }
is_reply = REPLY_OP_NEED;
} }
ret = cfg_channel_send(seq, in); ret = cfg_channel_send(seq, in, is_reply);
if (ret != TRACE_SUCCESS) { if (ret != TRACE_SUCCESS) {
SYSLOG_ERR("Sending cfg is failure"); SYSLOG_ERR("Sending cfg is failure");
goto END; goto END;