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

Function idpf_ctlq_add

dpdk/drivers/common/idpf/base/idpf_controlq.c:135–209  ·  view source on GitHub ↗

* idpf_ctlq_add - add one control queue * @hw: pointer to hardware struct * @qinfo: info for queue to be created * @cq_out: (output) double pointer to control queue to be created * * Allocate and initialize a control queue and add it to the control queue list. * The cq parameter will be allocated/initialized and passed back to the caller * if no errors occur. * * Note: idpf_ctlq_init must

Source from the content-addressed store, hash-verified

133 * Note: idpf_ctlq_init must be called prior to any calls to idpf_ctlq_add
134 */
135int idpf_ctlq_add(struct idpf_hw *hw,
136 struct idpf_ctlq_create_info *qinfo,
137 struct idpf_ctlq_info **cq_out)
138{
139 struct idpf_ctlq_info *cq;
140 bool is_rxq = false;
141 int status = 0;
142
143 if (!qinfo->len || !qinfo->buf_size ||
144 qinfo->len > IDPF_CTLQ_MAX_RING_SIZE ||
145 qinfo->buf_size > IDPF_CTLQ_MAX_BUF_LEN)
146 return -EINVAL;
147
148 cq = (struct idpf_ctlq_info *)
149 idpf_calloc(hw, 1, sizeof(struct idpf_ctlq_info));
150 if (!cq)
151 return -ENOMEM;
152
153 cq->cq_type = qinfo->type;
154 cq->q_id = qinfo->id;
155 cq->buf_size = qinfo->buf_size;
156 cq->ring_size = qinfo->len;
157
158 cq->next_to_use = 0;
159 cq->next_to_clean = 0;
160 cq->next_to_post = cq->ring_size - 1;
161
162 switch (qinfo->type) {
163 case IDPF_CTLQ_TYPE_MAILBOX_RX:
164 is_rxq = true;
165 /* fallthrough */
166 case IDPF_CTLQ_TYPE_MAILBOX_TX:
167 status = idpf_ctlq_alloc_ring_res(hw, cq);
168 break;
169 default:
170 status = -EINVAL;
171 break;
172 }
173
174 if (status)
175 goto init_free_q;
176
177 if (is_rxq) {
178 idpf_ctlq_init_rxq_bufs(cq);
179 } else {
180 /* Allocate the array of msg pointers for TX queues */
181 cq->bi.tx_msg = (struct idpf_ctlq_msg **)
182 idpf_calloc(hw, qinfo->len,
183 sizeof(struct idpf_ctlq_msg *));
184 if (!cq->bi.tx_msg) {
185 status = -ENOMEM;
186 goto init_dealloc_q_mem;
187 }
188 }
189
190 idpf_ctlq_setup_regs(cq, qinfo);
191
192 idpf_ctlq_init_regs(hw, cq, is_rxq);

Callers 1

idpf_ctlq_initFunction · 0.85

Calls 5

idpf_ctlq_alloc_ring_resFunction · 0.85
idpf_ctlq_init_rxq_bufsFunction · 0.85
idpf_ctlq_setup_regsFunction · 0.85
idpf_ctlq_init_regsFunction · 0.85

Tested by

no test coverage detected