opal/mca/common/libfabric/libfabric/prov/usnic/src/usdf_av.c
/*
 * Called by progression thread to look for AV completions on this domain
 */
Called by progression thread to look for AV completions on this domain
Called by progression thread to look for AV completions on this domain
static void
usdf_av_insert_progress(void *v)
{
	int ret;
	struct usdf_av_insert *insert;
	struct usdf_fabric *fp;
	struct usd_dest *dest;
	struct usdf_av_req *req;
	struct usdf_av_req *tmpreq;
	struct usd_device_attrs *dap;
	uint64_t now;
	uint8_t *eth;
	insert = v;
	fp = insert->avi_av->av_domain->dom_fabric;
	dap = fp->fab_dev_attrs;
	TAILQ_FOREACH_SAFE(req, tmpreq, &insert->avi_req_list, avr_link) {
		dest = req->avr_dest;
		eth = &dest->ds_dest.ds_udp.u_hdr.uh_eth.ether_dhost[0];
		ret = usnic_arp_lookup(dap->uda_ifname,
				req->avr_daddr_be, fp->fab_arp_sockfd, eth);
		if (ret != EAGAIN) {
			TAILQ_REMOVE(&insert->avi_req_list, req, avr_link);
			req->avr_status = -ret;
			if (ret == 0) {
				++insert->avi_successes;
				*(struct usd_dest **)req->avr_fi_addr = dest;
			} else {
				usdf_post_insert_request_error(insert, req);
			}
		}
	}
	now = usdf_get_ms();
	if (now - insert->avi_last_arp_time > USDF_AV_ARP_INTERVAL) {
		if (insert->avi_arps_left == 0) {
			TAILQ_FOREACH(req, &insert->avi_req_list, avr_link) {
				req->avr_status = -FI_EHOSTUNREACH;
				usdf_post_insert_request_error(insert, req);
			}
			TAILQ_INIT(&insert->avi_req_list);
		} else {
			TAILQ_FOREACH_SAFE(req, tmpreq,
					&insert->avi_req_list, avr_link) {
				ret = usnic_arp_request(req->avr_daddr_be,
						fp->fab_arp_sockfd);
				if (ret != 0) {
					req->avr_status = -ret;
					TAILQ_REMOVE(&insert->avi_req_list,
							req, avr_link);
					usdf_post_insert_request_error(insert,
							req);
				}
			}
			insert->avi_last_arp_time = now;
			--insert->avi_arps_left;
		}
	}
	if (TAILQ_EMPTY(&insert->avi_req_list)) {
		usdf_av_insert_async_complete(insert);
	} else {
		usdf_timer_set(fp, insert->avi_timer, 1);
	}
}
static void usdf_av_insert_progress ( void * v ) { int ret ; struct usdf_av_insert * insert ; struct usdf_fabric * fp ; struct usd_dest * dest ; struct usdf_av_req * req ; struct usdf_av_req * tmpreq ; struct usd_device_attrs * dap ; uint64_t now ; uint8_t * eth ; insert = v ; fp = insert -> avi_av -> av_domain -> dom_fabric ; dap = fp -> fab_dev_attrs ; TAILQ_FOREACH_SAFE ( req , tmpreq , & insert -> avi_req_list , avr_link ) { dest = req -> avr_dest ; eth = & dest -> ds_dest . ds_udp . u_hdr . uh_eth . ether_dhost [ 0 ] ; ret = usnic_arp_lookup ( dap -> uda_ifname , req -> avr_daddr_be , fp -> fab_arp_sockfd , eth ) ; if ( ret != EAGAIN ) { TAILQ_REMOVE ( & insert -> avi_req_list , req , avr_link ) ; req -> avr_status = - ret ; if ( ret == 0 ) { ++ insert -> avi_successes ; * ( struct usd_dest * * ) req -> avr_fi_addr = dest ; } else { usdf_post_insert_request_error ( insert , req ) ; } } } now = usdf_get_ms ( ) ; if ( now - insert -> avi_last_arp_time > USDF_AV_ARP_INTERVAL ) { if ( insert -> avi_arps_left == 0 ) { TAILQ_FOREACH ( req , & insert -> avi_req_list , avr_link ) { req -> avr_status = - FI_EHOSTUNREACH ; usdf_post_insert_request_error ( insert , req ) ; } TAILQ_INIT ( & insert -> avi_req_list ) ; } else { TAILQ_FOREACH_SAFE ( req , tmpreq , & insert -> avi_req_list , avr_link ) { ret = usnic_arp_request ( req -> avr_daddr_be , fp -> fab_arp_sockfd ) ; if ( ret != 0 ) { req -> avr_status = - ret ; TAILQ_REMOVE ( & insert -> avi_req_list , req , avr_link ) ; usdf_post_insert_request_error ( insert , req ) ; } } insert -> avi_last_arp_time = now ; -- insert -> avi_arps_left ; } } if ( TAILQ_EMPTY ( & insert -> avi_req_list ) ) { usdf_av_insert_async_complete ( insert ) ; } else { usdf_timer_set ( fp , insert -> avi_timer , 1 ) ; } }
Called by progression thread to look for AV completions on this domain
Called by progression thread to look for AV completions on this domain
/* anything besides -EAGAIN means request is completed */ /* Time for a new ARP? */ /* If no more ARP requests left, fail all remaining requests */ /* Trigger an ARP request for all pending requests */ /* If no more pending requests, all done! */ /* retry in 1 ms */