38
38
struct cxgb4_match_field {
39
39
int off ; /* Offset from the beginning of the header to match */
40
40
/* Fill the value/mask pair in the spec if matched */
41
- int (* val )(struct ch_filter_specification * f , u32 val , u32 mask );
41
+ int (* val )(struct ch_filter_specification * f , __be32 val , __be32 mask );
42
42
};
43
43
44
44
/* IPv4 match fields */
45
45
static inline int cxgb4_fill_ipv4_tos (struct ch_filter_specification * f ,
46
- u32 val , u32 mask )
46
+ __be32 val , __be32 mask )
47
47
{
48
48
f -> val .tos = (ntohl (val ) >> 16 ) & 0x000000FF ;
49
49
f -> mask .tos = (ntohl (mask ) >> 16 ) & 0x000000FF ;
@@ -52,7 +52,7 @@ static inline int cxgb4_fill_ipv4_tos(struct ch_filter_specification *f,
52
52
}
53
53
54
54
static inline int cxgb4_fill_ipv4_frag (struct ch_filter_specification * f ,
55
- u32 val , u32 mask )
55
+ __be32 val , __be32 mask )
56
56
{
57
57
u32 mask_val ;
58
58
u8 frag_val ;
@@ -74,7 +74,7 @@ static inline int cxgb4_fill_ipv4_frag(struct ch_filter_specification *f,
74
74
}
75
75
76
76
static inline int cxgb4_fill_ipv4_proto (struct ch_filter_specification * f ,
77
- u32 val , u32 mask )
77
+ __be32 val , __be32 mask )
78
78
{
79
79
f -> val .proto = (ntohl (val ) >> 16 ) & 0x000000FF ;
80
80
f -> mask .proto = (ntohl (mask ) >> 16 ) & 0x000000FF ;
@@ -83,7 +83,7 @@ static inline int cxgb4_fill_ipv4_proto(struct ch_filter_specification *f,
83
83
}
84
84
85
85
static inline int cxgb4_fill_ipv4_src_ip (struct ch_filter_specification * f ,
86
- u32 val , u32 mask )
86
+ __be32 val , __be32 mask )
87
87
{
88
88
memcpy (& f -> val .fip [0 ], & val , sizeof (u32 ));
89
89
memcpy (& f -> mask .fip [0 ], & mask , sizeof (u32 ));
@@ -92,7 +92,7 @@ static inline int cxgb4_fill_ipv4_src_ip(struct ch_filter_specification *f,
92
92
}
93
93
94
94
static inline int cxgb4_fill_ipv4_dst_ip (struct ch_filter_specification * f ,
95
- u32 val , u32 mask )
95
+ __be32 val , __be32 mask )
96
96
{
97
97
memcpy (& f -> val .lip [0 ], & val , sizeof (u32 ));
98
98
memcpy (& f -> mask .lip [0 ], & mask , sizeof (u32 ));
@@ -111,7 +111,7 @@ static const struct cxgb4_match_field cxgb4_ipv4_fields[] = {
111
111
112
112
/* IPv6 match fields */
113
113
static inline int cxgb4_fill_ipv6_tos (struct ch_filter_specification * f ,
114
- u32 val , u32 mask )
114
+ __be32 val , __be32 mask )
115
115
{
116
116
f -> val .tos = (ntohl (val ) >> 20 ) & 0x000000FF ;
117
117
f -> mask .tos = (ntohl (mask ) >> 20 ) & 0x000000FF ;
@@ -120,7 +120,7 @@ static inline int cxgb4_fill_ipv6_tos(struct ch_filter_specification *f,
120
120
}
121
121
122
122
static inline int cxgb4_fill_ipv6_proto (struct ch_filter_specification * f ,
123
- u32 val , u32 mask )
123
+ __be32 val , __be32 mask )
124
124
{
125
125
f -> val .proto = (ntohl (val ) >> 8 ) & 0x000000FF ;
126
126
f -> mask .proto = (ntohl (mask ) >> 8 ) & 0x000000FF ;
@@ -129,7 +129,7 @@ static inline int cxgb4_fill_ipv6_proto(struct ch_filter_specification *f,
129
129
}
130
130
131
131
static inline int cxgb4_fill_ipv6_src_ip0 (struct ch_filter_specification * f ,
132
- u32 val , u32 mask )
132
+ __be32 val , __be32 mask )
133
133
{
134
134
memcpy (& f -> val .fip [0 ], & val , sizeof (u32 ));
135
135
memcpy (& f -> mask .fip [0 ], & mask , sizeof (u32 ));
@@ -138,7 +138,7 @@ static inline int cxgb4_fill_ipv6_src_ip0(struct ch_filter_specification *f,
138
138
}
139
139
140
140
static inline int cxgb4_fill_ipv6_src_ip1 (struct ch_filter_specification * f ,
141
- u32 val , u32 mask )
141
+ __be32 val , __be32 mask )
142
142
{
143
143
memcpy (& f -> val .fip [4 ], & val , sizeof (u32 ));
144
144
memcpy (& f -> mask .fip [4 ], & mask , sizeof (u32 ));
@@ -147,7 +147,7 @@ static inline int cxgb4_fill_ipv6_src_ip1(struct ch_filter_specification *f,
147
147
}
148
148
149
149
static inline int cxgb4_fill_ipv6_src_ip2 (struct ch_filter_specification * f ,
150
- u32 val , u32 mask )
150
+ __be32 val , __be32 mask )
151
151
{
152
152
memcpy (& f -> val .fip [8 ], & val , sizeof (u32 ));
153
153
memcpy (& f -> mask .fip [8 ], & mask , sizeof (u32 ));
@@ -156,7 +156,7 @@ static inline int cxgb4_fill_ipv6_src_ip2(struct ch_filter_specification *f,
156
156
}
157
157
158
158
static inline int cxgb4_fill_ipv6_src_ip3 (struct ch_filter_specification * f ,
159
- u32 val , u32 mask )
159
+ __be32 val , __be32 mask )
160
160
{
161
161
memcpy (& f -> val .fip [12 ], & val , sizeof (u32 ));
162
162
memcpy (& f -> mask .fip [12 ], & mask , sizeof (u32 ));
@@ -165,7 +165,7 @@ static inline int cxgb4_fill_ipv6_src_ip3(struct ch_filter_specification *f,
165
165
}
166
166
167
167
static inline int cxgb4_fill_ipv6_dst_ip0 (struct ch_filter_specification * f ,
168
- u32 val , u32 mask )
168
+ __be32 val , __be32 mask )
169
169
{
170
170
memcpy (& f -> val .lip [0 ], & val , sizeof (u32 ));
171
171
memcpy (& f -> mask .lip [0 ], & mask , sizeof (u32 ));
@@ -174,7 +174,7 @@ static inline int cxgb4_fill_ipv6_dst_ip0(struct ch_filter_specification *f,
174
174
}
175
175
176
176
static inline int cxgb4_fill_ipv6_dst_ip1 (struct ch_filter_specification * f ,
177
- u32 val , u32 mask )
177
+ __be32 val , __be32 mask )
178
178
{
179
179
memcpy (& f -> val .lip [4 ], & val , sizeof (u32 ));
180
180
memcpy (& f -> mask .lip [4 ], & mask , sizeof (u32 ));
@@ -183,7 +183,7 @@ static inline int cxgb4_fill_ipv6_dst_ip1(struct ch_filter_specification *f,
183
183
}
184
184
185
185
static inline int cxgb4_fill_ipv6_dst_ip2 (struct ch_filter_specification * f ,
186
- u32 val , u32 mask )
186
+ __be32 val , __be32 mask )
187
187
{
188
188
memcpy (& f -> val .lip [8 ], & val , sizeof (u32 ));
189
189
memcpy (& f -> mask .lip [8 ], & mask , sizeof (u32 ));
@@ -192,7 +192,7 @@ static inline int cxgb4_fill_ipv6_dst_ip2(struct ch_filter_specification *f,
192
192
}
193
193
194
194
static inline int cxgb4_fill_ipv6_dst_ip3 (struct ch_filter_specification * f ,
195
- u32 val , u32 mask )
195
+ __be32 val , __be32 mask )
196
196
{
197
197
memcpy (& f -> val .lip [12 ], & val , sizeof (u32 ));
198
198
memcpy (& f -> mask .lip [12 ], & mask , sizeof (u32 ));
@@ -216,7 +216,7 @@ static const struct cxgb4_match_field cxgb4_ipv6_fields[] = {
216
216
217
217
/* TCP/UDP match */
218
218
static inline int cxgb4_fill_l4_ports (struct ch_filter_specification * f ,
219
- u32 val , u32 mask )
219
+ __be32 val , __be32 mask )
220
220
{
221
221
f -> val .fport = ntohl (val ) >> 16 ;
222
222
f -> mask .fport = ntohl (mask ) >> 16 ;
@@ -237,19 +237,13 @@ static const struct cxgb4_match_field cxgb4_udp_fields[] = {
237
237
};
238
238
239
239
struct cxgb4_next_header {
240
- unsigned int offset ; /* Offset to next header */
241
- /* offset, shift, and mask added to offset above
240
+ /* Offset, shift, and mask added to beginning of the header
242
241
* to get to next header. Useful when using a header
243
242
* field's value to jump to next header such as IHL field
244
243
* in IPv4 header.
245
244
*/
246
- unsigned int offoff ;
247
- u32 shift ;
248
- u32 mask ;
249
- /* match criteria to make this jump */
250
- unsigned int match_off ;
251
- u32 match_val ;
252
- u32 match_mask ;
245
+ struct tc_u32_sel sel ;
246
+ struct tc_u32_key key ;
253
247
/* location of jump to make */
254
248
const struct cxgb4_match_field * jump ;
255
249
};
@@ -258,26 +252,74 @@ struct cxgb4_next_header {
258
252
* IPv4 header.
259
253
*/
260
254
static const struct cxgb4_next_header cxgb4_ipv4_jumps [] = {
261
- { .offset = 0 , .offoff = 0 , .shift = 6 , .mask = 0xF ,
262
- .match_off = 8 , .match_val = 0x600 , .match_mask = 0xFF00 ,
263
- .jump = cxgb4_tcp_fields },
264
- { .offset = 0 , .offoff = 0 , .shift = 6 , .mask = 0xF ,
265
- .match_off = 8 , .match_val = 0x1100 , .match_mask = 0xFF00 ,
266
- .jump = cxgb4_udp_fields },
267
- { .jump = NULL }
255
+ {
256
+ /* TCP Jump */
257
+ .sel = {
258
+ .off = 0 ,
259
+ .offoff = 0 ,
260
+ .offshift = 6 ,
261
+ .offmask = cpu_to_be16 (0x0f00 ),
262
+ },
263
+ .key = {
264
+ .off = 8 ,
265
+ .val = cpu_to_be32 (0x00060000 ),
266
+ .mask = cpu_to_be32 (0x00ff0000 ),
267
+ },
268
+ .jump = cxgb4_tcp_fields ,
269
+ },
270
+ {
271
+ /* UDP Jump */
272
+ .sel = {
273
+ .off = 0 ,
274
+ .offoff = 0 ,
275
+ .offshift = 6 ,
276
+ .offmask = cpu_to_be16 (0x0f00 ),
277
+ },
278
+ .key = {
279
+ .off = 8 ,
280
+ .val = cpu_to_be32 (0x00110000 ),
281
+ .mask = cpu_to_be32 (0x00ff0000 ),
282
+ },
283
+ .jump = cxgb4_udp_fields ,
284
+ },
285
+ { .jump = NULL },
268
286
};
269
287
270
288
/* Accept a rule with a jump directly past the 40 Bytes of IPv6 fixed header
271
289
* to get to transport layer header.
272
290
*/
273
291
static const struct cxgb4_next_header cxgb4_ipv6_jumps [] = {
274
- { .offset = 0x28 , .offoff = 0 , .shift = 0 , .mask = 0 ,
275
- .match_off = 4 , .match_val = 0x60000 , .match_mask = 0xFF0000 ,
276
- .jump = cxgb4_tcp_fields },
277
- { .offset = 0x28 , .offoff = 0 , .shift = 0 , .mask = 0 ,
278
- .match_off = 4 , .match_val = 0x110000 , .match_mask = 0xFF0000 ,
279
- .jump = cxgb4_udp_fields },
280
- { .jump = NULL }
292
+ {
293
+ /* TCP Jump */
294
+ .sel = {
295
+ .off = 40 ,
296
+ .offoff = 0 ,
297
+ .offshift = 0 ,
298
+ .offmask = 0 ,
299
+ },
300
+ .key = {
301
+ .off = 4 ,
302
+ .val = cpu_to_be32 (0x00000600 ),
303
+ .mask = cpu_to_be32 (0x0000ff00 ),
304
+ },
305
+ .jump = cxgb4_tcp_fields ,
306
+ },
307
+ {
308
+ /* UDP Jump */
309
+ .sel = {
310
+ .off = 40 ,
311
+ .offoff = 0 ,
312
+ .offshift = 0 ,
313
+ .offmask = 0 ,
314
+ },
315
+ .key = {
316
+ .off = 4 ,
317
+ .val = cpu_to_be32 (0x00001100 ),
318
+ .mask = cpu_to_be32 (0x0000ff00 ),
319
+ },
320
+ .jump = cxgb4_udp_fields ,
321
+ },
322
+ { .jump = NULL },
281
323
};
282
324
283
325
struct cxgb4_link {
0 commit comments