提交 890de95e 编写于 作者: L Li Yang 提交者: Jeff Garzik

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: NLi Yang <leoli@freescale.com>
Signed-off-by: NJeff Garzik <jeff@garzik.org>
上级 ac421852
...@@ -60,11 +60,19 @@ ...@@ -60,11 +60,19 @@
#else #else
#define ugeth_vdbg(fmt, args...) do { } while (0) #define ugeth_vdbg(fmt, args...) do { } while (0)
#endif /* UGETH_VERBOSE_DEBUG */ #endif /* UGETH_VERBOSE_DEBUG */
#define UGETH_MSG_DEFAULT (NETIF_MSG_IFUP << 1 ) - 1
void uec_set_ethtool_ops(struct net_device *netdev); void uec_set_ethtool_ops(struct net_device *netdev);
static DEFINE_SPINLOCK(ugeth_lock); static DEFINE_SPINLOCK(ugeth_lock);
static struct {
u32 msg_enable;
} debug = { -1 };
module_param_named(debug, debug.msg_enable, int, 0);
MODULE_PARM_DESC(debug, "Debug verbosity level (0=none, ..., 0xffff=all)");
static struct ucc_geth_info ugeth_primary_info = { static struct ucc_geth_info ugeth_primary_info = {
.uf_info = { .uf_info = {
.bd_mem_part = MEM_PART_SYSTEM, .bd_mem_part = MEM_PART_SYSTEM,
...@@ -282,6 +290,7 @@ static int fill_init_enet_entries(struct ucc_geth_private *ugeth, ...@@ -282,6 +290,7 @@ static int fill_init_enet_entries(struct ucc_geth_private *ugeth,
for (i = 0; i < num_entries; i++) { for (i = 0; i < num_entries; i++) {
if ((snum = qe_get_snum()) < 0) { if ((snum = qe_get_snum()) < 0) {
if (netif_msg_ifup(ugeth))
ugeth_err("fill_init_enet_entries: Can not get SNUM."); ugeth_err("fill_init_enet_entries: Can not get SNUM.");
return snum; return snum;
} }
...@@ -292,8 +301,8 @@ static int fill_init_enet_entries(struct ucc_geth_private *ugeth, ...@@ -292,8 +301,8 @@ static int fill_init_enet_entries(struct ucc_geth_private *ugeth,
init_enet_offset = init_enet_offset =
qe_muram_alloc(thread_size, thread_alignment); qe_muram_alloc(thread_size, thread_alignment);
if (IS_ERR_VALUE(init_enet_offset)) { if (IS_ERR_VALUE(init_enet_offset)) {
ugeth_err if (netif_msg_ifup(ugeth))
("fill_init_enet_entries: Can not allocate DPRAM memory."); ugeth_err("fill_init_enet_entries: Can not allocate DPRAM memory.");
qe_put_snum((u8) snum); qe_put_snum((u8) snum);
return -ENOMEM; return -ENOMEM;
} }
...@@ -1487,8 +1496,8 @@ static int adjust_enet_interface(struct ucc_geth_private *ugeth) ...@@ -1487,8 +1496,8 @@ static int adjust_enet_interface(struct ucc_geth_private *ugeth)
ret_val = init_preamble_length(ug_info->prel, &ug_regs->maccfg2); ret_val = init_preamble_length(ug_info->prel, &ug_regs->maccfg2);
if (ret_val != 0) { if (ret_val != 0) {
ugeth_err if (netif_msg_probe(ugeth))
("%s: Preamble length must be between 3 and 7 inclusive.", ugeth_err("%s: Preamble length must be between 3 and 7 inclusive.",
__FUNCTION__); __FUNCTION__);
return ret_val; return ret_val;
} }
...@@ -1727,6 +1736,7 @@ static int ugeth_enable(struct ucc_geth_private *ugeth, enum comm_dir mode) ...@@ -1727,6 +1736,7 @@ static int ugeth_enable(struct ucc_geth_private *ugeth, enum comm_dir mode)
/* check if the UCC number is in range. */ /* check if the UCC number is in range. */
if (ugeth->ug_info->uf_info.ucc_num >= UCC_MAX_NUM) { if (ugeth->ug_info->uf_info.ucc_num >= UCC_MAX_NUM) {
if (netif_msg_probe(ugeth))
ugeth_err("%s: ucc_num out of range.", __FUNCTION__); ugeth_err("%s: ucc_num out of range.", __FUNCTION__);
return -EINVAL; return -EINVAL;
} }
...@@ -1755,6 +1765,7 @@ static int ugeth_disable(struct ucc_geth_private * ugeth, enum comm_dir mode) ...@@ -1755,6 +1765,7 @@ static int ugeth_disable(struct ucc_geth_private * ugeth, enum comm_dir mode)
/* check if the UCC number is in range. */ /* check if the UCC number is in range. */
if (ugeth->ug_info->uf_info.ucc_num >= UCC_MAX_NUM) { if (ugeth->ug_info->uf_info.ucc_num >= UCC_MAX_NUM) {
if (netif_msg_probe(ugeth))
ugeth_err("%s: ucc_num out of range.", __FUNCTION__); ugeth_err("%s: ucc_num out of range.", __FUNCTION__);
return -EINVAL; return -EINVAL;
} }
...@@ -2307,7 +2318,9 @@ static int ucc_struct_init(struct ucc_geth_private *ugeth) ...@@ -2307,7 +2318,9 @@ static int ucc_struct_init(struct ucc_geth_private *ugeth)
if (!((uf_info->bd_mem_part == MEM_PART_SYSTEM) || if (!((uf_info->bd_mem_part == MEM_PART_SYSTEM) ||
(uf_info->bd_mem_part == MEM_PART_MURAM))) { (uf_info->bd_mem_part == MEM_PART_MURAM))) {
ugeth_err("%s: Bad memory partition value.", __FUNCTION__); if (netif_msg_probe(ugeth))
ugeth_err("%s: Bad memory partition value.",
__FUNCTION__);
return -EINVAL; return -EINVAL;
} }
...@@ -2316,9 +2329,10 @@ static int ucc_struct_init(struct ucc_geth_private *ugeth) ...@@ -2316,9 +2329,10 @@ static int ucc_struct_init(struct ucc_geth_private *ugeth)
if ((ug_info->bdRingLenRx[i] < UCC_GETH_RX_BD_RING_SIZE_MIN) || if ((ug_info->bdRingLenRx[i] < UCC_GETH_RX_BD_RING_SIZE_MIN) ||
(ug_info->bdRingLenRx[i] % (ug_info->bdRingLenRx[i] %
UCC_GETH_RX_BD_RING_SIZE_ALIGNMENT)) { UCC_GETH_RX_BD_RING_SIZE_ALIGNMENT)) {
if (netif_msg_probe(ugeth))
ugeth_err ugeth_err
("%s: Rx BD ring length must be multiple of 4," ("%s: Rx BD ring length must be multiple of 4, no smaller than 8.",
" no smaller than 8.", __FUNCTION__); __FUNCTION__);
return -EINVAL; return -EINVAL;
} }
} }
...@@ -2326,6 +2340,7 @@ static int ucc_struct_init(struct ucc_geth_private *ugeth) ...@@ -2326,6 +2340,7 @@ static int ucc_struct_init(struct ucc_geth_private *ugeth)
/* Tx BD lengths */ /* Tx BD lengths */
for (i = 0; i < ug_info->numQueuesTx; i++) { for (i = 0; i < ug_info->numQueuesTx; i++) {
if (ug_info->bdRingLenTx[i] < UCC_GETH_TX_BD_RING_SIZE_MIN) { if (ug_info->bdRingLenTx[i] < UCC_GETH_TX_BD_RING_SIZE_MIN) {
if (netif_msg_probe(ugeth))
ugeth_err ugeth_err
("%s: Tx BD ring length must be no smaller than 2.", ("%s: Tx BD ring length must be no smaller than 2.",
__FUNCTION__); __FUNCTION__);
...@@ -2336,6 +2351,7 @@ static int ucc_struct_init(struct ucc_geth_private *ugeth) ...@@ -2336,6 +2351,7 @@ static int ucc_struct_init(struct ucc_geth_private *ugeth)
/* mrblr */ /* mrblr */
if ((uf_info->max_rx_buf_length == 0) || if ((uf_info->max_rx_buf_length == 0) ||
(uf_info->max_rx_buf_length % UCC_GETH_MRBLR_ALIGNMENT)) { (uf_info->max_rx_buf_length % UCC_GETH_MRBLR_ALIGNMENT)) {
if (netif_msg_probe(ugeth))
ugeth_err ugeth_err
("%s: max_rx_buf_length must be non-zero multiple of 128.", ("%s: max_rx_buf_length must be non-zero multiple of 128.",
__FUNCTION__); __FUNCTION__);
...@@ -2344,12 +2360,14 @@ static int ucc_struct_init(struct ucc_geth_private *ugeth) ...@@ -2344,12 +2360,14 @@ static int ucc_struct_init(struct ucc_geth_private *ugeth)
/* num Tx queues */ /* num Tx queues */
if (ug_info->numQueuesTx > NUM_TX_QUEUES) { if (ug_info->numQueuesTx > NUM_TX_QUEUES) {
if (netif_msg_probe(ugeth))
ugeth_err("%s: number of tx queues too large.", __FUNCTION__); ugeth_err("%s: number of tx queues too large.", __FUNCTION__);
return -EINVAL; return -EINVAL;
} }
/* num Rx queues */ /* num Rx queues */
if (ug_info->numQueuesRx > NUM_RX_QUEUES) { if (ug_info->numQueuesRx > NUM_RX_QUEUES) {
if (netif_msg_probe(ugeth))
ugeth_err("%s: number of rx queues too large.", __FUNCTION__); ugeth_err("%s: number of rx queues too large.", __FUNCTION__);
return -EINVAL; return -EINVAL;
} }
...@@ -2357,6 +2375,7 @@ static int ucc_struct_init(struct ucc_geth_private *ugeth) ...@@ -2357,6 +2375,7 @@ static int ucc_struct_init(struct ucc_geth_private *ugeth)
/* l2qt */ /* l2qt */
for (i = 0; i < UCC_GETH_VLAN_PRIORITY_MAX; i++) { for (i = 0; i < UCC_GETH_VLAN_PRIORITY_MAX; i++) {
if (ug_info->l2qt[i] >= ug_info->numQueuesRx) { if (ug_info->l2qt[i] >= ug_info->numQueuesRx) {
if (netif_msg_probe(ugeth))
ugeth_err ugeth_err
("%s: VLAN priority table entry must not be" ("%s: VLAN priority table entry must not be"
" larger than number of Rx queues.", " larger than number of Rx queues.",
...@@ -2368,6 +2387,7 @@ static int ucc_struct_init(struct ucc_geth_private *ugeth) ...@@ -2368,6 +2387,7 @@ static int ucc_struct_init(struct ucc_geth_private *ugeth)
/* l3qt */ /* l3qt */
for (i = 0; i < UCC_GETH_IP_PRIORITY_MAX; i++) { for (i = 0; i < UCC_GETH_IP_PRIORITY_MAX; i++) {
if (ug_info->l3qt[i] >= ug_info->numQueuesRx) { if (ug_info->l3qt[i] >= ug_info->numQueuesRx) {
if (netif_msg_probe(ugeth))
ugeth_err ugeth_err
("%s: IP priority table entry must not be" ("%s: IP priority table entry must not be"
" larger than number of Rx queues.", " larger than number of Rx queues.",
...@@ -2377,6 +2397,7 @@ static int ucc_struct_init(struct ucc_geth_private *ugeth) ...@@ -2377,6 +2397,7 @@ static int ucc_struct_init(struct ucc_geth_private *ugeth)
} }
if (ug_info->cam && !ug_info->ecamptr) { if (ug_info->cam && !ug_info->ecamptr) {
if (netif_msg_probe(ugeth))
ugeth_err("%s: If cam mode is chosen, must supply cam ptr.", ugeth_err("%s: If cam mode is chosen, must supply cam ptr.",
__FUNCTION__); __FUNCTION__);
return -EINVAL; return -EINVAL;
...@@ -2385,6 +2406,7 @@ static int ucc_struct_init(struct ucc_geth_private *ugeth) ...@@ -2385,6 +2406,7 @@ static int ucc_struct_init(struct ucc_geth_private *ugeth)
if ((ug_info->numStationAddresses != if ((ug_info->numStationAddresses !=
UCC_GETH_NUM_OF_STATION_ADDRESSES_1) UCC_GETH_NUM_OF_STATION_ADDRESSES_1)
&& ug_info->rxExtendedFiltering) { && ug_info->rxExtendedFiltering) {
if (netif_msg_probe(ugeth))
ugeth_err("%s: Number of station addresses greater than 1 " ugeth_err("%s: Number of station addresses greater than 1 "
"not allowed in extended parsing mode.", "not allowed in extended parsing mode.",
__FUNCTION__); __FUNCTION__);
...@@ -2400,6 +2422,7 @@ static int ucc_struct_init(struct ucc_geth_private *ugeth) ...@@ -2400,6 +2422,7 @@ static int ucc_struct_init(struct ucc_geth_private *ugeth)
uf_info->uccm_mask |= (UCCE_TXBF_SINGLE_MASK << i); uf_info->uccm_mask |= (UCCE_TXBF_SINGLE_MASK << i);
/* Initialize the general fast UCC block. */ /* Initialize the general fast UCC block. */
if (ucc_fast_init(uf_info, &ugeth->uccf)) { if (ucc_fast_init(uf_info, &ugeth->uccf)) {
if (netif_msg_probe(ugeth))
ugeth_err("%s: Failed to init uccf.", __FUNCTION__); ugeth_err("%s: Failed to init uccf.", __FUNCTION__);
ucc_geth_memclean(ugeth); ucc_geth_memclean(ugeth);
return -ENOMEM; return -ENOMEM;
...@@ -2453,7 +2476,9 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth) ...@@ -2453,7 +2476,9 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth)
numThreadsRxNumerical = 8; numThreadsRxNumerical = 8;
break; break;
default: default:
ugeth_err("%s: Bad number of Rx threads value.", __FUNCTION__); if (netif_msg_ifup(ugeth))
ugeth_err("%s: Bad number of Rx threads value.",
__FUNCTION__);
ucc_geth_memclean(ugeth); ucc_geth_memclean(ugeth);
return -EINVAL; return -EINVAL;
break; break;
...@@ -2476,7 +2501,9 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth) ...@@ -2476,7 +2501,9 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth)
numThreadsTxNumerical = 8; numThreadsTxNumerical = 8;
break; break;
default: default:
ugeth_err("%s: Bad number of Tx threads value.", __FUNCTION__); if (netif_msg_ifup(ugeth))
ugeth_err("%s: Bad number of Tx threads value.",
__FUNCTION__);
ucc_geth_memclean(ugeth); ucc_geth_memclean(ugeth);
return -EINVAL; return -EINVAL;
break; break;
...@@ -2528,6 +2555,7 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth) ...@@ -2528,6 +2555,7 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth)
ug_info->backToBackInterFrameGap, ug_info->backToBackInterFrameGap,
&ug_regs->ipgifg); &ug_regs->ipgifg);
if (ret_val != 0) { if (ret_val != 0) {
if (netif_msg_ifup(ugeth))
ugeth_err("%s: IPGIFG initialization parameter too large.", ugeth_err("%s: IPGIFG initialization parameter too large.",
__FUNCTION__); __FUNCTION__);
ucc_geth_memclean(ugeth); ucc_geth_memclean(ugeth);
...@@ -2545,6 +2573,7 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth) ...@@ -2545,6 +2573,7 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth)
ug_info->collisionWindow, ug_info->collisionWindow,
&ug_regs->hafdup); &ug_regs->hafdup);
if (ret_val != 0) { if (ret_val != 0) {
if (netif_msg_ifup(ugeth))
ugeth_err("%s: Half Duplex initialization parameter too large.", ugeth_err("%s: Half Duplex initialization parameter too large.",
__FUNCTION__); __FUNCTION__);
ucc_geth_memclean(ugeth); ucc_geth_memclean(ugeth);
...@@ -2598,6 +2627,7 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth) ...@@ -2598,6 +2627,7 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth)
tx_bd_ring_offset[j]); tx_bd_ring_offset[j]);
} }
if (!ugeth->p_tx_bd_ring[j]) { if (!ugeth->p_tx_bd_ring[j]) {
if (netif_msg_ifup(ugeth))
ugeth_err ugeth_err
("%s: Can not allocate memory for Tx bd rings.", ("%s: Can not allocate memory for Tx bd rings.",
__FUNCTION__); __FUNCTION__);
...@@ -2633,6 +2663,7 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth) ...@@ -2633,6 +2663,7 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth)
rx_bd_ring_offset[j]); rx_bd_ring_offset[j]);
} }
if (!ugeth->p_rx_bd_ring[j]) { if (!ugeth->p_rx_bd_ring[j]) {
if (netif_msg_ifup(ugeth))
ugeth_err ugeth_err
("%s: Can not allocate memory for Rx bd rings.", ("%s: Can not allocate memory for Rx bd rings.",
__FUNCTION__); __FUNCTION__);
...@@ -2649,6 +2680,7 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth) ...@@ -2649,6 +2680,7 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth)
GFP_KERNEL); GFP_KERNEL);
if (ugeth->tx_skbuff[j] == NULL) { if (ugeth->tx_skbuff[j] == NULL) {
if (netif_msg_ifup(ugeth))
ugeth_err("%s: Could not allocate tx_skbuff", ugeth_err("%s: Could not allocate tx_skbuff",
__FUNCTION__); __FUNCTION__);
ucc_geth_memclean(ugeth); ucc_geth_memclean(ugeth);
...@@ -2680,6 +2712,7 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth) ...@@ -2680,6 +2712,7 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth)
GFP_KERNEL); GFP_KERNEL);
if (ugeth->rx_skbuff[j] == NULL) { if (ugeth->rx_skbuff[j] == NULL) {
if (netif_msg_ifup(ugeth))
ugeth_err("%s: Could not allocate rx_skbuff", ugeth_err("%s: Could not allocate rx_skbuff",
__FUNCTION__); __FUNCTION__);
ucc_geth_memclean(ugeth); ucc_geth_memclean(ugeth);
...@@ -2712,6 +2745,7 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth) ...@@ -2712,6 +2745,7 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth)
qe_muram_alloc(sizeof(struct ucc_geth_tx_global_pram), qe_muram_alloc(sizeof(struct ucc_geth_tx_global_pram),
UCC_GETH_TX_GLOBAL_PRAM_ALIGNMENT); UCC_GETH_TX_GLOBAL_PRAM_ALIGNMENT);
if (IS_ERR_VALUE(ugeth->tx_glbl_pram_offset)) { if (IS_ERR_VALUE(ugeth->tx_glbl_pram_offset)) {
if (netif_msg_ifup(ugeth))
ugeth_err ugeth_err
("%s: Can not allocate DPRAM memory for p_tx_glbl_pram.", ("%s: Can not allocate DPRAM memory for p_tx_glbl_pram.",
__FUNCTION__); __FUNCTION__);
...@@ -2734,6 +2768,7 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth) ...@@ -2734,6 +2768,7 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth)
32 * (numThreadsTxNumerical == 1), 32 * (numThreadsTxNumerical == 1),
UCC_GETH_THREAD_DATA_ALIGNMENT); UCC_GETH_THREAD_DATA_ALIGNMENT);
if (IS_ERR_VALUE(ugeth->thread_dat_tx_offset)) { if (IS_ERR_VALUE(ugeth->thread_dat_tx_offset)) {
if (netif_msg_ifup(ugeth))
ugeth_err ugeth_err
("%s: Can not allocate DPRAM memory for p_thread_data_tx.", ("%s: Can not allocate DPRAM memory for p_thread_data_tx.",
__FUNCTION__); __FUNCTION__);
...@@ -2762,6 +2797,7 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth) ...@@ -2762,6 +2797,7 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth)
sizeof(struct ucc_geth_send_queue_qd), sizeof(struct ucc_geth_send_queue_qd),
UCC_GETH_SEND_QUEUE_QUEUE_DESCRIPTOR_ALIGNMENT); UCC_GETH_SEND_QUEUE_QUEUE_DESCRIPTOR_ALIGNMENT);
if (IS_ERR_VALUE(ugeth->send_q_mem_reg_offset)) { if (IS_ERR_VALUE(ugeth->send_q_mem_reg_offset)) {
if (netif_msg_ifup(ugeth))
ugeth_err ugeth_err
("%s: Can not allocate DPRAM memory for p_send_q_mem_reg.", ("%s: Can not allocate DPRAM memory for p_send_q_mem_reg.",
__FUNCTION__); __FUNCTION__);
...@@ -2805,6 +2841,7 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth) ...@@ -2805,6 +2841,7 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth)
qe_muram_alloc(sizeof(struct ucc_geth_scheduler), qe_muram_alloc(sizeof(struct ucc_geth_scheduler),
UCC_GETH_SCHEDULER_ALIGNMENT); UCC_GETH_SCHEDULER_ALIGNMENT);
if (IS_ERR_VALUE(ugeth->scheduler_offset)) { if (IS_ERR_VALUE(ugeth->scheduler_offset)) {
if (netif_msg_ifup(ugeth))
ugeth_err ugeth_err
("%s: Can not allocate DPRAM memory for p_scheduler.", ("%s: Can not allocate DPRAM memory for p_scheduler.",
__FUNCTION__); __FUNCTION__);
...@@ -2853,9 +2890,11 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth) ...@@ -2853,9 +2890,11 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth)
(struct ucc_geth_tx_firmware_statistics_pram), (struct ucc_geth_tx_firmware_statistics_pram),
UCC_GETH_TX_STATISTICS_ALIGNMENT); UCC_GETH_TX_STATISTICS_ALIGNMENT);
if (IS_ERR_VALUE(ugeth->tx_fw_statistics_pram_offset)) { if (IS_ERR_VALUE(ugeth->tx_fw_statistics_pram_offset)) {
if (netif_msg_ifup(ugeth))
ugeth_err ugeth_err
("%s: Can not allocate DPRAM memory for" ("%s: Can not allocate DPRAM memory for"
" p_tx_fw_statistics_pram.", __FUNCTION__); " p_tx_fw_statistics_pram.",
__FUNCTION__);
ucc_geth_memclean(ugeth); ucc_geth_memclean(ugeth);
return -ENOMEM; return -ENOMEM;
} }
...@@ -2892,6 +2931,7 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth) ...@@ -2892,6 +2931,7 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth)
qe_muram_alloc(sizeof(struct ucc_geth_rx_global_pram), qe_muram_alloc(sizeof(struct ucc_geth_rx_global_pram),
UCC_GETH_RX_GLOBAL_PRAM_ALIGNMENT); UCC_GETH_RX_GLOBAL_PRAM_ALIGNMENT);
if (IS_ERR_VALUE(ugeth->rx_glbl_pram_offset)) { if (IS_ERR_VALUE(ugeth->rx_glbl_pram_offset)) {
if (netif_msg_ifup(ugeth))
ugeth_err ugeth_err
("%s: Can not allocate DPRAM memory for p_rx_glbl_pram.", ("%s: Can not allocate DPRAM memory for p_rx_glbl_pram.",
__FUNCTION__); __FUNCTION__);
...@@ -2913,6 +2953,7 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth) ...@@ -2913,6 +2953,7 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth)
sizeof(struct ucc_geth_thread_data_rx), sizeof(struct ucc_geth_thread_data_rx),
UCC_GETH_THREAD_DATA_ALIGNMENT); UCC_GETH_THREAD_DATA_ALIGNMENT);
if (IS_ERR_VALUE(ugeth->thread_dat_rx_offset)) { if (IS_ERR_VALUE(ugeth->thread_dat_rx_offset)) {
if (netif_msg_ifup(ugeth))
ugeth_err ugeth_err
("%s: Can not allocate DPRAM memory for p_thread_data_rx.", ("%s: Can not allocate DPRAM memory for p_thread_data_rx.",
__FUNCTION__); __FUNCTION__);
...@@ -2936,6 +2977,7 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth) ...@@ -2936,6 +2977,7 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth)
(struct ucc_geth_rx_firmware_statistics_pram), (struct ucc_geth_rx_firmware_statistics_pram),
UCC_GETH_RX_STATISTICS_ALIGNMENT); UCC_GETH_RX_STATISTICS_ALIGNMENT);
if (IS_ERR_VALUE(ugeth->rx_fw_statistics_pram_offset)) { if (IS_ERR_VALUE(ugeth->rx_fw_statistics_pram_offset)) {
if (netif_msg_ifup(ugeth))
ugeth_err ugeth_err
("%s: Can not allocate DPRAM memory for" ("%s: Can not allocate DPRAM memory for"
" p_rx_fw_statistics_pram.", __FUNCTION__); " p_rx_fw_statistics_pram.", __FUNCTION__);
...@@ -2958,6 +3000,7 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth) ...@@ -2958,6 +3000,7 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth)
sizeof(struct ucc_geth_rx_interrupt_coalescing_entry) sizeof(struct ucc_geth_rx_interrupt_coalescing_entry)
+ 4, UCC_GETH_RX_INTERRUPT_COALESCING_ALIGNMENT); + 4, UCC_GETH_RX_INTERRUPT_COALESCING_ALIGNMENT);
if (IS_ERR_VALUE(ugeth->rx_irq_coalescing_tbl_offset)) { if (IS_ERR_VALUE(ugeth->rx_irq_coalescing_tbl_offset)) {
if (netif_msg_ifup(ugeth))
ugeth_err ugeth_err
("%s: Can not allocate DPRAM memory for" ("%s: Can not allocate DPRAM memory for"
" p_rx_irq_coalescing_tbl.", __FUNCTION__); " p_rx_irq_coalescing_tbl.", __FUNCTION__);
...@@ -3026,6 +3069,7 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth) ...@@ -3026,6 +3069,7 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth)
sizeof(struct ucc_geth_rx_prefetched_bds)), sizeof(struct ucc_geth_rx_prefetched_bds)),
UCC_GETH_RX_BD_QUEUES_ALIGNMENT); UCC_GETH_RX_BD_QUEUES_ALIGNMENT);
if (IS_ERR_VALUE(ugeth->rx_bd_qs_tbl_offset)) { if (IS_ERR_VALUE(ugeth->rx_bd_qs_tbl_offset)) {
if (netif_msg_ifup(ugeth))
ugeth_err ugeth_err
("%s: Can not allocate DPRAM memory for p_rx_bd_qs_tbl.", ("%s: Can not allocate DPRAM memory for p_rx_bd_qs_tbl.",
__FUNCTION__); __FUNCTION__);
...@@ -3103,6 +3147,7 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth) ...@@ -3103,6 +3147,7 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth)
/* initialize extended filtering */ /* initialize extended filtering */
if (ug_info->rxExtendedFiltering) { if (ug_info->rxExtendedFiltering) {
if (!ug_info->extendedFilteringChainPointer) { if (!ug_info->extendedFilteringChainPointer) {
if (netif_msg_ifup(ugeth))
ugeth_err("%s: Null Extended Filtering Chain Pointer.", ugeth_err("%s: Null Extended Filtering Chain Pointer.",
__FUNCTION__); __FUNCTION__);
ucc_geth_memclean(ugeth); ucc_geth_memclean(ugeth);
...@@ -3115,6 +3160,7 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth) ...@@ -3115,6 +3160,7 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth)
qe_muram_alloc(sizeof(struct ucc_geth_exf_global_pram), qe_muram_alloc(sizeof(struct ucc_geth_exf_global_pram),
UCC_GETH_RX_EXTENDED_FILTERING_GLOBAL_PARAMETERS_ALIGNMENT); UCC_GETH_RX_EXTENDED_FILTERING_GLOBAL_PARAMETERS_ALIGNMENT);
if (IS_ERR_VALUE(ugeth->exf_glbl_param_offset)) { if (IS_ERR_VALUE(ugeth->exf_glbl_param_offset)) {
if (netif_msg_ifup(ugeth))
ugeth_err ugeth_err
("%s: Can not allocate DPRAM memory for" ("%s: Can not allocate DPRAM memory for"
" p_exf_glbl_param.", __FUNCTION__); " p_exf_glbl_param.", __FUNCTION__);
...@@ -3162,6 +3208,7 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth) ...@@ -3162,6 +3208,7 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth)
*/ */
if (!(ugeth->p_init_enet_param_shadow = if (!(ugeth->p_init_enet_param_shadow =
kmalloc(sizeof(struct ucc_geth_init_pram), GFP_KERNEL))) { kmalloc(sizeof(struct ucc_geth_init_pram), GFP_KERNEL))) {
if (netif_msg_ifup(ugeth))
ugeth_err ugeth_err
("%s: Can not allocate memory for" ("%s: Can not allocate memory for"
" p_UccInitEnetParamShadows.", __FUNCTION__); " p_UccInitEnetParamShadows.", __FUNCTION__);
...@@ -3197,6 +3244,7 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth) ...@@ -3197,6 +3244,7 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth)
QE_FLTR_LARGEST_EXTERNAL_TABLE_LOOKUP_KEY_SIZE_8_BYTES) QE_FLTR_LARGEST_EXTERNAL_TABLE_LOOKUP_KEY_SIZE_8_BYTES)
&& (ug_info->largestexternallookupkeysize != && (ug_info->largestexternallookupkeysize !=
QE_FLTR_LARGEST_EXTERNAL_TABLE_LOOKUP_KEY_SIZE_16_BYTES)) { QE_FLTR_LARGEST_EXTERNAL_TABLE_LOOKUP_KEY_SIZE_16_BYTES)) {
if (netif_msg_ifup(ugeth))
ugeth_err("%s: Invalid largest External Lookup Key Size.", ugeth_err("%s: Invalid largest External Lookup Key Size.",
__FUNCTION__); __FUNCTION__);
ucc_geth_memclean(ugeth); ucc_geth_memclean(ugeth);
...@@ -3223,6 +3271,7 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth) ...@@ -3223,6 +3271,7 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth)
/* Rx needs one extra for terminator */ /* Rx needs one extra for terminator */
, size, UCC_GETH_THREAD_RX_PRAM_ALIGNMENT, , size, UCC_GETH_THREAD_RX_PRAM_ALIGNMENT,
ug_info->riscRx, 1)) != 0) { ug_info->riscRx, 1)) != 0) {
if (netif_msg_ifup(ugeth))
ugeth_err("%s: Can not fill p_init_enet_param_shadow.", ugeth_err("%s: Can not fill p_init_enet_param_shadow.",
__FUNCTION__); __FUNCTION__);
ucc_geth_memclean(ugeth); ucc_geth_memclean(ugeth);
...@@ -3238,6 +3287,7 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth) ...@@ -3238,6 +3287,7 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth)
sizeof(struct ucc_geth_thread_tx_pram), sizeof(struct ucc_geth_thread_tx_pram),
UCC_GETH_THREAD_TX_PRAM_ALIGNMENT, UCC_GETH_THREAD_TX_PRAM_ALIGNMENT,
ug_info->riscTx, 0)) != 0) { ug_info->riscTx, 0)) != 0) {
if (netif_msg_ifup(ugeth))
ugeth_err("%s: Can not fill p_init_enet_param_shadow.", ugeth_err("%s: Can not fill p_init_enet_param_shadow.",
__FUNCTION__); __FUNCTION__);
ucc_geth_memclean(ugeth); ucc_geth_memclean(ugeth);
...@@ -3247,6 +3297,7 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth) ...@@ -3247,6 +3297,7 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth)
/* Load Rx bds with buffers */ /* Load Rx bds with buffers */
for (i = 0; i < ug_info->numQueuesRx; i++) { for (i = 0; i < ug_info->numQueuesRx; i++) {
if ((ret_val = rx_bd_buffer_set(ugeth, (u8) i)) != 0) { if ((ret_val = rx_bd_buffer_set(ugeth, (u8) i)) != 0) {
if (netif_msg_ifup(ugeth))
ugeth_err("%s: Can not fill Rx bds with buffers.", ugeth_err("%s: Can not fill Rx bds with buffers.",
__FUNCTION__); __FUNCTION__);
ucc_geth_memclean(ugeth); ucc_geth_memclean(ugeth);
...@@ -3257,6 +3308,7 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth) ...@@ -3257,6 +3308,7 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth)
/* Allocate InitEnet command parameter structure */ /* Allocate InitEnet command parameter structure */
init_enet_pram_offset = qe_muram_alloc(sizeof(struct ucc_geth_init_pram), 4); init_enet_pram_offset = qe_muram_alloc(sizeof(struct ucc_geth_init_pram), 4);
if (IS_ERR_VALUE(init_enet_pram_offset)) { if (IS_ERR_VALUE(init_enet_pram_offset)) {
if (netif_msg_ifup(ugeth))
ugeth_err ugeth_err
("%s: Can not allocate DPRAM memory for p_init_enet_pram.", ("%s: Can not allocate DPRAM memory for p_init_enet_pram.",
__FUNCTION__); __FUNCTION__);
...@@ -3429,7 +3481,8 @@ static int ucc_geth_rx(struct ucc_geth_private *ugeth, u8 rxQ, int rx_work_limit ...@@ -3429,7 +3481,8 @@ static int ucc_geth_rx(struct ucc_geth_private *ugeth, u8 rxQ, int rx_work_limit
if (!skb || if (!skb ||
(!(bd_status & (R_F | R_L))) || (!(bd_status & (R_F | R_L))) ||
(bd_status & R_ERRORS_FATAL)) { (bd_status & R_ERRORS_FATAL)) {
ugeth_vdbg("%s, %d: ERROR!!! skb - 0x%08x", if (netif_msg_rx_err(ugeth))
ugeth_err("%s, %d: ERROR!!! skb - 0x%08x",
__FUNCTION__, __LINE__, (u32) skb); __FUNCTION__, __LINE__, (u32) skb);
if (skb) if (skb)
dev_kfree_skb_any(skb); dev_kfree_skb_any(skb);
...@@ -3459,6 +3512,7 @@ static int ucc_geth_rx(struct ucc_geth_private *ugeth, u8 rxQ, int rx_work_limit ...@@ -3459,6 +3512,7 @@ static int ucc_geth_rx(struct ucc_geth_private *ugeth, u8 rxQ, int rx_work_limit
skb = get_new_skb(ugeth, bd); skb = get_new_skb(ugeth, bd);
if (!skb) { if (!skb) {
if (netif_msg_rx_err(ugeth))
ugeth_warn("%s: No Rx Data Buffer", __FUNCTION__); ugeth_warn("%s: No Rx Data Buffer", __FUNCTION__);
ugeth->stats.rx_dropped++; ugeth->stats.rx_dropped++;
break; break;
...@@ -3650,6 +3704,7 @@ static int ucc_geth_open(struct net_device *dev) ...@@ -3650,6 +3704,7 @@ static int ucc_geth_open(struct net_device *dev)
/* Test station address */ /* Test station address */
if (dev->dev_addr[0] & ENET_GROUP_ADDR) { if (dev->dev_addr[0] & ENET_GROUP_ADDR) {
if (netif_msg_ifup(ugeth))
ugeth_err("%s: Multicast address used for station address" ugeth_err("%s: Multicast address used for station address"
" - is this what you wanted?", __FUNCTION__); " - is this what you wanted?", __FUNCTION__);
return -EINVAL; return -EINVAL;
...@@ -3657,12 +3712,14 @@ static int ucc_geth_open(struct net_device *dev) ...@@ -3657,12 +3712,14 @@ static int ucc_geth_open(struct net_device *dev)
err = ucc_struct_init(ugeth); err = ucc_struct_init(ugeth);
if (err) { if (err) {
if (netif_msg_ifup(ugeth))
ugeth_err("%s: Cannot configure internal struct, aborting.", dev->name); ugeth_err("%s: Cannot configure internal struct, aborting.", dev->name);
return err; return err;
} }
err = ucc_geth_startup(ugeth); err = ucc_geth_startup(ugeth);
if (err) { if (err) {
if (netif_msg_ifup(ugeth))
ugeth_err("%s: Cannot configure net device, aborting.", ugeth_err("%s: Cannot configure net device, aborting.",
dev->name); dev->name);
return err; return err;
...@@ -3670,6 +3727,7 @@ static int ucc_geth_open(struct net_device *dev) ...@@ -3670,6 +3727,7 @@ static int ucc_geth_open(struct net_device *dev)
err = adjust_enet_interface(ugeth); err = adjust_enet_interface(ugeth);
if (err) { if (err) {
if (netif_msg_ifup(ugeth))
ugeth_err("%s: Cannot configure net device, aborting.", ugeth_err("%s: Cannot configure net device, aborting.",
dev->name); dev->name);
return err; return err;
...@@ -3688,6 +3746,7 @@ static int ucc_geth_open(struct net_device *dev) ...@@ -3688,6 +3746,7 @@ static int ucc_geth_open(struct net_device *dev)
err = init_phy(dev); err = init_phy(dev);
if (err) { if (err) {
if (netif_msg_ifup(ugeth))
ugeth_err("%s: Cannot initialize PHY, aborting.", dev->name); ugeth_err("%s: Cannot initialize PHY, aborting.", dev->name);
return err; return err;
} }
...@@ -3698,6 +3757,7 @@ static int ucc_geth_open(struct net_device *dev) ...@@ -3698,6 +3757,7 @@ static int ucc_geth_open(struct net_device *dev)
request_irq(ugeth->ug_info->uf_info.irq, ucc_geth_irq_handler, 0, request_irq(ugeth->ug_info->uf_info.irq, ucc_geth_irq_handler, 0,
"UCC Geth", dev); "UCC Geth", dev);
if (err) { if (err) {
if (netif_msg_ifup(ugeth))
ugeth_err("%s: Cannot get IRQ for net device, aborting.", ugeth_err("%s: Cannot get IRQ for net device, aborting.",
dev->name); dev->name);
ucc_geth_stop(ugeth); ucc_geth_stop(ugeth);
...@@ -3706,6 +3766,7 @@ static int ucc_geth_open(struct net_device *dev) ...@@ -3706,6 +3766,7 @@ static int ucc_geth_open(struct net_device *dev)
err = ugeth_enable(ugeth, COMM_DIR_RX_AND_TX); err = ugeth_enable(ugeth, COMM_DIR_RX_AND_TX);
if (err) { if (err) {
if (netif_msg_ifup(ugeth))
ugeth_err("%s: Cannot enable net device, aborting.", dev->name); ugeth_err("%s: Cannot enable net device, aborting.", dev->name);
ucc_geth_stop(ugeth); ucc_geth_stop(ugeth);
return err; return err;
...@@ -3789,6 +3850,13 @@ static int ucc_geth_probe(struct of_device* ofdev, const struct of_device_id *ma ...@@ -3789,6 +3850,13 @@ static int ucc_geth_probe(struct of_device* ofdev, const struct of_device_id *ma
return -ENODEV; return -ENODEV;
ug_info = &ugeth_info[ucc_num]; ug_info = &ugeth_info[ucc_num];
if (ug_info == NULL) {
if (netif_msg_probe(&debug))
ugeth_err("%s: [%d] Missing additional data!",
__FUNCTION__, ucc_num);
return -ENODEV;
}
ug_info->uf_info.ucc_num = ucc_num; ug_info->uf_info.ucc_num = ucc_num;
prop = of_get_property(np, "rx-clock", NULL); prop = of_get_property(np, "rx-clock", NULL);
...@@ -3867,16 +3935,11 @@ static int ucc_geth_probe(struct of_device* ofdev, const struct of_device_id *ma ...@@ -3867,16 +3935,11 @@ static int ucc_geth_probe(struct of_device* ofdev, const struct of_device_id *ma
ug_info->mdio_bus = res.start; ug_info->mdio_bus = res.start;
if (netif_msg_probe(&debug))
printk(KERN_INFO "ucc_geth: UCC%1d at 0x%8x (irq = %d) \n", printk(KERN_INFO "ucc_geth: UCC%1d at 0x%8x (irq = %d) \n",
ug_info->uf_info.ucc_num + 1, ug_info->uf_info.regs, ug_info->uf_info.ucc_num + 1, ug_info->uf_info.regs,
ug_info->uf_info.irq); ug_info->uf_info.irq);
if (ug_info == NULL) {
ugeth_err("%s: [%d] Missing additional data!", __FUNCTION__,
ucc_num);
return -ENODEV;
}
/* Create an ethernet device instance */ /* Create an ethernet device instance */
dev = alloc_etherdev(sizeof(*ugeth)); dev = alloc_etherdev(sizeof(*ugeth));
...@@ -3910,12 +3973,13 @@ static int ucc_geth_probe(struct of_device* ofdev, const struct of_device_id *ma ...@@ -3910,12 +3973,13 @@ static int ucc_geth_probe(struct of_device* ofdev, const struct of_device_id *ma
dev->mtu = 1500; dev->mtu = 1500;
dev->set_multicast_list = ucc_geth_set_multi; dev->set_multicast_list = ucc_geth_set_multi;
ugeth->msg_enable = (NETIF_MSG_IFUP << 1 ) - 1; ugeth->msg_enable = netif_msg_init(debug.msg_enable, UGETH_MSG_DEFAULT);
ugeth->phy_interface = phy_interface; ugeth->phy_interface = phy_interface;
ugeth->max_speed = max_speed; ugeth->max_speed = max_speed;
err = register_netdev(dev); err = register_netdev(dev);
if (err) { if (err) {
if (netif_msg_probe(ugeth))
ugeth_err("%s: Cannot register net device, aborting.", ugeth_err("%s: Cannot register net device, aborting.",
dev->name); dev->name);
free_netdev(dev); free_netdev(dev);
...@@ -3971,6 +4035,7 @@ static int __init ucc_geth_init(void) ...@@ -3971,6 +4035,7 @@ static int __init ucc_geth_init(void)
if (ret) if (ret)
return ret; return ret;
if (netif_msg_drv(&debug))
printk(KERN_INFO "ucc_geth: " DRV_DESC "\n"); printk(KERN_INFO "ucc_geth: " DRV_DESC "\n");
for (i = 0; i < 8; i++) for (i = 0; i < 8; i++)
memcpy(&(ugeth_info[i]), &ugeth_primary_info, memcpy(&(ugeth_info[i]), &ugeth_primary_info,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册