Skip to content

Add TCP_QUICKACK socket option support#3

Draft
ryehuda-dn wants to merge 1 commit intofpopescu/rst_cont_readfrom
ryehuda/support_tcp_quickack
Draft

Add TCP_QUICKACK socket option support#3
ryehuda-dn wants to merge 1 commit intofpopescu/rst_cont_readfrom
ryehuda/support_tcp_quickack

Conversation

@ryehuda-dn
Copy link
Copy Markdown

Implements NN_TCP_QUICKACK option to allow users to request immediate ACK transmission after receiving data, matching standard Linux socket behavior.

This support is added to solve the TCP delays in nanoconnection mentions in SW-217254 (Delayed ACKs causing 40ms delay for link down)

TCP_QUICKACK is a Linux-specific, one-shot option that forces the kernel to send an acknowledgment immediately instead of using delayed ACKs. The kernel automatically resets this flag after each receive operation, so users must call nn_setsockopt() after each nn_recv() to trigger it.

Implementation details:

  • Added NN_TCP_QUICKACK constant to tcp.h (value: 2)
  • Extended nn_ep_ops with setopt function pointer for dynamic option application on active connections
  • Implemented two-level iteration:
    • sock.c iterates through all endpoints on a socket
    • btcp.c iterates through all accepted connections (atcp) within a bind endpoint
    • ctcp.c applies directly to its single outgoing connection
  • Direct setsockopt() on active sockets (bypassing nn_usock_setsockopt which only works on STARTING/ACCEPTED state)
  • Added symbol registration for introspection
  • Added test case in tests/tcp.c
  • Documented in nn_tcp.adoc

Usage:
nn_recv(socket, buf, len, 0); int opt = 1; nn_setsockopt(socket, NN_TCP, NN_TCP_QUICKACK, &opt, sizeof(opt));

Implements NN_TCP_QUICKACK option to allow users to request immediate
ACK transmission after receiving data, matching standard Linux socket
behavior.

This support is added to solve the TCP delays in nanoconnection
mentions in SW-217254 (Delayed ACKs causing 40ms delay for link down)

TCP_QUICKACK is a Linux-specific, one-shot option that forces the kernel
to send an acknowledgment immediately instead of using delayed ACKs. The
kernel automatically resets this flag after each receive operation, so
users must call nn_setsockopt() after each nn_recv() to trigger it.

Implementation details:
- Added NN_TCP_QUICKACK constant to tcp.h (value: 2)
- Extended nn_ep_ops with setopt function pointer for dynamic option
  application on active connections
- Implemented two-level iteration:
  * sock.c iterates through all endpoints on a socket
  * btcp.c iterates through all accepted connections (atcp) within a
    bind endpoint
  * ctcp.c applies directly to its single outgoing connection
- Direct setsockopt() on active sockets (bypassing nn_usock_setsockopt
  which only works on STARTING/ACCEPTED state)
- Added symbol registration for introspection
- Added test case in tests/tcp.c
- Documented in nn_tcp.adoc

Usage:
  nn_recv(socket, buf, len, 0);
  int opt = 1;
  nn_setsockopt(socket, NN_TCP, NN_TCP_QUICKACK, &opt, sizeof(opt));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant