Skip to content

Commit

Permalink
Program nexthop table as a ternary match. (#59)
Browse files Browse the repository at this point in the history
The P4 program has been modified to move the NextHop table from
the SEM block (exact match) to the WCM block (ternary match). This
requires a corresponding change in the Kernel Monitor.

This is a breaking change. Newer versions of krnlmon are incompatible
with older versions of the P4 program.

Signed-off-by: Sandeep N <[email protected]>
Co-authored-by: Derek G Foster <[email protected]>
  • Loading branch information
n-sandeep and ffoulkes authored Oct 11, 2023
1 parent 74f9546 commit 47c61cc
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,8 @@
# ipdk-io/krnlmon
The Kernel Monitor receives RFC 3549 messages from the Linux Kernel over a Netlink socket when changes are made to the kernel networking data structures.

## Breaking changes

### 11 Oct 2023

- https://github.com/ipdk-io/krnlmon/pull/59: The NextHop table in the P4 program has been moved from the SEM block (exact match) to the WCM block (ternary block). The Kernel Monitor must use a different API to write the entry to the WCM block. krnlmon is no longer compatible with older versions of the P4 program.
13 changes: 13 additions & 0 deletions switchapi/es2k/switch_pd_routing.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@

#include "port_mgr/dpdk/bf_dpdk_port_if.h"

// Table match type definitions.
#define NEXTHOP_TABLE_TERNARY_MATCH 1

switch_status_t switch_routing_table_entry (
switch_device_t device,
const switch_pd_routing_info_t *api_routing_info,
Expand Down Expand Up @@ -180,10 +183,20 @@ switch_status_t switch_pd_nexthop_table_entry(
goto dealloc_resources;
}

#if NEXTHOP_TABLE_TERNARY_MATCH
// When Nexthop table is of type ternary Match
status = tdi_key_field_set_value_and_mask(key_hdl, field_id,
(api_nexthop_pd_info->nexthop_handle &
~(SWITCH_HANDLE_TYPE_NHOP <<
SWITCH_HANDLE_TYPE_SHIFT)), 0xFFFF);
#else
// When Nexthop table is of type exact Match
status = tdi_key_field_set_value(key_hdl, field_id,
(api_nexthop_pd_info->nexthop_handle &
~(SWITCH_HANDLE_TYPE_NHOP <<
SWITCH_HANDLE_TYPE_SHIFT)));
#endif

if (status != TDI_SUCCESS) {
krnlmon_log_error("Unable to set value for key ID: %d for nexthop_table,"
" error: %d", field_id, status);
Expand Down

0 comments on commit 47c61cc

Please sign in to comment.