Skip to content

Commit 3d77c02

Browse files
committed
fix rxr_msg.c
1 parent 038ae4a commit 3d77c02

File tree

2 files changed

+17
-14
lines changed

2 files changed

+17
-14
lines changed

prov/efa/src/rdm/rxr_msg.c

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -182,42 +182,45 @@ ssize_t rxr_msg_generic_send(struct fid_ep *ep, const struct fi_msg *msg,
182182
ssize_t err, ret, use_p2p;
183183
struct rxr_op_entry *tx_entry;
184184
struct efa_rdm_peer *peer;
185-
struct fi_msg_tagged tmsg = {0};
185+
struct fi_msg shm_msg = {0};
186+
struct fi_msg_tagged shm_tmsg = {0};
186187

187188
rxr_ep = container_of(ep, struct rxr_ep, base_ep.util_ep.ep_fid.fid);
188189
assert(msg->iov_count <= rxr_ep->tx_iov_limit);
189190

190-
efa_perfset_start(rxr_ep, perf_efa_tx);
191-
ofi_mutex_lock(&rxr_ep->base_ep.util_ep.lock);
192-
193-
if (OFI_UNLIKELY(is_tx_res_full(rxr_ep))) {
194-
err = -FI_EAGAIN;
195-
goto out;
196-
}
197-
198191
peer = rxr_ep_get_peer(rxr_ep, msg->addr);
199192
assert(peer);
200193

201194
if (peer->is_local && rxr_ep->use_shm_for_tx) {
202195
/*
203196
* AWS Neuron and SynapseAI are currently not supported by the SHM provider.
204197
*/
205-
if (efa_mr_is_neuron(msg->desc[0]) || efa_mr_is_synapseai(msg->desc[0])) {
198+
if (msg->desc && msg->desc[0] && (efa_mr_is_neuron(msg->desc[0]) || efa_mr_is_synapseai(msg->desc[0]))) {
206199
EFA_WARN(FI_LOG_CQ,
207200
"Hmem iface: %s is currently not supported by the SHM provider\n",
208201
fi_tostr(&((struct efa_mr *)msg->desc[0])->peer.iface, FI_TYPE_HMEM_IFACE));
209202
return -FI_EINVAL;
210203
}
211204
if (op == ofi_op_msg) {
212-
return fi_sendmsg(rxr_ep->shm_ep, msg, flags);
205+
rxr_msg_construct(&shm_msg, msg->msg_iov, NULL, msg->iov_count, peer->shm_fiaddr,
206+
msg->context, msg->data);
207+
return fi_sendmsg(rxr_ep->shm_ep, &shm_msg, flags);
213208
} else {
214209
assert(op == ofi_op_tagged);
215-
rxr_tmsg_construct(&tmsg, msg->msg_iov, msg->desc, msg->iov_count, msg->addr,
210+
rxr_tmsg_construct(&shm_tmsg, msg->msg_iov, NULL, msg->iov_count, peer->shm_fiaddr,
216211
msg->context, msg->data, tag);
217-
return fi_tsendmsg(rxr_ep->shm_ep, &tmsg, flags);
212+
return fi_tsendmsg(rxr_ep->shm_ep, &shm_tmsg, flags);
218213
}
219214
}
220215

216+
efa_perfset_start(rxr_ep, perf_efa_tx);
217+
ofi_mutex_lock(&rxr_ep->base_ep.util_ep.lock);
218+
219+
if (OFI_UNLIKELY(is_tx_res_full(rxr_ep))) {
220+
err = -FI_EAGAIN;
221+
goto out;
222+
}
223+
221224
if (peer->flags & EFA_RDM_PEER_IN_BACKOFF) {
222225
err = -FI_EAGAIN;
223226
goto out;

prov/efa/src/rdm/rxr_msg.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ void rxr_msg_update_peer_rx_entry(struct fi_peer_rx_entry *peer_rx_entry,
4747
assert(op == ofi_op_msg || op == ofi_op_tagged);
4848

4949
peer_rx_entry->flags = rx_entry->fi_flags;
50-
peer_rx_entry->desc = &rx_entry->desc[0];
50+
peer_rx_entry->desc = NULL;//&rx_entry->desc[0];
5151
peer_rx_entry->iov = rx_entry->iov;
5252
peer_rx_entry->count = rx_entry->iov_count;
5353
peer_rx_entry->context = rx_entry->cq_entry.op_context;

0 commit comments

Comments
 (0)