• Home
  • Raw
  • Download

Lines Matching full:nl

351 	struct net_local  *nl;  in sbni_probe1()  local
382 nl = netdev_priv(dev); in sbni_probe1()
383 if( !nl ) { in sbni_probe1()
389 memset( nl, 0, sizeof(struct net_local) ); in sbni_probe1()
390 spin_lock_init( &nl->lock ); in sbni_probe1()
400 nl->maxframe = DEFAULT_FRAME_LEN; in sbni_probe1()
401 nl->csr1.rate = baud[ num ]; in sbni_probe1()
403 if( (nl->cur_rxl_index = rxl[ num ]) == -1 ) { in sbni_probe1()
405 nl->cur_rxl_index = DEF_RXL; in sbni_probe1()
406 nl->delta_rxl = DEF_RXL_DELTA; in sbni_probe1()
408 nl->delta_rxl = 0; in sbni_probe1()
410 nl->csr1.rxl = rxl_tab[ nl->cur_rxl_index ]; in sbni_probe1()
412 nl->state |= FL_SLOW_MODE; in sbni_probe1()
422 ((nl->state & FL_SLOW_MODE) ? 500000 : 2000000) in sbni_probe1()
423 / (1 << nl->csr1.rate)); in sbni_probe1()
425 if( nl->delta_rxl == 0 ) in sbni_probe1()
426 pr_cont(", receive level 0x%x (fixed)\n", nl->cur_rxl_index); in sbni_probe1()
431 nl->master = dev; in sbni_probe1()
432 nl->link = NULL; in sbni_probe1()
452 struct net_local *nl = netdev_priv(p); in sbni_start_xmit() local
453 spin_lock( &nl->lock ); in sbni_start_xmit()
454 if( nl->tx_buf_p || (nl->state & FL_LINE_DOWN) ) { in sbni_start_xmit()
455 p = nl->link; in sbni_start_xmit()
456 spin_unlock( &nl->lock ); in sbni_start_xmit()
460 spin_unlock( &nl->lock ); in sbni_start_xmit()
474 struct net_local *nl = netdev_priv(dev); in sbni_start_xmit() local
477 spin_lock( &nl->lock ); in sbni_start_xmit()
481 spin_unlock( &nl->lock ); in sbni_start_xmit()
508 struct net_local *nl = netdev_priv(dev); in sbni_interrupt() local
511 spin_lock( &nl->lock ); in sbni_interrupt()
512 if( nl->second ) in sbni_interrupt()
513 spin_lock(&NET_LOCAL_LOCK(nl->second)); in sbni_interrupt()
521 if( nl->second && /* second channel present */ in sbni_interrupt()
522 (inb( nl->second->base_addr+CSR0 ) & (RC_RDY | TR_RDY)) ) { in sbni_interrupt()
523 handle_channel( nl->second ); in sbni_interrupt()
528 if( nl->second ) in sbni_interrupt()
529 spin_unlock(&NET_LOCAL_LOCK(nl->second)); in sbni_interrupt()
530 spin_unlock( &nl->lock ); in sbni_interrupt()
538 struct net_local *nl = netdev_priv(dev); in handle_channel() local
546 if( nl->state & FL_SLAVE ) in handle_channel()
547 spin_lock(&NET_LOCAL_LOCK(nl->master)); in handle_channel()
552 nl->timer_ticks = CHANGE_LEVEL_START_TICKS; in handle_channel()
558 req_ans = !(nl->state & FL_PREV_OK); in handle_channel()
572 if( req_ans || nl->tx_frameno != 0 ) in handle_channel()
582 if( nl->state & FL_SLAVE ) in handle_channel()
583 spin_unlock(&NET_LOCAL_LOCK(nl->master)); in handle_channel()
596 struct net_local *nl = netdev_priv(dev); in recv_frame() local
614 nl->state |= FL_PREV_OK; in recv_frame()
616 nl->in_stats.all_rx_number++; in recv_frame()
618 nl->state &= ~FL_PREV_OK; in recv_frame()
620 nl->in_stats.all_rx_number++; in recv_frame()
621 nl->in_stats.bad_rx_number++; in recv_frame()
631 struct net_local *nl = netdev_priv(dev); in send_frame() local
635 if( nl->state & FL_NEED_RESEND ) { in send_frame()
638 if( nl->trans_errors ) { in send_frame()
639 --nl->trans_errors; in send_frame()
640 if( nl->framelen != 0 ) in send_frame()
641 nl->in_stats.resend_tx_number++; in send_frame()
645 if( (nl->state & FL_SLAVE) || nl->link ) in send_frame()
647 nl->state |= FL_LINE_DOWN; in send_frame()
652 nl->trans_errors = TR_ERROR_COUNT; in send_frame()
655 nl->state |= FL_NEED_RESEND; in send_frame()
662 if( nl->framelen ) { in send_frame()
664 nl->in_stats.all_tx_number++; in send_frame()
665 nl->state |= FL_WAIT_ACK; in send_frame()
673 if( nl->tx_frameno ) in send_frame()
688 struct net_local *nl = netdev_priv(dev); in download_data() local
689 struct sk_buff *skb = nl->tx_buf_p; in download_data()
691 unsigned len = min_t(unsigned int, skb->len - nl->outpos, nl->framelen); in download_data()
693 outsb( dev->base_addr + DAT, skb->data + nl->outpos, len ); in download_data()
694 *crc_p = calc_crc32( *crc_p, skb->data + nl->outpos, len ); in download_data()
697 for( len = nl->framelen - len; len--; ) { in download_data()
708 struct net_local *nl = netdev_priv(dev); in upload_data() local
713 nl->wait_frameno = frameno; in upload_data()
714 nl->inppos = 0; in upload_data()
717 if( nl->wait_frameno == frameno ) { in upload_data()
719 if( nl->inppos + framelen <= ETHER_MAX_LEN ) in upload_data()
728 nl->wait_frameno = 0; in upload_data()
729 nl->inppos = 0; in upload_data()
731 nl->master->stats.rx_errors++; in upload_data()
732 nl->master->stats.rx_missed_errors++; in upload_data()
747 nl->wait_frameno = 0; in upload_data()
749 nl->master->stats.rx_errors++; in upload_data()
750 nl->master->stats.rx_crc_errors++; in upload_data()
764 struct net_local *nl = netdev_priv(dev); in send_complete() local
767 nl->master->stats.tx_packets++; in send_complete()
768 nl->master->stats.tx_bytes += nl->tx_buf_p->len; in send_complete()
771 dev->stats.tx_bytes += nl->tx_buf_p->len; in send_complete()
773 dev_consume_skb_irq(nl->tx_buf_p); in send_complete()
775 nl->tx_buf_p = NULL; in send_complete()
777 nl->outpos = 0; in send_complete()
778 nl->state &= ~(FL_WAIT_ACK | FL_NEED_RESEND); in send_complete()
779 nl->framelen = 0; in send_complete()
786 struct net_local *nl = netdev_priv(dev); in interpret_ack() local
789 nl->state &= ~FL_NEED_RESEND; in interpret_ack()
791 if( nl->state & FL_WAIT_ACK ) { in interpret_ack()
792 nl->outpos += nl->framelen; in interpret_ack()
794 if( --nl->tx_frameno ) { in interpret_ack()
795 nl->framelen = min_t(unsigned int, in interpret_ack()
796 nl->maxframe, in interpret_ack()
797 nl->tx_buf_p->len - nl->outpos); in interpret_ack()
801 netif_wake_queue( nl->master ); in interpret_ack()
809 nl->state &= ~FL_WAIT_ACK; in interpret_ack()
821 struct net_local *nl = netdev_priv(dev); in append_frame_to_pkt() local
825 if( nl->inppos + framelen > ETHER_MAX_LEN ) in append_frame_to_pkt()
828 if( !nl->rx_buf_p && !(nl->rx_buf_p = get_rx_buf( dev )) ) in append_frame_to_pkt()
831 p = nl->rx_buf_p->data + nl->inppos; in append_frame_to_pkt()
836 nl->inppos += framelen - 4; in append_frame_to_pkt()
837 if( --nl->wait_frameno == 0 ) /* last frame received */ in append_frame_to_pkt()
852 struct net_local *nl = netdev_priv(dev); in prepare_to_send() local
856 /* nl->tx_buf_p == NULL here! */ in prepare_to_send()
857 if( nl->tx_buf_p ) in prepare_to_send()
860 nl->outpos = 0; in prepare_to_send()
861 nl->state &= ~(FL_WAIT_ACK | FL_NEED_RESEND); in prepare_to_send()
867 nl->tx_buf_p = skb; in prepare_to_send()
868 nl->tx_frameno = DIV_ROUND_UP(len, nl->maxframe); in prepare_to_send()
869 nl->framelen = len < nl->maxframe ? len : nl->maxframe; in prepare_to_send()
873 netif_trans_update(nl->master); in prepare_to_send()
883 struct net_local *nl = netdev_priv(dev); in drop_xmit_queue() local
885 if( nl->tx_buf_p ) { in drop_xmit_queue()
886 dev_kfree_skb_any( nl->tx_buf_p ); in drop_xmit_queue()
887 nl->tx_buf_p = NULL; in drop_xmit_queue()
889 nl->master->stats.tx_errors++; in drop_xmit_queue()
890 nl->master->stats.tx_carrier_errors++; in drop_xmit_queue()
897 nl->tx_frameno = 0; in drop_xmit_queue()
898 nl->framelen = 0; in drop_xmit_queue()
899 nl->outpos = 0; in drop_xmit_queue()
900 nl->state &= ~(FL_WAIT_ACK | FL_NEED_RESEND); in drop_xmit_queue()
902 netif_start_queue( nl->master ); in drop_xmit_queue()
903 netif_trans_update(nl->master); in drop_xmit_queue()
914 struct net_local *nl = netdev_priv(dev); in send_frame_header() local
917 u32 len_field = nl->framelen + 6; /* CRC + frameno + reserved */ in send_frame_header()
920 if( nl->state & FL_NEED_RESEND ) in send_frame_header()
923 if( nl->outpos == 0 ) in send_frame_header()
926 len_field |= (nl->state & FL_PREV_OK) ? FRAME_SENT_OK : FRAME_SENT_BAD; in send_frame_header()
936 outb( nl->tx_frameno, dev->base_addr + DAT ); in send_frame_header()
937 crc = CRC32( nl->tx_frameno, crc ); in send_frame_header()
1016 struct net_local *nl = netdev_priv(dev); in indicate_pkt() local
1017 struct sk_buff *skb = nl->rx_buf_p; in indicate_pkt()
1019 skb_put( skb, nl->inppos ); in indicate_pkt()
1022 skb->protocol = eth_type_trans( skb, nl->master ); in indicate_pkt()
1024 ++nl->master->stats.rx_packets; in indicate_pkt()
1025 nl->master->stats.rx_bytes += nl->inppos; in indicate_pkt()
1030 dev->stats.rx_bytes += nl->inppos; in indicate_pkt()
1032 nl->rx_buf_p = NULL; /* protocol driver will clear this sk_buff */ in indicate_pkt()
1046 struct net_local *nl = from_timer(nl, t, watchdog); in sbni_watchdog() local
1047 struct net_device *dev = nl->watchdog_dev; in sbni_watchdog()
1051 spin_lock_irqsave( &nl->lock, flags ); in sbni_watchdog()
1056 if( nl->timer_ticks ) { in sbni_watchdog()
1059 nl->timer_ticks--; in sbni_watchdog()
1061 nl->in_stats.timeout_number++; in sbni_watchdog()
1062 if( nl->delta_rxl ) in sbni_watchdog()
1065 outb( *(u_char *)&nl->csr1 | PR_RES, in sbni_watchdog()
1070 nl->state &= ~FL_LINE_DOWN; in sbni_watchdog()
1076 spin_unlock_irqrestore( &nl->lock, flags ); in sbni_watchdog()
1095 struct net_local *nl = netdev_priv(dev); in card_start() local
1097 nl->timer_ticks = CHANGE_LEVEL_START_TICKS; in card_start()
1098 nl->state &= ~(FL_WAIT_ACK | FL_NEED_RESEND); in card_start()
1099 nl->state |= FL_PREV_OK; in card_start()
1101 nl->inppos = nl->outpos = 0; in card_start()
1102 nl->wait_frameno = 0; in card_start()
1103 nl->tx_frameno = 0; in card_start()
1104 nl->framelen = 0; in card_start()
1106 outb( *(u_char *)&nl->csr1 | PR_RES, dev->base_addr + CSR1 ); in card_start()
1117 struct net_local *nl = netdev_priv(dev); in change_level() local
1119 if( nl->delta_rxl == 0 ) /* do not auto-negotiate RxL */ in change_level()
1122 if( nl->cur_rxl_index == 0 ) in change_level()
1123 nl->delta_rxl = 1; in change_level()
1124 else if( nl->cur_rxl_index == 15 ) in change_level()
1125 nl->delta_rxl = -1; in change_level()
1126 else if( nl->cur_rxl_rcvd < nl->prev_rxl_rcvd ) in change_level()
1127 nl->delta_rxl = -nl->delta_rxl; in change_level()
1129 nl->csr1.rxl = rxl_tab[ nl->cur_rxl_index += nl->delta_rxl ]; in change_level()
1131 outb( *(u8 *)&nl->csr1, dev->base_addr + CSR1 ); in change_level()
1133 nl->prev_rxl_rcvd = nl->cur_rxl_rcvd; in change_level()
1134 nl->cur_rxl_rcvd = 0; in change_level()
1141 struct net_local *nl = netdev_priv(dev); in timeout_change_level() local
1143 nl->cur_rxl_index = timeout_rxl_tab[ nl->timeout_rxl ]; in timeout_change_level()
1144 if( ++nl->timeout_rxl >= 4 ) in timeout_change_level()
1145 nl->timeout_rxl = 0; in timeout_change_level()
1147 nl->csr1.rxl = rxl_tab[ nl->cur_rxl_index ]; in timeout_change_level()
1149 outb( *(unsigned char *)&nl->csr1, dev->base_addr + CSR1 ); in timeout_change_level()
1151 nl->prev_rxl_rcvd = nl->cur_rxl_rcvd; in timeout_change_level()
1152 nl->cur_rxl_rcvd = 0; in timeout_change_level()
1164 struct net_local *nl = netdev_priv(dev); in sbni_open() local
1165 struct timer_list *w = &nl->watchdog; in sbni_open()
1184 nl->state |= FL_SECONDARY; in sbni_open()
1196 spin_lock( &nl->lock ); in sbni_open()
1198 memset( &nl->in_stats, 0, sizeof(struct sbni_in_stats) ); in sbni_open()
1205 nl->watchdog_dev = dev; in sbni_open()
1210 spin_unlock( &nl->lock ); in sbni_open()
1218 struct net_local *nl = netdev_priv(dev); in sbni_close() local
1220 if( nl->second && nl->second->flags & IFF_UP ) { in sbni_close()
1222 nl->second->name); in sbni_close()
1227 if( nl->state & FL_SLAVE ) in sbni_close()
1230 while( nl->link ) /* it's master device! */ in sbni_close()
1231 emancipate( nl->link ); in sbni_close()
1234 spin_lock( &nl->lock ); in sbni_close()
1236 nl->second = NULL; in sbni_close()
1240 del_timer( &nl->watchdog ); in sbni_close()
1244 if( !(nl->state & FL_SECONDARY) ) in sbni_close()
1246 nl->state &= FL_SECONDARY; in sbni_close()
1248 spin_unlock( &nl->lock ); in sbni_close()
1302 struct net_local *nl = netdev_priv(dev); in sbni_ioctl() local
1313 if (copy_to_user( ifr->ifr_data, &nl->in_stats, in sbni_ioctl()
1321 memset( &nl->in_stats, 0, sizeof(struct sbni_in_stats) ); in sbni_ioctl()
1326 flags.rate = nl->csr1.rate; in sbni_ioctl()
1327 flags.slow_mode = (nl->state & FL_SLOW_MODE) != 0; in sbni_ioctl()
1328 flags.rxl = nl->cur_rxl_index; in sbni_ioctl()
1329 flags.fixed_rxl = nl->delta_rxl == 0; in sbni_ioctl()
1339 spin_lock( &nl->lock ); in sbni_ioctl()
1342 nl->delta_rxl = 0; in sbni_ioctl()
1343 nl->cur_rxl_index = flags.rxl; in sbni_ioctl()
1345 nl->delta_rxl = DEF_RXL_DELTA; in sbni_ioctl()
1346 nl->cur_rxl_index = DEF_RXL; in sbni_ioctl()
1349 nl->csr1.rxl = rxl_tab[ nl->cur_rxl_index ]; in sbni_ioctl()
1350 nl->csr1.rate = flags.rate; in sbni_ioctl()
1351 outb( *(u8 *)&nl->csr1 | PR_RES, dev->base_addr + CSR1 ); in sbni_ioctl()
1352 spin_unlock( &nl->lock ); in sbni_ioctl()
1395 struct net_local *nl = netdev_priv(dev); in enslave() local
1398 if( nl->state & FL_SLAVE ) /* This isn't master or free device */ in enslave()
1404 spin_lock( &nl->lock ); in enslave()
1408 snl->link = nl->link; in enslave()
1409 nl->link = slave_dev; in enslave()
1420 spin_unlock( &nl->lock ); in enslave()
1431 struct net_local *nl = netdev_priv(p); in emancipate() local
1436 spin_lock( &nl->lock ); in emancipate()
1457 spin_unlock( &nl->lock ); in emancipate()