[dpdk-dev] [PATCH v2 4/6] net/pcap: add libpcap wrappers
Nick Connolly
nick.connolly at mayadata.io
Tue Mar 2 12:22:43 CET 2021
> Is posix_memalign() used more extensively in SPDK? In DPDK, it's 2 PMDs:
Yes, there are about 80 references. A lot are in ISA-L where they are
#defined to _aligned_malloc and can be ignored, but there still several
in the rest of the code.
>> * 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.
I'm not sure about use in public APIs - I'd hope none do. I was thinking
about 'internal' use. The tricky issue here is that on Linux/FreeBSD
socket() returns a small integer file descriptor whereas Windows returns
a SOCKET type (which is a UINT_PTR and so larger than the 'int' that an
fd occupies). In practice it looks as though SOCKET usually returns a
small integer, but as far as I can see from the documentation it depends
on the software stack that is in use. Even if it's a small integer, I
don't think it has any correlation to the file descriptor table in the
crt, which means that calls to read/write/close will all need to be
handled so that they work.
> (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.
Sounds good - well done!
Regards,
Nick
More information about the dev
mailing list