1270631Sjfv/******************************************************************************
2270631Sjfv
3270631Sjfv  Copyright (c) 2013-2014, Intel Corporation
4270631Sjfv  All rights reserved.
5270631Sjfv
6270631Sjfv  Redistribution and use in source and binary forms, with or without
7270631Sjfv  modification, are permitted provided that the following conditions are met:
8270631Sjfv
9270631Sjfv   1. Redistributions of source code must retain the above copyright notice,
10270631Sjfv      this list of conditions and the following disclaimer.
11270631Sjfv
12270631Sjfv   2. Redistributions in binary form must reproduce the above copyright
13270631Sjfv      notice, this list of conditions and the following disclaimer in the
14270631Sjfv      documentation and/or other materials provided with the distribution.
15270631Sjfv
16270631Sjfv   3. Neither the name of the Intel Corporation nor the names of its
17270631Sjfv      contributors may be used to endorse or promote products derived from
18270631Sjfv      this software without specific prior written permission.
19270631Sjfv
20270631Sjfv  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21270631Sjfv  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22270631Sjfv  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23270631Sjfv  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
24270631Sjfv  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
25270631Sjfv  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
26270631Sjfv  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
27270631Sjfv  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
28270631Sjfv  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
29270631Sjfv  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
30270631Sjfv  POSSIBILITY OF SUCH DAMAGE.
31270631Sjfv
32270631Sjfv******************************************************************************/
33270631Sjfv/*$FreeBSD: releng/10.2/sys/dev/ixl/ixl_pf.h 270631 2014-08-25 22:04:29Z jfv $*/
34270631Sjfv
35270631Sjfv
36270631Sjfv#ifndef _IXL_PF_H_
37270631Sjfv#define _IXL_PF_H_
38270631Sjfv
39270631Sjfv/* Physical controller structure */
40270631Sjfvstruct ixl_pf {
41270631Sjfv	struct i40e_hw		hw;
42270631Sjfv	struct i40e_osdep	osdep;
43270631Sjfv	struct device		*dev;
44270631Sjfv
45270631Sjfv	struct resource		*pci_mem;
46270631Sjfv	struct resource		*msix_mem;
47270631Sjfv
48270631Sjfv	/*
49270631Sjfv	 * Interrupt resources: this set is
50270631Sjfv	 * either used for legacy, or for Link
51270631Sjfv	 * when doing MSIX
52270631Sjfv	 */
53270631Sjfv	void			*tag;
54270631Sjfv	struct resource 	*res;
55270631Sjfv
56270631Sjfv	struct callout		timer;
57270631Sjfv	int			msix;
58270631Sjfv	int			if_flags;
59270631Sjfv
60270631Sjfv	struct mtx		pf_mtx;
61270631Sjfv
62270631Sjfv	u32			qbase;
63270631Sjfv	u32 			admvec;
64270631Sjfv	struct task     	adminq;
65270631Sjfv	struct taskqueue	*tq;
66270631Sjfv
67270631Sjfv	int			advertised_speed;
68270631Sjfv
69270631Sjfv	/*
70270631Sjfv	** VSI - Stations:
71270631Sjfv	**   These are the traffic class holders, and
72270631Sjfv	**   will have a stack interface and queues
73270631Sjfv	**   associated with them.
74270631Sjfv	** NOTE: for now using just one, so embed it.
75270631Sjfv	*/
76270631Sjfv	struct ixl_vsi		vsi;
77270631Sjfv
78270631Sjfv	/* Misc stats maintained by the driver */
79270631Sjfv	u64			watchdog_events;
80270631Sjfv	u64			admin_irq;
81270631Sjfv
82270631Sjfv	/* Statistics from hw */
83270631Sjfv	struct i40e_hw_port_stats 	stats;
84270631Sjfv	struct i40e_hw_port_stats	stats_offsets;
85270631Sjfv	bool 				stat_offsets_loaded;
86270631Sjfv};
87270631Sjfv
88270631Sjfv
89270631Sjfv#define IXL_PF_LOCK_INIT(_sc, _name) \
90270631Sjfv        mtx_init(&(_sc)->pf_mtx, _name, "IXL PF Lock", MTX_DEF)
91270631Sjfv#define IXL_PF_LOCK(_sc)              mtx_lock(&(_sc)->pf_mtx)
92270631Sjfv#define IXL_PF_UNLOCK(_sc)            mtx_unlock(&(_sc)->pf_mtx)
93270631Sjfv#define IXL_PF_LOCK_DESTROY(_sc)      mtx_destroy(&(_sc)->pf_mtx)
94270631Sjfv#define IXL_PF_LOCK_ASSERT(_sc)       mtx_assert(&(_sc)->pf_mtx, MA_OWNED)
95270631Sjfv
96270631Sjfv#endif /* _IXL_PF_H_ */
97