This source file includes following definitions.
- ef4_rx_flush_packet
- ef4_rss_enabled
- ef4_filter_insert_filter
- ef4_filter_remove_id_safe
- ef4_filter_get_filter_safe
- ef4_filter_count_rx_used
- ef4_filter_get_rx_id_limit
- ef4_filter_get_rx_ids
- ef4_filter_rfs_expire
- ef4_filter_rfs_expire
- ef4_mtd_probe
- ef4_mtd_probe
- ef4_mtd_rename
- ef4_mtd_remove
- ef4_schedule_channel
- ef4_schedule_channel_irq
- ef4_device_detach_sync
- ef4_rwsem_assert_write_locked
1
2
3
4
5
6
7
8 #ifndef EF4_EFX_H
9 #define EF4_EFX_H
10
11 #include "net_driver.h"
12 #include "filter.h"
13
14
15
16 #define EF4_MEM_BAR 2
17 #define EF4_MEM_VF_BAR 0
18
19 int ef4_net_open(struct net_device *net_dev);
20 int ef4_net_stop(struct net_device *net_dev);
21
22
23 int ef4_probe_tx_queue(struct ef4_tx_queue *tx_queue);
24 void ef4_remove_tx_queue(struct ef4_tx_queue *tx_queue);
25 void ef4_init_tx_queue(struct ef4_tx_queue *tx_queue);
26 void ef4_init_tx_queue_core_txq(struct ef4_tx_queue *tx_queue);
27 void ef4_fini_tx_queue(struct ef4_tx_queue *tx_queue);
28 netdev_tx_t ef4_hard_start_xmit(struct sk_buff *skb,
29 struct net_device *net_dev);
30 netdev_tx_t ef4_enqueue_skb(struct ef4_tx_queue *tx_queue, struct sk_buff *skb);
31 void ef4_xmit_done(struct ef4_tx_queue *tx_queue, unsigned int index);
32 int ef4_setup_tc(struct net_device *net_dev, enum tc_setup_type type,
33 void *type_data);
34 unsigned int ef4_tx_max_skb_descs(struct ef4_nic *efx);
35 extern bool ef4_separate_tx_channels;
36
37
38 void ef4_set_default_rx_indir_table(struct ef4_nic *efx);
39 void ef4_rx_config_page_split(struct ef4_nic *efx);
40 int ef4_probe_rx_queue(struct ef4_rx_queue *rx_queue);
41 void ef4_remove_rx_queue(struct ef4_rx_queue *rx_queue);
42 void ef4_init_rx_queue(struct ef4_rx_queue *rx_queue);
43 void ef4_fini_rx_queue(struct ef4_rx_queue *rx_queue);
44 void ef4_fast_push_rx_descriptors(struct ef4_rx_queue *rx_queue, bool atomic);
45 void ef4_rx_slow_fill(struct timer_list *t);
46 void __ef4_rx_packet(struct ef4_channel *channel);
47 void ef4_rx_packet(struct ef4_rx_queue *rx_queue, unsigned int index,
48 unsigned int n_frags, unsigned int len, u16 flags);
49 static inline void ef4_rx_flush_packet(struct ef4_channel *channel)
50 {
51 if (channel->rx_pkt_n_frags)
52 __ef4_rx_packet(channel);
53 }
54 void ef4_schedule_slow_fill(struct ef4_rx_queue *rx_queue);
55
56 #define EF4_MAX_DMAQ_SIZE 4096UL
57 #define EF4_DEFAULT_DMAQ_SIZE 1024UL
58 #define EF4_MIN_DMAQ_SIZE 512UL
59
60 #define EF4_MAX_EVQ_SIZE 16384UL
61 #define EF4_MIN_EVQ_SIZE 512UL
62
63
64 #define EF4_TSO_MAX_SEGS 100
65
66
67
68
69
70 #define EF4_RXQ_MIN_ENT 128U
71 #define EF4_TXQ_MIN_ENT(efx) (2 * ef4_tx_max_skb_descs(efx))
72
73 static inline bool ef4_rss_enabled(struct ef4_nic *efx)
74 {
75 return efx->rss_spread > 1;
76 }
77
78
79
80 void ef4_mac_reconfigure(struct ef4_nic *efx);
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107 static inline s32 ef4_filter_insert_filter(struct ef4_nic *efx,
108 struct ef4_filter_spec *spec,
109 bool replace_equal)
110 {
111 return efx->type->filter_insert(efx, spec, replace_equal);
112 }
113
114
115
116
117
118
119
120
121
122
123 static inline int ef4_filter_remove_id_safe(struct ef4_nic *efx,
124 enum ef4_filter_priority priority,
125 u32 filter_id)
126 {
127 return efx->type->filter_remove_safe(efx, priority, filter_id);
128 }
129
130
131
132
133
134
135
136
137
138
139
140 static inline int
141 ef4_filter_get_filter_safe(struct ef4_nic *efx,
142 enum ef4_filter_priority priority,
143 u32 filter_id, struct ef4_filter_spec *spec)
144 {
145 return efx->type->filter_get_safe(efx, priority, filter_id, spec);
146 }
147
148 static inline u32 ef4_filter_count_rx_used(struct ef4_nic *efx,
149 enum ef4_filter_priority priority)
150 {
151 return efx->type->filter_count_rx_used(efx, priority);
152 }
153 static inline u32 ef4_filter_get_rx_id_limit(struct ef4_nic *efx)
154 {
155 return efx->type->filter_get_rx_id_limit(efx);
156 }
157 static inline s32 ef4_filter_get_rx_ids(struct ef4_nic *efx,
158 enum ef4_filter_priority priority,
159 u32 *buf, u32 size)
160 {
161 return efx->type->filter_get_rx_ids(efx, priority, buf, size);
162 }
163 #ifdef CONFIG_RFS_ACCEL
164 int ef4_filter_rfs(struct net_device *net_dev, const struct sk_buff *skb,
165 u16 rxq_index, u32 flow_id);
166 bool __ef4_filter_rfs_expire(struct ef4_nic *efx, unsigned quota);
167 static inline void ef4_filter_rfs_expire(struct ef4_channel *channel)
168 {
169 if (channel->rfs_filters_added >= 60 &&
170 __ef4_filter_rfs_expire(channel->efx, 100))
171 channel->rfs_filters_added -= 60;
172 }
173 #define ef4_filter_rfs_enabled() 1
174 #else
175 static inline void ef4_filter_rfs_expire(struct ef4_channel *channel) {}
176 #define ef4_filter_rfs_enabled() 0
177 #endif
178 bool ef4_filter_is_mc_recipient(const struct ef4_filter_spec *spec);
179
180
181 int ef4_channel_dummy_op_int(struct ef4_channel *channel);
182 void ef4_channel_dummy_op_void(struct ef4_channel *channel);
183 int ef4_realloc_channels(struct ef4_nic *efx, u32 rxq_entries, u32 txq_entries);
184
185
186 int ef4_reconfigure_port(struct ef4_nic *efx);
187 int __ef4_reconfigure_port(struct ef4_nic *efx);
188
189
190 extern const struct ethtool_ops ef4_ethtool_ops;
191
192
193 int ef4_reset(struct ef4_nic *efx, enum reset_type method);
194 void ef4_reset_down(struct ef4_nic *efx, enum reset_type method);
195 int ef4_reset_up(struct ef4_nic *efx, enum reset_type method, bool ok);
196 int ef4_try_recovery(struct ef4_nic *efx);
197
198
199 void ef4_schedule_reset(struct ef4_nic *efx, enum reset_type type);
200 unsigned int ef4_usecs_to_ticks(struct ef4_nic *efx, unsigned int usecs);
201 unsigned int ef4_ticks_to_usecs(struct ef4_nic *efx, unsigned int ticks);
202 int ef4_init_irq_moderation(struct ef4_nic *efx, unsigned int tx_usecs,
203 unsigned int rx_usecs, bool rx_adaptive,
204 bool rx_may_override_tx);
205 void ef4_get_irq_moderation(struct ef4_nic *efx, unsigned int *tx_usecs,
206 unsigned int *rx_usecs, bool *rx_adaptive);
207 void ef4_stop_eventq(struct ef4_channel *channel);
208 void ef4_start_eventq(struct ef4_channel *channel);
209
210
211 int ef4_port_dummy_op_int(struct ef4_nic *efx);
212 void ef4_port_dummy_op_void(struct ef4_nic *efx);
213
214
215 void ef4_update_sw_stats(struct ef4_nic *efx, u64 *stats);
216
217
218 #ifdef CONFIG_SFC_FALCON_MTD
219 int ef4_mtd_add(struct ef4_nic *efx, struct ef4_mtd_partition *parts,
220 size_t n_parts, size_t sizeof_part);
221 static inline int ef4_mtd_probe(struct ef4_nic *efx)
222 {
223 return efx->type->mtd_probe(efx);
224 }
225 void ef4_mtd_rename(struct ef4_nic *efx);
226 void ef4_mtd_remove(struct ef4_nic *efx);
227 #else
228 static inline int ef4_mtd_probe(struct ef4_nic *efx) { return 0; }
229 static inline void ef4_mtd_rename(struct ef4_nic *efx) {}
230 static inline void ef4_mtd_remove(struct ef4_nic *efx) {}
231 #endif
232
233 static inline void ef4_schedule_channel(struct ef4_channel *channel)
234 {
235 netif_vdbg(channel->efx, intr, channel->efx->net_dev,
236 "channel %d scheduling NAPI poll on CPU%d\n",
237 channel->channel, raw_smp_processor_id());
238
239 napi_schedule(&channel->napi_str);
240 }
241
242 static inline void ef4_schedule_channel_irq(struct ef4_channel *channel)
243 {
244 channel->event_test_cpu = raw_smp_processor_id();
245 ef4_schedule_channel(channel);
246 }
247
248 void ef4_link_status_changed(struct ef4_nic *efx);
249 void ef4_link_set_advertising(struct ef4_nic *efx, u32);
250 void ef4_link_set_wanted_fc(struct ef4_nic *efx, u8);
251
252 static inline void ef4_device_detach_sync(struct ef4_nic *efx)
253 {
254 struct net_device *dev = efx->net_dev;
255
256
257
258
259
260 netif_tx_lock_bh(dev);
261 netif_device_detach(dev);
262 netif_tx_unlock_bh(dev);
263 }
264
265 static inline bool ef4_rwsem_assert_write_locked(struct rw_semaphore *sem)
266 {
267 if (WARN_ON(down_read_trylock(sem))) {
268 up_read(sem);
269 return false;
270 }
271 return true;
272 }
273
274 #endif