From patchwork Tue Apr 23 06:01:41 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ilias Apalodimas X-Patchwork-Id: 162654 Delivered-To: patch@linaro.org Received: by 2002:a02:c6d8:0:0:0:0:0 with SMTP id r24csp3406876jan; Mon, 22 Apr 2019 23:01:55 -0700 (PDT) X-Google-Smtp-Source: APXvYqymxGwiIAsfOp3F9Ao7Qq4QK+hNDHhSsPwL219vjxXRZLdpHipoj1UYR//Htn1gCKKMv+8b X-Received: by 2002:aa7:8818:: with SMTP id c24mr5207199pfo.129.1555999315418; Mon, 22 Apr 2019 23:01:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1555999315; cv=none; d=google.com; s=arc-20160816; b=ZEzA2oh7BlA73yk4+oS0b7Mwl7JJu2/77t3vwcBdaWAQyk6zA11pPJHshdBVV3TQGO 9AG6S9mfGsikoFNfDCI/9an/JwXL/pjJP5B9+tECYgTJfrvlVLMUqUDtg6WLfYxCy9ay IfDFdXPoE+902ijCBrfU5ldJBRN9jL6FX3RmUjAsGmqflpyVY1SKfyDACd4mi2tX2qZk XFD3TxHVvjdY2bR+Dv75d5qz9auowbUXCn49mmmivNv7dFFJivcOPT9gRUN9BQiQ2FXi 8f404Rfb+gbRuCHhW6T4i02xCYh7TwO2eKS9UjCsv6CiRehcoabdPRDlXYSXYdltodIx 4lpg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature; bh=DdaM/BLqoBhZc1ZXGu9hCwQRCNfgOUtiZeu0B3ea5zQ=; b=Oj90GuiyTMkflOEiiEmDmncRXM8E7HbBp25tTQJKi63A1FUCbGv1IxRRj39lQ31bKT AC4+gUxg4nSOSfJyOoDxH0Q5x40vEmlR5LXOOzxI9i29pNgDCC4oS5FrC8TQqo9deRPT yi28vfm9FSZvhqCGqQUM3sy2UOnSWtbsBk5nvLSERknn834w41JWz9ktLqj7cVMDU3if 8iKAMYybVz380HIgr8pDFtNg5nsuUSxy8WPZZB+GoaaZ0a9EffuEkglTU8eC1lNuPYvQ ZwgSmm3iJjGfVb69OppP+onVyW4LM48gX/6G+hCOXGWhkc5qiscUbRrSjCtMh1WGEa+r il9A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=pSJ4YlwJ; spf=pass (google.com: best guess record for domain of netdev-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=netdev-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e11si15051487pfd.88.2019.04.22.23.01.55; Mon, 22 Apr 2019 23:01:55 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of netdev-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=pSJ4YlwJ; spf=pass (google.com: best guess record for domain of netdev-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=netdev-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726004AbfDWGBy (ORCPT + 9 others); Tue, 23 Apr 2019 02:01:54 -0400 Received: from mail-wm1-f65.google.com ([209.85.128.65]:55937 "EHLO mail-wm1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725916AbfDWGBx (ORCPT ); Tue, 23 Apr 2019 02:01:53 -0400 Received: by mail-wm1-f65.google.com with SMTP id o25so17010814wmf.5 for ; Mon, 22 Apr 2019 23:01:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=DdaM/BLqoBhZc1ZXGu9hCwQRCNfgOUtiZeu0B3ea5zQ=; b=pSJ4YlwJMNvlzOLgvRsNTupa0u1e7/NdkT5k4BgqDvasZdPRClPBFgA42/qYaCv5QC SAXkyHD058cK9Rd67V2X2QvZxpV5/t/sSSbwkpgcTk0xrc89y5DyrB3ZCslNo5V7jW3/ 6J2mrs6rpsXF2it4+9cML1Ibhyhup0BdcQT2veaOdCwYI60eC+MsxuKygA0aICFPB0Dx nP9nxO/j0pge+77yFf84JkmQd4eSWk4lr0IFToiLoqshOGBrQoPEzn2pLbsxKIK6bfLu MdiRUvH3/Y3F/GtTUuvgDvc0wECekqBuvOWjoeYr9uSYH/fDzkH07tr/dUseg+Y/PiLM Mrng== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=DdaM/BLqoBhZc1ZXGu9hCwQRCNfgOUtiZeu0B3ea5zQ=; b=VwJ5Q76yQKgVzWZC5cVxubXJ1UnoPYOlUlMPoXRd3PWYQaGBTmsukcFBkPSSktSJ9s Yr8GnBHUfgKyK//GwbbPDRdlwdQWUp3jG0CU5UZPZaBOO3kvKrAVG0RiDDcm2aoaVdh5 j96tcMIvI8bs/Lz3igEhAcr2e+2+hA6jvmbsejGG+PpKxQPyBSJSbZrngGgqZmT3E3e7 3kTPI4ro2XPhnUB8xsuEefOiUyvjyYdbBn0ZHoOTOdBVDaT3PJqFbc6B5XryDaDoUhwk OjW1yFe8PrEisAbDsK5qcYHFy1M6sdFJ8wdSOJPzyVc/ho+IWbDmDN+lPG1GSdBAdlEa DTEg== X-Gm-Message-State: APjAAAVMN3a+Gsev/ZHTxJ6uvIoTOSf4+bVFR+L8KZ+oeWsRa4kUv4pw TaTPIrF4ZOaBCyu3zdVI5SrMEw== X-Received: by 2002:a1c:208c:: with SMTP id g134mr867982wmg.70.1555999312205; Mon, 22 Apr 2019 23:01:52 -0700 (PDT) Received: from apalos.lan (athedsl-4485328.home.otenet.gr. [94.71.60.216]) by smtp.gmail.com with ESMTPSA id z11sm13371587wmf.12.2019.04.22.23.01.50 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 22 Apr 2019 23:01:51 -0700 (PDT) From: Ilias Apalodimas To: jaswinder.singh@linaro.org Cc: netdev@vger.kernel.org, ard.biesheuvel@linaro.org, masahisa.kojima@linaro.org, davem@davemloft.net, Ilias Apalodimas Subject: [PATCH 1/1, v2] net: socionext: replace napi_alloc_frag with the netdev variant on init Date: Tue, 23 Apr 2019 09:01:41 +0300 Message-Id: <1555999301-20818-1-git-send-email-ilias.apalodimas@linaro.org> X-Mailer: git-send-email 2.7.4 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org The netdev variant is usable on any context since it disables interrupts. The napi variant of the call should only be used within softirq context. Replace napi_alloc_frag on driver init with the correct netdev_alloc_frag call Changes since v1: - Adjusted commit message Acked-by: Ard Biesheuvel Acked-by: Jassi Brar Fixes: 4acb20b46214 ("net: socionext: different approach on DMA") Signed-off-by: Ilias Apalodimas --- drivers/net/ethernet/socionext/netsec.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) -- 2.7.4 diff --git a/drivers/net/ethernet/socionext/netsec.c b/drivers/net/ethernet/socionext/netsec.c index a18149720aa2..cba5881b2746 100644 --- a/drivers/net/ethernet/socionext/netsec.c +++ b/drivers/net/ethernet/socionext/netsec.c @@ -673,7 +673,8 @@ static void netsec_process_tx(struct netsec_priv *priv) } static void *netsec_alloc_rx_data(struct netsec_priv *priv, - dma_addr_t *dma_handle, u16 *desc_len) + dma_addr_t *dma_handle, u16 *desc_len, + bool napi) { size_t total_len = SKB_DATA_ALIGN(sizeof(struct skb_shared_info)); size_t payload_len = NETSEC_RX_BUF_SZ; @@ -682,7 +683,7 @@ static void *netsec_alloc_rx_data(struct netsec_priv *priv, total_len += SKB_DATA_ALIGN(payload_len + NETSEC_SKB_PAD); - buf = napi_alloc_frag(total_len); + buf = napi ? napi_alloc_frag(total_len) : netdev_alloc_frag(total_len); if (!buf) return NULL; @@ -765,7 +766,8 @@ static int netsec_process_rx(struct netsec_priv *priv, int budget) /* allocate a fresh buffer and map it to the hardware. * This will eventually replace the old buffer in the hardware */ - buf_addr = netsec_alloc_rx_data(priv, &dma_handle, &desc_len); + buf_addr = netsec_alloc_rx_data(priv, &dma_handle, &desc_len, + true); if (unlikely(!buf_addr)) break; @@ -1069,7 +1071,8 @@ static int netsec_setup_rx_dring(struct netsec_priv *priv) void *buf; u16 len; - buf = netsec_alloc_rx_data(priv, &dma_handle, &len); + buf = netsec_alloc_rx_data(priv, &dma_handle, &len, + false); if (!buf) { netsec_uninit_pkt_dring(priv, NETSEC_RING_RX); goto err_out;