@@ -173,10 +173,6 @@ MODULE_PARM_DESC(macaddr, "FEC Ethernet MAC address");
173
173
#endif
174
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
176
/* Interrupt events/masks. */
181
177
#define FEC_ENET_HBERR ((uint)0x80000000) /* Heartbeat error */
182
178
#define FEC_ENET_BABR ((uint)0x40000000) /* Babbling receiver */
@@ -2048,9 +2044,21 @@ static int fec_enet_init(struct net_device *ndev)
2048
2044
const struct platform_device_id * id_entry =
2049
2045
platform_get_device_id (fep -> pdev );
2050
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
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
2062
GFP_KERNEL );
2055
2063
if (!cbd_base )
2056
2064
return - ENOMEM ;
@@ -2064,20 +2072,13 @@ static int fec_enet_init(struct net_device *ndev)
2064
2072
/* make sure MAC we just acquired is programmed into the hw */
2065
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
2075
/* Set receive and transmit descriptor base. */
2072
2076
fep -> rx_bd_base = cbd_base ;
2073
- if (fep -> bufdesc_ex ) {
2077
+ if (fep -> bufdesc_ex )
2074
2078
fep -> tx_bd_base = (struct bufdesc * )
2075
2079
(((struct bufdesc_ex * )cbd_base ) + fep -> rx_ring_size );
2076
- fep -> bufdesc_size = sizeof (struct bufdesc_ex );
2077
- } else {
2080
+ else
2078
2081
fep -> tx_bd_base = cbd_base + fep -> rx_ring_size ;
2079
- fep -> bufdesc_size = sizeof (struct bufdesc );
2080
- }
2081
2082
2082
2083
/* The FEC Ethernet specific entries in the device structure */
2083
2084
ndev -> watchdog_timeo = TX_TIMEOUT ;
0 commit comments