xref: /freebsd/sys/dev/ixl/ixl_iw.h (revision 71625ec9ad2a9bc8c09784fbd23b759830e0ee5f)
1cb6b8299SEric Joyner /******************************************************************************
2cb6b8299SEric Joyner 
3f4cc2d17SEric Joyner   Copyright (c) 2013-2018, Intel Corporation
4cb6b8299SEric Joyner   All rights reserved.
5cb6b8299SEric Joyner 
6cb6b8299SEric Joyner   Redistribution and use in source and binary forms, with or without
7cb6b8299SEric Joyner   modification, are permitted provided that the following conditions are met:
8cb6b8299SEric Joyner 
9cb6b8299SEric Joyner    1. Redistributions of source code must retain the above copyright notice,
10cb6b8299SEric Joyner       this list of conditions and the following disclaimer.
11cb6b8299SEric Joyner 
12cb6b8299SEric Joyner    2. Redistributions in binary form must reproduce the above copyright
13cb6b8299SEric Joyner       notice, this list of conditions and the following disclaimer in the
14cb6b8299SEric Joyner       documentation and/or other materials provided with the distribution.
15cb6b8299SEric Joyner 
16cb6b8299SEric Joyner    3. Neither the name of the Intel Corporation nor the names of its
17cb6b8299SEric Joyner       contributors may be used to endorse or promote products derived from
18cb6b8299SEric Joyner       this software without specific prior written permission.
19cb6b8299SEric Joyner 
20cb6b8299SEric Joyner   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21cb6b8299SEric Joyner   AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22cb6b8299SEric Joyner   IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23cb6b8299SEric Joyner   ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
24cb6b8299SEric Joyner   LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
25cb6b8299SEric Joyner   CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
26cb6b8299SEric Joyner   SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
27cb6b8299SEric Joyner   INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
28cb6b8299SEric Joyner   CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
29cb6b8299SEric Joyner   ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
30cb6b8299SEric Joyner   POSSIBILITY OF SUCH DAMAGE.
31cb6b8299SEric Joyner 
32cb6b8299SEric Joyner ******************************************************************************/
33cb6b8299SEric Joyner 
34cb6b8299SEric Joyner #ifndef _IXL_IW_H_
35cb6b8299SEric Joyner #define _IXL_IW_H_
36cb6b8299SEric Joyner 
37cb6b8299SEric Joyner #define IXL_IW_MAX_USER_PRIORITY 8
38ceebc2f3SEric Joyner #define IXL_IW_MAX_MSIX	64
39cb6b8299SEric Joyner 
40cb6b8299SEric Joyner struct ixl_iw_msix_mapping {
41cb6b8299SEric Joyner 	u8	itr_indx;
42cb6b8299SEric Joyner 	int	aeq_vector;
43cb6b8299SEric Joyner 	int	ceq_cnt;
44cb6b8299SEric Joyner 	int	*ceq_vector;
45cb6b8299SEric Joyner };
46cb6b8299SEric Joyner 
47cb6b8299SEric Joyner struct ixl_iw_msix {
48cb6b8299SEric Joyner 	int	base;
49cb6b8299SEric Joyner 	int	count;
50cb6b8299SEric Joyner };
51cb6b8299SEric Joyner 
52cb6b8299SEric Joyner struct ixl_iw_pf {
53cb6b8299SEric Joyner 	void		*handle;
54*86803260SJustin Hibbits 	if_t		ifp;
55cb6b8299SEric Joyner 	device_t	dev;
56cb6b8299SEric Joyner 	struct resource	*pci_mem;
57cb6b8299SEric Joyner 	u8		pf_id;
58cb6b8299SEric Joyner 	u16		mtu;
59cb6b8299SEric Joyner 	struct ixl_iw_msix	iw_msix;
60cb6b8299SEric Joyner 	u16	qs_handle[IXL_IW_MAX_USER_PRIORITY];
61cb6b8299SEric Joyner };
62cb6b8299SEric Joyner 
63cb6b8299SEric Joyner struct ixl_iw_ops {
64cb6b8299SEric Joyner 	int (*init)(struct ixl_iw_pf *pf_info);
65cb6b8299SEric Joyner 	int (*stop)(struct ixl_iw_pf *pf_info);
66cb6b8299SEric Joyner };
67cb6b8299SEric Joyner 
68cb6b8299SEric Joyner int	ixl_iw_pf_reset(void *pf_handle);
69cb6b8299SEric Joyner int	ixl_iw_pf_msix_init(void *pf_handle,
70cb6b8299SEric Joyner 	    struct ixl_iw_msix_mapping *msix_info);
71cb6b8299SEric Joyner int	ixl_iw_register(struct ixl_iw_ops *iw_ops);
72cb6b8299SEric Joyner int	ixl_iw_unregister(void);
73cb6b8299SEric Joyner 
74cb6b8299SEric Joyner #endif /* _IXL_IW_H_ */
75