| 398 | } |
| 399 | |
| 400 | static uint16_t |
| 401 | eth_vhost_rx(void *q, struct rte_mbuf **bufs, uint16_t nb_bufs) |
| 402 | { |
| 403 | struct vhost_queue *r = q; |
| 404 | uint16_t i, nb_rx = 0; |
| 405 | uint16_t nb_receive = nb_bufs; |
| 406 | |
| 407 | if (unlikely(rte_atomic32_read(&r->allow_queuing) == 0)) |
| 408 | return 0; |
| 409 | |
| 410 | rte_atomic32_set(&r->while_queuing, 1); |
| 411 | |
| 412 | if (unlikely(rte_atomic32_read(&r->allow_queuing) == 0)) |
| 413 | goto out; |
| 414 | |
| 415 | /* Dequeue packets from guest TX queue */ |
| 416 | while (nb_receive) { |
| 417 | uint16_t nb_pkts; |
| 418 | uint16_t num = (uint16_t)RTE_MIN(nb_receive, |
| 419 | VHOST_MAX_PKT_BURST); |
| 420 | |
| 421 | nb_pkts = rte_vhost_dequeue_burst(r->vid, r->virtqueue_id, |
| 422 | r->mb_pool, &bufs[nb_rx], |
| 423 | num); |
| 424 | |
| 425 | nb_rx += nb_pkts; |
| 426 | nb_receive -= nb_pkts; |
| 427 | if (nb_pkts < num) |
| 428 | break; |
| 429 | } |
| 430 | |
| 431 | r->stats.pkts += nb_rx; |
| 432 | |
| 433 | for (i = 0; likely(i < nb_rx); i++) { |
| 434 | bufs[i]->port = r->port; |
| 435 | bufs[i]->vlan_tci = 0; |
| 436 | |
| 437 | if (r->internal->vlan_strip) |
| 438 | rte_vlan_strip(bufs[i]); |
| 439 | |
| 440 | if (r->internal->rx_sw_csum) |
| 441 | vhost_dev_rx_sw_csum(bufs[i]); |
| 442 | |
| 443 | r->stats.bytes += bufs[i]->pkt_len; |
| 444 | } |
| 445 | |
| 446 | out: |
| 447 | rte_atomic32_set(&r->while_queuing, 0); |
| 448 | |
| 449 | return nb_rx; |
| 450 | } |
| 451 | |
| 452 | static uint16_t |
| 453 | eth_vhost_tx(void *q, struct rte_mbuf **bufs, uint16_t nb_bufs) |
nothing calls this directly
no test coverage detected