MCPcopy Create free account
hub / github.com/F-Stack/f-stack / cpfl_send_ctlq_msg

Function cpfl_send_ctlq_msg

dpdk/drivers/net/cpfl/cpfl_fxp_rule.c:12–61  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

10#define CTLQ_RECEIVE_RETRIES 100
11
12int
13cpfl_send_ctlq_msg(struct idpf_hw *hw, struct idpf_ctlq_info *cq, u16 num_q_msg,
14 struct idpf_ctlq_msg q_msg[])
15{
16 struct idpf_ctlq_msg **msg_ptr_list;
17 u16 clean_count = 0;
18 int num_cleaned = 0;
19 int retries = 0;
20 int ret = 0;
21
22 msg_ptr_list = calloc(num_q_msg, sizeof(struct idpf_ctlq_msg *));
23 if (!msg_ptr_list) {
24 PMD_INIT_LOG(ERR, "no memory for cleaning ctlq");
25 ret = -ENOMEM;
26 goto err;
27 }
28
29 ret = cpfl_vport_ctlq_send(hw, cq, num_q_msg, q_msg);
30 if (ret) {
31 PMD_INIT_LOG(ERR, "cpfl_vport_ctlq_send() failed with error: 0x%4x", ret);
32 goto send_err;
33 }
34
35 while (retries <= CTLQ_SEND_RETRIES) {
36 clean_count = num_q_msg - num_cleaned;
37 ret = cpfl_vport_ctlq_clean_sq(cq, &clean_count,
38 &msg_ptr_list[num_cleaned]);
39 if (ret) {
40 PMD_INIT_LOG(ERR, "clean ctlq failed: 0x%4x", ret);
41 goto send_err;
42 }
43
44 num_cleaned += clean_count;
45 retries++;
46 if (num_cleaned >= num_q_msg)
47 break;
48 rte_delay_us_sleep(10);
49 }
50
51 if (retries > CTLQ_SEND_RETRIES) {
52 PMD_INIT_LOG(ERR, "timed out while polling for completions");
53 ret = -1;
54 goto send_err;
55 }
56
57send_err:
58 free(msg_ptr_list);
59err:
60 return ret;
61}
62
63int
64cpfl_receive_ctlq_msg(struct idpf_hw *hw, struct idpf_ctlq_info *cq, u16 num_q_msg,

Callers 1

cpfl_rule_processFunction · 0.85

Calls 5

callocFunction · 0.85
cpfl_vport_ctlq_sendFunction · 0.85
cpfl_vport_ctlq_clean_sqFunction · 0.85
rte_delay_us_sleepFunction · 0.50
freeFunction · 0.50

Tested by

no test coverage detected