From patchwork Thu Nov 29 08:08:37 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kunihiko Hayashi X-Patchwork-Id: 152373 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp2088443ljp; Thu, 29 Nov 2018 00:08:49 -0800 (PST) X-Google-Smtp-Source: AFSGD/XmoYEVyGx1Y2X9AiRN1zpm6FbEXbpzq+bCOdChLzXLbKBscmFET6ubeRY7g4FQmdS/5BS5 X-Received: by 2002:a17:902:b48b:: with SMTP id y11mr489258plr.200.1543478929350; Thu, 29 Nov 2018 00:08:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543478929; cv=none; d=google.com; s=arc-20160816; b=tjQqShxaznC/n97NZn7EjzXq4KHVrsTKRd1wigyK2exgG1P7RAU84g4NQQQgrkzgKn x4fp42KlazB74mqxjHOZs/H7gTeeJtqPOnadQMrO+ztfceugcBZBGpQPXZHOy/ueZGsf 5cwz5llV2SCW6bngLFkCC3riMAx1TrjcMO/8MDli3n9684CMGRt5jsOLw6nY21Y+n+v9 KU8DCz3VvDgGKmXQu7znfOecHGXsh8nuPNNJ5LT37eM1ewvHYo+7mMFPyFKBYvetHOaK kZ/Nw02/+n6NwWLKP9t1iR/sXpueGGalx7fvoOfYVjPJC5XNxWPR53QwiutX2PnaqfPz CUjg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from; bh=TJfZcJDHbTkf6DYzC7h+3CdpbodRUdhUJAdzqXLTOKA=; b=nLpZ7v26g/OrxwmyODk1Xj65YVKfgMvrUmbAE1asgAXHPUziLWA2WKEYC1TbawFWpN BCqR7clQz96JndbITMMfXoQYuL2Iaa8Y32Eu4GQ2Rr8+luuyYeCv8CcfNaS3ITRFHLGv YJig4cG08GgriDy40tZJp7HMgfSP5JNuBDo7GgmC+Jzm3IdSQMwoybKC0mJ8C5MW0/rf SeQjTcLf9uTCkaUyH57FwhPu4gLjBCpFslCmAfQ4MjA32RbCYnzbSesgvueWwkQnrsl2 HxQo3ntEi5rVOKXOjR7094edHcGG5CI0BdN24WMDa9OvcrUAlnV7jUTxryAV6MFpYG6C B8FQ== 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 a18si1320288pgj.77.2018.11.29.00.08.49; Thu, 29 Nov 2018 00:08:49 -0800 (PST) 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 S1728033AbeK2TNS (ORCPT + 32 others); Thu, 29 Nov 2018 14:13:18 -0500 Received: from mx.socionext.com ([202.248.49.38]:4139 "EHLO mx.socionext.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727944AbeK2TNS (ORCPT ); Thu, 29 Nov 2018 14:13:18 -0500 Received: from unknown (HELO iyokan-ex.css.socionext.com) ([172.31.9.54]) by mx.socionext.com with ESMTP; 29 Nov 2018 17:08:45 +0900 Received: from mail.mfilter.local (m-filter-1 [10.213.24.61]) by iyokan-ex.css.socionext.com (Postfix) with ESMTP id BE32960062; Thu, 29 Nov 2018 17:08:45 +0900 (JST) Received: from 172.31.9.51 (172.31.9.51) by m-FILTER with ESMTP; Thu, 29 Nov 2018 17:08:45 +0900 Received: from plum.e01.socionext.com (unknown [10.213.132.32]) by kinkan.css.socionext.com (Postfix) with ESMTP id 4CBB61A03A2; Thu, 29 Nov 2018 17:08:45 +0900 (JST) From: Kunihiko Hayashi To: "David S. Miller" Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Kunihiko Hayashi Subject: [PATCH net 2/3] net: ethernet: ave: Replace NET_IP_ALIGN with AVE_FRAME_HEADROOM Date: Thu, 29 Nov 2018 17:08:37 +0900 Message-Id: <1543478918-13883-3-git-send-email-hayashi.kunihiko@socionext.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1543478918-13883-1-git-send-email-hayashi.kunihiko@socionext.com> References: <1543478918-13883-1-git-send-email-hayashi.kunihiko@socionext.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org In commit 26a4676faa1a ("arm64: mm: define NET_IP_ALIGN to 0"), AVE controller affects this modification because the controller forces to ignore lower 2bits of buffer start address, and make 2-byte headroom, that is, data reception starts from (buffer + 2). This patch defines AVE_FRAME_HEADROOM macro as hardware-specific value, and replaces NET_IP_ALIGN with it. Signed-off-by: Kunihiko Hayashi --- drivers/net/ethernet/socionext/sni_ave.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) -- 2.7.4 diff --git a/drivers/net/ethernet/socionext/sni_ave.c b/drivers/net/ethernet/socionext/sni_ave.c index 598b963..6710151 100644 --- a/drivers/net/ethernet/socionext/sni_ave.c +++ b/drivers/net/ethernet/socionext/sni_ave.c @@ -194,6 +194,7 @@ /* Parameter for ethernet frame */ #define AVE_MAX_ETHFRAME 1518 +#define AVE_FRAME_HEADROOM 2 /* Parameter for interrupt */ #define AVE_INTM_COUNT 20 @@ -577,12 +578,13 @@ static int ave_rxdesc_prepare(struct net_device *ndev, int entry) skb = priv->rx.desc[entry].skbs; if (!skb) { - skb = netdev_alloc_skb_ip_align(ndev, - AVE_MAX_ETHFRAME); + skb = netdev_alloc_skb(ndev, AVE_MAX_ETHFRAME); if (!skb) { netdev_err(ndev, "can't allocate skb for Rx\n"); return -ENOMEM; } + skb->data += AVE_FRAME_HEADROOM; + skb->tail += AVE_FRAME_HEADROOM; } /* set disable to cmdsts */ @@ -595,12 +597,12 @@ static int ave_rxdesc_prepare(struct net_device *ndev, int entry) * - Rx buffer begins with 2 byte headroom, and data will be put from * (buffer + 2). * To satisfy this, specify the address to put back the buffer - * pointer advanced by NET_IP_ALIGN by netdev_alloc_skb_ip_align(), - * and expand the map size by NET_IP_ALIGN. + * pointer advanced by AVE_FRAME_HEADROOM, and expand the map size + * by AVE_FRAME_HEADROOM. */ ret = ave_dma_map(ndev, &priv->rx.desc[entry], - skb->data - NET_IP_ALIGN, - AVE_MAX_ETHFRAME + NET_IP_ALIGN, + skb->data - AVE_FRAME_HEADROOM, + AVE_MAX_ETHFRAME + AVE_FRAME_HEADROOM, DMA_FROM_DEVICE, &paddr); if (ret) { netdev_err(ndev, "can't map skb for Rx\n");