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
{
36 int (*val
)(struct ixgbe_fdir_filter
*input
,
37 union ixgbe_atr_input
*mask
,
42 static inline int ixgbe_mat_prgm_sip(struct ixgbe_fdir_filter
*input
,
43 union ixgbe_atr_input
*mask
,
46 input
->filter
.formatted
.src_ip
[0] = val
;
47 mask
->formatted
.src_ip
[0] = m
;
51 static inline int ixgbe_mat_prgm_dip(struct ixgbe_fdir_filter
*input
,
52 union ixgbe_atr_input
*mask
,
55 input
->filter
.formatted
.dst_ip
[0] = val
;
56 mask
->formatted
.dst_ip
[0] = m
;
60 static struct ixgbe_mat_field ixgbe_ipv4_fields
[] = {
61 { .off
= 12, .mask
= -1, .val
= ixgbe_mat_prgm_sip
,
62 .type
= IXGBE_ATR_FLOW_TYPE_IPV4
},
63 { .off
= 16, .mask
= -1, .val
= ixgbe_mat_prgm_dip
,
64 .type
= IXGBE_ATR_FLOW_TYPE_IPV4
},
65 { .val
= NULL
} /* terminal node */
68 static inline int ixgbe_mat_prgm_sport(struct ixgbe_fdir_filter
*input
,
69 union ixgbe_atr_input
*mask
,
72 input
->filter
.formatted
.src_port
= val
& 0xffff;
73 mask
->formatted
.src_port
= m
& 0xffff;
77 static inline int ixgbe_mat_prgm_dport(struct ixgbe_fdir_filter
*input
,
78 union ixgbe_atr_input
*mask
,
81 input
->filter
.formatted
.dst_port
= val
& 0xffff;
82 mask
->formatted
.dst_port
= m
& 0xffff;
86 static struct ixgbe_mat_field ixgbe_tcp_fields
[] = {
87 {.off
= 0, .mask
= 0xffff, .val
= ixgbe_mat_prgm_sport
,
88 .type
= IXGBE_ATR_FLOW_TYPE_TCPV4
},
89 {.off
= 2, .mask
= 0xffff, .val
= ixgbe_mat_prgm_dport
,
90 .type
= IXGBE_ATR_FLOW_TYPE_TCPV4
},
91 { .val
= NULL
} /* terminal node */
94 struct ixgbe_nexthdr
{
95 /* offset, shift, and mask of position to next header */
99 /* match criteria to make this jump*/
103 /* location of jump to make */
104 struct ixgbe_mat_field
*jump
;
107 static struct ixgbe_nexthdr ixgbe_ipv4_jumps
[] = {
108 { .o
= 0, .s
= 6, .m
= 0xf,
109 .off
= 8, .val
= 0x600, .mask
= 0xff00, .jump
= ixgbe_tcp_fields
},
110 { .jump
= NULL
} /* terminal node */
112 #endif /* _IXGBE_MODEL_H_ */