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: <55803007.50800@cogentembedded.com>
Date:	Tue, 16 Jun 2015 17:17:43 +0300
From:	Sergei Shtylyov <sergei.shtylyov@...entembedded.com>
To:	Jeff Kirsher <jeffrey.t.kirsher@...el.com>, davem@...emloft.net
CC:	Jacob Keller <jacob.e.keller@...el.com>, netdev@...r.kernel.org,
	nhorman@...hat.com, sassmann@...hat.com, jogreene@...hat.com
Subject: Re: [net-next 10/17] fm10k: use dma_set_mask_and_coherent in fm10k_probe

On 6/16/2015 4:47 PM, Jeff Kirsher wrote:

> From: Jacob Keller <jacob.e.keller@...el.com>

> This patch cleans up the use of dma_get_required_mask and uses the
> simpler dma_set_mask_and_coherent function instead of doing these as
> separate steps.

> I removed the dma_get_required_mask call because based on some minimal
> testing it appears that either (a) we're not doing the right thing with
> the call or (b) we don't need it anyways. If the value returned is
> <48bits, we'll end up trying with 48 bits anyways. If it's over 48bits,
> fm10k can't support that anyways, and we should try 48bits. If 48bits
> fails, we'll fallback to 32bits. This cleans up some very funky code.

> Signed-off-by: Jacob Keller <jacob.e.keller@...el.com>
> Tested-by: Krishneil Singh <Krishneil.k.singh@...el.com>
> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@...el.com>
> ---
>   drivers/net/ethernet/intel/fm10k/fm10k_pci.c | 24 ++++++------------------
>   1 file changed, 6 insertions(+), 18 deletions(-)

> diff --git a/drivers/net/ethernet/intel/fm10k/fm10k_pci.c b/drivers/net/ethernet/intel/fm10k/fm10k_pci.c
> index 5269b16..0381c8d1 100644
> --- a/drivers/net/ethernet/intel/fm10k/fm10k_pci.c
> +++ b/drivers/net/ethernet/intel/fm10k/fm10k_pci.c
> @@ -1741,30 +1741,18 @@ static int fm10k_probe(struct pci_dev *pdev,
>   	struct fm10k_intfc *interface;
>   	struct fm10k_hw *hw;
>   	int err;
> -	u64 dma_mask;
>
>   	err = pci_enable_device_mem(pdev);
>   	if (err)
>   		return err;
>
> -	/* By default fm10k only supports a 48 bit DMA mask */
> -	dma_mask = DMA_BIT_MASK(48) | dma_get_required_mask(&pdev->dev);
> -
> -	if ((dma_mask <= DMA_BIT_MASK(32)) ||
> -	    dma_set_mask_and_coherent(&pdev->dev, dma_mask)) {
> -		dma_mask &= DMA_BIT_MASK(32);
> -
> +	err = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(48));
> +	if (err)
>   		err = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32));
> -		err = dma_set_mask(&pdev->dev, DMA_BIT_MASK(32));
> -		if (err) {
> -			err = dma_set_coherent_mask(&pdev->dev,
> -						    DMA_BIT_MASK(32));
> -			if (err) {
> -				dev_err(&pdev->dev,
> -					"No usable DMA configuration, aborting\n");
> -				goto err_dma;
> -			}
> -		}
> +	if (err) {
> +		dev_err(&pdev->dev,
> +			"DMA configuration failed: 0x%x\n", err);

     Again, "%d" seems more suitable here.

[...]

WBR, Sergei

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