Skip to content

Commit 9dd1996

Browse files
committed
btl/tcp: Clean up some dead code.
The put/get functions can now use the new active messaging protocol provided by btl/base. Signed-off-by: Austen Lauria <[email protected]>
1 parent 532cd9e commit 9dd1996

File tree

4 files changed

+0
-188
lines changed

4 files changed

+0
-188
lines changed

opal/mca/btl/tcp/btl_tcp.c

Lines changed: 0 additions & 145 deletions
Original file line numberDiff line numberDiff line change
@@ -329,151 +329,6 @@ int mca_btl_tcp_send(struct mca_btl_base_module_t *btl, struct mca_btl_base_endp
329329
return mca_btl_tcp_endpoint_send(endpoint, frag);
330330
}
331331

332-
static void fake_rdma_complete(mca_btl_base_module_t *btl, mca_btl_base_endpoint_t *endpoint,
333-
mca_btl_base_descriptor_t *desc, int rc)
334-
{
335-
mca_btl_tcp_frag_t *frag = (mca_btl_tcp_frag_t *) desc;
336-
337-
frag->cb.func(btl, endpoint, frag->segments[0].seg_addr.pval, NULL, frag->cb.context,
338-
frag->cb.data, rc);
339-
}
340-
341-
/**
342-
* Initiate an asynchronous put.
343-
*/
344-
345-
int mca_btl_tcp_put(mca_btl_base_module_t *btl, struct mca_btl_base_endpoint_t *endpoint,
346-
void *local_address, uint64_t remote_address,
347-
mca_btl_base_registration_handle_t *local_handle,
348-
mca_btl_base_registration_handle_t *remote_handle, size_t size, int flags,
349-
int order, mca_btl_base_rdma_completion_fn_t cbfunc, void *cbcontext,
350-
void *cbdata)
351-
{
352-
mca_btl_tcp_module_t *tcp_btl = (mca_btl_tcp_module_t *) btl;
353-
mca_btl_tcp_frag_t *frag = NULL;
354-
int i;
355-
356-
MCA_BTL_TCP_FRAG_ALLOC_USER(frag);
357-
if (OPAL_UNLIKELY(NULL == frag)) {
358-
return OPAL_ERR_OUT_OF_RESOURCE;
359-
}
360-
361-
frag->endpoint = endpoint;
362-
363-
frag->segments->seg_len = size;
364-
frag->segments->seg_addr.pval = local_address;
365-
366-
frag->base.des_segments = frag->segments;
367-
frag->base.des_segment_count = 1;
368-
frag->base.order = MCA_BTL_NO_ORDER;
369-
370-
frag->segments[0].seg_addr.pval = local_address;
371-
frag->segments[0].seg_len = size;
372-
373-
frag->segments[1].seg_addr.lval = remote_address;
374-
frag->segments[1].seg_len = size;
375-
if (endpoint->endpoint_nbo) {
376-
MCA_BTL_BASE_SEGMENT_HTON(frag->segments[1]);
377-
}
378-
379-
frag->base.des_flags = MCA_BTL_DES_FLAGS_BTL_OWNERSHIP | MCA_BTL_DES_SEND_ALWAYS_CALLBACK;
380-
frag->base.des_cbfunc = fake_rdma_complete;
381-
382-
frag->cb.func = cbfunc;
383-
frag->cb.data = cbdata;
384-
frag->cb.context = cbcontext;
385-
386-
frag->btl = tcp_btl;
387-
frag->endpoint = endpoint;
388-
frag->rc = 0;
389-
frag->iov_idx = 0;
390-
frag->hdr.size = 0;
391-
frag->iov_cnt = 2;
392-
frag->iov_ptr = frag->iov;
393-
frag->iov[0].iov_base = (IOVBASE_TYPE *) &frag->hdr;
394-
frag->iov[0].iov_len = sizeof(frag->hdr);
395-
frag->iov[1].iov_base = (IOVBASE_TYPE *) (frag->segments + 1);
396-
frag->iov[1].iov_len = sizeof(mca_btl_base_segment_t);
397-
for (i = 0; i < (int) frag->base.des_segment_count; i++) {
398-
frag->hdr.size += frag->segments[i].seg_len;
399-
frag->iov[i + 2].iov_len = frag->segments[i].seg_len;
400-
frag->iov[i + 2].iov_base = (IOVBASE_TYPE *) frag->segments[i].seg_addr.pval;
401-
frag->iov_cnt++;
402-
}
403-
frag->hdr.base.tag = MCA_BTL_TAG_BTL;
404-
frag->hdr.type = MCA_BTL_TCP_HDR_TYPE_PUT;
405-
frag->hdr.count = 1;
406-
if (endpoint->endpoint_nbo) {
407-
MCA_BTL_TCP_HDR_HTON(frag->hdr);
408-
}
409-
return ((i = mca_btl_tcp_endpoint_send(endpoint, frag)) >= 0 ? OPAL_SUCCESS : i);
410-
}
411-
412-
/**
413-
* Initiate an asynchronous get.
414-
*/
415-
416-
int mca_btl_tcp_get(mca_btl_base_module_t *btl, struct mca_btl_base_endpoint_t *endpoint,
417-
void *local_address, uint64_t remote_address,
418-
mca_btl_base_registration_handle_t *local_handle,
419-
mca_btl_base_registration_handle_t *remote_handle, size_t size, int flags,
420-
int order, mca_btl_base_rdma_completion_fn_t cbfunc, void *cbcontext,
421-
void *cbdata)
422-
{
423-
mca_btl_tcp_module_t *tcp_btl = (mca_btl_tcp_module_t *) btl;
424-
mca_btl_tcp_frag_t *frag = NULL;
425-
int rc;
426-
427-
MCA_BTL_TCP_FRAG_ALLOC_USER(frag);
428-
if (OPAL_UNLIKELY(NULL == frag)) {
429-
return OPAL_ERR_OUT_OF_RESOURCE;
430-
;
431-
}
432-
433-
frag->endpoint = endpoint;
434-
435-
frag->segments->seg_len = size;
436-
frag->segments->seg_addr.pval = local_address;
437-
438-
frag->base.des_segments = frag->segments;
439-
frag->base.des_segment_count = 1;
440-
frag->base.order = MCA_BTL_NO_ORDER;
441-
442-
frag->segments[0].seg_addr.pval = local_address;
443-
frag->segments[0].seg_len = size;
444-
445-
frag->segments[1].seg_addr.lval = remote_address;
446-
frag->segments[1].seg_len = size;
447-
448-
/* call the rdma callback through the descriptor callback. this is
449-
* tcp so the extra latency is not an issue */
450-
frag->base.des_flags = MCA_BTL_DES_FLAGS_BTL_OWNERSHIP | MCA_BTL_DES_SEND_ALWAYS_CALLBACK;
451-
frag->base.des_cbfunc = fake_rdma_complete;
452-
453-
frag->cb.func = cbfunc;
454-
frag->cb.data = cbdata;
455-
frag->cb.context = cbcontext;
456-
457-
frag->btl = tcp_btl;
458-
frag->endpoint = endpoint;
459-
frag->rc = 0;
460-
frag->iov_idx = 0;
461-
frag->hdr.size = 0;
462-
frag->iov_cnt = 2;
463-
frag->iov_ptr = frag->iov;
464-
frag->iov[0].iov_base = (IOVBASE_TYPE *) &frag->hdr;
465-
frag->iov[0].iov_len = sizeof(frag->hdr);
466-
frag->iov[1].iov_base = (IOVBASE_TYPE *) &frag->segments[1];
467-
frag->iov[1].iov_len = sizeof(mca_btl_base_segment_t);
468-
frag->hdr.base.tag = MCA_BTL_TAG_BTL;
469-
frag->hdr.type = MCA_BTL_TCP_HDR_TYPE_GET;
470-
frag->hdr.count = 1;
471-
if (endpoint->endpoint_nbo) {
472-
MCA_BTL_TCP_HDR_HTON(frag->hdr);
473-
}
474-
return ((rc = mca_btl_tcp_endpoint_send(endpoint, frag)) >= 0 ? OPAL_SUCCESS : rc);
475-
}
476-
477332
/*
478333
* Cleanup/release module resources.
479334
*/

opal/mca/btl/tcp/btl_tcp.h

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -251,28 +251,6 @@ extern int mca_btl_tcp_send(struct mca_btl_base_module_t *btl,
251251
struct mca_btl_base_endpoint_t *btl_peer,
252252
struct mca_btl_base_descriptor_t *descriptor, mca_btl_base_tag_t tag);
253253

254-
/**
255-
* Initiate an asynchronous put.
256-
*/
257-
258-
int mca_btl_tcp_put(mca_btl_base_module_t *btl, struct mca_btl_base_endpoint_t *endpoint,
259-
void *local_address, uint64_t remote_address,
260-
mca_btl_base_registration_handle_t *local_handle,
261-
mca_btl_base_registration_handle_t *remote_handle, size_t size, int flags,
262-
int order, mca_btl_base_rdma_completion_fn_t cbfunc, void *cbcontext,
263-
void *cbdata);
264-
265-
/**
266-
* Initiate an asynchronous get.
267-
*/
268-
269-
int mca_btl_tcp_get(mca_btl_base_module_t *btl, struct mca_btl_base_endpoint_t *endpoint,
270-
void *local_address, uint64_t remote_address,
271-
mca_btl_base_registration_handle_t *local_handle,
272-
mca_btl_base_registration_handle_t *remote_handle, size_t size, int flags,
273-
int order, mca_btl_base_rdma_completion_fn_t cbfunc, void *cbcontext,
274-
void *cbdata);
275-
276254
/**
277255
* Allocate a descriptor with a segment of the requested size.
278256
* Note that the BTL layer may choose to return a smaller size

opal/mca/btl/tcp/btl_tcp_frag.c

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -288,25 +288,6 @@ bool mca_btl_tcp_frag_recv(mca_btl_tcp_frag_t *frag, int sd)
288288
goto repeat;
289289
}
290290
break;
291-
case MCA_BTL_TCP_HDR_TYPE_PUT:
292-
if (frag->iov_idx == 1) {
293-
frag->iov[1].iov_base = (IOVBASE_TYPE *) frag->segments;
294-
frag->iov[1].iov_len = frag->hdr.count * sizeof(mca_btl_base_segment_t);
295-
frag->iov_cnt++;
296-
goto repeat;
297-
} else if (frag->iov_idx == 2) {
298-
for (i = 0; i < frag->hdr.count; i++) {
299-
if (btl_endpoint->endpoint_nbo) {
300-
MCA_BTL_BASE_SEGMENT_NTOH(frag->segments[i]);
301-
}
302-
frag->iov[i + 2].iov_base = (IOVBASE_TYPE *) frag->segments[i].seg_addr.pval;
303-
frag->iov[i + 2].iov_len = frag->segments[i].seg_len;
304-
}
305-
frag->iov_cnt += frag->hdr.count;
306-
goto repeat;
307-
}
308-
break;
309-
case MCA_BTL_TCP_HDR_TYPE_GET:
310291
default:
311292
break;
312293
}

opal/mca/btl/tcp/btl_tcp_hdr.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,6 @@ BEGIN_C_DECLS
3030
*/
3131

3232
#define MCA_BTL_TCP_HDR_TYPE_SEND 1
33-
#define MCA_BTL_TCP_HDR_TYPE_PUT 2
34-
#define MCA_BTL_TCP_HDR_TYPE_GET 3
3533
#define MCA_BTL_TCP_HDR_TYPE_FIN 4
3634
/* The MCA_BTL_TCP_HDR_TYPE_FIN is a special kind of message sent during normal
3735
* connexion closing. Before the endpoint closes the socket, it performs a

0 commit comments

Comments
 (0)