Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge branch 'master' of master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6

+2077 -257
+10
drivers/net/Kconfig
··· 928 928 The module will be called smc91x. If you want to compile it as a 929 929 module, say M here and read <file:Documentation/kbuild/modules.txt>. 930 930 931 + config PXA168_ETH 932 + tristate "Marvell pxa168 ethernet support" 933 + depends on CPU_PXA168 934 + select PHYLIB 935 + help 936 + This driver supports the pxa168 Ethernet ports. 937 + 938 + To compile this driver as a module, choose M here. The module 939 + will be called pxa168_eth. 940 + 931 941 config NET_NETX 932 942 tristate "NetX Ethernet support" 933 943 select MII
+1
drivers/net/Makefile
··· 245 245 obj-$(CONFIG_SMC91X) += smc91x.o 246 246 obj-$(CONFIG_SMC911X) += smc911x.o 247 247 obj-$(CONFIG_SMSC911X) += smsc911x.o 248 + obj-$(CONFIG_PXA168_ETH) += pxa168_eth.o 248 249 obj-$(CONFIG_BFIN_MAC) += bfin_mac.o 249 250 obj-$(CONFIG_DM9000) += dm9000.o 250 251 obj-$(CONFIG_PASEMI_MAC) += pasemi_mac_driver.o
+2 -2
drivers/net/bnx2x/bnx2x.h
··· 20 20 * (you will need to reboot afterwards) */ 21 21 /* #define BNX2X_STOP_ON_ERROR */ 22 22 23 - #define DRV_MODULE_VERSION "1.52.53-3" 24 - #define DRV_MODULE_RELDATE "2010/18/04" 23 + #define DRV_MODULE_VERSION "1.52.53-4" 24 + #define DRV_MODULE_RELDATE "2010/16/08" 25 25 #define BNX2X_BC_VER 0x040200 26 26 27 27 #if defined(CONFIG_VLAN_8021Q) || defined(CONFIG_VLAN_8021Q_MODULE)
+7 -2
drivers/net/bnx2x/bnx2x_main.c
··· 4328 4328 val |= aeu_gpio_mask; 4329 4329 REG_WR(bp, offset, val); 4330 4330 } 4331 + bp->port.need_hw_lock = 1; 4331 4332 break; 4332 4333 4333 - case PORT_HW_CFG_XGXS_EXT_PHY_TYPE_SFX7101: 4334 4334 case PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM8727: 4335 + bp->port.need_hw_lock = 1; 4336 + case PORT_HW_CFG_XGXS_EXT_PHY_TYPE_SFX7101: 4335 4337 /* add SPIO 5 to group 0 */ 4336 4338 { 4337 4339 u32 reg_addr = (port ? MISC_REG_AEU_ENABLE1_FUNC_1_OUT_0 : ··· 4343 4341 REG_WR(bp, reg_addr, val); 4344 4342 } 4345 4343 break; 4346 - 4344 + case PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM8072: 4345 + case PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM8073: 4346 + bp->port.need_hw_lock = 1; 4347 + break; 4347 4348 default: 4348 4349 break; 4349 4350 }
+18 -13
drivers/net/e1000e/82571.c
··· 936 936 ew32(IMC, 0xffffffff); 937 937 icr = er32(ICR); 938 938 939 - /* Install any alternate MAC address into RAR0 */ 940 - ret_val = e1000_check_alt_mac_addr_generic(hw); 941 - if (ret_val) 942 - return ret_val; 939 + if (hw->mac.type == e1000_82571) { 940 + /* Install any alternate MAC address into RAR0 */ 941 + ret_val = e1000_check_alt_mac_addr_generic(hw); 942 + if (ret_val) 943 + return ret_val; 943 944 944 - e1000e_set_laa_state_82571(hw, true); 945 + e1000e_set_laa_state_82571(hw, true); 946 + } 945 947 946 948 /* Reinitialize the 82571 serdes link state machine */ 947 949 if (hw->phy.media_type == e1000_media_type_internal_serdes) ··· 1620 1618 { 1621 1619 s32 ret_val = 0; 1622 1620 1623 - /* 1624 - * If there's an alternate MAC address place it in RAR0 1625 - * so that it will override the Si installed default perm 1626 - * address. 1627 - */ 1628 - ret_val = e1000_check_alt_mac_addr_generic(hw); 1629 - if (ret_val) 1630 - goto out; 1621 + if (hw->mac.type == e1000_82571) { 1622 + /* 1623 + * If there's an alternate MAC address place it in RAR0 1624 + * so that it will override the Si installed default perm 1625 + * address. 1626 + */ 1627 + ret_val = e1000_check_alt_mac_addr_generic(hw); 1628 + if (ret_val) 1629 + goto out; 1630 + } 1631 1631 1632 1632 ret_val = e1000_read_mac_addr_generic(hw); 1633 1633 ··· 1837 1833 | FLAG_HAS_SMART_POWER_DOWN 1838 1834 | FLAG_HAS_AMT 1839 1835 | FLAG_HAS_SWSM_ON_LOAD, 1836 + .flags2 = FLAG2_DISABLE_ASPM_L1, 1840 1837 .pba = 20, 1841 1838 .max_hw_frame_size = ETH_FRAME_LEN + ETH_FCS_LEN, 1842 1839 .get_variants = e1000_get_variants_82571,
+4
drivers/net/e1000e/defines.h
··· 621 621 #define E1000_FLASH_UPDATES 2000 622 622 623 623 /* NVM Word Offsets */ 624 + #define NVM_COMPAT 0x0003 624 625 #define NVM_ID_LED_SETTINGS 0x0004 625 626 #define NVM_INIT_CONTROL2_REG 0x000F 626 627 #define NVM_INIT_CONTROL3_PORT_B 0x0014 ··· 643 642 644 643 /* Mask bits for fields in Word 0x1a of the NVM */ 645 644 #define NVM_WORD1A_ASPM_MASK 0x000C 645 + 646 + /* Mask bits for fields in Word 0x03 of the EEPROM */ 647 + #define NVM_COMPAT_LOM 0x0800 646 648 647 649 /* For checksumming, the sum of all words in the NVM should equal 0xBABA. */ 648 650 #define NVM_SUM 0xBABA
+10
drivers/net/e1000e/lib.c
··· 183 183 u16 offset, nvm_alt_mac_addr_offset, nvm_data; 184 184 u8 alt_mac_addr[ETH_ALEN]; 185 185 186 + ret_val = e1000_read_nvm(hw, NVM_COMPAT, 1, &nvm_data); 187 + if (ret_val) 188 + goto out; 189 + 190 + /* Check for LOM (vs. NIC) or one of two valid mezzanine cards */ 191 + if (!((nvm_data & NVM_COMPAT_LOM) || 192 + (hw->adapter->pdev->device == E1000_DEV_ID_82571EB_SERDES_DUAL) || 193 + (hw->adapter->pdev->device == E1000_DEV_ID_82571EB_SERDES_QUAD))) 194 + goto out; 195 + 186 196 ret_val = e1000_read_nvm(hw, NVM_ALT_MAC_ADDR_PTR, 1, 187 197 &nvm_alt_mac_addr_offset); 188 198 if (ret_val) {
+2 -1
drivers/net/ehea/ehea.h
··· 40 40 #include <asm/io.h> 41 41 42 42 #define DRV_NAME "ehea" 43 - #define DRV_VERSION "EHEA_0105" 43 + #define DRV_VERSION "EHEA_0106" 44 44 45 45 /* eHEA capability flags */ 46 46 #define DLPAR_PORT_ADD_REM 1 ··· 400 400 u32 poll_counter; 401 401 struct net_lro_mgr lro_mgr; 402 402 struct net_lro_desc lro_desc[MAX_LRO_DESCRIPTORS]; 403 + int sq_restart_flag; 403 404 }; 404 405 405 406
+59 -1
drivers/net/ehea/ehea_main.c
··· 776 776 return processed; 777 777 } 778 778 779 + #define SWQE_RESTART_CHECK 0xdeadbeaff00d0000ull 780 + 781 + static void reset_sq_restart_flag(struct ehea_port *port) 782 + { 783 + int i; 784 + 785 + for (i = 0; i < port->num_def_qps + port->num_add_tx_qps; i++) { 786 + struct ehea_port_res *pr = &port->port_res[i]; 787 + pr->sq_restart_flag = 0; 788 + } 789 + } 790 + 791 + static void check_sqs(struct ehea_port *port) 792 + { 793 + struct ehea_swqe *swqe; 794 + int swqe_index; 795 + int i, k; 796 + 797 + for (i = 0; i < port->num_def_qps + port->num_add_tx_qps; i++) { 798 + struct ehea_port_res *pr = &port->port_res[i]; 799 + k = 0; 800 + swqe = ehea_get_swqe(pr->qp, &swqe_index); 801 + memset(swqe, 0, SWQE_HEADER_SIZE); 802 + atomic_dec(&pr->swqe_avail); 803 + 804 + swqe->tx_control |= EHEA_SWQE_PURGE; 805 + swqe->wr_id = SWQE_RESTART_CHECK; 806 + swqe->tx_control |= EHEA_SWQE_SIGNALLED_COMPLETION; 807 + swqe->tx_control |= EHEA_SWQE_IMM_DATA_PRESENT; 808 + swqe->immediate_data_length = 80; 809 + 810 + ehea_post_swqe(pr->qp, swqe); 811 + 812 + while (pr->sq_restart_flag == 0) { 813 + msleep(5); 814 + if (++k == 100) { 815 + ehea_error("HW/SW queues out of sync"); 816 + ehea_schedule_port_reset(pr->port); 817 + return; 818 + } 819 + } 820 + } 821 + 822 + return; 823 + } 824 + 825 + 779 826 static struct ehea_cqe *ehea_proc_cqes(struct ehea_port_res *pr, int my_quota) 780 827 { 781 828 struct sk_buff *skb; ··· 840 793 841 794 cqe_counter++; 842 795 rmb(); 796 + 797 + if (cqe->wr_id == SWQE_RESTART_CHECK) { 798 + pr->sq_restart_flag = 1; 799 + swqe_av++; 800 + break; 801 + } 802 + 843 803 if (cqe->status & EHEA_CQE_STAT_ERR_MASK) { 844 804 ehea_error("Bad send completion status=0x%04X", 845 805 cqe->status); ··· 2729 2675 int k = 0; 2730 2676 while (atomic_read(&pr->swqe_avail) < swqe_max) { 2731 2677 msleep(5); 2732 - if (++k == 20) 2678 + if (++k == 20) { 2679 + ehea_error("WARNING: sq not flushed completely"); 2733 2680 break; 2681 + } 2734 2682 } 2735 2683 } 2736 2684 } ··· 2973 2917 port_napi_disable(port); 2974 2918 mutex_unlock(&port->port_lock); 2975 2919 } 2920 + reset_sq_restart_flag(port); 2976 2921 } 2977 2922 2978 2923 /* Unregister old memory region */ ··· 3008 2951 mutex_lock(&port->port_lock); 3009 2952 port_napi_enable(port); 3010 2953 ret = ehea_restart_qps(dev); 2954 + check_sqs(port); 3011 2955 if (!ret) 3012 2956 netif_wake_queue(dev); 3013 2957 mutex_unlock(&port->port_lock);
+15 -17
drivers/net/ibmveth.c
··· 1113 1113 struct ibmveth_adapter *adapter = netdev_priv(dev); 1114 1114 struct vio_dev *viodev = adapter->vdev; 1115 1115 int new_mtu_oh = new_mtu + IBMVETH_BUFF_OH; 1116 - int i; 1116 + int i, rc; 1117 + int need_restart = 0; 1117 1118 1118 1119 if (new_mtu < IBMVETH_MAX_MTU) 1119 1120 return -EINVAL; ··· 1128 1127 1129 1128 /* Deactivate all the buffer pools so that the next loop can activate 1130 1129 only the buffer pools necessary to hold the new MTU */ 1131 - for (i = 0; i < IbmVethNumBufferPools; i++) 1132 - if (adapter->rx_buff_pool[i].active) { 1133 - ibmveth_free_buffer_pool(adapter, 1134 - &adapter->rx_buff_pool[i]); 1135 - adapter->rx_buff_pool[i].active = 0; 1136 - } 1130 + if (netif_running(adapter->netdev)) { 1131 + need_restart = 1; 1132 + adapter->pool_config = 1; 1133 + ibmveth_close(adapter->netdev); 1134 + adapter->pool_config = 0; 1135 + } 1137 1136 1138 1137 /* Look for an active buffer pool that can hold the new MTU */ 1139 1138 for(i = 0; i<IbmVethNumBufferPools; i++) { 1140 1139 adapter->rx_buff_pool[i].active = 1; 1141 1140 1142 1141 if (new_mtu_oh < adapter->rx_buff_pool[i].buff_size) { 1143 - if (netif_running(adapter->netdev)) { 1144 - adapter->pool_config = 1; 1145 - ibmveth_close(adapter->netdev); 1146 - adapter->pool_config = 0; 1147 - dev->mtu = new_mtu; 1148 - vio_cmo_set_dev_desired(viodev, 1149 - ibmveth_get_desired_dma 1150 - (viodev)); 1151 - return ibmveth_open(adapter->netdev); 1152 - } 1153 1142 dev->mtu = new_mtu; 1154 1143 vio_cmo_set_dev_desired(viodev, 1155 1144 ibmveth_get_desired_dma 1156 1145 (viodev)); 1146 + if (need_restart) { 1147 + return ibmveth_open(adapter->netdev); 1148 + } 1157 1149 return 0; 1158 1150 } 1159 1151 } 1152 + 1153 + if (need_restart && (rc = ibmveth_open(adapter->netdev))) 1154 + return rc; 1155 + 1160 1156 return -EINVAL; 1161 1157 } 1162 1158
+2 -2
drivers/net/ll_temac_main.c
··· 902 902 disable_irq(lp->tx_irq); 903 903 disable_irq(lp->rx_irq); 904 904 905 - ll_temac_rx_irq(lp->tx_irq, lp); 906 - ll_temac_tx_irq(lp->rx_irq, lp); 905 + ll_temac_rx_irq(lp->tx_irq, ndev); 906 + ll_temac_tx_irq(lp->rx_irq, ndev); 907 907 908 908 enable_irq(lp->tx_irq); 909 909 enable_irq(lp->rx_irq);
+2 -2
drivers/net/netxen/netxen_nic.h
··· 53 53 54 54 #define _NETXEN_NIC_LINUX_MAJOR 4 55 55 #define _NETXEN_NIC_LINUX_MINOR 0 56 - #define _NETXEN_NIC_LINUX_SUBVERSION 73 57 - #define NETXEN_NIC_LINUX_VERSIONID "4.0.73" 56 + #define _NETXEN_NIC_LINUX_SUBVERSION 74 57 + #define NETXEN_NIC_LINUX_VERSIONID "4.0.74" 58 58 59 59 #define NETXEN_VERSION_CODE(a, b, c) (((a) << 24) + ((b) << 16) + (c)) 60 60 #define _major(v) (((v) >> 24) & 0xff)
-4
drivers/net/netxen/netxen_nic_init.c
··· 1805 1805 netxen_ctx_msg msg = 0; 1806 1806 struct list_head *head; 1807 1807 1808 - spin_lock(&rds_ring->lock); 1809 - 1810 1808 producer = rds_ring->producer; 1811 1809 1812 1810 head = &rds_ring->free_list; ··· 1851 1853 NETXEN_RCV_PRODUCER_OFFSET), msg); 1852 1854 } 1853 1855 } 1854 - 1855 - spin_unlock(&rds_ring->lock); 1856 1856 } 1857 1857 1858 1858 static void
-2
drivers/net/netxen/netxen_nic_main.c
··· 2032 2032 struct netxen_adapter *adapter = netdev_priv(netdev); 2033 2033 struct net_device_stats *stats = &netdev->stats; 2034 2034 2035 - memset(stats, 0, sizeof(*stats)); 2036 - 2037 2035 stats->rx_packets = adapter->stats.rx_pkts + adapter->stats.lro_pkts; 2038 2036 stats->tx_packets = adapter->stats.xmitfinished; 2039 2037 stats->rx_bytes = adapter->stats.rxbytes;
+1666
drivers/net/pxa168_eth.c
··· 1 + /* 2 + * PXA168 ethernet driver. 3 + * Most of the code is derived from mv643xx ethernet driver. 4 + * 5 + * Copyright (C) 2010 Marvell International Ltd. 6 + * Sachin Sanap <ssanap@marvell.com> 7 + * Philip Rakity <prakity@marvell.com> 8 + * Mark Brown <markb@marvell.com> 9 + * 10 + * This program is free software; you can redistribute it and/or 11 + * modify it under the terms of the GNU General Public License 12 + * as published by the Free Software Foundation; either version 2 13 + * of the License, or (at your option) any later version. 14 + * 15 + * This program is distributed in the hope that it will be useful, 16 + * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 + * GNU General Public License for more details. 19 + * 20 + * You should have received a copy of the GNU General Public License 21 + * along with this program; if not, write to the Free Software 22 + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 23 + */ 24 + 25 + #include <linux/init.h> 26 + #include <linux/dma-mapping.h> 27 + #include <linux/in.h> 28 + #include <linux/ip.h> 29 + #include <linux/tcp.h> 30 + #include <linux/udp.h> 31 + #include <linux/etherdevice.h> 32 + #include <linux/bitops.h> 33 + #include <linux/delay.h> 34 + #include <linux/ethtool.h> 35 + #include <linux/platform_device.h> 36 + #include <linux/module.h> 37 + #include <linux/kernel.h> 38 + #include <linux/workqueue.h> 39 + #include <linux/clk.h> 40 + #include <linux/phy.h> 41 + #include <linux/io.h> 42 + #include <linux/types.h> 43 + #include <asm/pgtable.h> 44 + #include <asm/system.h> 45 + #include <linux/delay.h> 46 + #include <linux/dma-mapping.h> 47 + #include <asm/cacheflush.h> 48 + #include <linux/pxa168_eth.h> 49 + 50 + #define DRIVER_NAME "pxa168-eth" 51 + #define DRIVER_VERSION "0.3" 52 + 53 + /* 54 + * Registers 55 + */ 56 + 57 + #define PHY_ADDRESS 0x0000 58 + #define SMI 0x0010 59 + #define PORT_CONFIG 0x0400 60 + #define PORT_CONFIG_EXT 0x0408 61 + #define PORT_COMMAND 0x0410 62 + #define PORT_STATUS 0x0418 63 + #define HTPR 0x0428 64 + #define SDMA_CONFIG 0x0440 65 + #define SDMA_CMD 0x0448 66 + #define INT_CAUSE 0x0450 67 + #define INT_W_CLEAR 0x0454 68 + #define INT_MASK 0x0458 69 + #define ETH_F_RX_DESC_0 0x0480 70 + #define ETH_C_RX_DESC_0 0x04A0 71 + #define ETH_C_TX_DESC_1 0x04E4 72 + 73 + /* smi register */ 74 + #define SMI_BUSY (1 << 28) /* 0 - Write, 1 - Read */ 75 + #define SMI_R_VALID (1 << 27) /* 0 - Write, 1 - Read */ 76 + #define SMI_OP_W (0 << 26) /* Write operation */ 77 + #define SMI_OP_R (1 << 26) /* Read operation */ 78 + 79 + #define PHY_WAIT_ITERATIONS 10 80 + 81 + #define PXA168_ETH_PHY_ADDR_DEFAULT 0 82 + /* RX & TX descriptor command */ 83 + #define BUF_OWNED_BY_DMA (1 << 31) 84 + 85 + /* RX descriptor status */ 86 + #define RX_EN_INT (1 << 23) 87 + #define RX_FIRST_DESC (1 << 17) 88 + #define RX_LAST_DESC (1 << 16) 89 + #define RX_ERROR (1 << 15) 90 + 91 + /* TX descriptor command */ 92 + #define TX_EN_INT (1 << 23) 93 + #define TX_GEN_CRC (1 << 22) 94 + #define TX_ZERO_PADDING (1 << 18) 95 + #define TX_FIRST_DESC (1 << 17) 96 + #define TX_LAST_DESC (1 << 16) 97 + #define TX_ERROR (1 << 15) 98 + 99 + /* SDMA_CMD */ 100 + #define SDMA_CMD_AT (1 << 31) 101 + #define SDMA_CMD_TXDL (1 << 24) 102 + #define SDMA_CMD_TXDH (1 << 23) 103 + #define SDMA_CMD_AR (1 << 15) 104 + #define SDMA_CMD_ERD (1 << 7) 105 + 106 + /* Bit definitions of the Port Config Reg */ 107 + #define PCR_HS (1 << 12) 108 + #define PCR_EN (1 << 7) 109 + #define PCR_PM (1 << 0) 110 + 111 + /* Bit definitions of the Port Config Extend Reg */ 112 + #define PCXR_2BSM (1 << 28) 113 + #define PCXR_DSCP_EN (1 << 21) 114 + #define PCXR_MFL_1518 (0 << 14) 115 + #define PCXR_MFL_1536 (1 << 14) 116 + #define PCXR_MFL_2048 (2 << 14) 117 + #define PCXR_MFL_64K (3 << 14) 118 + #define PCXR_FLP (1 << 11) 119 + #define PCXR_PRIO_TX_OFF 3 120 + #define PCXR_TX_HIGH_PRI (7 << PCXR_PRIO_TX_OFF) 121 + 122 + /* Bit definitions of the SDMA Config Reg */ 123 + #define SDCR_BSZ_OFF 12 124 + #define SDCR_BSZ8 (3 << SDCR_BSZ_OFF) 125 + #define SDCR_BSZ4 (2 << SDCR_BSZ_OFF) 126 + #define SDCR_BSZ2 (1 << SDCR_BSZ_OFF) 127 + #define SDCR_BSZ1 (0 << SDCR_BSZ_OFF) 128 + #define SDCR_BLMR (1 << 6) 129 + #define SDCR_BLMT (1 << 7) 130 + #define SDCR_RIFB (1 << 9) 131 + #define SDCR_RC_OFF 2 132 + #define SDCR_RC_MAX_RETRANS (0xf << SDCR_RC_OFF) 133 + 134 + /* 135 + * Bit definitions of the Interrupt Cause Reg 136 + * and Interrupt MASK Reg is the same 137 + */ 138 + #define ICR_RXBUF (1 << 0) 139 + #define ICR_TXBUF_H (1 << 2) 140 + #define ICR_TXBUF_L (1 << 3) 141 + #define ICR_TXEND_H (1 << 6) 142 + #define ICR_TXEND_L (1 << 7) 143 + #define ICR_RXERR (1 << 8) 144 + #define ICR_TXERR_H (1 << 10) 145 + #define ICR_TXERR_L (1 << 11) 146 + #define ICR_TX_UDR (1 << 13) 147 + #define ICR_MII_CH (1 << 28) 148 + 149 + #define ALL_INTS (ICR_TXBUF_H | ICR_TXBUF_L | ICR_TX_UDR |\ 150 + ICR_TXERR_H | ICR_TXERR_L |\ 151 + ICR_TXEND_H | ICR_TXEND_L |\ 152 + ICR_RXBUF | ICR_RXERR | ICR_MII_CH) 153 + 154 + #define ETH_HW_IP_ALIGN 2 /* hw aligns IP header */ 155 + 156 + #define NUM_RX_DESCS 64 157 + #define NUM_TX_DESCS 64 158 + 159 + #define HASH_ADD 0 160 + #define HASH_DELETE 1 161 + #define HASH_ADDR_TABLE_SIZE 0x4000 /* 16K (1/2K address - PCR_HS == 1) */ 162 + #define HOP_NUMBER 12 163 + 164 + /* Bit definitions for Port status */ 165 + #define PORT_SPEED_100 (1 << 0) 166 + #define FULL_DUPLEX (1 << 1) 167 + #define FLOW_CONTROL_ENABLED (1 << 2) 168 + #define LINK_UP (1 << 3) 169 + 170 + /* Bit definitions for work to be done */ 171 + #define WORK_LINK (1 << 0) 172 + #define WORK_TX_DONE (1 << 1) 173 + 174 + /* 175 + * Misc definitions. 176 + */ 177 + #define SKB_DMA_REALIGN ((PAGE_SIZE - NET_SKB_PAD) % SMP_CACHE_BYTES) 178 + 179 + struct rx_desc { 180 + u32 cmd_sts; /* Descriptor command status */ 181 + u16 byte_cnt; /* Descriptor buffer byte count */ 182 + u16 buf_size; /* Buffer size */ 183 + u32 buf_ptr; /* Descriptor buffer pointer */ 184 + u32 next_desc_ptr; /* Next descriptor pointer */ 185 + }; 186 + 187 + struct tx_desc { 188 + u32 cmd_sts; /* Command/status field */ 189 + u16 reserved; 190 + u16 byte_cnt; /* buffer byte count */ 191 + u32 buf_ptr; /* pointer to buffer for this descriptor */ 192 + u32 next_desc_ptr; /* Pointer to next descriptor */ 193 + }; 194 + 195 + struct pxa168_eth_private { 196 + int port_num; /* User Ethernet port number */ 197 + 198 + int rx_resource_err; /* Rx ring resource error flag */ 199 + 200 + /* Next available and first returning Rx resource */ 201 + int rx_curr_desc_q, rx_used_desc_q; 202 + 203 + /* Next available and first returning Tx resource */ 204 + int tx_curr_desc_q, tx_used_desc_q; 205 + 206 + struct rx_desc *p_rx_desc_area; 207 + dma_addr_t rx_desc_dma; 208 + int rx_desc_area_size; 209 + struct sk_buff **rx_skb; 210 + 211 + struct tx_desc *p_tx_desc_area; 212 + dma_addr_t tx_desc_dma; 213 + int tx_desc_area_size; 214 + struct sk_buff **tx_skb; 215 + 216 + struct work_struct tx_timeout_task; 217 + 218 + struct net_device *dev; 219 + struct napi_struct napi; 220 + u8 work_todo; 221 + int skb_size; 222 + 223 + struct net_device_stats stats; 224 + /* Size of Tx Ring per queue */ 225 + int tx_ring_size; 226 + /* Number of tx descriptors in use */ 227 + int tx_desc_count; 228 + /* Size of Rx Ring per queue */ 229 + int rx_ring_size; 230 + /* Number of rx descriptors in use */ 231 + int rx_desc_count; 232 + 233 + /* 234 + * Used in case RX Ring is empty, which can occur when 235 + * system does not have resources (skb's) 236 + */ 237 + struct timer_list timeout; 238 + struct mii_bus *smi_bus; 239 + struct phy_device *phy; 240 + 241 + /* clock */ 242 + struct clk *clk; 243 + struct pxa168_eth_platform_data *pd; 244 + /* 245 + * Ethernet controller base address. 246 + */ 247 + void __iomem *base; 248 + 249 + /* Pointer to the hardware address filter table */ 250 + void *htpr; 251 + dma_addr_t htpr_dma; 252 + }; 253 + 254 + struct addr_table_entry { 255 + __le32 lo; 256 + __le32 hi; 257 + }; 258 + 259 + /* Bit fields of a Hash Table Entry */ 260 + enum hash_table_entry { 261 + HASH_ENTRY_VALID = 1, 262 + SKIP = 2, 263 + HASH_ENTRY_RECEIVE_DISCARD = 4, 264 + HASH_ENTRY_RECEIVE_DISCARD_BIT = 2 265 + }; 266 + 267 + static int pxa168_get_settings(struct net_device *dev, struct ethtool_cmd *cmd); 268 + static int pxa168_set_settings(struct net_device *dev, struct ethtool_cmd *cmd); 269 + static int pxa168_init_hw(struct pxa168_eth_private *pep); 270 + static void eth_port_reset(struct net_device *dev); 271 + static void eth_port_start(struct net_device *dev); 272 + static int pxa168_eth_open(struct net_device *dev); 273 + static int pxa168_eth_stop(struct net_device *dev); 274 + static int ethernet_phy_setup(struct net_device *dev); 275 + 276 + static inline u32 rdl(struct pxa168_eth_private *pep, int offset) 277 + { 278 + return readl(pep->base + offset); 279 + } 280 + 281 + static inline void wrl(struct pxa168_eth_private *pep, int offset, u32 data) 282 + { 283 + writel(data, pep->base + offset); 284 + } 285 + 286 + static void abort_dma(struct pxa168_eth_private *pep) 287 + { 288 + int delay; 289 + int max_retries = 40; 290 + 291 + do { 292 + wrl(pep, SDMA_CMD, SDMA_CMD_AR | SDMA_CMD_AT); 293 + udelay(100); 294 + 295 + delay = 10; 296 + while ((rdl(pep, SDMA_CMD) & (SDMA_CMD_AR | SDMA_CMD_AT)) 297 + && delay-- > 0) { 298 + udelay(10); 299 + } 300 + } while (max_retries-- > 0 && delay <= 0); 301 + 302 + if (max_retries <= 0) 303 + printk(KERN_ERR "%s : DMA Stuck\n", __func__); 304 + } 305 + 306 + static int ethernet_phy_get(struct pxa168_eth_private *pep) 307 + { 308 + unsigned int reg_data; 309 + 310 + reg_data = rdl(pep, PHY_ADDRESS); 311 + 312 + return (reg_data >> (5 * pep->port_num)) & 0x1f; 313 + } 314 + 315 + static void ethernet_phy_set_addr(struct pxa168_eth_private *pep, int phy_addr) 316 + { 317 + u32 reg_data; 318 + int addr_shift = 5 * pep->port_num; 319 + 320 + reg_data = rdl(pep, PHY_ADDRESS); 321 + reg_data &= ~(0x1f << addr_shift); 322 + reg_data |= (phy_addr & 0x1f) << addr_shift; 323 + wrl(pep, PHY_ADDRESS, reg_data); 324 + } 325 + 326 + static void ethernet_phy_reset(struct pxa168_eth_private *pep) 327 + { 328 + int data; 329 + 330 + data = phy_read(pep->phy, MII_BMCR); 331 + if (data < 0) 332 + return; 333 + 334 + data |= BMCR_RESET; 335 + if (phy_write(pep->phy, MII_BMCR, data) < 0) 336 + return; 337 + 338 + do { 339 + data = phy_read(pep->phy, MII_BMCR); 340 + } while (data >= 0 && data & BMCR_RESET); 341 + } 342 + 343 + static void rxq_refill(struct net_device *dev) 344 + { 345 + struct pxa168_eth_private *pep = netdev_priv(dev); 346 + struct sk_buff *skb; 347 + struct rx_desc *p_used_rx_desc; 348 + int used_rx_desc; 349 + 350 + while (pep->rx_desc_count < pep->rx_ring_size) { 351 + int size; 352 + 353 + skb = dev_alloc_skb(pep->skb_size); 354 + if (!skb) 355 + break; 356 + if (SKB_DMA_REALIGN) 357 + skb_reserve(skb, SKB_DMA_REALIGN); 358 + pep->rx_desc_count++; 359 + /* Get 'used' Rx descriptor */ 360 + used_rx_desc = pep->rx_used_desc_q; 361 + p_used_rx_desc = &pep->p_rx_desc_area[used_rx_desc]; 362 + size = skb->end - skb->data; 363 + p_used_rx_desc->buf_ptr = dma_map_single(NULL, 364 + skb->data, 365 + size, 366 + DMA_FROM_DEVICE); 367 + p_used_rx_desc->buf_size = size; 368 + pep->rx_skb[used_rx_desc] = skb; 369 + 370 + /* Return the descriptor to DMA ownership */ 371 + wmb(); 372 + p_used_rx_desc->cmd_sts = BUF_OWNED_BY_DMA | RX_EN_INT; 373 + wmb(); 374 + 375 + /* Move the used descriptor pointer to the next descriptor */ 376 + pep->rx_used_desc_q = (used_rx_desc + 1) % pep->rx_ring_size; 377 + 378 + /* Any Rx return cancels the Rx resource error status */ 379 + pep->rx_resource_err = 0; 380 + 381 + skb_reserve(skb, ETH_HW_IP_ALIGN); 382 + } 383 + 384 + /* 385 + * If RX ring is empty of SKB, set a timer to try allocating 386 + * again at a later time. 387 + */ 388 + if (pep->rx_desc_count == 0) { 389 + pep->timeout.expires = jiffies + (HZ / 10); 390 + add_timer(&pep->timeout); 391 + } 392 + } 393 + 394 + static inline void rxq_refill_timer_wrapper(unsigned long data) 395 + { 396 + struct pxa168_eth_private *pep = (void *)data; 397 + napi_schedule(&pep->napi); 398 + } 399 + 400 + static inline u8 flip_8_bits(u8 x) 401 + { 402 + return (((x) & 0x01) << 3) | (((x) & 0x02) << 1) 403 + | (((x) & 0x04) >> 1) | (((x) & 0x08) >> 3) 404 + | (((x) & 0x10) << 3) | (((x) & 0x20) << 1) 405 + | (((x) & 0x40) >> 1) | (((x) & 0x80) >> 3); 406 + } 407 + 408 + static void nibble_swap_every_byte(unsigned char *mac_addr) 409 + { 410 + int i; 411 + for (i = 0; i < ETH_ALEN; i++) { 412 + mac_addr[i] = ((mac_addr[i] & 0x0f) << 4) | 413 + ((mac_addr[i] & 0xf0) >> 4); 414 + } 415 + } 416 + 417 + static void inverse_every_nibble(unsigned char *mac_addr) 418 + { 419 + int i; 420 + for (i = 0; i < ETH_ALEN; i++) 421 + mac_addr[i] = flip_8_bits(mac_addr[i]); 422 + } 423 + 424 + /* 425 + * ---------------------------------------------------------------------------- 426 + * This function will calculate the hash function of the address. 427 + * Inputs 428 + * mac_addr_orig - MAC address. 429 + * Outputs 430 + * return the calculated entry. 431 + */ 432 + static u32 hash_function(unsigned char *mac_addr_orig) 433 + { 434 + u32 hash_result; 435 + u32 addr0; 436 + u32 addr1; 437 + u32 addr2; 438 + u32 addr3; 439 + unsigned char mac_addr[ETH_ALEN]; 440 + 441 + /* Make a copy of MAC address since we are going to performe bit 442 + * operations on it 443 + */ 444 + memcpy(mac_addr, mac_addr_orig, ETH_ALEN); 445 + 446 + nibble_swap_every_byte(mac_addr); 447 + inverse_every_nibble(mac_addr); 448 + 449 + addr0 = (mac_addr[5] >> 2) & 0x3f; 450 + addr1 = (mac_addr[5] & 0x03) | (((mac_addr[4] & 0x7f)) << 2); 451 + addr2 = ((mac_addr[4] & 0x80) >> 7) | mac_addr[3] << 1; 452 + addr3 = (mac_addr[2] & 0xff) | ((mac_addr[1] & 1) << 8); 453 + 454 + hash_result = (addr0 << 9) | (addr1 ^ addr2 ^ addr3); 455 + hash_result = hash_result & 0x07ff; 456 + return hash_result; 457 + } 458 + 459 + /* 460 + * ---------------------------------------------------------------------------- 461 + * This function will add/del an entry to the address table. 462 + * Inputs 463 + * pep - ETHERNET . 464 + * mac_addr - MAC address. 465 + * skip - if 1, skip this address.Used in case of deleting an entry which is a 466 + * part of chain in the hash table.We cant just delete the entry since 467 + * that will break the chain.We need to defragment the tables time to 468 + * time. 469 + * rd - 0 Discard packet upon match. 470 + * - 1 Receive packet upon match. 471 + * Outputs 472 + * address table entry is added/deleted. 473 + * 0 if success. 474 + * -ENOSPC if table full 475 + */ 476 + static int add_del_hash_entry(struct pxa168_eth_private *pep, 477 + unsigned char *mac_addr, 478 + u32 rd, u32 skip, int del) 479 + { 480 + struct addr_table_entry *entry, *start; 481 + u32 new_high; 482 + u32 new_low; 483 + u32 i; 484 + 485 + new_low = (((mac_addr[1] >> 4) & 0xf) << 15) 486 + | (((mac_addr[1] >> 0) & 0xf) << 11) 487 + | (((mac_addr[0] >> 4) & 0xf) << 7) 488 + | (((mac_addr[0] >> 0) & 0xf) << 3) 489 + | (((mac_addr[3] >> 4) & 0x1) << 31) 490 + | (((mac_addr[3] >> 0) & 0xf) << 27) 491 + | (((mac_addr[2] >> 4) & 0xf) << 23) 492 + | (((mac_addr[2] >> 0) & 0xf) << 19) 493 + | (skip << SKIP) | (rd << HASH_ENTRY_RECEIVE_DISCARD_BIT) 494 + | HASH_ENTRY_VALID; 495 + 496 + new_high = (((mac_addr[5] >> 4) & 0xf) << 15) 497 + | (((mac_addr[5] >> 0) & 0xf) << 11) 498 + | (((mac_addr[4] >> 4) & 0xf) << 7) 499 + | (((mac_addr[4] >> 0) & 0xf) << 3) 500 + | (((mac_addr[3] >> 5) & 0x7) << 0); 501 + 502 + /* 503 + * Pick the appropriate table, start scanning for free/reusable 504 + * entries at the index obtained by hashing the specified MAC address 505 + */ 506 + start = (struct addr_table_entry *)(pep->htpr); 507 + entry = start + hash_function(mac_addr); 508 + for (i = 0; i < HOP_NUMBER; i++) { 509 + if (!(le32_to_cpu(entry->lo) & HASH_ENTRY_VALID)) { 510 + break; 511 + } else { 512 + /* if same address put in same position */ 513 + if (((le32_to_cpu(entry->lo) & 0xfffffff8) == 514 + (new_low & 0xfffffff8)) && 515 + (le32_to_cpu(entry->hi) == new_high)) { 516 + break; 517 + } 518 + } 519 + if (entry == start + 0x7ff) 520 + entry = start; 521 + else 522 + entry++; 523 + } 524 + 525 + if (((le32_to_cpu(entry->lo) & 0xfffffff8) != (new_low & 0xfffffff8)) && 526 + (le32_to_cpu(entry->hi) != new_high) && del) 527 + return 0; 528 + 529 + if (i == HOP_NUMBER) { 530 + if (!del) { 531 + printk(KERN_INFO "%s: table section is full, need to " 532 + "move to 16kB implementation?\n", 533 + __FILE__); 534 + return -ENOSPC; 535 + } else 536 + return 0; 537 + } 538 + 539 + /* 540 + * Update the selected entry 541 + */ 542 + if (del) { 543 + entry->hi = 0; 544 + entry->lo = 0; 545 + } else { 546 + entry->hi = cpu_to_le32(new_high); 547 + entry->lo = cpu_to_le32(new_low); 548 + } 549 + 550 + return 0; 551 + } 552 + 553 + /* 554 + * ---------------------------------------------------------------------------- 555 + * Create an addressTable entry from MAC address info 556 + * found in the specifed net_device struct 557 + * 558 + * Input : pointer to ethernet interface network device structure 559 + * Output : N/A 560 + */ 561 + static void update_hash_table_mac_address(struct pxa168_eth_private *pep, 562 + unsigned char *oaddr, 563 + unsigned char *addr) 564 + { 565 + /* Delete old entry */ 566 + if (oaddr) 567 + add_del_hash_entry(pep, oaddr, 1, 0, HASH_DELETE); 568 + /* Add new entry */ 569 + add_del_hash_entry(pep, addr, 1, 0, HASH_ADD); 570 + } 571 + 572 + static int init_hash_table(struct pxa168_eth_private *pep) 573 + { 574 + /* 575 + * Hardware expects CPU to build a hash table based on a predefined 576 + * hash function and populate it based on hardware address. The 577 + * location of the hash table is identified by 32-bit pointer stored 578 + * in HTPR internal register. Two possible sizes exists for the hash 579 + * table 8kB (256kB of DRAM required (4 x 64 kB banks)) and 1/2kB 580 + * (16kB of DRAM required (4 x 4 kB banks)).We currently only support 581 + * 1/2kB. 582 + */ 583 + /* TODO: Add support for 8kB hash table and alternative hash 584 + * function.Driver can dynamically switch to them if the 1/2kB hash 585 + * table is full. 586 + */ 587 + if (pep->htpr == NULL) { 588 + pep->htpr = dma_alloc_coherent(pep->dev->dev.parent, 589 + HASH_ADDR_TABLE_SIZE, 590 + &pep->htpr_dma, GFP_KERNEL); 591 + if (pep->htpr == NULL) 592 + return -ENOMEM; 593 + } 594 + memset(pep->htpr, 0, HASH_ADDR_TABLE_SIZE); 595 + wrl(pep, HTPR, pep->htpr_dma); 596 + return 0; 597 + } 598 + 599 + static void pxa168_eth_set_rx_mode(struct net_device *dev) 600 + { 601 + struct pxa168_eth_private *pep = netdev_priv(dev); 602 + struct netdev_hw_addr *ha; 603 + u32 val; 604 + 605 + val = rdl(pep, PORT_CONFIG); 606 + if (dev->flags & IFF_PROMISC) 607 + val |= PCR_PM; 608 + else 609 + val &= ~PCR_PM; 610 + wrl(pep, PORT_CONFIG, val); 611 + 612 + /* 613 + * Remove the old list of MAC address and add dev->addr 614 + * and multicast address. 615 + */ 616 + memset(pep->htpr, 0, HASH_ADDR_TABLE_SIZE); 617 + update_hash_table_mac_address(pep, NULL, dev->dev_addr); 618 + 619 + netdev_for_each_mc_addr(ha, dev) 620 + update_hash_table_mac_address(pep, NULL, ha->addr); 621 + } 622 + 623 + static int pxa168_eth_set_mac_address(struct net_device *dev, void *addr) 624 + { 625 + struct sockaddr *sa = addr; 626 + struct pxa168_eth_private *pep = netdev_priv(dev); 627 + unsigned char oldMac[ETH_ALEN]; 628 + 629 + if (!is_valid_ether_addr(sa->sa_data)) 630 + return -EINVAL; 631 + memcpy(oldMac, dev->dev_addr, ETH_ALEN); 632 + memcpy(dev->dev_addr, sa->sa_data, ETH_ALEN); 633 + netif_addr_lock_bh(dev); 634 + update_hash_table_mac_address(pep, oldMac, dev->dev_addr); 635 + netif_addr_unlock_bh(dev); 636 + return 0; 637 + } 638 + 639 + static void eth_port_start(struct net_device *dev) 640 + { 641 + unsigned int val = 0; 642 + struct pxa168_eth_private *pep = netdev_priv(dev); 643 + int tx_curr_desc, rx_curr_desc; 644 + 645 + /* Perform PHY reset, if there is a PHY. */ 646 + if (pep->phy != NULL) { 647 + struct ethtool_cmd cmd; 648 + 649 + pxa168_get_settings(pep->dev, &cmd); 650 + ethernet_phy_reset(pep); 651 + pxa168_set_settings(pep->dev, &cmd); 652 + } 653 + 654 + /* Assignment of Tx CTRP of given queue */ 655 + tx_curr_desc = pep->tx_curr_desc_q; 656 + wrl(pep, ETH_C_TX_DESC_1, 657 + (u32) ((struct tx_desc *)pep->tx_desc_dma + tx_curr_desc)); 658 + 659 + /* Assignment of Rx CRDP of given queue */ 660 + rx_curr_desc = pep->rx_curr_desc_q; 661 + wrl(pep, ETH_C_RX_DESC_0, 662 + (u32) ((struct rx_desc *)pep->rx_desc_dma + rx_curr_desc)); 663 + 664 + wrl(pep, ETH_F_RX_DESC_0, 665 + (u32) ((struct rx_desc *)pep->rx_desc_dma + rx_curr_desc)); 666 + 667 + /* Clear all interrupts */ 668 + wrl(pep, INT_CAUSE, 0); 669 + 670 + /* Enable all interrupts for receive, transmit and error. */ 671 + wrl(pep, INT_MASK, ALL_INTS); 672 + 673 + val = rdl(pep, PORT_CONFIG); 674 + val |= PCR_EN; 675 + wrl(pep, PORT_CONFIG, val); 676 + 677 + /* Start RX DMA engine */ 678 + val = rdl(pep, SDMA_CMD); 679 + val |= SDMA_CMD_ERD; 680 + wrl(pep, SDMA_CMD, val); 681 + } 682 + 683 + static void eth_port_reset(struct net_device *dev) 684 + { 685 + struct pxa168_eth_private *pep = netdev_priv(dev); 686 + unsigned int val = 0; 687 + 688 + /* Stop all interrupts for receive, transmit and error. */ 689 + wrl(pep, INT_MASK, 0); 690 + 691 + /* Clear all interrupts */ 692 + wrl(pep, INT_CAUSE, 0); 693 + 694 + /* Stop RX DMA */ 695 + val = rdl(pep, SDMA_CMD); 696 + val &= ~SDMA_CMD_ERD; /* abort dma command */ 697 + 698 + /* Abort any transmit and receive operations and put DMA 699 + * in idle state. 700 + */ 701 + abort_dma(pep); 702 + 703 + /* Disable port */ 704 + val = rdl(pep, PORT_CONFIG); 705 + val &= ~PCR_EN; 706 + wrl(pep, PORT_CONFIG, val); 707 + } 708 + 709 + /* 710 + * txq_reclaim - Free the tx desc data for completed descriptors 711 + * If force is non-zero, frees uncompleted descriptors as well 712 + */ 713 + static int txq_reclaim(struct net_device *dev, int force) 714 + { 715 + struct pxa168_eth_private *pep = netdev_priv(dev); 716 + struct tx_desc *desc; 717 + u32 cmd_sts; 718 + struct sk_buff *skb; 719 + int tx_index; 720 + dma_addr_t addr; 721 + int count; 722 + int released = 0; 723 + 724 + netif_tx_lock(dev); 725 + 726 + pep->work_todo &= ~WORK_TX_DONE; 727 + while (pep->tx_desc_count > 0) { 728 + tx_index = pep->tx_used_desc_q; 729 + desc = &pep->p_tx_desc_area[tx_index]; 730 + cmd_sts = desc->cmd_sts; 731 + if (!force && (cmd_sts & BUF_OWNED_BY_DMA)) { 732 + if (released > 0) { 733 + goto txq_reclaim_end; 734 + } else { 735 + released = -1; 736 + goto txq_reclaim_end; 737 + } 738 + } 739 + pep->tx_used_desc_q = (tx_index + 1) % pep->tx_ring_size; 740 + pep->tx_desc_count--; 741 + addr = desc->buf_ptr; 742 + count = desc->byte_cnt; 743 + skb = pep->tx_skb[tx_index]; 744 + if (skb) 745 + pep->tx_skb[tx_index] = NULL; 746 + 747 + if (cmd_sts & TX_ERROR) { 748 + if (net_ratelimit()) 749 + printk(KERN_ERR "%s: Error in TX\n", dev->name); 750 + dev->stats.tx_errors++; 751 + } 752 + dma_unmap_single(NULL, addr, count, DMA_TO_DEVICE); 753 + if (skb) 754 + dev_kfree_skb_irq(skb); 755 + released++; 756 + } 757 + txq_reclaim_end: 758 + netif_tx_unlock(dev); 759 + return released; 760 + } 761 + 762 + static void pxa168_eth_tx_timeout(struct net_device *dev) 763 + { 764 + struct pxa168_eth_private *pep = netdev_priv(dev); 765 + 766 + printk(KERN_INFO "%s: TX timeout desc_count %d\n", 767 + dev->name, pep->tx_desc_count); 768 + 769 + schedule_work(&pep->tx_timeout_task); 770 + } 771 + 772 + static void pxa168_eth_tx_timeout_task(struct work_struct *work) 773 + { 774 + struct pxa168_eth_private *pep = container_of(work, 775 + struct pxa168_eth_private, 776 + tx_timeout_task); 777 + struct net_device *dev = pep->dev; 778 + pxa168_eth_stop(dev); 779 + pxa168_eth_open(dev); 780 + } 781 + 782 + static int rxq_process(struct net_device *dev, int budget) 783 + { 784 + struct pxa168_eth_private *pep = netdev_priv(dev); 785 + struct net_device_stats *stats = &dev->stats; 786 + unsigned int received_packets = 0; 787 + struct sk_buff *skb; 788 + 789 + while (budget-- > 0) { 790 + int rx_next_curr_desc, rx_curr_desc, rx_used_desc; 791 + struct rx_desc *rx_desc; 792 + unsigned int cmd_sts; 793 + 794 + /* Do not process Rx ring in case of Rx ring resource error */ 795 + if (pep->rx_resource_err) 796 + break; 797 + rx_curr_desc = pep->rx_curr_desc_q; 798 + rx_used_desc = pep->rx_used_desc_q; 799 + rx_desc = &pep->p_rx_desc_area[rx_curr_desc]; 800 + cmd_sts = rx_desc->cmd_sts; 801 + rmb(); 802 + if (cmd_sts & (BUF_OWNED_BY_DMA)) 803 + break; 804 + skb = pep->rx_skb[rx_curr_desc]; 805 + pep->rx_skb[rx_curr_desc] = NULL; 806 + 807 + rx_next_curr_desc = (rx_curr_desc + 1) % pep->rx_ring_size; 808 + pep->rx_curr_desc_q = rx_next_curr_desc; 809 + 810 + /* Rx descriptors exhausted. */ 811 + /* Set the Rx ring resource error flag */ 812 + if (rx_next_curr_desc == rx_used_desc) 813 + pep->rx_resource_err = 1; 814 + pep->rx_desc_count--; 815 + dma_unmap_single(NULL, rx_desc->buf_ptr, 816 + rx_desc->buf_size, 817 + DMA_FROM_DEVICE); 818 + received_packets++; 819 + /* 820 + * Update statistics. 821 + * Note byte count includes 4 byte CRC count 822 + */ 823 + stats->rx_packets++; 824 + stats->rx_bytes += rx_desc->byte_cnt; 825 + /* 826 + * In case received a packet without first / last bits on OR 827 + * the error summary bit is on, the packets needs to be droped. 828 + */ 829 + if (((cmd_sts & (RX_FIRST_DESC | RX_LAST_DESC)) != 830 + (RX_FIRST_DESC | RX_LAST_DESC)) 831 + || (cmd_sts & RX_ERROR)) { 832 + 833 + stats->rx_dropped++; 834 + if ((cmd_sts & (RX_FIRST_DESC | RX_LAST_DESC)) != 835 + (RX_FIRST_DESC | RX_LAST_DESC)) { 836 + if (net_ratelimit()) 837 + printk(KERN_ERR 838 + "%s: Rx pkt on multiple desc\n", 839 + dev->name); 840 + } 841 + if (cmd_sts & RX_ERROR) 842 + stats->rx_errors++; 843 + dev_kfree_skb_irq(skb); 844 + } else { 845 + /* 846 + * The -4 is for the CRC in the trailer of the 847 + * received packet 848 + */ 849 + skb_put(skb, rx_desc->byte_cnt - 4); 850 + skb->protocol = eth_type_trans(skb, dev); 851 + netif_receive_skb(skb); 852 + } 853 + dev->last_rx = jiffies; 854 + } 855 + /* Fill RX ring with skb's */ 856 + rxq_refill(dev); 857 + return received_packets; 858 + } 859 + 860 + static int pxa168_eth_collect_events(struct pxa168_eth_private *pep, 861 + struct net_device *dev) 862 + { 863 + u32 icr; 864 + int ret = 0; 865 + 866 + icr = rdl(pep, INT_CAUSE); 867 + if (icr == 0) 868 + return IRQ_NONE; 869 + 870 + wrl(pep, INT_CAUSE, ~icr); 871 + if (icr & (ICR_TXBUF_H | ICR_TXBUF_L)) { 872 + pep->work_todo |= WORK_TX_DONE; 873 + ret = 1; 874 + } 875 + if (icr & ICR_RXBUF) 876 + ret = 1; 877 + if (icr & ICR_MII_CH) { 878 + pep->work_todo |= WORK_LINK; 879 + ret = 1; 880 + } 881 + return ret; 882 + } 883 + 884 + static void handle_link_event(struct pxa168_eth_private *pep) 885 + { 886 + struct net_device *dev = pep->dev; 887 + u32 port_status; 888 + int speed; 889 + int duplex; 890 + int fc; 891 + 892 + port_status = rdl(pep, PORT_STATUS); 893 + if (!(port_status & LINK_UP)) { 894 + if (netif_carrier_ok(dev)) { 895 + printk(KERN_INFO "%s: link down\n", dev->name); 896 + netif_carrier_off(dev); 897 + txq_reclaim(dev, 1); 898 + } 899 + return; 900 + } 901 + if (port_status & PORT_SPEED_100) 902 + speed = 100; 903 + else 904 + speed = 10; 905 + 906 + duplex = (port_status & FULL_DUPLEX) ? 1 : 0; 907 + fc = (port_status & FLOW_CONTROL_ENABLED) ? 1 : 0; 908 + printk(KERN_INFO "%s: link up, %d Mb/s, %s duplex, " 909 + "flow control %sabled\n", dev->name, 910 + speed, duplex ? "full" : "half", fc ? "en" : "dis"); 911 + if (!netif_carrier_ok(dev)) 912 + netif_carrier_on(dev); 913 + } 914 + 915 + static irqreturn_t pxa168_eth_int_handler(int irq, void *dev_id) 916 + { 917 + struct net_device *dev = (struct net_device *)dev_id; 918 + struct pxa168_eth_private *pep = netdev_priv(dev); 919 + 920 + if (unlikely(!pxa168_eth_collect_events(pep, dev))) 921 + return IRQ_NONE; 922 + /* Disable interrupts */ 923 + wrl(pep, INT_MASK, 0); 924 + napi_schedule(&pep->napi); 925 + return IRQ_HANDLED; 926 + } 927 + 928 + static void pxa168_eth_recalc_skb_size(struct pxa168_eth_private *pep) 929 + { 930 + int skb_size; 931 + 932 + /* 933 + * Reserve 2+14 bytes for an ethernet header (the hardware 934 + * automatically prepends 2 bytes of dummy data to each 935 + * received packet), 16 bytes for up to four VLAN tags, and 936 + * 4 bytes for the trailing FCS -- 36 bytes total. 937 + */ 938 + skb_size = pep->dev->mtu + 36; 939 + 940 + /* 941 + * Make sure that the skb size is a multiple of 8 bytes, as 942 + * the lower three bits of the receive descriptor's buffer 943 + * size field are ignored by the hardware. 944 + */ 945 + pep->skb_size = (skb_size + 7) & ~7; 946 + 947 + /* 948 + * If NET_SKB_PAD is smaller than a cache line, 949 + * netdev_alloc_skb() will cause skb->data to be misaligned 950 + * to a cache line boundary. If this is the case, include 951 + * some extra space to allow re-aligning the data area. 952 + */ 953 + pep->skb_size += SKB_DMA_REALIGN; 954 + 955 + } 956 + 957 + static int set_port_config_ext(struct pxa168_eth_private *pep) 958 + { 959 + int skb_size; 960 + 961 + pxa168_eth_recalc_skb_size(pep); 962 + if (pep->skb_size <= 1518) 963 + skb_size = PCXR_MFL_1518; 964 + else if (pep->skb_size <= 1536) 965 + skb_size = PCXR_MFL_1536; 966 + else if (pep->skb_size <= 2048) 967 + skb_size = PCXR_MFL_2048; 968 + else 969 + skb_size = PCXR_MFL_64K; 970 + 971 + /* Extended Port Configuration */ 972 + wrl(pep, 973 + PORT_CONFIG_EXT, PCXR_2BSM | /* Two byte prefix aligns IP hdr */ 974 + PCXR_DSCP_EN | /* Enable DSCP in IP */ 975 + skb_size | PCXR_FLP | /* do not force link pass */ 976 + PCXR_TX_HIGH_PRI); /* Transmit - high priority queue */ 977 + 978 + return 0; 979 + } 980 + 981 + static int pxa168_init_hw(struct pxa168_eth_private *pep) 982 + { 983 + int err = 0; 984 + 985 + /* Disable interrupts */ 986 + wrl(pep, INT_MASK, 0); 987 + wrl(pep, INT_CAUSE, 0); 988 + /* Write to ICR to clear interrupts. */ 989 + wrl(pep, INT_W_CLEAR, 0); 990 + /* Abort any transmit and receive operations and put DMA 991 + * in idle state. 992 + */ 993 + abort_dma(pep); 994 + /* Initialize address hash table */ 995 + err = init_hash_table(pep); 996 + if (err) 997 + return err; 998 + /* SDMA configuration */ 999 + wrl(pep, SDMA_CONFIG, SDCR_BSZ8 | /* Burst size = 32 bytes */ 1000 + SDCR_RIFB | /* Rx interrupt on frame */ 1001 + SDCR_BLMT | /* Little endian transmit */ 1002 + SDCR_BLMR | /* Little endian receive */ 1003 + SDCR_RC_MAX_RETRANS); /* Max retransmit count */ 1004 + /* Port Configuration */ 1005 + wrl(pep, PORT_CONFIG, PCR_HS); /* Hash size is 1/2kb */ 1006 + set_port_config_ext(pep); 1007 + 1008 + return err; 1009 + } 1010 + 1011 + static int rxq_init(struct net_device *dev) 1012 + { 1013 + struct pxa168_eth_private *pep = netdev_priv(dev); 1014 + struct rx_desc *p_rx_desc; 1015 + int size = 0, i = 0; 1016 + int rx_desc_num = pep->rx_ring_size; 1017 + 1018 + /* Allocate RX skb rings */ 1019 + pep->rx_skb = kmalloc(sizeof(*pep->rx_skb) * pep->rx_ring_size, 1020 + GFP_KERNEL); 1021 + if (!pep->rx_skb) { 1022 + printk(KERN_ERR "%s: Cannot alloc RX skb ring\n", dev->name); 1023 + return -ENOMEM; 1024 + } 1025 + /* Allocate RX ring */ 1026 + pep->rx_desc_count = 0; 1027 + size = pep->rx_ring_size * sizeof(struct rx_desc); 1028 + pep->rx_desc_area_size = size; 1029 + pep->p_rx_desc_area = dma_alloc_coherent(pep->dev->dev.parent, size, 1030 + &pep->rx_desc_dma, GFP_KERNEL); 1031 + if (!pep->p_rx_desc_area) { 1032 + printk(KERN_ERR "%s: Cannot alloc RX ring (size %d bytes)\n", 1033 + dev->name, size); 1034 + goto out; 1035 + } 1036 + memset((void *)pep->p_rx_desc_area, 0, size); 1037 + /* initialize the next_desc_ptr links in the Rx descriptors ring */ 1038 + p_rx_desc = (struct rx_desc *)pep->p_rx_desc_area; 1039 + for (i = 0; i < rx_desc_num; i++) { 1040 + p_rx_desc[i].next_desc_ptr = pep->rx_desc_dma + 1041 + ((i + 1) % rx_desc_num) * sizeof(struct rx_desc); 1042 + } 1043 + /* Save Rx desc pointer to driver struct. */ 1044 + pep->rx_curr_desc_q = 0; 1045 + pep->rx_used_desc_q = 0; 1046 + pep->rx_desc_area_size = rx_desc_num * sizeof(struct rx_desc); 1047 + return 0; 1048 + out: 1049 + kfree(pep->rx_skb); 1050 + return -ENOMEM; 1051 + } 1052 + 1053 + static void rxq_deinit(struct net_device *dev) 1054 + { 1055 + struct pxa168_eth_private *pep = netdev_priv(dev); 1056 + int curr; 1057 + 1058 + /* Free preallocated skb's on RX rings */ 1059 + for (curr = 0; pep->rx_desc_count && curr < pep->rx_ring_size; curr++) { 1060 + if (pep->rx_skb[curr]) { 1061 + dev_kfree_skb(pep->rx_skb[curr]); 1062 + pep->rx_desc_count--; 1063 + } 1064 + } 1065 + if (pep->rx_desc_count) 1066 + printk(KERN_ERR 1067 + "Error in freeing Rx Ring. %d skb's still\n", 1068 + pep->rx_desc_count); 1069 + /* Free RX ring */ 1070 + if (pep->p_rx_desc_area) 1071 + dma_free_coherent(pep->dev->dev.parent, pep->rx_desc_area_size, 1072 + pep->p_rx_desc_area, pep->rx_desc_dma); 1073 + kfree(pep->rx_skb); 1074 + } 1075 + 1076 + static int txq_init(struct net_device *dev) 1077 + { 1078 + struct pxa168_eth_private *pep = netdev_priv(dev); 1079 + struct tx_desc *p_tx_desc; 1080 + int size = 0, i = 0; 1081 + int tx_desc_num = pep->tx_ring_size; 1082 + 1083 + pep->tx_skb = kmalloc(sizeof(*pep->tx_skb) * pep->tx_ring_size, 1084 + GFP_KERNEL); 1085 + if (!pep->tx_skb) { 1086 + printk(KERN_ERR "%s: Cannot alloc TX skb ring\n", dev->name); 1087 + return -ENOMEM; 1088 + } 1089 + /* Allocate TX ring */ 1090 + pep->tx_desc_count = 0; 1091 + size = pep->tx_ring_size * sizeof(struct tx_desc); 1092 + pep->tx_desc_area_size = size; 1093 + pep->p_tx_desc_area = dma_alloc_coherent(pep->dev->dev.parent, size, 1094 + &pep->tx_desc_dma, GFP_KERNEL); 1095 + if (!pep->p_tx_desc_area) { 1096 + printk(KERN_ERR "%s: Cannot allocate Tx Ring (size %d bytes)\n", 1097 + dev->name, size); 1098 + goto out; 1099 + } 1100 + memset((void *)pep->p_tx_desc_area, 0, pep->tx_desc_area_size); 1101 + /* Initialize the next_desc_ptr links in the Tx descriptors ring */ 1102 + p_tx_desc = (struct tx_desc *)pep->p_tx_desc_area; 1103 + for (i = 0; i < tx_desc_num; i++) { 1104 + p_tx_desc[i].next_desc_ptr = pep->tx_desc_dma + 1105 + ((i + 1) % tx_desc_num) * sizeof(struct tx_desc); 1106 + } 1107 + pep->tx_curr_desc_q = 0; 1108 + pep->tx_used_desc_q = 0; 1109 + pep->tx_desc_area_size = tx_desc_num * sizeof(struct tx_desc); 1110 + return 0; 1111 + out: 1112 + kfree(pep->tx_skb); 1113 + return -ENOMEM; 1114 + } 1115 + 1116 + static void txq_deinit(struct net_device *dev) 1117 + { 1118 + struct pxa168_eth_private *pep = netdev_priv(dev); 1119 + 1120 + /* Free outstanding skb's on TX ring */ 1121 + txq_reclaim(dev, 1); 1122 + BUG_ON(pep->tx_used_desc_q != pep->tx_curr_desc_q); 1123 + /* Free TX ring */ 1124 + if (pep->p_tx_desc_area) 1125 + dma_free_coherent(pep->dev->dev.parent, pep->tx_desc_area_size, 1126 + pep->p_tx_desc_area, pep->tx_desc_dma); 1127 + kfree(pep->tx_skb); 1128 + } 1129 + 1130 + static int pxa168_eth_open(struct net_device *dev) 1131 + { 1132 + struct pxa168_eth_private *pep = netdev_priv(dev); 1133 + int err; 1134 + 1135 + err = request_irq(dev->irq, pxa168_eth_int_handler, 1136 + IRQF_DISABLED, dev->name, dev); 1137 + if (err) { 1138 + dev_printk(KERN_ERR, &dev->dev, "can't assign irq\n"); 1139 + return -EAGAIN; 1140 + } 1141 + pep->rx_resource_err = 0; 1142 + err = rxq_init(dev); 1143 + if (err != 0) 1144 + goto out_free_irq; 1145 + err = txq_init(dev); 1146 + if (err != 0) 1147 + goto out_free_rx_skb; 1148 + pep->rx_used_desc_q = 0; 1149 + pep->rx_curr_desc_q = 0; 1150 + 1151 + /* Fill RX ring with skb's */ 1152 + rxq_refill(dev); 1153 + pep->rx_used_desc_q = 0; 1154 + pep->rx_curr_desc_q = 0; 1155 + netif_carrier_off(dev); 1156 + eth_port_start(dev); 1157 + napi_enable(&pep->napi); 1158 + return 0; 1159 + out_free_rx_skb: 1160 + rxq_deinit(dev); 1161 + out_free_irq: 1162 + free_irq(dev->irq, dev); 1163 + return err; 1164 + } 1165 + 1166 + static int pxa168_eth_stop(struct net_device *dev) 1167 + { 1168 + struct pxa168_eth_private *pep = netdev_priv(dev); 1169 + eth_port_reset(dev); 1170 + 1171 + /* Disable interrupts */ 1172 + wrl(pep, INT_MASK, 0); 1173 + wrl(pep, INT_CAUSE, 0); 1174 + /* Write to ICR to clear interrupts. */ 1175 + wrl(pep, INT_W_CLEAR, 0); 1176 + napi_disable(&pep->napi); 1177 + del_timer_sync(&pep->timeout); 1178 + netif_carrier_off(dev); 1179 + free_irq(dev->irq, dev); 1180 + rxq_deinit(dev); 1181 + txq_deinit(dev); 1182 + 1183 + return 0; 1184 + } 1185 + 1186 + static int pxa168_eth_change_mtu(struct net_device *dev, int mtu) 1187 + { 1188 + int retval; 1189 + struct pxa168_eth_private *pep = netdev_priv(dev); 1190 + 1191 + if ((mtu > 9500) || (mtu < 68)) 1192 + return -EINVAL; 1193 + 1194 + dev->mtu = mtu; 1195 + retval = set_port_config_ext(pep); 1196 + 1197 + if (!netif_running(dev)) 1198 + return 0; 1199 + 1200 + /* 1201 + * Stop and then re-open the interface. This will allocate RX 1202 + * skbs of the new MTU. 1203 + * There is a possible danger that the open will not succeed, 1204 + * due to memory being full. 1205 + */ 1206 + pxa168_eth_stop(dev); 1207 + if (pxa168_eth_open(dev)) { 1208 + dev_printk(KERN_ERR, &dev->dev, 1209 + "fatal error on re-opening device after " 1210 + "MTU change\n"); 1211 + } 1212 + 1213 + return 0; 1214 + } 1215 + 1216 + static int eth_alloc_tx_desc_index(struct pxa168_eth_private *pep) 1217 + { 1218 + int tx_desc_curr; 1219 + 1220 + tx_desc_curr = pep->tx_curr_desc_q; 1221 + pep->tx_curr_desc_q = (tx_desc_curr + 1) % pep->tx_ring_size; 1222 + BUG_ON(pep->tx_curr_desc_q == pep->tx_used_desc_q); 1223 + pep->tx_desc_count++; 1224 + 1225 + return tx_desc_curr; 1226 + } 1227 + 1228 + static int pxa168_rx_poll(struct napi_struct *napi, int budget) 1229 + { 1230 + struct pxa168_eth_private *pep = 1231 + container_of(napi, struct pxa168_eth_private, napi); 1232 + struct net_device *dev = pep->dev; 1233 + int work_done = 0; 1234 + 1235 + if (unlikely(pep->work_todo & WORK_LINK)) { 1236 + pep->work_todo &= ~(WORK_LINK); 1237 + handle_link_event(pep); 1238 + } 1239 + /* 1240 + * We call txq_reclaim every time since in NAPI interupts are disabled 1241 + * and due to this we miss the TX_DONE interrupt,which is not updated in 1242 + * interrupt status register. 1243 + */ 1244 + txq_reclaim(dev, 0); 1245 + if (netif_queue_stopped(dev) 1246 + && pep->tx_ring_size - pep->tx_desc_count > 1) { 1247 + netif_wake_queue(dev); 1248 + } 1249 + work_done = rxq_process(dev, budget); 1250 + if (work_done < budget) { 1251 + napi_complete(napi); 1252 + wrl(pep, INT_MASK, ALL_INTS); 1253 + } 1254 + 1255 + return work_done; 1256 + } 1257 + 1258 + static int pxa168_eth_start_xmit(struct sk_buff *skb, struct net_device *dev) 1259 + { 1260 + struct pxa168_eth_private *pep = netdev_priv(dev); 1261 + struct net_device_stats *stats = &dev->stats; 1262 + struct tx_desc *desc; 1263 + int tx_index; 1264 + int length; 1265 + 1266 + tx_index = eth_alloc_tx_desc_index(pep); 1267 + desc = &pep->p_tx_desc_area[tx_index]; 1268 + length = skb->len; 1269 + pep->tx_skb[tx_index] = skb; 1270 + desc->byte_cnt = length; 1271 + desc->buf_ptr = dma_map_single(NULL, skb->data, length, DMA_TO_DEVICE); 1272 + wmb(); 1273 + desc->cmd_sts = BUF_OWNED_BY_DMA | TX_GEN_CRC | TX_FIRST_DESC | 1274 + TX_ZERO_PADDING | TX_LAST_DESC | TX_EN_INT; 1275 + wmb(); 1276 + wrl(pep, SDMA_CMD, SDMA_CMD_TXDH | SDMA_CMD_ERD); 1277 + 1278 + stats->tx_bytes += skb->len; 1279 + stats->tx_packets++; 1280 + dev->trans_start = jiffies; 1281 + if (pep->tx_ring_size - pep->tx_desc_count <= 1) { 1282 + /* We handled the current skb, but now we are out of space.*/ 1283 + netif_stop_queue(dev); 1284 + } 1285 + 1286 + return NETDEV_TX_OK; 1287 + } 1288 + 1289 + static int smi_wait_ready(struct pxa168_eth_private *pep) 1290 + { 1291 + int i = 0; 1292 + 1293 + /* wait for the SMI register to become available */ 1294 + for (i = 0; rdl(pep, SMI) & SMI_BUSY; i++) { 1295 + if (i == PHY_WAIT_ITERATIONS) 1296 + return -ETIMEDOUT; 1297 + msleep(10); 1298 + } 1299 + 1300 + return 0; 1301 + } 1302 + 1303 + static int pxa168_smi_read(struct mii_bus *bus, int phy_addr, int regnum) 1304 + { 1305 + struct pxa168_eth_private *pep = bus->priv; 1306 + int i = 0; 1307 + int val; 1308 + 1309 + if (smi_wait_ready(pep)) { 1310 + printk(KERN_WARNING "pxa168_eth: SMI bus busy timeout\n"); 1311 + return -ETIMEDOUT; 1312 + } 1313 + wrl(pep, SMI, (phy_addr << 16) | (regnum << 21) | SMI_OP_R); 1314 + /* now wait for the data to be valid */ 1315 + for (i = 0; !((val = rdl(pep, SMI)) & SMI_R_VALID); i++) { 1316 + if (i == PHY_WAIT_ITERATIONS) { 1317 + printk(KERN_WARNING 1318 + "pxa168_eth: SMI bus read not valid\n"); 1319 + return -ENODEV; 1320 + } 1321 + msleep(10); 1322 + } 1323 + 1324 + return val & 0xffff; 1325 + } 1326 + 1327 + static int pxa168_smi_write(struct mii_bus *bus, int phy_addr, int regnum, 1328 + u16 value) 1329 + { 1330 + struct pxa168_eth_private *pep = bus->priv; 1331 + 1332 + if (smi_wait_ready(pep)) { 1333 + printk(KERN_WARNING "pxa168_eth: SMI bus busy timeout\n"); 1334 + return -ETIMEDOUT; 1335 + } 1336 + 1337 + wrl(pep, SMI, (phy_addr << 16) | (regnum << 21) | 1338 + SMI_OP_W | (value & 0xffff)); 1339 + 1340 + if (smi_wait_ready(pep)) { 1341 + printk(KERN_ERR "pxa168_eth: SMI bus busy timeout\n"); 1342 + return -ETIMEDOUT; 1343 + } 1344 + 1345 + return 0; 1346 + } 1347 + 1348 + static int pxa168_eth_do_ioctl(struct net_device *dev, struct ifreq *ifr, 1349 + int cmd) 1350 + { 1351 + struct pxa168_eth_private *pep = netdev_priv(dev); 1352 + if (pep->phy != NULL) 1353 + return phy_mii_ioctl(pep->phy, if_mii(ifr), cmd); 1354 + 1355 + return -EOPNOTSUPP; 1356 + } 1357 + 1358 + static struct phy_device *phy_scan(struct pxa168_eth_private *pep, int phy_addr) 1359 + { 1360 + struct mii_bus *bus = pep->smi_bus; 1361 + struct phy_device *phydev; 1362 + int start; 1363 + int num; 1364 + int i; 1365 + 1366 + if (phy_addr == PXA168_ETH_PHY_ADDR_DEFAULT) { 1367 + /* Scan entire range */ 1368 + start = ethernet_phy_get(pep); 1369 + num = 32; 1370 + } else { 1371 + /* Use phy addr specific to platform */ 1372 + start = phy_addr & 0x1f; 1373 + num = 1; 1374 + } 1375 + phydev = NULL; 1376 + for (i = 0; i < num; i++) { 1377 + int addr = (start + i) & 0x1f; 1378 + if (bus->phy_map[addr] == NULL) 1379 + mdiobus_scan(bus, addr); 1380 + 1381 + if (phydev == NULL) { 1382 + phydev = bus->phy_map[addr]; 1383 + if (phydev != NULL) 1384 + ethernet_phy_set_addr(pep, addr); 1385 + } 1386 + } 1387 + 1388 + return phydev; 1389 + } 1390 + 1391 + static void phy_init(struct pxa168_eth_private *pep, int speed, int duplex) 1392 + { 1393 + struct phy_device *phy = pep->phy; 1394 + ethernet_phy_reset(pep); 1395 + 1396 + phy_attach(pep->dev, dev_name(&phy->dev), 0, PHY_INTERFACE_MODE_MII); 1397 + 1398 + if (speed == 0) { 1399 + phy->autoneg = AUTONEG_ENABLE; 1400 + phy->speed = 0; 1401 + phy->duplex = 0; 1402 + phy->supported &= PHY_BASIC_FEATURES; 1403 + phy->advertising = phy->supported | ADVERTISED_Autoneg; 1404 + } else { 1405 + phy->autoneg = AUTONEG_DISABLE; 1406 + phy->advertising = 0; 1407 + phy->speed = speed; 1408 + phy->duplex = duplex; 1409 + } 1410 + phy_start_aneg(phy); 1411 + } 1412 + 1413 + static int ethernet_phy_setup(struct net_device *dev) 1414 + { 1415 + struct pxa168_eth_private *pep = netdev_priv(dev); 1416 + 1417 + if (pep->pd != NULL) { 1418 + if (pep->pd->init) 1419 + pep->pd->init(); 1420 + } 1421 + pep->phy = phy_scan(pep, pep->pd->phy_addr & 0x1f); 1422 + if (pep->phy != NULL) 1423 + phy_init(pep, pep->pd->speed, pep->pd->duplex); 1424 + update_hash_table_mac_address(pep, NULL, dev->dev_addr); 1425 + 1426 + return 0; 1427 + } 1428 + 1429 + static int pxa168_get_settings(struct net_device *dev, struct ethtool_cmd *cmd) 1430 + { 1431 + struct pxa168_eth_private *pep = netdev_priv(dev); 1432 + int err; 1433 + 1434 + err = phy_read_status(pep->phy); 1435 + if (err == 0) 1436 + err = phy_ethtool_gset(pep->phy, cmd); 1437 + 1438 + return err; 1439 + } 1440 + 1441 + static int pxa168_set_settings(struct net_device *dev, struct ethtool_cmd *cmd) 1442 + { 1443 + struct pxa168_eth_private *pep = netdev_priv(dev); 1444 + 1445 + return phy_ethtool_sset(pep->phy, cmd); 1446 + } 1447 + 1448 + static void pxa168_get_drvinfo(struct net_device *dev, 1449 + struct ethtool_drvinfo *info) 1450 + { 1451 + strncpy(info->driver, DRIVER_NAME, 32); 1452 + strncpy(info->version, DRIVER_VERSION, 32); 1453 + strncpy(info->fw_version, "N/A", 32); 1454 + strncpy(info->bus_info, "N/A", 32); 1455 + } 1456 + 1457 + static u32 pxa168_get_link(struct net_device *dev) 1458 + { 1459 + return !!netif_carrier_ok(dev); 1460 + } 1461 + 1462 + static const struct ethtool_ops pxa168_ethtool_ops = { 1463 + .get_settings = pxa168_get_settings, 1464 + .set_settings = pxa168_set_settings, 1465 + .get_drvinfo = pxa168_get_drvinfo, 1466 + .get_link = pxa168_get_link, 1467 + }; 1468 + 1469 + static const struct net_device_ops pxa168_eth_netdev_ops = { 1470 + .ndo_open = pxa168_eth_open, 1471 + .ndo_stop = pxa168_eth_stop, 1472 + .ndo_start_xmit = pxa168_eth_start_xmit, 1473 + .ndo_set_rx_mode = pxa168_eth_set_rx_mode, 1474 + .ndo_set_mac_address = pxa168_eth_set_mac_address, 1475 + .ndo_validate_addr = eth_validate_addr, 1476 + .ndo_do_ioctl = pxa168_eth_do_ioctl, 1477 + .ndo_change_mtu = pxa168_eth_change_mtu, 1478 + .ndo_tx_timeout = pxa168_eth_tx_timeout, 1479 + }; 1480 + 1481 + static int pxa168_eth_probe(struct platform_device *pdev) 1482 + { 1483 + struct pxa168_eth_private *pep = NULL; 1484 + struct net_device *dev = NULL; 1485 + struct resource *res; 1486 + struct clk *clk; 1487 + int err; 1488 + 1489 + printk(KERN_NOTICE "PXA168 10/100 Ethernet Driver\n"); 1490 + 1491 + clk = clk_get(&pdev->dev, "MFUCLK"); 1492 + if (IS_ERR(clk)) { 1493 + printk(KERN_ERR "%s: Fast Ethernet failed to get clock\n", 1494 + DRIVER_NAME); 1495 + return -ENODEV; 1496 + } 1497 + clk_enable(clk); 1498 + 1499 + dev = alloc_etherdev(sizeof(struct pxa168_eth_private)); 1500 + if (!dev) { 1501 + err = -ENOMEM; 1502 + goto out; 1503 + } 1504 + 1505 + platform_set_drvdata(pdev, dev); 1506 + pep = netdev_priv(dev); 1507 + pep->dev = dev; 1508 + pep->clk = clk; 1509 + res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 1510 + if (res == NULL) { 1511 + err = -ENODEV; 1512 + goto out; 1513 + } 1514 + pep->base = ioremap(res->start, res->end - res->start + 1); 1515 + if (pep->base == NULL) { 1516 + err = -ENOMEM; 1517 + goto out; 1518 + } 1519 + res = platform_get_resource(pdev, IORESOURCE_IRQ, 0); 1520 + BUG_ON(!res); 1521 + dev->irq = res->start; 1522 + dev->netdev_ops = &pxa168_eth_netdev_ops; 1523 + dev->watchdog_timeo = 2 * HZ; 1524 + dev->base_addr = 0; 1525 + SET_ETHTOOL_OPS(dev, &pxa168_ethtool_ops); 1526 + 1527 + INIT_WORK(&pep->tx_timeout_task, pxa168_eth_tx_timeout_task); 1528 + 1529 + printk(KERN_INFO "%s:Using random mac address\n", DRIVER_NAME); 1530 + random_ether_addr(dev->dev_addr); 1531 + 1532 + pep->pd = pdev->dev.platform_data; 1533 + pep->rx_ring_size = NUM_RX_DESCS; 1534 + if (pep->pd->rx_queue_size) 1535 + pep->rx_ring_size = pep->pd->rx_queue_size; 1536 + 1537 + pep->tx_ring_size = NUM_TX_DESCS; 1538 + if (pep->pd->tx_queue_size) 1539 + pep->tx_ring_size = pep->pd->tx_queue_size; 1540 + 1541 + pep->port_num = pep->pd->port_number; 1542 + /* Hardware supports only 3 ports */ 1543 + BUG_ON(pep->port_num > 2); 1544 + netif_napi_add(dev, &pep->napi, pxa168_rx_poll, pep->rx_ring_size); 1545 + 1546 + memset(&pep->timeout, 0, sizeof(struct timer_list)); 1547 + init_timer(&pep->timeout); 1548 + pep->timeout.function = rxq_refill_timer_wrapper; 1549 + pep->timeout.data = (unsigned long)pep; 1550 + 1551 + pep->smi_bus = mdiobus_alloc(); 1552 + if (pep->smi_bus == NULL) { 1553 + err = -ENOMEM; 1554 + goto out; 1555 + } 1556 + pep->smi_bus->priv = pep; 1557 + pep->smi_bus->name = "pxa168_eth smi"; 1558 + pep->smi_bus->read = pxa168_smi_read; 1559 + pep->smi_bus->write = pxa168_smi_write; 1560 + snprintf(pep->smi_bus->id, MII_BUS_ID_SIZE, "%d", pdev->id); 1561 + pep->smi_bus->parent = &pdev->dev; 1562 + pep->smi_bus->phy_mask = 0xffffffff; 1563 + if (mdiobus_register(pep->smi_bus) < 0) { 1564 + err = -ENOMEM; 1565 + goto out; 1566 + } 1567 + pxa168_init_hw(pep); 1568 + err = ethernet_phy_setup(dev); 1569 + if (err) 1570 + goto out; 1571 + SET_NETDEV_DEV(dev, &pdev->dev); 1572 + err = register_netdev(dev); 1573 + if (err) 1574 + goto out; 1575 + return 0; 1576 + out: 1577 + if (pep->clk) { 1578 + clk_disable(pep->clk); 1579 + clk_put(pep->clk); 1580 + pep->clk = NULL; 1581 + } 1582 + if (pep->base) { 1583 + iounmap(pep->base); 1584 + pep->base = NULL; 1585 + } 1586 + if (dev) 1587 + free_netdev(dev); 1588 + return err; 1589 + } 1590 + 1591 + static int pxa168_eth_remove(struct platform_device *pdev) 1592 + { 1593 + struct net_device *dev = platform_get_drvdata(pdev); 1594 + struct pxa168_eth_private *pep = netdev_priv(dev); 1595 + 1596 + if (pep->htpr) { 1597 + dma_free_coherent(pep->dev->dev.parent, HASH_ADDR_TABLE_SIZE, 1598 + pep->htpr, pep->htpr_dma); 1599 + pep->htpr = NULL; 1600 + } 1601 + if (pep->clk) { 1602 + clk_disable(pep->clk); 1603 + clk_put(pep->clk); 1604 + pep->clk = NULL; 1605 + } 1606 + if (pep->phy != NULL) 1607 + phy_detach(pep->phy); 1608 + 1609 + iounmap(pep->base); 1610 + pep->base = NULL; 1611 + unregister_netdev(dev); 1612 + flush_scheduled_work(); 1613 + free_netdev(dev); 1614 + platform_set_drvdata(pdev, NULL); 1615 + return 0; 1616 + } 1617 + 1618 + static void pxa168_eth_shutdown(struct platform_device *pdev) 1619 + { 1620 + struct net_device *dev = platform_get_drvdata(pdev); 1621 + eth_port_reset(dev); 1622 + } 1623 + 1624 + #ifdef CONFIG_PM 1625 + static int pxa168_eth_resume(struct platform_device *pdev) 1626 + { 1627 + return -ENOSYS; 1628 + } 1629 + 1630 + static int pxa168_eth_suspend(struct platform_device *pdev, pm_message_t state) 1631 + { 1632 + return -ENOSYS; 1633 + } 1634 + 1635 + #else 1636 + #define pxa168_eth_resume NULL 1637 + #define pxa168_eth_suspend NULL 1638 + #endif 1639 + 1640 + static struct platform_driver pxa168_eth_driver = { 1641 + .probe = pxa168_eth_probe, 1642 + .remove = pxa168_eth_remove, 1643 + .shutdown = pxa168_eth_shutdown, 1644 + .resume = pxa168_eth_resume, 1645 + .suspend = pxa168_eth_suspend, 1646 + .driver = { 1647 + .name = DRIVER_NAME, 1648 + }, 1649 + }; 1650 + 1651 + static int __init pxa168_init_module(void) 1652 + { 1653 + return platform_driver_register(&pxa168_eth_driver); 1654 + } 1655 + 1656 + static void __exit pxa168_cleanup_module(void) 1657 + { 1658 + platform_driver_unregister(&pxa168_eth_driver); 1659 + } 1660 + 1661 + module_init(pxa168_init_module); 1662 + module_exit(pxa168_cleanup_module); 1663 + 1664 + MODULE_LICENSE("GPL"); 1665 + MODULE_DESCRIPTION("Ethernet driver for Marvell PXA168"); 1666 + MODULE_ALIAS("platform:pxa168_eth");
-2
drivers/net/qlcnic/qlcnic_main.c
··· 2091 2091 struct qlcnic_adapter *adapter = netdev_priv(netdev); 2092 2092 struct net_device_stats *stats = &netdev->stats; 2093 2093 2094 - memset(stats, 0, sizeof(*stats)); 2095 - 2096 2094 stats->rx_packets = adapter->stats.rx_pkts + adapter->stats.lro_pkts; 2097 2095 stats->tx_packets = adapter->stats.xmitfinished; 2098 2096 stats->rx_bytes = adapter->stats.rxbytes + adapter->stats.lrobytes;
+1 -1
drivers/net/sh_eth.c
··· 1437 1437 1438 1438 static int sh_eth_drv_probe(struct platform_device *pdev) 1439 1439 { 1440 - int ret, i, devno = 0; 1440 + int ret, devno = 0; 1441 1441 struct resource *res; 1442 1442 struct net_device *ndev = NULL; 1443 1443 struct sh_eth_private *mdp;
+4 -4
drivers/net/wireless/adm8211.c
··· 732 732 733 733 /* Nothing to do for ADMtek BBP */ 734 734 } else if (priv->bbp_type != ADM8211_TYPE_ADMTEK) 735 - wiphy_debug(dev->wiphy, "unsupported bbp type %d\n", 735 + wiphy_debug(dev->wiphy, "unsupported BBP type %d\n", 736 736 priv->bbp_type); 737 737 738 738 ADM8211_RESTORE(); ··· 1032 1032 break; 1033 1033 } 1034 1034 } else 1035 - wiphy_debug(dev->wiphy, "unsupported bbp %d\n", priv->bbp_type); 1035 + wiphy_debug(dev->wiphy, "unsupported BBP %d\n", priv->bbp_type); 1036 1036 1037 1037 ADM8211_CSR_WRITE(SYNRF, 0); 1038 1038 ··· 1525 1525 retval = request_irq(priv->pdev->irq, adm8211_interrupt, 1526 1526 IRQF_SHARED, "adm8211", dev); 1527 1527 if (retval) { 1528 - wiphy_err(dev->wiphy, "failed to register irq handler\n"); 1528 + wiphy_err(dev->wiphy, "failed to register IRQ handler\n"); 1529 1529 goto fail; 1530 1530 } 1531 1531 ··· 1902 1902 goto err_free_eeprom; 1903 1903 } 1904 1904 1905 - wiphy_info(dev->wiphy, "hwaddr %pm, rev 0x%02x\n", 1905 + wiphy_info(dev->wiphy, "hwaddr %pM, Rev 0x%02x\n", 1906 1906 dev->wiphy->perm_addr, pdev->revision); 1907 1907 1908 1908 return 0;
+11 -11
drivers/net/wireless/at76c50x-usb.c
··· 655 655 exit: 656 656 kfree(hwcfg); 657 657 if (ret < 0) 658 - wiphy_err(priv->hw->wiphy, "cannot get hw config (error %d)\n", 658 + wiphy_err(priv->hw->wiphy, "cannot get HW Config (error %d)\n", 659 659 ret); 660 660 661 661 return ret; ··· 960 960 sizeof(struct mib_mac_addr)); 961 961 if (ret < 0) { 962 962 wiphy_err(priv->hw->wiphy, 963 - "at76_get_mib (mac_addr) failed: %d\n", ret); 963 + "at76_get_mib (MAC_ADDR) failed: %d\n", ret); 964 964 goto exit; 965 965 } 966 966 ··· 989 989 sizeof(struct mib_mac_wep)); 990 990 if (ret < 0) { 991 991 wiphy_err(priv->hw->wiphy, 992 - "at76_get_mib (mac_wep) failed: %d\n", ret); 992 + "at76_get_mib (MAC_WEP) failed: %d\n", ret); 993 993 goto exit; 994 994 } 995 995 ··· 1026 1026 sizeof(struct mib_mac_mgmt)); 1027 1027 if (ret < 0) { 1028 1028 wiphy_err(priv->hw->wiphy, 1029 - "at76_get_mib (mac_mgmt) failed: %d\n", ret); 1029 + "at76_get_mib (MAC_MGMT) failed: %d\n", ret); 1030 1030 goto exit; 1031 1031 } 1032 1032 ··· 1062 1062 ret = at76_get_mib(priv->udev, MIB_MAC, m, sizeof(struct mib_mac)); 1063 1063 if (ret < 0) { 1064 1064 wiphy_err(priv->hw->wiphy, 1065 - "at76_get_mib (mac) failed: %d\n", ret); 1065 + "at76_get_mib (MAC) failed: %d\n", ret); 1066 1066 goto exit; 1067 1067 } 1068 1068 ··· 1099 1099 ret = at76_get_mib(priv->udev, MIB_PHY, m, sizeof(struct mib_phy)); 1100 1100 if (ret < 0) { 1101 1101 wiphy_err(priv->hw->wiphy, 1102 - "at76_get_mib (phy) failed: %d\n", ret); 1102 + "at76_get_mib (PHY) failed: %d\n", ret); 1103 1103 goto exit; 1104 1104 } 1105 1105 ··· 1132 1132 ret = at76_get_mib(priv->udev, MIB_LOCAL, m, sizeof(struct mib_local)); 1133 1133 if (ret < 0) { 1134 1134 wiphy_err(priv->hw->wiphy, 1135 - "at76_get_mib (local) failed: %d\n", ret); 1135 + "at76_get_mib (LOCAL) failed: %d\n", ret); 1136 1136 goto exit; 1137 1137 } 1138 1138 ··· 1158 1158 sizeof(struct mib_mdomain)); 1159 1159 if (ret < 0) { 1160 1160 wiphy_err(priv->hw->wiphy, 1161 - "at76_get_mib (mdomain) failed: %d\n", ret); 1161 + "at76_get_mib (MDOMAIN) failed: %d\n", ret); 1162 1162 goto exit; 1163 1163 } 1164 1164 ··· 1229 1229 struct sk_buff *skb = priv->rx_skb; 1230 1230 1231 1231 if (!priv->rx_urb) { 1232 - wiphy_err(priv->hw->wiphy, "%s: priv->rx_urb is null\n", 1232 + wiphy_err(priv->hw->wiphy, "%s: priv->rx_urb is NULL\n", 1233 1233 __func__); 1234 1234 return -EFAULT; 1235 1235 } ··· 1792 1792 wiphy_err(priv->hw->wiphy, "error in tx submit urb: %d\n", ret); 1793 1793 if (ret == -EINVAL) 1794 1794 wiphy_err(priv->hw->wiphy, 1795 - "-einval: tx urb %p hcpriv %p complete %p\n", 1795 + "-EINVAL: tx urb %p hcpriv %p complete %p\n", 1796 1796 priv->tx_urb, 1797 1797 priv->tx_urb->hcpriv, priv->tx_urb->complete); 1798 1798 } ··· 2310 2310 2311 2311 priv->mac80211_registered = 1; 2312 2312 2313 - wiphy_info(priv->hw->wiphy, "usb %s, mac %pm, firmware %d.%d.%d-%d\n", 2313 + wiphy_info(priv->hw->wiphy, "USB %s, MAC %pM, firmware %d.%d.%d-%d\n", 2314 2314 dev_name(&interface->dev), priv->mac_addr, 2315 2315 priv->fw_version.major, priv->fw_version.minor, 2316 2316 priv->fw_version.patch, priv->fw_version.build);
+2 -2
drivers/net/wireless/ath/ar9170/main.c
··· 245 245 { 246 246 int i; 247 247 248 - wiphy_debug(ar->hw->wiphy, "qos queue stats\n"); 248 + wiphy_debug(ar->hw->wiphy, "QoS queue stats\n"); 249 249 250 250 for (i = 0; i < __AR9170_NUM_TXQ; i++) 251 251 wiphy_debug(ar->hw->wiphy, ··· 387 387 if (mac && compare_ether_addr(ieee80211_get_DA(hdr), mac)) { 388 388 #ifdef AR9170_QUEUE_DEBUG 389 389 wiphy_debug(ar->hw->wiphy, 390 - "skip frame => da %pm != %pm\n", 390 + "skip frame => DA %pM != %pM\n", 391 391 mac, ieee80211_get_DA(hdr)); 392 392 ar9170_print_txheader(ar, skb); 393 393 #endif /* AR9170_QUEUE_DEBUG */
-8
drivers/net/wireless/ipw2x00/ipw2100.c
··· 2723 2723 2724 2724 packet = &priv->rx_buffers[i]; 2725 2725 2726 - /* Sync the DMA for the STATUS buffer so CPU is sure to get 2727 - * the correct values */ 2728 - pci_dma_sync_single_for_cpu(priv->pci_dev, 2729 - sq->nic + 2730 - sizeof(struct ipw2100_status) * i, 2731 - sizeof(struct ipw2100_status), 2732 - PCI_DMA_FROMDEVICE); 2733 - 2734 2726 /* Sync the DMA for the RX buffer so CPU is sure to get 2735 2727 * the correct values */ 2736 2728 pci_dma_sync_single_for_cpu(priv->pci_dev, packet->dma_addr,
+2 -2
drivers/net/wireless/iwlwifi/iwl-1000.c
··· 265 265 .support_ct_kill_exit = true, 266 266 .plcp_delta_threshold = IWL_MAX_PLCP_ERR_EXT_LONG_THRESHOLD_DEF, 267 267 .chain_noise_scale = 1000, 268 - .monitor_recover_period = IWL_MONITORING_PERIOD, 268 + .monitor_recover_period = IWL_DEF_MONITORING_PERIOD, 269 269 .max_event_log_size = 128, 270 270 .ucode_tracing = true, 271 271 .sensitivity_calib_by_driver = true, ··· 297 297 .support_ct_kill_exit = true, 298 298 .plcp_delta_threshold = IWL_MAX_PLCP_ERR_EXT_LONG_THRESHOLD_DEF, 299 299 .chain_noise_scale = 1000, 300 - .monitor_recover_period = IWL_MONITORING_PERIOD, 300 + .monitor_recover_period = IWL_DEF_MONITORING_PERIOD, 301 301 .max_event_log_size = 128, 302 302 .ucode_tracing = true, 303 303 .sensitivity_calib_by_driver = true,
+2 -2
drivers/net/wireless/iwlwifi/iwl-3945.c
··· 2731 2731 .led_compensation = 64, 2732 2732 .broken_powersave = true, 2733 2733 .plcp_delta_threshold = IWL_MAX_PLCP_ERR_LONG_THRESHOLD_DEF, 2734 - .monitor_recover_period = IWL_MONITORING_PERIOD, 2734 + .monitor_recover_period = IWL_DEF_MONITORING_PERIOD, 2735 2735 .max_event_log_size = 512, 2736 2736 .tx_power_by_driver = true, 2737 2737 }; ··· 2752 2752 .led_compensation = 64, 2753 2753 .broken_powersave = true, 2754 2754 .plcp_delta_threshold = IWL_MAX_PLCP_ERR_LONG_THRESHOLD_DEF, 2755 - .monitor_recover_period = IWL_MONITORING_PERIOD, 2755 + .monitor_recover_period = IWL_DEF_MONITORING_PERIOD, 2756 2756 .max_event_log_size = 512, 2757 2757 .tx_power_by_driver = true, 2758 2758 };
+1 -1
drivers/net/wireless/iwlwifi/iwl-4965.c
··· 2322 2322 .led_compensation = 61, 2323 2323 .chain_noise_num_beacons = IWL4965_CAL_NUM_BEACONS, 2324 2324 .plcp_delta_threshold = IWL_MAX_PLCP_ERR_THRESHOLD_DEF, 2325 - .monitor_recover_period = IWL_MONITORING_PERIOD, 2325 + .monitor_recover_period = IWL_DEF_MONITORING_PERIOD, 2326 2326 .temperature_kelvin = true, 2327 2327 .max_event_log_size = 512, 2328 2328 .tx_power_by_driver = true,
+7 -7
drivers/net/wireless/iwlwifi/iwl-5000.c
··· 510 510 .chain_noise_num_beacons = IWL_CAL_NUM_BEACONS, 511 511 .plcp_delta_threshold = IWL_MAX_PLCP_ERR_LONG_THRESHOLD_DEF, 512 512 .chain_noise_scale = 1000, 513 - .monitor_recover_period = IWL_MONITORING_PERIOD, 513 + .monitor_recover_period = IWL_LONG_MONITORING_PERIOD, 514 514 .max_event_log_size = 512, 515 515 .ucode_tracing = true, 516 516 .sensitivity_calib_by_driver = true, ··· 541 541 .chain_noise_num_beacons = IWL_CAL_NUM_BEACONS, 542 542 .plcp_delta_threshold = IWL_MAX_PLCP_ERR_LONG_THRESHOLD_DEF, 543 543 .chain_noise_scale = 1000, 544 - .monitor_recover_period = IWL_MONITORING_PERIOD, 544 + .monitor_recover_period = IWL_LONG_MONITORING_PERIOD, 545 545 .max_event_log_size = 512, 546 546 .ucode_tracing = true, 547 547 .sensitivity_calib_by_driver = true, ··· 570 570 .chain_noise_num_beacons = IWL_CAL_NUM_BEACONS, 571 571 .plcp_delta_threshold = IWL_MAX_PLCP_ERR_LONG_THRESHOLD_DEF, 572 572 .chain_noise_scale = 1000, 573 - .monitor_recover_period = IWL_MONITORING_PERIOD, 573 + .monitor_recover_period = IWL_LONG_MONITORING_PERIOD, 574 574 .max_event_log_size = 512, 575 575 .ucode_tracing = true, 576 576 .sensitivity_calib_by_driver = true, ··· 601 601 .chain_noise_num_beacons = IWL_CAL_NUM_BEACONS, 602 602 .plcp_delta_threshold = IWL_MAX_PLCP_ERR_LONG_THRESHOLD_DEF, 603 603 .chain_noise_scale = 1000, 604 - .monitor_recover_period = IWL_MONITORING_PERIOD, 604 + .monitor_recover_period = IWL_LONG_MONITORING_PERIOD, 605 605 .max_event_log_size = 512, 606 606 .ucode_tracing = true, 607 607 .sensitivity_calib_by_driver = true, ··· 632 632 .chain_noise_num_beacons = IWL_CAL_NUM_BEACONS, 633 633 .plcp_delta_threshold = IWL_MAX_PLCP_ERR_LONG_THRESHOLD_DEF, 634 634 .chain_noise_scale = 1000, 635 - .monitor_recover_period = IWL_MONITORING_PERIOD, 635 + .monitor_recover_period = IWL_LONG_MONITORING_PERIOD, 636 636 .max_event_log_size = 512, 637 637 .ucode_tracing = true, 638 638 .sensitivity_calib_by_driver = true, ··· 663 663 .chain_noise_num_beacons = IWL_CAL_NUM_BEACONS, 664 664 .plcp_delta_threshold = IWL_MAX_PLCP_ERR_LONG_THRESHOLD_DEF, 665 665 .chain_noise_scale = 1000, 666 - .monitor_recover_period = IWL_MONITORING_PERIOD, 666 + .monitor_recover_period = IWL_LONG_MONITORING_PERIOD, 667 667 .max_event_log_size = 512, 668 668 .ucode_tracing = true, 669 669 .sensitivity_calib_by_driver = true, ··· 693 693 .chain_noise_num_beacons = IWL_CAL_NUM_BEACONS, 694 694 .plcp_delta_threshold = IWL_MAX_PLCP_ERR_LONG_THRESHOLD_DEF, 695 695 .chain_noise_scale = 1000, 696 - .monitor_recover_period = IWL_MONITORING_PERIOD, 696 + .monitor_recover_period = IWL_LONG_MONITORING_PERIOD, 697 697 .max_event_log_size = 512, 698 698 .ucode_tracing = true, 699 699 .sensitivity_calib_by_driver = true,
+16 -16
drivers/net/wireless/iwlwifi/iwl-6000.c
··· 388 388 .support_ct_kill_exit = true, 389 389 .plcp_delta_threshold = IWL_MAX_PLCP_ERR_THRESHOLD_DEF, 390 390 .chain_noise_scale = 1000, 391 - .monitor_recover_period = IWL_MONITORING_PERIOD, 391 + .monitor_recover_period = IWL_DEF_MONITORING_PERIOD, 392 392 .max_event_log_size = 512, 393 393 .ucode_tracing = true, 394 394 .sensitivity_calib_by_driver = true, ··· 424 424 .support_ct_kill_exit = true, 425 425 .plcp_delta_threshold = IWL_MAX_PLCP_ERR_THRESHOLD_DEF, 426 426 .chain_noise_scale = 1000, 427 - .monitor_recover_period = IWL_MONITORING_PERIOD, 427 + .monitor_recover_period = IWL_DEF_MONITORING_PERIOD, 428 428 .max_event_log_size = 512, 429 429 .sensitivity_calib_by_driver = true, 430 430 .chain_noise_calib_by_driver = true, ··· 459 459 .support_ct_kill_exit = true, 460 460 .plcp_delta_threshold = IWL_MAX_PLCP_ERR_THRESHOLD_DEF, 461 461 .chain_noise_scale = 1000, 462 - .monitor_recover_period = IWL_MONITORING_PERIOD, 462 + .monitor_recover_period = IWL_DEF_MONITORING_PERIOD, 463 463 .max_event_log_size = 512, 464 464 .sensitivity_calib_by_driver = true, 465 465 .chain_noise_calib_by_driver = true, ··· 496 496 .support_ct_kill_exit = true, 497 497 .plcp_delta_threshold = IWL_MAX_PLCP_ERR_THRESHOLD_DEF, 498 498 .chain_noise_scale = 1000, 499 - .monitor_recover_period = IWL_MONITORING_PERIOD, 499 + .monitor_recover_period = IWL_LONG_MONITORING_PERIOD, 500 500 .max_event_log_size = 512, 501 501 .sensitivity_calib_by_driver = true, 502 502 .chain_noise_calib_by_driver = true, ··· 532 532 .support_ct_kill_exit = true, 533 533 .plcp_delta_threshold = IWL_MAX_PLCP_ERR_THRESHOLD_DEF, 534 534 .chain_noise_scale = 1000, 535 - .monitor_recover_period = IWL_MONITORING_PERIOD, 535 + .monitor_recover_period = IWL_LONG_MONITORING_PERIOD, 536 536 .max_event_log_size = 512, 537 537 .sensitivity_calib_by_driver = true, 538 538 .chain_noise_calib_by_driver = true, ··· 570 570 .support_ct_kill_exit = true, 571 571 .plcp_delta_threshold = IWL_MAX_PLCP_ERR_THRESHOLD_DEF, 572 572 .chain_noise_scale = 1000, 573 - .monitor_recover_period = IWL_MONITORING_PERIOD, 573 + .monitor_recover_period = IWL_LONG_MONITORING_PERIOD, 574 574 .max_event_log_size = 512, 575 575 .sensitivity_calib_by_driver = true, 576 576 .chain_noise_calib_by_driver = true, ··· 606 606 .support_ct_kill_exit = true, 607 607 .plcp_delta_threshold = IWL_MAX_PLCP_ERR_THRESHOLD_DEF, 608 608 .chain_noise_scale = 1000, 609 - .monitor_recover_period = IWL_MONITORING_PERIOD, 609 + .monitor_recover_period = IWL_LONG_MONITORING_PERIOD, 610 610 .max_event_log_size = 512, 611 611 .sensitivity_calib_by_driver = true, 612 612 .chain_noise_calib_by_driver = true, ··· 644 644 .support_ct_kill_exit = true, 645 645 .plcp_delta_threshold = IWL_MAX_PLCP_ERR_THRESHOLD_DEF, 646 646 .chain_noise_scale = 1000, 647 - .monitor_recover_period = IWL_MONITORING_PERIOD, 647 + .monitor_recover_period = IWL_LONG_MONITORING_PERIOD, 648 648 .max_event_log_size = 512, 649 649 .sensitivity_calib_by_driver = true, 650 650 .chain_noise_calib_by_driver = true, ··· 680 680 .support_ct_kill_exit = true, 681 681 .plcp_delta_threshold = IWL_MAX_PLCP_ERR_THRESHOLD_DEF, 682 682 .chain_noise_scale = 1000, 683 - .monitor_recover_period = IWL_MONITORING_PERIOD, 683 + .monitor_recover_period = IWL_LONG_MONITORING_PERIOD, 684 684 .max_event_log_size = 512, 685 685 .sensitivity_calib_by_driver = true, 686 686 .chain_noise_calib_by_driver = true, ··· 721 721 .support_ct_kill_exit = true, 722 722 .plcp_delta_threshold = IWL_MAX_PLCP_ERR_THRESHOLD_DEF, 723 723 .chain_noise_scale = 1000, 724 - .monitor_recover_period = IWL_MONITORING_PERIOD, 724 + .monitor_recover_period = IWL_DEF_MONITORING_PERIOD, 725 725 .max_event_log_size = 1024, 726 726 .ucode_tracing = true, 727 727 .sensitivity_calib_by_driver = true, ··· 756 756 .support_ct_kill_exit = true, 757 757 .plcp_delta_threshold = IWL_MAX_PLCP_ERR_THRESHOLD_DEF, 758 758 .chain_noise_scale = 1000, 759 - .monitor_recover_period = IWL_MONITORING_PERIOD, 759 + .monitor_recover_period = IWL_DEF_MONITORING_PERIOD, 760 760 .max_event_log_size = 1024, 761 761 .ucode_tracing = true, 762 762 .sensitivity_calib_by_driver = true, ··· 791 791 .support_ct_kill_exit = true, 792 792 .plcp_delta_threshold = IWL_MAX_PLCP_ERR_THRESHOLD_DEF, 793 793 .chain_noise_scale = 1000, 794 - .monitor_recover_period = IWL_MONITORING_PERIOD, 794 + .monitor_recover_period = IWL_DEF_MONITORING_PERIOD, 795 795 .max_event_log_size = 1024, 796 796 .ucode_tracing = true, 797 797 .sensitivity_calib_by_driver = true, ··· 828 828 .support_ct_kill_exit = true, 829 829 .plcp_delta_threshold = IWL_MAX_PLCP_ERR_THRESHOLD_DEF, 830 830 .chain_noise_scale = 1500, 831 - .monitor_recover_period = IWL_MONITORING_PERIOD, 831 + .monitor_recover_period = IWL_DEF_MONITORING_PERIOD, 832 832 .max_event_log_size = 1024, 833 833 .ucode_tracing = true, 834 834 .sensitivity_calib_by_driver = true, ··· 866 866 .support_ct_kill_exit = true, 867 867 .plcp_delta_threshold = IWL_MAX_PLCP_ERR_THRESHOLD_DEF, 868 868 .chain_noise_scale = 1500, 869 - .monitor_recover_period = IWL_MONITORING_PERIOD, 869 + .monitor_recover_period = IWL_DEF_MONITORING_PERIOD, 870 870 .max_event_log_size = 1024, 871 871 .ucode_tracing = true, 872 872 .sensitivity_calib_by_driver = true, ··· 902 902 .support_ct_kill_exit = true, 903 903 .plcp_delta_threshold = IWL_MAX_PLCP_ERR_THRESHOLD_DEF, 904 904 .chain_noise_scale = 1500, 905 - .monitor_recover_period = IWL_MONITORING_PERIOD, 905 + .monitor_recover_period = IWL_DEF_MONITORING_PERIOD, 906 906 .max_event_log_size = 1024, 907 907 .ucode_tracing = true, 908 908 .sensitivity_calib_by_driver = true, ··· 940 940 .support_ct_kill_exit = true, 941 941 .plcp_delta_threshold = IWL_MAX_PLCP_ERR_THRESHOLD_DEF, 942 942 .chain_noise_scale = 1000, 943 - .monitor_recover_period = IWL_MONITORING_PERIOD, 943 + .monitor_recover_period = IWL_DEF_MONITORING_PERIOD, 944 944 .max_event_log_size = 1024, 945 945 .ucode_tracing = true, 946 946 .sensitivity_calib_by_driver = true,
+44 -1
drivers/net/wireless/iwlwifi/iwl-agn.c
··· 3667 3667 IWL_DEBUG_MAC80211(priv, "leave\n"); 3668 3668 } 3669 3669 3670 + static void iwlagn_configure_filter(struct ieee80211_hw *hw, 3671 + unsigned int changed_flags, 3672 + unsigned int *total_flags, 3673 + u64 multicast) 3674 + { 3675 + struct iwl_priv *priv = hw->priv; 3676 + __le32 filter_or = 0, filter_nand = 0; 3677 + 3678 + #define CHK(test, flag) do { \ 3679 + if (*total_flags & (test)) \ 3680 + filter_or |= (flag); \ 3681 + else \ 3682 + filter_nand |= (flag); \ 3683 + } while (0) 3684 + 3685 + IWL_DEBUG_MAC80211(priv, "Enter: changed: 0x%x, total: 0x%x\n", 3686 + changed_flags, *total_flags); 3687 + 3688 + CHK(FIF_OTHER_BSS | FIF_PROMISC_IN_BSS, RXON_FILTER_PROMISC_MSK); 3689 + CHK(FIF_CONTROL, RXON_FILTER_CTL2HOST_MSK); 3690 + CHK(FIF_BCN_PRBRESP_PROMISC, RXON_FILTER_BCON_AWARE_MSK); 3691 + 3692 + #undef CHK 3693 + 3694 + mutex_lock(&priv->mutex); 3695 + 3696 + priv->staging_rxon.filter_flags &= ~filter_nand; 3697 + priv->staging_rxon.filter_flags |= filter_or; 3698 + 3699 + iwlcore_commit_rxon(priv); 3700 + 3701 + mutex_unlock(&priv->mutex); 3702 + 3703 + /* 3704 + * Receiving all multicast frames is always enabled by the 3705 + * default flags setup in iwl_connection_init_rx_config() 3706 + * since we currently do not support programming multicast 3707 + * filters into the device. 3708 + */ 3709 + *total_flags &= FIF_OTHER_BSS | FIF_ALLMULTI | FIF_PROMISC_IN_BSS | 3710 + FIF_BCN_PRBRESP_PROMISC | FIF_CONTROL; 3711 + } 3712 + 3670 3713 static void iwl_mac_flush(struct ieee80211_hw *hw, bool drop) 3671 3714 { 3672 3715 struct iwl_priv *priv = hw->priv; ··· 3910 3867 .add_interface = iwl_mac_add_interface, 3911 3868 .remove_interface = iwl_mac_remove_interface, 3912 3869 .config = iwl_mac_config, 3913 - .configure_filter = iwl_configure_filter, 3870 + .configure_filter = iwlagn_configure_filter, 3914 3871 .set_key = iwl_mac_set_key, 3915 3872 .update_tkip_key = iwl_mac_update_tkip_key, 3916 3873 .conf_tx = iwl_mac_conf_tx,
-45
drivers/net/wireless/iwlwifi/iwl-core.c
··· 1328 1328 EXPORT_SYMBOL(iwl_apm_init); 1329 1329 1330 1330 1331 - 1332 - void iwl_configure_filter(struct ieee80211_hw *hw, 1333 - unsigned int changed_flags, 1334 - unsigned int *total_flags, 1335 - u64 multicast) 1336 - { 1337 - struct iwl_priv *priv = hw->priv; 1338 - __le32 filter_or = 0, filter_nand = 0; 1339 - 1340 - #define CHK(test, flag) do { \ 1341 - if (*total_flags & (test)) \ 1342 - filter_or |= (flag); \ 1343 - else \ 1344 - filter_nand |= (flag); \ 1345 - } while (0) 1346 - 1347 - IWL_DEBUG_MAC80211(priv, "Enter: changed: 0x%x, total: 0x%x\n", 1348 - changed_flags, *total_flags); 1349 - 1350 - CHK(FIF_OTHER_BSS | FIF_PROMISC_IN_BSS, RXON_FILTER_PROMISC_MSK); 1351 - CHK(FIF_CONTROL, RXON_FILTER_CTL2HOST_MSK); 1352 - CHK(FIF_BCN_PRBRESP_PROMISC, RXON_FILTER_BCON_AWARE_MSK); 1353 - 1354 - #undef CHK 1355 - 1356 - mutex_lock(&priv->mutex); 1357 - 1358 - priv->staging_rxon.filter_flags &= ~filter_nand; 1359 - priv->staging_rxon.filter_flags |= filter_or; 1360 - 1361 - iwlcore_commit_rxon(priv); 1362 - 1363 - mutex_unlock(&priv->mutex); 1364 - 1365 - /* 1366 - * Receiving all multicast frames is always enabled by the 1367 - * default flags setup in iwl_connection_init_rx_config() 1368 - * since we currently do not support programming multicast 1369 - * filters into the device. 1370 - */ 1371 - *total_flags &= FIF_OTHER_BSS | FIF_ALLMULTI | FIF_PROMISC_IN_BSS | 1372 - FIF_BCN_PRBRESP_PROMISC | FIF_CONTROL; 1373 - } 1374 - EXPORT_SYMBOL(iwl_configure_filter); 1375 - 1376 1331 int iwl_set_hw_params(struct iwl_priv *priv) 1377 1332 { 1378 1333 priv->hw_params.max_rxq_size = RX_QUEUE_SIZE;
-3
drivers/net/wireless/iwlwifi/iwl-core.h
··· 372 372 u32 decrypt_res, 373 373 struct ieee80211_rx_status *stats); 374 374 void iwl_irq_handle_error(struct iwl_priv *priv); 375 - void iwl_configure_filter(struct ieee80211_hw *hw, 376 - unsigned int changed_flags, 377 - unsigned int *total_flags, u64 multicast); 378 375 int iwl_set_hw_params(struct iwl_priv *priv); 379 376 void iwl_post_associate(struct iwl_priv *priv, struct ieee80211_vif *vif); 380 377 void iwl_bss_info_changed(struct ieee80211_hw *hw,
+2 -1
drivers/net/wireless/iwlwifi/iwl-dev.h
··· 1049 1049 #define IWL_DELAY_NEXT_FORCE_FW_RELOAD (HZ*5) 1050 1050 1051 1051 /* timer constants use to monitor and recover stuck tx queues in mSecs */ 1052 - #define IWL_MONITORING_PERIOD (1000) 1052 + #define IWL_DEF_MONITORING_PERIOD (1000) 1053 + #define IWL_LONG_MONITORING_PERIOD (5000) 1053 1054 #define IWL_ONE_HUNDRED_MSECS (100) 1054 1055 #define IWL_SIXTY_SECS (60000) 1055 1056
+50 -1
drivers/net/wireless/iwlwifi/iwl3945-base.c
··· 3391 3391 3392 3392 return 0; 3393 3393 } 3394 + 3395 + static void iwl3945_configure_filter(struct ieee80211_hw *hw, 3396 + unsigned int changed_flags, 3397 + unsigned int *total_flags, 3398 + u64 multicast) 3399 + { 3400 + struct iwl_priv *priv = hw->priv; 3401 + __le32 filter_or = 0, filter_nand = 0; 3402 + 3403 + #define CHK(test, flag) do { \ 3404 + if (*total_flags & (test)) \ 3405 + filter_or |= (flag); \ 3406 + else \ 3407 + filter_nand |= (flag); \ 3408 + } while (0) 3409 + 3410 + IWL_DEBUG_MAC80211(priv, "Enter: changed: 0x%x, total: 0x%x\n", 3411 + changed_flags, *total_flags); 3412 + 3413 + CHK(FIF_OTHER_BSS | FIF_PROMISC_IN_BSS, RXON_FILTER_PROMISC_MSK); 3414 + CHK(FIF_CONTROL, RXON_FILTER_CTL2HOST_MSK); 3415 + CHK(FIF_BCN_PRBRESP_PROMISC, RXON_FILTER_BCON_AWARE_MSK); 3416 + 3417 + #undef CHK 3418 + 3419 + mutex_lock(&priv->mutex); 3420 + 3421 + priv->staging_rxon.filter_flags &= ~filter_nand; 3422 + priv->staging_rxon.filter_flags |= filter_or; 3423 + 3424 + /* 3425 + * Committing directly here breaks for some reason, 3426 + * but we'll eventually commit the filter flags 3427 + * change anyway. 3428 + */ 3429 + 3430 + mutex_unlock(&priv->mutex); 3431 + 3432 + /* 3433 + * Receiving all multicast frames is always enabled by the 3434 + * default flags setup in iwl_connection_init_rx_config() 3435 + * since we currently do not support programming multicast 3436 + * filters into the device. 3437 + */ 3438 + *total_flags &= FIF_OTHER_BSS | FIF_ALLMULTI | FIF_PROMISC_IN_BSS | 3439 + FIF_BCN_PRBRESP_PROMISC | FIF_CONTROL; 3440 + } 3441 + 3442 + 3394 3443 /***************************************************************************** 3395 3444 * 3396 3445 * sysfs attributes ··· 3845 3796 .add_interface = iwl_mac_add_interface, 3846 3797 .remove_interface = iwl_mac_remove_interface, 3847 3798 .config = iwl_mac_config, 3848 - .configure_filter = iwl_configure_filter, 3799 + .configure_filter = iwl3945_configure_filter, 3849 3800 .set_key = iwl3945_mac_set_key, 3850 3801 .conf_tx = iwl_mac_conf_tx, 3851 3802 .reset_tsf = iwl_mac_reset_tsf,
+1 -1
drivers/net/wireless/mac80211_hwsim.c
··· 486 486 struct ieee80211_rx_status rx_status; 487 487 488 488 if (data->idle) { 489 - wiphy_debug(hw->wiphy, "trying to tx when idle - reject\n"); 489 + wiphy_debug(hw->wiphy, "Trying to TX when idle - reject\n"); 490 490 return false; 491 491 } 492 492
+17 -17
drivers/net/wireless/mwl8k.c
··· 910 910 911 911 rxq->rxd = pci_alloc_consistent(priv->pdev, size, &rxq->rxd_dma); 912 912 if (rxq->rxd == NULL) { 913 - wiphy_err(hw->wiphy, "failed to alloc rx descriptors\n"); 913 + wiphy_err(hw->wiphy, "failed to alloc RX descriptors\n"); 914 914 return -ENOMEM; 915 915 } 916 916 memset(rxq->rxd, 0, size); 917 917 918 918 rxq->buf = kmalloc(MWL8K_RX_DESCS * sizeof(*rxq->buf), GFP_KERNEL); 919 919 if (rxq->buf == NULL) { 920 - wiphy_err(hw->wiphy, "failed to alloc rx skbuff list\n"); 920 + wiphy_err(hw->wiphy, "failed to alloc RX skbuff list\n"); 921 921 pci_free_consistent(priv->pdev, size, rxq->rxd, rxq->rxd_dma); 922 922 return -ENOMEM; 923 923 } ··· 1145 1145 1146 1146 txq->txd = pci_alloc_consistent(priv->pdev, size, &txq->txd_dma); 1147 1147 if (txq->txd == NULL) { 1148 - wiphy_err(hw->wiphy, "failed to alloc tx descriptors\n"); 1148 + wiphy_err(hw->wiphy, "failed to alloc TX descriptors\n"); 1149 1149 return -ENOMEM; 1150 1150 } 1151 1151 memset(txq->txd, 0, size); 1152 1152 1153 1153 txq->skb = kmalloc(MWL8K_TX_DESCS * sizeof(*txq->skb), GFP_KERNEL); 1154 1154 if (txq->skb == NULL) { 1155 - wiphy_err(hw->wiphy, "failed to alloc tx skbuff list\n"); 1155 + wiphy_err(hw->wiphy, "failed to alloc TX skbuff list\n"); 1156 1156 pci_free_consistent(priv->pdev, size, txq->txd, txq->txd_dma); 1157 1157 return -ENOMEM; 1158 1158 } ··· 1573 1573 PCI_DMA_BIDIRECTIONAL); 1574 1574 1575 1575 if (!timeout) { 1576 - wiphy_err(hw->wiphy, "command %s timeout after %u ms\n", 1576 + wiphy_err(hw->wiphy, "Command %s timeout after %u ms\n", 1577 1577 mwl8k_cmd_name(cmd->code, buf, sizeof(buf)), 1578 1578 MWL8K_CMD_TIMEOUT_MS); 1579 1579 rc = -ETIMEDOUT; ··· 1584 1584 1585 1585 rc = cmd->result ? -EINVAL : 0; 1586 1586 if (rc) 1587 - wiphy_err(hw->wiphy, "command %s error 0x%x\n", 1587 + wiphy_err(hw->wiphy, "Command %s error 0x%x\n", 1588 1588 mwl8k_cmd_name(cmd->code, buf, sizeof(buf)), 1589 1589 le16_to_cpu(cmd->result)); 1590 1590 else if (ms > 2000) 1591 - wiphy_notice(hw->wiphy, "command %s took %d ms\n", 1591 + wiphy_notice(hw->wiphy, "Command %s took %d ms\n", 1592 1592 mwl8k_cmd_name(cmd->code, 1593 1593 buf, sizeof(buf)), 1594 1594 ms); ··· 3210 3210 rc = request_irq(priv->pdev->irq, mwl8k_interrupt, 3211 3211 IRQF_SHARED, MWL8K_NAME, hw); 3212 3212 if (rc) { 3213 - wiphy_err(hw->wiphy, "failed to register irq handler\n"); 3213 + wiphy_err(hw->wiphy, "failed to register IRQ handler\n"); 3214 3214 return -EIO; 3215 3215 } 3216 3216 ··· 3926 3926 3927 3927 priv->sram = pci_iomap(pdev, 0, 0x10000); 3928 3928 if (priv->sram == NULL) { 3929 - wiphy_err(hw->wiphy, "cannot map device sram\n"); 3929 + wiphy_err(hw->wiphy, "Cannot map device SRAM\n"); 3930 3930 goto err_iounmap; 3931 3931 } 3932 3932 ··· 3938 3938 if (priv->regs == NULL) { 3939 3939 priv->regs = pci_iomap(pdev, 2, 0x10000); 3940 3940 if (priv->regs == NULL) { 3941 - wiphy_err(hw->wiphy, "cannot map device registers\n"); 3941 + wiphy_err(hw->wiphy, "Cannot map device registers\n"); 3942 3942 goto err_iounmap; 3943 3943 } 3944 3944 } ··· 3950 3950 /* Ask userland hotplug daemon for the device firmware */ 3951 3951 rc = mwl8k_request_firmware(priv); 3952 3952 if (rc) { 3953 - wiphy_err(hw->wiphy, "firmware files not found\n"); 3953 + wiphy_err(hw->wiphy, "Firmware files not found\n"); 3954 3954 goto err_stop_firmware; 3955 3955 } 3956 3956 3957 3957 /* Load firmware into hardware */ 3958 3958 rc = mwl8k_load_firmware(hw); 3959 3959 if (rc) { 3960 - wiphy_err(hw->wiphy, "cannot start firmware\n"); 3960 + wiphy_err(hw->wiphy, "Cannot start firmware\n"); 3961 3961 goto err_stop_firmware; 3962 3962 } 3963 3963 ··· 4047 4047 rc = request_irq(priv->pdev->irq, mwl8k_interrupt, 4048 4048 IRQF_SHARED, MWL8K_NAME, hw); 4049 4049 if (rc) { 4050 - wiphy_err(hw->wiphy, "failed to register irq handler\n"); 4050 + wiphy_err(hw->wiphy, "failed to register IRQ handler\n"); 4051 4051 goto err_free_queues; 4052 4052 } 4053 4053 ··· 4067 4067 rc = mwl8k_cmd_get_hw_spec_sta(hw); 4068 4068 } 4069 4069 if (rc) { 4070 - wiphy_err(hw->wiphy, "cannot initialise firmware\n"); 4070 + wiphy_err(hw->wiphy, "Cannot initialise firmware\n"); 4071 4071 goto err_free_irq; 4072 4072 } 4073 4073 ··· 4081 4081 /* Turn radio off */ 4082 4082 rc = mwl8k_cmd_radio_disable(hw); 4083 4083 if (rc) { 4084 - wiphy_err(hw->wiphy, "cannot disable\n"); 4084 + wiphy_err(hw->wiphy, "Cannot disable\n"); 4085 4085 goto err_free_irq; 4086 4086 } 4087 4087 4088 4088 /* Clear MAC address */ 4089 4089 rc = mwl8k_cmd_set_mac_addr(hw, NULL, "\x00\x00\x00\x00\x00\x00"); 4090 4090 if (rc) { 4091 - wiphy_err(hw->wiphy, "cannot clear mac address\n"); 4091 + wiphy_err(hw->wiphy, "Cannot clear MAC address\n"); 4092 4092 goto err_free_irq; 4093 4093 } 4094 4094 ··· 4098 4098 4099 4099 rc = ieee80211_register_hw(hw); 4100 4100 if (rc) { 4101 - wiphy_err(hw->wiphy, "cannot register device\n"); 4101 + wiphy_err(hw->wiphy, "Cannot register device\n"); 4102 4102 goto err_free_queues; 4103 4103 } 4104 4104
+3 -3
drivers/net/wireless/p54/eeprom.c
··· 167 167 } 168 168 169 169 if (j == 0) { 170 - wiphy_err(dev->wiphy, "disabling totally damaged %d GHz band\n", 170 + wiphy_err(dev->wiphy, "Disabling totally damaged %d GHz band\n", 171 171 (band == IEEE80211_BAND_2GHZ) ? 2 : 5); 172 172 173 173 ret = -ENODATA; ··· 695 695 u8 perm_addr[ETH_ALEN]; 696 696 697 697 wiphy_warn(dev->wiphy, 698 - "invalid hwaddr! using randomly generated mac addr\n"); 698 + "Invalid hwaddr! Using randomly generated MAC addr\n"); 699 699 random_ether_addr(perm_addr); 700 700 SET_IEEE80211_PERM_ADDR(dev, perm_addr); 701 701 } 702 702 703 - wiphy_info(dev->wiphy, "hwaddr %pm, mac:isl38%02x rf:%s\n", 703 + wiphy_info(dev->wiphy, "hwaddr %pM, MAC:isl38%02x RF:%s\n", 704 704 dev->wiphy->perm_addr, priv->version, 705 705 p54_rf_chips[priv->rxhw]); 706 706
+1 -1
drivers/net/wireless/p54/fwio.c
··· 125 125 126 126 if (fw_version) 127 127 wiphy_info(priv->hw->wiphy, 128 - "fw rev %s - softmac protocol %x.%x\n", 128 + "FW rev %s - Softmac protocol %x.%x\n", 129 129 fw_version, priv->fw_var >> 8, priv->fw_var & 0xff); 130 130 131 131 if (priv->fw_var < 0x500)
+2 -2
drivers/net/wireless/p54/led.c
··· 58 58 err = p54_set_leds(priv); 59 59 if (err && net_ratelimit()) 60 60 wiphy_err(priv->hw->wiphy, 61 - "failed to update leds (%d).\n", err); 61 + "failed to update LEDs (%d).\n", err); 62 62 63 63 if (rerun) 64 64 ieee80211_queue_delayed_work(priv->hw, &priv->led_work, ··· 103 103 err = led_classdev_register(wiphy_dev(priv->hw->wiphy), &led->led_dev); 104 104 if (err) 105 105 wiphy_err(priv->hw->wiphy, 106 - "failed to register %s led.\n", name); 106 + "Failed to register %s LED.\n", name); 107 107 else 108 108 led->registered = 1; 109 109
+1 -1
drivers/net/wireless/p54/p54pci.c
··· 466 466 P54P_READ(dev_int); 467 467 468 468 if (!wait_for_completion_interruptible_timeout(&priv->boot_comp, HZ)) { 469 - wiphy_err(dev->wiphy, "cannot boot firmware!\n"); 469 + wiphy_err(dev->wiphy, "Cannot boot firmware!\n"); 470 470 p54p_stop(dev); 471 471 return -ETIMEDOUT; 472 472 }
+1 -1
drivers/net/wireless/p54/txrx.c
··· 540 540 case P54_TRAP_BEACON_TX: 541 541 break; 542 542 case P54_TRAP_RADAR: 543 - wiphy_info(priv->hw->wiphy, "radar (freq:%d mhz)\n", freq); 543 + wiphy_info(priv->hw->wiphy, "radar (freq:%d MHz)\n", freq); 544 544 break; 545 545 case P54_TRAP_NO_BEACON: 546 546 if (priv->vif)
+3 -3
drivers/net/wireless/rtl818x/rtl8180_dev.c
··· 445 445 &priv->rx_ring_dma); 446 446 447 447 if (!priv->rx_ring || (unsigned long)priv->rx_ring & 0xFF) { 448 - wiphy_err(dev->wiphy, "cannot allocate rx ring\n"); 448 + wiphy_err(dev->wiphy, "Cannot allocate RX ring\n"); 449 449 return -ENOMEM; 450 450 } 451 451 ··· 502 502 503 503 ring = pci_alloc_consistent(priv->pdev, sizeof(*ring) * entries, &dma); 504 504 if (!ring || (unsigned long)ring & 0xFF) { 505 - wiphy_err(dev->wiphy, "cannot allocate tx ring (prio = %d)\n", 505 + wiphy_err(dev->wiphy, "Cannot allocate TX ring (prio = %d)\n", 506 506 prio); 507 507 return -ENOMEM; 508 508 } ··· 568 568 ret = request_irq(priv->pdev->irq, rtl8180_interrupt, 569 569 IRQF_SHARED, KBUILD_MODNAME, dev); 570 570 if (ret) { 571 - wiphy_err(dev->wiphy, "failed to register irq handler\n"); 571 + wiphy_err(dev->wiphy, "failed to register IRQ handler\n"); 572 572 goto err_free_rings; 573 573 } 574 574
+2 -2
drivers/net/wireless/rtl818x/rtl8187_dev.c
··· 573 573 } while (--i); 574 574 575 575 if (!i) { 576 - wiphy_err(dev->wiphy, "reset timeout!\n"); 576 + wiphy_err(dev->wiphy, "Reset timeout!\n"); 577 577 return -ETIMEDOUT; 578 578 } 579 579 ··· 1526 1526 mutex_init(&priv->conf_mutex); 1527 1527 skb_queue_head_init(&priv->b_tx_status.queue); 1528 1528 1529 - wiphy_info(dev->wiphy, "hwaddr %pm, %s v%d + %s, rfkill mask %d\n", 1529 + wiphy_info(dev->wiphy, "hwaddr %pM, %s V%d + %s, rfkill mask %d\n", 1530 1530 mac_addr, chip_name, priv->asic_rev, priv->rf->name, 1531 1531 priv->rfkill_mask); 1532 1532
+2 -2
drivers/net/wireless/rtl818x/rtl8187_rtl8225.c
··· 366 366 rtl8225_write(dev, 0x02, 0x044d); 367 367 msleep(100); 368 368 if (!(rtl8225_read(dev, 6) & (1 << 7))) 369 - wiphy_warn(dev->wiphy, "rf calibration failed! %x\n", 369 + wiphy_warn(dev->wiphy, "RF Calibration Failed! %x\n", 370 370 rtl8225_read(dev, 6)); 371 371 } 372 372 ··· 735 735 rtl8225_write(dev, 0x02, 0x044D); 736 736 msleep(100); 737 737 if (!(rtl8225_read(dev, 6) & (1 << 7))) 738 - wiphy_warn(dev->wiphy, "rf calibration failed! %x\n", 738 + wiphy_warn(dev->wiphy, "RF Calibration Failed! %x\n", 739 739 rtl8225_read(dev, 6)); 740 740 } 741 741
+2
include/linux/netfilter/xt_ipvs.h
··· 1 1 #ifndef _XT_IPVS_H 2 2 #define _XT_IPVS_H 3 3 4 + #include <linux/types.h> 5 + 4 6 enum { 5 7 XT_IPVS_IPVS_PROPERTY = 1 << 0, /* all other options imply this one */ 6 8 XT_IPVS_PROTO = 1 << 1,
+30
include/linux/pxa168_eth.h
··· 1 + /* 2 + *pxa168 ethernet platform device data definition file. 3 + */ 4 + #ifndef __LINUX_PXA168_ETH_H 5 + #define __LINUX_PXA168_ETH_H 6 + 7 + struct pxa168_eth_platform_data { 8 + int port_number; 9 + int phy_addr; 10 + 11 + /* 12 + * If speed is 0, then speed and duplex are autonegotiated. 13 + */ 14 + int speed; /* 0, SPEED_10, SPEED_100 */ 15 + int duplex; /* DUPLEX_HALF or DUPLEX_FULL */ 16 + 17 + /* 18 + * Override default RX/TX queue sizes if nonzero. 19 + */ 20 + int rx_queue_size; 21 + int tx_queue_size; 22 + 23 + /* 24 + * init callback is used for board specific initialization 25 + * e.g on Aspenite its used to initialize the PHY transceiver. 26 + */ 27 + int (*init)(void); 28 + }; 29 + 30 + #endif /* __LINUX_PXA168_ETH_H */
+2 -1
net/8021q/vlan_dev.c
··· 510 510 if (vlan->flags & VLAN_FLAG_GVRP) 511 511 vlan_gvrp_request_join(dev); 512 512 513 - netif_carrier_on(dev); 513 + if (netif_carrier_ok(real_dev)) 514 + netif_carrier_on(dev); 514 515 return 0; 515 516 516 517 clear_allmulti:
+1 -1
net/core/dev.c
··· 3156 3156 put_page(skb_shinfo(skb)->frags[0].page); 3157 3157 memmove(skb_shinfo(skb)->frags, 3158 3158 skb_shinfo(skb)->frags + 1, 3159 - --skb_shinfo(skb)->nr_frags); 3159 + --skb_shinfo(skb)->nr_frags * sizeof(skb_frag_t)); 3160 3160 } 3161 3161 } 3162 3162
+2
net/ipv4/netfilter/arp_tables.c
··· 735 735 if (cpu == curcpu) 736 736 continue; 737 737 i = 0; 738 + local_bh_disable(); 738 739 xt_info_wrlock(cpu); 739 740 xt_entry_foreach(iter, t->entries[cpu], t->size) { 740 741 ADD_COUNTER(counters[i], iter->counters.bcnt, ··· 743 742 ++i; 744 743 } 745 744 xt_info_wrunlock(cpu); 745 + local_bh_enable(); 746 746 } 747 747 put_cpu(); 748 748 }
+2
net/ipv4/netfilter/ip_tables.c
··· 909 909 if (cpu == curcpu) 910 910 continue; 911 911 i = 0; 912 + local_bh_disable(); 912 913 xt_info_wrlock(cpu); 913 914 xt_entry_foreach(iter, t->entries[cpu], t->size) { 914 915 ADD_COUNTER(counters[i], iter->counters.bcnt, ··· 917 916 ++i; /* macro does multi eval of i */ 918 917 } 919 918 xt_info_wrunlock(cpu); 919 + local_bh_enable(); 920 920 } 921 921 put_cpu(); 922 922 }
+2
net/ipv6/netfilter/ip6_tables.c
··· 922 922 if (cpu == curcpu) 923 923 continue; 924 924 i = 0; 925 + local_bh_disable(); 925 926 xt_info_wrlock(cpu); 926 927 xt_entry_foreach(iter, t->entries[cpu], t->size) { 927 928 ADD_COUNTER(counters[i], iter->counters.bcnt, ··· 930 929 ++i; 931 930 } 932 931 xt_info_wrunlock(cpu); 932 + local_bh_enable(); 933 933 } 934 934 put_cpu(); 935 935 }
+3 -1
net/irda/irlan/irlan_eth.c
··· 169 169 { 170 170 struct irlan_cb *self = netdev_priv(dev); 171 171 int ret; 172 + unsigned int len; 172 173 173 174 /* skb headroom large enough to contain all IrDA-headers? */ 174 175 if ((skb_headroom(skb) < self->max_header_size) || (skb_shared(skb))) { ··· 189 188 190 189 dev->trans_start = jiffies; 191 190 191 + len = skb->len; 192 192 /* Now queue the packet in the transport layer */ 193 193 if (self->use_udata) 194 194 ret = irttp_udata_request(self->tsap_data, skb); ··· 211 209 self->stats.tx_dropped++; 212 210 } else { 213 211 self->stats.tx_packets++; 214 - self->stats.tx_bytes += skb->len; 212 + self->stats.tx_bytes += len; 215 213 } 216 214 217 215 return NETDEV_TX_OK;
+16 -30
net/netlink/af_netlink.c
··· 1406 1406 struct netlink_sock *nlk = nlk_sk(sk); 1407 1407 int noblock = flags&MSG_DONTWAIT; 1408 1408 size_t copied; 1409 - struct sk_buff *skb, *frag __maybe_unused = NULL; 1409 + struct sk_buff *skb, *data_skb; 1410 1410 int err; 1411 1411 1412 1412 if (flags&MSG_OOB) ··· 1418 1418 if (skb == NULL) 1419 1419 goto out; 1420 1420 1421 + data_skb = skb; 1422 + 1421 1423 #ifdef CONFIG_COMPAT_NETLINK_MESSAGES 1422 1424 if (unlikely(skb_shinfo(skb)->frag_list)) { 1423 - bool need_compat = !!(flags & MSG_CMSG_COMPAT); 1424 - 1425 1425 /* 1426 - * If this skb has a frag_list, then here that means that 1427 - * we will have to use the frag_list skb for compat tasks 1428 - * and the regular skb for non-compat tasks. 1426 + * If this skb has a frag_list, then here that means that we 1427 + * will have to use the frag_list skb's data for compat tasks 1428 + * and the regular skb's data for normal (non-compat) tasks. 1429 1429 * 1430 - * The skb might (and likely will) be cloned, so we can't 1431 - * just reset frag_list and go on with things -- we need to 1432 - * keep that. For the compat case that's easy -- simply get 1433 - * a reference to the compat skb and free the regular one 1434 - * including the frag. For the non-compat case, we need to 1435 - * avoid sending the frag to the user -- so assign NULL but 1436 - * restore it below before freeing the skb. 1430 + * If we need to send the compat skb, assign it to the 1431 + * 'data_skb' variable so that it will be used below for data 1432 + * copying. We keep 'skb' for everything else, including 1433 + * freeing both later. 1437 1434 */ 1438 - if (need_compat) { 1439 - struct sk_buff *compskb = skb_shinfo(skb)->frag_list; 1440 - skb_get(compskb); 1441 - kfree_skb(skb); 1442 - skb = compskb; 1443 - } else { 1444 - frag = skb_shinfo(skb)->frag_list; 1445 - skb_shinfo(skb)->frag_list = NULL; 1446 - } 1435 + if (flags & MSG_CMSG_COMPAT) 1436 + data_skb = skb_shinfo(skb)->frag_list; 1447 1437 } 1448 1438 #endif 1449 1439 1450 1440 msg->msg_namelen = 0; 1451 1441 1452 - copied = skb->len; 1442 + copied = data_skb->len; 1453 1443 if (len < copied) { 1454 1444 msg->msg_flags |= MSG_TRUNC; 1455 1445 copied = len; 1456 1446 } 1457 1447 1458 - skb_reset_transport_header(skb); 1459 - err = skb_copy_datagram_iovec(skb, 0, msg->msg_iov, copied); 1448 + skb_reset_transport_header(data_skb); 1449 + err = skb_copy_datagram_iovec(data_skb, 0, msg->msg_iov, copied); 1460 1450 1461 1451 if (msg->msg_name) { 1462 1452 struct sockaddr_nl *addr = (struct sockaddr_nl *)msg->msg_name; ··· 1466 1476 } 1467 1477 siocb->scm->creds = *NETLINK_CREDS(skb); 1468 1478 if (flags & MSG_TRUNC) 1469 - copied = skb->len; 1470 - 1471 - #ifdef CONFIG_COMPAT_NETLINK_MESSAGES 1472 - skb_shinfo(skb)->frag_list = frag; 1473 - #endif 1479 + copied = data_skb->len; 1474 1480 1475 1481 skb_free_datagram(sk, skb); 1476 1482
+1 -1
net/rds/recv.c
··· 297 297 int rds_notify_queue_get(struct rds_sock *rs, struct msghdr *msghdr) 298 298 { 299 299 struct rds_notifier *notifier; 300 - struct rds_rdma_notify cmsg; 300 + struct rds_rdma_notify cmsg = { 0 }; /* fill holes with zero */ 301 301 unsigned int count = 0, max_messages = ~0U; 302 302 unsigned long flags; 303 303 LIST_HEAD(copy);
+12 -9
net/sched/act_gact.c
··· 152 152 static int tcf_gact_dump(struct sk_buff *skb, struct tc_action *a, int bind, int ref) 153 153 { 154 154 unsigned char *b = skb_tail_pointer(skb); 155 - struct tc_gact opt; 156 155 struct tcf_gact *gact = a->priv; 156 + struct tc_gact opt = { 157 + .index = gact->tcf_index, 158 + .refcnt = gact->tcf_refcnt - ref, 159 + .bindcnt = gact->tcf_bindcnt - bind, 160 + .action = gact->tcf_action, 161 + }; 157 162 struct tcf_t t; 158 163 159 - opt.index = gact->tcf_index; 160 - opt.refcnt = gact->tcf_refcnt - ref; 161 - opt.bindcnt = gact->tcf_bindcnt - bind; 162 - opt.action = gact->tcf_action; 163 164 NLA_PUT(skb, TCA_GACT_PARMS, sizeof(opt), &opt); 164 165 #ifdef CONFIG_GACT_PROB 165 166 if (gact->tcfg_ptype) { 166 - struct tc_gact_p p_opt; 167 - p_opt.paction = gact->tcfg_paction; 168 - p_opt.pval = gact->tcfg_pval; 169 - p_opt.ptype = gact->tcfg_ptype; 167 + struct tc_gact_p p_opt = { 168 + .paction = gact->tcfg_paction, 169 + .pval = gact->tcfg_pval, 170 + .ptype = gact->tcfg_ptype, 171 + }; 172 + 170 173 NLA_PUT(skb, TCA_GACT_PROB, sizeof(p_opt), &p_opt); 171 174 } 172 175 #endif
+8 -7
net/sched/act_mirred.c
··· 219 219 { 220 220 unsigned char *b = skb_tail_pointer(skb); 221 221 struct tcf_mirred *m = a->priv; 222 - struct tc_mirred opt; 222 + struct tc_mirred opt = { 223 + .index = m->tcf_index, 224 + .action = m->tcf_action, 225 + .refcnt = m->tcf_refcnt - ref, 226 + .bindcnt = m->tcf_bindcnt - bind, 227 + .eaction = m->tcfm_eaction, 228 + .ifindex = m->tcfm_ifindex, 229 + }; 223 230 struct tcf_t t; 224 231 225 - opt.index = m->tcf_index; 226 - opt.action = m->tcf_action; 227 - opt.refcnt = m->tcf_refcnt - ref; 228 - opt.bindcnt = m->tcf_bindcnt - bind; 229 - opt.eaction = m->tcfm_eaction; 230 - opt.ifindex = m->tcfm_ifindex; 231 232 NLA_PUT(skb, TCA_MIRRED_PARMS, sizeof(opt), &opt); 232 233 t.install = jiffies_to_clock_t(jiffies - m->tcf_tm.install); 233 234 t.lastuse = jiffies_to_clock_t(jiffies - m->tcf_tm.lastuse);
+11 -11
net/sched/act_nat.c
··· 272 272 { 273 273 unsigned char *b = skb_tail_pointer(skb); 274 274 struct tcf_nat *p = a->priv; 275 - struct tc_nat opt; 275 + struct tc_nat opt = { 276 + .old_addr = p->old_addr, 277 + .new_addr = p->new_addr, 278 + .mask = p->mask, 279 + .flags = p->flags, 280 + 281 + .index = p->tcf_index, 282 + .action = p->tcf_action, 283 + .refcnt = p->tcf_refcnt - ref, 284 + .bindcnt = p->tcf_bindcnt - bind, 285 + }; 276 286 struct tcf_t t; 277 - 278 - opt.old_addr = p->old_addr; 279 - opt.new_addr = p->new_addr; 280 - opt.mask = p->mask; 281 - opt.flags = p->flags; 282 - 283 - opt.index = p->tcf_index; 284 - opt.action = p->tcf_action; 285 - opt.refcnt = p->tcf_refcnt - ref; 286 - opt.bindcnt = p->tcf_bindcnt - bind; 287 287 288 288 NLA_PUT(skb, TCA_NAT_PARMS, sizeof(opt), &opt); 289 289 t.install = jiffies_to_clock_t(jiffies - p->tcf_tm.install);
+6 -5
net/sched/act_simple.c
··· 164 164 { 165 165 unsigned char *b = skb_tail_pointer(skb); 166 166 struct tcf_defact *d = a->priv; 167 - struct tc_defact opt; 167 + struct tc_defact opt = { 168 + .index = d->tcf_index, 169 + .refcnt = d->tcf_refcnt - ref, 170 + .bindcnt = d->tcf_bindcnt - bind, 171 + .action = d->tcf_action, 172 + }; 168 173 struct tcf_t t; 169 174 170 - opt.index = d->tcf_index; 171 - opt.refcnt = d->tcf_refcnt - ref; 172 - opt.bindcnt = d->tcf_bindcnt - bind; 173 - opt.action = d->tcf_action; 174 175 NLA_PUT(skb, TCA_DEF_PARMS, sizeof(opt), &opt); 175 176 NLA_PUT_STRING(skb, TCA_DEF_DATA, d->tcfd_defdata); 176 177 t.install = jiffies_to_clock_t(jiffies - d->tcf_tm.install);
+6 -5
net/sched/act_skbedit.c
··· 159 159 { 160 160 unsigned char *b = skb_tail_pointer(skb); 161 161 struct tcf_skbedit *d = a->priv; 162 - struct tc_skbedit opt; 162 + struct tc_skbedit opt = { 163 + .index = d->tcf_index, 164 + .refcnt = d->tcf_refcnt - ref, 165 + .bindcnt = d->tcf_bindcnt - bind, 166 + .action = d->tcf_action, 167 + }; 163 168 struct tcf_t t; 164 169 165 - opt.index = d->tcf_index; 166 - opt.refcnt = d->tcf_refcnt - ref; 167 - opt.bindcnt = d->tcf_bindcnt - bind; 168 - opt.action = d->tcf_action; 169 170 NLA_PUT(skb, TCA_SKBEDIT_PARMS, sizeof(opt), &opt); 170 171 if (d->flags & SKBEDIT_F_PRIORITY) 171 172 NLA_PUT(skb, TCA_SKBEDIT_PRIORITY, sizeof(d->priority),