Skip to content

Commit

Permalink
LNW nexthop changes for LAG scenario (#155)
Browse files Browse the repository at this point in the history
- Removed unused `router_interface_id` argument from `set_nexthop_lag`
  action in `nexthop_table`.
- Added `router_interface_id` with `set_egress_port` action for
  `tx_lag_table` to resolve source MAC address population for LAG
  scenario.

This aligns with recent changes in the P4 program to address a LAG bug.

Signed-off-by: Sabeel Ansari <[email protected]>
  • Loading branch information
5abeel authored Jul 12, 2024
1 parent 332e41f commit 2fd1746
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 19 deletions.
1 change: 0 additions & 1 deletion switchapi/es2k/lnw_v3/lnw_nexthop_table.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@

#define LNW_NEXTHOP_TABLE_ACTION_SET_NEXTHOP_LAG \
"linux_networking_control.set_nexthop_lag"
#define LNW_ACTION_SET_NEXTHOP_LAG_PARAM_RIF "router_interface_id"
#define LNW_ACTION_SET_NEXTHOP_LAG_PARAM_DMAC_HIGH "dmac_high"
#define LNW_ACTION_SET_NEXTHOP_LAG_PARAM_DMAC_LOW "dmac_low"
#define LNW_ACTION_SET_NEXTHOP_LAG_PARAM_LAG_ID "lag_group_id"
Expand Down
17 changes: 17 additions & 0 deletions switchapi/es2k/lnw_v3/switch_pd_lag.c
Original file line number Diff line number Diff line change
Expand Up @@ -470,6 +470,7 @@ switch_status_t switch_pd_tx_lacp_lag_table_entry(
tdi_id_t field_id_hash = 0;
tdi_id_t action_id = 0;
tdi_id_t data_field_id = 0;
tdi_id_t rif_data_field_id = 0;

tdi_dev_id_t dev_id = device;

Expand Down Expand Up @@ -580,6 +581,15 @@ switch_status_t switch_pd_tx_lacp_lag_table_entry(
goto dealloc_resources;
}

status = tdi_data_field_id_with_action_get(
table_info_hdl, ACTION_SET_EGRESS_PORT_PARAM_ROUTER_INTF_ID, action_id,
&rif_data_field_id);
if (status != TDI_SUCCESS) {
krnlmon_log_error("Unable to get data field id param for: %s, error: %d",
ACTION_SET_EGRESS_PORT_PARAM_EGRESS_PORT, status);
goto dealloc_resources;
}

status = tdi_data_field_id_with_action_get(
table_info_hdl, ACTION_SET_EGRESS_PORT_PARAM_EGRESS_PORT, action_id,
&data_field_id);
Expand Down Expand Up @@ -625,6 +635,13 @@ switch_status_t switch_pd_tx_lacp_lag_table_entry(
}

if (entry_add) {
status = tdi_data_field_set_value(data_hdl, rif_data_field_id, lag_id);
if (status != TDI_SUCCESS) {
krnlmon_log_error("Unable to set action value for ID: %d, error: %d",
data_field_id, status);
goto dealloc_resources;
}

status = tdi_data_field_set_value(data_hdl, data_field_id, egress_port);
if (status != TDI_SUCCESS) {
krnlmon_log_error("Unable to set action value for ID: %d, error: %d",
Expand Down
18 changes: 0 additions & 18 deletions switchapi/es2k/lnw_v3/switch_pd_routing.c
Original file line number Diff line number Diff line change
Expand Up @@ -348,27 +348,9 @@ switch_status_t switch_pd_nexthop_table_entry(
goto dealloc_resources;
}

status = tdi_data_field_id_with_action_get(
table_info_hdl, LNW_ACTION_SET_NEXTHOP_LAG_PARAM_RIF, action_id,
&data_field_id);
if (status != TDI_SUCCESS) {
krnlmon_log_error(
"Unable to get data field id param for: %s, "
"error: %d",
LNW_ACTION_SET_NEXTHOP_LAG_PARAM_RIF, status);
goto dealloc_resources;
}

lag_id = api_nexthop_pd_info->rif_handle &
~(SWITCH_HANDLE_TYPE_LAG << SWITCH_HANDLE_TYPE_SHIFT);

status = tdi_data_field_set_value(data_hdl, data_field_id, lag_id);
if (status != TDI_SUCCESS) {
krnlmon_log_error("Unable to set action value for ID: %d, error: %d",
data_field_id, status);
goto dealloc_resources;
}

status = tdi_data_field_id_with_action_get(
table_info_hdl, LNW_ACTION_SET_NEXTHOP_LAG_PARAM_DMAC_HIGH, action_id,
&data_field_id);
Expand Down
1 change: 1 addition & 0 deletions switchapi/es2k/switch_pd_p4_name_routing.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@
#define LNW_TX_LAG_TABLE_ACTION_SET_EGRESS_PORT \
"linux_networking_control.set_egress_port"

#define ACTION_SET_EGRESS_PORT_PARAM_ROUTER_INTF_ID "router_interface_id"
#define ACTION_SET_EGRESS_PORT_PARAM_EGRESS_PORT "egress_port"

#define LNW_LAG_HASH_SIZE 65536
Expand Down

0 comments on commit 2fd1746

Please sign in to comment.