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: <20180630.210342.804224843120744818.davem@davemloft.net>
Date:   Sat, 30 Jun 2018 21:03:42 +0900 (KST)
From:   David Miller <davem@...emloft.net>
To:     lipeng321@...wei.com
Cc:     netdev@...r.kernel.org, linux-kernel@...r.kernel.org,
        linuxarm@...wei.com, yisen.zhuang@...wei.com,
        salil.mehta@...wei.com
Subject: Re: [PATCH net-next 05/10] net: hns3: using modulo for cyclic
 counters in hclge_cmd_send

From: Peng Li <lipeng321@...wei.com>
Date: Fri, 29 Jun 2018 19:23:00 +0800

> @@ -228,8 +228,7 @@ int hclge_cmd_send(struct hclge_hw *hw, struct hclge_desc *desc, int num)
>  		desc_to_use = &hw->cmq.csq.desc[hw->cmq.csq.next_to_use];
>  		*desc_to_use = desc[handle];
>  		(hw->cmq.csq.next_to_use)++;
> -		if (hw->cmq.csq.next_to_use == hw->cmq.csq.desc_num)
> -			hw->cmq.csq.next_to_use = 0;
> +		hw->cmq.csq.next_to_use %= hw->cmq.csq.desc_num;
>  		handle++;

I would advise against this.

The "%" modulus operation takes many cpu cycles, and the current code
is thus much faster.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ