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

Function cpfl_receive_ctlq_msg

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

Source from the content-addressed store, hash-verified

61}
62
63int
64cpfl_receive_ctlq_msg(struct idpf_hw *hw, struct idpf_ctlq_info *cq, u16 num_q_msg,
65 struct idpf_ctlq_msg q_msg[])
66{
67 int retries = 0;
68 struct idpf_dma_mem *dma;
69 u16 i;
70 uint16_t buff_cnt;
71 int ret = 0;
72
73 retries = 0;
74 while (retries <= CTLQ_RECEIVE_RETRIES) {
75 rte_delay_us_sleep(10);
76 ret = cpfl_vport_ctlq_recv(cq, &num_q_msg, &q_msg[0]);
77
78 if (ret && ret != CPFL_ERR_CTLQ_NO_WORK && ret != CPFL_ERR_CTLQ_ERROR &&
79 ret != CPFL_ERR_CTLQ_EMPTY) {
80 PMD_INIT_LOG(ERR, "failed to recv ctrlq msg. err: 0x%4x", ret);
81 retries++;
82 continue;
83 }
84
85 if (ret == CPFL_ERR_CTLQ_NO_WORK) {
86 retries++;
87 continue;
88 }
89
90 if (ret == CPFL_ERR_CTLQ_EMPTY)
91 break;
92
93 /* TODO - process rx controlq message */
94 for (i = 0; i < num_q_msg; i++) {
95 ret = q_msg[i].status;
96 if (ret != CPFL_CFG_PKT_ERR_OK &&
97 q_msg[i].opcode != cpfl_ctlq_sem_query_del_rule_hash_addr) {
98 PMD_INIT_LOG(ERR, "Failed to process rx_ctrlq msg: %s",
99 cpfl_cfg_pkt_errormsg[ret]);
100 return ret;
101 }
102
103 if (q_msg[i].data_len > 0)
104 dma = q_msg[i].ctx.indirect.payload;
105 else
106 dma = NULL;
107
108 buff_cnt = dma ? 1 : 0;
109 ret = cpfl_vport_ctlq_post_rx_buffs(hw, cq, &buff_cnt, &dma);
110 if (ret)
111 PMD_INIT_LOG(WARNING, "could not posted recv bufs");
112 }
113 break;
114 }
115
116 if (retries > CTLQ_RECEIVE_RETRIES) {
117 PMD_INIT_LOG(ERR, "timed out while polling for receive response");
118 ret = -1;
119 }
120

Callers 1

cpfl_rule_processFunction · 0.85

Calls 3

cpfl_vport_ctlq_recvFunction · 0.85
rte_delay_us_sleepFunction · 0.50

Tested by

no test coverage detected