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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <8ab10450-5fe3-bc33-6c66-6f3ea861f561@cogentembedded.com>
Date:   Mon, 16 Jan 2017 23:41:51 +0300
From:   Sergei Shtylyov <sergei.shtylyov@...entembedded.com>
To:     Simon Horman <horms@...ge.net.au>
Cc:     David Miller <davem@...emloft.net>,
        Magnus Damm <magnus.damm@...il.com>, netdev@...r.kernel.org,
        linux-renesas-soc@...r.kernel.org
Subject: Re: [PATCH/RFC v2 net-next] ravb: unmap descriptors when freeing
 rings

Hello!

On 01/12/2017 04:18 PM, Simon Horman wrote:

> ...

>>>>   Here, it stop once an untransmitted buffer is encountered...
>>>
>>> Yes, I see that now.
>>>
>>> I wonder if we should:
>>>
>>> a) paramatise ravb_tx_free() so it may either clear all transmitted buffers
>>>   (current behaviour) or all buffers (new behaviour).
>>> b) provide a different version of this loop in ravb_ring_free()
>>>
>>> What are your thoughts?
>>
>>    I'm voting for (b).

    After looking at this issue for another time, I'll vote for (a). Sorry for 
back-and-forth on this matter -- I somehow thought we could do a better job by 
scanning all the TX ring...

> Ok, something like this?
>
> @@ -215,6 +225,30 @@ static void ravb_ring_free(struct net_device *ndev, int q)
>  	}
>
>  	if (priv->tx_ring[q]) {
> +		for (; priv->cur_tx[q] - priv->dirty_tx[q] > 0; priv->dirty_tx[q]++) {
> +			struct ravb_tx_desc *desc;
> +			int entry;
> +
> +			entry = priv->dirty_tx[q] % (priv->num_tx_ring[q] *
> +						     NUM_TX_DESC);
> +			desc = &priv->tx_ring[q][entry];
> +
> +			/* Free the original skb. */
> +			if (priv->tx_skb[q][entry / NUM_TX_DESC]) {
> +				u32 size = le16_to_cpu(desc->ds_tagl) & TX_DS;
> +
> +				dma_unmap_single(ndev->dev.parent,
> +						 le32_to_cpu(desc->dptr),
> +						 size, DMA_TO_DEVICE);
> +				/* Last packet descriptor? */
> +				if (entry % NUM_TX_DESC == NUM_TX_DESC - 1) {
> +					entry /= NUM_TX_DESC;
> +					dev_kfree_skb_any(priv->tx_skb[q][entry]);
> +					priv->tx_skb[q][entry] = NULL;
> +				}
> +			}
> +		}
> +

    This is only different from ravb_tx_free() by not stopping on unfinished 
descriptor, so we must be good with adding an extra param to it...

[...]

MBR, Sergei

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ