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@google.com Signed-off-by: Stanislav Fomichev sdf@fomichev.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);
+}