On Mon, Jan 28, 2019 at 12:40 AM Or Gerlitz <[email protected]> wrote:
>
> On Sun, Jan 27, 2019 at 1:06 PM <[email protected]> wrote:
> > From: Tonghao Zhang <[email protected]>
> >
> > In some case, we may use multiple pedit actions to modify packets.
> > The command shown as below: the last pedit action is effective.
>
> > @@ -2073,7 +2076,8 @@ static int alloc_mod_hdr_actions(struct mlx5e_priv
> > *priv,
> > if (!parse_attr->mod_hdr_actions)
> > return -ENOMEM;
> >
> > - parse_attr->num_mod_hdr_actions = max_actions;
> > + parse_attr->max_mod_hdr_actions = max_actions;
> > + parse_attr->num_mod_hdr_actions = 0;
>
> why would we want to do this zeroing? what purpose does it serve?
Because we use the num_mod_hdr_actions to store the number of actions
we have parsed,
and when we alloc it, we init it 0 as default.
> On a probably related note, I suspect that the patch broke the caching
> we do for modify header contexts, see mlx5e_attach_mod_hdr where we
> look if a given set of modify header operations already has hw modify header
> context and we use it.
>
> To test that, put two tc rules with different matching but same set of
> modify header
> (pedit) actions and see that only one modify header context is used.
The patch does't break the cache, I think that different matching may
share the same set of
pedit actions.
I use the tc filters to test it: only one same pedit actions in hw,
and after deleting one tc filter, other filter work fine.
tc filter add dev eth4_0 parent ffff: protocol ip prio 1 \
flower skip_sw ip_proto icmp dst_ip 3.3.3.3 \
action pedit ex munge ip dst set 192.168.1.100 pipe \
action pedit ex munge eth src set 00:00:00:00:00:01 pipe \
action pedit ex munge eth dst set 00:00:00:00:00:02 pipe \
action csum ip pipe \
action tunnel_key set src_ip 192.168.6.2 dst_ip 192.168.10.2
dst_port 4789 id 100 \
action mirred egress redirect dev vxlan0
note: match 3.3.3.3, vxlan id 100
tc filter add dev eth4_0 parent ffff: protocol ip prio 1 \
flower skip_sw ip_proto icmp dst_ip 3.3.3.4 \
action pedit ex munge ip dst set 192.168.1.100 pipe \
action pedit ex munge eth src set 00:00:00:00:00:01 pipe \
action pedit ex munge eth dst set 00:00:00:00:00:02 pipe \
action csum ip pipe \
action tunnel_key set src_ip 192.168.6.2 dst_ip 192.168.10.2
dst_port 4789 id 200 \
action mirred egress redirect dev vxlan0
note: match 3.3.3.4, vxlan id 200