Merge tag 'driver-core-4.6-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git...
[deliverable/linux.git] / drivers / net / ethernet / intel / ixgbe / ixgbe_model.h
CommitLineData
9d35cf06
JF
1/*******************************************************************************
2 *
3 * Intel 10 Gigabit PCI Express Linux drive
a92265ce 4 * Copyright(c) 2016 Intel Corporation.
9d35cf06
JF
5 *
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.
9 *
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
13 * more details.
14 *
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/>.
17 *
18 * The full GNU General Public License is included in this distribution in
19 * the file called "COPYING".
20 *
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
24 *
25 ******************************************************************************/
26
27#ifndef _IXGBE_MODEL_H_
28#define _IXGBE_MODEL_H_
29
30#include "ixgbe.h"
31#include "ixgbe_type.h"
32
33struct ixgbe_mat_field {
34 unsigned int off;
9d35cf06
JF
35 int (*val)(struct ixgbe_fdir_filter *input,
36 union ixgbe_atr_input *mask,
fa477f4c 37 u32 val, u32 m);
9d35cf06
JF
38 unsigned int type;
39};
40
41static inline int ixgbe_mat_prgm_sip(struct ixgbe_fdir_filter *input,
42 union ixgbe_atr_input *mask,
fa477f4c 43 u32 val, u32 m)
9d35cf06
JF
44{
45 input->filter.formatted.src_ip[0] = val;
46 mask->formatted.src_ip[0] = m;
47 return 0;
48}
49
50static inline int ixgbe_mat_prgm_dip(struct ixgbe_fdir_filter *input,
51 union ixgbe_atr_input *mask,
fa477f4c 52 u32 val, u32 m)
9d35cf06
JF
53{
54 input->filter.formatted.dst_ip[0] = val;
55 mask->formatted.dst_ip[0] = m;
56 return 0;
57}
58
59static struct ixgbe_mat_field ixgbe_ipv4_fields[] = {
ebd83ad8 60 { .off = 12, .val = ixgbe_mat_prgm_sip,
9d35cf06 61 .type = IXGBE_ATR_FLOW_TYPE_IPV4},
ebd83ad8 62 { .off = 16, .val = ixgbe_mat_prgm_dip,
9d35cf06
JF
63 .type = IXGBE_ATR_FLOW_TYPE_IPV4},
64 { .val = NULL } /* terminal node */
65};
66
b5aea3de 67static inline int ixgbe_mat_prgm_ports(struct ixgbe_fdir_filter *input,
9d35cf06 68 union ixgbe_atr_input *mask,
fa477f4c 69 u32 val, u32 m)
9d35cf06
JF
70{
71 input->filter.formatted.src_port = val & 0xffff;
72 mask->formatted.src_port = m & 0xffff;
b5aea3de
SS
73 input->filter.formatted.dst_port = val >> 16;
74 mask->formatted.dst_port = m >> 16;
9d35cf06 75
9d35cf06
JF
76 return 0;
77};
78
79static struct ixgbe_mat_field ixgbe_tcp_fields[] = {
b5aea3de 80 {.off = 0, .val = ixgbe_mat_prgm_ports,
9d35cf06
JF
81 .type = IXGBE_ATR_FLOW_TYPE_TCPV4},
82 { .val = NULL } /* terminal node */
83};
84
85struct ixgbe_nexthdr {
86 /* offset, shift, and mask of position to next header */
87 unsigned int o;
fa477f4c
JF
88 u32 s;
89 u32 m;
9d35cf06
JF
90 /* match criteria to make this jump*/
91 unsigned int off;
fa477f4c
JF
92 u32 val;
93 u32 mask;
9d35cf06
JF
94 /* location of jump to make */
95 struct ixgbe_mat_field *jump;
96};
97
98static struct ixgbe_nexthdr ixgbe_ipv4_jumps[] = {
99 { .o = 0, .s = 6, .m = 0xf,
100 .off = 8, .val = 0x600, .mask = 0xff00, .jump = ixgbe_tcp_fields},
101 { .jump = NULL } /* terminal node */
102};
103#endif /* _IXGBE_MODEL_H_ */
This page took 0.043147 seconds and 5 git commands to generate.