diff options
author | Li Yang <leoli@freescale.com> | 2007-07-18 23:48:29 -0400 |
---|---|---|
committer | Jeff Garzik <jeff@garzik.org> | 2007-07-24 16:28:38 -0400 |
commit | 890de95e8fe617a978e0fcad3c5dd2be99db4532 (patch) | |
tree | 528a145f827d0e87db7e32c321a91dab347f436d /drivers/net | |
parent | ac421852b3a01e7440ac7bb2e635b60a99d0a391 (diff) |
ucc_geth: add support to netif message level
Adds netif message level control to the ucc_geth driver. The level can
be set by module parameter and ethtool.
Signed-off-by: Li Yang <leoli@freescale.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
Diffstat (limited to 'drivers/net')
-rw-r--r-- | drivers/net/ucc_geth.c | 315 |
1 files changed, 190 insertions, 125 deletions
diff --git a/drivers/net/ucc_geth.c b/drivers/net/ucc_geth.c index 4a3fd62156d9..12e01b24105a 100644 --- a/drivers/net/ucc_geth.c +++ b/drivers/net/ucc_geth.c | |||
@@ -60,11 +60,19 @@ | |||
60 | #else | 60 | #else |
61 | #define ugeth_vdbg(fmt, args...) do { } while (0) | 61 | #define ugeth_vdbg(fmt, args...) do { } while (0) |
62 | #endif /* UGETH_VERBOSE_DEBUG */ | 62 | #endif /* UGETH_VERBOSE_DEBUG */ |
63 | #define UGETH_MSG_DEFAULT (NETIF_MSG_IFUP << 1 ) - 1 | ||
63 | 64 | ||
64 | void uec_set_ethtool_ops(struct net_device *netdev); | 65 | void uec_set_ethtool_ops(struct net_device *netdev); |
65 | 66 | ||
66 | static DEFINE_SPINLOCK(ugeth_lock); | 67 | static DEFINE_SPINLOCK(ugeth_lock); |
67 | 68 | ||
69 | static struct { | ||
70 | u32 msg_enable; | ||
71 | } debug = { -1 }; | ||
72 | |||
73 | module_param_named(debug, debug.msg_enable, int, 0); | ||
74 | MODULE_PARM_DESC(debug, "Debug verbosity level (0=none, ..., 0xffff=all)"); | ||
75 | |||
68 | static struct ucc_geth_info ugeth_primary_info = { | 76 | static struct ucc_geth_info ugeth_primary_info = { |
69 | .uf_info = { | 77 | .uf_info = { |
70 | .bd_mem_part = MEM_PART_SYSTEM, | 78 | .bd_mem_part = MEM_PART_SYSTEM, |
@@ -282,7 +290,8 @@ static int fill_init_enet_entries(struct ucc_geth_private *ugeth, | |||
282 | 290 | ||
283 | for (i = 0; i < num_entries; i++) { | 291 | for (i = 0; i < num_entries; i++) { |
284 | if ((snum = qe_get_snum()) < 0) { | 292 | if ((snum = qe_get_snum()) < 0) { |
285 | ugeth_err("fill_init_enet_entries: Can not get SNUM."); | 293 | if (netif_msg_ifup(ugeth)) |
294 | ugeth_err("fill_init_enet_entries: Can not get SNUM."); | ||
286 | return snum; | 295 | return snum; |
287 | } | 296 | } |
288 | if ((i == 0) && skip_page_for_first_entry) | 297 | if ((i == 0) && skip_page_for_first_entry) |
@@ -292,8 +301,8 @@ static int fill_init_enet_entries(struct ucc_geth_private *ugeth, | |||
292 | init_enet_offset = | 301 | init_enet_offset = |
293 | qe_muram_alloc(thread_size, thread_alignment); | 302 | qe_muram_alloc(thread_size, thread_alignment); |
294 | if (IS_ERR_VALUE(init_enet_offset)) { | 303 | if (IS_ERR_VALUE(init_enet_offset)) { |
295 | ugeth_err | 304 | if (netif_msg_ifup(ugeth)) |
296 | ("fill_init_enet_entries: Can not allocate DPRAM memory."); | 305 | ugeth_err("fill_init_enet_entries: Can not allocate DPRAM memory."); |
297 | qe_put_snum((u8) snum); | 306 | qe_put_snum((u8) snum); |
298 | return -ENOMEM; | 307 | return -ENOMEM; |
299 | } | 308 | } |
@@ -1487,9 +1496,9 @@ static int adjust_enet_interface(struct ucc_geth_private *ugeth) | |||
1487 | 1496 | ||
1488 | ret_val = init_preamble_length(ug_info->prel, &ug_regs->maccfg2); | 1497 | ret_val = init_preamble_length(ug_info->prel, &ug_regs->maccfg2); |
1489 | if (ret_val != 0) { | 1498 | if (ret_val != 0) { |
1490 | ugeth_err | 1499 | if (netif_msg_probe(ugeth)) |
1491 | ("%s: Preamble length must be between 3 and 7 inclusive.", | 1500 | ugeth_err("%s: Preamble length must be between 3 and 7 inclusive.", |
1492 | __FUNCTION__); | 1501 | __FUNCTION__); |
1493 | return ret_val; | 1502 | return ret_val; |
1494 | } | 1503 | } |
1495 | 1504 | ||
@@ -1727,7 +1736,8 @@ static int ugeth_enable(struct ucc_geth_private *ugeth, enum comm_dir mode) | |||
1727 | 1736 | ||
1728 | /* check if the UCC number is in range. */ | 1737 | /* check if the UCC number is in range. */ |
1729 | if (ugeth->ug_info->uf_info.ucc_num >= UCC_MAX_NUM) { | 1738 | if (ugeth->ug_info->uf_info.ucc_num >= UCC_MAX_NUM) { |
1730 | ugeth_err("%s: ucc_num out of range.", __FUNCTION__); | 1739 | if (netif_msg_probe(ugeth)) |
1740 | ugeth_err("%s: ucc_num out of range.", __FUNCTION__); | ||
1731 | return -EINVAL; | 1741 | return -EINVAL; |
1732 | } | 1742 | } |
1733 | 1743 | ||
@@ -1755,7 +1765,8 @@ static int ugeth_disable(struct ucc_geth_private * ugeth, enum comm_dir mode) | |||
1755 | 1765 | ||
1756 | /* check if the UCC number is in range. */ | 1766 | /* check if the UCC number is in range. */ |
1757 | if (ugeth->ug_info->uf_info.ucc_num >= UCC_MAX_NUM) { | 1767 | if (ugeth->ug_info->uf_info.ucc_num >= UCC_MAX_NUM) { |
1758 | ugeth_err("%s: ucc_num out of range.", __FUNCTION__); | 1768 | if (netif_msg_probe(ugeth)) |
1769 | ugeth_err("%s: ucc_num out of range.", __FUNCTION__); | ||
1759 | return -EINVAL; | 1770 | return -EINVAL; |
1760 | } | 1771 | } |
1761 | 1772 | ||
@@ -2307,7 +2318,9 @@ static int ucc_struct_init(struct ucc_geth_private *ugeth) | |||
2307 | 2318 | ||
2308 | if (!((uf_info->bd_mem_part == MEM_PART_SYSTEM) || | 2319 | if (!((uf_info->bd_mem_part == MEM_PART_SYSTEM) || |
2309 | (uf_info->bd_mem_part == MEM_PART_MURAM))) { | 2320 | (uf_info->bd_mem_part == MEM_PART_MURAM))) { |
2310 | ugeth_err("%s: Bad memory partition value.", __FUNCTION__); | 2321 | if (netif_msg_probe(ugeth)) |
2322 | ugeth_err("%s: Bad memory partition value.", | ||
2323 | __FUNCTION__); | ||
2311 | return -EINVAL; | 2324 | return -EINVAL; |
2312 | } | 2325 | } |
2313 | 2326 | ||
@@ -2316,9 +2329,10 @@ static int ucc_struct_init(struct ucc_geth_private *ugeth) | |||
2316 | if ((ug_info->bdRingLenRx[i] < UCC_GETH_RX_BD_RING_SIZE_MIN) || | 2329 | if ((ug_info->bdRingLenRx[i] < UCC_GETH_RX_BD_RING_SIZE_MIN) || |
2317 | (ug_info->bdRingLenRx[i] % | 2330 | (ug_info->bdRingLenRx[i] % |
2318 | UCC_GETH_RX_BD_RING_SIZE_ALIGNMENT)) { | 2331 | UCC_GETH_RX_BD_RING_SIZE_ALIGNMENT)) { |
2319 | ugeth_err | 2332 | if (netif_msg_probe(ugeth)) |
2320 | ("%s: Rx BD ring length must be multiple of 4," | 2333 | ugeth_err |
2321 | " no smaller than 8.", __FUNCTION__); | 2334 | ("%s: Rx BD ring length must be multiple of 4, no smaller than 8.", |
2335 | __FUNCTION__); | ||
2322 | return -EINVAL; | 2336 | return -EINVAL; |
2323 | } | 2337 | } |
2324 | } | 2338 | } |
@@ -2326,9 +2340,10 @@ static int ucc_struct_init(struct ucc_geth_private *ugeth) | |||
2326 | /* Tx BD lengths */ | 2340 | /* Tx BD lengths */ |
2327 | for (i = 0; i < ug_info->numQueuesTx; i++) { | 2341 | for (i = 0; i < ug_info->numQueuesTx; i++) { |
2328 | if (ug_info->bdRingLenTx[i] < UCC_GETH_TX_BD_RING_SIZE_MIN) { | 2342 | if (ug_info->bdRingLenTx[i] < UCC_GETH_TX_BD_RING_SIZE_MIN) { |
2329 | ugeth_err | 2343 | if (netif_msg_probe(ugeth)) |
2330 | ("%s: Tx BD ring length must be no smaller than 2.", | 2344 | ugeth_err |
2331 | __FUNCTION__); | 2345 | ("%s: Tx BD ring length must be no smaller than 2.", |
2346 | __FUNCTION__); | ||
2332 | return -EINVAL; | 2347 | return -EINVAL; |
2333 | } | 2348 | } |
2334 | } | 2349 | } |
@@ -2336,31 +2351,35 @@ static int ucc_struct_init(struct ucc_geth_private *ugeth) | |||
2336 | /* mrblr */ | 2351 | /* mrblr */ |
2337 | if ((uf_info->max_rx_buf_length == 0) || | 2352 | if ((uf_info->max_rx_buf_length == 0) || |
2338 | (uf_info->max_rx_buf_length % UCC_GETH_MRBLR_ALIGNMENT)) { | 2353 | (uf_info->max_rx_buf_length % UCC_GETH_MRBLR_ALIGNMENT)) { |
2339 | ugeth_err | 2354 | if (netif_msg_probe(ugeth)) |
2340 | ("%s: max_rx_buf_length must be non-zero multiple of 128.", | 2355 | ugeth_err |
2341 | __FUNCTION__); | 2356 | ("%s: max_rx_buf_length must be non-zero multiple of 128.", |
2357 | __FUNCTION__); | ||
2342 | return -EINVAL; | 2358 | return -EINVAL; |
2343 | } | 2359 | } |
2344 | 2360 | ||
2345 | /* num Tx queues */ | 2361 | /* num Tx queues */ |
2346 | if (ug_info->numQueuesTx > NUM_TX_QUEUES) { | 2362 | if (ug_info->numQueuesTx > NUM_TX_QUEUES) { |
2347 | ugeth_err("%s: number of tx queues too large.", __FUNCTION__); | 2363 | if (netif_msg_probe(ugeth)) |
2364 | ugeth_err("%s: number of tx queues too large.", __FUNCTION__); | ||
2348 | return -EINVAL; | 2365 | return -EINVAL; |
2349 | } | 2366 | } |
2350 | 2367 | ||
2351 | /* num Rx queues */ | 2368 | /* num Rx queues */ |
2352 | if (ug_info->numQueuesRx > NUM_RX_QUEUES) { | 2369 | if (ug_info->numQueuesRx > NUM_RX_QUEUES) { |
2353 | ugeth_err("%s: number of rx queues too large.", __FUNCTION__); | 2370 | if (netif_msg_probe(ugeth)) |
2371 | ugeth_err("%s: number of rx queues too large.", __FUNCTION__); | ||
2354 | return -EINVAL; | 2372 | return -EINVAL; |
2355 | } | 2373 | } |
2356 | 2374 | ||
2357 | /* l2qt */ | 2375 | /* l2qt */ |
2358 | for (i = 0; i < UCC_GETH_VLAN_PRIORITY_MAX; i++) { | 2376 | for (i = 0; i < UCC_GETH_VLAN_PRIORITY_MAX; i++) { |
2359 | if (ug_info->l2qt[i] >= ug_info->numQueuesRx) { | 2377 | if (ug_info->l2qt[i] >= ug_info->numQueuesRx) { |
2360 | ugeth_err | 2378 | if (netif_msg_probe(ugeth)) |
2361 | ("%s: VLAN priority table entry must not be" | 2379 | ugeth_err |
2362 | " larger than number of Rx queues.", | 2380 | ("%s: VLAN priority table entry must not be" |
2363 | __FUNCTION__); | 2381 | " larger than number of Rx queues.", |
2382 | __FUNCTION__); | ||
2364 | return -EINVAL; | 2383 | return -EINVAL; |
2365 | } | 2384 | } |
2366 | } | 2385 | } |
@@ -2368,26 +2387,29 @@ static int ucc_struct_init(struct ucc_geth_private *ugeth) | |||
2368 | /* l3qt */ | 2387 | /* l3qt */ |
2369 | for (i = 0; i < UCC_GETH_IP_PRIORITY_MAX; i++) { | 2388 | for (i = 0; i < UCC_GETH_IP_PRIORITY_MAX; i++) { |
2370 | if (ug_info->l3qt[i] >= ug_info->numQueuesRx) { | 2389 | if (ug_info->l3qt[i] >= ug_info->numQueuesRx) { |
2371 | ugeth_err | 2390 | if (netif_msg_probe(ugeth)) |
2372 | ("%s: IP priority table entry must not be" | 2391 | ugeth_err |
2373 | " larger than number of Rx queues.", | 2392 | ("%s: IP priority table entry must not be" |
2374 | __FUNCTION__); | 2393 | " larger than number of Rx queues.", |
2394 | __FUNCTION__); | ||
2375 | return -EINVAL; | 2395 | return -EINVAL; |
2376 | } | 2396 | } |
2377 | } | 2397 | } |
2378 | 2398 | ||
2379 | if (ug_info->cam && !ug_info->ecamptr) { | 2399 | if (ug_info->cam && !ug_info->ecamptr) { |
2380 | ugeth_err("%s: If cam mode is chosen, must supply cam ptr.", | 2400 | if (netif_msg_probe(ugeth)) |
2381 | __FUNCTION__); | 2401 | ugeth_err("%s: If cam mode is chosen, must supply cam ptr.", |
2402 | __FUNCTION__); | ||
2382 | return -EINVAL; | 2403 | return -EINVAL; |
2383 | } | 2404 | } |
2384 | 2405 | ||
2385 | if ((ug_info->numStationAddresses != | 2406 | if ((ug_info->numStationAddresses != |
2386 | UCC_GETH_NUM_OF_STATION_ADDRESSES_1) | 2407 | UCC_GETH_NUM_OF_STATION_ADDRESSES_1) |
2387 | && ug_info->rxExtendedFiltering) { | 2408 | && ug_info->rxExtendedFiltering) { |
2388 | ugeth_err("%s: Number of station addresses greater than 1 " | 2409 | if (netif_msg_probe(ugeth)) |
2389 | "not allowed in extended parsing mode.", | 2410 | ugeth_err("%s: Number of station addresses greater than 1 " |
2390 | __FUNCTION__); | 2411 | "not allowed in extended parsing mode.", |
2412 | __FUNCTION__); | ||
2391 | return -EINVAL; | 2413 | return -EINVAL; |
2392 | } | 2414 | } |
2393 | 2415 | ||
@@ -2400,7 +2422,8 @@ static int ucc_struct_init(struct ucc_geth_private *ugeth) | |||
2400 | uf_info->uccm_mask |= (UCCE_TXBF_SINGLE_MASK << i); | 2422 | uf_info->uccm_mask |= (UCCE_TXBF_SINGLE_MASK << i); |
2401 | /* Initialize the general fast UCC block. */ | 2423 | /* Initialize the general fast UCC block. */ |
2402 | if (ucc_fast_init(uf_info, &ugeth->uccf)) { | 2424 | if (ucc_fast_init(uf_info, &ugeth->uccf)) { |
2403 | ugeth_err("%s: Failed to init uccf.", __FUNCTION__); | 2425 | if (netif_msg_probe(ugeth)) |
2426 | ugeth_err("%s: Failed to init uccf.", __FUNCTION__); | ||
2404 | ucc_geth_memclean(ugeth); | 2427 | ucc_geth_memclean(ugeth); |
2405 | return -ENOMEM; | 2428 | return -ENOMEM; |
2406 | } | 2429 | } |
@@ -2453,7 +2476,9 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth) | |||
2453 | numThreadsRxNumerical = 8; | 2476 | numThreadsRxNumerical = 8; |
2454 | break; | 2477 | break; |
2455 | default: | 2478 | default: |
2456 | ugeth_err("%s: Bad number of Rx threads value.", __FUNCTION__); | 2479 | if (netif_msg_ifup(ugeth)) |
2480 | ugeth_err("%s: Bad number of Rx threads value.", | ||
2481 | __FUNCTION__); | ||
2457 | ucc_geth_memclean(ugeth); | 2482 | ucc_geth_memclean(ugeth); |
2458 | return -EINVAL; | 2483 | return -EINVAL; |
2459 | break; | 2484 | break; |
@@ -2476,7 +2501,9 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth) | |||
2476 | numThreadsTxNumerical = 8; | 2501 | numThreadsTxNumerical = 8; |
2477 | break; | 2502 | break; |
2478 | default: | 2503 | default: |
2479 | ugeth_err("%s: Bad number of Tx threads value.", __FUNCTION__); | 2504 | if (netif_msg_ifup(ugeth)) |
2505 | ugeth_err("%s: Bad number of Tx threads value.", | ||
2506 | __FUNCTION__); | ||
2480 | ucc_geth_memclean(ugeth); | 2507 | ucc_geth_memclean(ugeth); |
2481 | return -EINVAL; | 2508 | return -EINVAL; |
2482 | break; | 2509 | break; |
@@ -2528,8 +2555,9 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth) | |||
2528 | ug_info->backToBackInterFrameGap, | 2555 | ug_info->backToBackInterFrameGap, |
2529 | &ug_regs->ipgifg); | 2556 | &ug_regs->ipgifg); |
2530 | if (ret_val != 0) { | 2557 | if (ret_val != 0) { |
2531 | ugeth_err("%s: IPGIFG initialization parameter too large.", | 2558 | if (netif_msg_ifup(ugeth)) |
2532 | __FUNCTION__); | 2559 | ugeth_err("%s: IPGIFG initialization parameter too large.", |
2560 | __FUNCTION__); | ||
2533 | ucc_geth_memclean(ugeth); | 2561 | ucc_geth_memclean(ugeth); |
2534 | return ret_val; | 2562 | return ret_val; |
2535 | } | 2563 | } |
@@ -2545,7 +2573,8 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth) | |||
2545 | ug_info->collisionWindow, | 2573 | ug_info->collisionWindow, |
2546 | &ug_regs->hafdup); | 2574 | &ug_regs->hafdup); |
2547 | if (ret_val != 0) { | 2575 | if (ret_val != 0) { |
2548 | ugeth_err("%s: Half Duplex initialization parameter too large.", | 2576 | if (netif_msg_ifup(ugeth)) |
2577 | ugeth_err("%s: Half Duplex initialization parameter too large.", | ||
2549 | __FUNCTION__); | 2578 | __FUNCTION__); |
2550 | ucc_geth_memclean(ugeth); | 2579 | ucc_geth_memclean(ugeth); |
2551 | return ret_val; | 2580 | return ret_val; |
@@ -2598,9 +2627,10 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth) | |||
2598 | tx_bd_ring_offset[j]); | 2627 | tx_bd_ring_offset[j]); |
2599 | } | 2628 | } |
2600 | if (!ugeth->p_tx_bd_ring[j]) { | 2629 | if (!ugeth->p_tx_bd_ring[j]) { |
2601 | ugeth_err | 2630 | if (netif_msg_ifup(ugeth)) |
2602 | ("%s: Can not allocate memory for Tx bd rings.", | 2631 | ugeth_err |
2603 | __FUNCTION__); | 2632 | ("%s: Can not allocate memory for Tx bd rings.", |
2633 | __FUNCTION__); | ||
2604 | ucc_geth_memclean(ugeth); | 2634 | ucc_geth_memclean(ugeth); |
2605 | return -ENOMEM; | 2635 | return -ENOMEM; |
2606 | } | 2636 | } |
@@ -2633,9 +2663,10 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth) | |||
2633 | rx_bd_ring_offset[j]); | 2663 | rx_bd_ring_offset[j]); |
2634 | } | 2664 | } |
2635 | if (!ugeth->p_rx_bd_ring[j]) { | 2665 | if (!ugeth->p_rx_bd_ring[j]) { |
2636 | ugeth_err | 2666 | if (netif_msg_ifup(ugeth)) |
2637 | ("%s: Can not allocate memory for Rx bd rings.", | 2667 | ugeth_err |
2638 | __FUNCTION__); | 2668 | ("%s: Can not allocate memory for Rx bd rings.", |
2669 | __FUNCTION__); | ||
2639 | ucc_geth_memclean(ugeth); | 2670 | ucc_geth_memclean(ugeth); |
2640 | return -ENOMEM; | 2671 | return -ENOMEM; |
2641 | } | 2672 | } |
@@ -2649,8 +2680,9 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth) | |||
2649 | GFP_KERNEL); | 2680 | GFP_KERNEL); |
2650 | 2681 | ||
2651 | if (ugeth->tx_skbuff[j] == NULL) { | 2682 | if (ugeth->tx_skbuff[j] == NULL) { |
2652 | ugeth_err("%s: Could not allocate tx_skbuff", | 2683 | if (netif_msg_ifup(ugeth)) |
2653 | __FUNCTION__); | 2684 | ugeth_err("%s: Could not allocate tx_skbuff", |
2685 | __FUNCTION__); | ||
2654 | ucc_geth_memclean(ugeth); | 2686 | ucc_geth_memclean(ugeth); |
2655 | return -ENOMEM; | 2687 | return -ENOMEM; |
2656 | } | 2688 | } |
@@ -2680,8 +2712,9 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth) | |||
2680 | GFP_KERNEL); | 2712 | GFP_KERNEL); |
2681 | 2713 | ||
2682 | if (ugeth->rx_skbuff[j] == NULL) { | 2714 | if (ugeth->rx_skbuff[j] == NULL) { |
2683 | ugeth_err("%s: Could not allocate rx_skbuff", | 2715 | if (netif_msg_ifup(ugeth)) |
2684 | __FUNCTION__); | 2716 | ugeth_err("%s: Could not allocate rx_skbuff", |
2717 | __FUNCTION__); | ||
2685 | ucc_geth_memclean(ugeth); | 2718 | ucc_geth_memclean(ugeth); |
2686 | return -ENOMEM; | 2719 | return -ENOMEM; |
2687 | } | 2720 | } |
@@ -2712,9 +2745,10 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth) | |||
2712 | qe_muram_alloc(sizeof(struct ucc_geth_tx_global_pram), | 2745 | qe_muram_alloc(sizeof(struct ucc_geth_tx_global_pram), |
2713 | UCC_GETH_TX_GLOBAL_PRAM_ALIGNMENT); | 2746 | UCC_GETH_TX_GLOBAL_PRAM_ALIGNMENT); |
2714 | if (IS_ERR_VALUE(ugeth->tx_glbl_pram_offset)) { | 2747 | if (IS_ERR_VALUE(ugeth->tx_glbl_pram_offset)) { |
2715 | ugeth_err | 2748 | if (netif_msg_ifup(ugeth)) |
2716 | ("%s: Can not allocate DPRAM memory for p_tx_glbl_pram.", | 2749 | ugeth_err |
2717 | __FUNCTION__); | 2750 | ("%s: Can not allocate DPRAM memory for p_tx_glbl_pram.", |
2751 | __FUNCTION__); | ||
2718 | ucc_geth_memclean(ugeth); | 2752 | ucc_geth_memclean(ugeth); |
2719 | return -ENOMEM; | 2753 | return -ENOMEM; |
2720 | } | 2754 | } |
@@ -2734,9 +2768,10 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth) | |||
2734 | 32 * (numThreadsTxNumerical == 1), | 2768 | 32 * (numThreadsTxNumerical == 1), |
2735 | UCC_GETH_THREAD_DATA_ALIGNMENT); | 2769 | UCC_GETH_THREAD_DATA_ALIGNMENT); |
2736 | if (IS_ERR_VALUE(ugeth->thread_dat_tx_offset)) { | 2770 | if (IS_ERR_VALUE(ugeth->thread_dat_tx_offset)) { |
2737 | ugeth_err | 2771 | if (netif_msg_ifup(ugeth)) |
2738 | ("%s: Can not allocate DPRAM memory for p_thread_data_tx.", | 2772 | ugeth_err |
2739 | __FUNCTION__); | 2773 | ("%s: Can not allocate DPRAM memory for p_thread_data_tx.", |
2774 | __FUNCTION__); | ||
2740 | ucc_geth_memclean(ugeth); | 2775 | ucc_geth_memclean(ugeth); |
2741 | return -ENOMEM; | 2776 | return -ENOMEM; |
2742 | } | 2777 | } |
@@ -2762,9 +2797,10 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth) | |||
2762 | sizeof(struct ucc_geth_send_queue_qd), | 2797 | sizeof(struct ucc_geth_send_queue_qd), |
2763 | UCC_GETH_SEND_QUEUE_QUEUE_DESCRIPTOR_ALIGNMENT); | 2798 | UCC_GETH_SEND_QUEUE_QUEUE_DESCRIPTOR_ALIGNMENT); |
2764 | if (IS_ERR_VALUE(ugeth->send_q_mem_reg_offset)) { | 2799 | if (IS_ERR_VALUE(ugeth->send_q_mem_reg_offset)) { |
2765 | ugeth_err | 2800 | if (netif_msg_ifup(ugeth)) |
2766 | ("%s: Can not allocate DPRAM memory for p_send_q_mem_reg.", | 2801 | ugeth_err |
2767 | __FUNCTION__); | 2802 | ("%s: Can not allocate DPRAM memory for p_send_q_mem_reg.", |
2803 | __FUNCTION__); | ||
2768 | ucc_geth_memclean(ugeth); | 2804 | ucc_geth_memclean(ugeth); |
2769 | return -ENOMEM; | 2805 | return -ENOMEM; |
2770 | } | 2806 | } |
@@ -2805,9 +2841,10 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth) | |||
2805 | qe_muram_alloc(sizeof(struct ucc_geth_scheduler), | 2841 | qe_muram_alloc(sizeof(struct ucc_geth_scheduler), |
2806 | UCC_GETH_SCHEDULER_ALIGNMENT); | 2842 | UCC_GETH_SCHEDULER_ALIGNMENT); |
2807 | if (IS_ERR_VALUE(ugeth->scheduler_offset)) { | 2843 | if (IS_ERR_VALUE(ugeth->scheduler_offset)) { |
2808 | ugeth_err | 2844 | if (netif_msg_ifup(ugeth)) |
2809 | ("%s: Can not allocate DPRAM memory for p_scheduler.", | 2845 | ugeth_err |
2810 | __FUNCTION__); | 2846 | ("%s: Can not allocate DPRAM memory for p_scheduler.", |
2847 | __FUNCTION__); | ||
2811 | ucc_geth_memclean(ugeth); | 2848 | ucc_geth_memclean(ugeth); |
2812 | return -ENOMEM; | 2849 | return -ENOMEM; |
2813 | } | 2850 | } |
@@ -2853,9 +2890,11 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth) | |||
2853 | (struct ucc_geth_tx_firmware_statistics_pram), | 2890 | (struct ucc_geth_tx_firmware_statistics_pram), |
2854 | UCC_GETH_TX_STATISTICS_ALIGNMENT); | 2891 | UCC_GETH_TX_STATISTICS_ALIGNMENT); |
2855 | if (IS_ERR_VALUE(ugeth->tx_fw_statistics_pram_offset)) { | 2892 | if (IS_ERR_VALUE(ugeth->tx_fw_statistics_pram_offset)) { |
2856 | ugeth_err | 2893 | if (netif_msg_ifup(ugeth)) |
2857 | ("%s: Can not allocate DPRAM memory for" | 2894 | ugeth_err |
2858 | " p_tx_fw_statistics_pram.", __FUNCTION__); | 2895 | ("%s: Can not allocate DPRAM memory for" |
2896 | " p_tx_fw_statistics_pram.", | ||
2897 | __FUNCTION__); | ||
2859 | ucc_geth_memclean(ugeth); | 2898 | ucc_geth_memclean(ugeth); |
2860 | return -ENOMEM; | 2899 | return -ENOMEM; |
2861 | } | 2900 | } |
@@ -2892,9 +2931,10 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth) | |||
2892 | qe_muram_alloc(sizeof(struct ucc_geth_rx_global_pram), | 2931 | qe_muram_alloc(sizeof(struct ucc_geth_rx_global_pram), |
2893 | UCC_GETH_RX_GLOBAL_PRAM_ALIGNMENT); | 2932 | UCC_GETH_RX_GLOBAL_PRAM_ALIGNMENT); |
2894 | if (IS_ERR_VALUE(ugeth->rx_glbl_pram_offset)) { | 2933 | if (IS_ERR_VALUE(ugeth->rx_glbl_pram_offset)) { |
2895 | ugeth_err | 2934 | if (netif_msg_ifup(ugeth)) |
2896 | ("%s: Can not allocate DPRAM memory for p_rx_glbl_pram.", | 2935 | ugeth_err |
2897 | __FUNCTION__); | 2936 | ("%s: Can not allocate DPRAM memory for p_rx_glbl_pram.", |
2937 | __FUNCTION__); | ||
2898 | ucc_geth_memclean(ugeth); | 2938 | ucc_geth_memclean(ugeth); |
2899 | return -ENOMEM; | 2939 | return -ENOMEM; |
2900 | } | 2940 | } |
@@ -2913,9 +2953,10 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth) | |||
2913 | sizeof(struct ucc_geth_thread_data_rx), | 2953 | sizeof(struct ucc_geth_thread_data_rx), |
2914 | UCC_GETH_THREAD_DATA_ALIGNMENT); | 2954 | UCC_GETH_THREAD_DATA_ALIGNMENT); |
2915 | if (IS_ERR_VALUE(ugeth->thread_dat_rx_offset)) { | 2955 | if (IS_ERR_VALUE(ugeth->thread_dat_rx_offset)) { |
2916 | ugeth_err | 2956 | if (netif_msg_ifup(ugeth)) |
2917 | ("%s: Can not allocate DPRAM memory for p_thread_data_rx.", | 2957 | ugeth_err |
2918 | __FUNCTION__); | 2958 | ("%s: Can not allocate DPRAM memory for p_thread_data_rx.", |
2959 | __FUNCTION__); | ||
2919 | ucc_geth_memclean(ugeth); | 2960 | ucc_geth_memclean(ugeth); |
2920 | return -ENOMEM; | 2961 | return -ENOMEM; |
2921 | } | 2962 | } |
@@ -2936,9 +2977,10 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth) | |||
2936 | (struct ucc_geth_rx_firmware_statistics_pram), | 2977 | (struct ucc_geth_rx_firmware_statistics_pram), |
2937 | UCC_GETH_RX_STATISTICS_ALIGNMENT); | 2978 | UCC_GETH_RX_STATISTICS_ALIGNMENT); |
2938 | if (IS_ERR_VALUE(ugeth->rx_fw_statistics_pram_offset)) { | 2979 | if (IS_ERR_VALUE(ugeth->rx_fw_statistics_pram_offset)) { |
2939 | ugeth_err | 2980 | if (netif_msg_ifup(ugeth)) |
2940 | ("%s: Can not allocate DPRAM memory for" | 2981 | ugeth_err |
2941 | " p_rx_fw_statistics_pram.", __FUNCTION__); | 2982 | ("%s: Can not allocate DPRAM memory for" |
2983 | " p_rx_fw_statistics_pram.", __FUNCTION__); | ||
2942 | ucc_geth_memclean(ugeth); | 2984 | ucc_geth_memclean(ugeth); |
2943 | return -ENOMEM; | 2985 | return -ENOMEM; |
2944 | } | 2986 | } |
@@ -2958,9 +3000,10 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth) | |||
2958 | sizeof(struct ucc_geth_rx_interrupt_coalescing_entry) | 3000 | sizeof(struct ucc_geth_rx_interrupt_coalescing_entry) |
2959 | + 4, UCC_GETH_RX_INTERRUPT_COALESCING_ALIGNMENT); | 3001 | + 4, UCC_GETH_RX_INTERRUPT_COALESCING_ALIGNMENT); |
2960 | if (IS_ERR_VALUE(ugeth->rx_irq_coalescing_tbl_offset)) { | 3002 | if (IS_ERR_VALUE(ugeth->rx_irq_coalescing_tbl_offset)) { |
2961 | ugeth_err | 3003 | if (netif_msg_ifup(ugeth)) |
2962 | ("%s: Can not allocate DPRAM memory for" | 3004 | ugeth_err |
2963 | " p_rx_irq_coalescing_tbl.", __FUNCTION__); | 3005 | ("%s: Can not allocate DPRAM memory for" |
3006 | " p_rx_irq_coalescing_tbl.", __FUNCTION__); | ||
2964 | ucc_geth_memclean(ugeth); | 3007 | ucc_geth_memclean(ugeth); |
2965 | return -ENOMEM; | 3008 | return -ENOMEM; |
2966 | } | 3009 | } |
@@ -3026,9 +3069,10 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth) | |||
3026 | sizeof(struct ucc_geth_rx_prefetched_bds)), | 3069 | sizeof(struct ucc_geth_rx_prefetched_bds)), |
3027 | UCC_GETH_RX_BD_QUEUES_ALIGNMENT); | 3070 | UCC_GETH_RX_BD_QUEUES_ALIGNMENT); |
3028 | if (IS_ERR_VALUE(ugeth->rx_bd_qs_tbl_offset)) { | 3071 | if (IS_ERR_VALUE(ugeth->rx_bd_qs_tbl_offset)) { |
3029 | ugeth_err | 3072 | if (netif_msg_ifup(ugeth)) |
3030 | ("%s: Can not allocate DPRAM memory for p_rx_bd_qs_tbl.", | 3073 | ugeth_err |
3031 | __FUNCTION__); | 3074 | ("%s: Can not allocate DPRAM memory for p_rx_bd_qs_tbl.", |
3075 | __FUNCTION__); | ||
3032 | ucc_geth_memclean(ugeth); | 3076 | ucc_geth_memclean(ugeth); |
3033 | return -ENOMEM; | 3077 | return -ENOMEM; |
3034 | } | 3078 | } |
@@ -3103,8 +3147,9 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth) | |||
3103 | /* initialize extended filtering */ | 3147 | /* initialize extended filtering */ |
3104 | if (ug_info->rxExtendedFiltering) { | 3148 | if (ug_info->rxExtendedFiltering) { |
3105 | if (!ug_info->extendedFilteringChainPointer) { | 3149 | if (!ug_info->extendedFilteringChainPointer) { |
3106 | ugeth_err("%s: Null Extended Filtering Chain Pointer.", | 3150 | if (netif_msg_ifup(ugeth)) |
3107 | __FUNCTION__); | 3151 | ugeth_err("%s: Null Extended Filtering Chain Pointer.", |
3152 | __FUNCTION__); | ||
3108 | ucc_geth_memclean(ugeth); | 3153 | ucc_geth_memclean(ugeth); |
3109 | return -EINVAL; | 3154 | return -EINVAL; |
3110 | } | 3155 | } |
@@ -3115,9 +3160,10 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth) | |||
3115 | qe_muram_alloc(sizeof(struct ucc_geth_exf_global_pram), | 3160 | qe_muram_alloc(sizeof(struct ucc_geth_exf_global_pram), |
3116 | UCC_GETH_RX_EXTENDED_FILTERING_GLOBAL_PARAMETERS_ALIGNMENT); | 3161 | UCC_GETH_RX_EXTENDED_FILTERING_GLOBAL_PARAMETERS_ALIGNMENT); |
3117 | if (IS_ERR_VALUE(ugeth->exf_glbl_param_offset)) { | 3162 | if (IS_ERR_VALUE(ugeth->exf_glbl_param_offset)) { |
3118 | ugeth_err | 3163 | if (netif_msg_ifup(ugeth)) |
3119 | ("%s: Can not allocate DPRAM memory for" | 3164 | ugeth_err |
3120 | " p_exf_glbl_param.", __FUNCTION__); | 3165 | ("%s: Can not allocate DPRAM memory for" |
3166 | " p_exf_glbl_param.", __FUNCTION__); | ||
3121 | ucc_geth_memclean(ugeth); | 3167 | ucc_geth_memclean(ugeth); |
3122 | return -ENOMEM; | 3168 | return -ENOMEM; |
3123 | } | 3169 | } |
@@ -3162,9 +3208,10 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth) | |||
3162 | */ | 3208 | */ |
3163 | if (!(ugeth->p_init_enet_param_shadow = | 3209 | if (!(ugeth->p_init_enet_param_shadow = |
3164 | kmalloc(sizeof(struct ucc_geth_init_pram), GFP_KERNEL))) { | 3210 | kmalloc(sizeof(struct ucc_geth_init_pram), GFP_KERNEL))) { |
3165 | ugeth_err | 3211 | if (netif_msg_ifup(ugeth)) |
3166 | ("%s: Can not allocate memory for" | 3212 | ugeth_err |
3167 | " p_UccInitEnetParamShadows.", __FUNCTION__); | 3213 | ("%s: Can not allocate memory for" |
3214 | " p_UccInitEnetParamShadows.", __FUNCTION__); | ||
3168 | ucc_geth_memclean(ugeth); | 3215 | ucc_geth_memclean(ugeth); |
3169 | return -ENOMEM; | 3216 | return -ENOMEM; |
3170 | } | 3217 | } |
@@ -3197,8 +3244,9 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth) | |||
3197 | QE_FLTR_LARGEST_EXTERNAL_TABLE_LOOKUP_KEY_SIZE_8_BYTES) | 3244 | QE_FLTR_LARGEST_EXTERNAL_TABLE_LOOKUP_KEY_SIZE_8_BYTES) |
3198 | && (ug_info->largestexternallookupkeysize != | 3245 | && (ug_info->largestexternallookupkeysize != |
3199 | QE_FLTR_LARGEST_EXTERNAL_TABLE_LOOKUP_KEY_SIZE_16_BYTES)) { | 3246 | QE_FLTR_LARGEST_EXTERNAL_TABLE_LOOKUP_KEY_SIZE_16_BYTES)) { |
3200 | ugeth_err("%s: Invalid largest External Lookup Key Size.", | 3247 | if (netif_msg_ifup(ugeth)) |
3201 | __FUNCTION__); | 3248 | ugeth_err("%s: Invalid largest External Lookup Key Size.", |
3249 | __FUNCTION__); | ||
3202 | ucc_geth_memclean(ugeth); | 3250 | ucc_geth_memclean(ugeth); |
3203 | return -EINVAL; | 3251 | return -EINVAL; |
3204 | } | 3252 | } |
@@ -3223,8 +3271,9 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth) | |||
3223 | /* Rx needs one extra for terminator */ | 3271 | /* Rx needs one extra for terminator */ |
3224 | , size, UCC_GETH_THREAD_RX_PRAM_ALIGNMENT, | 3272 | , size, UCC_GETH_THREAD_RX_PRAM_ALIGNMENT, |
3225 | ug_info->riscRx, 1)) != 0) { | 3273 | ug_info->riscRx, 1)) != 0) { |
3226 | ugeth_err("%s: Can not fill p_init_enet_param_shadow.", | 3274 | if (netif_msg_ifup(ugeth)) |
3227 | __FUNCTION__); | 3275 | ugeth_err("%s: Can not fill p_init_enet_param_shadow.", |
3276 | __FUNCTION__); | ||
3228 | ucc_geth_memclean(ugeth); | 3277 | ucc_geth_memclean(ugeth); |
3229 | return ret_val; | 3278 | return ret_val; |
3230 | } | 3279 | } |
@@ -3238,8 +3287,9 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth) | |||
3238 | sizeof(struct ucc_geth_thread_tx_pram), | 3287 | sizeof(struct ucc_geth_thread_tx_pram), |
3239 | UCC_GETH_THREAD_TX_PRAM_ALIGNMENT, | 3288 | UCC_GETH_THREAD_TX_PRAM_ALIGNMENT, |
3240 | ug_info->riscTx, 0)) != 0) { | 3289 | ug_info->riscTx, 0)) != 0) { |
3241 | ugeth_err("%s: Can not fill p_init_enet_param_shadow.", | 3290 | if (netif_msg_ifup(ugeth)) |
3242 | __FUNCTION__); | 3291 | ugeth_err("%s: Can not fill p_init_enet_param_shadow.", |
3292 | __FUNCTION__); | ||
3243 | ucc_geth_memclean(ugeth); | 3293 | ucc_geth_memclean(ugeth); |
3244 | return ret_val; | 3294 | return ret_val; |
3245 | } | 3295 | } |
@@ -3247,8 +3297,9 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth) | |||
3247 | /* Load Rx bds with buffers */ | 3297 | /* Load Rx bds with buffers */ |
3248 | for (i = 0; i < ug_info->numQueuesRx; i++) { | 3298 | for (i = 0; i < ug_info->numQueuesRx; i++) { |
3249 | if ((ret_val = rx_bd_buffer_set(ugeth, (u8) i)) != 0) { | 3299 | if ((ret_val = rx_bd_buffer_set(ugeth, (u8) i)) != 0) { |
3250 | ugeth_err("%s: Can not fill Rx bds with buffers.", | 3300 | if (netif_msg_ifup(ugeth)) |
3251 | __FUNCTION__); | 3301 | ugeth_err("%s: Can not fill Rx bds with buffers.", |
3302 | __FUNCTION__); | ||
3252 | ucc_geth_memclean(ugeth); | 3303 | ucc_geth_memclean(ugeth); |
3253 | return ret_val; | 3304 | return ret_val; |
3254 | } | 3305 | } |
@@ -3257,9 +3308,10 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth) | |||
3257 | /* Allocate InitEnet command parameter structure */ | 3308 | /* Allocate InitEnet command parameter structure */ |
3258 | init_enet_pram_offset = qe_muram_alloc(sizeof(struct ucc_geth_init_pram), 4); | 3309 | init_enet_pram_offset = qe_muram_alloc(sizeof(struct ucc_geth_init_pram), 4); |
3259 | if (IS_ERR_VALUE(init_enet_pram_offset)) { | 3310 | if (IS_ERR_VALUE(init_enet_pram_offset)) { |
3260 | ugeth_err | 3311 | if (netif_msg_ifup(ugeth)) |
3261 | ("%s: Can not allocate DPRAM memory for p_init_enet_pram.", | 3312 | ugeth_err |
3262 | __FUNCTION__); | 3313 | ("%s: Can not allocate DPRAM memory for p_init_enet_pram.", |
3314 | __FUNCTION__); | ||
3263 | ucc_geth_memclean(ugeth); | 3315 | ucc_geth_memclean(ugeth); |
3264 | return -ENOMEM; | 3316 | return -ENOMEM; |
3265 | } | 3317 | } |
@@ -3429,8 +3481,9 @@ static int ucc_geth_rx(struct ucc_geth_private *ugeth, u8 rxQ, int rx_work_limit | |||
3429 | if (!skb || | 3481 | if (!skb || |
3430 | (!(bd_status & (R_F | R_L))) || | 3482 | (!(bd_status & (R_F | R_L))) || |
3431 | (bd_status & R_ERRORS_FATAL)) { | 3483 | (bd_status & R_ERRORS_FATAL)) { |
3432 | ugeth_vdbg("%s, %d: ERROR!!! skb - 0x%08x", | 3484 | if (netif_msg_rx_err(ugeth)) |
3433 | __FUNCTION__, __LINE__, (u32) skb); | 3485 | ugeth_err("%s, %d: ERROR!!! skb - 0x%08x", |
3486 | __FUNCTION__, __LINE__, (u32) skb); | ||
3434 | if (skb) | 3487 | if (skb) |
3435 | dev_kfree_skb_any(skb); | 3488 | dev_kfree_skb_any(skb); |
3436 | 3489 | ||
@@ -3459,7 +3512,8 @@ static int ucc_geth_rx(struct ucc_geth_private *ugeth, u8 rxQ, int rx_work_limit | |||
3459 | 3512 | ||
3460 | skb = get_new_skb(ugeth, bd); | 3513 | skb = get_new_skb(ugeth, bd); |
3461 | if (!skb) { | 3514 | if (!skb) { |
3462 | ugeth_warn("%s: No Rx Data Buffer", __FUNCTION__); | 3515 | if (netif_msg_rx_err(ugeth)) |
3516 | ugeth_warn("%s: No Rx Data Buffer", __FUNCTION__); | ||
3463 | ugeth->stats.rx_dropped++; | 3517 | ugeth->stats.rx_dropped++; |
3464 | break; | 3518 | break; |
3465 | } | 3519 | } |
@@ -3650,28 +3704,32 @@ static int ucc_geth_open(struct net_device *dev) | |||
3650 | 3704 | ||
3651 | /* Test station address */ | 3705 | /* Test station address */ |
3652 | if (dev->dev_addr[0] & ENET_GROUP_ADDR) { | 3706 | if (dev->dev_addr[0] & ENET_GROUP_ADDR) { |
3653 | ugeth_err("%s: Multicast address used for station address" | 3707 | if (netif_msg_ifup(ugeth)) |
3654 | " - is this what you wanted?", __FUNCTION__); | 3708 | ugeth_err("%s: Multicast address used for station address" |
3709 | " - is this what you wanted?", __FUNCTION__); | ||
3655 | return -EINVAL; | 3710 | return -EINVAL; |
3656 | } | 3711 | } |
3657 | 3712 | ||
3658 | err = ucc_struct_init(ugeth); | 3713 | err = ucc_struct_init(ugeth); |
3659 | if (err) { | 3714 | if (err) { |
3660 | ugeth_err("%s: Cannot configure internal struct, aborting.", dev->name); | 3715 | if (netif_msg_ifup(ugeth)) |
3716 | ugeth_err("%s: Cannot configure internal struct, aborting.", dev->name); | ||
3661 | return err; | 3717 | return err; |
3662 | } | 3718 | } |
3663 | 3719 | ||
3664 | err = ucc_geth_startup(ugeth); | 3720 | err = ucc_geth_startup(ugeth); |
3665 | if (err) { | 3721 | if (err) { |
3666 | ugeth_err("%s: Cannot configure net device, aborting.", | 3722 | if (netif_msg_ifup(ugeth)) |
3667 | dev->name); | 3723 | ugeth_err("%s: Cannot configure net device, aborting.", |
3724 | dev->name); | ||
3668 | return err; | 3725 | return err; |
3669 | } | 3726 | } |
3670 | 3727 | ||
3671 | err = adjust_enet_interface(ugeth); | 3728 | err = adjust_enet_interface(ugeth); |
3672 | if (err) { | 3729 | if (err) { |
3673 | ugeth_err("%s: Cannot configure net device, aborting.", | 3730 | if (netif_msg_ifup(ugeth)) |
3674 | dev->name); | 3731 | ugeth_err("%s: Cannot configure net device, aborting.", |
3732 | dev->name); | ||
3675 | return err; | 3733 | return err; |
3676 | } | 3734 | } |
3677 | 3735 | ||
@@ -3688,7 +3746,8 @@ static int ucc_geth_open(struct net_device *dev) | |||
3688 | 3746 | ||
3689 | err = init_phy(dev); | 3747 | err = init_phy(dev); |
3690 | if (err) { | 3748 | if (err) { |
3691 | ugeth_err("%s: Cannot initialize PHY, aborting.", dev->name); | 3749 | if (netif_msg_ifup(ugeth)) |
3750 | ugeth_err("%s: Cannot initialize PHY, aborting.", dev->name); | ||
3692 | return err; | 3751 | return err; |
3693 | } | 3752 | } |
3694 | 3753 | ||
@@ -3698,15 +3757,17 @@ static int ucc_geth_open(struct net_device *dev) | |||
3698 | request_irq(ugeth->ug_info->uf_info.irq, ucc_geth_irq_handler, 0, | 3757 | request_irq(ugeth->ug_info->uf_info.irq, ucc_geth_irq_handler, 0, |
3699 | "UCC Geth", dev); | 3758 | "UCC Geth", dev); |
3700 | if (err) { | 3759 | if (err) { |
3701 | ugeth_err("%s: Cannot get IRQ for net device, aborting.", | 3760 | if (netif_msg_ifup(ugeth)) |
3702 | dev->name); | 3761 | ugeth_err("%s: Cannot get IRQ for net device, aborting.", |
3762 | dev->name); | ||
3703 | ucc_geth_stop(ugeth); | 3763 | ucc_geth_stop(ugeth); |
3704 | return err; | 3764 | return err; |
3705 | } | 3765 | } |
3706 | 3766 | ||
3707 | err = ugeth_enable(ugeth, COMM_DIR_RX_AND_TX); | 3767 | err = ugeth_enable(ugeth, COMM_DIR_RX_AND_TX); |
3708 | if (err) { | 3768 | if (err) { |
3709 | ugeth_err("%s: Cannot enable net device, aborting.", dev->name); | 3769 | if (netif_msg_ifup(ugeth)) |
3770 | ugeth_err("%s: Cannot enable net device, aborting.", dev->name); | ||
3710 | ucc_geth_stop(ugeth); | 3771 | ucc_geth_stop(ugeth); |
3711 | return err; | 3772 | return err; |
3712 | } | 3773 | } |
@@ -3789,6 +3850,13 @@ static int ucc_geth_probe(struct of_device* ofdev, const struct of_device_id *ma | |||
3789 | return -ENODEV; | 3850 | return -ENODEV; |
3790 | 3851 | ||
3791 | ug_info = &ugeth_info[ucc_num]; | 3852 | ug_info = &ugeth_info[ucc_num]; |
3853 | if (ug_info == NULL) { | ||
3854 | if (netif_msg_probe(&debug)) | ||
3855 | ugeth_err("%s: [%d] Missing additional data!", | ||
3856 | __FUNCTION__, ucc_num); | ||
3857 | return -ENODEV; | ||
3858 | } | ||
3859 | |||
3792 | ug_info->uf_info.ucc_num = ucc_num; | 3860 | ug_info->uf_info.ucc_num = ucc_num; |
3793 | 3861 | ||
3794 | prop = of_get_property(np, "rx-clock", NULL); | 3862 | prop = of_get_property(np, "rx-clock", NULL); |
@@ -3867,15 +3935,10 @@ static int ucc_geth_probe(struct of_device* ofdev, const struct of_device_id *ma | |||
3867 | 3935 | ||
3868 | ug_info->mdio_bus = res.start; | 3936 | ug_info->mdio_bus = res.start; |
3869 | 3937 | ||
3870 | printk(KERN_INFO "ucc_geth: UCC%1d at 0x%8x (irq = %d) \n", | 3938 | if (netif_msg_probe(&debug)) |
3871 | ug_info->uf_info.ucc_num + 1, ug_info->uf_info.regs, | 3939 | printk(KERN_INFO "ucc_geth: UCC%1d at 0x%8x (irq = %d) \n", |
3872 | ug_info->uf_info.irq); | 3940 | ug_info->uf_info.ucc_num + 1, ug_info->uf_info.regs, |
3873 | 3941 | ug_info->uf_info.irq); | |
3874 | if (ug_info == NULL) { | ||
3875 | ugeth_err("%s: [%d] Missing additional data!", __FUNCTION__, | ||
3876 | ucc_num); | ||
3877 | return -ENODEV; | ||
3878 | } | ||
3879 | 3942 | ||
3880 | /* Create an ethernet device instance */ | 3943 | /* Create an ethernet device instance */ |
3881 | dev = alloc_etherdev(sizeof(*ugeth)); | 3944 | dev = alloc_etherdev(sizeof(*ugeth)); |
@@ -3910,14 +3973,15 @@ static int ucc_geth_probe(struct of_device* ofdev, const struct of_device_id *ma | |||
3910 | dev->mtu = 1500; | 3973 | dev->mtu = 1500; |
3911 | dev->set_multicast_list = ucc_geth_set_multi; | 3974 | dev->set_multicast_list = ucc_geth_set_multi; |
3912 | 3975 | ||
3913 | ugeth->msg_enable = (NETIF_MSG_IFUP << 1 ) - 1; | 3976 | ugeth->msg_enable = netif_msg_init(debug.msg_enable, UGETH_MSG_DEFAULT); |
3914 | ugeth->phy_interface = phy_interface; | 3977 | ugeth->phy_interface = phy_interface; |
3915 | ugeth->max_speed = max_speed; | 3978 | ugeth->max_speed = max_speed; |
3916 | 3979 | ||
3917 | err = register_netdev(dev); | 3980 | err = register_netdev(dev); |
3918 | if (err) { | 3981 | if (err) { |
3919 | ugeth_err("%s: Cannot register net device, aborting.", | 3982 | if (netif_msg_probe(ugeth)) |
3920 | dev->name); | 3983 | ugeth_err("%s: Cannot register net device, aborting.", |
3984 | dev->name); | ||
3921 | free_netdev(dev); | 3985 | free_netdev(dev); |
3922 | return err; | 3986 | return err; |
3923 | } | 3987 | } |
@@ -3971,7 +4035,8 @@ static int __init ucc_geth_init(void) | |||
3971 | if (ret) | 4035 | if (ret) |
3972 | return ret; | 4036 | return ret; |
3973 | 4037 | ||
3974 | printk(KERN_INFO "ucc_geth: " DRV_DESC "\n"); | 4038 | if (netif_msg_drv(&debug)) |
4039 | printk(KERN_INFO "ucc_geth: " DRV_DESC "\n"); | ||
3975 | for (i = 0; i < 8; i++) | 4040 | for (i = 0; i < 8; i++) |
3976 | memcpy(&(ugeth_info[i]), &ugeth_primary_info, | 4041 | memcpy(&(ugeth_info[i]), &ugeth_primary_info, |
3977 | sizeof(ugeth_primary_info)); | 4042 | sizeof(ugeth_primary_info)); |