ssa.c: In ssa_upstream_handle_op, start upstream queries when SSA_MSG_DB_UPDATE msg is received and ssa_db is NULL

Signed-off-by: Hal Rosenstock <hal@mellanox.com>
ssa.c: Eliminate passing SSA DB object in internal prepare and ready messages

Don't have the SSA DB yet to pass (it would be the old/current one and
not the one about to come in and be passed in the update message).

Signed-off-by: Hal Rosenstock <hal@mellanox.com>
core.c: Don't pass SSA DB object in prepare message in ssa_extract_db_update_prepare

Signed-off-by: Hal Rosenstock <hal@mellanox.com>
ssa.c: In ssa_upstream_initiate_conn, enable keepalives for consumers (ACMs)

Consumer (ACM) nodes need to detect when the other end of the
connection goes away (e.g. SSA app on other end dies, also
doesn't detect a bounced port making it need to reconnect
and maybe rejoin too).

Signed-off-by: Hal Rosenstock <hal@mellanox.com>
core.c: Fix compile warnings when simulator enabled (--enable-simulator)

src/core.c: In function #core_extract_handler#:
src/core.c:1377: warning: implicit declaration of function #core_orphan_adoption#
src/core.c:1396: warning: implicit declaration of function #core_dump_tree#

Signed-off-by: Hal Rosenstock <hal@mellanox.com>
Remove ref_count_obj support and replace with smdb_refcnt

As of the following commit, PRDBs are no longer reference counted:
commit 1b69ad459a0b8878fec889baedeedaa7c6b786ff
Author: Sasha Kotchubievsky <sashakot@mellanox.com>
Date:   Mon Nov 10 15:08:32 2014 +0200

    ssa.c: Decouple access and downstream threads during PRDB update

    Signed-off-by: Sasha Kotchubievsky <sashakot@mellanox.com>
    Signed-off-by: Hal Rosenstock <hal@mellanox.com>

Since then, it is only SMDB which is reference counted. Reference
counting there is only an optimization to determine when
current SMDB is "in use" (in process of being transferred downstream).

Signed-off-by: Hal Rosenstock <hal@mellanox.com>
ssa.c: Reorder parameters to ssa_db_update_init to be consistent with other APIs

svc parameter comes first (before SSA DB parameter)

Signed-off-by: Hal Rosenstock <hal@mellanox.com>
ssa.c: Trivial reorder of local variables in ssa_access_map_callback

Signed-off-by: Hal Rosenstock <hal@mellanox.com>
ssa.c: In ssa_calculate_prdb, add SMDB epoch to PRDB copy failed log message

Also, cosmetic commentary change

Signed-off-by: Hal Rosenstock <hal@mellanox.com>
ssa.c: Cosmetic reformatting of ssa_access_context structure

Signed-off-by: Hal Rosenstock <hal@mellanox.com>
ssa.c: Improved a couple of error log messages dealing with ssa_db struct allocation failures

Signed-off-by: Hal Rosenstock <hal@mellanox.com>
ssa.c: In ssa_downstream_handler, remove epoch from log message when access send DB update message

Epoch is unused (invalid epoch) in such message

Signed-off-by: Hal Rosenstock <hal@mellanox.com>
ssa.c: Don't close upstream connection, if IBV_EVENT_CLIENT_REREGISTER is received.

 The change allows an SM failover/handover investigation.
 The behavior could be changed in future.
ssa.c, common.h: Add log_data1 buffer.

 It will be used for log printing where two gids should be
 printed.
ssa.c, core.c: Add parent_gid field to join query.

 Old parent will be taken into account in distribution tree
 building.
common.h,ssa_mad.h,core.c,ssa.c: Return parent type in response to join request.

 The parent's node type will be used in SM resiliancy feature.
 To struct ssa_svc two new fields are added: primary_type,
 secondary_type. At the moment, SSA supports only primary parent.
 secondary_type will be used in future.
ssa.c: Add IBV_EVENT_SM_CHANGE event to device's event processing routines.

 The event is generated when there is a new SM in the subnet.
 WARNING. The event is not generated by last Mellanox drivers.
 The event is handled for debug purposes.
ssa.c: Generate IBV_EVENT_SM_CHANGE event.

 It's workaround for Mellanox drivers. The driver dosen't generate
 IBV_EVENT_SM_CHANGE event. But IBV_EVENT_CLIENT_REREGISTER event
 is generated in case of SM change. ssa_ctrl_device could check
 if the SM lid was changed and forward to upstream and downstream
 IBV_EVENT_SM_CHANGE event instead of the original event.