lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Sun, 12 May 2019 09:08:01 +0000
From:   Roi Dayan <roid@...lanox.com>
To:     "xiangxia.m.yue@...il.com" <xiangxia.m.yue@...il.com>,
        Saeed Mahameed <saeedm@...lanox.com>
CC:     "netdev@...r.kernel.org" <netdev@...r.kernel.org>
Subject: Re: [PATCH] net/mlx5e: Allow matching only enc_key_id/enc_dst_port
 for decapsulation action



On 06/05/2019 21:28, xiangxia.m.yue@...il.com wrote:
> From: Tonghao Zhang <xiangxia.m.yue@...il.com>
> 
> In some case, we don't care the enc_src_ip and enc_dst_ip, and
> if we don't match the field enc_src_ip and enc_dst_ip, we can use
> fewer flows in hardware when revice the tunnel packets. For example,
> the tunnel packets may be sent from different hosts, we must offload
> one rule for each host.
> 
> 	$ tc filter add dev vxlan0 protocol ip parent ffff: prio 1 \
> 		flower dst_mac 00:11:22:33:44:00 \
> 		enc_src_ip Host0_IP enc_dst_ip 2.2.2.100 \
> 		enc_dst_port 4789 enc_key_id 100 \
> 		action tunnel_key unset action mirred egress redirect dev eth0_1
> 
> 	$ tc filter add dev vxlan0 protocol ip parent ffff: prio 1 \
> 		flower dst_mac 00:11:22:33:44:00 \
> 		enc_src_ip Host1_IP enc_dst_ip 2.2.2.100 \
> 		enc_dst_port 4789 enc_key_id 100 \
> 		action tunnel_key unset action mirred egress redirect dev eth0_1
> 
> If we support flows which only match the enc_key_id and enc_dst_port,
> a flow can process the packets sent to VM which (mac 00:11:22:33:44:00).
> 
> 	$ tc filter add dev vxlan0 protocol ip parent ffff: prio 1 \
> 		flower dst_mac 00:11:22:33:44:00 \
> 		enc_dst_port 4789 enc_key_id 100 \
> 		action tunnel_key unset action mirred egress redirect dev eth0_1
> 
> Signed-off-by: Tonghao Zhang <xiangxia.m.yue@...il.com>
> ---
>  drivers/net/ethernet/mellanox/mlx5/core/en_tc.c | 27 +++++++------------------
>  1 file changed, 7 insertions(+), 20 deletions(-)
> 
> diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c b/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c
> index 122f457..91e4db1 100644
> --- a/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c
> +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c
> @@ -1339,7 +1339,6 @@ static int parse_tunnel_attr(struct mlx5e_priv *priv,
>  	void *headers_v = MLX5_ADDR_OF(fte_match_param, spec->match_value,
>  				       outer_headers);
>  	struct flow_rule *rule = tc_cls_flower_offload_flow_rule(f);
> -	struct flow_match_control enc_control;
>  	int err;
>  
>  	err = mlx5e_tc_tun_parse(filter_dev, priv, spec, f,
> @@ -1350,9 +1349,7 @@ static int parse_tunnel_attr(struct mlx5e_priv *priv,
>  		return err;
>  	}
>  
> -	flow_rule_match_enc_control(rule, &enc_control);
> -
> -	if (enc_control.key->addr_type == FLOW_DISSECTOR_KEY_IPV4_ADDRS) {
> +	if (flow_rule_match_key(rule, FLOW_DISSECTOR_KEY_ENC_IPV4_ADDRS)) {
>  		struct flow_match_ipv4_addrs match;
>  
>  		flow_rule_match_enc_ipv4_addrs(rule, &match);
> @@ -1372,7 +1369,7 @@ static int parse_tunnel_attr(struct mlx5e_priv *priv,
>  
>  		MLX5_SET_TO_ONES(fte_match_set_lyr_2_4, headers_c, ethertype);
>  		MLX5_SET(fte_match_set_lyr_2_4, headers_v, ethertype, ETH_P_IP);
> -	} else if (enc_control.key->addr_type == FLOW_DISSECTOR_KEY_IPV6_ADDRS) {
> +	} else if (flow_rule_match_key(rule, FLOW_DISSECTOR_KEY_ENC_IPV6_ADDRS)) {
>  		struct flow_match_ipv6_addrs match;
>  
>  		flow_rule_match_enc_ipv6_addrs(rule, &match);
> @@ -1504,22 +1501,12 @@ static int __parse_cls_flower(struct mlx5e_priv *priv,
>  		return -EOPNOTSUPP;
>  	}
>  
> -	if ((flow_rule_match_key(rule, FLOW_DISSECTOR_KEY_ENC_IPV4_ADDRS) ||
> -	     flow_rule_match_key(rule, FLOW_DISSECTOR_KEY_ENC_KEYID) ||
> -	     flow_rule_match_key(rule, FLOW_DISSECTOR_KEY_ENC_PORTS)) &&
> -	    flow_rule_match_key(rule, FLOW_DISSECTOR_KEY_ENC_CONTROL)) {
> -		struct flow_match_control match;
> -
> -		flow_rule_match_enc_control(rule, &match);
> -		switch (match.key->addr_type) {
> -		case FLOW_DISSECTOR_KEY_IPV4_ADDRS:
> -		case FLOW_DISSECTOR_KEY_IPV6_ADDRS:
> -			if (parse_tunnel_attr(priv, spec, f, filter_dev, tunnel_match_level))
> -				return -EOPNOTSUPP;
> -			break;
> -		default:
> +	if (flow_rule_match_key(rule, FLOW_DISSECTOR_KEY_ENC_IPV4_ADDRS) ||
> +	    flow_rule_match_key(rule, FLOW_DISSECTOR_KEY_ENC_IPV6_ADDRS) ||
> +	    flow_rule_match_key(rule, FLOW_DISSECTOR_KEY_ENC_KEYID) ||
> +	    flow_rule_match_key(rule, FLOW_DISSECTOR_KEY_ENC_PORTS)) {
> +		if (parse_tunnel_attr(priv, spec, f, filter_dev, tunnel_match_level))
>  			return -EOPNOTSUPP;
> -		}
>  
>  		/* In decap flow, header pointers should point to the inner
>  		 * headers, outer header were already set by parse_tunnel_attr
> 


Reviewed-by: Roi Dayan <roid@...lanox.com>

Powered by blists - more mailing lists