|
RTE OSAdapter POSIX 0.1.0 build 41b3eb3
POSIX/Linux OAL OSAdapter for Platform_RTE
|
Socket buffer sizes of a link config (OSA rules R5, R6; Platform_RTE REQ-OAL-NETLINK-015), shared by the netlink OSAdapter (at open) and the channel service OSAdapter (at every socket (re)init). Semantics are documented on posix_socket_apply_buffers() in rte_posix_osadapter_sockbuf.h. More...
#include "rte_posix_osadapter_sockbuf.h"#include <limits.h>#include <stdbool.h>#include <stdint.h>#include <sys/socket.h>#include "rte_posix_osadapter_report.h"Go to the source code of this file.
Macros | |
| #define | _POSIX_C_SOURCE 200809L |
| #define | POSIX_SOCKBUF_READBACK_FACTOR 1 |
Functions | |
| static rte_status_t | apply_one (int fd, int option, uint32_t bytes, bool *capped) |
| 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. | |
Socket buffer sizes of a link config (OSA rules R5, R6; Platform_RTE REQ-OAL-NETLINK-015), shared by the netlink OSAdapter (at open) and the channel service OSAdapter (at every socket (re)init). Semantics are documented on posix_socket_apply_buffers() in rte_posix_osadapter_sockbuf.h.
Definition in file rte_posix_osadapter_sockbuf.c.
| #define _POSIX_C_SOURCE 200809L |
Definition at line 3 of file rte_posix_osadapter_sockbuf.c.
| #define POSIX_SOCKBUF_READBACK_FACTOR 1 |
Local makros Other hosts (macOS) report the size exactly as accepted.
Definition at line 26 of file rte_posix_osadapter_sockbuf.c.
|
static |
Local types declarations Local function declarations
Local variables declarations Global variables declarations Local functions Sets one SOL_SOCKET buffer option and reads it back. bytes == 0: no call, RTE_STATUS_OK. Sets *capped when the read-back is below what an accepted request reports; leaves it alone otherwise. Single exit.
Definition at line 42 of file rte_posix_osadapter_sockbuf.c.
| 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.
Global functions
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. |
Definition at line 75 of file rte_posix_osadapter_sockbuf.c.