aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNimrod Andy <B38611@freescale.com>2014-06-11 20:16:21 -0400
committerDavid S. Miller <davem@davemloft.net>2014-06-12 14:01:57 -0400
commit55d0218ae2e23eb8a4da1f277eba53ba4edb9a26 (patch)
tree043d555c5ed3c2e792867b732439e48fe4bf1410
parent09d1e541fd906861805446af4bb6236a0d2cf09b (diff)
net: fec: Increase buffer descriptor entry number
In order to support SG, software TSO, let's increase BD entry number. CC: Ezequiel Garcia <ezequiel.garcia@free-electrons.com> CC: Eric Dumazet <eric.dumazet@gmail.com> CC: David Laight <David.Laight@ACULAB.COM> Signed-off-by: Fugang Duan <B38611@freescale.com> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--drivers/net/ethernet/freescale/fec.h4
-rw-r--r--drivers/net/ethernet/freescale/fec_main.c29
2 files changed, 17 insertions, 16 deletions
diff --git a/drivers/net/ethernet/freescale/fec.h b/drivers/net/ethernet/freescale/fec.h
index db967a08637d..5ffd32308b9c 100644
--- a/drivers/net/ethernet/freescale/fec.h
+++ b/drivers/net/ethernet/freescale/fec.h
@@ -246,8 +246,8 @@ struct bufdesc_ex {
246#define RX_RING_SIZE (FEC_ENET_RX_FRPPG * FEC_ENET_RX_PAGES) 246#define RX_RING_SIZE (FEC_ENET_RX_FRPPG * FEC_ENET_RX_PAGES)
247#define FEC_ENET_TX_FRSIZE 2048 247#define FEC_ENET_TX_FRSIZE 2048
248#define FEC_ENET_TX_FRPPG (PAGE_SIZE / FEC_ENET_TX_FRSIZE) 248#define FEC_ENET_TX_FRPPG (PAGE_SIZE / FEC_ENET_TX_FRSIZE)
249#define TX_RING_SIZE 16 /* Must be power of two */ 249#define TX_RING_SIZE 512 /* Must be power of two */
250#define TX_RING_MOD_MASK 15 /* for this to work */ 250#define TX_RING_MOD_MASK 511 /* for this to work */
251 251
252#define BD_ENET_RX_INT 0x00800000 252#define BD_ENET_RX_INT 0x00800000
253#define BD_ENET_RX_PTP ((ushort)0x0400) 253#define BD_ENET_RX_PTP ((ushort)0x0400)
diff --git a/drivers/net/ethernet/freescale/fec_main.c b/drivers/net/ethernet/freescale/fec_main.c
index f943cd142ef7..b27a729222b8 100644
--- a/drivers/net/ethernet/freescale/fec_main.c
+++ b/drivers/net/ethernet/freescale/fec_main.c
@@ -173,10 +173,6 @@ MODULE_PARM_DESC(macaddr, "FEC Ethernet MAC address");
173#endif 173#endif
174#endif /* CONFIG_M5272 */ 174#endif /* CONFIG_M5272 */
175 175
176#if (((RX_RING_SIZE + TX_RING_SIZE) * 32) > PAGE_SIZE)
177#error "FEC: descriptor ring size constants too large"
178#endif
179
180/* Interrupt events/masks. */ 176/* Interrupt events/masks. */
181#define FEC_ENET_HBERR ((uint)0x80000000) /* Heartbeat error */ 177#define FEC_ENET_HBERR ((uint)0x80000000) /* Heartbeat error */
182#define FEC_ENET_BABR ((uint)0x40000000) /* Babbling receiver */ 178#define FEC_ENET_BABR ((uint)0x40000000) /* Babbling receiver */
@@ -2048,9 +2044,21 @@ static int fec_enet_init(struct net_device *ndev)
2048 const struct platform_device_id *id_entry = 2044 const struct platform_device_id *id_entry =
2049 platform_get_device_id(fep->pdev); 2045 platform_get_device_id(fep->pdev);
2050 struct bufdesc *cbd_base; 2046 struct bufdesc *cbd_base;
2047 int bd_size;
2048
2049 /* init the tx & rx ring size */
2050 fep->tx_ring_size = TX_RING_SIZE;
2051 fep->rx_ring_size = RX_RING_SIZE;
2052
2053 if (fep->bufdesc_ex)
2054 fep->bufdesc_size = sizeof(struct bufdesc_ex);
2055 else
2056 fep->bufdesc_size = sizeof(struct bufdesc);
2057 bd_size = (fep->tx_ring_size + fep->rx_ring_size) *
2058 fep->bufdesc_size;
2051 2059
2052 /* Allocate memory for buffer descriptors. */ 2060 /* Allocate memory for buffer descriptors. */
2053 cbd_base = dma_alloc_coherent(NULL, PAGE_SIZE, &fep->bd_dma, 2061 cbd_base = dma_alloc_coherent(NULL, bd_size, &fep->bd_dma,
2054 GFP_KERNEL); 2062 GFP_KERNEL);
2055 if (!cbd_base) 2063 if (!cbd_base)
2056 return -ENOMEM; 2064 return -ENOMEM;
@@ -2064,20 +2072,13 @@ static int fec_enet_init(struct net_device *ndev)
2064 /* make sure MAC we just acquired is programmed into the hw */ 2072 /* make sure MAC we just acquired is programmed into the hw */
2065 fec_set_mac_address(ndev, NULL); 2073 fec_set_mac_address(ndev, NULL);
2066 2074
2067 /* init the tx & rx ring size */
2068 fep->tx_ring_size = TX_RING_SIZE;
2069 fep->rx_ring_size = RX_RING_SIZE;
2070
2071 /* Set receive and transmit descriptor base. */ 2075 /* Set receive and transmit descriptor base. */
2072 fep->rx_bd_base = cbd_base; 2076 fep->rx_bd_base = cbd_base;
2073 if (fep->bufdesc_ex) { 2077 if (fep->bufdesc_ex)
2074 fep->tx_bd_base = (struct bufdesc *) 2078 fep->tx_bd_base = (struct bufdesc *)
2075 (((struct bufdesc_ex *)cbd_base) + fep->rx_ring_size); 2079 (((struct bufdesc_ex *)cbd_base) + fep->rx_ring_size);
2076 fep->bufdesc_size = sizeof(struct bufdesc_ex); 2080 else
2077 } else {
2078 fep->tx_bd_base = cbd_base + fep->rx_ring_size; 2081 fep->tx_bd_base = cbd_base + fep->rx_ring_size;
2079 fep->bufdesc_size = sizeof(struct bufdesc);
2080 }
2081 2082
2082 /* The FEC Ethernet specific entries in the device structure */ 2083 /* The FEC Ethernet specific entries in the device structure */
2083 ndev->watchdog_timeo = TX_TIMEOUT; 2084 ndev->watchdog_timeo = TX_TIMEOUT;