diff options
31 files changed, 306 insertions, 149 deletions
diff --git a/drivers/net/benet/be_cmds.c b/drivers/net/benet/be_cmds.c index 0c7811faf72c..a179cc6d79f2 100644 --- a/drivers/net/benet/be_cmds.c +++ b/drivers/net/benet/be_cmds.c | |||
@@ -1786,6 +1786,10 @@ int be_cmd_get_seeprom_data(struct be_adapter *adapter, | |||
1786 | spin_lock_bh(&adapter->mcc_lock); | 1786 | spin_lock_bh(&adapter->mcc_lock); |
1787 | 1787 | ||
1788 | wrb = wrb_from_mccq(adapter); | 1788 | wrb = wrb_from_mccq(adapter); |
1789 | if (!wrb) { | ||
1790 | status = -EBUSY; | ||
1791 | goto err; | ||
1792 | } | ||
1789 | req = nonemb_cmd->va; | 1793 | req = nonemb_cmd->va; |
1790 | sge = nonembedded_sgl(wrb); | 1794 | sge = nonembedded_sgl(wrb); |
1791 | 1795 | ||
@@ -1801,6 +1805,7 @@ int be_cmd_get_seeprom_data(struct be_adapter *adapter, | |||
1801 | 1805 | ||
1802 | status = be_mcc_notify_wait(adapter); | 1806 | status = be_mcc_notify_wait(adapter); |
1803 | 1807 | ||
1808 | err: | ||
1804 | spin_unlock_bh(&adapter->mcc_lock); | 1809 | spin_unlock_bh(&adapter->mcc_lock); |
1805 | return status; | 1810 | return status; |
1806 | } | 1811 | } |
diff --git a/drivers/net/bnx2x/bnx2x_main.c b/drivers/net/bnx2x/bnx2x_main.c index ccf2c8c61a61..c238c4d65d13 100644 --- a/drivers/net/bnx2x/bnx2x_main.c +++ b/drivers/net/bnx2x/bnx2x_main.c | |||
@@ -4300,9 +4300,12 @@ void bnx2x_set_storm_rx_mode(struct bnx2x *bp) | |||
4300 | def_q_filters |= BNX2X_ACCEPT_UNICAST | BNX2X_ACCEPT_BROADCAST | | 4300 | def_q_filters |= BNX2X_ACCEPT_UNICAST | BNX2X_ACCEPT_BROADCAST | |
4301 | BNX2X_ACCEPT_MULTICAST; | 4301 | BNX2X_ACCEPT_MULTICAST; |
4302 | #ifdef BCM_CNIC | 4302 | #ifdef BCM_CNIC |
4303 | cl_id = bnx2x_fcoe(bp, cl_id); | 4303 | if (!NO_FCOE(bp)) { |
4304 | bnx2x_rxq_set_mac_filters(bp, cl_id, BNX2X_ACCEPT_UNICAST | | 4304 | cl_id = bnx2x_fcoe(bp, cl_id); |
4305 | BNX2X_ACCEPT_MULTICAST); | 4305 | bnx2x_rxq_set_mac_filters(bp, cl_id, |
4306 | BNX2X_ACCEPT_UNICAST | | ||
4307 | BNX2X_ACCEPT_MULTICAST); | ||
4308 | } | ||
4306 | #endif | 4309 | #endif |
4307 | break; | 4310 | break; |
4308 | 4311 | ||
@@ -4310,18 +4313,29 @@ void bnx2x_set_storm_rx_mode(struct bnx2x *bp) | |||
4310 | def_q_filters |= BNX2X_ACCEPT_UNICAST | BNX2X_ACCEPT_BROADCAST | | 4313 | def_q_filters |= BNX2X_ACCEPT_UNICAST | BNX2X_ACCEPT_BROADCAST | |
4311 | BNX2X_ACCEPT_ALL_MULTICAST; | 4314 | BNX2X_ACCEPT_ALL_MULTICAST; |
4312 | #ifdef BCM_CNIC | 4315 | #ifdef BCM_CNIC |
4313 | cl_id = bnx2x_fcoe(bp, cl_id); | 4316 | /* |
4314 | bnx2x_rxq_set_mac_filters(bp, cl_id, BNX2X_ACCEPT_UNICAST | | 4317 | * Prevent duplication of multicast packets by configuring FCoE |
4315 | BNX2X_ACCEPT_MULTICAST); | 4318 | * L2 Client to receive only matched unicast frames. |
4319 | */ | ||
4320 | if (!NO_FCOE(bp)) { | ||
4321 | cl_id = bnx2x_fcoe(bp, cl_id); | ||
4322 | bnx2x_rxq_set_mac_filters(bp, cl_id, | ||
4323 | BNX2X_ACCEPT_UNICAST); | ||
4324 | } | ||
4316 | #endif | 4325 | #endif |
4317 | break; | 4326 | break; |
4318 | 4327 | ||
4319 | case BNX2X_RX_MODE_PROMISC: | 4328 | case BNX2X_RX_MODE_PROMISC: |
4320 | def_q_filters |= BNX2X_PROMISCUOUS_MODE; | 4329 | def_q_filters |= BNX2X_PROMISCUOUS_MODE; |
4321 | #ifdef BCM_CNIC | 4330 | #ifdef BCM_CNIC |
4322 | cl_id = bnx2x_fcoe(bp, cl_id); | 4331 | /* |
4323 | bnx2x_rxq_set_mac_filters(bp, cl_id, BNX2X_ACCEPT_UNICAST | | 4332 | * Prevent packets duplication by configuring DROP_ALL for FCoE |
4324 | BNX2X_ACCEPT_MULTICAST); | 4333 | * L2 Client. |
4334 | */ | ||
4335 | if (!NO_FCOE(bp)) { | ||
4336 | cl_id = bnx2x_fcoe(bp, cl_id); | ||
4337 | bnx2x_rxq_set_mac_filters(bp, cl_id, BNX2X_ACCEPT_NONE); | ||
4338 | } | ||
4325 | #endif | 4339 | #endif |
4326 | /* pass management unicast packets as well */ | 4340 | /* pass management unicast packets as well */ |
4327 | llh_mask |= NIG_LLH0_BRB1_DRV_MASK_REG_LLH0_BRB1_DRV_MASK_UNCST; | 4341 | llh_mask |= NIG_LLH0_BRB1_DRV_MASK_REG_LLH0_BRB1_DRV_MASK_UNCST; |
diff --git a/drivers/net/can/pch_can.c b/drivers/net/can/pch_can.c index c42e97268248..7d8bc128044c 100644 --- a/drivers/net/can/pch_can.c +++ b/drivers/net/can/pch_can.c | |||
@@ -187,7 +187,7 @@ static struct can_bittiming_const pch_can_bittiming_const = { | |||
187 | .name = KBUILD_MODNAME, | 187 | .name = KBUILD_MODNAME, |
188 | .tseg1_min = 1, | 188 | .tseg1_min = 1, |
189 | .tseg1_max = 16, | 189 | .tseg1_max = 16, |
190 | .tseg2_min = 1, | 190 | .tseg2_min = 2, |
191 | .tseg2_max = 8, | 191 | .tseg2_max = 8, |
192 | .sjw_max = 4, | 192 | .sjw_max = 4, |
193 | .brp_min = 1, | 193 | .brp_min = 1, |
@@ -959,13 +959,13 @@ static void __devexit pch_can_remove(struct pci_dev *pdev) | |||
959 | struct pch_can_priv *priv = netdev_priv(ndev); | 959 | struct pch_can_priv *priv = netdev_priv(ndev); |
960 | 960 | ||
961 | unregister_candev(priv->ndev); | 961 | unregister_candev(priv->ndev); |
962 | pci_iounmap(pdev, priv->regs); | ||
963 | if (priv->use_msi) | 962 | if (priv->use_msi) |
964 | pci_disable_msi(priv->dev); | 963 | pci_disable_msi(priv->dev); |
965 | pci_release_regions(pdev); | 964 | pci_release_regions(pdev); |
966 | pci_disable_device(pdev); | 965 | pci_disable_device(pdev); |
967 | pci_set_drvdata(pdev, NULL); | 966 | pci_set_drvdata(pdev, NULL); |
968 | pch_can_reset(priv); | 967 | pch_can_reset(priv); |
968 | pci_iounmap(pdev, priv->regs); | ||
969 | free_candev(priv->ndev); | 969 | free_candev(priv->ndev); |
970 | } | 970 | } |
971 | 971 | ||
@@ -1238,6 +1238,7 @@ static int __devinit pch_can_probe(struct pci_dev *pdev, | |||
1238 | priv->use_msi = 0; | 1238 | priv->use_msi = 0; |
1239 | } else { | 1239 | } else { |
1240 | netdev_err(ndev, "PCH CAN opened with MSI\n"); | 1240 | netdev_err(ndev, "PCH CAN opened with MSI\n"); |
1241 | pci_set_master(pdev); | ||
1241 | priv->use_msi = 1; | 1242 | priv->use_msi = 1; |
1242 | } | 1243 | } |
1243 | 1244 | ||
diff --git a/drivers/net/e1000/e1000_hw.c b/drivers/net/e1000/e1000_hw.c index aed223b1b897..7501d977d992 100644 --- a/drivers/net/e1000/e1000_hw.c +++ b/drivers/net/e1000/e1000_hw.c | |||
@@ -124,6 +124,7 @@ static s32 e1000_set_phy_type(struct e1000_hw *hw) | |||
124 | case M88E1000_I_PHY_ID: | 124 | case M88E1000_I_PHY_ID: |
125 | case M88E1011_I_PHY_ID: | 125 | case M88E1011_I_PHY_ID: |
126 | case M88E1111_I_PHY_ID: | 126 | case M88E1111_I_PHY_ID: |
127 | case M88E1118_E_PHY_ID: | ||
127 | hw->phy_type = e1000_phy_m88; | 128 | hw->phy_type = e1000_phy_m88; |
128 | break; | 129 | break; |
129 | case IGP01E1000_I_PHY_ID: | 130 | case IGP01E1000_I_PHY_ID: |
@@ -3222,7 +3223,8 @@ static s32 e1000_detect_gig_phy(struct e1000_hw *hw) | |||
3222 | break; | 3223 | break; |
3223 | case e1000_ce4100: | 3224 | case e1000_ce4100: |
3224 | if ((hw->phy_id == RTL8211B_PHY_ID) || | 3225 | if ((hw->phy_id == RTL8211B_PHY_ID) || |
3225 | (hw->phy_id == RTL8201N_PHY_ID)) | 3226 | (hw->phy_id == RTL8201N_PHY_ID) || |
3227 | (hw->phy_id == M88E1118_E_PHY_ID)) | ||
3226 | match = true; | 3228 | match = true; |
3227 | break; | 3229 | break; |
3228 | case e1000_82541: | 3230 | case e1000_82541: |
diff --git a/drivers/net/e1000/e1000_hw.h b/drivers/net/e1000/e1000_hw.h index 196eeda2dd6c..c70b23d52284 100644 --- a/drivers/net/e1000/e1000_hw.h +++ b/drivers/net/e1000/e1000_hw.h | |||
@@ -2917,6 +2917,7 @@ struct e1000_host_command_info { | |||
2917 | #define M88E1000_14_PHY_ID M88E1000_E_PHY_ID | 2917 | #define M88E1000_14_PHY_ID M88E1000_E_PHY_ID |
2918 | #define M88E1011_I_REV_4 0x04 | 2918 | #define M88E1011_I_REV_4 0x04 |
2919 | #define M88E1111_I_PHY_ID 0x01410CC0 | 2919 | #define M88E1111_I_PHY_ID 0x01410CC0 |
2920 | #define M88E1118_E_PHY_ID 0x01410E40 | ||
2920 | #define L1LXT971A_PHY_ID 0x001378E0 | 2921 | #define L1LXT971A_PHY_ID 0x001378E0 |
2921 | 2922 | ||
2922 | #define RTL8211B_PHY_ID 0x001CC910 | 2923 | #define RTL8211B_PHY_ID 0x001CC910 |
diff --git a/drivers/net/e1000e/netdev.c b/drivers/net/e1000e/netdev.c index 5b916b01805f..6025d5fb12a4 100644 --- a/drivers/net/e1000e/netdev.c +++ b/drivers/net/e1000e/netdev.c | |||
@@ -4311,7 +4311,6 @@ link_up: | |||
4311 | * to get done, so reset controller to flush Tx. | 4311 | * to get done, so reset controller to flush Tx. |
4312 | * (Do the reset outside of interrupt context). | 4312 | * (Do the reset outside of interrupt context). |
4313 | */ | 4313 | */ |
4314 | adapter->tx_timeout_count++; | ||
4315 | schedule_work(&adapter->reset_task); | 4314 | schedule_work(&adapter->reset_task); |
4316 | /* return immediately since reset is imminent */ | 4315 | /* return immediately since reset is imminent */ |
4317 | return; | 4316 | return; |
diff --git a/drivers/net/ixgbe/ixgbe_common.c b/drivers/net/ixgbe/ixgbe_common.c index d5ede2df3e42..ebbda7d15254 100644 --- a/drivers/net/ixgbe/ixgbe_common.c +++ b/drivers/net/ixgbe/ixgbe_common.c | |||
@@ -1370,6 +1370,9 @@ s32 ixgbe_init_rx_addrs_generic(struct ixgbe_hw *hw) | |||
1370 | hw_dbg(hw, " New MAC Addr =%pM\n", hw->mac.addr); | 1370 | hw_dbg(hw, " New MAC Addr =%pM\n", hw->mac.addr); |
1371 | 1371 | ||
1372 | hw->mac.ops.set_rar(hw, 0, hw->mac.addr, 0, IXGBE_RAH_AV); | 1372 | hw->mac.ops.set_rar(hw, 0, hw->mac.addr, 0, IXGBE_RAH_AV); |
1373 | |||
1374 | /* clear VMDq pool/queue selection for RAR 0 */ | ||
1375 | hw->mac.ops.clear_vmdq(hw, 0, IXGBE_CLEAR_VMDQ_ALL); | ||
1373 | } | 1376 | } |
1374 | hw->addr_ctrl.overflow_promisc = 0; | 1377 | hw->addr_ctrl.overflow_promisc = 0; |
1375 | 1378 | ||
diff --git a/drivers/net/ixgbe/ixgbe_fcoe.c b/drivers/net/ixgbe/ixgbe_fcoe.c index 6342d4859790..8753980668c7 100644 --- a/drivers/net/ixgbe/ixgbe_fcoe.c +++ b/drivers/net/ixgbe/ixgbe_fcoe.c | |||
@@ -165,7 +165,7 @@ int ixgbe_fcoe_ddp_get(struct net_device *netdev, u16 xid, | |||
165 | unsigned int thisoff = 0; | 165 | unsigned int thisoff = 0; |
166 | unsigned int thislen = 0; | 166 | unsigned int thislen = 0; |
167 | u32 fcbuff, fcdmarw, fcfltrw; | 167 | u32 fcbuff, fcdmarw, fcfltrw; |
168 | dma_addr_t addr; | 168 | dma_addr_t addr = 0; |
169 | 169 | ||
170 | if (!netdev || !sgl) | 170 | if (!netdev || !sgl) |
171 | return 0; | 171 | return 0; |
diff --git a/drivers/net/ixgbe/ixgbe_main.c b/drivers/net/ixgbe/ixgbe_main.c index 602078b84892..fbae703b46d7 100644 --- a/drivers/net/ixgbe/ixgbe_main.c +++ b/drivers/net/ixgbe/ixgbe_main.c | |||
@@ -52,7 +52,7 @@ char ixgbe_driver_name[] = "ixgbe"; | |||
52 | static const char ixgbe_driver_string[] = | 52 | static const char ixgbe_driver_string[] = |
53 | "Intel(R) 10 Gigabit PCI Express Network Driver"; | 53 | "Intel(R) 10 Gigabit PCI Express Network Driver"; |
54 | 54 | ||
55 | #define DRV_VERSION "3.0.12-k2" | 55 | #define DRV_VERSION "3.2.9-k2" |
56 | const char ixgbe_driver_version[] = DRV_VERSION; | 56 | const char ixgbe_driver_version[] = DRV_VERSION; |
57 | static char ixgbe_copyright[] = "Copyright (c) 1999-2010 Intel Corporation."; | 57 | static char ixgbe_copyright[] = "Copyright (c) 1999-2010 Intel Corporation."; |
58 | 58 | ||
@@ -3176,9 +3176,16 @@ static void ixgbe_set_rx_buffer_len(struct ixgbe_adapter *adapter) | |||
3176 | u32 mhadd, hlreg0; | 3176 | u32 mhadd, hlreg0; |
3177 | 3177 | ||
3178 | /* Decide whether to use packet split mode or not */ | 3178 | /* Decide whether to use packet split mode or not */ |
3179 | /* On by default */ | ||
3180 | adapter->flags |= IXGBE_FLAG_RX_PS_ENABLED; | ||
3181 | |||
3179 | /* Do not use packet split if we're in SR-IOV Mode */ | 3182 | /* Do not use packet split if we're in SR-IOV Mode */ |
3180 | if (!adapter->num_vfs) | 3183 | if (adapter->num_vfs) |
3181 | adapter->flags |= IXGBE_FLAG_RX_PS_ENABLED; | 3184 | adapter->flags &= ~IXGBE_FLAG_RX_PS_ENABLED; |
3185 | |||
3186 | /* Disable packet split due to 82599 erratum #45 */ | ||
3187 | if (hw->mac.type == ixgbe_mac_82599EB) | ||
3188 | adapter->flags &= ~IXGBE_FLAG_RX_PS_ENABLED; | ||
3182 | 3189 | ||
3183 | /* Set the RX buffer length according to the mode */ | 3190 | /* Set the RX buffer length according to the mode */ |
3184 | if (adapter->flags & IXGBE_FLAG_RX_PS_ENABLED) { | 3191 | if (adapter->flags & IXGBE_FLAG_RX_PS_ENABLED) { |
@@ -4863,16 +4870,13 @@ static int ixgbe_alloc_q_vectors(struct ixgbe_adapter *adapter) | |||
4863 | { | 4870 | { |
4864 | int q_idx, num_q_vectors; | 4871 | int q_idx, num_q_vectors; |
4865 | struct ixgbe_q_vector *q_vector; | 4872 | struct ixgbe_q_vector *q_vector; |
4866 | int napi_vectors; | ||
4867 | int (*poll)(struct napi_struct *, int); | 4873 | int (*poll)(struct napi_struct *, int); |
4868 | 4874 | ||
4869 | if (adapter->flags & IXGBE_FLAG_MSIX_ENABLED) { | 4875 | if (adapter->flags & IXGBE_FLAG_MSIX_ENABLED) { |
4870 | num_q_vectors = adapter->num_msix_vectors - NON_Q_VECTORS; | 4876 | num_q_vectors = adapter->num_msix_vectors - NON_Q_VECTORS; |
4871 | napi_vectors = adapter->num_rx_queues; | ||
4872 | poll = &ixgbe_clean_rxtx_many; | 4877 | poll = &ixgbe_clean_rxtx_many; |
4873 | } else { | 4878 | } else { |
4874 | num_q_vectors = 1; | 4879 | num_q_vectors = 1; |
4875 | napi_vectors = 1; | ||
4876 | poll = &ixgbe_poll; | 4880 | poll = &ixgbe_poll; |
4877 | } | 4881 | } |
4878 | 4882 | ||
diff --git a/drivers/net/ixgbe/ixgbe_sriov.c b/drivers/net/ixgbe/ixgbe_sriov.c index 47b15738b009..187b3a16ec1f 100644 --- a/drivers/net/ixgbe/ixgbe_sriov.c +++ b/drivers/net/ixgbe/ixgbe_sriov.c | |||
@@ -110,12 +110,10 @@ static int ixgbe_set_vf_vlan(struct ixgbe_adapter *adapter, int add, int vid, | |||
110 | return adapter->hw.mac.ops.set_vfta(&adapter->hw, vid, vf, (bool)add); | 110 | return adapter->hw.mac.ops.set_vfta(&adapter->hw, vid, vf, (bool)add); |
111 | } | 111 | } |
112 | 112 | ||
113 | |||
114 | static void ixgbe_set_vmolr(struct ixgbe_hw *hw, u32 vf, bool aupe) | 113 | static void ixgbe_set_vmolr(struct ixgbe_hw *hw, u32 vf, bool aupe) |
115 | { | 114 | { |
116 | u32 vmolr = IXGBE_READ_REG(hw, IXGBE_VMOLR(vf)); | 115 | u32 vmolr = IXGBE_READ_REG(hw, IXGBE_VMOLR(vf)); |
117 | vmolr |= (IXGBE_VMOLR_ROMPE | | 116 | vmolr |= (IXGBE_VMOLR_ROMPE | |
118 | IXGBE_VMOLR_ROPE | | ||
119 | IXGBE_VMOLR_BAM); | 117 | IXGBE_VMOLR_BAM); |
120 | if (aupe) | 118 | if (aupe) |
121 | vmolr |= IXGBE_VMOLR_AUPE; | 119 | vmolr |= IXGBE_VMOLR_AUPE; |
diff --git a/drivers/net/ixgbe/ixgbe_x540.c b/drivers/net/ixgbe/ixgbe_x540.c index 3a8923993ce3..f2518b01067d 100644 --- a/drivers/net/ixgbe/ixgbe_x540.c +++ b/drivers/net/ixgbe/ixgbe_x540.c | |||
@@ -133,17 +133,17 @@ static s32 ixgbe_reset_hw_X540(struct ixgbe_hw *hw) | |||
133 | } | 133 | } |
134 | 134 | ||
135 | ctrl = IXGBE_READ_REG(hw, IXGBE_CTRL); | 135 | ctrl = IXGBE_READ_REG(hw, IXGBE_CTRL); |
136 | IXGBE_WRITE_REG(hw, IXGBE_CTRL, (ctrl | IXGBE_CTRL_RST)); | 136 | IXGBE_WRITE_REG(hw, IXGBE_CTRL, (ctrl | reset_bit)); |
137 | IXGBE_WRITE_FLUSH(hw); | 137 | IXGBE_WRITE_FLUSH(hw); |
138 | 138 | ||
139 | /* Poll for reset bit to self-clear indicating reset is complete */ | 139 | /* Poll for reset bit to self-clear indicating reset is complete */ |
140 | for (i = 0; i < 10; i++) { | 140 | for (i = 0; i < 10; i++) { |
141 | udelay(1); | 141 | udelay(1); |
142 | ctrl = IXGBE_READ_REG(hw, IXGBE_CTRL); | 142 | ctrl = IXGBE_READ_REG(hw, IXGBE_CTRL); |
143 | if (!(ctrl & IXGBE_CTRL_RST)) | 143 | if (!(ctrl & reset_bit)) |
144 | break; | 144 | break; |
145 | } | 145 | } |
146 | if (ctrl & IXGBE_CTRL_RST) { | 146 | if (ctrl & reset_bit) { |
147 | status = IXGBE_ERR_RESET_FAILED; | 147 | status = IXGBE_ERR_RESET_FAILED; |
148 | hw_dbg(hw, "Reset polling failed to complete.\n"); | 148 | hw_dbg(hw, "Reset polling failed to complete.\n"); |
149 | } | 149 | } |
diff --git a/drivers/net/sis900.c b/drivers/net/sis900.c index 5976d1d51df1..640e368ebeee 100644 --- a/drivers/net/sis900.c +++ b/drivers/net/sis900.c | |||
@@ -1777,6 +1777,7 @@ static int sis900_rx(struct net_device *net_dev) | |||
1777 | "cur_rx:%4.4d, dirty_rx:%4.4d\n", | 1777 | "cur_rx:%4.4d, dirty_rx:%4.4d\n", |
1778 | net_dev->name, sis_priv->cur_rx, | 1778 | net_dev->name, sis_priv->cur_rx, |
1779 | sis_priv->dirty_rx); | 1779 | sis_priv->dirty_rx); |
1780 | dev_kfree_skb(skb); | ||
1780 | break; | 1781 | break; |
1781 | } | 1782 | } |
1782 | 1783 | ||
diff --git a/drivers/net/usb/cdc_ncm.c b/drivers/net/usb/cdc_ncm.c index 04e8ce14a1d0..7113168473cf 100644 --- a/drivers/net/usb/cdc_ncm.c +++ b/drivers/net/usb/cdc_ncm.c | |||
@@ -1,7 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * cdc_ncm.c | 2 | * cdc_ncm.c |
3 | * | 3 | * |
4 | * Copyright (C) ST-Ericsson 2010 | 4 | * Copyright (C) ST-Ericsson 2010-2011 |
5 | * Contact: Alexey Orishko <alexey.orishko@stericsson.com> | 5 | * Contact: Alexey Orishko <alexey.orishko@stericsson.com> |
6 | * Original author: Hans Petter Selasky <hans.petter.selasky@stericsson.com> | 6 | * Original author: Hans Petter Selasky <hans.petter.selasky@stericsson.com> |
7 | * | 7 | * |
@@ -54,7 +54,7 @@ | |||
54 | #include <linux/usb/usbnet.h> | 54 | #include <linux/usb/usbnet.h> |
55 | #include <linux/usb/cdc.h> | 55 | #include <linux/usb/cdc.h> |
56 | 56 | ||
57 | #define DRIVER_VERSION "17-Jan-2011" | 57 | #define DRIVER_VERSION "7-Feb-2011" |
58 | 58 | ||
59 | /* CDC NCM subclass 3.2.1 */ | 59 | /* CDC NCM subclass 3.2.1 */ |
60 | #define USB_CDC_NCM_NDP16_LENGTH_MIN 0x10 | 60 | #define USB_CDC_NCM_NDP16_LENGTH_MIN 0x10 |
@@ -77,6 +77,9 @@ | |||
77 | */ | 77 | */ |
78 | #define CDC_NCM_DPT_DATAGRAMS_MAX 32 | 78 | #define CDC_NCM_DPT_DATAGRAMS_MAX 32 |
79 | 79 | ||
80 | /* Maximum amount of IN datagrams in NTB */ | ||
81 | #define CDC_NCM_DPT_DATAGRAMS_IN_MAX 0 /* unlimited */ | ||
82 | |||
80 | /* Restart the timer, if amount of datagrams is less than given value */ | 83 | /* Restart the timer, if amount of datagrams is less than given value */ |
81 | #define CDC_NCM_RESTART_TIMER_DATAGRAM_CNT 3 | 84 | #define CDC_NCM_RESTART_TIMER_DATAGRAM_CNT 3 |
82 | 85 | ||
@@ -85,11 +88,6 @@ | |||
85 | (sizeof(struct usb_cdc_ncm_nth16) + sizeof(struct usb_cdc_ncm_ndp16) + \ | 88 | (sizeof(struct usb_cdc_ncm_nth16) + sizeof(struct usb_cdc_ncm_ndp16) + \ |
86 | (CDC_NCM_DPT_DATAGRAMS_MAX + 1) * sizeof(struct usb_cdc_ncm_dpe16)) | 89 | (CDC_NCM_DPT_DATAGRAMS_MAX + 1) * sizeof(struct usb_cdc_ncm_dpe16)) |
87 | 90 | ||
88 | struct connection_speed_change { | ||
89 | __le32 USBitRate; /* holds 3GPP downlink value, bits per second */ | ||
90 | __le32 DSBitRate; /* holds 3GPP uplink value, bits per second */ | ||
91 | } __attribute__ ((packed)); | ||
92 | |||
93 | struct cdc_ncm_data { | 91 | struct cdc_ncm_data { |
94 | struct usb_cdc_ncm_nth16 nth16; | 92 | struct usb_cdc_ncm_nth16 nth16; |
95 | struct usb_cdc_ncm_ndp16 ndp16; | 93 | struct usb_cdc_ncm_ndp16 ndp16; |
@@ -198,10 +196,10 @@ static u8 cdc_ncm_setup(struct cdc_ncm_ctx *ctx) | |||
198 | { | 196 | { |
199 | struct usb_cdc_notification req; | 197 | struct usb_cdc_notification req; |
200 | u32 val; | 198 | u32 val; |
201 | __le16 max_datagram_size; | ||
202 | u8 flags; | 199 | u8 flags; |
203 | u8 iface_no; | 200 | u8 iface_no; |
204 | int err; | 201 | int err; |
202 | u16 ntb_fmt_supported; | ||
205 | 203 | ||
206 | iface_no = ctx->control->cur_altsetting->desc.bInterfaceNumber; | 204 | iface_no = ctx->control->cur_altsetting->desc.bInterfaceNumber; |
207 | 205 | ||
@@ -223,6 +221,9 @@ static u8 cdc_ncm_setup(struct cdc_ncm_ctx *ctx) | |||
223 | ctx->tx_remainder = le16_to_cpu(ctx->ncm_parm.wNdpOutPayloadRemainder); | 221 | ctx->tx_remainder = le16_to_cpu(ctx->ncm_parm.wNdpOutPayloadRemainder); |
224 | ctx->tx_modulus = le16_to_cpu(ctx->ncm_parm.wNdpOutDivisor); | 222 | ctx->tx_modulus = le16_to_cpu(ctx->ncm_parm.wNdpOutDivisor); |
225 | ctx->tx_ndp_modulus = le16_to_cpu(ctx->ncm_parm.wNdpOutAlignment); | 223 | ctx->tx_ndp_modulus = le16_to_cpu(ctx->ncm_parm.wNdpOutAlignment); |
224 | /* devices prior to NCM Errata shall set this field to zero */ | ||
225 | ctx->tx_max_datagrams = le16_to_cpu(ctx->ncm_parm.wNtbOutMaxDatagrams); | ||
226 | ntb_fmt_supported = le16_to_cpu(ctx->ncm_parm.bmNtbFormatsSupported); | ||
226 | 227 | ||
227 | if (ctx->func_desc != NULL) | 228 | if (ctx->func_desc != NULL) |
228 | flags = ctx->func_desc->bmNetworkCapabilities; | 229 | flags = ctx->func_desc->bmNetworkCapabilities; |
@@ -231,22 +232,58 @@ static u8 cdc_ncm_setup(struct cdc_ncm_ctx *ctx) | |||
231 | 232 | ||
232 | pr_debug("dwNtbInMaxSize=%u dwNtbOutMaxSize=%u " | 233 | pr_debug("dwNtbInMaxSize=%u dwNtbOutMaxSize=%u " |
233 | "wNdpOutPayloadRemainder=%u wNdpOutDivisor=%u " | 234 | "wNdpOutPayloadRemainder=%u wNdpOutDivisor=%u " |
234 | "wNdpOutAlignment=%u flags=0x%x\n", | 235 | "wNdpOutAlignment=%u wNtbOutMaxDatagrams=%u flags=0x%x\n", |
235 | ctx->rx_max, ctx->tx_max, ctx->tx_remainder, ctx->tx_modulus, | 236 | ctx->rx_max, ctx->tx_max, ctx->tx_remainder, ctx->tx_modulus, |
236 | ctx->tx_ndp_modulus, flags); | 237 | ctx->tx_ndp_modulus, ctx->tx_max_datagrams, flags); |
237 | 238 | ||
238 | /* max count of tx datagrams without terminating NULL entry */ | 239 | /* max count of tx datagrams */ |
239 | ctx->tx_max_datagrams = CDC_NCM_DPT_DATAGRAMS_MAX; | 240 | if ((ctx->tx_max_datagrams == 0) || |
241 | (ctx->tx_max_datagrams > CDC_NCM_DPT_DATAGRAMS_MAX)) | ||
242 | ctx->tx_max_datagrams = CDC_NCM_DPT_DATAGRAMS_MAX; | ||
240 | 243 | ||
241 | /* verify maximum size of received NTB in bytes */ | 244 | /* verify maximum size of received NTB in bytes */ |
242 | if ((ctx->rx_max < | 245 | if (ctx->rx_max < USB_CDC_NCM_NTB_MIN_IN_SIZE) { |
243 | (CDC_NCM_MIN_HDR_SIZE + CDC_NCM_MIN_DATAGRAM_SIZE)) || | 246 | pr_debug("Using min receive length=%d\n", |
244 | (ctx->rx_max > CDC_NCM_NTB_MAX_SIZE_RX)) { | 247 | USB_CDC_NCM_NTB_MIN_IN_SIZE); |
248 | ctx->rx_max = USB_CDC_NCM_NTB_MIN_IN_SIZE; | ||
249 | } | ||
250 | |||
251 | if (ctx->rx_max > CDC_NCM_NTB_MAX_SIZE_RX) { | ||
245 | pr_debug("Using default maximum receive length=%d\n", | 252 | pr_debug("Using default maximum receive length=%d\n", |
246 | CDC_NCM_NTB_MAX_SIZE_RX); | 253 | CDC_NCM_NTB_MAX_SIZE_RX); |
247 | ctx->rx_max = CDC_NCM_NTB_MAX_SIZE_RX; | 254 | ctx->rx_max = CDC_NCM_NTB_MAX_SIZE_RX; |
248 | } | 255 | } |
249 | 256 | ||
257 | /* inform device about NTB input size changes */ | ||
258 | if (ctx->rx_max != le32_to_cpu(ctx->ncm_parm.dwNtbInMaxSize)) { | ||
259 | req.bmRequestType = USB_TYPE_CLASS | USB_DIR_OUT | | ||
260 | USB_RECIP_INTERFACE; | ||
261 | req.bNotificationType = USB_CDC_SET_NTB_INPUT_SIZE; | ||
262 | req.wValue = 0; | ||
263 | req.wIndex = cpu_to_le16(iface_no); | ||
264 | |||
265 | if (flags & USB_CDC_NCM_NCAP_NTB_INPUT_SIZE) { | ||
266 | struct usb_cdc_ncm_ndp_input_size ndp_in_sz; | ||
267 | |||
268 | req.wLength = 8; | ||
269 | ndp_in_sz.dwNtbInMaxSize = cpu_to_le32(ctx->rx_max); | ||
270 | ndp_in_sz.wNtbInMaxDatagrams = | ||
271 | cpu_to_le16(CDC_NCM_DPT_DATAGRAMS_MAX); | ||
272 | ndp_in_sz.wReserved = 0; | ||
273 | err = cdc_ncm_do_request(ctx, &req, &ndp_in_sz, 0, NULL, | ||
274 | 1000); | ||
275 | } else { | ||
276 | __le32 dwNtbInMaxSize = cpu_to_le32(ctx->rx_max); | ||
277 | |||
278 | req.wLength = 4; | ||
279 | err = cdc_ncm_do_request(ctx, &req, &dwNtbInMaxSize, 0, | ||
280 | NULL, 1000); | ||
281 | } | ||
282 | |||
283 | if (err) | ||
284 | pr_debug("Setting NTB Input Size failed\n"); | ||
285 | } | ||
286 | |||
250 | /* verify maximum size of transmitted NTB in bytes */ | 287 | /* verify maximum size of transmitted NTB in bytes */ |
251 | if ((ctx->tx_max < | 288 | if ((ctx->tx_max < |
252 | (CDC_NCM_MIN_HDR_SIZE + CDC_NCM_MIN_DATAGRAM_SIZE)) || | 289 | (CDC_NCM_MIN_HDR_SIZE + CDC_NCM_MIN_DATAGRAM_SIZE)) || |
@@ -297,47 +334,84 @@ static u8 cdc_ncm_setup(struct cdc_ncm_ctx *ctx) | |||
297 | /* additional configuration */ | 334 | /* additional configuration */ |
298 | 335 | ||
299 | /* set CRC Mode */ | 336 | /* set CRC Mode */ |
300 | req.bmRequestType = USB_TYPE_CLASS | USB_DIR_OUT | USB_RECIP_INTERFACE; | 337 | if (flags & USB_CDC_NCM_NCAP_CRC_MODE) { |
301 | req.bNotificationType = USB_CDC_SET_CRC_MODE; | 338 | req.bmRequestType = USB_TYPE_CLASS | USB_DIR_OUT | |
302 | req.wValue = cpu_to_le16(USB_CDC_NCM_CRC_NOT_APPENDED); | 339 | USB_RECIP_INTERFACE; |
303 | req.wIndex = cpu_to_le16(iface_no); | 340 | req.bNotificationType = USB_CDC_SET_CRC_MODE; |
304 | req.wLength = 0; | 341 | req.wValue = cpu_to_le16(USB_CDC_NCM_CRC_NOT_APPENDED); |
305 | 342 | req.wIndex = cpu_to_le16(iface_no); | |
306 | err = cdc_ncm_do_request(ctx, &req, NULL, 0, NULL, 1000); | 343 | req.wLength = 0; |
307 | if (err) | 344 | |
308 | pr_debug("Setting CRC mode off failed\n"); | 345 | err = cdc_ncm_do_request(ctx, &req, NULL, 0, NULL, 1000); |
346 | if (err) | ||
347 | pr_debug("Setting CRC mode off failed\n"); | ||
348 | } | ||
309 | 349 | ||
310 | /* set NTB format */ | 350 | /* set NTB format, if both formats are supported */ |
311 | req.bmRequestType = USB_TYPE_CLASS | USB_DIR_OUT | USB_RECIP_INTERFACE; | 351 | if (ntb_fmt_supported & USB_CDC_NCM_NTH32_SIGN) { |
312 | req.bNotificationType = USB_CDC_SET_NTB_FORMAT; | 352 | req.bmRequestType = USB_TYPE_CLASS | USB_DIR_OUT | |
313 | req.wValue = cpu_to_le16(USB_CDC_NCM_NTB16_FORMAT); | 353 | USB_RECIP_INTERFACE; |
314 | req.wIndex = cpu_to_le16(iface_no); | 354 | req.bNotificationType = USB_CDC_SET_NTB_FORMAT; |
315 | req.wLength = 0; | 355 | req.wValue = cpu_to_le16(USB_CDC_NCM_NTB16_FORMAT); |
356 | req.wIndex = cpu_to_le16(iface_no); | ||
357 | req.wLength = 0; | ||
358 | |||
359 | err = cdc_ncm_do_request(ctx, &req, NULL, 0, NULL, 1000); | ||
360 | if (err) | ||
361 | pr_debug("Setting NTB format to 16-bit failed\n"); | ||
362 | } | ||
316 | 363 | ||
317 | err = cdc_ncm_do_request(ctx, &req, NULL, 0, NULL, 1000); | 364 | ctx->max_datagram_size = CDC_NCM_MIN_DATAGRAM_SIZE; |
318 | if (err) | ||
319 | pr_debug("Setting NTB format to 16-bit failed\n"); | ||
320 | 365 | ||
321 | /* set Max Datagram Size (MTU) */ | 366 | /* set Max Datagram Size (MTU) */ |
322 | req.bmRequestType = USB_TYPE_CLASS | USB_DIR_IN | USB_RECIP_INTERFACE; | 367 | if (flags & USB_CDC_NCM_NCAP_MAX_DATAGRAM_SIZE) { |
323 | req.bNotificationType = USB_CDC_GET_MAX_DATAGRAM_SIZE; | 368 | __le16 max_datagram_size; |
324 | req.wValue = 0; | 369 | u16 eth_max_sz = le16_to_cpu(ctx->ether_desc->wMaxSegmentSize); |
325 | req.wIndex = cpu_to_le16(iface_no); | 370 | |
326 | req.wLength = cpu_to_le16(2); | 371 | req.bmRequestType = USB_TYPE_CLASS | USB_DIR_IN | |
372 | USB_RECIP_INTERFACE; | ||
373 | req.bNotificationType = USB_CDC_GET_MAX_DATAGRAM_SIZE; | ||
374 | req.wValue = 0; | ||
375 | req.wIndex = cpu_to_le16(iface_no); | ||
376 | req.wLength = cpu_to_le16(2); | ||
377 | |||
378 | err = cdc_ncm_do_request(ctx, &req, &max_datagram_size, 0, NULL, | ||
379 | 1000); | ||
380 | if (err) { | ||
381 | pr_debug("GET_MAX_DATAGRAM_SIZE failed, use size=%u\n", | ||
382 | CDC_NCM_MIN_DATAGRAM_SIZE); | ||
383 | } else { | ||
384 | ctx->max_datagram_size = le16_to_cpu(max_datagram_size); | ||
385 | /* Check Eth descriptor value */ | ||
386 | if (eth_max_sz < CDC_NCM_MAX_DATAGRAM_SIZE) { | ||
387 | if (ctx->max_datagram_size > eth_max_sz) | ||
388 | ctx->max_datagram_size = eth_max_sz; | ||
389 | } else { | ||
390 | if (ctx->max_datagram_size > | ||
391 | CDC_NCM_MAX_DATAGRAM_SIZE) | ||
392 | ctx->max_datagram_size = | ||
393 | CDC_NCM_MAX_DATAGRAM_SIZE; | ||
394 | } | ||
327 | 395 | ||
328 | err = cdc_ncm_do_request(ctx, &req, &max_datagram_size, 0, NULL, 1000); | 396 | if (ctx->max_datagram_size < CDC_NCM_MIN_DATAGRAM_SIZE) |
329 | if (err) { | 397 | ctx->max_datagram_size = |
330 | pr_debug(" GET_MAX_DATAGRAM_SIZE failed, using size=%u\n", | 398 | CDC_NCM_MIN_DATAGRAM_SIZE; |
331 | CDC_NCM_MIN_DATAGRAM_SIZE); | 399 | |
332 | /* use default */ | 400 | /* if value changed, update device */ |
333 | ctx->max_datagram_size = CDC_NCM_MIN_DATAGRAM_SIZE; | 401 | req.bmRequestType = USB_TYPE_CLASS | USB_DIR_OUT | |
334 | } else { | 402 | USB_RECIP_INTERFACE; |
335 | ctx->max_datagram_size = le16_to_cpu(max_datagram_size); | 403 | req.bNotificationType = USB_CDC_SET_MAX_DATAGRAM_SIZE; |
404 | req.wValue = 0; | ||
405 | req.wIndex = cpu_to_le16(iface_no); | ||
406 | req.wLength = 2; | ||
407 | max_datagram_size = cpu_to_le16(ctx->max_datagram_size); | ||
408 | |||
409 | err = cdc_ncm_do_request(ctx, &req, &max_datagram_size, | ||
410 | 0, NULL, 1000); | ||
411 | if (err) | ||
412 | pr_debug("SET_MAX_DATAGRAM_SIZE failed\n"); | ||
413 | } | ||
336 | 414 | ||
337 | if (ctx->max_datagram_size < CDC_NCM_MIN_DATAGRAM_SIZE) | ||
338 | ctx->max_datagram_size = CDC_NCM_MIN_DATAGRAM_SIZE; | ||
339 | else if (ctx->max_datagram_size > CDC_NCM_MAX_DATAGRAM_SIZE) | ||
340 | ctx->max_datagram_size = CDC_NCM_MAX_DATAGRAM_SIZE; | ||
341 | } | 415 | } |
342 | 416 | ||
343 | if (ctx->netdev->mtu != (ctx->max_datagram_size - ETH_HLEN)) | 417 | if (ctx->netdev->mtu != (ctx->max_datagram_size - ETH_HLEN)) |
@@ -466,19 +540,13 @@ static int cdc_ncm_bind(struct usbnet *dev, struct usb_interface *intf) | |||
466 | 540 | ||
467 | ctx->ether_desc = | 541 | ctx->ether_desc = |
468 | (const struct usb_cdc_ether_desc *)buf; | 542 | (const struct usb_cdc_ether_desc *)buf; |
469 | |||
470 | dev->hard_mtu = | 543 | dev->hard_mtu = |
471 | le16_to_cpu(ctx->ether_desc->wMaxSegmentSize); | 544 | le16_to_cpu(ctx->ether_desc->wMaxSegmentSize); |
472 | 545 | ||
473 | if (dev->hard_mtu < | 546 | if (dev->hard_mtu < CDC_NCM_MIN_DATAGRAM_SIZE) |
474 | (CDC_NCM_MIN_DATAGRAM_SIZE - ETH_HLEN)) | 547 | dev->hard_mtu = CDC_NCM_MIN_DATAGRAM_SIZE; |
475 | dev->hard_mtu = | 548 | else if (dev->hard_mtu > CDC_NCM_MAX_DATAGRAM_SIZE) |
476 | CDC_NCM_MIN_DATAGRAM_SIZE - ETH_HLEN; | 549 | dev->hard_mtu = CDC_NCM_MAX_DATAGRAM_SIZE; |
477 | |||
478 | else if (dev->hard_mtu > | ||
479 | (CDC_NCM_MAX_DATAGRAM_SIZE - ETH_HLEN)) | ||
480 | dev->hard_mtu = | ||
481 | CDC_NCM_MAX_DATAGRAM_SIZE - ETH_HLEN; | ||
482 | break; | 550 | break; |
483 | 551 | ||
484 | case USB_CDC_NCM_TYPE: | 552 | case USB_CDC_NCM_TYPE: |
@@ -628,13 +696,13 @@ cdc_ncm_fill_tx_frame(struct cdc_ncm_ctx *ctx, struct sk_buff *skb) | |||
628 | u32 offset; | 696 | u32 offset; |
629 | u32 last_offset; | 697 | u32 last_offset; |
630 | u16 n = 0; | 698 | u16 n = 0; |
631 | u8 timeout = 0; | 699 | u8 ready2send = 0; |
632 | 700 | ||
633 | /* if there is a remaining skb, it gets priority */ | 701 | /* if there is a remaining skb, it gets priority */ |
634 | if (skb != NULL) | 702 | if (skb != NULL) |
635 | swap(skb, ctx->tx_rem_skb); | 703 | swap(skb, ctx->tx_rem_skb); |
636 | else | 704 | else |
637 | timeout = 1; | 705 | ready2send = 1; |
638 | 706 | ||
639 | /* | 707 | /* |
640 | * +----------------+ | 708 | * +----------------+ |
@@ -682,9 +750,10 @@ cdc_ncm_fill_tx_frame(struct cdc_ncm_ctx *ctx, struct sk_buff *skb) | |||
682 | 750 | ||
683 | for (; n < ctx->tx_max_datagrams; n++) { | 751 | for (; n < ctx->tx_max_datagrams; n++) { |
684 | /* check if end of transmit buffer is reached */ | 752 | /* check if end of transmit buffer is reached */ |
685 | if (offset >= ctx->tx_max) | 753 | if (offset >= ctx->tx_max) { |
754 | ready2send = 1; | ||
686 | break; | 755 | break; |
687 | 756 | } | |
688 | /* compute maximum buffer size */ | 757 | /* compute maximum buffer size */ |
689 | rem = ctx->tx_max - offset; | 758 | rem = ctx->tx_max - offset; |
690 | 759 | ||
@@ -711,9 +780,7 @@ cdc_ncm_fill_tx_frame(struct cdc_ncm_ctx *ctx, struct sk_buff *skb) | |||
711 | } | 780 | } |
712 | ctx->tx_rem_skb = skb; | 781 | ctx->tx_rem_skb = skb; |
713 | skb = NULL; | 782 | skb = NULL; |
714 | 783 | ready2send = 1; | |
715 | /* loop one more time */ | ||
716 | timeout = 1; | ||
717 | } | 784 | } |
718 | break; | 785 | break; |
719 | } | 786 | } |
@@ -756,7 +823,7 @@ cdc_ncm_fill_tx_frame(struct cdc_ncm_ctx *ctx, struct sk_buff *skb) | |||
756 | ctx->tx_curr_last_offset = last_offset; | 823 | ctx->tx_curr_last_offset = last_offset; |
757 | goto exit_no_skb; | 824 | goto exit_no_skb; |
758 | 825 | ||
759 | } else if ((n < ctx->tx_max_datagrams) && (timeout == 0)) { | 826 | } else if ((n < ctx->tx_max_datagrams) && (ready2send == 0)) { |
760 | /* wait for more frames */ | 827 | /* wait for more frames */ |
761 | /* push variables */ | 828 | /* push variables */ |
762 | ctx->tx_curr_skb = skb_out; | 829 | ctx->tx_curr_skb = skb_out; |
@@ -813,7 +880,7 @@ cdc_ncm_fill_tx_frame(struct cdc_ncm_ctx *ctx, struct sk_buff *skb) | |||
813 | cpu_to_le16(sizeof(ctx->tx_ncm.nth16)); | 880 | cpu_to_le16(sizeof(ctx->tx_ncm.nth16)); |
814 | ctx->tx_ncm.nth16.wSequence = cpu_to_le16(ctx->tx_seq); | 881 | ctx->tx_ncm.nth16.wSequence = cpu_to_le16(ctx->tx_seq); |
815 | ctx->tx_ncm.nth16.wBlockLength = cpu_to_le16(last_offset); | 882 | ctx->tx_ncm.nth16.wBlockLength = cpu_to_le16(last_offset); |
816 | ctx->tx_ncm.nth16.wFpIndex = ALIGN(sizeof(struct usb_cdc_ncm_nth16), | 883 | ctx->tx_ncm.nth16.wNdpIndex = ALIGN(sizeof(struct usb_cdc_ncm_nth16), |
817 | ctx->tx_ndp_modulus); | 884 | ctx->tx_ndp_modulus); |
818 | 885 | ||
819 | memcpy(skb_out->data, &(ctx->tx_ncm.nth16), sizeof(ctx->tx_ncm.nth16)); | 886 | memcpy(skb_out->data, &(ctx->tx_ncm.nth16), sizeof(ctx->tx_ncm.nth16)); |
@@ -825,13 +892,13 @@ cdc_ncm_fill_tx_frame(struct cdc_ncm_ctx *ctx, struct sk_buff *skb) | |||
825 | rem = sizeof(ctx->tx_ncm.ndp16) + ((ctx->tx_curr_frame_num + 1) * | 892 | rem = sizeof(ctx->tx_ncm.ndp16) + ((ctx->tx_curr_frame_num + 1) * |
826 | sizeof(struct usb_cdc_ncm_dpe16)); | 893 | sizeof(struct usb_cdc_ncm_dpe16)); |
827 | ctx->tx_ncm.ndp16.wLength = cpu_to_le16(rem); | 894 | ctx->tx_ncm.ndp16.wLength = cpu_to_le16(rem); |
828 | ctx->tx_ncm.ndp16.wNextFpIndex = 0; /* reserved */ | 895 | ctx->tx_ncm.ndp16.wNextNdpIndex = 0; /* reserved */ |
829 | 896 | ||
830 | memcpy(((u8 *)skb_out->data) + ctx->tx_ncm.nth16.wFpIndex, | 897 | memcpy(((u8 *)skb_out->data) + ctx->tx_ncm.nth16.wNdpIndex, |
831 | &(ctx->tx_ncm.ndp16), | 898 | &(ctx->tx_ncm.ndp16), |
832 | sizeof(ctx->tx_ncm.ndp16)); | 899 | sizeof(ctx->tx_ncm.ndp16)); |
833 | 900 | ||
834 | memcpy(((u8 *)skb_out->data) + ctx->tx_ncm.nth16.wFpIndex + | 901 | memcpy(((u8 *)skb_out->data) + ctx->tx_ncm.nth16.wNdpIndex + |
835 | sizeof(ctx->tx_ncm.ndp16), | 902 | sizeof(ctx->tx_ncm.ndp16), |
836 | &(ctx->tx_ncm.dpe16), | 903 | &(ctx->tx_ncm.dpe16), |
837 | (ctx->tx_curr_frame_num + 1) * | 904 | (ctx->tx_curr_frame_num + 1) * |
@@ -961,7 +1028,7 @@ static int cdc_ncm_rx_fixup(struct usbnet *dev, struct sk_buff *skb_in) | |||
961 | goto error; | 1028 | goto error; |
962 | } | 1029 | } |
963 | 1030 | ||
964 | temp = le16_to_cpu(ctx->rx_ncm.nth16.wFpIndex); | 1031 | temp = le16_to_cpu(ctx->rx_ncm.nth16.wNdpIndex); |
965 | if ((temp + sizeof(ctx->rx_ncm.ndp16)) > actlen) { | 1032 | if ((temp + sizeof(ctx->rx_ncm.ndp16)) > actlen) { |
966 | pr_debug("invalid DPT16 index\n"); | 1033 | pr_debug("invalid DPT16 index\n"); |
967 | goto error; | 1034 | goto error; |
@@ -1048,10 +1115,10 @@ error: | |||
1048 | 1115 | ||
1049 | static void | 1116 | static void |
1050 | cdc_ncm_speed_change(struct cdc_ncm_ctx *ctx, | 1117 | cdc_ncm_speed_change(struct cdc_ncm_ctx *ctx, |
1051 | struct connection_speed_change *data) | 1118 | struct usb_cdc_speed_change *data) |
1052 | { | 1119 | { |
1053 | uint32_t rx_speed = le32_to_cpu(data->USBitRate); | 1120 | uint32_t rx_speed = le32_to_cpu(data->DLBitRRate); |
1054 | uint32_t tx_speed = le32_to_cpu(data->DSBitRate); | 1121 | uint32_t tx_speed = le32_to_cpu(data->ULBitRate); |
1055 | 1122 | ||
1056 | /* | 1123 | /* |
1057 | * Currently the USB-NET API does not support reporting the actual | 1124 | * Currently the USB-NET API does not support reporting the actual |
@@ -1092,7 +1159,7 @@ static void cdc_ncm_status(struct usbnet *dev, struct urb *urb) | |||
1092 | /* test for split data in 8-byte chunks */ | 1159 | /* test for split data in 8-byte chunks */ |
1093 | if (test_and_clear_bit(EVENT_STS_SPLIT, &dev->flags)) { | 1160 | if (test_and_clear_bit(EVENT_STS_SPLIT, &dev->flags)) { |
1094 | cdc_ncm_speed_change(ctx, | 1161 | cdc_ncm_speed_change(ctx, |
1095 | (struct connection_speed_change *)urb->transfer_buffer); | 1162 | (struct usb_cdc_speed_change *)urb->transfer_buffer); |
1096 | return; | 1163 | return; |
1097 | } | 1164 | } |
1098 | 1165 | ||
@@ -1120,12 +1187,12 @@ static void cdc_ncm_status(struct usbnet *dev, struct urb *urb) | |||
1120 | break; | 1187 | break; |
1121 | 1188 | ||
1122 | case USB_CDC_NOTIFY_SPEED_CHANGE: | 1189 | case USB_CDC_NOTIFY_SPEED_CHANGE: |
1123 | if (urb->actual_length < | 1190 | if (urb->actual_length < (sizeof(*event) + |
1124 | (sizeof(*event) + sizeof(struct connection_speed_change))) | 1191 | sizeof(struct usb_cdc_speed_change))) |
1125 | set_bit(EVENT_STS_SPLIT, &dev->flags); | 1192 | set_bit(EVENT_STS_SPLIT, &dev->flags); |
1126 | else | 1193 | else |
1127 | cdc_ncm_speed_change(ctx, | 1194 | cdc_ncm_speed_change(ctx, |
1128 | (struct connection_speed_change *) &event[1]); | 1195 | (struct usb_cdc_speed_change *) &event[1]); |
1129 | break; | 1196 | break; |
1130 | 1197 | ||
1131 | default: | 1198 | default: |
diff --git a/drivers/net/wireless/ath/ath9k/ath9k.h b/drivers/net/wireless/ath/ath9k/ath9k.h index 7c8409e53598..9272278aff5e 100644 --- a/drivers/net/wireless/ath/ath9k/ath9k.h +++ b/drivers/net/wireless/ath/ath9k/ath9k.h | |||
@@ -218,6 +218,7 @@ struct ath_frame_info { | |||
218 | struct ath_buf_state { | 218 | struct ath_buf_state { |
219 | u8 bf_type; | 219 | u8 bf_type; |
220 | u8 bfs_paprd; | 220 | u8 bfs_paprd; |
221 | unsigned long bfs_paprd_timestamp; | ||
221 | enum ath9k_internal_frame_type bfs_ftype; | 222 | enum ath9k_internal_frame_type bfs_ftype; |
222 | }; | 223 | }; |
223 | 224 | ||
@@ -600,7 +601,6 @@ struct ath_softc { | |||
600 | struct work_struct paprd_work; | 601 | struct work_struct paprd_work; |
601 | struct work_struct hw_check_work; | 602 | struct work_struct hw_check_work; |
602 | struct completion paprd_complete; | 603 | struct completion paprd_complete; |
603 | bool paprd_pending; | ||
604 | 604 | ||
605 | unsigned int hw_busy_count; | 605 | unsigned int hw_busy_count; |
606 | 606 | ||
diff --git a/drivers/net/wireless/ath/ath9k/main.c b/drivers/net/wireless/ath/ath9k/main.c index 2d4e9b861b60..4ed43b2b8df6 100644 --- a/drivers/net/wireless/ath/ath9k/main.c +++ b/drivers/net/wireless/ath/ath9k/main.c | |||
@@ -342,7 +342,6 @@ static bool ath_paprd_send_frame(struct ath_softc *sc, struct sk_buff *skb, int | |||
342 | tx_info->control.rates[1].idx = -1; | 342 | tx_info->control.rates[1].idx = -1; |
343 | 343 | ||
344 | init_completion(&sc->paprd_complete); | 344 | init_completion(&sc->paprd_complete); |
345 | sc->paprd_pending = true; | ||
346 | txctl.paprd = BIT(chain); | 345 | txctl.paprd = BIT(chain); |
347 | 346 | ||
348 | if (ath_tx_start(hw, skb, &txctl) != 0) { | 347 | if (ath_tx_start(hw, skb, &txctl) != 0) { |
@@ -353,7 +352,6 @@ static bool ath_paprd_send_frame(struct ath_softc *sc, struct sk_buff *skb, int | |||
353 | 352 | ||
354 | time_left = wait_for_completion_timeout(&sc->paprd_complete, | 353 | time_left = wait_for_completion_timeout(&sc->paprd_complete, |
355 | msecs_to_jiffies(ATH_PAPRD_TIMEOUT)); | 354 | msecs_to_jiffies(ATH_PAPRD_TIMEOUT)); |
356 | sc->paprd_pending = false; | ||
357 | 355 | ||
358 | if (!time_left) | 356 | if (!time_left) |
359 | ath_dbg(ath9k_hw_common(sc->sc_ah), ATH_DBG_CALIBRATE, | 357 | ath_dbg(ath9k_hw_common(sc->sc_ah), ATH_DBG_CALIBRATE, |
diff --git a/drivers/net/wireless/ath/ath9k/xmit.c b/drivers/net/wireless/ath/ath9k/xmit.c index 68a1c7612e9b..9f4e755d27ce 100644 --- a/drivers/net/wireless/ath/ath9k/xmit.c +++ b/drivers/net/wireless/ath/ath9k/xmit.c | |||
@@ -1752,6 +1752,9 @@ static void ath_tx_start_dma(struct ath_softc *sc, struct ath_buf *bf, | |||
1752 | ar9003_hw_set_paprd_txdesc(sc->sc_ah, bf->bf_desc, | 1752 | ar9003_hw_set_paprd_txdesc(sc->sc_ah, bf->bf_desc, |
1753 | bf->bf_state.bfs_paprd); | 1753 | bf->bf_state.bfs_paprd); |
1754 | 1754 | ||
1755 | if (txctl->paprd) | ||
1756 | bf->bf_state.bfs_paprd_timestamp = jiffies; | ||
1757 | |||
1755 | ath_tx_send_normal(sc, txctl->txq, tid, &bf_head); | 1758 | ath_tx_send_normal(sc, txctl->txq, tid, &bf_head); |
1756 | } | 1759 | } |
1757 | 1760 | ||
@@ -1909,7 +1912,9 @@ static void ath_tx_complete_buf(struct ath_softc *sc, struct ath_buf *bf, | |||
1909 | bf->bf_buf_addr = 0; | 1912 | bf->bf_buf_addr = 0; |
1910 | 1913 | ||
1911 | if (bf->bf_state.bfs_paprd) { | 1914 | if (bf->bf_state.bfs_paprd) { |
1912 | if (!sc->paprd_pending) | 1915 | if (time_after(jiffies, |
1916 | bf->bf_state.bfs_paprd_timestamp + | ||
1917 | msecs_to_jiffies(ATH_PAPRD_TIMEOUT))) | ||
1913 | dev_kfree_skb_any(skb); | 1918 | dev_kfree_skb_any(skb); |
1914 | else | 1919 | else |
1915 | complete(&sc->paprd_complete); | 1920 | complete(&sc->paprd_complete); |
diff --git a/drivers/net/wireless/ath/carl9170/rx.c b/drivers/net/wireless/ath/carl9170/rx.c index 939a0e96ed1f..84866a4b8350 100644 --- a/drivers/net/wireless/ath/carl9170/rx.c +++ b/drivers/net/wireless/ath/carl9170/rx.c | |||
@@ -564,7 +564,7 @@ static void carl9170_ps_beacon(struct ar9170 *ar, void *data, unsigned int len) | |||
564 | cam = ieee80211_check_tim(tim_ie, tim_len, ar->common.curaid); | 564 | cam = ieee80211_check_tim(tim_ie, tim_len, ar->common.curaid); |
565 | 565 | ||
566 | /* 2. Maybe the AP wants to send multicast/broadcast data? */ | 566 | /* 2. Maybe the AP wants to send multicast/broadcast data? */ |
567 | cam = !!(tim_ie->bitmap_ctrl & 0x01); | 567 | cam |= !!(tim_ie->bitmap_ctrl & 0x01); |
568 | 568 | ||
569 | if (!cam) { | 569 | if (!cam) { |
570 | /* back to low-power land. */ | 570 | /* back to low-power land. */ |
diff --git a/drivers/net/wireless/iwlwifi/iwl-6000.c b/drivers/net/wireless/iwlwifi/iwl-6000.c index aa32b1e05dff..f6493f77610d 100644 --- a/drivers/net/wireless/iwlwifi/iwl-6000.c +++ b/drivers/net/wireless/iwlwifi/iwl-6000.c | |||
@@ -678,6 +678,8 @@ struct iwl_cfg iwl6000i_2bg_cfg = { | |||
678 | .fw_name_pre = IWL6050_FW_PRE, \ | 678 | .fw_name_pre = IWL6050_FW_PRE, \ |
679 | .ucode_api_max = IWL6050_UCODE_API_MAX, \ | 679 | .ucode_api_max = IWL6050_UCODE_API_MAX, \ |
680 | .ucode_api_min = IWL6050_UCODE_API_MIN, \ | 680 | .ucode_api_min = IWL6050_UCODE_API_MIN, \ |
681 | .valid_tx_ant = ANT_AB, /* .cfg overwrite */ \ | ||
682 | .valid_rx_ant = ANT_AB, /* .cfg overwrite */ \ | ||
681 | .ops = &iwl6050_ops, \ | 683 | .ops = &iwl6050_ops, \ |
682 | .eeprom_ver = EEPROM_6050_EEPROM_VERSION, \ | 684 | .eeprom_ver = EEPROM_6050_EEPROM_VERSION, \ |
683 | .eeprom_calib_ver = EEPROM_6050_TX_POWER_VERSION, \ | 685 | .eeprom_calib_ver = EEPROM_6050_TX_POWER_VERSION, \ |
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn.c b/drivers/net/wireless/iwlwifi/iwl-agn.c index 096f8ad0f1b1..8ee810f5fc06 100644 --- a/drivers/net/wireless/iwlwifi/iwl-agn.c +++ b/drivers/net/wireless/iwlwifi/iwl-agn.c | |||
@@ -1183,6 +1183,9 @@ static void iwl_irq_tasklet_legacy(struct iwl_priv *priv) | |||
1183 | /* only Re-enable if disabled by irq */ | 1183 | /* only Re-enable if disabled by irq */ |
1184 | if (test_bit(STATUS_INT_ENABLED, &priv->status)) | 1184 | if (test_bit(STATUS_INT_ENABLED, &priv->status)) |
1185 | iwl_enable_interrupts(priv); | 1185 | iwl_enable_interrupts(priv); |
1186 | /* Re-enable RF_KILL if it occurred */ | ||
1187 | else if (handled & CSR_INT_BIT_RF_KILL) | ||
1188 | iwl_enable_rfkill_int(priv); | ||
1186 | 1189 | ||
1187 | #ifdef CONFIG_IWLWIFI_DEBUG | 1190 | #ifdef CONFIG_IWLWIFI_DEBUG |
1188 | if (iwl_get_debug_level(priv) & (IWL_DL_ISR)) { | 1191 | if (iwl_get_debug_level(priv) & (IWL_DL_ISR)) { |
@@ -1397,6 +1400,9 @@ static void iwl_irq_tasklet(struct iwl_priv *priv) | |||
1397 | /* only Re-enable if disabled by irq */ | 1400 | /* only Re-enable if disabled by irq */ |
1398 | if (test_bit(STATUS_INT_ENABLED, &priv->status)) | 1401 | if (test_bit(STATUS_INT_ENABLED, &priv->status)) |
1399 | iwl_enable_interrupts(priv); | 1402 | iwl_enable_interrupts(priv); |
1403 | /* Re-enable RF_KILL if it occurred */ | ||
1404 | else if (handled & CSR_INT_BIT_RF_KILL) | ||
1405 | iwl_enable_rfkill_int(priv); | ||
1400 | } | 1406 | } |
1401 | 1407 | ||
1402 | /* the threshold ratio of actual_ack_cnt to expected_ack_cnt in percent */ | 1408 | /* the threshold ratio of actual_ack_cnt to expected_ack_cnt in percent */ |
diff --git a/drivers/net/wireless/wl1251/main.c b/drivers/net/wireless/wl1251/main.c index 1c8b0775d849..5a1c13878eaf 100644 --- a/drivers/net/wireless/wl1251/main.c +++ b/drivers/net/wireless/wl1251/main.c | |||
@@ -1050,6 +1050,9 @@ static void wl1251_op_bss_info_changed(struct ieee80211_hw *hw, | |||
1050 | 1050 | ||
1051 | if (changed & BSS_CHANGED_BEACON) { | 1051 | if (changed & BSS_CHANGED_BEACON) { |
1052 | beacon = ieee80211_beacon_get(hw, vif); | 1052 | beacon = ieee80211_beacon_get(hw, vif); |
1053 | if (!beacon) | ||
1054 | goto out_sleep; | ||
1055 | |||
1053 | ret = wl1251_cmd_template_set(wl, CMD_BEACON, beacon->data, | 1056 | ret = wl1251_cmd_template_set(wl, CMD_BEACON, beacon->data, |
1054 | beacon->len); | 1057 | beacon->len); |
1055 | 1058 | ||
diff --git a/drivers/ssb/pcmcia.c b/drivers/ssb/pcmcia.c index c7345dbf43fa..f8533795ee7f 100644 --- a/drivers/ssb/pcmcia.c +++ b/drivers/ssb/pcmcia.c | |||
@@ -733,7 +733,7 @@ int ssb_pcmcia_get_invariants(struct ssb_bus *bus, | |||
733 | 733 | ||
734 | /* Fetch the vendor specific tuples. */ | 734 | /* Fetch the vendor specific tuples. */ |
735 | res = pcmcia_loop_tuple(bus->host_pcmcia, SSB_PCMCIA_CIS, | 735 | res = pcmcia_loop_tuple(bus->host_pcmcia, SSB_PCMCIA_CIS, |
736 | ssb_pcmcia_do_get_invariants, sprom); | 736 | ssb_pcmcia_do_get_invariants, iv); |
737 | if ((res == 0) || (res == -ENOSPC)) | 737 | if ((res == 0) || (res == -ENOSPC)) |
738 | return 0; | 738 | return 0; |
739 | 739 | ||
diff --git a/include/linux/usb/cdc.h b/include/linux/usb/cdc.h index 5e86dc771da4..81a927930bfd 100644 --- a/include/linux/usb/cdc.h +++ b/include/linux/usb/cdc.h | |||
@@ -89,7 +89,7 @@ struct usb_cdc_acm_descriptor { | |||
89 | 89 | ||
90 | #define USB_CDC_COMM_FEATURE 0x01 | 90 | #define USB_CDC_COMM_FEATURE 0x01 |
91 | #define USB_CDC_CAP_LINE 0x02 | 91 | #define USB_CDC_CAP_LINE 0x02 |
92 | #define USB_CDC_CAP_BRK 0x04 | 92 | #define USB_CDC_CAP_BRK 0x04 |
93 | #define USB_CDC_CAP_NOTIFY 0x08 | 93 | #define USB_CDC_CAP_NOTIFY 0x08 |
94 | 94 | ||
95 | /* "Union Functional Descriptor" from CDC spec 5.2.3.8 */ | 95 | /* "Union Functional Descriptor" from CDC spec 5.2.3.8 */ |
@@ -271,6 +271,11 @@ struct usb_cdc_notification { | |||
271 | __le16 wLength; | 271 | __le16 wLength; |
272 | } __attribute__ ((packed)); | 272 | } __attribute__ ((packed)); |
273 | 273 | ||
274 | struct usb_cdc_speed_change { | ||
275 | __le32 DLBitRRate; /* contains the downlink bit rate (IN pipe) */ | ||
276 | __le32 ULBitRate; /* contains the uplink bit rate (OUT pipe) */ | ||
277 | } __attribute__ ((packed)); | ||
278 | |||
274 | /*-------------------------------------------------------------------------*/ | 279 | /*-------------------------------------------------------------------------*/ |
275 | 280 | ||
276 | /* | 281 | /* |
@@ -292,7 +297,7 @@ struct usb_cdc_ncm_ntb_parameters { | |||
292 | __le16 wNdpOutDivisor; | 297 | __le16 wNdpOutDivisor; |
293 | __le16 wNdpOutPayloadRemainder; | 298 | __le16 wNdpOutPayloadRemainder; |
294 | __le16 wNdpOutAlignment; | 299 | __le16 wNdpOutAlignment; |
295 | __le16 wPadding2; | 300 | __le16 wNtbOutMaxDatagrams; |
296 | } __attribute__ ((packed)); | 301 | } __attribute__ ((packed)); |
297 | 302 | ||
298 | /* | 303 | /* |
@@ -307,7 +312,7 @@ struct usb_cdc_ncm_nth16 { | |||
307 | __le16 wHeaderLength; | 312 | __le16 wHeaderLength; |
308 | __le16 wSequence; | 313 | __le16 wSequence; |
309 | __le16 wBlockLength; | 314 | __le16 wBlockLength; |
310 | __le16 wFpIndex; | 315 | __le16 wNdpIndex; |
311 | } __attribute__ ((packed)); | 316 | } __attribute__ ((packed)); |
312 | 317 | ||
313 | struct usb_cdc_ncm_nth32 { | 318 | struct usb_cdc_ncm_nth32 { |
@@ -315,7 +320,7 @@ struct usb_cdc_ncm_nth32 { | |||
315 | __le16 wHeaderLength; | 320 | __le16 wHeaderLength; |
316 | __le16 wSequence; | 321 | __le16 wSequence; |
317 | __le32 dwBlockLength; | 322 | __le32 dwBlockLength; |
318 | __le32 dwFpIndex; | 323 | __le32 dwNdpIndex; |
319 | } __attribute__ ((packed)); | 324 | } __attribute__ ((packed)); |
320 | 325 | ||
321 | /* | 326 | /* |
@@ -337,7 +342,7 @@ struct usb_cdc_ncm_dpe16 { | |||
337 | struct usb_cdc_ncm_ndp16 { | 342 | struct usb_cdc_ncm_ndp16 { |
338 | __le32 dwSignature; | 343 | __le32 dwSignature; |
339 | __le16 wLength; | 344 | __le16 wLength; |
340 | __le16 wNextFpIndex; | 345 | __le16 wNextNdpIndex; |
341 | struct usb_cdc_ncm_dpe16 dpe16[0]; | 346 | struct usb_cdc_ncm_dpe16 dpe16[0]; |
342 | } __attribute__ ((packed)); | 347 | } __attribute__ ((packed)); |
343 | 348 | ||
@@ -375,6 +380,7 @@ struct usb_cdc_ncm_ndp32 { | |||
375 | #define USB_CDC_NCM_NCAP_ENCAP_COMMAND (1 << 2) | 380 | #define USB_CDC_NCM_NCAP_ENCAP_COMMAND (1 << 2) |
376 | #define USB_CDC_NCM_NCAP_MAX_DATAGRAM_SIZE (1 << 3) | 381 | #define USB_CDC_NCM_NCAP_MAX_DATAGRAM_SIZE (1 << 3) |
377 | #define USB_CDC_NCM_NCAP_CRC_MODE (1 << 4) | 382 | #define USB_CDC_NCM_NCAP_CRC_MODE (1 << 4) |
383 | #define USB_CDC_NCM_NCAP_NTB_INPUT_SIZE (1 << 5) | ||
378 | 384 | ||
379 | /* CDC NCM subclass Table 6-3: NTB Parameter Structure */ | 385 | /* CDC NCM subclass Table 6-3: NTB Parameter Structure */ |
380 | #define USB_CDC_NCM_NTB16_SUPPORTED (1 << 0) | 386 | #define USB_CDC_NCM_NTB16_SUPPORTED (1 << 0) |
@@ -392,6 +398,13 @@ struct usb_cdc_ncm_ndp32 { | |||
392 | #define USB_CDC_NCM_NTB_MIN_IN_SIZE 2048 | 398 | #define USB_CDC_NCM_NTB_MIN_IN_SIZE 2048 |
393 | #define USB_CDC_NCM_NTB_MIN_OUT_SIZE 2048 | 399 | #define USB_CDC_NCM_NTB_MIN_OUT_SIZE 2048 |
394 | 400 | ||
401 | /* NTB Input Size Structure */ | ||
402 | struct usb_cdc_ncm_ndp_input_size { | ||
403 | __le32 dwNtbInMaxSize; | ||
404 | __le16 wNtbInMaxDatagrams; | ||
405 | __le16 wReserved; | ||
406 | } __attribute__ ((packed)); | ||
407 | |||
395 | /* CDC NCM subclass 6.2.11 SetCrcMode */ | 408 | /* CDC NCM subclass 6.2.11 SetCrcMode */ |
396 | #define USB_CDC_NCM_CRC_NOT_APPENDED 0x00 | 409 | #define USB_CDC_NCM_CRC_NOT_APPENDED 0x00 |
397 | #define USB_CDC_NCM_CRC_APPENDED 0x01 | 410 | #define USB_CDC_NCM_CRC_APPENDED 0x01 |
diff --git a/net/batman-adv/unicast.c b/net/batman-adv/unicast.c index cbf022cb3121..bedf29425775 100644 --- a/net/batman-adv/unicast.c +++ b/net/batman-adv/unicast.c | |||
@@ -50,12 +50,12 @@ static struct sk_buff *frag_merge_packet(struct list_head *head, | |||
50 | skb = tfp->skb; | 50 | skb = tfp->skb; |
51 | } | 51 | } |
52 | 52 | ||
53 | if (skb_linearize(skb) < 0 || skb_linearize(tmp_skb) < 0) | ||
54 | goto err; | ||
55 | |||
53 | skb_pull(tmp_skb, sizeof(struct unicast_frag_packet)); | 56 | skb_pull(tmp_skb, sizeof(struct unicast_frag_packet)); |
54 | if (pskb_expand_head(skb, 0, tmp_skb->len, GFP_ATOMIC) < 0) { | 57 | if (pskb_expand_head(skb, 0, tmp_skb->len, GFP_ATOMIC) < 0) |
55 | /* free buffered skb, skb will be freed later */ | 58 | goto err; |
56 | kfree_skb(tfp->skb); | ||
57 | return NULL; | ||
58 | } | ||
59 | 59 | ||
60 | /* move free entry to end */ | 60 | /* move free entry to end */ |
61 | tfp->skb = NULL; | 61 | tfp->skb = NULL; |
@@ -70,6 +70,11 @@ static struct sk_buff *frag_merge_packet(struct list_head *head, | |||
70 | unicast_packet->packet_type = BAT_UNICAST; | 70 | unicast_packet->packet_type = BAT_UNICAST; |
71 | 71 | ||
72 | return skb; | 72 | return skb; |
73 | |||
74 | err: | ||
75 | /* free buffered skb, skb will be freed later */ | ||
76 | kfree_skb(tfp->skb); | ||
77 | return NULL; | ||
73 | } | 78 | } |
74 | 79 | ||
75 | static void frag_create_entry(struct list_head *head, struct sk_buff *skb) | 80 | static void frag_create_entry(struct list_head *head, struct sk_buff *skb) |
diff --git a/net/caif/chnl_net.c b/net/caif/chnl_net.c index fa9dab372b68..6008d6dc18a0 100644 --- a/net/caif/chnl_net.c +++ b/net/caif/chnl_net.c | |||
@@ -394,9 +394,7 @@ static void ipcaif_net_setup(struct net_device *dev) | |||
394 | priv->conn_req.sockaddr.u.dgm.connection_id = -1; | 394 | priv->conn_req.sockaddr.u.dgm.connection_id = -1; |
395 | priv->flowenabled = false; | 395 | priv->flowenabled = false; |
396 | 396 | ||
397 | ASSERT_RTNL(); | ||
398 | init_waitqueue_head(&priv->netmgmt_wq); | 397 | init_waitqueue_head(&priv->netmgmt_wq); |
399 | list_add(&priv->list_field, &chnl_net_list); | ||
400 | } | 398 | } |
401 | 399 | ||
402 | 400 | ||
@@ -453,6 +451,8 @@ static int ipcaif_newlink(struct net *src_net, struct net_device *dev, | |||
453 | ret = register_netdevice(dev); | 451 | ret = register_netdevice(dev); |
454 | if (ret) | 452 | if (ret) |
455 | pr_warn("device rtml registration failed\n"); | 453 | pr_warn("device rtml registration failed\n"); |
454 | else | ||
455 | list_add(&caifdev->list_field, &chnl_net_list); | ||
456 | return ret; | 456 | return ret; |
457 | } | 457 | } |
458 | 458 | ||
diff --git a/net/core/dev.c b/net/core/dev.c index f46ee357ff2e..6392ea0a5910 100644 --- a/net/core/dev.c +++ b/net/core/dev.c | |||
@@ -5807,31 +5807,36 @@ struct net_device *alloc_netdev_mqs(int sizeof_priv, const char *name, | |||
5807 | 5807 | ||
5808 | dev_net_set(dev, &init_net); | 5808 | dev_net_set(dev, &init_net); |
5809 | 5809 | ||
5810 | dev->gso_max_size = GSO_MAX_SIZE; | ||
5811 | |||
5812 | INIT_LIST_HEAD(&dev->ethtool_ntuple_list.list); | ||
5813 | dev->ethtool_ntuple_list.count = 0; | ||
5814 | INIT_LIST_HEAD(&dev->napi_list); | ||
5815 | INIT_LIST_HEAD(&dev->unreg_list); | ||
5816 | INIT_LIST_HEAD(&dev->link_watch_list); | ||
5817 | dev->priv_flags = IFF_XMIT_DST_RELEASE; | ||
5818 | setup(dev); | ||
5819 | |||
5810 | dev->num_tx_queues = txqs; | 5820 | dev->num_tx_queues = txqs; |
5811 | dev->real_num_tx_queues = txqs; | 5821 | dev->real_num_tx_queues = txqs; |
5812 | if (netif_alloc_netdev_queues(dev)) | 5822 | if (netif_alloc_netdev_queues(dev)) |
5813 | goto free_pcpu; | 5823 | goto free_all; |
5814 | 5824 | ||
5815 | #ifdef CONFIG_RPS | 5825 | #ifdef CONFIG_RPS |
5816 | dev->num_rx_queues = rxqs; | 5826 | dev->num_rx_queues = rxqs; |
5817 | dev->real_num_rx_queues = rxqs; | 5827 | dev->real_num_rx_queues = rxqs; |
5818 | if (netif_alloc_rx_queues(dev)) | 5828 | if (netif_alloc_rx_queues(dev)) |
5819 | goto free_pcpu; | 5829 | goto free_all; |
5820 | #endif | 5830 | #endif |
5821 | 5831 | ||
5822 | dev->gso_max_size = GSO_MAX_SIZE; | ||
5823 | |||
5824 | INIT_LIST_HEAD(&dev->ethtool_ntuple_list.list); | ||
5825 | dev->ethtool_ntuple_list.count = 0; | ||
5826 | INIT_LIST_HEAD(&dev->napi_list); | ||
5827 | INIT_LIST_HEAD(&dev->unreg_list); | ||
5828 | INIT_LIST_HEAD(&dev->link_watch_list); | ||
5829 | dev->priv_flags = IFF_XMIT_DST_RELEASE; | ||
5830 | setup(dev); | ||
5831 | strcpy(dev->name, name); | 5832 | strcpy(dev->name, name); |
5832 | dev->group = INIT_NETDEV_GROUP; | 5833 | dev->group = INIT_NETDEV_GROUP; |
5833 | return dev; | 5834 | return dev; |
5834 | 5835 | ||
5836 | free_all: | ||
5837 | free_netdev(dev); | ||
5838 | return NULL; | ||
5839 | |||
5835 | free_pcpu: | 5840 | free_pcpu: |
5836 | free_percpu(dev->pcpu_refcnt); | 5841 | free_percpu(dev->pcpu_refcnt); |
5837 | kfree(dev->_tx); | 5842 | kfree(dev->_tx); |
diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c index 845c76d58d25..2ba3af850dda 100644 --- a/net/mac80211/cfg.c +++ b/net/mac80211/cfg.c | |||
@@ -1838,6 +1838,7 @@ static int ieee80211_mgmt_tx(struct wiphy *wiphy, struct net_device *dev, | |||
1838 | *cookie ^= 2; | 1838 | *cookie ^= 2; |
1839 | IEEE80211_SKB_CB(skb)->flags |= IEEE80211_TX_CTL_TX_OFFCHAN; | 1839 | IEEE80211_SKB_CB(skb)->flags |= IEEE80211_TX_CTL_TX_OFFCHAN; |
1840 | local->hw_roc_skb = skb; | 1840 | local->hw_roc_skb = skb; |
1841 | local->hw_roc_skb_for_status = skb; | ||
1841 | mutex_unlock(&local->mtx); | 1842 | mutex_unlock(&local->mtx); |
1842 | 1843 | ||
1843 | return 0; | 1844 | return 0; |
@@ -1891,6 +1892,7 @@ static int ieee80211_mgmt_tx_cancel_wait(struct wiphy *wiphy, | |||
1891 | if (ret == 0) { | 1892 | if (ret == 0) { |
1892 | kfree_skb(local->hw_roc_skb); | 1893 | kfree_skb(local->hw_roc_skb); |
1893 | local->hw_roc_skb = NULL; | 1894 | local->hw_roc_skb = NULL; |
1895 | local->hw_roc_skb_for_status = NULL; | ||
1894 | } | 1896 | } |
1895 | 1897 | ||
1896 | mutex_unlock(&local->mtx); | 1898 | mutex_unlock(&local->mtx); |
diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h index 44eea1af1553..f2ef15d910a5 100644 --- a/net/mac80211/ieee80211_i.h +++ b/net/mac80211/ieee80211_i.h | |||
@@ -951,7 +951,7 @@ struct ieee80211_local { | |||
951 | 951 | ||
952 | struct ieee80211_channel *hw_roc_channel; | 952 | struct ieee80211_channel *hw_roc_channel; |
953 | struct net_device *hw_roc_dev; | 953 | struct net_device *hw_roc_dev; |
954 | struct sk_buff *hw_roc_skb; | 954 | struct sk_buff *hw_roc_skb, *hw_roc_skb_for_status; |
955 | struct work_struct hw_roc_start, hw_roc_done; | 955 | struct work_struct hw_roc_start, hw_roc_done; |
956 | enum nl80211_channel_type hw_roc_channel_type; | 956 | enum nl80211_channel_type hw_roc_channel_type; |
957 | unsigned int hw_roc_duration; | 957 | unsigned int hw_roc_duration; |
diff --git a/net/mac80211/status.c b/net/mac80211/status.c index ffb0de9bc2fa..010a559bd872 100644 --- a/net/mac80211/status.c +++ b/net/mac80211/status.c | |||
@@ -327,6 +327,7 @@ void ieee80211_tx_status(struct ieee80211_hw *hw, struct sk_buff *skb) | |||
327 | 327 | ||
328 | if (info->flags & IEEE80211_TX_INTFL_NL80211_FRAME_TX) { | 328 | if (info->flags & IEEE80211_TX_INTFL_NL80211_FRAME_TX) { |
329 | struct ieee80211_work *wk; | 329 | struct ieee80211_work *wk; |
330 | u64 cookie = (unsigned long)skb; | ||
330 | 331 | ||
331 | rcu_read_lock(); | 332 | rcu_read_lock(); |
332 | list_for_each_entry_rcu(wk, &local->work_list, list) { | 333 | list_for_each_entry_rcu(wk, &local->work_list, list) { |
@@ -338,8 +339,12 @@ void ieee80211_tx_status(struct ieee80211_hw *hw, struct sk_buff *skb) | |||
338 | break; | 339 | break; |
339 | } | 340 | } |
340 | rcu_read_unlock(); | 341 | rcu_read_unlock(); |
342 | if (local->hw_roc_skb_for_status == skb) { | ||
343 | cookie = local->hw_roc_cookie ^ 2; | ||
344 | local->hw_roc_skb_for_status = NULL; | ||
345 | } | ||
341 | cfg80211_mgmt_tx_status( | 346 | cfg80211_mgmt_tx_status( |
342 | skb->dev, (unsigned long) skb, skb->data, skb->len, | 347 | skb->dev, cookie, skb->data, skb->len, |
343 | !!(info->flags & IEEE80211_TX_STAT_ACK), GFP_ATOMIC); | 348 | !!(info->flags & IEEE80211_TX_STAT_ACK), GFP_ATOMIC); |
344 | } | 349 | } |
345 | 350 | ||
diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c index 38e593939727..17ef4f4e8602 100644 --- a/net/mac80211/tx.c +++ b/net/mac80211/tx.c | |||
@@ -1549,7 +1549,7 @@ static int ieee80211_skb_resize(struct ieee80211_local *local, | |||
1549 | skb_orphan(skb); | 1549 | skb_orphan(skb); |
1550 | } | 1550 | } |
1551 | 1551 | ||
1552 | if (skb_header_cloned(skb)) | 1552 | if (skb_cloned(skb)) |
1553 | I802_DEBUG_INC(local->tx_expand_skb_head_cloned); | 1553 | I802_DEBUG_INC(local->tx_expand_skb_head_cloned); |
1554 | else if (head_need || tail_need) | 1554 | else if (head_need || tail_need) |
1555 | I802_DEBUG_INC(local->tx_expand_skb_head); | 1555 | I802_DEBUG_INC(local->tx_expand_skb_head); |
diff --git a/net/x25/x25_facilities.c b/net/x25/x25_facilities.c index 55187c8f6420..406207515b5e 100644 --- a/net/x25/x25_facilities.c +++ b/net/x25/x25_facilities.c | |||
@@ -27,9 +27,19 @@ | |||
27 | #include <net/sock.h> | 27 | #include <net/sock.h> |
28 | #include <net/x25.h> | 28 | #include <net/x25.h> |
29 | 29 | ||
30 | /* | 30 | /** |
31 | * Parse a set of facilities into the facilities structures. Unrecognised | 31 | * x25_parse_facilities - Parse facilities from skb into the facilities structs |
32 | * facilities are written to the debug log file. | 32 | * |
33 | * @skb: sk_buff to parse | ||
34 | * @facilities: Regular facilites, updated as facilities are found | ||
35 | * @dte_facs: ITU DTE facilities, updated as DTE facilities are found | ||
36 | * @vc_fac_mask: mask is updated with all facilities found | ||
37 | * | ||
38 | * Return codes: | ||
39 | * -1 - Parsing error, caller should drop call and clean up | ||
40 | * 0 - Parse OK, this skb has no facilities | ||
41 | * >0 - Parse OK, returns the length of the facilities header | ||
42 | * | ||
33 | */ | 43 | */ |
34 | int x25_parse_facilities(struct sk_buff *skb, struct x25_facilities *facilities, | 44 | int x25_parse_facilities(struct sk_buff *skb, struct x25_facilities *facilities, |
35 | struct x25_dte_facilities *dte_facs, unsigned long *vc_fac_mask) | 45 | struct x25_dte_facilities *dte_facs, unsigned long *vc_fac_mask) |
@@ -62,7 +72,7 @@ int x25_parse_facilities(struct sk_buff *skb, struct x25_facilities *facilities, | |||
62 | switch (*p & X25_FAC_CLASS_MASK) { | 72 | switch (*p & X25_FAC_CLASS_MASK) { |
63 | case X25_FAC_CLASS_A: | 73 | case X25_FAC_CLASS_A: |
64 | if (len < 2) | 74 | if (len < 2) |
65 | return 0; | 75 | return -1; |
66 | switch (*p) { | 76 | switch (*p) { |
67 | case X25_FAC_REVERSE: | 77 | case X25_FAC_REVERSE: |
68 | if((p[1] & 0x81) == 0x81) { | 78 | if((p[1] & 0x81) == 0x81) { |
@@ -107,7 +117,7 @@ int x25_parse_facilities(struct sk_buff *skb, struct x25_facilities *facilities, | |||
107 | break; | 117 | break; |
108 | case X25_FAC_CLASS_B: | 118 | case X25_FAC_CLASS_B: |
109 | if (len < 3) | 119 | if (len < 3) |
110 | return 0; | 120 | return -1; |
111 | switch (*p) { | 121 | switch (*p) { |
112 | case X25_FAC_PACKET_SIZE: | 122 | case X25_FAC_PACKET_SIZE: |
113 | facilities->pacsize_in = p[1]; | 123 | facilities->pacsize_in = p[1]; |
@@ -130,7 +140,7 @@ int x25_parse_facilities(struct sk_buff *skb, struct x25_facilities *facilities, | |||
130 | break; | 140 | break; |
131 | case X25_FAC_CLASS_C: | 141 | case X25_FAC_CLASS_C: |
132 | if (len < 4) | 142 | if (len < 4) |
133 | return 0; | 143 | return -1; |
134 | printk(KERN_DEBUG "X.25: unknown facility %02X, " | 144 | printk(KERN_DEBUG "X.25: unknown facility %02X, " |
135 | "values %02X, %02X, %02X\n", | 145 | "values %02X, %02X, %02X\n", |
136 | p[0], p[1], p[2], p[3]); | 146 | p[0], p[1], p[2], p[3]); |
@@ -139,18 +149,18 @@ int x25_parse_facilities(struct sk_buff *skb, struct x25_facilities *facilities, | |||
139 | break; | 149 | break; |
140 | case X25_FAC_CLASS_D: | 150 | case X25_FAC_CLASS_D: |
141 | if (len < p[1] + 2) | 151 | if (len < p[1] + 2) |
142 | return 0; | 152 | return -1; |
143 | switch (*p) { | 153 | switch (*p) { |
144 | case X25_FAC_CALLING_AE: | 154 | case X25_FAC_CALLING_AE: |
145 | if (p[1] > X25_MAX_DTE_FACIL_LEN || p[1] <= 1) | 155 | if (p[1] > X25_MAX_DTE_FACIL_LEN || p[1] <= 1) |
146 | return 0; | 156 | return -1; |
147 | dte_facs->calling_len = p[2]; | 157 | dte_facs->calling_len = p[2]; |
148 | memcpy(dte_facs->calling_ae, &p[3], p[1] - 1); | 158 | memcpy(dte_facs->calling_ae, &p[3], p[1] - 1); |
149 | *vc_fac_mask |= X25_MASK_CALLING_AE; | 159 | *vc_fac_mask |= X25_MASK_CALLING_AE; |
150 | break; | 160 | break; |
151 | case X25_FAC_CALLED_AE: | 161 | case X25_FAC_CALLED_AE: |
152 | if (p[1] > X25_MAX_DTE_FACIL_LEN || p[1] <= 1) | 162 | if (p[1] > X25_MAX_DTE_FACIL_LEN || p[1] <= 1) |
153 | return 0; | 163 | return -1; |
154 | dte_facs->called_len = p[2]; | 164 | dte_facs->called_len = p[2]; |
155 | memcpy(dte_facs->called_ae, &p[3], p[1] - 1); | 165 | memcpy(dte_facs->called_ae, &p[3], p[1] - 1); |
156 | *vc_fac_mask |= X25_MASK_CALLED_AE; | 166 | *vc_fac_mask |= X25_MASK_CALLED_AE; |
diff --git a/net/x25/x25_in.c b/net/x25/x25_in.c index f729f022be69..15de65f04719 100644 --- a/net/x25/x25_in.c +++ b/net/x25/x25_in.c | |||
@@ -91,10 +91,10 @@ static int x25_state1_machine(struct sock *sk, struct sk_buff *skb, int frametyp | |||
91 | { | 91 | { |
92 | struct x25_address source_addr, dest_addr; | 92 | struct x25_address source_addr, dest_addr; |
93 | int len; | 93 | int len; |
94 | struct x25_sock *x25 = x25_sk(sk); | ||
94 | 95 | ||
95 | switch (frametype) { | 96 | switch (frametype) { |
96 | case X25_CALL_ACCEPTED: { | 97 | case X25_CALL_ACCEPTED: { |
97 | struct x25_sock *x25 = x25_sk(sk); | ||
98 | 98 | ||
99 | x25_stop_timer(sk); | 99 | x25_stop_timer(sk); |
100 | x25->condition = 0x00; | 100 | x25->condition = 0x00; |
@@ -113,14 +113,16 @@ static int x25_state1_machine(struct sock *sk, struct sk_buff *skb, int frametyp | |||
113 | &dest_addr); | 113 | &dest_addr); |
114 | if (len > 0) | 114 | if (len > 0) |
115 | skb_pull(skb, len); | 115 | skb_pull(skb, len); |
116 | else if (len < 0) | ||
117 | goto out_clear; | ||
116 | 118 | ||
117 | len = x25_parse_facilities(skb, &x25->facilities, | 119 | len = x25_parse_facilities(skb, &x25->facilities, |
118 | &x25->dte_facilities, | 120 | &x25->dte_facilities, |
119 | &x25->vc_facil_mask); | 121 | &x25->vc_facil_mask); |
120 | if (len > 0) | 122 | if (len > 0) |
121 | skb_pull(skb, len); | 123 | skb_pull(skb, len); |
122 | else | 124 | else if (len < 0) |
123 | return -1; | 125 | goto out_clear; |
124 | /* | 126 | /* |
125 | * Copy any Call User Data. | 127 | * Copy any Call User Data. |
126 | */ | 128 | */ |
@@ -144,6 +146,12 @@ static int x25_state1_machine(struct sock *sk, struct sk_buff *skb, int frametyp | |||
144 | } | 146 | } |
145 | 147 | ||
146 | return 0; | 148 | return 0; |
149 | |||
150 | out_clear: | ||
151 | x25_write_internal(sk, X25_CLEAR_REQUEST); | ||
152 | x25->state = X25_STATE_2; | ||
153 | x25_start_t23timer(sk); | ||
154 | return 0; | ||
147 | } | 155 | } |
148 | 156 | ||
149 | /* | 157 | /* |