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

Function vhost_check_queue_inflights_packed

dpdk/lib/vhost/vhost_user.c:1971–2065  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1969}
1970
1971static int
1972vhost_check_queue_inflights_packed(struct virtio_net *dev,
1973 struct vhost_virtqueue *vq)
1974{
1975 uint16_t i;
1976 uint16_t resubmit_num = 0, old_used_idx, num;
1977 struct rte_vhost_resubmit_info *resubmit;
1978 struct rte_vhost_inflight_info_packed *inflight_packed;
1979
1980 if (!(dev->protocol_features &
1981 (1ULL << VHOST_USER_PROTOCOL_F_INFLIGHT_SHMFD)))
1982 return RTE_VHOST_MSG_RESULT_OK;
1983
1984 /* The frontend may still not support the inflight feature
1985 * although we negotiate the protocol feature.
1986 */
1987 if ((!vq->inflight_packed))
1988 return RTE_VHOST_MSG_RESULT_OK;
1989
1990 if (!vq->inflight_packed->version) {
1991 vq->inflight_packed->version = INFLIGHT_VERSION;
1992 return RTE_VHOST_MSG_RESULT_OK;
1993 }
1994
1995 if (vq->resubmit_inflight)
1996 return RTE_VHOST_MSG_RESULT_OK;
1997
1998 inflight_packed = vq->inflight_packed;
1999 vq->global_counter = 0;
2000 old_used_idx = inflight_packed->old_used_idx;
2001
2002 if (inflight_packed->used_idx != old_used_idx) {
2003 if (inflight_packed->desc[old_used_idx].inflight == 0) {
2004 inflight_packed->old_used_idx =
2005 inflight_packed->used_idx;
2006 inflight_packed->old_used_wrap_counter =
2007 inflight_packed->used_wrap_counter;
2008 inflight_packed->old_free_head =
2009 inflight_packed->free_head;
2010 } else {
2011 inflight_packed->used_idx =
2012 inflight_packed->old_used_idx;
2013 inflight_packed->used_wrap_counter =
2014 inflight_packed->old_used_wrap_counter;
2015 inflight_packed->free_head =
2016 inflight_packed->old_free_head;
2017 }
2018 }
2019
2020 for (i = 0; i < inflight_packed->desc_num; i++) {
2021 if (inflight_packed->desc[i].inflight == 1)
2022 resubmit_num++;
2023 }
2024
2025 if (resubmit_num) {
2026 resubmit = rte_zmalloc_socket("resubmit", sizeof(struct rte_vhost_resubmit_info),
2027 0, vq->numa_node);
2028 if (resubmit == NULL) {

Callers 1

Calls 3

rte_zmalloc_socketFunction · 0.85
rte_freeFunction · 0.85
qsortFunction · 0.85

Tested by

no test coverage detected