Skip to content

port_output: route packets for unplugged ports to a drop node#534

Merged
christophefontaine merged 1 commit intoDPDK:mainfrom
rjarry:port-output-invalid
Mar 10, 2026
Merged

port_output: route packets for unplugged ports to a drop node#534
christophefontaine merged 1 commit intoDPDK:mainfrom
rjarry:port-output-invalid

Conversation

@rjarry
Copy link
Collaborator

@rjarry rjarry commented Mar 5, 2026

During interface deletion, port_unplug_cb is called as a PRE_REMOVE event subscriber and rebuilds the datapath graph without the deleted port's TX edge. Other PRE_REMOVE subscribers (nexthop, route and address cleanup) may run after port_unplug_cb, leaving a window where in-flight packets still reference the deleted port via their iface pointer.

These packets eventually reach port_output and hit an invalid edge:

grout: port_output.c:33: port_output_process:
  Assertion `edge != RTE_EDGE_ID_INVALID' failed.

Thread 5 (control plane):
  worker_graph_reload  ../modules/infra/control/graph.c:264
  worker_graph_reload_all  ../modules/infra/control/graph.c:365
  port_unplug  ../modules/infra/control/worker.c:176
  iface_destroy  ../modules/infra/control/iface.c:609
Thread 1 (datapath worker):
  port_output_process  ../modules/infra/datapath/port_output.c:33

Register a port_output_invalid drop node and append it as the last edge of port_output. Initialize all port_output context edges to point to that drop edge by default, so that packets destined for an unplugged port are silently dropped instead of hitting an assertion.

Fixes: 587d5e4 ("rx,tx: use one node per port queue")

Summary by CodeRabbit

  • Bug Fixes

    • Added an explicit invalid-port drop path to avoid crashes and reduce packet loss in rare port-output edge cases.
    • Improved handling when a port output has no valid next-hop to prevent incorrect termination.
  • Infrastructure Improvements

    • Robustified edge initialization and mapping for more predictable datapath behavior and port routing.

@coderabbitai
Copy link

coderabbitai bot commented Mar 5, 2026

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 9273fa8f-ac56-43a6-8ca9-8924f995c318

📥 Commits

Reviewing files that changed from the base of the PR and between afcc804 and 5965d78.

📒 Files selected for processing (2)
  • modules/infra/control/graph.c
  • modules/infra/datapath/port_output.c

📝 Walkthrough

Walkthrough

The change adds a sentinel edge port_output_invalid used by datapath and control layers. The port_output node now has two next-hops (port_tx and port_output_invalid) and the prior assertion forbidding RTE_EDGE_ID_INVALID was removed. In the control layer, port edges are initialized to port_output_invalid (appended to transmit node names) and iteration/mapping logic was adjusted to treat this sentinel as the terminating/error edge.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

if (unlikely(edge == RTE_EDGE_ID_INVALID)) {
// Port may have been unplugged while in-flight packets
// still reference it (e.g. during interface deletion).
rte_pktmbuf_free(mbuf);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Shouldn't we send these packets to a drop node ?
As of now, the packets are silently dropped, without any stat.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The issue is that port_output has a 1:1 mapping to port_tx clones (one per txq). We cannot add other edges so we cannot send packets to a "drop" node.

This would be an ideal candidate for xstats.

@rjarry rjarry force-pushed the port-output-invalid branch 2 times, most recently from 3ab0d77 to 011d6b5 Compare March 9, 2026 10:46
@rjarry rjarry changed the title port_output: drop packets for unplugged ports port_output: route packets for unplugged ports to a drop node Mar 9, 2026
@rjarry rjarry force-pushed the port-output-invalid branch from 011d6b5 to afcc804 Compare March 9, 2026 12:33
During interface deletion, port_unplug_cb is called as a PRE_REMOVE
event subscriber and rebuilds the datapath graph without the deleted
port's TX edge. Other PRE_REMOVE subscribers (nexthop, route and address
cleanup) may run after port_unplug_cb, leaving a window where in-flight
packets still reference the deleted port via their iface pointer.

These packets eventually reach port_output and hit an invalid edge:

  grout: port_output.c:33: port_output_process:
    Assertion `edge != RTE_EDGE_ID_INVALID' failed.

  Thread 5 (control plane):
    worker_graph_reload  ../modules/infra/control/graph.c:264
    worker_graph_reload_all  ../modules/infra/control/graph.c:365
    port_unplug  ../modules/infra/control/worker.c:176
    iface_destroy  ../modules/infra/control/iface.c:609
  Thread 1 (datapath worker):
    port_output_process  ../modules/infra/datapath/port_output.c:33

Register a port_output_invalid drop node and append it as the last edge
of port_output. Initialize all port_output context edges to point to
that drop edge by default, so that packets destined for an unplugged
port are silently dropped instead of hitting an assertion.

Fixes: 587d5e4 ("rx,tx: use one node per port queue")
Signed-off-by: Robin Jarry <rjarry@redhat.com>
Reviewed-by: Christophe Fontaine <cfontain@redhat.com>
@grout-bot grout-bot force-pushed the port-output-invalid branch from afcc804 to 5965d78 Compare March 9, 2026 14:57
@christophefontaine christophefontaine merged commit 7395b80 into DPDK:main Mar 10, 2026
6 checks passed
@rjarry rjarry deleted the port-output-invalid branch March 10, 2026 13:57
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.

2 participants