From patchwork Tue Sep 22 13:25:59 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mingyu Li X-Patchwork-Id: 521048 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from arrakis.dune.hu (arrakis.dune.hu [78.24.191.176]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 766F61401CD for ; Tue, 22 Sep 2015 23:28:33 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b=xb/3wV4I; dkim-atps=neutral Received: from arrakis.dune.hu (localhost [127.0.0.1]) by arrakis.dune.hu (Postfix) with ESMTP id A99BE28C720; Tue, 22 Sep 2015 15:25:59 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on arrakis.dune.hu X-Spam-Level: X-Spam-Status: No, score=-1.5 required=5.0 tests=BAYES_00,FREEMAIL_FROM, T_DKIM_INVALID autolearn=unavailable version=3.3.2 Received: from arrakis.dune.hu (localhost [127.0.0.1]) by arrakis.dune.hu (Postfix) with ESMTP id A96D328B79B for ; Tue, 22 Sep 2015 15:25:10 +0200 (CEST) X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 CL_IP_EQ_HELO_IP=-2 (check from: .gmail. - helo: .mail-pa0-f54.google. - helo-domain: .google.) FROM/MX_MATCHES_HELO(DOMAIN)=-2; rate: -8.5 Received: from mail-pa0-f54.google.com (mail-pa0-f54.google.com [209.85.220.54]) by arrakis.dune.hu (Postfix) with ESMTPS for ; Tue, 22 Sep 2015 15:25:04 +0200 (CEST) Received: by pacfv12 with SMTP id fv12so9670191pac.2 for ; Tue, 22 Sep 2015 06:26:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=apqi3w6+9xpCaZ9qLsLXGiHrxtZEaKDcvN1oLcO9rF0=; b=xb/3wV4IfOYjeV2A7rM+wF2OtMyYVI7HeWkCKT+Nie+t5fFY+W08xawnf/kaGpbE7s Mk0oFU2LCDBnhhTWmTiXb/AcW0XGenLcOxwYyAiCftqfrgIO9VX1+m1+pdRQJm3lQgih Tfp/OEEd9yr3V0ZovaM8S0i5ZXWLf1HUX3gHIyZWlnaRWAtFfhb3HGtAD7TLkw5tDkhm HNeXfdYVj/P2V79azItQpYHm0v0kiJmNCBji3tspwZrbbX0xQnkBZX/KpZ9+2vmLbtfM p8S//JAzLMzPf05aJYBtfjuohCUeg3bX+5fNCpPMMumhk6ePqS3wl5GQFJswud4IzWah iBfg== X-Received: by 10.66.175.7 with SMTP id bw7mr32018343pac.155.1442928377185; Tue, 22 Sep 2015 06:26:17 -0700 (PDT) Received: from localhost.localdomain (f45hc114.RAS.nctu.edu.tw. [140.113.45.114]) by smtp.gmail.com with ESMTPSA id fn10sm2455118pad.11.2015.09.22.06.26.15 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 22 Sep 2015 06:26:16 -0700 (PDT) From: Michael Lee To: blogic@openwrt.org Date: Tue, 22 Sep 2015 21:25:59 +0800 Message-Id: <1442928363-6219-3-git-send-email-igvtee@gmail.com> X-Mailer: git-send-email 2.3.6 In-Reply-To: <1442928363-6219-1-git-send-email-igvtee@gmail.com> References: <1442928363-6219-1-git-send-email-igvtee@gmail.com> Cc: openwrt-devel@lists.openwrt.org Subject: [OpenWrt-Devel] [PATCH 3/7] ramips: fix rx buffer length X-BeenThere: openwrt-devel@lists.openwrt.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: OpenWrt Development List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: openwrt-devel-bounces@lists.openwrt.org Sender: "openwrt-devel" From: michael lee Signed-off-by: Michael Lee --- .../ramips/files/drivers/net/ethernet/ralink/ralink_soc_eth.c | 7 ++++--- .../ramips/files/drivers/net/ethernet/ralink/ralink_soc_eth.h | 3 ++- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/target/linux/ramips/files/drivers/net/ethernet/ralink/ralink_soc_eth.c b/target/linux/ramips/files/drivers/net/ethernet/ralink/ralink_soc_eth.c index db6b197..4b31b56 100644 --- a/target/linux/ramips/files/drivers/net/ethernet/ralink/ralink_soc_eth.c +++ b/target/linux/ramips/files/drivers/net/ethernet/ralink/ralink_soc_eth.c @@ -266,7 +266,8 @@ static int fe_alloc_rx(struct fe_priv *priv) ring->rx_dma[i].rxd1 = (unsigned int) dma_addr; if (priv->flags & FE_FLAG_RX_SG_DMA) - ring->rx_dma[i].rxd2 = RX_DMA_PLEN0(ring->rx_buf_size); + ring->rx_dma[i].rxd2 = + RX_DMA_PLEN0_SET(ring->rx_buf_size); else ring->rx_dma[i].rxd2 = RX_DMA_LSO; } @@ -849,7 +850,7 @@ static int fe_poll_rx(struct napi_struct *napi, int budget, dma_unmap_single(&netdev->dev, trxd.rxd1, ring->rx_buf_size, DMA_FROM_DEVICE); - pktlen = RX_DMA_PLEN0(trxd.rxd2); + pktlen = RX_DMA_PLEN0_GET(trxd.rxd2); skb->dev = netdev; skb_put(skb, pktlen); if (trxd.rxd4 & checksum_bit) { @@ -871,7 +872,7 @@ static int fe_poll_rx(struct napi_struct *napi, int budget, release_desc: if (priv->flags & FE_FLAG_RX_SG_DMA) - rxd->rxd2 = RX_DMA_PLEN0(ring->rx_buf_size); + rxd->rxd2 = RX_DMA_PLEN0_SET(ring->rx_buf_size); else rxd->rxd2 = RX_DMA_LSO; diff --git a/target/linux/ramips/files/drivers/net/ethernet/ralink/ralink_soc_eth.h b/target/linux/ramips/files/drivers/net/ethernet/ralink/ralink_soc_eth.h index 78e04b0..8861762 100644 --- a/target/linux/ramips/files/drivers/net/ethernet/ralink/ralink_soc_eth.h +++ b/target/linux/ramips/files/drivers/net/ethernet/ralink/ralink_soc_eth.h @@ -310,7 +310,8 @@ enum fe_work_flag { /* rxd2 */ #define RX_DMA_DONE BIT(31) #define RX_DMA_LSO BIT(30) -#define RX_DMA_PLEN0(_x) (((_x) >> 16) & 0x3fff) +#define RX_DMA_PLEN0_GET(_x) (((_x) >> 16) & 0x3fff) +#define RX_DMA_PLEN0_SET(_x) (((_x) & 0x3fff) << 16) #define RX_DMA_TAG BIT(15) /* rxd3 */ #define RX_DMA_TPID(_x) (((_x) >> 16) & 0xffff)