Skip to content

Control input cleanup - #676

Open
rjarry wants to merge 12 commits into
DPDK:mainfrom
rjarry:control-input-cleanup
Open

Control input cleanup#676
rjarry wants to merge 12 commits into
DPDK:mainfrom
rjarry:control-input-cleanup

Conversation

@rjarry

@rjarry rjarry commented Aug 3, 2026

Copy link
Copy Markdown
Collaborator

Depends on #672

Summary

  • Added per-interface mbuf pools and control-plane file descriptors and events to struct iface.
  • Reworked loopback and TAP paths to use interface-owned pools and resources.
  • Replaced control-input type IDs and allocation flags with direct rte_edge_t registration and (edge, mbuf) queue entries.
  • Added typed send helpers for Ethernet, interface, IPv4, IPv6, ARP, and loopback output.
  • Updated DHCP, LACP, ICMP, ICMPv6, ARP, router advertisement, and NDP paths to allocate mbufs from the interface pool and store request context in mbuf metadata.
  • Removed shared control-input and per-module mempools, heap-allocated control messages, obsolete output handlers, and related module dependencies.

@rjarry
rjarry force-pushed the control-input-cleanup branch from acae4a7 to 85d28ac Compare August 3, 2026 10:41
@coderabbitai

This comment was marked as resolved.

@rjarry
rjarry marked this pull request as draft August 3, 2026 10:56
@rjarry
rjarry force-pushed the control-input-cleanup branch from 85d28ac to 9fdbc53 Compare August 3, 2026 12:57
@rjarry
rjarry marked this pull request as ready for review August 3, 2026 15:35
@rjarry
rjarry force-pushed the control-input-cleanup branch from 9fdbc53 to a1d485e Compare August 4, 2026 09:37

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@modules/infra/control/loopback.c`:
- Around line 268-281: Initialize ioctl_sock and iface->cp_fd to -1 before
descriptor creation in the surrounding setup flow, then update the cleanup
checks in the err path to close each descriptor when its value is >= 0. Preserve
the existing resource-release order and avoid reading uninitialized descriptor
values when socket() or open() fails.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 713283b0-c686-4130-82f4-fcf5c77437b4

📥 Commits

Reviewing files that changed from the base of the PR and between 1f98b66 and a1d485e.

📒 Files selected for processing (32)
  • modules/dhcp/control/client.c
  • modules/dhcp/control/dhcp.h
  • modules/dhcp/control/packet.c
  • modules/infra/control/ctlplane.c
  • modules/infra/control/iface.h
  • modules/infra/control/iface_test.c
  • modules/infra/control/loopback.c
  • modules/infra/control/loopback.h
  • modules/infra/control/vrf.c
  • modules/infra/control/vrf.h
  • modules/infra/datapath/control_input.c
  • modules/infra/datapath/control_input.h
  • modules/infra/datapath/eth.h
  • modules/infra/datapath/eth_output.c
  • modules/infra/datapath/iface_output.c
  • modules/infra/datapath/lacp_output.c
  • modules/infra/datapath/loop_input.c
  • modules/infra/datapath/loop_output.c
  • modules/infra/datapath/rxtx.h
  • modules/ip/control/nexthop.c
  • modules/ip/datapath/arp_output_reply.c
  • modules/ip/datapath/arp_output_request.c
  • modules/ip/datapath/icmp_local_send.c
  • modules/ip/datapath/ip4_datapath.h
  • modules/ip/datapath/ip_output.c
  • modules/ip6/control/nexthop.c
  • modules/ip6/control/router_advert.c
  • modules/ip6/datapath/icmp6_local_send.c
  • modules/ip6/datapath/ip6_datapath.h
  • modules/ip6/datapath/ip6_output.c
  • modules/ip6/datapath/ndp_na_output.c
  • modules/ip6/datapath/ndp_ns_output.c
💤 Files with no reviewable changes (2)
  • modules/infra/control/vrf.h
  • modules/dhcp/control/dhcp.h

Comment thread modules/infra/control/loopback.c
rjarry added 12 commits August 4, 2026 12:30
Loopback interfaces store their TUN fd and libevent handle in
iface_info_loopback, while ctlplane interfaces use iface->cp_fd
and iface->cp_ev for the same purpose. Unify both by using the
fields already on struct iface, which makes iface_info_loopback
empty and removes it.

Signed-off-by: Robin Jarry <rjarry@redhat.com>
Instead of two static mempools in ctlplane and loopback, allocate
a per-interface mempool and store it in the generic iface structure. Use
the mempool to fetch mbufs for packets received from control plane
representor and loopback interfaces.

Signed-off-by: Robin Jarry <rjarry@redhat.com>
Use iface->pool instead of the module-global dhcp_mp pool.
Remove dhcp_get_mempool() since DHCP packet building already
has the iface available.

Signed-off-by: Robin Jarry <rjarry@redhat.com>
Allocate the mbuf in lacp_send_pdu and write the PDU directly
into the packet data. The LACP PDU is too large to fit in mbuf
private data so it goes into the packet buffer itself. The
downstream graph node reads it with rte_pktmbuf_mtod. This
removes the malloc/free of the intermediate lacp_output_data
struct.

Signed-off-by: Robin Jarry <rjarry@redhat.com>
Allocate the mbuf in icmp_local_send and store request
parameters in icmp_send_mbuf_data instead of a calloc'd
ctl_to_stack struct. The downstream graph node reads from mbuf
private data instead of control_input_mbuf_data.

Signed-off-by: Robin Jarry <rjarry@redhat.com>
Same approach as the IPv4 ICMP change. Replace the calloc'd
ctl_to_stack struct with icmp6_send_mbuf_data in mbuf private
data. The iface_id field is replaced by the inherited iface
pointer in the private data base struct.

Signed-off-by: Robin Jarry <rjarry@redhat.com>
Allocate the mbuf in arp_output_request_solicit from iface->pool
and store the nexthop pointer in l3_mbuf_data instead of passing
a raw pointer through the control_input ring.

Signed-off-by: Robin Jarry <rjarry@redhat.com>
Use iface->pool instead of ra_ctx.mp. The ra_ctx struct is now
empty, remove it.

Signed-off-by: Robin Jarry <rjarry@redhat.com>
Same approach as ARP. Allocate the mbuf in nh6_solicit and store
the nexthop pointer in l3_mbuf_data.

Signed-off-by: Robin Jarry <rjarry@redhat.com>
Allocate the mbuf in nh6_advertise from iface->pool and store
context in ndp_na_mbuf_data instead of a malloc'd
advertise_context struct.

Signed-off-by: Robin Jarry <rjarry@redhat.com>
All callers now pre-allocate mbufs before calling post_to_stack.
Remove the data_is_mbuf flag, the control_input_mbuf_data
private data type, and the per-node mempool. The control_input
node always treats the enqueued data as an mbuf.

Signed-off-by: Robin Jarry <rjarry@redhat.com>
Each datapath node that can receive mbufs from the control plane
now registers its own edge and exposes a *_send() function.
Callers use these typed helpers instead of holding a static
edge variable and calling post_to_stack directly. This removes
the ip_nexthop and ip6_nexthop modules which only existed to
register control_input edges at init time.

Signed-off-by: Robin Jarry <rjarry@redhat.com>
@rjarry
rjarry force-pushed the control-input-cleanup branch from a1d485e to 3507674 Compare August 4, 2026 10:30
@rjarry
rjarry requested a review from aharivel August 5, 2026 10:56
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