summaryrefslogtreecommitdiffstats
path: root/net/smc/smc.h
diff options
context:
space:
mode:
authorUrsula Braun <ubraun@linux.vnet.ibm.com>2017-01-09 10:55:22 -0500
committerDavid S. Miller <davem@davemloft.net>2017-01-09 16:07:40 -0500
commit5f08318f617b05b6ee389d8bd174c7af921ebf19 (patch)
treea9cb73bf47554bd92ad3e9861a49683df2c11ab9 /net/smc/smc.h
parent9bf9abead28abaf11d0776b6e0c5d34b6525e846 (diff)
smc: connection data control (CDC)
send and receive CDC messages (via IB message send and CQE) Signed-off-by: Ursula Braun <ubraun@linux.vnet.ibm.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/smc/smc.h')
-rw-r--r--net/smc/smc.h97
1 files changed, 97 insertions, 0 deletions
diff --git a/net/smc/smc.h b/net/smc/smc.h
index 4d2e54d176f2..a8d4a68aac30 100644
--- a/net/smc/smc.h
+++ b/net/smc/smc.h
@@ -21,6 +21,10 @@
21 21
22#define SMC_MAX_PORTS 2 /* Max # of ports */ 22#define SMC_MAX_PORTS 2 /* Max # of ports */
23 23
24#ifdef ATOMIC64_INIT
25#define KERNEL_HAS_ATOMIC64
26#endif
27
24enum smc_state { /* possible states of an SMC socket */ 28enum smc_state { /* possible states of an SMC socket */
25 SMC_ACTIVE = 1, 29 SMC_ACTIVE = 1,
26 SMC_INIT = 2, 30 SMC_INIT = 2,
@@ -34,6 +38,67 @@ struct smc_wr_rx_hdr { /* common prefix part of LLC and CDC to demultiplex */
34 u8 type; 38 u8 type;
35} __aligned(1); 39} __aligned(1);
36 40
41struct smc_cdc_conn_state_flags {
42#if defined(__BIG_ENDIAN_BITFIELD)
43 u8 peer_done_writing : 1; /* Sending done indicator */
44 u8 peer_conn_closed : 1; /* Peer connection closed indicator */
45 u8 peer_conn_abort : 1; /* Abnormal close indicator */
46 u8 reserved : 5;
47#elif defined(__LITTLE_ENDIAN_BITFIELD)
48 u8 reserved : 5;
49 u8 peer_conn_abort : 1;
50 u8 peer_conn_closed : 1;
51 u8 peer_done_writing : 1;
52#endif
53};
54
55struct smc_cdc_producer_flags {
56#if defined(__BIG_ENDIAN_BITFIELD)
57 u8 write_blocked : 1; /* Writing Blocked, no rx buf space */
58 u8 urg_data_pending : 1; /* Urgent Data Pending */
59 u8 urg_data_present : 1; /* Urgent Data Present */
60 u8 cons_curs_upd_req : 1; /* cursor update requested */
61 u8 failover_validation : 1;/* message replay due to failover */
62 u8 reserved : 3;
63#elif defined(__LITTLE_ENDIAN_BITFIELD)
64 u8 reserved : 3;
65 u8 failover_validation : 1;
66 u8 cons_curs_upd_req : 1;
67 u8 urg_data_present : 1;
68 u8 urg_data_pending : 1;
69 u8 write_blocked : 1;
70#endif
71};
72
73/* in host byte order */
74union smc_host_cursor { /* SMC cursor - an offset in an RMBE */
75 struct {
76 u16 reserved;
77 u16 wrap; /* window wrap sequence number */
78 u32 count; /* cursor (= offset) part */
79 };
80#ifdef KERNEL_HAS_ATOMIC64
81 atomic64_t acurs; /* for atomic processing */
82#else
83 u64 acurs; /* for atomic processing */
84#endif
85} __aligned(8);
86
87/* in host byte order, except for flag bitfields in network byte order */
88struct smc_host_cdc_msg { /* Connection Data Control message */
89 struct smc_wr_rx_hdr common; /* .type = 0xFE */
90 u8 len; /* length = 44 */
91 u16 seqno; /* connection seq # */
92 u32 token; /* alert_token */
93 union smc_host_cursor prod; /* producer cursor */
94 union smc_host_cursor cons; /* consumer cursor,
95 * piggy backed "ack"
96 */
97 struct smc_cdc_producer_flags prod_flags; /* conn. tx/rx status */
98 struct smc_cdc_conn_state_flags conn_state_flags; /* peer conn. status*/
99 u8 reserved[18];
100} __aligned(8);
101
37struct smc_connection { 102struct smc_connection {
38 struct rb_node alert_node; 103 struct rb_node alert_node;
39 struct smc_link_group *lgr; /* link group of connection */ 104 struct smc_link_group *lgr; /* link group of connection */
@@ -50,6 +115,38 @@ struct smc_connection {
50 struct smc_buf_desc *rmb_desc; /* RMBE descriptor */ 115 struct smc_buf_desc *rmb_desc; /* RMBE descriptor */
51 int rmbe_size; /* RMBE size <== sock rmem */ 116 int rmbe_size; /* RMBE size <== sock rmem */
52 int rmbe_size_short;/* compressed notation */ 117 int rmbe_size_short;/* compressed notation */
118
119 struct smc_host_cdc_msg local_tx_ctrl; /* host byte order staging
120 * buffer for CDC msg send
121 * .prod cf. TCP snd_nxt
122 * .cons cf. TCP sends ack
123 */
124 union smc_host_cursor tx_curs_prep; /* tx - prepared data
125 * snd_max..wmem_alloc
126 */
127 union smc_host_cursor tx_curs_sent; /* tx - sent data
128 * snd_nxt ?
129 */
130 union smc_host_cursor tx_curs_fin; /* tx - confirmed by peer
131 * snd-wnd-begin ?
132 */
133 atomic_t sndbuf_space; /* remaining space in sndbuf */
134 u16 tx_cdc_seq; /* sequence # for CDC send */
135 spinlock_t send_lock; /* protect wr_sends */
136
137 struct smc_host_cdc_msg local_rx_ctrl; /* filled during event_handl.
138 * .prod cf. TCP rcv_nxt
139 * .cons cf. TCP snd_una
140 */
141 union smc_host_cursor rx_curs_confirmed; /* confirmed to peer
142 * source of snd_una ?
143 */
144 atomic_t bytes_to_rcv; /* arrived data,
145 * not yet received
146 */
147#ifndef KERNEL_HAS_ATOMIC64
148 spinlock_t acurs_lock; /* protect cursors */
149#endif
53}; 150};
54 151
55struct smc_sock { /* smc sock container */ 152struct smc_sock { /* smc sock container */