-
Notifications
You must be signed in to change notification settings - Fork 16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[ovsp4rt] Implement GetTxAccVsiPort() #737
Conversation
Document that summarizes apparent encoding issues in ovsp4rt. Signed-off-by: Derek Foster <[email protected]>
- Encode and validate IPv6 addresses as arrays of uint16_t. This allows us to provide better feedback in case of a mismatch. - Make a couple of minor changes to encode_addr_test. Signed-off-by: Derek Foster <[email protected]>
Signed-off-by: Derek Foster <[email protected]>
Signed-off-by: Derek Foster <[email protected]>
- Enabled CMAKE_EXPORT_COMPILE_COMMANDS. This option instructs CMake to generate a `compile_commands.json` file in the build directory, for use by other tools (such as `clang-tidy`) - Expanded CMAKE_INSTALL_PREFIX to an absolute path, which is what happens when you set `CMAKE_INSTALL_PREFIX` on the CMake command line. Signed-off-by: Derek Foster <[email protected]>
Signed-off-by: Derek Foster <[email protected]>
- Moved the set_property() for the STRINGS property on P4OVS_MODE after its definition. This fixes a CMake configuration error that cropped up in the Tofino build. Signed-off-by: Derek Foster <[email protected]>
Bumps [actions/setup-go](https://github.com/actions/setup-go) from 5.0.2 to 5.1.0. - [Release notes](https://github.com/actions/setup-go/releases) - [Commits](actions/setup-go@v5.0.2...v5.1.0) --- updated-dependencies: - dependency-name: actions/setup-go dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Signed-off-by: Derek Foster <[email protected]>
- Implemented an `install-path-presets` preset that defines DEPEND_INSTALL_DIR and SDE_INSTALL_DIR from the DEPEND_INSTALL and SDE_INSTALL environment variables. Signed-off-by: Derek Foster <[email protected]>
- Added sample cmake pre-load scripts and a user presets file, and updated the buildsystem to install them in the `share` directory tree. - Added /dpdk.cmake and /es2k.cmake to .gitignore. Signed-off-by: Derek Foster <[email protected]>
- Sanitized a couple of file paths. - Changed "pre-load" to "preload". The CMake documentation uses the hyphenated form, but I find it distracting. Signed-off-by: Derek Foster <[email protected]>
- Removed the experimental p4cpconfig script. It has been superseded by cmake presets. Signed-off-by: Derek Foster <[email protected]>
Signed-off-by: Derek Foster <[email protected]>
Signed-off-by: Derek Foster <[email protected]>
- Marked the BUILD_JOURNAL and BUILD_SPIES variables as advanced. They are internal options, used to enable features that are still under development, and should normally be hidden. Signed-off-by: Derek Foster <[email protected]>
Signed-off-by: Derek Foster <[email protected]>
- This is an internal variable intended for use by developers. Signed-off-by: Derek Foster <[email protected]>
- Added logic to generate an uninstall script and defined a target to run the script. Signed-off-by: Derek Foster <[email protected]>
- Created an experimental CMakePresets.json file. - Defined property strings for the P4OVS_MODE variable. Signed-off-by: Derek Foster <[email protected]>
- Updated the stratum and krnlmon submodule references. Signed-off-by: Derek Foster <[email protected]>
- Implemented the `Client` `ClientInterface`, and `ClientMock` classes, to abstract the interface to the P4Runtime server. Signed-off-by: Derek Foster <[email protected]>
- Renamed the Journal "schema" element to "version". - Added `const` qualifier to a couple of parameters. Signed-off-by: Derek Foster <[email protected]>
Bumps [actions/setup-go](https://github.com/actions/setup-go) from 5.1.0 to 5.2.0. - [Release notes](https://github.com/actions/setup-go/releases) - [Commits](actions/setup-go@v5.1.0...v5.2.0) --- updated-dependencies: - dependency-name: actions/setup-go dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
The purpose of the `Client` class is to replace the discrete logic that interacts with the P4Runtime server with an object that implements an abstract interface. - `ClientInterface` is an abstract class that defines the interface. - `Client` is an implementation of `ClientInterface` that replaces the current discrete logic. - `ClientMock` is a mock implementation of `ClientInterface`. For this to work, we need to hide the session object from the user. Signed-off-by: Derek Foster <[email protected]>
- Modified CMakeLists.txt files to fix compile and link errors when building with BUILD_CLIENT enabled. Signed-off-by: Derek Foster <[email protected]>
- Changed `ubuntu-latest` to `ubuntu-22.04` in the workflows, in preparation for GitHub bumping ubuntu-latest to 24.04. Signed-off-by: Derek Foster <[email protected]>
* [ovsp4rt] Implement journaling api and client - Created JournalClient, a subclass of Client that is instrumented to record interactions between OVS and the P4Runtime server. Signed-off-by: Derek Foster <[email protected]> * [ovsp4rt] Rough in new Journal methods - Added methods to the Journal class to record P4Runtime server requests and responses. Signed-off-by: Derek Foster <[email protected]> --------- Signed-off-by: Derek Foster <[email protected]>
- Moved the C API wrapper functions to a separate source file. This makes it possible to substitute a different implementation of the API, for testing. Extracted from PR #674. Works with an updated version of ovsp4rt.cc that has not been committed. Currently excluded from the build. Signed-off-by: Derek Foster <[email protected]>
- Created a variant of the public API that uses JournalClient objects. Extracted from PR #674. Works with several files that have not yet been committed, or that are being committed separately. Currently excluded from the build. Signed-off-by: Derek Foster <[email protected]>
* Update to stratum-deps v1.3.4 * Update stratum submodule to v3.3.0.0 Signed-off-by: Derek Foster <[email protected]>
Signed-off-by: Derek Foster <[email protected]>
Signed-off-by: Derek Foster <[email protected]>
Signed-off-by: Derek Foster <[email protected]>
- Corrected ES2K to DPDK in the DPDK version of the file. Signed-off-by: Derek Foster <[email protected]>
Signed-off-by: Derek Foster <[email protected]>
- Updated cmake listfile to use `newovsp4rt.cc` instead of `ovsp4rt.cc` when the BUILD_CLIENT option is enabled. - Modified newovsp4rt.cc to use a `Client` object instead of an `OvsP4rtSession` object to communicate with the P4Runtime server. - Made each public C API function a wrapper around a C++ function that accepts a `Client` object as a parameter. This allows a test to replace the object with a test double (e.g. a mock). - Moved the C API functions to another file (`ovsp4rt_standard_api.cc`), separating the user interface from the implementation. - Created a second implementation of the C API (`ovsp4rt_journal_api.cc`) that enables journaling. - Added an `ovsp4rt_build_and_test` job to the pipeline, to verify that ovsp4rt builds when BUILD_CLIENT and BUILD_JOURNAL are enabled. Signed-off-by: Derek Foster <[email protected]>
- Moved ovsp4rt_str_to_tunnel_type() to a separate source file for C api functions that are not wrappers. Signed-off-by: Derek Foster <[email protected]>
- Renamed the functions in the internal C++ API from ConfigEntry to DoConfigEntry, to keep them from being confused with ConfigTableEntry functions. The conventions are: - A PrepareTableEntry function populates the fields of a TableEntry. - A ConfigTableEntry function initializes a WriteRequest, prepares the TableEntry, and sends the request to the P4Runtime server. - A GetTableEntry function initializes a ReadRequest, prepares the TableEntry, sends the request to the P4Runtime server, and returns the response. - A DoConfigEntry function implements the core logic of an ovsp4rt_table_entry C API. It may make one or more ConfigTableEntry or GetTableEntry calls. Signed-off-by: Derek Foster <[email protected]>
- Modified the functions in the internal C++ API to return `absl::Status`, allowing a test program to verify whether the function encountered an error. - Updated the C API wrappers to ignore the returned Status explicitly. The public APIs currently have a `void` return type. These changes only apply when BUILD_CLIENT is enabled. Signed-off-by: Derek Foster <[email protected]>
20c0c7b
to
7914257
Compare
- Extracted the GetTxiAccVsiHostSrcPort() function from ConfigFdbEntry() and ConfigSrcPortEntry(). This change is ES2K-specific. Signed-off-by: Derek Foster <[email protected]>
7914257
to
c0f7685
Compare
Signed-off-by: Derek Foster <[email protected]>
Here is ChatGPT's assessment of the first refactoring: Let's compare the original and refactored code and identify key differences to determine if they are functionally equivalent: Key Changes:
Functional Equivalence:
Conclusion:The original and refactored code are functionally equivalent. The refactoring only reorganizes the code to improve clarity and modularity, without altering the core behavior. |
Its conclusions on the second refactoring were as follows: Functional Equivalence:
Conclusion:The refactored code is functionally equivalent to the original code. The change primarily improves the structure of the function by extracting the logic for obtaining and processing the |
} | ||
// TODO(derek): This break exits to the outermost for loop, | ||
// advancing to the next table entry. Is this correct? | ||
// Would `return host_sp` be better? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we replace break
with return host_sp
, we can (1) define and initialize host_sp
within the if
statement, and (2) change line 2153 to return 0
.
I also propose to rename the loop index from param_bytes
to i
. The long name is misleading and adds unnecessary complexity.
ConfigFdbEntry()
andConfigSrcPortEntry()
to a newGetTxAccVsiPort()
function. This reduces the complexity of the calling functions, which don't need to know how the port is obtained, and it removes duplicate code.See later comments in the PR for AI analysis of this refactoring.
This PR is ES2K-specific.
GetTxiAccVsiPort
is only called by ES2K functions.Note
The purpose of this PR is to refactor. I propose to make the mutability changes noted in the comments in a second PR, and any other changes in subsequent PRs.