4747static void nfp_fl_pop_vlan (struct nfp_fl_pop_vlan * pop_vlan )
4848{
4949 size_t act_size = sizeof (struct nfp_fl_pop_vlan );
50- u16 tmp_pop_vlan_op ;
5150
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 ;
5753 pop_vlan -> reserved = 0 ;
5854}
5955
@@ -64,14 +60,9 @@ nfp_fl_push_vlan(struct nfp_fl_push_vlan *push_vlan,
6460 size_t act_size = sizeof (struct nfp_fl_push_vlan );
6561 struct tcf_vlan * vlan = to_vlan (action );
6662 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 );
7263
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 ;
7566 push_vlan -> reserved = 0 ;
7667 push_vlan -> vlan_tpid = tcf_vlan_push_proto (action );
7768
@@ -101,16 +92,12 @@ nfp_fl_output(struct nfp_fl_output *output, const struct tc_action *action,
10192 int * tun_out_cnt )
10293{
10394 size_t act_size = sizeof (struct nfp_fl_output );
104- u16 tmp_output_op , tmp_flags ;
10595 struct net_device * out_dev ;
96+ u16 tmp_flags ;
10697 int ifindex ;
10798
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 ;
114101
115102 ifindex = tcf_mirred_ifindex (action );
116103 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)
161148{
162149 size_t act_size = sizeof (struct nfp_fl_pre_tunnel );
163150 struct nfp_fl_pre_tunnel * pre_tun_act ;
164- u16 tmp_pre_tun_op ;
165151
166152 /* Pre_tunnel action must be first on action list.
167153 * 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)
173159
174160 memset (pre_tun_act , 0 , act_size );
175161
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 ;
181164
182165 return pre_tun_act ;
183166}
@@ -190,7 +173,6 @@ nfp_fl_set_vxlan(struct nfp_fl_set_vxlan *set_vxlan,
190173 struct ip_tunnel_info * vxlan = tcf_tunnel_info (action );
191174 size_t act_size = sizeof (struct nfp_fl_set_vxlan );
192175 u32 tmp_set_vxlan_type_index = 0 ;
193- u16 tmp_set_vxlan_op ;
194176 /* Currently support one pre-tunnel so index is always 0. */
195177 int pretun_idx = 0 ;
196178
@@ -199,12 +181,8 @@ nfp_fl_set_vxlan(struct nfp_fl_set_vxlan *set_vxlan,
199181 return - EOPNOTSUPP ;
200182 }
201183
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 ;
208186
209187 /* Set tunnel type and pre-tunnel index. */
210188 tmp_set_vxlan_type_index |=
@@ -240,7 +218,6 @@ static int
240218nfp_fl_set_eth (const struct tc_action * action , int idx , u32 off ,
241219 struct nfp_fl_set_eth * set_eth )
242220{
243- u16 tmp_set_eth_op ;
244221 u32 exact , mask ;
245222
246223 if (off + 4 > ETH_ALEN * 2 )
@@ -256,11 +233,8 @@ nfp_fl_set_eth(const struct tc_action *action, int idx, u32 off,
256233 & set_eth -> eth_addr_mask [off ]);
257234
258235 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 ;
264238
265239 return 0 ;
266240}
@@ -269,7 +243,6 @@ static int
269243nfp_fl_set_ip4 (const struct tc_action * action , int idx , u32 off ,
270244 struct nfp_fl_set_ip4_addrs * set_ip_addr )
271245{
272- u16 tmp_set_ipv4_op ;
273246 __be32 exact , mask ;
274247
275248 /* 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,
293266 }
294267
295268 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 ;
301271
302272 return 0 ;
303273}
@@ -306,16 +276,12 @@ static void
306276nfp_fl_set_ip6_helper (int opcode_tag , int idx , __be32 exact , __be32 mask ,
307277 struct nfp_fl_set_ipv6_addr * ip6 )
308278{
309- u16 tmp_set_op ;
310-
311279 ip6 -> ipv6 [idx % 4 ].mask = mask ;
312280 ip6 -> ipv6 [idx % 4 ].exact = exact ;
313281
314282 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 ;
319285}
320286
321287static int
@@ -352,7 +318,6 @@ nfp_fl_set_tport(const struct tc_action *action, int idx, u32 off,
352318 struct nfp_fl_set_tport * set_tport , int opcode )
353319{
354320 u32 exact , mask ;
355- u16 tmp_set_op ;
356321
357322 if (off )
358323 return - EOPNOTSUPP ;
@@ -367,10 +332,8 @@ nfp_fl_set_tport(const struct tc_action *action, int idx, u32 off,
367332 set_tport -> tp_port_mask );
368333
369334 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 ;
374337
375338 return 0 ;
376339}
@@ -428,15 +391,15 @@ nfp_fl_pedit(const struct tc_action *action, char *nfp_action, int *a_len)
428391 return err ;
429392 }
430393
431- if (set_eth .a_op ) {
394+ if (set_eth .head . len_lw ) {
432395 act_size = sizeof (set_eth );
433396 memcpy (nfp_action , & set_eth , act_size );
434397 * a_len += act_size ;
435- } else if (set_ip_addr .a_op ) {
398+ } else if (set_ip_addr .head . len_lw ) {
436399 act_size = sizeof (set_ip_addr );
437400 memcpy (nfp_action , & set_ip_addr , act_size );
438401 * 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 ) {
440403 /* TC compiles set src and dst IPv6 address as a single action,
441404 * the hardware requires this to be 2 separate actions.
442405 */
@@ -448,15 +411,15 @@ nfp_fl_pedit(const struct tc_action *action, char *nfp_action, int *a_len)
448411 memcpy (& nfp_action [sizeof (set_ip6_src )], & set_ip6_dst ,
449412 act_size );
450413 * a_len += act_size ;
451- } else if (set_ip6_dst .a_op ) {
414+ } else if (set_ip6_dst .head . len_lw ) {
452415 act_size = sizeof (set_ip6_dst );
453416 memcpy (nfp_action , & set_ip6_dst , act_size );
454417 * a_len += act_size ;
455- } else if (set_ip6_src .a_op ) {
418+ } else if (set_ip6_src .head . len_lw ) {
456419 act_size = sizeof (set_ip6_src );
457420 memcpy (nfp_action , & set_ip6_src , act_size );
458421 * a_len += act_size ;
459- } else if (set_tport .a_op ) {
422+ } else if (set_tport .head . len_lw ) {
460423 act_size = sizeof (set_tport );
461424 memcpy (nfp_action , & set_tport , act_size );
462425 * a_len += act_size ;
0 commit comments