Skip to content

Commit 55d0218

Browse files
Nimrod Andydavem330
authored andcommitted
net: fec: Increase buffer descriptor entry number
In order to support SG, software TSO, let's increase BD entry number. CC: Ezequiel Garcia <[email protected]> CC: Eric Dumazet <[email protected]> CC: David Laight <[email protected]> Signed-off-by: Fugang Duan <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 09d1e54 commit 55d0218

File tree

2 files changed

+17
-16
lines changed

2 files changed

+17
-16
lines changed

drivers/net/ethernet/freescale/fec.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -246,8 +246,8 @@ struct bufdesc_ex {
246246
#define RX_RING_SIZE (FEC_ENET_RX_FRPPG * FEC_ENET_RX_PAGES)
247247
#define FEC_ENET_TX_FRSIZE 2048
248248
#define FEC_ENET_TX_FRPPG (PAGE_SIZE / FEC_ENET_TX_FRSIZE)
249-
#define TX_RING_SIZE 16 /* Must be power of two */
250-
#define TX_RING_MOD_MASK 15 /* for this to work */
249+
#define TX_RING_SIZE 512 /* Must be power of two */
250+
#define TX_RING_MOD_MASK 511 /* for this to work */
251251

252252
#define BD_ENET_RX_INT 0x00800000
253253
#define BD_ENET_RX_PTP ((ushort)0x0400)

drivers/net/ethernet/freescale/fec_main.c

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -173,10 +173,6 @@ MODULE_PARM_DESC(macaddr, "FEC Ethernet MAC address");
173173
#endif
174174
#endif /* CONFIG_M5272 */
175175

176-
#if (((RX_RING_SIZE + TX_RING_SIZE) * 32) > PAGE_SIZE)
177-
#error "FEC: descriptor ring size constants too large"
178-
#endif
179-
180176
/* Interrupt events/masks. */
181177
#define FEC_ENET_HBERR ((uint)0x80000000) /* Heartbeat error */
182178
#define FEC_ENET_BABR ((uint)0x40000000) /* Babbling receiver */
@@ -2048,9 +2044,21 @@ static int fec_enet_init(struct net_device *ndev)
20482044
const struct platform_device_id *id_entry =
20492045
platform_get_device_id(fep->pdev);
20502046
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;
20512059

20522060
/* 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,
20542062
GFP_KERNEL);
20552063
if (!cbd_base)
20562064
return -ENOMEM;
@@ -2064,20 +2072,13 @@ static int fec_enet_init(struct net_device *ndev)
20642072
/* make sure MAC we just acquired is programmed into the hw */
20652073
fec_set_mac_address(ndev, NULL);
20662074

2067-
/* init the tx & rx ring size */
2068-
fep->tx_ring_size = TX_RING_SIZE;
2069-
fep->rx_ring_size = RX_RING_SIZE;
2070-
20712075
/* Set receive and transmit descriptor base. */
20722076
fep->rx_bd_base = cbd_base;
2073-
if (fep->bufdesc_ex) {
2077+
if (fep->bufdesc_ex)
20742078
fep->tx_bd_base = (struct bufdesc *)
20752079
(((struct bufdesc_ex *)cbd_base) + fep->rx_ring_size);
2076-
fep->bufdesc_size = sizeof(struct bufdesc_ex);
2077-
} else {
2080+
else
20782081
fep->tx_bd_base = cbd_base + fep->rx_ring_size;
2079-
fep->bufdesc_size = sizeof(struct bufdesc);
2080-
}
20812082

20822083
/* The FEC Ethernet specific entries in the device structure */
20832084
ndev->watchdog_timeo = TX_TIMEOUT;

0 commit comments

Comments
 (0)