Lines Matching refs:nl
350 struct net_local *nl; in sbni_probe1() local
381 nl = netdev_priv(dev); in sbni_probe1()
382 if( !nl ) { in sbni_probe1()
388 memset( nl, 0, sizeof(struct net_local) ); in sbni_probe1()
389 spin_lock_init( &nl->lock ); in sbni_probe1()
399 nl->maxframe = DEFAULT_FRAME_LEN; in sbni_probe1()
400 nl->csr1.rate = baud[ num ]; in sbni_probe1()
402 if( (nl->cur_rxl_index = rxl[ num ]) == -1 ) in sbni_probe1()
404 nl->cur_rxl_index = DEF_RXL, in sbni_probe1()
405 nl->delta_rxl = DEF_RXL_DELTA; in sbni_probe1()
407 nl->delta_rxl = 0; in sbni_probe1()
408 nl->csr1.rxl = rxl_tab[ nl->cur_rxl_index ]; in sbni_probe1()
410 nl->state |= FL_SLOW_MODE; in sbni_probe1()
420 ((nl->state & FL_SLOW_MODE) ? 500000 : 2000000) in sbni_probe1()
421 / (1 << nl->csr1.rate)); in sbni_probe1()
423 if( nl->delta_rxl == 0 ) in sbni_probe1()
424 pr_cont(", receive level 0x%x (fixed)\n", nl->cur_rxl_index); in sbni_probe1()
429 nl->master = dev; in sbni_probe1()
430 nl->link = NULL; in sbni_probe1()
450 struct net_local *nl = netdev_priv(p); in sbni_start_xmit() local
451 spin_lock( &nl->lock ); in sbni_start_xmit()
452 if( nl->tx_buf_p || (nl->state & FL_LINE_DOWN) ) { in sbni_start_xmit()
453 p = nl->link; in sbni_start_xmit()
454 spin_unlock( &nl->lock ); in sbni_start_xmit()
458 spin_unlock( &nl->lock ); in sbni_start_xmit()
472 struct net_local *nl = netdev_priv(dev); in sbni_start_xmit() local
475 spin_lock( &nl->lock ); in sbni_start_xmit()
479 spin_unlock( &nl->lock ); in sbni_start_xmit()
506 struct net_local *nl = netdev_priv(dev); in sbni_interrupt() local
509 spin_lock( &nl->lock ); in sbni_interrupt()
510 if( nl->second ) in sbni_interrupt()
511 spin_lock(&NET_LOCAL_LOCK(nl->second)); in sbni_interrupt()
518 if( nl->second && /* second channel present */ in sbni_interrupt()
519 (inb( nl->second->base_addr+CSR0 ) & (RC_RDY | TR_RDY)) ) in sbni_interrupt()
520 handle_channel( nl->second ), in sbni_interrupt()
524 if( nl->second ) in sbni_interrupt()
525 spin_unlock(&NET_LOCAL_LOCK(nl->second)); in sbni_interrupt()
526 spin_unlock( &nl->lock ); in sbni_interrupt()
534 struct net_local *nl = netdev_priv(dev); in handle_channel() local
542 if( nl->state & FL_SLAVE ) in handle_channel()
543 spin_lock(&NET_LOCAL_LOCK(nl->master)); in handle_channel()
548 nl->timer_ticks = CHANGE_LEVEL_START_TICKS; in handle_channel()
554 req_ans = !(nl->state & FL_PREV_OK); in handle_channel()
568 if( req_ans || nl->tx_frameno != 0 ) in handle_channel()
578 if( nl->state & FL_SLAVE ) in handle_channel()
579 spin_unlock(&NET_LOCAL_LOCK(nl->master)); in handle_channel()
592 struct net_local *nl = netdev_priv(dev); in recv_frame() local
610 nl->state |= FL_PREV_OK; in recv_frame()
612 nl->in_stats.all_rx_number++; in recv_frame()
614 nl->state &= ~FL_PREV_OK, in recv_frame()
616 nl->in_stats.all_rx_number++, in recv_frame()
617 nl->in_stats.bad_rx_number++; in recv_frame()
626 struct net_local *nl = netdev_priv(dev); in send_frame() local
630 if( nl->state & FL_NEED_RESEND ) { in send_frame()
633 if( nl->trans_errors ) { in send_frame()
634 --nl->trans_errors; in send_frame()
635 if( nl->framelen != 0 ) in send_frame()
636 nl->in_stats.resend_tx_number++; in send_frame()
640 if( (nl->state & FL_SLAVE) || nl->link ) in send_frame()
642 nl->state |= FL_LINE_DOWN; in send_frame()
647 nl->trans_errors = TR_ERROR_COUNT; in send_frame()
650 nl->state |= FL_NEED_RESEND; in send_frame()
657 if( nl->framelen ) { in send_frame()
659 nl->in_stats.all_tx_number++; in send_frame()
660 nl->state |= FL_WAIT_ACK; in send_frame()
668 if( nl->tx_frameno ) in send_frame()
683 struct net_local *nl = netdev_priv(dev); in download_data() local
684 struct sk_buff *skb = nl->tx_buf_p; in download_data()
686 unsigned len = min_t(unsigned int, skb->len - nl->outpos, nl->framelen); in download_data()
688 outsb( dev->base_addr + DAT, skb->data + nl->outpos, len ); in download_data()
689 *crc_p = calc_crc32( *crc_p, skb->data + nl->outpos, len ); in download_data()
692 for( len = nl->framelen - len; len--; ) in download_data()
702 struct net_local *nl = netdev_priv(dev); in upload_data() local
707 nl->wait_frameno = frameno, in upload_data()
708 nl->inppos = 0; in upload_data()
710 if( nl->wait_frameno == frameno ) { in upload_data()
712 if( nl->inppos + framelen <= ETHER_MAX_LEN ) in upload_data()
721 nl->wait_frameno = 0, in upload_data()
722 nl->inppos = 0, in upload_data()
724 nl->master->stats.rx_errors++, in upload_data()
725 nl->master->stats.rx_missed_errors++; in upload_data()
739 nl->wait_frameno = 0, in upload_data()
741 nl->master->stats.rx_errors++, in upload_data()
742 nl->master->stats.rx_crc_errors++; in upload_data()
755 struct net_local *nl = netdev_priv(dev); in send_complete() local
758 nl->master->stats.tx_packets++; in send_complete()
759 nl->master->stats.tx_bytes += nl->tx_buf_p->len; in send_complete()
762 dev->stats.tx_bytes += nl->tx_buf_p->len; in send_complete()
764 dev_kfree_skb_irq( nl->tx_buf_p ); in send_complete()
766 nl->tx_buf_p = NULL; in send_complete()
768 nl->outpos = 0; in send_complete()
769 nl->state &= ~(FL_WAIT_ACK | FL_NEED_RESEND); in send_complete()
770 nl->framelen = 0; in send_complete()
777 struct net_local *nl = netdev_priv(dev); in interpret_ack() local
780 nl->state &= ~FL_NEED_RESEND; in interpret_ack()
782 if( nl->state & FL_WAIT_ACK ) { in interpret_ack()
783 nl->outpos += nl->framelen; in interpret_ack()
785 if( --nl->tx_frameno ) in interpret_ack()
786 nl->framelen = min_t(unsigned int, in interpret_ack()
787 nl->maxframe, in interpret_ack()
788 nl->tx_buf_p->len - nl->outpos); in interpret_ack()
792 netif_wake_queue( nl->master ); in interpret_ack()
799 nl->state &= ~FL_WAIT_ACK; in interpret_ack()
811 struct net_local *nl = netdev_priv(dev); in append_frame_to_pkt() local
815 if( nl->inppos + framelen > ETHER_MAX_LEN ) in append_frame_to_pkt()
818 if( !nl->rx_buf_p && !(nl->rx_buf_p = get_rx_buf( dev )) ) in append_frame_to_pkt()
821 p = nl->rx_buf_p->data + nl->inppos; in append_frame_to_pkt()
826 nl->inppos += framelen - 4; in append_frame_to_pkt()
827 if( --nl->wait_frameno == 0 ) /* last frame received */ in append_frame_to_pkt()
842 struct net_local *nl = netdev_priv(dev); in prepare_to_send() local
847 if( nl->tx_buf_p ) in prepare_to_send()
850 nl->outpos = 0; in prepare_to_send()
851 nl->state &= ~(FL_WAIT_ACK | FL_NEED_RESEND); in prepare_to_send()
857 nl->tx_buf_p = skb; in prepare_to_send()
858 nl->tx_frameno = DIV_ROUND_UP(len, nl->maxframe); in prepare_to_send()
859 nl->framelen = len < nl->maxframe ? len : nl->maxframe; in prepare_to_send()
863 nl->master->trans_start = jiffies; in prepare_to_send()
873 struct net_local *nl = netdev_priv(dev); in drop_xmit_queue() local
875 if( nl->tx_buf_p ) in drop_xmit_queue()
876 dev_kfree_skb_any( nl->tx_buf_p ), in drop_xmit_queue()
877 nl->tx_buf_p = NULL, in drop_xmit_queue()
879 nl->master->stats.tx_errors++, in drop_xmit_queue()
880 nl->master->stats.tx_carrier_errors++; in drop_xmit_queue()
886 nl->tx_frameno = 0; in drop_xmit_queue()
887 nl->framelen = 0; in drop_xmit_queue()
888 nl->outpos = 0; in drop_xmit_queue()
889 nl->state &= ~(FL_WAIT_ACK | FL_NEED_RESEND); in drop_xmit_queue()
891 netif_start_queue( nl->master ); in drop_xmit_queue()
892 nl->master->trans_start = jiffies; in drop_xmit_queue()
903 struct net_local *nl = netdev_priv(dev); in send_frame_header() local
906 u32 len_field = nl->framelen + 6; /* CRC + frameno + reserved */ in send_frame_header()
909 if( nl->state & FL_NEED_RESEND ) in send_frame_header()
912 if( nl->outpos == 0 ) in send_frame_header()
915 len_field |= (nl->state & FL_PREV_OK) ? FRAME_SENT_OK : FRAME_SENT_BAD; in send_frame_header()
925 outb( nl->tx_frameno, dev->base_addr + DAT ); in send_frame_header()
926 crc = CRC32( nl->tx_frameno, crc ); in send_frame_header()
1005 struct net_local *nl = netdev_priv(dev); in indicate_pkt() local
1006 struct sk_buff *skb = nl->rx_buf_p; in indicate_pkt()
1008 skb_put( skb, nl->inppos ); in indicate_pkt()
1011 skb->protocol = eth_type_trans( skb, nl->master ); in indicate_pkt()
1013 ++nl->master->stats.rx_packets; in indicate_pkt()
1014 nl->master->stats.rx_bytes += nl->inppos; in indicate_pkt()
1019 dev->stats.rx_bytes += nl->inppos; in indicate_pkt()
1021 nl->rx_buf_p = NULL; /* protocol driver will clear this sk_buff */ in indicate_pkt()
1036 struct net_local *nl = netdev_priv(dev); in sbni_watchdog() local
1037 struct timer_list *w = &nl->watchdog; in sbni_watchdog()
1041 spin_lock_irqsave( &nl->lock, flags ); in sbni_watchdog()
1046 if( nl->timer_ticks ) { in sbni_watchdog()
1049 nl->timer_ticks--; in sbni_watchdog()
1051 nl->in_stats.timeout_number++; in sbni_watchdog()
1052 if( nl->delta_rxl ) in sbni_watchdog()
1055 outb( *(u_char *)&nl->csr1 | PR_RES, in sbni_watchdog()
1060 nl->state &= ~FL_LINE_DOWN; in sbni_watchdog()
1070 spin_unlock_irqrestore( &nl->lock, flags ); in sbni_watchdog()
1089 struct net_local *nl = netdev_priv(dev); in card_start() local
1091 nl->timer_ticks = CHANGE_LEVEL_START_TICKS; in card_start()
1092 nl->state &= ~(FL_WAIT_ACK | FL_NEED_RESEND); in card_start()
1093 nl->state |= FL_PREV_OK; in card_start()
1095 nl->inppos = nl->outpos = 0; in card_start()
1096 nl->wait_frameno = 0; in card_start()
1097 nl->tx_frameno = 0; in card_start()
1098 nl->framelen = 0; in card_start()
1100 outb( *(u_char *)&nl->csr1 | PR_RES, dev->base_addr + CSR1 ); in card_start()
1111 struct net_local *nl = netdev_priv(dev); in change_level() local
1113 if( nl->delta_rxl == 0 ) /* do not auto-negotiate RxL */ in change_level()
1116 if( nl->cur_rxl_index == 0 ) in change_level()
1117 nl->delta_rxl = 1; in change_level()
1118 else if( nl->cur_rxl_index == 15 ) in change_level()
1119 nl->delta_rxl = -1; in change_level()
1120 else if( nl->cur_rxl_rcvd < nl->prev_rxl_rcvd ) in change_level()
1121 nl->delta_rxl = -nl->delta_rxl; in change_level()
1123 nl->csr1.rxl = rxl_tab[ nl->cur_rxl_index += nl->delta_rxl ]; in change_level()
1125 outb( *(u8 *)&nl->csr1, dev->base_addr + CSR1 ); in change_level()
1127 nl->prev_rxl_rcvd = nl->cur_rxl_rcvd; in change_level()
1128 nl->cur_rxl_rcvd = 0; in change_level()
1135 struct net_local *nl = netdev_priv(dev); in timeout_change_level() local
1137 nl->cur_rxl_index = timeout_rxl_tab[ nl->timeout_rxl ]; in timeout_change_level()
1138 if( ++nl->timeout_rxl >= 4 ) in timeout_change_level()
1139 nl->timeout_rxl = 0; in timeout_change_level()
1141 nl->csr1.rxl = rxl_tab[ nl->cur_rxl_index ]; in timeout_change_level()
1143 outb( *(unsigned char *)&nl->csr1, dev->base_addr + CSR1 ); in timeout_change_level()
1145 nl->prev_rxl_rcvd = nl->cur_rxl_rcvd; in timeout_change_level()
1146 nl->cur_rxl_rcvd = 0; in timeout_change_level()
1158 struct net_local *nl = netdev_priv(dev); in sbni_open() local
1159 struct timer_list *w = &nl->watchdog; in sbni_open()
1178 nl->state |= FL_SECONDARY; in sbni_open()
1190 spin_lock( &nl->lock ); in sbni_open()
1192 memset( &nl->in_stats, 0, sizeof(struct sbni_in_stats) ); in sbni_open()
1205 spin_unlock( &nl->lock ); in sbni_open()
1213 struct net_local *nl = netdev_priv(dev); in sbni_close() local
1215 if( nl->second && nl->second->flags & IFF_UP ) { in sbni_close()
1217 nl->second->name); in sbni_close()
1222 if( nl->state & FL_SLAVE ) in sbni_close()
1225 while( nl->link ) /* it's master device! */ in sbni_close()
1226 emancipate( nl->link ); in sbni_close()
1229 spin_lock( &nl->lock ); in sbni_close()
1231 nl->second = NULL; in sbni_close()
1235 del_timer( &nl->watchdog ); in sbni_close()
1239 if( !(nl->state & FL_SECONDARY) ) in sbni_close()
1241 nl->state &= FL_SECONDARY; in sbni_close()
1243 spin_unlock( &nl->lock ); in sbni_close()
1297 struct net_local *nl = netdev_priv(dev); in sbni_ioctl() local
1308 if (copy_to_user( ifr->ifr_data, &nl->in_stats, in sbni_ioctl()
1316 memset( &nl->in_stats, 0, sizeof(struct sbni_in_stats) ); in sbni_ioctl()
1321 flags.rate = nl->csr1.rate; in sbni_ioctl()
1322 flags.slow_mode = (nl->state & FL_SLOW_MODE) != 0; in sbni_ioctl()
1323 flags.rxl = nl->cur_rxl_index; in sbni_ioctl()
1324 flags.fixed_rxl = nl->delta_rxl == 0; in sbni_ioctl()
1334 spin_lock( &nl->lock ); in sbni_ioctl()
1337 nl->delta_rxl = 0, in sbni_ioctl()
1338 nl->cur_rxl_index = flags.rxl; in sbni_ioctl()
1340 nl->delta_rxl = DEF_RXL_DELTA, in sbni_ioctl()
1341 nl->cur_rxl_index = DEF_RXL; in sbni_ioctl()
1343 nl->csr1.rxl = rxl_tab[ nl->cur_rxl_index ]; in sbni_ioctl()
1344 nl->csr1.rate = flags.rate; in sbni_ioctl()
1345 outb( *(u8 *)&nl->csr1 | PR_RES, dev->base_addr + CSR1 ); in sbni_ioctl()
1346 spin_unlock( &nl->lock ); in sbni_ioctl()
1387 struct net_local *nl = netdev_priv(dev); in enslave() local
1390 if( nl->state & FL_SLAVE ) /* This isn't master or free device */ in enslave()
1396 spin_lock( &nl->lock ); in enslave()
1400 snl->link = nl->link; in enslave()
1401 nl->link = slave_dev; in enslave()
1412 spin_unlock( &nl->lock ); in enslave()
1423 struct net_local *nl = netdev_priv(p); in emancipate() local
1428 spin_lock( &nl->lock ); in emancipate()
1449 spin_unlock( &nl->lock ); in emancipate()