[OpenWrt-Devel] [PATCH 3/7] ramips: fix rx buffer length

Michael Lee igvtee at gmail.com
Tue Sep 22 09:25:59 EDT 2015


From: michael lee <igvtee at gmail.com>

Signed-off-by: Michael Lee <igvtee at gmail.com>
---
 .../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)
-- 
2.3.6
_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel



More information about the openwrt-devel mailing list