Skip to content

Commit

Permalink
LNW nexthop changes for LAG scenario
Browse files Browse the repository at this point in the history
Signed-off-by: Sabeel Ansari <[email protected]>
  • Loading branch information
5abeel committed Jul 12, 2024
1 parent 332e41f commit f2f99ec
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 4 deletions.
3 changes: 2 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,8 @@

#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"
//MEVTS1.7 this param removed from set_nexthop_lag action
//#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
8 changes: 5 additions & 3 deletions switchapi/es2k/lnw_v3/switch_pd_routing.c
Original file line number Diff line number Diff line change
Expand Up @@ -348,6 +348,10 @@ switch_status_t switch_pd_nexthop_table_entry(
goto dealloc_resources;
}

lag_id = api_nexthop_pd_info->rif_handle &
~(SWITCH_HANDLE_TYPE_LAG << SWITCH_HANDLE_TYPE_SHIFT);
// The RIF param is removed from P4 with 1.7
#if 0
status = tdi_data_field_id_with_action_get(
table_info_hdl, LNW_ACTION_SET_NEXTHOP_LAG_PARAM_RIF, action_id,
&data_field_id);
Expand All @@ -359,15 +363,13 @@ switch_status_t switch_pd_nexthop_table_entry(
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;
}
#endif

status = tdi_data_field_id_with_action_get(
table_info_hdl, LNW_ACTION_SET_NEXTHOP_LAG_PARAM_DMAC_HIGH, action_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 f2f99ec

Please sign in to comment.