[PATCH] vhost_net: Print feature masks in hex

Ilya Maximets posted 1 patch 2 years, 1 month ago
Test checkpatch passed
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20220318140440.596019-1-i.maximets@ovn.org
Maintainers: "Michael S. Tsirkin" <mst@redhat.com>, Jason Wang <jasowang@redhat.com>
hw/net/vhost_net.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
[PATCH] vhost_net: Print feature masks in hex
Posted by Ilya Maximets 2 years, 1 month ago
"0x200000000" is much more readable than "8589934592".
The change saves one step (conversion) while debugging.

Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
---
 hw/net/vhost_net.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/hw/net/vhost_net.c b/hw/net/vhost_net.c
index 30379d2ca4..df0f050548 100644
--- a/hw/net/vhost_net.c
+++ b/hw/net/vhost_net.c
@@ -201,7 +201,7 @@ struct vhost_net *vhost_net_init(VhostNetOptions *options)
             net->dev.features &= ~(1ULL << VIRTIO_NET_F_MRG_RXBUF);
         }
         if (~net->dev.features & net->dev.backend_features) {
-            fprintf(stderr, "vhost lacks feature mask %" PRIu64
+            fprintf(stderr, "vhost lacks feature mask 0x%" PRIx64
                    " for backend\n",
                    (uint64_t)(~net->dev.features & net->dev.backend_features));
             goto fail;
@@ -213,7 +213,7 @@ struct vhost_net *vhost_net_init(VhostNetOptions *options)
     if (net->nc->info->type == NET_CLIENT_DRIVER_VHOST_USER) {
         features = vhost_user_get_acked_features(net->nc);
         if (~net->dev.features & features) {
-            fprintf(stderr, "vhost lacks feature mask %" PRIu64
+            fprintf(stderr, "vhost lacks feature mask 0x%" PRIx64
                     " for backend\n",
                     (uint64_t)(~net->dev.features & features));
             goto fail;
-- 
2.34.1
Re: [PATCH] vhost_net: Print feature masks in hex
Posted by Philippe Mathieu-Daudé 2 years, 1 month ago
On 18/3/22 15:04, Ilya Maximets wrote:
> "0x200000000" is much more readable than "8589934592".
> The change saves one step (conversion) while debugging.
> 
> Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
> ---
>   hw/net/vhost_net.c | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/hw/net/vhost_net.c b/hw/net/vhost_net.c
> index 30379d2ca4..df0f050548 100644
> --- a/hw/net/vhost_net.c
> +++ b/hw/net/vhost_net.c
> @@ -201,7 +201,7 @@ struct vhost_net *vhost_net_init(VhostNetOptions *options)
>               net->dev.features &= ~(1ULL << VIRTIO_NET_F_MRG_RXBUF);
>           }
>           if (~net->dev.features & net->dev.backend_features) {
> -            fprintf(stderr, "vhost lacks feature mask %" PRIu64
> +            fprintf(stderr, "vhost lacks feature mask 0x%" PRIx64
>                      " for backend\n",
>                      (uint64_t)(~net->dev.features & net->dev.backend_features));
>               goto fail;
> @@ -213,7 +213,7 @@ struct vhost_net *vhost_net_init(VhostNetOptions *options)
>       if (net->nc->info->type == NET_CLIENT_DRIVER_VHOST_USER) {
>           features = vhost_user_get_acked_features(net->nc);
>           if (~net->dev.features & features) {
> -            fprintf(stderr, "vhost lacks feature mask %" PRIu64
> +            fprintf(stderr, "vhost lacks feature mask 0x%" PRIx64
>                       " for backend\n",
>                       (uint64_t)(~net->dev.features & features));
>               goto fail;

Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>