diff options
author | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-07-24 18:58:15 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-07-24 18:58:15 -0400 |
commit | 7742c0bc8594cf1bcbad1f3e876acae5b644dc7b (patch) | |
tree | 07b18d979b1fbd6dab540a686206c3ed43b3171c | |
parent | 9e72ea82e62dd714bc11ed29bfe09a7fc8ac24fe (diff) | |
parent | 88accb498fc92998d7b30b7515ba39f3e6070978 (diff) |
Merge branch 'upstream-linus' of master.kernel.org:/pub/scm/linux/kernel/git/jgarzik/netdev-2.6
* 'upstream-linus' of master.kernel.org:/pub/scm/linux/kernel/git/jgarzik/netdev-2.6: (26 commits)
netdev: i82596 Ethernet needs <asm/cacheflush.h>
forcedeth: mcp73 device addition
forcedeth: new device ids in pci_ids.h
atl1: make atl1_init_ring_ptrs static
eHEA: net_poll support
drivers/net/acenic.c: fix check-after-use
defxx: Use __maybe_unused rather than a local hack
Fix error checking in Vitesse IRQ config
ps3: reduce allocation size of rx skb buffers
atl1: use kernel provided ethernet length constants
atl1: fix typo in dma_req_block
atl1: change cmb write threshold
atl1: fix typo in DMA engine setup
atl1: change tpd_avail function name
ps3: fix rare issue that reenabling rx DMA fails
ps3: removed calling netif_poll_enable() in open()
ps3: use ethX as the name of irq
ps3: use net_device_stats of net_device structure
ps3: removed conditional ethtool support
ps3: removed defines no longer used
...
-rw-r--r-- | drivers/net/82596.c | 1 | ||||
-rw-r--r-- | drivers/net/Makefile | 2 | ||||
-rw-r--r-- | drivers/net/acenic.c | 6 | ||||
-rw-r--r-- | drivers/net/atl1/atl1_hw.h | 9 | ||||
-rw-r--r-- | drivers/net/atl1/atl1_main.c | 28 | ||||
-rw-r--r-- | drivers/net/defxx.c | 17 | ||||
-rw-r--r-- | drivers/net/ehea/ehea.h | 2 | ||||
-rw-r--r-- | drivers/net/ehea/ehea_main.c | 22 | ||||
-rw-r--r-- | drivers/net/forcedeth.c | 16 | ||||
-rw-r--r-- | drivers/net/netxen/netxen_nic.h | 3 | ||||
-rw-r--r-- | drivers/net/netxen/netxen_nic_main.c | 48 | ||||
-rw-r--r-- | drivers/net/phy/vitesse.c | 2 | ||||
-rw-r--r-- | drivers/net/ps3_gelic_net.c | 215 | ||||
-rw-r--r-- | drivers/net/ps3_gelic_net.h | 24 | ||||
-rw-r--r-- | drivers/net/ucc_geth.c | 334 | ||||
-rw-r--r-- | drivers/net/ucc_geth.h | 6 | ||||
-rw-r--r-- | drivers/net/ucc_geth_ethtool.c | 388 | ||||
-rw-r--r-- | drivers/net/ucc_geth_mii.c | 6 | ||||
-rw-r--r-- | include/linux/pci_ids.h | 4 |
19 files changed, 824 insertions, 309 deletions
diff --git a/drivers/net/82596.c b/drivers/net/82596.c index 3ff1155459a3..d915837193cc 100644 --- a/drivers/net/82596.c +++ b/drivers/net/82596.c | |||
@@ -57,6 +57,7 @@ | |||
57 | #include <asm/io.h> | 57 | #include <asm/io.h> |
58 | #include <asm/dma.h> | 58 | #include <asm/dma.h> |
59 | #include <asm/pgtable.h> | 59 | #include <asm/pgtable.h> |
60 | #include <asm/cacheflush.h> | ||
60 | 61 | ||
61 | static char version[] __initdata = | 62 | static char version[] __initdata = |
62 | "82596.c $Revision: 1.5 $\n"; | 63 | "82596.c $Revision: 1.5 $\n"; |
diff --git a/drivers/net/Makefile b/drivers/net/Makefile index 336af0635df8..94b78cc5fe86 100644 --- a/drivers/net/Makefile +++ b/drivers/net/Makefile | |||
@@ -18,7 +18,7 @@ gianfar_driver-objs := gianfar.o \ | |||
18 | gianfar_sysfs.o | 18 | gianfar_sysfs.o |
19 | 19 | ||
20 | obj-$(CONFIG_UCC_GETH) += ucc_geth_driver.o | 20 | obj-$(CONFIG_UCC_GETH) += ucc_geth_driver.o |
21 | ucc_geth_driver-objs := ucc_geth.o ucc_geth_mii.o | 21 | ucc_geth_driver-objs := ucc_geth.o ucc_geth_mii.o ucc_geth_ethtool.o |
22 | 22 | ||
23 | # | 23 | # |
24 | # link order important here | 24 | # link order important here |
diff --git a/drivers/net/acenic.c b/drivers/net/acenic.c index b78a4e5ceeb2..62e660a79387 100644 --- a/drivers/net/acenic.c +++ b/drivers/net/acenic.c | |||
@@ -3128,12 +3128,6 @@ static int __devinit read_eeprom_byte(struct net_device *dev, | |||
3128 | int result = 0; | 3128 | int result = 0; |
3129 | short i; | 3129 | short i; |
3130 | 3130 | ||
3131 | if (!dev) { | ||
3132 | printk(KERN_ERR "No device!\n"); | ||
3133 | result = -ENODEV; | ||
3134 | goto out; | ||
3135 | } | ||
3136 | |||
3137 | /* | 3131 | /* |
3138 | * Don't take interrupts on this CPU will bit banging | 3132 | * Don't take interrupts on this CPU will bit banging |
3139 | * the %#%#@$ I2C device | 3133 | * the %#%#@$ I2C device |
diff --git a/drivers/net/atl1/atl1_hw.h b/drivers/net/atl1/atl1_hw.h index 100c09c66e64..939aa0f53f6e 100644 --- a/drivers/net/atl1/atl1_hw.h +++ b/drivers/net/atl1/atl1_hw.h | |||
@@ -680,11 +680,6 @@ void atl1_check_options(struct atl1_adapter *adapter); | |||
680 | #define AUTONEG_ADVERTISE_10_100_ALL 0x000F /* All 10/100 speeds */ | 680 | #define AUTONEG_ADVERTISE_10_100_ALL 0x000F /* All 10/100 speeds */ |
681 | #define AUTONEG_ADVERTISE_10_ALL 0x0003 /* 10Mbps Full & Half speeds */ | 681 | #define AUTONEG_ADVERTISE_10_ALL 0x0003 /* 10Mbps Full & Half speeds */ |
682 | 682 | ||
683 | /* The size (in bytes) of a ethernet packet */ | ||
684 | #define ENET_HEADER_SIZE 14 | ||
685 | #define MAXIMUM_ETHERNET_FRAME_SIZE 1518 /* with FCS */ | ||
686 | #define MINIMUM_ETHERNET_FRAME_SIZE 64 /* with FCS */ | ||
687 | #define ETHERNET_FCS_SIZE 4 | ||
688 | #define MAX_JUMBO_FRAME_SIZE 0x2800 | 683 | #define MAX_JUMBO_FRAME_SIZE 0x2800 |
689 | 684 | ||
690 | #define PHY_AUTO_NEG_TIME 45 /* 4.5 Seconds */ | 685 | #define PHY_AUTO_NEG_TIME 45 /* 4.5 Seconds */ |
@@ -929,8 +924,8 @@ enum atl1_dma_req_block { | |||
929 | atl1_dma_req_128 = 0, | 924 | atl1_dma_req_128 = 0, |
930 | atl1_dma_req_256 = 1, | 925 | atl1_dma_req_256 = 1, |
931 | atl1_dma_req_512 = 2, | 926 | atl1_dma_req_512 = 2, |
932 | atl1_dam_req_1024 = 3, | 927 | atl1_dma_req_1024 = 3, |
933 | atl1_dam_req_2048 = 4, | 928 | atl1_dma_req_2048 = 4, |
934 | atl1_dma_req_4096 = 5 | 929 | atl1_dma_req_4096 = 5 |
935 | }; | 930 | }; |
936 | 931 | ||
diff --git a/drivers/net/atl1/atl1_main.c b/drivers/net/atl1/atl1_main.c index fd1e156f1747..56f6389a300e 100644 --- a/drivers/net/atl1/atl1_main.c +++ b/drivers/net/atl1/atl1_main.c | |||
@@ -59,6 +59,7 @@ | |||
59 | #include <linux/skbuff.h> | 59 | #include <linux/skbuff.h> |
60 | #include <linux/etherdevice.h> | 60 | #include <linux/etherdevice.h> |
61 | #include <linux/if_vlan.h> | 61 | #include <linux/if_vlan.h> |
62 | #include <linux/if_ether.h> | ||
62 | #include <linux/irqreturn.h> | 63 | #include <linux/irqreturn.h> |
63 | #include <linux/workqueue.h> | 64 | #include <linux/workqueue.h> |
64 | #include <linux/timer.h> | 65 | #include <linux/timer.h> |
@@ -120,8 +121,8 @@ static int __devinit atl1_sw_init(struct atl1_adapter *adapter) | |||
120 | struct atl1_hw *hw = &adapter->hw; | 121 | struct atl1_hw *hw = &adapter->hw; |
121 | struct net_device *netdev = adapter->netdev; | 122 | struct net_device *netdev = adapter->netdev; |
122 | 123 | ||
123 | hw->max_frame_size = netdev->mtu + ENET_HEADER_SIZE + ETHERNET_FCS_SIZE; | 124 | hw->max_frame_size = netdev->mtu + ETH_HLEN + ETH_FCS_LEN; |
124 | hw->min_frame_size = MINIMUM_ETHERNET_FRAME_SIZE; | 125 | hw->min_frame_size = ETH_ZLEN + ETH_FCS_LEN; |
125 | 126 | ||
126 | adapter->wol = 0; | 127 | adapter->wol = 0; |
127 | adapter->rx_buffer_len = (hw->max_frame_size + 7) & ~7; | 128 | adapter->rx_buffer_len = (hw->max_frame_size + 7) & ~7; |
@@ -314,7 +315,7 @@ err_nomem: | |||
314 | return -ENOMEM; | 315 | return -ENOMEM; |
315 | } | 316 | } |
316 | 317 | ||
317 | void atl1_init_ring_ptrs(struct atl1_adapter *adapter) | 318 | static void atl1_init_ring_ptrs(struct atl1_adapter *adapter) |
318 | { | 319 | { |
319 | struct atl1_tpd_ring *tpd_ring = &adapter->tpd_ring; | 320 | struct atl1_tpd_ring *tpd_ring = &adapter->tpd_ring; |
320 | struct atl1_rfd_ring *rfd_ring = &adapter->rfd_ring; | 321 | struct atl1_rfd_ring *rfd_ring = &adapter->rfd_ring; |
@@ -688,9 +689,9 @@ static int atl1_change_mtu(struct net_device *netdev, int new_mtu) | |||
688 | { | 689 | { |
689 | struct atl1_adapter *adapter = netdev_priv(netdev); | 690 | struct atl1_adapter *adapter = netdev_priv(netdev); |
690 | int old_mtu = netdev->mtu; | 691 | int old_mtu = netdev->mtu; |
691 | int max_frame = new_mtu + ENET_HEADER_SIZE + ETHERNET_FCS_SIZE; | 692 | int max_frame = new_mtu + ETH_HLEN + ETH_FCS_LEN; |
692 | 693 | ||
693 | if ((max_frame < MINIMUM_ETHERNET_FRAME_SIZE) || | 694 | if ((max_frame < ETH_ZLEN + ETH_FCS_LEN) || |
694 | (max_frame > MAX_JUMBO_FRAME_SIZE)) { | 695 | (max_frame > MAX_JUMBO_FRAME_SIZE)) { |
695 | dev_warn(&adapter->pdev->dev, "invalid MTU setting\n"); | 696 | dev_warn(&adapter->pdev->dev, "invalid MTU setting\n"); |
696 | return -EINVAL; | 697 | return -EINVAL; |
@@ -908,8 +909,8 @@ static u32 atl1_configure(struct atl1_adapter *adapter) | |||
908 | /* config DMA Engine */ | 909 | /* config DMA Engine */ |
909 | value = ((((u32) hw->dmar_block) & DMA_CTRL_DMAR_BURST_LEN_MASK) | 910 | value = ((((u32) hw->dmar_block) & DMA_CTRL_DMAR_BURST_LEN_MASK) |
910 | << DMA_CTRL_DMAR_BURST_LEN_SHIFT) | | 911 | << DMA_CTRL_DMAR_BURST_LEN_SHIFT) | |
911 | ((((u32) hw->dmaw_block) & DMA_CTRL_DMAR_BURST_LEN_MASK) | 912 | ((((u32) hw->dmaw_block) & DMA_CTRL_DMAW_BURST_LEN_MASK) |
912 | << DMA_CTRL_DMAR_BURST_LEN_SHIFT) | DMA_CTRL_DMAR_EN | | 913 | << DMA_CTRL_DMAW_BURST_LEN_SHIFT) | DMA_CTRL_DMAR_EN | |
913 | DMA_CTRL_DMAW_EN; | 914 | DMA_CTRL_DMAW_EN; |
914 | value |= (u32) hw->dma_ord; | 915 | value |= (u32) hw->dma_ord; |
915 | if (atl1_rcb_128 == hw->rcb_value) | 916 | if (atl1_rcb_128 == hw->rcb_value) |
@@ -917,7 +918,10 @@ static u32 atl1_configure(struct atl1_adapter *adapter) | |||
917 | iowrite32(value, hw->hw_addr + REG_DMA_CTRL); | 918 | iowrite32(value, hw->hw_addr + REG_DMA_CTRL); |
918 | 919 | ||
919 | /* config CMB / SMB */ | 920 | /* config CMB / SMB */ |
920 | value = hw->cmb_rrd | ((u32) hw->cmb_tpd << 16); | 921 | value = (hw->cmb_tpd > adapter->tpd_ring.count) ? |
922 | hw->cmb_tpd : adapter->tpd_ring.count; | ||
923 | value <<= 16; | ||
924 | value |= hw->cmb_rrd; | ||
921 | iowrite32(value, hw->hw_addr + REG_CMB_WRITE_TH); | 925 | iowrite32(value, hw->hw_addr + REG_CMB_WRITE_TH); |
922 | value = hw->cmb_rx_timer | ((u32) hw->cmb_tx_timer << 16); | 926 | value = hw->cmb_rx_timer | ((u32) hw->cmb_tx_timer << 16); |
923 | iowrite32(value, hw->hw_addr + REG_CMB_WRITE_TIMER); | 927 | iowrite32(value, hw->hw_addr + REG_CMB_WRITE_TIMER); |
@@ -1334,7 +1338,7 @@ rrd_ok: | |||
1334 | skb = buffer_info->skb; | 1338 | skb = buffer_info->skb; |
1335 | length = le16_to_cpu(rrd->xsz.xsum_sz.pkt_size); | 1339 | length = le16_to_cpu(rrd->xsz.xsum_sz.pkt_size); |
1336 | 1340 | ||
1337 | skb_put(skb, length - ETHERNET_FCS_SIZE); | 1341 | skb_put(skb, length - ETH_FCS_LEN); |
1338 | 1342 | ||
1339 | /* Receive Checksum Offload */ | 1343 | /* Receive Checksum Offload */ |
1340 | atl1_rx_checksum(adapter, rrd, skb); | 1344 | atl1_rx_checksum(adapter, rrd, skb); |
@@ -1422,7 +1426,7 @@ static void atl1_intr_tx(struct atl1_adapter *adapter) | |||
1422 | netif_wake_queue(adapter->netdev); | 1426 | netif_wake_queue(adapter->netdev); |
1423 | } | 1427 | } |
1424 | 1428 | ||
1425 | static u16 tpd_avail(struct atl1_tpd_ring *tpd_ring) | 1429 | static u16 atl1_tpd_avail(struct atl1_tpd_ring *tpd_ring) |
1426 | { | 1430 | { |
1427 | u16 next_to_clean = atomic_read(&tpd_ring->next_to_clean); | 1431 | u16 next_to_clean = atomic_read(&tpd_ring->next_to_clean); |
1428 | u16 next_to_use = atomic_read(&tpd_ring->next_to_use); | 1432 | u16 next_to_use = atomic_read(&tpd_ring->next_to_use); |
@@ -1453,7 +1457,7 @@ static int atl1_tso(struct atl1_adapter *adapter, struct sk_buff *skb, | |||
1453 | tcp_hdr(skb)->check = ~csum_tcpudp_magic(iph->saddr, | 1457 | tcp_hdr(skb)->check = ~csum_tcpudp_magic(iph->saddr, |
1454 | iph->daddr, 0, IPPROTO_TCP, 0); | 1458 | iph->daddr, 0, IPPROTO_TCP, 0); |
1455 | ipofst = skb_network_offset(skb); | 1459 | ipofst = skb_network_offset(skb); |
1456 | if (ipofst != ENET_HEADER_SIZE) /* 802.3 frame */ | 1460 | if (ipofst != ETH_HLEN) /* 802.3 frame */ |
1457 | tso->tsopl |= 1 << TSO_PARAM_ETHTYPE_SHIFT; | 1461 | tso->tsopl |= 1 << TSO_PARAM_ETHTYPE_SHIFT; |
1458 | 1462 | ||
1459 | tso->tsopl |= (iph->ihl & | 1463 | tso->tsopl |= (iph->ihl & |
@@ -1708,7 +1712,7 @@ static int atl1_xmit_frame(struct sk_buff *skb, struct net_device *netdev) | |||
1708 | return NETDEV_TX_LOCKED; | 1712 | return NETDEV_TX_LOCKED; |
1709 | } | 1713 | } |
1710 | 1714 | ||
1711 | if (tpd_avail(&adapter->tpd_ring) < count) { | 1715 | if (atl1_tpd_avail(&adapter->tpd_ring) < count) { |
1712 | /* not enough descriptors */ | 1716 | /* not enough descriptors */ |
1713 | netif_stop_queue(netdev); | 1717 | netif_stop_queue(netdev); |
1714 | spin_unlock_irqrestore(&adapter->lock, flags); | 1718 | spin_unlock_irqrestore(&adapter->lock, flags); |
diff --git a/drivers/net/defxx.c b/drivers/net/defxx.c index 7df23dc28190..9c8e3f9f5e58 100644 --- a/drivers/net/defxx.c +++ b/drivers/net/defxx.c | |||
@@ -200,6 +200,7 @@ | |||
200 | 200 | ||
201 | /* Include files */ | 201 | /* Include files */ |
202 | #include <linux/bitops.h> | 202 | #include <linux/bitops.h> |
203 | #include <linux/compiler.h> | ||
203 | #include <linux/delay.h> | 204 | #include <linux/delay.h> |
204 | #include <linux/dma-mapping.h> | 205 | #include <linux/dma-mapping.h> |
205 | #include <linux/eisa.h> | 206 | #include <linux/eisa.h> |
@@ -240,8 +241,6 @@ static char version[] __devinitdata = | |||
240 | */ | 241 | */ |
241 | #define NEW_SKB_SIZE (PI_RCV_DATA_K_SIZE_MAX+128) | 242 | #define NEW_SKB_SIZE (PI_RCV_DATA_K_SIZE_MAX+128) |
242 | 243 | ||
243 | #define __unused __attribute__ ((unused)) | ||
244 | |||
245 | #ifdef CONFIG_PCI | 244 | #ifdef CONFIG_PCI |
246 | #define DFX_BUS_PCI(dev) (dev->bus == &pci_bus_type) | 245 | #define DFX_BUS_PCI(dev) (dev->bus == &pci_bus_type) |
247 | #else | 246 | #else |
@@ -375,7 +374,7 @@ static inline void dfx_outl(DFX_board_t *bp, int offset, u32 data) | |||
375 | 374 | ||
376 | static void dfx_port_write_long(DFX_board_t *bp, int offset, u32 data) | 375 | static void dfx_port_write_long(DFX_board_t *bp, int offset, u32 data) |
377 | { | 376 | { |
378 | struct device __unused *bdev = bp->bus_dev; | 377 | struct device __maybe_unused *bdev = bp->bus_dev; |
379 | int dfx_bus_tc = DFX_BUS_TC(bdev); | 378 | int dfx_bus_tc = DFX_BUS_TC(bdev); |
380 | int dfx_use_mmio = DFX_MMIO || dfx_bus_tc; | 379 | int dfx_use_mmio = DFX_MMIO || dfx_bus_tc; |
381 | 380 | ||
@@ -399,7 +398,7 @@ static inline void dfx_inl(DFX_board_t *bp, int offset, u32 *data) | |||
399 | 398 | ||
400 | static void dfx_port_read_long(DFX_board_t *bp, int offset, u32 *data) | 399 | static void dfx_port_read_long(DFX_board_t *bp, int offset, u32 *data) |
401 | { | 400 | { |
402 | struct device __unused *bdev = bp->bus_dev; | 401 | struct device __maybe_unused *bdev = bp->bus_dev; |
403 | int dfx_bus_tc = DFX_BUS_TC(bdev); | 402 | int dfx_bus_tc = DFX_BUS_TC(bdev); |
404 | int dfx_use_mmio = DFX_MMIO || dfx_bus_tc; | 403 | int dfx_use_mmio = DFX_MMIO || dfx_bus_tc; |
405 | 404 | ||
@@ -866,7 +865,7 @@ static void __devinit dfx_bus_uninit(struct net_device *dev) | |||
866 | 865 | ||
867 | static void __devinit dfx_bus_config_check(DFX_board_t *bp) | 866 | static void __devinit dfx_bus_config_check(DFX_board_t *bp) |
868 | { | 867 | { |
869 | struct device __unused *bdev = bp->bus_dev; | 868 | struct device __maybe_unused *bdev = bp->bus_dev; |
870 | int dfx_bus_eisa = DFX_BUS_EISA(bdev); | 869 | int dfx_bus_eisa = DFX_BUS_EISA(bdev); |
871 | int status; /* return code from adapter port control call */ | 870 | int status; /* return code from adapter port control call */ |
872 | u32 host_data; /* LW data returned from port control call */ | 871 | u32 host_data; /* LW data returned from port control call */ |
@@ -3624,8 +3623,8 @@ static void __devexit dfx_unregister(struct device *bdev) | |||
3624 | } | 3623 | } |
3625 | 3624 | ||
3626 | 3625 | ||
3627 | static int __devinit __unused dfx_dev_register(struct device *); | 3626 | static int __devinit __maybe_unused dfx_dev_register(struct device *); |
3628 | static int __devexit __unused dfx_dev_unregister(struct device *); | 3627 | static int __devexit __maybe_unused dfx_dev_unregister(struct device *); |
3629 | 3628 | ||
3630 | #ifdef CONFIG_PCI | 3629 | #ifdef CONFIG_PCI |
3631 | static int __devinit dfx_pci_register(struct pci_dev *, | 3630 | static int __devinit dfx_pci_register(struct pci_dev *, |
@@ -3699,7 +3698,7 @@ static struct tc_driver dfx_tc_driver = { | |||
3699 | }; | 3698 | }; |
3700 | #endif /* CONFIG_TC */ | 3699 | #endif /* CONFIG_TC */ |
3701 | 3700 | ||
3702 | static int __devinit __unused dfx_dev_register(struct device *dev) | 3701 | static int __devinit __maybe_unused dfx_dev_register(struct device *dev) |
3703 | { | 3702 | { |
3704 | int status; | 3703 | int status; |
3705 | 3704 | ||
@@ -3709,7 +3708,7 @@ static int __devinit __unused dfx_dev_register(struct device *dev) | |||
3709 | return status; | 3708 | return status; |
3710 | } | 3709 | } |
3711 | 3710 | ||
3712 | static int __devexit __unused dfx_dev_unregister(struct device *dev) | 3711 | static int __devexit __maybe_unused dfx_dev_unregister(struct device *dev) |
3713 | { | 3712 | { |
3714 | put_device(dev); | 3713 | put_device(dev); |
3715 | dfx_unregister(dev); | 3714 | dfx_unregister(dev); |
diff --git a/drivers/net/ehea/ehea.h b/drivers/net/ehea/ehea.h index 489c8b260dd8..8ee2c2c86b42 100644 --- a/drivers/net/ehea/ehea.h +++ b/drivers/net/ehea/ehea.h | |||
@@ -39,7 +39,7 @@ | |||
39 | #include <asm/io.h> | 39 | #include <asm/io.h> |
40 | 40 | ||
41 | #define DRV_NAME "ehea" | 41 | #define DRV_NAME "ehea" |
42 | #define DRV_VERSION "EHEA_0071" | 42 | #define DRV_VERSION "EHEA_0072" |
43 | 43 | ||
44 | /* eHEA capability flags */ | 44 | /* eHEA capability flags */ |
45 | #define DLPAR_PORT_ADD_REM 1 | 45 | #define DLPAR_PORT_ADD_REM 1 |
diff --git a/drivers/net/ehea/ehea_main.c b/drivers/net/ehea/ehea_main.c index 4c70a9301c1b..58702f54c3fb 100644 --- a/drivers/net/ehea/ehea_main.c +++ b/drivers/net/ehea/ehea_main.c | |||
@@ -589,6 +589,23 @@ static int ehea_poll(struct net_device *dev, int *budget) | |||
589 | return 1; | 589 | return 1; |
590 | } | 590 | } |
591 | 591 | ||
592 | #ifdef CONFIG_NET_POLL_CONTROLLER | ||
593 | static void ehea_netpoll(struct net_device *dev) | ||
594 | { | ||
595 | struct ehea_port *port = netdev_priv(dev); | ||
596 | |||
597 | netif_rx_schedule(port->port_res[0].d_netdev); | ||
598 | } | ||
599 | #endif | ||
600 | |||
601 | static int ehea_poll_firstqueue(struct net_device *dev, int *budget) | ||
602 | { | ||
603 | struct ehea_port *port = netdev_priv(dev); | ||
604 | struct net_device *d_dev = port->port_res[0].d_netdev; | ||
605 | |||
606 | return ehea_poll(d_dev, budget); | ||
607 | } | ||
608 | |||
592 | static irqreturn_t ehea_recv_irq_handler(int irq, void *param) | 609 | static irqreturn_t ehea_recv_irq_handler(int irq, void *param) |
593 | { | 610 | { |
594 | struct ehea_port_res *pr = param; | 611 | struct ehea_port_res *pr = param; |
@@ -2626,7 +2643,10 @@ struct ehea_port *ehea_setup_single_port(struct ehea_adapter *adapter, | |||
2626 | memcpy(dev->dev_addr, &port->mac_addr, ETH_ALEN); | 2643 | memcpy(dev->dev_addr, &port->mac_addr, ETH_ALEN); |
2627 | 2644 | ||
2628 | dev->open = ehea_open; | 2645 | dev->open = ehea_open; |
2629 | dev->poll = ehea_poll; | 2646 | dev->poll = ehea_poll_firstqueue; |
2647 | #ifdef CONFIG_NET_POLL_CONTROLLER | ||
2648 | dev->poll_controller = ehea_netpoll; | ||
2649 | #endif | ||
2630 | dev->weight = 64; | 2650 | dev->weight = 64; |
2631 | dev->stop = ehea_stop; | 2651 | dev->stop = ehea_stop; |
2632 | dev->hard_start_xmit = ehea_start_xmit; | 2652 | dev->hard_start_xmit = ehea_start_xmit; |
diff --git a/drivers/net/forcedeth.c b/drivers/net/forcedeth.c index 6d1d50a19783..661c747389e4 100644 --- a/drivers/net/forcedeth.c +++ b/drivers/net/forcedeth.c | |||
@@ -5546,6 +5546,22 @@ static struct pci_device_id pci_tbl[] = { | |||
5546 | PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_27), | 5546 | PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_27), |
5547 | .driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_HIGH_DMA|DEV_HAS_POWER_CNTRL|DEV_HAS_MSI|DEV_HAS_PAUSEFRAME_TX|DEV_HAS_STATISTICS_V2|DEV_HAS_TEST_EXTENDED|DEV_HAS_MGMT_UNIT, | 5547 | .driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_HIGH_DMA|DEV_HAS_POWER_CNTRL|DEV_HAS_MSI|DEV_HAS_PAUSEFRAME_TX|DEV_HAS_STATISTICS_V2|DEV_HAS_TEST_EXTENDED|DEV_HAS_MGMT_UNIT, |
5548 | }, | 5548 | }, |
5549 | { /* MCP73 Ethernet Controller */ | ||
5550 | PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_28), | ||
5551 | .driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_HIGH_DMA|DEV_HAS_POWER_CNTRL|DEV_HAS_MSI|DEV_HAS_PAUSEFRAME_TX|DEV_HAS_STATISTICS_V2|DEV_HAS_TEST_EXTENDED|DEV_HAS_MGMT_UNIT, | ||
5552 | }, | ||
5553 | { /* MCP73 Ethernet Controller */ | ||
5554 | PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_29), | ||
5555 | .driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_HIGH_DMA|DEV_HAS_POWER_CNTRL|DEV_HAS_MSI|DEV_HAS_PAUSEFRAME_TX|DEV_HAS_STATISTICS_V2|DEV_HAS_TEST_EXTENDED|DEV_HAS_MGMT_UNIT, | ||
5556 | }, | ||
5557 | { /* MCP73 Ethernet Controller */ | ||
5558 | PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_30), | ||
5559 | .driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_HIGH_DMA|DEV_HAS_POWER_CNTRL|DEV_HAS_MSI|DEV_HAS_PAUSEFRAME_TX|DEV_HAS_STATISTICS_V2|DEV_HAS_TEST_EXTENDED|DEV_HAS_MGMT_UNIT, | ||
5560 | }, | ||
5561 | { /* MCP73 Ethernet Controller */ | ||
5562 | PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_31), | ||
5563 | .driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_HIGH_DMA|DEV_HAS_POWER_CNTRL|DEV_HAS_MSI|DEV_HAS_PAUSEFRAME_TX|DEV_HAS_STATISTICS_V2|DEV_HAS_TEST_EXTENDED|DEV_HAS_MGMT_UNIT, | ||
5564 | }, | ||
5549 | {0,}, | 5565 | {0,}, |
5550 | }; | 5566 | }; |
5551 | 5567 | ||
diff --git a/drivers/net/netxen/netxen_nic.h b/drivers/net/netxen/netxen_nic.h index 325269d8ae38..d4c92cc879d4 100644 --- a/drivers/net/netxen/netxen_nic.h +++ b/drivers/net/netxen/netxen_nic.h | |||
@@ -1179,8 +1179,7 @@ dma_watchdog_shutdown_poll_result(struct netxen_adapter *adapter) | |||
1179 | NETXEN_CAM_RAM(NETXEN_CAM_RAM_DMA_WATCHDOG_CTRL), &ctrl, 4)) | 1179 | NETXEN_CAM_RAM(NETXEN_CAM_RAM_DMA_WATCHDOG_CTRL), &ctrl, 4)) |
1180 | printk(KERN_ERR "failed to read dma watchdog status\n"); | 1180 | printk(KERN_ERR "failed to read dma watchdog status\n"); |
1181 | 1181 | ||
1182 | return ((netxen_get_dma_watchdog_enabled(ctrl) == 0) && | 1182 | return (netxen_get_dma_watchdog_enabled(ctrl) == 0); |
1183 | (netxen_get_dma_watchdog_disabled(ctrl) == 0)); | ||
1184 | } | 1183 | } |
1185 | 1184 | ||
1186 | static inline int | 1185 | static inline int |
diff --git a/drivers/net/netxen/netxen_nic_main.c b/drivers/net/netxen/netxen_nic_main.c index b703ccfe040b..19e2fa940ac0 100644 --- a/drivers/net/netxen/netxen_nic_main.c +++ b/drivers/net/netxen/netxen_nic_main.c | |||
@@ -46,7 +46,7 @@ MODULE_DESCRIPTION("NetXen Multi port (1/10) Gigabit Network Driver"); | |||
46 | MODULE_LICENSE("GPL"); | 46 | MODULE_LICENSE("GPL"); |
47 | MODULE_VERSION(NETXEN_NIC_LINUX_VERSIONID); | 47 | MODULE_VERSION(NETXEN_NIC_LINUX_VERSIONID); |
48 | 48 | ||
49 | char netxen_nic_driver_name[] = "netxen-nic"; | 49 | char netxen_nic_driver_name[] = "netxen_nic"; |
50 | static char netxen_nic_driver_string[] = "NetXen Network Driver version " | 50 | static char netxen_nic_driver_string[] = "NetXen Network Driver version " |
51 | NETXEN_NIC_LINUX_VERSIONID; | 51 | NETXEN_NIC_LINUX_VERSIONID; |
52 | 52 | ||
@@ -640,6 +640,10 @@ netxen_nic_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
640 | NETXEN_CRB_NORMALIZE(adapter, | 640 | NETXEN_CRB_NORMALIZE(adapter, |
641 | NETXEN_ROMUSB_GLB_PEGTUNE_DONE)); | 641 | NETXEN_ROMUSB_GLB_PEGTUNE_DONE)); |
642 | /* Handshake with the card before we register the devices. */ | 642 | /* Handshake with the card before we register the devices. */ |
643 | writel(0, NETXEN_CRB_NORMALIZE(adapter, CRB_CMDPEG_STATE)); | ||
644 | netxen_pinit_from_rom(adapter, 0); | ||
645 | msleep(1); | ||
646 | netxen_load_firmware(adapter); | ||
643 | netxen_phantom_init(adapter, NETXEN_NIC_PEG_TUNE); | 647 | netxen_phantom_init(adapter, NETXEN_NIC_PEG_TUNE); |
644 | } | 648 | } |
645 | 649 | ||
@@ -782,19 +786,18 @@ static void __devexit netxen_nic_remove(struct pci_dev *pdev) | |||
782 | 786 | ||
783 | if (adapter->portnum == 0) { | 787 | if (adapter->portnum == 0) { |
784 | if (init_firmware_done) { | 788 | if (init_firmware_done) { |
785 | dma_watchdog_shutdown_request(adapter); | ||
786 | msleep(100); | ||
787 | i = 100; | 789 | i = 100; |
788 | while ((dma_watchdog_shutdown_poll_result(adapter) != 1) && i) { | 790 | do { |
789 | printk(KERN_INFO "dma_watchdog_shutdown_poll still in progress\n"); | 791 | if (dma_watchdog_shutdown_request(adapter) == 1) |
792 | break; | ||
790 | msleep(100); | 793 | msleep(100); |
791 | i--; | 794 | if (dma_watchdog_shutdown_poll_result(adapter) == 1) |
792 | } | 795 | break; |
796 | } while (--i); | ||
793 | 797 | ||
794 | if (i == 0) { | 798 | if (i == 0) |
795 | printk(KERN_ERR "dma_watchdog_shutdown_request failed\n"); | 799 | printk(KERN_ERR "%s: dma_watchdog_shutdown failed\n", |
796 | return; | 800 | netdev->name); |
797 | } | ||
798 | 801 | ||
799 | /* clear the register for future unloads/loads */ | 802 | /* clear the register for future unloads/loads */ |
800 | writel(0, NETXEN_CRB_NORMALIZE(adapter, NETXEN_CAM_RAM(0x1fc))); | 803 | writel(0, NETXEN_CRB_NORMALIZE(adapter, NETXEN_CAM_RAM(0x1fc))); |
@@ -803,11 +806,9 @@ static void __devexit netxen_nic_remove(struct pci_dev *pdev) | |||
803 | 806 | ||
804 | /* leave the hw in the same state as reboot */ | 807 | /* leave the hw in the same state as reboot */ |
805 | writel(0, NETXEN_CRB_NORMALIZE(adapter, CRB_CMDPEG_STATE)); | 808 | writel(0, NETXEN_CRB_NORMALIZE(adapter, CRB_CMDPEG_STATE)); |
806 | if (netxen_pinit_from_rom(adapter, 0)) | 809 | netxen_pinit_from_rom(adapter, 0); |
807 | return; | ||
808 | msleep(1); | 810 | msleep(1); |
809 | if (netxen_load_firmware(adapter)) | 811 | netxen_load_firmware(adapter); |
810 | return; | ||
811 | netxen_phantom_init(adapter, NETXEN_NIC_PEG_TUNE); | 812 | netxen_phantom_init(adapter, NETXEN_NIC_PEG_TUNE); |
812 | } | 813 | } |
813 | 814 | ||
@@ -816,22 +817,21 @@ static void __devexit netxen_nic_remove(struct pci_dev *pdev) | |||
816 | printk(KERN_INFO "State: 0x%0x\n", | 817 | printk(KERN_INFO "State: 0x%0x\n", |
817 | readl(NETXEN_CRB_NORMALIZE(adapter, CRB_CMDPEG_STATE))); | 818 | readl(NETXEN_CRB_NORMALIZE(adapter, CRB_CMDPEG_STATE))); |
818 | 819 | ||
819 | dma_watchdog_shutdown_request(adapter); | ||
820 | msleep(100); | ||
821 | i = 100; | 820 | i = 100; |
822 | while ((dma_watchdog_shutdown_poll_result(adapter) != 1) && i) { | 821 | do { |
823 | printk(KERN_INFO "dma_watchdog_shutdown_poll still in progress\n"); | 822 | if (dma_watchdog_shutdown_request(adapter) == 1) |
823 | break; | ||
824 | msleep(100); | 824 | msleep(100); |
825 | i--; | 825 | if (dma_watchdog_shutdown_poll_result(adapter) == 1) |
826 | } | 826 | break; |
827 | } while (--i); | ||
827 | 828 | ||
828 | if (i) { | 829 | if (i) { |
829 | netxen_free_adapter_offload(adapter); | 830 | netxen_free_adapter_offload(adapter); |
830 | } else { | 831 | } else { |
831 | printk(KERN_ERR "failed to dma shutdown\n"); | 832 | printk(KERN_ERR "%s: dma_watchdog_shutdown failed\n", |
832 | return; | 833 | netdev->name); |
833 | } | 834 | } |
834 | |||
835 | } | 835 | } |
836 | 836 | ||
837 | iounmap(adapter->ahw.db_base); | 837 | iounmap(adapter->ahw.db_base); |
diff --git a/drivers/net/phy/vitesse.c b/drivers/net/phy/vitesse.c index 6a5385647911..8874497b6bbf 100644 --- a/drivers/net/phy/vitesse.c +++ b/drivers/net/phy/vitesse.c | |||
@@ -109,7 +109,7 @@ static int vsc824x_config_intr(struct phy_device *phydev) | |||
109 | */ | 109 | */ |
110 | err = phy_read(phydev, MII_VSC8244_ISTAT); | 110 | err = phy_read(phydev, MII_VSC8244_ISTAT); |
111 | 111 | ||
112 | if (err) | 112 | if (err < 0) |
113 | return err; | 113 | return err; |
114 | 114 | ||
115 | err = phy_write(phydev, MII_VSC8244_IMASK, 0); | 115 | err = phy_write(phydev, MII_VSC8244_IMASK, 0); |
diff --git a/drivers/net/ps3_gelic_net.c b/drivers/net/ps3_gelic_net.c index 08d25066f051..13d1c0a2a25f 100644 --- a/drivers/net/ps3_gelic_net.c +++ b/drivers/net/ps3_gelic_net.c | |||
@@ -290,7 +290,8 @@ static void gelic_net_release_rx_chain(struct gelic_net_card *card) | |||
290 | descr->buf_addr = 0; | 290 | descr->buf_addr = 0; |
291 | dev_kfree_skb_any(descr->skb); | 291 | dev_kfree_skb_any(descr->skb); |
292 | descr->skb = NULL; | 292 | descr->skb = NULL; |
293 | descr->dmac_cmd_status = GELIC_NET_DESCR_NOT_IN_USE; | 293 | gelic_net_set_descr_status(descr, |
294 | GELIC_NET_DESCR_NOT_IN_USE); | ||
294 | } | 295 | } |
295 | descr = descr->next; | 296 | descr = descr->next; |
296 | } while (descr != card->rx_chain.head); | 297 | } while (descr != card->rx_chain.head); |
@@ -374,7 +375,7 @@ static void gelic_net_release_tx_descr(struct gelic_net_card *card, | |||
374 | descr->skb = NULL; | 375 | descr->skb = NULL; |
375 | 376 | ||
376 | /* set descr status */ | 377 | /* set descr status */ |
377 | descr->dmac_cmd_status = GELIC_NET_DMAC_CMDSTAT_NOT_IN_USE; | 378 | gelic_net_set_descr_status(descr, GELIC_NET_DESCR_NOT_IN_USE); |
378 | } | 379 | } |
379 | 380 | ||
380 | /** | 381 | /** |
@@ -403,26 +404,29 @@ static void gelic_net_release_tx_chain(struct gelic_net_card *card, int stop) | |||
403 | "%s: forcing end of tx descriptor " \ | 404 | "%s: forcing end of tx descriptor " \ |
404 | "with status %x\n", | 405 | "with status %x\n", |
405 | __func__, status); | 406 | __func__, status); |
406 | card->netdev_stats.tx_dropped++; | 407 | card->netdev->stats.tx_dropped++; |
407 | break; | 408 | break; |
408 | 409 | ||
409 | case GELIC_NET_DESCR_COMPLETE: | 410 | case GELIC_NET_DESCR_COMPLETE: |
410 | card->netdev_stats.tx_packets++; | 411 | if (tx_chain->tail->skb) { |
411 | card->netdev_stats.tx_bytes += | 412 | card->netdev->stats.tx_packets++; |
412 | tx_chain->tail->skb->len; | 413 | card->netdev->stats.tx_bytes += |
414 | tx_chain->tail->skb->len; | ||
415 | } | ||
413 | break; | 416 | break; |
414 | 417 | ||
415 | case GELIC_NET_DESCR_CARDOWNED: | 418 | case GELIC_NET_DESCR_CARDOWNED: |
416 | /* pending tx request */ | 419 | /* pending tx request */ |
417 | default: | 420 | default: |
418 | /* any other value (== GELIC_NET_DESCR_NOT_IN_USE) */ | 421 | /* any other value (== GELIC_NET_DESCR_NOT_IN_USE) */ |
419 | goto out; | 422 | if (!stop) |
423 | goto out; | ||
420 | } | 424 | } |
421 | gelic_net_release_tx_descr(card, tx_chain->tail); | 425 | gelic_net_release_tx_descr(card, tx_chain->tail); |
422 | release = 1; | 426 | release ++; |
423 | } | 427 | } |
424 | out: | 428 | out: |
425 | if (!stop && release) | 429 | if (!stop && (2 < release)) |
426 | netif_wake_queue(card->netdev); | 430 | netif_wake_queue(card->netdev); |
427 | } | 431 | } |
428 | 432 | ||
@@ -659,19 +663,21 @@ static int gelic_net_prepare_tx_descr_v(struct gelic_net_card *card, | |||
659 | { | 663 | { |
660 | dma_addr_t buf[2]; | 664 | dma_addr_t buf[2]; |
661 | unsigned int vlan_len; | 665 | unsigned int vlan_len; |
666 | struct gelic_net_descr *sec_descr = descr->next; | ||
662 | 667 | ||
663 | if (skb->len < GELIC_NET_VLAN_POS) | 668 | if (skb->len < GELIC_NET_VLAN_POS) |
664 | return -EINVAL; | 669 | return -EINVAL; |
665 | 670 | ||
666 | memcpy(&descr->vlan, skb->data, GELIC_NET_VLAN_POS); | 671 | vlan_len = GELIC_NET_VLAN_POS; |
672 | memcpy(&descr->vlan, skb->data, vlan_len); | ||
667 | if (card->vlan_index != -1) { | 673 | if (card->vlan_index != -1) { |
674 | /* internal vlan tag used */ | ||
668 | descr->vlan.h_vlan_proto = htons(ETH_P_8021Q); /* vlan 0x8100*/ | 675 | descr->vlan.h_vlan_proto = htons(ETH_P_8021Q); /* vlan 0x8100*/ |
669 | descr->vlan.h_vlan_TCI = htons(card->vlan_id[card->vlan_index]); | 676 | descr->vlan.h_vlan_TCI = htons(card->vlan_id[card->vlan_index]); |
670 | vlan_len = GELIC_NET_VLAN_POS + VLAN_HLEN; /* VLAN_HLEN=4 */ | 677 | vlan_len += VLAN_HLEN; /* added for above two lines */ |
671 | } else | 678 | } |
672 | vlan_len = GELIC_NET_VLAN_POS; /* no vlan tag */ | ||
673 | 679 | ||
674 | /* first descr */ | 680 | /* map data area */ |
675 | buf[0] = dma_map_single(ctodev(card), &descr->vlan, | 681 | buf[0] = dma_map_single(ctodev(card), &descr->vlan, |
676 | vlan_len, DMA_TO_DEVICE); | 682 | vlan_len, DMA_TO_DEVICE); |
677 | 683 | ||
@@ -682,20 +688,6 @@ static int gelic_net_prepare_tx_descr_v(struct gelic_net_card *card, | |||
682 | return -ENOMEM; | 688 | return -ENOMEM; |
683 | } | 689 | } |
684 | 690 | ||
685 | descr->buf_addr = buf[0]; | ||
686 | descr->buf_size = vlan_len; | ||
687 | descr->skb = skb; /* not used */ | ||
688 | descr->data_status = 0; | ||
689 | gelic_net_set_txdescr_cmdstat(descr, skb, 1); /* not the frame end */ | ||
690 | |||
691 | /* second descr */ | ||
692 | card->tx_chain.head = card->tx_chain.head->next; | ||
693 | descr->next_descr_addr = descr->next->bus_addr; | ||
694 | descr = descr->next; | ||
695 | if (gelic_net_get_descr_status(descr) != GELIC_NET_DESCR_NOT_IN_USE) | ||
696 | /* XXX will be removed */ | ||
697 | dev_err(ctodev(card), "descr is not free!\n"); | ||
698 | |||
699 | buf[1] = dma_map_single(ctodev(card), skb->data + GELIC_NET_VLAN_POS, | 691 | buf[1] = dma_map_single(ctodev(card), skb->data + GELIC_NET_VLAN_POS, |
700 | skb->len - GELIC_NET_VLAN_POS, | 692 | skb->len - GELIC_NET_VLAN_POS, |
701 | DMA_TO_DEVICE); | 693 | DMA_TO_DEVICE); |
@@ -710,13 +702,24 @@ static int gelic_net_prepare_tx_descr_v(struct gelic_net_card *card, | |||
710 | return -ENOMEM; | 702 | return -ENOMEM; |
711 | } | 703 | } |
712 | 704 | ||
713 | descr->buf_addr = buf[1]; | 705 | /* first descr */ |
714 | descr->buf_size = skb->len - GELIC_NET_VLAN_POS; | 706 | descr->buf_addr = buf[0]; |
715 | descr->skb = skb; | 707 | descr->buf_size = vlan_len; |
708 | descr->skb = NULL; /* not used */ | ||
716 | descr->data_status = 0; | 709 | descr->data_status = 0; |
717 | descr->next_descr_addr = 0; /* terminate hw descr */ | 710 | descr->next_descr_addr = descr->next->bus_addr; |
718 | gelic_net_set_txdescr_cmdstat(descr, skb, 0); | 711 | gelic_net_set_txdescr_cmdstat(descr, skb, 1); /* not the frame end */ |
719 | 712 | ||
713 | /* second descr */ | ||
714 | sec_descr->buf_addr = buf[1]; | ||
715 | sec_descr->buf_size = skb->len - GELIC_NET_VLAN_POS; | ||
716 | sec_descr->skb = skb; | ||
717 | sec_descr->data_status = 0; | ||
718 | sec_descr->next_descr_addr = 0; /* terminate hw descr */ | ||
719 | gelic_net_set_txdescr_cmdstat(sec_descr, skb, 0); | ||
720 | |||
721 | /* bump free descriptor pointer */ | ||
722 | card->tx_chain.head = sec_descr->next; | ||
720 | return 0; | 723 | return 0; |
721 | } | 724 | } |
722 | 725 | ||
@@ -729,7 +732,7 @@ static int gelic_net_prepare_tx_descr_v(struct gelic_net_card *card, | |||
729 | static int gelic_net_kick_txdma(struct gelic_net_card *card, | 732 | static int gelic_net_kick_txdma(struct gelic_net_card *card, |
730 | struct gelic_net_descr *descr) | 733 | struct gelic_net_descr *descr) |
731 | { | 734 | { |
732 | int status = -ENXIO; | 735 | int status = 0; |
733 | int count = 10; | 736 | int count = 10; |
734 | 737 | ||
735 | if (card->tx_dma_progress) | 738 | if (card->tx_dma_progress) |
@@ -763,47 +766,62 @@ static int gelic_net_kick_txdma(struct gelic_net_card *card, | |||
763 | static int gelic_net_xmit(struct sk_buff *skb, struct net_device *netdev) | 766 | static int gelic_net_xmit(struct sk_buff *skb, struct net_device *netdev) |
764 | { | 767 | { |
765 | struct gelic_net_card *card = netdev_priv(netdev); | 768 | struct gelic_net_card *card = netdev_priv(netdev); |
766 | struct gelic_net_descr *descr = NULL; | 769 | struct gelic_net_descr *descr; |
767 | int result; | 770 | int result; |
768 | unsigned long flags; | 771 | unsigned long flags; |
769 | 772 | ||
770 | spin_lock_irqsave(&card->tx_dma_lock, flags); | 773 | spin_lock_irqsave(&card->tx_dma_lock, flags); |
771 | 774 | ||
772 | gelic_net_release_tx_chain(card, 0); | 775 | gelic_net_release_tx_chain(card, 0); |
773 | if (!skb) | 776 | |
774 | goto kick; | ||
775 | descr = gelic_net_get_next_tx_descr(card); | 777 | descr = gelic_net_get_next_tx_descr(card); |
776 | if (!descr) { | 778 | if (!descr) { |
779 | /* | ||
780 | * no more descriptors free | ||
781 | */ | ||
777 | netif_stop_queue(netdev); | 782 | netif_stop_queue(netdev); |
778 | spin_unlock_irqrestore(&card->tx_dma_lock, flags); | 783 | spin_unlock_irqrestore(&card->tx_dma_lock, flags); |
779 | return NETDEV_TX_BUSY; | 784 | return NETDEV_TX_BUSY; |
780 | } | 785 | } |
781 | result = gelic_net_prepare_tx_descr_v(card, descr, skb); | ||
782 | |||
783 | if (result) | ||
784 | goto error; | ||
785 | 786 | ||
786 | card->tx_chain.head = card->tx_chain.head->next; | 787 | result = gelic_net_prepare_tx_descr_v(card, descr, skb); |
787 | 788 | if (result) { | |
788 | if (descr->prev) | 789 | /* |
789 | descr->prev->next_descr_addr = descr->bus_addr; | 790 | * DMA map failed. As chanses are that failure |
790 | kick: | 791 | * would continue, just release skb and return |
792 | */ | ||
793 | card->netdev->stats.tx_dropped++; | ||
794 | dev_kfree_skb_any(skb); | ||
795 | spin_unlock_irqrestore(&card->tx_dma_lock, flags); | ||
796 | return NETDEV_TX_OK; | ||
797 | } | ||
798 | /* | ||
799 | * link this prepared descriptor to previous one | ||
800 | * to achieve high performance | ||
801 | */ | ||
802 | descr->prev->next_descr_addr = descr->bus_addr; | ||
791 | /* | 803 | /* |
792 | * as hardware descriptor is modified in the above lines, | 804 | * as hardware descriptor is modified in the above lines, |
793 | * ensure that the hardware sees it | 805 | * ensure that the hardware sees it |
794 | */ | 806 | */ |
795 | wmb(); | 807 | wmb(); |
796 | if (gelic_net_kick_txdma(card, card->tx_chain.tail)) | 808 | if (gelic_net_kick_txdma(card, descr)) { |
797 | goto error; | 809 | /* |
810 | * kick failed. | ||
811 | * release descriptors which were just prepared | ||
812 | */ | ||
813 | card->netdev->stats.tx_dropped++; | ||
814 | gelic_net_release_tx_descr(card, descr); | ||
815 | gelic_net_release_tx_descr(card, descr->next); | ||
816 | card->tx_chain.tail = descr->next->next; | ||
817 | dev_info(ctodev(card), "%s: kick failure\n", __func__); | ||
818 | } else { | ||
819 | /* OK, DMA started/reserved */ | ||
820 | netdev->trans_start = jiffies; | ||
821 | } | ||
798 | 822 | ||
799 | netdev->trans_start = jiffies; | ||
800 | spin_unlock_irqrestore(&card->tx_dma_lock, flags); | 823 | spin_unlock_irqrestore(&card->tx_dma_lock, flags); |
801 | return NETDEV_TX_OK; | 824 | return NETDEV_TX_OK; |
802 | |||
803 | error: | ||
804 | card->netdev_stats.tx_dropped++; | ||
805 | spin_unlock_irqrestore(&card->tx_dma_lock, flags); | ||
806 | return NETDEV_TX_LOCKED; | ||
807 | } | 825 | } |
808 | 826 | ||
809 | /** | 827 | /** |
@@ -854,8 +872,8 @@ static void gelic_net_pass_skb_up(struct gelic_net_descr *descr, | |||
854 | skb->ip_summed = CHECKSUM_NONE; | 872 | skb->ip_summed = CHECKSUM_NONE; |
855 | 873 | ||
856 | /* update netdevice statistics */ | 874 | /* update netdevice statistics */ |
857 | card->netdev_stats.rx_packets++; | 875 | card->netdev->stats.rx_packets++; |
858 | card->netdev_stats.rx_bytes += skb->len; | 876 | card->netdev->stats.rx_bytes += skb->len; |
859 | 877 | ||
860 | /* pass skb up to stack */ | 878 | /* pass skb up to stack */ |
861 | netif_receive_skb(skb); | 879 | netif_receive_skb(skb); |
@@ -895,38 +913,67 @@ static int gelic_net_decode_one_descr(struct gelic_net_card *card) | |||
895 | (status == GELIC_NET_DESCR_FORCE_END)) { | 913 | (status == GELIC_NET_DESCR_FORCE_END)) { |
896 | dev_info(ctodev(card), "dropping RX descriptor with state %x\n", | 914 | dev_info(ctodev(card), "dropping RX descriptor with state %x\n", |
897 | status); | 915 | status); |
898 | card->netdev_stats.rx_dropped++; | 916 | card->netdev->stats.rx_dropped++; |
899 | goto refill; | 917 | goto refill; |
900 | } | 918 | } |
901 | 919 | ||
902 | if ((status != GELIC_NET_DESCR_COMPLETE) && | 920 | if (status == GELIC_NET_DESCR_BUFFER_FULL) { |
903 | (status != GELIC_NET_DESCR_FRAME_END)) { | 921 | /* |
922 | * Buffer full would occur if and only if | ||
923 | * the frame length was longer than the size of this | ||
924 | * descriptor's buffer. If the frame length was equal | ||
925 | * to or shorter than buffer'size, FRAME_END condition | ||
926 | * would occur. | ||
927 | * Anyway this frame was longer than the MTU, | ||
928 | * just drop it. | ||
929 | */ | ||
930 | dev_info(ctodev(card), "overlength frame\n"); | ||
931 | goto refill; | ||
932 | } | ||
933 | /* | ||
934 | * descriptoers any other than FRAME_END here should | ||
935 | * be treated as error. | ||
936 | */ | ||
937 | if (status != GELIC_NET_DESCR_FRAME_END) { | ||
904 | dev_dbg(ctodev(card), "RX descriptor with state %x\n", | 938 | dev_dbg(ctodev(card), "RX descriptor with state %x\n", |
905 | status); | 939 | status); |
906 | goto refill; | 940 | goto refill; |
907 | } | 941 | } |
908 | 942 | ||
909 | /* ok, we've got a packet in descr */ | 943 | /* ok, we've got a packet in descr */ |
910 | gelic_net_pass_skb_up(descr, card); /* 1: skb_up sccess */ | 944 | gelic_net_pass_skb_up(descr, card); |
911 | |||
912 | refill: | 945 | refill: |
913 | descr->next_descr_addr = 0; /* unlink the descr */ | 946 | /* |
947 | * So that always DMAC can see the end | ||
948 | * of the descriptor chain to avoid | ||
949 | * from unwanted DMAC overrun. | ||
950 | */ | ||
951 | descr->next_descr_addr = 0; | ||
914 | 952 | ||
915 | /* change the descriptor state: */ | 953 | /* change the descriptor state: */ |
916 | gelic_net_set_descr_status(descr, GELIC_NET_DESCR_NOT_IN_USE); | 954 | gelic_net_set_descr_status(descr, GELIC_NET_DESCR_NOT_IN_USE); |
917 | 955 | ||
918 | /* refill one desc | 956 | /* |
919 | * FIXME: this can fail, but for now, just leave this | 957 | * this call can fail, but for now, just leave this |
920 | * descriptor without skb | 958 | * decriptor without skb |
921 | */ | 959 | */ |
922 | gelic_net_prepare_rx_descr(card, descr); | 960 | gelic_net_prepare_rx_descr(card, descr); |
961 | |||
923 | chain->head = descr; | 962 | chain->head = descr; |
924 | chain->tail = descr->next; | 963 | chain->tail = descr->next; |
964 | |||
965 | /* | ||
966 | * Set this descriptor the end of the chain. | ||
967 | */ | ||
925 | descr->prev->next_descr_addr = descr->bus_addr; | 968 | descr->prev->next_descr_addr = descr->bus_addr; |
926 | 969 | ||
970 | /* | ||
971 | * If dmac chain was met, DMAC stopped. | ||
972 | * thus re-enable it | ||
973 | */ | ||
927 | if (dmac_chain_ended) { | 974 | if (dmac_chain_ended) { |
928 | gelic_net_enable_rxdmac(card); | 975 | card->rx_dma_restart_required = 1; |
929 | dev_dbg(ctodev(card), "reenable rx dma\n"); | 976 | dev_dbg(ctodev(card), "reenable rx dma scheduled\n"); |
930 | } | 977 | } |
931 | 978 | ||
932 | return 1; | 979 | return 1; |
@@ -968,20 +1015,6 @@ static int gelic_net_poll(struct net_device *netdev, int *budget) | |||
968 | } else | 1015 | } else |
969 | return 1; | 1016 | return 1; |
970 | } | 1017 | } |
971 | |||
972 | /** | ||
973 | * gelic_net_get_stats - get interface statistics | ||
974 | * @netdev: interface device structure | ||
975 | * | ||
976 | * returns the interface statistics residing in the gelic_net_card struct | ||
977 | */ | ||
978 | static struct net_device_stats *gelic_net_get_stats(struct net_device *netdev) | ||
979 | { | ||
980 | struct gelic_net_card *card = netdev_priv(netdev); | ||
981 | |||
982 | return &card->netdev_stats; | ||
983 | } | ||
984 | |||
985 | /** | 1018 | /** |
986 | * gelic_net_change_mtu - changes the MTU of an interface | 1019 | * gelic_net_change_mtu - changes the MTU of an interface |
987 | * @netdev: interface device structure | 1020 | * @netdev: interface device structure |
@@ -1016,6 +1049,11 @@ static irqreturn_t gelic_net_interrupt(int irq, void *ptr) | |||
1016 | if (!status) | 1049 | if (!status) |
1017 | return IRQ_NONE; | 1050 | return IRQ_NONE; |
1018 | 1051 | ||
1052 | if (card->rx_dma_restart_required) { | ||
1053 | card->rx_dma_restart_required = 0; | ||
1054 | gelic_net_enable_rxdmac(card); | ||
1055 | } | ||
1056 | |||
1019 | if (status & GELIC_NET_RXINT) { | 1057 | if (status & GELIC_NET_RXINT) { |
1020 | gelic_net_rx_irq_off(card); | 1058 | gelic_net_rx_irq_off(card); |
1021 | netif_rx_schedule(netdev); | 1059 | netif_rx_schedule(netdev); |
@@ -1024,9 +1062,10 @@ static irqreturn_t gelic_net_interrupt(int irq, void *ptr) | |||
1024 | if (status & GELIC_NET_TXINT) { | 1062 | if (status & GELIC_NET_TXINT) { |
1025 | spin_lock_irqsave(&card->tx_dma_lock, flags); | 1063 | spin_lock_irqsave(&card->tx_dma_lock, flags); |
1026 | card->tx_dma_progress = 0; | 1064 | card->tx_dma_progress = 0; |
1065 | gelic_net_release_tx_chain(card, 0); | ||
1066 | /* kick outstanding tx descriptor if any */ | ||
1067 | gelic_net_kick_txdma(card, card->tx_chain.tail); | ||
1027 | spin_unlock_irqrestore(&card->tx_dma_lock, flags); | 1068 | spin_unlock_irqrestore(&card->tx_dma_lock, flags); |
1028 | /* start pending DMA */ | ||
1029 | gelic_net_xmit(NULL, netdev); | ||
1030 | } | 1069 | } |
1031 | return IRQ_HANDLED; | 1070 | return IRQ_HANDLED; |
1032 | } | 1071 | } |
@@ -1068,7 +1107,7 @@ static int gelic_net_open_device(struct gelic_net_card *card) | |||
1068 | } | 1107 | } |
1069 | 1108 | ||
1070 | result = request_irq(card->netdev->irq, gelic_net_interrupt, | 1109 | result = request_irq(card->netdev->irq, gelic_net_interrupt, |
1071 | IRQF_DISABLED, "gelic network", card->netdev); | 1110 | IRQF_DISABLED, card->netdev->name, card->netdev); |
1072 | 1111 | ||
1073 | if (result) { | 1112 | if (result) { |
1074 | dev_info(ctodev(card), "%s:%d: request_irq failed (%d)\n", | 1113 | dev_info(ctodev(card), "%s:%d: request_irq failed (%d)\n", |
@@ -1107,7 +1146,7 @@ static int gelic_net_open(struct net_device *netdev) | |||
1107 | card->descr, GELIC_NET_TX_DESCRIPTORS)) | 1146 | card->descr, GELIC_NET_TX_DESCRIPTORS)) |
1108 | goto alloc_tx_failed; | 1147 | goto alloc_tx_failed; |
1109 | if (gelic_net_init_chain(card, &card->rx_chain, | 1148 | if (gelic_net_init_chain(card, &card->rx_chain, |
1110 | card->descr + GELIC_NET_RX_DESCRIPTORS, | 1149 | card->descr + GELIC_NET_TX_DESCRIPTORS, |
1111 | GELIC_NET_RX_DESCRIPTORS)) | 1150 | GELIC_NET_RX_DESCRIPTORS)) |
1112 | goto alloc_rx_failed; | 1151 | goto alloc_rx_failed; |
1113 | 1152 | ||
@@ -1129,7 +1168,6 @@ static int gelic_net_open(struct net_device *netdev) | |||
1129 | 1168 | ||
1130 | netif_start_queue(netdev); | 1169 | netif_start_queue(netdev); |
1131 | netif_carrier_on(netdev); | 1170 | netif_carrier_on(netdev); |
1132 | netif_poll_enable(netdev); | ||
1133 | 1171 | ||
1134 | return 0; | 1172 | return 0; |
1135 | 1173 | ||
@@ -1141,7 +1179,6 @@ alloc_tx_failed: | |||
1141 | return -ENOMEM; | 1179 | return -ENOMEM; |
1142 | } | 1180 | } |
1143 | 1181 | ||
1144 | #ifdef GELIC_NET_ETHTOOL | ||
1145 | static void gelic_net_get_drvinfo (struct net_device *netdev, | 1182 | static void gelic_net_get_drvinfo (struct net_device *netdev, |
1146 | struct ethtool_drvinfo *info) | 1183 | struct ethtool_drvinfo *info) |
1147 | { | 1184 | { |
@@ -1261,7 +1298,6 @@ static struct ethtool_ops gelic_net_ethtool_ops = { | |||
1261 | .get_rx_csum = gelic_net_get_rx_csum, | 1298 | .get_rx_csum = gelic_net_get_rx_csum, |
1262 | .set_rx_csum = gelic_net_set_rx_csum, | 1299 | .set_rx_csum = gelic_net_set_rx_csum, |
1263 | }; | 1300 | }; |
1264 | #endif | ||
1265 | 1301 | ||
1266 | /** | 1302 | /** |
1267 | * gelic_net_tx_timeout_task - task scheduled by the watchdog timeout | 1303 | * gelic_net_tx_timeout_task - task scheduled by the watchdog timeout |
@@ -1320,7 +1356,6 @@ static void gelic_net_setup_netdev_ops(struct net_device *netdev) | |||
1320 | netdev->open = &gelic_net_open; | 1356 | netdev->open = &gelic_net_open; |
1321 | netdev->stop = &gelic_net_stop; | 1357 | netdev->stop = &gelic_net_stop; |
1322 | netdev->hard_start_xmit = &gelic_net_xmit; | 1358 | netdev->hard_start_xmit = &gelic_net_xmit; |
1323 | netdev->get_stats = &gelic_net_get_stats; | ||
1324 | netdev->set_multicast_list = &gelic_net_set_multi; | 1359 | netdev->set_multicast_list = &gelic_net_set_multi; |
1325 | netdev->change_mtu = &gelic_net_change_mtu; | 1360 | netdev->change_mtu = &gelic_net_change_mtu; |
1326 | /* tx watchdog */ | 1361 | /* tx watchdog */ |
@@ -1329,9 +1364,7 @@ static void gelic_net_setup_netdev_ops(struct net_device *netdev) | |||
1329 | /* NAPI */ | 1364 | /* NAPI */ |
1330 | netdev->poll = &gelic_net_poll; | 1365 | netdev->poll = &gelic_net_poll; |
1331 | netdev->weight = GELIC_NET_NAPI_WEIGHT; | 1366 | netdev->weight = GELIC_NET_NAPI_WEIGHT; |
1332 | #ifdef GELIC_NET_ETHTOOL | ||
1333 | netdev->ethtool_ops = &gelic_net_ethtool_ops; | 1367 | netdev->ethtool_ops = &gelic_net_ethtool_ops; |
1334 | #endif | ||
1335 | } | 1368 | } |
1336 | 1369 | ||
1337 | /** | 1370 | /** |
diff --git a/drivers/net/ps3_gelic_net.h b/drivers/net/ps3_gelic_net.h index 5e1c28654e16..a9c4c4fc2547 100644 --- a/drivers/net/ps3_gelic_net.h +++ b/drivers/net/ps3_gelic_net.h | |||
@@ -28,21 +28,12 @@ | |||
28 | #ifndef _GELIC_NET_H | 28 | #ifndef _GELIC_NET_H |
29 | #define _GELIC_NET_H | 29 | #define _GELIC_NET_H |
30 | 30 | ||
31 | #define GELIC_NET_DRV_NAME "Gelic Network Driver" | ||
32 | #define GELIC_NET_DRV_VERSION "1.0" | ||
33 | |||
34 | #define GELIC_NET_ETHTOOL /* use ethtool */ | ||
35 | |||
36 | /* ioctl */ | ||
37 | #define GELIC_NET_GET_MODE (SIOCDEVPRIVATE + 0) | ||
38 | #define GELIC_NET_SET_MODE (SIOCDEVPRIVATE + 1) | ||
39 | |||
40 | /* descriptors */ | 31 | /* descriptors */ |
41 | #define GELIC_NET_RX_DESCRIPTORS 128 /* num of descriptors */ | 32 | #define GELIC_NET_RX_DESCRIPTORS 128 /* num of descriptors */ |
42 | #define GELIC_NET_TX_DESCRIPTORS 128 /* num of descriptors */ | 33 | #define GELIC_NET_TX_DESCRIPTORS 128 /* num of descriptors */ |
43 | 34 | ||
44 | #define GELIC_NET_MAX_MTU 2308 | 35 | #define GELIC_NET_MAX_MTU VLAN_ETH_FRAME_LEN |
45 | #define GELIC_NET_MIN_MTU 64 | 36 | #define GELIC_NET_MIN_MTU VLAN_ETH_ZLEN |
46 | #define GELIC_NET_RXBUF_ALIGN 128 | 37 | #define GELIC_NET_RXBUF_ALIGN 128 |
47 | #define GELIC_NET_RX_CSUM_DEFAULT 1 /* hw chksum */ | 38 | #define GELIC_NET_RX_CSUM_DEFAULT 1 /* hw chksum */ |
48 | #define GELIC_NET_WATCHDOG_TIMEOUT 5*HZ | 39 | #define GELIC_NET_WATCHDOG_TIMEOUT 5*HZ |
@@ -90,7 +81,8 @@ enum gelic_net_int1_status { | |||
90 | */ | 81 | */ |
91 | #define GELIC_NET_RXVLNPKT 0x00200000 /* VLAN packet */ | 82 | #define GELIC_NET_RXVLNPKT 0x00200000 /* VLAN packet */ |
92 | /* bit 20..16 reserved */ | 83 | /* bit 20..16 reserved */ |
93 | #define GELIC_NET_RXRECNUM 0x0000ff00 /* reception receipt number */ | 84 | #define GELIC_NET_RXRRECNUM 0x0000ff00 /* reception receipt number */ |
85 | #define GELIC_NET_RXRRECNUM_SHIFT 8 | ||
94 | /* bit 7..0 reserved */ | 86 | /* bit 7..0 reserved */ |
95 | 87 | ||
96 | #define GELIC_NET_TXDESC_TAIL 0 | 88 | #define GELIC_NET_TXDESC_TAIL 0 |
@@ -133,19 +125,19 @@ enum gelic_net_int1_status { | |||
133 | * interrupt status */ | 125 | * interrupt status */ |
134 | 126 | ||
135 | #define GELIC_NET_DMAC_CMDSTAT_CHAIN_END 0x00000002 /* RXDCEIS:DMA stopped */ | 127 | #define GELIC_NET_DMAC_CMDSTAT_CHAIN_END 0x00000002 /* RXDCEIS:DMA stopped */ |
136 | #define GELIC_NET_DMAC_CMDSTAT_NOT_IN_USE 0xb0000000 | ||
137 | #define GELIC_NET_DESCR_IND_PROC_SHIFT 28 | 128 | #define GELIC_NET_DESCR_IND_PROC_SHIFT 28 |
138 | #define GELIC_NET_DESCR_IND_PROC_MASKO 0x0fffffff | 129 | #define GELIC_NET_DESCR_IND_PROC_MASKO 0x0fffffff |
139 | 130 | ||
140 | 131 | ||
141 | enum gelic_net_descr_status { | 132 | enum gelic_net_descr_status { |
142 | GELIC_NET_DESCR_COMPLETE = 0x00, /* used in rx and tx */ | 133 | GELIC_NET_DESCR_COMPLETE = 0x00, /* used in tx */ |
134 | GELIC_NET_DESCR_BUFFER_FULL = 0x00, /* used in rx */ | ||
143 | GELIC_NET_DESCR_RESPONSE_ERROR = 0x01, /* used in rx and tx */ | 135 | GELIC_NET_DESCR_RESPONSE_ERROR = 0x01, /* used in rx and tx */ |
144 | GELIC_NET_DESCR_PROTECTION_ERROR = 0x02, /* used in rx and tx */ | 136 | GELIC_NET_DESCR_PROTECTION_ERROR = 0x02, /* used in rx and tx */ |
145 | GELIC_NET_DESCR_FRAME_END = 0x04, /* used in rx */ | 137 | GELIC_NET_DESCR_FRAME_END = 0x04, /* used in rx */ |
146 | GELIC_NET_DESCR_FORCE_END = 0x05, /* used in rx and tx */ | 138 | GELIC_NET_DESCR_FORCE_END = 0x05, /* used in rx and tx */ |
147 | GELIC_NET_DESCR_CARDOWNED = 0x0a, /* used in rx and tx */ | 139 | GELIC_NET_DESCR_CARDOWNED = 0x0a, /* used in rx and tx */ |
148 | GELIC_NET_DESCR_NOT_IN_USE /* any other value */ | 140 | GELIC_NET_DESCR_NOT_IN_USE = 0x0b /* any other value */ |
149 | }; | 141 | }; |
150 | /* for lv1_net_control */ | 142 | /* for lv1_net_control */ |
151 | #define GELIC_NET_GET_MAC_ADDRESS 0x0000000000000001 | 143 | #define GELIC_NET_GET_MAC_ADDRESS 0x0000000000000001 |
@@ -216,10 +208,10 @@ struct gelic_net_card { | |||
216 | 208 | ||
217 | struct gelic_net_descr_chain tx_chain; | 209 | struct gelic_net_descr_chain tx_chain; |
218 | struct gelic_net_descr_chain rx_chain; | 210 | struct gelic_net_descr_chain rx_chain; |
211 | int rx_dma_restart_required; | ||
219 | /* gurad dmac descriptor chain*/ | 212 | /* gurad dmac descriptor chain*/ |
220 | spinlock_t chain_lock; | 213 | spinlock_t chain_lock; |
221 | 214 | ||
222 | struct net_device_stats netdev_stats; | ||
223 | int rx_csum; | 215 | int rx_csum; |
224 | /* guard tx_dma_progress */ | 216 | /* guard tx_dma_progress */ |
225 | spinlock_t tx_dma_lock; | 217 | spinlock_t tx_dma_lock; |
diff --git a/drivers/net/ucc_geth.c b/drivers/net/ucc_geth.c index e4736a3b1b7a..12e01b24105a 100644 --- a/drivers/net/ucc_geth.c +++ b/drivers/net/ucc_geth.c | |||
@@ -43,10 +43,6 @@ | |||
43 | 43 | ||
44 | #undef DEBUG | 44 | #undef DEBUG |
45 | 45 | ||
46 | #define DRV_DESC "QE UCC Gigabit Ethernet Controller" | ||
47 | #define DRV_NAME "ucc_geth" | ||
48 | #define DRV_VERSION "1.1" | ||
49 | |||
50 | #define ugeth_printk(level, format, arg...) \ | 46 | #define ugeth_printk(level, format, arg...) \ |
51 | printk(level format "\n", ## arg) | 47 | printk(level format "\n", ## arg) |
52 | 48 | ||
@@ -64,9 +60,19 @@ | |||
64 | #else | 60 | #else |
65 | #define ugeth_vdbg(fmt, args...) do { } while (0) | 61 | #define ugeth_vdbg(fmt, args...) do { } while (0) |
66 | #endif /* UGETH_VERBOSE_DEBUG */ | 62 | #endif /* UGETH_VERBOSE_DEBUG */ |
63 | #define UGETH_MSG_DEFAULT (NETIF_MSG_IFUP << 1 ) - 1 | ||
67 | 64 | ||
65 | void uec_set_ethtool_ops(struct net_device *netdev); | ||
66 | |||
68 | static DEFINE_SPINLOCK(ugeth_lock); | 67 | static DEFINE_SPINLOCK(ugeth_lock); |
69 | 68 | ||
69 | static struct { | ||
70 | u32 msg_enable; | ||
71 | } debug = { -1 }; | ||
72 | |||
73 | module_param_named(debug, debug.msg_enable, int, 0); | ||
74 | MODULE_PARM_DESC(debug, "Debug verbosity level (0=none, ..., 0xffff=all)"); | ||
75 | |||
70 | static struct ucc_geth_info ugeth_primary_info = { | 76 | static struct ucc_geth_info ugeth_primary_info = { |
71 | .uf_info = { | 77 | .uf_info = { |
72 | .bd_mem_part = MEM_PART_SYSTEM, | 78 | .bd_mem_part = MEM_PART_SYSTEM, |
@@ -104,6 +110,7 @@ static struct ucc_geth_info ugeth_primary_info = { | |||
104 | .maxRetransmission = 0xf, | 110 | .maxRetransmission = 0xf, |
105 | .collisionWindow = 0x37, | 111 | .collisionWindow = 0x37, |
106 | .receiveFlowControl = 1, | 112 | .receiveFlowControl = 1, |
113 | .transmitFlowControl = 1, | ||
107 | .maxGroupAddrInHash = 4, | 114 | .maxGroupAddrInHash = 4, |
108 | .maxIndAddrInHash = 4, | 115 | .maxIndAddrInHash = 4, |
109 | .prel = 7, | 116 | .prel = 7, |
@@ -139,7 +146,9 @@ static struct ucc_geth_info ugeth_primary_info = { | |||
139 | .numStationAddresses = UCC_GETH_NUM_OF_STATION_ADDRESSES_1, | 146 | .numStationAddresses = UCC_GETH_NUM_OF_STATION_ADDRESSES_1, |
140 | .largestexternallookupkeysize = | 147 | .largestexternallookupkeysize = |
141 | QE_FLTR_LARGEST_EXTERNAL_TABLE_LOOKUP_KEY_SIZE_NONE, | 148 | QE_FLTR_LARGEST_EXTERNAL_TABLE_LOOKUP_KEY_SIZE_NONE, |
142 | .statisticsMode = UCC_GETH_STATISTICS_GATHERING_MODE_NONE, | 149 | .statisticsMode = UCC_GETH_STATISTICS_GATHERING_MODE_HARDWARE | |
150 | UCC_GETH_STATISTICS_GATHERING_MODE_FIRMWARE_TX | | ||
151 | UCC_GETH_STATISTICS_GATHERING_MODE_FIRMWARE_RX, | ||
143 | .vlanOperationTagged = UCC_GETH_VLAN_OPERATION_TAGGED_NOP, | 152 | .vlanOperationTagged = UCC_GETH_VLAN_OPERATION_TAGGED_NOP, |
144 | .vlanOperationNonTagged = UCC_GETH_VLAN_OPERATION_NON_TAGGED_NOP, | 153 | .vlanOperationNonTagged = UCC_GETH_VLAN_OPERATION_NON_TAGGED_NOP, |
145 | .rxQoSMode = UCC_GETH_QOS_MODE_DEFAULT, | 154 | .rxQoSMode = UCC_GETH_QOS_MODE_DEFAULT, |
@@ -281,7 +290,8 @@ static int fill_init_enet_entries(struct ucc_geth_private *ugeth, | |||
281 | 290 | ||
282 | for (i = 0; i < num_entries; i++) { | 291 | for (i = 0; i < num_entries; i++) { |
283 | if ((snum = qe_get_snum()) < 0) { | 292 | if ((snum = qe_get_snum()) < 0) { |
284 | ugeth_err("fill_init_enet_entries: Can not get SNUM."); | 293 | if (netif_msg_ifup(ugeth)) |
294 | ugeth_err("fill_init_enet_entries: Can not get SNUM."); | ||
285 | return snum; | 295 | return snum; |
286 | } | 296 | } |
287 | if ((i == 0) && skip_page_for_first_entry) | 297 | if ((i == 0) && skip_page_for_first_entry) |
@@ -291,8 +301,8 @@ static int fill_init_enet_entries(struct ucc_geth_private *ugeth, | |||
291 | init_enet_offset = | 301 | init_enet_offset = |
292 | qe_muram_alloc(thread_size, thread_alignment); | 302 | qe_muram_alloc(thread_size, thread_alignment); |
293 | if (IS_ERR_VALUE(init_enet_offset)) { | 303 | if (IS_ERR_VALUE(init_enet_offset)) { |
294 | ugeth_err | 304 | if (netif_msg_ifup(ugeth)) |
295 | ("fill_init_enet_entries: Can not allocate DPRAM memory."); | 305 | ugeth_err("fill_init_enet_entries: Can not allocate DPRAM memory."); |
296 | qe_put_snum((u8) snum); | 306 | qe_put_snum((u8) snum); |
297 | return -ENOMEM; | 307 | return -ENOMEM; |
298 | } | 308 | } |
@@ -1200,7 +1210,7 @@ static int init_inter_frame_gap_params(u8 non_btb_cs_ipg, | |||
1200 | return 0; | 1210 | return 0; |
1201 | } | 1211 | } |
1202 | 1212 | ||
1203 | static int init_flow_control_params(u32 automatic_flow_control_mode, | 1213 | int init_flow_control_params(u32 automatic_flow_control_mode, |
1204 | int rx_flow_control_enable, | 1214 | int rx_flow_control_enable, |
1205 | int tx_flow_control_enable, | 1215 | int tx_flow_control_enable, |
1206 | u16 pause_period, | 1216 | u16 pause_period, |
@@ -1486,9 +1496,9 @@ static int adjust_enet_interface(struct ucc_geth_private *ugeth) | |||
1486 | 1496 | ||
1487 | ret_val = init_preamble_length(ug_info->prel, &ug_regs->maccfg2); | 1497 | ret_val = init_preamble_length(ug_info->prel, &ug_regs->maccfg2); |
1488 | if (ret_val != 0) { | 1498 | if (ret_val != 0) { |
1489 | ugeth_err | 1499 | if (netif_msg_probe(ugeth)) |
1490 | ("%s: Preamble length must be between 3 and 7 inclusive.", | 1500 | ugeth_err("%s: Preamble length must be between 3 and 7 inclusive.", |
1491 | __FUNCTION__); | 1501 | __FUNCTION__); |
1492 | return ret_val; | 1502 | return ret_val; |
1493 | } | 1503 | } |
1494 | 1504 | ||
@@ -1726,7 +1736,8 @@ static int ugeth_enable(struct ucc_geth_private *ugeth, enum comm_dir mode) | |||
1726 | 1736 | ||
1727 | /* check if the UCC number is in range. */ | 1737 | /* check if the UCC number is in range. */ |
1728 | if (ugeth->ug_info->uf_info.ucc_num >= UCC_MAX_NUM) { | 1738 | if (ugeth->ug_info->uf_info.ucc_num >= UCC_MAX_NUM) { |
1729 | ugeth_err("%s: ucc_num out of range.", __FUNCTION__); | 1739 | if (netif_msg_probe(ugeth)) |
1740 | ugeth_err("%s: ucc_num out of range.", __FUNCTION__); | ||
1730 | return -EINVAL; | 1741 | return -EINVAL; |
1731 | } | 1742 | } |
1732 | 1743 | ||
@@ -1754,7 +1765,8 @@ static int ugeth_disable(struct ucc_geth_private * ugeth, enum comm_dir mode) | |||
1754 | 1765 | ||
1755 | /* check if the UCC number is in range. */ | 1766 | /* check if the UCC number is in range. */ |
1756 | if (ugeth->ug_info->uf_info.ucc_num >= UCC_MAX_NUM) { | 1767 | if (ugeth->ug_info->uf_info.ucc_num >= UCC_MAX_NUM) { |
1757 | ugeth_err("%s: ucc_num out of range.", __FUNCTION__); | 1768 | if (netif_msg_probe(ugeth)) |
1769 | ugeth_err("%s: ucc_num out of range.", __FUNCTION__); | ||
1758 | return -EINVAL; | 1770 | return -EINVAL; |
1759 | } | 1771 | } |
1760 | 1772 | ||
@@ -2306,7 +2318,9 @@ static int ucc_struct_init(struct ucc_geth_private *ugeth) | |||
2306 | 2318 | ||
2307 | if (!((uf_info->bd_mem_part == MEM_PART_SYSTEM) || | 2319 | if (!((uf_info->bd_mem_part == MEM_PART_SYSTEM) || |
2308 | (uf_info->bd_mem_part == MEM_PART_MURAM))) { | 2320 | (uf_info->bd_mem_part == MEM_PART_MURAM))) { |
2309 | ugeth_err("%s: Bad memory partition value.", __FUNCTION__); | 2321 | if (netif_msg_probe(ugeth)) |
2322 | ugeth_err("%s: Bad memory partition value.", | ||
2323 | __FUNCTION__); | ||
2310 | return -EINVAL; | 2324 | return -EINVAL; |
2311 | } | 2325 | } |
2312 | 2326 | ||
@@ -2315,9 +2329,10 @@ static int ucc_struct_init(struct ucc_geth_private *ugeth) | |||
2315 | if ((ug_info->bdRingLenRx[i] < UCC_GETH_RX_BD_RING_SIZE_MIN) || | 2329 | if ((ug_info->bdRingLenRx[i] < UCC_GETH_RX_BD_RING_SIZE_MIN) || |
2316 | (ug_info->bdRingLenRx[i] % | 2330 | (ug_info->bdRingLenRx[i] % |
2317 | UCC_GETH_RX_BD_RING_SIZE_ALIGNMENT)) { | 2331 | UCC_GETH_RX_BD_RING_SIZE_ALIGNMENT)) { |
2318 | ugeth_err | 2332 | if (netif_msg_probe(ugeth)) |
2319 | ("%s: Rx BD ring length must be multiple of 4," | 2333 | ugeth_err |
2320 | " no smaller than 8.", __FUNCTION__); | 2334 | ("%s: Rx BD ring length must be multiple of 4, no smaller than 8.", |
2335 | __FUNCTION__); | ||
2321 | return -EINVAL; | 2336 | return -EINVAL; |
2322 | } | 2337 | } |
2323 | } | 2338 | } |
@@ -2325,9 +2340,10 @@ static int ucc_struct_init(struct ucc_geth_private *ugeth) | |||
2325 | /* Tx BD lengths */ | 2340 | /* Tx BD lengths */ |
2326 | for (i = 0; i < ug_info->numQueuesTx; i++) { | 2341 | for (i = 0; i < ug_info->numQueuesTx; i++) { |
2327 | if (ug_info->bdRingLenTx[i] < UCC_GETH_TX_BD_RING_SIZE_MIN) { | 2342 | if (ug_info->bdRingLenTx[i] < UCC_GETH_TX_BD_RING_SIZE_MIN) { |
2328 | ugeth_err | 2343 | if (netif_msg_probe(ugeth)) |
2329 | ("%s: Tx BD ring length must be no smaller than 2.", | 2344 | ugeth_err |
2330 | __FUNCTION__); | 2345 | ("%s: Tx BD ring length must be no smaller than 2.", |
2346 | __FUNCTION__); | ||
2331 | return -EINVAL; | 2347 | return -EINVAL; |
2332 | } | 2348 | } |
2333 | } | 2349 | } |
@@ -2335,31 +2351,35 @@ static int ucc_struct_init(struct ucc_geth_private *ugeth) | |||
2335 | /* mrblr */ | 2351 | /* mrblr */ |
2336 | if ((uf_info->max_rx_buf_length == 0) || | 2352 | if ((uf_info->max_rx_buf_length == 0) || |
2337 | (uf_info->max_rx_buf_length % UCC_GETH_MRBLR_ALIGNMENT)) { | 2353 | (uf_info->max_rx_buf_length % UCC_GETH_MRBLR_ALIGNMENT)) { |
2338 | ugeth_err | 2354 | if (netif_msg_probe(ugeth)) |
2339 | ("%s: max_rx_buf_length must be non-zero multiple of 128.", | 2355 | ugeth_err |
2340 | __FUNCTION__); | 2356 | ("%s: max_rx_buf_length must be non-zero multiple of 128.", |
2357 | __FUNCTION__); | ||
2341 | return -EINVAL; | 2358 | return -EINVAL; |
2342 | } | 2359 | } |
2343 | 2360 | ||
2344 | /* num Tx queues */ | 2361 | /* num Tx queues */ |
2345 | if (ug_info->numQueuesTx > NUM_TX_QUEUES) { | 2362 | if (ug_info->numQueuesTx > NUM_TX_QUEUES) { |
2346 | ugeth_err("%s: number of tx queues too large.", __FUNCTION__); | 2363 | if (netif_msg_probe(ugeth)) |
2364 | ugeth_err("%s: number of tx queues too large.", __FUNCTION__); | ||
2347 | return -EINVAL; | 2365 | return -EINVAL; |
2348 | } | 2366 | } |
2349 | 2367 | ||
2350 | /* num Rx queues */ | 2368 | /* num Rx queues */ |
2351 | if (ug_info->numQueuesRx > NUM_RX_QUEUES) { | 2369 | if (ug_info->numQueuesRx > NUM_RX_QUEUES) { |
2352 | ugeth_err("%s: number of rx queues too large.", __FUNCTION__); | 2370 | if (netif_msg_probe(ugeth)) |
2371 | ugeth_err("%s: number of rx queues too large.", __FUNCTION__); | ||
2353 | return -EINVAL; | 2372 | return -EINVAL; |
2354 | } | 2373 | } |
2355 | 2374 | ||
2356 | /* l2qt */ | 2375 | /* l2qt */ |
2357 | for (i = 0; i < UCC_GETH_VLAN_PRIORITY_MAX; i++) { | 2376 | for (i = 0; i < UCC_GETH_VLAN_PRIORITY_MAX; i++) { |
2358 | if (ug_info->l2qt[i] >= ug_info->numQueuesRx) { | 2377 | if (ug_info->l2qt[i] >= ug_info->numQueuesRx) { |
2359 | ugeth_err | 2378 | if (netif_msg_probe(ugeth)) |
2360 | ("%s: VLAN priority table entry must not be" | 2379 | ugeth_err |
2361 | " larger than number of Rx queues.", | 2380 | ("%s: VLAN priority table entry must not be" |
2362 | __FUNCTION__); | 2381 | " larger than number of Rx queues.", |
2382 | __FUNCTION__); | ||
2363 | return -EINVAL; | 2383 | return -EINVAL; |
2364 | } | 2384 | } |
2365 | } | 2385 | } |
@@ -2367,26 +2387,29 @@ static int ucc_struct_init(struct ucc_geth_private *ugeth) | |||
2367 | /* l3qt */ | 2387 | /* l3qt */ |
2368 | for (i = 0; i < UCC_GETH_IP_PRIORITY_MAX; i++) { | 2388 | for (i = 0; i < UCC_GETH_IP_PRIORITY_MAX; i++) { |
2369 | if (ug_info->l3qt[i] >= ug_info->numQueuesRx) { | 2389 | if (ug_info->l3qt[i] >= ug_info->numQueuesRx) { |
2370 | ugeth_err | 2390 | if (netif_msg_probe(ugeth)) |
2371 | ("%s: IP priority table entry must not be" | 2391 | ugeth_err |
2372 | " larger than number of Rx queues.", | 2392 | ("%s: IP priority table entry must not be" |
2373 | __FUNCTION__); | 2393 | " larger than number of Rx queues.", |
2394 | __FUNCTION__); | ||
2374 | return -EINVAL; | 2395 | return -EINVAL; |
2375 | } | 2396 | } |
2376 | } | 2397 | } |
2377 | 2398 | ||
2378 | if (ug_info->cam && !ug_info->ecamptr) { | 2399 | if (ug_info->cam && !ug_info->ecamptr) { |
2379 | ugeth_err("%s: If cam mode is chosen, must supply cam ptr.", | 2400 | if (netif_msg_probe(ugeth)) |
2380 | __FUNCTION__); | 2401 | ugeth_err("%s: If cam mode is chosen, must supply cam ptr.", |
2402 | __FUNCTION__); | ||
2381 | return -EINVAL; | 2403 | return -EINVAL; |
2382 | } | 2404 | } |
2383 | 2405 | ||
2384 | if ((ug_info->numStationAddresses != | 2406 | if ((ug_info->numStationAddresses != |
2385 | UCC_GETH_NUM_OF_STATION_ADDRESSES_1) | 2407 | UCC_GETH_NUM_OF_STATION_ADDRESSES_1) |
2386 | && ug_info->rxExtendedFiltering) { | 2408 | && ug_info->rxExtendedFiltering) { |
2387 | ugeth_err("%s: Number of station addresses greater than 1 " | 2409 | if (netif_msg_probe(ugeth)) |
2388 | "not allowed in extended parsing mode.", | 2410 | ugeth_err("%s: Number of station addresses greater than 1 " |
2389 | __FUNCTION__); | 2411 | "not allowed in extended parsing mode.", |
2412 | __FUNCTION__); | ||
2390 | return -EINVAL; | 2413 | return -EINVAL; |
2391 | } | 2414 | } |
2392 | 2415 | ||
@@ -2399,7 +2422,8 @@ static int ucc_struct_init(struct ucc_geth_private *ugeth) | |||
2399 | uf_info->uccm_mask |= (UCCE_TXBF_SINGLE_MASK << i); | 2422 | uf_info->uccm_mask |= (UCCE_TXBF_SINGLE_MASK << i); |
2400 | /* Initialize the general fast UCC block. */ | 2423 | /* Initialize the general fast UCC block. */ |
2401 | if (ucc_fast_init(uf_info, &ugeth->uccf)) { | 2424 | if (ucc_fast_init(uf_info, &ugeth->uccf)) { |
2402 | ugeth_err("%s: Failed to init uccf.", __FUNCTION__); | 2425 | if (netif_msg_probe(ugeth)) |
2426 | ugeth_err("%s: Failed to init uccf.", __FUNCTION__); | ||
2403 | ucc_geth_memclean(ugeth); | 2427 | ucc_geth_memclean(ugeth); |
2404 | return -ENOMEM; | 2428 | return -ENOMEM; |
2405 | } | 2429 | } |
@@ -2452,7 +2476,9 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth) | |||
2452 | numThreadsRxNumerical = 8; | 2476 | numThreadsRxNumerical = 8; |
2453 | break; | 2477 | break; |
2454 | default: | 2478 | default: |
2455 | ugeth_err("%s: Bad number of Rx threads value.", __FUNCTION__); | 2479 | if (netif_msg_ifup(ugeth)) |
2480 | ugeth_err("%s: Bad number of Rx threads value.", | ||
2481 | __FUNCTION__); | ||
2456 | ucc_geth_memclean(ugeth); | 2482 | ucc_geth_memclean(ugeth); |
2457 | return -EINVAL; | 2483 | return -EINVAL; |
2458 | break; | 2484 | break; |
@@ -2475,7 +2501,9 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth) | |||
2475 | numThreadsTxNumerical = 8; | 2501 | numThreadsTxNumerical = 8; |
2476 | break; | 2502 | break; |
2477 | default: | 2503 | default: |
2478 | ugeth_err("%s: Bad number of Tx threads value.", __FUNCTION__); | 2504 | if (netif_msg_ifup(ugeth)) |
2505 | ugeth_err("%s: Bad number of Tx threads value.", | ||
2506 | __FUNCTION__); | ||
2479 | ucc_geth_memclean(ugeth); | 2507 | ucc_geth_memclean(ugeth); |
2480 | return -EINVAL; | 2508 | return -EINVAL; |
2481 | break; | 2509 | break; |
@@ -2507,7 +2535,7 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth) | |||
2507 | /* For more details see the hardware spec. */ | 2535 | /* For more details see the hardware spec. */ |
2508 | init_flow_control_params(ug_info->aufc, | 2536 | init_flow_control_params(ug_info->aufc, |
2509 | ug_info->receiveFlowControl, | 2537 | ug_info->receiveFlowControl, |
2510 | 1, | 2538 | ug_info->transmitFlowControl, |
2511 | ug_info->pausePeriod, | 2539 | ug_info->pausePeriod, |
2512 | ug_info->extensionField, | 2540 | ug_info->extensionField, |
2513 | &uf_regs->upsmr, | 2541 | &uf_regs->upsmr, |
@@ -2527,8 +2555,9 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth) | |||
2527 | ug_info->backToBackInterFrameGap, | 2555 | ug_info->backToBackInterFrameGap, |
2528 | &ug_regs->ipgifg); | 2556 | &ug_regs->ipgifg); |
2529 | if (ret_val != 0) { | 2557 | if (ret_val != 0) { |
2530 | ugeth_err("%s: IPGIFG initialization parameter too large.", | 2558 | if (netif_msg_ifup(ugeth)) |
2531 | __FUNCTION__); | 2559 | ugeth_err("%s: IPGIFG initialization parameter too large.", |
2560 | __FUNCTION__); | ||
2532 | ucc_geth_memclean(ugeth); | 2561 | ucc_geth_memclean(ugeth); |
2533 | return ret_val; | 2562 | return ret_val; |
2534 | } | 2563 | } |
@@ -2544,7 +2573,8 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth) | |||
2544 | ug_info->collisionWindow, | 2573 | ug_info->collisionWindow, |
2545 | &ug_regs->hafdup); | 2574 | &ug_regs->hafdup); |
2546 | if (ret_val != 0) { | 2575 | if (ret_val != 0) { |
2547 | ugeth_err("%s: Half Duplex initialization parameter too large.", | 2576 | if (netif_msg_ifup(ugeth)) |
2577 | ugeth_err("%s: Half Duplex initialization parameter too large.", | ||
2548 | __FUNCTION__); | 2578 | __FUNCTION__); |
2549 | ucc_geth_memclean(ugeth); | 2579 | ucc_geth_memclean(ugeth); |
2550 | return ret_val; | 2580 | return ret_val; |
@@ -2597,9 +2627,10 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth) | |||
2597 | tx_bd_ring_offset[j]); | 2627 | tx_bd_ring_offset[j]); |
2598 | } | 2628 | } |
2599 | if (!ugeth->p_tx_bd_ring[j]) { | 2629 | if (!ugeth->p_tx_bd_ring[j]) { |
2600 | ugeth_err | 2630 | if (netif_msg_ifup(ugeth)) |
2601 | ("%s: Can not allocate memory for Tx bd rings.", | 2631 | ugeth_err |
2602 | __FUNCTION__); | 2632 | ("%s: Can not allocate memory for Tx bd rings.", |
2633 | __FUNCTION__); | ||
2603 | ucc_geth_memclean(ugeth); | 2634 | ucc_geth_memclean(ugeth); |
2604 | return -ENOMEM; | 2635 | return -ENOMEM; |
2605 | } | 2636 | } |
@@ -2632,9 +2663,10 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth) | |||
2632 | rx_bd_ring_offset[j]); | 2663 | rx_bd_ring_offset[j]); |
2633 | } | 2664 | } |
2634 | if (!ugeth->p_rx_bd_ring[j]) { | 2665 | if (!ugeth->p_rx_bd_ring[j]) { |
2635 | ugeth_err | 2666 | if (netif_msg_ifup(ugeth)) |
2636 | ("%s: Can not allocate memory for Rx bd rings.", | 2667 | ugeth_err |
2637 | __FUNCTION__); | 2668 | ("%s: Can not allocate memory for Rx bd rings.", |
2669 | __FUNCTION__); | ||
2638 | ucc_geth_memclean(ugeth); | 2670 | ucc_geth_memclean(ugeth); |
2639 | return -ENOMEM; | 2671 | return -ENOMEM; |
2640 | } | 2672 | } |
@@ -2648,8 +2680,9 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth) | |||
2648 | GFP_KERNEL); | 2680 | GFP_KERNEL); |
2649 | 2681 | ||
2650 | if (ugeth->tx_skbuff[j] == NULL) { | 2682 | if (ugeth->tx_skbuff[j] == NULL) { |
2651 | ugeth_err("%s: Could not allocate tx_skbuff", | 2683 | if (netif_msg_ifup(ugeth)) |
2652 | __FUNCTION__); | 2684 | ugeth_err("%s: Could not allocate tx_skbuff", |
2685 | __FUNCTION__); | ||
2653 | ucc_geth_memclean(ugeth); | 2686 | ucc_geth_memclean(ugeth); |
2654 | return -ENOMEM; | 2687 | return -ENOMEM; |
2655 | } | 2688 | } |
@@ -2679,8 +2712,9 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth) | |||
2679 | GFP_KERNEL); | 2712 | GFP_KERNEL); |
2680 | 2713 | ||
2681 | if (ugeth->rx_skbuff[j] == NULL) { | 2714 | if (ugeth->rx_skbuff[j] == NULL) { |
2682 | ugeth_err("%s: Could not allocate rx_skbuff", | 2715 | if (netif_msg_ifup(ugeth)) |
2683 | __FUNCTION__); | 2716 | ugeth_err("%s: Could not allocate rx_skbuff", |
2717 | __FUNCTION__); | ||
2684 | ucc_geth_memclean(ugeth); | 2718 | ucc_geth_memclean(ugeth); |
2685 | return -ENOMEM; | 2719 | return -ENOMEM; |
2686 | } | 2720 | } |
@@ -2711,9 +2745,10 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth) | |||
2711 | qe_muram_alloc(sizeof(struct ucc_geth_tx_global_pram), | 2745 | qe_muram_alloc(sizeof(struct ucc_geth_tx_global_pram), |
2712 | UCC_GETH_TX_GLOBAL_PRAM_ALIGNMENT); | 2746 | UCC_GETH_TX_GLOBAL_PRAM_ALIGNMENT); |
2713 | if (IS_ERR_VALUE(ugeth->tx_glbl_pram_offset)) { | 2747 | if (IS_ERR_VALUE(ugeth->tx_glbl_pram_offset)) { |
2714 | ugeth_err | 2748 | if (netif_msg_ifup(ugeth)) |
2715 | ("%s: Can not allocate DPRAM memory for p_tx_glbl_pram.", | 2749 | ugeth_err |
2716 | __FUNCTION__); | 2750 | ("%s: Can not allocate DPRAM memory for p_tx_glbl_pram.", |
2751 | __FUNCTION__); | ||
2717 | ucc_geth_memclean(ugeth); | 2752 | ucc_geth_memclean(ugeth); |
2718 | return -ENOMEM; | 2753 | return -ENOMEM; |
2719 | } | 2754 | } |
@@ -2733,9 +2768,10 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth) | |||
2733 | 32 * (numThreadsTxNumerical == 1), | 2768 | 32 * (numThreadsTxNumerical == 1), |
2734 | UCC_GETH_THREAD_DATA_ALIGNMENT); | 2769 | UCC_GETH_THREAD_DATA_ALIGNMENT); |
2735 | if (IS_ERR_VALUE(ugeth->thread_dat_tx_offset)) { | 2770 | if (IS_ERR_VALUE(ugeth->thread_dat_tx_offset)) { |
2736 | ugeth_err | 2771 | if (netif_msg_ifup(ugeth)) |
2737 | ("%s: Can not allocate DPRAM memory for p_thread_data_tx.", | 2772 | ugeth_err |
2738 | __FUNCTION__); | 2773 | ("%s: Can not allocate DPRAM memory for p_thread_data_tx.", |
2774 | __FUNCTION__); | ||
2739 | ucc_geth_memclean(ugeth); | 2775 | ucc_geth_memclean(ugeth); |
2740 | return -ENOMEM; | 2776 | return -ENOMEM; |
2741 | } | 2777 | } |
@@ -2761,9 +2797,10 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth) | |||
2761 | sizeof(struct ucc_geth_send_queue_qd), | 2797 | sizeof(struct ucc_geth_send_queue_qd), |
2762 | UCC_GETH_SEND_QUEUE_QUEUE_DESCRIPTOR_ALIGNMENT); | 2798 | UCC_GETH_SEND_QUEUE_QUEUE_DESCRIPTOR_ALIGNMENT); |
2763 | if (IS_ERR_VALUE(ugeth->send_q_mem_reg_offset)) { | 2799 | if (IS_ERR_VALUE(ugeth->send_q_mem_reg_offset)) { |
2764 | ugeth_err | 2800 | if (netif_msg_ifup(ugeth)) |
2765 | ("%s: Can not allocate DPRAM memory for p_send_q_mem_reg.", | 2801 | ugeth_err |
2766 | __FUNCTION__); | 2802 | ("%s: Can not allocate DPRAM memory for p_send_q_mem_reg.", |
2803 | __FUNCTION__); | ||
2767 | ucc_geth_memclean(ugeth); | 2804 | ucc_geth_memclean(ugeth); |
2768 | return -ENOMEM; | 2805 | return -ENOMEM; |
2769 | } | 2806 | } |
@@ -2804,9 +2841,10 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth) | |||
2804 | qe_muram_alloc(sizeof(struct ucc_geth_scheduler), | 2841 | qe_muram_alloc(sizeof(struct ucc_geth_scheduler), |
2805 | UCC_GETH_SCHEDULER_ALIGNMENT); | 2842 | UCC_GETH_SCHEDULER_ALIGNMENT); |
2806 | if (IS_ERR_VALUE(ugeth->scheduler_offset)) { | 2843 | if (IS_ERR_VALUE(ugeth->scheduler_offset)) { |
2807 | ugeth_err | 2844 | if (netif_msg_ifup(ugeth)) |
2808 | ("%s: Can not allocate DPRAM memory for p_scheduler.", | 2845 | ugeth_err |
2809 | __FUNCTION__); | 2846 | ("%s: Can not allocate DPRAM memory for p_scheduler.", |
2847 | __FUNCTION__); | ||
2810 | ucc_geth_memclean(ugeth); | 2848 | ucc_geth_memclean(ugeth); |
2811 | return -ENOMEM; | 2849 | return -ENOMEM; |
2812 | } | 2850 | } |
@@ -2852,9 +2890,11 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth) | |||
2852 | (struct ucc_geth_tx_firmware_statistics_pram), | 2890 | (struct ucc_geth_tx_firmware_statistics_pram), |
2853 | UCC_GETH_TX_STATISTICS_ALIGNMENT); | 2891 | UCC_GETH_TX_STATISTICS_ALIGNMENT); |
2854 | if (IS_ERR_VALUE(ugeth->tx_fw_statistics_pram_offset)) { | 2892 | if (IS_ERR_VALUE(ugeth->tx_fw_statistics_pram_offset)) { |
2855 | ugeth_err | 2893 | if (netif_msg_ifup(ugeth)) |
2856 | ("%s: Can not allocate DPRAM memory for" | 2894 | ugeth_err |
2857 | " p_tx_fw_statistics_pram.", __FUNCTION__); | 2895 | ("%s: Can not allocate DPRAM memory for" |
2896 | " p_tx_fw_statistics_pram.", | ||
2897 | __FUNCTION__); | ||
2858 | ucc_geth_memclean(ugeth); | 2898 | ucc_geth_memclean(ugeth); |
2859 | return -ENOMEM; | 2899 | return -ENOMEM; |
2860 | } | 2900 | } |
@@ -2891,9 +2931,10 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth) | |||
2891 | qe_muram_alloc(sizeof(struct ucc_geth_rx_global_pram), | 2931 | qe_muram_alloc(sizeof(struct ucc_geth_rx_global_pram), |
2892 | UCC_GETH_RX_GLOBAL_PRAM_ALIGNMENT); | 2932 | UCC_GETH_RX_GLOBAL_PRAM_ALIGNMENT); |
2893 | if (IS_ERR_VALUE(ugeth->rx_glbl_pram_offset)) { | 2933 | if (IS_ERR_VALUE(ugeth->rx_glbl_pram_offset)) { |
2894 | ugeth_err | 2934 | if (netif_msg_ifup(ugeth)) |
2895 | ("%s: Can not allocate DPRAM memory for p_rx_glbl_pram.", | 2935 | ugeth_err |
2896 | __FUNCTION__); | 2936 | ("%s: Can not allocate DPRAM memory for p_rx_glbl_pram.", |
2937 | __FUNCTION__); | ||
2897 | ucc_geth_memclean(ugeth); | 2938 | ucc_geth_memclean(ugeth); |
2898 | return -ENOMEM; | 2939 | return -ENOMEM; |
2899 | } | 2940 | } |
@@ -2912,9 +2953,10 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth) | |||
2912 | sizeof(struct ucc_geth_thread_data_rx), | 2953 | sizeof(struct ucc_geth_thread_data_rx), |
2913 | UCC_GETH_THREAD_DATA_ALIGNMENT); | 2954 | UCC_GETH_THREAD_DATA_ALIGNMENT); |
2914 | if (IS_ERR_VALUE(ugeth->thread_dat_rx_offset)) { | 2955 | if (IS_ERR_VALUE(ugeth->thread_dat_rx_offset)) { |
2915 | ugeth_err | 2956 | if (netif_msg_ifup(ugeth)) |
2916 | ("%s: Can not allocate DPRAM memory for p_thread_data_rx.", | 2957 | ugeth_err |
2917 | __FUNCTION__); | 2958 | ("%s: Can not allocate DPRAM memory for p_thread_data_rx.", |
2959 | __FUNCTION__); | ||
2918 | ucc_geth_memclean(ugeth); | 2960 | ucc_geth_memclean(ugeth); |
2919 | return -ENOMEM; | 2961 | return -ENOMEM; |
2920 | } | 2962 | } |
@@ -2935,9 +2977,10 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth) | |||
2935 | (struct ucc_geth_rx_firmware_statistics_pram), | 2977 | (struct ucc_geth_rx_firmware_statistics_pram), |
2936 | UCC_GETH_RX_STATISTICS_ALIGNMENT); | 2978 | UCC_GETH_RX_STATISTICS_ALIGNMENT); |
2937 | if (IS_ERR_VALUE(ugeth->rx_fw_statistics_pram_offset)) { | 2979 | if (IS_ERR_VALUE(ugeth->rx_fw_statistics_pram_offset)) { |
2938 | ugeth_err | 2980 | if (netif_msg_ifup(ugeth)) |
2939 | ("%s: Can not allocate DPRAM memory for" | 2981 | ugeth_err |
2940 | " p_rx_fw_statistics_pram.", __FUNCTION__); | 2982 | ("%s: Can not allocate DPRAM memory for" |
2983 | " p_rx_fw_statistics_pram.", __FUNCTION__); | ||
2941 | ucc_geth_memclean(ugeth); | 2984 | ucc_geth_memclean(ugeth); |
2942 | return -ENOMEM; | 2985 | return -ENOMEM; |
2943 | } | 2986 | } |
@@ -2957,9 +3000,10 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth) | |||
2957 | sizeof(struct ucc_geth_rx_interrupt_coalescing_entry) | 3000 | sizeof(struct ucc_geth_rx_interrupt_coalescing_entry) |
2958 | + 4, UCC_GETH_RX_INTERRUPT_COALESCING_ALIGNMENT); | 3001 | + 4, UCC_GETH_RX_INTERRUPT_COALESCING_ALIGNMENT); |
2959 | if (IS_ERR_VALUE(ugeth->rx_irq_coalescing_tbl_offset)) { | 3002 | if (IS_ERR_VALUE(ugeth->rx_irq_coalescing_tbl_offset)) { |
2960 | ugeth_err | 3003 | if (netif_msg_ifup(ugeth)) |
2961 | ("%s: Can not allocate DPRAM memory for" | 3004 | ugeth_err |
2962 | " p_rx_irq_coalescing_tbl.", __FUNCTION__); | 3005 | ("%s: Can not allocate DPRAM memory for" |
3006 | " p_rx_irq_coalescing_tbl.", __FUNCTION__); | ||
2963 | ucc_geth_memclean(ugeth); | 3007 | ucc_geth_memclean(ugeth); |
2964 | return -ENOMEM; | 3008 | return -ENOMEM; |
2965 | } | 3009 | } |
@@ -3025,9 +3069,10 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth) | |||
3025 | sizeof(struct ucc_geth_rx_prefetched_bds)), | 3069 | sizeof(struct ucc_geth_rx_prefetched_bds)), |
3026 | UCC_GETH_RX_BD_QUEUES_ALIGNMENT); | 3070 | UCC_GETH_RX_BD_QUEUES_ALIGNMENT); |
3027 | if (IS_ERR_VALUE(ugeth->rx_bd_qs_tbl_offset)) { | 3071 | if (IS_ERR_VALUE(ugeth->rx_bd_qs_tbl_offset)) { |
3028 | ugeth_err | 3072 | if (netif_msg_ifup(ugeth)) |
3029 | ("%s: Can not allocate DPRAM memory for p_rx_bd_qs_tbl.", | 3073 | ugeth_err |
3030 | __FUNCTION__); | 3074 | ("%s: Can not allocate DPRAM memory for p_rx_bd_qs_tbl.", |
3075 | __FUNCTION__); | ||
3031 | ucc_geth_memclean(ugeth); | 3076 | ucc_geth_memclean(ugeth); |
3032 | return -ENOMEM; | 3077 | return -ENOMEM; |
3033 | } | 3078 | } |
@@ -3102,8 +3147,9 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth) | |||
3102 | /* initialize extended filtering */ | 3147 | /* initialize extended filtering */ |
3103 | if (ug_info->rxExtendedFiltering) { | 3148 | if (ug_info->rxExtendedFiltering) { |
3104 | if (!ug_info->extendedFilteringChainPointer) { | 3149 | if (!ug_info->extendedFilteringChainPointer) { |
3105 | ugeth_err("%s: Null Extended Filtering Chain Pointer.", | 3150 | if (netif_msg_ifup(ugeth)) |
3106 | __FUNCTION__); | 3151 | ugeth_err("%s: Null Extended Filtering Chain Pointer.", |
3152 | __FUNCTION__); | ||
3107 | ucc_geth_memclean(ugeth); | 3153 | ucc_geth_memclean(ugeth); |
3108 | return -EINVAL; | 3154 | return -EINVAL; |
3109 | } | 3155 | } |
@@ -3114,9 +3160,10 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth) | |||
3114 | qe_muram_alloc(sizeof(struct ucc_geth_exf_global_pram), | 3160 | qe_muram_alloc(sizeof(struct ucc_geth_exf_global_pram), |
3115 | UCC_GETH_RX_EXTENDED_FILTERING_GLOBAL_PARAMETERS_ALIGNMENT); | 3161 | UCC_GETH_RX_EXTENDED_FILTERING_GLOBAL_PARAMETERS_ALIGNMENT); |
3116 | if (IS_ERR_VALUE(ugeth->exf_glbl_param_offset)) { | 3162 | if (IS_ERR_VALUE(ugeth->exf_glbl_param_offset)) { |
3117 | ugeth_err | 3163 | if (netif_msg_ifup(ugeth)) |
3118 | ("%s: Can not allocate DPRAM memory for" | 3164 | ugeth_err |
3119 | " p_exf_glbl_param.", __FUNCTION__); | 3165 | ("%s: Can not allocate DPRAM memory for" |
3166 | " p_exf_glbl_param.", __FUNCTION__); | ||
3120 | ucc_geth_memclean(ugeth); | 3167 | ucc_geth_memclean(ugeth); |
3121 | return -ENOMEM; | 3168 | return -ENOMEM; |
3122 | } | 3169 | } |
@@ -3161,9 +3208,10 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth) | |||
3161 | */ | 3208 | */ |
3162 | if (!(ugeth->p_init_enet_param_shadow = | 3209 | if (!(ugeth->p_init_enet_param_shadow = |
3163 | kmalloc(sizeof(struct ucc_geth_init_pram), GFP_KERNEL))) { | 3210 | kmalloc(sizeof(struct ucc_geth_init_pram), GFP_KERNEL))) { |
3164 | ugeth_err | 3211 | if (netif_msg_ifup(ugeth)) |
3165 | ("%s: Can not allocate memory for" | 3212 | ugeth_err |
3166 | " p_UccInitEnetParamShadows.", __FUNCTION__); | 3213 | ("%s: Can not allocate memory for" |
3214 | " p_UccInitEnetParamShadows.", __FUNCTION__); | ||
3167 | ucc_geth_memclean(ugeth); | 3215 | ucc_geth_memclean(ugeth); |
3168 | return -ENOMEM; | 3216 | return -ENOMEM; |
3169 | } | 3217 | } |
@@ -3196,8 +3244,9 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth) | |||
3196 | QE_FLTR_LARGEST_EXTERNAL_TABLE_LOOKUP_KEY_SIZE_8_BYTES) | 3244 | QE_FLTR_LARGEST_EXTERNAL_TABLE_LOOKUP_KEY_SIZE_8_BYTES) |
3197 | && (ug_info->largestexternallookupkeysize != | 3245 | && (ug_info->largestexternallookupkeysize != |
3198 | QE_FLTR_LARGEST_EXTERNAL_TABLE_LOOKUP_KEY_SIZE_16_BYTES)) { | 3246 | QE_FLTR_LARGEST_EXTERNAL_TABLE_LOOKUP_KEY_SIZE_16_BYTES)) { |
3199 | ugeth_err("%s: Invalid largest External Lookup Key Size.", | 3247 | if (netif_msg_ifup(ugeth)) |
3200 | __FUNCTION__); | 3248 | ugeth_err("%s: Invalid largest External Lookup Key Size.", |
3249 | __FUNCTION__); | ||
3201 | ucc_geth_memclean(ugeth); | 3250 | ucc_geth_memclean(ugeth); |
3202 | return -EINVAL; | 3251 | return -EINVAL; |
3203 | } | 3252 | } |
@@ -3222,8 +3271,9 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth) | |||
3222 | /* Rx needs one extra for terminator */ | 3271 | /* Rx needs one extra for terminator */ |
3223 | , size, UCC_GETH_THREAD_RX_PRAM_ALIGNMENT, | 3272 | , size, UCC_GETH_THREAD_RX_PRAM_ALIGNMENT, |
3224 | ug_info->riscRx, 1)) != 0) { | 3273 | ug_info->riscRx, 1)) != 0) { |
3225 | ugeth_err("%s: Can not fill p_init_enet_param_shadow.", | 3274 | if (netif_msg_ifup(ugeth)) |
3226 | __FUNCTION__); | 3275 | ugeth_err("%s: Can not fill p_init_enet_param_shadow.", |
3276 | __FUNCTION__); | ||
3227 | ucc_geth_memclean(ugeth); | 3277 | ucc_geth_memclean(ugeth); |
3228 | return ret_val; | 3278 | return ret_val; |
3229 | } | 3279 | } |
@@ -3237,8 +3287,9 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth) | |||
3237 | sizeof(struct ucc_geth_thread_tx_pram), | 3287 | sizeof(struct ucc_geth_thread_tx_pram), |
3238 | UCC_GETH_THREAD_TX_PRAM_ALIGNMENT, | 3288 | UCC_GETH_THREAD_TX_PRAM_ALIGNMENT, |
3239 | ug_info->riscTx, 0)) != 0) { | 3289 | ug_info->riscTx, 0)) != 0) { |
3240 | ugeth_err("%s: Can not fill p_init_enet_param_shadow.", | 3290 | if (netif_msg_ifup(ugeth)) |
3241 | __FUNCTION__); | 3291 | ugeth_err("%s: Can not fill p_init_enet_param_shadow.", |
3292 | __FUNCTION__); | ||
3242 | ucc_geth_memclean(ugeth); | 3293 | ucc_geth_memclean(ugeth); |
3243 | return ret_val; | 3294 | return ret_val; |
3244 | } | 3295 | } |
@@ -3246,8 +3297,9 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth) | |||
3246 | /* Load Rx bds with buffers */ | 3297 | /* Load Rx bds with buffers */ |
3247 | for (i = 0; i < ug_info->numQueuesRx; i++) { | 3298 | for (i = 0; i < ug_info->numQueuesRx; i++) { |
3248 | if ((ret_val = rx_bd_buffer_set(ugeth, (u8) i)) != 0) { | 3299 | if ((ret_val = rx_bd_buffer_set(ugeth, (u8) i)) != 0) { |
3249 | ugeth_err("%s: Can not fill Rx bds with buffers.", | 3300 | if (netif_msg_ifup(ugeth)) |
3250 | __FUNCTION__); | 3301 | ugeth_err("%s: Can not fill Rx bds with buffers.", |
3302 | __FUNCTION__); | ||
3251 | ucc_geth_memclean(ugeth); | 3303 | ucc_geth_memclean(ugeth); |
3252 | return ret_val; | 3304 | return ret_val; |
3253 | } | 3305 | } |
@@ -3256,9 +3308,10 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth) | |||
3256 | /* Allocate InitEnet command parameter structure */ | 3308 | /* Allocate InitEnet command parameter structure */ |
3257 | init_enet_pram_offset = qe_muram_alloc(sizeof(struct ucc_geth_init_pram), 4); | 3309 | init_enet_pram_offset = qe_muram_alloc(sizeof(struct ucc_geth_init_pram), 4); |
3258 | if (IS_ERR_VALUE(init_enet_pram_offset)) { | 3310 | if (IS_ERR_VALUE(init_enet_pram_offset)) { |
3259 | ugeth_err | 3311 | if (netif_msg_ifup(ugeth)) |
3260 | ("%s: Can not allocate DPRAM memory for p_init_enet_pram.", | 3312 | ugeth_err |
3261 | __FUNCTION__); | 3313 | ("%s: Can not allocate DPRAM memory for p_init_enet_pram.", |
3314 | __FUNCTION__); | ||
3262 | ucc_geth_memclean(ugeth); | 3315 | ucc_geth_memclean(ugeth); |
3263 | return -ENOMEM; | 3316 | return -ENOMEM; |
3264 | } | 3317 | } |
@@ -3428,8 +3481,9 @@ static int ucc_geth_rx(struct ucc_geth_private *ugeth, u8 rxQ, int rx_work_limit | |||
3428 | if (!skb || | 3481 | if (!skb || |
3429 | (!(bd_status & (R_F | R_L))) || | 3482 | (!(bd_status & (R_F | R_L))) || |
3430 | (bd_status & R_ERRORS_FATAL)) { | 3483 | (bd_status & R_ERRORS_FATAL)) { |
3431 | ugeth_vdbg("%s, %d: ERROR!!! skb - 0x%08x", | 3484 | if (netif_msg_rx_err(ugeth)) |
3432 | __FUNCTION__, __LINE__, (u32) skb); | 3485 | ugeth_err("%s, %d: ERROR!!! skb - 0x%08x", |
3486 | __FUNCTION__, __LINE__, (u32) skb); | ||
3433 | if (skb) | 3487 | if (skb) |
3434 | dev_kfree_skb_any(skb); | 3488 | dev_kfree_skb_any(skb); |
3435 | 3489 | ||
@@ -3458,7 +3512,8 @@ static int ucc_geth_rx(struct ucc_geth_private *ugeth, u8 rxQ, int rx_work_limit | |||
3458 | 3512 | ||
3459 | skb = get_new_skb(ugeth, bd); | 3513 | skb = get_new_skb(ugeth, bd); |
3460 | if (!skb) { | 3514 | if (!skb) { |
3461 | ugeth_warn("%s: No Rx Data Buffer", __FUNCTION__); | 3515 | if (netif_msg_rx_err(ugeth)) |
3516 | ugeth_warn("%s: No Rx Data Buffer", __FUNCTION__); | ||
3462 | ugeth->stats.rx_dropped++; | 3517 | ugeth->stats.rx_dropped++; |
3463 | break; | 3518 | break; |
3464 | } | 3519 | } |
@@ -3649,28 +3704,32 @@ static int ucc_geth_open(struct net_device *dev) | |||
3649 | 3704 | ||
3650 | /* Test station address */ | 3705 | /* Test station address */ |
3651 | if (dev->dev_addr[0] & ENET_GROUP_ADDR) { | 3706 | if (dev->dev_addr[0] & ENET_GROUP_ADDR) { |
3652 | ugeth_err("%s: Multicast address used for station address" | 3707 | if (netif_msg_ifup(ugeth)) |
3653 | " - is this what you wanted?", __FUNCTION__); | 3708 | ugeth_err("%s: Multicast address used for station address" |
3709 | " - is this what you wanted?", __FUNCTION__); | ||
3654 | return -EINVAL; | 3710 | return -EINVAL; |
3655 | } | 3711 | } |
3656 | 3712 | ||
3657 | err = ucc_struct_init(ugeth); | 3713 | err = ucc_struct_init(ugeth); |
3658 | if (err) { | 3714 | if (err) { |
3659 | ugeth_err("%s: Cannot configure internal struct, aborting.", dev->name); | 3715 | if (netif_msg_ifup(ugeth)) |
3716 | ugeth_err("%s: Cannot configure internal struct, aborting.", dev->name); | ||
3660 | return err; | 3717 | return err; |
3661 | } | 3718 | } |
3662 | 3719 | ||
3663 | err = ucc_geth_startup(ugeth); | 3720 | err = ucc_geth_startup(ugeth); |
3664 | if (err) { | 3721 | if (err) { |
3665 | ugeth_err("%s: Cannot configure net device, aborting.", | 3722 | if (netif_msg_ifup(ugeth)) |
3666 | dev->name); | 3723 | ugeth_err("%s: Cannot configure net device, aborting.", |
3724 | dev->name); | ||
3667 | return err; | 3725 | return err; |
3668 | } | 3726 | } |
3669 | 3727 | ||
3670 | err = adjust_enet_interface(ugeth); | 3728 | err = adjust_enet_interface(ugeth); |
3671 | if (err) { | 3729 | if (err) { |
3672 | ugeth_err("%s: Cannot configure net device, aborting.", | 3730 | if (netif_msg_ifup(ugeth)) |
3673 | dev->name); | 3731 | ugeth_err("%s: Cannot configure net device, aborting.", |
3732 | dev->name); | ||
3674 | return err; | 3733 | return err; |
3675 | } | 3734 | } |
3676 | 3735 | ||
@@ -3687,7 +3746,8 @@ static int ucc_geth_open(struct net_device *dev) | |||
3687 | 3746 | ||
3688 | err = init_phy(dev); | 3747 | err = init_phy(dev); |
3689 | if (err) { | 3748 | if (err) { |
3690 | ugeth_err("%s: Cannot initialize PHY, aborting.", dev->name); | 3749 | if (netif_msg_ifup(ugeth)) |
3750 | ugeth_err("%s: Cannot initialize PHY, aborting.", dev->name); | ||
3691 | return err; | 3751 | return err; |
3692 | } | 3752 | } |
3693 | 3753 | ||
@@ -3697,15 +3757,17 @@ static int ucc_geth_open(struct net_device *dev) | |||
3697 | request_irq(ugeth->ug_info->uf_info.irq, ucc_geth_irq_handler, 0, | 3757 | request_irq(ugeth->ug_info->uf_info.irq, ucc_geth_irq_handler, 0, |
3698 | "UCC Geth", dev); | 3758 | "UCC Geth", dev); |
3699 | if (err) { | 3759 | if (err) { |
3700 | ugeth_err("%s: Cannot get IRQ for net device, aborting.", | 3760 | if (netif_msg_ifup(ugeth)) |
3701 | dev->name); | 3761 | ugeth_err("%s: Cannot get IRQ for net device, aborting.", |
3762 | dev->name); | ||
3702 | ucc_geth_stop(ugeth); | 3763 | ucc_geth_stop(ugeth); |
3703 | return err; | 3764 | return err; |
3704 | } | 3765 | } |
3705 | 3766 | ||
3706 | err = ugeth_enable(ugeth, COMM_DIR_RX_AND_TX); | 3767 | err = ugeth_enable(ugeth, COMM_DIR_RX_AND_TX); |
3707 | if (err) { | 3768 | if (err) { |
3708 | ugeth_err("%s: Cannot enable net device, aborting.", dev->name); | 3769 | if (netif_msg_ifup(ugeth)) |
3770 | ugeth_err("%s: Cannot enable net device, aborting.", dev->name); | ||
3709 | ucc_geth_stop(ugeth); | 3771 | ucc_geth_stop(ugeth); |
3710 | return err; | 3772 | return err; |
3711 | } | 3773 | } |
@@ -3732,8 +3794,6 @@ static int ucc_geth_close(struct net_device *dev) | |||
3732 | return 0; | 3794 | return 0; |
3733 | } | 3795 | } |
3734 | 3796 | ||
3735 | const struct ethtool_ops ucc_geth_ethtool_ops = { }; | ||
3736 | |||
3737 | static phy_interface_t to_phy_interface(const char *phy_connection_type) | 3797 | static phy_interface_t to_phy_interface(const char *phy_connection_type) |
3738 | { | 3798 | { |
3739 | if (strcasecmp(phy_connection_type, "mii") == 0) | 3799 | if (strcasecmp(phy_connection_type, "mii") == 0) |
@@ -3790,6 +3850,13 @@ static int ucc_geth_probe(struct of_device* ofdev, const struct of_device_id *ma | |||
3790 | return -ENODEV; | 3850 | return -ENODEV; |
3791 | 3851 | ||
3792 | ug_info = &ugeth_info[ucc_num]; | 3852 | ug_info = &ugeth_info[ucc_num]; |
3853 | if (ug_info == NULL) { | ||
3854 | if (netif_msg_probe(&debug)) | ||
3855 | ugeth_err("%s: [%d] Missing additional data!", | ||
3856 | __FUNCTION__, ucc_num); | ||
3857 | return -ENODEV; | ||
3858 | } | ||
3859 | |||
3793 | ug_info->uf_info.ucc_num = ucc_num; | 3860 | ug_info->uf_info.ucc_num = ucc_num; |
3794 | 3861 | ||
3795 | prop = of_get_property(np, "rx-clock", NULL); | 3862 | prop = of_get_property(np, "rx-clock", NULL); |
@@ -3868,15 +3935,10 @@ static int ucc_geth_probe(struct of_device* ofdev, const struct of_device_id *ma | |||
3868 | 3935 | ||
3869 | ug_info->mdio_bus = res.start; | 3936 | ug_info->mdio_bus = res.start; |
3870 | 3937 | ||
3871 | printk(KERN_INFO "ucc_geth: UCC%1d at 0x%8x (irq = %d) \n", | 3938 | if (netif_msg_probe(&debug)) |
3872 | ug_info->uf_info.ucc_num + 1, ug_info->uf_info.regs, | 3939 | printk(KERN_INFO "ucc_geth: UCC%1d at 0x%8x (irq = %d) \n", |
3873 | ug_info->uf_info.irq); | 3940 | ug_info->uf_info.ucc_num + 1, ug_info->uf_info.regs, |
3874 | 3941 | ug_info->uf_info.irq); | |
3875 | if (ug_info == NULL) { | ||
3876 | ugeth_err("%s: [%d] Missing additional data!", __FUNCTION__, | ||
3877 | ucc_num); | ||
3878 | return -ENODEV; | ||
3879 | } | ||
3880 | 3942 | ||
3881 | /* Create an ethernet device instance */ | 3943 | /* Create an ethernet device instance */ |
3882 | dev = alloc_etherdev(sizeof(*ugeth)); | 3944 | dev = alloc_etherdev(sizeof(*ugeth)); |
@@ -3896,6 +3958,7 @@ static int ucc_geth_probe(struct of_device* ofdev, const struct of_device_id *ma | |||
3896 | SET_NETDEV_DEV(dev, device); | 3958 | SET_NETDEV_DEV(dev, device); |
3897 | 3959 | ||
3898 | /* Fill in the dev structure */ | 3960 | /* Fill in the dev structure */ |
3961 | uec_set_ethtool_ops(dev); | ||
3899 | dev->open = ucc_geth_open; | 3962 | dev->open = ucc_geth_open; |
3900 | dev->hard_start_xmit = ucc_geth_start_xmit; | 3963 | dev->hard_start_xmit = ucc_geth_start_xmit; |
3901 | dev->tx_timeout = ucc_geth_timeout; | 3964 | dev->tx_timeout = ucc_geth_timeout; |
@@ -3909,16 +3972,16 @@ static int ucc_geth_probe(struct of_device* ofdev, const struct of_device_id *ma | |||
3909 | // dev->change_mtu = ucc_geth_change_mtu; | 3972 | // dev->change_mtu = ucc_geth_change_mtu; |
3910 | dev->mtu = 1500; | 3973 | dev->mtu = 1500; |
3911 | dev->set_multicast_list = ucc_geth_set_multi; | 3974 | dev->set_multicast_list = ucc_geth_set_multi; |
3912 | dev->ethtool_ops = &ucc_geth_ethtool_ops; | ||
3913 | 3975 | ||
3914 | ugeth->msg_enable = (NETIF_MSG_IFUP << 1 ) - 1; | 3976 | ugeth->msg_enable = netif_msg_init(debug.msg_enable, UGETH_MSG_DEFAULT); |
3915 | ugeth->phy_interface = phy_interface; | 3977 | ugeth->phy_interface = phy_interface; |
3916 | ugeth->max_speed = max_speed; | 3978 | ugeth->max_speed = max_speed; |
3917 | 3979 | ||
3918 | err = register_netdev(dev); | 3980 | err = register_netdev(dev); |
3919 | if (err) { | 3981 | if (err) { |
3920 | ugeth_err("%s: Cannot register net device, aborting.", | 3982 | if (netif_msg_probe(ugeth)) |
3921 | dev->name); | 3983 | ugeth_err("%s: Cannot register net device, aborting.", |
3984 | dev->name); | ||
3922 | free_netdev(dev); | 3985 | free_netdev(dev); |
3923 | return err; | 3986 | return err; |
3924 | } | 3987 | } |
@@ -3972,7 +4035,8 @@ static int __init ucc_geth_init(void) | |||
3972 | if (ret) | 4035 | if (ret) |
3973 | return ret; | 4036 | return ret; |
3974 | 4037 | ||
3975 | printk(KERN_INFO "ucc_geth: " DRV_DESC "\n"); | 4038 | if (netif_msg_drv(&debug)) |
4039 | printk(KERN_INFO "ucc_geth: " DRV_DESC "\n"); | ||
3976 | for (i = 0; i < 8; i++) | 4040 | for (i = 0; i < 8; i++) |
3977 | memcpy(&(ugeth_info[i]), &ugeth_primary_info, | 4041 | memcpy(&(ugeth_info[i]), &ugeth_primary_info, |
3978 | sizeof(ugeth_primary_info)); | 4042 | sizeof(ugeth_primary_info)); |
diff --git a/drivers/net/ucc_geth.h b/drivers/net/ucc_geth.h index a29e1c3ca4b7..bb4dac8c0c65 100644 --- a/drivers/net/ucc_geth.h +++ b/drivers/net/ucc_geth.h | |||
@@ -30,6 +30,10 @@ | |||
30 | 30 | ||
31 | #include "ucc_geth_mii.h" | 31 | #include "ucc_geth_mii.h" |
32 | 32 | ||
33 | #define DRV_DESC "QE UCC Gigabit Ethernet Controller" | ||
34 | #define DRV_NAME "ucc_geth" | ||
35 | #define DRV_VERSION "1.1" | ||
36 | |||
33 | #define NUM_TX_QUEUES 8 | 37 | #define NUM_TX_QUEUES 8 |
34 | #define NUM_RX_QUEUES 8 | 38 | #define NUM_RX_QUEUES 8 |
35 | #define NUM_BDS_IN_PREFETCHED_BDS 4 | 39 | #define NUM_BDS_IN_PREFETCHED_BDS 4 |
@@ -896,6 +900,7 @@ struct ucc_geth_hardware_statistics { | |||
896 | #define UCC_GETH_TX_VTAG_TABLE_ENTRY_MAX 8 | 900 | #define UCC_GETH_TX_VTAG_TABLE_ENTRY_MAX 8 |
897 | #define UCC_GETH_RX_BD_RING_SIZE_MIN 8 | 901 | #define UCC_GETH_RX_BD_RING_SIZE_MIN 8 |
898 | #define UCC_GETH_TX_BD_RING_SIZE_MIN 2 | 902 | #define UCC_GETH_TX_BD_RING_SIZE_MIN 2 |
903 | #define UCC_GETH_BD_RING_SIZE_MAX 0xffff | ||
899 | 904 | ||
900 | #define UCC_GETH_SIZE_OF_BD QE_SIZEOF_BD | 905 | #define UCC_GETH_SIZE_OF_BD QE_SIZEOF_BD |
901 | 906 | ||
@@ -1135,6 +1140,7 @@ struct ucc_geth_info { | |||
1135 | int bro; | 1140 | int bro; |
1136 | int ecm; | 1141 | int ecm; |
1137 | int receiveFlowControl; | 1142 | int receiveFlowControl; |
1143 | int transmitFlowControl; | ||
1138 | u8 maxGroupAddrInHash; | 1144 | u8 maxGroupAddrInHash; |
1139 | u8 maxIndAddrInHash; | 1145 | u8 maxIndAddrInHash; |
1140 | u8 prel; | 1146 | u8 prel; |
diff --git a/drivers/net/ucc_geth_ethtool.c b/drivers/net/ucc_geth_ethtool.c new file mode 100644 index 000000000000..a8994c7b8583 --- /dev/null +++ b/drivers/net/ucc_geth_ethtool.c | |||
@@ -0,0 +1,388 @@ | |||
1 | /* | ||
2 | * Copyright (c) 2007 Freescale Semiconductor, Inc. All rights reserved. | ||
3 | * | ||
4 | * Description: QE UCC Gigabit Ethernet Ethtool API Set | ||
5 | * | ||
6 | * Author: Li Yang <leoli@freescale.com> | ||
7 | * | ||
8 | * Limitation: | ||
9 | * Can only get/set setttings of the first queue. | ||
10 | * Need to re-open the interface manually after changing some paramters. | ||
11 | * | ||
12 | * This program is free software; you can redistribute it and/or modify it | ||
13 | * under the terms of the GNU General Public License as published by the | ||
14 | * Free Software Foundation; either version 2 of the License, or (at your | ||
15 | * option) any later version. | ||
16 | */ | ||
17 | |||
18 | #include <linux/kernel.h> | ||
19 | #include <linux/init.h> | ||
20 | #include <linux/errno.h> | ||
21 | #include <linux/slab.h> | ||
22 | #include <linux/stddef.h> | ||
23 | #include <linux/interrupt.h> | ||
24 | #include <linux/netdevice.h> | ||
25 | #include <linux/etherdevice.h> | ||
26 | #include <linux/skbuff.h> | ||
27 | #include <linux/spinlock.h> | ||
28 | #include <linux/mm.h> | ||
29 | #include <linux/delay.h> | ||
30 | #include <linux/dma-mapping.h> | ||
31 | #include <linux/fsl_devices.h> | ||
32 | #include <linux/ethtool.h> | ||
33 | #include <linux/mii.h> | ||
34 | #include <linux/phy.h> | ||
35 | |||
36 | #include <asm/io.h> | ||
37 | #include <asm/irq.h> | ||
38 | #include <asm/uaccess.h> | ||
39 | #include <asm/types.h> | ||
40 | #include <asm/uaccess.h> | ||
41 | |||
42 | #include "ucc_geth.h" | ||
43 | #include "ucc_geth_mii.h" | ||
44 | |||
45 | static char hw_stat_gstrings[][ETH_GSTRING_LEN] = { | ||
46 | "tx-64-frames", | ||
47 | "tx-65-127-frames", | ||
48 | "tx-128-255-frames", | ||
49 | "rx-64-frames", | ||
50 | "rx-65-127-frames", | ||
51 | "rx-128-255-frames", | ||
52 | "tx-bytes-ok", | ||
53 | "tx-pause-frames", | ||
54 | "tx-multicast-frames", | ||
55 | "tx-broadcast-frames", | ||
56 | "rx-frames", | ||
57 | "rx-bytes-ok", | ||
58 | "rx-bytes-all", | ||
59 | "rx-multicast-frames", | ||
60 | "rx-broadcast-frames", | ||
61 | "stats-counter-carry", | ||
62 | "stats-counter-mask", | ||
63 | "rx-dropped-frames", | ||
64 | }; | ||
65 | |||
66 | static char tx_fw_stat_gstrings[][ETH_GSTRING_LEN] = { | ||
67 | "tx-single-collision", | ||
68 | "tx-multiple-collision", | ||
69 | "tx-late-collsion", | ||
70 | "tx-aborted-frames", | ||
71 | "tx-lost-frames", | ||
72 | "tx-carrier-sense-errors", | ||
73 | "tx-frames-ok", | ||
74 | "tx-excessive-differ-frames", | ||
75 | "tx-256-511-frames", | ||
76 | "tx-1024-1518-frames", | ||
77 | "tx-jumbo-frames", | ||
78 | }; | ||
79 | |||
80 | static char rx_fw_stat_gstrings[][ETH_GSTRING_LEN] = { | ||
81 | "rx-crc-errors", | ||
82 | "rx-alignment-errors", | ||
83 | "rx-in-range-length-errors", | ||
84 | "rx-out-of-range-length-errors", | ||
85 | "rx-too-long-frames", | ||
86 | "rx-runt", | ||
87 | "rx-very-long-event", | ||
88 | "rx-symbol-errors", | ||
89 | "rx-busy-drop-frames", | ||
90 | "reserved", | ||
91 | "reserved", | ||
92 | "rx-mismatch-drop-frames", | ||
93 | "rx-small-than-64", | ||
94 | "rx-256-511-frames", | ||
95 | "rx-512-1023-frames", | ||
96 | "rx-1024-1518-frames", | ||
97 | "rx-jumbo-frames", | ||
98 | "rx-mac-error-loss", | ||
99 | "rx-pause-frames", | ||
100 | "reserved", | ||
101 | "rx-vlan-removed", | ||
102 | "rx-vlan-replaced", | ||
103 | "rx-vlan-inserted", | ||
104 | "rx-ip-checksum-errors", | ||
105 | }; | ||
106 | |||
107 | #define UEC_HW_STATS_LEN ARRAY_SIZE(hw_stat_gstrings) | ||
108 | #define UEC_TX_FW_STATS_LEN ARRAY_SIZE(tx_fw_stat_gstrings) | ||
109 | #define UEC_RX_FW_STATS_LEN ARRAY_SIZE(rx_fw_stat_gstrings) | ||
110 | |||
111 | extern int init_flow_control_params(u32 automatic_flow_control_mode, | ||
112 | int rx_flow_control_enable, | ||
113 | int tx_flow_control_enable, u16 pause_period, | ||
114 | u16 extension_field, volatile u32 *upsmr_register, | ||
115 | volatile u32 *uempr_register, volatile u32 *maccfg1_register); | ||
116 | |||
117 | static int | ||
118 | uec_get_settings(struct net_device *netdev, struct ethtool_cmd *ecmd) | ||
119 | { | ||
120 | struct ucc_geth_private *ugeth = netdev_priv(netdev); | ||
121 | struct phy_device *phydev = ugeth->phydev; | ||
122 | struct ucc_geth_info *ug_info = ugeth->ug_info; | ||
123 | |||
124 | if (!phydev) | ||
125 | return -ENODEV; | ||
126 | |||
127 | ecmd->maxtxpkt = 1; | ||
128 | ecmd->maxrxpkt = ug_info->interruptcoalescingmaxvalue[0]; | ||
129 | |||
130 | return phy_ethtool_gset(phydev, ecmd); | ||
131 | } | ||
132 | |||
133 | static int | ||
134 | uec_set_settings(struct net_device *netdev, struct ethtool_cmd *ecmd) | ||
135 | { | ||
136 | struct ucc_geth_private *ugeth = netdev_priv(netdev); | ||
137 | struct phy_device *phydev = ugeth->phydev; | ||
138 | |||
139 | if (!phydev) | ||
140 | return -ENODEV; | ||
141 | |||
142 | return phy_ethtool_sset(phydev, ecmd); | ||
143 | } | ||
144 | |||
145 | static void | ||
146 | uec_get_pauseparam(struct net_device *netdev, | ||
147 | struct ethtool_pauseparam *pause) | ||
148 | { | ||
149 | struct ucc_geth_private *ugeth = netdev_priv(netdev); | ||
150 | |||
151 | pause->autoneg = ugeth->phydev->autoneg; | ||
152 | |||
153 | if (ugeth->ug_info->receiveFlowControl) | ||
154 | pause->rx_pause = 1; | ||
155 | if (ugeth->ug_info->transmitFlowControl) | ||
156 | pause->tx_pause = 1; | ||
157 | } | ||
158 | |||
159 | static int | ||
160 | uec_set_pauseparam(struct net_device *netdev, | ||
161 | struct ethtool_pauseparam *pause) | ||
162 | { | ||
163 | struct ucc_geth_private *ugeth = netdev_priv(netdev); | ||
164 | int ret = 0; | ||
165 | |||
166 | ugeth->ug_info->receiveFlowControl = pause->rx_pause; | ||
167 | ugeth->ug_info->transmitFlowControl = pause->tx_pause; | ||
168 | |||
169 | if (ugeth->phydev->autoneg) { | ||
170 | if (netif_running(netdev)) { | ||
171 | /* FIXME: automatically restart */ | ||
172 | printk(KERN_INFO | ||
173 | "Please re-open the interface.\n"); | ||
174 | } | ||
175 | } else { | ||
176 | struct ucc_geth_info *ug_info = ugeth->ug_info; | ||
177 | |||
178 | ret = init_flow_control_params(ug_info->aufc, | ||
179 | ug_info->receiveFlowControl, | ||
180 | ug_info->transmitFlowControl, | ||
181 | ug_info->pausePeriod, | ||
182 | ug_info->extensionField, | ||
183 | &ugeth->uccf->uf_regs->upsmr, | ||
184 | &ugeth->ug_regs->uempr, | ||
185 | &ugeth->ug_regs->maccfg1); | ||
186 | } | ||
187 | |||
188 | return ret; | ||
189 | } | ||
190 | |||
191 | static uint32_t | ||
192 | uec_get_msglevel(struct net_device *netdev) | ||
193 | { | ||
194 | struct ucc_geth_private *ugeth = netdev_priv(netdev); | ||
195 | return ugeth->msg_enable; | ||
196 | } | ||
197 | |||
198 | static void | ||
199 | uec_set_msglevel(struct net_device *netdev, uint32_t data) | ||
200 | { | ||
201 | struct ucc_geth_private *ugeth = netdev_priv(netdev); | ||
202 | ugeth->msg_enable = data; | ||
203 | } | ||
204 | |||
205 | static int | ||
206 | uec_get_regs_len(struct net_device *netdev) | ||
207 | { | ||
208 | return sizeof(struct ucc_geth); | ||
209 | } | ||
210 | |||
211 | static void | ||
212 | uec_get_regs(struct net_device *netdev, | ||
213 | struct ethtool_regs *regs, void *p) | ||
214 | { | ||
215 | int i; | ||
216 | struct ucc_geth_private *ugeth = netdev_priv(netdev); | ||
217 | u32 __iomem *ug_regs = (u32 __iomem *)ugeth->ug_regs; | ||
218 | u32 *buff = p; | ||
219 | |||
220 | for (i = 0; i < sizeof(struct ucc_geth) / sizeof(u32); i++) | ||
221 | buff[i] = in_be32(&ug_regs[i]); | ||
222 | } | ||
223 | |||
224 | static void | ||
225 | uec_get_ringparam(struct net_device *netdev, | ||
226 | struct ethtool_ringparam *ring) | ||
227 | { | ||
228 | struct ucc_geth_private *ugeth = netdev_priv(netdev); | ||
229 | struct ucc_geth_info *ug_info = ugeth->ug_info; | ||
230 | int queue = 0; | ||
231 | |||
232 | ring->rx_max_pending = UCC_GETH_BD_RING_SIZE_MAX; | ||
233 | ring->rx_mini_max_pending = UCC_GETH_BD_RING_SIZE_MAX; | ||
234 | ring->rx_jumbo_max_pending = UCC_GETH_BD_RING_SIZE_MAX; | ||
235 | ring->tx_max_pending = UCC_GETH_BD_RING_SIZE_MAX; | ||
236 | |||
237 | ring->rx_pending = ug_info->bdRingLenRx[queue]; | ||
238 | ring->rx_mini_pending = ug_info->bdRingLenRx[queue]; | ||
239 | ring->rx_jumbo_pending = ug_info->bdRingLenRx[queue]; | ||
240 | ring->tx_pending = ug_info->bdRingLenTx[queue]; | ||
241 | } | ||
242 | |||
243 | static int | ||
244 | uec_set_ringparam(struct net_device *netdev, | ||
245 | struct ethtool_ringparam *ring) | ||
246 | { | ||
247 | struct ucc_geth_private *ugeth = netdev_priv(netdev); | ||
248 | struct ucc_geth_info *ug_info = ugeth->ug_info; | ||
249 | int queue = 0, ret = 0; | ||
250 | |||
251 | if (ring->rx_pending < UCC_GETH_RX_BD_RING_SIZE_MIN) { | ||
252 | printk("%s: RxBD ring size must be no smaller than %d.\n", | ||
253 | netdev->name, UCC_GETH_RX_BD_RING_SIZE_MIN); | ||
254 | return -EINVAL; | ||
255 | } | ||
256 | if (ring->rx_pending % UCC_GETH_RX_BD_RING_SIZE_ALIGNMENT) { | ||
257 | printk("%s: RxBD ring size must be multiple of %d.\n", | ||
258 | netdev->name, UCC_GETH_RX_BD_RING_SIZE_ALIGNMENT); | ||
259 | return -EINVAL; | ||
260 | } | ||
261 | if (ring->tx_pending < UCC_GETH_TX_BD_RING_SIZE_MIN) { | ||
262 | printk("%s: TxBD ring size must be no smaller than %d.\n", | ||
263 | netdev->name, UCC_GETH_TX_BD_RING_SIZE_MIN); | ||
264 | return -EINVAL; | ||
265 | } | ||
266 | |||
267 | ug_info->bdRingLenRx[queue] = ring->rx_pending; | ||
268 | ug_info->bdRingLenTx[queue] = ring->tx_pending; | ||
269 | |||
270 | if (netif_running(netdev)) { | ||
271 | /* FIXME: restart automatically */ | ||
272 | printk(KERN_INFO | ||
273 | "Please re-open the interface.\n"); | ||
274 | } | ||
275 | |||
276 | return ret; | ||
277 | } | ||
278 | |||
279 | static int uec_get_stats_count(struct net_device *netdev) | ||
280 | { | ||
281 | struct ucc_geth_private *ugeth = netdev_priv(netdev); | ||
282 | u32 stats_mode = ugeth->ug_info->statisticsMode; | ||
283 | int len = 0; | ||
284 | |||
285 | if (stats_mode & UCC_GETH_STATISTICS_GATHERING_MODE_HARDWARE) | ||
286 | len += UEC_HW_STATS_LEN; | ||
287 | if (stats_mode & UCC_GETH_STATISTICS_GATHERING_MODE_FIRMWARE_TX) | ||
288 | len += UEC_TX_FW_STATS_LEN; | ||
289 | if (stats_mode & UCC_GETH_STATISTICS_GATHERING_MODE_FIRMWARE_RX) | ||
290 | len += UEC_RX_FW_STATS_LEN; | ||
291 | |||
292 | return len; | ||
293 | } | ||
294 | |||
295 | static void uec_get_strings(struct net_device *netdev, u32 stringset, u8 *buf) | ||
296 | { | ||
297 | struct ucc_geth_private *ugeth = netdev_priv(netdev); | ||
298 | u32 stats_mode = ugeth->ug_info->statisticsMode; | ||
299 | |||
300 | if (stats_mode & UCC_GETH_STATISTICS_GATHERING_MODE_HARDWARE) { | ||
301 | memcpy(buf, hw_stat_gstrings, UEC_HW_STATS_LEN * | ||
302 | ETH_GSTRING_LEN); | ||
303 | buf += UEC_HW_STATS_LEN * ETH_GSTRING_LEN; | ||
304 | } | ||
305 | if (stats_mode & UCC_GETH_STATISTICS_GATHERING_MODE_FIRMWARE_TX) { | ||
306 | memcpy(buf, tx_fw_stat_gstrings, UEC_TX_FW_STATS_LEN * | ||
307 | ETH_GSTRING_LEN); | ||
308 | buf += UEC_TX_FW_STATS_LEN * ETH_GSTRING_LEN; | ||
309 | } | ||
310 | if (stats_mode & UCC_GETH_STATISTICS_GATHERING_MODE_FIRMWARE_RX) | ||
311 | memcpy(buf, tx_fw_stat_gstrings, UEC_RX_FW_STATS_LEN * | ||
312 | ETH_GSTRING_LEN); | ||
313 | } | ||
314 | |||
315 | static void uec_get_ethtool_stats(struct net_device *netdev, | ||
316 | struct ethtool_stats *stats, uint64_t *data) | ||
317 | { | ||
318 | struct ucc_geth_private *ugeth = netdev_priv(netdev); | ||
319 | u32 stats_mode = ugeth->ug_info->statisticsMode; | ||
320 | u32 __iomem *base; | ||
321 | int i, j = 0; | ||
322 | |||
323 | if (stats_mode & UCC_GETH_STATISTICS_GATHERING_MODE_HARDWARE) { | ||
324 | base = (u32 __iomem *)&ugeth->ug_regs->tx64; | ||
325 | for (i = 0; i < UEC_HW_STATS_LEN; i++) | ||
326 | data[j++] = (u64)in_be32(&base[i]); | ||
327 | } | ||
328 | if (stats_mode & UCC_GETH_STATISTICS_GATHERING_MODE_FIRMWARE_TX) { | ||
329 | base = (u32 __iomem *)ugeth->p_tx_fw_statistics_pram; | ||
330 | for (i = 0; i < UEC_TX_FW_STATS_LEN; i++) | ||
331 | data[j++] = (u64)in_be32(&base[i]); | ||
332 | } | ||
333 | if (stats_mode & UCC_GETH_STATISTICS_GATHERING_MODE_FIRMWARE_RX) { | ||
334 | base = (u32 __iomem *)ugeth->p_rx_fw_statistics_pram; | ||
335 | for (i = 0; i < UEC_RX_FW_STATS_LEN; i++) | ||
336 | data[j++] = (u64)in_be32(&base[i]); | ||
337 | } | ||
338 | } | ||
339 | |||
340 | static int uec_nway_reset(struct net_device *netdev) | ||
341 | { | ||
342 | struct ucc_geth_private *ugeth = netdev_priv(netdev); | ||
343 | |||
344 | return phy_start_aneg(ugeth->phydev); | ||
345 | } | ||
346 | |||
347 | /* Report driver information */ | ||
348 | static void | ||
349 | uec_get_drvinfo(struct net_device *netdev, | ||
350 | struct ethtool_drvinfo *drvinfo) | ||
351 | { | ||
352 | strncpy(drvinfo->driver, DRV_NAME, 32); | ||
353 | strncpy(drvinfo->version, DRV_VERSION, 32); | ||
354 | strncpy(drvinfo->fw_version, "N/A", 32); | ||
355 | strncpy(drvinfo->bus_info, "QUICC ENGINE", 32); | ||
356 | drvinfo->n_stats = uec_get_stats_count(netdev); | ||
357 | drvinfo->testinfo_len = 0; | ||
358 | drvinfo->eedump_len = 0; | ||
359 | drvinfo->regdump_len = uec_get_regs_len(netdev); | ||
360 | } | ||
361 | |||
362 | static const struct ethtool_ops uec_ethtool_ops = { | ||
363 | .get_settings = uec_get_settings, | ||
364 | .set_settings = uec_set_settings, | ||
365 | .get_drvinfo = uec_get_drvinfo, | ||
366 | .get_regs_len = uec_get_regs_len, | ||
367 | .get_regs = uec_get_regs, | ||
368 | .get_msglevel = uec_get_msglevel, | ||
369 | .set_msglevel = uec_set_msglevel, | ||
370 | .nway_reset = uec_nway_reset, | ||
371 | .get_link = ethtool_op_get_link, | ||
372 | .get_ringparam = uec_get_ringparam, | ||
373 | .set_ringparam = uec_set_ringparam, | ||
374 | .get_pauseparam = uec_get_pauseparam, | ||
375 | .set_pauseparam = uec_set_pauseparam, | ||
376 | .get_sg = ethtool_op_get_sg, | ||
377 | .set_sg = ethtool_op_set_sg, | ||
378 | .get_tso = ethtool_op_get_tso, | ||
379 | .get_stats_count = uec_get_stats_count, | ||
380 | .get_strings = uec_get_strings, | ||
381 | .get_ethtool_stats = uec_get_ethtool_stats, | ||
382 | .get_perm_addr = ethtool_op_get_perm_addr, | ||
383 | }; | ||
384 | |||
385 | void uec_set_ethtool_ops(struct net_device *netdev) | ||
386 | { | ||
387 | SET_ETHTOOL_OPS(netdev, &uec_ethtool_ops); | ||
388 | } | ||
diff --git a/drivers/net/ucc_geth_mii.c b/drivers/net/ucc_geth_mii.c index 7bcb82f50cf7..5f8c2d30a328 100644 --- a/drivers/net/ucc_geth_mii.c +++ b/drivers/net/ucc_geth_mii.c | |||
@@ -54,8 +54,8 @@ | |||
54 | #define vdbg(format, arg...) do {} while(0) | 54 | #define vdbg(format, arg...) do {} while(0) |
55 | #endif | 55 | #endif |
56 | 56 | ||
57 | #define DRV_DESC "QE UCC Ethernet Controller MII Bus" | 57 | #define MII_DRV_DESC "QE UCC Ethernet Controller MII Bus" |
58 | #define DRV_NAME "fsl-uec_mdio" | 58 | #define MII_DRV_NAME "fsl-uec_mdio" |
59 | 59 | ||
60 | /* Write value to the PHY for this device to the register at regnum, */ | 60 | /* Write value to the PHY for this device to the register at regnum, */ |
61 | /* waiting until the write is done before it returns. All PHY */ | 61 | /* waiting until the write is done before it returns. All PHY */ |
@@ -261,7 +261,7 @@ static struct of_device_id uec_mdio_match[] = { | |||
261 | }; | 261 | }; |
262 | 262 | ||
263 | static struct of_platform_driver uec_mdio_driver = { | 263 | static struct of_platform_driver uec_mdio_driver = { |
264 | .name = DRV_NAME, | 264 | .name = MII_DRV_NAME, |
265 | .probe = uec_mdio_probe, | 265 | .probe = uec_mdio_probe, |
266 | .remove = uec_mdio_remove, | 266 | .remove = uec_mdio_remove, |
267 | .match_table = uec_mdio_match, | 267 | .match_table = uec_mdio_match, |
diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h index cbabb9c675c9..42d3278c6b56 100644 --- a/include/linux/pci_ids.h +++ b/include/linux/pci_ids.h | |||
@@ -1225,6 +1225,10 @@ | |||
1225 | #define PCI_DEVICE_ID_NVIDIA_NVENET_25 0x054D | 1225 | #define PCI_DEVICE_ID_NVIDIA_NVENET_25 0x054D |
1226 | #define PCI_DEVICE_ID_NVIDIA_NVENET_26 0x054E | 1226 | #define PCI_DEVICE_ID_NVIDIA_NVENET_26 0x054E |
1227 | #define PCI_DEVICE_ID_NVIDIA_NVENET_27 0x054F | 1227 | #define PCI_DEVICE_ID_NVIDIA_NVENET_27 0x054F |
1228 | #define PCI_DEVICE_ID_NVIDIA_NVENET_28 0x07DC | ||
1229 | #define PCI_DEVICE_ID_NVIDIA_NVENET_29 0x07DD | ||
1230 | #define PCI_DEVICE_ID_NVIDIA_NVENET_30 0x07DE | ||
1231 | #define PCI_DEVICE_ID_NVIDIA_NVENET_31 0x07DF | ||
1228 | #define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP67_IDE 0x0560 | 1232 | #define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP67_IDE 0x0560 |
1229 | #define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP73_IDE 0x056C | 1233 | #define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP73_IDE 0x056C |
1230 | #define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP77_IDE 0x0759 | 1234 | #define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP77_IDE 0x0759 |