Thread (67 messages) 67 messages, 9 authors, 2021-04-21

Re: [dpdk-dev] [PATCH v2 4/6] net/pcap: add libpcap wrappers

From: Dmitry Kozlyuk <hidden>
Date: 2021-03-01 23:06:05

2021-03-01 21:43, Nick Connolly:
quoted
Complete removal of non-standard dependencies in headers is within a grasp.
Then we can remove shims and include whatever needed.
Thoughts?
Sounds good. A couple of 'gotchas' that I've come across (but may not be 
an issue for DPDK):

  * Memory allocation / free that spans a dll boundary (see earlier email).
Not sure which email you mean, could you give a link?
  * posix_memalign is unfortunately specified as using free(), so we'll
    either have to modify the calls to rte_posix_memalign /
    rte_free_memalign (which means code analysis to find which free
    calls need changing), or wrapper free() to distinguish the two types
    of memory somehow. I 'solved' this for SPDK by using posix_memalign
    for everything and I have a vague recollection that the mingw libc
    does something similar.
Is posix_memalign() used more extensively in SPDK? In DPDK, it's 2 PMDs:
  * mlx5 PMD uses _aligned_malloc/_aligned_free on Windows;
  * dpaax (PMD family) uses posix_memalign() to allocate pages.
There are "malloc" and "alloc_size" attributes that can help code analysis.
  * Sockets are unfortunately specified as using close(). This is
    probably easy to address by rte_ wrapping all socket calls.
Which public DPDK APIs operate on sockets?
I don't like the idea of wrapping APIs like sockets or files.
(Yes, we're discussing libpcap API wrappers in this thread, but we already
agreed they are a mistake and they were internal in the first place.)

I drafted what I was talking about: adding address types and removing shims:

* librte_net/rte_ip.h then includes <netinet/ip.h> or <ws2tcpip.h>
  conditionally for AF_xxx, IPPROTO_xxx, and a few other constants.
  That's probably OK, there are similar places for Linux/FreeBSD differences,
  e.g. in <rte_endian.h>.

* Some IPPROTO_xxx constants are missing on Windows, so rte_ip.h has to
  provide them. I hope Mirosoft will add them to system headers one day.

* It affects cmdline (mostly), ethdev, security, crypto/dpaax.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help