Skip to content

Fix entry addition logic for keyless match tables#1339

Open
Shivampal157 wants to merge 1 commit intop4lang:mainfrom
Shivampal157:main
Open

Fix entry addition logic for keyless match tables#1339
Shivampal157 wants to merge 1 commit intop4lang:mainfrom
Shivampal157:main

Conversation

@Shivampal157
Copy link
Copy Markdown

Summary

Fixes entry addition logic for keyless match tables.

Previously, adding an entry to a table with no match key (get_size_key() == 0)
would always fail with NO_TABLE_KEY, even when the provided match_key was empty.

What changed

  • NO_TABLE_KEY is now returned only when:
    • the table has no match key, and
    • a non-empty match_key is provided
  • Keyless tables with a single default action can successfully add entries again.

Files changed

  • src/bm_sim/match_units.cpp

Motivation

This restores correct behavior for keyless tables such as get_lb_key,
which rely on a default action without match keys.

Signed-off-by: Shivampal157 <shivampal60076@gmail.com>
@jafingerhut
Copy link
Copy Markdown
Contributor

I do not understand why you believe it should be possible to add an entry to a P4 table with no key fields.

If you never add an entry to such a table, it should always get a miss on any table_name.apply() call, and execute the table's default_action. This is what happens today, yes?

Said another way: suppose it was possible to add an entry to such a keyless table. Should future calls to table_name.apply() then get a hit, instead of a miss? Why?

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