aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/tokenring/smctr.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/tokenring/smctr.c')
-rw-r--r--drivers/net/tokenring/smctr.c86
1 files changed, 42 insertions, 44 deletions
diff --git a/drivers/net/tokenring/smctr.c b/drivers/net/tokenring/smctr.c
index ebda61bc4c2f..427a8970b6fe 100644
--- a/drivers/net/tokenring/smctr.c
+++ b/drivers/net/tokenring/smctr.c
@@ -2309,9 +2309,9 @@ static irqreturn_t smctr_interrupt(int irq, void *dev_id)
2309 else 2309 else
2310 { 2310 {
2311 if((tp->acb_head->cmd 2311 if((tp->acb_head->cmd
2312 == ACB_CMD_READ_TRC_STATUS) 2312 == ACB_CMD_READ_TRC_STATUS) &&
2313 && (tp->acb_head->subcmd 2313 (tp->acb_head->subcmd
2314 == RW_TRC_STATUS_BLOCK)) 2314 == RW_TRC_STATUS_BLOCK))
2315 { 2315 {
2316 if(tp->ptr_bcn_type) 2316 if(tp->ptr_bcn_type)
2317 { 2317 {
@@ -2331,8 +2331,8 @@ static irqreturn_t smctr_interrupt(int irq, void *dev_id)
2331 smctr_disable_16bit(dev); 2331 smctr_disable_16bit(dev);
2332 err = smctr_ring_status_chg(dev); 2332 err = smctr_ring_status_chg(dev);
2333 smctr_enable_16bit(dev); 2333 smctr_enable_16bit(dev);
2334 if((tp->ring_status & REMOVE_RECEIVED) 2334 if((tp->ring_status & REMOVE_RECEIVED) &&
2335 && (tp->config_word0 & NO_AUTOREMOVE)) 2335 (tp->config_word0 & NO_AUTOREMOVE))
2336 { 2336 {
2337 smctr_issue_remove_cmd(dev); 2337 smctr_issue_remove_cmd(dev);
2338 } 2338 }
@@ -2511,9 +2511,9 @@ static int smctr_issue_init_timers_cmd(struct net_device *dev)
2511 tp->config_word0 = THDREN | DMA_TRIGGER | USETPT | NO_AUTOREMOVE; 2511 tp->config_word0 = THDREN | DMA_TRIGGER | USETPT | NO_AUTOREMOVE;
2512 tp->config_word1 = 0; 2512 tp->config_word1 = 0;
2513 2513
2514 if((tp->media_type == MEDIA_STP_16) 2514 if((tp->media_type == MEDIA_STP_16) ||
2515 || (tp->media_type == MEDIA_UTP_16) 2515 (tp->media_type == MEDIA_UTP_16) ||
2516 || (tp->media_type == MEDIA_STP_16_UTP_16)) 2516 (tp->media_type == MEDIA_STP_16_UTP_16))
2517 { 2517 {
2518 tp->config_word0 |= FREQ_16MB_BIT; 2518 tp->config_word0 |= FREQ_16MB_BIT;
2519 } 2519 }
@@ -2556,9 +2556,9 @@ static int smctr_issue_init_timers_cmd(struct net_device *dev)
2556 tp->config_word1 &= ~SOURCE_ROUTING_SPANNING_BITS; 2556 tp->config_word1 &= ~SOURCE_ROUTING_SPANNING_BITS;
2557 } 2557 }
2558 2558
2559 if((tp->media_type == MEDIA_STP_16) 2559 if((tp->media_type == MEDIA_STP_16) ||
2560 || (tp->media_type == MEDIA_UTP_16) 2560 (tp->media_type == MEDIA_UTP_16) ||
2561 || (tp->media_type == MEDIA_STP_16_UTP_16)) 2561 (tp->media_type == MEDIA_STP_16_UTP_16))
2562 { 2562 {
2563 tp->config_word1 |= INTERFRAME_SPACING_16; 2563 tp->config_word1 |= INTERFRAME_SPACING_16;
2564 } 2564 }
@@ -2568,9 +2568,9 @@ static int smctr_issue_init_timers_cmd(struct net_device *dev)
2568 *pTimer_Struc++ = tp->config_word0; 2568 *pTimer_Struc++ = tp->config_word0;
2569 *pTimer_Struc++ = tp->config_word1; 2569 *pTimer_Struc++ = tp->config_word1;
2570 2570
2571 if((tp->media_type == MEDIA_STP_4) 2571 if((tp->media_type == MEDIA_STP_4) ||
2572 || (tp->media_type == MEDIA_UTP_4) 2572 (tp->media_type == MEDIA_UTP_4) ||
2573 || (tp->media_type == MEDIA_STP_4_UTP_4)) 2573 (tp->media_type == MEDIA_STP_4_UTP_4))
2574 { 2574 {
2575 *pTimer_Struc++ = 0x00FA; /* prescale */ 2575 *pTimer_Struc++ = 0x00FA; /* prescale */
2576 *pTimer_Struc++ = 0x2710; /* TPT_limit */ 2576 *pTimer_Struc++ = 0x2710; /* TPT_limit */
@@ -2990,8 +2990,8 @@ static int smctr_load_firmware(struct net_device *dev)
2990 } 2990 }
2991 2991
2992 /* Verify the firmware exists and is there in the right amount. */ 2992 /* Verify the firmware exists and is there in the right amount. */
2993 if (!fw->data 2993 if (!fw->data ||
2994 || (*(fw->data + UCODE_VERSION_OFFSET) < UCODE_VERSION)) 2994 (*(fw->data + UCODE_VERSION_OFFSET) < UCODE_VERSION))
2995 { 2995 {
2996 err = (UCODE_NOT_PRESENT); 2996 err = (UCODE_NOT_PRESENT);
2997 goto out; 2997 goto out;
@@ -3010,9 +3010,8 @@ static int smctr_load_firmware(struct net_device *dev)
3010 smctr_enable_16bit(dev); 3010 smctr_enable_16bit(dev);
3011 smctr_set_page(dev, (__u8 *)tp->ram_access); 3011 smctr_set_page(dev, (__u8 *)tp->ram_access);
3012 3012
3013 if((smctr_checksum_firmware(dev)) 3013 if((smctr_checksum_firmware(dev)) ||
3014 || (*(fw->data + UCODE_VERSION_OFFSET) 3014 (*(fw->data + UCODE_VERSION_OFFSET) > tp->microcode_version))
3015 > tp->microcode_version))
3016 { 3015 {
3017 smctr_enable_adapter_ctrl_store(dev); 3016 smctr_enable_adapter_ctrl_store(dev);
3018 3017
@@ -3117,9 +3116,9 @@ static int smctr_lobe_media_test(struct net_device *dev)
3117 } 3116 }
3118 3117
3119 /* Check if any frames received during test. */ 3118 /* Check if any frames received during test. */
3120 if((tp->rx_fcb_curr[MAC_QUEUE]->frame_status) 3119 if((tp->rx_fcb_curr[MAC_QUEUE]->frame_status) ||
3121 || (tp->rx_fcb_curr[NON_MAC_QUEUE]->frame_status)) 3120 (tp->rx_fcb_curr[NON_MAC_QUEUE]->frame_status))
3122 goto err; 3121 goto err;
3123 3122
3124 /* Set receive mask to "Promisc" mode. */ 3123 /* Set receive mask to "Promisc" mode. */
3125 tp->receive_mask = saved_rcv_mask; 3124 tp->receive_mask = saved_rcv_mask;
@@ -3303,8 +3302,8 @@ static int smctr_make_group_addr(struct net_device *dev, MAC_SUB_VECTOR *tsv)
3303 /* Set Group Address Sub-vector to all zeros if only the 3302 /* Set Group Address Sub-vector to all zeros if only the
3304 * Group Address/Functional Address Indicator is set. 3303 * Group Address/Functional Address Indicator is set.
3305 */ 3304 */
3306 if(tsv->svv[0] == 0x80 && tsv->svv[1] == 0x00 3305 if(tsv->svv[0] == 0x80 && tsv->svv[1] == 0x00 &&
3307 && tsv->svv[2] == 0x00 && tsv->svv[3] == 0x00) 3306 tsv->svv[2] == 0x00 && tsv->svv[3] == 0x00)
3308 tsv->svv[0] = 0x00; 3307 tsv->svv[0] = 0x00;
3309 3308
3310 return (0); 3309 return (0);
@@ -3876,10 +3875,10 @@ static int smctr_process_rx_packet(MAC_HEADER *rmf, __u16 size,
3876 /* NOTE: UNKNOWN MAC frames will NOT be passed up unless 3875 /* NOTE: UNKNOWN MAC frames will NOT be passed up unless
3877 * ACCEPT_ATT_MAC_FRAMES is set. 3876 * ACCEPT_ATT_MAC_FRAMES is set.
3878 */ 3877 */
3879 if(((tp->receive_mask & ACCEPT_ATT_MAC_FRAMES) 3878 if(((tp->receive_mask & ACCEPT_ATT_MAC_FRAMES) &&
3880 && (xframe == (__u8)0)) 3879 (xframe == (__u8)0)) ||
3881 || ((tp->receive_mask & ACCEPT_EXT_MAC_FRAMES) 3880 ((tp->receive_mask & ACCEPT_EXT_MAC_FRAMES) &&
3882 && (xframe == (__u8)1))) 3881 (xframe == (__u8)1)))
3883 { 3882 {
3884 rmf->vl = SWAP_BYTES(rmf->vl); 3883 rmf->vl = SWAP_BYTES(rmf->vl);
3885 3884
@@ -3934,8 +3933,8 @@ static int smctr_ram_memory_test(struct net_device *dev)
3934 3933
3935 word_pattern = start_pattern; 3934 word_pattern = start_pattern;
3936 3935
3937 for(j = 1; j < (__u32)(tp->ram_usable * 1024) - 1 3936 for(j = 1; j < (__u32)(tp->ram_usable * 1024) - 1 && (~err);
3938 && (~err); j += 2, word_pattern++) 3937 j += 2, word_pattern++)
3939 { 3938 {
3940 word_read = *(__u16 *)(pword + j); 3939 word_read = *(__u16 *)(pword + j);
3941 if(word_read != word_pattern) 3940 if(word_read != word_pattern)
@@ -3959,8 +3958,7 @@ static int smctr_ram_memory_test(struct net_device *dev)
3959 for(j = 0; j < (__u32)tp->ram_usable * 1024; j +=2) 3958 for(j = 0; j < (__u32)tp->ram_usable * 1024; j +=2)
3960 *(__u16 *)(pword + j) = word_pattern; 3959 *(__u16 *)(pword + j) = word_pattern;
3961 3960
3962 for(j =0; j < (__u32)tp->ram_usable * 1024 3961 for(j =0; j < (__u32)tp->ram_usable * 1024 && (~err); j += 2)
3963 && (~err); j += 2)
3964 { 3962 {
3965 word_read = *(__u16 *)(pword + j); 3963 word_read = *(__u16 *)(pword + j);
3966 if(word_read != word_pattern) 3964 if(word_read != word_pattern)
@@ -4325,8 +4323,8 @@ static int smctr_restart_tx_chain(struct net_device *dev, short queue)
4325 if(smctr_debug > 10) 4323 if(smctr_debug > 10)
4326 printk(KERN_DEBUG "%s: smctr_restart_tx_chain\n", dev->name); 4324 printk(KERN_DEBUG "%s: smctr_restart_tx_chain\n", dev->name);
4327 4325
4328 if(tp->num_tx_fcbs_used[queue] != 0 4326 if(tp->num_tx_fcbs_used[queue] != 0 &&
4329 && tp->tx_queue_status[queue] == NOT_TRANSMITING) 4327 tp->tx_queue_status[queue] == NOT_TRANSMITING)
4330 { 4328 {
4331 tp->tx_queue_status[queue] = TRANSMITING; 4329 tp->tx_queue_status[queue] = TRANSMITING;
4332 err = smctr_issue_resume_tx_fcb_cmd(dev, queue); 4330 err = smctr_issue_resume_tx_fcb_cmd(dev, queue);
@@ -4349,8 +4347,8 @@ static int smctr_ring_status_chg(struct net_device *dev)
4349 */ 4347 */
4350 if(tp->ring_status_flags == MONITOR_STATE_CHANGED) 4348 if(tp->ring_status_flags == MONITOR_STATE_CHANGED)
4351 { 4349 {
4352 if((tp->monitor_state == MS_ACTIVE_MONITOR_STATE) 4350 if((tp->monitor_state == MS_ACTIVE_MONITOR_STATE) ||
4353 || (tp->monitor_state == MS_STANDBY_MONITOR_STATE)) 4351 (tp->monitor_state == MS_STANDBY_MONITOR_STATE))
4354 { 4352 {
4355 tp->monitor_state_ready = 1; 4353 tp->monitor_state_ready = 1;
4356 } 4354 }
@@ -4363,8 +4361,8 @@ static int smctr_ring_status_chg(struct net_device *dev)
4363 tp->monitor_state_ready = 0; 4361 tp->monitor_state_ready = 0;
4364 4362
4365 /* Ring speed problem, switching to auto mode. */ 4363 /* Ring speed problem, switching to auto mode. */
4366 if(tp->monitor_state == MS_MONITOR_FSM_INACTIVE 4364 if(tp->monitor_state == MS_MONITOR_FSM_INACTIVE &&
4367 && !tp->cleanup) 4365 !tp->cleanup)
4368 { 4366 {
4369 printk(KERN_INFO "%s: Incorrect ring speed switching.\n", 4367 printk(KERN_INFO "%s: Incorrect ring speed switching.\n",
4370 dev->name); 4368 dev->name);
@@ -4442,8 +4440,8 @@ static int smctr_rx_frame(struct net_device *dev)
4442 { 4440 {
4443 err = HARDWARE_FAILED; 4441 err = HARDWARE_FAILED;
4444 4442
4445 if(((status & 0x007f) == 0) 4443 if(((status & 0x007f) == 0) ||
4446 || ((tp->receive_mask & ACCEPT_ERR_PACKETS) != 0)) 4444 ((tp->receive_mask & ACCEPT_ERR_PACKETS) != 0))
4447 { 4445 {
4448 /* frame length less the CRC (4 bytes) + FS (1 byte) */ 4446 /* frame length less the CRC (4 bytes) + FS (1 byte) */
4449 rx_size = tp->rx_fcb_curr[queue]->frame_length - 5; 4447 rx_size = tp->rx_fcb_curr[queue]->frame_length - 5;
@@ -4538,8 +4536,8 @@ static int smctr_send_dat(struct net_device *dev)
4538 } 4536 }
4539 4537
4540 /* Check if GOOD frame Tx'ed. */ 4538 /* Check if GOOD frame Tx'ed. */
4541 if(!(fcb->frame_status & FCB_COMMAND_DONE) 4539 if(!(fcb->frame_status & FCB_COMMAND_DONE) ||
4542 || fcb->frame_status & (FCB_TX_STATUS_E | FCB_TX_AC_BITS)) 4540 fcb->frame_status & (FCB_TX_STATUS_E | FCB_TX_AC_BITS))
4543 { 4541 {
4544 return (INITIALIZE_FAILED); 4542 return (INITIALIZE_FAILED);
4545 } 4543 }
@@ -4653,8 +4651,8 @@ static int smctr_send_lobe_media_test(struct net_device *dev)
4653 } 4651 }
4654 4652
4655 /* Check if GOOD frame Tx'ed */ 4653 /* Check if GOOD frame Tx'ed */
4656 if(!(fcb->frame_status & FCB_COMMAND_DONE) 4654 if(!(fcb->frame_status & FCB_COMMAND_DONE) ||
4657 || fcb->frame_status & (FCB_TX_STATUS_E | FCB_TX_AC_BITS)) 4655 fcb->frame_status & (FCB_TX_STATUS_E | FCB_TX_AC_BITS))
4658 { 4656 {
4659 return (LOBE_MEDIA_TEST_FAILED); 4657 return (LOBE_MEDIA_TEST_FAILED);
4660 } 4658 }