X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;f=src%2Fvnet%2Fdevices%2Fvirtio%2Fvhost_user_inline.h;h=e4a1d5960404a9233979bffd219342a25aba44fc;hb=e5d34919b;hp=9f6135165aed0c99037336217ee4d35a8fea8a10;hpb=e7cde313e1df14ea118386d678c3e47219090a0d;p=vpp.git diff --git a/src/vnet/devices/virtio/vhost_user_inline.h b/src/vnet/devices/virtio/vhost_user_inline.h index 9f6135165ae..e4a1d596040 100644 --- a/src/vnet/devices/virtio/vhost_user_inline.h +++ b/src/vnet/devices/virtio/vhost_user_inline.h @@ -15,6 +15,7 @@ #ifndef __VIRTIO_VHOST_USER_INLINE_H__ #define __VIRTIO_VHOST_USER_INLINE_H__ /* vhost-user inline functions */ +#include static_always_inline void * map_guest_mem (vhost_user_intf_t * vui, uword addr, u32 * hint) @@ -134,7 +135,19 @@ vhost_map_guest_mem_done: } } #endif - DBG_VQ ("failed to map guest mem addr %llx", addr); + /* *INDENT-OFF* */ + ELOG_TYPE_DECLARE (el) = + { + .format = "failed to map guest mem addr %lx", + .format_args = "i8", + }; + /* *INDENT-ON* */ + struct + { + uword addr; + } *ed; + ed = ELOG_DATA (&vlib_global_main.elog_main, el); + ed->addr = addr; *hint = 0; return 0; } @@ -173,7 +186,7 @@ vhost_user_log_dirty_pages_2 (vhost_user_intf_t * vui, } if (PREDICT_FALSE ((addr + len - 1) / VHOST_LOG_PAGE / 8 >= vui->log_size)) { - DBG_SOCK ("vhost_user_log_dirty_pages(): out of range\n"); + vu_log_debug (vui, "vhost_user_log_dirty_pages(): out of range\n"); return; } @@ -201,13 +214,17 @@ format_vhost_trace (u8 * s, va_list * va) CLIB_UNUSED (vnet_main_t * vnm) = vnet_get_main (); vhost_user_main_t *vum = &vhost_user_main; vhost_trace_t *t = va_arg (*va, vhost_trace_t *); - vhost_user_intf_t *vui = pool_elt_at_index (vum->vhost_user_interfaces, - t->device_index); - - vnet_sw_interface_t *sw = vnet_get_sw_interface (vnm, vui->sw_if_index); - - u32 indent = format_get_indent (s); + vhost_user_intf_t *vui = vum->vhost_user_interfaces + t->device_index; + vnet_sw_interface_t *sw; + u32 indent; + if (pool_is_free (vum->vhost_user_interfaces, vui)) + { + s = format (s, "vhost-user interface is deleted"); + return s; + } + sw = vnet_get_sw_interface (vnm, vui->sw_if_index); + indent = format_get_indent (s); s = format (s, "%U %U queue %d\n", format_white_space, indent, format_vnet_sw_interface_name, vnm, sw, t->qid); @@ -251,6 +268,30 @@ vhost_user_send_call (vlib_main_t * vm, vhost_user_vring_t * vq) vq->int_deadline = vlib_time_now (vm) + vum->coalesce_time; } +static_always_inline u8 +vui_is_link_up (vhost_user_intf_t * vui) +{ + return vui->admin_up && vui->is_ready; +} + +static_always_inline void +vhost_user_update_gso_interface_count (vhost_user_intf_t * vui, u8 add) +{ + vhost_user_main_t *vum = &vhost_user_main; + + if (vui->enable_gso) + { + if (add) + { + vum->gso_count++; + } + else + { + ASSERT (vum->gso_count > 0); + vum->gso_count--; + } + } +} #endif /*