1298010Simp/*- 2298010Simp * CAM IO Scheduler Interface 3298010Simp * 4298010Simp * Copyright (c) 2015 Netflix, Inc. 5298010Simp * All rights reserved. 6298010Simp * 7298010Simp * Redistribution and use in source and binary forms, with or without 8298010Simp * modification, are permitted provided that the following conditions 9298010Simp * are met: 10298010Simp * 1. Redistributions of source code must retain the above copyright 11298010Simp * notice, this list of conditions, and the following disclaimer, 12298010Simp * without modification, immediately at the beginning of the file. 13298010Simp * 2. The name of the author may not be used to endorse or promote products 14298010Simp * derived from this software without specific prior written permission. 15298010Simp * 16298010Simp * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 17298010Simp * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18298010Simp * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19298010Simp * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR 20298010Simp * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 21298010Simp * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 22298010Simp * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 23298010Simp * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 24298010Simp * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 25298010Simp * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 26298010Simp * SUCH DAMAGE. 27298010Simp * 28298010Simp * $FreeBSD$ 29298010Simp */ 30298010Simp 31298010Simp#ifndef _CAM_CAM_IOSCHED_H 32298010Simp#define _CAM_CAM_IOSCHED_H 33298010Simp 34298010Simp/* No user-servicable parts in here. */ 35298010Simp#ifdef _KERNEL 36298010Simp 37298010Simp/* Forward declare all structs to keep interface thin */ 38298010Simpstruct cam_iosched_softc; 39298010Simpstruct sysctl_ctx_list; 40298010Simpstruct sysctl_oid; 41298010Simpunion ccb; 42298010Simpstruct bio; 43298010Simp 44298010Simpint cam_iosched_init(struct cam_iosched_softc **, struct cam_periph *periph); 45298010Simpvoid cam_iosched_fini(struct cam_iosched_softc *); 46298010Simpvoid cam_iosched_sysctl_init(struct cam_iosched_softc *, struct sysctl_ctx_list *, struct sysctl_oid *); 47298010Simpstruct bio *cam_iosched_next_trim(struct cam_iosched_softc *isc); 48298010Simpstruct bio *cam_iosched_get_trim(struct cam_iosched_softc *isc); 49298010Simpstruct bio *cam_iosched_next_bio(struct cam_iosched_softc *isc); 50298010Simpvoid cam_iosched_queue_work(struct cam_iosched_softc *isc, struct bio *bp); 51298010Simpvoid cam_iosched_flush(struct cam_iosched_softc *isc, struct devstat *stp, int err); 52298010Simpvoid cam_iosched_schedule(struct cam_iosched_softc *isc, struct cam_periph *periph); 53298010Simpvoid cam_iosched_finish_trim(struct cam_iosched_softc *isc); 54298010Simpvoid cam_iosched_submit_trim(struct cam_iosched_softc *isc); 55298010Simpvoid cam_iosched_put_back_trim(struct cam_iosched_softc *isc, struct bio *bp); 56298010Simpvoid cam_iosched_set_sort_queue(struct cam_iosched_softc *isc, int val); 57298010Simpint cam_iosched_has_work_flags(struct cam_iosched_softc *isc, uint32_t flags); 58298010Simpvoid cam_iosched_set_work_flags(struct cam_iosched_softc *isc, uint32_t flags); 59298010Simpvoid cam_iosched_clr_work_flags(struct cam_iosched_softc *isc, uint32_t flags); 60298010Simpvoid cam_iosched_trim_done(struct cam_iosched_softc *isc); 61298010Simpint cam_iosched_bio_complete(struct cam_iosched_softc *isc, struct bio *bp, union ccb *done_ccb); 62298010Simp 63298010Simp#endif 64298010Simp#endif 65