|
RTE OSAdapter POSIX 0.1.0 build 41b3eb3
POSIX/Linux OAL OSAdapter for Platform_RTE
|
Private helper: applies the socket buffer sizes of a link config (OSA rules R5, R6). More...
#include "rte/oal/netlink/rte_netlink.h"#include "rte/utils/status/rte_status.h"Go to the source code of this file.
Functions | |
| rte_status_t | posix_socket_apply_buffers (int fd, const rte_netlink_config_t *config) |
| Sets and confirms config->rcvbuf_bytes (SO_RCVBUF) and config->sndbuf_bytes (SO_SNDBUF) on a socket. | |
Private helper: applies the socket buffer sizes of a link config (OSA rules R5, R6).
One implementation of Platform_RTE REQ-OAL-NETLINK-015 shared by the netlink OSAdapter (at open) and the channel service OSAdapter (at every socket (re)init). Not installed: an internal header of this product, like rte_posix_osadapter_poll.h.
Definition in file rte_posix_osadapter_sockbuf.h.
| rte_status_t posix_socket_apply_buffers | ( | int | fd, |
| const rte_netlink_config_t * | config ) |
Sets and confirms config->rcvbuf_bytes (SO_RCVBUF) and config->sndbuf_bytes (SO_SNDBUF) on a socket.
A field of 0 keeps the OS default: no setsockopt() and no getsockopt() call for it, so a config with both fields 0 makes no system call at all. For each non-zero field: setsockopt(SOL_SOCKET) with the value capped at INT_MAX (setsockopt takes an int), return code checked, then getsockopt() of the same option, return code and length checked. The read-back is compared with what the kernel reports for an accepted request: twice the value on Linux (the kernel doubles it for bookkeeping and caps the request at net.core.rmem_max / wmem_max without an error), the value itself on other hosts. A read-back below that is reported once per call (DEGRADED / RTE_SAFESTATE_REASON_OSA_RT_ATTRIBUTE, "socket buffer size capped") and the socket is kept. SO_RCVBUF is applied before SO_SNDBUF; the first failure ends the call. The caller owns the socket and closes it on a failure.
| fd | Open socket descriptor. |
| config | Link configuration; only rcvbuf_bytes and sndbuf_bytes are read. Must not be NULL. |
Global functions
Definition at line 75 of file rte_posix_osadapter_sockbuf.c.