1147191Sjkoshy/******************************************************************************
2174215Sjkoshy
3174215Sjkoshy  Copyright (c) 2013-2014, Intel Corporation
4147191Sjkoshy  All rights reserved.
5147191Sjkoshy
6174215Sjkoshy  Redistribution and use in source and binary forms, with or without
7174215Sjkoshy  modification, are permitted provided that the following conditions are met:
8174215Sjkoshy
9147191Sjkoshy   1. Redistributions of source code must retain the above copyright notice,
10147191Sjkoshy      this list of conditions and the following disclaimer.
11147191Sjkoshy
12147191Sjkoshy   2. Redistributions in binary form must reproduce the above copyright
13147191Sjkoshy      notice, this list of conditions and the following disclaimer in the
14147191Sjkoshy      documentation and/or other materials provided with the distribution.
15147191Sjkoshy
16147191Sjkoshy   3. Neither the name of the Intel Corporation nor the names of its
17147191Sjkoshy      contributors may be used to endorse or promote products derived from
18147191Sjkoshy      this software without specific prior written permission.
19147191Sjkoshy
20147191Sjkoshy  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21147191Sjkoshy  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22147191Sjkoshy  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23147191Sjkoshy  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
24147191Sjkoshy  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
25147191Sjkoshy  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
26147191Sjkoshy  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
27147191Sjkoshy  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
28147191Sjkoshy  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
29147191Sjkoshy  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
30147191Sjkoshy  POSSIBILITY OF SUCH DAMAGE.
31147191Sjkoshy
32147191Sjkoshy******************************************************************************/
33147191Sjkoshy/*$FreeBSD$*/
34147191Sjkoshy
35147191Sjkoshy#ifndef _IXLV_VC_MGR_H_
36147191Sjkoshy#define _IXLV_VC_MGR_H_
37147191Sjkoshy
38147191Sjkoshy#include <sys/queue.h>
39147191Sjkoshy
40147191Sjkoshystruct ixl_vc_cmd;
41147191Sjkoshy
42147191Sjkoshytypedef void ixl_vc_callback_t(struct ixl_vc_cmd *, void *,
43147191Sjkoshy	enum i40e_status_code);
44147191Sjkoshy
45147191Sjkoshy
46147191Sjkoshy#define	IXLV_VC_CMD_FLAG_BUSY		0x0001
47147191Sjkoshy
48147191Sjkoshystruct ixl_vc_cmd
49147191Sjkoshy{
50185363Sjkoshy	uint32_t request;
51185363Sjkoshy	uint32_t flags;
52147191Sjkoshy
53147191Sjkoshy	ixl_vc_callback_t *callback;
54147191Sjkoshy	void *arg;
55147191Sjkoshy
56147191Sjkoshy	TAILQ_ENTRY(ixl_vc_cmd) next;
57147191Sjkoshy};
58147191Sjkoshy
59147191Sjkoshystruct ixl_vc_mgr
60147191Sjkoshy{
61147191Sjkoshy	struct ixlv_sc *sc;
62147191Sjkoshy	struct ixl_vc_cmd *current;
63147191Sjkoshy	struct callout callout;
64147191Sjkoshy
65147191Sjkoshy	TAILQ_HEAD(, ixl_vc_cmd) pending;
66147191Sjkoshy};
67147191Sjkoshy
68147191Sjkoshy#define	IXLV_VC_TIMEOUT			(2 * hz)
69147191Sjkoshy
70147191Sjkoshyvoid	ixl_vc_init_mgr(struct ixlv_sc *, struct ixl_vc_mgr *);
71147191Sjkoshyvoid	ixl_vc_enqueue(struct ixl_vc_mgr *, struct ixl_vc_cmd *,
72147191Sjkoshy	    uint32_t, ixl_vc_callback_t *, void *);
73147191Sjkoshyvoid	ixl_vc_flush(struct ixl_vc_mgr *mgr);
74147191Sjkoshy
75147191Sjkoshy#endif
76147191Sjkoshy
77147191Sjkoshy