diff -u -p linux/drivers/net/irda-d7/sir_dev.c linux/drivers/net/irda/sir_dev.c --- linux/drivers/net/irda-d7/sir_dev.c Mon Nov 4 17:00:22 2002 +++ linux/drivers/net/irda/sir_dev.c Fri Nov 15 17:25:55 2002 @@ -223,26 +223,55 @@ int sirdev_receive(struct sir_dev *dev, } /* Read the characters into the buffer */ - while (count--) { - if (likely(atomic_read(&dev->enable_rx))) { +#if 0 + { + struct timeval stamp; + struct timeval now; + int u_diff; + int r_count = count; + int r_len = dev->rx_buff.len; + unsigned long flags; + + local_irq_save(flags); + if( + //r_count >= 16 + r_len > 1975 + ) + do_gettimeofday(&stamp); +#endif + if (likely(atomic_read(&dev->enable_rx))) { + while (count--) /* Unwrap and destuff one byte */ async_unwrap_char(dev->netdev, &dev->stats, - &dev->rx_buff, *cp++); - } - else { + &dev->rx_buff, *cp++); + } else { + while (count--) { /* rx not enabled: save the raw bytes and never * trigger any netif_rx. The received bytes are flushed * later when we re-enable rx but might be read meanwhile * by the dongle driver. */ dev->rx_buff.data[dev->rx_buff.len++] = *cp++; - } - /* What should we do when the buffer is full? */ - if (unlikely(dev->rx_buff.len == dev->rx_buff.truesize)) - dev->rx_buff.len = 0; - + /* What should we do when the buffer is full? */ + if (unlikely(dev->rx_buff.len == dev->rx_buff.truesize)) + dev->rx_buff.len = 0; + } + } +#if 0 + if( + //r_count >= 16 + (r_len > 1975) && (dev->rx_buff.len < r_len) + ) + { + do_gettimeofday(&now); + u_diff = now.tv_usec - stamp.tv_usec; + printk(KERN_DEBUG "async_unwrap_char : count %d, len %d, %d us\n", + r_count, r_len, u_diff); + } + local_irq_restore(flags); } +#endif return 0; } @@ -312,9 +341,31 @@ static int sirdev_hard_xmit(struct sk_bu /* serialize with write completion */ spin_lock_bh(&dev->tx_lock); +#if 0 + { + struct timeval stamp; + struct timeval now; + int s_diff; + int u_diff; + + do_gettimeofday(&stamp); +#endif + /* Copy skb to tx_buff while wrapping, stuffing and making CRC */ dev->tx_buff.len = async_wrap_skb(skb, dev->tx_buff.data, dev->tx_buff.truesize); +#if 0 + if(dev->tx_buff.len > 1000) + { + do_gettimeofday(&now); + s_diff = now.tv_sec - stamp.tv_sec; + u_diff = now.tv_usec - stamp.tv_usec; + printk(KERN_DEBUG "async_wrap_skb : len %d, %d s : %d us\n", + dev->tx_buff.len, s_diff, u_diff); + } + } +#endif + /* transmission will start now - disable receive. * if we are just in the middle of an incoming frame, * treat it as collision. probably it's a good idea to @@ -423,19 +474,37 @@ static int sirdev_ioctl(struct net_devic static int sirdev_alloc_buffers(struct sir_dev *dev) { - dev->rx_buff.truesize = SIRBUF_ALLOCSIZE; dev->tx_buff.truesize = SIRBUF_ALLOCSIZE; +#if 0 + dev->rx_buff.truesize = SIRBUF_ALLOCSIZE; dev->rx_buff.head = kmalloc(dev->rx_buff.truesize, GFP_KERNEL); if (dev->rx_buff.head == NULL) return -ENOMEM; memset(dev->rx_buff.head, 0, dev->rx_buff.truesize); +#else + dev->rx_buff.truesize = IRDA_SKB_MAX_MTU; + + /* Bootstrap ZeroCopy Rx */ + dev->rx_buff.skb = __dev_alloc_skb(dev->rx_buff.truesize, GFP_KERNEL); + if (dev->rx_buff.skb == NULL) + return -ENOMEM; + skb_reserve(dev->rx_buff.skb, 1); + dev->rx_buff.head = dev->rx_buff.skb->data; + /* No need to memset the buffer, unless you are really pedantic */ +#endif dev->tx_buff.head = kmalloc(dev->tx_buff.truesize, GFP_KERNEL); if (dev->tx_buff.head == NULL) { +#if 0 kfree(dev->rx_buff.head); +#else + kfree_skb(dev->rx_buff.skb); + dev->rx_buff.skb = NULL; +#endif dev->rx_buff.head = NULL; return -ENOMEM; + /* Hu ??? This should not be here, Martin ? */ memset(dev->tx_buff.head, 0, dev->tx_buff.truesize); }