Skip to content
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

LNW nexthop changes for LAG scenario #155

Merged
merged 3 commits into from
Jul 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACTION_SET_EGRESS_PORT_PARAM_EGRESS_PORT -> Change this to ACTION_SET_EGRESS_PORT_PARAM_ROUTER_INTF_ID for correct error message.

Copy link
Collaborator Author

@5abeel 5abeel Jul 12, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Opened PR #156 to address this

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);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

data_field_id, --> change this to rif_data_field_id for correct error message.

Copy link
Collaborator Author

@5abeel 5abeel Jul 12, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Opened PR #156 to address this

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