lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <676dc97d7c311_1d346b29456@willemb.c.googlers.com.notmuch>
Date: Thu, 26 Dec 2024 16:24:13 -0500
From: Willem de Bruijn <willemdebruijn.kernel@...il.com>
To: Mina Almasry <almasrymina@...gle.com>, 
 netdev@...r.kernel.org, 
 linux-kernel@...r.kernel.org, 
 linux-doc@...r.kernel.org, 
 virtualization@...ts.linux.dev, 
 kvm@...r.kernel.org, 
 linux-kselftest@...r.kernel.org
Cc: Mina Almasry <almasrymina@...gle.com>, 
 "David S. Miller" <davem@...emloft.net>, 
 Eric Dumazet <edumazet@...gle.com>, 
 Jakub Kicinski <kuba@...nel.org>, 
 Paolo Abeni <pabeni@...hat.com>, 
 Simon Horman <horms@...nel.org>, 
 Donald Hunter <donald.hunter@...il.com>, 
 Jonathan Corbet <corbet@....net>, 
 Andrew Lunn <andrew+netdev@...n.ch>, 
 David Ahern <dsahern@...nel.org>, 
 "Michael S. Tsirkin" <mst@...hat.com>, 
 Jason Wang <jasowang@...hat.com>, 
 Xuan Zhuo <xuanzhuo@...ux.alibaba.com>, 
 Eugenio PĂ©rez <eperezma@...hat.com>, 
 Stefan Hajnoczi <stefanha@...hat.com>, 
 Stefano Garzarella <sgarzare@...hat.com>, 
 Shuah Khan <shuah@...nel.org>, 
 Kaiyuan Zhang <kaiyuanz@...gle.com>, 
 Pavel Begunkov <asml.silence@...il.com>, 
 Willem de Bruijn <willemb@...gle.com>, 
 Samiullah Khawaja <skhawaja@...gle.com>, 
 Stanislav Fomichev <sdf@...ichev.me>, 
 Joe Damato <jdamato@...tly.com>, 
 dw@...idwei.uk
Subject: Re: [PATCH RFC net-next v1 2/5] selftests: ncdevmem: Implement devmem
 TCP TX

Mina Almasry wrote:
> Add support for devmem TX in ncdevmem.
> 
> This is a combination of the ncdevmem from the devmem TCP series RFCv1
> which included the TX path, and work by Stan to include the netlink API
> and refactored on top of his generic memory_provider support.
> 
> Signed-off-by: Mina Almasry <almasrymina@...gle.com>
> Signed-off-by: Stanislav Fomichev <sdf@...ichev.me>
> ---
>  .../selftests/drivers/net/hw/ncdevmem.c       | 261 +++++++++++++++++-
>  1 file changed, 259 insertions(+), 2 deletions(-)
> 

> +static unsigned long gettimeofday_ms(void)
> +{
> +	struct timeval tv;
> +
> +	gettimeofday(&tv, NULL);
> +	return (tv.tv_sec * 1000) + (tv.tv_usec / 1000);
> +}

Consider uint64_t and 1000ULL to avoid overflow on 32-bit platforms in
2034 (currently at 1.7^10^9 usec since start of epoch).

Or use clock_gettime CLOCK_MONOTONIC.

> +
> +static int do_poll(int fd)
> +{
> +	struct pollfd pfd;
> +	int ret;
> +
> +	pfd.events = POLLERR;
> +	pfd.revents = 0;

Not important but since demonstrator code:
no need to set POLLERR on events. Errors cannot be masked.

> +	pfd.fd = fd;
> +
> +	ret = poll(&pfd, 1, waittime_ms);
> +	if (ret == -1)
> +		error(1, errno, "poll");
> +
> +	return ret && (pfd.revents & POLLERR);
> +}

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ