ssa.c: In ssa_downstream_close_ssa_conn, minor code refactoring

Signed-off-by: Hal Rosenstock <hal@mellanox.com>
ssa.c: Check for existing SMDB before sending DB update notification

Signed-off-by: Ilya Nelkenbaum <ilyan@mellanox.com>
Signed-off-by: Hal Rosenstock <hal@mellanox.com>
ssa.c: Add reconnection timer to upstream thread

The reconnection timer will be used for rsocket connection recovery.
Now, timeout interval is 0 and the timer is disabled.
For the timer, we use timerfd system calls that deliver the timer
notification via a file descriptor. The file descriptor is monitored
by rpoll function.
The timer descriptor is used in non-blocking mode.
timerfd is implemented in glibc.

Reference: http://man7.org/linux/man-pages/man2/timerfd_create.2.html
Requirements: Linux 2.6.27

Signed-off-by: Sasha Kotchubievsky <sashakot@mellanox.com>
Signed-off-by: Hal Rosenstock <hal@mellanox.com>
ssa.c: Configure number of workers in rclose thread pool

Override RCLOSE_THREAD_POOL_WORKERS_NUM in compilation command line
using CFLAGS as follows:
./autogen.sh  && ./configure CFLAGS="-DRCLOSE_THREAD_POOL_WORKERS_NUM=3

Signed-off-by: Sasha Kotchubievsky <sashakot@mellanox.com>
Signed-off-by: Hal Rosenstock <hal@mellanox.com>
ssa.c: Print number of rlose thread pool workers to ssa log

Signed-off-by: Sasha Kotchubievsky <sashakot@mellanox.com>
Signed-off-by: Hal Rosenstock <hal@mellanox.com>
[ssa_mad.h, core.c, ssa.c]: Add bad_parent flag to ssa_member_record

If the flag is "true", a node can't establish upstream connection to
current parent and asks the core for a new one.

Signed-off-by: Sasha Kotchubievsky <sashakot@mellanox.com>
Signed-off-by: Hal Rosenstock <hal@mellanox.com>
ssa.c: Join core node to itself rather than to "MASTER" core

Without the patch, after moving mastership to a new core, it's
distribution tree is wrong. There is no core there.

Also, distribution tree formation doesn't really support two cores
with one is standby.

Signed-off-by: Sasha Kotchubievsky <sashakot@mellanox.com>
Signed-off-by: Hal Rosenstock <hal@mellanox.com>
ssa.c: Handle opened upstream connection if a new parent is received

- If the old and new parents are identical and the connection is alive,
  just move to the CONNECTED state.
- If the parents are different, close the existing upstream connection.

Signed-off-by: Sasha Kotchubievsky <sashakot@mellanox.com>
Signed-off-by: Hal Rosenstock <hal@mellanox.com>
Revert "ssa.c: Avoid rejoin from nodes not directly connected to core"

This reverts commit 846f209c3d62e83b244b9e4d6c9ce5abcaefa581.

Signed-off-by: Hal Rosenstock <hal@mellanox.com>
ssa.c: Fix rejoin policy to distribution tree

Signed-off-by: Ilya Nelkenbaum <ilyan@mellanox.com>
Signed-off-by: Hal Rosenstock <hal@mellanox.com>
ssa.c: Implement DB lifecycle support for consumer (ACM) nodes

Destroy previous PRDB after current one completely received
on upstream connection.

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