aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'drivers')
-rw-r--r--drivers/atm/iphase.c2
-rw-r--r--drivers/net/bonding/bond_main.c73
-rw-r--r--drivers/net/dsa/mt7530.c2
-rw-r--r--drivers/net/ethernet/marvell/mvneta.c1
-rw-r--r--drivers/net/ethernet/mellanox/mlx4/en_dcb_nl.c72
-rw-r--r--drivers/net/ethernet/mellanox/mlx4/en_ethtool.c33
-rw-r--r--drivers/net/ethernet/mellanox/mlx4/en_main.c4
-rw-r--r--drivers/net/ethernet/mellanox/mlx4/resource_tracker.c1
-rw-r--r--drivers/net/ethernet/mellanox/mlx5/core/Kconfig2
-rw-r--r--drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c17
-rw-r--r--drivers/net/ethernet/mellanox/mlx5/core/en_main.c13
-rw-r--r--drivers/net/ethernet/mellanox/mlx5/core/en_rep.c34
-rw-r--r--drivers/net/ethernet/mellanox/mlx5/core/en_tc.c18
-rw-r--r--drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c78
-rw-r--r--drivers/net/ethernet/netronome/nfp/bpf/jit.c6
-rw-r--r--drivers/net/ethernet/qlogic/qede/qede_fp.c20
-rw-r--r--drivers/net/ethernet/realtek/r8169.c4
-rw-r--r--drivers/net/hyperv/rndis_filter.c2
-rw-r--r--drivers/net/team/team.c12
-rw-r--r--drivers/net/usb/lan78xx.c33
-rw-r--r--drivers/net/usb/qmi_wwan.c5
-rw-r--r--drivers/net/vrf.c5
-rw-r--r--drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c2
-rw-r--r--drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c5
-rw-r--r--drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.h1
-rw-r--r--drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c57
-rw-r--r--drivers/net/wireless/intel/iwlwifi/cfg/9000.c62
-rw-r--r--drivers/net/wireless/intel/iwlwifi/fw/file.h1
-rw-r--r--drivers/net/wireless/intel/iwlwifi/iwl-config.h5
-rw-r--r--drivers/net/wireless/intel/iwlwifi/mvm/fw.c4
-rw-r--r--drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c9
-rw-r--r--drivers/net/wireless/intel/iwlwifi/mvm/mvm.h3
-rw-r--r--drivers/net/wireless/intel/iwlwifi/mvm/phy-ctxt.c21
-rw-r--r--drivers/net/wireless/intel/iwlwifi/mvm/sta.c74
-rw-r--r--drivers/net/wireless/intel/iwlwifi/mvm/time-event.c15
-rw-r--r--drivers/net/wireless/intel/iwlwifi/mvm/tx.c10
-rw-r--r--drivers/net/wireless/intel/iwlwifi/pcie/drv.c38
-rw-r--r--drivers/vhost/net.c4
-rw-r--r--drivers/vhost/vhost.c17
39 files changed, 497 insertions, 268 deletions
diff --git a/drivers/atm/iphase.c b/drivers/atm/iphase.c
index 98a3a43484c8..44abb8a0a5e5 100644
--- a/drivers/atm/iphase.c
+++ b/drivers/atm/iphase.c
@@ -3147,7 +3147,7 @@ static int ia_proc_read(struct atm_dev *dev,loff_t *pos,char *page)
3147 " Size of Tx Buffer : %u\n" 3147 " Size of Tx Buffer : %u\n"
3148 " Number of Rx Buffer: %u\n" 3148 " Number of Rx Buffer: %u\n"
3149 " Size of Rx Buffer : %u\n" 3149 " Size of Rx Buffer : %u\n"
3150 " Packets Receiverd : %u\n" 3150 " Packets Received : %u\n"
3151 " Packets Transmitted: %u\n" 3151 " Packets Transmitted: %u\n"
3152 " Cells Received : %u\n" 3152 " Cells Received : %u\n"
3153 " Cells Transmitted : %u\n" 3153 " Cells Transmitted : %u\n"
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
index c669554d70bb..b7b113018853 100644
--- a/drivers/net/bonding/bond_main.c
+++ b/drivers/net/bonding/bond_main.c
@@ -1528,39 +1528,6 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev,
1528 goto err_close; 1528 goto err_close;
1529 } 1529 }
1530 1530
1531 /* If the mode uses primary, then the following is handled by
1532 * bond_change_active_slave().
1533 */
1534 if (!bond_uses_primary(bond)) {
1535 /* set promiscuity level to new slave */
1536 if (bond_dev->flags & IFF_PROMISC) {
1537 res = dev_set_promiscuity(slave_dev, 1);
1538 if (res)
1539 goto err_close;
1540 }
1541
1542 /* set allmulti level to new slave */
1543 if (bond_dev->flags & IFF_ALLMULTI) {
1544 res = dev_set_allmulti(slave_dev, 1);
1545 if (res)
1546 goto err_close;
1547 }
1548
1549 netif_addr_lock_bh(bond_dev);
1550
1551 dev_mc_sync_multiple(slave_dev, bond_dev);
1552 dev_uc_sync_multiple(slave_dev, bond_dev);
1553
1554 netif_addr_unlock_bh(bond_dev);
1555 }
1556
1557 if (BOND_MODE(bond) == BOND_MODE_8023AD) {
1558 /* add lacpdu mc addr to mc list */
1559 u8 lacpdu_multicast[ETH_ALEN] = MULTICAST_LACPDU_ADDR;
1560
1561 dev_mc_add(slave_dev, lacpdu_multicast);
1562 }
1563
1564 res = vlan_vids_add_by_dev(slave_dev, bond_dev); 1531 res = vlan_vids_add_by_dev(slave_dev, bond_dev);
1565 if (res) { 1532 if (res) {
1566 netdev_err(bond_dev, "Couldn't add bond vlan ids to %s\n", 1533 netdev_err(bond_dev, "Couldn't add bond vlan ids to %s\n",
@@ -1725,6 +1692,40 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev,
1725 goto err_upper_unlink; 1692 goto err_upper_unlink;
1726 } 1693 }
1727 1694
1695 /* If the mode uses primary, then the following is handled by
1696 * bond_change_active_slave().
1697 */
1698 if (!bond_uses_primary(bond)) {
1699 /* set promiscuity level to new slave */
1700 if (bond_dev->flags & IFF_PROMISC) {
1701 res = dev_set_promiscuity(slave_dev, 1);
1702 if (res)
1703 goto err_sysfs_del;
1704 }
1705
1706 /* set allmulti level to new slave */
1707 if (bond_dev->flags & IFF_ALLMULTI) {
1708 res = dev_set_allmulti(slave_dev, 1);
1709 if (res) {
1710 if (bond_dev->flags & IFF_PROMISC)
1711 dev_set_promiscuity(slave_dev, -1);
1712 goto err_sysfs_del;
1713 }
1714 }
1715
1716 netif_addr_lock_bh(bond_dev);
1717 dev_mc_sync_multiple(slave_dev, bond_dev);
1718 dev_uc_sync_multiple(slave_dev, bond_dev);
1719 netif_addr_unlock_bh(bond_dev);
1720
1721 if (BOND_MODE(bond) == BOND_MODE_8023AD) {
1722 /* add lacpdu mc addr to mc list */
1723 u8 lacpdu_multicast[ETH_ALEN] = MULTICAST_LACPDU_ADDR;
1724
1725 dev_mc_add(slave_dev, lacpdu_multicast);
1726 }
1727 }
1728
1728 bond->slave_cnt++; 1729 bond->slave_cnt++;
1729 bond_compute_features(bond); 1730 bond_compute_features(bond);
1730 bond_set_carrier(bond); 1731 bond_set_carrier(bond);
@@ -1748,6 +1749,9 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev,
1748 return 0; 1749 return 0;
1749 1750
1750/* Undo stages on error */ 1751/* Undo stages on error */
1752err_sysfs_del:
1753 bond_sysfs_slave_del(new_slave);
1754
1751err_upper_unlink: 1755err_upper_unlink:
1752 bond_upper_dev_unlink(bond, new_slave); 1756 bond_upper_dev_unlink(bond, new_slave);
1753 1757
@@ -1755,9 +1759,6 @@ err_unregister:
1755 netdev_rx_handler_unregister(slave_dev); 1759 netdev_rx_handler_unregister(slave_dev);
1756 1760
1757err_detach: 1761err_detach:
1758 if (!bond_uses_primary(bond))
1759 bond_hw_addr_flush(bond_dev, slave_dev);
1760
1761 vlan_vids_del_by_dev(slave_dev, bond_dev); 1762 vlan_vids_del_by_dev(slave_dev, bond_dev);
1762 if (rcu_access_pointer(bond->primary_slave) == new_slave) 1763 if (rcu_access_pointer(bond->primary_slave) == new_slave)
1763 RCU_INIT_POINTER(bond->primary_slave, NULL); 1764 RCU_INIT_POINTER(bond->primary_slave, NULL);
diff --git a/drivers/net/dsa/mt7530.c b/drivers/net/dsa/mt7530.c
index 8a0bb000d056..4e53c5ce23ff 100644
--- a/drivers/net/dsa/mt7530.c
+++ b/drivers/net/dsa/mt7530.c
@@ -1409,6 +1409,7 @@ static const struct of_device_id mt7530_of_match[] = {
1409 { .compatible = "mediatek,mt7530" }, 1409 { .compatible = "mediatek,mt7530" },
1410 { /* sentinel */ }, 1410 { /* sentinel */ },
1411}; 1411};
1412MODULE_DEVICE_TABLE(of, mt7530_of_match);
1412 1413
1413static struct mdio_driver mt7530_mdio_driver = { 1414static struct mdio_driver mt7530_mdio_driver = {
1414 .probe = mt7530_probe, 1415 .probe = mt7530_probe,
@@ -1424,4 +1425,3 @@ mdio_module_driver(mt7530_mdio_driver);
1424MODULE_AUTHOR("Sean Wang <sean.wang@mediatek.com>"); 1425MODULE_AUTHOR("Sean Wang <sean.wang@mediatek.com>");
1425MODULE_DESCRIPTION("Driver for Mediatek MT7530 Switch"); 1426MODULE_DESCRIPTION("Driver for Mediatek MT7530 Switch");
1426MODULE_LICENSE("GPL"); 1427MODULE_LICENSE("GPL");
1427MODULE_ALIAS("platform:mediatek-mt7530");
diff --git a/drivers/net/ethernet/marvell/mvneta.c b/drivers/net/ethernet/marvell/mvneta.c
index 25e9a551cc8c..3f6fb635738c 100644
--- a/drivers/net/ethernet/marvell/mvneta.c
+++ b/drivers/net/ethernet/marvell/mvneta.c
@@ -1132,6 +1132,7 @@ static void mvneta_port_up(struct mvneta_port *pp)
1132 } 1132 }
1133 mvreg_write(pp, MVNETA_TXQ_CMD, q_map); 1133 mvreg_write(pp, MVNETA_TXQ_CMD, q_map);
1134 1134
1135 q_map = 0;
1135 /* Enable all initialized RXQs. */ 1136 /* Enable all initialized RXQs. */
1136 for (queue = 0; queue < rxq_number; queue++) { 1137 for (queue = 0; queue < rxq_number; queue++) {
1137 struct mvneta_rx_queue *rxq = &pp->rxqs[queue]; 1138 struct mvneta_rx_queue *rxq = &pp->rxqs[queue];
diff --git a/drivers/net/ethernet/mellanox/mlx4/en_dcb_nl.c b/drivers/net/ethernet/mellanox/mlx4/en_dcb_nl.c
index 1a0c3bf86ead..752a72499b4f 100644
--- a/drivers/net/ethernet/mellanox/mlx4/en_dcb_nl.c
+++ b/drivers/net/ethernet/mellanox/mlx4/en_dcb_nl.c
@@ -156,57 +156,63 @@ static int mlx4_en_dcbnl_getnumtcs(struct net_device *netdev, int tcid, u8 *num)
156static u8 mlx4_en_dcbnl_set_all(struct net_device *netdev) 156static u8 mlx4_en_dcbnl_set_all(struct net_device *netdev)
157{ 157{
158 struct mlx4_en_priv *priv = netdev_priv(netdev); 158 struct mlx4_en_priv *priv = netdev_priv(netdev);
159 struct mlx4_en_port_profile *prof = priv->prof;
159 struct mlx4_en_dev *mdev = priv->mdev; 160 struct mlx4_en_dev *mdev = priv->mdev;
161 u8 tx_pause, tx_ppp, rx_pause, rx_ppp;
160 162
161 if (!(priv->dcbx_cap & DCB_CAP_DCBX_VER_CEE)) 163 if (!(priv->dcbx_cap & DCB_CAP_DCBX_VER_CEE))
162 return 1; 164 return 1;
163 165
164 if (priv->cee_config.pfc_state) { 166 if (priv->cee_config.pfc_state) {
165 int tc; 167 int tc;
168 rx_ppp = prof->rx_ppp;
169 tx_ppp = prof->tx_ppp;
166 170
167 priv->prof->rx_pause = 0;
168 priv->prof->tx_pause = 0;
169 for (tc = 0; tc < CEE_DCBX_MAX_PRIO; tc++) { 171 for (tc = 0; tc < CEE_DCBX_MAX_PRIO; tc++) {
170 u8 tc_mask = 1 << tc; 172 u8 tc_mask = 1 << tc;
171 173
172 switch (priv->cee_config.dcb_pfc[tc]) { 174 switch (priv->cee_config.dcb_pfc[tc]) {
173 case pfc_disabled: 175 case pfc_disabled:
174 priv->prof->tx_ppp &= ~tc_mask; 176 tx_ppp &= ~tc_mask;
175 priv->prof->rx_ppp &= ~tc_mask; 177 rx_ppp &= ~tc_mask;
176 break; 178 break;
177 case pfc_enabled_full: 179 case pfc_enabled_full:
178 priv->prof->tx_ppp |= tc_mask; 180 tx_ppp |= tc_mask;
179 priv->prof->rx_ppp |= tc_mask; 181 rx_ppp |= tc_mask;
180 break; 182 break;
181 case pfc_enabled_tx: 183 case pfc_enabled_tx:
182 priv->prof->tx_ppp |= tc_mask; 184 tx_ppp |= tc_mask;
183 priv->prof->rx_ppp &= ~tc_mask; 185 rx_ppp &= ~tc_mask;
184 break; 186 break;
185 case pfc_enabled_rx: 187 case pfc_enabled_rx:
186 priv->prof->tx_ppp &= ~tc_mask; 188 tx_ppp &= ~tc_mask;
187 priv->prof->rx_ppp |= tc_mask; 189 rx_ppp |= tc_mask;
188 break; 190 break;
189 default: 191 default:
190 break; 192 break;
191 } 193 }
192 } 194 }
193 en_dbg(DRV, priv, "Set pfc on\n"); 195 rx_pause = !!(rx_ppp || tx_ppp) ? 0 : prof->rx_pause;
196 tx_pause = !!(rx_ppp || tx_ppp) ? 0 : prof->tx_pause;
194 } else { 197 } else {
195 priv->prof->rx_pause = 1; 198 rx_ppp = 0;
196 priv->prof->tx_pause = 1; 199 tx_ppp = 0;
197 en_dbg(DRV, priv, "Set pfc off\n"); 200 rx_pause = prof->rx_pause;
201 tx_pause = prof->tx_pause;
198 } 202 }
199 203
200 if (mlx4_SET_PORT_general(mdev->dev, priv->port, 204 if (mlx4_SET_PORT_general(mdev->dev, priv->port,
201 priv->rx_skb_size + ETH_FCS_LEN, 205 priv->rx_skb_size + ETH_FCS_LEN,
202 priv->prof->tx_pause, 206 tx_pause, tx_ppp, rx_pause, rx_ppp)) {
203 priv->prof->tx_ppp,
204 priv->prof->rx_pause,
205 priv->prof->rx_ppp)) {
206 en_err(priv, "Failed setting pause params\n"); 207 en_err(priv, "Failed setting pause params\n");
207 return 1; 208 return 1;
208 } 209 }
209 210
211 prof->tx_ppp = tx_ppp;
212 prof->rx_ppp = rx_ppp;
213 prof->tx_pause = tx_pause;
214 prof->rx_pause = rx_pause;
215
210 return 0; 216 return 0;
211} 217}
212 218
@@ -408,6 +414,7 @@ static int mlx4_en_dcbnl_ieee_setpfc(struct net_device *dev,
408 struct mlx4_en_priv *priv = netdev_priv(dev); 414 struct mlx4_en_priv *priv = netdev_priv(dev);
409 struct mlx4_en_port_profile *prof = priv->prof; 415 struct mlx4_en_port_profile *prof = priv->prof;
410 struct mlx4_en_dev *mdev = priv->mdev; 416 struct mlx4_en_dev *mdev = priv->mdev;
417 u32 tx_pause, tx_ppp, rx_pause, rx_ppp;
411 int err; 418 int err;
412 419
413 en_dbg(DRV, priv, "cap: 0x%x en: 0x%x mbc: 0x%x delay: %d\n", 420 en_dbg(DRV, priv, "cap: 0x%x en: 0x%x mbc: 0x%x delay: %d\n",
@@ -416,23 +423,26 @@ static int mlx4_en_dcbnl_ieee_setpfc(struct net_device *dev,
416 pfc->mbc, 423 pfc->mbc,
417 pfc->delay); 424 pfc->delay);
418 425
419 prof->rx_pause = !pfc->pfc_en; 426 rx_pause = prof->rx_pause && !pfc->pfc_en;
420 prof->tx_pause = !pfc->pfc_en; 427 tx_pause = prof->tx_pause && !pfc->pfc_en;
421 prof->rx_ppp = pfc->pfc_en; 428 rx_ppp = pfc->pfc_en;
422 prof->tx_ppp = pfc->pfc_en; 429 tx_ppp = pfc->pfc_en;
423 430
424 err = mlx4_SET_PORT_general(mdev->dev, priv->port, 431 err = mlx4_SET_PORT_general(mdev->dev, priv->port,
425 priv->rx_skb_size + ETH_FCS_LEN, 432 priv->rx_skb_size + ETH_FCS_LEN,
426 prof->tx_pause, 433 tx_pause, tx_ppp, rx_pause, rx_ppp);
427 prof->tx_ppp, 434 if (err) {
428 prof->rx_pause,
429 prof->rx_ppp);
430 if (err)
431 en_err(priv, "Failed setting pause params\n"); 435 en_err(priv, "Failed setting pause params\n");
432 else 436 return err;
433 mlx4_en_update_pfc_stats_bitmap(mdev->dev, &priv->stats_bitmap, 437 }
434 prof->rx_ppp, prof->rx_pause, 438
435 prof->tx_ppp, prof->tx_pause); 439 mlx4_en_update_pfc_stats_bitmap(mdev->dev, &priv->stats_bitmap,
440 rx_ppp, rx_pause, tx_ppp, tx_pause);
441
442 prof->tx_ppp = tx_ppp;
443 prof->rx_ppp = rx_ppp;
444 prof->rx_pause = rx_pause;
445 prof->tx_pause = tx_pause;
436 446
437 return err; 447 return err;
438} 448}
diff --git a/drivers/net/ethernet/mellanox/mlx4/en_ethtool.c b/drivers/net/ethernet/mellanox/mlx4/en_ethtool.c
index ebc1f566a4d9..f3302edba8b4 100644
--- a/drivers/net/ethernet/mellanox/mlx4/en_ethtool.c
+++ b/drivers/net/ethernet/mellanox/mlx4/en_ethtool.c
@@ -1046,27 +1046,32 @@ static int mlx4_en_set_pauseparam(struct net_device *dev,
1046{ 1046{
1047 struct mlx4_en_priv *priv = netdev_priv(dev); 1047 struct mlx4_en_priv *priv = netdev_priv(dev);
1048 struct mlx4_en_dev *mdev = priv->mdev; 1048 struct mlx4_en_dev *mdev = priv->mdev;
1049 u8 tx_pause, tx_ppp, rx_pause, rx_ppp;
1049 int err; 1050 int err;
1050 1051
1051 if (pause->autoneg) 1052 if (pause->autoneg)
1052 return -EINVAL; 1053 return -EINVAL;
1053 1054
1054 priv->prof->tx_pause = pause->tx_pause != 0; 1055 tx_pause = !!(pause->tx_pause);
1055 priv->prof->rx_pause = pause->rx_pause != 0; 1056 rx_pause = !!(pause->rx_pause);
1057 rx_ppp = priv->prof->rx_ppp && !(tx_pause || rx_pause);
1058 tx_ppp = priv->prof->tx_ppp && !(tx_pause || rx_pause);
1059
1056 err = mlx4_SET_PORT_general(mdev->dev, priv->port, 1060 err = mlx4_SET_PORT_general(mdev->dev, priv->port,
1057 priv->rx_skb_size + ETH_FCS_LEN, 1061 priv->rx_skb_size + ETH_FCS_LEN,
1058 priv->prof->tx_pause, 1062 tx_pause, tx_ppp, rx_pause, rx_ppp);
1059 priv->prof->tx_ppp, 1063 if (err) {
1060 priv->prof->rx_pause, 1064 en_err(priv, "Failed setting pause params, err = %d\n", err);
1061 priv->prof->rx_ppp); 1065 return err;
1062 if (err) 1066 }
1063 en_err(priv, "Failed setting pause params\n"); 1067
1064 else 1068 mlx4_en_update_pfc_stats_bitmap(mdev->dev, &priv->stats_bitmap,
1065 mlx4_en_update_pfc_stats_bitmap(mdev->dev, &priv->stats_bitmap, 1069 rx_ppp, rx_pause, tx_ppp, tx_pause);
1066 priv->prof->rx_ppp, 1070
1067 priv->prof->rx_pause, 1071 priv->prof->tx_pause = tx_pause;
1068 priv->prof->tx_ppp, 1072 priv->prof->rx_pause = rx_pause;
1069 priv->prof->tx_pause); 1073 priv->prof->tx_ppp = tx_ppp;
1074 priv->prof->rx_ppp = rx_ppp;
1070 1075
1071 return err; 1076 return err;
1072} 1077}
diff --git a/drivers/net/ethernet/mellanox/mlx4/en_main.c b/drivers/net/ethernet/mellanox/mlx4/en_main.c
index 2c2965497ed3..d25e16d2c319 100644
--- a/drivers/net/ethernet/mellanox/mlx4/en_main.c
+++ b/drivers/net/ethernet/mellanox/mlx4/en_main.c
@@ -163,9 +163,9 @@ static void mlx4_en_get_profile(struct mlx4_en_dev *mdev)
163 params->udp_rss = 0; 163 params->udp_rss = 0;
164 } 164 }
165 for (i = 1; i <= MLX4_MAX_PORTS; i++) { 165 for (i = 1; i <= MLX4_MAX_PORTS; i++) {
166 params->prof[i].rx_pause = 1; 166 params->prof[i].rx_pause = !(pfcrx || pfctx);
167 params->prof[i].rx_ppp = pfcrx; 167 params->prof[i].rx_ppp = pfcrx;
168 params->prof[i].tx_pause = 1; 168 params->prof[i].tx_pause = !(pfcrx || pfctx);
169 params->prof[i].tx_ppp = pfctx; 169 params->prof[i].tx_ppp = pfctx;
170 params->prof[i].tx_ring_size = MLX4_EN_DEF_TX_RING_SIZE; 170 params->prof[i].tx_ring_size = MLX4_EN_DEF_TX_RING_SIZE;
171 params->prof[i].rx_ring_size = MLX4_EN_DEF_RX_RING_SIZE; 171 params->prof[i].rx_ring_size = MLX4_EN_DEF_RX_RING_SIZE;
diff --git a/drivers/net/ethernet/mellanox/mlx4/resource_tracker.c b/drivers/net/ethernet/mellanox/mlx4/resource_tracker.c
index 606a0e0beeae..29e50f787349 100644
--- a/drivers/net/ethernet/mellanox/mlx4/resource_tracker.c
+++ b/drivers/net/ethernet/mellanox/mlx4/resource_tracker.c
@@ -5088,6 +5088,7 @@ static void rem_slave_fs_rule(struct mlx4_dev *dev, int slave)
5088 &tracker->res_tree[RES_FS_RULE]); 5088 &tracker->res_tree[RES_FS_RULE]);
5089 list_del(&fs_rule->com.list); 5089 list_del(&fs_rule->com.list);
5090 spin_unlock_irq(mlx4_tlock(dev)); 5090 spin_unlock_irq(mlx4_tlock(dev));
5091 kfree(fs_rule->mirr_mbox);
5091 kfree(fs_rule); 5092 kfree(fs_rule);
5092 state = 0; 5093 state = 0;
5093 break; 5094 break;
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/Kconfig b/drivers/net/ethernet/mellanox/mlx5/core/Kconfig
index 25deaa5a534c..c032319f1cb9 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/Kconfig
+++ b/drivers/net/ethernet/mellanox/mlx5/core/Kconfig
@@ -46,7 +46,7 @@ config MLX5_MPFS
46 46
47config MLX5_ESWITCH 47config MLX5_ESWITCH
48 bool "Mellanox Technologies MLX5 SRIOV E-Switch support" 48 bool "Mellanox Technologies MLX5 SRIOV E-Switch support"
49 depends on MLX5_CORE_EN 49 depends on MLX5_CORE_EN && NET_SWITCHDEV
50 default y 50 default y
51 ---help--- 51 ---help---
52 Mellanox Technologies Ethernet SRIOV E-Switch support in ConnectX NIC. 52 Mellanox Technologies Ethernet SRIOV E-Switch support in ConnectX NIC.
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c b/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c
index cc8048f68f11..59ebfdae6695 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c
@@ -477,6 +477,9 @@ static int mlx5e_get_coalesce(struct net_device *netdev,
477 return mlx5e_ethtool_get_coalesce(priv, coal); 477 return mlx5e_ethtool_get_coalesce(priv, coal);
478} 478}
479 479
480#define MLX5E_MAX_COAL_TIME MLX5_MAX_CQ_PERIOD
481#define MLX5E_MAX_COAL_FRAMES MLX5_MAX_CQ_COUNT
482
480static void 483static void
481mlx5e_set_priv_channels_coalesce(struct mlx5e_priv *priv, struct ethtool_coalesce *coal) 484mlx5e_set_priv_channels_coalesce(struct mlx5e_priv *priv, struct ethtool_coalesce *coal)
482{ 485{
@@ -511,6 +514,20 @@ int mlx5e_ethtool_set_coalesce(struct mlx5e_priv *priv,
511 if (!MLX5_CAP_GEN(mdev, cq_moderation)) 514 if (!MLX5_CAP_GEN(mdev, cq_moderation))
512 return -EOPNOTSUPP; 515 return -EOPNOTSUPP;
513 516
517 if (coal->tx_coalesce_usecs > MLX5E_MAX_COAL_TIME ||
518 coal->rx_coalesce_usecs > MLX5E_MAX_COAL_TIME) {
519 netdev_info(priv->netdev, "%s: maximum coalesce time supported is %lu usecs\n",
520 __func__, MLX5E_MAX_COAL_TIME);
521 return -ERANGE;
522 }
523
524 if (coal->tx_max_coalesced_frames > MLX5E_MAX_COAL_FRAMES ||
525 coal->rx_max_coalesced_frames > MLX5E_MAX_COAL_FRAMES) {
526 netdev_info(priv->netdev, "%s: maximum coalesced frames supported is %lu\n",
527 __func__, MLX5E_MAX_COAL_FRAMES);
528 return -ERANGE;
529 }
530
514 mutex_lock(&priv->state_lock); 531 mutex_lock(&priv->state_lock);
515 new_channels.params = priv->channels.params; 532 new_channels.params = priv->channels.params;
516 533
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
index da94c8cba5ee..9b4827d36e3e 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
@@ -2572,6 +2572,9 @@ int mlx5e_open(struct net_device *netdev)
2572 mlx5_set_port_admin_status(priv->mdev, MLX5_PORT_UP); 2572 mlx5_set_port_admin_status(priv->mdev, MLX5_PORT_UP);
2573 mutex_unlock(&priv->state_lock); 2573 mutex_unlock(&priv->state_lock);
2574 2574
2575 if (mlx5e_vxlan_allowed(priv->mdev))
2576 udp_tunnel_get_rx_info(netdev);
2577
2575 return err; 2578 return err;
2576} 2579}
2577 2580
@@ -4069,7 +4072,7 @@ static void mlx5e_set_netdev_dev_addr(struct net_device *netdev)
4069 } 4072 }
4070} 4073}
4071 4074
4072#if IS_ENABLED(CONFIG_NET_SWITCHDEV) && IS_ENABLED(CONFIG_MLX5_ESWITCH) 4075#if IS_ENABLED(CONFIG_MLX5_ESWITCH)
4073static const struct switchdev_ops mlx5e_switchdev_ops = { 4076static const struct switchdev_ops mlx5e_switchdev_ops = {
4074 .switchdev_port_attr_get = mlx5e_attr_get, 4077 .switchdev_port_attr_get = mlx5e_attr_get,
4075}; 4078};
@@ -4175,7 +4178,7 @@ static void mlx5e_build_nic_netdev(struct net_device *netdev)
4175 4178
4176 mlx5e_set_netdev_dev_addr(netdev); 4179 mlx5e_set_netdev_dev_addr(netdev);
4177 4180
4178#if IS_ENABLED(CONFIG_NET_SWITCHDEV) && IS_ENABLED(CONFIG_MLX5_ESWITCH) 4181#if IS_ENABLED(CONFIG_MLX5_ESWITCH)
4179 if (MLX5_VPORT_MANAGER(mdev)) 4182 if (MLX5_VPORT_MANAGER(mdev))
4180 netdev->switchdev_ops = &mlx5e_switchdev_ops; 4183 netdev->switchdev_ops = &mlx5e_switchdev_ops;
4181#endif 4184#endif
@@ -4327,12 +4330,6 @@ static void mlx5e_nic_enable(struct mlx5e_priv *priv)
4327#ifdef CONFIG_MLX5_CORE_EN_DCB 4330#ifdef CONFIG_MLX5_CORE_EN_DCB
4328 mlx5e_dcbnl_init_app(priv); 4331 mlx5e_dcbnl_init_app(priv);
4329#endif 4332#endif
4330 /* Device already registered: sync netdev system state */
4331 if (mlx5e_vxlan_allowed(mdev)) {
4332 rtnl_lock();
4333 udp_tunnel_get_rx_info(netdev);
4334 rtnl_unlock();
4335 }
4336 4333
4337 queue_work(priv->wq, &priv->set_rx_mode_work); 4334 queue_work(priv->wq, &priv->set_rx_mode_work);
4338 4335
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c b/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c
index 363d8dcb7f17..500d817d2b0a 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c
@@ -44,6 +44,11 @@
44#include "en_tc.h" 44#include "en_tc.h"
45#include "fs_core.h" 45#include "fs_core.h"
46 46
47#define MLX5E_REP_PARAMS_LOG_SQ_SIZE \
48 max(0x6, MLX5E_PARAMS_MINIMUM_LOG_SQ_SIZE)
49#define MLX5E_REP_PARAMS_LOG_RQ_SIZE \
50 max(0x6, MLX5E_PARAMS_MINIMUM_LOG_RQ_SIZE)
51
47static const char mlx5e_rep_driver_name[] = "mlx5e_rep"; 52static const char mlx5e_rep_driver_name[] = "mlx5e_rep";
48 53
49static void mlx5e_rep_get_drvinfo(struct net_device *dev, 54static void mlx5e_rep_get_drvinfo(struct net_device *dev,
@@ -209,7 +214,7 @@ static void mlx5e_sqs2vport_stop(struct mlx5_eswitch *esw,
209 214
210static int mlx5e_sqs2vport_start(struct mlx5_eswitch *esw, 215static int mlx5e_sqs2vport_start(struct mlx5_eswitch *esw,
211 struct mlx5_eswitch_rep *rep, 216 struct mlx5_eswitch_rep *rep,
212 u16 *sqns_array, int sqns_num) 217 u32 *sqns_array, int sqns_num)
213{ 218{
214 struct mlx5_flow_handle *flow_rule; 219 struct mlx5_flow_handle *flow_rule;
215 struct mlx5e_rep_priv *rpriv; 220 struct mlx5e_rep_priv *rpriv;
@@ -255,9 +260,9 @@ int mlx5e_add_sqs_fwd_rules(struct mlx5e_priv *priv)
255 struct mlx5e_channel *c; 260 struct mlx5e_channel *c;
256 int n, tc, num_sqs = 0; 261 int n, tc, num_sqs = 0;
257 int err = -ENOMEM; 262 int err = -ENOMEM;
258 u16 *sqs; 263 u32 *sqs;
259 264
260 sqs = kcalloc(priv->channels.num * priv->channels.params.num_tc, sizeof(u16), GFP_KERNEL); 265 sqs = kcalloc(priv->channels.num * priv->channels.params.num_tc, sizeof(*sqs), GFP_KERNEL);
261 if (!sqs) 266 if (!sqs)
262 goto out; 267 goto out;
263 268
@@ -288,7 +293,7 @@ void mlx5e_remove_sqs_fwd_rules(struct mlx5e_priv *priv)
288static void mlx5e_rep_neigh_update_init_interval(struct mlx5e_rep_priv *rpriv) 293static void mlx5e_rep_neigh_update_init_interval(struct mlx5e_rep_priv *rpriv)
289{ 294{
290#if IS_ENABLED(CONFIG_IPV6) 295#if IS_ENABLED(CONFIG_IPV6)
291 unsigned long ipv6_interval = NEIGH_VAR(&ipv6_stub->nd_tbl->parms, 296 unsigned long ipv6_interval = NEIGH_VAR(&nd_tbl.parms,
292 DELAY_PROBE_TIME); 297 DELAY_PROBE_TIME);
293#else 298#else
294 unsigned long ipv6_interval = ~0UL; 299 unsigned long ipv6_interval = ~0UL;
@@ -424,7 +429,7 @@ static int mlx5e_rep_netevent_event(struct notifier_block *nb,
424 case NETEVENT_NEIGH_UPDATE: 429 case NETEVENT_NEIGH_UPDATE:
425 n = ptr; 430 n = ptr;
426#if IS_ENABLED(CONFIG_IPV6) 431#if IS_ENABLED(CONFIG_IPV6)
427 if (n->tbl != ipv6_stub->nd_tbl && n->tbl != &arp_tbl) 432 if (n->tbl != &nd_tbl && n->tbl != &arp_tbl)
428#else 433#else
429 if (n->tbl != &arp_tbl) 434 if (n->tbl != &arp_tbl)
430#endif 435#endif
@@ -472,7 +477,7 @@ static int mlx5e_rep_netevent_event(struct notifier_block *nb,
472 * done per device delay prob time parameter. 477 * done per device delay prob time parameter.
473 */ 478 */
474#if IS_ENABLED(CONFIG_IPV6) 479#if IS_ENABLED(CONFIG_IPV6)
475 if (!p->dev || (p->tbl != ipv6_stub->nd_tbl && p->tbl != &arp_tbl)) 480 if (!p->dev || (p->tbl != &nd_tbl && p->tbl != &arp_tbl))
476#else 481#else
477 if (!p->dev || p->tbl != &arp_tbl) 482 if (!p->dev || p->tbl != &arp_tbl)
478#endif 483#endif
@@ -668,7 +673,6 @@ static int mlx5e_rep_open(struct net_device *dev)
668 struct mlx5e_priv *priv = netdev_priv(dev); 673 struct mlx5e_priv *priv = netdev_priv(dev);
669 struct mlx5e_rep_priv *rpriv = priv->ppriv; 674 struct mlx5e_rep_priv *rpriv = priv->ppriv;
670 struct mlx5_eswitch_rep *rep = rpriv->rep; 675 struct mlx5_eswitch_rep *rep = rpriv->rep;
671 struct mlx5_eswitch *esw = priv->mdev->priv.eswitch;
672 int err; 676 int err;
673 677
674 mutex_lock(&priv->state_lock); 678 mutex_lock(&priv->state_lock);
@@ -676,8 +680,9 @@ static int mlx5e_rep_open(struct net_device *dev)
676 if (err) 680 if (err)
677 goto unlock; 681 goto unlock;
678 682
679 if (!mlx5_eswitch_set_vport_state(esw, rep->vport, 683 if (!mlx5_modify_vport_admin_state(priv->mdev,
680 MLX5_ESW_VPORT_ADMIN_STATE_UP)) 684 MLX5_QUERY_VPORT_STATE_IN_OP_MOD_ESW_VPORT,
685 rep->vport, MLX5_ESW_VPORT_ADMIN_STATE_UP))
681 netif_carrier_on(dev); 686 netif_carrier_on(dev);
682 687
683unlock: 688unlock:
@@ -690,11 +695,12 @@ static int mlx5e_rep_close(struct net_device *dev)
690 struct mlx5e_priv *priv = netdev_priv(dev); 695 struct mlx5e_priv *priv = netdev_priv(dev);
691 struct mlx5e_rep_priv *rpriv = priv->ppriv; 696 struct mlx5e_rep_priv *rpriv = priv->ppriv;
692 struct mlx5_eswitch_rep *rep = rpriv->rep; 697 struct mlx5_eswitch_rep *rep = rpriv->rep;
693 struct mlx5_eswitch *esw = priv->mdev->priv.eswitch;
694 int ret; 698 int ret;
695 699
696 mutex_lock(&priv->state_lock); 700 mutex_lock(&priv->state_lock);
697 (void)mlx5_eswitch_set_vport_state(esw, rep->vport, MLX5_ESW_VPORT_ADMIN_STATE_DOWN); 701 mlx5_modify_vport_admin_state(priv->mdev,
702 MLX5_QUERY_VPORT_STATE_IN_OP_MOD_ESW_VPORT,
703 rep->vport, MLX5_ESW_VPORT_ADMIN_STATE_DOWN);
698 ret = mlx5e_close_locked(dev); 704 ret = mlx5e_close_locked(dev);
699 mutex_unlock(&priv->state_lock); 705 mutex_unlock(&priv->state_lock);
700 return ret; 706 return ret;
@@ -877,9 +883,9 @@ static void mlx5e_build_rep_params(struct mlx5_core_dev *mdev,
877 MLX5_CQ_PERIOD_MODE_START_FROM_CQE : 883 MLX5_CQ_PERIOD_MODE_START_FROM_CQE :
878 MLX5_CQ_PERIOD_MODE_START_FROM_EQE; 884 MLX5_CQ_PERIOD_MODE_START_FROM_EQE;
879 885
880 params->log_sq_size = MLX5E_PARAMS_MINIMUM_LOG_SQ_SIZE; 886 params->log_sq_size = MLX5E_REP_PARAMS_LOG_SQ_SIZE;
881 params->rq_wq_type = MLX5_WQ_TYPE_LINKED_LIST; 887 params->rq_wq_type = MLX5_WQ_TYPE_LINKED_LIST;
882 params->log_rq_size = MLX5E_PARAMS_MINIMUM_LOG_RQ_SIZE; 888 params->log_rq_size = MLX5E_REP_PARAMS_LOG_RQ_SIZE;
883 889
884 params->rx_dim_enabled = MLX5_CAP_GEN(mdev, cq_moderation); 890 params->rx_dim_enabled = MLX5_CAP_GEN(mdev, cq_moderation);
885 mlx5e_set_rx_cq_mode_params(params, cq_period_mode); 891 mlx5e_set_rx_cq_mode_params(params, cq_period_mode);
@@ -899,9 +905,7 @@ static void mlx5e_build_rep_netdev(struct net_device *netdev)
899 905
900 netdev->ethtool_ops = &mlx5e_rep_ethtool_ops; 906 netdev->ethtool_ops = &mlx5e_rep_ethtool_ops;
901 907
902#ifdef CONFIG_NET_SWITCHDEV
903 netdev->switchdev_ops = &mlx5e_rep_switchdev_ops; 908 netdev->switchdev_ops = &mlx5e_rep_switchdev_ops;
904#endif
905 909
906 netdev->features |= NETIF_F_VLAN_CHALLENGED | NETIF_F_HW_TC | NETIF_F_NETNS_LOCAL; 910 netdev->features |= NETIF_F_VLAN_CHALLENGED | NETIF_F_HW_TC | NETIF_F_NETNS_LOCAL;
907 netdev->hw_features |= NETIF_F_HW_TC; 911 netdev->hw_features |= NETIF_F_HW_TC;
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c b/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c
index fa86a1466718..43234cabf444 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c
@@ -963,7 +963,7 @@ void mlx5e_tc_update_neigh_used_value(struct mlx5e_neigh_hash_entry *nhe)
963 tbl = &arp_tbl; 963 tbl = &arp_tbl;
964#if IS_ENABLED(CONFIG_IPV6) 964#if IS_ENABLED(CONFIG_IPV6)
965 else if (m_neigh->family == AF_INET6) 965 else if (m_neigh->family == AF_INET6)
966 tbl = ipv6_stub->nd_tbl; 966 tbl = &nd_tbl;
967#endif 967#endif
968 else 968 else
969 return; 969 return;
@@ -2608,19 +2608,19 @@ int mlx5e_configure_flower(struct mlx5e_priv *priv,
2608 if (err != -EAGAIN) 2608 if (err != -EAGAIN)
2609 flow->flags |= MLX5E_TC_FLOW_OFFLOADED; 2609 flow->flags |= MLX5E_TC_FLOW_OFFLOADED;
2610 2610
2611 if (!(flow->flags & MLX5E_TC_FLOW_ESWITCH) ||
2612 !(flow->esw_attr->action & MLX5_FLOW_CONTEXT_ACTION_ENCAP))
2613 kvfree(parse_attr);
2614
2611 err = rhashtable_insert_fast(&tc->ht, &flow->node, 2615 err = rhashtable_insert_fast(&tc->ht, &flow->node,
2612 tc->ht_params); 2616 tc->ht_params);
2613 if (err) 2617 if (err) {
2614 goto err_del_rule; 2618 mlx5e_tc_del_flow(priv, flow);
2619 kfree(flow);
2620 }
2615 2621
2616 if (flow->flags & MLX5E_TC_FLOW_ESWITCH &&
2617 !(flow->esw_attr->action & MLX5_FLOW_CONTEXT_ACTION_ENCAP))
2618 kvfree(parse_attr);
2619 return err; 2622 return err;
2620 2623
2621err_del_rule:
2622 mlx5e_tc_del_flow(priv, flow);
2623
2624err_free: 2624err_free:
2625 kvfree(parse_attr); 2625 kvfree(parse_attr);
2626 kfree(flow); 2626 kfree(flow);
diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c
index f7948e983637..997e24dcb053 100644
--- a/drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c
+++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c
@@ -1380,6 +1380,55 @@ mlxsw_sp_ipip_entry_ol_up_event(struct mlxsw_sp *mlxsw_sp,
1380 decap_fib_entry); 1380 decap_fib_entry);
1381} 1381}
1382 1382
1383static int
1384mlxsw_sp_rif_ipip_lb_op(struct mlxsw_sp_rif_ipip_lb *lb_rif,
1385 struct mlxsw_sp_vr *ul_vr, bool enable)
1386{
1387 struct mlxsw_sp_rif_ipip_lb_config lb_cf = lb_rif->lb_config;
1388 struct mlxsw_sp_rif *rif = &lb_rif->common;
1389 struct mlxsw_sp *mlxsw_sp = rif->mlxsw_sp;
1390 char ritr_pl[MLXSW_REG_RITR_LEN];
1391 u32 saddr4;
1392
1393 switch (lb_cf.ul_protocol) {
1394 case MLXSW_SP_L3_PROTO_IPV4:
1395 saddr4 = be32_to_cpu(lb_cf.saddr.addr4);
1396 mlxsw_reg_ritr_pack(ritr_pl, enable, MLXSW_REG_RITR_LOOPBACK_IF,
1397 rif->rif_index, rif->vr_id, rif->dev->mtu);
1398 mlxsw_reg_ritr_loopback_ipip4_pack(ritr_pl, lb_cf.lb_ipipt,
1399 MLXSW_REG_RITR_LOOPBACK_IPIP_OPTIONS_GRE_KEY_PRESET,
1400 ul_vr->id, saddr4, lb_cf.okey);
1401 break;
1402
1403 case MLXSW_SP_L3_PROTO_IPV6:
1404 return -EAFNOSUPPORT;
1405 }
1406
1407 return mlxsw_reg_write(mlxsw_sp->core, MLXSW_REG(ritr), ritr_pl);
1408}
1409
1410static int mlxsw_sp_netdevice_ipip_ol_update_mtu(struct mlxsw_sp *mlxsw_sp,
1411 struct net_device *ol_dev)
1412{
1413 struct mlxsw_sp_ipip_entry *ipip_entry;
1414 struct mlxsw_sp_rif_ipip_lb *lb_rif;
1415 struct mlxsw_sp_vr *ul_vr;
1416 int err = 0;
1417
1418 ipip_entry = mlxsw_sp_ipip_entry_find_by_ol_dev(mlxsw_sp, ol_dev);
1419 if (ipip_entry) {
1420 lb_rif = ipip_entry->ol_lb;
1421 ul_vr = &mlxsw_sp->router->vrs[lb_rif->ul_vr_id];
1422 err = mlxsw_sp_rif_ipip_lb_op(lb_rif, ul_vr, true);
1423 if (err)
1424 goto out;
1425 lb_rif->common.mtu = ol_dev->mtu;
1426 }
1427
1428out:
1429 return err;
1430}
1431
1383static void mlxsw_sp_netdevice_ipip_ol_up_event(struct mlxsw_sp *mlxsw_sp, 1432static void mlxsw_sp_netdevice_ipip_ol_up_event(struct mlxsw_sp *mlxsw_sp,
1384 struct net_device *ol_dev) 1433 struct net_device *ol_dev)
1385{ 1434{
@@ -1660,6 +1709,8 @@ int mlxsw_sp_netdevice_ipip_ol_event(struct mlxsw_sp *mlxsw_sp,
1660 extack = info->extack; 1709 extack = info->extack;
1661 return mlxsw_sp_netdevice_ipip_ol_change_event(mlxsw_sp, 1710 return mlxsw_sp_netdevice_ipip_ol_change_event(mlxsw_sp,
1662 ol_dev, extack); 1711 ol_dev, extack);
1712 case NETDEV_CHANGEMTU:
1713 return mlxsw_sp_netdevice_ipip_ol_update_mtu(mlxsw_sp, ol_dev);
1663 } 1714 }
1664 return 0; 1715 return 0;
1665} 1716}
@@ -6844,33 +6895,6 @@ mlxsw_sp_rif_ipip_lb_setup(struct mlxsw_sp_rif *rif,
6844} 6895}
6845 6896
6846static int 6897static int
6847mlxsw_sp_rif_ipip_lb_op(struct mlxsw_sp_rif_ipip_lb *lb_rif,
6848 struct mlxsw_sp_vr *ul_vr, bool enable)
6849{
6850 struct mlxsw_sp_rif_ipip_lb_config lb_cf = lb_rif->lb_config;
6851 struct mlxsw_sp_rif *rif = &lb_rif->common;
6852 struct mlxsw_sp *mlxsw_sp = rif->mlxsw_sp;
6853 char ritr_pl[MLXSW_REG_RITR_LEN];
6854 u32 saddr4;
6855
6856 switch (lb_cf.ul_protocol) {
6857 case MLXSW_SP_L3_PROTO_IPV4:
6858 saddr4 = be32_to_cpu(lb_cf.saddr.addr4);
6859 mlxsw_reg_ritr_pack(ritr_pl, enable, MLXSW_REG_RITR_LOOPBACK_IF,
6860 rif->rif_index, rif->vr_id, rif->dev->mtu);
6861 mlxsw_reg_ritr_loopback_ipip4_pack(ritr_pl, lb_cf.lb_ipipt,
6862 MLXSW_REG_RITR_LOOPBACK_IPIP_OPTIONS_GRE_KEY_PRESET,
6863 ul_vr->id, saddr4, lb_cf.okey);
6864 break;
6865
6866 case MLXSW_SP_L3_PROTO_IPV6:
6867 return -EAFNOSUPPORT;
6868 }
6869
6870 return mlxsw_reg_write(mlxsw_sp->core, MLXSW_REG(ritr), ritr_pl);
6871}
6872
6873static int
6874mlxsw_sp_rif_ipip_lb_configure(struct mlxsw_sp_rif *rif) 6898mlxsw_sp_rif_ipip_lb_configure(struct mlxsw_sp_rif *rif)
6875{ 6899{
6876 struct mlxsw_sp_rif_ipip_lb *lb_rif = mlxsw_sp_rif_ipip_lb_rif(rif); 6900 struct mlxsw_sp_rif_ipip_lb *lb_rif = mlxsw_sp_rif_ipip_lb_rif(rif);
diff --git a/drivers/net/ethernet/netronome/nfp/bpf/jit.c b/drivers/net/ethernet/netronome/nfp/bpf/jit.c
index 56451edf01c2..ecd7c33baf3c 100644
--- a/drivers/net/ethernet/netronome/nfp/bpf/jit.c
+++ b/drivers/net/ethernet/netronome/nfp/bpf/jit.c
@@ -74,7 +74,9 @@ nfp_meta_has_prev(struct nfp_prog *nfp_prog, struct nfp_insn_meta *meta)
74 74
75static void nfp_prog_push(struct nfp_prog *nfp_prog, u64 insn) 75static void nfp_prog_push(struct nfp_prog *nfp_prog, u64 insn)
76{ 76{
77 if (nfp_prog->__prog_alloc_len == nfp_prog->prog_len) { 77 if (nfp_prog->__prog_alloc_len / sizeof(u64) == nfp_prog->prog_len) {
78 pr_warn("instruction limit reached (%u NFP instructions)\n",
79 nfp_prog->prog_len);
78 nfp_prog->error = -ENOSPC; 80 nfp_prog->error = -ENOSPC;
79 return; 81 return;
80 } 82 }
@@ -2463,6 +2465,8 @@ static int nfp_translate(struct nfp_prog *nfp_prog)
2463 err = cb(nfp_prog, meta); 2465 err = cb(nfp_prog, meta);
2464 if (err) 2466 if (err)
2465 return err; 2467 return err;
2468 if (nfp_prog->error)
2469 return nfp_prog->error;
2466 2470
2467 nfp_prog->n_translated++; 2471 nfp_prog->n_translated++;
2468 } 2472 }
diff --git a/drivers/net/ethernet/qlogic/qede/qede_fp.c b/drivers/net/ethernet/qlogic/qede/qede_fp.c
index dafc079ab6b9..14941303189d 100644
--- a/drivers/net/ethernet/qlogic/qede/qede_fp.c
+++ b/drivers/net/ethernet/qlogic/qede/qede_fp.c
@@ -320,13 +320,11 @@ static inline void qede_update_tx_producer(struct qede_tx_queue *txq)
320 barrier(); 320 barrier();
321 writel(txq->tx_db.raw, txq->doorbell_addr); 321 writel(txq->tx_db.raw, txq->doorbell_addr);
322 322
323 /* mmiowb is needed to synchronize doorbell writes from more than one 323 /* Fence required to flush the write combined buffer, since another
324 * processor. It guarantees that the write arrives to the device before 324 * CPU may write to the same doorbell address and data may be lost
325 * the queue lock is released and another start_xmit is called (possibly 325 * due to relaxed order nature of write combined bar.
326 * on another CPU). Without this barrier, the next doorbell can bypass
327 * this doorbell. This is applicable to IA64/Altix systems.
328 */ 326 */
329 mmiowb(); 327 wmb();
330} 328}
331 329
332static int qede_xdp_xmit(struct qede_dev *edev, struct qede_fastpath *fp, 330static int qede_xdp_xmit(struct qede_dev *edev, struct qede_fastpath *fp,
@@ -1249,16 +1247,10 @@ static int qede_rx_process_cqe(struct qede_dev *edev,
1249 1247
1250 csum_flag = qede_check_csum(parse_flag); 1248 csum_flag = qede_check_csum(parse_flag);
1251 if (unlikely(csum_flag == QEDE_CSUM_ERROR)) { 1249 if (unlikely(csum_flag == QEDE_CSUM_ERROR)) {
1252 if (qede_pkt_is_ip_fragmented(fp_cqe, parse_flag)) { 1250 if (qede_pkt_is_ip_fragmented(fp_cqe, parse_flag))
1253 rxq->rx_ip_frags++; 1251 rxq->rx_ip_frags++;
1254 } else { 1252 else
1255 DP_NOTICE(edev,
1256 "CQE has error, flags = %x, dropping incoming packet\n",
1257 parse_flag);
1258 rxq->rx_hw_errors++; 1253 rxq->rx_hw_errors++;
1259 qede_recycle_rx_bd_ring(rxq, fp_cqe->bd_num);
1260 return 0;
1261 }
1262 } 1254 }
1263 1255
1264 /* Basic validation passed; Need to prepare an SKB. This would also 1256 /* Basic validation passed; Need to prepare an SKB. This would also
diff --git a/drivers/net/ethernet/realtek/r8169.c b/drivers/net/ethernet/realtek/r8169.c
index 0bf7d1759250..b4779acb6b5c 100644
--- a/drivers/net/ethernet/realtek/r8169.c
+++ b/drivers/net/ethernet/realtek/r8169.c
@@ -8660,12 +8660,12 @@ static int rtl_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
8660 if (!tp->counters) 8660 if (!tp->counters)
8661 return -ENOMEM; 8661 return -ENOMEM;
8662 8662
8663 pci_set_drvdata(pdev, dev);
8664
8663 rc = register_netdev(dev); 8665 rc = register_netdev(dev);
8664 if (rc < 0) 8666 if (rc < 0)
8665 return rc; 8667 return rc;
8666 8668
8667 pci_set_drvdata(pdev, dev);
8668
8669 netif_info(tp, probe, dev, "%s at 0x%p, %pM, XID %08x IRQ %d\n", 8669 netif_info(tp, probe, dev, "%s at 0x%p, %pM, XID %08x IRQ %d\n",
8670 rtl_chip_infos[chipset].name, ioaddr, dev->dev_addr, 8670 rtl_chip_infos[chipset].name, ioaddr, dev->dev_addr,
8671 (u32)(RTL_R32(TxConfig) & 0x9cf0f8ff), pdev->irq); 8671 (u32)(RTL_R32(TxConfig) & 0x9cf0f8ff), pdev->irq);
diff --git a/drivers/net/hyperv/rndis_filter.c b/drivers/net/hyperv/rndis_filter.c
index a6ec41c399d6..465c42e30508 100644
--- a/drivers/net/hyperv/rndis_filter.c
+++ b/drivers/net/hyperv/rndis_filter.c
@@ -858,7 +858,7 @@ static void rndis_set_multicast(struct work_struct *w)
858 if (flags & IFF_PROMISC) { 858 if (flags & IFF_PROMISC) {
859 filter = NDIS_PACKET_TYPE_PROMISCUOUS; 859 filter = NDIS_PACKET_TYPE_PROMISCUOUS;
860 } else { 860 } else {
861 if (flags & IFF_ALLMULTI) 861 if (!netdev_mc_empty(rdev->ndev) || (flags & IFF_ALLMULTI))
862 filter |= NDIS_PACKET_TYPE_ALL_MULTICAST; 862 filter |= NDIS_PACKET_TYPE_ALL_MULTICAST;
863 if (flags & IFF_BROADCAST) 863 if (flags & IFF_BROADCAST)
864 filter |= NDIS_PACKET_TYPE_BROADCAST; 864 filter |= NDIS_PACKET_TYPE_BROADCAST;
diff --git a/drivers/net/team/team.c b/drivers/net/team/team.c
index 56c701b73c12..befed2d22bf4 100644
--- a/drivers/net/team/team.c
+++ b/drivers/net/team/team.c
@@ -1197,11 +1197,6 @@ static int team_port_add(struct team *team, struct net_device *port_dev)
1197 goto err_dev_open; 1197 goto err_dev_open;
1198 } 1198 }
1199 1199
1200 netif_addr_lock_bh(dev);
1201 dev_uc_sync_multiple(port_dev, dev);
1202 dev_mc_sync_multiple(port_dev, dev);
1203 netif_addr_unlock_bh(dev);
1204
1205 err = vlan_vids_add_by_dev(port_dev, dev); 1200 err = vlan_vids_add_by_dev(port_dev, dev);
1206 if (err) { 1201 if (err) {
1207 netdev_err(dev, "Failed to add vlan ids to device %s\n", 1202 netdev_err(dev, "Failed to add vlan ids to device %s\n",
@@ -1241,6 +1236,11 @@ static int team_port_add(struct team *team, struct net_device *port_dev)
1241 goto err_option_port_add; 1236 goto err_option_port_add;
1242 } 1237 }
1243 1238
1239 netif_addr_lock_bh(dev);
1240 dev_uc_sync_multiple(port_dev, dev);
1241 dev_mc_sync_multiple(port_dev, dev);
1242 netif_addr_unlock_bh(dev);
1243
1244 port->index = -1; 1244 port->index = -1;
1245 list_add_tail_rcu(&port->list, &team->port_list); 1245 list_add_tail_rcu(&port->list, &team->port_list);
1246 team_port_enable(team, port); 1246 team_port_enable(team, port);
@@ -1265,8 +1265,6 @@ err_enable_netpoll:
1265 vlan_vids_del_by_dev(port_dev, dev); 1265 vlan_vids_del_by_dev(port_dev, dev);
1266 1266
1267err_vids_add: 1267err_vids_add:
1268 dev_uc_unsync(port_dev, dev);
1269 dev_mc_unsync(port_dev, dev);
1270 dev_close(port_dev); 1268 dev_close(port_dev);
1271 1269
1272err_dev_open: 1270err_dev_open:
diff --git a/drivers/net/usb/lan78xx.c b/drivers/net/usb/lan78xx.c
index 60a604cc7647..55a78eb96961 100644
--- a/drivers/net/usb/lan78xx.c
+++ b/drivers/net/usb/lan78xx.c
@@ -2351,6 +2351,7 @@ static int lan78xx_reset(struct lan78xx_net *dev)
2351 u32 buf; 2351 u32 buf;
2352 int ret = 0; 2352 int ret = 0;
2353 unsigned long timeout; 2353 unsigned long timeout;
2354 u8 sig;
2354 2355
2355 ret = lan78xx_read_reg(dev, HW_CFG, &buf); 2356 ret = lan78xx_read_reg(dev, HW_CFG, &buf);
2356 buf |= HW_CFG_LRST_; 2357 buf |= HW_CFG_LRST_;
@@ -2450,6 +2451,15 @@ static int lan78xx_reset(struct lan78xx_net *dev)
2450 /* LAN7801 only has RGMII mode */ 2451 /* LAN7801 only has RGMII mode */
2451 if (dev->chipid == ID_REV_CHIP_ID_7801_) 2452 if (dev->chipid == ID_REV_CHIP_ID_7801_)
2452 buf &= ~MAC_CR_GMII_EN_; 2453 buf &= ~MAC_CR_GMII_EN_;
2454
2455 if (dev->chipid == ID_REV_CHIP_ID_7800_) {
2456 ret = lan78xx_read_raw_eeprom(dev, 0, 1, &sig);
2457 if (!ret && sig != EEPROM_INDICATOR) {
2458 /* Implies there is no external eeprom. Set mac speed */
2459 netdev_info(dev->net, "No External EEPROM. Setting MAC Speed\n");
2460 buf |= MAC_CR_AUTO_DUPLEX_ | MAC_CR_AUTO_SPEED_;
2461 }
2462 }
2453 ret = lan78xx_write_reg(dev, MAC_CR, buf); 2463 ret = lan78xx_write_reg(dev, MAC_CR, buf);
2454 2464
2455 ret = lan78xx_read_reg(dev, MAC_TX, &buf); 2465 ret = lan78xx_read_reg(dev, MAC_TX, &buf);
@@ -2863,8 +2873,7 @@ static int lan78xx_bind(struct lan78xx_net *dev, struct usb_interface *intf)
2863 if (ret < 0) { 2873 if (ret < 0) {
2864 netdev_warn(dev->net, 2874 netdev_warn(dev->net,
2865 "lan78xx_setup_irq_domain() failed : %d", ret); 2875 "lan78xx_setup_irq_domain() failed : %d", ret);
2866 kfree(pdata); 2876 goto out1;
2867 return ret;
2868 } 2877 }
2869 2878
2870 dev->net->hard_header_len += TX_OVERHEAD; 2879 dev->net->hard_header_len += TX_OVERHEAD;
@@ -2872,14 +2881,32 @@ static int lan78xx_bind(struct lan78xx_net *dev, struct usb_interface *intf)
2872 2881
2873 /* Init all registers */ 2882 /* Init all registers */
2874 ret = lan78xx_reset(dev); 2883 ret = lan78xx_reset(dev);
2884 if (ret) {
2885 netdev_warn(dev->net, "Registers INIT FAILED....");
2886 goto out2;
2887 }
2875 2888
2876 ret = lan78xx_mdio_init(dev); 2889 ret = lan78xx_mdio_init(dev);
2890 if (ret) {
2891 netdev_warn(dev->net, "MDIO INIT FAILED.....");
2892 goto out2;
2893 }
2877 2894
2878 dev->net->flags |= IFF_MULTICAST; 2895 dev->net->flags |= IFF_MULTICAST;
2879 2896
2880 pdata->wol = WAKE_MAGIC; 2897 pdata->wol = WAKE_MAGIC;
2881 2898
2882 return ret; 2899 return ret;
2900
2901out2:
2902 lan78xx_remove_irq_domain(dev);
2903
2904out1:
2905 netdev_warn(dev->net, "Bind routine FAILED");
2906 cancel_work_sync(&pdata->set_multicast);
2907 cancel_work_sync(&pdata->set_vlan);
2908 kfree(pdata);
2909 return ret;
2883} 2910}
2884 2911
2885static void lan78xx_unbind(struct lan78xx_net *dev, struct usb_interface *intf) 2912static void lan78xx_unbind(struct lan78xx_net *dev, struct usb_interface *intf)
@@ -2891,6 +2918,8 @@ static void lan78xx_unbind(struct lan78xx_net *dev, struct usb_interface *intf)
2891 lan78xx_remove_mdio(dev); 2918 lan78xx_remove_mdio(dev);
2892 2919
2893 if (pdata) { 2920 if (pdata) {
2921 cancel_work_sync(&pdata->set_multicast);
2922 cancel_work_sync(&pdata->set_vlan);
2894 netif_dbg(dev, ifdown, dev->net, "free pdata"); 2923 netif_dbg(dev, ifdown, dev->net, "free pdata");
2895 kfree(pdata); 2924 kfree(pdata);
2896 pdata = NULL; 2925 pdata = NULL;
diff --git a/drivers/net/usb/qmi_wwan.c b/drivers/net/usb/qmi_wwan.c
index 76ac48095c29..ca066b785e9f 100644
--- a/drivers/net/usb/qmi_wwan.c
+++ b/drivers/net/usb/qmi_wwan.c
@@ -1104,6 +1104,9 @@ static const struct usb_device_id products[] = {
1104 {QMI_FIXED_INTF(0x0846, 0x68a2, 8)}, 1104 {QMI_FIXED_INTF(0x0846, 0x68a2, 8)},
1105 {QMI_FIXED_INTF(0x12d1, 0x140c, 1)}, /* Huawei E173 */ 1105 {QMI_FIXED_INTF(0x12d1, 0x140c, 1)}, /* Huawei E173 */
1106 {QMI_FIXED_INTF(0x12d1, 0x14ac, 1)}, /* Huawei E1820 */ 1106 {QMI_FIXED_INTF(0x12d1, 0x14ac, 1)}, /* Huawei E1820 */
1107 {QMI_FIXED_INTF(0x1435, 0xd181, 3)}, /* Wistron NeWeb D18Q1 */
1108 {QMI_FIXED_INTF(0x1435, 0xd181, 4)}, /* Wistron NeWeb D18Q1 */
1109 {QMI_FIXED_INTF(0x1435, 0xd181, 5)}, /* Wistron NeWeb D18Q1 */
1107 {QMI_FIXED_INTF(0x16d8, 0x6003, 0)}, /* CMOTech 6003 */ 1110 {QMI_FIXED_INTF(0x16d8, 0x6003, 0)}, /* CMOTech 6003 */
1108 {QMI_FIXED_INTF(0x16d8, 0x6007, 0)}, /* CMOTech CHE-628S */ 1111 {QMI_FIXED_INTF(0x16d8, 0x6007, 0)}, /* CMOTech CHE-628S */
1109 {QMI_FIXED_INTF(0x16d8, 0x6008, 0)}, /* CMOTech CMU-301 */ 1112 {QMI_FIXED_INTF(0x16d8, 0x6008, 0)}, /* CMOTech CMU-301 */
@@ -1180,6 +1183,7 @@ static const struct usb_device_id products[] = {
1180 {QMI_FIXED_INTF(0x19d2, 0x2002, 4)}, /* ZTE (Vodafone) K3765-Z */ 1183 {QMI_FIXED_INTF(0x19d2, 0x2002, 4)}, /* ZTE (Vodafone) K3765-Z */
1181 {QMI_FIXED_INTF(0x2001, 0x7e19, 4)}, /* D-Link DWM-221 B1 */ 1184 {QMI_FIXED_INTF(0x2001, 0x7e19, 4)}, /* D-Link DWM-221 B1 */
1182 {QMI_FIXED_INTF(0x2001, 0x7e35, 4)}, /* D-Link DWM-222 */ 1185 {QMI_FIXED_INTF(0x2001, 0x7e35, 4)}, /* D-Link DWM-222 */
1186 {QMI_FIXED_INTF(0x2020, 0x2033, 4)}, /* BroadMobi BM806U */
1183 {QMI_FIXED_INTF(0x0f3d, 0x68a2, 8)}, /* Sierra Wireless MC7700 */ 1187 {QMI_FIXED_INTF(0x0f3d, 0x68a2, 8)}, /* Sierra Wireless MC7700 */
1184 {QMI_FIXED_INTF(0x114f, 0x68a2, 8)}, /* Sierra Wireless MC7750 */ 1188 {QMI_FIXED_INTF(0x114f, 0x68a2, 8)}, /* Sierra Wireless MC7750 */
1185 {QMI_FIXED_INTF(0x1199, 0x68a2, 8)}, /* Sierra Wireless MC7710 in QMI mode */ 1189 {QMI_FIXED_INTF(0x1199, 0x68a2, 8)}, /* Sierra Wireless MC7710 in QMI mode */
@@ -1240,6 +1244,7 @@ static const struct usb_device_id products[] = {
1240 {QMI_FIXED_INTF(0x413c, 0x81b6, 8)}, /* Dell Wireless 5811e */ 1244 {QMI_FIXED_INTF(0x413c, 0x81b6, 8)}, /* Dell Wireless 5811e */
1241 {QMI_FIXED_INTF(0x413c, 0x81b6, 10)}, /* Dell Wireless 5811e */ 1245 {QMI_FIXED_INTF(0x413c, 0x81b6, 10)}, /* Dell Wireless 5811e */
1242 {QMI_FIXED_INTF(0x03f0, 0x4e1d, 8)}, /* HP lt4111 LTE/EV-DO/HSPA+ Gobi 4G Module */ 1246 {QMI_FIXED_INTF(0x03f0, 0x4e1d, 8)}, /* HP lt4111 LTE/EV-DO/HSPA+ Gobi 4G Module */
1247 {QMI_FIXED_INTF(0x03f0, 0x9d1d, 1)}, /* HP lt4120 Snapdragon X5 LTE */
1243 {QMI_FIXED_INTF(0x22de, 0x9061, 3)}, /* WeTelecom WPD-600N */ 1248 {QMI_FIXED_INTF(0x22de, 0x9061, 3)}, /* WeTelecom WPD-600N */
1244 {QMI_FIXED_INTF(0x1e0e, 0x9001, 5)}, /* SIMCom 7230E */ 1249 {QMI_FIXED_INTF(0x1e0e, 0x9001, 5)}, /* SIMCom 7230E */
1245 {QMI_QUIRK_SET_DTR(0x2c7c, 0x0125, 4)}, /* Quectel EC25, EC20 R2.0 Mini PCIe */ 1250 {QMI_QUIRK_SET_DTR(0x2c7c, 0x0125, 4)}, /* Quectel EC25, EC20 R2.0 Mini PCIe */
diff --git a/drivers/net/vrf.c b/drivers/net/vrf.c
index 139c61c8244a..ac40924fe437 100644
--- a/drivers/net/vrf.c
+++ b/drivers/net/vrf.c
@@ -578,12 +578,13 @@ static int vrf_finish_output(struct net *net, struct sock *sk, struct sk_buff *s
578 if (!IS_ERR(neigh)) { 578 if (!IS_ERR(neigh)) {
579 sock_confirm_neigh(skb, neigh); 579 sock_confirm_neigh(skb, neigh);
580 ret = neigh_output(neigh, skb); 580 ret = neigh_output(neigh, skb);
581 rcu_read_unlock_bh();
582 return ret;
581 } 583 }
582 584
583 rcu_read_unlock_bh(); 585 rcu_read_unlock_bh();
584err: 586err:
585 if (unlikely(ret < 0)) 587 vrf_tx_error(skb->dev, skb);
586 vrf_tx_error(skb->dev, skb);
587 return ret; 588 return ret;
588} 589}
589 590
diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
index 15fa00d79fc6..1ad97a40940d 100644
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
@@ -6802,7 +6802,7 @@ static void brcmf_cfg80211_reg_notifier(struct wiphy *wiphy,
6802 return; 6802 return;
6803 6803
6804 /* ignore non-ISO3166 country codes */ 6804 /* ignore non-ISO3166 country codes */
6805 for (i = 0; i < sizeof(req->alpha2); i++) 6805 for (i = 0; i < 2; i++)
6806 if (req->alpha2[i] < 'A' || req->alpha2[i] > 'Z') { 6806 if (req->alpha2[i] < 'A' || req->alpha2[i] > 'Z') {
6807 brcmf_err("not an ISO3166 code (0x%02x 0x%02x)\n", 6807 brcmf_err("not an ISO3166 code (0x%02x 0x%02x)\n",
6808 req->alpha2[0], req->alpha2[1]); 6808 req->alpha2[0], req->alpha2[1]);
diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c
index 9be0b051066a..ebe35e6a40e7 100644
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c
@@ -75,6 +75,10 @@ static int brcmf_roamoff;
75module_param_named(roamoff, brcmf_roamoff, int, S_IRUSR); 75module_param_named(roamoff, brcmf_roamoff, int, S_IRUSR);
76MODULE_PARM_DESC(roamoff, "Do not use internal roaming engine"); 76MODULE_PARM_DESC(roamoff, "Do not use internal roaming engine");
77 77
78static int brcmf_iapp_enable;
79module_param_named(iapp, brcmf_iapp_enable, int, 0);
80MODULE_PARM_DESC(iapp, "Enable partial support for the obsoleted Inter-Access Point Protocol");
81
78#ifdef DEBUG 82#ifdef DEBUG
79/* always succeed brcmf_bus_started() */ 83/* always succeed brcmf_bus_started() */
80static int brcmf_ignore_probe_fail; 84static int brcmf_ignore_probe_fail;
@@ -441,6 +445,7 @@ struct brcmf_mp_device *brcmf_get_module_param(struct device *dev,
441 settings->feature_disable = brcmf_feature_disable; 445 settings->feature_disable = brcmf_feature_disable;
442 settings->fcmode = brcmf_fcmode; 446 settings->fcmode = brcmf_fcmode;
443 settings->roamoff = !!brcmf_roamoff; 447 settings->roamoff = !!brcmf_roamoff;
448 settings->iapp = !!brcmf_iapp_enable;
444#ifdef DEBUG 449#ifdef DEBUG
445 settings->ignore_probe_fail = !!brcmf_ignore_probe_fail; 450 settings->ignore_probe_fail = !!brcmf_ignore_probe_fail;
446#endif 451#endif
diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.h b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.h
index a62f8e70b320..ef914619e8e1 100644
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.h
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.h
@@ -58,6 +58,7 @@ struct brcmf_mp_device {
58 unsigned int feature_disable; 58 unsigned int feature_disable;
59 int fcmode; 59 int fcmode;
60 bool roamoff; 60 bool roamoff;
61 bool iapp;
61 bool ignore_probe_fail; 62 bool ignore_probe_fail;
62 struct brcmfmac_pd_cc *country_codes; 63 struct brcmfmac_pd_cc *country_codes;
63 union { 64 union {
diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
index 930e423f83a8..44b7774ebd02 100644
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
@@ -230,6 +230,37 @@ static void brcmf_netdev_set_multicast_list(struct net_device *ndev)
230 schedule_work(&ifp->multicast_work); 230 schedule_work(&ifp->multicast_work);
231} 231}
232 232
233/**
234 * brcmf_skb_is_iapp - checks if skb is an IAPP packet
235 *
236 * @skb: skb to check
237 */
238static bool brcmf_skb_is_iapp(struct sk_buff *skb)
239{
240 static const u8 iapp_l2_update_packet[6] __aligned(2) = {
241 0x00, 0x01, 0xaf, 0x81, 0x01, 0x00,
242 };
243 unsigned char *eth_data;
244#if !defined(CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS)
245 const u16 *a, *b;
246#endif
247
248 if (skb->len - skb->mac_len != 6 ||
249 !is_multicast_ether_addr(eth_hdr(skb)->h_dest))
250 return false;
251
252 eth_data = skb_mac_header(skb) + ETH_HLEN;
253#if defined(CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS)
254 return !(((*(const u32 *)eth_data) ^ (*(const u32 *)iapp_l2_update_packet)) |
255 ((*(const u16 *)(eth_data + 4)) ^ (*(const u16 *)(iapp_l2_update_packet + 4))));
256#else
257 a = (const u16 *)eth_data;
258 b = (const u16 *)iapp_l2_update_packet;
259
260 return !((a[0] ^ b[0]) | (a[1] ^ b[1]) | (a[2] ^ b[2]));
261#endif
262}
263
233static netdev_tx_t brcmf_netdev_start_xmit(struct sk_buff *skb, 264static netdev_tx_t brcmf_netdev_start_xmit(struct sk_buff *skb,
234 struct net_device *ndev) 265 struct net_device *ndev)
235{ 266{
@@ -250,6 +281,23 @@ static netdev_tx_t brcmf_netdev_start_xmit(struct sk_buff *skb,
250 goto done; 281 goto done;
251 } 282 }
252 283
284 /* Some recent Broadcom's firmwares disassociate STA when they receive
285 * an 802.11f ADD frame. This behavior can lead to a local DoS security
286 * issue. Attacker may trigger disassociation of any STA by sending a
287 * proper Ethernet frame to the wireless interface.
288 *
289 * Moreover this feature may break AP interfaces in some specific
290 * setups. This applies e.g. to the bridge with hairpin mode enabled and
291 * IFLA_BRPORT_MCAST_TO_UCAST set. IAPP packet generated by a firmware
292 * will get passed back to the wireless interface and cause immediate
293 * disassociation of a just-connected STA.
294 */
295 if (!drvr->settings->iapp && brcmf_skb_is_iapp(skb)) {
296 dev_kfree_skb(skb);
297 ret = -EINVAL;
298 goto done;
299 }
300
253 /* Make sure there's enough writeable headroom */ 301 /* Make sure there's enough writeable headroom */
254 if (skb_headroom(skb) < drvr->hdrlen || skb_header_cloned(skb)) { 302 if (skb_headroom(skb) < drvr->hdrlen || skb_header_cloned(skb)) {
255 head_delta = max_t(int, drvr->hdrlen - skb_headroom(skb), 0); 303 head_delta = max_t(int, drvr->hdrlen - skb_headroom(skb), 0);
@@ -325,6 +373,15 @@ void brcmf_txflowblock_if(struct brcmf_if *ifp,
325 373
326void brcmf_netif_rx(struct brcmf_if *ifp, struct sk_buff *skb) 374void brcmf_netif_rx(struct brcmf_if *ifp, struct sk_buff *skb)
327{ 375{
376 /* Most of Broadcom's firmwares send 802.11f ADD frame every time a new
377 * STA connects to the AP interface. This is an obsoleted standard most
378 * users don't use, so don't pass these frames up unless requested.
379 */
380 if (!ifp->drvr->settings->iapp && brcmf_skb_is_iapp(skb)) {
381 brcmu_pkt_buf_free_skb(skb);
382 return;
383 }
384
328 if (skb->pkt_type == PACKET_MULTICAST) 385 if (skb->pkt_type == PACKET_MULTICAST)
329 ifp->ndev->stats.multicast++; 386 ifp->ndev->stats.multicast++;
330 387
diff --git a/drivers/net/wireless/intel/iwlwifi/cfg/9000.c b/drivers/net/wireless/intel/iwlwifi/cfg/9000.c
index 90a1d14cf7d2..ab1469473e4f 100644
--- a/drivers/net/wireless/intel/iwlwifi/cfg/9000.c
+++ b/drivers/net/wireless/intel/iwlwifi/cfg/9000.c
@@ -53,6 +53,7 @@
53#include <linux/stringify.h> 53#include <linux/stringify.h>
54#include "iwl-config.h" 54#include "iwl-config.h"
55#include "iwl-agn-hw.h" 55#include "iwl-agn-hw.h"
56#include "fw/file.h"
56 57
57/* Highest firmware API version supported */ 58/* Highest firmware API version supported */
58#define IWL9000_UCODE_API_MAX 36 59#define IWL9000_UCODE_API_MAX 36
@@ -265,6 +266,67 @@ const struct iwl_cfg iwl9560_2ac_cfg_soc = {
265 .integrated = true, 266 .integrated = true,
266 .soc_latency = 5000, 267 .soc_latency = 5000,
267}; 268};
269
270const struct iwl_cfg iwl9460_2ac_cfg_shared_clk = {
271 .name = "Intel(R) Dual Band Wireless AC 9460",
272 .fw_name_pre = IWL9000A_FW_PRE,
273 .fw_name_pre_b_or_c_step = IWL9000B_FW_PRE,
274 .fw_name_pre_rf_next_step = IWL9000RFB_FW_PRE,
275 IWL_DEVICE_9000,
276 .ht_params = &iwl9000_ht_params,
277 .nvm_ver = IWL9000_NVM_VERSION,
278 .nvm_calib_ver = IWL9000_TX_POWER_VERSION,
279 .max_ht_ampdu_exponent = IEEE80211_HT_MAX_AMPDU_64K,
280 .integrated = true,
281 .soc_latency = 5000,
282 .extra_phy_cfg_flags = FW_PHY_CFG_SHARED_CLK
283};
284
285const struct iwl_cfg iwl9461_2ac_cfg_shared_clk = {
286 .name = "Intel(R) Dual Band Wireless AC 9461",
287 .fw_name_pre = IWL9000A_FW_PRE,
288 .fw_name_pre_b_or_c_step = IWL9000B_FW_PRE,
289 .fw_name_pre_rf_next_step = IWL9000RFB_FW_PRE,
290 IWL_DEVICE_9000,
291 .ht_params = &iwl9000_ht_params,
292 .nvm_ver = IWL9000_NVM_VERSION,
293 .nvm_calib_ver = IWL9000_TX_POWER_VERSION,
294 .max_ht_ampdu_exponent = IEEE80211_HT_MAX_AMPDU_64K,
295 .integrated = true,
296 .soc_latency = 5000,
297 .extra_phy_cfg_flags = FW_PHY_CFG_SHARED_CLK
298};
299
300const struct iwl_cfg iwl9462_2ac_cfg_shared_clk = {
301 .name = "Intel(R) Dual Band Wireless AC 9462",
302 .fw_name_pre = IWL9000A_FW_PRE,
303 .fw_name_pre_b_or_c_step = IWL9000B_FW_PRE,
304 .fw_name_pre_rf_next_step = IWL9000RFB_FW_PRE,
305 IWL_DEVICE_9000,
306 .ht_params = &iwl9000_ht_params,
307 .nvm_ver = IWL9000_NVM_VERSION,
308 .nvm_calib_ver = IWL9000_TX_POWER_VERSION,
309 .max_ht_ampdu_exponent = IEEE80211_HT_MAX_AMPDU_64K,
310 .integrated = true,
311 .soc_latency = 5000,
312 .extra_phy_cfg_flags = FW_PHY_CFG_SHARED_CLK
313};
314
315const struct iwl_cfg iwl9560_2ac_cfg_shared_clk = {
316 .name = "Intel(R) Dual Band Wireless AC 9560",
317 .fw_name_pre = IWL9000A_FW_PRE,
318 .fw_name_pre_b_or_c_step = IWL9000B_FW_PRE,
319 .fw_name_pre_rf_next_step = IWL9000RFB_FW_PRE,
320 IWL_DEVICE_9000,
321 .ht_params = &iwl9000_ht_params,
322 .nvm_ver = IWL9000_NVM_VERSION,
323 .nvm_calib_ver = IWL9000_TX_POWER_VERSION,
324 .max_ht_ampdu_exponent = IEEE80211_HT_MAX_AMPDU_64K,
325 .integrated = true,
326 .soc_latency = 5000,
327 .extra_phy_cfg_flags = FW_PHY_CFG_SHARED_CLK
328};
329
268MODULE_FIRMWARE(IWL9000A_MODULE_FIRMWARE(IWL9000_UCODE_API_MAX)); 330MODULE_FIRMWARE(IWL9000A_MODULE_FIRMWARE(IWL9000_UCODE_API_MAX));
269MODULE_FIRMWARE(IWL9000B_MODULE_FIRMWARE(IWL9000_UCODE_API_MAX)); 331MODULE_FIRMWARE(IWL9000B_MODULE_FIRMWARE(IWL9000_UCODE_API_MAX));
270MODULE_FIRMWARE(IWL9000RFB_MODULE_FIRMWARE(IWL9000_UCODE_API_MAX)); 332MODULE_FIRMWARE(IWL9000RFB_MODULE_FIRMWARE(IWL9000_UCODE_API_MAX));
diff --git a/drivers/net/wireless/intel/iwlwifi/fw/file.h b/drivers/net/wireless/intel/iwlwifi/fw/file.h
index 1a05d506ac9a..2cb303c5c42e 100644
--- a/drivers/net/wireless/intel/iwlwifi/fw/file.h
+++ b/drivers/net/wireless/intel/iwlwifi/fw/file.h
@@ -441,6 +441,7 @@ enum iwl_fw_phy_cfg {
441 FW_PHY_CFG_TX_CHAIN = 0xf << FW_PHY_CFG_TX_CHAIN_POS, 441 FW_PHY_CFG_TX_CHAIN = 0xf << FW_PHY_CFG_TX_CHAIN_POS,
442 FW_PHY_CFG_RX_CHAIN_POS = 20, 442 FW_PHY_CFG_RX_CHAIN_POS = 20,
443 FW_PHY_CFG_RX_CHAIN = 0xf << FW_PHY_CFG_RX_CHAIN_POS, 443 FW_PHY_CFG_RX_CHAIN = 0xf << FW_PHY_CFG_RX_CHAIN_POS,
444 FW_PHY_CFG_SHARED_CLK = BIT(31),
444}; 445};
445 446
446#define IWL_UCODE_MAX_CS 1 447#define IWL_UCODE_MAX_CS 1
diff --git a/drivers/net/wireless/intel/iwlwifi/iwl-config.h b/drivers/net/wireless/intel/iwlwifi/iwl-config.h
index 258d439bb0a9..f0f5636dd3ea 100644
--- a/drivers/net/wireless/intel/iwlwifi/iwl-config.h
+++ b/drivers/net/wireless/intel/iwlwifi/iwl-config.h
@@ -398,6 +398,7 @@ struct iwl_cfg {
398 u8 ucode_api_max; 398 u8 ucode_api_max;
399 u8 ucode_api_min; 399 u8 ucode_api_min;
400 u32 min_umac_error_event_table; 400 u32 min_umac_error_event_table;
401 u32 extra_phy_cfg_flags;
401}; 402};
402 403
403/* 404/*
@@ -477,6 +478,10 @@ extern const struct iwl_cfg iwl9460_2ac_cfg_soc;
477extern const struct iwl_cfg iwl9461_2ac_cfg_soc; 478extern const struct iwl_cfg iwl9461_2ac_cfg_soc;
478extern const struct iwl_cfg iwl9462_2ac_cfg_soc; 479extern const struct iwl_cfg iwl9462_2ac_cfg_soc;
479extern const struct iwl_cfg iwl9560_2ac_cfg_soc; 480extern const struct iwl_cfg iwl9560_2ac_cfg_soc;
481extern const struct iwl_cfg iwl9460_2ac_cfg_shared_clk;
482extern const struct iwl_cfg iwl9461_2ac_cfg_shared_clk;
483extern const struct iwl_cfg iwl9462_2ac_cfg_shared_clk;
484extern const struct iwl_cfg iwl9560_2ac_cfg_shared_clk;
480extern const struct iwl_cfg iwl22000_2ac_cfg_hr; 485extern const struct iwl_cfg iwl22000_2ac_cfg_hr;
481extern const struct iwl_cfg iwl22000_2ac_cfg_hr_cdb; 486extern const struct iwl_cfg iwl22000_2ac_cfg_hr_cdb;
482extern const struct iwl_cfg iwl22000_2ac_cfg_jf; 487extern const struct iwl_cfg iwl22000_2ac_cfg_jf;
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/fw.c b/drivers/net/wireless/intel/iwlwifi/mvm/fw.c
index 0920be637b57..3c59109bea20 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/fw.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/fw.c
@@ -433,6 +433,10 @@ static int iwl_send_phy_cfg_cmd(struct iwl_mvm *mvm)
433 433
434 /* Set parameters */ 434 /* Set parameters */
435 phy_cfg_cmd.phy_cfg = cpu_to_le32(iwl_mvm_get_phy_config(mvm)); 435 phy_cfg_cmd.phy_cfg = cpu_to_le32(iwl_mvm_get_phy_config(mvm));
436
437 /* set flags extra PHY configuration flags from the device's cfg */
438 phy_cfg_cmd.phy_cfg |= cpu_to_le32(mvm->cfg->extra_phy_cfg_flags);
439
436 phy_cfg_cmd.calib_control.event_trigger = 440 phy_cfg_cmd.calib_control.event_trigger =
437 mvm->fw->default_calib[ucode_type].event_trigger; 441 mvm->fw->default_calib[ucode_type].event_trigger;
438 phy_cfg_cmd.calib_control.flow_trigger = 442 phy_cfg_cmd.calib_control.flow_trigger =
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c b/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c
index ebf511150f4d..7152fdc00fb1 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c
@@ -2132,10 +2132,10 @@ static int iwl_mvm_start_ap_ibss(struct ieee80211_hw *hw,
2132 * Send the bcast station. At this stage the TBTT and DTIM time 2132 * Send the bcast station. At this stage the TBTT and DTIM time
2133 * events are added and applied to the scheduler 2133 * events are added and applied to the scheduler
2134 */ 2134 */
2135 iwl_mvm_send_add_bcast_sta(mvm, vif); 2135 ret = iwl_mvm_send_add_bcast_sta(mvm, vif);
2136 if (ret) 2136 if (ret)
2137 goto out_unbind; 2137 goto out_unbind;
2138 iwl_mvm_add_mcast_sta(mvm, vif); 2138 ret = iwl_mvm_add_mcast_sta(mvm, vif);
2139 if (ret) { 2139 if (ret) {
2140 iwl_mvm_send_rm_bcast_sta(mvm, vif); 2140 iwl_mvm_send_rm_bcast_sta(mvm, vif);
2141 goto out_unbind; 2141 goto out_unbind;
@@ -3494,6 +3494,7 @@ static int __iwl_mvm_assign_vif_chanctx(struct iwl_mvm *mvm,
3494 ret = 0; 3494 ret = 0;
3495 goto out; 3495 goto out;
3496 case NL80211_IFTYPE_STATION: 3496 case NL80211_IFTYPE_STATION:
3497 mvmvif->csa_bcn_pending = false;
3497 break; 3498 break;
3498 case NL80211_IFTYPE_MONITOR: 3499 case NL80211_IFTYPE_MONITOR:
3499 /* always disable PS when a monitor interface is active */ 3500 /* always disable PS when a monitor interface is active */
@@ -3537,7 +3538,7 @@ static int __iwl_mvm_assign_vif_chanctx(struct iwl_mvm *mvm,
3537 } 3538 }
3538 3539
3539 if (switching_chanctx && vif->type == NL80211_IFTYPE_STATION) { 3540 if (switching_chanctx && vif->type == NL80211_IFTYPE_STATION) {
3540 u32 duration = 2 * vif->bss_conf.beacon_int; 3541 u32 duration = 3 * vif->bss_conf.beacon_int;
3541 3542
3542 /* iwl_mvm_protect_session() reads directly from the 3543 /* iwl_mvm_protect_session() reads directly from the
3543 * device (the system time), so make sure it is 3544 * device (the system time), so make sure it is
@@ -3550,6 +3551,7 @@ static int __iwl_mvm_assign_vif_chanctx(struct iwl_mvm *mvm,
3550 /* Protect the session to make sure we hear the first 3551 /* Protect the session to make sure we hear the first
3551 * beacon on the new channel. 3552 * beacon on the new channel.
3552 */ 3553 */
3554 mvmvif->csa_bcn_pending = true;
3553 iwl_mvm_protect_session(mvm, vif, duration, duration, 3555 iwl_mvm_protect_session(mvm, vif, duration, duration,
3554 vif->bss_conf.beacon_int / 2, 3556 vif->bss_conf.beacon_int / 2,
3555 true); 3557 true);
@@ -3988,6 +3990,7 @@ static int iwl_mvm_post_channel_switch(struct ieee80211_hw *hw,
3988 if (vif->type == NL80211_IFTYPE_STATION) { 3990 if (vif->type == NL80211_IFTYPE_STATION) {
3989 struct iwl_mvm_sta *mvmsta; 3991 struct iwl_mvm_sta *mvmsta;
3990 3992
3993 mvmvif->csa_bcn_pending = false;
3991 mvmsta = iwl_mvm_sta_from_staid_protected(mvm, 3994 mvmsta = iwl_mvm_sta_from_staid_protected(mvm,
3992 mvmvif->ap_sta_id); 3995 mvmvif->ap_sta_id);
3993 3996
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/mvm.h b/drivers/net/wireless/intel/iwlwifi/mvm/mvm.h
index 89ff02d7c876..625b238a3f0a 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/mvm.h
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/mvm.h
@@ -438,6 +438,9 @@ struct iwl_mvm_vif {
438 bool csa_failed; 438 bool csa_failed;
439 u16 csa_target_freq; 439 u16 csa_target_freq;
440 440
441 /* Indicates that we are waiting for a beacon on a new channel */
442 bool csa_bcn_pending;
443
441 /* TCP Checksum Offload */ 444 /* TCP Checksum Offload */
442 netdev_features_t features; 445 netdev_features_t features;
443}; 446};
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/phy-ctxt.c b/drivers/net/wireless/intel/iwlwifi/mvm/phy-ctxt.c
index 305cd56bf746..7f5434b34d0d 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/phy-ctxt.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/phy-ctxt.c
@@ -8,6 +8,7 @@
8 * Copyright(c) 2012 - 2014 Intel Corporation. All rights reserved. 8 * Copyright(c) 2012 - 2014 Intel Corporation. All rights reserved.
9 * Copyright(c) 2013 - 2014 Intel Mobile Communications GmbH 9 * Copyright(c) 2013 - 2014 Intel Mobile Communications GmbH
10 * Copyright(c) 2017 Intel Deutschland GmbH 10 * Copyright(c) 2017 Intel Deutschland GmbH
11 * Copyright(c) 2018 Intel Corporation
11 * 12 *
12 * This program is free software; you can redistribute it and/or modify 13 * This program is free software; you can redistribute it and/or modify
13 * it under the terms of version 2 of the GNU General Public License as 14 * it under the terms of version 2 of the GNU General Public License as
@@ -18,11 +19,6 @@
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 * General Public License for more details. 20 * General Public License for more details.
20 * 21 *
21 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, write to the Free Software
23 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110,
24 * USA
25 *
26 * The full GNU General Public License is included in this distribution 22 * The full GNU General Public License is included in this distribution
27 * in the file called COPYING. 23 * in the file called COPYING.
28 * 24 *
@@ -34,6 +30,7 @@
34 * 30 *
35 * Copyright(c) 2012 - 2014 Intel Corporation. All rights reserved. 31 * Copyright(c) 2012 - 2014 Intel Corporation. All rights reserved.
36 * Copyright(c) 2013 - 2014 Intel Mobile Communications GmbH 32 * Copyright(c) 2013 - 2014 Intel Mobile Communications GmbH
33 * Copyright(c) 2018 Intel Corporation
37 * All rights reserved. 34 * All rights reserved.
38 * 35 *
39 * Redistribution and use in source and binary forms, with or without 36 * Redistribution and use in source and binary forms, with or without
@@ -286,6 +283,20 @@ void iwl_mvm_phy_ctxt_unref(struct iwl_mvm *mvm, struct iwl_mvm_phy_ctxt *ctxt)
286 return; 283 return;
287 284
288 ctxt->ref--; 285 ctxt->ref--;
286
287 /*
288 * Move unused phy's to a default channel. When the phy is moved the,
289 * fw will cleanup immediate quiet bit if it was previously set,
290 * otherwise we might not be able to reuse this phy.
291 */
292 if (ctxt->ref == 0) {
293 struct ieee80211_channel *chan;
294 struct cfg80211_chan_def chandef;
295
296 chan = &mvm->hw->wiphy->bands[NL80211_BAND_2GHZ]->channels[0];
297 cfg80211_chandef_create(&chandef, chan, NL80211_CHAN_NO_HT);
298 iwl_mvm_phy_ctxt_changed(mvm, ctxt, &chandef, 1, 1);
299 }
289} 300}
290 301
291static void iwl_mvm_binding_iterator(void *_data, u8 *mac, 302static void iwl_mvm_binding_iterator(void *_data, u8 *mac,
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/sta.c b/drivers/net/wireless/intel/iwlwifi/mvm/sta.c
index 630e23cb0ffb..80067eb9ea05 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/sta.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/sta.c
@@ -1695,7 +1695,8 @@ int iwl_mvm_allocate_int_sta(struct iwl_mvm *mvm,
1695 u32 qmask, enum nl80211_iftype iftype, 1695 u32 qmask, enum nl80211_iftype iftype,
1696 enum iwl_sta_type type) 1696 enum iwl_sta_type type)
1697{ 1697{
1698 if (!test_bit(IWL_MVM_STATUS_IN_HW_RESTART, &mvm->status)) { 1698 if (!test_bit(IWL_MVM_STATUS_IN_HW_RESTART, &mvm->status) ||
1699 sta->sta_id == IWL_MVM_INVALID_STA) {
1699 sta->sta_id = iwl_mvm_find_free_sta_id(mvm, iftype); 1700 sta->sta_id = iwl_mvm_find_free_sta_id(mvm, iftype);
1700 if (WARN_ON_ONCE(sta->sta_id == IWL_MVM_INVALID_STA)) 1701 if (WARN_ON_ONCE(sta->sta_id == IWL_MVM_INVALID_STA))
1701 return -ENOSPC; 1702 return -ENOSPC;
@@ -2478,28 +2479,12 @@ int iwl_mvm_sta_tx_agg_start(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
2478 2479
2479 /* 2480 /*
2480 * Note the possible cases: 2481 * Note the possible cases:
2481 * 1. In DQA mode with an enabled TXQ - TXQ needs to become agg'ed 2482 * 1. An enabled TXQ - TXQ needs to become agg'ed
2482 * 2. Non-DQA mode: the TXQ hasn't yet been enabled, so find a free 2483 * 2. The TXQ hasn't yet been enabled, so find a free one and mark
2483 * one and mark it as reserved 2484 * it as reserved
2484 * 3. In DQA mode, but no traffic yet on this TID: same treatment as in
2485 * non-DQA mode, since the TXQ hasn't yet been allocated
2486 * Don't support case 3 for new TX path as it is not expected to happen
2487 * and aggregation will be offloaded soon anyway
2488 */ 2485 */
2489 txq_id = mvmsta->tid_data[tid].txq_id; 2486 txq_id = mvmsta->tid_data[tid].txq_id;
2490 if (iwl_mvm_has_new_tx_api(mvm)) { 2487 if (txq_id == IWL_MVM_INVALID_QUEUE) {
2491 if (txq_id == IWL_MVM_INVALID_QUEUE) {
2492 ret = -ENXIO;
2493 goto release_locks;
2494 }
2495 } else if (unlikely(mvm->queue_info[txq_id].status ==
2496 IWL_MVM_QUEUE_SHARED)) {
2497 ret = -ENXIO;
2498 IWL_DEBUG_TX_QUEUES(mvm,
2499 "Can't start tid %d agg on shared queue!\n",
2500 tid);
2501 goto release_locks;
2502 } else if (mvm->queue_info[txq_id].status != IWL_MVM_QUEUE_READY) {
2503 txq_id = iwl_mvm_find_free_queue(mvm, mvmsta->sta_id, 2488 txq_id = iwl_mvm_find_free_queue(mvm, mvmsta->sta_id,
2504 IWL_MVM_DQA_MIN_DATA_QUEUE, 2489 IWL_MVM_DQA_MIN_DATA_QUEUE,
2505 IWL_MVM_DQA_MAX_DATA_QUEUE); 2490 IWL_MVM_DQA_MAX_DATA_QUEUE);
@@ -2508,16 +2493,16 @@ int iwl_mvm_sta_tx_agg_start(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
2508 IWL_ERR(mvm, "Failed to allocate agg queue\n"); 2493 IWL_ERR(mvm, "Failed to allocate agg queue\n");
2509 goto release_locks; 2494 goto release_locks;
2510 } 2495 }
2511 /*
2512 * TXQ shouldn't be in inactive mode for non-DQA, so getting
2513 * an inactive queue from iwl_mvm_find_free_queue() is
2514 * certainly a bug
2515 */
2516 WARN_ON(mvm->queue_info[txq_id].status ==
2517 IWL_MVM_QUEUE_INACTIVE);
2518 2496
2519 /* TXQ hasn't yet been enabled, so mark it only as reserved */ 2497 /* TXQ hasn't yet been enabled, so mark it only as reserved */
2520 mvm->queue_info[txq_id].status = IWL_MVM_QUEUE_RESERVED; 2498 mvm->queue_info[txq_id].status = IWL_MVM_QUEUE_RESERVED;
2499 } else if (unlikely(mvm->queue_info[txq_id].status ==
2500 IWL_MVM_QUEUE_SHARED)) {
2501 ret = -ENXIO;
2502 IWL_DEBUG_TX_QUEUES(mvm,
2503 "Can't start tid %d agg on shared queue!\n",
2504 tid);
2505 goto release_locks;
2521 } 2506 }
2522 2507
2523 spin_unlock(&mvm->queue_info_lock); 2508 spin_unlock(&mvm->queue_info_lock);
@@ -2696,8 +2681,10 @@ out:
2696 2681
2697static void iwl_mvm_unreserve_agg_queue(struct iwl_mvm *mvm, 2682static void iwl_mvm_unreserve_agg_queue(struct iwl_mvm *mvm,
2698 struct iwl_mvm_sta *mvmsta, 2683 struct iwl_mvm_sta *mvmsta,
2699 u16 txq_id) 2684 struct iwl_mvm_tid_data *tid_data)
2700{ 2685{
2686 u16 txq_id = tid_data->txq_id;
2687
2701 if (iwl_mvm_has_new_tx_api(mvm)) 2688 if (iwl_mvm_has_new_tx_api(mvm))
2702 return; 2689 return;
2703 2690
@@ -2709,8 +2696,10 @@ static void iwl_mvm_unreserve_agg_queue(struct iwl_mvm *mvm,
2709 * allocated through iwl_mvm_enable_txq, so we can just mark it back as 2696 * allocated through iwl_mvm_enable_txq, so we can just mark it back as
2710 * free. 2697 * free.
2711 */ 2698 */
2712 if (mvm->queue_info[txq_id].status == IWL_MVM_QUEUE_RESERVED) 2699 if (mvm->queue_info[txq_id].status == IWL_MVM_QUEUE_RESERVED) {
2713 mvm->queue_info[txq_id].status = IWL_MVM_QUEUE_FREE; 2700 mvm->queue_info[txq_id].status = IWL_MVM_QUEUE_FREE;
2701 tid_data->txq_id = IWL_MVM_INVALID_QUEUE;
2702 }
2714 2703
2715 spin_unlock_bh(&mvm->queue_info_lock); 2704 spin_unlock_bh(&mvm->queue_info_lock);
2716} 2705}
@@ -2741,7 +2730,7 @@ int iwl_mvm_sta_tx_agg_stop(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
2741 2730
2742 mvmsta->agg_tids &= ~BIT(tid); 2731 mvmsta->agg_tids &= ~BIT(tid);
2743 2732
2744 iwl_mvm_unreserve_agg_queue(mvm, mvmsta, txq_id); 2733 iwl_mvm_unreserve_agg_queue(mvm, mvmsta, tid_data);
2745 2734
2746 switch (tid_data->state) { 2735 switch (tid_data->state) {
2747 case IWL_AGG_ON: 2736 case IWL_AGG_ON:
@@ -2808,7 +2797,7 @@ int iwl_mvm_sta_tx_agg_flush(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
2808 mvmsta->agg_tids &= ~BIT(tid); 2797 mvmsta->agg_tids &= ~BIT(tid);
2809 spin_unlock_bh(&mvmsta->lock); 2798 spin_unlock_bh(&mvmsta->lock);
2810 2799
2811 iwl_mvm_unreserve_agg_queue(mvm, mvmsta, txq_id); 2800 iwl_mvm_unreserve_agg_queue(mvm, mvmsta, tid_data);
2812 2801
2813 if (old_state >= IWL_AGG_ON) { 2802 if (old_state >= IWL_AGG_ON) {
2814 iwl_mvm_drain_sta(mvm, mvmsta, true); 2803 iwl_mvm_drain_sta(mvm, mvmsta, true);
@@ -3233,17 +3222,9 @@ int iwl_mvm_set_sta_key(struct iwl_mvm *mvm,
3233 } 3222 }
3234 sta_id = mvm_sta->sta_id; 3223 sta_id = mvm_sta->sta_id;
3235 3224
3236 if (keyconf->cipher == WLAN_CIPHER_SUITE_AES_CMAC ||
3237 keyconf->cipher == WLAN_CIPHER_SUITE_BIP_GMAC_128 ||
3238 keyconf->cipher == WLAN_CIPHER_SUITE_BIP_GMAC_256) {
3239 ret = iwl_mvm_send_sta_igtk(mvm, keyconf, sta_id,
3240 false);
3241 goto end;
3242 }
3243
3244 /* 3225 /*
3245 * It is possible that the 'sta' parameter is NULL, and thus 3226 * It is possible that the 'sta' parameter is NULL, and thus
3246 * there is a need to retrieve the sta from the local station 3227 * there is a need to retrieve the sta from the local station
3247 * table. 3228 * table.
3248 */ 3229 */
3249 if (!sta) { 3230 if (!sta) {
@@ -3258,6 +3239,17 @@ int iwl_mvm_set_sta_key(struct iwl_mvm *mvm,
3258 3239
3259 if (WARN_ON_ONCE(iwl_mvm_sta_from_mac80211(sta)->vif != vif)) 3240 if (WARN_ON_ONCE(iwl_mvm_sta_from_mac80211(sta)->vif != vif))
3260 return -EINVAL; 3241 return -EINVAL;
3242 } else {
3243 struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif);
3244
3245 sta_id = mvmvif->mcast_sta.sta_id;
3246 }
3247
3248 if (keyconf->cipher == WLAN_CIPHER_SUITE_AES_CMAC ||
3249 keyconf->cipher == WLAN_CIPHER_SUITE_BIP_GMAC_128 ||
3250 keyconf->cipher == WLAN_CIPHER_SUITE_BIP_GMAC_256) {
3251 ret = iwl_mvm_send_sta_igtk(mvm, keyconf, sta_id, false);
3252 goto end;
3261 } 3253 }
3262 3254
3263 /* If the key_offset is not pre-assigned, we need to find a 3255 /* If the key_offset is not pre-assigned, we need to find a
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/time-event.c b/drivers/net/wireless/intel/iwlwifi/mvm/time-event.c
index acb217e666db..cd91bc44259c 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/time-event.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/time-event.c
@@ -8,6 +8,7 @@
8 * Copyright(c) 2012 - 2014 Intel Corporation. All rights reserved. 8 * Copyright(c) 2012 - 2014 Intel Corporation. All rights reserved.
9 * Copyright(c) 2013 - 2015 Intel Mobile Communications GmbH 9 * Copyright(c) 2013 - 2015 Intel Mobile Communications GmbH
10 * Copyright(c) 2017 Intel Deutschland GmbH 10 * Copyright(c) 2017 Intel Deutschland GmbH
11 * Copyright(c) 2018 Intel Corporation
11 * 12 *
12 * This program is free software; you can redistribute it and/or modify 13 * This program is free software; you can redistribute it and/or modify
13 * it under the terms of version 2 of the GNU General Public License as 14 * it under the terms of version 2 of the GNU General Public License as
@@ -18,11 +19,6 @@
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 * General Public License for more details. 20 * General Public License for more details.
20 * 21 *
21 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, write to the Free Software
23 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110,
24 * USA
25 *
26 * The full GNU General Public License is included in this distribution 22 * The full GNU General Public License is included in this distribution
27 * in the file called COPYING. 23 * in the file called COPYING.
28 * 24 *
@@ -35,6 +31,7 @@
35 * Copyright(c) 2012 - 2014 Intel Corporation. All rights reserved. 31 * Copyright(c) 2012 - 2014 Intel Corporation. All rights reserved.
36 * Copyright(c) 2013 - 2015 Intel Mobile Communications GmbH 32 * Copyright(c) 2013 - 2015 Intel Mobile Communications GmbH
37 * Copyright(c) 2017 Intel Deutschland GmbH 33 * Copyright(c) 2017 Intel Deutschland GmbH
34 * Copyright(c) 2018 Intel Corporation
38 * All rights reserved. 35 * All rights reserved.
39 * 36 *
40 * Redistribution and use in source and binary forms, with or without 37 * Redistribution and use in source and binary forms, with or without
@@ -198,9 +195,13 @@ static bool iwl_mvm_te_check_disconnect(struct iwl_mvm *mvm,
198 struct ieee80211_vif *vif, 195 struct ieee80211_vif *vif,
199 const char *errmsg) 196 const char *errmsg)
200{ 197{
198 struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif);
199
201 if (vif->type != NL80211_IFTYPE_STATION) 200 if (vif->type != NL80211_IFTYPE_STATION)
202 return false; 201 return false;
203 if (vif->bss_conf.assoc && vif->bss_conf.dtim_period) 202
203 if (!mvmvif->csa_bcn_pending && vif->bss_conf.assoc &&
204 vif->bss_conf.dtim_period)
204 return false; 205 return false;
205 if (errmsg) 206 if (errmsg)
206 IWL_ERR(mvm, "%s\n", errmsg); 207 IWL_ERR(mvm, "%s\n", errmsg);
@@ -344,7 +345,7 @@ static void iwl_mvm_te_handle_notif(struct iwl_mvm *mvm,
344 * and know the dtim period. 345 * and know the dtim period.
345 */ 346 */
346 iwl_mvm_te_check_disconnect(mvm, te_data->vif, 347 iwl_mvm_te_check_disconnect(mvm, te_data->vif,
347 "No association and the time event is over already..."); 348 "No beacon heard and the time event is over already...");
348 break; 349 break;
349 default: 350 default:
350 break; 351 break;
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/tx.c b/drivers/net/wireless/intel/iwlwifi/mvm/tx.c
index af6dfceab6b8..7dfe4cde55e3 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/tx.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/tx.c
@@ -1894,14 +1894,12 @@ int iwl_mvm_flush_sta(struct iwl_mvm *mvm, void *sta, bool internal, u32 flags)
1894 struct iwl_mvm_int_sta *int_sta = sta; 1894 struct iwl_mvm_int_sta *int_sta = sta;
1895 struct iwl_mvm_sta *mvm_sta = sta; 1895 struct iwl_mvm_sta *mvm_sta = sta;
1896 1896
1897 if (iwl_mvm_has_new_tx_api(mvm)) { 1897 BUILD_BUG_ON(offsetof(struct iwl_mvm_int_sta, sta_id) !=
1898 if (internal) 1898 offsetof(struct iwl_mvm_sta, sta_id));
1899 return iwl_mvm_flush_sta_tids(mvm, int_sta->sta_id,
1900 BIT(IWL_MGMT_TID), flags);
1901 1899
1900 if (iwl_mvm_has_new_tx_api(mvm))
1902 return iwl_mvm_flush_sta_tids(mvm, mvm_sta->sta_id, 1901 return iwl_mvm_flush_sta_tids(mvm, mvm_sta->sta_id,
1903 0xFF, flags); 1902 0xff | BIT(IWL_MGMT_TID), flags);
1904 }
1905 1903
1906 if (internal) 1904 if (internal)
1907 return iwl_mvm_flush_tx_path(mvm, int_sta->tfd_queue_msk, 1905 return iwl_mvm_flush_tx_path(mvm, int_sta->tfd_queue_msk,
diff --git a/drivers/net/wireless/intel/iwlwifi/pcie/drv.c b/drivers/net/wireless/intel/iwlwifi/pcie/drv.c
index 56fc28750a41..e323d3abb6ac 100644
--- a/drivers/net/wireless/intel/iwlwifi/pcie/drv.c
+++ b/drivers/net/wireless/intel/iwlwifi/pcie/drv.c
@@ -579,25 +579,25 @@ static const struct pci_device_id iwl_hw_card_ids[] = {
579 {IWL_PCI_DEVICE(0x30DC, 0x0264, iwl9461_2ac_cfg_soc)}, 579 {IWL_PCI_DEVICE(0x30DC, 0x0264, iwl9461_2ac_cfg_soc)},
580 {IWL_PCI_DEVICE(0x30DC, 0x02A0, iwl9462_2ac_cfg_soc)}, 580 {IWL_PCI_DEVICE(0x30DC, 0x02A0, iwl9462_2ac_cfg_soc)},
581 {IWL_PCI_DEVICE(0x30DC, 0x02A4, iwl9462_2ac_cfg_soc)}, 581 {IWL_PCI_DEVICE(0x30DC, 0x02A4, iwl9462_2ac_cfg_soc)},
582 {IWL_PCI_DEVICE(0x31DC, 0x0030, iwl9560_2ac_cfg_soc)}, 582 {IWL_PCI_DEVICE(0x31DC, 0x0030, iwl9560_2ac_cfg_shared_clk)},
583 {IWL_PCI_DEVICE(0x31DC, 0x0034, iwl9560_2ac_cfg_soc)}, 583 {IWL_PCI_DEVICE(0x31DC, 0x0034, iwl9560_2ac_cfg_shared_clk)},
584 {IWL_PCI_DEVICE(0x31DC, 0x0038, iwl9560_2ac_cfg_soc)}, 584 {IWL_PCI_DEVICE(0x31DC, 0x0038, iwl9560_2ac_cfg_shared_clk)},
585 {IWL_PCI_DEVICE(0x31DC, 0x003C, iwl9560_2ac_cfg_soc)}, 585 {IWL_PCI_DEVICE(0x31DC, 0x003C, iwl9560_2ac_cfg_shared_clk)},
586 {IWL_PCI_DEVICE(0x31DC, 0x0060, iwl9460_2ac_cfg_soc)}, 586 {IWL_PCI_DEVICE(0x31DC, 0x0060, iwl9460_2ac_cfg_shared_clk)},
587 {IWL_PCI_DEVICE(0x31DC, 0x0064, iwl9461_2ac_cfg_soc)}, 587 {IWL_PCI_DEVICE(0x31DC, 0x0064, iwl9461_2ac_cfg_shared_clk)},
588 {IWL_PCI_DEVICE(0x31DC, 0x00A0, iwl9462_2ac_cfg_soc)}, 588 {IWL_PCI_DEVICE(0x31DC, 0x00A0, iwl9462_2ac_cfg_shared_clk)},
589 {IWL_PCI_DEVICE(0x31DC, 0x00A4, iwl9462_2ac_cfg_soc)}, 589 {IWL_PCI_DEVICE(0x31DC, 0x00A4, iwl9462_2ac_cfg_shared_clk)},
590 {IWL_PCI_DEVICE(0x31DC, 0x0230, iwl9560_2ac_cfg_soc)}, 590 {IWL_PCI_DEVICE(0x31DC, 0x0230, iwl9560_2ac_cfg_shared_clk)},
591 {IWL_PCI_DEVICE(0x31DC, 0x0234, iwl9560_2ac_cfg_soc)}, 591 {IWL_PCI_DEVICE(0x31DC, 0x0234, iwl9560_2ac_cfg_shared_clk)},
592 {IWL_PCI_DEVICE(0x31DC, 0x0238, iwl9560_2ac_cfg_soc)}, 592 {IWL_PCI_DEVICE(0x31DC, 0x0238, iwl9560_2ac_cfg_shared_clk)},
593 {IWL_PCI_DEVICE(0x31DC, 0x023C, iwl9560_2ac_cfg_soc)}, 593 {IWL_PCI_DEVICE(0x31DC, 0x023C, iwl9560_2ac_cfg_shared_clk)},
594 {IWL_PCI_DEVICE(0x31DC, 0x0260, iwl9461_2ac_cfg_soc)}, 594 {IWL_PCI_DEVICE(0x31DC, 0x0260, iwl9461_2ac_cfg_shared_clk)},
595 {IWL_PCI_DEVICE(0x31DC, 0x0264, iwl9461_2ac_cfg_soc)}, 595 {IWL_PCI_DEVICE(0x31DC, 0x0264, iwl9461_2ac_cfg_shared_clk)},
596 {IWL_PCI_DEVICE(0x31DC, 0x02A0, iwl9462_2ac_cfg_soc)}, 596 {IWL_PCI_DEVICE(0x31DC, 0x02A0, iwl9462_2ac_cfg_shared_clk)},
597 {IWL_PCI_DEVICE(0x31DC, 0x02A4, iwl9462_2ac_cfg_soc)}, 597 {IWL_PCI_DEVICE(0x31DC, 0x02A4, iwl9462_2ac_cfg_shared_clk)},
598 {IWL_PCI_DEVICE(0x31DC, 0x4030, iwl9560_2ac_cfg_soc)}, 598 {IWL_PCI_DEVICE(0x31DC, 0x4030, iwl9560_2ac_cfg_shared_clk)},
599 {IWL_PCI_DEVICE(0x31DC, 0x4034, iwl9560_2ac_cfg_soc)}, 599 {IWL_PCI_DEVICE(0x31DC, 0x4034, iwl9560_2ac_cfg_shared_clk)},
600 {IWL_PCI_DEVICE(0x31DC, 0x40A4, iwl9462_2ac_cfg_soc)}, 600 {IWL_PCI_DEVICE(0x31DC, 0x40A4, iwl9462_2ac_cfg_shared_clk)},
601 {IWL_PCI_DEVICE(0x34F0, 0x0030, iwl9560_2ac_cfg_soc)}, 601 {IWL_PCI_DEVICE(0x34F0, 0x0030, iwl9560_2ac_cfg_soc)},
602 {IWL_PCI_DEVICE(0x34F0, 0x0034, iwl9560_2ac_cfg_soc)}, 602 {IWL_PCI_DEVICE(0x34F0, 0x0034, iwl9560_2ac_cfg_soc)},
603 {IWL_PCI_DEVICE(0x34F0, 0x02A4, iwl9462_2ac_cfg_soc)}, 603 {IWL_PCI_DEVICE(0x34F0, 0x02A4, iwl9462_2ac_cfg_soc)},
diff --git a/drivers/vhost/net.c b/drivers/vhost/net.c
index 8139bc70ad7d..12bcfbac2cc9 100644
--- a/drivers/vhost/net.c
+++ b/drivers/vhost/net.c
@@ -630,7 +630,7 @@ static int vhost_net_rx_peek_head_len(struct vhost_net *net, struct sock *sk)
630 630
631 if (!len && vq->busyloop_timeout) { 631 if (!len && vq->busyloop_timeout) {
632 /* Both tx vq and rx socket were polled here */ 632 /* Both tx vq and rx socket were polled here */
633 mutex_lock(&vq->mutex); 633 mutex_lock_nested(&vq->mutex, 1);
634 vhost_disable_notify(&net->dev, vq); 634 vhost_disable_notify(&net->dev, vq);
635 635
636 preempt_disable(); 636 preempt_disable();
@@ -763,7 +763,7 @@ static void handle_rx(struct vhost_net *net)
763 struct iov_iter fixup; 763 struct iov_iter fixup;
764 __virtio16 num_buffers; 764 __virtio16 num_buffers;
765 765
766 mutex_lock(&vq->mutex); 766 mutex_lock_nested(&vq->mutex, 0);
767 sock = vq->private_data; 767 sock = vq->private_data;
768 if (!sock) 768 if (!sock)
769 goto out; 769 goto out;
diff --git a/drivers/vhost/vhost.c b/drivers/vhost/vhost.c
index 1b3e8d2d5c8b..5320039671b7 100644
--- a/drivers/vhost/vhost.c
+++ b/drivers/vhost/vhost.c
@@ -212,8 +212,7 @@ int vhost_poll_start(struct vhost_poll *poll, struct file *file)
212 if (mask) 212 if (mask)
213 vhost_poll_wakeup(&poll->wait, 0, 0, poll_to_key(mask)); 213 vhost_poll_wakeup(&poll->wait, 0, 0, poll_to_key(mask));
214 if (mask & EPOLLERR) { 214 if (mask & EPOLLERR) {
215 if (poll->wqh) 215 vhost_poll_stop(poll);
216 remove_wait_queue(poll->wqh, &poll->wait);
217 ret = -EINVAL; 216 ret = -EINVAL;
218 } 217 }
219 218
@@ -1245,14 +1244,12 @@ static int vq_log_access_ok(struct vhost_virtqueue *vq,
1245/* Caller should have vq mutex and device mutex */ 1244/* Caller should have vq mutex and device mutex */
1246int vhost_vq_access_ok(struct vhost_virtqueue *vq) 1245int vhost_vq_access_ok(struct vhost_virtqueue *vq)
1247{ 1246{
1248 if (vq->iotlb) { 1247 int ret = vq_log_access_ok(vq, vq->log_base);
1249 /* When device IOTLB was used, the access validation 1248
1250 * will be validated during prefetching. 1249 if (ret || vq->iotlb)
1251 */ 1250 return ret;
1252 return 1; 1251
1253 } 1252 return vq_access_ok(vq, vq->num, vq->desc, vq->avail, vq->used);
1254 return vq_access_ok(vq, vq->num, vq->desc, vq->avail, vq->used) &&
1255 vq_log_access_ok(vq, vq->log_base);
1256} 1253}
1257EXPORT_SYMBOL_GPL(vhost_vq_access_ok); 1254EXPORT_SYMBOL_GPL(vhost_vq_access_ok);
1258 1255