Date: Thu, 7 Jan 2016 23:02:15 +0000 (UTC) From: "Conrad E. Meyer" <cem@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r293390 - in head: share/man/man4 sys/dev/ioat Message-ID: <201601072302.u07N2FsR085492@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: cem Date: Thu Jan 7 23:02:15 2016 New Revision: 293390 URL: https://svnweb.freebsd.org/changeset/base/293390 Log: ioat(4): Add ioat_acquire_reserve() KPI ioat_acquire_reserve() is an extended version of ioat_acquire(). It allows users to reserve space in the channel for some number of descriptors. If this succeeds, it guarantees that at least submission of N valid descriptors will succeed. Sponsored by: EMC / Isilon Storage Division Modified: head/share/man/man4/ioat.4 head/sys/dev/ioat/ioat.c head/sys/dev/ioat/ioat.h Modified: head/share/man/man4/ioat.4 ============================================================================== --- head/share/man/man4/ioat.4 Thu Jan 7 22:59:09 2016 (r293389) +++ head/share/man/man4/ioat.4 Thu Jan 7 23:02:15 2016 (r293390) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd January 5, 2016 +.Dd January 7, 2016 .Dt IOAT 4 .Os .Sh NAME @@ -73,6 +73,8 @@ In .Fn ioat_get_max_coalesce_period "bus_dmaengine_t dmaengine" .Ft void .Fn ioat_acquire "bus_dmaengine_t dmaengine" +.Ft int +.Fn ioat_acquire_reserve "bus_dmaengine_t dmaengine" "uint32_t n" "int mflags" .Ft void .Fn ioat_release "bus_dmaengine_t dmaengine" .Ft struct bus_dmadesc * @@ -178,6 +180,14 @@ When the user wants to offload a copy, t the .Ar bus_dmaengine_t object for exclusive access to enqueue operations on that channel. +Optionally, the user can reserve space by using +.Fn ioat_acquire_reserve +instead. +If +.Fn ioat_acquire_reserve +succeeds, there is guaranteed to be room for +.Fa N +new operations in the internal ring buffer. Then, they will submit one or more operations using .Fn ioat_blockfill , .Fn ioat_copy , Modified: head/sys/dev/ioat/ioat.c ============================================================================== --- head/sys/dev/ioat/ioat.c Thu Jan 7 22:59:09 2016 (r293389) +++ head/sys/dev/ioat/ioat.c Thu Jan 7 23:02:15 2016 (r293390) @@ -789,6 +789,21 @@ ioat_acquire(bus_dmaengine_t dmaengine) CTR0(KTR_IOAT, __func__); } +int +ioat_acquire_reserve(bus_dmaengine_t dmaengine, unsigned n, int mflags) +{ + struct ioat_softc *ioat; + int error; + + ioat = to_ioat_softc(dmaengine); + ioat_acquire(dmaengine); + + error = ioat_reserve_space(ioat, n, mflags); + if (error != 0) + ioat_release(dmaengine); + return (error); +} + void ioat_release(bus_dmaengine_t dmaengine) { Modified: head/sys/dev/ioat/ioat.h ============================================================================== --- head/sys/dev/ioat/ioat.h Thu Jan 7 22:59:09 2016 (r293389) +++ head/sys/dev/ioat/ioat.h Thu Jan 7 23:02:15 2016 (r293390) @@ -96,13 +96,26 @@ uint16_t ioat_get_max_coalesce_period(bu /* * Acquire must be called before issuing an operation to perform. Release is - * called after. Multiple operations can be issued within the context of one + * called after. Multiple operations can be issued within the context of one * acquire and release */ void ioat_acquire(bus_dmaengine_t dmaengine); void ioat_release(bus_dmaengine_t dmaengine); /* + * Acquire_reserve can be called to ensure there is room for N descriptors. If + * it succeeds, the next N valid operations will successfully enqueue. + * + * It may fail with: + * - ENXIO if the channel is in an errored state, or the driver is being + * unloaded + * - EAGAIN if mflags included M_NOWAIT + * + * On failure, the caller does not hold the dmaengine. + */ +int ioat_acquire_reserve(bus_dmaengine_t dmaengine, unsigned n, int mflags); + +/* * Issue a blockfill operation. The 64-bit pattern 'fillpattern' is written to * 'len' physically contiguous bytes at 'dst'. *
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201601072302.u07N2FsR085492>