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: <559559E1.5090605@gmail.com>
Date:	Thu, 02 Jul 2015 08:33:53 -0700
From:	John Fastabend <john.fastabend@...il.com>
To:	Eric Dumazet <edumazet@...gle.com>,
	"David S. Miller" <davem@...emloft.net>
CC:	netdev <netdev@...r.kernel.org>,
	Alexei Starovoitov <ast@...mgrid.com>,
	Jamal Hadi Salim <jhs@...atatu.com>,
	Eric Dumazet <edumazet@...il.com>
Subject: Re: [PATCH net-next 3/6] net_sched: act: make tcfg_pval non zero

On 15-07-02 06:07 AM, Eric Dumazet wrote:
> First step for gact RCU operation :
> 
> Instead of testing if tcfg_pval is zero or not, just make it 1.
> 
> No change in behavior, but slightly faster code.
> 
> Signed-off-by: Eric Dumazet <edumazet@...gle.com>
> Cc: Alexei Starovoitov <ast@...mgrid.com>
> Cc: Jamal Hadi Salim <jhs@...atatu.com>
> Cc: John Fastabend <john.fastabend@...il.com>
> ---
>  net/sched/act_gact.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/net/sched/act_gact.c b/net/sched/act_gact.c
> index a4f8af29ee30..42284aad77dd 100644
> --- a/net/sched/act_gact.c
> +++ b/net/sched/act_gact.c

Acked-by: John Fastabend <john.r.fastabend@...el.com>

> @@ -28,14 +28,14 @@
>  #ifdef CONFIG_GACT_PROB
>  static int gact_net_rand(struct tcf_gact *gact)
>  {
> -	if (!gact->tcfg_pval || prandom_u32() % gact->tcfg_pval)
> +	if (prandom_u32() % gact->tcfg_pval)
>  		return gact->tcf_action;
>  	return gact->tcfg_paction;
>  }
>  
>  static int gact_determ(struct tcf_gact *gact)
>  {
> -	if (!gact->tcfg_pval || gact->tcf_bstats.packets % gact->tcfg_pval)
> +	if (gact->tcf_bstats.packets % gact->tcfg_pval)
>  		return gact->tcf_action;
>  	return gact->tcfg_paction;
>  }
> @@ -105,7 +105,7 @@ static int tcf_gact_init(struct net *net, struct nlattr *nla,
>  #ifdef CONFIG_GACT_PROB
>  	if (p_parm) {
>  		gact->tcfg_paction = p_parm->paction;
> -		gact->tcfg_pval    = p_parm->pval;
> +		gact->tcfg_pval    = max_t(u16, 1, p_parm->pval);
>  		gact->tcfg_ptype   = p_parm->ptype;
>  	}
>  #endif
> 

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ