Staging: hv: mousevsc: Cleanup and properly implement reportdesc_callback()
[zen-stable.git] / drivers / net / sfc / filter.h
blob872f2132a49626c2ff3a5ac5c99e32ae22e121b6
1 /****************************************************************************
2 * Driver for Solarflare Solarstorm network controllers and boards
3 * Copyright 2005-2010 Solarflare Communications Inc.
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 as published
7 * by the Free Software Foundation, incorporated herein by reference.
8 */
10 #ifndef EFX_FILTER_H
11 #define EFX_FILTER_H
13 #include <linux/types.h>
15 /**
16 * enum efx_filter_type - type of hardware filter
17 * @EFX_FILTER_TCP_FULL: Matching TCP/IPv4 4-tuple
18 * @EFX_FILTER_TCP_WILD: Matching TCP/IPv4 destination (host, port)
19 * @EFX_FILTER_UDP_FULL: Matching UDP/IPv4 4-tuple
20 * @EFX_FILTER_UDP_WILD: Matching UDP/IPv4 destination (host, port)
21 * @EFX_FILTER_MAC_FULL: Matching Ethernet destination MAC address, VID
22 * @EFX_FILTER_MAC_WILD: Matching Ethernet destination MAC address
23 * @EFX_FILTER_UNSPEC: Match type is unspecified
25 * Falcon NICs only support the TCP/IPv4 and UDP/IPv4 filter types.
27 enum efx_filter_type {
28 EFX_FILTER_TCP_FULL = 0,
29 EFX_FILTER_TCP_WILD,
30 EFX_FILTER_UDP_FULL,
31 EFX_FILTER_UDP_WILD,
32 EFX_FILTER_MAC_FULL = 4,
33 EFX_FILTER_MAC_WILD,
34 EFX_FILTER_TYPE_COUNT, /* number of specific types */
35 EFX_FILTER_UNSPEC = 0xf,
38 /**
39 * enum efx_filter_priority - priority of a hardware filter specification
40 * @EFX_FILTER_PRI_HINT: Performance hint
41 * @EFX_FILTER_PRI_MANUAL: Manually configured filter
42 * @EFX_FILTER_PRI_REQUIRED: Required for correct behaviour
44 enum efx_filter_priority {
45 EFX_FILTER_PRI_HINT = 0,
46 EFX_FILTER_PRI_MANUAL,
47 EFX_FILTER_PRI_REQUIRED,
50 /**
51 * enum efx_filter_flags - flags for hardware filter specifications
52 * @EFX_FILTER_FLAG_RX_RSS: Use RSS to spread across multiple queues.
53 * By default, matching packets will be delivered only to the
54 * specified queue. If this flag is set, they will be delivered
55 * to a range of queues offset from the specified queue number
56 * according to the indirection table.
57 * @EFX_FILTER_FLAG_RX_SCATTER: Enable DMA scatter on the receiving
58 * queue.
59 * @EFX_FILTER_FLAG_RX_OVERRIDE_IP: Enables a MAC filter to override
60 * any IP filter that matches the same packet. By default, IP
61 * filters take precedence.
62 * @EFX_FILTER_FLAG_RX: Filter is for RX
64 enum efx_filter_flags {
65 EFX_FILTER_FLAG_RX_RSS = 0x01,
66 EFX_FILTER_FLAG_RX_SCATTER = 0x02,
67 EFX_FILTER_FLAG_RX_OVERRIDE_IP = 0x04,
68 EFX_FILTER_FLAG_RX = 0x08,
71 /**
72 * struct efx_filter_spec - specification for a hardware filter
73 * @type: Type of match to be performed, from &enum efx_filter_type
74 * @priority: Priority of the filter, from &enum efx_filter_priority
75 * @flags: Miscellaneous flags, from &enum efx_filter_flags
76 * @dmaq_id: Source/target queue index
77 * @data: Match data (type-dependent)
79 * Use the efx_filter_set_*() functions to initialise the @type and
80 * @data fields.
82 struct efx_filter_spec {
83 u8 type:4;
84 u8 priority:4;
85 u8 flags;
86 u16 dmaq_id;
87 u32 data[3];
90 static inline void efx_filter_init_rx(struct efx_filter_spec *spec,
91 enum efx_filter_priority priority,
92 enum efx_filter_flags flags,
93 unsigned rxq_id)
95 spec->type = EFX_FILTER_UNSPEC;
96 spec->priority = priority;
97 spec->flags = EFX_FILTER_FLAG_RX | flags;
98 spec->dmaq_id = rxq_id;
101 extern int efx_filter_set_ipv4_local(struct efx_filter_spec *spec, u8 proto,
102 __be32 host, __be16 port);
103 extern int efx_filter_set_ipv4_full(struct efx_filter_spec *spec, u8 proto,
104 __be32 host, __be16 port,
105 __be32 rhost, __be16 rport);
106 extern int efx_filter_set_eth_local(struct efx_filter_spec *spec,
107 u16 vid, const u8 *addr);
108 enum {
109 EFX_FILTER_VID_UNSPEC = 0xffff,
112 #endif /* EFX_FILTER_H */