recv.c (712cba5d87a6c0e980ee5fad45734e189c4d7151) recv.c (905dd4184e0732de41d6ee3c7b06e0cfdd9f0aad)
1/*
2 * Copyright (c) 2006 Oracle. All rights reserved.
3 *
4 * This software is available to you under a choice of one of two
5 * licenses. You may choose to be licensed under the terms of the GNU
6 * General Public License (GPL) Version 2, available from the file
7 * COPYING in the main directory of this source tree, or the
8 * OpenIB.org BSD license below:

--- 106 unchanged lines hidden (view full) ---

115 rs->rs_congested = 0;
116 rds_cong_clear_bit(map, port);
117 rds_cong_queue_updates(map);
118 }
119
120 /* do nothing if no change in cong state */
121}
122
1/*
2 * Copyright (c) 2006 Oracle. All rights reserved.
3 *
4 * This software is available to you under a choice of one of two
5 * licenses. You may choose to be licensed under the terms of the GNU
6 * General Public License (GPL) Version 2, available from the file
7 * COPYING in the main directory of this source tree, or the
8 * OpenIB.org BSD license below:

--- 106 unchanged lines hidden (view full) ---

115 rs->rs_congested = 0;
116 rds_cong_clear_bit(map, port);
117 rds_cong_queue_updates(map);
118 }
119
120 /* do nothing if no change in cong state */
121}
122
123static void rds_conn_peer_gen_update(struct rds_connection *conn,
124 u32 peer_gen_num)
125{
126 int i;
127 struct rds_message *rm, *tmp;
128 unsigned long flags;
129
130 WARN_ON(conn->c_trans->t_type != RDS_TRANS_TCP);
131 if (peer_gen_num != 0) {
132 if (conn->c_peer_gen_num != 0 &&
133 peer_gen_num != conn->c_peer_gen_num) {
134 for (i = 0; i < RDS_MPATH_WORKERS; i++) {
135 struct rds_conn_path *cp;
136
137 cp = &conn->c_path[i];
138 spin_lock_irqsave(&cp->cp_lock, flags);
139 cp->cp_next_tx_seq = 1;
140 cp->cp_next_rx_seq = 0;
141 list_for_each_entry_safe(rm, tmp,
142 &cp->cp_retrans,
143 m_conn_item) {
144 set_bit(RDS_MSG_FLUSH, &rm->m_flags);
145 }
146 spin_unlock_irqrestore(&cp->cp_lock, flags);
147 }
148 }
149 conn->c_peer_gen_num = peer_gen_num;
150 }
151}
152
123/*
124 * Process all extension headers that come with this message.
125 */
126static void rds_recv_incoming_exthdrs(struct rds_incoming *inc, struct rds_sock *rs)
127{
128 struct rds_header *hdr = &inc->i_hdr;
129 unsigned int pos = 0, type, len;
130 union {

--- 27 unchanged lines hidden (view full) ---

158
159static void rds_recv_hs_exthdrs(struct rds_header *hdr,
160 struct rds_connection *conn)
161{
162 unsigned int pos = 0, type, len;
163 union {
164 struct rds_ext_header_version version;
165 u16 rds_npaths;
153/*
154 * Process all extension headers that come with this message.
155 */
156static void rds_recv_incoming_exthdrs(struct rds_incoming *inc, struct rds_sock *rs)
157{
158 struct rds_header *hdr = &inc->i_hdr;
159 unsigned int pos = 0, type, len;
160 union {

--- 27 unchanged lines hidden (view full) ---

188
189static void rds_recv_hs_exthdrs(struct rds_header *hdr,
190 struct rds_connection *conn)
191{
192 unsigned int pos = 0, type, len;
193 union {
194 struct rds_ext_header_version version;
195 u16 rds_npaths;
196 u32 rds_gen_num;
166 } buffer;
197 } buffer;
198 u32 new_peer_gen_num = 0;
167
168 while (1) {
169 len = sizeof(buffer);
170 type = rds_message_next_extension(hdr, &pos, &buffer, &len);
171 if (type == RDS_EXTHDR_NONE)
172 break;
173 /* Process extension header here */
174 switch (type) {
175 case RDS_EXTHDR_NPATHS:
176 conn->c_npaths = min_t(int, RDS_MPATH_WORKERS,
177 buffer.rds_npaths);
178 break;
199
200 while (1) {
201 len = sizeof(buffer);
202 type = rds_message_next_extension(hdr, &pos, &buffer, &len);
203 if (type == RDS_EXTHDR_NONE)
204 break;
205 /* Process extension header here */
206 switch (type) {
207 case RDS_EXTHDR_NPATHS:
208 conn->c_npaths = min_t(int, RDS_MPATH_WORKERS,
209 buffer.rds_npaths);
210 break;
211 case RDS_EXTHDR_GEN_NUM:
212 new_peer_gen_num = buffer.rds_gen_num;
213 break;
179 default:
180 pr_warn_ratelimited("ignoring unknown exthdr type "
181 "0x%x\n", type);
182 }
183 }
184 /* if RDS_EXTHDR_NPATHS was not found, default to a single-path */
185 conn->c_npaths = max_t(int, conn->c_npaths, 1);
214 default:
215 pr_warn_ratelimited("ignoring unknown exthdr type "
216 "0x%x\n", type);
217 }
218 }
219 /* if RDS_EXTHDR_NPATHS was not found, default to a single-path */
220 conn->c_npaths = max_t(int, conn->c_npaths, 1);
221 rds_conn_peer_gen_update(conn, new_peer_gen_num);
186}
187
188/* rds_start_mprds() will synchronously start multiple paths when appropriate.
189 * The scheme is based on the following rules:
190 *
191 * 1. rds_sendmsg on first connect attempt sends the probe ping, with the
192 * sender's npaths (s_npaths)
193 * 2. rcvr of probe-ping knows the mprds_paths = min(s_npaths, r_npaths). It

--- 472 unchanged lines hidden ---
222}
223
224/* rds_start_mprds() will synchronously start multiple paths when appropriate.
225 * The scheme is based on the following rules:
226 *
227 * 1. rds_sendmsg on first connect attempt sends the probe ping, with the
228 * sender's npaths (s_npaths)
229 * 2. rcvr of probe-ping knows the mprds_paths = min(s_npaths, r_npaths). It

--- 472 unchanged lines hidden ---