ionic_adminq_post - Post an admin command. * @lif: Handle to lif. * @cmd_ctx: Api admin command context. * * Post the command to an admin queue in the ethernet driver. If this command * succeeds, then the command has been posted, but that does not indicate a * completion. If this command returns success, then the completion callback * will eventually be called.
| 192 | * Return: zero or negative error status. |
| 193 | */ |
| 194 | static int |
| 195 | ionic_adminq_post(struct ionic_lif *lif, struct ionic_admin_ctx *ctx) |
| 196 | { |
| 197 | struct ionic_queue *q = &lif->adminqcq->qcq.q; |
| 198 | struct ionic_admin_cmd *q_desc_base = q->base; |
| 199 | struct ionic_admin_cmd *q_desc; |
| 200 | void **info; |
| 201 | int err = 0; |
| 202 | |
| 203 | rte_spinlock_lock(&lif->adminq_lock); |
| 204 | |
| 205 | if (ionic_q_space_avail(q) < 1) { |
| 206 | err = -ENOSPC; |
| 207 | goto err_out; |
| 208 | } |
| 209 | |
| 210 | q_desc = &q_desc_base[q->head_idx]; |
| 211 | |
| 212 | memcpy(q_desc, &ctx->cmd, sizeof(ctx->cmd)); |
| 213 | |
| 214 | info = IONIC_INFO_PTR(q, q->head_idx); |
| 215 | info[0] = ctx; |
| 216 | |
| 217 | q->head_idx = Q_NEXT_TO_POST(q, 1); |
| 218 | |
| 219 | /* Ring doorbell */ |
| 220 | rte_wmb(); |
| 221 | ionic_q_flush(q); |
| 222 | |
| 223 | err_out: |
| 224 | rte_spinlock_unlock(&lif->adminq_lock); |
| 225 | |
| 226 | return err; |
| 227 | } |
| 228 | |
| 229 | static int |
| 230 | ionic_adminq_wait_for_completion(struct ionic_lif *lif, |
no test coverage detected