| 434 | } |
| 435 | |
| 436 | static enum rte_vhost_msg_result |
| 437 | vhost_crypto_msg_post_handler(int vid, void *msg) |
| 438 | { |
| 439 | struct virtio_net *dev = get_device(vid); |
| 440 | struct vhost_crypto *vcrypto; |
| 441 | struct vhu_msg_context *ctx = msg; |
| 442 | enum rte_vhost_msg_result ret = RTE_VHOST_MSG_RESULT_OK; |
| 443 | |
| 444 | if (dev == NULL) { |
| 445 | VC_LOG_ERR("Invalid vid %i", vid); |
| 446 | return RTE_VHOST_MSG_RESULT_ERR; |
| 447 | } |
| 448 | |
| 449 | vcrypto = dev->extern_data; |
| 450 | if (vcrypto == NULL) { |
| 451 | VC_LOG_ERR("Cannot find required data, is it initialized?"); |
| 452 | return RTE_VHOST_MSG_RESULT_ERR; |
| 453 | } |
| 454 | |
| 455 | switch (ctx->msg.request.frontend) { |
| 456 | case VHOST_USER_CRYPTO_CREATE_SESS: |
| 457 | vhost_crypto_create_sess(vcrypto, |
| 458 | &ctx->msg.payload.crypto_session); |
| 459 | ctx->fd_num = 0; |
| 460 | ret = RTE_VHOST_MSG_RESULT_REPLY; |
| 461 | break; |
| 462 | case VHOST_USER_CRYPTO_CLOSE_SESS: |
| 463 | if (vhost_crypto_close_sess(vcrypto, ctx->msg.payload.u64)) |
| 464 | ret = RTE_VHOST_MSG_RESULT_ERR; |
| 465 | break; |
| 466 | default: |
| 467 | ret = RTE_VHOST_MSG_RESULT_NOT_HANDLED; |
| 468 | break; |
| 469 | } |
| 470 | |
| 471 | return ret; |
| 472 | } |
| 473 | |
| 474 | static __rte_always_inline struct vhost_crypto_desc * |
| 475 | find_write_desc(struct vhost_crypto_desc *head, struct vhost_crypto_desc *desc, |
nothing calls this directly
no test coverage detected