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

Update bootstrap-t4p4s.sh and fix state initialization for main socket != 0 #28

Open
wants to merge 10 commits into
base: master
Choose a base branch
from
2 changes: 1 addition & 1 deletion bootstrap-t4p4s.sh
Original file line number Diff line number Diff line change
Expand Up @@ -362,7 +362,7 @@ if [ "$INSTALL_STAGE3_PROTOBUF" == "yes" ]; then
fi

if [ "$INSTALL_STAGE4_P4C" == "yes" ]; then
[ ! -d "p4c" ] && git clone "$REPO_PATH_p4c" --no-hardlinks --recursive >$(logfile "get-p4c") 2>&1 && cd p4c && git checkout `git rev-list -1 --before="$P4C_COMMIT_DATE" master` >>$(logfile "get-p4c") 2>&1 && git submodule update --init --recursive &
[ ! -d "p4c" ] && git clone "$REPO_PATH_p4c" --no-hardlinks --recursive >$(logfile "get-p4c") 2>&1 && cd p4c && git checkout `git rev-list -1 --before="$P4C_COMMIT_DATE" main` >>$(logfile "get-p4c") 2>&1 && git submodule update --init --recursive &
Copy link
Contributor

Choose a reason for hiding this comment

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

This problem has been resolved with commit d110dda

WAITPROC_P4C="$!"
[ "$PARALLEL_INSTALL" != "yes" ] && wait "$WAITPROC_P4C" >/dev/null 2>&1
fi
Expand Down
2 changes: 2 additions & 0 deletions src/hardware_dep/dpdk/data_plane/dpdk_lib.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ uint32_t enabled_port_mask;
uint16_t nb_lcore_params;
struct lcore_params lcore_params[MAX_LCORE_PARAMS];

int main_socket;

//=============================================================================
// Locals

Expand Down
5 changes: 5 additions & 0 deletions src/hardware_dep/dpdk/data_plane/dpdk_lib_init_tables.c
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,11 @@ void init_tables()
#ifdef T4P4S_DEBUG
init_print_table_info();
#endif
#if RTE_VERSION >= RTE_VERSION_NUM(20,11,0,0)
main_socket = get_socketid(rte_get_main_lcore());
#else
main_socket= get_socketid(rte_get_master_lcore());
#endif

for (unsigned lcore_id = 0; lcore_id < RTE_MAX_LCORE; lcore_id++) {
create_tables_on_lcore(lcore_id);
Expand Down
5 changes: 3 additions & 2 deletions src/hardware_indep/controlplane.c.py
Original file line number Diff line number Diff line change
Expand Up @@ -342,6 +342,7 @@ def gen_fill_key_component(k, idx, byte_width, tmt, kmt):


#[ ctrl_plane_backend bg;
#[ extern int main_socket;

#{ #ifdef T4P4S_P4RT
#[ void init_control_plane()
Expand All @@ -361,8 +362,8 @@ def gen_fill_key_component(k, idx, byte_width, tmt, kmt):
#{ #ifdef T4P4S_DEBUG
#{ for (int i = 0; i < NB_TABLES; i++) {
#[ lookup_table_t t = table_config[i];
#[ if (state[0].tables[t.id][0]->init_entry_count > 0)
#[ debug(" " T4LIT(:,incoming) " Table " T4LIT(%s,table) " got " T4LIT(%d) " entries from the control plane\n", state[0].tables[t.id][0]->short_name, state[0].tables[t.id][0]->init_entry_count);
#[ if (state[main_socket].tables[t.id][0]->init_entry_count > 0)
#[ debug(" " T4LIT(:,incoming) " Table " T4LIT(%s,table) " got " T4LIT(%d) " entries from the control plane\n", state[main_socket].tables[t.id][0]->short_name, state[main_socket].tables[t.id][0]->init_entry_count);
#} }
#} #endif
#} }
Expand Down
6 changes: 3 additions & 3 deletions src/hardware_indep/tables.c.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
#} }


#[ #define SOCKET0 0
#[ extern int main_socket;

#[ extern struct socket_state state[NB_SOCKETS];
#[
Expand All @@ -78,8 +78,8 @@
for table in sorted(hlir.tables, key=lambda table: table.short_name):
default_action = table.default_action.expression.method.action_ref
show_info = 'false' if table in nops else 'true'
#[ int current_replica_${table.name} = state[SOCKET0].active_replica[TABLE_${table.name}];
#{ if (likely(state[SOCKET0].tables[TABLE_${table.name}][current_replica_${table.name}]->default_val == NULL)) {
#[ int current_replica_${table.name} = state[main_socket].active_replica[TABLE_${table.name}];
#{ if (likely(state[main_socket].tables[TABLE_${table.name}][current_replica_${table.name}]->default_val == NULL)) {
#[ setdefault_${table.name}(action_${default_action.name}, ${show_info});
#} }
#} }
Expand Down