=================================================================== RCS file: /var/cvsroot_2.4/usr/src/e1000/src/e1000.h,v retrieving revision 1.1 retrieving revision 1.2 diff -u -w -b -B -r1.1 -r1.2 --- e1000.h 2001/06/07 17:09:00 1.1 +++ e1000.h 2001/06/07 19:18:13 1.2 @@ -240,6 +240,13 @@ #define E1000_PCI + +/* LWS secs watchdog timer - stats update */ +#define WATCHDOG_DELTA ((1 * HZ) / 2) + +/* LWS netif_wake_queue threshhold: number (%) tx descs available */ +#define WAKE_THRESHOLD 3 / 4 + /* The size in bytes of a standard ethernet header */ #define ENET_HEADER_SIZE 14 #define MAX_INTS 256 @@ -255,8 +262,10 @@ * so a DMA handle can be stored along with the buffer */ struct e1000_buffer { struct sk_buff *skb; - dma_addr_t dma; +#ifndef DUMMY_PCI_UNMAP + dma64_t dma; unsigned long length; +#endif }; /* Adapter->flags definitions */ Index: e1000_kcompat.h =================================================================== RCS file: /var/cvsroot_2.4/usr/src/e1000/src/e1000_kcompat.h,v retrieving revision 1.1 retrieving revision 1.2 diff -u -w -b -B -r1.1 -r1.2 --- e1000_kcompat.h 2001/06/07 17:09:00 1.1 +++ e1000_kcompat.h 2001/06/07 19:18:13 1.2 @@ -98,6 +98,14 @@ #endif #endif +typedef unsigned long long dma64_t; + +#if defined(CONFIG_X86) +/* pci_unmap_single is a noop */ +#define DUMMY_PCI_UNMAP +#endif + + #if ( LINUX_VERSION_CODE < KERNEL_VERSION(2,3,41) ) #include #include Index: e1000_main.c =================================================================== RCS file: /var/cvsroot_2.4/usr/src/e1000/src/e1000_main.c,v retrieving revision 1.1 retrieving revision 1.3 diff -u -w -b -B -r1.1 -r1.3 --- e1000_main.c 2001/06/07 17:09:00 1.1 +++ e1000_main.c 2001/06/13 13:18:36 1.3 @@ -1325,22 +1325,11 @@ *********************************************************************/ static inline void -e1000_load_addr(E1000_64_BIT_PHYSICAL_ADDRESS *desc_addr, dma_addr_t addr) { +e1000_load_addr(E1000_64_BIT_PHYSICAL_ADDRESS *desc_addr, dma64_t addr) { -#if (BITS_PER_LONG == 32) - - desc_addr->Lo32 = cpu_to_le32(addr); - desc_addr->Hi32 = 0; - -#elif (BITS_PER_LONG == 64) - desc_addr->Lo32 = cpu_to_le32((uint32_t)(addr & 0x00000000FFFFFFFF)); desc_addr->Hi32 = cpu_to_le32(addr >> 32); -#else -#error "Unsupported System - does not use 32 or 64 bit pointers!" -#endif - return; } @@ -1448,12 +1437,12 @@ tasklet_schedule(&Adapter->rx_fill_tasklet); - /* Set the watchdog timer for 2 seconds */ + /* Set the watchdog timer for WATCHDOG_DELTA seconds */ init_timer(&Adapter->timer_id); Adapter->timer_id.function = &e1000_watchdog; Adapter->timer_id.data = (unsigned long) netdev; - mod_timer(&Adapter->timer_id, (jiffies + 2 * HZ)); + mod_timer(&Adapter->timer_id, (jiffies + WATCHDOG_DELTA)); /* LWS */ /* stats accumulated while down are dropped * this does not clear the running total */ @@ -1843,9 +1832,11 @@ for(i = 0; i < Adapter->NumTxDescriptors; i++) { if(Adapter->tx_skb[i].skb != NULL) { +#ifndef DUMMY_PCI_UNMAP pci_unmap_single(pdev, Adapter->tx_skb[i].dma, Adapter->tx_skb[i].length, PCI_DMA_TODEVICE); +#endif dev_kfree_skb(Adapter->tx_skb[i].skb); @@ -1922,10 +1913,11 @@ for(i = 0; i < Adapter->NumRxDescriptors; i++) { if(Adapter->rx_skb[i].skb != NULL) { +#ifndef DUMMY_PCI_UNMAP pci_unmap_single(pdev, Adapter->rx_skb[i].dma, Adapter->rx_skb[i].length, PCI_DMA_FROMDEVICE); - +#endif dev_kfree_skb(Adapter->rx_skb[i].skb); Adapter->rx_skb[i].skb = NULL; @@ -2128,7 +2120,7 @@ #endif /* Reset the timer */ - mod_timer(&Adapter->timer_id, jiffies + 2 * HZ); + mod_timer(&Adapter->timer_id, jiffies + WATCHDOG_DELTA); /* LWS */ return; } @@ -2202,6 +2194,32 @@ return; } +#if defined(CONFIG_HIGHMEM) && ZEROCOPY + +static inline dma64_t +pci_map_single_high(struct pci_dev *hwdev, struct page *page, + int offset, size_t size, int dir) +{ + dma64_t phys; + + phys = ((page - mem_map) * (dma64_t)PAGE_SIZE) + offset; + + return phys; +} + +#else + +static inline dma64_t +pci_map_single_high(struct pci_dev *hwdev, struct page *page, + int offset, size_t size, int dir) +{ + return (dma64_t)pci_map_single(hwdev, page_address(page) + offset, size, dir); +} + +#endif + + + /*********************************************************************/ /*! @brief Transmit entry point * @ingroup entry_point @@ -2225,6 +2243,7 @@ PE1000_TRANSMIT_DESCRIPTOR CurrentTxDescriptor; int i, first_len, first_txd; UINT32 txd_upper, txd_lower; + dma64_t phys; E1000_DBG("e1000_xmit_frame"); @@ -2245,12 +2264,15 @@ first_len = skb->len; #endif - Adapter->tx_skb[i].length = first_len; - Adapter->tx_skb[i].dma = pci_map_single(pdev, skb->data, first_len, + phys = pci_map_single(pdev, skb->data, first_len, PCI_DMA_TODEVICE); + + e1000_load_addr(&(CurrentTxDescriptor->BufferAddress), phys); - e1000_load_addr(&(CurrentTxDescriptor->BufferAddress), - Adapter->tx_skb[i].dma); +#ifndef DUMMY_PCI_UNMAP + Adapter->tx_skb[i].length = first_len; + Adapter->tx_skb[i].dma = phys; +#endif CurrentTxDescriptor->Lower.DwordData = cpu_to_le32(txd_lower | first_len); CurrentTxDescriptor->Upper.DwordData = cpu_to_le32(txd_upper); @@ -2271,14 +2293,21 @@ atomic_dec(&Adapter->NumTxDescriptorsAvail); CurrentTxDescriptor = &Adapter->TxDescriptors[i]; - Adapter->tx_skb[i].dma = pci_map_single(pdev, - page_address(frag->page)+frag->page_offset, - frag->size, PCI_DMA_TODEVICE); - Adapter->tx_skb[i].length = frag->size; - e1000_load_addr(&(CurrentTxDescriptor->BufferAddress), - Adapter->tx_skb[i].dma); + phys = pci_map_single_high(pdev, + frag->page, + frag->page_offset, + frag->size, + PCI_DMA_TODEVICE); + + e1000_load_addr(&(CurrentTxDescriptor->BufferAddress), phys); + CurrentTxDescriptor->Lower.DwordData = (txd_lower | frag->size); CurrentTxDescriptor->Upper.DwordData = (txd_upper); + +#ifndef DUMMY_PCI_UNMAP + Adapter->tx_skb[i].length = frag->size; + Adapter->tx_skb[i].dma = phys; +#endif } /* EOP and SKB pointer go with the last fragment */ CurrentTxDescriptor->Lower.DwordData |= (E1000_TXD_CMD_EOP); @@ -2748,13 +2777,14 @@ while (TransmitDescriptor->Upper.DwordData & cpu_to_le32(E1000_TXD_STAT_DD)) { +#ifndef DUMMY_PCI_UNMAP if(Adapter->tx_skb[i].dma != 0) { pci_unmap_single(pdev, Adapter->tx_skb[i].dma, Adapter->tx_skb[i].length, PCI_DMA_TODEVICE); Adapter->tx_skb[i].dma = 0; } - +#endif if(Adapter->tx_skb[i].skb != NULL) { dev_kfree_skb_irq(Adapter->tx_skb[i].skb); Adapter->tx_skb[i].skb = NULL; @@ -2772,7 +2802,7 @@ if(Adapter->tx_out_res && netif_queue_stopped(netdev) && (atomic_read(&Adapter->NumTxDescriptorsAvail) > - (Adapter->NumTxDescriptors * 3 / 4))) { + (Adapter->NumTxDescriptors * WAKE_THRESHOLD))) { /* LWS */ Adapter->tx_out_res = 0; #ifdef IANS @@ -2808,9 +2838,12 @@ CurrentDescriptor = &Adapter->RxDescriptors[i]; while(CurrentDescriptor->ReceiveStatus & E1000_RXD_STAT_DD) { + +#ifndef DUMMY_PCI_UNMAP pci_unmap_single(pdev, Adapter->rx_skb[i].dma, Adapter->rx_skb[i].length, PCI_DMA_FROMDEVICE); +#endif skb = Adapter->rx_skb[i].skb; Length = le16_to_cpu(CurrentDescriptor->Length) - CRC_LENGTH; @@ -2926,6 +2959,7 @@ PE1000_RECEIVE_DESCRIPTOR CurrentDescriptor; struct sk_buff *skb; int i; + dma_addr_t phys; E1000_DBG("ReceiveBufferFill"); @@ -2958,14 +2992,17 @@ skb->dev = netdev; Adapter->rx_skb[i].skb = skb; - Adapter->rx_skb[i].length = Adapter->RxBufferLen; - Adapter->rx_skb[i].dma = pci_map_single(pdev, skb->data, + + phys = pci_map_single(pdev, skb->data, Adapter->RxBufferLen, PCI_DMA_FROMDEVICE); - e1000_load_addr(&(CurrentDescriptor->BufferAddress), - Adapter->rx_skb[i].dma); + e1000_load_addr(&(CurrentDescriptor->BufferAddress), (dma64_t)phys); +#ifndef DUMMY_PCI_UNMAP + Adapter->rx_skb[i].length = Adapter->RxBufferLen; + Adapter->rx_skb[i].dma = phys; +#endif /* move tail */ E1000_WRITE_REG(Rdt0, i); @@ -3106,6 +3143,8 @@ struct pci_dev *pdev = Adapter->pdev; PE1000_TRANSMIT_DESCRIPTOR CurrentTxDescriptor; int i; + dma_addr_t phys; + #ifdef DIAG_DEBUG printk("%x \n", *(skb->data+3)); #endif @@ -3113,13 +3152,16 @@ CurrentTxDescriptor = &Adapter->TxDescriptors[i]; Adapter->tx_skb[i].skb = skb; - Adapter->tx_skb[i].length = skb->len; - Adapter->tx_skb[i].dma = pci_map_single(pdev, skb->data, skb->len, + + phys = pci_map_single(pdev, skb->data, skb->len, PCI_DMA_TODEVICE); - e1000_load_addr(&(CurrentTxDescriptor->BufferAddress), - Adapter->tx_skb[i].dma); + e1000_load_addr(&(CurrentTxDescriptor->BufferAddress), (dma64_t)phys); +#ifndef DUMMY_PCI_UNMAP + Adapter->tx_skb[i].length = skb->len; + Adapter->tx_skb[i].dma = phys; +#endif CurrentTxDescriptor->Lower.DwordData = cpu_to_le32(skb->len); /* zero out the status field in the descriptor */ @@ -3195,10 +3237,11 @@ rcved_pkt = TRUE; } } +#ifndef DUMMY_PCI_UNMAP pci_unmap_single(pdev, Adapter->rx_skb[i].dma, Adapter->rx_skb[i].length, PCI_DMA_FROMDEVICE); - +#endif dev_kfree_skb_irq(skb); Adapter->rx_skb[i].skb = NULL;