Skip to content

Commit

Permalink
Stream-Rail distribution with addr + port
Browse files Browse the repository at this point in the history
When the stream forward the stream data, it used the peer address to
determine the endpoint in the rail to forward the data. This patch adds
`port` into the calculation as well to increase the stream data
distribution among the endpoints in the rail.
  • Loading branch information
narategithub committed Jul 1, 2024
1 parent 4c6a017 commit 53aa7a5
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions ldms/src/core/ldms_stream.c
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,7 @@ __remote_client_cb(ldms_stream_event_t ev, void *cb_arg)
ldms_rail_t r;
int ep_idx;
int rc;
uint64_t addr_port;
if (ev->type == LDMS_STREAM_EVENT_CLOSE)
return 0;
assert( ev->type == LDMS_STREAM_EVENT_RECV );
Expand All @@ -270,10 +271,14 @@ __remote_client_cb(ldms_stream_event_t ev, void *cb_arg)
ep_idx = 0;
break;
case AF_INET:
ep_idx = ( be32toh(*(int*)&ev->recv.src.addr[0]) % primer ) % r->n_eps;
addr_port = be32toh(*(int*)&ev->recv.src.addr[0]);
addr_port = (addr_port<<16) | be16toh(ev->recv.src.sin_port);
ep_idx = ( addr_port % primer ) % r->n_eps;
break;
case AF_INET6:
ep_idx = ( be32toh(*(int*)&ev->recv.src.addr[12]) % primer ) % r->n_eps;
addr_port = be32toh(*(int*)&ev->recv.src.addr[12]);
addr_port = (addr_port<<16) | be16toh(ev->recv.src.sin_port);
ep_idx = ( addr_port % primer ) % r->n_eps;
break;
default:
assert(0 == "Unexpected network family");
Expand Down

0 comments on commit 53aa7a5

Please sign in to comment.