diff options
author | Brice Goglin <brice@myri.com> | 2006-06-08 10:25:00 -0400 |
---|---|---|
committer | Jeff Garzik <jeff@garzik.org> | 2006-06-08 15:25:22 -0400 |
commit | b10c066823c97c0e40989b2048540e85f5190501 (patch) | |
tree | 6e1dae7c49b009a21ceb0407188d4432fe009e15 /drivers/net/myri10ge | |
parent | d15a88fc21ef225768ce31be16edfc9c6e2e02e3 (diff) |
[PATCH] myri10ge update
The following patch updates the myri10ge to 1.0.0, with the following changes:
* Switch to dma_alloc_coherent API.
* Avoid PCI burst when writing the firmware on chipset with unaligned completions.
* Use ethtool_op_set_tx_hw_csum instead of ethtool_op_set_tx_csum.
* Include linux/dma-mapping.h to bring DMA_32/64BIT_MASK on all architectures
(was missing at least on alpha).
* Some typo and warning fixes.
Signed-off-by: Brice Goglin <brice@myri.com>
Signed-off-by: Andrew J. Gallatin <gallatin@myri.com>
drivers/net/myri10ge/myri10ge.c | 57 +++++++++++++++++++-----------
1 file changed, 37 insertions(+), 20 deletions(-)
Signed-off-by: Jeff Garzik <jeff@garzik.org>
Diffstat (limited to 'drivers/net/myri10ge')
-rw-r--r-- | drivers/net/myri10ge/myri10ge.c | 58 |
1 files changed, 38 insertions, 20 deletions
diff --git a/drivers/net/myri10ge/myri10ge.c b/drivers/net/myri10ge/myri10ge.c index 87933cba7e22..e1feb58bd661 100644 --- a/drivers/net/myri10ge/myri10ge.c +++ b/drivers/net/myri10ge/myri10ge.c | |||
@@ -44,6 +44,7 @@ | |||
44 | #include <linux/string.h> | 44 | #include <linux/string.h> |
45 | #include <linux/module.h> | 45 | #include <linux/module.h> |
46 | #include <linux/pci.h> | 46 | #include <linux/pci.h> |
47 | #include <linux/dma-mapping.h> | ||
47 | #include <linux/etherdevice.h> | 48 | #include <linux/etherdevice.h> |
48 | #include <linux/if_ether.h> | 49 | #include <linux/if_ether.h> |
49 | #include <linux/if_vlan.h> | 50 | #include <linux/if_vlan.h> |
@@ -62,7 +63,6 @@ | |||
62 | #include <net/checksum.h> | 63 | #include <net/checksum.h> |
63 | #include <asm/byteorder.h> | 64 | #include <asm/byteorder.h> |
64 | #include <asm/io.h> | 65 | #include <asm/io.h> |
65 | #include <asm/pci.h> | ||
66 | #include <asm/processor.h> | 66 | #include <asm/processor.h> |
67 | #ifdef CONFIG_MTRR | 67 | #ifdef CONFIG_MTRR |
68 | #include <asm/mtrr.h> | 68 | #include <asm/mtrr.h> |
@@ -71,7 +71,7 @@ | |||
71 | #include "myri10ge_mcp.h" | 71 | #include "myri10ge_mcp.h" |
72 | #include "myri10ge_mcp_gen_header.h" | 72 | #include "myri10ge_mcp_gen_header.h" |
73 | 73 | ||
74 | #define MYRI10GE_VERSION_STR "0.9.0" | 74 | #define MYRI10GE_VERSION_STR "1.0.0" |
75 | 75 | ||
76 | MODULE_DESCRIPTION("Myricom 10G driver (10GbE)"); | 76 | MODULE_DESCRIPTION("Myricom 10G driver (10GbE)"); |
77 | MODULE_AUTHOR("Maintainer: help@myri.com"); | 77 | MODULE_AUTHOR("Maintainer: help@myri.com"); |
@@ -480,7 +480,19 @@ static int myri10ge_load_hotplug_firmware(struct myri10ge_priv *mgp, u32 * size) | |||
480 | goto abort_with_fw; | 480 | goto abort_with_fw; |
481 | 481 | ||
482 | crc = crc32(~0, fw->data, fw->size); | 482 | crc = crc32(~0, fw->data, fw->size); |
483 | memcpy_toio(mgp->sram + MYRI10GE_FW_OFFSET, fw->data, fw->size); | 483 | if (mgp->tx.boundary == 2048) { |
484 | /* Avoid PCI burst on chipset with unaligned completions. */ | ||
485 | int i; | ||
486 | __iomem u32 *ptr = (__iomem u32 *) (mgp->sram + | ||
487 | MYRI10GE_FW_OFFSET); | ||
488 | for (i = 0; i < fw->size / 4; i++) { | ||
489 | __raw_writel(((u32 *) fw->data)[i], ptr + i); | ||
490 | wmb(); | ||
491 | } | ||
492 | } else { | ||
493 | myri10ge_pio_copy(mgp->sram + MYRI10GE_FW_OFFSET, fw->data, | ||
494 | fw->size); | ||
495 | } | ||
484 | /* corruption checking is good for parity recovery and buggy chipset */ | 496 | /* corruption checking is good for parity recovery and buggy chipset */ |
485 | memcpy_fromio(fw->data, mgp->sram + MYRI10GE_FW_OFFSET, fw->size); | 497 | memcpy_fromio(fw->data, mgp->sram + MYRI10GE_FW_OFFSET, fw->size); |
486 | reread_crc = crc32(~0, fw->data, fw->size); | 498 | reread_crc = crc32(~0, fw->data, fw->size); |
@@ -536,6 +548,7 @@ static int myri10ge_load_firmware(struct myri10ge_priv *mgp) | |||
536 | u32 dma_low, dma_high, size; | 548 | u32 dma_low, dma_high, size; |
537 | int status, i; | 549 | int status, i; |
538 | 550 | ||
551 | size = 0; | ||
539 | status = myri10ge_load_hotplug_firmware(mgp, &size); | 552 | status = myri10ge_load_hotplug_firmware(mgp, &size); |
540 | if (status) { | 553 | if (status) { |
541 | dev_warn(&mgp->pdev->dev, "hotplug firmware loading failed\n"); | 554 | dev_warn(&mgp->pdev->dev, "hotplug firmware loading failed\n"); |
@@ -778,7 +791,7 @@ myri10ge_submit_8rx(struct mcp_kreq_ether_recv __iomem * dst, | |||
778 | } | 791 | } |
779 | 792 | ||
780 | /* | 793 | /* |
781 | * Set of routunes to get a new receive buffer. Any buffer which | 794 | * Set of routines to get a new receive buffer. Any buffer which |
782 | * crosses a 4KB boundary must start on a 4KB boundary due to PCIe | 795 | * crosses a 4KB boundary must start on a 4KB boundary due to PCIe |
783 | * wdma restrictions. We also try to align any smaller allocation to | 796 | * wdma restrictions. We also try to align any smaller allocation to |
784 | * at least a 16 byte boundary for efficiency. We assume the linux | 797 | * at least a 16 byte boundary for efficiency. We assume the linux |
@@ -1349,7 +1362,7 @@ static struct ethtool_ops myri10ge_ethtool_ops = { | |||
1349 | .get_rx_csum = myri10ge_get_rx_csum, | 1362 | .get_rx_csum = myri10ge_get_rx_csum, |
1350 | .set_rx_csum = myri10ge_set_rx_csum, | 1363 | .set_rx_csum = myri10ge_set_rx_csum, |
1351 | .get_tx_csum = ethtool_op_get_tx_csum, | 1364 | .get_tx_csum = ethtool_op_get_tx_csum, |
1352 | .set_tx_csum = ethtool_op_set_tx_csum, | 1365 | .set_tx_csum = ethtool_op_set_tx_hw_csum, |
1353 | .get_sg = ethtool_op_get_sg, | 1366 | .get_sg = ethtool_op_get_sg, |
1354 | .set_sg = ethtool_op_set_sg, | 1367 | .set_sg = ethtool_op_set_sg, |
1355 | #ifdef NETIF_F_TSO | 1368 | #ifdef NETIF_F_TSO |
@@ -2615,12 +2628,13 @@ static int myri10ge_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
2615 | dev_err(&pdev->dev, "Error %d setting DMA mask\n", status); | 2628 | dev_err(&pdev->dev, "Error %d setting DMA mask\n", status); |
2616 | goto abort_with_netdev; | 2629 | goto abort_with_netdev; |
2617 | } | 2630 | } |
2618 | mgp->cmd = pci_alloc_consistent(pdev, sizeof(*mgp->cmd), &mgp->cmd_bus); | 2631 | mgp->cmd = dma_alloc_coherent(&pdev->dev, sizeof(*mgp->cmd), |
2632 | &mgp->cmd_bus, GFP_KERNEL); | ||
2619 | if (mgp->cmd == NULL) | 2633 | if (mgp->cmd == NULL) |
2620 | goto abort_with_netdev; | 2634 | goto abort_with_netdev; |
2621 | 2635 | ||
2622 | mgp->fw_stats = pci_alloc_consistent(pdev, sizeof(*mgp->fw_stats), | 2636 | mgp->fw_stats = dma_alloc_coherent(&pdev->dev, sizeof(*mgp->fw_stats), |
2623 | &mgp->fw_stats_bus); | 2637 | &mgp->fw_stats_bus, GFP_KERNEL); |
2624 | if (mgp->fw_stats == NULL) | 2638 | if (mgp->fw_stats == NULL) |
2625 | goto abort_with_cmd; | 2639 | goto abort_with_cmd; |
2626 | 2640 | ||
@@ -2659,8 +2673,8 @@ static int myri10ge_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
2659 | 2673 | ||
2660 | /* allocate rx done ring */ | 2674 | /* allocate rx done ring */ |
2661 | bytes = myri10ge_max_intr_slots * sizeof(*mgp->rx_done.entry); | 2675 | bytes = myri10ge_max_intr_slots * sizeof(*mgp->rx_done.entry); |
2662 | mgp->rx_done.entry = | 2676 | mgp->rx_done.entry = dma_alloc_coherent(&pdev->dev, bytes, |
2663 | pci_alloc_consistent(pdev, bytes, &mgp->rx_done.bus); | 2677 | &mgp->rx_done.bus, GFP_KERNEL); |
2664 | if (mgp->rx_done.entry == NULL) | 2678 | if (mgp->rx_done.entry == NULL) |
2665 | goto abort_with_ioremap; | 2679 | goto abort_with_ioremap; |
2666 | memset(mgp->rx_done.entry, 0, bytes); | 2680 | memset(mgp->rx_done.entry, 0, bytes); |
@@ -2750,7 +2764,8 @@ abort_with_firmware: | |||
2750 | 2764 | ||
2751 | abort_with_rx_done: | 2765 | abort_with_rx_done: |
2752 | bytes = myri10ge_max_intr_slots * sizeof(*mgp->rx_done.entry); | 2766 | bytes = myri10ge_max_intr_slots * sizeof(*mgp->rx_done.entry); |
2753 | pci_free_consistent(pdev, bytes, mgp->rx_done.entry, mgp->rx_done.bus); | 2767 | dma_free_coherent(&pdev->dev, bytes, |
2768 | mgp->rx_done.entry, mgp->rx_done.bus); | ||
2754 | 2769 | ||
2755 | abort_with_ioremap: | 2770 | abort_with_ioremap: |
2756 | iounmap(mgp->sram); | 2771 | iounmap(mgp->sram); |
@@ -2760,11 +2775,12 @@ abort_with_wc: | |||
2760 | if (mgp->mtrr >= 0) | 2775 | if (mgp->mtrr >= 0) |
2761 | mtrr_del(mgp->mtrr, mgp->iomem_base, mgp->board_span); | 2776 | mtrr_del(mgp->mtrr, mgp->iomem_base, mgp->board_span); |
2762 | #endif | 2777 | #endif |
2763 | pci_free_consistent(pdev, sizeof(*mgp->fw_stats), | 2778 | dma_free_coherent(&pdev->dev, sizeof(*mgp->fw_stats), |
2764 | mgp->fw_stats, mgp->fw_stats_bus); | 2779 | mgp->fw_stats, mgp->fw_stats_bus); |
2765 | 2780 | ||
2766 | abort_with_cmd: | 2781 | abort_with_cmd: |
2767 | pci_free_consistent(pdev, sizeof(*mgp->cmd), mgp->cmd, mgp->cmd_bus); | 2782 | dma_free_coherent(&pdev->dev, sizeof(*mgp->cmd), |
2783 | mgp->cmd, mgp->cmd_bus); | ||
2768 | 2784 | ||
2769 | abort_with_netdev: | 2785 | abort_with_netdev: |
2770 | 2786 | ||
@@ -2799,7 +2815,8 @@ static void myri10ge_remove(struct pci_dev *pdev) | |||
2799 | myri10ge_dummy_rdma(mgp, 0); | 2815 | myri10ge_dummy_rdma(mgp, 0); |
2800 | 2816 | ||
2801 | bytes = myri10ge_max_intr_slots * sizeof(*mgp->rx_done.entry); | 2817 | bytes = myri10ge_max_intr_slots * sizeof(*mgp->rx_done.entry); |
2802 | pci_free_consistent(pdev, bytes, mgp->rx_done.entry, mgp->rx_done.bus); | 2818 | dma_free_coherent(&pdev->dev, bytes, |
2819 | mgp->rx_done.entry, mgp->rx_done.bus); | ||
2803 | 2820 | ||
2804 | iounmap(mgp->sram); | 2821 | iounmap(mgp->sram); |
2805 | 2822 | ||
@@ -2807,19 +2824,20 @@ static void myri10ge_remove(struct pci_dev *pdev) | |||
2807 | if (mgp->mtrr >= 0) | 2824 | if (mgp->mtrr >= 0) |
2808 | mtrr_del(mgp->mtrr, mgp->iomem_base, mgp->board_span); | 2825 | mtrr_del(mgp->mtrr, mgp->iomem_base, mgp->board_span); |
2809 | #endif | 2826 | #endif |
2810 | pci_free_consistent(pdev, sizeof(*mgp->fw_stats), | 2827 | dma_free_coherent(&pdev->dev, sizeof(*mgp->fw_stats), |
2811 | mgp->fw_stats, mgp->fw_stats_bus); | 2828 | mgp->fw_stats, mgp->fw_stats_bus); |
2812 | 2829 | ||
2813 | pci_free_consistent(pdev, sizeof(*mgp->cmd), mgp->cmd, mgp->cmd_bus); | 2830 | dma_free_coherent(&pdev->dev, sizeof(*mgp->cmd), |
2831 | mgp->cmd, mgp->cmd_bus); | ||
2814 | 2832 | ||
2815 | free_netdev(netdev); | 2833 | free_netdev(netdev); |
2816 | pci_set_drvdata(pdev, NULL); | 2834 | pci_set_drvdata(pdev, NULL); |
2817 | } | 2835 | } |
2818 | 2836 | ||
2819 | #define PCI_DEVICE_ID_MYIRCOM_MYRI10GE_Z8E 0x0008 | 2837 | #define PCI_DEVICE_ID_MYRICOM_MYRI10GE_Z8E 0x0008 |
2820 | 2838 | ||
2821 | static struct pci_device_id myri10ge_pci_tbl[] = { | 2839 | static struct pci_device_id myri10ge_pci_tbl[] = { |
2822 | {PCI_DEVICE(PCI_VENDOR_ID_MYRICOM, PCI_DEVICE_ID_MYIRCOM_MYRI10GE_Z8E)}, | 2840 | {PCI_DEVICE(PCI_VENDOR_ID_MYRICOM, PCI_DEVICE_ID_MYRICOM_MYRI10GE_Z8E)}, |
2823 | {0}, | 2841 | {0}, |
2824 | }; | 2842 | }; |
2825 | 2843 | ||