pFad - Phone/Frame/Anonymizer/Declutterfier! Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

URL: http://github.com/PlatformLab/HomaModule/commit/72a3964d8a92a4b30b57277b6b58b35e4eddfd19

in="anonymous" media="all" rel="stylesheet" href="https://github.githubassets.com/assets/global-7a1ad343bd40328c.css" /> Remove unused 'created' parameter from homa_rpc_alloc_server · PlatformLab/HomaModule@72a3964 · GitHub
Skip to content

Commit 72a3964

Browse files
breakerttjohnousterhout
authored andcommitted
Remove unused 'created' parameter from homa_rpc_alloc_server
Closes #78
1 parent c2cd259 commit 72a3964

6 files changed

Lines changed: 20 additions & 59 deletions

File tree

homa_incoming.c

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -520,14 +520,11 @@ void homa_dispatch_pkts(struct sk_buff *skb)
520520
if (!homa_is_client(id)) {
521521
/* We are the server for this RPC. */
522522
if (h->common.type == DATA) {
523-
int created;
524-
525523
/* Create a new RPC if one doesn't
526524
* already exist.
527525
*/
528526
rpc = homa_rpc_alloc_server(hsk, &saddr,
529-
h,
530-
&created);
527+
h);
531528
if (IS_ERR(rpc)) {
532529
INC_METRIC(server_cant_create_rpcs, 1);
533530
rpc = NULL;

homa_rpc.c

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -108,16 +108,14 @@ struct homa_rpc *homa_rpc_alloc_client(struct homa_sock *hsk,
108108
* @source: IP address (network byte order) of the RPC's client.
109109
* @h: Header for the first data packet received for this RPC; used
110110
* to initialize the RPC.
111-
* @created: Will be set to 1 if a new RPC was created and 0 if an
112-
* existing RPC was found.
113111
*
114112
* Return: A pointer to a new RPC, which is locked, or a negative errno
115113
* if an error occurred. If there is already an RPC corresponding
116114
* to h, then it is returned instead of creating a new RPC.
117115
*/
118116
struct homa_rpc *homa_rpc_alloc_server(struct homa_sock *hsk,
119117
const struct in6_addr *source,
120-
struct homa_data_hdr *h, int *created)
118+
struct homa_data_hdr *h)
121119
__cond_acquires(srpc->bucket->lock)
122120
{
123121
u64 id = homa_local_id(h->common.sender_id);
@@ -140,7 +138,6 @@ struct homa_rpc *homa_rpc_alloc_server(struct homa_sock *hsk,
140138
/* RPC already exists; just return it instead
141139
* of creating a new RPC.
142140
*/
143-
*created = 0;
144141
return srpc;
145142
}
146143
}
@@ -204,7 +201,6 @@ struct homa_rpc *homa_rpc_alloc_server(struct homa_sock *hsk,
204201
homa_rpc_handoff(srpc);
205202
}
206203
INC_METRIC(requests_received, 1);
207-
*created = 1;
208204
return srpc;
209205

210206
error:

homa_rpc.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -483,7 +483,7 @@ struct homa_rpc
483483
struct homa_rpc
484484
*homa_rpc_alloc_server(struct homa_sock *hsk,
485485
const struct in6_addr *source,
486-
struct homa_data_hdr *h, int *created);
486+
struct homa_data_hdr *h);
487487
void homa_rpc_end(struct homa_rpc *rpc);
488488
struct homa_rpc
489489
*homa_rpc_find_client(struct homa_sock *hsk, u64 id);

test/unit_homa_incoming.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -151,11 +151,9 @@ TEST_F(homa_incoming, homa_message_in_init__basics)
151151
TEST_F(homa_incoming, homa_message_in_init__message_too_long)
152152
{
153153
struct homa_rpc *srpc;
154-
int created;
155154

156155
self->data.message_length = htonl(HOMA_MAX_MESSAGE_LENGTH+1);
157-
srpc = homa_rpc_alloc_server(&self->hsk, self->client_ip, &self->data,
158-
&created);
156+
srpc = homa_rpc_alloc_server(&self->hsk, self->client_ip, &self->data);
159157
ASSERT_TRUE(IS_ERR(srpc));
160158
EXPECT_EQ(EINVAL, -PTR_ERR(srpc));
161159
}

test/unit_homa_rpc.c

Lines changed: 14 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -132,91 +132,74 @@ TEST_F(homa_rpc, homa_rpc_alloc_client__socket_shutdown)
132132
TEST_F(homa_rpc, homa_rpc_alloc_server__normal)
133133
{
134134
struct homa_rpc *srpc;
135-
int created;
136135

137-
srpc = homa_rpc_alloc_server(&self->hsk, self->client_ip, &self->data,
138-
&created);
136+
srpc = homa_rpc_alloc_server(&self->hsk, self->client_ip, &self->data);
139137
ASSERT_FALSE(IS_ERR(srpc));
140138
homa_rpc_unlock(srpc);
141139
self->data.message_length = N(1600);
142140
homa_data_pkt(mock_skb_alloc(self->client_ip, &self->data.common,
143141
1400, 0), srpc);
144142
EXPECT_EQ(RPC_INCOMING, srpc->state);
145143
EXPECT_EQ(1, unit_list_length(&self->hsk.active_rpcs));
146-
EXPECT_EQ(1, created);
147144
homa_rpc_end(srpc);
148145
}
149146
TEST_F(homa_rpc, homa_rpc_alloc_server__no_buffer_pool)
150147
{
151148
struct homa_rpc *srpc;
152-
int created;
153149

154150
homa_pool_free(self->hsk.buffer_pool);
155151
self->hsk.buffer_pool = NULL;
156-
srpc = homa_rpc_alloc_server(&self->hsk, self->client_ip, &self->data,
157-
&created);
152+
srpc = homa_rpc_alloc_server(&self->hsk, self->client_ip, &self->data);
158153
EXPECT_TRUE(IS_ERR(srpc));
159154
EXPECT_EQ(ENOMEM, -PTR_ERR(srpc));
160155
EXPECT_EQ(0, unit_list_length(&self->hsk.active_rpcs));
161156
}
162157
TEST_F(homa_rpc, homa_rpc_alloc_server__already_exists)
163158
{
164159
struct homa_rpc *srpc1, *srpc2, *srpc3;
165-
int created;
166160

167-
srpc1 = homa_rpc_alloc_server(&self->hsk, self->client_ip, &self->data,
168-
&created);
161+
srpc1 = homa_rpc_alloc_server(&self->hsk, self->client_ip, &self->data);
169162
ASSERT_FALSE(IS_ERR(srpc1));
170163
homa_rpc_unlock(srpc1);
171164
self->data.common.sender_id = cpu_to_be64(
172165
be64_to_cpu(self->data.common.sender_id)
173166
+ 2*HOMA_SERVER_RPC_BUCKETS);
174-
srpc2 = homa_rpc_alloc_server(&self->hsk, self->client_ip, &self->data,
175-
&created);
167+
srpc2 = homa_rpc_alloc_server(&self->hsk, self->client_ip, &self->data);
176168
ASSERT_FALSE(IS_ERR(srpc2));
177-
EXPECT_EQ(1, created);
178169
homa_rpc_unlock(srpc2);
179170
EXPECT_NE(srpc2, srpc1);
180171
self->data.common.sender_id = cpu_to_be64(
181172
be64_to_cpu(self->data.common.sender_id)
182173
- 2*HOMA_SERVER_RPC_BUCKETS);
183-
srpc3 = homa_rpc_alloc_server(&self->hsk, self->client_ip, &self->data,
184-
&created);
174+
srpc3 = homa_rpc_alloc_server(&self->hsk, self->client_ip, &self->data);
185175
ASSERT_FALSE(IS_ERR(srpc3));
186-
EXPECT_EQ(0, created);
187176
homa_rpc_unlock(srpc3);
188177
EXPECT_EQ(srpc3, srpc1);
189178
}
190179
TEST_F(homa_rpc, homa_rpc_alloc_server__malloc_error)
191180
{
192181
struct homa_rpc *srpc;
193-
int created;
194182

195183
mock_kmalloc_errors = 1;
196-
srpc = homa_rpc_alloc_server(&self->hsk, self->client_ip, &self->data,
197-
&created);
184+
srpc = homa_rpc_alloc_server(&self->hsk, self->client_ip, &self->data);
198185
EXPECT_TRUE(IS_ERR(srpc));
199186
EXPECT_EQ(ENOMEM, -PTR_ERR(srpc));
200187
}
201188
TEST_F(homa_rpc, homa_rpc_alloc_server__addr_error)
202189
{
203190
struct homa_rpc *srpc;
204-
int created;
205191

206192
mock_route_errors = 1;
207-
srpc = homa_rpc_alloc_server(&self->hsk, self->client_ip, &self->data,
208-
&created);
193+
srpc = homa_rpc_alloc_server(&self->hsk, self->client_ip, &self->data);
209194
EXPECT_TRUE(IS_ERR(srpc));
210195
EXPECT_EQ(EHOSTUNREACH, -PTR_ERR(srpc));
211196
}
212197
TEST_F(homa_rpc, homa_rpc_alloc_server__socket_shutdown)
213198
{
214199
struct homa_rpc *srpc;
215-
int created;
216200

217201
self->hsk.shutdown = 1;
218-
srpc = homa_rpc_alloc_server(&self->hsk, self->client_ip, &self->data,
219-
&created);
202+
srpc = homa_rpc_alloc_server(&self->hsk, self->client_ip, &self->data);
220203
EXPECT_TRUE(IS_ERR(srpc));
221204
EXPECT_EQ(ESHUTDOWN, -PTR_ERR(srpc));
222205
EXPECT_EQ(0, unit_list_length(&self->hsk.active_rpcs));
@@ -225,11 +208,9 @@ TEST_F(homa_rpc, homa_rpc_alloc_server__socket_shutdown)
225208
TEST_F(homa_rpc, homa_rpc_alloc_server__allocate_buffers)
226209
{
227210
struct homa_rpc *srpc;
228-
int created;
229211

230212
self->data.message_length = N(3*HOMA_BPAGE_SIZE);
231-
srpc = homa_rpc_alloc_server(&self->hsk, self->client_ip, &self->data,
232-
&created);
213+
srpc = homa_rpc_alloc_server(&self->hsk, self->client_ip, &self->data);
233214
ASSERT_FALSE(IS_ERR(srpc));
234215
homa_rpc_unlock(srpc);
235216
EXPECT_EQ(3, srpc->msgin.num_bpages);
@@ -238,24 +219,20 @@ TEST_F(homa_rpc, homa_rpc_alloc_server__allocate_buffers)
238219
TEST_F(homa_rpc, homa_rpc_alloc_server__cant_allocate_buffers)
239220
{
240221
struct homa_rpc *srpc;
241-
int created;
242222

243223
self->data.message_length = N(1400);
244224
homa_pool_free(self->hsk.buffer_pool);
245225
self->hsk.buffer_pool = homa_pool_alloc(&self->hsk);
246-
srpc = homa_rpc_alloc_server(&self->hsk, self->client_ip, &self->data,
247-
&created);
226+
srpc = homa_rpc_alloc_server(&self->hsk, self->client_ip, &self->data);
248227
ASSERT_TRUE(IS_ERR(srpc));
249228
EXPECT_EQ(ENOMEM, -PTR_ERR(srpc));
250229
}
251230
TEST_F(homa_rpc, homa_rpc_alloc_server__handoff_rpc)
252231
{
253232
struct homa_rpc *srpc;
254-
int created;
255233

256234
self->data.message_length = N(1400);
257-
srpc = homa_rpc_alloc_server(&self->hsk, self->client_ip, &self->data,
258-
&created);
235+
srpc = homa_rpc_alloc_server(&self->hsk, self->client_ip, &self->data);
259236
ASSERT_FALSE(IS_ERR(srpc));
260237
homa_rpc_unlock(srpc);
261238
EXPECT_EQ(RPC_INCOMING, srpc->state);
@@ -266,12 +243,10 @@ TEST_F(homa_rpc, homa_rpc_alloc_server__handoff_rpc)
266243
TEST_F(homa_rpc, homa_rpc_alloc_server__dont_handoff_no_buffers)
267244
{
268245
struct homa_rpc *srpc;
269-
int created;
270246

271247
self->data.message_length = N(1400);
272248
atomic_set(&self->hsk.buffer_pool->free_bpages, 0);
273-
srpc = homa_rpc_alloc_server(&self->hsk, self->client_ip, &self->data,
274-
&created);
249+
srpc = homa_rpc_alloc_server(&self->hsk, self->client_ip, &self->data);
275250
ASSERT_FALSE(IS_ERR(srpc));
276251
homa_rpc_unlock(srpc);
277252
EXPECT_EQ(0, unit_list_length(&self->hsk.ready_rpcs));
@@ -280,12 +255,10 @@ TEST_F(homa_rpc, homa_rpc_alloc_server__dont_handoff_no_buffers)
280255
TEST_F(homa_rpc, homa_rpc_alloc_server__dont_handoff_rpc)
281256
{
282257
struct homa_rpc *srpc;
283-
int created;
284258

285259
self->data.message_length = N(2800);
286260
self->data.seg.offset = N(1400);
287-
srpc = homa_rpc_alloc_server(&self->hsk, self->client_ip, &self->data,
288-
&created);
261+
srpc = homa_rpc_alloc_server(&self->hsk, self->client_ip, &self->data);
289262
ASSERT_FALSE(IS_ERR(srpc));
290263
homa_rpc_unlock(srpc);
291264
EXPECT_EQ(RPC_INCOMING, srpc->state);
@@ -298,15 +271,13 @@ TEST_F(homa_rpc, homa_rpc_alloc_server__dont_handoff_rpc)
298271
TEST_F(homa_rpc, homa_bucket_lock_slow)
299272
{
300273
struct homa_rpc *crpc, *srpc;
301-
int created;
302274

303275
mock_clock_tick = 10;
304276
crpc = homa_rpc_alloc_client(&self->hsk, &self->server_addr);
305277
ASSERT_FALSE(IS_ERR(crpc));
306278
homa_rpc_end(crpc);
307279
homa_rpc_unlock(crpc);
308-
srpc = homa_rpc_alloc_server(&self->hsk, self->client_ip, &self->data,
309-
&created);
280+
srpc = homa_rpc_alloc_server(&self->hsk, self->client_ip, &self->data);
310281
ASSERT_FALSE(IS_ERR(srpc));
311282
homa_rpc_unlock(srpc);
312283

test/utils.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -382,7 +382,7 @@ struct homa_rpc *unit_server_rpc(struct homa_sock *hsk,
382382
struct in6_addr *server_ip, int client_port, int id,
383383
int req_length, int resp_length)
384384
{
385-
int bytes_received, created;
385+
int bytes_received;
386386
struct homa_data_hdr h;
387387
int status;
388388

@@ -397,8 +397,7 @@ struct homa_rpc *unit_server_rpc(struct homa_sock *hsk,
397397
#ifndef __STRIP__ /* See strip.py */
398398
h.incoming = htonl(10000);
399399
#endif /* See strip.py */
400-
struct homa_rpc *srpc = homa_rpc_alloc_server(hsk, client_ip, &h,
401-
&created);
400+
struct homa_rpc *srpc = homa_rpc_alloc_server(hsk, client_ip, &h);
402401

403402
if (IS_ERR(srpc))
404403
return NULL;

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad © 2024 Your Company Name. All rights reserved.





Check this box to remove all script contents from the fetched content.



Check this box to remove all images from the fetched content.


Check this box to remove all CSS styles from the fetched content.


Check this box to keep images inefficiently compressed and original size.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy