1 /*******************************************************************************
3 * Intel 10 Gigabit PCI Express Linux drive
4 * Copyright(c) 2016 Intel Corporation.
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms and conditions of the GNU General Public License,
8 * version 2, as published by the Free Software Foundation.
10 * This program is distributed in the hope it will be useful, but WITHOUT
11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
15 * You should have received a copy of the GNU General Public License along
16 * with this program. If not, see <http://www.gnu.org/licenses/>.
18 * The full GNU General Public License is included in this distribution in
19 * the file called "COPYING".
21 * Contact Information:
22 * e1000-devel Mailing List <e1000-devel@lists.sourceforge.net>
23 * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
25 ******************************************************************************/
27 #ifndef _IXGBE_MODEL_H_
28 #define _IXGBE_MODEL_H_
31 #include "ixgbe_type.h"
33 struct ixgbe_mat_field
{
35 int (*val
)(struct ixgbe_fdir_filter
*input
,
36 union ixgbe_atr_input
*mask
,
41 struct ixgbe_jump_table
{
42 struct ixgbe_mat_field
*mat
;
43 struct ixgbe_fdir_filter
*input
;
44 union ixgbe_atr_input
*mask
;
47 static inline int ixgbe_mat_prgm_sip(struct ixgbe_fdir_filter
*input
,
48 union ixgbe_atr_input
*mask
,
51 input
->filter
.formatted
.src_ip
[0] = val
;
52 mask
->formatted
.src_ip
[0] = m
;
56 static inline int ixgbe_mat_prgm_dip(struct ixgbe_fdir_filter
*input
,
57 union ixgbe_atr_input
*mask
,
60 input
->filter
.formatted
.dst_ip
[0] = val
;
61 mask
->formatted
.dst_ip
[0] = m
;
65 static struct ixgbe_mat_field ixgbe_ipv4_fields
[] = {
66 { .off
= 12, .val
= ixgbe_mat_prgm_sip
,
67 .type
= IXGBE_ATR_FLOW_TYPE_IPV4
},
68 { .off
= 16, .val
= ixgbe_mat_prgm_dip
,
69 .type
= IXGBE_ATR_FLOW_TYPE_IPV4
},
70 { .val
= NULL
} /* terminal node */
73 static inline int ixgbe_mat_prgm_ports(struct ixgbe_fdir_filter
*input
,
74 union ixgbe_atr_input
*mask
,
77 input
->filter
.formatted
.src_port
= val
& 0xffff;
78 mask
->formatted
.src_port
= m
& 0xffff;
79 input
->filter
.formatted
.dst_port
= val
>> 16;
80 mask
->formatted
.dst_port
= m
>> 16;
85 static struct ixgbe_mat_field ixgbe_tcp_fields
[] = {
86 {.off
= 0, .val
= ixgbe_mat_prgm_ports
,
87 .type
= IXGBE_ATR_FLOW_TYPE_TCPV4
},
88 { .val
= NULL
} /* terminal node */
91 static struct ixgbe_mat_field ixgbe_udp_fields
[] = {
92 {.off
= 0, .val
= ixgbe_mat_prgm_ports
,
93 .type
= IXGBE_ATR_FLOW_TYPE_UDPV4
},
94 { .val
= NULL
} /* terminal node */
97 struct ixgbe_nexthdr
{
98 /* offset, shift, and mask of position to next header */
102 /* match criteria to make this jump*/
106 /* location of jump to make */
107 struct ixgbe_mat_field
*jump
;
110 static struct ixgbe_nexthdr ixgbe_ipv4_jumps
[] = {
111 { .o
= 0, .s
= 6, .m
= 0xf,
112 .off
= 8, .val
= 0x600, .mask
= 0xff00, .jump
= ixgbe_tcp_fields
},
113 { .o
= 0, .s
= 6, .m
= 0xf,
114 .off
= 8, .val
= 0x1100, .mask
= 0xff00, .jump
= ixgbe_udp_fields
},
115 { .jump
= NULL
} /* terminal node */
117 #endif /* _IXGBE_MODEL_H_ */