21
21
22
22
#define SMC_MAX_PORTS 2 /* Max # of ports */
23
23
24
+ #ifdef ATOMIC64_INIT
25
+ #define KERNEL_HAS_ATOMIC64
26
+ #endif
27
+
24
28
enum smc_state { /* possible states of an SMC socket */
25
29
SMC_ACTIVE = 1 ,
26
30
SMC_INIT = 2 ,
@@ -34,6 +38,67 @@ struct smc_wr_rx_hdr { /* common prefix part of LLC and CDC to demultiplex */
34
38
u8 type ;
35
39
} __aligned (1 );
36
40
41
+ struct 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
+
55
+ struct 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 */
74
+ union 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 */
88
+ struct 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
+
37
102
struct smc_connection {
38
103
struct rb_node alert_node ;
39
104
struct smc_link_group * lgr ; /* link group of connection */
@@ -50,6 +115,38 @@ struct smc_connection {
50
115
struct smc_buf_desc * rmb_desc ; /* RMBE descriptor */
51
116
int rmbe_size ; /* RMBE size <== sock rmem */
52
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
55
152
struct smc_sock { /* smc sock container */
0 commit comments