| 55 | } |
| 56 | |
| 57 | static int |
| 58 | memif_msg_send_from_queue(struct memif_control_channel *cc) |
| 59 | { |
| 60 | ssize_t size; |
| 61 | int ret = 0; |
| 62 | struct memif_msg_queue_elt *e; |
| 63 | |
| 64 | e = TAILQ_FIRST(&cc->msg_queue); |
| 65 | if (e == NULL) |
| 66 | return 0; |
| 67 | |
| 68 | if (rte_intr_fd_get(cc->intr_handle) < 0) |
| 69 | return -1; |
| 70 | |
| 71 | size = memif_msg_send(rte_intr_fd_get(cc->intr_handle), &e->msg, |
| 72 | e->fd); |
| 73 | if (size != sizeof(memif_msg_t)) { |
| 74 | MIF_LOG(ERR, "sendmsg fail: %s.", strerror(errno)); |
| 75 | ret = -1; |
| 76 | } else { |
| 77 | MIF_LOG(DEBUG, "Sent msg type %u.", e->msg.type); |
| 78 | } |
| 79 | TAILQ_REMOVE(&cc->msg_queue, e, next); |
| 80 | rte_free(e); |
| 81 | |
| 82 | return ret; |
| 83 | } |
| 84 | |
| 85 | static struct memif_msg_queue_elt * |
| 86 | memif_msg_enq(struct memif_control_channel *cc) |
no test coverage detected