xref: /linux/drivers/net/ethernet/intel/ixgbevf/vf.h (revision 3d8fe98f8d5cb303d907d8f94ea6dc1f9a1d8b7a)
1dee1ad47SJeff Kirsher /*******************************************************************************
2dee1ad47SJeff Kirsher 
3dee1ad47SJeff Kirsher   Intel 82599 Virtual Function driver
4dee1ad47SJeff Kirsher   Copyright(c) 1999 - 2010 Intel Corporation.
5dee1ad47SJeff Kirsher 
6dee1ad47SJeff Kirsher   This program is free software; you can redistribute it and/or modify it
7dee1ad47SJeff Kirsher   under the terms and conditions of the GNU General Public License,
8dee1ad47SJeff Kirsher   version 2, as published by the Free Software Foundation.
9dee1ad47SJeff Kirsher 
10dee1ad47SJeff Kirsher   This program is distributed in the hope it will be useful, but WITHOUT
11dee1ad47SJeff Kirsher   ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12dee1ad47SJeff Kirsher   FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
13dee1ad47SJeff Kirsher   more details.
14dee1ad47SJeff Kirsher 
15dee1ad47SJeff Kirsher   You should have received a copy of the GNU General Public License along with
16dee1ad47SJeff Kirsher   this program; if not, write to the Free Software Foundation, Inc.,
17dee1ad47SJeff Kirsher   51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
18dee1ad47SJeff Kirsher 
19dee1ad47SJeff Kirsher   The full GNU General Public License is included in this distribution in
20dee1ad47SJeff Kirsher   the file called "COPYING".
21dee1ad47SJeff Kirsher 
22dee1ad47SJeff Kirsher   Contact Information:
23dee1ad47SJeff Kirsher   e1000-devel Mailing List <e1000-devel@lists.sourceforge.net>
24dee1ad47SJeff Kirsher   Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
25dee1ad47SJeff Kirsher 
26dee1ad47SJeff Kirsher *******************************************************************************/
27dee1ad47SJeff Kirsher 
28dee1ad47SJeff Kirsher #ifndef __IXGBE_VF_H__
29dee1ad47SJeff Kirsher #define __IXGBE_VF_H__
30dee1ad47SJeff Kirsher 
31dee1ad47SJeff Kirsher #include <linux/pci.h>
32dee1ad47SJeff Kirsher #include <linux/delay.h>
33dee1ad47SJeff Kirsher #include <linux/interrupt.h>
34dee1ad47SJeff Kirsher #include <linux/if_ether.h>
35dee1ad47SJeff Kirsher #include <linux/netdevice.h>
36dee1ad47SJeff Kirsher 
37dee1ad47SJeff Kirsher #include "defines.h"
38dee1ad47SJeff Kirsher #include "regs.h"
39dee1ad47SJeff Kirsher #include "mbx.h"
40dee1ad47SJeff Kirsher 
41dee1ad47SJeff Kirsher struct ixgbe_hw;
42dee1ad47SJeff Kirsher 
43dee1ad47SJeff Kirsher /* iterator type for walking multicast address lists */
44dee1ad47SJeff Kirsher typedef u8* (*ixgbe_mc_addr_itr) (struct ixgbe_hw *hw, u8 **mc_addr_ptr,
45dee1ad47SJeff Kirsher 				  u32 *vmdq);
46dee1ad47SJeff Kirsher struct ixgbe_mac_operations {
47dee1ad47SJeff Kirsher 	s32 (*init_hw)(struct ixgbe_hw *);
48dee1ad47SJeff Kirsher 	s32 (*reset_hw)(struct ixgbe_hw *);
49dee1ad47SJeff Kirsher 	s32 (*start_hw)(struct ixgbe_hw *);
50dee1ad47SJeff Kirsher 	s32 (*clear_hw_cntrs)(struct ixgbe_hw *);
51dee1ad47SJeff Kirsher 	enum ixgbe_media_type (*get_media_type)(struct ixgbe_hw *);
52dee1ad47SJeff Kirsher 	u32 (*get_supported_physical_layer)(struct ixgbe_hw *);
53dee1ad47SJeff Kirsher 	s32 (*get_mac_addr)(struct ixgbe_hw *, u8 *);
54dee1ad47SJeff Kirsher 	s32 (*stop_adapter)(struct ixgbe_hw *);
55dee1ad47SJeff Kirsher 	s32 (*get_bus_info)(struct ixgbe_hw *);
56dee1ad47SJeff Kirsher 
57dee1ad47SJeff Kirsher 	/* Link */
58dee1ad47SJeff Kirsher 	s32 (*setup_link)(struct ixgbe_hw *, ixgbe_link_speed, bool, bool);
59dee1ad47SJeff Kirsher 	s32 (*check_link)(struct ixgbe_hw *, ixgbe_link_speed *, bool *, bool);
60dee1ad47SJeff Kirsher 	s32 (*get_link_capabilities)(struct ixgbe_hw *, ixgbe_link_speed *,
61dee1ad47SJeff Kirsher 				     bool *);
62dee1ad47SJeff Kirsher 
63dee1ad47SJeff Kirsher 	/* RAR, Multicast, VLAN */
64dee1ad47SJeff Kirsher 	s32 (*set_rar)(struct ixgbe_hw *, u32, u8 *, u32);
65dee1ad47SJeff Kirsher 	s32 (*set_uc_addr)(struct ixgbe_hw *, u32, u8 *);
66dee1ad47SJeff Kirsher 	s32 (*init_rx_addrs)(struct ixgbe_hw *);
67dee1ad47SJeff Kirsher 	s32 (*update_mc_addr_list)(struct ixgbe_hw *, struct net_device *);
68dee1ad47SJeff Kirsher 	s32 (*enable_mc)(struct ixgbe_hw *);
69dee1ad47SJeff Kirsher 	s32 (*disable_mc)(struct ixgbe_hw *);
70dee1ad47SJeff Kirsher 	s32 (*clear_vfta)(struct ixgbe_hw *);
71dee1ad47SJeff Kirsher 	s32 (*set_vfta)(struct ixgbe_hw *, u32, u32, bool);
72dee1ad47SJeff Kirsher };
73dee1ad47SJeff Kirsher 
74dee1ad47SJeff Kirsher enum ixgbe_mac_type {
75dee1ad47SJeff Kirsher 	ixgbe_mac_unknown = 0,
76dee1ad47SJeff Kirsher 	ixgbe_mac_82599_vf,
77dee1ad47SJeff Kirsher 	ixgbe_mac_X540_vf,
78dee1ad47SJeff Kirsher 	ixgbe_num_macs
79dee1ad47SJeff Kirsher };
80dee1ad47SJeff Kirsher 
81dee1ad47SJeff Kirsher struct ixgbe_mac_info {
82dee1ad47SJeff Kirsher 	struct ixgbe_mac_operations ops;
83dee1ad47SJeff Kirsher 	u8 addr[6];
84dee1ad47SJeff Kirsher 	u8 perm_addr[6];
85dee1ad47SJeff Kirsher 
86dee1ad47SJeff Kirsher 	enum ixgbe_mac_type type;
87dee1ad47SJeff Kirsher 
88dee1ad47SJeff Kirsher 	s32  mc_filter_type;
89dee1ad47SJeff Kirsher 
90dee1ad47SJeff Kirsher 	bool get_link_status;
91dee1ad47SJeff Kirsher 	u32  max_tx_queues;
92dee1ad47SJeff Kirsher 	u32  max_rx_queues;
93dee1ad47SJeff Kirsher 	u32  max_msix_vectors;
94dee1ad47SJeff Kirsher };
95dee1ad47SJeff Kirsher 
96dee1ad47SJeff Kirsher struct ixgbe_mbx_operations {
97dee1ad47SJeff Kirsher 	s32 (*init_params)(struct ixgbe_hw *hw);
98dee1ad47SJeff Kirsher 	s32 (*read)(struct ixgbe_hw *, u32 *, u16);
99dee1ad47SJeff Kirsher 	s32 (*write)(struct ixgbe_hw *, u32 *, u16);
100dee1ad47SJeff Kirsher 	s32 (*read_posted)(struct ixgbe_hw *, u32 *, u16);
101dee1ad47SJeff Kirsher 	s32 (*write_posted)(struct ixgbe_hw *, u32 *, u16);
102dee1ad47SJeff Kirsher 	s32 (*check_for_msg)(struct ixgbe_hw *);
103dee1ad47SJeff Kirsher 	s32 (*check_for_ack)(struct ixgbe_hw *);
104dee1ad47SJeff Kirsher 	s32 (*check_for_rst)(struct ixgbe_hw *);
105dee1ad47SJeff Kirsher };
106dee1ad47SJeff Kirsher 
107dee1ad47SJeff Kirsher struct ixgbe_mbx_stats {
108dee1ad47SJeff Kirsher 	u32 msgs_tx;
109dee1ad47SJeff Kirsher 	u32 msgs_rx;
110dee1ad47SJeff Kirsher 
111dee1ad47SJeff Kirsher 	u32 acks;
112dee1ad47SJeff Kirsher 	u32 reqs;
113dee1ad47SJeff Kirsher 	u32 rsts;
114dee1ad47SJeff Kirsher };
115dee1ad47SJeff Kirsher 
116dee1ad47SJeff Kirsher struct ixgbe_mbx_info {
117dee1ad47SJeff Kirsher 	struct ixgbe_mbx_operations ops;
118dee1ad47SJeff Kirsher 	struct ixgbe_mbx_stats stats;
119dee1ad47SJeff Kirsher 	u32 timeout;
120dee1ad47SJeff Kirsher 	u32 udelay;
121dee1ad47SJeff Kirsher 	u32 v2p_mailbox;
122dee1ad47SJeff Kirsher 	u16 size;
123dee1ad47SJeff Kirsher };
124dee1ad47SJeff Kirsher 
125dee1ad47SJeff Kirsher struct ixgbe_hw {
126dee1ad47SJeff Kirsher 	void *back;
127dee1ad47SJeff Kirsher 
128dee1ad47SJeff Kirsher 	u8 __iomem *hw_addr;
129dee1ad47SJeff Kirsher 
130dee1ad47SJeff Kirsher 	struct ixgbe_mac_info mac;
131dee1ad47SJeff Kirsher 	struct ixgbe_mbx_info mbx;
132dee1ad47SJeff Kirsher 
133dee1ad47SJeff Kirsher 	u16 device_id;
134dee1ad47SJeff Kirsher 	u16 subsystem_vendor_id;
135dee1ad47SJeff Kirsher 	u16 subsystem_device_id;
136dee1ad47SJeff Kirsher 	u16 vendor_id;
137dee1ad47SJeff Kirsher 
138dee1ad47SJeff Kirsher 	u8  revision_id;
139dee1ad47SJeff Kirsher 	bool adapter_stopped;
140dee1ad47SJeff Kirsher };
141dee1ad47SJeff Kirsher 
142dee1ad47SJeff Kirsher struct ixgbevf_hw_stats {
143dee1ad47SJeff Kirsher 	u64 base_vfgprc;
144dee1ad47SJeff Kirsher 	u64 base_vfgptc;
145dee1ad47SJeff Kirsher 	u64 base_vfgorc;
146dee1ad47SJeff Kirsher 	u64 base_vfgotc;
147dee1ad47SJeff Kirsher 	u64 base_vfmprc;
148dee1ad47SJeff Kirsher 
149dee1ad47SJeff Kirsher 	u64 last_vfgprc;
150dee1ad47SJeff Kirsher 	u64 last_vfgptc;
151dee1ad47SJeff Kirsher 	u64 last_vfgorc;
152dee1ad47SJeff Kirsher 	u64 last_vfgotc;
153dee1ad47SJeff Kirsher 	u64 last_vfmprc;
154dee1ad47SJeff Kirsher 
155dee1ad47SJeff Kirsher 	u64 vfgprc;
156dee1ad47SJeff Kirsher 	u64 vfgptc;
157dee1ad47SJeff Kirsher 	u64 vfgorc;
158dee1ad47SJeff Kirsher 	u64 vfgotc;
159dee1ad47SJeff Kirsher 	u64 vfmprc;
160dee1ad47SJeff Kirsher 
161dee1ad47SJeff Kirsher 	u64 saved_reset_vfgprc;
162dee1ad47SJeff Kirsher 	u64 saved_reset_vfgptc;
163dee1ad47SJeff Kirsher 	u64 saved_reset_vfgorc;
164dee1ad47SJeff Kirsher 	u64 saved_reset_vfgotc;
165dee1ad47SJeff Kirsher 	u64 saved_reset_vfmprc;
166dee1ad47SJeff Kirsher };
167dee1ad47SJeff Kirsher 
168dee1ad47SJeff Kirsher struct ixgbevf_info {
169dee1ad47SJeff Kirsher 	enum ixgbe_mac_type		mac;
170*3d8fe98fSStephen Hemminger 	const struct ixgbe_mac_operations *mac_ops;
171dee1ad47SJeff Kirsher };
172dee1ad47SJeff Kirsher 
173dee1ad47SJeff Kirsher #endif /* __IXGBE_VF_H__ */
174dee1ad47SJeff Kirsher 
175