[RFC] zero-copy extensions for rsockets

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]


Before implementing this, I'm looking for feedback.  The following proposal defines user-space APIs to support zero-copy.  The intent is that the use of these extensions is fully compatible with existing calls, allowing applications to make selective use of them.  Although I'm specifically looking at these calls for rsockets, I tried to make these generic enough that they could apply to a wider variety of technologies.

- Sean

--

/* Define option/flag to indicate asynchronous operation */
#define O_ASYNC ...	/* fcntl option */
#define MSG_ASYNC ...	/* send/recv flag */

/*
 * ioq - fd used to report asynchronous completions.
 * sockets/fd's report asynchronous events through an associated ioq
 * ioq is usable with standard calls - fcntl, select, poll, read, etc.
 */
int ioq_create(int flags);
int ioq_add(int ioq, int fd, int flags);
int ioq_del(int ioq, int fd);

/* Reading from an ioq returns this structure */
struct ioq_event {
	int fd;
	int operation;	/* IOREAD, IOWRITE, etc. */
	int result;		/* e.g. bytes transferred */
	int errno;
	void *ptr;		/* context, e.g. address */
};

/* Register memory for zero-copy. */
off_t iomap(int fd, void *addr, size_t len, int prot, int flags, off_t offset);
int iounmap(int fd, off_t offset, size_t len);

/*
 * Zero-copy read and write calls.
 * If fd is nonblocking, then the operation must as asynchronous.
 */
size_t get(int fd, void *buf, size_t count, off_t offset, int flags);
size_t put(int fd, const void *buf, size_t count, off_t offset, int flags);

/* Technology specific operation */
int submit(int fd,
           int operation,	/* IOREAD, IOWRITE, vendor defined, etc. */
           void *context,
           void *request,	/* request structures varies by operation */
           size_t len,		/* size of request structure */
           int flags);

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Home]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Photo]     [Yosemite News]    [Yosemite Photos]    [Free Online Dating]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Devices]

Add to Google Powered by Linux