DMOVERIO(4) Kernel Interfaces Manual DMOVERIO(4)

NAME

dmoveriohardware-assisted data mover interface

SYNOPSIS

pseudo-device dmoverio


#include <dev/dmover/dmover_io.h>

DESCRIPTION

The dmoverio pseudo-device driver provides an interface to hardware-assisted data movers, which the kernel supports using the dmover(9) facility. This can be used to copy data from one location in memory to another, clear a region of memory, fill a region of memory with a pattern, and perform simple operations on multiple regions of memory, such as an XOR, without intervention by the CPU.

A dmoverio function always has one output region. A function may have zero or more input regions, or may use an immediate value as an input. For functions which use input regions, the lengths of each input region and the output region must be the same. All dmoverio functions with the same name will have the same number of and type inputs.

To use dmoverio, the client must first create a session. This is achieved by performing the following steps:

To submit a request for processing the following steps must be performed:

When a client is finished using a dmoverio session, the session is destroyed by closing the session handle using close(2).

EXAMPLES

The following is an example of a client using dmoverio to zero-fill a region of memory. In this example, the application would be able to perform other work while the hardware-assisted data mover clears the specified block of memory.

int 
hw_bzero(void *buf, size_t len) 
{ 
	static uint32_t reqid; 
 
	struct dmio_setfunc dsf; 
	struct iovec iov; 
	struct dmio_usrreq req; 
	struct dmio_usrresp resp; 
	int fd; 
 
	fd = open("/dev/dmoverio", O_RDWR, 0666); 
	if (fd == -1) 
		return (-1); 
 
	strcpy(dsf.dsf_name, "zero"); 
 
	if (ioctl(fd, DMIO_SETFUNC, &dsf) == -1) { 
		close(fd); 
		return (-1); 
	} 
 
	iov.iov_base = buf; 
	iov.iov_len = len; 
 
	req.req_outbuf.dmbuf_iov = &iov; 
	req.req_outbuf.dmbuf_iovcnt = 1; 
	req.req_id = reqid++; 
 
	if (write(fd, &req, sizeof(req)) != sizeof(req)) { 
		close(fd); 
		return (-1); 
	} 
 
	/* Application can do other work here. */ 
 
	if (read(fd, &resp, sizeof(resp)) != sizeof(resp)) { 
		close(fd); 
		return (-1); 
	} 
 
	if (resp.resp_id != req.req_id) { 
		close(fd); 
		return (-1); 
	} 
 
	if (resp.resp_error != 0) { 
		close(fd); 
		return (-1); 
	} 
 
	close(fd); 
	return (0); 
}

SEE ALSO

dmover(9)

HISTORY

The dmoverio device first appeared in NetBSD 2.0.

AUTHORS

The dmoverio device was designed and implemented by Jason R. Thorpe <thorpej@wasabisystems.com> and contributed by Wasabi Systems, Inc.
August 1, 2002 NetBSD 6.1