From patchwork Wed May 7 08:14:00 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Byungho An X-Patchwork-Id: 4126401 Return-Path: X-Original-To: patchwork-linux-samsung-soc@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 3A8C39F1E1 for ; Wed, 7 May 2014 08:14:10 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 65BEE20222 for ; Wed, 7 May 2014 08:14:09 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id C670C201C8 for ; Wed, 7 May 2014 08:14:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753928AbaEGIOG (ORCPT ); Wed, 7 May 2014 04:14:06 -0400 Received: from mailout3.samsung.com ([203.254.224.33]:59404 "EHLO mailout3.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752675AbaEGIOC (ORCPT ); Wed, 7 May 2014 04:14:02 -0400 Received: from epcpsbgr1.samsung.com (u141.gpu120.samsung.co.kr [203.254.230.141]) by mailout3.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0N57009SM2VDM2D0@mailout3.samsung.com>; Wed, 07 May 2014 17:14:01 +0900 (KST) Received: from epcpsbgm1.samsung.com ( [203.254.230.49]) by epcpsbgr1.samsung.com (EPCPMTA) with SMTP id 12.1D.18501.94BE9635; Wed, 07 May 2014 17:14:01 +0900 (KST) X-AuditID: cbfee68d-b7f4e6d000004845-59-5369eb49882f Received: from epmmp1.local.host ( [203.254.227.16]) by epcpsbgm1.samsung.com (EPCPMTA) with SMTP id AA.3E.27725.84BE9635; Wed, 07 May 2014 17:14:01 +0900 (KST) Received: from DObh74an01 ([12.36.166.149]) by mmp1.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTPA id <0N57000ZW2VCYT50@mmp1.samsung.com>; Wed, 07 May 2014 17:14:00 +0900 (KST) From: Byungho An To: netdev@vger.kernel.org, linux-samsung-soc@vger.kernel.org Cc: davem@davemloft.net, ks.giri@samsung.com, vipul.pandya@samsung.com Subject: [PATCH] net: sxgbe: Added tail point update Date: Wed, 07 May 2014 17:14:00 +0900 Message-id: <008b01cf69cc$4d304e50$e790eaf0$%an@samsung.com> MIME-version: 1.0 Content-type: text/plain; charset=us-ascii Content-transfer-encoding: 7bit X-Mailer: Microsoft Office Outlook 12.0 Thread-index: Ac9pzE0XSfLYvJBMQH+/Z23wToIh9A== Content-language: ko X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrKIsWRmVeSWpSXmKPExsVy+t8zQ13P15nBBv/vcVnMOd/CYjH/6A4m ixnn9zFZHFsgZrFtwQVmB1aPLStvMnn0bVnF6PF5k1wAcxSXTUpqTmZZapG+XQJXxp2pfWwF J2QqLm/fwtLA+ES8i5GTQ0LARKL11FZmCFtM4sK99WxdjFwcQgLLGCXOLVvBCFO06NQNFojE IkaJ15OOsUI4vxklOk99YwWpYhNQk2ieeZkNxBYRsJVYcuQzO4jNLOAmsf/ybbAaYaBJB67v AlvHIqAqsXfTErA4r4CNxNNNK9kgbEGJH5PvsUD0akms33mcCcKWl9i85i1QLwfQReoSj/7q QqzSk3i48BJUuYjEvhfvGEFukxDYxC6xZMFmdohdAhLfJh9igeiVldh0AOpjSYmDK26wTGAU m4Vk8ywkm2ch2TwLyYoFjCyrGEVTC5ILipPSiwz1ihNzi0vz0vWS83M3MUKirHcH4+0D1ocY k4HWT2SWEk3OB0ZpXkm8obGZkYWpiamxkbmlGWnCSuK8SQ+TgoQE0hNLUrNTUwtSi+KLSnNS iw8xMnFwSjUwFuo9/LFqLdsb1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QAAQEnGJQMAAA== DLP-Filter: Pass X-MTR: 20000000000000000@CPGS X-CFilter-Loop: Reflected Sender: linux-samsung-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org X-Spam-Status: No, score=-7.5 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This patch adds tail point update function for rx path after rx_refill function. It indicates tail point for rx dma. Signed-off-by: Byungho An --- drivers/net/ethernet/samsung/sxgbe/sxgbe_dma.c | 14 +++++++++++++- drivers/net/ethernet/samsung/sxgbe/sxgbe_dma.h | 4 ++++ drivers/net/ethernet/samsung/sxgbe/sxgbe_main.c | 5 +++++ 3 files changed, 22 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/samsung/sxgbe/sxgbe_dma.c b/drivers/net/ethernet/samsung/sxgbe/sxgbe_dma.c index 49240c9..249b0e0 100644 --- a/drivers/net/ethernet/samsung/sxgbe/sxgbe_dma.c +++ b/drivers/net/ethernet/samsung/sxgbe/sxgbe_dma.c @@ -112,7 +112,7 @@ static void sxgbe_dma_channel_init(void __iomem *ioaddr, int cha_num, dma_addr = dma_rx + ((r_rsize - 1) * SXGBE_DESC_SIZE_BYTES); writel(lower_32_bits(dma_addr), - ioaddr + SXGBE_DMA_CHA_RXDESC_LADD_REG(cha_num)); + ioaddr + SXGBE_DMA_CHA_RXDESC_TAILPTR_REG(cha_num)); /* program the ring sizes */ writel(t_rsize - 1, ioaddr + SXGBE_DMA_CHA_TXDESC_RINGLEN_REG(cha_num)); writel(r_rsize - 1, ioaddr + SXGBE_DMA_CHA_RXDESC_RINGLEN_REG(cha_num)); @@ -370,6 +370,17 @@ static void sxgbe_enable_tso(void __iomem *ioaddr, u8 chan_num) writel(ctrl, ioaddr + SXGBE_DMA_CHA_TXCTL_REG(chan_num)); } +static void sxgbe_dma_update_rxdesc_tail_ptr(void __iomem *ioaddr, u8 chan_num, + dma_addr_t dma_rx_phy, int cur_rx, + int rxsize) +{ + u32 reg_val; + + reg_val = (dma_rx_phy & 0xFFFFFFFF) + ((cur_rx % rxsize) * + SXGBE_DESC_SIZE_BYTES); + writel(reg_val, ioaddr + SXGBE_DMA_CHA_RXDESC_TAILPTR_REG(chan_num)); +} + static const struct sxgbe_dma_ops sxgbe_dma_ops = { .init = sxgbe_dma_init, .cha_init = sxgbe_dma_channel_init, @@ -386,6 +397,7 @@ static const struct sxgbe_dma_ops sxgbe_dma_ops = { .rx_dma_int_status = sxgbe_rx_dma_int_status, .rx_watchdog = sxgbe_dma_rx_watchdog, .enable_tso = sxgbe_enable_tso, + .update_rxdesc_tail_ptr = sxgbe_dma_update_rxdesc_tail_ptr, }; const struct sxgbe_dma_ops *sxgbe_get_dma_ops(void) diff --git a/drivers/net/ethernet/samsung/sxgbe/sxgbe_dma.h b/drivers/net/ethernet/samsung/sxgbe/sxgbe_dma.h index 843fa9b..a06e01e 100644 --- a/drivers/net/ethernet/samsung/sxgbe/sxgbe_dma.h +++ b/drivers/net/ethernet/samsung/sxgbe/sxgbe_dma.h @@ -43,6 +43,10 @@ struct sxgbe_dma_ops { void (*rx_watchdog)(void __iomem *ioaddr, u32 riwt); /* Enable TSO for each DMA channel */ void (*enable_tso)(void __iomem *ioaddr, u8 chan_num); + void (*update_rxdesc_tail_ptr)(void __iomem *ioaddr, u8 chan_num, + dma_addr_t dma_rx, int r_rentry, + int r_rsize); + }; const struct sxgbe_dma_ops *sxgbe_get_dma_ops(void); diff --git a/drivers/net/ethernet/samsung/sxgbe/sxgbe_main.c b/drivers/net/ethernet/samsung/sxgbe/sxgbe_main.c index 93bf151..7dc3449 100644 --- a/drivers/net/ethernet/samsung/sxgbe/sxgbe_main.c +++ b/drivers/net/ethernet/samsung/sxgbe/sxgbe_main.c @@ -1521,6 +1521,7 @@ static int sxgbe_rx(struct sxgbe_priv_data *priv, int limit) skb_put(skb, frame_len); skb->ip_summed = checksum; + skb->protocol = eth_type_trans(skb, priv->dev); if (checksum == CHECKSUM_NONE) netif_receive_skb(skb); else @@ -1530,6 +1531,10 @@ static int sxgbe_rx(struct sxgbe_priv_data *priv, int limit) } sxgbe_rx_refill(priv); + priv->hw->dma->update_rxdesc_tail_ptr(priv->ioaddr, qnum, + priv->rxq[qnum]->dma_rx_phy, + priv->rxq[qnum]->cur_rx, + priv->dma_rx_size); return count; }