diff options
93 files changed, 828 insertions, 460 deletions
diff --git a/MAINTAINERS b/MAINTAINERS index 66de4da2d244..2ebe195951af 100644 --- a/MAINTAINERS +++ b/MAINTAINERS | |||
@@ -8009,6 +8009,7 @@ Q: http://patchwork.kernel.org/project/linux-wireless/list/ | |||
8009 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/kvalo/wireless-drivers.git | 8009 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/kvalo/wireless-drivers.git |
8010 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/kvalo/wireless-drivers-next.git | 8010 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/kvalo/wireless-drivers-next.git |
8011 | S: Maintained | 8011 | S: Maintained |
8012 | F: Documentation/devicetree/bindings/net/wireless/ | ||
8012 | F: drivers/net/wireless/ | 8013 | F: drivers/net/wireless/ |
8013 | 8014 | ||
8014 | NETXEN (1/10) GbE SUPPORT | 8015 | NETXEN (1/10) GbE SUPPORT |
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c index c5fe915870ad..a59d55e25d5f 100644 --- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c +++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c | |||
@@ -12895,52 +12895,71 @@ static int __bnx2x_vlan_configure_vid(struct bnx2x *bp, u16 vid, bool add) | |||
12895 | return rc; | 12895 | return rc; |
12896 | } | 12896 | } |
12897 | 12897 | ||
12898 | int bnx2x_vlan_reconfigure_vid(struct bnx2x *bp) | 12898 | static int bnx2x_vlan_configure_vid_list(struct bnx2x *bp) |
12899 | { | 12899 | { |
12900 | struct bnx2x_vlan_entry *vlan; | 12900 | struct bnx2x_vlan_entry *vlan; |
12901 | int rc = 0; | 12901 | int rc = 0; |
12902 | 12902 | ||
12903 | if (!bp->vlan_cnt) { | 12903 | /* Configure all non-configured entries */ |
12904 | DP(NETIF_MSG_IFUP, "No need to re-configure vlan filters\n"); | ||
12905 | return 0; | ||
12906 | } | ||
12907 | |||
12908 | list_for_each_entry(vlan, &bp->vlan_reg, link) { | 12904 | list_for_each_entry(vlan, &bp->vlan_reg, link) { |
12909 | /* Prepare for cleanup in case of errors */ | 12905 | if (vlan->hw) |
12910 | if (rc) { | ||
12911 | vlan->hw = false; | ||
12912 | continue; | ||
12913 | } | ||
12914 | |||
12915 | if (!vlan->hw) | ||
12916 | continue; | 12906 | continue; |
12917 | 12907 | ||
12918 | DP(NETIF_MSG_IFUP, "Re-configuring vlan 0x%04x\n", vlan->vid); | 12908 | if (bp->vlan_cnt >= bp->vlan_credit) |
12909 | return -ENOBUFS; | ||
12919 | 12910 | ||
12920 | rc = __bnx2x_vlan_configure_vid(bp, vlan->vid, true); | 12911 | rc = __bnx2x_vlan_configure_vid(bp, vlan->vid, true); |
12921 | if (rc) { | 12912 | if (rc) { |
12922 | BNX2X_ERR("Unable to configure VLAN %d\n", vlan->vid); | 12913 | BNX2X_ERR("Unable to config VLAN %d\n", vlan->vid); |
12923 | vlan->hw = false; | 12914 | return rc; |
12924 | rc = -EINVAL; | ||
12925 | continue; | ||
12926 | } | 12915 | } |
12916 | |||
12917 | DP(NETIF_MSG_IFUP, "HW configured for VLAN %d\n", vlan->vid); | ||
12918 | vlan->hw = true; | ||
12919 | bp->vlan_cnt++; | ||
12927 | } | 12920 | } |
12928 | 12921 | ||
12929 | return rc; | 12922 | return 0; |
12923 | } | ||
12924 | |||
12925 | static void bnx2x_vlan_configure(struct bnx2x *bp, bool set_rx_mode) | ||
12926 | { | ||
12927 | bool need_accept_any_vlan; | ||
12928 | |||
12929 | need_accept_any_vlan = !!bnx2x_vlan_configure_vid_list(bp); | ||
12930 | |||
12931 | if (bp->accept_any_vlan != need_accept_any_vlan) { | ||
12932 | bp->accept_any_vlan = need_accept_any_vlan; | ||
12933 | DP(NETIF_MSG_IFUP, "Accept all VLAN %s\n", | ||
12934 | bp->accept_any_vlan ? "raised" : "cleared"); | ||
12935 | if (set_rx_mode) { | ||
12936 | if (IS_PF(bp)) | ||
12937 | bnx2x_set_rx_mode_inner(bp); | ||
12938 | else | ||
12939 | bnx2x_vfpf_storm_rx_mode(bp); | ||
12940 | } | ||
12941 | } | ||
12942 | } | ||
12943 | |||
12944 | int bnx2x_vlan_reconfigure_vid(struct bnx2x *bp) | ||
12945 | { | ||
12946 | struct bnx2x_vlan_entry *vlan; | ||
12947 | |||
12948 | /* The hw forgot all entries after reload */ | ||
12949 | list_for_each_entry(vlan, &bp->vlan_reg, link) | ||
12950 | vlan->hw = false; | ||
12951 | bp->vlan_cnt = 0; | ||
12952 | |||
12953 | /* Don't set rx mode here. Our caller will do it. */ | ||
12954 | bnx2x_vlan_configure(bp, false); | ||
12955 | |||
12956 | return 0; | ||
12930 | } | 12957 | } |
12931 | 12958 | ||
12932 | static int bnx2x_vlan_rx_add_vid(struct net_device *dev, __be16 proto, u16 vid) | 12959 | static int bnx2x_vlan_rx_add_vid(struct net_device *dev, __be16 proto, u16 vid) |
12933 | { | 12960 | { |
12934 | struct bnx2x *bp = netdev_priv(dev); | 12961 | struct bnx2x *bp = netdev_priv(dev); |
12935 | struct bnx2x_vlan_entry *vlan; | 12962 | struct bnx2x_vlan_entry *vlan; |
12936 | bool hw = false; | ||
12937 | int rc = 0; | ||
12938 | |||
12939 | if (!netif_running(bp->dev)) { | ||
12940 | DP(NETIF_MSG_IFUP, | ||
12941 | "Ignoring VLAN configuration the interface is down\n"); | ||
12942 | return -EFAULT; | ||
12943 | } | ||
12944 | 12963 | ||
12945 | DP(NETIF_MSG_IFUP, "Adding VLAN %d\n", vid); | 12964 | DP(NETIF_MSG_IFUP, "Adding VLAN %d\n", vid); |
12946 | 12965 | ||
@@ -12948,93 +12967,47 @@ static int bnx2x_vlan_rx_add_vid(struct net_device *dev, __be16 proto, u16 vid) | |||
12948 | if (!vlan) | 12967 | if (!vlan) |
12949 | return -ENOMEM; | 12968 | return -ENOMEM; |
12950 | 12969 | ||
12951 | bp->vlan_cnt++; | ||
12952 | if (bp->vlan_cnt > bp->vlan_credit && !bp->accept_any_vlan) { | ||
12953 | DP(NETIF_MSG_IFUP, "Accept all VLAN raised\n"); | ||
12954 | bp->accept_any_vlan = true; | ||
12955 | if (IS_PF(bp)) | ||
12956 | bnx2x_set_rx_mode_inner(bp); | ||
12957 | else | ||
12958 | bnx2x_vfpf_storm_rx_mode(bp); | ||
12959 | } else if (bp->vlan_cnt <= bp->vlan_credit) { | ||
12960 | rc = __bnx2x_vlan_configure_vid(bp, vid, true); | ||
12961 | hw = true; | ||
12962 | } | ||
12963 | |||
12964 | vlan->vid = vid; | 12970 | vlan->vid = vid; |
12965 | vlan->hw = hw; | 12971 | vlan->hw = false; |
12972 | list_add_tail(&vlan->link, &bp->vlan_reg); | ||
12966 | 12973 | ||
12967 | if (!rc) { | 12974 | if (netif_running(dev)) |
12968 | list_add(&vlan->link, &bp->vlan_reg); | 12975 | bnx2x_vlan_configure(bp, true); |
12969 | } else { | ||
12970 | bp->vlan_cnt--; | ||
12971 | kfree(vlan); | ||
12972 | } | ||
12973 | |||
12974 | DP(NETIF_MSG_IFUP, "Adding VLAN result %d\n", rc); | ||
12975 | 12976 | ||
12976 | return rc; | 12977 | return 0; |
12977 | } | 12978 | } |
12978 | 12979 | ||
12979 | static int bnx2x_vlan_rx_kill_vid(struct net_device *dev, __be16 proto, u16 vid) | 12980 | static int bnx2x_vlan_rx_kill_vid(struct net_device *dev, __be16 proto, u16 vid) |
12980 | { | 12981 | { |
12981 | struct bnx2x *bp = netdev_priv(dev); | 12982 | struct bnx2x *bp = netdev_priv(dev); |
12982 | struct bnx2x_vlan_entry *vlan; | 12983 | struct bnx2x_vlan_entry *vlan; |
12984 | bool found = false; | ||
12983 | int rc = 0; | 12985 | int rc = 0; |
12984 | 12986 | ||
12985 | if (!netif_running(bp->dev)) { | ||
12986 | DP(NETIF_MSG_IFUP, | ||
12987 | "Ignoring VLAN configuration the interface is down\n"); | ||
12988 | return -EFAULT; | ||
12989 | } | ||
12990 | |||
12991 | DP(NETIF_MSG_IFUP, "Removing VLAN %d\n", vid); | 12987 | DP(NETIF_MSG_IFUP, "Removing VLAN %d\n", vid); |
12992 | 12988 | ||
12993 | if (!bp->vlan_cnt) { | ||
12994 | BNX2X_ERR("Unable to kill VLAN %d\n", vid); | ||
12995 | return -EINVAL; | ||
12996 | } | ||
12997 | |||
12998 | list_for_each_entry(vlan, &bp->vlan_reg, link) | 12989 | list_for_each_entry(vlan, &bp->vlan_reg, link) |
12999 | if (vlan->vid == vid) | 12990 | if (vlan->vid == vid) { |
12991 | found = true; | ||
13000 | break; | 12992 | break; |
12993 | } | ||
13001 | 12994 | ||
13002 | if (vlan->vid != vid) { | 12995 | if (!found) { |
13003 | BNX2X_ERR("Unable to kill VLAN %d - not found\n", vid); | 12996 | BNX2X_ERR("Unable to kill VLAN %d - not found\n", vid); |
13004 | return -EINVAL; | 12997 | return -EINVAL; |
13005 | } | 12998 | } |
13006 | 12999 | ||
13007 | if (vlan->hw) | 13000 | if (netif_running(dev) && vlan->hw) { |
13008 | rc = __bnx2x_vlan_configure_vid(bp, vid, false); | 13001 | rc = __bnx2x_vlan_configure_vid(bp, vid, false); |
13002 | DP(NETIF_MSG_IFUP, "HW deconfigured for VLAN %d\n", vid); | ||
13003 | bp->vlan_cnt--; | ||
13004 | } | ||
13009 | 13005 | ||
13010 | list_del(&vlan->link); | 13006 | list_del(&vlan->link); |
13011 | kfree(vlan); | 13007 | kfree(vlan); |
13012 | 13008 | ||
13013 | bp->vlan_cnt--; | 13009 | if (netif_running(dev)) |
13014 | 13010 | bnx2x_vlan_configure(bp, true); | |
13015 | if (bp->vlan_cnt <= bp->vlan_credit && bp->accept_any_vlan) { | ||
13016 | /* Configure all non-configured entries */ | ||
13017 | list_for_each_entry(vlan, &bp->vlan_reg, link) { | ||
13018 | if (vlan->hw) | ||
13019 | continue; | ||
13020 | |||
13021 | rc = __bnx2x_vlan_configure_vid(bp, vlan->vid, true); | ||
13022 | if (rc) { | ||
13023 | BNX2X_ERR("Unable to config VLAN %d\n", | ||
13024 | vlan->vid); | ||
13025 | continue; | ||
13026 | } | ||
13027 | DP(NETIF_MSG_IFUP, "HW configured for VLAN %d\n", | ||
13028 | vlan->vid); | ||
13029 | vlan->hw = true; | ||
13030 | } | ||
13031 | DP(NETIF_MSG_IFUP, "Accept all VLAN Removed\n"); | ||
13032 | bp->accept_any_vlan = false; | ||
13033 | if (IS_PF(bp)) | ||
13034 | bnx2x_set_rx_mode_inner(bp); | ||
13035 | else | ||
13036 | bnx2x_vfpf_storm_rx_mode(bp); | ||
13037 | } | ||
13038 | 13011 | ||
13039 | DP(NETIF_MSG_IFUP, "Removing VLAN result %d\n", rc); | 13012 | DP(NETIF_MSG_IFUP, "Removing VLAN result %d\n", rc); |
13040 | 13013 | ||
diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethernet/broadcom/bnxt/bnxt.c index 72a2efff8e49..c777cde85ce4 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c | |||
@@ -286,7 +286,9 @@ static netdev_tx_t bnxt_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
286 | cpu_to_le32(DB_KEY_TX_PUSH | DB_LONG_TX_PUSH | prod); | 286 | cpu_to_le32(DB_KEY_TX_PUSH | DB_LONG_TX_PUSH | prod); |
287 | txr->tx_prod = prod; | 287 | txr->tx_prod = prod; |
288 | 288 | ||
289 | tx_buf->is_push = 1; | ||
289 | netdev_tx_sent_queue(txq, skb->len); | 290 | netdev_tx_sent_queue(txq, skb->len); |
291 | wmb(); /* Sync is_push and byte queue before pushing data */ | ||
290 | 292 | ||
291 | push_len = (length + sizeof(*tx_push) + 7) / 8; | 293 | push_len = (length + sizeof(*tx_push) + 7) / 8; |
292 | if (push_len > 16) { | 294 | if (push_len > 16) { |
@@ -298,7 +300,6 @@ static netdev_tx_t bnxt_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
298 | push_len); | 300 | push_len); |
299 | } | 301 | } |
300 | 302 | ||
301 | tx_buf->is_push = 1; | ||
302 | goto tx_done; | 303 | goto tx_done; |
303 | } | 304 | } |
304 | 305 | ||
@@ -1112,19 +1113,13 @@ static inline struct sk_buff *bnxt_tpa_end(struct bnxt *bp, | |||
1112 | if (tpa_info->hash_type != PKT_HASH_TYPE_NONE) | 1113 | if (tpa_info->hash_type != PKT_HASH_TYPE_NONE) |
1113 | skb_set_hash(skb, tpa_info->rss_hash, tpa_info->hash_type); | 1114 | skb_set_hash(skb, tpa_info->rss_hash, tpa_info->hash_type); |
1114 | 1115 | ||
1115 | if (tpa_info->flags2 & RX_CMP_FLAGS2_META_FORMAT_VLAN) { | 1116 | if ((tpa_info->flags2 & RX_CMP_FLAGS2_META_FORMAT_VLAN) && |
1116 | netdev_features_t features = skb->dev->features; | 1117 | (skb->dev->features & NETIF_F_HW_VLAN_CTAG_RX)) { |
1117 | u16 vlan_proto = tpa_info->metadata >> | 1118 | u16 vlan_proto = tpa_info->metadata >> |
1118 | RX_CMP_FLAGS2_METADATA_TPID_SFT; | 1119 | RX_CMP_FLAGS2_METADATA_TPID_SFT; |
1120 | u16 vtag = tpa_info->metadata & RX_CMP_FLAGS2_METADATA_VID_MASK; | ||
1119 | 1121 | ||
1120 | if (((features & NETIF_F_HW_VLAN_CTAG_RX) && | 1122 | __vlan_hwaccel_put_tag(skb, htons(vlan_proto), vtag); |
1121 | vlan_proto == ETH_P_8021Q) || | ||
1122 | ((features & NETIF_F_HW_VLAN_STAG_RX) && | ||
1123 | vlan_proto == ETH_P_8021AD)) { | ||
1124 | __vlan_hwaccel_put_tag(skb, htons(vlan_proto), | ||
1125 | tpa_info->metadata & | ||
1126 | RX_CMP_FLAGS2_METADATA_VID_MASK); | ||
1127 | } | ||
1128 | } | 1123 | } |
1129 | 1124 | ||
1130 | skb_checksum_none_assert(skb); | 1125 | skb_checksum_none_assert(skb); |
@@ -1277,19 +1272,14 @@ static int bnxt_rx_pkt(struct bnxt *bp, struct bnxt_napi *bnapi, u32 *raw_cons, | |||
1277 | 1272 | ||
1278 | skb->protocol = eth_type_trans(skb, dev); | 1273 | skb->protocol = eth_type_trans(skb, dev); |
1279 | 1274 | ||
1280 | if (rxcmp1->rx_cmp_flags2 & | 1275 | if ((rxcmp1->rx_cmp_flags2 & |
1281 | cpu_to_le32(RX_CMP_FLAGS2_META_FORMAT_VLAN)) { | 1276 | cpu_to_le32(RX_CMP_FLAGS2_META_FORMAT_VLAN)) && |
1282 | netdev_features_t features = skb->dev->features; | 1277 | (skb->dev->features & NETIF_F_HW_VLAN_CTAG_RX)) { |
1283 | u32 meta_data = le32_to_cpu(rxcmp1->rx_cmp_meta_data); | 1278 | u32 meta_data = le32_to_cpu(rxcmp1->rx_cmp_meta_data); |
1279 | u16 vtag = meta_data & RX_CMP_FLAGS2_METADATA_VID_MASK; | ||
1284 | u16 vlan_proto = meta_data >> RX_CMP_FLAGS2_METADATA_TPID_SFT; | 1280 | u16 vlan_proto = meta_data >> RX_CMP_FLAGS2_METADATA_TPID_SFT; |
1285 | 1281 | ||
1286 | if (((features & NETIF_F_HW_VLAN_CTAG_RX) && | 1282 | __vlan_hwaccel_put_tag(skb, htons(vlan_proto), vtag); |
1287 | vlan_proto == ETH_P_8021Q) || | ||
1288 | ((features & NETIF_F_HW_VLAN_STAG_RX) && | ||
1289 | vlan_proto == ETH_P_8021AD)) | ||
1290 | __vlan_hwaccel_put_tag(skb, htons(vlan_proto), | ||
1291 | meta_data & | ||
1292 | RX_CMP_FLAGS2_METADATA_VID_MASK); | ||
1293 | } | 1283 | } |
1294 | 1284 | ||
1295 | skb_checksum_none_assert(skb); | 1285 | skb_checksum_none_assert(skb); |
@@ -5466,6 +5456,20 @@ static netdev_features_t bnxt_fix_features(struct net_device *dev, | |||
5466 | 5456 | ||
5467 | if (!bnxt_rfs_capable(bp)) | 5457 | if (!bnxt_rfs_capable(bp)) |
5468 | features &= ~NETIF_F_NTUPLE; | 5458 | features &= ~NETIF_F_NTUPLE; |
5459 | |||
5460 | /* Both CTAG and STAG VLAN accelaration on the RX side have to be | ||
5461 | * turned on or off together. | ||
5462 | */ | ||
5463 | if ((features & (NETIF_F_HW_VLAN_CTAG_RX | NETIF_F_HW_VLAN_STAG_RX)) != | ||
5464 | (NETIF_F_HW_VLAN_CTAG_RX | NETIF_F_HW_VLAN_STAG_RX)) { | ||
5465 | if (dev->features & NETIF_F_HW_VLAN_CTAG_RX) | ||
5466 | features &= ~(NETIF_F_HW_VLAN_CTAG_RX | | ||
5467 | NETIF_F_HW_VLAN_STAG_RX); | ||
5468 | else | ||
5469 | features |= NETIF_F_HW_VLAN_CTAG_RX | | ||
5470 | NETIF_F_HW_VLAN_STAG_RX; | ||
5471 | } | ||
5472 | |||
5469 | return features; | 5473 | return features; |
5470 | } | 5474 | } |
5471 | 5475 | ||
diff --git a/drivers/net/ethernet/chelsio/cxgb4/t4_pci_id_tbl.h b/drivers/net/ethernet/chelsio/cxgb4/t4_pci_id_tbl.h index a2cdfc1261dc..50812a1d67bd 100644 --- a/drivers/net/ethernet/chelsio/cxgb4/t4_pci_id_tbl.h +++ b/drivers/net/ethernet/chelsio/cxgb4/t4_pci_id_tbl.h | |||
@@ -144,6 +144,7 @@ CH_PCI_DEVICE_ID_TABLE_DEFINE_BEGIN | |||
144 | CH_PCI_ID_TABLE_FENTRY(0x5015), /* T502-bt */ | 144 | CH_PCI_ID_TABLE_FENTRY(0x5015), /* T502-bt */ |
145 | CH_PCI_ID_TABLE_FENTRY(0x5016), /* T580-OCP-SO */ | 145 | CH_PCI_ID_TABLE_FENTRY(0x5016), /* T580-OCP-SO */ |
146 | CH_PCI_ID_TABLE_FENTRY(0x5017), /* T520-OCP-SO */ | 146 | CH_PCI_ID_TABLE_FENTRY(0x5017), /* T520-OCP-SO */ |
147 | CH_PCI_ID_TABLE_FENTRY(0x5018), /* T540-BT */ | ||
147 | CH_PCI_ID_TABLE_FENTRY(0x5080), /* Custom T540-cr */ | 148 | CH_PCI_ID_TABLE_FENTRY(0x5080), /* Custom T540-cr */ |
148 | CH_PCI_ID_TABLE_FENTRY(0x5081), /* Custom T540-LL-cr */ | 149 | CH_PCI_ID_TABLE_FENTRY(0x5081), /* Custom T540-LL-cr */ |
149 | CH_PCI_ID_TABLE_FENTRY(0x5082), /* Custom T504-cr */ | 150 | CH_PCI_ID_TABLE_FENTRY(0x5082), /* Custom T504-cr */ |
diff --git a/drivers/net/ethernet/ethoc.c b/drivers/net/ethernet/ethoc.c index 41b010645100..4edb98c3c6c7 100644 --- a/drivers/net/ethernet/ethoc.c +++ b/drivers/net/ethernet/ethoc.c | |||
@@ -1195,7 +1195,7 @@ static int ethoc_probe(struct platform_device *pdev) | |||
1195 | priv->mdio = mdiobus_alloc(); | 1195 | priv->mdio = mdiobus_alloc(); |
1196 | if (!priv->mdio) { | 1196 | if (!priv->mdio) { |
1197 | ret = -ENOMEM; | 1197 | ret = -ENOMEM; |
1198 | goto free; | 1198 | goto free2; |
1199 | } | 1199 | } |
1200 | 1200 | ||
1201 | priv->mdio->name = "ethoc-mdio"; | 1201 | priv->mdio->name = "ethoc-mdio"; |
@@ -1208,7 +1208,7 @@ static int ethoc_probe(struct platform_device *pdev) | |||
1208 | ret = mdiobus_register(priv->mdio); | 1208 | ret = mdiobus_register(priv->mdio); |
1209 | if (ret) { | 1209 | if (ret) { |
1210 | dev_err(&netdev->dev, "failed to register MDIO bus\n"); | 1210 | dev_err(&netdev->dev, "failed to register MDIO bus\n"); |
1211 | goto free; | 1211 | goto free2; |
1212 | } | 1212 | } |
1213 | 1213 | ||
1214 | ret = ethoc_mdio_probe(netdev); | 1214 | ret = ethoc_mdio_probe(netdev); |
@@ -1241,9 +1241,10 @@ error2: | |||
1241 | error: | 1241 | error: |
1242 | mdiobus_unregister(priv->mdio); | 1242 | mdiobus_unregister(priv->mdio); |
1243 | mdiobus_free(priv->mdio); | 1243 | mdiobus_free(priv->mdio); |
1244 | free: | 1244 | free2: |
1245 | if (priv->clk) | 1245 | if (priv->clk) |
1246 | clk_disable_unprepare(priv->clk); | 1246 | clk_disable_unprepare(priv->clk); |
1247 | free: | ||
1247 | free_netdev(netdev); | 1248 | free_netdev(netdev); |
1248 | out: | 1249 | out: |
1249 | return ret; | 1250 | return ret; |
diff --git a/drivers/net/ethernet/freescale/fec_main.c b/drivers/net/ethernet/freescale/fec_main.c index 3c0255e98535..fea0f330ddbd 100644 --- a/drivers/net/ethernet/freescale/fec_main.c +++ b/drivers/net/ethernet/freescale/fec_main.c | |||
@@ -2416,24 +2416,24 @@ fec_enet_set_coalesce(struct net_device *ndev, struct ethtool_coalesce *ec) | |||
2416 | return -EOPNOTSUPP; | 2416 | return -EOPNOTSUPP; |
2417 | 2417 | ||
2418 | if (ec->rx_max_coalesced_frames > 255) { | 2418 | if (ec->rx_max_coalesced_frames > 255) { |
2419 | pr_err("Rx coalesced frames exceed hardware limiation"); | 2419 | pr_err("Rx coalesced frames exceed hardware limitation\n"); |
2420 | return -EINVAL; | 2420 | return -EINVAL; |
2421 | } | 2421 | } |
2422 | 2422 | ||
2423 | if (ec->tx_max_coalesced_frames > 255) { | 2423 | if (ec->tx_max_coalesced_frames > 255) { |
2424 | pr_err("Tx coalesced frame exceed hardware limiation"); | 2424 | pr_err("Tx coalesced frame exceed hardware limitation\n"); |
2425 | return -EINVAL; | 2425 | return -EINVAL; |
2426 | } | 2426 | } |
2427 | 2427 | ||
2428 | cycle = fec_enet_us_to_itr_clock(ndev, fep->rx_time_itr); | 2428 | cycle = fec_enet_us_to_itr_clock(ndev, fep->rx_time_itr); |
2429 | if (cycle > 0xFFFF) { | 2429 | if (cycle > 0xFFFF) { |
2430 | pr_err("Rx coalesed usec exceeed hardware limiation"); | 2430 | pr_err("Rx coalesced usec exceed hardware limitation\n"); |
2431 | return -EINVAL; | 2431 | return -EINVAL; |
2432 | } | 2432 | } |
2433 | 2433 | ||
2434 | cycle = fec_enet_us_to_itr_clock(ndev, fep->tx_time_itr); | 2434 | cycle = fec_enet_us_to_itr_clock(ndev, fep->tx_time_itr); |
2435 | if (cycle > 0xFFFF) { | 2435 | if (cycle > 0xFFFF) { |
2436 | pr_err("Rx coalesed usec exceeed hardware limiation"); | 2436 | pr_err("Rx coalesced usec exceed hardware limitation\n"); |
2437 | return -EINVAL; | 2437 | return -EINVAL; |
2438 | } | 2438 | } |
2439 | 2439 | ||
diff --git a/drivers/net/ethernet/freescale/gianfar.c b/drivers/net/ethernet/freescale/gianfar.c index 7615e0668acb..2e6785b6e8be 100644 --- a/drivers/net/ethernet/freescale/gianfar.c +++ b/drivers/net/ethernet/freescale/gianfar.c | |||
@@ -2440,7 +2440,8 @@ static int gfar_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
2440 | tx_queue->tx_ring_size); | 2440 | tx_queue->tx_ring_size); |
2441 | 2441 | ||
2442 | if (likely(!nr_frags)) { | 2442 | if (likely(!nr_frags)) { |
2443 | lstatus |= BD_LFLAG(TXBD_LAST | TXBD_INTERRUPT); | 2443 | if (likely(!do_tstamp)) |
2444 | lstatus |= BD_LFLAG(TXBD_LAST | TXBD_INTERRUPT); | ||
2444 | } else { | 2445 | } else { |
2445 | u32 lstatus_start = lstatus; | 2446 | u32 lstatus_start = lstatus; |
2446 | 2447 | ||
diff --git a/drivers/net/ethernet/mediatek/mtk_eth_soc.c b/drivers/net/ethernet/mediatek/mtk_eth_soc.c index c984462fad2a..4763252bbf85 100644 --- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c +++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c | |||
@@ -133,6 +133,8 @@ static int mtk_mdio_read(struct mii_bus *bus, int phy_addr, int phy_reg) | |||
133 | static void mtk_phy_link_adjust(struct net_device *dev) | 133 | static void mtk_phy_link_adjust(struct net_device *dev) |
134 | { | 134 | { |
135 | struct mtk_mac *mac = netdev_priv(dev); | 135 | struct mtk_mac *mac = netdev_priv(dev); |
136 | u16 lcl_adv = 0, rmt_adv = 0; | ||
137 | u8 flowctrl; | ||
136 | u32 mcr = MAC_MCR_MAX_RX_1536 | MAC_MCR_IPG_CFG | | 138 | u32 mcr = MAC_MCR_MAX_RX_1536 | MAC_MCR_IPG_CFG | |
137 | MAC_MCR_FORCE_MODE | MAC_MCR_TX_EN | | 139 | MAC_MCR_FORCE_MODE | MAC_MCR_TX_EN | |
138 | MAC_MCR_RX_EN | MAC_MCR_BACKOFF_EN | | 140 | MAC_MCR_RX_EN | MAC_MCR_BACKOFF_EN | |
@@ -150,11 +152,30 @@ static void mtk_phy_link_adjust(struct net_device *dev) | |||
150 | if (mac->phy_dev->link) | 152 | if (mac->phy_dev->link) |
151 | mcr |= MAC_MCR_FORCE_LINK; | 153 | mcr |= MAC_MCR_FORCE_LINK; |
152 | 154 | ||
153 | if (mac->phy_dev->duplex) | 155 | if (mac->phy_dev->duplex) { |
154 | mcr |= MAC_MCR_FORCE_DPX; | 156 | mcr |= MAC_MCR_FORCE_DPX; |
155 | 157 | ||
156 | if (mac->phy_dev->pause) | 158 | if (mac->phy_dev->pause) |
157 | mcr |= MAC_MCR_FORCE_RX_FC | MAC_MCR_FORCE_TX_FC; | 159 | rmt_adv = LPA_PAUSE_CAP; |
160 | if (mac->phy_dev->asym_pause) | ||
161 | rmt_adv |= LPA_PAUSE_ASYM; | ||
162 | |||
163 | if (mac->phy_dev->advertising & ADVERTISED_Pause) | ||
164 | lcl_adv |= ADVERTISE_PAUSE_CAP; | ||
165 | if (mac->phy_dev->advertising & ADVERTISED_Asym_Pause) | ||
166 | lcl_adv |= ADVERTISE_PAUSE_ASYM; | ||
167 | |||
168 | flowctrl = mii_resolve_flowctrl_fdx(lcl_adv, rmt_adv); | ||
169 | |||
170 | if (flowctrl & FLOW_CTRL_TX) | ||
171 | mcr |= MAC_MCR_FORCE_TX_FC; | ||
172 | if (flowctrl & FLOW_CTRL_RX) | ||
173 | mcr |= MAC_MCR_FORCE_RX_FC; | ||
174 | |||
175 | netif_dbg(mac->hw, link, dev, "rx pause %s, tx pause %s\n", | ||
176 | flowctrl & FLOW_CTRL_RX ? "enabled" : "disabled", | ||
177 | flowctrl & FLOW_CTRL_TX ? "enabled" : "disabled"); | ||
178 | } | ||
158 | 179 | ||
159 | mtk_w32(mac->hw, mcr, MTK_MAC_MCR(mac->id)); | 180 | mtk_w32(mac->hw, mcr, MTK_MAC_MCR(mac->id)); |
160 | 181 | ||
@@ -208,10 +229,16 @@ static int mtk_phy_connect(struct mtk_mac *mac) | |||
208 | u32 val, ge_mode; | 229 | u32 val, ge_mode; |
209 | 230 | ||
210 | np = of_parse_phandle(mac->of_node, "phy-handle", 0); | 231 | np = of_parse_phandle(mac->of_node, "phy-handle", 0); |
232 | if (!np && of_phy_is_fixed_link(mac->of_node)) | ||
233 | if (!of_phy_register_fixed_link(mac->of_node)) | ||
234 | np = of_node_get(mac->of_node); | ||
211 | if (!np) | 235 | if (!np) |
212 | return -ENODEV; | 236 | return -ENODEV; |
213 | 237 | ||
214 | switch (of_get_phy_mode(np)) { | 238 | switch (of_get_phy_mode(np)) { |
239 | case PHY_INTERFACE_MODE_RGMII_TXID: | ||
240 | case PHY_INTERFACE_MODE_RGMII_RXID: | ||
241 | case PHY_INTERFACE_MODE_RGMII_ID: | ||
215 | case PHY_INTERFACE_MODE_RGMII: | 242 | case PHY_INTERFACE_MODE_RGMII: |
216 | ge_mode = 0; | 243 | ge_mode = 0; |
217 | break; | 244 | break; |
@@ -236,7 +263,8 @@ static int mtk_phy_connect(struct mtk_mac *mac) | |||
236 | mac->phy_dev->autoneg = AUTONEG_ENABLE; | 263 | mac->phy_dev->autoneg = AUTONEG_ENABLE; |
237 | mac->phy_dev->speed = 0; | 264 | mac->phy_dev->speed = 0; |
238 | mac->phy_dev->duplex = 0; | 265 | mac->phy_dev->duplex = 0; |
239 | mac->phy_dev->supported &= PHY_BASIC_FEATURES; | 266 | mac->phy_dev->supported &= PHY_GBIT_FEATURES | SUPPORTED_Pause | |
267 | SUPPORTED_Asym_Pause; | ||
240 | mac->phy_dev->advertising = mac->phy_dev->supported | | 268 | mac->phy_dev->advertising = mac->phy_dev->supported | |
241 | ADVERTISED_Autoneg; | 269 | ADVERTISED_Autoneg; |
242 | phy_start_aneg(mac->phy_dev); | 270 | phy_start_aneg(mac->phy_dev); |
@@ -280,7 +308,7 @@ static int mtk_mdio_init(struct mtk_eth *eth) | |||
280 | return 0; | 308 | return 0; |
281 | 309 | ||
282 | err_free_bus: | 310 | err_free_bus: |
283 | kfree(eth->mii_bus); | 311 | mdiobus_free(eth->mii_bus); |
284 | 312 | ||
285 | err_put_node: | 313 | err_put_node: |
286 | of_node_put(mii_np); | 314 | of_node_put(mii_np); |
@@ -295,7 +323,7 @@ static void mtk_mdio_cleanup(struct mtk_eth *eth) | |||
295 | 323 | ||
296 | mdiobus_unregister(eth->mii_bus); | 324 | mdiobus_unregister(eth->mii_bus); |
297 | of_node_put(eth->mii_bus->dev.of_node); | 325 | of_node_put(eth->mii_bus->dev.of_node); |
298 | kfree(eth->mii_bus); | 326 | mdiobus_free(eth->mii_bus); |
299 | } | 327 | } |
300 | 328 | ||
301 | static inline void mtk_irq_disable(struct mtk_eth *eth, u32 mask) | 329 | static inline void mtk_irq_disable(struct mtk_eth *eth, u32 mask) |
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c index fd4392999eee..f5c8d5db25a8 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c | |||
@@ -3192,10 +3192,7 @@ static void mlx5e_destroy_netdev(struct mlx5_core_dev *mdev, void *vpriv) | |||
3192 | flush_workqueue(priv->wq); | 3192 | flush_workqueue(priv->wq); |
3193 | if (test_bit(MLX5_INTERFACE_STATE_SHUTDOWN, &mdev->intf_state)) { | 3193 | if (test_bit(MLX5_INTERFACE_STATE_SHUTDOWN, &mdev->intf_state)) { |
3194 | netif_device_detach(netdev); | 3194 | netif_device_detach(netdev); |
3195 | mutex_lock(&priv->state_lock); | 3195 | mlx5e_close(netdev); |
3196 | if (test_bit(MLX5E_STATE_OPENED, &priv->state)) | ||
3197 | mlx5e_close_locked(netdev); | ||
3198 | mutex_unlock(&priv->state_lock); | ||
3199 | } else { | 3196 | } else { |
3200 | unregister_netdev(netdev); | 3197 | unregister_netdev(netdev); |
3201 | } | 3198 | } |
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_tx.c b/drivers/net/ethernet/mellanox/mlx5/core/en_tx.c index 229ab16fb8d3..b000ddc29553 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en_tx.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_tx.c | |||
@@ -317,7 +317,8 @@ static netdev_tx_t mlx5e_sq_xmit(struct mlx5e_sq *sq, struct sk_buff *skb) | |||
317 | while ((sq->pc & wq->sz_m1) > sq->edge) | 317 | while ((sq->pc & wq->sz_m1) > sq->edge) |
318 | mlx5e_send_nop(sq, false); | 318 | mlx5e_send_nop(sq, false); |
319 | 319 | ||
320 | sq->bf_budget = bf ? sq->bf_budget - 1 : 0; | 320 | if (bf) |
321 | sq->bf_budget--; | ||
321 | 322 | ||
322 | sq->stats.packets++; | 323 | sq->stats.packets++; |
323 | sq->stats.bytes += num_bytes; | 324 | sq->stats.bytes += num_bytes; |
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/eswitch.c b/drivers/net/ethernet/mellanox/mlx5/core/eswitch.c index b84a6918a700..aebbd6ccb9fe 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/eswitch.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/eswitch.c | |||
@@ -383,7 +383,7 @@ __esw_fdb_set_vport_rule(struct mlx5_eswitch *esw, u32 vport, bool rx_rule, | |||
383 | match_v, | 383 | match_v, |
384 | MLX5_FLOW_CONTEXT_ACTION_FWD_DEST, | 384 | MLX5_FLOW_CONTEXT_ACTION_FWD_DEST, |
385 | 0, &dest); | 385 | 0, &dest); |
386 | if (IS_ERR_OR_NULL(flow_rule)) { | 386 | if (IS_ERR(flow_rule)) { |
387 | pr_warn( | 387 | pr_warn( |
388 | "FDB: Failed to add flow rule: dmac_v(%pM) dmac_c(%pM) -> vport(%d), err(%ld)\n", | 388 | "FDB: Failed to add flow rule: dmac_v(%pM) dmac_c(%pM) -> vport(%d), err(%ld)\n", |
389 | dmac_v, dmac_c, vport, PTR_ERR(flow_rule)); | 389 | dmac_v, dmac_c, vport, PTR_ERR(flow_rule)); |
@@ -457,7 +457,7 @@ static int esw_create_fdb_table(struct mlx5_eswitch *esw, int nvports) | |||
457 | 457 | ||
458 | table_size = BIT(MLX5_CAP_ESW_FLOWTABLE_FDB(dev, log_max_ft_size)); | 458 | table_size = BIT(MLX5_CAP_ESW_FLOWTABLE_FDB(dev, log_max_ft_size)); |
459 | fdb = mlx5_create_flow_table(root_ns, 0, table_size, 0); | 459 | fdb = mlx5_create_flow_table(root_ns, 0, table_size, 0); |
460 | if (IS_ERR_OR_NULL(fdb)) { | 460 | if (IS_ERR(fdb)) { |
461 | err = PTR_ERR(fdb); | 461 | err = PTR_ERR(fdb); |
462 | esw_warn(dev, "Failed to create FDB Table err %d\n", err); | 462 | esw_warn(dev, "Failed to create FDB Table err %d\n", err); |
463 | goto out; | 463 | goto out; |
@@ -474,7 +474,7 @@ static int esw_create_fdb_table(struct mlx5_eswitch *esw, int nvports) | |||
474 | MLX5_SET(create_flow_group_in, flow_group_in, end_flow_index, table_size - 3); | 474 | MLX5_SET(create_flow_group_in, flow_group_in, end_flow_index, table_size - 3); |
475 | eth_broadcast_addr(dmac); | 475 | eth_broadcast_addr(dmac); |
476 | g = mlx5_create_flow_group(fdb, flow_group_in); | 476 | g = mlx5_create_flow_group(fdb, flow_group_in); |
477 | if (IS_ERR_OR_NULL(g)) { | 477 | if (IS_ERR(g)) { |
478 | err = PTR_ERR(g); | 478 | err = PTR_ERR(g); |
479 | esw_warn(dev, "Failed to create flow group err(%d)\n", err); | 479 | esw_warn(dev, "Failed to create flow group err(%d)\n", err); |
480 | goto out; | 480 | goto out; |
@@ -489,7 +489,7 @@ static int esw_create_fdb_table(struct mlx5_eswitch *esw, int nvports) | |||
489 | eth_zero_addr(dmac); | 489 | eth_zero_addr(dmac); |
490 | dmac[0] = 0x01; | 490 | dmac[0] = 0x01; |
491 | g = mlx5_create_flow_group(fdb, flow_group_in); | 491 | g = mlx5_create_flow_group(fdb, flow_group_in); |
492 | if (IS_ERR_OR_NULL(g)) { | 492 | if (IS_ERR(g)) { |
493 | err = PTR_ERR(g); | 493 | err = PTR_ERR(g); |
494 | esw_warn(dev, "Failed to create allmulti flow group err(%d)\n", err); | 494 | esw_warn(dev, "Failed to create allmulti flow group err(%d)\n", err); |
495 | goto out; | 495 | goto out; |
@@ -506,7 +506,7 @@ static int esw_create_fdb_table(struct mlx5_eswitch *esw, int nvports) | |||
506 | MLX5_SET(create_flow_group_in, flow_group_in, start_flow_index, table_size - 1); | 506 | MLX5_SET(create_flow_group_in, flow_group_in, start_flow_index, table_size - 1); |
507 | MLX5_SET(create_flow_group_in, flow_group_in, end_flow_index, table_size - 1); | 507 | MLX5_SET(create_flow_group_in, flow_group_in, end_flow_index, table_size - 1); |
508 | g = mlx5_create_flow_group(fdb, flow_group_in); | 508 | g = mlx5_create_flow_group(fdb, flow_group_in); |
509 | if (IS_ERR_OR_NULL(g)) { | 509 | if (IS_ERR(g)) { |
510 | err = PTR_ERR(g); | 510 | err = PTR_ERR(g); |
511 | esw_warn(dev, "Failed to create promisc flow group err(%d)\n", err); | 511 | esw_warn(dev, "Failed to create promisc flow group err(%d)\n", err); |
512 | goto out; | 512 | goto out; |
@@ -529,7 +529,7 @@ out: | |||
529 | } | 529 | } |
530 | } | 530 | } |
531 | 531 | ||
532 | kfree(flow_group_in); | 532 | kvfree(flow_group_in); |
533 | return err; | 533 | return err; |
534 | } | 534 | } |
535 | 535 | ||
@@ -651,6 +651,7 @@ static void update_allmulti_vports(struct mlx5_eswitch *esw, | |||
651 | esw_fdb_set_vport_rule(esw, | 651 | esw_fdb_set_vport_rule(esw, |
652 | mac, | 652 | mac, |
653 | vport_idx); | 653 | vport_idx); |
654 | iter_vaddr->mc_promisc = true; | ||
654 | break; | 655 | break; |
655 | case MLX5_ACTION_DEL: | 656 | case MLX5_ACTION_DEL: |
656 | if (!iter_vaddr) | 657 | if (!iter_vaddr) |
@@ -1060,7 +1061,7 @@ static void esw_vport_enable_egress_acl(struct mlx5_eswitch *esw, | |||
1060 | return; | 1061 | return; |
1061 | 1062 | ||
1062 | acl = mlx5_create_vport_flow_table(root_ns, 0, table_size, 0, vport->vport); | 1063 | acl = mlx5_create_vport_flow_table(root_ns, 0, table_size, 0, vport->vport); |
1063 | if (IS_ERR_OR_NULL(acl)) { | 1064 | if (IS_ERR(acl)) { |
1064 | err = PTR_ERR(acl); | 1065 | err = PTR_ERR(acl); |
1065 | esw_warn(dev, "Failed to create E-Switch vport[%d] egress flow Table, err(%d)\n", | 1066 | esw_warn(dev, "Failed to create E-Switch vport[%d] egress flow Table, err(%d)\n", |
1066 | vport->vport, err); | 1067 | vport->vport, err); |
@@ -1075,7 +1076,7 @@ static void esw_vport_enable_egress_acl(struct mlx5_eswitch *esw, | |||
1075 | MLX5_SET(create_flow_group_in, flow_group_in, end_flow_index, 0); | 1076 | MLX5_SET(create_flow_group_in, flow_group_in, end_flow_index, 0); |
1076 | 1077 | ||
1077 | vlan_grp = mlx5_create_flow_group(acl, flow_group_in); | 1078 | vlan_grp = mlx5_create_flow_group(acl, flow_group_in); |
1078 | if (IS_ERR_OR_NULL(vlan_grp)) { | 1079 | if (IS_ERR(vlan_grp)) { |
1079 | err = PTR_ERR(vlan_grp); | 1080 | err = PTR_ERR(vlan_grp); |
1080 | esw_warn(dev, "Failed to create E-Switch vport[%d] egress allowed vlans flow group, err(%d)\n", | 1081 | esw_warn(dev, "Failed to create E-Switch vport[%d] egress allowed vlans flow group, err(%d)\n", |
1081 | vport->vport, err); | 1082 | vport->vport, err); |
@@ -1086,7 +1087,7 @@ static void esw_vport_enable_egress_acl(struct mlx5_eswitch *esw, | |||
1086 | MLX5_SET(create_flow_group_in, flow_group_in, start_flow_index, 1); | 1087 | MLX5_SET(create_flow_group_in, flow_group_in, start_flow_index, 1); |
1087 | MLX5_SET(create_flow_group_in, flow_group_in, end_flow_index, 1); | 1088 | MLX5_SET(create_flow_group_in, flow_group_in, end_flow_index, 1); |
1088 | drop_grp = mlx5_create_flow_group(acl, flow_group_in); | 1089 | drop_grp = mlx5_create_flow_group(acl, flow_group_in); |
1089 | if (IS_ERR_OR_NULL(drop_grp)) { | 1090 | if (IS_ERR(drop_grp)) { |
1090 | err = PTR_ERR(drop_grp); | 1091 | err = PTR_ERR(drop_grp); |
1091 | esw_warn(dev, "Failed to create E-Switch vport[%d] egress drop flow group, err(%d)\n", | 1092 | esw_warn(dev, "Failed to create E-Switch vport[%d] egress drop flow group, err(%d)\n", |
1092 | vport->vport, err); | 1093 | vport->vport, err); |
@@ -1097,7 +1098,7 @@ static void esw_vport_enable_egress_acl(struct mlx5_eswitch *esw, | |||
1097 | vport->egress.drop_grp = drop_grp; | 1098 | vport->egress.drop_grp = drop_grp; |
1098 | vport->egress.allowed_vlans_grp = vlan_grp; | 1099 | vport->egress.allowed_vlans_grp = vlan_grp; |
1099 | out: | 1100 | out: |
1100 | kfree(flow_group_in); | 1101 | kvfree(flow_group_in); |
1101 | if (err && !IS_ERR_OR_NULL(vlan_grp)) | 1102 | if (err && !IS_ERR_OR_NULL(vlan_grp)) |
1102 | mlx5_destroy_flow_group(vlan_grp); | 1103 | mlx5_destroy_flow_group(vlan_grp); |
1103 | if (err && !IS_ERR_OR_NULL(acl)) | 1104 | if (err && !IS_ERR_OR_NULL(acl)) |
@@ -1174,7 +1175,7 @@ static void esw_vport_enable_ingress_acl(struct mlx5_eswitch *esw, | |||
1174 | return; | 1175 | return; |
1175 | 1176 | ||
1176 | acl = mlx5_create_vport_flow_table(root_ns, 0, table_size, 0, vport->vport); | 1177 | acl = mlx5_create_vport_flow_table(root_ns, 0, table_size, 0, vport->vport); |
1177 | if (IS_ERR_OR_NULL(acl)) { | 1178 | if (IS_ERR(acl)) { |
1178 | err = PTR_ERR(acl); | 1179 | err = PTR_ERR(acl); |
1179 | esw_warn(dev, "Failed to create E-Switch vport[%d] ingress flow Table, err(%d)\n", | 1180 | esw_warn(dev, "Failed to create E-Switch vport[%d] ingress flow Table, err(%d)\n", |
1180 | vport->vport, err); | 1181 | vport->vport, err); |
@@ -1192,7 +1193,7 @@ static void esw_vport_enable_ingress_acl(struct mlx5_eswitch *esw, | |||
1192 | MLX5_SET(create_flow_group_in, flow_group_in, end_flow_index, 0); | 1193 | MLX5_SET(create_flow_group_in, flow_group_in, end_flow_index, 0); |
1193 | 1194 | ||
1194 | g = mlx5_create_flow_group(acl, flow_group_in); | 1195 | g = mlx5_create_flow_group(acl, flow_group_in); |
1195 | if (IS_ERR_OR_NULL(g)) { | 1196 | if (IS_ERR(g)) { |
1196 | err = PTR_ERR(g); | 1197 | err = PTR_ERR(g); |
1197 | esw_warn(dev, "Failed to create E-Switch vport[%d] ingress untagged spoofchk flow group, err(%d)\n", | 1198 | esw_warn(dev, "Failed to create E-Switch vport[%d] ingress untagged spoofchk flow group, err(%d)\n", |
1198 | vport->vport, err); | 1199 | vport->vport, err); |
@@ -1207,7 +1208,7 @@ static void esw_vport_enable_ingress_acl(struct mlx5_eswitch *esw, | |||
1207 | MLX5_SET(create_flow_group_in, flow_group_in, end_flow_index, 1); | 1208 | MLX5_SET(create_flow_group_in, flow_group_in, end_flow_index, 1); |
1208 | 1209 | ||
1209 | g = mlx5_create_flow_group(acl, flow_group_in); | 1210 | g = mlx5_create_flow_group(acl, flow_group_in); |
1210 | if (IS_ERR_OR_NULL(g)) { | 1211 | if (IS_ERR(g)) { |
1211 | err = PTR_ERR(g); | 1212 | err = PTR_ERR(g); |
1212 | esw_warn(dev, "Failed to create E-Switch vport[%d] ingress untagged flow group, err(%d)\n", | 1213 | esw_warn(dev, "Failed to create E-Switch vport[%d] ingress untagged flow group, err(%d)\n", |
1213 | vport->vport, err); | 1214 | vport->vport, err); |
@@ -1223,7 +1224,7 @@ static void esw_vport_enable_ingress_acl(struct mlx5_eswitch *esw, | |||
1223 | MLX5_SET(create_flow_group_in, flow_group_in, end_flow_index, 2); | 1224 | MLX5_SET(create_flow_group_in, flow_group_in, end_flow_index, 2); |
1224 | 1225 | ||
1225 | g = mlx5_create_flow_group(acl, flow_group_in); | 1226 | g = mlx5_create_flow_group(acl, flow_group_in); |
1226 | if (IS_ERR_OR_NULL(g)) { | 1227 | if (IS_ERR(g)) { |
1227 | err = PTR_ERR(g); | 1228 | err = PTR_ERR(g); |
1228 | esw_warn(dev, "Failed to create E-Switch vport[%d] ingress spoofchk flow group, err(%d)\n", | 1229 | esw_warn(dev, "Failed to create E-Switch vport[%d] ingress spoofchk flow group, err(%d)\n", |
1229 | vport->vport, err); | 1230 | vport->vport, err); |
@@ -1236,7 +1237,7 @@ static void esw_vport_enable_ingress_acl(struct mlx5_eswitch *esw, | |||
1236 | MLX5_SET(create_flow_group_in, flow_group_in, end_flow_index, 3); | 1237 | MLX5_SET(create_flow_group_in, flow_group_in, end_flow_index, 3); |
1237 | 1238 | ||
1238 | g = mlx5_create_flow_group(acl, flow_group_in); | 1239 | g = mlx5_create_flow_group(acl, flow_group_in); |
1239 | if (IS_ERR_OR_NULL(g)) { | 1240 | if (IS_ERR(g)) { |
1240 | err = PTR_ERR(g); | 1241 | err = PTR_ERR(g); |
1241 | esw_warn(dev, "Failed to create E-Switch vport[%d] ingress drop flow group, err(%d)\n", | 1242 | esw_warn(dev, "Failed to create E-Switch vport[%d] ingress drop flow group, err(%d)\n", |
1242 | vport->vport, err); | 1243 | vport->vport, err); |
@@ -1259,7 +1260,7 @@ out: | |||
1259 | mlx5_destroy_flow_table(vport->ingress.acl); | 1260 | mlx5_destroy_flow_table(vport->ingress.acl); |
1260 | } | 1261 | } |
1261 | 1262 | ||
1262 | kfree(flow_group_in); | 1263 | kvfree(flow_group_in); |
1263 | } | 1264 | } |
1264 | 1265 | ||
1265 | static void esw_vport_cleanup_ingress_rules(struct mlx5_eswitch *esw, | 1266 | static void esw_vport_cleanup_ingress_rules(struct mlx5_eswitch *esw, |
@@ -1363,7 +1364,7 @@ static int esw_vport_ingress_config(struct mlx5_eswitch *esw, | |||
1363 | match_v, | 1364 | match_v, |
1364 | MLX5_FLOW_CONTEXT_ACTION_ALLOW, | 1365 | MLX5_FLOW_CONTEXT_ACTION_ALLOW, |
1365 | 0, NULL); | 1366 | 0, NULL); |
1366 | if (IS_ERR_OR_NULL(vport->ingress.allow_rule)) { | 1367 | if (IS_ERR(vport->ingress.allow_rule)) { |
1367 | err = PTR_ERR(vport->ingress.allow_rule); | 1368 | err = PTR_ERR(vport->ingress.allow_rule); |
1368 | pr_warn("vport[%d] configure ingress allow rule, err(%d)\n", | 1369 | pr_warn("vport[%d] configure ingress allow rule, err(%d)\n", |
1369 | vport->vport, err); | 1370 | vport->vport, err); |
@@ -1380,7 +1381,7 @@ static int esw_vport_ingress_config(struct mlx5_eswitch *esw, | |||
1380 | match_v, | 1381 | match_v, |
1381 | MLX5_FLOW_CONTEXT_ACTION_DROP, | 1382 | MLX5_FLOW_CONTEXT_ACTION_DROP, |
1382 | 0, NULL); | 1383 | 0, NULL); |
1383 | if (IS_ERR_OR_NULL(vport->ingress.drop_rule)) { | 1384 | if (IS_ERR(vport->ingress.drop_rule)) { |
1384 | err = PTR_ERR(vport->ingress.drop_rule); | 1385 | err = PTR_ERR(vport->ingress.drop_rule); |
1385 | pr_warn("vport[%d] configure ingress drop rule, err(%d)\n", | 1386 | pr_warn("vport[%d] configure ingress drop rule, err(%d)\n", |
1386 | vport->vport, err); | 1387 | vport->vport, err); |
@@ -1439,7 +1440,7 @@ static int esw_vport_egress_config(struct mlx5_eswitch *esw, | |||
1439 | match_v, | 1440 | match_v, |
1440 | MLX5_FLOW_CONTEXT_ACTION_ALLOW, | 1441 | MLX5_FLOW_CONTEXT_ACTION_ALLOW, |
1441 | 0, NULL); | 1442 | 0, NULL); |
1442 | if (IS_ERR_OR_NULL(vport->egress.allowed_vlan)) { | 1443 | if (IS_ERR(vport->egress.allowed_vlan)) { |
1443 | err = PTR_ERR(vport->egress.allowed_vlan); | 1444 | err = PTR_ERR(vport->egress.allowed_vlan); |
1444 | pr_warn("vport[%d] configure egress allowed vlan rule failed, err(%d)\n", | 1445 | pr_warn("vport[%d] configure egress allowed vlan rule failed, err(%d)\n", |
1445 | vport->vport, err); | 1446 | vport->vport, err); |
@@ -1457,7 +1458,7 @@ static int esw_vport_egress_config(struct mlx5_eswitch *esw, | |||
1457 | match_v, | 1458 | match_v, |
1458 | MLX5_FLOW_CONTEXT_ACTION_DROP, | 1459 | MLX5_FLOW_CONTEXT_ACTION_DROP, |
1459 | 0, NULL); | 1460 | 0, NULL); |
1460 | if (IS_ERR_OR_NULL(vport->egress.drop_rule)) { | 1461 | if (IS_ERR(vport->egress.drop_rule)) { |
1461 | err = PTR_ERR(vport->egress.drop_rule); | 1462 | err = PTR_ERR(vport->egress.drop_rule); |
1462 | pr_warn("vport[%d] configure egress drop rule failed, err(%d)\n", | 1463 | pr_warn("vport[%d] configure egress drop rule failed, err(%d)\n", |
1463 | vport->vport, err); | 1464 | vport->vport, err); |
@@ -1491,14 +1492,11 @@ static void esw_enable_vport(struct mlx5_eswitch *esw, int vport_num, | |||
1491 | 1492 | ||
1492 | /* Sync with current vport context */ | 1493 | /* Sync with current vport context */ |
1493 | vport->enabled_events = enable_events; | 1494 | vport->enabled_events = enable_events; |
1494 | esw_vport_change_handle_locked(vport); | ||
1495 | |||
1496 | vport->enabled = true; | 1495 | vport->enabled = true; |
1497 | 1496 | ||
1498 | /* only PF is trusted by default */ | 1497 | /* only PF is trusted by default */ |
1499 | vport->trusted = (vport_num) ? false : true; | 1498 | vport->trusted = (vport_num) ? false : true; |
1500 | 1499 | esw_vport_change_handle_locked(vport); | |
1501 | arm_vport_context_events_cmd(esw->dev, vport_num, enable_events); | ||
1502 | 1500 | ||
1503 | esw->enabled_vports++; | 1501 | esw->enabled_vports++; |
1504 | esw_debug(esw->dev, "Enabled VPORT(%d)\n", vport_num); | 1502 | esw_debug(esw->dev, "Enabled VPORT(%d)\n", vport_num); |
@@ -1728,11 +1726,24 @@ void mlx5_eswitch_vport_event(struct mlx5_eswitch *esw, struct mlx5_eqe *eqe) | |||
1728 | (esw && MLX5_CAP_GEN(esw->dev, vport_group_manager) && mlx5_core_is_pf(esw->dev)) | 1726 | (esw && MLX5_CAP_GEN(esw->dev, vport_group_manager) && mlx5_core_is_pf(esw->dev)) |
1729 | #define LEGAL_VPORT(esw, vport) (vport >= 0 && vport < esw->total_vports) | 1727 | #define LEGAL_VPORT(esw, vport) (vport >= 0 && vport < esw->total_vports) |
1730 | 1728 | ||
1729 | static void node_guid_gen_from_mac(u64 *node_guid, u8 mac[ETH_ALEN]) | ||
1730 | { | ||
1731 | ((u8 *)node_guid)[7] = mac[0]; | ||
1732 | ((u8 *)node_guid)[6] = mac[1]; | ||
1733 | ((u8 *)node_guid)[5] = mac[2]; | ||
1734 | ((u8 *)node_guid)[4] = 0xff; | ||
1735 | ((u8 *)node_guid)[3] = 0xfe; | ||
1736 | ((u8 *)node_guid)[2] = mac[3]; | ||
1737 | ((u8 *)node_guid)[1] = mac[4]; | ||
1738 | ((u8 *)node_guid)[0] = mac[5]; | ||
1739 | } | ||
1740 | |||
1731 | int mlx5_eswitch_set_vport_mac(struct mlx5_eswitch *esw, | 1741 | int mlx5_eswitch_set_vport_mac(struct mlx5_eswitch *esw, |
1732 | int vport, u8 mac[ETH_ALEN]) | 1742 | int vport, u8 mac[ETH_ALEN]) |
1733 | { | 1743 | { |
1734 | int err = 0; | ||
1735 | struct mlx5_vport *evport; | 1744 | struct mlx5_vport *evport; |
1745 | u64 node_guid; | ||
1746 | int err = 0; | ||
1736 | 1747 | ||
1737 | if (!ESW_ALLOWED(esw)) | 1748 | if (!ESW_ALLOWED(esw)) |
1738 | return -EPERM; | 1749 | return -EPERM; |
@@ -1756,11 +1767,17 @@ int mlx5_eswitch_set_vport_mac(struct mlx5_eswitch *esw, | |||
1756 | return err; | 1767 | return err; |
1757 | } | 1768 | } |
1758 | 1769 | ||
1770 | node_guid_gen_from_mac(&node_guid, mac); | ||
1771 | err = mlx5_modify_nic_vport_node_guid(esw->dev, vport, node_guid); | ||
1772 | if (err) | ||
1773 | mlx5_core_warn(esw->dev, | ||
1774 | "Failed to set vport %d node guid, err = %d. RDMA_CM will not function properly for this VF.\n", | ||
1775 | vport, err); | ||
1776 | |||
1759 | mutex_lock(&esw->state_lock); | 1777 | mutex_lock(&esw->state_lock); |
1760 | if (evport->enabled) | 1778 | if (evport->enabled) |
1761 | err = esw_vport_ingress_config(esw, evport); | 1779 | err = esw_vport_ingress_config(esw, evport); |
1762 | mutex_unlock(&esw->state_lock); | 1780 | mutex_unlock(&esw->state_lock); |
1763 | |||
1764 | return err; | 1781 | return err; |
1765 | } | 1782 | } |
1766 | 1783 | ||
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/fs_core.c b/drivers/net/ethernet/mellanox/mlx5/core/fs_core.c index 8b5f0b2c0d5c..e912a3d2505e 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/fs_core.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/fs_core.c | |||
@@ -1292,8 +1292,8 @@ static int update_root_ft_destroy(struct mlx5_flow_table *ft) | |||
1292 | ft->id); | 1292 | ft->id); |
1293 | return err; | 1293 | return err; |
1294 | } | 1294 | } |
1295 | root->root_ft = new_root_ft; | ||
1296 | } | 1295 | } |
1296 | root->root_ft = new_root_ft; | ||
1297 | return 0; | 1297 | return 0; |
1298 | } | 1298 | } |
1299 | 1299 | ||
@@ -1767,6 +1767,9 @@ static void cleanup_root_ns(struct mlx5_core_dev *dev) | |||
1767 | 1767 | ||
1768 | void mlx5_cleanup_fs(struct mlx5_core_dev *dev) | 1768 | void mlx5_cleanup_fs(struct mlx5_core_dev *dev) |
1769 | { | 1769 | { |
1770 | if (MLX5_CAP_GEN(dev, port_type) != MLX5_CAP_PORT_TYPE_ETH) | ||
1771 | return; | ||
1772 | |||
1770 | cleanup_root_ns(dev); | 1773 | cleanup_root_ns(dev); |
1771 | cleanup_single_prio_root_ns(dev, dev->priv.fdb_root_ns); | 1774 | cleanup_single_prio_root_ns(dev, dev->priv.fdb_root_ns); |
1772 | cleanup_single_prio_root_ns(dev, dev->priv.esw_egress_root_ns); | 1775 | cleanup_single_prio_root_ns(dev, dev->priv.esw_egress_root_ns); |
@@ -1828,29 +1831,36 @@ int mlx5_init_fs(struct mlx5_core_dev *dev) | |||
1828 | { | 1831 | { |
1829 | int err = 0; | 1832 | int err = 0; |
1830 | 1833 | ||
1834 | if (MLX5_CAP_GEN(dev, port_type) != MLX5_CAP_PORT_TYPE_ETH) | ||
1835 | return 0; | ||
1836 | |||
1831 | err = mlx5_init_fc_stats(dev); | 1837 | err = mlx5_init_fc_stats(dev); |
1832 | if (err) | 1838 | if (err) |
1833 | return err; | 1839 | return err; |
1834 | 1840 | ||
1835 | if (MLX5_CAP_GEN(dev, nic_flow_table)) { | 1841 | if (MLX5_CAP_GEN(dev, nic_flow_table) && |
1842 | MLX5_CAP_FLOWTABLE_NIC_RX(dev, ft_support)) { | ||
1836 | err = init_root_ns(dev); | 1843 | err = init_root_ns(dev); |
1837 | if (err) | 1844 | if (err) |
1838 | goto err; | 1845 | goto err; |
1839 | } | 1846 | } |
1847 | |||
1840 | if (MLX5_CAP_GEN(dev, eswitch_flow_table)) { | 1848 | if (MLX5_CAP_GEN(dev, eswitch_flow_table)) { |
1841 | err = init_fdb_root_ns(dev); | 1849 | if (MLX5_CAP_ESW_FLOWTABLE_FDB(dev, ft_support)) { |
1842 | if (err) | 1850 | err = init_fdb_root_ns(dev); |
1843 | goto err; | 1851 | if (err) |
1844 | } | 1852 | goto err; |
1845 | if (MLX5_CAP_ESW_EGRESS_ACL(dev, ft_support)) { | 1853 | } |
1846 | err = init_egress_acl_root_ns(dev); | 1854 | if (MLX5_CAP_ESW_EGRESS_ACL(dev, ft_support)) { |
1847 | if (err) | 1855 | err = init_egress_acl_root_ns(dev); |
1848 | goto err; | 1856 | if (err) |
1849 | } | 1857 | goto err; |
1850 | if (MLX5_CAP_ESW_INGRESS_ACL(dev, ft_support)) { | 1858 | } |
1851 | err = init_ingress_acl_root_ns(dev); | 1859 | if (MLX5_CAP_ESW_INGRESS_ACL(dev, ft_support)) { |
1852 | if (err) | 1860 | err = init_ingress_acl_root_ns(dev); |
1853 | goto err; | 1861 | if (err) |
1862 | goto err; | ||
1863 | } | ||
1854 | } | 1864 | } |
1855 | 1865 | ||
1856 | return 0; | 1866 | return 0; |
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/qp.c b/drivers/net/ethernet/mellanox/mlx5/core/qp.c index b720a274220d..b82d65802d96 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/qp.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/qp.c | |||
@@ -418,7 +418,7 @@ int mlx5_core_xrcd_alloc(struct mlx5_core_dev *dev, u32 *xrcdn) | |||
418 | if (out.hdr.status) | 418 | if (out.hdr.status) |
419 | err = mlx5_cmd_status_to_err(&out.hdr); | 419 | err = mlx5_cmd_status_to_err(&out.hdr); |
420 | else | 420 | else |
421 | *xrcdn = be32_to_cpu(out.xrcdn); | 421 | *xrcdn = be32_to_cpu(out.xrcdn) & 0xffffff; |
422 | 422 | ||
423 | return err; | 423 | return err; |
424 | } | 424 | } |
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/vport.c b/drivers/net/ethernet/mellanox/mlx5/core/vport.c index b69dadcfb897..daf44cd4c566 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/vport.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/vport.c | |||
@@ -508,6 +508,44 @@ int mlx5_query_nic_vport_node_guid(struct mlx5_core_dev *mdev, u64 *node_guid) | |||
508 | } | 508 | } |
509 | EXPORT_SYMBOL_GPL(mlx5_query_nic_vport_node_guid); | 509 | EXPORT_SYMBOL_GPL(mlx5_query_nic_vport_node_guid); |
510 | 510 | ||
511 | int mlx5_modify_nic_vport_node_guid(struct mlx5_core_dev *mdev, | ||
512 | u32 vport, u64 node_guid) | ||
513 | { | ||
514 | int inlen = MLX5_ST_SZ_BYTES(modify_nic_vport_context_in); | ||
515 | void *nic_vport_context; | ||
516 | u8 *guid; | ||
517 | void *in; | ||
518 | int err; | ||
519 | |||
520 | if (!vport) | ||
521 | return -EINVAL; | ||
522 | if (!MLX5_CAP_GEN(mdev, vport_group_manager)) | ||
523 | return -EACCES; | ||
524 | if (!MLX5_CAP_ESW(mdev, nic_vport_node_guid_modify)) | ||
525 | return -ENOTSUPP; | ||
526 | |||
527 | in = mlx5_vzalloc(inlen); | ||
528 | if (!in) | ||
529 | return -ENOMEM; | ||
530 | |||
531 | MLX5_SET(modify_nic_vport_context_in, in, | ||
532 | field_select.node_guid, 1); | ||
533 | MLX5_SET(modify_nic_vport_context_in, in, vport_number, vport); | ||
534 | MLX5_SET(modify_nic_vport_context_in, in, other_vport, !!vport); | ||
535 | |||
536 | nic_vport_context = MLX5_ADDR_OF(modify_nic_vport_context_in, | ||
537 | in, nic_vport_context); | ||
538 | guid = MLX5_ADDR_OF(nic_vport_context, nic_vport_context, | ||
539 | node_guid); | ||
540 | MLX5_SET64(nic_vport_context, nic_vport_context, node_guid, node_guid); | ||
541 | |||
542 | err = mlx5_modify_nic_vport_context(mdev, in, inlen); | ||
543 | |||
544 | kvfree(in); | ||
545 | |||
546 | return err; | ||
547 | } | ||
548 | |||
511 | int mlx5_query_nic_vport_qkey_viol_cntr(struct mlx5_core_dev *mdev, | 549 | int mlx5_query_nic_vport_qkey_viol_cntr(struct mlx5_core_dev *mdev, |
512 | u16 *qkey_viol_cntr) | 550 | u16 *qkey_viol_cntr) |
513 | { | 551 | { |
diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum.c index 4a7273771028..6f9e3ddff4a8 100644 --- a/drivers/net/ethernet/mellanox/mlxsw/spectrum.c +++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum.c | |||
@@ -247,15 +247,23 @@ static int mlxsw_sp_port_mtu_set(struct mlxsw_sp_port *mlxsw_sp_port, u16 mtu) | |||
247 | return mlxsw_reg_write(mlxsw_sp->core, MLXSW_REG(pmtu), pmtu_pl); | 247 | return mlxsw_reg_write(mlxsw_sp->core, MLXSW_REG(pmtu), pmtu_pl); |
248 | } | 248 | } |
249 | 249 | ||
250 | static int mlxsw_sp_port_swid_set(struct mlxsw_sp_port *mlxsw_sp_port, u8 swid) | 250 | static int __mlxsw_sp_port_swid_set(struct mlxsw_sp *mlxsw_sp, u8 local_port, |
251 | u8 swid) | ||
251 | { | 252 | { |
252 | struct mlxsw_sp *mlxsw_sp = mlxsw_sp_port->mlxsw_sp; | ||
253 | char pspa_pl[MLXSW_REG_PSPA_LEN]; | 253 | char pspa_pl[MLXSW_REG_PSPA_LEN]; |
254 | 254 | ||
255 | mlxsw_reg_pspa_pack(pspa_pl, swid, mlxsw_sp_port->local_port); | 255 | mlxsw_reg_pspa_pack(pspa_pl, swid, local_port); |
256 | return mlxsw_reg_write(mlxsw_sp->core, MLXSW_REG(pspa), pspa_pl); | 256 | return mlxsw_reg_write(mlxsw_sp->core, MLXSW_REG(pspa), pspa_pl); |
257 | } | 257 | } |
258 | 258 | ||
259 | static int mlxsw_sp_port_swid_set(struct mlxsw_sp_port *mlxsw_sp_port, u8 swid) | ||
260 | { | ||
261 | struct mlxsw_sp *mlxsw_sp = mlxsw_sp_port->mlxsw_sp; | ||
262 | |||
263 | return __mlxsw_sp_port_swid_set(mlxsw_sp, mlxsw_sp_port->local_port, | ||
264 | swid); | ||
265 | } | ||
266 | |||
259 | static int mlxsw_sp_port_vp_mode_set(struct mlxsw_sp_port *mlxsw_sp_port, | 267 | static int mlxsw_sp_port_vp_mode_set(struct mlxsw_sp_port *mlxsw_sp_port, |
260 | bool enable) | 268 | bool enable) |
261 | { | 269 | { |
@@ -305,9 +313,9 @@ mlxsw_sp_port_system_port_mapping_set(struct mlxsw_sp_port *mlxsw_sp_port) | |||
305 | return mlxsw_reg_write(mlxsw_sp->core, MLXSW_REG(sspr), sspr_pl); | 313 | return mlxsw_reg_write(mlxsw_sp->core, MLXSW_REG(sspr), sspr_pl); |
306 | } | 314 | } |
307 | 315 | ||
308 | static int __mlxsw_sp_port_module_info_get(struct mlxsw_sp *mlxsw_sp, | 316 | static int mlxsw_sp_port_module_info_get(struct mlxsw_sp *mlxsw_sp, |
309 | u8 local_port, u8 *p_module, | 317 | u8 local_port, u8 *p_module, |
310 | u8 *p_width, u8 *p_lane) | 318 | u8 *p_width, u8 *p_lane) |
311 | { | 319 | { |
312 | char pmlp_pl[MLXSW_REG_PMLP_LEN]; | 320 | char pmlp_pl[MLXSW_REG_PMLP_LEN]; |
313 | int err; | 321 | int err; |
@@ -322,16 +330,6 @@ static int __mlxsw_sp_port_module_info_get(struct mlxsw_sp *mlxsw_sp, | |||
322 | return 0; | 330 | return 0; |
323 | } | 331 | } |
324 | 332 | ||
325 | static int mlxsw_sp_port_module_info_get(struct mlxsw_sp *mlxsw_sp, | ||
326 | u8 local_port, u8 *p_module, | ||
327 | u8 *p_width) | ||
328 | { | ||
329 | u8 lane; | ||
330 | |||
331 | return __mlxsw_sp_port_module_info_get(mlxsw_sp, local_port, p_module, | ||
332 | p_width, &lane); | ||
333 | } | ||
334 | |||
335 | static int mlxsw_sp_port_module_map(struct mlxsw_sp *mlxsw_sp, u8 local_port, | 333 | static int mlxsw_sp_port_module_map(struct mlxsw_sp *mlxsw_sp, u8 local_port, |
336 | u8 module, u8 width, u8 lane) | 334 | u8 module, u8 width, u8 lane) |
337 | { | 335 | { |
@@ -949,17 +947,11 @@ static int mlxsw_sp_port_get_phys_port_name(struct net_device *dev, char *name, | |||
949 | size_t len) | 947 | size_t len) |
950 | { | 948 | { |
951 | struct mlxsw_sp_port *mlxsw_sp_port = netdev_priv(dev); | 949 | struct mlxsw_sp_port *mlxsw_sp_port = netdev_priv(dev); |
952 | u8 module, width, lane; | 950 | u8 module = mlxsw_sp_port->mapping.module; |
951 | u8 width = mlxsw_sp_port->mapping.width; | ||
952 | u8 lane = mlxsw_sp_port->mapping.lane; | ||
953 | int err; | 953 | int err; |
954 | 954 | ||
955 | err = __mlxsw_sp_port_module_info_get(mlxsw_sp_port->mlxsw_sp, | ||
956 | mlxsw_sp_port->local_port, | ||
957 | &module, &width, &lane); | ||
958 | if (err) { | ||
959 | netdev_err(dev, "Failed to retrieve module information\n"); | ||
960 | return err; | ||
961 | } | ||
962 | |||
963 | if (!mlxsw_sp_port->split) | 955 | if (!mlxsw_sp_port->split) |
964 | err = snprintf(name, len, "p%d", module + 1); | 956 | err = snprintf(name, len, "p%d", module + 1); |
965 | else | 957 | else |
@@ -1681,8 +1673,8 @@ static int mlxsw_sp_port_ets_init(struct mlxsw_sp_port *mlxsw_sp_port) | |||
1681 | return 0; | 1673 | return 0; |
1682 | } | 1674 | } |
1683 | 1675 | ||
1684 | static int __mlxsw_sp_port_create(struct mlxsw_sp *mlxsw_sp, u8 local_port, | 1676 | static int mlxsw_sp_port_create(struct mlxsw_sp *mlxsw_sp, u8 local_port, |
1685 | bool split, u8 module, u8 width) | 1677 | bool split, u8 module, u8 width, u8 lane) |
1686 | { | 1678 | { |
1687 | struct mlxsw_sp_port *mlxsw_sp_port; | 1679 | struct mlxsw_sp_port *mlxsw_sp_port; |
1688 | struct net_device *dev; | 1680 | struct net_device *dev; |
@@ -1697,6 +1689,9 @@ static int __mlxsw_sp_port_create(struct mlxsw_sp *mlxsw_sp, u8 local_port, | |||
1697 | mlxsw_sp_port->mlxsw_sp = mlxsw_sp; | 1689 | mlxsw_sp_port->mlxsw_sp = mlxsw_sp; |
1698 | mlxsw_sp_port->local_port = local_port; | 1690 | mlxsw_sp_port->local_port = local_port; |
1699 | mlxsw_sp_port->split = split; | 1691 | mlxsw_sp_port->split = split; |
1692 | mlxsw_sp_port->mapping.module = module; | ||
1693 | mlxsw_sp_port->mapping.width = width; | ||
1694 | mlxsw_sp_port->mapping.lane = lane; | ||
1700 | bytes = DIV_ROUND_UP(VLAN_N_VID, BITS_PER_BYTE); | 1695 | bytes = DIV_ROUND_UP(VLAN_N_VID, BITS_PER_BYTE); |
1701 | mlxsw_sp_port->active_vlans = kzalloc(bytes, GFP_KERNEL); | 1696 | mlxsw_sp_port->active_vlans = kzalloc(bytes, GFP_KERNEL); |
1702 | if (!mlxsw_sp_port->active_vlans) { | 1697 | if (!mlxsw_sp_port->active_vlans) { |
@@ -1839,28 +1834,6 @@ err_port_active_vlans_alloc: | |||
1839 | return err; | 1834 | return err; |
1840 | } | 1835 | } |
1841 | 1836 | ||
1842 | static int mlxsw_sp_port_create(struct mlxsw_sp *mlxsw_sp, u8 local_port, | ||
1843 | bool split, u8 module, u8 width, u8 lane) | ||
1844 | { | ||
1845 | int err; | ||
1846 | |||
1847 | err = mlxsw_sp_port_module_map(mlxsw_sp, local_port, module, width, | ||
1848 | lane); | ||
1849 | if (err) | ||
1850 | return err; | ||
1851 | |||
1852 | err = __mlxsw_sp_port_create(mlxsw_sp, local_port, split, module, | ||
1853 | width); | ||
1854 | if (err) | ||
1855 | goto err_port_create; | ||
1856 | |||
1857 | return 0; | ||
1858 | |||
1859 | err_port_create: | ||
1860 | mlxsw_sp_port_module_unmap(mlxsw_sp, local_port); | ||
1861 | return err; | ||
1862 | } | ||
1863 | |||
1864 | static void mlxsw_sp_port_vports_fini(struct mlxsw_sp_port *mlxsw_sp_port) | 1837 | static void mlxsw_sp_port_vports_fini(struct mlxsw_sp_port *mlxsw_sp_port) |
1865 | { | 1838 | { |
1866 | struct net_device *dev = mlxsw_sp_port->dev; | 1839 | struct net_device *dev = mlxsw_sp_port->dev; |
@@ -1909,8 +1882,8 @@ static void mlxsw_sp_ports_remove(struct mlxsw_sp *mlxsw_sp) | |||
1909 | 1882 | ||
1910 | static int mlxsw_sp_ports_create(struct mlxsw_sp *mlxsw_sp) | 1883 | static int mlxsw_sp_ports_create(struct mlxsw_sp *mlxsw_sp) |
1911 | { | 1884 | { |
1885 | u8 module, width, lane; | ||
1912 | size_t alloc_size; | 1886 | size_t alloc_size; |
1913 | u8 module, width; | ||
1914 | int i; | 1887 | int i; |
1915 | int err; | 1888 | int err; |
1916 | 1889 | ||
@@ -1921,13 +1894,14 @@ static int mlxsw_sp_ports_create(struct mlxsw_sp *mlxsw_sp) | |||
1921 | 1894 | ||
1922 | for (i = 1; i < MLXSW_PORT_MAX_PORTS; i++) { | 1895 | for (i = 1; i < MLXSW_PORT_MAX_PORTS; i++) { |
1923 | err = mlxsw_sp_port_module_info_get(mlxsw_sp, i, &module, | 1896 | err = mlxsw_sp_port_module_info_get(mlxsw_sp, i, &module, |
1924 | &width); | 1897 | &width, &lane); |
1925 | if (err) | 1898 | if (err) |
1926 | goto err_port_module_info_get; | 1899 | goto err_port_module_info_get; |
1927 | if (!width) | 1900 | if (!width) |
1928 | continue; | 1901 | continue; |
1929 | mlxsw_sp->port_to_module[i] = module; | 1902 | mlxsw_sp->port_to_module[i] = module; |
1930 | err = __mlxsw_sp_port_create(mlxsw_sp, i, false, module, width); | 1903 | err = mlxsw_sp_port_create(mlxsw_sp, i, false, module, width, |
1904 | lane); | ||
1931 | if (err) | 1905 | if (err) |
1932 | goto err_port_create; | 1906 | goto err_port_create; |
1933 | } | 1907 | } |
@@ -1948,12 +1922,85 @@ static u8 mlxsw_sp_cluster_base_port_get(u8 local_port) | |||
1948 | return local_port - offset; | 1922 | return local_port - offset; |
1949 | } | 1923 | } |
1950 | 1924 | ||
1925 | static int mlxsw_sp_port_split_create(struct mlxsw_sp *mlxsw_sp, u8 base_port, | ||
1926 | u8 module, unsigned int count) | ||
1927 | { | ||
1928 | u8 width = MLXSW_PORT_MODULE_MAX_WIDTH / count; | ||
1929 | int err, i; | ||
1930 | |||
1931 | for (i = 0; i < count; i++) { | ||
1932 | err = mlxsw_sp_port_module_map(mlxsw_sp, base_port + i, module, | ||
1933 | width, i * width); | ||
1934 | if (err) | ||
1935 | goto err_port_module_map; | ||
1936 | } | ||
1937 | |||
1938 | for (i = 0; i < count; i++) { | ||
1939 | err = __mlxsw_sp_port_swid_set(mlxsw_sp, base_port + i, 0); | ||
1940 | if (err) | ||
1941 | goto err_port_swid_set; | ||
1942 | } | ||
1943 | |||
1944 | for (i = 0; i < count; i++) { | ||
1945 | err = mlxsw_sp_port_create(mlxsw_sp, base_port + i, true, | ||
1946 | module, width, i * width); | ||
1947 | if (err) | ||
1948 | goto err_port_create; | ||
1949 | } | ||
1950 | |||
1951 | return 0; | ||
1952 | |||
1953 | err_port_create: | ||
1954 | for (i--; i >= 0; i--) | ||
1955 | mlxsw_sp_port_remove(mlxsw_sp, base_port + i); | ||
1956 | i = count; | ||
1957 | err_port_swid_set: | ||
1958 | for (i--; i >= 0; i--) | ||
1959 | __mlxsw_sp_port_swid_set(mlxsw_sp, base_port + i, | ||
1960 | MLXSW_PORT_SWID_DISABLED_PORT); | ||
1961 | i = count; | ||
1962 | err_port_module_map: | ||
1963 | for (i--; i >= 0; i--) | ||
1964 | mlxsw_sp_port_module_unmap(mlxsw_sp, base_port + i); | ||
1965 | return err; | ||
1966 | } | ||
1967 | |||
1968 | static void mlxsw_sp_port_unsplit_create(struct mlxsw_sp *mlxsw_sp, | ||
1969 | u8 base_port, unsigned int count) | ||
1970 | { | ||
1971 | u8 local_port, module, width = MLXSW_PORT_MODULE_MAX_WIDTH; | ||
1972 | int i; | ||
1973 | |||
1974 | /* Split by four means we need to re-create two ports, otherwise | ||
1975 | * only one. | ||
1976 | */ | ||
1977 | count = count / 2; | ||
1978 | |||
1979 | for (i = 0; i < count; i++) { | ||
1980 | local_port = base_port + i * 2; | ||
1981 | module = mlxsw_sp->port_to_module[local_port]; | ||
1982 | |||
1983 | mlxsw_sp_port_module_map(mlxsw_sp, local_port, module, width, | ||
1984 | 0); | ||
1985 | } | ||
1986 | |||
1987 | for (i = 0; i < count; i++) | ||
1988 | __mlxsw_sp_port_swid_set(mlxsw_sp, base_port + i * 2, 0); | ||
1989 | |||
1990 | for (i = 0; i < count; i++) { | ||
1991 | local_port = base_port + i * 2; | ||
1992 | module = mlxsw_sp->port_to_module[local_port]; | ||
1993 | |||
1994 | mlxsw_sp_port_create(mlxsw_sp, local_port, false, module, | ||
1995 | width, 0); | ||
1996 | } | ||
1997 | } | ||
1998 | |||
1951 | static int mlxsw_sp_port_split(struct mlxsw_core *mlxsw_core, u8 local_port, | 1999 | static int mlxsw_sp_port_split(struct mlxsw_core *mlxsw_core, u8 local_port, |
1952 | unsigned int count) | 2000 | unsigned int count) |
1953 | { | 2001 | { |
1954 | struct mlxsw_sp *mlxsw_sp = mlxsw_core_driver_priv(mlxsw_core); | 2002 | struct mlxsw_sp *mlxsw_sp = mlxsw_core_driver_priv(mlxsw_core); |
1955 | struct mlxsw_sp_port *mlxsw_sp_port; | 2003 | struct mlxsw_sp_port *mlxsw_sp_port; |
1956 | u8 width = MLXSW_PORT_MODULE_MAX_WIDTH / count; | ||
1957 | u8 module, cur_width, base_port; | 2004 | u8 module, cur_width, base_port; |
1958 | int i; | 2005 | int i; |
1959 | int err; | 2006 | int err; |
@@ -1965,18 +2012,14 @@ static int mlxsw_sp_port_split(struct mlxsw_core *mlxsw_core, u8 local_port, | |||
1965 | return -EINVAL; | 2012 | return -EINVAL; |
1966 | } | 2013 | } |
1967 | 2014 | ||
2015 | module = mlxsw_sp_port->mapping.module; | ||
2016 | cur_width = mlxsw_sp_port->mapping.width; | ||
2017 | |||
1968 | if (count != 2 && count != 4) { | 2018 | if (count != 2 && count != 4) { |
1969 | netdev_err(mlxsw_sp_port->dev, "Port can only be split into 2 or 4 ports\n"); | 2019 | netdev_err(mlxsw_sp_port->dev, "Port can only be split into 2 or 4 ports\n"); |
1970 | return -EINVAL; | 2020 | return -EINVAL; |
1971 | } | 2021 | } |
1972 | 2022 | ||
1973 | err = mlxsw_sp_port_module_info_get(mlxsw_sp, local_port, &module, | ||
1974 | &cur_width); | ||
1975 | if (err) { | ||
1976 | netdev_err(mlxsw_sp_port->dev, "Failed to get port's width\n"); | ||
1977 | return err; | ||
1978 | } | ||
1979 | |||
1980 | if (cur_width != MLXSW_PORT_MODULE_MAX_WIDTH) { | 2023 | if (cur_width != MLXSW_PORT_MODULE_MAX_WIDTH) { |
1981 | netdev_err(mlxsw_sp_port->dev, "Port cannot be split further\n"); | 2024 | netdev_err(mlxsw_sp_port->dev, "Port cannot be split further\n"); |
1982 | return -EINVAL; | 2025 | return -EINVAL; |
@@ -2001,25 +2044,16 @@ static int mlxsw_sp_port_split(struct mlxsw_core *mlxsw_core, u8 local_port, | |||
2001 | for (i = 0; i < count; i++) | 2044 | for (i = 0; i < count; i++) |
2002 | mlxsw_sp_port_remove(mlxsw_sp, base_port + i); | 2045 | mlxsw_sp_port_remove(mlxsw_sp, base_port + i); |
2003 | 2046 | ||
2004 | for (i = 0; i < count; i++) { | 2047 | err = mlxsw_sp_port_split_create(mlxsw_sp, base_port, module, count); |
2005 | err = mlxsw_sp_port_create(mlxsw_sp, base_port + i, true, | 2048 | if (err) { |
2006 | module, width, i * width); | 2049 | dev_err(mlxsw_sp->bus_info->dev, "Failed to create split ports\n"); |
2007 | if (err) { | 2050 | goto err_port_split_create; |
2008 | dev_err(mlxsw_sp->bus_info->dev, "Failed to create split port\n"); | ||
2009 | goto err_port_create; | ||
2010 | } | ||
2011 | } | 2051 | } |
2012 | 2052 | ||
2013 | return 0; | 2053 | return 0; |
2014 | 2054 | ||
2015 | err_port_create: | 2055 | err_port_split_create: |
2016 | for (i--; i >= 0; i--) | 2056 | mlxsw_sp_port_unsplit_create(mlxsw_sp, base_port, count); |
2017 | mlxsw_sp_port_remove(mlxsw_sp, base_port + i); | ||
2018 | for (i = 0; i < count / 2; i++) { | ||
2019 | module = mlxsw_sp->port_to_module[base_port + i * 2]; | ||
2020 | mlxsw_sp_port_create(mlxsw_sp, base_port + i * 2, false, | ||
2021 | module, MLXSW_PORT_MODULE_MAX_WIDTH, 0); | ||
2022 | } | ||
2023 | return err; | 2057 | return err; |
2024 | } | 2058 | } |
2025 | 2059 | ||
@@ -2027,10 +2061,9 @@ static int mlxsw_sp_port_unsplit(struct mlxsw_core *mlxsw_core, u8 local_port) | |||
2027 | { | 2061 | { |
2028 | struct mlxsw_sp *mlxsw_sp = mlxsw_core_driver_priv(mlxsw_core); | 2062 | struct mlxsw_sp *mlxsw_sp = mlxsw_core_driver_priv(mlxsw_core); |
2029 | struct mlxsw_sp_port *mlxsw_sp_port; | 2063 | struct mlxsw_sp_port *mlxsw_sp_port; |
2030 | u8 module, cur_width, base_port; | 2064 | u8 cur_width, base_port; |
2031 | unsigned int count; | 2065 | unsigned int count; |
2032 | int i; | 2066 | int i; |
2033 | int err; | ||
2034 | 2067 | ||
2035 | mlxsw_sp_port = mlxsw_sp->ports[local_port]; | 2068 | mlxsw_sp_port = mlxsw_sp->ports[local_port]; |
2036 | if (!mlxsw_sp_port) { | 2069 | if (!mlxsw_sp_port) { |
@@ -2044,12 +2077,7 @@ static int mlxsw_sp_port_unsplit(struct mlxsw_core *mlxsw_core, u8 local_port) | |||
2044 | return -EINVAL; | 2077 | return -EINVAL; |
2045 | } | 2078 | } |
2046 | 2079 | ||
2047 | err = mlxsw_sp_port_module_info_get(mlxsw_sp, local_port, &module, | 2080 | cur_width = mlxsw_sp_port->mapping.width; |
2048 | &cur_width); | ||
2049 | if (err) { | ||
2050 | netdev_err(mlxsw_sp_port->dev, "Failed to get port's width\n"); | ||
2051 | return err; | ||
2052 | } | ||
2053 | count = cur_width == 1 ? 4 : 2; | 2081 | count = cur_width == 1 ? 4 : 2; |
2054 | 2082 | ||
2055 | base_port = mlxsw_sp_cluster_base_port_get(local_port); | 2083 | base_port = mlxsw_sp_cluster_base_port_get(local_port); |
@@ -2061,14 +2089,7 @@ static int mlxsw_sp_port_unsplit(struct mlxsw_core *mlxsw_core, u8 local_port) | |||
2061 | for (i = 0; i < count; i++) | 2089 | for (i = 0; i < count; i++) |
2062 | mlxsw_sp_port_remove(mlxsw_sp, base_port + i); | 2090 | mlxsw_sp_port_remove(mlxsw_sp, base_port + i); |
2063 | 2091 | ||
2064 | for (i = 0; i < count / 2; i++) { | 2092 | mlxsw_sp_port_unsplit_create(mlxsw_sp, base_port, count); |
2065 | module = mlxsw_sp->port_to_module[base_port + i * 2]; | ||
2066 | err = mlxsw_sp_port_create(mlxsw_sp, base_port + i * 2, false, | ||
2067 | module, MLXSW_PORT_MODULE_MAX_WIDTH, | ||
2068 | 0); | ||
2069 | if (err) | ||
2070 | dev_err(mlxsw_sp->bus_info->dev, "Failed to reinstantiate port\n"); | ||
2071 | } | ||
2072 | 2093 | ||
2073 | return 0; | 2094 | return 0; |
2074 | } | 2095 | } |
diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum.h b/drivers/net/ethernet/mellanox/mlxsw/spectrum.h index e2c022d3e2f3..13b30eaa13d4 100644 --- a/drivers/net/ethernet/mellanox/mlxsw/spectrum.h +++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum.h | |||
@@ -229,6 +229,11 @@ struct mlxsw_sp_port { | |||
229 | struct ieee_maxrate *maxrate; | 229 | struct ieee_maxrate *maxrate; |
230 | struct ieee_pfc *pfc; | 230 | struct ieee_pfc *pfc; |
231 | } dcb; | 231 | } dcb; |
232 | struct { | ||
233 | u8 module; | ||
234 | u8 width; | ||
235 | u8 lane; | ||
236 | } mapping; | ||
232 | /* 802.1Q bridge VLANs */ | 237 | /* 802.1Q bridge VLANs */ |
233 | unsigned long *active_vlans; | 238 | unsigned long *active_vlans; |
234 | unsigned long *untagged_vlans; | 239 | unsigned long *untagged_vlans; |
diff --git a/drivers/net/ethernet/qlogic/qed/qed_main.c b/drivers/net/ethernet/qlogic/qed/qed_main.c index 753064679bde..61cc6869fa65 100644 --- a/drivers/net/ethernet/qlogic/qed/qed_main.c +++ b/drivers/net/ethernet/qlogic/qed/qed_main.c | |||
@@ -1105,6 +1105,39 @@ static int qed_get_port_type(u32 media_type) | |||
1105 | return port_type; | 1105 | return port_type; |
1106 | } | 1106 | } |
1107 | 1107 | ||
1108 | static int qed_get_link_data(struct qed_hwfn *hwfn, | ||
1109 | struct qed_mcp_link_params *params, | ||
1110 | struct qed_mcp_link_state *link, | ||
1111 | struct qed_mcp_link_capabilities *link_caps) | ||
1112 | { | ||
1113 | void *p; | ||
1114 | |||
1115 | if (!IS_PF(hwfn->cdev)) { | ||
1116 | qed_vf_get_link_params(hwfn, params); | ||
1117 | qed_vf_get_link_state(hwfn, link); | ||
1118 | qed_vf_get_link_caps(hwfn, link_caps); | ||
1119 | |||
1120 | return 0; | ||
1121 | } | ||
1122 | |||
1123 | p = qed_mcp_get_link_params(hwfn); | ||
1124 | if (!p) | ||
1125 | return -ENXIO; | ||
1126 | memcpy(params, p, sizeof(*params)); | ||
1127 | |||
1128 | p = qed_mcp_get_link_state(hwfn); | ||
1129 | if (!p) | ||
1130 | return -ENXIO; | ||
1131 | memcpy(link, p, sizeof(*link)); | ||
1132 | |||
1133 | p = qed_mcp_get_link_capabilities(hwfn); | ||
1134 | if (!p) | ||
1135 | return -ENXIO; | ||
1136 | memcpy(link_caps, p, sizeof(*link_caps)); | ||
1137 | |||
1138 | return 0; | ||
1139 | } | ||
1140 | |||
1108 | static void qed_fill_link(struct qed_hwfn *hwfn, | 1141 | static void qed_fill_link(struct qed_hwfn *hwfn, |
1109 | struct qed_link_output *if_link) | 1142 | struct qed_link_output *if_link) |
1110 | { | 1143 | { |
@@ -1116,15 +1149,9 @@ static void qed_fill_link(struct qed_hwfn *hwfn, | |||
1116 | memset(if_link, 0, sizeof(*if_link)); | 1149 | memset(if_link, 0, sizeof(*if_link)); |
1117 | 1150 | ||
1118 | /* Prepare source inputs */ | 1151 | /* Prepare source inputs */ |
1119 | if (IS_PF(hwfn->cdev)) { | 1152 | if (qed_get_link_data(hwfn, ¶ms, &link, &link_caps)) { |
1120 | memcpy(¶ms, qed_mcp_get_link_params(hwfn), sizeof(params)); | 1153 | dev_warn(&hwfn->cdev->pdev->dev, "no link data available\n"); |
1121 | memcpy(&link, qed_mcp_get_link_state(hwfn), sizeof(link)); | 1154 | return; |
1122 | memcpy(&link_caps, qed_mcp_get_link_capabilities(hwfn), | ||
1123 | sizeof(link_caps)); | ||
1124 | } else { | ||
1125 | qed_vf_get_link_params(hwfn, ¶ms); | ||
1126 | qed_vf_get_link_state(hwfn, &link); | ||
1127 | qed_vf_get_link_caps(hwfn, &link_caps); | ||
1128 | } | 1155 | } |
1129 | 1156 | ||
1130 | /* Set the link parameters to pass to protocol driver */ | 1157 | /* Set the link parameters to pass to protocol driver */ |
diff --git a/drivers/net/ethernet/qlogic/qed/qed_sriov.h b/drivers/net/ethernet/qlogic/qed/qed_sriov.h index c8667c65e685..c90b2b6ad969 100644 --- a/drivers/net/ethernet/qlogic/qed/qed_sriov.h +++ b/drivers/net/ethernet/qlogic/qed/qed_sriov.h | |||
@@ -12,11 +12,13 @@ | |||
12 | #include "qed_vf.h" | 12 | #include "qed_vf.h" |
13 | #define QED_VF_ARRAY_LENGTH (3) | 13 | #define QED_VF_ARRAY_LENGTH (3) |
14 | 14 | ||
15 | #ifdef CONFIG_QED_SRIOV | ||
15 | #define IS_VF(cdev) ((cdev)->b_is_vf) | 16 | #define IS_VF(cdev) ((cdev)->b_is_vf) |
16 | #define IS_PF(cdev) (!((cdev)->b_is_vf)) | 17 | #define IS_PF(cdev) (!((cdev)->b_is_vf)) |
17 | #ifdef CONFIG_QED_SRIOV | ||
18 | #define IS_PF_SRIOV(p_hwfn) (!!((p_hwfn)->cdev->p_iov_info)) | 18 | #define IS_PF_SRIOV(p_hwfn) (!!((p_hwfn)->cdev->p_iov_info)) |
19 | #else | 19 | #else |
20 | #define IS_VF(cdev) (0) | ||
21 | #define IS_PF(cdev) (1) | ||
20 | #define IS_PF_SRIOV(p_hwfn) (0) | 22 | #define IS_PF_SRIOV(p_hwfn) (0) |
21 | #endif | 23 | #endif |
22 | #define IS_PF_SRIOV_ALLOC(p_hwfn) (!!((p_hwfn)->pf_iov_info)) | 24 | #define IS_PF_SRIOV_ALLOC(p_hwfn) (!!((p_hwfn)->pf_iov_info)) |
diff --git a/drivers/net/ethernet/qlogic/qede/qede_main.c b/drivers/net/ethernet/qlogic/qede/qede_main.c index 5d00d1404bfc..5733d1888223 100644 --- a/drivers/net/ethernet/qlogic/qede/qede_main.c +++ b/drivers/net/ethernet/qlogic/qede/qede_main.c | |||
@@ -87,7 +87,9 @@ static const struct pci_device_id qede_pci_tbl[] = { | |||
87 | {PCI_VDEVICE(QLOGIC, PCI_DEVICE_ID_57980S_100), QEDE_PRIVATE_PF}, | 87 | {PCI_VDEVICE(QLOGIC, PCI_DEVICE_ID_57980S_100), QEDE_PRIVATE_PF}, |
88 | {PCI_VDEVICE(QLOGIC, PCI_DEVICE_ID_57980S_50), QEDE_PRIVATE_PF}, | 88 | {PCI_VDEVICE(QLOGIC, PCI_DEVICE_ID_57980S_50), QEDE_PRIVATE_PF}, |
89 | {PCI_VDEVICE(QLOGIC, PCI_DEVICE_ID_57980S_25), QEDE_PRIVATE_PF}, | 89 | {PCI_VDEVICE(QLOGIC, PCI_DEVICE_ID_57980S_25), QEDE_PRIVATE_PF}, |
90 | #ifdef CONFIG_QED_SRIOV | ||
90 | {PCI_VDEVICE(QLOGIC, PCI_DEVICE_ID_57980S_IOV), QEDE_PRIVATE_VF}, | 91 | {PCI_VDEVICE(QLOGIC, PCI_DEVICE_ID_57980S_IOV), QEDE_PRIVATE_VF}, |
92 | #endif | ||
91 | { 0 } | 93 | { 0 } |
92 | }; | 94 | }; |
93 | 95 | ||
diff --git a/drivers/net/ethernet/sfc/mcdi_port.c b/drivers/net/ethernet/sfc/mcdi_port.c index 7f295c4d7b80..2a9228a6e4a0 100644 --- a/drivers/net/ethernet/sfc/mcdi_port.c +++ b/drivers/net/ethernet/sfc/mcdi_port.c | |||
@@ -189,11 +189,12 @@ static u32 mcdi_to_ethtool_cap(u32 media, u32 cap) | |||
189 | 189 | ||
190 | case MC_CMD_MEDIA_XFP: | 190 | case MC_CMD_MEDIA_XFP: |
191 | case MC_CMD_MEDIA_SFP_PLUS: | 191 | case MC_CMD_MEDIA_SFP_PLUS: |
192 | result |= SUPPORTED_FIBRE; | ||
193 | break; | ||
194 | |||
195 | case MC_CMD_MEDIA_QSFP_PLUS: | 192 | case MC_CMD_MEDIA_QSFP_PLUS: |
196 | result |= SUPPORTED_FIBRE; | 193 | result |= SUPPORTED_FIBRE; |
194 | if (cap & (1 << MC_CMD_PHY_CAP_1000FDX_LBN)) | ||
195 | result |= SUPPORTED_1000baseT_Full; | ||
196 | if (cap & (1 << MC_CMD_PHY_CAP_10000FDX_LBN)) | ||
197 | result |= SUPPORTED_10000baseT_Full; | ||
197 | if (cap & (1 << MC_CMD_PHY_CAP_40000FDX_LBN)) | 198 | if (cap & (1 << MC_CMD_PHY_CAP_40000FDX_LBN)) |
198 | result |= SUPPORTED_40000baseCR4_Full; | 199 | result |= SUPPORTED_40000baseCR4_Full; |
199 | break; | 200 | break; |
diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c b/drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c index 4f7283d05588..44da877d2483 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c | |||
@@ -156,7 +156,7 @@ static void dwmac4_set_filter(struct mac_device_info *hw, | |||
156 | struct netdev_hw_addr *ha; | 156 | struct netdev_hw_addr *ha; |
157 | 157 | ||
158 | netdev_for_each_uc_addr(ha, dev) { | 158 | netdev_for_each_uc_addr(ha, dev) { |
159 | dwmac4_set_umac_addr(ioaddr, ha->addr, reg); | 159 | dwmac4_set_umac_addr(hw, ha->addr, reg); |
160 | reg++; | 160 | reg++; |
161 | } | 161 | } |
162 | } | 162 | } |
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c index eac45d0c75e2..a473c182c91d 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | |||
@@ -3450,8 +3450,6 @@ int stmmac_resume(struct device *dev) | |||
3450 | if (!netif_running(ndev)) | 3450 | if (!netif_running(ndev)) |
3451 | return 0; | 3451 | return 0; |
3452 | 3452 | ||
3453 | spin_lock_irqsave(&priv->lock, flags); | ||
3454 | |||
3455 | /* Power Down bit, into the PM register, is cleared | 3453 | /* Power Down bit, into the PM register, is cleared |
3456 | * automatically as soon as a magic packet or a Wake-up frame | 3454 | * automatically as soon as a magic packet or a Wake-up frame |
3457 | * is received. Anyway, it's better to manually clear | 3455 | * is received. Anyway, it's better to manually clear |
@@ -3459,7 +3457,9 @@ int stmmac_resume(struct device *dev) | |||
3459 | * from another devices (e.g. serial console). | 3457 | * from another devices (e.g. serial console). |
3460 | */ | 3458 | */ |
3461 | if (device_may_wakeup(priv->device)) { | 3459 | if (device_may_wakeup(priv->device)) { |
3460 | spin_lock_irqsave(&priv->lock, flags); | ||
3462 | priv->hw->mac->pmt(priv->hw, 0); | 3461 | priv->hw->mac->pmt(priv->hw, 0); |
3462 | spin_unlock_irqrestore(&priv->lock, flags); | ||
3463 | priv->irq_wake = 0; | 3463 | priv->irq_wake = 0; |
3464 | } else { | 3464 | } else { |
3465 | pinctrl_pm_select_default_state(priv->device); | 3465 | pinctrl_pm_select_default_state(priv->device); |
@@ -3473,6 +3473,8 @@ int stmmac_resume(struct device *dev) | |||
3473 | 3473 | ||
3474 | netif_device_attach(ndev); | 3474 | netif_device_attach(ndev); |
3475 | 3475 | ||
3476 | spin_lock_irqsave(&priv->lock, flags); | ||
3477 | |||
3476 | priv->cur_rx = 0; | 3478 | priv->cur_rx = 0; |
3477 | priv->dirty_rx = 0; | 3479 | priv->dirty_rx = 0; |
3478 | priv->dirty_tx = 0; | 3480 | priv->dirty_tx = 0; |
diff --git a/drivers/net/ethernet/ti/cpsw.c b/drivers/net/ethernet/ti/cpsw.c index 4b08a2f52b3e..e6bb0ecb12c7 100644 --- a/drivers/net/ethernet/ti/cpsw.c +++ b/drivers/net/ethernet/ti/cpsw.c | |||
@@ -1339,7 +1339,7 @@ static int cpsw_ndo_open(struct net_device *ndev) | |||
1339 | if (priv->coal_intvl != 0) { | 1339 | if (priv->coal_intvl != 0) { |
1340 | struct ethtool_coalesce coal; | 1340 | struct ethtool_coalesce coal; |
1341 | 1341 | ||
1342 | coal.rx_coalesce_usecs = (priv->coal_intvl << 4); | 1342 | coal.rx_coalesce_usecs = priv->coal_intvl; |
1343 | cpsw_set_coalesce(ndev, &coal); | 1343 | cpsw_set_coalesce(ndev, &coal); |
1344 | } | 1344 | } |
1345 | 1345 | ||
diff --git a/drivers/net/vmxnet3/vmxnet3_drv.c b/drivers/net/vmxnet3/vmxnet3_drv.c index db8022ae415b..08885bc8d6db 100644 --- a/drivers/net/vmxnet3/vmxnet3_drv.c +++ b/drivers/net/vmxnet3/vmxnet3_drv.c | |||
@@ -1369,7 +1369,7 @@ vmxnet3_rq_rx_complete(struct vmxnet3_rx_queue *rq, | |||
1369 | rcdlro = (struct Vmxnet3_RxCompDescExt *)rcd; | 1369 | rcdlro = (struct Vmxnet3_RxCompDescExt *)rcd; |
1370 | 1370 | ||
1371 | segCnt = rcdlro->segCnt; | 1371 | segCnt = rcdlro->segCnt; |
1372 | BUG_ON(segCnt <= 1); | 1372 | WARN_ON_ONCE(segCnt == 0); |
1373 | mss = rcdlro->mss; | 1373 | mss = rcdlro->mss; |
1374 | if (unlikely(segCnt <= 1)) | 1374 | if (unlikely(segCnt <= 1)) |
1375 | segCnt = 0; | 1375 | segCnt = 0; |
diff --git a/drivers/net/vmxnet3/vmxnet3_int.h b/drivers/net/vmxnet3/vmxnet3_int.h index c4825392d64b..3d2b64e63408 100644 --- a/drivers/net/vmxnet3/vmxnet3_int.h +++ b/drivers/net/vmxnet3/vmxnet3_int.h | |||
@@ -69,10 +69,10 @@ | |||
69 | /* | 69 | /* |
70 | * Version numbers | 70 | * Version numbers |
71 | */ | 71 | */ |
72 | #define VMXNET3_DRIVER_VERSION_STRING "1.4.7.0-k" | 72 | #define VMXNET3_DRIVER_VERSION_STRING "1.4.8.0-k" |
73 | 73 | ||
74 | /* a 32-bit int, each byte encode a verion number in VMXNET3_DRIVER_VERSION */ | 74 | /* a 32-bit int, each byte encode a verion number in VMXNET3_DRIVER_VERSION */ |
75 | #define VMXNET3_DRIVER_VERSION_NUM 0x01040700 | 75 | #define VMXNET3_DRIVER_VERSION_NUM 0x01040800 |
76 | 76 | ||
77 | #if defined(CONFIG_PCI_MSI) | 77 | #if defined(CONFIG_PCI_MSI) |
78 | /* RSS only makes sense if MSI-X is supported. */ | 78 | /* RSS only makes sense if MSI-X is supported. */ |
diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c index d0631b6cfd53..62f475e31077 100644 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c | |||
@@ -2540,12 +2540,14 @@ brcmf_cfg80211_get_station(struct wiphy *wiphy, struct net_device *ndev, | |||
2540 | const u8 *mac, struct station_info *sinfo) | 2540 | const u8 *mac, struct station_info *sinfo) |
2541 | { | 2541 | { |
2542 | struct brcmf_if *ifp = netdev_priv(ndev); | 2542 | struct brcmf_if *ifp = netdev_priv(ndev); |
2543 | struct brcmf_scb_val_le scb_val; | ||
2543 | s32 err = 0; | 2544 | s32 err = 0; |
2544 | struct brcmf_sta_info_le sta_info_le; | 2545 | struct brcmf_sta_info_le sta_info_le; |
2545 | u32 sta_flags; | 2546 | u32 sta_flags; |
2546 | u32 is_tdls_peer; | 2547 | u32 is_tdls_peer; |
2547 | s32 total_rssi; | 2548 | s32 total_rssi; |
2548 | s32 count_rssi; | 2549 | s32 count_rssi; |
2550 | int rssi; | ||
2549 | u32 i; | 2551 | u32 i; |
2550 | 2552 | ||
2551 | brcmf_dbg(TRACE, "Enter, MAC %pM\n", mac); | 2553 | brcmf_dbg(TRACE, "Enter, MAC %pM\n", mac); |
@@ -2629,6 +2631,20 @@ brcmf_cfg80211_get_station(struct wiphy *wiphy, struct net_device *ndev, | |||
2629 | sinfo->filled |= BIT(NL80211_STA_INFO_SIGNAL); | 2631 | sinfo->filled |= BIT(NL80211_STA_INFO_SIGNAL); |
2630 | total_rssi /= count_rssi; | 2632 | total_rssi /= count_rssi; |
2631 | sinfo->signal = total_rssi; | 2633 | sinfo->signal = total_rssi; |
2634 | } else if (test_bit(BRCMF_VIF_STATUS_CONNECTED, | ||
2635 | &ifp->vif->sme_state)) { | ||
2636 | memset(&scb_val, 0, sizeof(scb_val)); | ||
2637 | err = brcmf_fil_cmd_data_get(ifp, BRCMF_C_GET_RSSI, | ||
2638 | &scb_val, sizeof(scb_val)); | ||
2639 | if (err) { | ||
2640 | brcmf_err("Could not get rssi (%d)\n", err); | ||
2641 | goto done; | ||
2642 | } else { | ||
2643 | rssi = le32_to_cpu(scb_val.val); | ||
2644 | sinfo->filled |= BIT(NL80211_STA_INFO_SIGNAL); | ||
2645 | sinfo->signal = rssi; | ||
2646 | brcmf_dbg(CONN, "RSSI %d dBm\n", rssi); | ||
2647 | } | ||
2632 | } | 2648 | } |
2633 | } | 2649 | } |
2634 | done: | 2650 | done: |
diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/msgbuf.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/msgbuf.c index 68f1ce02f4bf..2b9a2bc429d6 100644 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/msgbuf.c +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/msgbuf.c | |||
@@ -1157,6 +1157,8 @@ brcmf_msgbuf_process_rx_complete(struct brcmf_msgbuf *msgbuf, void *buf) | |||
1157 | brcmu_pkt_buf_free_skb(skb); | 1157 | brcmu_pkt_buf_free_skb(skb); |
1158 | return; | 1158 | return; |
1159 | } | 1159 | } |
1160 | |||
1161 | skb->protocol = eth_type_trans(skb, ifp->ndev); | ||
1160 | brcmf_netif_rx(ifp, skb); | 1162 | brcmf_netif_rx(ifp, skb); |
1161 | } | 1163 | } |
1162 | 1164 | ||
diff --git a/drivers/net/wireless/mac80211_hwsim.c b/drivers/net/wireless/mac80211_hwsim.c index 9ed0ed1bf514..4dd5adcdd29b 100644 --- a/drivers/net/wireless/mac80211_hwsim.c +++ b/drivers/net/wireless/mac80211_hwsim.c | |||
@@ -2776,6 +2776,7 @@ static int hwsim_tx_info_frame_received_nl(struct sk_buff *skb_2, | |||
2776 | if (!info->attrs[HWSIM_ATTR_ADDR_TRANSMITTER] || | 2776 | if (!info->attrs[HWSIM_ATTR_ADDR_TRANSMITTER] || |
2777 | !info->attrs[HWSIM_ATTR_FLAGS] || | 2777 | !info->attrs[HWSIM_ATTR_FLAGS] || |
2778 | !info->attrs[HWSIM_ATTR_COOKIE] || | 2778 | !info->attrs[HWSIM_ATTR_COOKIE] || |
2779 | !info->attrs[HWSIM_ATTR_SIGNAL] || | ||
2779 | !info->attrs[HWSIM_ATTR_TX_INFO]) | 2780 | !info->attrs[HWSIM_ATTR_TX_INFO]) |
2780 | goto out; | 2781 | goto out; |
2781 | 2782 | ||
diff --git a/drivers/net/wireless/realtek/rtlwifi/core.c b/drivers/net/wireless/realtek/rtlwifi/core.c index 0f48048b8654..3a0faa8fe9d4 100644 --- a/drivers/net/wireless/realtek/rtlwifi/core.c +++ b/drivers/net/wireless/realtek/rtlwifi/core.c | |||
@@ -54,7 +54,7 @@ EXPORT_SYMBOL(channel5g_80m); | |||
54 | void rtl_addr_delay(u32 addr) | 54 | void rtl_addr_delay(u32 addr) |
55 | { | 55 | { |
56 | if (addr == 0xfe) | 56 | if (addr == 0xfe) |
57 | msleep(50); | 57 | mdelay(50); |
58 | else if (addr == 0xfd) | 58 | else if (addr == 0xfd) |
59 | msleep(5); | 59 | msleep(5); |
60 | else if (addr == 0xfc) | 60 | else if (addr == 0xfc) |
@@ -75,7 +75,7 @@ void rtl_rfreg_delay(struct ieee80211_hw *hw, enum radio_path rfpath, u32 addr, | |||
75 | rtl_addr_delay(addr); | 75 | rtl_addr_delay(addr); |
76 | } else { | 76 | } else { |
77 | rtl_set_rfreg(hw, rfpath, addr, mask, data); | 77 | rtl_set_rfreg(hw, rfpath, addr, mask, data); |
78 | usleep_range(1, 2); | 78 | udelay(1); |
79 | } | 79 | } |
80 | } | 80 | } |
81 | EXPORT_SYMBOL(rtl_rfreg_delay); | 81 | EXPORT_SYMBOL(rtl_rfreg_delay); |
@@ -86,7 +86,7 @@ void rtl_bb_delay(struct ieee80211_hw *hw, u32 addr, u32 data) | |||
86 | rtl_addr_delay(addr); | 86 | rtl_addr_delay(addr); |
87 | } else { | 87 | } else { |
88 | rtl_set_bbreg(hw, addr, MASKDWORD, data); | 88 | rtl_set_bbreg(hw, addr, MASKDWORD, data); |
89 | usleep_range(1, 2); | 89 | udelay(1); |
90 | } | 90 | } |
91 | } | 91 | } |
92 | EXPORT_SYMBOL(rtl_bb_delay); | 92 | EXPORT_SYMBOL(rtl_bb_delay); |
diff --git a/include/linux/mlx5/device.h b/include/linux/mlx5/device.h index 035abdf62cfe..73a48479892d 100644 --- a/include/linux/mlx5/device.h +++ b/include/linux/mlx5/device.h | |||
@@ -1240,8 +1240,6 @@ struct mlx5_destroy_psv_out { | |||
1240 | u8 rsvd[8]; | 1240 | u8 rsvd[8]; |
1241 | }; | 1241 | }; |
1242 | 1242 | ||
1243 | #define MLX5_CMD_OP_MAX 0x920 | ||
1244 | |||
1245 | enum { | 1243 | enum { |
1246 | VPORT_STATE_DOWN = 0x0, | 1244 | VPORT_STATE_DOWN = 0x0, |
1247 | VPORT_STATE_UP = 0x1, | 1245 | VPORT_STATE_UP = 0x1, |
@@ -1369,6 +1367,12 @@ enum mlx5_cap_type { | |||
1369 | #define MLX5_CAP_FLOWTABLE_MAX(mdev, cap) \ | 1367 | #define MLX5_CAP_FLOWTABLE_MAX(mdev, cap) \ |
1370 | MLX5_GET(flow_table_nic_cap, mdev->hca_caps_max[MLX5_CAP_FLOW_TABLE], cap) | 1368 | MLX5_GET(flow_table_nic_cap, mdev->hca_caps_max[MLX5_CAP_FLOW_TABLE], cap) |
1371 | 1369 | ||
1370 | #define MLX5_CAP_FLOWTABLE_NIC_RX(mdev, cap) \ | ||
1371 | MLX5_CAP_FLOWTABLE(mdev, flow_table_properties_nic_receive.cap) | ||
1372 | |||
1373 | #define MLX5_CAP_FLOWTABLE_NIC_RX_MAX(mdev, cap) \ | ||
1374 | MLX5_CAP_FLOWTABLE_MAX(mdev, flow_table_properties_nic_receive.cap) | ||
1375 | |||
1372 | #define MLX5_CAP_ESW_FLOWTABLE(mdev, cap) \ | 1376 | #define MLX5_CAP_ESW_FLOWTABLE(mdev, cap) \ |
1373 | MLX5_GET(flow_table_eswitch_cap, \ | 1377 | MLX5_GET(flow_table_eswitch_cap, \ |
1374 | mdev->hca_caps_cur[MLX5_CAP_ESWITCH_FLOW_TABLE], cap) | 1378 | mdev->hca_caps_cur[MLX5_CAP_ESWITCH_FLOW_TABLE], cap) |
diff --git a/include/linux/mlx5/mlx5_ifc.h b/include/linux/mlx5/mlx5_ifc.h index 9a05cd7e5890..e955a2859009 100644 --- a/include/linux/mlx5/mlx5_ifc.h +++ b/include/linux/mlx5/mlx5_ifc.h | |||
@@ -205,7 +205,8 @@ enum { | |||
205 | MLX5_CMD_OP_ALLOC_FLOW_COUNTER = 0x939, | 205 | MLX5_CMD_OP_ALLOC_FLOW_COUNTER = 0x939, |
206 | MLX5_CMD_OP_DEALLOC_FLOW_COUNTER = 0x93a, | 206 | MLX5_CMD_OP_DEALLOC_FLOW_COUNTER = 0x93a, |
207 | MLX5_CMD_OP_QUERY_FLOW_COUNTER = 0x93b, | 207 | MLX5_CMD_OP_QUERY_FLOW_COUNTER = 0x93b, |
208 | MLX5_CMD_OP_MODIFY_FLOW_TABLE = 0x93c | 208 | MLX5_CMD_OP_MODIFY_FLOW_TABLE = 0x93c, |
209 | MLX5_CMD_OP_MAX | ||
209 | }; | 210 | }; |
210 | 211 | ||
211 | struct mlx5_ifc_flow_table_fields_supported_bits { | 212 | struct mlx5_ifc_flow_table_fields_supported_bits { |
@@ -500,7 +501,9 @@ struct mlx5_ifc_e_switch_cap_bits { | |||
500 | u8 vport_svlan_insert[0x1]; | 501 | u8 vport_svlan_insert[0x1]; |
501 | u8 vport_cvlan_insert_if_not_exist[0x1]; | 502 | u8 vport_cvlan_insert_if_not_exist[0x1]; |
502 | u8 vport_cvlan_insert_overwrite[0x1]; | 503 | u8 vport_cvlan_insert_overwrite[0x1]; |
503 | u8 reserved_at_5[0x1b]; | 504 | u8 reserved_at_5[0x19]; |
505 | u8 nic_vport_node_guid_modify[0x1]; | ||
506 | u8 nic_vport_port_guid_modify[0x1]; | ||
504 | 507 | ||
505 | u8 reserved_at_20[0x7e0]; | 508 | u8 reserved_at_20[0x7e0]; |
506 | }; | 509 | }; |
@@ -4583,7 +4586,10 @@ struct mlx5_ifc_modify_nic_vport_context_out_bits { | |||
4583 | }; | 4586 | }; |
4584 | 4587 | ||
4585 | struct mlx5_ifc_modify_nic_vport_field_select_bits { | 4588 | struct mlx5_ifc_modify_nic_vport_field_select_bits { |
4586 | u8 reserved_at_0[0x19]; | 4589 | u8 reserved_at_0[0x16]; |
4590 | u8 node_guid[0x1]; | ||
4591 | u8 port_guid[0x1]; | ||
4592 | u8 reserved_at_18[0x1]; | ||
4587 | u8 mtu[0x1]; | 4593 | u8 mtu[0x1]; |
4588 | u8 change_event[0x1]; | 4594 | u8 change_event[0x1]; |
4589 | u8 promisc[0x1]; | 4595 | u8 promisc[0x1]; |
diff --git a/include/linux/mlx5/qp.h b/include/linux/mlx5/qp.h index e4e29882fdfd..266320feb160 100644 --- a/include/linux/mlx5/qp.h +++ b/include/linux/mlx5/qp.h | |||
@@ -559,6 +559,7 @@ struct mlx5_modify_qp_mbox_in { | |||
559 | __be32 optparam; | 559 | __be32 optparam; |
560 | u8 rsvd0[4]; | 560 | u8 rsvd0[4]; |
561 | struct mlx5_qp_context ctx; | 561 | struct mlx5_qp_context ctx; |
562 | u8 rsvd2[16]; | ||
562 | }; | 563 | }; |
563 | 564 | ||
564 | struct mlx5_modify_qp_mbox_out { | 565 | struct mlx5_modify_qp_mbox_out { |
diff --git a/include/linux/mlx5/vport.h b/include/linux/mlx5/vport.h index 301da4a5e6bf..6c16c198f680 100644 --- a/include/linux/mlx5/vport.h +++ b/include/linux/mlx5/vport.h | |||
@@ -50,6 +50,8 @@ int mlx5_modify_nic_vport_mtu(struct mlx5_core_dev *mdev, u16 mtu); | |||
50 | int mlx5_query_nic_vport_system_image_guid(struct mlx5_core_dev *mdev, | 50 | int mlx5_query_nic_vport_system_image_guid(struct mlx5_core_dev *mdev, |
51 | u64 *system_image_guid); | 51 | u64 *system_image_guid); |
52 | int mlx5_query_nic_vport_node_guid(struct mlx5_core_dev *mdev, u64 *node_guid); | 52 | int mlx5_query_nic_vport_node_guid(struct mlx5_core_dev *mdev, u64 *node_guid); |
53 | int mlx5_modify_nic_vport_node_guid(struct mlx5_core_dev *mdev, | ||
54 | u32 vport, u64 node_guid); | ||
53 | int mlx5_query_nic_vport_qkey_viol_cntr(struct mlx5_core_dev *mdev, | 55 | int mlx5_query_nic_vport_qkey_viol_cntr(struct mlx5_core_dev *mdev, |
54 | u16 *qkey_viol_cntr); | 56 | u16 *qkey_viol_cntr); |
55 | int mlx5_query_hca_vport_gid(struct mlx5_core_dev *dev, u8 other_vport, | 57 | int mlx5_query_hca_vport_gid(struct mlx5_core_dev *dev, u8 other_vport, |
diff --git a/include/net/compat.h b/include/net/compat.h index 48103cf94e97..13de0ccaa059 100644 --- a/include/net/compat.h +++ b/include/net/compat.h | |||
@@ -42,6 +42,7 @@ int compat_sock_get_timestampns(struct sock *, struct timespec __user *); | |||
42 | 42 | ||
43 | int get_compat_msghdr(struct msghdr *, struct compat_msghdr __user *, | 43 | int get_compat_msghdr(struct msghdr *, struct compat_msghdr __user *, |
44 | struct sockaddr __user **, struct iovec **); | 44 | struct sockaddr __user **, struct iovec **); |
45 | struct sock_fprog __user *get_compat_bpf_fprog(char __user *optval); | ||
45 | asmlinkage long compat_sys_sendmsg(int, struct compat_msghdr __user *, | 46 | asmlinkage long compat_sys_sendmsg(int, struct compat_msghdr __user *, |
46 | unsigned int); | 47 | unsigned int); |
47 | asmlinkage long compat_sys_sendmmsg(int, struct compat_mmsghdr __user *, | 48 | asmlinkage long compat_sys_sendmmsg(int, struct compat_mmsghdr __user *, |
diff --git a/include/net/ip_vs.h b/include/net/ip_vs.h index af4c10ebb241..cd6018a9ee24 100644 --- a/include/net/ip_vs.h +++ b/include/net/ip_vs.h | |||
@@ -1232,7 +1232,7 @@ void ip_vs_conn_expire_now(struct ip_vs_conn *cp); | |||
1232 | const char *ip_vs_state_name(__u16 proto, int state); | 1232 | const char *ip_vs_state_name(__u16 proto, int state); |
1233 | 1233 | ||
1234 | void ip_vs_tcp_conn_listen(struct ip_vs_conn *cp); | 1234 | void ip_vs_tcp_conn_listen(struct ip_vs_conn *cp); |
1235 | int ip_vs_check_template(struct ip_vs_conn *ct); | 1235 | int ip_vs_check_template(struct ip_vs_conn *ct, struct ip_vs_dest *cdest); |
1236 | void ip_vs_random_dropentry(struct netns_ipvs *ipvs); | 1236 | void ip_vs_random_dropentry(struct netns_ipvs *ipvs); |
1237 | int ip_vs_conn_init(void); | 1237 | int ip_vs_conn_init(void); |
1238 | void ip_vs_conn_cleanup(void); | 1238 | void ip_vs_conn_cleanup(void); |
diff --git a/include/net/netfilter/nf_queue.h b/include/net/netfilter/nf_queue.h index 9c5638ad872e..0dbce55437f2 100644 --- a/include/net/netfilter/nf_queue.h +++ b/include/net/netfilter/nf_queue.h | |||
@@ -28,8 +28,8 @@ struct nf_queue_handler { | |||
28 | struct nf_hook_ops *ops); | 28 | struct nf_hook_ops *ops); |
29 | }; | 29 | }; |
30 | 30 | ||
31 | void nf_register_queue_handler(const struct nf_queue_handler *qh); | 31 | void nf_register_queue_handler(struct net *net, const struct nf_queue_handler *qh); |
32 | void nf_unregister_queue_handler(void); | 32 | void nf_unregister_queue_handler(struct net *net); |
33 | void nf_reinject(struct nf_queue_entry *entry, unsigned int verdict); | 33 | void nf_reinject(struct nf_queue_entry *entry, unsigned int verdict); |
34 | 34 | ||
35 | void nf_queue_entry_get_refs(struct nf_queue_entry *entry); | 35 | void nf_queue_entry_get_refs(struct nf_queue_entry *entry); |
diff --git a/include/net/netns/netfilter.h b/include/net/netns/netfilter.h index 38aa4983e2a9..36d723579af2 100644 --- a/include/net/netns/netfilter.h +++ b/include/net/netns/netfilter.h | |||
@@ -5,11 +5,13 @@ | |||
5 | 5 | ||
6 | struct proc_dir_entry; | 6 | struct proc_dir_entry; |
7 | struct nf_logger; | 7 | struct nf_logger; |
8 | struct nf_queue_handler; | ||
8 | 9 | ||
9 | struct netns_nf { | 10 | struct netns_nf { |
10 | #if defined CONFIG_PROC_FS | 11 | #if defined CONFIG_PROC_FS |
11 | struct proc_dir_entry *proc_netfilter; | 12 | struct proc_dir_entry *proc_netfilter; |
12 | #endif | 13 | #endif |
14 | const struct nf_queue_handler __rcu *queue_handler; | ||
13 | const struct nf_logger __rcu *nf_loggers[NFPROTO_NUMPROTO]; | 15 | const struct nf_logger __rcu *nf_loggers[NFPROTO_NUMPROTO]; |
14 | #ifdef CONFIG_SYSCTL | 16 | #ifdef CONFIG_SYSCTL |
15 | struct ctl_table_header *nf_log_dir_header; | 17 | struct ctl_table_header *nf_log_dir_header; |
diff --git a/include/net/pkt_cls.h b/include/net/pkt_cls.h index 0f7efa88f210..3722dda0199d 100644 --- a/include/net/pkt_cls.h +++ b/include/net/pkt_cls.h | |||
@@ -392,16 +392,20 @@ struct tc_cls_u32_offload { | |||
392 | }; | 392 | }; |
393 | }; | 393 | }; |
394 | 394 | ||
395 | static inline bool tc_should_offload(struct net_device *dev, u32 flags) | 395 | static inline bool tc_should_offload(const struct net_device *dev, |
396 | const struct tcf_proto *tp, u32 flags) | ||
396 | { | 397 | { |
398 | const struct Qdisc *sch = tp->q; | ||
399 | const struct Qdisc_class_ops *cops = sch->ops->cl_ops; | ||
400 | |||
397 | if (!(dev->features & NETIF_F_HW_TC)) | 401 | if (!(dev->features & NETIF_F_HW_TC)) |
398 | return false; | 402 | return false; |
399 | |||
400 | if (flags & TCA_CLS_FLAGS_SKIP_HW) | 403 | if (flags & TCA_CLS_FLAGS_SKIP_HW) |
401 | return false; | 404 | return false; |
402 | |||
403 | if (!dev->netdev_ops->ndo_setup_tc) | 405 | if (!dev->netdev_ops->ndo_setup_tc) |
404 | return false; | 406 | return false; |
407 | if (cops && cops->tcf_cl_offload) | ||
408 | return cops->tcf_cl_offload(tp->classid); | ||
405 | 409 | ||
406 | return true; | 410 | return true; |
407 | } | 411 | } |
diff --git a/include/net/sch_generic.h b/include/net/sch_generic.h index a1fd76c22a59..62d553184e91 100644 --- a/include/net/sch_generic.h +++ b/include/net/sch_generic.h | |||
@@ -168,6 +168,7 @@ struct Qdisc_class_ops { | |||
168 | 168 | ||
169 | /* Filter manipulation */ | 169 | /* Filter manipulation */ |
170 | struct tcf_proto __rcu ** (*tcf_chain)(struct Qdisc *, unsigned long); | 170 | struct tcf_proto __rcu ** (*tcf_chain)(struct Qdisc *, unsigned long); |
171 | bool (*tcf_cl_offload)(u32 classid); | ||
171 | unsigned long (*bind_tcf)(struct Qdisc *, unsigned long, | 172 | unsigned long (*bind_tcf)(struct Qdisc *, unsigned long, |
172 | u32 classid); | 173 | u32 classid); |
173 | void (*unbind_tcf)(struct Qdisc *, unsigned long); | 174 | void (*unbind_tcf)(struct Qdisc *, unsigned long); |
@@ -691,9 +692,11 @@ static inline struct sk_buff *qdisc_peek_dequeued(struct Qdisc *sch) | |||
691 | /* we can reuse ->gso_skb because peek isn't called for root qdiscs */ | 692 | /* we can reuse ->gso_skb because peek isn't called for root qdiscs */ |
692 | if (!sch->gso_skb) { | 693 | if (!sch->gso_skb) { |
693 | sch->gso_skb = sch->dequeue(sch); | 694 | sch->gso_skb = sch->dequeue(sch); |
694 | if (sch->gso_skb) | 695 | if (sch->gso_skb) { |
695 | /* it's still part of the queue */ | 696 | /* it's still part of the queue */ |
697 | qdisc_qstats_backlog_inc(sch, sch->gso_skb); | ||
696 | sch->q.qlen++; | 698 | sch->q.qlen++; |
699 | } | ||
697 | } | 700 | } |
698 | 701 | ||
699 | return sch->gso_skb; | 702 | return sch->gso_skb; |
@@ -706,6 +709,7 @@ static inline struct sk_buff *qdisc_dequeue_peeked(struct Qdisc *sch) | |||
706 | 709 | ||
707 | if (skb) { | 710 | if (skb) { |
708 | sch->gso_skb = NULL; | 711 | sch->gso_skb = NULL; |
712 | qdisc_qstats_backlog_dec(sch, skb); | ||
709 | sch->q.qlen--; | 713 | sch->q.qlen--; |
710 | } else { | 714 | } else { |
711 | skb = sch->dequeue(sch); | 715 | skb = sch->dequeue(sch); |
diff --git a/include/uapi/linux/gtp.h b/include/uapi/linux/gtp.h index ca1054dd8249..72a04a0e8cce 100644 --- a/include/uapi/linux/gtp.h +++ b/include/uapi/linux/gtp.h | |||
@@ -1,5 +1,5 @@ | |||
1 | #ifndef _UAPI_LINUX_GTP_H_ | 1 | #ifndef _UAPI_LINUX_GTP_H_ |
2 | #define _UAPI_LINUX_GTP_H__ | 2 | #define _UAPI_LINUX_GTP_H_ |
3 | 3 | ||
4 | enum gtp_genl_cmds { | 4 | enum gtp_genl_cmds { |
5 | GTP_CMD_NEWPDP, | 5 | GTP_CMD_NEWPDP, |
diff --git a/kernel/trace/bpf_trace.c b/kernel/trace/bpf_trace.c index 780bcbe1d4de..720b7bb01d43 100644 --- a/kernel/trace/bpf_trace.c +++ b/kernel/trace/bpf_trace.c | |||
@@ -198,7 +198,7 @@ static u64 bpf_perf_event_read(u64 r1, u64 index, u64 r3, u64 r4, u64 r5) | |||
198 | if (unlikely(index >= array->map.max_entries)) | 198 | if (unlikely(index >= array->map.max_entries)) |
199 | return -E2BIG; | 199 | return -E2BIG; |
200 | 200 | ||
201 | file = (struct file *)array->ptrs[index]; | 201 | file = READ_ONCE(array->ptrs[index]); |
202 | if (unlikely(!file)) | 202 | if (unlikely(!file)) |
203 | return -ENOENT; | 203 | return -ENOENT; |
204 | 204 | ||
@@ -247,7 +247,7 @@ static u64 bpf_perf_event_output(u64 r1, u64 r2, u64 flags, u64 r4, u64 size) | |||
247 | if (unlikely(index >= array->map.max_entries)) | 247 | if (unlikely(index >= array->map.max_entries)) |
248 | return -E2BIG; | 248 | return -E2BIG; |
249 | 249 | ||
250 | file = (struct file *)array->ptrs[index]; | 250 | file = READ_ONCE(array->ptrs[index]); |
251 | if (unlikely(!file)) | 251 | if (unlikely(!file)) |
252 | return -ENOENT; | 252 | return -ENOENT; |
253 | 253 | ||
diff --git a/net/bridge/br_fdb.c b/net/bridge/br_fdb.c index dcea4f4c62b3..c18080ad4085 100644 --- a/net/bridge/br_fdb.c +++ b/net/bridge/br_fdb.c | |||
@@ -279,6 +279,8 @@ void br_fdb_change_mac_address(struct net_bridge *br, const u8 *newaddr) | |||
279 | * change from under us. | 279 | * change from under us. |
280 | */ | 280 | */ |
281 | list_for_each_entry(v, &vg->vlan_list, vlist) { | 281 | list_for_each_entry(v, &vg->vlan_list, vlist) { |
282 | if (!br_vlan_should_use(v)) | ||
283 | continue; | ||
282 | f = __br_fdb_get(br, br->dev->dev_addr, v->vid); | 284 | f = __br_fdb_get(br, br->dev->dev_addr, v->vid); |
283 | if (f && f->is_local && !f->dst) | 285 | if (f && f->is_local && !f->dst) |
284 | fdb_delete_local(br, NULL, f); | 286 | fdb_delete_local(br, NULL, f); |
diff --git a/net/compat.c b/net/compat.c index 5cfd26a0006f..1cd2ec046164 100644 --- a/net/compat.c +++ b/net/compat.c | |||
@@ -309,8 +309,8 @@ void scm_detach_fds_compat(struct msghdr *kmsg, struct scm_cookie *scm) | |||
309 | __scm_destroy(scm); | 309 | __scm_destroy(scm); |
310 | } | 310 | } |
311 | 311 | ||
312 | static int do_set_attach_filter(struct socket *sock, int level, int optname, | 312 | /* allocate a 64-bit sock_fprog on the user stack for duration of syscall. */ |
313 | char __user *optval, unsigned int optlen) | 313 | struct sock_fprog __user *get_compat_bpf_fprog(char __user *optval) |
314 | { | 314 | { |
315 | struct compat_sock_fprog __user *fprog32 = (struct compat_sock_fprog __user *)optval; | 315 | struct compat_sock_fprog __user *fprog32 = (struct compat_sock_fprog __user *)optval; |
316 | struct sock_fprog __user *kfprog = compat_alloc_user_space(sizeof(struct sock_fprog)); | 316 | struct sock_fprog __user *kfprog = compat_alloc_user_space(sizeof(struct sock_fprog)); |
@@ -323,6 +323,19 @@ static int do_set_attach_filter(struct socket *sock, int level, int optname, | |||
323 | __get_user(ptr, &fprog32->filter) || | 323 | __get_user(ptr, &fprog32->filter) || |
324 | __put_user(len, &kfprog->len) || | 324 | __put_user(len, &kfprog->len) || |
325 | __put_user(compat_ptr(ptr), &kfprog->filter)) | 325 | __put_user(compat_ptr(ptr), &kfprog->filter)) |
326 | return NULL; | ||
327 | |||
328 | return kfprog; | ||
329 | } | ||
330 | EXPORT_SYMBOL_GPL(get_compat_bpf_fprog); | ||
331 | |||
332 | static int do_set_attach_filter(struct socket *sock, int level, int optname, | ||
333 | char __user *optval, unsigned int optlen) | ||
334 | { | ||
335 | struct sock_fprog __user *kfprog; | ||
336 | |||
337 | kfprog = get_compat_bpf_fprog(optval); | ||
338 | if (!kfprog) | ||
326 | return -EFAULT; | 339 | return -EFAULT; |
327 | 340 | ||
328 | return sock_setsockopt(sock, level, optname, (char __user *)kfprog, | 341 | return sock_setsockopt(sock, level, optname, (char __user *)kfprog, |
@@ -354,7 +367,8 @@ static int do_set_sock_timeout(struct socket *sock, int level, | |||
354 | static int compat_sock_setsockopt(struct socket *sock, int level, int optname, | 367 | static int compat_sock_setsockopt(struct socket *sock, int level, int optname, |
355 | char __user *optval, unsigned int optlen) | 368 | char __user *optval, unsigned int optlen) |
356 | { | 369 | { |
357 | if (optname == SO_ATTACH_FILTER) | 370 | if (optname == SO_ATTACH_FILTER || |
371 | optname == SO_ATTACH_REUSEPORT_CBPF) | ||
358 | return do_set_attach_filter(sock, level, optname, | 372 | return do_set_attach_filter(sock, level, optname, |
359 | optval, optlen); | 373 | optval, optlen); |
360 | if (optname == SO_RCVTIMEO || optname == SO_SNDTIMEO) | 374 | if (optname == SO_RCVTIMEO || optname == SO_SNDTIMEO) |
diff --git a/net/core/gen_stats.c b/net/core/gen_stats.c index f96ee8b9478d..be873e4e3125 100644 --- a/net/core/gen_stats.c +++ b/net/core/gen_stats.c | |||
@@ -47,6 +47,7 @@ nla_put_failure: | |||
47 | * @xstats_type: TLV type for backward compatibility xstats TLV | 47 | * @xstats_type: TLV type for backward compatibility xstats TLV |
48 | * @lock: statistics lock | 48 | * @lock: statistics lock |
49 | * @d: dumping handle | 49 | * @d: dumping handle |
50 | * @padattr: padding attribute | ||
50 | * | 51 | * |
51 | * Initializes the dumping handle, grabs the statistic lock and appends | 52 | * Initializes the dumping handle, grabs the statistic lock and appends |
52 | * an empty TLV header to the socket buffer for use a container for all | 53 | * an empty TLV header to the socket buffer for use a container for all |
@@ -87,6 +88,7 @@ EXPORT_SYMBOL(gnet_stats_start_copy_compat); | |||
87 | * @type: TLV type for top level statistic TLV | 88 | * @type: TLV type for top level statistic TLV |
88 | * @lock: statistics lock | 89 | * @lock: statistics lock |
89 | * @d: dumping handle | 90 | * @d: dumping handle |
91 | * @padattr: padding attribute | ||
90 | * | 92 | * |
91 | * Initializes the dumping handle, grabs the statistic lock and appends | 93 | * Initializes the dumping handle, grabs the statistic lock and appends |
92 | * an empty TLV header to the socket buffer for use a container for all | 94 | * an empty TLV header to the socket buffer for use a container for all |
diff --git a/net/core/net-sysfs.c b/net/core/net-sysfs.c index 2b3f76fe65f4..7a0b616557ab 100644 --- a/net/core/net-sysfs.c +++ b/net/core/net-sysfs.c | |||
@@ -24,6 +24,7 @@ | |||
24 | #include <linux/jiffies.h> | 24 | #include <linux/jiffies.h> |
25 | #include <linux/pm_runtime.h> | 25 | #include <linux/pm_runtime.h> |
26 | #include <linux/of.h> | 26 | #include <linux/of.h> |
27 | #include <linux/of_net.h> | ||
27 | 28 | ||
28 | #include "net-sysfs.h" | 29 | #include "net-sysfs.h" |
29 | 30 | ||
diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c index d56c0559b477..0ff31d97d485 100644 --- a/net/ipv4/udp.c +++ b/net/ipv4/udp.c | |||
@@ -1618,12 +1618,12 @@ int udp_queue_rcv_skb(struct sock *sk, struct sk_buff *skb) | |||
1618 | } | 1618 | } |
1619 | } | 1619 | } |
1620 | 1620 | ||
1621 | if (rcu_access_pointer(sk->sk_filter)) { | 1621 | if (rcu_access_pointer(sk->sk_filter) && |
1622 | if (udp_lib_checksum_complete(skb)) | 1622 | udp_lib_checksum_complete(skb)) |
1623 | goto csum_error; | 1623 | goto csum_error; |
1624 | if (sk_filter(sk, skb)) | 1624 | |
1625 | goto drop; | 1625 | if (sk_filter(sk, skb)) |
1626 | } | 1626 | goto drop; |
1627 | 1627 | ||
1628 | udp_csum_pull_header(skb); | 1628 | udp_csum_pull_header(skb); |
1629 | if (sk_rcvqueues_full(sk, sk->sk_rcvbuf)) { | 1629 | if (sk_rcvqueues_full(sk, sk->sk_rcvbuf)) { |
diff --git a/net/ipv6/ip6_gre.c b/net/ipv6/ip6_gre.c index f4ac2842d4d9..fdc9de276ab1 100644 --- a/net/ipv6/ip6_gre.c +++ b/net/ipv6/ip6_gre.c | |||
@@ -1256,6 +1256,8 @@ static int ip6gre_tap_init(struct net_device *dev) | |||
1256 | if (ret) | 1256 | if (ret) |
1257 | return ret; | 1257 | return ret; |
1258 | 1258 | ||
1259 | dev->priv_flags |= IFF_LIVE_ADDR_CHANGE; | ||
1260 | |||
1259 | tunnel = netdev_priv(dev); | 1261 | tunnel = netdev_priv(dev); |
1260 | 1262 | ||
1261 | ip6gre_tnl_link_config(tunnel, 1); | 1263 | ip6gre_tnl_link_config(tunnel, 1); |
@@ -1289,6 +1291,7 @@ static void ip6gre_tap_setup(struct net_device *dev) | |||
1289 | 1291 | ||
1290 | dev->features |= NETIF_F_NETNS_LOCAL; | 1292 | dev->features |= NETIF_F_NETNS_LOCAL; |
1291 | dev->priv_flags &= ~IFF_TX_SKB_SHARING; | 1293 | dev->priv_flags &= ~IFF_TX_SKB_SHARING; |
1294 | dev->priv_flags |= IFF_LIVE_ADDR_CHANGE; | ||
1292 | } | 1295 | } |
1293 | 1296 | ||
1294 | static bool ip6gre_netlink_encap_parms(struct nlattr *data[], | 1297 | static bool ip6gre_netlink_encap_parms(struct nlattr *data[], |
diff --git a/net/ipv6/ip6_output.c b/net/ipv6/ip6_output.c index cbf127ae7c67..635b8d340cdb 100644 --- a/net/ipv6/ip6_output.c +++ b/net/ipv6/ip6_output.c | |||
@@ -1071,17 +1071,12 @@ struct dst_entry *ip6_sk_dst_lookup_flow(struct sock *sk, struct flowi6 *fl6, | |||
1071 | const struct in6_addr *final_dst) | 1071 | const struct in6_addr *final_dst) |
1072 | { | 1072 | { |
1073 | struct dst_entry *dst = sk_dst_check(sk, inet6_sk(sk)->dst_cookie); | 1073 | struct dst_entry *dst = sk_dst_check(sk, inet6_sk(sk)->dst_cookie); |
1074 | int err; | ||
1075 | 1074 | ||
1076 | dst = ip6_sk_dst_check(sk, dst, fl6); | 1075 | dst = ip6_sk_dst_check(sk, dst, fl6); |
1076 | if (!dst) | ||
1077 | dst = ip6_dst_lookup_flow(sk, fl6, final_dst); | ||
1077 | 1078 | ||
1078 | err = ip6_dst_lookup_tail(sock_net(sk), sk, &dst, fl6); | 1079 | return dst; |
1079 | if (err) | ||
1080 | return ERR_PTR(err); | ||
1081 | if (final_dst) | ||
1082 | fl6->daddr = *final_dst; | ||
1083 | |||
1084 | return xfrm_lookup_route(sock_net(sk), dst, flowi6_to_flowi(fl6), sk, 0); | ||
1085 | } | 1080 | } |
1086 | EXPORT_SYMBOL_GPL(ip6_sk_dst_lookup_flow); | 1081 | EXPORT_SYMBOL_GPL(ip6_sk_dst_lookup_flow); |
1087 | 1082 | ||
diff --git a/net/ipv6/netfilter/nf_dup_ipv6.c b/net/ipv6/netfilter/nf_dup_ipv6.c index 6989c70ae29f..4a84b5ad9ecb 100644 --- a/net/ipv6/netfilter/nf_dup_ipv6.c +++ b/net/ipv6/netfilter/nf_dup_ipv6.c | |||
@@ -33,6 +33,7 @@ static bool nf_dup_ipv6_route(struct net *net, struct sk_buff *skb, | |||
33 | fl6.daddr = *gw; | 33 | fl6.daddr = *gw; |
34 | fl6.flowlabel = (__force __be32)(((iph->flow_lbl[0] & 0xF) << 16) | | 34 | fl6.flowlabel = (__force __be32)(((iph->flow_lbl[0] & 0xF) << 16) | |
35 | (iph->flow_lbl[1] << 8) | iph->flow_lbl[2]); | 35 | (iph->flow_lbl[1] << 8) | iph->flow_lbl[2]); |
36 | fl6.flowi6_flags = FLOWI_FLAG_KNOWN_NH; | ||
36 | dst = ip6_route_output(net, NULL, &fl6); | 37 | dst = ip6_route_output(net, NULL, &fl6); |
37 | if (dst->error) { | 38 | if (dst->error) { |
38 | dst_release(dst); | 39 | dst_release(dst); |
diff --git a/net/ipv6/tcp_ipv6.c b/net/ipv6/tcp_ipv6.c index 79e33e02f11a..f36c2d076fce 100644 --- a/net/ipv6/tcp_ipv6.c +++ b/net/ipv6/tcp_ipv6.c | |||
@@ -1721,7 +1721,9 @@ static void get_tcp6_sock(struct seq_file *seq, struct sock *sp, int i) | |||
1721 | destp = ntohs(inet->inet_dport); | 1721 | destp = ntohs(inet->inet_dport); |
1722 | srcp = ntohs(inet->inet_sport); | 1722 | srcp = ntohs(inet->inet_sport); |
1723 | 1723 | ||
1724 | if (icsk->icsk_pending == ICSK_TIME_RETRANS) { | 1724 | if (icsk->icsk_pending == ICSK_TIME_RETRANS || |
1725 | icsk->icsk_pending == ICSK_TIME_EARLY_RETRANS || | ||
1726 | icsk->icsk_pending == ICSK_TIME_LOSS_PROBE) { | ||
1725 | timer_active = 1; | 1727 | timer_active = 1; |
1726 | timer_expires = icsk->icsk_timeout; | 1728 | timer_expires = icsk->icsk_timeout; |
1727 | } else if (icsk->icsk_pending == ICSK_TIME_PROBE0) { | 1729 | } else if (icsk->icsk_pending == ICSK_TIME_PROBE0) { |
diff --git a/net/ipv6/udp.c b/net/ipv6/udp.c index 2da1896af934..f421c9f23c5b 100644 --- a/net/ipv6/udp.c +++ b/net/ipv6/udp.c | |||
@@ -653,12 +653,12 @@ int udpv6_queue_rcv_skb(struct sock *sk, struct sk_buff *skb) | |||
653 | } | 653 | } |
654 | } | 654 | } |
655 | 655 | ||
656 | if (rcu_access_pointer(sk->sk_filter)) { | 656 | if (rcu_access_pointer(sk->sk_filter) && |
657 | if (udp_lib_checksum_complete(skb)) | 657 | udp_lib_checksum_complete(skb)) |
658 | goto csum_error; | 658 | goto csum_error; |
659 | if (sk_filter(sk, skb)) | 659 | |
660 | goto drop; | 660 | if (sk_filter(sk, skb)) |
661 | } | 661 | goto drop; |
662 | 662 | ||
663 | udp_csum_pull_header(skb); | 663 | udp_csum_pull_header(skb); |
664 | if (sk_rcvqueues_full(sk, sk->sk_rcvbuf)) { | 664 | if (sk_rcvqueues_full(sk, sk->sk_rcvbuf)) { |
diff --git a/net/l2tp/l2tp_core.c b/net/l2tp/l2tp_core.c index 6edfa9980314..1e40dacaa137 100644 --- a/net/l2tp/l2tp_core.c +++ b/net/l2tp/l2tp_core.c | |||
@@ -1581,7 +1581,7 @@ int l2tp_tunnel_create(struct net *net, int fd, int version, u32 tunnel_id, u32 | |||
1581 | /* Mark socket as an encapsulation socket. See net/ipv4/udp.c */ | 1581 | /* Mark socket as an encapsulation socket. See net/ipv4/udp.c */ |
1582 | tunnel->encap = encap; | 1582 | tunnel->encap = encap; |
1583 | if (encap == L2TP_ENCAPTYPE_UDP) { | 1583 | if (encap == L2TP_ENCAPTYPE_UDP) { |
1584 | struct udp_tunnel_sock_cfg udp_cfg; | 1584 | struct udp_tunnel_sock_cfg udp_cfg = { }; |
1585 | 1585 | ||
1586 | udp_cfg.sk_user_data = tunnel; | 1586 | udp_cfg.sk_user_data = tunnel; |
1587 | udp_cfg.encap_type = UDP_ENCAP_L2TPINUDP; | 1587 | udp_cfg.encap_type = UDP_ENCAP_L2TPINUDP; |
diff --git a/net/mac80211/mesh.c b/net/mac80211/mesh.c index 4c6404e1ad6e..21b1fdf5d01d 100644 --- a/net/mac80211/mesh.c +++ b/net/mac80211/mesh.c | |||
@@ -161,6 +161,10 @@ void mesh_sta_cleanup(struct sta_info *sta) | |||
161 | del_timer_sync(&sta->mesh->plink_timer); | 161 | del_timer_sync(&sta->mesh->plink_timer); |
162 | } | 162 | } |
163 | 163 | ||
164 | /* make sure no readers can access nexthop sta from here on */ | ||
165 | mesh_path_flush_by_nexthop(sta); | ||
166 | synchronize_net(); | ||
167 | |||
164 | if (changed) | 168 | if (changed) |
165 | ieee80211_mbss_info_change_notify(sdata, changed); | 169 | ieee80211_mbss_info_change_notify(sdata, changed); |
166 | } | 170 | } |
diff --git a/net/mac80211/sta_info.h b/net/mac80211/sta_info.h index c8b8ccc370eb..78b0ef32dddd 100644 --- a/net/mac80211/sta_info.h +++ b/net/mac80211/sta_info.h | |||
@@ -280,7 +280,7 @@ struct ieee80211_fast_tx { | |||
280 | u8 sa_offs, da_offs, pn_offs; | 280 | u8 sa_offs, da_offs, pn_offs; |
281 | u8 band; | 281 | u8 band; |
282 | u8 hdr[30 + 2 + IEEE80211_FAST_XMIT_MAX_IV + | 282 | u8 hdr[30 + 2 + IEEE80211_FAST_XMIT_MAX_IV + |
283 | sizeof(rfc1042_header)]; | 283 | sizeof(rfc1042_header)] __aligned(2); |
284 | 284 | ||
285 | struct rcu_head rcu_head; | 285 | struct rcu_head rcu_head; |
286 | }; | 286 | }; |
diff --git a/net/netfilter/ipvs/ip_vs_conn.c b/net/netfilter/ipvs/ip_vs_conn.c index 2cb3c626cd43..096a45103f14 100644 --- a/net/netfilter/ipvs/ip_vs_conn.c +++ b/net/netfilter/ipvs/ip_vs_conn.c | |||
@@ -762,7 +762,7 @@ static int expire_quiescent_template(struct netns_ipvs *ipvs, | |||
762 | * If available, return 1, otherwise invalidate this connection | 762 | * If available, return 1, otherwise invalidate this connection |
763 | * template and return 0. | 763 | * template and return 0. |
764 | */ | 764 | */ |
765 | int ip_vs_check_template(struct ip_vs_conn *ct) | 765 | int ip_vs_check_template(struct ip_vs_conn *ct, struct ip_vs_dest *cdest) |
766 | { | 766 | { |
767 | struct ip_vs_dest *dest = ct->dest; | 767 | struct ip_vs_dest *dest = ct->dest; |
768 | struct netns_ipvs *ipvs = ct->ipvs; | 768 | struct netns_ipvs *ipvs = ct->ipvs; |
@@ -772,7 +772,8 @@ int ip_vs_check_template(struct ip_vs_conn *ct) | |||
772 | */ | 772 | */ |
773 | if ((dest == NULL) || | 773 | if ((dest == NULL) || |
774 | !(dest->flags & IP_VS_DEST_F_AVAILABLE) || | 774 | !(dest->flags & IP_VS_DEST_F_AVAILABLE) || |
775 | expire_quiescent_template(ipvs, dest)) { | 775 | expire_quiescent_template(ipvs, dest) || |
776 | (cdest && (dest != cdest))) { | ||
776 | IP_VS_DBG_BUF(9, "check_template: dest not available for " | 777 | IP_VS_DBG_BUF(9, "check_template: dest not available for " |
777 | "protocol %s s:%s:%d v:%s:%d " | 778 | "protocol %s s:%s:%d v:%s:%d " |
778 | "-> d:%s:%d\n", | 779 | "-> d:%s:%d\n", |
diff --git a/net/netfilter/ipvs/ip_vs_core.c b/net/netfilter/ipvs/ip_vs_core.c index 1207f20d24e4..2c1b498a7a27 100644 --- a/net/netfilter/ipvs/ip_vs_core.c +++ b/net/netfilter/ipvs/ip_vs_core.c | |||
@@ -321,7 +321,7 @@ ip_vs_sched_persist(struct ip_vs_service *svc, | |||
321 | 321 | ||
322 | /* Check if a template already exists */ | 322 | /* Check if a template already exists */ |
323 | ct = ip_vs_ct_in_get(¶m); | 323 | ct = ip_vs_ct_in_get(¶m); |
324 | if (!ct || !ip_vs_check_template(ct)) { | 324 | if (!ct || !ip_vs_check_template(ct, NULL)) { |
325 | struct ip_vs_scheduler *sched; | 325 | struct ip_vs_scheduler *sched; |
326 | 326 | ||
327 | /* | 327 | /* |
@@ -1154,7 +1154,8 @@ struct ip_vs_conn *ip_vs_new_conn_out(struct ip_vs_service *svc, | |||
1154 | vport, ¶m) < 0) | 1154 | vport, ¶m) < 0) |
1155 | return NULL; | 1155 | return NULL; |
1156 | ct = ip_vs_ct_in_get(¶m); | 1156 | ct = ip_vs_ct_in_get(¶m); |
1157 | if (!ct) { | 1157 | /* check if template exists and points to the same dest */ |
1158 | if (!ct || !ip_vs_check_template(ct, dest)) { | ||
1158 | ct = ip_vs_conn_new(¶m, dest->af, daddr, dport, | 1159 | ct = ip_vs_conn_new(¶m, dest->af, daddr, dport, |
1159 | IP_VS_CONN_F_TEMPLATE, dest, 0); | 1160 | IP_VS_CONN_F_TEMPLATE, dest, 0); |
1160 | if (!ct) { | 1161 | if (!ct) { |
diff --git a/net/netfilter/nf_conntrack_ftp.c b/net/netfilter/nf_conntrack_ftp.c index 883c691ec8d0..19efeba02abb 100644 --- a/net/netfilter/nf_conntrack_ftp.c +++ b/net/netfilter/nf_conntrack_ftp.c | |||
@@ -632,6 +632,7 @@ static int __init nf_conntrack_ftp_init(void) | |||
632 | if (ret) { | 632 | if (ret) { |
633 | pr_err("failed to register helper for pf: %d port: %d\n", | 633 | pr_err("failed to register helper for pf: %d port: %d\n", |
634 | ftp[i][j].tuple.src.l3num, ports[i]); | 634 | ftp[i][j].tuple.src.l3num, ports[i]); |
635 | ports_c = i; | ||
635 | nf_conntrack_ftp_fini(); | 636 | nf_conntrack_ftp_fini(); |
636 | return ret; | 637 | return ret; |
637 | } | 638 | } |
diff --git a/net/netfilter/nf_conntrack_helper.c b/net/netfilter/nf_conntrack_helper.c index f703adb7e5f7..196cb39649e1 100644 --- a/net/netfilter/nf_conntrack_helper.c +++ b/net/netfilter/nf_conntrack_helper.c | |||
@@ -361,9 +361,10 @@ EXPORT_SYMBOL_GPL(nf_ct_helper_log); | |||
361 | 361 | ||
362 | int nf_conntrack_helper_register(struct nf_conntrack_helper *me) | 362 | int nf_conntrack_helper_register(struct nf_conntrack_helper *me) |
363 | { | 363 | { |
364 | int ret = 0; | 364 | struct nf_conntrack_tuple_mask mask = { .src.u.all = htons(0xFFFF) }; |
365 | struct nf_conntrack_helper *cur; | ||
366 | unsigned int h = helper_hash(&me->tuple); | 365 | unsigned int h = helper_hash(&me->tuple); |
366 | struct nf_conntrack_helper *cur; | ||
367 | int ret = 0; | ||
367 | 368 | ||
368 | BUG_ON(me->expect_policy == NULL); | 369 | BUG_ON(me->expect_policy == NULL); |
369 | BUG_ON(me->expect_class_max >= NF_CT_MAX_EXPECT_CLASSES); | 370 | BUG_ON(me->expect_class_max >= NF_CT_MAX_EXPECT_CLASSES); |
@@ -371,9 +372,7 @@ int nf_conntrack_helper_register(struct nf_conntrack_helper *me) | |||
371 | 372 | ||
372 | mutex_lock(&nf_ct_helper_mutex); | 373 | mutex_lock(&nf_ct_helper_mutex); |
373 | hlist_for_each_entry(cur, &nf_ct_helper_hash[h], hnode) { | 374 | hlist_for_each_entry(cur, &nf_ct_helper_hash[h], hnode) { |
374 | if (strncmp(cur->name, me->name, NF_CT_HELPER_NAME_LEN) == 0 && | 375 | if (nf_ct_tuple_src_mask_cmp(&cur->tuple, &me->tuple, &mask)) { |
375 | cur->tuple.src.l3num == me->tuple.src.l3num && | ||
376 | cur->tuple.dst.protonum == me->tuple.dst.protonum) { | ||
377 | ret = -EEXIST; | 376 | ret = -EEXIST; |
378 | goto out; | 377 | goto out; |
379 | } | 378 | } |
diff --git a/net/netfilter/nf_conntrack_irc.c b/net/netfilter/nf_conntrack_irc.c index 8b6da2719600..f97ac61d2536 100644 --- a/net/netfilter/nf_conntrack_irc.c +++ b/net/netfilter/nf_conntrack_irc.c | |||
@@ -271,6 +271,7 @@ static int __init nf_conntrack_irc_init(void) | |||
271 | if (ret) { | 271 | if (ret) { |
272 | pr_err("failed to register helper for pf: %u port: %u\n", | 272 | pr_err("failed to register helper for pf: %u port: %u\n", |
273 | irc[i].tuple.src.l3num, ports[i]); | 273 | irc[i].tuple.src.l3num, ports[i]); |
274 | ports_c = i; | ||
274 | nf_conntrack_irc_fini(); | 275 | nf_conntrack_irc_fini(); |
275 | return ret; | 276 | return ret; |
276 | } | 277 | } |
diff --git a/net/netfilter/nf_conntrack_sane.c b/net/netfilter/nf_conntrack_sane.c index 7523a575f6d1..3fcbaab83b3d 100644 --- a/net/netfilter/nf_conntrack_sane.c +++ b/net/netfilter/nf_conntrack_sane.c | |||
@@ -223,6 +223,7 @@ static int __init nf_conntrack_sane_init(void) | |||
223 | if (ret) { | 223 | if (ret) { |
224 | pr_err("failed to register helper for pf: %d port: %d\n", | 224 | pr_err("failed to register helper for pf: %d port: %d\n", |
225 | sane[i][j].tuple.src.l3num, ports[i]); | 225 | sane[i][j].tuple.src.l3num, ports[i]); |
226 | ports_c = i; | ||
226 | nf_conntrack_sane_fini(); | 227 | nf_conntrack_sane_fini(); |
227 | return ret; | 228 | return ret; |
228 | } | 229 | } |
diff --git a/net/netfilter/nf_conntrack_sip.c b/net/netfilter/nf_conntrack_sip.c index 3e06402739e0..f72ba5587588 100644 --- a/net/netfilter/nf_conntrack_sip.c +++ b/net/netfilter/nf_conntrack_sip.c | |||
@@ -1669,6 +1669,7 @@ static int __init nf_conntrack_sip_init(void) | |||
1669 | if (ret) { | 1669 | if (ret) { |
1670 | pr_err("failed to register helper for pf: %u port: %u\n", | 1670 | pr_err("failed to register helper for pf: %u port: %u\n", |
1671 | sip[i][j].tuple.src.l3num, ports[i]); | 1671 | sip[i][j].tuple.src.l3num, ports[i]); |
1672 | ports_c = i; | ||
1672 | nf_conntrack_sip_fini(); | 1673 | nf_conntrack_sip_fini(); |
1673 | return ret; | 1674 | return ret; |
1674 | } | 1675 | } |
diff --git a/net/netfilter/nf_conntrack_standalone.c b/net/netfilter/nf_conntrack_standalone.c index f87e84ebcec3..c026c472ea80 100644 --- a/net/netfilter/nf_conntrack_standalone.c +++ b/net/netfilter/nf_conntrack_standalone.c | |||
@@ -487,8 +487,6 @@ static struct ctl_table nf_ct_sysctl_table[] = { | |||
487 | { } | 487 | { } |
488 | }; | 488 | }; |
489 | 489 | ||
490 | #define NET_NF_CONNTRACK_MAX 2089 | ||
491 | |||
492 | static struct ctl_table nf_ct_netfilter_table[] = { | 490 | static struct ctl_table nf_ct_netfilter_table[] = { |
493 | { | 491 | { |
494 | .procname = "nf_conntrack_max", | 492 | .procname = "nf_conntrack_max", |
diff --git a/net/netfilter/nf_conntrack_tftp.c b/net/netfilter/nf_conntrack_tftp.c index 36f964066461..2e65b5430fba 100644 --- a/net/netfilter/nf_conntrack_tftp.c +++ b/net/netfilter/nf_conntrack_tftp.c | |||
@@ -142,6 +142,7 @@ static int __init nf_conntrack_tftp_init(void) | |||
142 | if (ret) { | 142 | if (ret) { |
143 | pr_err("failed to register helper for pf: %u port: %u\n", | 143 | pr_err("failed to register helper for pf: %u port: %u\n", |
144 | tftp[i][j].tuple.src.l3num, ports[i]); | 144 | tftp[i][j].tuple.src.l3num, ports[i]); |
145 | ports_c = i; | ||
145 | nf_conntrack_tftp_fini(); | 146 | nf_conntrack_tftp_fini(); |
146 | return ret; | 147 | return ret; |
147 | } | 148 | } |
diff --git a/net/netfilter/nf_queue.c b/net/netfilter/nf_queue.c index 5baa8e24e6ac..b19ad20a705c 100644 --- a/net/netfilter/nf_queue.c +++ b/net/netfilter/nf_queue.c | |||
@@ -26,23 +26,21 @@ | |||
26 | * Once the queue is registered it must reinject all packets it | 26 | * Once the queue is registered it must reinject all packets it |
27 | * receives, no matter what. | 27 | * receives, no matter what. |
28 | */ | 28 | */ |
29 | static const struct nf_queue_handler __rcu *queue_handler __read_mostly; | ||
30 | 29 | ||
31 | /* return EBUSY when somebody else is registered, return EEXIST if the | 30 | /* return EBUSY when somebody else is registered, return EEXIST if the |
32 | * same handler is registered, return 0 in case of success. */ | 31 | * same handler is registered, return 0 in case of success. */ |
33 | void nf_register_queue_handler(const struct nf_queue_handler *qh) | 32 | void nf_register_queue_handler(struct net *net, const struct nf_queue_handler *qh) |
34 | { | 33 | { |
35 | /* should never happen, we only have one queueing backend in kernel */ | 34 | /* should never happen, we only have one queueing backend in kernel */ |
36 | WARN_ON(rcu_access_pointer(queue_handler)); | 35 | WARN_ON(rcu_access_pointer(net->nf.queue_handler)); |
37 | rcu_assign_pointer(queue_handler, qh); | 36 | rcu_assign_pointer(net->nf.queue_handler, qh); |
38 | } | 37 | } |
39 | EXPORT_SYMBOL(nf_register_queue_handler); | 38 | EXPORT_SYMBOL(nf_register_queue_handler); |
40 | 39 | ||
41 | /* The caller must flush their queue before this */ | 40 | /* The caller must flush their queue before this */ |
42 | void nf_unregister_queue_handler(void) | 41 | void nf_unregister_queue_handler(struct net *net) |
43 | { | 42 | { |
44 | RCU_INIT_POINTER(queue_handler, NULL); | 43 | RCU_INIT_POINTER(net->nf.queue_handler, NULL); |
45 | synchronize_rcu(); | ||
46 | } | 44 | } |
47 | EXPORT_SYMBOL(nf_unregister_queue_handler); | 45 | EXPORT_SYMBOL(nf_unregister_queue_handler); |
48 | 46 | ||
@@ -103,7 +101,7 @@ void nf_queue_nf_hook_drop(struct net *net, struct nf_hook_ops *ops) | |||
103 | const struct nf_queue_handler *qh; | 101 | const struct nf_queue_handler *qh; |
104 | 102 | ||
105 | rcu_read_lock(); | 103 | rcu_read_lock(); |
106 | qh = rcu_dereference(queue_handler); | 104 | qh = rcu_dereference(net->nf.queue_handler); |
107 | if (qh) | 105 | if (qh) |
108 | qh->nf_hook_drop(net, ops); | 106 | qh->nf_hook_drop(net, ops); |
109 | rcu_read_unlock(); | 107 | rcu_read_unlock(); |
@@ -122,9 +120,10 @@ int nf_queue(struct sk_buff *skb, | |||
122 | struct nf_queue_entry *entry = NULL; | 120 | struct nf_queue_entry *entry = NULL; |
123 | const struct nf_afinfo *afinfo; | 121 | const struct nf_afinfo *afinfo; |
124 | const struct nf_queue_handler *qh; | 122 | const struct nf_queue_handler *qh; |
123 | struct net *net = state->net; | ||
125 | 124 | ||
126 | /* QUEUE == DROP if no one is waiting, to be safe. */ | 125 | /* QUEUE == DROP if no one is waiting, to be safe. */ |
127 | qh = rcu_dereference(queue_handler); | 126 | qh = rcu_dereference(net->nf.queue_handler); |
128 | if (!qh) { | 127 | if (!qh) { |
129 | status = -ESRCH; | 128 | status = -ESRCH; |
130 | goto err; | 129 | goto err; |
diff --git a/net/netfilter/nf_tables_api.c b/net/netfilter/nf_tables_api.c index 4d292b933b5c..7b7aa871a174 100644 --- a/net/netfilter/nf_tables_api.c +++ b/net/netfilter/nf_tables_api.c | |||
@@ -2647,6 +2647,8 @@ static int nf_tables_getset(struct net *net, struct sock *nlsk, | |||
2647 | /* Only accept unspec with dump */ | 2647 | /* Only accept unspec with dump */ |
2648 | if (nfmsg->nfgen_family == NFPROTO_UNSPEC) | 2648 | if (nfmsg->nfgen_family == NFPROTO_UNSPEC) |
2649 | return -EAFNOSUPPORT; | 2649 | return -EAFNOSUPPORT; |
2650 | if (!nla[NFTA_SET_TABLE]) | ||
2651 | return -EINVAL; | ||
2650 | 2652 | ||
2651 | set = nf_tables_set_lookup(ctx.table, nla[NFTA_SET_NAME]); | 2653 | set = nf_tables_set_lookup(ctx.table, nla[NFTA_SET_NAME]); |
2652 | if (IS_ERR(set)) | 2654 | if (IS_ERR(set)) |
diff --git a/net/netfilter/nfnetlink_queue.c b/net/netfilter/nfnetlink_queue.c index aa93877ab6e2..5d36a0926b4a 100644 --- a/net/netfilter/nfnetlink_queue.c +++ b/net/netfilter/nfnetlink_queue.c | |||
@@ -557,7 +557,7 @@ nfqnl_build_packet_message(struct net *net, struct nfqnl_instance *queue, | |||
557 | 557 | ||
558 | if (entskb->tstamp.tv64) { | 558 | if (entskb->tstamp.tv64) { |
559 | struct nfqnl_msg_packet_timestamp ts; | 559 | struct nfqnl_msg_packet_timestamp ts; |
560 | struct timespec64 kts = ktime_to_timespec64(skb->tstamp); | 560 | struct timespec64 kts = ktime_to_timespec64(entskb->tstamp); |
561 | 561 | ||
562 | ts.sec = cpu_to_be64(kts.tv_sec); | 562 | ts.sec = cpu_to_be64(kts.tv_sec); |
563 | ts.usec = cpu_to_be64(kts.tv_nsec / NSEC_PER_USEC); | 563 | ts.usec = cpu_to_be64(kts.tv_nsec / NSEC_PER_USEC); |
@@ -1482,21 +1482,29 @@ static int __net_init nfnl_queue_net_init(struct net *net) | |||
1482 | net->nf.proc_netfilter, &nfqnl_file_ops)) | 1482 | net->nf.proc_netfilter, &nfqnl_file_ops)) |
1483 | return -ENOMEM; | 1483 | return -ENOMEM; |
1484 | #endif | 1484 | #endif |
1485 | nf_register_queue_handler(net, &nfqh); | ||
1485 | return 0; | 1486 | return 0; |
1486 | } | 1487 | } |
1487 | 1488 | ||
1488 | static void __net_exit nfnl_queue_net_exit(struct net *net) | 1489 | static void __net_exit nfnl_queue_net_exit(struct net *net) |
1489 | { | 1490 | { |
1491 | nf_unregister_queue_handler(net); | ||
1490 | #ifdef CONFIG_PROC_FS | 1492 | #ifdef CONFIG_PROC_FS |
1491 | remove_proc_entry("nfnetlink_queue", net->nf.proc_netfilter); | 1493 | remove_proc_entry("nfnetlink_queue", net->nf.proc_netfilter); |
1492 | #endif | 1494 | #endif |
1493 | } | 1495 | } |
1494 | 1496 | ||
1497 | static void nfnl_queue_net_exit_batch(struct list_head *net_exit_list) | ||
1498 | { | ||
1499 | synchronize_rcu(); | ||
1500 | } | ||
1501 | |||
1495 | static struct pernet_operations nfnl_queue_net_ops = { | 1502 | static struct pernet_operations nfnl_queue_net_ops = { |
1496 | .init = nfnl_queue_net_init, | 1503 | .init = nfnl_queue_net_init, |
1497 | .exit = nfnl_queue_net_exit, | 1504 | .exit = nfnl_queue_net_exit, |
1498 | .id = &nfnl_queue_net_id, | 1505 | .exit_batch = nfnl_queue_net_exit_batch, |
1499 | .size = sizeof(struct nfnl_queue_net), | 1506 | .id = &nfnl_queue_net_id, |
1507 | .size = sizeof(struct nfnl_queue_net), | ||
1500 | }; | 1508 | }; |
1501 | 1509 | ||
1502 | static int __init nfnetlink_queue_init(void) | 1510 | static int __init nfnetlink_queue_init(void) |
@@ -1517,7 +1525,6 @@ static int __init nfnetlink_queue_init(void) | |||
1517 | } | 1525 | } |
1518 | 1526 | ||
1519 | register_netdevice_notifier(&nfqnl_dev_notifier); | 1527 | register_netdevice_notifier(&nfqnl_dev_notifier); |
1520 | nf_register_queue_handler(&nfqh); | ||
1521 | return status; | 1528 | return status; |
1522 | 1529 | ||
1523 | cleanup_netlink_notifier: | 1530 | cleanup_netlink_notifier: |
@@ -1529,7 +1536,6 @@ out: | |||
1529 | 1536 | ||
1530 | static void __exit nfnetlink_queue_fini(void) | 1537 | static void __exit nfnetlink_queue_fini(void) |
1531 | { | 1538 | { |
1532 | nf_unregister_queue_handler(); | ||
1533 | unregister_netdevice_notifier(&nfqnl_dev_notifier); | 1539 | unregister_netdevice_notifier(&nfqnl_dev_notifier); |
1534 | nfnetlink_subsys_unregister(&nfqnl_subsys); | 1540 | nfnetlink_subsys_unregister(&nfqnl_subsys); |
1535 | netlink_unregister_notifier(&nfqnl_rtnl_notifier); | 1541 | netlink_unregister_notifier(&nfqnl_rtnl_notifier); |
diff --git a/net/netfilter/x_tables.c b/net/netfilter/x_tables.c index c69c892231d7..2675d580c490 100644 --- a/net/netfilter/x_tables.c +++ b/net/netfilter/x_tables.c | |||
@@ -612,7 +612,7 @@ int xt_compat_check_entry_offsets(const void *base, const char *elems, | |||
612 | return -EINVAL; | 612 | return -EINVAL; |
613 | 613 | ||
614 | if (strcmp(t->u.user.name, XT_STANDARD_TARGET) == 0 && | 614 | if (strcmp(t->u.user.name, XT_STANDARD_TARGET) == 0 && |
615 | target_offset + sizeof(struct compat_xt_standard_target) != next_offset) | 615 | COMPAT_XT_ALIGN(target_offset + sizeof(struct compat_xt_standard_target)) != next_offset) |
616 | return -EINVAL; | 616 | return -EINVAL; |
617 | 617 | ||
618 | /* compat_xt_entry match has less strict aligment requirements, | 618 | /* compat_xt_entry match has less strict aligment requirements, |
@@ -694,7 +694,7 @@ int xt_check_entry_offsets(const void *base, | |||
694 | return -EINVAL; | 694 | return -EINVAL; |
695 | 695 | ||
696 | if (strcmp(t->u.user.name, XT_STANDARD_TARGET) == 0 && | 696 | if (strcmp(t->u.user.name, XT_STANDARD_TARGET) == 0 && |
697 | target_offset + sizeof(struct xt_standard_target) != next_offset) | 697 | XT_ALIGN(target_offset + sizeof(struct xt_standard_target)) != next_offset) |
698 | return -EINVAL; | 698 | return -EINVAL; |
699 | 699 | ||
700 | return xt_check_entry_match(elems, base + target_offset, | 700 | return xt_check_entry_match(elems, base + target_offset, |
diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c index 4040eb92d9c9..9bff6ef16fa7 100644 --- a/net/packet/af_packet.c +++ b/net/packet/af_packet.c | |||
@@ -93,6 +93,7 @@ | |||
93 | #include <net/inet_common.h> | 93 | #include <net/inet_common.h> |
94 | #endif | 94 | #endif |
95 | #include <linux/bpf.h> | 95 | #include <linux/bpf.h> |
96 | #include <net/compat.h> | ||
96 | 97 | ||
97 | #include "internal.h" | 98 | #include "internal.h" |
98 | 99 | ||
@@ -3940,6 +3941,27 @@ static int packet_getsockopt(struct socket *sock, int level, int optname, | |||
3940 | } | 3941 | } |
3941 | 3942 | ||
3942 | 3943 | ||
3944 | #ifdef CONFIG_COMPAT | ||
3945 | static int compat_packet_setsockopt(struct socket *sock, int level, int optname, | ||
3946 | char __user *optval, unsigned int optlen) | ||
3947 | { | ||
3948 | struct packet_sock *po = pkt_sk(sock->sk); | ||
3949 | |||
3950 | if (level != SOL_PACKET) | ||
3951 | return -ENOPROTOOPT; | ||
3952 | |||
3953 | if (optname == PACKET_FANOUT_DATA && | ||
3954 | po->fanout && po->fanout->type == PACKET_FANOUT_CBPF) { | ||
3955 | optval = (char __user *)get_compat_bpf_fprog(optval); | ||
3956 | if (!optval) | ||
3957 | return -EFAULT; | ||
3958 | optlen = sizeof(struct sock_fprog); | ||
3959 | } | ||
3960 | |||
3961 | return packet_setsockopt(sock, level, optname, optval, optlen); | ||
3962 | } | ||
3963 | #endif | ||
3964 | |||
3943 | static int packet_notifier(struct notifier_block *this, | 3965 | static int packet_notifier(struct notifier_block *this, |
3944 | unsigned long msg, void *ptr) | 3966 | unsigned long msg, void *ptr) |
3945 | { | 3967 | { |
@@ -4416,6 +4438,9 @@ static const struct proto_ops packet_ops = { | |||
4416 | .shutdown = sock_no_shutdown, | 4438 | .shutdown = sock_no_shutdown, |
4417 | .setsockopt = packet_setsockopt, | 4439 | .setsockopt = packet_setsockopt, |
4418 | .getsockopt = packet_getsockopt, | 4440 | .getsockopt = packet_getsockopt, |
4441 | #ifdef CONFIG_COMPAT | ||
4442 | .compat_setsockopt = compat_packet_setsockopt, | ||
4443 | #endif | ||
4419 | .sendmsg = packet_sendmsg, | 4444 | .sendmsg = packet_sendmsg, |
4420 | .recvmsg = packet_recvmsg, | 4445 | .recvmsg = packet_recvmsg, |
4421 | .mmap = packet_mmap, | 4446 | .mmap = packet_mmap, |
diff --git a/net/rds/rds.h b/net/rds/rds.h index 80256b08eac0..387df5f32e49 100644 --- a/net/rds/rds.h +++ b/net/rds/rds.h | |||
@@ -74,6 +74,7 @@ enum { | |||
74 | RDS_CONN_CONNECTING, | 74 | RDS_CONN_CONNECTING, |
75 | RDS_CONN_DISCONNECTING, | 75 | RDS_CONN_DISCONNECTING, |
76 | RDS_CONN_UP, | 76 | RDS_CONN_UP, |
77 | RDS_CONN_RESETTING, | ||
77 | RDS_CONN_ERROR, | 78 | RDS_CONN_ERROR, |
78 | }; | 79 | }; |
79 | 80 | ||
@@ -813,6 +814,7 @@ void rds_connect_worker(struct work_struct *); | |||
813 | void rds_shutdown_worker(struct work_struct *); | 814 | void rds_shutdown_worker(struct work_struct *); |
814 | void rds_send_worker(struct work_struct *); | 815 | void rds_send_worker(struct work_struct *); |
815 | void rds_recv_worker(struct work_struct *); | 816 | void rds_recv_worker(struct work_struct *); |
817 | void rds_connect_path_complete(struct rds_connection *conn, int curr); | ||
816 | void rds_connect_complete(struct rds_connection *conn); | 818 | void rds_connect_complete(struct rds_connection *conn); |
817 | 819 | ||
818 | /* transport.c */ | 820 | /* transport.c */ |
diff --git a/net/rds/recv.c b/net/rds/recv.c index c0be1ecd11c9..8413f6c99e13 100644 --- a/net/rds/recv.c +++ b/net/rds/recv.c | |||
@@ -561,5 +561,7 @@ void rds_inc_info_copy(struct rds_incoming *inc, | |||
561 | minfo.fport = inc->i_hdr.h_dport; | 561 | minfo.fport = inc->i_hdr.h_dport; |
562 | } | 562 | } |
563 | 563 | ||
564 | minfo.flags = 0; | ||
565 | |||
564 | rds_info_copy(iter, &minfo, sizeof(minfo)); | 566 | rds_info_copy(iter, &minfo, sizeof(minfo)); |
565 | } | 567 | } |
diff --git a/net/rds/send.c b/net/rds/send.c index c9cdb358ea88..b1962f8e30f7 100644 --- a/net/rds/send.c +++ b/net/rds/send.c | |||
@@ -99,6 +99,7 @@ void rds_send_reset(struct rds_connection *conn) | |||
99 | list_splice_init(&conn->c_retrans, &conn->c_send_queue); | 99 | list_splice_init(&conn->c_retrans, &conn->c_send_queue); |
100 | spin_unlock_irqrestore(&conn->c_lock, flags); | 100 | spin_unlock_irqrestore(&conn->c_lock, flags); |
101 | } | 101 | } |
102 | EXPORT_SYMBOL_GPL(rds_send_reset); | ||
102 | 103 | ||
103 | static int acquire_in_xmit(struct rds_connection *conn) | 104 | static int acquire_in_xmit(struct rds_connection *conn) |
104 | { | 105 | { |
diff --git a/net/rds/tcp.c b/net/rds/tcp.c index 86187dad1440..74ee126a6fe6 100644 --- a/net/rds/tcp.c +++ b/net/rds/tcp.c | |||
@@ -126,9 +126,81 @@ void rds_tcp_restore_callbacks(struct socket *sock, | |||
126 | } | 126 | } |
127 | 127 | ||
128 | /* | 128 | /* |
129 | * This is the only path that sets tc->t_sock. Send and receive trust that | 129 | * rds_tcp_reset_callbacks() switches the to the new sock and |
130 | * it is set. The RDS_CONN_UP bit protects those paths from being | 130 | * returns the existing tc->t_sock. |
131 | * called while it isn't set. | 131 | * |
132 | * The only functions that set tc->t_sock are rds_tcp_set_callbacks | ||
133 | * and rds_tcp_reset_callbacks. Send and receive trust that | ||
134 | * it is set. The absence of RDS_CONN_UP bit protects those paths | ||
135 | * from being called while it isn't set. | ||
136 | */ | ||
137 | void rds_tcp_reset_callbacks(struct socket *sock, | ||
138 | struct rds_connection *conn) | ||
139 | { | ||
140 | struct rds_tcp_connection *tc = conn->c_transport_data; | ||
141 | struct socket *osock = tc->t_sock; | ||
142 | |||
143 | if (!osock) | ||
144 | goto newsock; | ||
145 | |||
146 | /* Need to resolve a duelling SYN between peers. | ||
147 | * We have an outstanding SYN to this peer, which may | ||
148 | * potentially have transitioned to the RDS_CONN_UP state, | ||
149 | * so we must quiesce any send threads before resetting | ||
150 | * c_transport_data. We quiesce these threads by setting | ||
151 | * c_state to something other than RDS_CONN_UP, and then | ||
152 | * waiting for any existing threads in rds_send_xmit to | ||
153 | * complete release_in_xmit(). (Subsequent threads entering | ||
154 | * rds_send_xmit() will bail on !rds_conn_up(). | ||
155 | * | ||
156 | * However an incoming syn-ack at this point would end up | ||
157 | * marking the conn as RDS_CONN_UP, and would again permit | ||
158 | * rds_send_xmi() threads through, so ideally we would | ||
159 | * synchronize on RDS_CONN_UP after lock_sock(), but cannot | ||
160 | * do that: waiting on !RDS_IN_XMIT after lock_sock() may | ||
161 | * end up deadlocking with tcp_sendmsg(), and the RDS_IN_XMIT | ||
162 | * would not get set. As a result, we set c_state to | ||
163 | * RDS_CONN_RESETTTING, to ensure that rds_tcp_state_change | ||
164 | * cannot mark rds_conn_path_up() in the window before lock_sock() | ||
165 | */ | ||
166 | atomic_set(&conn->c_state, RDS_CONN_RESETTING); | ||
167 | wait_event(conn->c_waitq, !test_bit(RDS_IN_XMIT, &conn->c_flags)); | ||
168 | lock_sock(osock->sk); | ||
169 | /* reset receive side state for rds_tcp_data_recv() for osock */ | ||
170 | if (tc->t_tinc) { | ||
171 | rds_inc_put(&tc->t_tinc->ti_inc); | ||
172 | tc->t_tinc = NULL; | ||
173 | } | ||
174 | tc->t_tinc_hdr_rem = sizeof(struct rds_header); | ||
175 | tc->t_tinc_data_rem = 0; | ||
176 | tc->t_sock = NULL; | ||
177 | |||
178 | write_lock_bh(&osock->sk->sk_callback_lock); | ||
179 | |||
180 | osock->sk->sk_user_data = NULL; | ||
181 | osock->sk->sk_data_ready = tc->t_orig_data_ready; | ||
182 | osock->sk->sk_write_space = tc->t_orig_write_space; | ||
183 | osock->sk->sk_state_change = tc->t_orig_state_change; | ||
184 | write_unlock_bh(&osock->sk->sk_callback_lock); | ||
185 | release_sock(osock->sk); | ||
186 | sock_release(osock); | ||
187 | newsock: | ||
188 | rds_send_reset(conn); | ||
189 | lock_sock(sock->sk); | ||
190 | write_lock_bh(&sock->sk->sk_callback_lock); | ||
191 | tc->t_sock = sock; | ||
192 | sock->sk->sk_user_data = conn; | ||
193 | sock->sk->sk_data_ready = rds_tcp_data_ready; | ||
194 | sock->sk->sk_write_space = rds_tcp_write_space; | ||
195 | sock->sk->sk_state_change = rds_tcp_state_change; | ||
196 | |||
197 | write_unlock_bh(&sock->sk->sk_callback_lock); | ||
198 | release_sock(sock->sk); | ||
199 | } | ||
200 | |||
201 | /* Add tc to rds_tcp_tc_list and set tc->t_sock. See comments | ||
202 | * above rds_tcp_reset_callbacks for notes about synchronization | ||
203 | * with data path | ||
132 | */ | 204 | */ |
133 | void rds_tcp_set_callbacks(struct socket *sock, struct rds_connection *conn) | 205 | void rds_tcp_set_callbacks(struct socket *sock, struct rds_connection *conn) |
134 | { | 206 | { |
diff --git a/net/rds/tcp.h b/net/rds/tcp.h index 41c228300525..ec0602b0dc24 100644 --- a/net/rds/tcp.h +++ b/net/rds/tcp.h | |||
@@ -50,6 +50,7 @@ struct rds_tcp_statistics { | |||
50 | void rds_tcp_tune(struct socket *sock); | 50 | void rds_tcp_tune(struct socket *sock); |
51 | void rds_tcp_nonagle(struct socket *sock); | 51 | void rds_tcp_nonagle(struct socket *sock); |
52 | void rds_tcp_set_callbacks(struct socket *sock, struct rds_connection *conn); | 52 | void rds_tcp_set_callbacks(struct socket *sock, struct rds_connection *conn); |
53 | void rds_tcp_reset_callbacks(struct socket *sock, struct rds_connection *conn); | ||
53 | void rds_tcp_restore_callbacks(struct socket *sock, | 54 | void rds_tcp_restore_callbacks(struct socket *sock, |
54 | struct rds_tcp_connection *tc); | 55 | struct rds_tcp_connection *tc); |
55 | u32 rds_tcp_snd_nxt(struct rds_tcp_connection *tc); | 56 | u32 rds_tcp_snd_nxt(struct rds_tcp_connection *tc); |
diff --git a/net/rds/tcp_connect.c b/net/rds/tcp_connect.c index fb82e0a0bf89..fba13d0305fb 100644 --- a/net/rds/tcp_connect.c +++ b/net/rds/tcp_connect.c | |||
@@ -60,7 +60,7 @@ void rds_tcp_state_change(struct sock *sk) | |||
60 | case TCP_SYN_RECV: | 60 | case TCP_SYN_RECV: |
61 | break; | 61 | break; |
62 | case TCP_ESTABLISHED: | 62 | case TCP_ESTABLISHED: |
63 | rds_connect_complete(conn); | 63 | rds_connect_path_complete(conn, RDS_CONN_CONNECTING); |
64 | break; | 64 | break; |
65 | case TCP_CLOSE_WAIT: | 65 | case TCP_CLOSE_WAIT: |
66 | case TCP_CLOSE: | 66 | case TCP_CLOSE: |
diff --git a/net/rds/tcp_listen.c b/net/rds/tcp_listen.c index 4bf4befe5066..686b1d03a558 100644 --- a/net/rds/tcp_listen.c +++ b/net/rds/tcp_listen.c | |||
@@ -78,7 +78,6 @@ int rds_tcp_accept_one(struct socket *sock) | |||
78 | struct inet_sock *inet; | 78 | struct inet_sock *inet; |
79 | struct rds_tcp_connection *rs_tcp = NULL; | 79 | struct rds_tcp_connection *rs_tcp = NULL; |
80 | int conn_state; | 80 | int conn_state; |
81 | struct sock *nsk; | ||
82 | 81 | ||
83 | if (!sock) /* module unload or netns delete in progress */ | 82 | if (!sock) /* module unload or netns delete in progress */ |
84 | return -ENETUNREACH; | 83 | return -ENETUNREACH; |
@@ -136,26 +135,21 @@ int rds_tcp_accept_one(struct socket *sock) | |||
136 | !conn->c_outgoing) { | 135 | !conn->c_outgoing) { |
137 | goto rst_nsk; | 136 | goto rst_nsk; |
138 | } else { | 137 | } else { |
139 | atomic_set(&conn->c_state, RDS_CONN_CONNECTING); | 138 | rds_tcp_reset_callbacks(new_sock, conn); |
140 | wait_event(conn->c_waitq, | ||
141 | !test_bit(RDS_IN_XMIT, &conn->c_flags)); | ||
142 | rds_tcp_restore_callbacks(rs_tcp->t_sock, rs_tcp); | ||
143 | conn->c_outgoing = 0; | 139 | conn->c_outgoing = 0; |
140 | /* rds_connect_path_complete() marks RDS_CONN_UP */ | ||
141 | rds_connect_path_complete(conn, RDS_CONN_DISCONNECTING); | ||
144 | } | 142 | } |
143 | } else { | ||
144 | rds_tcp_set_callbacks(new_sock, conn); | ||
145 | rds_connect_path_complete(conn, RDS_CONN_CONNECTING); | ||
145 | } | 146 | } |
146 | rds_tcp_set_callbacks(new_sock, conn); | ||
147 | rds_connect_complete(conn); /* marks RDS_CONN_UP */ | ||
148 | new_sock = NULL; | 147 | new_sock = NULL; |
149 | ret = 0; | 148 | ret = 0; |
150 | goto out; | 149 | goto out; |
151 | rst_nsk: | 150 | rst_nsk: |
152 | /* reset the newly returned accept sock and bail */ | 151 | /* reset the newly returned accept sock and bail */ |
153 | nsk = new_sock->sk; | 152 | kernel_sock_shutdown(new_sock, SHUT_RDWR); |
154 | rds_tcp_stats_inc(s_tcp_listen_closed_stale); | ||
155 | nsk->sk_user_data = NULL; | ||
156 | nsk->sk_prot->disconnect(nsk, 0); | ||
157 | tcp_done(nsk); | ||
158 | new_sock = NULL; | ||
159 | ret = 0; | 153 | ret = 0; |
160 | out: | 154 | out: |
161 | if (rs_tcp) | 155 | if (rs_tcp) |
diff --git a/net/rds/threads.c b/net/rds/threads.c index 454aa6d23327..4a323045719b 100644 --- a/net/rds/threads.c +++ b/net/rds/threads.c | |||
@@ -71,9 +71,9 @@ | |||
71 | struct workqueue_struct *rds_wq; | 71 | struct workqueue_struct *rds_wq; |
72 | EXPORT_SYMBOL_GPL(rds_wq); | 72 | EXPORT_SYMBOL_GPL(rds_wq); |
73 | 73 | ||
74 | void rds_connect_complete(struct rds_connection *conn) | 74 | void rds_connect_path_complete(struct rds_connection *conn, int curr) |
75 | { | 75 | { |
76 | if (!rds_conn_transition(conn, RDS_CONN_CONNECTING, RDS_CONN_UP)) { | 76 | if (!rds_conn_transition(conn, curr, RDS_CONN_UP)) { |
77 | printk(KERN_WARNING "%s: Cannot transition to state UP, " | 77 | printk(KERN_WARNING "%s: Cannot transition to state UP, " |
78 | "current state is %d\n", | 78 | "current state is %d\n", |
79 | __func__, | 79 | __func__, |
@@ -90,6 +90,12 @@ void rds_connect_complete(struct rds_connection *conn) | |||
90 | queue_delayed_work(rds_wq, &conn->c_send_w, 0); | 90 | queue_delayed_work(rds_wq, &conn->c_send_w, 0); |
91 | queue_delayed_work(rds_wq, &conn->c_recv_w, 0); | 91 | queue_delayed_work(rds_wq, &conn->c_recv_w, 0); |
92 | } | 92 | } |
93 | EXPORT_SYMBOL_GPL(rds_connect_path_complete); | ||
94 | |||
95 | void rds_connect_complete(struct rds_connection *conn) | ||
96 | { | ||
97 | rds_connect_path_complete(conn, RDS_CONN_CONNECTING); | ||
98 | } | ||
93 | EXPORT_SYMBOL_GPL(rds_connect_complete); | 99 | EXPORT_SYMBOL_GPL(rds_connect_complete); |
94 | 100 | ||
95 | /* | 101 | /* |
diff --git a/net/rxrpc/rxkad.c b/net/rxrpc/rxkad.c index 6b726a046a7d..bab56ed649ba 100644 --- a/net/rxrpc/rxkad.c +++ b/net/rxrpc/rxkad.c | |||
@@ -1162,9 +1162,7 @@ static int rxkad_init(void) | |||
1162 | /* pin the cipher we need so that the crypto layer doesn't invoke | 1162 | /* pin the cipher we need so that the crypto layer doesn't invoke |
1163 | * keventd to go get it */ | 1163 | * keventd to go get it */ |
1164 | rxkad_ci = crypto_alloc_skcipher("pcbc(fcrypt)", 0, CRYPTO_ALG_ASYNC); | 1164 | rxkad_ci = crypto_alloc_skcipher("pcbc(fcrypt)", 0, CRYPTO_ALG_ASYNC); |
1165 | if (IS_ERR(rxkad_ci)) | 1165 | return PTR_ERR_OR_ZERO(rxkad_ci); |
1166 | return PTR_ERR(rxkad_ci); | ||
1167 | return 0; | ||
1168 | } | 1166 | } |
1169 | 1167 | ||
1170 | /* | 1168 | /* |
diff --git a/net/sched/act_police.c b/net/sched/act_police.c index b884dae692a1..c557789765dc 100644 --- a/net/sched/act_police.c +++ b/net/sched/act_police.c | |||
@@ -38,7 +38,7 @@ struct tcf_police { | |||
38 | bool peak_present; | 38 | bool peak_present; |
39 | }; | 39 | }; |
40 | #define to_police(pc) \ | 40 | #define to_police(pc) \ |
41 | container_of(pc, struct tcf_police, common) | 41 | container_of(pc->priv, struct tcf_police, common) |
42 | 42 | ||
43 | #define POL_TAB_MASK 15 | 43 | #define POL_TAB_MASK 15 |
44 | 44 | ||
@@ -119,14 +119,12 @@ static int tcf_act_police_locate(struct net *net, struct nlattr *nla, | |||
119 | struct nlattr *est, struct tc_action *a, | 119 | struct nlattr *est, struct tc_action *a, |
120 | int ovr, int bind) | 120 | int ovr, int bind) |
121 | { | 121 | { |
122 | unsigned int h; | ||
123 | int ret = 0, err; | 122 | int ret = 0, err; |
124 | struct nlattr *tb[TCA_POLICE_MAX + 1]; | 123 | struct nlattr *tb[TCA_POLICE_MAX + 1]; |
125 | struct tc_police *parm; | 124 | struct tc_police *parm; |
126 | struct tcf_police *police; | 125 | struct tcf_police *police; |
127 | struct qdisc_rate_table *R_tab = NULL, *P_tab = NULL; | 126 | struct qdisc_rate_table *R_tab = NULL, *P_tab = NULL; |
128 | struct tc_action_net *tn = net_generic(net, police_net_id); | 127 | struct tc_action_net *tn = net_generic(net, police_net_id); |
129 | struct tcf_hashinfo *hinfo = tn->hinfo; | ||
130 | int size; | 128 | int size; |
131 | 129 | ||
132 | if (nla == NULL) | 130 | if (nla == NULL) |
@@ -145,7 +143,7 @@ static int tcf_act_police_locate(struct net *net, struct nlattr *nla, | |||
145 | 143 | ||
146 | if (parm->index) { | 144 | if (parm->index) { |
147 | if (tcf_hash_search(tn, a, parm->index)) { | 145 | if (tcf_hash_search(tn, a, parm->index)) { |
148 | police = to_police(a->priv); | 146 | police = to_police(a); |
149 | if (bind) { | 147 | if (bind) { |
150 | police->tcf_bindcnt += 1; | 148 | police->tcf_bindcnt += 1; |
151 | police->tcf_refcnt += 1; | 149 | police->tcf_refcnt += 1; |
@@ -156,16 +154,15 @@ static int tcf_act_police_locate(struct net *net, struct nlattr *nla, | |||
156 | /* not replacing */ | 154 | /* not replacing */ |
157 | return -EEXIST; | 155 | return -EEXIST; |
158 | } | 156 | } |
157 | } else { | ||
158 | ret = tcf_hash_create(tn, parm->index, NULL, a, | ||
159 | sizeof(*police), bind, false); | ||
160 | if (ret) | ||
161 | return ret; | ||
162 | ret = ACT_P_CREATED; | ||
159 | } | 163 | } |
160 | 164 | ||
161 | police = kzalloc(sizeof(*police), GFP_KERNEL); | 165 | police = to_police(a); |
162 | if (police == NULL) | ||
163 | return -ENOMEM; | ||
164 | ret = ACT_P_CREATED; | ||
165 | police->tcf_refcnt = 1; | ||
166 | spin_lock_init(&police->tcf_lock); | ||
167 | if (bind) | ||
168 | police->tcf_bindcnt = 1; | ||
169 | override: | 166 | override: |
170 | if (parm->rate.rate) { | 167 | if (parm->rate.rate) { |
171 | err = -ENOMEM; | 168 | err = -ENOMEM; |
@@ -237,16 +234,8 @@ override: | |||
237 | return ret; | 234 | return ret; |
238 | 235 | ||
239 | police->tcfp_t_c = ktime_get_ns(); | 236 | police->tcfp_t_c = ktime_get_ns(); |
240 | police->tcf_index = parm->index ? parm->index : | 237 | tcf_hash_insert(tn, a); |
241 | tcf_hash_new_index(tn); | ||
242 | police->tcf_tm.install = jiffies; | ||
243 | police->tcf_tm.lastuse = jiffies; | ||
244 | h = tcf_hash(police->tcf_index, POL_TAB_MASK); | ||
245 | spin_lock_bh(&hinfo->lock); | ||
246 | hlist_add_head(&police->tcf_head, &hinfo->htab[h]); | ||
247 | spin_unlock_bh(&hinfo->lock); | ||
248 | 238 | ||
249 | a->priv = police; | ||
250 | return ret; | 239 | return ret; |
251 | 240 | ||
252 | failure_unlock: | 241 | failure_unlock: |
@@ -255,7 +244,7 @@ failure: | |||
255 | qdisc_put_rtab(P_tab); | 244 | qdisc_put_rtab(P_tab); |
256 | qdisc_put_rtab(R_tab); | 245 | qdisc_put_rtab(R_tab); |
257 | if (ret == ACT_P_CREATED) | 246 | if (ret == ACT_P_CREATED) |
258 | kfree(police); | 247 | tcf_hash_cleanup(a, est); |
259 | return err; | 248 | return err; |
260 | } | 249 | } |
261 | 250 | ||
diff --git a/net/sched/cls_flower.c b/net/sched/cls_flower.c index 730aacafc22d..b3b7978f4182 100644 --- a/net/sched/cls_flower.c +++ b/net/sched/cls_flower.c | |||
@@ -171,7 +171,7 @@ static void fl_hw_destroy_filter(struct tcf_proto *tp, unsigned long cookie) | |||
171 | struct tc_cls_flower_offload offload = {0}; | 171 | struct tc_cls_flower_offload offload = {0}; |
172 | struct tc_to_netdev tc; | 172 | struct tc_to_netdev tc; |
173 | 173 | ||
174 | if (!tc_should_offload(dev, 0)) | 174 | if (!tc_should_offload(dev, tp, 0)) |
175 | return; | 175 | return; |
176 | 176 | ||
177 | offload.command = TC_CLSFLOWER_DESTROY; | 177 | offload.command = TC_CLSFLOWER_DESTROY; |
@@ -194,7 +194,7 @@ static void fl_hw_replace_filter(struct tcf_proto *tp, | |||
194 | struct tc_cls_flower_offload offload = {0}; | 194 | struct tc_cls_flower_offload offload = {0}; |
195 | struct tc_to_netdev tc; | 195 | struct tc_to_netdev tc; |
196 | 196 | ||
197 | if (!tc_should_offload(dev, flags)) | 197 | if (!tc_should_offload(dev, tp, flags)) |
198 | return; | 198 | return; |
199 | 199 | ||
200 | offload.command = TC_CLSFLOWER_REPLACE; | 200 | offload.command = TC_CLSFLOWER_REPLACE; |
@@ -216,7 +216,7 @@ static void fl_hw_update_stats(struct tcf_proto *tp, struct cls_fl_filter *f) | |||
216 | struct tc_cls_flower_offload offload = {0}; | 216 | struct tc_cls_flower_offload offload = {0}; |
217 | struct tc_to_netdev tc; | 217 | struct tc_to_netdev tc; |
218 | 218 | ||
219 | if (!tc_should_offload(dev, 0)) | 219 | if (!tc_should_offload(dev, tp, 0)) |
220 | return; | 220 | return; |
221 | 221 | ||
222 | offload.command = TC_CLSFLOWER_STATS; | 222 | offload.command = TC_CLSFLOWER_STATS; |
diff --git a/net/sched/cls_u32.c b/net/sched/cls_u32.c index 079b43b3c5d2..ffe593efe930 100644 --- a/net/sched/cls_u32.c +++ b/net/sched/cls_u32.c | |||
@@ -440,7 +440,7 @@ static void u32_remove_hw_knode(struct tcf_proto *tp, u32 handle) | |||
440 | offload.type = TC_SETUP_CLSU32; | 440 | offload.type = TC_SETUP_CLSU32; |
441 | offload.cls_u32 = &u32_offload; | 441 | offload.cls_u32 = &u32_offload; |
442 | 442 | ||
443 | if (tc_should_offload(dev, 0)) { | 443 | if (tc_should_offload(dev, tp, 0)) { |
444 | offload.cls_u32->command = TC_CLSU32_DELETE_KNODE; | 444 | offload.cls_u32->command = TC_CLSU32_DELETE_KNODE; |
445 | offload.cls_u32->knode.handle = handle; | 445 | offload.cls_u32->knode.handle = handle; |
446 | dev->netdev_ops->ndo_setup_tc(dev, tp->q->handle, | 446 | dev->netdev_ops->ndo_setup_tc(dev, tp->q->handle, |
@@ -457,20 +457,21 @@ static int u32_replace_hw_hnode(struct tcf_proto *tp, | |||
457 | struct tc_to_netdev offload; | 457 | struct tc_to_netdev offload; |
458 | int err; | 458 | int err; |
459 | 459 | ||
460 | if (!tc_should_offload(dev, tp, flags)) | ||
461 | return tc_skip_sw(flags) ? -EINVAL : 0; | ||
462 | |||
460 | offload.type = TC_SETUP_CLSU32; | 463 | offload.type = TC_SETUP_CLSU32; |
461 | offload.cls_u32 = &u32_offload; | 464 | offload.cls_u32 = &u32_offload; |
462 | 465 | ||
463 | if (tc_should_offload(dev, flags)) { | 466 | offload.cls_u32->command = TC_CLSU32_NEW_HNODE; |
464 | offload.cls_u32->command = TC_CLSU32_NEW_HNODE; | 467 | offload.cls_u32->hnode.divisor = h->divisor; |
465 | offload.cls_u32->hnode.divisor = h->divisor; | 468 | offload.cls_u32->hnode.handle = h->handle; |
466 | offload.cls_u32->hnode.handle = h->handle; | 469 | offload.cls_u32->hnode.prio = h->prio; |
467 | offload.cls_u32->hnode.prio = h->prio; | ||
468 | 470 | ||
469 | err = dev->netdev_ops->ndo_setup_tc(dev, tp->q->handle, | 471 | err = dev->netdev_ops->ndo_setup_tc(dev, tp->q->handle, |
470 | tp->protocol, &offload); | 472 | tp->protocol, &offload); |
471 | if (tc_skip_sw(flags)) | 473 | if (tc_skip_sw(flags)) |
472 | return err; | 474 | return err; |
473 | } | ||
474 | 475 | ||
475 | return 0; | 476 | return 0; |
476 | } | 477 | } |
@@ -484,7 +485,7 @@ static void u32_clear_hw_hnode(struct tcf_proto *tp, struct tc_u_hnode *h) | |||
484 | offload.type = TC_SETUP_CLSU32; | 485 | offload.type = TC_SETUP_CLSU32; |
485 | offload.cls_u32 = &u32_offload; | 486 | offload.cls_u32 = &u32_offload; |
486 | 487 | ||
487 | if (tc_should_offload(dev, 0)) { | 488 | if (tc_should_offload(dev, tp, 0)) { |
488 | offload.cls_u32->command = TC_CLSU32_DELETE_HNODE; | 489 | offload.cls_u32->command = TC_CLSU32_DELETE_HNODE; |
489 | offload.cls_u32->hnode.divisor = h->divisor; | 490 | offload.cls_u32->hnode.divisor = h->divisor; |
490 | offload.cls_u32->hnode.handle = h->handle; | 491 | offload.cls_u32->hnode.handle = h->handle; |
@@ -507,27 +508,28 @@ static int u32_replace_hw_knode(struct tcf_proto *tp, | |||
507 | offload.type = TC_SETUP_CLSU32; | 508 | offload.type = TC_SETUP_CLSU32; |
508 | offload.cls_u32 = &u32_offload; | 509 | offload.cls_u32 = &u32_offload; |
509 | 510 | ||
510 | if (tc_should_offload(dev, flags)) { | 511 | if (!tc_should_offload(dev, tp, flags)) |
511 | offload.cls_u32->command = TC_CLSU32_REPLACE_KNODE; | 512 | return tc_skip_sw(flags) ? -EINVAL : 0; |
512 | offload.cls_u32->knode.handle = n->handle; | 513 | |
513 | offload.cls_u32->knode.fshift = n->fshift; | 514 | offload.cls_u32->command = TC_CLSU32_REPLACE_KNODE; |
515 | offload.cls_u32->knode.handle = n->handle; | ||
516 | offload.cls_u32->knode.fshift = n->fshift; | ||
514 | #ifdef CONFIG_CLS_U32_MARK | 517 | #ifdef CONFIG_CLS_U32_MARK |
515 | offload.cls_u32->knode.val = n->val; | 518 | offload.cls_u32->knode.val = n->val; |
516 | offload.cls_u32->knode.mask = n->mask; | 519 | offload.cls_u32->knode.mask = n->mask; |
517 | #else | 520 | #else |
518 | offload.cls_u32->knode.val = 0; | 521 | offload.cls_u32->knode.val = 0; |
519 | offload.cls_u32->knode.mask = 0; | 522 | offload.cls_u32->knode.mask = 0; |
520 | #endif | 523 | #endif |
521 | offload.cls_u32->knode.sel = &n->sel; | 524 | offload.cls_u32->knode.sel = &n->sel; |
522 | offload.cls_u32->knode.exts = &n->exts; | 525 | offload.cls_u32->knode.exts = &n->exts; |
523 | if (n->ht_down) | 526 | if (n->ht_down) |
524 | offload.cls_u32->knode.link_handle = n->ht_down->handle; | 527 | offload.cls_u32->knode.link_handle = n->ht_down->handle; |
525 | 528 | ||
526 | err = dev->netdev_ops->ndo_setup_tc(dev, tp->q->handle, | 529 | err = dev->netdev_ops->ndo_setup_tc(dev, tp->q->handle, |
527 | tp->protocol, &offload); | 530 | tp->protocol, &offload); |
528 | if (tc_skip_sw(flags)) | 531 | if (tc_skip_sw(flags)) |
529 | return err; | 532 | return err; |
530 | } | ||
531 | 533 | ||
532 | return 0; | 534 | return 0; |
533 | } | 535 | } |
@@ -863,7 +865,7 @@ static int u32_change(struct net *net, struct sk_buff *in_skb, | |||
863 | if (tb[TCA_U32_FLAGS]) { | 865 | if (tb[TCA_U32_FLAGS]) { |
864 | flags = nla_get_u32(tb[TCA_U32_FLAGS]); | 866 | flags = nla_get_u32(tb[TCA_U32_FLAGS]); |
865 | if (!tc_flags_valid(flags)) | 867 | if (!tc_flags_valid(flags)) |
866 | return err; | 868 | return -EINVAL; |
867 | } | 869 | } |
868 | 870 | ||
869 | n = (struct tc_u_knode *)*arg; | 871 | n = (struct tc_u_knode *)*arg; |
@@ -921,11 +923,17 @@ static int u32_change(struct net *net, struct sk_buff *in_skb, | |||
921 | ht->divisor = divisor; | 923 | ht->divisor = divisor; |
922 | ht->handle = handle; | 924 | ht->handle = handle; |
923 | ht->prio = tp->prio; | 925 | ht->prio = tp->prio; |
926 | |||
927 | err = u32_replace_hw_hnode(tp, ht, flags); | ||
928 | if (err) { | ||
929 | kfree(ht); | ||
930 | return err; | ||
931 | } | ||
932 | |||
924 | RCU_INIT_POINTER(ht->next, tp_c->hlist); | 933 | RCU_INIT_POINTER(ht->next, tp_c->hlist); |
925 | rcu_assign_pointer(tp_c->hlist, ht); | 934 | rcu_assign_pointer(tp_c->hlist, ht); |
926 | *arg = (unsigned long)ht; | 935 | *arg = (unsigned long)ht; |
927 | 936 | ||
928 | u32_replace_hw_hnode(tp, ht, flags); | ||
929 | return 0; | 937 | return 0; |
930 | } | 938 | } |
931 | 939 | ||
diff --git a/net/sched/sch_drr.c b/net/sched/sch_drr.c index a63e879e8975..bf8af2c43c2c 100644 --- a/net/sched/sch_drr.c +++ b/net/sched/sch_drr.c | |||
@@ -375,6 +375,7 @@ static int drr_enqueue(struct sk_buff *skb, struct Qdisc *sch) | |||
375 | cl->deficit = cl->quantum; | 375 | cl->deficit = cl->quantum; |
376 | } | 376 | } |
377 | 377 | ||
378 | qdisc_qstats_backlog_inc(sch, skb); | ||
378 | sch->q.qlen++; | 379 | sch->q.qlen++; |
379 | return err; | 380 | return err; |
380 | } | 381 | } |
@@ -407,6 +408,7 @@ static struct sk_buff *drr_dequeue(struct Qdisc *sch) | |||
407 | 408 | ||
408 | bstats_update(&cl->bstats, skb); | 409 | bstats_update(&cl->bstats, skb); |
409 | qdisc_bstats_update(sch, skb); | 410 | qdisc_bstats_update(sch, skb); |
411 | qdisc_qstats_backlog_dec(sch, skb); | ||
410 | sch->q.qlen--; | 412 | sch->q.qlen--; |
411 | return skb; | 413 | return skb; |
412 | } | 414 | } |
@@ -428,6 +430,7 @@ static unsigned int drr_drop(struct Qdisc *sch) | |||
428 | if (cl->qdisc->ops->drop) { | 430 | if (cl->qdisc->ops->drop) { |
429 | len = cl->qdisc->ops->drop(cl->qdisc); | 431 | len = cl->qdisc->ops->drop(cl->qdisc); |
430 | if (len > 0) { | 432 | if (len > 0) { |
433 | sch->qstats.backlog -= len; | ||
431 | sch->q.qlen--; | 434 | sch->q.qlen--; |
432 | if (cl->qdisc->q.qlen == 0) | 435 | if (cl->qdisc->q.qlen == 0) |
433 | list_del(&cl->alist); | 436 | list_del(&cl->alist); |
@@ -463,6 +466,7 @@ static void drr_reset_qdisc(struct Qdisc *sch) | |||
463 | qdisc_reset(cl->qdisc); | 466 | qdisc_reset(cl->qdisc); |
464 | } | 467 | } |
465 | } | 468 | } |
469 | sch->qstats.backlog = 0; | ||
466 | sch->q.qlen = 0; | 470 | sch->q.qlen = 0; |
467 | } | 471 | } |
468 | 472 | ||
diff --git a/net/sched/sch_fq_codel.c b/net/sched/sch_fq_codel.c index 6883a8971562..da250b2e06ae 100644 --- a/net/sched/sch_fq_codel.c +++ b/net/sched/sch_fq_codel.c | |||
@@ -199,6 +199,7 @@ static int fq_codel_enqueue(struct sk_buff *skb, struct Qdisc *sch) | |||
199 | unsigned int idx, prev_backlog, prev_qlen; | 199 | unsigned int idx, prev_backlog, prev_qlen; |
200 | struct fq_codel_flow *flow; | 200 | struct fq_codel_flow *flow; |
201 | int uninitialized_var(ret); | 201 | int uninitialized_var(ret); |
202 | unsigned int pkt_len; | ||
202 | bool memory_limited; | 203 | bool memory_limited; |
203 | 204 | ||
204 | idx = fq_codel_classify(skb, sch, &ret); | 205 | idx = fq_codel_classify(skb, sch, &ret); |
@@ -230,6 +231,8 @@ static int fq_codel_enqueue(struct sk_buff *skb, struct Qdisc *sch) | |||
230 | prev_backlog = sch->qstats.backlog; | 231 | prev_backlog = sch->qstats.backlog; |
231 | prev_qlen = sch->q.qlen; | 232 | prev_qlen = sch->q.qlen; |
232 | 233 | ||
234 | /* save this packet length as it might be dropped by fq_codel_drop() */ | ||
235 | pkt_len = qdisc_pkt_len(skb); | ||
233 | /* fq_codel_drop() is quite expensive, as it performs a linear search | 236 | /* fq_codel_drop() is quite expensive, as it performs a linear search |
234 | * in q->backlogs[] to find a fat flow. | 237 | * in q->backlogs[] to find a fat flow. |
235 | * So instead of dropping a single packet, drop half of its backlog | 238 | * So instead of dropping a single packet, drop half of its backlog |
@@ -237,14 +240,23 @@ static int fq_codel_enqueue(struct sk_buff *skb, struct Qdisc *sch) | |||
237 | */ | 240 | */ |
238 | ret = fq_codel_drop(sch, q->drop_batch_size); | 241 | ret = fq_codel_drop(sch, q->drop_batch_size); |
239 | 242 | ||
240 | q->drop_overlimit += prev_qlen - sch->q.qlen; | 243 | prev_qlen -= sch->q.qlen; |
244 | prev_backlog -= sch->qstats.backlog; | ||
245 | q->drop_overlimit += prev_qlen; | ||
241 | if (memory_limited) | 246 | if (memory_limited) |
242 | q->drop_overmemory += prev_qlen - sch->q.qlen; | 247 | q->drop_overmemory += prev_qlen; |
243 | /* As we dropped packet(s), better let upper stack know this */ | ||
244 | qdisc_tree_reduce_backlog(sch, prev_qlen - sch->q.qlen, | ||
245 | prev_backlog - sch->qstats.backlog); | ||
246 | 248 | ||
247 | return ret == idx ? NET_XMIT_CN : NET_XMIT_SUCCESS; | 249 | /* As we dropped packet(s), better let upper stack know this. |
250 | * If we dropped a packet for this flow, return NET_XMIT_CN, | ||
251 | * but in this case, our parents wont increase their backlogs. | ||
252 | */ | ||
253 | if (ret == idx) { | ||
254 | qdisc_tree_reduce_backlog(sch, prev_qlen - 1, | ||
255 | prev_backlog - pkt_len); | ||
256 | return NET_XMIT_CN; | ||
257 | } | ||
258 | qdisc_tree_reduce_backlog(sch, prev_qlen, prev_backlog); | ||
259 | return NET_XMIT_SUCCESS; | ||
248 | } | 260 | } |
249 | 261 | ||
250 | /* This is the specific function called from codel_dequeue() | 262 | /* This is the specific function called from codel_dequeue() |
@@ -649,7 +661,7 @@ static int fq_codel_dump_class_stats(struct Qdisc *sch, unsigned long cl, | |||
649 | qs.backlog = q->backlogs[idx]; | 661 | qs.backlog = q->backlogs[idx]; |
650 | qs.drops = flow->dropped; | 662 | qs.drops = flow->dropped; |
651 | } | 663 | } |
652 | if (gnet_stats_copy_queue(d, NULL, &qs, 0) < 0) | 664 | if (gnet_stats_copy_queue(d, NULL, &qs, qs.qlen) < 0) |
653 | return -1; | 665 | return -1; |
654 | if (idx < q->flows_cnt) | 666 | if (idx < q->flows_cnt) |
655 | return gnet_stats_copy_app(d, &xstats, sizeof(xstats)); | 667 | return gnet_stats_copy_app(d, &xstats, sizeof(xstats)); |
diff --git a/net/sched/sch_generic.c b/net/sched/sch_generic.c index 269dd71b3828..f9e0e9c03d0a 100644 --- a/net/sched/sch_generic.c +++ b/net/sched/sch_generic.c | |||
@@ -49,6 +49,7 @@ static inline int dev_requeue_skb(struct sk_buff *skb, struct Qdisc *q) | |||
49 | { | 49 | { |
50 | q->gso_skb = skb; | 50 | q->gso_skb = skb; |
51 | q->qstats.requeues++; | 51 | q->qstats.requeues++; |
52 | qdisc_qstats_backlog_inc(q, skb); | ||
52 | q->q.qlen++; /* it's still part of the queue */ | 53 | q->q.qlen++; /* it's still part of the queue */ |
53 | __netif_schedule(q); | 54 | __netif_schedule(q); |
54 | 55 | ||
@@ -92,6 +93,7 @@ static struct sk_buff *dequeue_skb(struct Qdisc *q, bool *validate, | |||
92 | txq = skb_get_tx_queue(txq->dev, skb); | 93 | txq = skb_get_tx_queue(txq->dev, skb); |
93 | if (!netif_xmit_frozen_or_stopped(txq)) { | 94 | if (!netif_xmit_frozen_or_stopped(txq)) { |
94 | q->gso_skb = NULL; | 95 | q->gso_skb = NULL; |
96 | qdisc_qstats_backlog_dec(q, skb); | ||
95 | q->q.qlen--; | 97 | q->q.qlen--; |
96 | } else | 98 | } else |
97 | skb = NULL; | 99 | skb = NULL; |
diff --git a/net/sched/sch_hfsc.c b/net/sched/sch_hfsc.c index d783d7cc3348..1ac9f9f03fe3 100644 --- a/net/sched/sch_hfsc.c +++ b/net/sched/sch_hfsc.c | |||
@@ -1529,6 +1529,7 @@ hfsc_reset_qdisc(struct Qdisc *sch) | |||
1529 | q->eligible = RB_ROOT; | 1529 | q->eligible = RB_ROOT; |
1530 | INIT_LIST_HEAD(&q->droplist); | 1530 | INIT_LIST_HEAD(&q->droplist); |
1531 | qdisc_watchdog_cancel(&q->watchdog); | 1531 | qdisc_watchdog_cancel(&q->watchdog); |
1532 | sch->qstats.backlog = 0; | ||
1532 | sch->q.qlen = 0; | 1533 | sch->q.qlen = 0; |
1533 | } | 1534 | } |
1534 | 1535 | ||
@@ -1559,14 +1560,6 @@ hfsc_dump_qdisc(struct Qdisc *sch, struct sk_buff *skb) | |||
1559 | struct hfsc_sched *q = qdisc_priv(sch); | 1560 | struct hfsc_sched *q = qdisc_priv(sch); |
1560 | unsigned char *b = skb_tail_pointer(skb); | 1561 | unsigned char *b = skb_tail_pointer(skb); |
1561 | struct tc_hfsc_qopt qopt; | 1562 | struct tc_hfsc_qopt qopt; |
1562 | struct hfsc_class *cl; | ||
1563 | unsigned int i; | ||
1564 | |||
1565 | sch->qstats.backlog = 0; | ||
1566 | for (i = 0; i < q->clhash.hashsize; i++) { | ||
1567 | hlist_for_each_entry(cl, &q->clhash.hash[i], cl_common.hnode) | ||
1568 | sch->qstats.backlog += cl->qdisc->qstats.backlog; | ||
1569 | } | ||
1570 | 1563 | ||
1571 | qopt.defcls = q->defcls; | 1564 | qopt.defcls = q->defcls; |
1572 | if (nla_put(skb, TCA_OPTIONS, sizeof(qopt), &qopt)) | 1565 | if (nla_put(skb, TCA_OPTIONS, sizeof(qopt), &qopt)) |
@@ -1604,6 +1597,7 @@ hfsc_enqueue(struct sk_buff *skb, struct Qdisc *sch) | |||
1604 | if (cl->qdisc->q.qlen == 1) | 1597 | if (cl->qdisc->q.qlen == 1) |
1605 | set_active(cl, qdisc_pkt_len(skb)); | 1598 | set_active(cl, qdisc_pkt_len(skb)); |
1606 | 1599 | ||
1600 | qdisc_qstats_backlog_inc(sch, skb); | ||
1607 | sch->q.qlen++; | 1601 | sch->q.qlen++; |
1608 | 1602 | ||
1609 | return NET_XMIT_SUCCESS; | 1603 | return NET_XMIT_SUCCESS; |
@@ -1672,6 +1666,7 @@ hfsc_dequeue(struct Qdisc *sch) | |||
1672 | 1666 | ||
1673 | qdisc_unthrottled(sch); | 1667 | qdisc_unthrottled(sch); |
1674 | qdisc_bstats_update(sch, skb); | 1668 | qdisc_bstats_update(sch, skb); |
1669 | qdisc_qstats_backlog_dec(sch, skb); | ||
1675 | sch->q.qlen--; | 1670 | sch->q.qlen--; |
1676 | 1671 | ||
1677 | return skb; | 1672 | return skb; |
@@ -1695,6 +1690,7 @@ hfsc_drop(struct Qdisc *sch) | |||
1695 | } | 1690 | } |
1696 | cl->qstats.drops++; | 1691 | cl->qstats.drops++; |
1697 | qdisc_qstats_drop(sch); | 1692 | qdisc_qstats_drop(sch); |
1693 | sch->qstats.backlog -= len; | ||
1698 | sch->q.qlen--; | 1694 | sch->q.qlen--; |
1699 | return len; | 1695 | return len; |
1700 | } | 1696 | } |
diff --git a/net/sched/sch_ingress.c b/net/sched/sch_ingress.c index 10adbc617905..8fe6999b642a 100644 --- a/net/sched/sch_ingress.c +++ b/net/sched/sch_ingress.c | |||
@@ -27,6 +27,11 @@ static unsigned long ingress_get(struct Qdisc *sch, u32 classid) | |||
27 | return TC_H_MIN(classid) + 1; | 27 | return TC_H_MIN(classid) + 1; |
28 | } | 28 | } |
29 | 29 | ||
30 | static bool ingress_cl_offload(u32 classid) | ||
31 | { | ||
32 | return true; | ||
33 | } | ||
34 | |||
30 | static unsigned long ingress_bind_filter(struct Qdisc *sch, | 35 | static unsigned long ingress_bind_filter(struct Qdisc *sch, |
31 | unsigned long parent, u32 classid) | 36 | unsigned long parent, u32 classid) |
32 | { | 37 | { |
@@ -86,6 +91,7 @@ static const struct Qdisc_class_ops ingress_class_ops = { | |||
86 | .put = ingress_put, | 91 | .put = ingress_put, |
87 | .walk = ingress_walk, | 92 | .walk = ingress_walk, |
88 | .tcf_chain = ingress_find_tcf, | 93 | .tcf_chain = ingress_find_tcf, |
94 | .tcf_cl_offload = ingress_cl_offload, | ||
89 | .bind_tcf = ingress_bind_filter, | 95 | .bind_tcf = ingress_bind_filter, |
90 | .unbind_tcf = ingress_put, | 96 | .unbind_tcf = ingress_put, |
91 | }; | 97 | }; |
@@ -110,6 +116,11 @@ static unsigned long clsact_get(struct Qdisc *sch, u32 classid) | |||
110 | } | 116 | } |
111 | } | 117 | } |
112 | 118 | ||
119 | static bool clsact_cl_offload(u32 classid) | ||
120 | { | ||
121 | return TC_H_MIN(classid) == TC_H_MIN(TC_H_MIN_INGRESS); | ||
122 | } | ||
123 | |||
113 | static unsigned long clsact_bind_filter(struct Qdisc *sch, | 124 | static unsigned long clsact_bind_filter(struct Qdisc *sch, |
114 | unsigned long parent, u32 classid) | 125 | unsigned long parent, u32 classid) |
115 | { | 126 | { |
@@ -158,6 +169,7 @@ static const struct Qdisc_class_ops clsact_class_ops = { | |||
158 | .put = ingress_put, | 169 | .put = ingress_put, |
159 | .walk = ingress_walk, | 170 | .walk = ingress_walk, |
160 | .tcf_chain = clsact_find_tcf, | 171 | .tcf_chain = clsact_find_tcf, |
172 | .tcf_cl_offload = clsact_cl_offload, | ||
161 | .bind_tcf = clsact_bind_filter, | 173 | .bind_tcf = clsact_bind_filter, |
162 | .unbind_tcf = ingress_put, | 174 | .unbind_tcf = ingress_put, |
163 | }; | 175 | }; |
diff --git a/net/sched/sch_prio.c b/net/sched/sch_prio.c index fee1b15506b2..4b0a82191bc4 100644 --- a/net/sched/sch_prio.c +++ b/net/sched/sch_prio.c | |||
@@ -85,6 +85,7 @@ prio_enqueue(struct sk_buff *skb, struct Qdisc *sch) | |||
85 | 85 | ||
86 | ret = qdisc_enqueue(skb, qdisc); | 86 | ret = qdisc_enqueue(skb, qdisc); |
87 | if (ret == NET_XMIT_SUCCESS) { | 87 | if (ret == NET_XMIT_SUCCESS) { |
88 | qdisc_qstats_backlog_inc(sch, skb); | ||
88 | sch->q.qlen++; | 89 | sch->q.qlen++; |
89 | return NET_XMIT_SUCCESS; | 90 | return NET_XMIT_SUCCESS; |
90 | } | 91 | } |
@@ -117,6 +118,7 @@ static struct sk_buff *prio_dequeue(struct Qdisc *sch) | |||
117 | struct sk_buff *skb = qdisc_dequeue_peeked(qdisc); | 118 | struct sk_buff *skb = qdisc_dequeue_peeked(qdisc); |
118 | if (skb) { | 119 | if (skb) { |
119 | qdisc_bstats_update(sch, skb); | 120 | qdisc_bstats_update(sch, skb); |
121 | qdisc_qstats_backlog_dec(sch, skb); | ||
120 | sch->q.qlen--; | 122 | sch->q.qlen--; |
121 | return skb; | 123 | return skb; |
122 | } | 124 | } |
@@ -135,6 +137,7 @@ static unsigned int prio_drop(struct Qdisc *sch) | |||
135 | for (prio = q->bands-1; prio >= 0; prio--) { | 137 | for (prio = q->bands-1; prio >= 0; prio--) { |
136 | qdisc = q->queues[prio]; | 138 | qdisc = q->queues[prio]; |
137 | if (qdisc->ops->drop && (len = qdisc->ops->drop(qdisc)) != 0) { | 139 | if (qdisc->ops->drop && (len = qdisc->ops->drop(qdisc)) != 0) { |
140 | sch->qstats.backlog -= len; | ||
138 | sch->q.qlen--; | 141 | sch->q.qlen--; |
139 | return len; | 142 | return len; |
140 | } | 143 | } |
@@ -151,6 +154,7 @@ prio_reset(struct Qdisc *sch) | |||
151 | 154 | ||
152 | for (prio = 0; prio < q->bands; prio++) | 155 | for (prio = 0; prio < q->bands; prio++) |
153 | qdisc_reset(q->queues[prio]); | 156 | qdisc_reset(q->queues[prio]); |
157 | sch->qstats.backlog = 0; | ||
154 | sch->q.qlen = 0; | 158 | sch->q.qlen = 0; |
155 | } | 159 | } |
156 | 160 | ||
diff --git a/net/sched/sch_qfq.c b/net/sched/sch_qfq.c index 8d2d8d953432..f18857febdad 100644 --- a/net/sched/sch_qfq.c +++ b/net/sched/sch_qfq.c | |||
@@ -1235,8 +1235,10 @@ static int qfq_enqueue(struct sk_buff *skb, struct Qdisc *sch) | |||
1235 | cl->agg->lmax, qdisc_pkt_len(skb), cl->common.classid); | 1235 | cl->agg->lmax, qdisc_pkt_len(skb), cl->common.classid); |
1236 | err = qfq_change_agg(sch, cl, cl->agg->class_weight, | 1236 | err = qfq_change_agg(sch, cl, cl->agg->class_weight, |
1237 | qdisc_pkt_len(skb)); | 1237 | qdisc_pkt_len(skb)); |
1238 | if (err) | 1238 | if (err) { |
1239 | return err; | 1239 | cl->qstats.drops++; |
1240 | return qdisc_drop(skb, sch); | ||
1241 | } | ||
1240 | } | 1242 | } |
1241 | 1243 | ||
1242 | err = qdisc_enqueue(skb, cl->qdisc); | 1244 | err = qdisc_enqueue(skb, cl->qdisc); |
diff --git a/net/sched/sch_red.c b/net/sched/sch_red.c index 8c0508c0e287..91578bdd378c 100644 --- a/net/sched/sch_red.c +++ b/net/sched/sch_red.c | |||
@@ -97,6 +97,7 @@ static int red_enqueue(struct sk_buff *skb, struct Qdisc *sch) | |||
97 | 97 | ||
98 | ret = qdisc_enqueue(skb, child); | 98 | ret = qdisc_enqueue(skb, child); |
99 | if (likely(ret == NET_XMIT_SUCCESS)) { | 99 | if (likely(ret == NET_XMIT_SUCCESS)) { |
100 | qdisc_qstats_backlog_inc(sch, skb); | ||
100 | sch->q.qlen++; | 101 | sch->q.qlen++; |
101 | } else if (net_xmit_drop_count(ret)) { | 102 | } else if (net_xmit_drop_count(ret)) { |
102 | q->stats.pdrop++; | 103 | q->stats.pdrop++; |
@@ -118,6 +119,7 @@ static struct sk_buff *red_dequeue(struct Qdisc *sch) | |||
118 | skb = child->dequeue(child); | 119 | skb = child->dequeue(child); |
119 | if (skb) { | 120 | if (skb) { |
120 | qdisc_bstats_update(sch, skb); | 121 | qdisc_bstats_update(sch, skb); |
122 | qdisc_qstats_backlog_dec(sch, skb); | ||
121 | sch->q.qlen--; | 123 | sch->q.qlen--; |
122 | } else { | 124 | } else { |
123 | if (!red_is_idling(&q->vars)) | 125 | if (!red_is_idling(&q->vars)) |
@@ -143,6 +145,7 @@ static unsigned int red_drop(struct Qdisc *sch) | |||
143 | if (child->ops->drop && (len = child->ops->drop(child)) > 0) { | 145 | if (child->ops->drop && (len = child->ops->drop(child)) > 0) { |
144 | q->stats.other++; | 146 | q->stats.other++; |
145 | qdisc_qstats_drop(sch); | 147 | qdisc_qstats_drop(sch); |
148 | sch->qstats.backlog -= len; | ||
146 | sch->q.qlen--; | 149 | sch->q.qlen--; |
147 | return len; | 150 | return len; |
148 | } | 151 | } |
@@ -158,6 +161,7 @@ static void red_reset(struct Qdisc *sch) | |||
158 | struct red_sched_data *q = qdisc_priv(sch); | 161 | struct red_sched_data *q = qdisc_priv(sch); |
159 | 162 | ||
160 | qdisc_reset(q->qdisc); | 163 | qdisc_reset(q->qdisc); |
164 | sch->qstats.backlog = 0; | ||
161 | sch->q.qlen = 0; | 165 | sch->q.qlen = 0; |
162 | red_restart(&q->vars); | 166 | red_restart(&q->vars); |
163 | } | 167 | } |
diff --git a/net/sched/sch_tbf.c b/net/sched/sch_tbf.c index 83b90b584fae..3161e491990b 100644 --- a/net/sched/sch_tbf.c +++ b/net/sched/sch_tbf.c | |||
@@ -207,6 +207,7 @@ static int tbf_enqueue(struct sk_buff *skb, struct Qdisc *sch) | |||
207 | return ret; | 207 | return ret; |
208 | } | 208 | } |
209 | 209 | ||
210 | qdisc_qstats_backlog_inc(sch, skb); | ||
210 | sch->q.qlen++; | 211 | sch->q.qlen++; |
211 | return NET_XMIT_SUCCESS; | 212 | return NET_XMIT_SUCCESS; |
212 | } | 213 | } |
@@ -217,6 +218,7 @@ static unsigned int tbf_drop(struct Qdisc *sch) | |||
217 | unsigned int len = 0; | 218 | unsigned int len = 0; |
218 | 219 | ||
219 | if (q->qdisc->ops->drop && (len = q->qdisc->ops->drop(q->qdisc)) != 0) { | 220 | if (q->qdisc->ops->drop && (len = q->qdisc->ops->drop(q->qdisc)) != 0) { |
221 | sch->qstats.backlog -= len; | ||
220 | sch->q.qlen--; | 222 | sch->q.qlen--; |
221 | qdisc_qstats_drop(sch); | 223 | qdisc_qstats_drop(sch); |
222 | } | 224 | } |
@@ -263,6 +265,7 @@ static struct sk_buff *tbf_dequeue(struct Qdisc *sch) | |||
263 | q->t_c = now; | 265 | q->t_c = now; |
264 | q->tokens = toks; | 266 | q->tokens = toks; |
265 | q->ptokens = ptoks; | 267 | q->ptokens = ptoks; |
268 | qdisc_qstats_backlog_dec(sch, skb); | ||
266 | sch->q.qlen--; | 269 | sch->q.qlen--; |
267 | qdisc_unthrottled(sch); | 270 | qdisc_unthrottled(sch); |
268 | qdisc_bstats_update(sch, skb); | 271 | qdisc_bstats_update(sch, skb); |
@@ -294,6 +297,7 @@ static void tbf_reset(struct Qdisc *sch) | |||
294 | struct tbf_sched_data *q = qdisc_priv(sch); | 297 | struct tbf_sched_data *q = qdisc_priv(sch); |
295 | 298 | ||
296 | qdisc_reset(q->qdisc); | 299 | qdisc_reset(q->qdisc); |
300 | sch->qstats.backlog = 0; | ||
297 | sch->q.qlen = 0; | 301 | sch->q.qlen = 0; |
298 | q->t_c = ktime_get_ns(); | 302 | q->t_c = ktime_get_ns(); |
299 | q->tokens = q->buffer; | 303 | q->tokens = q->buffer; |
diff --git a/net/tipc/netlink_compat.c b/net/tipc/netlink_compat.c index f795b1dd0ccd..3ad9fab1985f 100644 --- a/net/tipc/netlink_compat.c +++ b/net/tipc/netlink_compat.c | |||
@@ -604,7 +604,8 @@ static int tipc_nl_compat_link_dump(struct tipc_nl_compat_msg *msg, | |||
604 | 604 | ||
605 | link_info.dest = nla_get_flag(link[TIPC_NLA_LINK_DEST]); | 605 | link_info.dest = nla_get_flag(link[TIPC_NLA_LINK_DEST]); |
606 | link_info.up = htonl(nla_get_flag(link[TIPC_NLA_LINK_UP])); | 606 | link_info.up = htonl(nla_get_flag(link[TIPC_NLA_LINK_UP])); |
607 | strcpy(link_info.str, nla_data(link[TIPC_NLA_LINK_NAME])); | 607 | nla_strlcpy(link_info.str, nla_data(link[TIPC_NLA_LINK_NAME]), |
608 | TIPC_MAX_LINK_NAME); | ||
608 | 609 | ||
609 | return tipc_add_tlv(msg->rep, TIPC_TLV_LINK_INFO, | 610 | return tipc_add_tlv(msg->rep, TIPC_TLV_LINK_INFO, |
610 | &link_info, sizeof(link_info)); | 611 | &link_info, sizeof(link_info)); |
diff --git a/net/wireless/core.c b/net/wireless/core.c index d25c82bc1bbe..ecca3896b9f7 100644 --- a/net/wireless/core.c +++ b/net/wireless/core.c | |||
@@ -363,8 +363,6 @@ struct wiphy *wiphy_new_nm(const struct cfg80211_ops *ops, int sizeof_priv, | |||
363 | WARN_ON(ops->remain_on_channel && !ops->cancel_remain_on_channel); | 363 | WARN_ON(ops->remain_on_channel && !ops->cancel_remain_on_channel); |
364 | WARN_ON(ops->tdls_channel_switch && !ops->tdls_cancel_channel_switch); | 364 | WARN_ON(ops->tdls_channel_switch && !ops->tdls_cancel_channel_switch); |
365 | WARN_ON(ops->add_tx_ts && !ops->del_tx_ts); | 365 | WARN_ON(ops->add_tx_ts && !ops->del_tx_ts); |
366 | WARN_ON(ops->set_tx_power && !ops->get_tx_power); | ||
367 | WARN_ON(ops->set_antenna && !ops->get_antenna); | ||
368 | 366 | ||
369 | alloc_size = sizeof(*rdev) + sizeof_priv; | 367 | alloc_size = sizeof(*rdev) + sizeof_priv; |
370 | 368 | ||
diff --git a/net/wireless/wext-core.c b/net/wireless/wext-core.c index 6250b1cfcde5..dbb2738e356a 100644 --- a/net/wireless/wext-core.c +++ b/net/wireless/wext-core.c | |||
@@ -958,8 +958,29 @@ static int wireless_process_ioctl(struct net *net, struct ifreq *ifr, | |||
958 | return private(dev, iwr, cmd, info, handler); | 958 | return private(dev, iwr, cmd, info, handler); |
959 | } | 959 | } |
960 | /* Old driver API : call driver ioctl handler */ | 960 | /* Old driver API : call driver ioctl handler */ |
961 | if (dev->netdev_ops->ndo_do_ioctl) | 961 | if (dev->netdev_ops->ndo_do_ioctl) { |
962 | return dev->netdev_ops->ndo_do_ioctl(dev, ifr, cmd); | 962 | #ifdef CONFIG_COMPAT |
963 | if (info->flags & IW_REQUEST_FLAG_COMPAT) { | ||
964 | int ret = 0; | ||
965 | struct iwreq iwr_lcl; | ||
966 | struct compat_iw_point *iwp_compat = (void *) &iwr->u.data; | ||
967 | |||
968 | memcpy(&iwr_lcl, iwr, sizeof(struct iwreq)); | ||
969 | iwr_lcl.u.data.pointer = compat_ptr(iwp_compat->pointer); | ||
970 | iwr_lcl.u.data.length = iwp_compat->length; | ||
971 | iwr_lcl.u.data.flags = iwp_compat->flags; | ||
972 | |||
973 | ret = dev->netdev_ops->ndo_do_ioctl(dev, (void *) &iwr_lcl, cmd); | ||
974 | |||
975 | iwp_compat->pointer = ptr_to_compat(iwr_lcl.u.data.pointer); | ||
976 | iwp_compat->length = iwr_lcl.u.data.length; | ||
977 | iwp_compat->flags = iwr_lcl.u.data.flags; | ||
978 | |||
979 | return ret; | ||
980 | } else | ||
981 | #endif | ||
982 | return dev->netdev_ops->ndo_do_ioctl(dev, ifr, cmd); | ||
983 | } | ||
963 | return -EOPNOTSUPP; | 984 | return -EOPNOTSUPP; |
964 | } | 985 | } |
965 | 986 | ||
diff --git a/tools/testing/selftests/net/reuseport_bpf.c b/tools/testing/selftests/net/reuseport_bpf.c index 96ba386b1b7b..4a8217448f20 100644 --- a/tools/testing/selftests/net/reuseport_bpf.c +++ b/tools/testing/selftests/net/reuseport_bpf.c | |||
@@ -111,9 +111,9 @@ static void attach_ebpf(int fd, uint16_t mod) | |||
111 | memset(&attr, 0, sizeof(attr)); | 111 | memset(&attr, 0, sizeof(attr)); |
112 | attr.prog_type = BPF_PROG_TYPE_SOCKET_FILTER; | 112 | attr.prog_type = BPF_PROG_TYPE_SOCKET_FILTER; |
113 | attr.insn_cnt = ARRAY_SIZE(prog); | 113 | attr.insn_cnt = ARRAY_SIZE(prog); |
114 | attr.insns = (uint64_t)prog; | 114 | attr.insns = (unsigned long) &prog; |
115 | attr.license = (uint64_t)bpf_license; | 115 | attr.license = (unsigned long) &bpf_license; |
116 | attr.log_buf = (uint64_t)bpf_log_buf; | 116 | attr.log_buf = (unsigned long) &bpf_log_buf; |
117 | attr.log_size = sizeof(bpf_log_buf); | 117 | attr.log_size = sizeof(bpf_log_buf); |
118 | attr.log_level = 1; | 118 | attr.log_level = 1; |
119 | attr.kern_version = 0; | 119 | attr.kern_version = 0; |
@@ -351,8 +351,8 @@ static void test_filter_no_reuseport(const struct test_params p) | |||
351 | memset(&eprog, 0, sizeof(eprog)); | 351 | memset(&eprog, 0, sizeof(eprog)); |
352 | eprog.prog_type = BPF_PROG_TYPE_SOCKET_FILTER; | 352 | eprog.prog_type = BPF_PROG_TYPE_SOCKET_FILTER; |
353 | eprog.insn_cnt = ARRAY_SIZE(ecode); | 353 | eprog.insn_cnt = ARRAY_SIZE(ecode); |
354 | eprog.insns = (uint64_t)ecode; | 354 | eprog.insns = (unsigned long) &ecode; |
355 | eprog.license = (uint64_t)bpf_license; | 355 | eprog.license = (unsigned long) &bpf_license; |
356 | eprog.kern_version = 0; | 356 | eprog.kern_version = 0; |
357 | 357 | ||
358 | memset(&cprog, 0, sizeof(cprog)); | 358 | memset(&cprog, 0, sizeof(cprog)); |