fm10k: Add netdev
[deliverable/linux.git] / drivers / net / ethernet / intel / fm10k / fm10k.h
CommitLineData
b3890e30
AD
1/* Intel Ethernet Switch Host Interface Driver
2 * Copyright(c) 2013 - 2014 Intel Corporation.
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms and conditions of the GNU General Public License,
6 * version 2, as published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope it will be useful, but WITHOUT
9 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
11 * more details.
12 *
13 * The full GNU General Public License is included in this distribution in
14 * the file called "COPYING".
15 *
16 * Contact Information:
17 * e1000-devel Mailing List <e1000-devel@lists.sourceforge.net>
18 * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
19 */
20
21#ifndef _FM10K_H_
22#define _FM10K_H_
23
24#include <linux/types.h>
25#include <linux/etherdevice.h>
26#include <linux/rtnetlink.h>
27#include <linux/if_vlan.h>
28#include <linux/pci.h>
29
0e7b3644
AD
30#include "fm10k_pf.h"
31
32#define FM10K_MAX_JUMBO_FRAME_SIZE 15358 /* Maximum supported size 15K */
33
34enum fm10k_ring_f_enum {
35 RING_F_RSS,
36 RING_F_QOS,
37 RING_F_ARRAY_SIZE /* must be last in enum set */
38};
39
40struct fm10k_ring_feature {
41 u16 limit; /* upper limit on feature indices */
42 u16 indices; /* current value of indices */
43 u16 mask; /* Mask used for feature to ring mapping */
44 u16 offset; /* offset to start of feature */
45};
46
47#define fm10k_vxlan_port_for_each(vp, intfc) \
48 list_for_each_entry(vp, &(intfc)->vxlan_port, list)
49struct fm10k_vxlan_port {
50 struct list_head list;
51 sa_family_t sa_family;
52 __be16 port;
53};
04a5aefb
AD
54
55struct fm10k_intfc {
0e7b3644
AD
56 unsigned long active_vlans[BITS_TO_LONGS(VLAN_N_VID)];
57 struct net_device *netdev;
04a5aefb 58 struct pci_dev *pdev;
0e7b3644
AD
59 unsigned long state;
60
61 u32 flags;
62#define FM10K_FLAG_RESET_REQUESTED (u32)(1 << 0)
63#define FM10K_FLAG_RSS_FIELD_IPV4_UDP (u32)(1 << 1)
64#define FM10K_FLAG_RSS_FIELD_IPV6_UDP (u32)(1 << 2)
65#define FM10K_FLAG_RX_TS_ENABLED (u32)(1 << 3)
66#define FM10K_FLAG_SWPRI_CONFIG (u32)(1 << 4)
67 int xcast_mode;
68
69 u64 rx_overrun_pf;
70 u64 rx_overrun_vf;
04a5aefb 71
0e7b3644
AD
72 struct fm10k_ring_feature ring_feature[RING_F_ARRAY_SIZE];
73
74 struct fm10k_hw_stats stats;
04a5aefb
AD
75 struct fm10k_hw hw;
76 u32 __iomem *uc_addr;
0e7b3644
AD
77 u16 msg_enable;
78
79 u32 reta[FM10K_RETA_SIZE];
80 u32 rssrk[FM10K_RSSRK_SIZE];
81
82 /* VXLAN port tracking information */
83 struct list_head vxlan_port;
84
85#if defined(HAVE_DCBNL_IEEE) && defined(CONFIG_DCB)
86 u8 pfc_en;
87#endif
88 u8 rx_pause;
89
90 /* GLORT resources in use by PF */
91 u16 glort;
92 u16 glort_count;
93
94 /* VLAN ID for updating multicast/unicast lists */
95 u16 vid;
96};
97
98enum fm10k_state_t {
99 __FM10K_RESETTING,
100 __FM10K_DOWN,
101 __FM10K_MBX_LOCK,
102 __FM10K_LINK_DOWN,
04a5aefb 103};
b3890e30 104
0e7b3644
AD
105static inline void fm10k_mbx_lock(struct fm10k_intfc *interface)
106{
107 /* busy loop if we cannot obtain the lock as some calls
108 * such as ndo_set_rx_mode may be made in atomic context
109 */
110 while (test_and_set_bit(__FM10K_MBX_LOCK, &interface->state))
111 udelay(20);
112}
113
114static inline void fm10k_mbx_unlock(struct fm10k_intfc *interface)
115{
116 /* flush memory to make sure state is correct */
117 smp_mb__before_atomic();
118 clear_bit(__FM10K_MBX_LOCK, &interface->state);
119}
120
121static inline int fm10k_mbx_trylock(struct fm10k_intfc *interface)
122{
123 return !test_and_set_bit(__FM10K_MBX_LOCK, &interface->state);
124}
125
b3890e30
AD
126/* main */
127extern char fm10k_driver_name[];
128extern const char fm10k_driver_version[];
129
130/* PCI */
131int fm10k_register_pci_driver(void);
132void fm10k_unregister_pci_driver(void);
0e7b3644
AD
133
134/* Netdev */
135struct net_device *fm10k_alloc_netdev(void);
b3890e30 136#endif /* _FM10K_H_ */
This page took 0.029582 seconds and 5 git commands to generate.