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:	Tue, 5 Jan 2016 09:56:24 +0100
From:	Giuseppe CAVALLARO <peppe.cavallaro@...com>
To:	David Miller <davem@...emloft.net>
CC:	<netdev@...r.kernel.org>, <alexandre.torgue@...com>,
	<david.mckay@...com>
Subject: Re: [PATCH (net-next.git) 04/18] stmmac: remove modulo in stmmac_xmit()

Hi David

On 1/5/2016 4:34 AM, David Miller wrote:
> From: Giuseppe Cavallaro <peppe.cavallaro@...com>
> Date: Mon, 4 Jan 2016 14:06:49 +0100
>
>> @@ -2056,7 +2068,10 @@ static netdev_tx_t stmmac_xmit(struct sk_buff *skb, struct net_device *dev)
>>   	priv->hw->desc->set_tx_owner(first);
>>   	wmb();
>>
>> -	priv->cur_tx++;
>> +	if (++entry >= txsize)
>> +		entry = 0;
>
> You are doing this over and over again, encapsulate it into a helper
> like "NEXT_TX(x)" or similar.
>
> Also, this is just fundamentally completely stupid.  Enforce the ring

this is not completely gentle but I share the final advice and I will 
fix that asap.

thanks for the review.

peppe

> size to be a power-of-2, then you can just go "x + 1 & (size - 1)" and
> not even have the conditional statement.
>
> Thanks.
>

--
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