ssa.c: In ssa_upstream_rrecv, don't issue rrecv if length is 0

Signed-off-by: Hal Rosenstock <hal@mellanox.com>
ssa.c: Add debug log message when reusing rbuf

prior to calling ssa_upstream_rrecv in ssa_upstream_handler

Signed-off-by: Hal Rosenstock <hal@mellanox.com>
ssa.c: In ssa_upstream_update_conn, when in SSA_DB_FIELD_DEFS phase, only store rbuf into SSA DB when not the same as rhdr

This handles NULL field defs as is used for variable size tables such
as the PKEY table in SMDB.

This was causing double deletion of rhdr.

Signed-off-by: Hal Rosenstock <hal@mellanox.com>
ssa.c: Cosmetic change to a couple of log messages

Remove PRDB from message as this will apply to SMDBs too

Signed-off-by: Hal Rosenstock <hal@mellanox.com>
ssa.c: Implement (SM)DB lifecycle support for distribution and access nodes

Destroy previous SMDB after ready is indicated.

Signed-off-by: Hal Rosenstock <hal@mellanox.com>
ssa_db.c: Add comment for not comparing 'set_offset' dataset field

Signed-off-by: Ilya Nelkenbaum <ilyan@mellanox.com>
Signed-off-by: Hal Rosenstock <hal@mellanox.com>
ssa_db.c: Assign pointers with NULL after memory release in ssa_db_destroy

Signed-off-by: Ilya Nelkenbaum <ilyan@mellanox.com>
Signed-off-by: Hal Rosenstock <hal@mellanox.com>
ssa_db.c: Fix const correctness in 'ssa_db_cmp()' routine

Signed-off-by: Ilya Nelkenbaum <ilyan@mellanox.com>
Signed-off-by: Hal Rosenstock <hal@mellanox.com>
ssa_db.[c h]: Add ssa_db_copy() routine

Signed-off-by: Ilya Nelkenbaum <ilyan@mellanox.com>
Signed-off-by: Hal Rosenstock <hal@mellanox.com>
ssa_db.[h c]: Use "const" modifier for ssa_db input parameter in ssa_db_get_epoch

The function doesn't change ssa_db.

Signed-off-by: Sasha Kotchubievsky <sashakot@mellanox.com>
Signed-off-by: Hal Rosenstock <hal@mellanox.com>
ssa_path_record_data.c: Use ssa_db_get_epoch function in ssa_pr_rebuild_indexes

Until partial update is implemented, epoch is database
attribute rather than table's attribute.

Signed-off-by: Sasha Kotchubievsky <sashakot@mellanox.com>
Signed-off-by: Hal Rosenstock <hal@mellanox.com>
ssa_db.c: Use DB_EPOCH_INVALID rather than 0 in ssa_db_get_epoch

Signed-off-by: Sasha Kotchubievsky <sashakot@mellanox.com>
Signed-off-by: Hal Rosenstock <hal@mellanox.com>
ssa_path_record_data.c: Set index's epoch after building

in ssa_pr_build_indexes

Signed-off-by: Sasha Kotchubievsky <sashakot@mellanox.com>
Signed-off-by: Hal Rosenstock <hal@mellanox.com>
ssa.c: Add ssa_db_copy() routine usage when calculating PRDB

Signed-off-by: Ilya Nelkenbaum <ilyan@mellanox.com>
Signed-off-by: Hal Rosenstock <hal@mellanox.com>
ssa.c: Add ssa_db_cmp() routine usage when calculating PRDB

Signed-off-by: Ilya Nelkenbaum <ilyan@mellanox.com>
Signed-off-by: Hal Rosenstock <hal@mellanox.com>
ssa.c: Rejoin after reject

Reject status is htons(SSA_STATUS_REQ_DENIED << 8).
The rejoin algorithm may be changed in upcoming commits.

Signed-off-by: Sasha Kotchubievsky <sashakot@mellanox.com>
Signed-off-by: Hal Rosenstock <hal@mellanox.com>
ssa_db_helper.c: Add 'mkpath()' routine - 'mkdir -p' equivalent

Signed-off-by: Ilya Nelkenbaum <ilyan@mellanox.com>
Signed-off-by: Hal Rosenstock <hal@mellanox.com>
ssa.c: Add GID to log message in case of invalid PRDB version

Signed-off-by: Ilya Nelkenbaum <ilyan@mellanox.com>
Signed-off-by: Hal Rosenstock <hal@mellanox.com>
ssa.c: Fixed log level used in ssa_sprint_addr for ssa_db_cmp return value 0

Signed-off-by: Hal Rosenstock <hal@mellanox.com>
ssa_db_helper.c: Check mkdir() and remove() calls return values

Signed-off-by: Ilya Nelkenbaum <ilyan@mellanox.com>
Signed-off-by: Hal Rosenstock <hal@mellanox.com>