diff options
author | Chas Williams <chas@cmf.nrl.navy.mil> | 2008-06-17 19:21:44 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-06-17 19:21:44 -0400 |
commit | 7255ca3f3c928fec6d9ce607fed7d0a4f4fca6f7 (patch) | |
tree | 516a1aaaa7a57a2f3db1608abd1acd72ac747e82 | |
parent | 97928f7021dc70f268037e9a7ea18a7345762fca (diff) |
atm: [he] remove #ifdef clutter
Signed-off-by: Chas Williams <chas@cmf.nrl.navy.mil>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | drivers/atm/he.c | 152 | ||||
-rw-r--r-- | drivers/atm/he.h | 26 |
2 files changed, 0 insertions, 178 deletions
diff --git a/drivers/atm/he.c b/drivers/atm/he.c index ea495b21f916..bdbad7edf682 100644 --- a/drivers/atm/he.c +++ b/drivers/atm/he.c | |||
@@ -75,14 +75,8 @@ | |||
75 | #include <linux/atm.h> | 75 | #include <linux/atm.h> |
76 | #include <linux/sonet.h> | 76 | #include <linux/sonet.h> |
77 | 77 | ||
78 | #define USE_TASKLET | ||
79 | #undef USE_SCATTERGATHER | 78 | #undef USE_SCATTERGATHER |
80 | #undef USE_CHECKSUM_HW /* still confused about this */ | 79 | #undef USE_CHECKSUM_HW /* still confused about this */ |
81 | #define USE_RBPS | ||
82 | #undef USE_RBPS_POOL /* if memory is tight try this */ | ||
83 | #undef USE_RBPL_POOL /* if memory is tight try this */ | ||
84 | #define USE_TPD_POOL | ||
85 | /* #undef CONFIG_ATM_HE_USE_SUNI */ | ||
86 | /* #undef HE_DEBUG */ | 80 | /* #undef HE_DEBUG */ |
87 | 81 | ||
88 | #include "he.h" | 82 | #include "he.h" |
@@ -388,9 +382,7 @@ he_init_one(struct pci_dev *pci_dev, const struct pci_device_id *pci_ent) | |||
388 | he_dev->atm_dev->dev_data = he_dev; | 382 | he_dev->atm_dev->dev_data = he_dev; |
389 | atm_dev->dev_data = he_dev; | 383 | atm_dev->dev_data = he_dev; |
390 | he_dev->number = atm_dev->number; | 384 | he_dev->number = atm_dev->number; |
391 | #ifdef USE_TASKLET | ||
392 | tasklet_init(&he_dev->tasklet, he_tasklet, (unsigned long) he_dev); | 385 | tasklet_init(&he_dev->tasklet, he_tasklet, (unsigned long) he_dev); |
393 | #endif | ||
394 | spin_lock_init(&he_dev->global_lock); | 386 | spin_lock_init(&he_dev->global_lock); |
395 | 387 | ||
396 | if (he_start(atm_dev)) { | 388 | if (he_start(atm_dev)) { |
@@ -787,23 +779,13 @@ he_init_group(struct he_dev *he_dev, int group) | |||
787 | { | 779 | { |
788 | int i; | 780 | int i; |
789 | 781 | ||
790 | #ifdef USE_RBPS | ||
791 | /* small buffer pool */ | 782 | /* small buffer pool */ |
792 | #ifdef USE_RBPS_POOL | ||
793 | he_dev->rbps_pool = pci_pool_create("rbps", he_dev->pci_dev, | 783 | he_dev->rbps_pool = pci_pool_create("rbps", he_dev->pci_dev, |
794 | CONFIG_RBPS_BUFSIZE, 8, 0); | 784 | CONFIG_RBPS_BUFSIZE, 8, 0); |
795 | if (he_dev->rbps_pool == NULL) { | 785 | if (he_dev->rbps_pool == NULL) { |
796 | hprintk("unable to create rbps pages\n"); | 786 | hprintk("unable to create rbps pages\n"); |
797 | return -ENOMEM; | 787 | return -ENOMEM; |
798 | } | 788 | } |
799 | #else /* !USE_RBPS_POOL */ | ||
800 | he_dev->rbps_pages = pci_alloc_consistent(he_dev->pci_dev, | ||
801 | CONFIG_RBPS_SIZE * CONFIG_RBPS_BUFSIZE, &he_dev->rbps_pages_phys); | ||
802 | if (he_dev->rbps_pages == NULL) { | ||
803 | hprintk("unable to create rbps page pool\n"); | ||
804 | return -ENOMEM; | ||
805 | } | ||
806 | #endif /* USE_RBPS_POOL */ | ||
807 | 789 | ||
808 | he_dev->rbps_base = pci_alloc_consistent(he_dev->pci_dev, | 790 | he_dev->rbps_base = pci_alloc_consistent(he_dev->pci_dev, |
809 | CONFIG_RBPS_SIZE * sizeof(struct he_rbp), &he_dev->rbps_phys); | 791 | CONFIG_RBPS_SIZE * sizeof(struct he_rbp), &he_dev->rbps_phys); |
@@ -818,14 +800,9 @@ he_init_group(struct he_dev *he_dev, int group) | |||
818 | dma_addr_t dma_handle; | 800 | dma_addr_t dma_handle; |
819 | void *cpuaddr; | 801 | void *cpuaddr; |
820 | 802 | ||
821 | #ifdef USE_RBPS_POOL | ||
822 | cpuaddr = pci_pool_alloc(he_dev->rbps_pool, GFP_KERNEL|GFP_DMA, &dma_handle); | 803 | cpuaddr = pci_pool_alloc(he_dev->rbps_pool, GFP_KERNEL|GFP_DMA, &dma_handle); |
823 | if (cpuaddr == NULL) | 804 | if (cpuaddr == NULL) |
824 | return -ENOMEM; | 805 | return -ENOMEM; |
825 | #else | ||
826 | cpuaddr = he_dev->rbps_pages + (i * CONFIG_RBPS_BUFSIZE); | ||
827 | dma_handle = he_dev->rbps_pages_phys + (i * CONFIG_RBPS_BUFSIZE); | ||
828 | #endif | ||
829 | 806 | ||
830 | he_dev->rbps_virt[i].virt = cpuaddr; | 807 | he_dev->rbps_virt[i].virt = cpuaddr; |
831 | he_dev->rbps_base[i].status = RBP_LOANED | RBP_SMALLBUF | (i << RBP_INDEX_OFF); | 808 | he_dev->rbps_base[i].status = RBP_LOANED | RBP_SMALLBUF | (i << RBP_INDEX_OFF); |
@@ -844,30 +821,14 @@ he_init_group(struct he_dev *he_dev, int group) | |||
844 | RBP_QSIZE(CONFIG_RBPS_SIZE - 1) | | 821 | RBP_QSIZE(CONFIG_RBPS_SIZE - 1) | |
845 | RBP_INT_ENB, | 822 | RBP_INT_ENB, |
846 | G0_RBPS_QI + (group * 32)); | 823 | G0_RBPS_QI + (group * 32)); |
847 | #else /* !USE_RBPS */ | ||
848 | he_writel(he_dev, 0x0, G0_RBPS_S + (group * 32)); | ||
849 | he_writel(he_dev, 0x0, G0_RBPS_T + (group * 32)); | ||
850 | he_writel(he_dev, 0x0, G0_RBPS_QI + (group * 32)); | ||
851 | he_writel(he_dev, RBP_THRESH(0x1) | RBP_QSIZE(0x0), | ||
852 | G0_RBPS_BS + (group * 32)); | ||
853 | #endif /* USE_RBPS */ | ||
854 | 824 | ||
855 | /* large buffer pool */ | 825 | /* large buffer pool */ |
856 | #ifdef USE_RBPL_POOL | ||
857 | he_dev->rbpl_pool = pci_pool_create("rbpl", he_dev->pci_dev, | 826 | he_dev->rbpl_pool = pci_pool_create("rbpl", he_dev->pci_dev, |
858 | CONFIG_RBPL_BUFSIZE, 8, 0); | 827 | CONFIG_RBPL_BUFSIZE, 8, 0); |
859 | if (he_dev->rbpl_pool == NULL) { | 828 | if (he_dev->rbpl_pool == NULL) { |
860 | hprintk("unable to create rbpl pool\n"); | 829 | hprintk("unable to create rbpl pool\n"); |
861 | return -ENOMEM; | 830 | return -ENOMEM; |
862 | } | 831 | } |
863 | #else /* !USE_RBPL_POOL */ | ||
864 | he_dev->rbpl_pages = (void *) pci_alloc_consistent(he_dev->pci_dev, | ||
865 | CONFIG_RBPL_SIZE * CONFIG_RBPL_BUFSIZE, &he_dev->rbpl_pages_phys); | ||
866 | if (he_dev->rbpl_pages == NULL) { | ||
867 | hprintk("unable to create rbpl pages\n"); | ||
868 | return -ENOMEM; | ||
869 | } | ||
870 | #endif /* USE_RBPL_POOL */ | ||
871 | 832 | ||
872 | he_dev->rbpl_base = pci_alloc_consistent(he_dev->pci_dev, | 833 | he_dev->rbpl_base = pci_alloc_consistent(he_dev->pci_dev, |
873 | CONFIG_RBPL_SIZE * sizeof(struct he_rbp), &he_dev->rbpl_phys); | 834 | CONFIG_RBPL_SIZE * sizeof(struct he_rbp), &he_dev->rbpl_phys); |
@@ -882,14 +843,9 @@ he_init_group(struct he_dev *he_dev, int group) | |||
882 | dma_addr_t dma_handle; | 843 | dma_addr_t dma_handle; |
883 | void *cpuaddr; | 844 | void *cpuaddr; |
884 | 845 | ||
885 | #ifdef USE_RBPL_POOL | ||
886 | cpuaddr = pci_pool_alloc(he_dev->rbpl_pool, GFP_KERNEL|GFP_DMA, &dma_handle); | 846 | cpuaddr = pci_pool_alloc(he_dev->rbpl_pool, GFP_KERNEL|GFP_DMA, &dma_handle); |
887 | if (cpuaddr == NULL) | 847 | if (cpuaddr == NULL) |
888 | return -ENOMEM; | 848 | return -ENOMEM; |
889 | #else | ||
890 | cpuaddr = he_dev->rbpl_pages + (i * CONFIG_RBPL_BUFSIZE); | ||
891 | dma_handle = he_dev->rbpl_pages_phys + (i * CONFIG_RBPL_BUFSIZE); | ||
892 | #endif | ||
893 | 849 | ||
894 | he_dev->rbpl_virt[i].virt = cpuaddr; | 850 | he_dev->rbpl_virt[i].virt = cpuaddr; |
895 | he_dev->rbpl_base[i].status = RBP_LOANED | (i << RBP_INDEX_OFF); | 851 | he_dev->rbpl_base[i].status = RBP_LOANED | (i << RBP_INDEX_OFF); |
@@ -1475,7 +1431,6 @@ he_start(struct atm_dev *dev) | |||
1475 | 1431 | ||
1476 | he_init_tpdrq(he_dev); | 1432 | he_init_tpdrq(he_dev); |
1477 | 1433 | ||
1478 | #ifdef USE_TPD_POOL | ||
1479 | he_dev->tpd_pool = pci_pool_create("tpd", he_dev->pci_dev, | 1434 | he_dev->tpd_pool = pci_pool_create("tpd", he_dev->pci_dev, |
1480 | sizeof(struct he_tpd), TPD_ALIGNMENT, 0); | 1435 | sizeof(struct he_tpd), TPD_ALIGNMENT, 0); |
1481 | if (he_dev->tpd_pool == NULL) { | 1436 | if (he_dev->tpd_pool == NULL) { |
@@ -1484,20 +1439,6 @@ he_start(struct atm_dev *dev) | |||
1484 | } | 1439 | } |
1485 | 1440 | ||
1486 | INIT_LIST_HEAD(&he_dev->outstanding_tpds); | 1441 | INIT_LIST_HEAD(&he_dev->outstanding_tpds); |
1487 | #else | ||
1488 | he_dev->tpd_base = (void *) pci_alloc_consistent(he_dev->pci_dev, | ||
1489 | CONFIG_NUMTPDS * sizeof(struct he_tpd), &he_dev->tpd_base_phys); | ||
1490 | if (!he_dev->tpd_base) | ||
1491 | return -ENOMEM; | ||
1492 | |||
1493 | for (i = 0; i < CONFIG_NUMTPDS; ++i) { | ||
1494 | he_dev->tpd_base[i].status = (i << TPD_ADDR_SHIFT); | ||
1495 | he_dev->tpd_base[i].inuse = 0; | ||
1496 | } | ||
1497 | |||
1498 | he_dev->tpd_head = he_dev->tpd_base; | ||
1499 | he_dev->tpd_end = &he_dev->tpd_base[CONFIG_NUMTPDS - 1]; | ||
1500 | #endif | ||
1501 | 1442 | ||
1502 | if (he_init_group(he_dev, 0) != 0) | 1443 | if (he_init_group(he_dev, 0) != 0) |
1503 | return -ENOMEM; | 1444 | return -ENOMEM; |
@@ -1606,9 +1547,7 @@ he_stop(struct he_dev *he_dev) | |||
1606 | gen_cntl_0 &= ~(INT_PROC_ENBL | INIT_ENB); | 1547 | gen_cntl_0 &= ~(INT_PROC_ENBL | INIT_ENB); |
1607 | pci_write_config_dword(pci_dev, GEN_CNTL_0, gen_cntl_0); | 1548 | pci_write_config_dword(pci_dev, GEN_CNTL_0, gen_cntl_0); |
1608 | 1549 | ||
1609 | #ifdef USE_TASKLET | ||
1610 | tasklet_disable(&he_dev->tasklet); | 1550 | tasklet_disable(&he_dev->tasklet); |
1611 | #endif | ||
1612 | 1551 | ||
1613 | /* disable recv and transmit */ | 1552 | /* disable recv and transmit */ |
1614 | 1553 | ||
@@ -1638,7 +1577,6 @@ he_stop(struct he_dev *he_dev) | |||
1638 | he_dev->hsp, he_dev->hsp_phys); | 1577 | he_dev->hsp, he_dev->hsp_phys); |
1639 | 1578 | ||
1640 | if (he_dev->rbpl_base) { | 1579 | if (he_dev->rbpl_base) { |
1641 | #ifdef USE_RBPL_POOL | ||
1642 | int i; | 1580 | int i; |
1643 | 1581 | ||
1644 | for (i = 0; i < CONFIG_RBPL_SIZE; ++i) { | 1582 | for (i = 0; i < CONFIG_RBPL_SIZE; ++i) { |
@@ -1647,22 +1585,14 @@ he_stop(struct he_dev *he_dev) | |||
1647 | 1585 | ||
1648 | pci_pool_free(he_dev->rbpl_pool, cpuaddr, dma_handle); | 1586 | pci_pool_free(he_dev->rbpl_pool, cpuaddr, dma_handle); |
1649 | } | 1587 | } |
1650 | #else | ||
1651 | pci_free_consistent(he_dev->pci_dev, CONFIG_RBPL_SIZE | ||
1652 | * CONFIG_RBPL_BUFSIZE, he_dev->rbpl_pages, he_dev->rbpl_pages_phys); | ||
1653 | #endif | ||
1654 | pci_free_consistent(he_dev->pci_dev, CONFIG_RBPL_SIZE | 1588 | pci_free_consistent(he_dev->pci_dev, CONFIG_RBPL_SIZE |
1655 | * sizeof(struct he_rbp), he_dev->rbpl_base, he_dev->rbpl_phys); | 1589 | * sizeof(struct he_rbp), he_dev->rbpl_base, he_dev->rbpl_phys); |
1656 | } | 1590 | } |
1657 | 1591 | ||
1658 | #ifdef USE_RBPL_POOL | ||
1659 | if (he_dev->rbpl_pool) | 1592 | if (he_dev->rbpl_pool) |
1660 | pci_pool_destroy(he_dev->rbpl_pool); | 1593 | pci_pool_destroy(he_dev->rbpl_pool); |
1661 | #endif | ||
1662 | 1594 | ||
1663 | #ifdef USE_RBPS | ||
1664 | if (he_dev->rbps_base) { | 1595 | if (he_dev->rbps_base) { |
1665 | #ifdef USE_RBPS_POOL | ||
1666 | int i; | 1596 | int i; |
1667 | 1597 | ||
1668 | for (i = 0; i < CONFIG_RBPS_SIZE; ++i) { | 1598 | for (i = 0; i < CONFIG_RBPS_SIZE; ++i) { |
@@ -1671,20 +1601,12 @@ he_stop(struct he_dev *he_dev) | |||
1671 | 1601 | ||
1672 | pci_pool_free(he_dev->rbps_pool, cpuaddr, dma_handle); | 1602 | pci_pool_free(he_dev->rbps_pool, cpuaddr, dma_handle); |
1673 | } | 1603 | } |
1674 | #else | ||
1675 | pci_free_consistent(he_dev->pci_dev, CONFIG_RBPS_SIZE | ||
1676 | * CONFIG_RBPS_BUFSIZE, he_dev->rbps_pages, he_dev->rbps_pages_phys); | ||
1677 | #endif | ||
1678 | pci_free_consistent(he_dev->pci_dev, CONFIG_RBPS_SIZE | 1604 | pci_free_consistent(he_dev->pci_dev, CONFIG_RBPS_SIZE |
1679 | * sizeof(struct he_rbp), he_dev->rbps_base, he_dev->rbps_phys); | 1605 | * sizeof(struct he_rbp), he_dev->rbps_base, he_dev->rbps_phys); |
1680 | } | 1606 | } |
1681 | 1607 | ||
1682 | #ifdef USE_RBPS_POOL | ||
1683 | if (he_dev->rbps_pool) | 1608 | if (he_dev->rbps_pool) |
1684 | pci_pool_destroy(he_dev->rbps_pool); | 1609 | pci_pool_destroy(he_dev->rbps_pool); |
1685 | #endif | ||
1686 | |||
1687 | #endif /* USE_RBPS */ | ||
1688 | 1610 | ||
1689 | if (he_dev->rbrq_base) | 1611 | if (he_dev->rbrq_base) |
1690 | pci_free_consistent(he_dev->pci_dev, CONFIG_RBRQ_SIZE * sizeof(struct he_rbrq), | 1612 | pci_free_consistent(he_dev->pci_dev, CONFIG_RBRQ_SIZE * sizeof(struct he_rbrq), |
@@ -1698,14 +1620,8 @@ he_stop(struct he_dev *he_dev) | |||
1698 | pci_free_consistent(he_dev->pci_dev, CONFIG_TBRQ_SIZE * sizeof(struct he_tbrq), | 1620 | pci_free_consistent(he_dev->pci_dev, CONFIG_TBRQ_SIZE * sizeof(struct he_tbrq), |
1699 | he_dev->tpdrq_base, he_dev->tpdrq_phys); | 1621 | he_dev->tpdrq_base, he_dev->tpdrq_phys); |
1700 | 1622 | ||
1701 | #ifdef USE_TPD_POOL | ||
1702 | if (he_dev->tpd_pool) | 1623 | if (he_dev->tpd_pool) |
1703 | pci_pool_destroy(he_dev->tpd_pool); | 1624 | pci_pool_destroy(he_dev->tpd_pool); |
1704 | #else | ||
1705 | if (he_dev->tpd_base) | ||
1706 | pci_free_consistent(he_dev->pci_dev, CONFIG_NUMTPDS * sizeof(struct he_tpd), | ||
1707 | he_dev->tpd_base, he_dev->tpd_base_phys); | ||
1708 | #endif | ||
1709 | 1625 | ||
1710 | if (he_dev->pci_dev) { | 1626 | if (he_dev->pci_dev) { |
1711 | pci_read_config_word(he_dev->pci_dev, PCI_COMMAND, &command); | 1627 | pci_read_config_word(he_dev->pci_dev, PCI_COMMAND, &command); |
@@ -1720,7 +1636,6 @@ he_stop(struct he_dev *he_dev) | |||
1720 | static struct he_tpd * | 1636 | static struct he_tpd * |
1721 | __alloc_tpd(struct he_dev *he_dev) | 1637 | __alloc_tpd(struct he_dev *he_dev) |
1722 | { | 1638 | { |
1723 | #ifdef USE_TPD_POOL | ||
1724 | struct he_tpd *tpd; | 1639 | struct he_tpd *tpd; |
1725 | dma_addr_t dma_handle; | 1640 | dma_addr_t dma_handle; |
1726 | 1641 | ||
@@ -1735,27 +1650,6 @@ __alloc_tpd(struct he_dev *he_dev) | |||
1735 | tpd->iovec[2].addr = 0; tpd->iovec[2].len = 0; | 1650 | tpd->iovec[2].addr = 0; tpd->iovec[2].len = 0; |
1736 | 1651 | ||
1737 | return tpd; | 1652 | return tpd; |
1738 | #else | ||
1739 | int i; | ||
1740 | |||
1741 | for (i = 0; i < CONFIG_NUMTPDS; ++i) { | ||
1742 | ++he_dev->tpd_head; | ||
1743 | if (he_dev->tpd_head > he_dev->tpd_end) { | ||
1744 | he_dev->tpd_head = he_dev->tpd_base; | ||
1745 | } | ||
1746 | |||
1747 | if (!he_dev->tpd_head->inuse) { | ||
1748 | he_dev->tpd_head->inuse = 1; | ||
1749 | he_dev->tpd_head->status &= TPD_MASK; | ||
1750 | he_dev->tpd_head->iovec[0].addr = 0; he_dev->tpd_head->iovec[0].len = 0; | ||
1751 | he_dev->tpd_head->iovec[1].addr = 0; he_dev->tpd_head->iovec[1].len = 0; | ||
1752 | he_dev->tpd_head->iovec[2].addr = 0; he_dev->tpd_head->iovec[2].len = 0; | ||
1753 | return he_dev->tpd_head; | ||
1754 | } | ||
1755 | } | ||
1756 | hprintk("out of tpds -- increase CONFIG_NUMTPDS (%d)\n", CONFIG_NUMTPDS); | ||
1757 | return NULL; | ||
1758 | #endif | ||
1759 | } | 1653 | } |
1760 | 1654 | ||
1761 | #define AAL5_LEN(buf,len) \ | 1655 | #define AAL5_LEN(buf,len) \ |
@@ -1804,11 +1698,9 @@ he_service_rbrq(struct he_dev *he_dev, int group) | |||
1804 | RBRQ_CON_CLOSED(he_dev->rbrq_head) ? " CON_CLOSED" : "", | 1698 | RBRQ_CON_CLOSED(he_dev->rbrq_head) ? " CON_CLOSED" : "", |
1805 | RBRQ_HBUF_ERR(he_dev->rbrq_head) ? " HBUF_ERR" : ""); | 1699 | RBRQ_HBUF_ERR(he_dev->rbrq_head) ? " HBUF_ERR" : ""); |
1806 | 1700 | ||
1807 | #ifdef USE_RBPS | ||
1808 | if (RBRQ_ADDR(he_dev->rbrq_head) & RBP_SMALLBUF) | 1701 | if (RBRQ_ADDR(he_dev->rbrq_head) & RBP_SMALLBUF) |
1809 | rbp = &he_dev->rbps_base[RBP_INDEX(RBRQ_ADDR(he_dev->rbrq_head))]; | 1702 | rbp = &he_dev->rbps_base[RBP_INDEX(RBRQ_ADDR(he_dev->rbrq_head))]; |
1810 | else | 1703 | else |
1811 | #endif | ||
1812 | rbp = &he_dev->rbpl_base[RBP_INDEX(RBRQ_ADDR(he_dev->rbrq_head))]; | 1704 | rbp = &he_dev->rbpl_base[RBP_INDEX(RBRQ_ADDR(he_dev->rbrq_head))]; |
1813 | 1705 | ||
1814 | buf_len = RBRQ_BUFLEN(he_dev->rbrq_head) * 4; | 1706 | buf_len = RBRQ_BUFLEN(he_dev->rbrq_head) * 4; |
@@ -1887,12 +1779,10 @@ he_service_rbrq(struct he_dev *he_dev, int group) | |||
1887 | 1779 | ||
1888 | for (iov = he_vcc->iov_head; | 1780 | for (iov = he_vcc->iov_head; |
1889 | iov < he_vcc->iov_tail; ++iov) { | 1781 | iov < he_vcc->iov_tail; ++iov) { |
1890 | #ifdef USE_RBPS | ||
1891 | if (iov->iov_base & RBP_SMALLBUF) | 1782 | if (iov->iov_base & RBP_SMALLBUF) |
1892 | memcpy(skb_put(skb, iov->iov_len), | 1783 | memcpy(skb_put(skb, iov->iov_len), |
1893 | he_dev->rbps_virt[RBP_INDEX(iov->iov_base)].virt, iov->iov_len); | 1784 | he_dev->rbps_virt[RBP_INDEX(iov->iov_base)].virt, iov->iov_len); |
1894 | else | 1785 | else |
1895 | #endif | ||
1896 | memcpy(skb_put(skb, iov->iov_len), | 1786 | memcpy(skb_put(skb, iov->iov_len), |
1897 | he_dev->rbpl_virt[RBP_INDEX(iov->iov_base)].virt, iov->iov_len); | 1787 | he_dev->rbpl_virt[RBP_INDEX(iov->iov_base)].virt, iov->iov_len); |
1898 | } | 1788 | } |
@@ -1937,11 +1827,9 @@ return_host_buffers: | |||
1937 | 1827 | ||
1938 | for (iov = he_vcc->iov_head; | 1828 | for (iov = he_vcc->iov_head; |
1939 | iov < he_vcc->iov_tail; ++iov) { | 1829 | iov < he_vcc->iov_tail; ++iov) { |
1940 | #ifdef USE_RBPS | ||
1941 | if (iov->iov_base & RBP_SMALLBUF) | 1830 | if (iov->iov_base & RBP_SMALLBUF) |
1942 | rbp = &he_dev->rbps_base[RBP_INDEX(iov->iov_base)]; | 1831 | rbp = &he_dev->rbps_base[RBP_INDEX(iov->iov_base)]; |
1943 | else | 1832 | else |
1944 | #endif | ||
1945 | rbp = &he_dev->rbpl_base[RBP_INDEX(iov->iov_base)]; | 1833 | rbp = &he_dev->rbpl_base[RBP_INDEX(iov->iov_base)]; |
1946 | 1834 | ||
1947 | rbp->status &= ~RBP_LOANED; | 1835 | rbp->status &= ~RBP_LOANED; |
@@ -1977,9 +1865,7 @@ he_service_tbrq(struct he_dev *he_dev, int group) | |||
1977 | he_dev->hsp->group[group].tbrq_tail); | 1865 | he_dev->hsp->group[group].tbrq_tail); |
1978 | struct he_tpd *tpd; | 1866 | struct he_tpd *tpd; |
1979 | int slot, updated = 0; | 1867 | int slot, updated = 0; |
1980 | #ifdef USE_TPD_POOL | ||
1981 | struct he_tpd *__tpd; | 1868 | struct he_tpd *__tpd; |
1982 | #endif | ||
1983 | 1869 | ||
1984 | /* 2.1.6 transmit buffer return queue */ | 1870 | /* 2.1.6 transmit buffer return queue */ |
1985 | 1871 | ||
@@ -1991,7 +1877,6 @@ he_service_tbrq(struct he_dev *he_dev, int group) | |||
1991 | TBRQ_TPD(he_dev->tbrq_head), | 1877 | TBRQ_TPD(he_dev->tbrq_head), |
1992 | TBRQ_EOS(he_dev->tbrq_head) ? " EOS" : "", | 1878 | TBRQ_EOS(he_dev->tbrq_head) ? " EOS" : "", |
1993 | TBRQ_MULTIPLE(he_dev->tbrq_head) ? " MULTIPLE" : ""); | 1879 | TBRQ_MULTIPLE(he_dev->tbrq_head) ? " MULTIPLE" : ""); |
1994 | #ifdef USE_TPD_POOL | ||
1995 | tpd = NULL; | 1880 | tpd = NULL; |
1996 | list_for_each_entry(__tpd, &he_dev->outstanding_tpds, entry) { | 1881 | list_for_each_entry(__tpd, &he_dev->outstanding_tpds, entry) { |
1997 | if (TPD_ADDR(__tpd->status) == TBRQ_TPD(he_dev->tbrq_head)) { | 1882 | if (TPD_ADDR(__tpd->status) == TBRQ_TPD(he_dev->tbrq_head)) { |
@@ -2006,9 +1891,6 @@ he_service_tbrq(struct he_dev *he_dev, int group) | |||
2006 | TBRQ_TPD(he_dev->tbrq_head)); | 1891 | TBRQ_TPD(he_dev->tbrq_head)); |
2007 | goto next_tbrq_entry; | 1892 | goto next_tbrq_entry; |
2008 | } | 1893 | } |
2009 | #else | ||
2010 | tpd = &he_dev->tpd_base[ TPD_INDEX(TBRQ_TPD(he_dev->tbrq_head)) ]; | ||
2011 | #endif | ||
2012 | 1894 | ||
2013 | if (TBRQ_EOS(he_dev->tbrq_head)) { | 1895 | if (TBRQ_EOS(he_dev->tbrq_head)) { |
2014 | HPRINTK("wake_up(tx_waitq) cid 0x%x\n", | 1896 | HPRINTK("wake_up(tx_waitq) cid 0x%x\n", |
@@ -2038,12 +1920,8 @@ he_service_tbrq(struct he_dev *he_dev, int group) | |||
2038 | } | 1920 | } |
2039 | 1921 | ||
2040 | next_tbrq_entry: | 1922 | next_tbrq_entry: |
2041 | #ifdef USE_TPD_POOL | ||
2042 | if (tpd) | 1923 | if (tpd) |
2043 | pci_pool_free(he_dev->tpd_pool, tpd, TPD_ADDR(tpd->status)); | 1924 | pci_pool_free(he_dev->tpd_pool, tpd, TPD_ADDR(tpd->status)); |
2044 | #else | ||
2045 | tpd->inuse = 0; | ||
2046 | #endif | ||
2047 | he_dev->tbrq_head = (struct he_tbrq *) | 1925 | he_dev->tbrq_head = (struct he_tbrq *) |
2048 | ((unsigned long) he_dev->tbrq_base | | 1926 | ((unsigned long) he_dev->tbrq_base | |
2049 | TBRQ_MASK(++he_dev->tbrq_head)); | 1927 | TBRQ_MASK(++he_dev->tbrq_head)); |
@@ -2086,7 +1964,6 @@ he_service_rbpl(struct he_dev *he_dev, int group) | |||
2086 | he_writel(he_dev, RBPL_MASK(he_dev->rbpl_tail), G0_RBPL_T); | 1964 | he_writel(he_dev, RBPL_MASK(he_dev->rbpl_tail), G0_RBPL_T); |
2087 | } | 1965 | } |
2088 | 1966 | ||
2089 | #ifdef USE_RBPS | ||
2090 | static void | 1967 | static void |
2091 | he_service_rbps(struct he_dev *he_dev, int group) | 1968 | he_service_rbps(struct he_dev *he_dev, int group) |
2092 | { | 1969 | { |
@@ -2113,7 +1990,6 @@ he_service_rbps(struct he_dev *he_dev, int group) | |||
2113 | if (moved) | 1990 | if (moved) |
2114 | he_writel(he_dev, RBPS_MASK(he_dev->rbps_tail), G0_RBPS_T); | 1991 | he_writel(he_dev, RBPS_MASK(he_dev->rbps_tail), G0_RBPS_T); |
2115 | } | 1992 | } |
2116 | #endif /* USE_RBPS */ | ||
2117 | 1993 | ||
2118 | static void | 1994 | static void |
2119 | he_tasklet(unsigned long data) | 1995 | he_tasklet(unsigned long data) |
@@ -2124,9 +2000,7 @@ he_tasklet(unsigned long data) | |||
2124 | int updated = 0; | 2000 | int updated = 0; |
2125 | 2001 | ||
2126 | HPRINTK("tasklet (0x%lx)\n", data); | 2002 | HPRINTK("tasklet (0x%lx)\n", data); |
2127 | #ifdef USE_TASKLET | ||
2128 | spin_lock_irqsave(&he_dev->global_lock, flags); | 2003 | spin_lock_irqsave(&he_dev->global_lock, flags); |
2129 | #endif | ||
2130 | 2004 | ||
2131 | while (he_dev->irq_head != he_dev->irq_tail) { | 2005 | while (he_dev->irq_head != he_dev->irq_tail) { |
2132 | ++updated; | 2006 | ++updated; |
@@ -2141,9 +2015,7 @@ he_tasklet(unsigned long data) | |||
2141 | case ITYPE_RBRQ_TIMER: | 2015 | case ITYPE_RBRQ_TIMER: |
2142 | if (he_service_rbrq(he_dev, group)) { | 2016 | if (he_service_rbrq(he_dev, group)) { |
2143 | he_service_rbpl(he_dev, group); | 2017 | he_service_rbpl(he_dev, group); |
2144 | #ifdef USE_RBPS | ||
2145 | he_service_rbps(he_dev, group); | 2018 | he_service_rbps(he_dev, group); |
2146 | #endif /* USE_RBPS */ | ||
2147 | } | 2019 | } |
2148 | break; | 2020 | break; |
2149 | case ITYPE_TBRQ_THRESH: | 2021 | case ITYPE_TBRQ_THRESH: |
@@ -2156,9 +2028,7 @@ he_tasklet(unsigned long data) | |||
2156 | he_service_rbpl(he_dev, group); | 2028 | he_service_rbpl(he_dev, group); |
2157 | break; | 2029 | break; |
2158 | case ITYPE_RBPS_THRESH: | 2030 | case ITYPE_RBPS_THRESH: |
2159 | #ifdef USE_RBPS | ||
2160 | he_service_rbps(he_dev, group); | 2031 | he_service_rbps(he_dev, group); |
2161 | #endif /* USE_RBPS */ | ||
2162 | break; | 2032 | break; |
2163 | case ITYPE_PHY: | 2033 | case ITYPE_PHY: |
2164 | HPRINTK("phy interrupt\n"); | 2034 | HPRINTK("phy interrupt\n"); |
@@ -2186,9 +2056,7 @@ he_tasklet(unsigned long data) | |||
2186 | 2056 | ||
2187 | he_service_rbrq(he_dev, 0); | 2057 | he_service_rbrq(he_dev, 0); |
2188 | he_service_rbpl(he_dev, 0); | 2058 | he_service_rbpl(he_dev, 0); |
2189 | #ifdef USE_RBPS | ||
2190 | he_service_rbps(he_dev, 0); | 2059 | he_service_rbps(he_dev, 0); |
2191 | #endif /* USE_RBPS */ | ||
2192 | he_service_tbrq(he_dev, 0); | 2060 | he_service_tbrq(he_dev, 0); |
2193 | break; | 2061 | break; |
2194 | default: | 2062 | default: |
@@ -2210,9 +2078,7 @@ he_tasklet(unsigned long data) | |||
2210 | IRQ_TAIL(he_dev->irq_tail), IRQ0_HEAD); | 2078 | IRQ_TAIL(he_dev->irq_tail), IRQ0_HEAD); |
2211 | (void) he_readl(he_dev, INT_FIFO); /* 8.1.2 controller errata; flush posted writes */ | 2079 | (void) he_readl(he_dev, INT_FIFO); /* 8.1.2 controller errata; flush posted writes */ |
2212 | } | 2080 | } |
2213 | #ifdef USE_TASKLET | ||
2214 | spin_unlock_irqrestore(&he_dev->global_lock, flags); | 2081 | spin_unlock_irqrestore(&he_dev->global_lock, flags); |
2215 | #endif | ||
2216 | } | 2082 | } |
2217 | 2083 | ||
2218 | static irqreturn_t | 2084 | static irqreturn_t |
@@ -2244,11 +2110,7 @@ he_irq_handler(int irq, void *dev_id) | |||
2244 | 2110 | ||
2245 | if (he_dev->irq_head != he_dev->irq_tail) { | 2111 | if (he_dev->irq_head != he_dev->irq_tail) { |
2246 | handled = 1; | 2112 | handled = 1; |
2247 | #ifdef USE_TASKLET | ||
2248 | tasklet_schedule(&he_dev->tasklet); | 2113 | tasklet_schedule(&he_dev->tasklet); |
2249 | #else | ||
2250 | he_tasklet((unsigned long) he_dev); | ||
2251 | #endif | ||
2252 | he_writel(he_dev, INT_CLEAR_A, INT_FIFO); /* clear interrupt */ | 2114 | he_writel(he_dev, INT_CLEAR_A, INT_FIFO); /* clear interrupt */ |
2253 | (void) he_readl(he_dev, INT_FIFO); /* flush posted writes */ | 2115 | (void) he_readl(he_dev, INT_FIFO); /* flush posted writes */ |
2254 | } | 2116 | } |
@@ -2305,23 +2167,14 @@ __enqueue_tpd(struct he_dev *he_dev, struct he_tpd *tpd, unsigned cid) | |||
2305 | dev_kfree_skb_any(tpd->skb); | 2167 | dev_kfree_skb_any(tpd->skb); |
2306 | atomic_inc(&tpd->vcc->stats->tx_err); | 2168 | atomic_inc(&tpd->vcc->stats->tx_err); |
2307 | } | 2169 | } |
2308 | #ifdef USE_TPD_POOL | ||
2309 | pci_pool_free(he_dev->tpd_pool, tpd, TPD_ADDR(tpd->status)); | 2170 | pci_pool_free(he_dev->tpd_pool, tpd, TPD_ADDR(tpd->status)); |
2310 | #else | ||
2311 | tpd->inuse = 0; | ||
2312 | #endif | ||
2313 | return; | 2171 | return; |
2314 | } | 2172 | } |
2315 | } | 2173 | } |
2316 | 2174 | ||
2317 | /* 2.1.5 transmit packet descriptor ready queue */ | 2175 | /* 2.1.5 transmit packet descriptor ready queue */ |
2318 | #ifdef USE_TPD_POOL | ||
2319 | list_add_tail(&tpd->entry, &he_dev->outstanding_tpds); | 2176 | list_add_tail(&tpd->entry, &he_dev->outstanding_tpds); |
2320 | he_dev->tpdrq_tail->tpd = TPD_ADDR(tpd->status); | 2177 | he_dev->tpdrq_tail->tpd = TPD_ADDR(tpd->status); |
2321 | #else | ||
2322 | he_dev->tpdrq_tail->tpd = he_dev->tpd_base_phys + | ||
2323 | (TPD_INDEX(tpd->status) * sizeof(struct he_tpd)); | ||
2324 | #endif | ||
2325 | he_dev->tpdrq_tail->cid = cid; | 2178 | he_dev->tpdrq_tail->cid = cid; |
2326 | wmb(); | 2179 | wmb(); |
2327 | 2180 | ||
@@ -2511,13 +2364,8 @@ he_open(struct atm_vcc *vcc) | |||
2511 | goto open_failed; | 2364 | goto open_failed; |
2512 | } | 2365 | } |
2513 | 2366 | ||
2514 | #ifdef USE_RBPS | ||
2515 | rsr1 = RSR1_GROUP(0); | 2367 | rsr1 = RSR1_GROUP(0); |
2516 | rsr4 = RSR4_GROUP(0); | 2368 | rsr4 = RSR4_GROUP(0); |
2517 | #else /* !USE_RBPS */ | ||
2518 | rsr1 = RSR1_GROUP(0)|RSR1_RBPL_ONLY; | ||
2519 | rsr4 = RSR4_GROUP(0)|RSR4_RBPL_ONLY; | ||
2520 | #endif /* USE_RBPS */ | ||
2521 | rsr0 = vcc->qos.rxtp.traffic_class == ATM_UBR ? | 2369 | rsr0 = vcc->qos.rxtp.traffic_class == ATM_UBR ? |
2522 | (RSR0_EPD_ENABLE|RSR0_PPD_ENABLE) : 0; | 2370 | (RSR0_EPD_ENABLE|RSR0_PPD_ENABLE) : 0; |
2523 | 2371 | ||
diff --git a/drivers/atm/he.h b/drivers/atm/he.h index b87d6ccabac1..c2983e0d4ec1 100644 --- a/drivers/atm/he.h +++ b/drivers/atm/he.h | |||
@@ -51,8 +51,6 @@ | |||
51 | #define CONFIG_IRQ_SIZE 128 | 51 | #define CONFIG_IRQ_SIZE 128 |
52 | #define CONFIG_IRQ_THRESH (CONFIG_IRQ_SIZE/2) | 52 | #define CONFIG_IRQ_THRESH (CONFIG_IRQ_SIZE/2) |
53 | 53 | ||
54 | #define CONFIG_NUMTPDS 256 | ||
55 | |||
56 | #define CONFIG_TPDRQ_SIZE 512 | 54 | #define CONFIG_TPDRQ_SIZE 512 |
57 | #define TPDRQ_MASK(x) (((unsigned long)(x))&((CONFIG_TPDRQ_SIZE<<3)-1)) | 55 | #define TPDRQ_MASK(x) (((unsigned long)(x))&((CONFIG_TPDRQ_SIZE<<3)-1)) |
58 | 56 | ||
@@ -140,12 +138,7 @@ struct he_tpd { | |||
140 | struct sk_buff *skb; | 138 | struct sk_buff *skb; |
141 | struct atm_vcc *vcc; | 139 | struct atm_vcc *vcc; |
142 | 140 | ||
143 | #ifdef USE_TPD_POOL | ||
144 | struct list_head entry; | 141 | struct list_head entry; |
145 | #else | ||
146 | u32 inuse; | ||
147 | char padding[32 - sizeof(u32) - (2*sizeof(void*))]; | ||
148 | #endif | ||
149 | }; | 142 | }; |
150 | 143 | ||
151 | #define TPD_ALIGNMENT 64 | 144 | #define TPD_ALIGNMENT 64 |
@@ -291,16 +284,9 @@ struct he_dev { | |||
291 | volatile unsigned *irq_tailoffset; | 284 | volatile unsigned *irq_tailoffset; |
292 | int irq_peak; | 285 | int irq_peak; |
293 | 286 | ||
294 | #ifdef USE_TASKLET | ||
295 | struct tasklet_struct tasklet; | 287 | struct tasklet_struct tasklet; |
296 | #endif | ||
297 | #ifdef USE_TPD_POOL | ||
298 | struct pci_pool *tpd_pool; | 288 | struct pci_pool *tpd_pool; |
299 | struct list_head outstanding_tpds; | 289 | struct list_head outstanding_tpds; |
300 | #else | ||
301 | struct he_tpd *tpd_head, *tpd_base, *tpd_end; | ||
302 | dma_addr_t tpd_base_phys; | ||
303 | #endif | ||
304 | 290 | ||
305 | dma_addr_t tpdrq_phys; | 291 | dma_addr_t tpdrq_phys; |
306 | struct he_tpdrq *tpdrq_base, *tpdrq_tail, *tpdrq_head; | 292 | struct he_tpdrq *tpdrq_base, *tpdrq_tail, *tpdrq_head; |
@@ -311,25 +297,13 @@ struct he_dev { | |||
311 | struct he_rbrq *rbrq_base, *rbrq_head; | 297 | struct he_rbrq *rbrq_base, *rbrq_head; |
312 | int rbrq_peak; | 298 | int rbrq_peak; |
313 | 299 | ||
314 | #ifdef USE_RBPL_POOL | ||
315 | struct pci_pool *rbpl_pool; | 300 | struct pci_pool *rbpl_pool; |
316 | #else | ||
317 | void *rbpl_pages; | ||
318 | dma_addr_t rbpl_pages_phys; | ||
319 | #endif | ||
320 | dma_addr_t rbpl_phys; | 301 | dma_addr_t rbpl_phys; |
321 | struct he_rbp *rbpl_base, *rbpl_tail; | 302 | struct he_rbp *rbpl_base, *rbpl_tail; |
322 | struct he_virt *rbpl_virt; | 303 | struct he_virt *rbpl_virt; |
323 | int rbpl_peak; | 304 | int rbpl_peak; |
324 | 305 | ||
325 | #ifdef USE_RBPS | ||
326 | #ifdef USE_RBPS_POOL | ||
327 | struct pci_pool *rbps_pool; | 306 | struct pci_pool *rbps_pool; |
328 | #else | ||
329 | void *rbps_pages; | ||
330 | dma_addr_t rbps_pages_phys; | ||
331 | #endif | ||
332 | #endif | ||
333 | dma_addr_t rbps_phys; | 307 | dma_addr_t rbps_phys; |
334 | struct he_rbp *rbps_base, *rbps_tail; | 308 | struct he_rbp *rbps_base, *rbps_tail; |
335 | struct he_virt *rbps_virt; | 309 | struct he_virt *rbps_virt; |