1274218Sjfv/******************************************************************************
2274218Sjfv
3349163Serj  Copyright (c) 2013-2019, Intel Corporation
4274218Sjfv  All rights reserved.
5349163Serj
6274218Sjfv  Redistribution and use in source and binary forms, with or without
7274218Sjfv  modification, are permitted provided that the following conditions are met:
8274218Sjfv
9274218Sjfv   1. Redistributions of source code must retain the above copyright notice,
10274218Sjfv      this list of conditions and the following disclaimer.
11274218Sjfv
12274218Sjfv   2. Redistributions in binary form must reproduce the above copyright
13274218Sjfv      notice, this list of conditions and the following disclaimer in the
14274218Sjfv      documentation and/or other materials provided with the distribution.
15274218Sjfv
16274218Sjfv   3. Neither the name of the Intel Corporation nor the names of its
17274218Sjfv      contributors may be used to endorse or promote products derived from
18274218Sjfv      this software without specific prior written permission.
19274218Sjfv
20274218Sjfv  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21274218Sjfv  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22274218Sjfv  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23274218Sjfv  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
24274218Sjfv  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
25274218Sjfv  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
26274218Sjfv  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
27274218Sjfv  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
28274218Sjfv  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
29274218Sjfv  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
30274218Sjfv  POSSIBILITY OF SUCH DAMAGE.
31274218Sjfv
32274218Sjfv******************************************************************************/
33274218Sjfv/*$FreeBSD: stable/11/sys/dev/ixl/ixlv_vc_mgr.h 349163 2019-06-18 00:08:02Z erj $*/
34274218Sjfv
35274218Sjfv#ifndef _IXLV_VC_MGR_H_
36274218Sjfv#define _IXLV_VC_MGR_H_
37274218Sjfv
38274218Sjfv#include <sys/queue.h>
39274218Sjfv
40274218Sjfvstruct ixl_vc_cmd;
41274218Sjfv
42274218Sjfvtypedef void ixl_vc_callback_t(struct ixl_vc_cmd *, void *,
43274218Sjfv	enum i40e_status_code);
44274218Sjfv
45274218Sjfv
46274218Sjfv#define	IXLV_VC_CMD_FLAG_BUSY		0x0001
47274218Sjfv
48274218Sjfvstruct ixl_vc_cmd
49274218Sjfv{
50274218Sjfv	uint32_t request;
51274218Sjfv	uint32_t flags;
52274218Sjfv
53274218Sjfv	ixl_vc_callback_t *callback;
54274218Sjfv	void *arg;
55274218Sjfv
56274218Sjfv	TAILQ_ENTRY(ixl_vc_cmd) next;
57274218Sjfv};
58274218Sjfv
59274218Sjfvstruct ixl_vc_mgr
60274218Sjfv{
61274218Sjfv	struct ixlv_sc *sc;
62274218Sjfv	struct ixl_vc_cmd *current;
63274218Sjfv	struct callout callout;
64274218Sjfv
65274218Sjfv	TAILQ_HEAD(, ixl_vc_cmd) pending;
66274218Sjfv};
67274218Sjfv
68274218Sjfv#define	IXLV_VC_TIMEOUT			(2 * hz)
69274218Sjfv
70274218Sjfvvoid	ixl_vc_init_mgr(struct ixlv_sc *, struct ixl_vc_mgr *);
71274218Sjfvvoid	ixl_vc_enqueue(struct ixl_vc_mgr *, struct ixl_vc_cmd *,
72274218Sjfv	    uint32_t, ixl_vc_callback_t *, void *);
73274218Sjfvvoid	ixl_vc_flush(struct ixl_vc_mgr *mgr);
74274218Sjfv
75274218Sjfv#endif
76274218Sjfv
77