Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp1868035imm; Thu, 2 Aug 2018 02:20:34 -0700 (PDT) X-Google-Smtp-Source: AAOMgpehwNAX1/kIo8QGpPvXMYeVcXdBpM7czXMhYxXwpvkomol87VpI/0xd7AI0WgJiQsz9IWPf X-Received: by 2002:a62:c8c2:: with SMTP id i63-v6mr2082863pfk.73.1533201633986; Thu, 02 Aug 2018 02:20:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533201633; cv=none; d=google.com; s=arc-20160816; b=nHS8NtgbOZHiBxxjexdHLZZiFvbkm4eUdL3LvNFGgUKjChmGMjr7TMnrk9pdlM2RAJ mOWW/DR8HSKD4FLc18+nbMCjC+nRJYHvm2ddQk0t7TQTLKijnyX10ldH429s6HsuGoHM KBpN3wCojYg11wDj/T54wEoAYnnaQxMH44zv/9qRsJgCsw0ixJyyhyDHaX6KE8croOUw 7rG3ExM8rX53EePLwP9mlHH13NLUQ1YC3S/AbIwWunpzAKJX7Ik4RJqNm8S1KQyp1Qbd PkivAG/Jl4peo/CJyskzDP6eQeTetBj/QWseF1pcgMKipeZrq5JZ3cUv/g0dhDvR67KI ltWw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:arc-authentication-results; bh=S4fb43B71Cz9f2gDvxKr5z+KiHH2h2RAT9XB/kqPUeY=; b=YwvsLZM/AC/4cYFFdVNnyAyRS9fOMHZeAykDph7/0T/mYIPxzqLS/TnnOfs7GAgH5P BishryexvWm+VX1Gsm/fGot1MbYQtJprCcy5PwtT9JZ/ZYW/t4LZVnU8YwFYCr9L82pV pn+LLP1S6vt0PzKK3a9vVuTSAYvnlt2B+N/X647wBr8SD2Zv0JFUk6/VyCqertpItUfT IoVWKfM//vFVOs4i4Zkahr/jOQUuBt4BIGzbn8dvYlRD5GWexl9yeW9oierqp9IPN+C2 tyAwNFJZf3BUB28wIU1WONTRTl4wKYWloGLTa7YCw63TMX/kyVqxnkfrdOQhh8QMyFYg /K9A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id i18-v6si1284541pgn.433.2018.08.02.02.20.19; Thu, 02 Aug 2018 02:20:33 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731722AbeHBLJp (ORCPT + 99 others); Thu, 2 Aug 2018 07:09:45 -0400 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:54618 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727159AbeHBLJo (ORCPT ); Thu, 2 Aug 2018 07:09:44 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id A6A3E80D; Thu, 2 Aug 2018 02:19:28 -0700 (PDT) Received: from [10.1.39.188] (desktop-vlo843j.cambridge.arm.com [10.1.39.188]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 58C8C3F5D0; Thu, 2 Aug 2018 02:19:27 -0700 (PDT) Subject: Re: [PATCH v2] net: fec: check DMA addressing limitations To: Stefan Agner , fugang.duan@nxp.com, davem@davemloft.net Cc: krzk@kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org References: <20180802084250.26489-1-stefan@agner.ch> From: Robin Murphy Message-ID: Date: Thu, 2 Aug 2018 10:19:20 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: <20180802084250.26489-1-stefan@agner.ch> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-GB Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2018-08-02 9:42 AM, Stefan Agner wrote: > Check DMA addressing limitations as suggested by the DMA API > how-to. This does not fix a particular issue seen but is > considered good style. Reviewed-by: Robin Murphy > Signed-off-by: Stefan Agner > --- > drivers/net/ethernet/freescale/fec_main.c | 8 ++++++++ > 1 file changed, 8 insertions(+) > > diff --git a/drivers/net/ethernet/freescale/fec_main.c b/drivers/net/ethernet/freescale/fec_main.c > index c729665107f5..cdf2f5447910 100644 > --- a/drivers/net/ethernet/freescale/fec_main.c > +++ b/drivers/net/ethernet/freescale/fec_main.c > @@ -3136,6 +3136,7 @@ static int fec_enet_init(struct net_device *ndev) > unsigned dsize = fep->bufdesc_ex ? sizeof(struct bufdesc_ex) : > sizeof(struct bufdesc); > unsigned dsize_log2 = __fls(dsize); > + int ret; > > WARN_ON(dsize != (1 << dsize_log2)); > #if defined(CONFIG_ARM) || defined(CONFIG_ARM64) > @@ -3146,6 +3147,13 @@ static int fec_enet_init(struct net_device *ndev) > fep->tx_align = 0x3; > #endif > > + /* Check mask of the streaming and coherent API */ > + ret = dma_set_mask_and_coherent(&fep->pdev->dev, DMA_BIT_MASK(32)); > + if (ret < 0) { > + dev_warn(&fep->pdev->dev, "No suitable DMA available\n"); > + return ret; > + } > + > fec_enet_alloc_queue(ndev); > > bd_size = (fep->total_tx_ring_size + fep->total_rx_ring_size) * dsize; >