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]
Message-ID: <9db26fa8-e1b0-acc5-80e8-6443d089fe2e@gmail.com>
Date:   Wed, 26 Sep 2018 11:41:30 -0700
From:   Florian Fainelli <f.fainelli@...il.com>
To:     Pablo Neira Ayuso <pablo@...filter.org>, netdev@...r.kernel.org
Cc:     davem@...emloft.net, thomas.lendacky@....com,
        ariel.elior@...ium.com, michael.chan@...adcom.com,
        santosh@...lsio.com, madalin.bucur@....com,
        yisen.zhuang@...wei.com, salil.mehta@...wei.com,
        jeffrey.t.kirsher@...el.com, tariqt@...lanox.com,
        saeedm@...lanox.com, jiri@...lanox.com, idosch@...lanox.com,
        ganeshgr@...lsio.com, jakub.kicinski@...ronome.com,
        linux-net-drivers@...arflare.com, peppe.cavallaro@...com,
        alexandre.torgue@...com, joabreu@...opsys.com,
        grygorii.strashko@...com, andrew@...n.ch,
        vivien.didelot@...oirfairelinux.com
Subject: Re: [PATCH RFC,net-next 10/10] dsa: bcm_sf2: use flow_rule
 infrastructure

Hi Pablo,

On 09/25/2018 12:20 PM, Pablo Neira Ayuso wrote:
> Update this driver to use the flow_rule infrastructure, hence the same
> code to populate hardware IR can be used from ethtool_rx_flow and the
> cls_flower interfaces.

Thanks for doing the conversion, I believe we could change things a
little bit such that there are fewer things to audit for correctness,
see below:

> 
> Signed-off-by: Pablo Neira Ayuso <pablo@...filter.org>
> ---
>  drivers/net/dsa/bcm_sf2_cfp.c | 311 ++++++++++++++++++++++--------------------
>  1 file changed, 166 insertions(+), 145 deletions(-)
> 
> diff --git a/drivers/net/dsa/bcm_sf2_cfp.c b/drivers/net/dsa/bcm_sf2_cfp.c
> index 47c5f272a084..9dace0e25a3a 100644
> --- a/drivers/net/dsa/bcm_sf2_cfp.c
> +++ b/drivers/net/dsa/bcm_sf2_cfp.c
> @@ -251,10 +251,12 @@ static int bcm_sf2_cfp_act_pol_set(struct bcm_sf2_priv *priv,
>  }
>  
>  static void bcm_sf2_cfp_slice_ipv4(struct bcm_sf2_priv *priv,
> -				   struct ethtool_tcpip4_spec *v4_spec,
> +				   struct flow_rule *flow_rule,
>  				   unsigned int slice_num,
>  				   bool mask)
>  {
> +	struct flow_match_ipv4_addrs ipv4;
> +	struct flow_match_ports ports;
>  	u32 reg, offset;
>  
>  	/* C-Tag		[31:24]
> @@ -268,41 +270,54 @@ static void bcm_sf2_cfp_slice_ipv4(struct bcm_sf2_priv *priv,
>  		offset = CORE_CFP_DATA_PORT(4);
>  	core_writel(priv, reg, offset);
>  
> +	flow_rule_match_ipv4_addrs(flow_rule, &ipv4);
> +	flow_rule_match_ports(flow_rule, &ports);
> +
>  	/* UDF_n_A7		[31:24]
>  	 * UDF_n_A6		[23:8]
>  	 * UDF_n_A5		[7:0]
>  	 */
> -	reg = be16_to_cpu(v4_spec->pdst) >> 8;
> -	if (mask)
> +	if (mask) {
> +		reg = be16_to_cpu(ports.mask->dst) >> 8;
>  		offset = CORE_CFP_MASK_PORT(3);
> -	else
> +	} else {
> +		reg = be16_to_cpu(ports.key->dst) >> 8;
>  		offset = CORE_CFP_DATA_PORT(3);
> +	}

For instance here, instead of having to assign "reg" differently, just
have an intermediate struct flow_match_ports variable that either points
to &ports.mask or &ports.key.

I quickly glanced through the changes, and I suspect that they are
correct, but there is unfortunately way too much code movement within
the functions which greatly hinders the ability to have complete
confidence in the changes :)

Can you find a way to only perform the ethtool_rx_flow_spec to flow_rule
conversion as close as possible from the point of use within the callee?

Thanks!
-- 
Florian

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ