1 /* Intel Ethernet Switch Host Interface Driver
2 * Copyright(c) 2013 - 2014 Intel Corporation.
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.
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
13 * The full GNU General Public License is included in this distribution in
14 * the file called "COPYING".
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
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>
32 #define FM10K_MAX_JUMBO_FRAME_SIZE 15358 /* Maximum supported size 15K */
34 enum fm10k_ring_f_enum
{
37 RING_F_ARRAY_SIZE
/* must be last in enum set */
40 struct 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 */
47 #define fm10k_vxlan_port_for_each(vp, intfc) \
48 list_for_each_entry(vp, &(intfc)->vxlan_port, list)
49 struct fm10k_vxlan_port
{
50 struct list_head list
;
51 sa_family_t sa_family
;
56 unsigned long active_vlans
[BITS_TO_LONGS(VLAN_N_VID
)];
57 struct net_device
*netdev
;
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)
72 struct fm10k_ring_feature ring_feature
[RING_F_ARRAY_SIZE
];
74 struct fm10k_hw_stats stats
;
79 u32 reta
[FM10K_RETA_SIZE
];
80 u32 rssrk
[FM10K_RSSRK_SIZE
];
82 /* VXLAN port tracking information */
83 struct list_head vxlan_port
;
85 #if defined(HAVE_DCBNL_IEEE) && defined(CONFIG_DCB)
90 /* GLORT resources in use by PF */
94 /* VLAN ID for updating multicast/unicast lists */
105 static inline void fm10k_mbx_lock(struct fm10k_intfc
*interface
)
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
110 while (test_and_set_bit(__FM10K_MBX_LOCK
, &interface
->state
))
114 static inline void fm10k_mbx_unlock(struct fm10k_intfc
*interface
)
116 /* flush memory to make sure state is correct */
117 smp_mb__before_atomic();
118 clear_bit(__FM10K_MBX_LOCK
, &interface
->state
);
121 static inline int fm10k_mbx_trylock(struct fm10k_intfc
*interface
)
123 return !test_and_set_bit(__FM10K_MBX_LOCK
, &interface
->state
);
127 extern char fm10k_driver_name
[];
128 extern const char fm10k_driver_version
[];
131 int fm10k_register_pci_driver(void);
132 void fm10k_unregister_pci_driver(void);
135 struct net_device
*fm10k_alloc_netdev(void);
136 #endif /* _FM10K_H_ */