FreeBSD/sys/dev/mxge/if_mxge.c
/*
 * copy an array of mcp_kreq_ether_send_t's to the mcp.  Copy
 * at most 32 bytes at a time, so as to avoid involving the software
 * pio handler in the nic.   We re-write the first segment's flags
 * to mark them valid only after writing the entire chain
 */
copy an array of mcp_kreq_ether_send_t's to the mcp.  Copy
at most 32 bytes at a time, so as to avoid involving the software
pio handler in the nic.   We re-write the first segment's flags
to mark them valid only after writing the entire chain
copy an array of mcp_kreq_ether_send_t ' s to the mcp . Copy at most 32 bytes at a time so as to avoid involving the software pio handler in the nic . We re - write the first segment ' s flags to mark them valid only after writing the entire chain
static inline void
mxge_submit_req(mxge_tx_ring_t *tx, mcp_kreq_ether_send_t *src,
		  int cnt)
{
	int idx, i;
	uint32_t *src_ints;
	volatile uint32_t *dst_ints;
	mcp_kreq_ether_send_t *srcp;
	volatile mcp_kreq_ether_send_t *dstp, *dst;
	uint8_t last_flags;
	idx = tx->req & tx->mask;
	last_flags = src->flags;
	src->flags = 0;
	wmb();
	dst = dstp = &tx->lanai[idx];
	srcp = src;
	if ((idx + cnt) < tx->mask) {
		for (i = 0; i < (cnt - 1); i += 2) {
			mxge_pio_copy(dstp, srcp, 2 * sizeof(*src));
			wmb(); 
			srcp += 2;
			dstp += 2;
		}
	} else {
		mxge_submit_req_backwards(tx, src, cnt);
		i = 0;
	}
	if (i < cnt) {
		mxge_pio_copy(dstp, srcp, sizeof(*src));
		wmb(); 
	}
	src->flags = last_flags;
	src_ints = (uint32_t *)src;
	src_ints+=3;
	dst_ints = (volatile uint32_t *)dst;
	dst_ints+=3;
	*dst_ints =  *src_ints;
	tx->req += cnt;
	wmb();
}
static inline void mxge_submit_req ( mxge_tx_ring_t * tx , mcp_kreq_ether_send_t * src , int cnt ) { int idx , i ; uint32_t * src_ints ; volatile uint32_t * dst_ints ; mcp_kreq_ether_send_t * srcp ; volatile mcp_kreq_ether_send_t * dstp , * dst ; uint8_t last_flags ; idx = tx -> req & tx -> mask ; last_flags = src -> flags ; src -> flags = 0 ; wmb ( ) ; dst = dstp = & tx -> lanai [ idx ] ; srcp = src ; if ( ( idx + cnt ) < tx -> mask ) { for ( i = 0 ; i < ( cnt - 1 ) ; i += 2 ) { mxge_pio_copy ( dstp , srcp , 2 * sizeof ( * src ) ) ; wmb ( ) ; srcp += 2 ; dstp += 2 ; } } else { mxge_submit_req_backwards ( tx , src , cnt ) ; i = 0 ; } if ( i < cnt ) { mxge_pio_copy ( dstp , srcp , sizeof ( * src ) ) ; wmb ( ) ; } src -> flags = last_flags ; src_ints = ( uint32_t * ) src ; src_ints += 3 ; dst_ints = ( volatile uint32_t * ) dst ; dst_ints += 3 ; * dst_ints = * src_ints ; tx -> req += cnt ; wmb ( ) ; }
copy an array of mcp_kreq_ether_send_t's to the mcp.
copy an array of mcp_kreq_ether_send_t ' s to the mcp .
/* force write every 32 bytes */ /* submit all but the first request, and ensure
		   that it is submitted below */ /* submit the first request */ /* barrier before setting valid flag */ /* re-write the last 32-bits with the valid flags */