FreeBSD/sys/dev/iser/iser_verbs.c
/**
 * is_iser_tx_desc - Indicate if the completion wr_id
 *     is a TX descriptor or not.
 * @iser_conn: iser connection
 * @wr_id: completion WR identifier
 *
 * Since we cannot rely on wc opcode in FLUSH errors
 * we must work around it by checking if the wr_id address
 * falls in the iser connection rx_descs buffer. If so
 * it is an RX descriptor, otherwize it is a TX.
 */
Indicate if the completion wr_id
is a TX descriptor or not.
@iser_conn: iser connection
@wr_id: completion WR identifier

Since we cannot rely on wc opcode in FLUSH errors
we must work around it by checking if the wr_id address
falls in the iser connection rx_descs buffer. If so
it is an RX descriptor, otherwize it is a TX.
Indicate if the completion wr_id is a TX descriptor or not . @iser_conn : iser connection @wr_id : completion WR identifier Since we cannot rely on wc opcode in FLUSH errors we must work around it by checking if the wr_id address falls in the iser connection rx_descs buffer . If so it is an RX descriptor otherwize it is a TX .
static inline bool
is_iser_tx_desc(struct iser_conn *iser_conn, void *wr_id)
{
	void *start = iser_conn->rx_descs;
	u64 len = iser_conn->num_rx_descs * sizeof(*iser_conn->rx_descs);
	void *end = (void *)((uintptr_t)start + (uintptr_t)len);
	if (start) {
		if (wr_id >= start && wr_id < end)
			return false;
	} else {
		return ((uintptr_t)wr_id != (uintptr_t)iser_conn->login_resp_buf);
	}
	return true;
}
static inline bool is_iser_tx_desc ( struct iser_conn * iser_conn , void * wr_id ) { void * start = iser_conn -> rx_descs ; u64 len = iser_conn -> num_rx_descs * sizeof ( * iser_conn -> rx_descs ) ; void * end = ( void * ) ( ( uintptr_t ) start + ( uintptr_t ) len ) ; if ( start ) { if ( wr_id >= start && wr_id < end ) return false ; } else { return ( ( uintptr_t ) wr_id != ( uintptr_t ) iser_conn -> login_resp_buf ) ; } return true ; }
is_iser_tx_desc - Indicate if the completion wr_id
     is a TX descriptor or not.
is_iser_tx_desc - Indicate if the completion wr_id is a TX descriptor or not .