47
47
static void nfp_fl_pop_vlan (struct nfp_fl_pop_vlan * pop_vlan )
48
48
{
49
49
size_t act_size = sizeof (struct nfp_fl_pop_vlan );
50
- u16 tmp_pop_vlan_op ;
51
50
52
- tmp_pop_vlan_op =
53
- FIELD_PREP (NFP_FL_ACT_LEN_LW , act_size >> NFP_FL_LW_SIZ ) |
54
- FIELD_PREP (NFP_FL_ACT_JMP_ID , NFP_FL_ACTION_OPCODE_POP_VLAN );
55
-
56
- pop_vlan -> a_op = cpu_to_be16 (tmp_pop_vlan_op );
51
+ pop_vlan -> head .jump_id = NFP_FL_ACTION_OPCODE_POP_VLAN ;
52
+ pop_vlan -> head .len_lw = act_size >> NFP_FL_LW_SIZ ;
57
53
pop_vlan -> reserved = 0 ;
58
54
}
59
55
@@ -64,14 +60,9 @@ nfp_fl_push_vlan(struct nfp_fl_push_vlan *push_vlan,
64
60
size_t act_size = sizeof (struct nfp_fl_push_vlan );
65
61
struct tcf_vlan * vlan = to_vlan (action );
66
62
u16 tmp_push_vlan_tci ;
67
- u16 tmp_push_vlan_op ;
68
-
69
- tmp_push_vlan_op =
70
- FIELD_PREP (NFP_FL_ACT_LEN_LW , act_size >> NFP_FL_LW_SIZ ) |
71
- FIELD_PREP (NFP_FL_ACT_JMP_ID , NFP_FL_ACTION_OPCODE_PUSH_VLAN );
72
63
73
- push_vlan -> a_op = cpu_to_be16 ( tmp_push_vlan_op ) ;
74
- /* Set action push vlan parameters. */
64
+ push_vlan -> head . jump_id = NFP_FL_ACTION_OPCODE_PUSH_VLAN ;
65
+ push_vlan -> head . len_lw = act_size >> NFP_FL_LW_SIZ ;
75
66
push_vlan -> reserved = 0 ;
76
67
push_vlan -> vlan_tpid = tcf_vlan_push_proto (action );
77
68
@@ -101,16 +92,12 @@ nfp_fl_output(struct nfp_fl_output *output, const struct tc_action *action,
101
92
int * tun_out_cnt )
102
93
{
103
94
size_t act_size = sizeof (struct nfp_fl_output );
104
- u16 tmp_output_op , tmp_flags ;
105
95
struct net_device * out_dev ;
96
+ u16 tmp_flags ;
106
97
int ifindex ;
107
98
108
- /* Set action opcode to output action. */
109
- tmp_output_op =
110
- FIELD_PREP (NFP_FL_ACT_LEN_LW , act_size >> NFP_FL_LW_SIZ ) |
111
- FIELD_PREP (NFP_FL_ACT_JMP_ID , NFP_FL_ACTION_OPCODE_OUTPUT );
112
-
113
- output -> a_op = cpu_to_be16 (tmp_output_op );
99
+ output -> head .jump_id = NFP_FL_ACTION_OPCODE_OUTPUT ;
100
+ output -> head .len_lw = act_size >> NFP_FL_LW_SIZ ;
114
101
115
102
ifindex = tcf_mirred_ifindex (action );
116
103
out_dev = __dev_get_by_index (dev_net (in_dev ), ifindex );
@@ -161,7 +148,6 @@ static struct nfp_fl_pre_tunnel *nfp_fl_pre_tunnel(char *act_data, int act_len)
161
148
{
162
149
size_t act_size = sizeof (struct nfp_fl_pre_tunnel );
163
150
struct nfp_fl_pre_tunnel * pre_tun_act ;
164
- u16 tmp_pre_tun_op ;
165
151
166
152
/* Pre_tunnel action must be first on action list.
167
153
* If other actions already exist they need pushed forward.
@@ -173,11 +159,8 @@ static struct nfp_fl_pre_tunnel *nfp_fl_pre_tunnel(char *act_data, int act_len)
173
159
174
160
memset (pre_tun_act , 0 , act_size );
175
161
176
- tmp_pre_tun_op =
177
- FIELD_PREP (NFP_FL_ACT_LEN_LW , act_size >> NFP_FL_LW_SIZ ) |
178
- FIELD_PREP (NFP_FL_ACT_JMP_ID , NFP_FL_ACTION_OPCODE_PRE_TUNNEL );
179
-
180
- pre_tun_act -> a_op = cpu_to_be16 (tmp_pre_tun_op );
162
+ pre_tun_act -> head .jump_id = NFP_FL_ACTION_OPCODE_PRE_TUNNEL ;
163
+ pre_tun_act -> head .len_lw = act_size >> NFP_FL_LW_SIZ ;
181
164
182
165
return pre_tun_act ;
183
166
}
@@ -190,7 +173,6 @@ nfp_fl_set_vxlan(struct nfp_fl_set_vxlan *set_vxlan,
190
173
struct ip_tunnel_info * vxlan = tcf_tunnel_info (action );
191
174
size_t act_size = sizeof (struct nfp_fl_set_vxlan );
192
175
u32 tmp_set_vxlan_type_index = 0 ;
193
- u16 tmp_set_vxlan_op ;
194
176
/* Currently support one pre-tunnel so index is always 0. */
195
177
int pretun_idx = 0 ;
196
178
@@ -199,12 +181,8 @@ nfp_fl_set_vxlan(struct nfp_fl_set_vxlan *set_vxlan,
199
181
return - EOPNOTSUPP ;
200
182
}
201
183
202
- tmp_set_vxlan_op =
203
- FIELD_PREP (NFP_FL_ACT_LEN_LW , act_size >> NFP_FL_LW_SIZ ) |
204
- FIELD_PREP (NFP_FL_ACT_JMP_ID ,
205
- NFP_FL_ACTION_OPCODE_SET_IPV4_TUNNEL );
206
-
207
- set_vxlan -> a_op = cpu_to_be16 (tmp_set_vxlan_op );
184
+ set_vxlan -> head .jump_id = NFP_FL_ACTION_OPCODE_SET_IPV4_TUNNEL ;
185
+ set_vxlan -> head .len_lw = act_size >> NFP_FL_LW_SIZ ;
208
186
209
187
/* Set tunnel type and pre-tunnel index. */
210
188
tmp_set_vxlan_type_index |=
@@ -240,7 +218,6 @@ static int
240
218
nfp_fl_set_eth (const struct tc_action * action , int idx , u32 off ,
241
219
struct nfp_fl_set_eth * set_eth )
242
220
{
243
- u16 tmp_set_eth_op ;
244
221
u32 exact , mask ;
245
222
246
223
if (off + 4 > ETH_ALEN * 2 )
@@ -256,11 +233,8 @@ nfp_fl_set_eth(const struct tc_action *action, int idx, u32 off,
256
233
& set_eth -> eth_addr_mask [off ]);
257
234
258
235
set_eth -> reserved = cpu_to_be16 (0 );
259
- tmp_set_eth_op = FIELD_PREP (NFP_FL_ACT_LEN_LW ,
260
- sizeof (* set_eth ) >> NFP_FL_LW_SIZ ) |
261
- FIELD_PREP (NFP_FL_ACT_JMP_ID ,
262
- NFP_FL_ACTION_OPCODE_SET_ETHERNET );
263
- set_eth -> a_op = cpu_to_be16 (tmp_set_eth_op );
236
+ set_eth -> head .jump_id = NFP_FL_ACTION_OPCODE_SET_ETHERNET ;
237
+ set_eth -> head .len_lw = sizeof (* set_eth ) >> NFP_FL_LW_SIZ ;
264
238
265
239
return 0 ;
266
240
}
@@ -269,7 +243,6 @@ static int
269
243
nfp_fl_set_ip4 (const struct tc_action * action , int idx , u32 off ,
270
244
struct nfp_fl_set_ip4_addrs * set_ip_addr )
271
245
{
272
- u16 tmp_set_ipv4_op ;
273
246
__be32 exact , mask ;
274
247
275
248
/* We are expecting tcf_pedit to return a big endian value */
@@ -293,11 +266,8 @@ nfp_fl_set_ip4(const struct tc_action *action, int idx, u32 off,
293
266
}
294
267
295
268
set_ip_addr -> reserved = cpu_to_be16 (0 );
296
- tmp_set_ipv4_op = FIELD_PREP (NFP_FL_ACT_LEN_LW ,
297
- sizeof (* set_ip_addr ) >> NFP_FL_LW_SIZ ) |
298
- FIELD_PREP (NFP_FL_ACT_JMP_ID ,
299
- NFP_FL_ACTION_OPCODE_SET_IPV4_ADDRS );
300
- set_ip_addr -> a_op = cpu_to_be16 (tmp_set_ipv4_op );
269
+ set_ip_addr -> head .jump_id = NFP_FL_ACTION_OPCODE_SET_IPV4_ADDRS ;
270
+ set_ip_addr -> head .len_lw = sizeof (* set_ip_addr ) >> NFP_FL_LW_SIZ ;
301
271
302
272
return 0 ;
303
273
}
@@ -306,16 +276,12 @@ static void
306
276
nfp_fl_set_ip6_helper (int opcode_tag , int idx , __be32 exact , __be32 mask ,
307
277
struct nfp_fl_set_ipv6_addr * ip6 )
308
278
{
309
- u16 tmp_set_op ;
310
-
311
279
ip6 -> ipv6 [idx % 4 ].mask = mask ;
312
280
ip6 -> ipv6 [idx % 4 ].exact = exact ;
313
281
314
282
ip6 -> reserved = cpu_to_be16 (0 );
315
- tmp_set_op = FIELD_PREP (NFP_FL_ACT_LEN_LW , sizeof (* ip6 ) >>
316
- NFP_FL_LW_SIZ ) |
317
- FIELD_PREP (NFP_FL_ACT_JMP_ID , opcode_tag );
318
- ip6 -> a_op = cpu_to_be16 (tmp_set_op );
283
+ ip6 -> head .jump_id = opcode_tag ;
284
+ ip6 -> head .len_lw = sizeof (* ip6 ) >> NFP_FL_LW_SIZ ;
319
285
}
320
286
321
287
static int
@@ -352,7 +318,6 @@ nfp_fl_set_tport(const struct tc_action *action, int idx, u32 off,
352
318
struct nfp_fl_set_tport * set_tport , int opcode )
353
319
{
354
320
u32 exact , mask ;
355
- u16 tmp_set_op ;
356
321
357
322
if (off )
358
323
return - EOPNOTSUPP ;
@@ -367,10 +332,8 @@ nfp_fl_set_tport(const struct tc_action *action, int idx, u32 off,
367
332
set_tport -> tp_port_mask );
368
333
369
334
set_tport -> reserved = cpu_to_be16 (0 );
370
- tmp_set_op = FIELD_PREP (NFP_FL_ACT_LEN_LW ,
371
- sizeof (* set_tport ) >> NFP_FL_LW_SIZ );
372
- tmp_set_op |= FIELD_PREP (NFP_FL_ACT_JMP_ID , opcode );
373
- set_tport -> a_op = cpu_to_be16 (tmp_set_op );
335
+ set_tport -> head .jump_id = opcode ;
336
+ set_tport -> head .len_lw = sizeof (* set_tport ) >> NFP_FL_LW_SIZ ;
374
337
375
338
return 0 ;
376
339
}
@@ -428,15 +391,15 @@ nfp_fl_pedit(const struct tc_action *action, char *nfp_action, int *a_len)
428
391
return err ;
429
392
}
430
393
431
- if (set_eth .a_op ) {
394
+ if (set_eth .head . len_lw ) {
432
395
act_size = sizeof (set_eth );
433
396
memcpy (nfp_action , & set_eth , act_size );
434
397
* a_len += act_size ;
435
- } else if (set_ip_addr .a_op ) {
398
+ } else if (set_ip_addr .head . len_lw ) {
436
399
act_size = sizeof (set_ip_addr );
437
400
memcpy (nfp_action , & set_ip_addr , act_size );
438
401
* a_len += act_size ;
439
- } else if (set_ip6_dst .a_op && set_ip6_src .a_op ) {
402
+ } else if (set_ip6_dst .head . len_lw && set_ip6_src .head . len_lw ) {
440
403
/* TC compiles set src and dst IPv6 address as a single action,
441
404
* the hardware requires this to be 2 separate actions.
442
405
*/
@@ -448,15 +411,15 @@ nfp_fl_pedit(const struct tc_action *action, char *nfp_action, int *a_len)
448
411
memcpy (& nfp_action [sizeof (set_ip6_src )], & set_ip6_dst ,
449
412
act_size );
450
413
* a_len += act_size ;
451
- } else if (set_ip6_dst .a_op ) {
414
+ } else if (set_ip6_dst .head . len_lw ) {
452
415
act_size = sizeof (set_ip6_dst );
453
416
memcpy (nfp_action , & set_ip6_dst , act_size );
454
417
* a_len += act_size ;
455
- } else if (set_ip6_src .a_op ) {
418
+ } else if (set_ip6_src .head . len_lw ) {
456
419
act_size = sizeof (set_ip6_src );
457
420
memcpy (nfp_action , & set_ip6_src , act_size );
458
421
* a_len += act_size ;
459
- } else if (set_tport .a_op ) {
422
+ } else if (set_tport .head . len_lw ) {
460
423
act_size = sizeof (set_tport );
461
424
memcpy (nfp_action , & set_tport , act_size );
462
425
* a_len += act_size ;
0 commit comments