Skip to content

Conversation

@Hoooao
Copy link
Contributor

@Hoooao Hoooao commented Oct 5, 2025

This PR is derived from #1316 .
The testcases will be in another PR.

Main updates after #1316 :

  1. Added command-line option --enable-pkt-fanout to configure, which defines PKT_FANOUT_ON. Is not supported in cmake for now.
  2. Raise an exception when selector_fanout mode is used while the above option is not given.
  3. Set the grp_selector for all specified selectors during switch start_and_return_, less intrusive.
  4. Previously, replicated pkts are pushed to ingress/egress-buffers in the ingress/egree_thread after the original packet gets processed. Now the logic is colocated with packet replication, which is much cleaner.

@Hoooao Hoooao force-pushed the main branch 2 times, most recently from 040e724 to 9ee035b Compare October 5, 2025 19:58
Hoooao added 4 commits October 6, 2025 19:03
Signed-off-by: Hoooao <[email protected]>
Signed-off-by: Hoooao <[email protected]>
Signed-off-by: Hoooao <[email protected]>
Signed-off-by: Hoooao <[email protected]>
@jafingerhut
Copy link
Contributor

@jonathan-dilorenzo FYI it would be good for someone in Google who wants this feature to learn enough about the code base to give it a good review. Unless you employ someone who knows this feature and how it works, or can contract with someone who does, any bugs discovered in it later are unlikely to be fixed by someone who is not interested in the feature.

Copy link
Contributor

@matthewtlam matthewtlam left a comment

Choose a reason for hiding this comment

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

Leaving behind first set of comments. Will add more later today

])
])

# TODO: add this to cmake build as well
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we still need this comment? I think you already added it to cmake build

fanout_ctx_map.emplace(thread_id, FanoutCtx(buffer_push_fn));
}

// TODO(Hao): deduplicate packets fanout, optional
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we still need this comment?

std::unordered_map<grp_hdl_t, std::vector<mbr_hdl_t>> groups;
};

class FanoutPktMgr {
Copy link
Contributor

Choose a reason for hiding this comment

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

Let's add some documentation regarding the FanoutPktMgr. For example how it is used and use cases

bm::Logger::get()->error("[{}] [cxt {}] " s, (pkt).get_unique_id(), \
(pkt).get_context(), ##__VA_ARGS__)

#define BMLOG_WARN(...) bm::Logger::get()->warn(__VA_ARGS__)
Copy link
Contributor

Choose a reason for hiding this comment

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

Don't see this MACRO being used anywhere so we can remove? Correct me if I am incorrect

packet->get_checksum_error() ? 1 : 0);
}
// Check if the packet has an optional continue node for pkt fanout
// TODO(Hao): update the doc/simple_switch.md
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we still need this TODO?

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.

3 participants