The following issues with the current socket layer hinders socket diagnostics
implementation, which led to this patch series. The series does not add any
functional change.

1. tipc socket state is derived from multiple variables like
   sock->state, tsk->probing_state and tsk->connected. This style forces
   us to export multiple attributes to the user space, which has to be
   backward compatible.

2. Abuse of sock->state cannot be exported to user-space without
   requiring tipc specific hacks in the user-space.
   - For connection less (CL) sockets sock->state is overloaded to
     tipc state SS_READY.
   - For connection oriented (CO) listening socket sock->state is
     overloaded to tipc state SS_LISTEN.

This series is split into four:
1. A bug fix in patch#1
2. Minor cleanups in patch#2-3
3. Express all tipc states using a single variable. This is done in patch#4-7.
4. Migrate the new tipc states to sk->sk_state. This is done in patch#8-14.

The figures below represents the FSM after this series:

For connectionless sockets:
+-----------+       +--------------+
| TIPC_OPEN |------>| TIPC_CLOSING |
+-----------+       +--------------+

Stream Server Listening Socket:
+-----------+       +-------------+
| TIPC_OPEN |------>| TIPC_LISTEN |
+-----------+       +-------------+
                            |
+--------------+            |
| TIPC_CLOSING |<-----------+
+--------------+

Stream Server Data Socket:
+-----------+       +------------------+
| TIPC_OPEN |------>| TIPC_ESTABLISHED |<---+
+-----------+       +------------------+    |
                        ^   |    |          |
                        |   |    +----------+
                        |   v
                    +--------------+
                    | TIPC_PROBING |
                    +--------------+
                           |
                           |
                           v
+--------------+    +--------------------+
| TIPC_CLOSING |<---| TIPC_DISCONNECTING |
+--------------+    +--------------------+

Stream Socket Client:
+-----------+       +-----------------+
| TIPC_OPEN |------>| TIPC_CONNECTING |
+-----------+       +-----------------+
                            |
                            |
                            v
                    +------------------+
                    | TIPC_ESTABLISHED |<---+
                    +------------------+    |
                         ^   |    |         |
                         |   |    +---------+
                         |   v
                    +--------------+
                    | TIPC_PROBING |
                    +--------------+
                           |
                           |
                           v
+--------------+    +--------------------+
| TIPC_CLOSING |<---| TIPC_DISCONNECTING |
+--------------+    +--------------------+

NOTE:
This is just a base refractoring required for socket diagnostics.
Implementation of TIPC socket diagnostics will be sent as a
separate series.

---
I plan to submit this series after v4.8 release cycle.

v4: Addressed comments from Jon Maloy:
    - Added a new patch #2 to rename variable.
    Make state names more readable and consistent:
    - Renamed the state TIPC_UNCONNECTED to TIPC_OPEN.
    - Adjusted the scope for TIPC_DISCONNECTING in patch#11.
    - Added a new state TIPC_CLOSING in patch#12.

v3: - Address comments from Ying Xue <ying....@windriver.com> in
      patch #7, #11.
    - Rebase on latest netnext which contains fixes for broadcast NACK
      that seems to make ptts regression stable.
    - Ran ptts suits for 6000 iterations for 5+ hours.

Parthasarathy Bhuvaragan (14):
  tipc: set kern=0 in sk_alloc() during tipc_accept()
  tipc: rename struct tipc_skb_cb member handle to bytes_read
  tipc: rename tsk->remote to tsk->peer for consistent naming
  tipc: remove tsk->connected for connectionless sockets
  tipc: remove tsk->connected from tipc_sock
  tipc: remove probing_intv from tipc_sock
  tipc: remove socket state SS_READY
  tipc: create TIPC_LISTEN as a new sk_state
  tipc: create TIPC_PROBING/TIPC_ESTABLISHED as new sk_states
  tipc: create TIPC_OPEN as a new sk_state
  tipc: create TIPC_DISCONNECTING as a new sk_state
  tipc: create TIPC_CLOSING as a new sk_state
  tipc: create TIPC_CONNECTING as a new sk_state
  tipc: remove SS_CONNECTED sock state

 include/uapi/linux/tipc.h |  13 ++
 net/tipc/msg.h            |   2 +-
 net/tipc/socket.c         | 380 +++++++++++++++++++++++++---------------------
 3 files changed, 217 insertions(+), 178 deletions(-)

-- 
2.1.4


------------------------------------------------------------------------------
_______________________________________________
tipc-discussion mailing list
tipc-discussion@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/tipc-discussion

Reply via email to