/* * Send an ACK */ void opal_btl_usnic_ack_send( opal_btl_usnic_module_t *module, opal_btl_usnic_endpoint_t *endpoint) { opal_btl_usnic_ack_segment_t *ack; /* Get an ACK frag. If we don't get one, just discard this ACK. */ ack = opal_btl_usnic_ack_segment_alloc(module); if (OPAL_UNLIKELY(NULL == ack)) { opal_output(0, "====================== No frag for sending the ACK -- skipped"); abort(); } /* send the seq of the lowest item in the window that we've received */ ack->ss_base.us_btl_header->ack_seq = endpoint->endpoint_next_contig_seq_to_recv - 1; ack->ss_base.us_sg_entry[0].length = sizeof(opal_btl_usnic_btl_header_t); #if MSGDEBUG1 { uint8_t mac[6]; char src_mac[32]; char dest_mac[32]; memset(src_mac, 0, sizeof(src_mac)); memset(dest_mac, 0, sizeof(dest_mac)); opal_btl_usnic_sprintf_mac(src_mac, module->if_mac); opal_btl_usnic_gid_to_mac(&endpoint->endpoint_remote_addr.gid, mac); opal_btl_usnic_sprintf_mac(dest_mac, mac); opal_output(0, "--> Sending ACK, sg_entry length %d, seq %" UDSEQ " to %s, qp %u", ack->ss_base.us_sg_entry[0].length, ack->ss_base.us_btl_header->ack_seq, dest_mac, endpoint->endpoint_remote_addr.qp_num[ack->ss_channel]); } #endif /* Do we need to check the connectivity? If enabled, we'll check the connectivity at either first send to peer X or first ACK to peer X. */ opal_btl_usnic_check_connectivity(module, endpoint); /* send the ACK */ opal_btl_usnic_post_segment(module, endpoint, ack); /* Stats */ ++module->stats.num_ack_sends; return; }
/* * Send an ACK */ void opal_btl_usnic_ack_send( opal_btl_usnic_module_t *module, opal_btl_usnic_endpoint_t *endpoint) { opal_btl_usnic_ack_segment_t *ack; /* Get an ACK frag. If we don't get one, just discard this ACK. */ ack = opal_btl_usnic_ack_segment_alloc(module); if (OPAL_UNLIKELY(NULL == ack)) { opal_output(0, "====================== No frag for sending the ACK -- skipped"); abort(); } /* send the seq of the lowest item in the window that we've received */ ack->ss_base.us_btl_header->ack_seq = endpoint->endpoint_next_contig_seq_to_recv - 1; ack->ss_len = sizeof(opal_btl_usnic_btl_header_t); #if MSGDEBUG1 { char remote_ip[IPV4STRADDRLEN]; struct opal_btl_usnic_modex_t *modex = &endpoint->endpoint_remote_modex; opal_btl_usnic_snprintf_ipv4_addr(remote_ip, sizeof(remote_ip), modex->ipv4_addr, modex->netmask); opal_output(0, "--> Sending ACK, length %d, seq %" UDSEQ " to %s, port %u", ack->ss_len, ack->ss_base.us_btl_header->ack_seq, remote_ip, modex->ports[ack->ss_channel]); } #endif /* Do we need to check the connectivity? If enabled, we'll check the connectivity at either first send to peer X or first ACK to peer X. */ opal_btl_usnic_check_connectivity(module, endpoint); /* send the ACK */ opal_btl_usnic_post_ack(module, endpoint, ack); /* Stats */ ++module->stats.num_ack_sends; return; }