Re: [PATCH v2 2/5] tools: hv: Add vmbus_bufring

From: Greg KH
Date: Wed Jun 14 2023 - 17:16:13 EST


On Wed, Jun 14, 2023 at 11:15:09AM -0700, Saurabh Sengar wrote:
> Common userspace interface for read/write from VMBus ringbuffer.
> This implementation is open for use by any userspace driver or
> application seeking direct control over VMBus ring buffers.
> A significant part of this code is borrowed from DPDK.

" "?

Anyway, this does not explain what this is at all.

And if you "borrowed" it from DPDK, that feels odd, are you sure you are
allowed to do so?

> Link: https://github.com/DPDK/dpdk/

Not what a Link: tag is for, sorry.

>
> Signed-off-by: Saurabh Sengar <ssengar@xxxxxxxxxxxxxxxxxxx>
> ---
> [V2]
> - simpler sysfs path, less parsing
>
> tools/hv/vmbus_bufring.c | 322 +++++++++++++++++++++++++++++++++++++++
> tools/hv/vmbus_bufring.h | 158 +++++++++++++++++++
> 2 files changed, 480 insertions(+)
> create mode 100644 tools/hv/vmbus_bufring.c
> create mode 100644 tools/hv/vmbus_bufring.h

You add new files to the tools directory, yet say nothing about how to
use them or even how to build them.

Why is there a .h file for a single .c file? That seems pointless,
right?

> diff --git a/tools/hv/vmbus_bufring.c b/tools/hv/vmbus_bufring.c
> new file mode 100644
> index 000000000000..d44a06d45b03
> --- /dev/null
> +++ b/tools/hv/vmbus_bufring.c
> @@ -0,0 +1,322 @@
> +// SPDX-License-Identifier: BSD-3-Clause
> +/*
> + * Copyright (c) 2009-2012,2016,2023 Microsoft Corp.
> + * Copyright (c) 2012 NetApp Inc.
> + * Copyright (c) 2012 Citrix Inc.
> + * All rights reserved.

No copyright for the work you did?

> + */
> +
> +#include <errno.h>
> +#include <fcntl.h>
> +#include <emmintrin.h>
> +#include <linux/limits.h>
> +#include <stdbool.h>
> +#include <stdint.h>
> +#include <stdio.h>
> +#include <string.h>
> +#include <sys/mman.h>
> +#include <sys/uio.h>
> +#include <unistd.h>
> +#include "vmbus_bufring.h"
> +
> +#define rte_compiler_barrier() ({ asm volatile ("" : : : "memory"); })
> +
> +#define rte_smp_rwmb() ({ asm volatile ("" : : : "memory"); })

These aren't in any common header file already?

thanks,

greg k-h