Pull networking fixes from Paolo Abeni: "Including fixes from WiFi and bpf. Current release - regressions: - bpf: syzkaller found null ptr deref in unix_bpf proto add - eth: i40e: fix ST code value for clause 45 Previous releases - regressions: - core: return error from sk_stream_wait_connect() if sk_wait_event() fails - ipv6: revert remove expired routes with a separated list of routes - wifi rfkill: - set GPIO direction - fix crash with WED rx support enabled - bluetooth: - fix deadlock in vhci_send_frame - fix use-after-free in bt_sock_recvmsg - eth: mlx5e: fix a race in command alloc flow - eth: ice: fix PF with enabled XDP going no-carrier after reset - eth: bnxt_en: do not map packet buffers twice Previous releases - always broken: - core: - check vlan filter feature in vlan_vids_add_by_dev() and vlan_vids_del_by_dev() - check dev->gso_max_size in gso_features_check() - mptcp: fix inconsistent state on fastopen race - phy: skip LED triggers on PHYs on SFP modules - eth: mlx5e: - fix double free of encap_header - fix slab-out-of-bounds in mlx5_query_nic_vport_mac_list()" * tag 'net-6.7-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net: (69 commits) net: check dev->gso_max_size in gso_features_check() kselftest: rtnetlink.sh: use grep_fail when expecting the cmd fail net/ipv6: Revert remove expired routes with a separated list of routes net: avoid build bug in skb extension length calculation net: ethernet: mtk_wed: fix possible NULL pointer dereference in mtk_wed_wo_queue_tx_clean() net: stmmac: fix incorrect flag check in timestamp interrupt selftests: add vlan hw filter tests net: check vlan filter feature in vlan_vids_add_by_dev() and vlan_vids_del_by_dev() net: hns3: add new maintainer for the HNS3 ethernet driver net: mana: select PAGE_POOL net: ks8851: Fix TX stall caused by TX buffer overrun ice: Fix PF with enabled XDP going no-carrier after reset ice: alter feature support check for SRIOV and LAG ice: stop trashing VF VSI aggregator node ID information mailmap: add entries for Geliang Tang mptcp: fill in missing MODULE_DESCRIPTION() mptcp: fix inconsistent state on fastopen race selftests: mptcp: join: fix subflow_send_ack lookup net: phy: skip LED triggers on PHYs on SFP modules bpf: Add missing BPF_LINK_TYPE invocations ...
Unified · Split
| @@ -191,6 +191,10 @@ Gao Xiang <xiang@kernel.org> <gaoxiang25@huawei.com> · 190 unmodified lines | |||
| 191 | Gao Xiang <xiang@kernel.org> <hsiangkao@aol.com> | 191 | Gao Xiang <xiang@kernel.org> <hsiangkao@aol.com> |
| 192 | Gao Xiang <xiang@kernel.org> <hsiangkao@linux.alibaba.com> | 192 | Gao Xiang <xiang@kernel.org> <hsiangkao@linux.alibaba.com> |
| 193 | Gao Xiang <xiang@kernel.org> <hsiangkao@redhat.com> | 193 | Gao Xiang <xiang@kernel.org> <hsiangkao@redhat.com> |
| 194 | Geliang Tang <geliang.tang@linux.dev> <geliang.tang@suse.com> | ||
| 195 | Geliang Tang <geliang.tang@linux.dev> <geliangtang@xiaomi.com> | ||
| 196 | Geliang Tang <geliang.tang@linux.dev> <geliangtang@gmail.com> | ||
| 197 | Geliang Tang <geliang.tang@linux.dev> <geliangtang@163.com> | ||
| 194 | Georgi Djakov <djakov@kernel.org> <georgi.djakov@linaro.org> | 198 | Georgi Djakov <djakov@kernel.org> <georgi.djakov@linaro.org> |
| 195 | Gerald Schaefer <gerald.schaefer@linux.ibm.com> <geraldsc@de.ibm.com> | 199 | Gerald Schaefer <gerald.schaefer@linux.ibm.com> <geraldsc@de.ibm.com> |
| 196 | Gerald Schaefer <gerald.schaefer@linux.ibm.com> <gerald.schaefer@de.ibm.com> | 200 | Gerald Schaefer <gerald.schaefer@linux.ibm.com> <gerald.schaefer@de.ibm.com> |
| @@ -9524,6 +9524,7 @@ F: drivers/bus/hisi_lpc.c · 9523 unmodified lines | |||
| 9524 | HISILICON NETWORK SUBSYSTEM 3 DRIVER (HNS3) | 9524 | HISILICON NETWORK SUBSYSTEM 3 DRIVER (HNS3) |
| 9525 | M: Yisen Zhuang <yisen.zhuang@huawei.com> | 9525 | M: Yisen Zhuang <yisen.zhuang@huawei.com> |
| 9526 | M: Salil Mehta <salil.mehta@huawei.com> | 9526 | M: Salil Mehta <salil.mehta@huawei.com> |
| 9527 | M: Jijie Shao <shaojijie@huawei.com> | ||
| 9527 | L: netdev@vger.kernel.org | 9528 | L: netdev@vger.kernel.org |
| 9528 | S: Maintained | 9529 | S: Maintained |
| 9529 | W: http://www.hisilicon.com | 9530 | W: http://www.hisilicon.com |
| @@ -11,6 +11,7 @@ · 10 unmodified lines | |||
| 11 | #include <linux/module.h> | 11 | #include <linux/module.h> |
| 12 | #include <asm/unaligned.h> | 12 | #include <asm/unaligned.h> |
| 13 | 13 | ||
| 14 | #include <linux/atomic.h> | ||
| 14 | #include <linux/kernel.h> | 15 | #include <linux/kernel.h> |
| 15 | #include <linux/init.h> | 16 | #include <linux/init.h> |
| 16 | #include <linux/slab.h> | 17 | #include <linux/slab.h> |
| @@ -44,6 +45,7 @@ struct vhci_data { · 27 unmodified lines | |||
| 44 | bool wakeup; | 45 | bool wakeup; |
| 45 | __u16 msft_opcode; | 46 | __u16 msft_opcode; |
| 46 | bool aosp_capable; | 47 | bool aosp_capable; |
| 48 | atomic_t initialized; | ||
| 47 | }; | 49 | }; |
| 48 | 50 | ||
| 49 | static int vhci_open_dev(struct hci_dev *hdev) | 51 | static int vhci_open_dev(struct hci_dev *hdev) |
| @@ -75,11 +77,10 @@ static int vhci_send_frame(struct hci_dev *hdev, struct sk_buff *skb) · 25 unmodified lines | |||
| 75 | 77 | ||
| 76 | memcpy(skb_push(skb, 1), &hci_skb_pkt_type(skb), 1); | 78 | memcpy(skb_push(skb, 1), &hci_skb_pkt_type(skb), 1); |
| 77 | 79 | ||
| 78 | mutex_lock(&data->open_mutex); | ||
| 79 | skb_queue_tail(&data->readq, skb); | 80 | skb_queue_tail(&data->readq, skb); |
| 80 | mutex_unlock(&data->open_mutex); | ||
| 81 | 81 | ||
| 82 | wake_up_interruptible(&data->read_wait); | 82 | if (atomic_read(&data->initialized)) |
| 83 | wake_up_interruptible(&data->read_wait); | ||
| 83 | return 0; | 84 | return 0; |
| 84 | } | 85 | } |
| 85 | 86 | ||
| @@ -464,7 +465,8 @@ static int __vhci_create_device(struct vhci_data *data, __u8 opcode) · 378 unmodified lines | |||
| 464 | skb_put_u8(skb, 0xff); | 465 | skb_put_u8(skb, 0xff); |
| 465 | skb_put_u8(skb, opcode); | 466 | skb_put_u8(skb, opcode); |
| 466 | put_unaligned_le16(hdev->id, skb_put(skb, 2)); | 467 | put_unaligned_le16(hdev->id, skb_put(skb, 2)); |
| 467 | skb_queue_tail(&data->readq, skb); | 468 | skb_queue_head(&data->readq, skb); |
| 469 | atomic_inc(&data->initialized); | ||
| 468 | 470 | ||
| 469 | wake_up_interruptible(&data->read_wait); | 471 | wake_up_interruptible(&data->read_wait); |
| 470 | return 0; | 472 | return 0; |
| @@ -866,10 +866,13 @@ static int atl1e_setup_ring_resources(struct atl1e_adapter *adapter) · 865 unmodified lines | |||
| 866 | netdev_err(adapter->netdev, "offset(%d) > ring size(%d) !!\n", | 866 | netdev_err(adapter->netdev, "offset(%d) > ring size(%d) !!\n", |
| 867 | offset, adapter->ring_size); | 867 | offset, adapter->ring_size); |
| 868 | err = -1; | 868 | err = -1; |
| 869 | goto failed; | 869 | goto free_buffer; |
| 870 | } | 870 | } |
| 871 | 871 | ||
| 872 | return 0; | 872 | return 0; |
| 873 | free_buffer: | ||
| 874 | kfree(tx_ring->tx_buffer); | ||
| 875 | tx_ring->tx_buffer = NULL; | ||
| 873 | failed: | 876 | failed: |
| 874 | if (adapter->ring_vir_addr != NULL) { | 877 | if (adapter->ring_vir_addr != NULL) { |
| 875 | dma_free_coherent(&pdev->dev, adapter->ring_size, | 878 | dma_free_coherent(&pdev->dev, adapter->ring_size, |
| @@ -59,7 +59,6 @@ struct bnxt_sw_tx_bd *bnxt_xmit_bd(struct bnxt *bp, · 58 unmodified lines | |||
| 59 | for (i = 0; i < num_frags ; i++) { | 59 | for (i = 0; i < num_frags ; i++) { |
| 60 | skb_frag_t *frag = &sinfo->frags[i]; | 60 | skb_frag_t *frag = &sinfo->frags[i]; |
| 61 | struct bnxt_sw_tx_bd *frag_tx_buf; | 61 | struct bnxt_sw_tx_bd *frag_tx_buf; |
| 62 | struct pci_dev *pdev = bp->pdev; | ||
| 63 | dma_addr_t frag_mapping; | 62 | dma_addr_t frag_mapping; |
| 64 | int frag_len; | 63 | int frag_len; |
| 65 | 64 | ||
| @@ -73,16 +72,10 @@ struct bnxt_sw_tx_bd *bnxt_xmit_bd(struct bnxt *bp, · 7 unmodified lines | |||
| 73 | txbd = &txr->tx_desc_ring[TX_RING(prod)][TX_IDX(prod)]; | 72 | txbd = &txr->tx_desc_ring[TX_RING(prod)][TX_IDX(prod)]; |
| 74 | 73 | ||
| 75 | frag_len = skb_frag_size(frag); | 74 | frag_len = skb_frag_size(frag); |
| 76 | frag_mapping = skb_frag_dma_map(&pdev->dev, frag, 0, | ||
| 77 | frag_len, DMA_TO_DEVICE); | ||
| 78 | |||
| 79 | if (unlikely(dma_mapping_error(&pdev->dev, frag_mapping))) | ||
| 80 | return NULL; | ||
| 81 | |||
| 82 | dma_unmap_addr_set(frag_tx_buf, mapping, frag_mapping); | ||
| 83 | |||
| 84 | flags = frag_len << TX_BD_LEN_SHIFT; | 75 | flags = frag_len << TX_BD_LEN_SHIFT; |
| 85 | txbd->tx_bd_len_flags_type = cpu_to_le32(flags); | 76 | txbd->tx_bd_len_flags_type = cpu_to_le32(flags); |
| 77 | frag_mapping = page_pool_get_dma_addr(skb_frag_page(frag)) + | ||
| 78 | skb_frag_off(frag); | ||
| 86 | txbd->tx_bd_haddr = cpu_to_le64(frag_mapping); | 79 | txbd->tx_bd_haddr = cpu_to_le64(frag_mapping); |
| 87 | 80 | ||
| 88 | len = frag_len; | 81 | len = frag_len; |
| @@ -207,7 +207,7 @@ · 206 unmodified lines | |||
| 207 | #define I40E_GLGEN_MSCA_OPCODE_SHIFT 26 | 207 | #define I40E_GLGEN_MSCA_OPCODE_SHIFT 26 |
| 208 | #define I40E_GLGEN_MSCA_OPCODE_MASK(_i) I40E_MASK(_i, I40E_GLGEN_MSCA_OPCODE_SHIFT) | 208 | #define I40E_GLGEN_MSCA_OPCODE_MASK(_i) I40E_MASK(_i, I40E_GLGEN_MSCA_OPCODE_SHIFT) |
| 209 | #define I40E_GLGEN_MSCA_STCODE_SHIFT 28 | 209 | #define I40E_GLGEN_MSCA_STCODE_SHIFT 28 |
| 210 | #define I40E_GLGEN_MSCA_STCODE_MASK I40E_MASK(0x1, I40E_GLGEN_MSCA_STCODE_SHIFT) | 210 | #define I40E_GLGEN_MSCA_STCODE_MASK(_i) I40E_MASK(_i, I40E_GLGEN_MSCA_STCODE_SHIFT) |
| 211 | #define I40E_GLGEN_MSCA_MDICMD_SHIFT 30 | 211 | #define I40E_GLGEN_MSCA_MDICMD_SHIFT 30 |
| 212 | #define I40E_GLGEN_MSCA_MDICMD_MASK I40E_MASK(0x1, I40E_GLGEN_MSCA_MDICMD_SHIFT) | 212 | #define I40E_GLGEN_MSCA_MDICMD_MASK I40E_MASK(0x1, I40E_GLGEN_MSCA_MDICMD_SHIFT) |
| 213 | #define I40E_GLGEN_MSCA_MDIINPROGEN_SHIFT 31 | 213 | #define I40E_GLGEN_MSCA_MDIINPROGEN_SHIFT 31 |
| @@ -37,11 +37,11 @@ typedef void (*I40E_ADMINQ_CALLBACK)(struct i40e_hw *, struct i40e_aq_desc *); · 36 unmodified lines | |||
| 37 | #define I40E_QTX_CTL_VM_QUEUE 0x1 | 37 | #define I40E_QTX_CTL_VM_QUEUE 0x1 |
| 38 | #define I40E_QTX_CTL_PF_QUEUE 0x2 | 38 | #define I40E_QTX_CTL_PF_QUEUE 0x2 |
| 39 | 39 | ||
| 40 | #define I40E_MDIO_CLAUSE22_STCODE_MASK I40E_GLGEN_MSCA_STCODE_MASK | 40 | #define I40E_MDIO_CLAUSE22_STCODE_MASK I40E_GLGEN_MSCA_STCODE_MASK(1) |
| 41 | #define I40E_MDIO_CLAUSE22_OPCODE_WRITE_MASK I40E_GLGEN_MSCA_OPCODE_MASK(1) | 41 | #define I40E_MDIO_CLAUSE22_OPCODE_WRITE_MASK I40E_GLGEN_MSCA_OPCODE_MASK(1) |
| 42 | #define I40E_MDIO_CLAUSE22_OPCODE_READ_MASK I40E_GLGEN_MSCA_OPCODE_MASK(2) | 42 | #define I40E_MDIO_CLAUSE22_OPCODE_READ_MASK I40E_GLGEN_MSCA_OPCODE_MASK(2) |
| 43 | 43 | ||
| 44 | #define I40E_MDIO_CLAUSE45_STCODE_MASK I40E_GLGEN_MSCA_STCODE_MASK | 44 | #define I40E_MDIO_CLAUSE45_STCODE_MASK I40E_GLGEN_MSCA_STCODE_MASK(0) |
| 45 | #define I40E_MDIO_CLAUSE45_OPCODE_ADDRESS_MASK I40E_GLGEN_MSCA_OPCODE_MASK(0) | 45 | #define I40E_MDIO_CLAUSE45_OPCODE_ADDRESS_MASK I40E_GLGEN_MSCA_OPCODE_MASK(0) |
| 46 | #define I40E_MDIO_CLAUSE45_OPCODE_WRITE_MASK I40E_GLGEN_MSCA_OPCODE_MASK(1) | 46 | #define I40E_MDIO_CLAUSE45_OPCODE_WRITE_MASK I40E_GLGEN_MSCA_OPCODE_MASK(1) |
| 47 | #define I40E_MDIO_CLAUSE45_OPCODE_READ_MASK I40E_GLGEN_MSCA_OPCODE_MASK(3) | 47 | #define I40E_MDIO_CLAUSE45_OPCODE_READ_MASK I40E_GLGEN_MSCA_OPCODE_MASK(3) |
| @@ -1850,14 +1850,14 @@ ice_phy_type_to_ethtool(struct net_device *netdev, · 1849 unmodified lines | |||
| 1850 | linkmode_zero(ks->link_modes.supported); | 1850 | linkmode_zero(ks->link_modes.supported); |
| 1851 | linkmode_zero(ks->link_modes.advertising); | 1851 | linkmode_zero(ks->link_modes.advertising); |
| 1852 | 1852 | ||
| 1853 | for (i = 0; i < BITS_PER_TYPE(u64); i++) { | 1853 | for (i = 0; i < ARRAY_SIZE(phy_type_low_lkup); i++) { |
| 1854 | if (phy_types_low & BIT_ULL(i)) | 1854 | if (phy_types_low & BIT_ULL(i)) |
| 1855 | ice_linkmode_set_bit(&phy_type_low_lkup[i], ks, | 1855 | ice_linkmode_set_bit(&phy_type_low_lkup[i], ks, |
| 1856 | req_speeds, advert_phy_type_lo, | 1856 | req_speeds, advert_phy_type_lo, |
| 1857 | i); | 1857 | i); |
| 1858 | } | 1858 | } |
| 1859 | 1859 | ||
| 1860 | for (i = 0; i < BITS_PER_TYPE(u64); i++) { | 1860 | for (i = 0; i < ARRAY_SIZE(phy_type_high_lkup); i++) { |
| 1861 | if (phy_types_high & BIT_ULL(i)) | 1861 | if (phy_types_high & BIT_ULL(i)) |
| 1862 | ice_linkmode_set_bit(&phy_type_high_lkup[i], ks, | 1862 | ice_linkmode_set_bit(&phy_type_high_lkup[i], ks, |
| 1863 | req_speeds, advert_phy_type_hi, | 1863 | req_speeds, advert_phy_type_hi, |
| @@ -1981,6 +1981,8 @@ int ice_init_lag(struct ice_pf *pf) · 1980 unmodified lines | |||
| 1981 | int n, err; | 1981 | int n, err; |
| 1982 | 1982 | ||
| 1983 | ice_lag_init_feature_support_flag(pf); | 1983 | ice_lag_init_feature_support_flag(pf); |
| 1984 | if (!ice_is_feature_supported(pf, ICE_F_SRIOV_LAG)) | ||
| 1985 | return 0; | ||
| 1984 | 1986 | ||
| 1985 | pf->lag = kzalloc(sizeof(*lag), GFP_KERNEL); | 1987 | pf->lag = kzalloc(sizeof(*lag), GFP_KERNEL); |
| 1986 | if (!pf->lag) | 1988 | if (!pf->lag) |
| @@ -2371,6 +2371,9 @@ static int ice_vsi_cfg_tc_lan(struct ice_pf *pf, struct ice_vsi *vsi) · 2370 unmodified lines | |||
| 2371 | } else { | 2371 | } else { |
| 2372 | max_txqs[i] = vsi->alloc_txq; | 2372 | max_txqs[i] = vsi->alloc_txq; |
| 2373 | } | 2373 | } |
| 2374 | |||
| 2375 | if (vsi->type == ICE_VSI_PF) | ||
| 2376 | max_txqs[i] += vsi->num_xdp_txq; | ||
| 2374 | } | 2377 | } |
| 2375 | 2378 | ||
| 2376 | dev_dbg(dev, "vsi->tc_cfg.ena_tc = %d\n", vsi->tc_cfg.ena_tc); | 2379 | dev_dbg(dev, "vsi->tc_cfg.ena_tc = %d\n", vsi->tc_cfg.ena_tc); |
| @@ -2620,10 +2623,6 @@ void ice_vsi_decfg(struct ice_vsi *vsi) · 243 unmodified lines | |||
| 2620 | if (vsi->type == ICE_VSI_VF && | 2623 | if (vsi->type == ICE_VSI_VF && |
| 2621 | vsi->agg_node && vsi->agg_node->valid) | 2624 | vsi->agg_node && vsi->agg_node->valid) |
| 2622 | vsi->agg_node->num_vsis--; | 2625 | vsi->agg_node->num_vsis--; |
| 2623 | if (vsi->agg_node) { | ||
| 2624 | vsi->agg_node->valid = false; | ||
| 2625 | vsi->agg_node->agg_id = 0; | ||
| 2626 | } | ||
| 2627 | } | 2626 | } |
| 2628 | 2627 | ||
| 2629 | /** | 2628 | /** |
| @@ -399,9 +399,10 @@ static int otx2_dcbnl_ieee_getpfc(struct net_device *dev, struct ieee_pfc *pfc) · 398 unmodified lines | |||
| 399 | static int otx2_dcbnl_ieee_setpfc(struct net_device *dev, struct ieee_pfc *pfc) | 399 | static int otx2_dcbnl_ieee_setpfc(struct net_device *dev, struct ieee_pfc *pfc) |
| 400 | { | 400 | { |
| 401 | struct otx2_nic *pfvf = netdev_priv(dev); | 401 | struct otx2_nic *pfvf = netdev_priv(dev); |
| 402 | u8 old_pfc_en; | ||
| 402 | int err; | 403 | int err; |
| 403 | 404 | ||
| 404 | /* Save PFC configuration to interface */ | 405 | old_pfc_en = pfvf->pfc_en; |
| 405 | pfvf->pfc_en = pfc->pfc_en; | 406 | pfvf->pfc_en = pfc->pfc_en; |
| 406 | 407 | ||
| 407 | if (pfvf->hw.tx_queues >= NIX_PF_PFC_PRIO_MAX) | 408 | if (pfvf->hw.tx_queues >= NIX_PF_PFC_PRIO_MAX) |
| @@ -411,13 +412,17 @@ static int otx2_dcbnl_ieee_setpfc(struct net_device *dev, struct ieee_pfc *pfc) · 3 unmodified lines | |||
| 411 | * supported by the tx queue configuration | 412 | * supported by the tx queue configuration |
| 412 | */ | 413 | */ |
| 413 | err = otx2_check_pfc_config(pfvf); | 414 | err = otx2_check_pfc_config(pfvf); |
| 414 | if (err) | 415 | if (err) { |
| 416 | pfvf->pfc_en = old_pfc_en; | ||
| 415 | return err; | 417 | return err; |
| 418 | } | ||
| 416 | 419 | ||
| 417 | process_pfc: | 420 | process_pfc: |
| 418 | err = otx2_config_priority_flow_ctrl(pfvf); | 421 | err = otx2_config_priority_flow_ctrl(pfvf); |
| 419 | if (err) | 422 | if (err) { |
| 423 | pfvf->pfc_en = old_pfc_en; | ||
| 420 | return err; | 424 | return err; |
| 425 | } | ||
| 421 | 426 | ||
| 422 | /* Request Per channel Bpids */ | 427 | /* Request Per channel Bpids */ |
| 423 | if (pfc->pfc_en) | 428 | if (pfc->pfc_en) |
| @@ -425,6 +430,12 @@ process_pfc: · 1 unmodified line | |||
| 425 | 430 | ||
| 426 | err = otx2_pfc_txschq_update(pfvf); | 431 | err = otx2_pfc_txschq_update(pfvf); |
| 427 | if (err) { | 432 | if (err) { |
| 433 | if (pfc->pfc_en) | ||
| 434 | otx2_nix_config_bp(pfvf, false); | ||
| 435 | |||
| 436 | otx2_pfc_txschq_stop(pfvf); | ||
| 437 | pfvf->pfc_en = old_pfc_en; | ||
| 438 | otx2_config_priority_flow_ctrl(pfvf); | ||
| 428 | dev_err(pfvf->dev, "%s failed to update TX schedulers\n", __func__); | 439 | dev_err(pfvf->dev, "%s failed to update TX schedulers\n", __func__); |
| 429 | return err; | 440 | return err; |
| 430 | } | 441 | } |
| @@ -291,6 +291,9 @@ mtk_wed_wo_queue_tx_clean(struct mtk_wed_wo *wo, struct mtk_wed_wo_queue *q) · 290 unmodified lines | |||
| 291 | for (i = 0; i < q->n_desc; i++) { | 291 | for (i = 0; i < q->n_desc; i++) { |
| 292 | struct mtk_wed_wo_queue_entry *entry = &q->entry[i]; | 292 | struct mtk_wed_wo_queue_entry *entry = &q->entry[i]; |
| 293 | 293 | ||
| 294 | if (!entry->buf) | ||
| 295 | continue; | ||
| 296 | |||
| 294 | dma_unmap_single(wo->hw->dev, entry->addr, entry->len, | 297 | dma_unmap_single(wo->hw->dev, entry->addr, entry->len, |
| 295 | DMA_TO_DEVICE); | 298 | DMA_TO_DEVICE); |
| 296 | skb_free_frag(entry->buf); | 299 | skb_free_frag(entry->buf); |
| @@ -156,15 +156,18 @@ static u8 alloc_token(struct mlx5_cmd *cmd) · 155 unmodified lines | |||
| 156 | return token; | 156 | return token; |
| 157 | } | 157 | } |
| 158 | 158 | ||
| 159 | static int cmd_alloc_index(struct mlx5_cmd *cmd) | 159 | static int cmd_alloc_index(struct mlx5_cmd *cmd, struct mlx5_cmd_work_ent *ent) |
| 160 | { | 160 | { |
| 161 | unsigned long flags; | 161 | unsigned long flags; |
| 162 | int ret; | 162 | int ret; |
| 163 | 163 | ||
| 164 | spin_lock_irqsave(&cmd->alloc_lock, flags); | 164 | spin_lock_irqsave(&cmd->alloc_lock, flags); |
| 165 | ret = find_first_bit(&cmd->vars.bitmask, cmd->vars.max_reg_cmds); | 165 | ret = find_first_bit(&cmd->vars.bitmask, cmd->vars.max_reg_cmds); |
| 166 | if (ret < cmd->vars.max_reg_cmds) | 166 | if (ret < cmd->vars.max_reg_cmds) { |
| 167 | clear_bit(ret, &cmd->vars.bitmask); | 167 | clear_bit(ret, &cmd->vars.bitmask); |
| 168 | ent->idx = ret; | ||
| 169 | cmd->ent_arr[ent->idx] = ent; | ||
| 170 | } | ||
| 168 | spin_unlock_irqrestore(&cmd->alloc_lock, flags); | 171 | spin_unlock_irqrestore(&cmd->alloc_lock, flags); |
| 169 | 172 | ||
| 170 | return ret < cmd->vars.max_reg_cmds ? ret : -ENOMEM; | 173 | return ret < cmd->vars.max_reg_cmds ? ret : -ENOMEM; |
| @@ -979,7 +982,7 @@ static void cmd_work_handler(struct work_struct *work) · 808 unmodified lines | |||
| 979 | sem = ent->page_queue ? &cmd->vars.pages_sem : &cmd->vars.sem; | 982 | sem = ent->page_queue ? &cmd->vars.pages_sem : &cmd->vars.sem; |
| 980 | down(sem); | 983 | down(sem); |
| 981 | if (!ent->page_queue) { | 984 | if (!ent->page_queue) { |
| 982 | alloc_ret = cmd_alloc_index(cmd); | 985 | alloc_ret = cmd_alloc_index(cmd, ent); |
| 983 | if (alloc_ret < 0) { | 986 | if (alloc_ret < 0) { |
| 984 | mlx5_core_err_rl(dev, "failed to allocate command entry\n"); | 987 | mlx5_core_err_rl(dev, "failed to allocate command entry\n"); |
| 985 | if (ent->callback) { | 988 | if (ent->callback) { |
| @@ -994,15 +997,14 @@ static void cmd_work_handler(struct work_struct *work) · 8 unmodified lines | |||
| 994 | up(sem); | 997 | up(sem); |
| 995 | return; | 998 | return; |
| 996 | } | 999 | } |
| 997 | ent->idx = alloc_ret; | ||
| 998 | } else { | 1000 | } else { |
| 999 | ent->idx = cmd->vars.max_reg_cmds; | 1001 | ent->idx = cmd->vars.max_reg_cmds; |
| 1000 | spin_lock_irqsave(&cmd->alloc_lock, flags); | 1002 | spin_lock_irqsave(&cmd->alloc_lock, flags); |
| 1001 | clear_bit(ent->idx, &cmd->vars.bitmask); | 1003 | clear_bit(ent->idx, &cmd->vars.bitmask); |
| 1004 | cmd->ent_arr[ent->idx] = ent; | ||
| 1002 | spin_unlock_irqrestore(&cmd->alloc_lock, flags); | 1005 | spin_unlock_irqrestore(&cmd->alloc_lock, flags); |
| 1003 | } | 1006 | } |
| 1004 | 1007 | ||
| 1005 | cmd->ent_arr[ent->idx] = ent; | ||
| 1006 | lay = get_inst(cmd, ent->idx); | 1008 | lay = get_inst(cmd, ent->idx); |
| 1007 | ent->lay = lay; | 1009 | ent->lay = lay; |
| 1008 | memset(lay, 0, sizeof(*lay)); | 1010 | memset(lay, 0, sizeof(*lay)); |
| @@ -718,7 +718,7 @@ static void mlx5_fw_tracer_handle_traces(struct work_struct *work) · 717 unmodified lines | |||
| 718 | 718 | ||
| 719 | while (block_timestamp > tracer->last_timestamp) { | 719 | while (block_timestamp > tracer->last_timestamp) { |
| 720 | /* Check block override if it's not the first block */ | 720 | /* Check block override if it's not the first block */ |
| 721 | if (!tracer->last_timestamp) { | 721 | if (tracer->last_timestamp) { |
| 722 | u64 *ts_event; | 722 | u64 *ts_event; |
| 723 | /* To avoid block override be the HW in case of buffer | 723 | /* To avoid block override be the HW in case of buffer |
| 724 | * wraparound, the time stamp of the previous block | 724 | * wraparound, the time stamp of the previous block |
| @@ -154,6 +154,7 @@ static int fs_udp_create_groups(struct mlx5e_flow_table *ft, enum fs_udp_type ty · 153 unmodified lines | |||
| 154 | in = kvzalloc(inlen, GFP_KERNEL); | 154 | in = kvzalloc(inlen, GFP_KERNEL); |
| 155 | if (!in || !ft->g) { | 155 | if (!in || !ft->g) { |
| 156 | kfree(ft->g); | 156 | kfree(ft->g); |
| 157 | ft->g = NULL; | ||
| 157 | kvfree(in); | 158 | kvfree(in); |
| 158 | return -ENOMEM; | 159 | return -ENOMEM; |
| 159 | } | 160 | } |
| @@ -197,7 +197,7 @@ parse_mirred_encap(struct mlx5e_tc_act_parse_state *parse_state, · 196 unmodified lines | |||
| 197 | } | 197 | } |
| 198 | esw_attr->dests[esw_attr->out_count].flags |= MLX5_ESW_DEST_ENCAP; | 198 | esw_attr->dests[esw_attr->out_count].flags |= MLX5_ESW_DEST_ENCAP; |
| 199 | esw_attr->out_count++; | 199 | esw_attr->out_count++; |
| 200 | /* attr->dests[].rep is resolved when we handle encap */ | 200 | /* attr->dests[].vport is resolved when we handle encap */ |
| 201 | 201 | ||
| 202 | return 0; | 202 | return 0; |
| 203 | } | 203 | } |
| @@ -270,7 +270,8 @@ parse_mirred(struct mlx5e_tc_act_parse_state *parse_state, · 66 unmodified lines | |||
| 270 | 270 | ||
| 271 | out_priv = netdev_priv(out_dev); | 271 | out_priv = netdev_priv(out_dev); |
| 272 | rpriv = out_priv->ppriv; | 272 | rpriv = out_priv->ppriv; |
| 273 | esw_attr->dests[esw_attr->out_count].rep = rpriv->rep; | 273 | esw_attr->dests[esw_attr->out_count].vport_valid = true; |
| 274 | esw_attr->dests[esw_attr->out_count].vport = rpriv->rep->vport; | ||
| 274 | esw_attr->dests[esw_attr->out_count].mdev = out_priv->mdev; | 275 | esw_attr->dests[esw_attr->out_count].mdev = out_priv->mdev; |
| 275 | 276 | ||
| 276 | esw_attr->out_count++; | 277 | esw_attr->out_count++; |
| @@ -300,6 +300,10 @@ int mlx5e_tc_tun_create_header_ipv4(struct mlx5e_priv *priv, · 299 unmodified lines | |||
| 300 | if (err) | 300 | if (err) |
| 301 | goto destroy_neigh_entry; | 301 | goto destroy_neigh_entry; |
| 302 | 302 | ||
| 303 | e->encap_size = ipv4_encap_size; | ||
| 304 | e->encap_header = encap_header; | ||
| 305 | encap_header = NULL; | ||
| 306 | |||
| 303 | if (!(nud_state & NUD_VALID)) { | 307 | if (!(nud_state & NUD_VALID)) { |
| 304 | neigh_event_send(attr.n, NULL); | 308 | neigh_event_send(attr.n, NULL); |
| 305 | /* the encap entry will be made valid on neigh update event | 309 | /* the encap entry will be made valid on neigh update event |
| @@ -310,8 +314,8 @@ int mlx5e_tc_tun_create_header_ipv4(struct mlx5e_priv *priv, · 4 unmodified lines | |||
| 310 | 314 | ||
| 311 | memset(&reformat_params, 0, sizeof(reformat_params)); | 315 | memset(&reformat_params, 0, sizeof(reformat_params)); |
| 312 | reformat_params.type = e->reformat_type; | 316 | reformat_params.type = e->reformat_type; |
| 313 | reformat_params.size = ipv4_encap_size; | 317 | reformat_params.size = e->encap_size; |
| 314 | reformat_params.data = encap_header; | 318 | reformat_params.data = e->encap_header; |
| 315 | e->pkt_reformat = mlx5_packet_reformat_alloc(priv->mdev, &reformat_params, | 319 | e->pkt_reformat = mlx5_packet_reformat_alloc(priv->mdev, &reformat_params, |
| 316 | MLX5_FLOW_NAMESPACE_FDB); | 320 | MLX5_FLOW_NAMESPACE_FDB); |
| 317 | if (IS_ERR(e->pkt_reformat)) { | 321 | if (IS_ERR(e->pkt_reformat)) { |
| @@ -319,8 +323,6 @@ int mlx5e_tc_tun_create_header_ipv4(struct mlx5e_priv *priv, · 1 unmodified line | |||
| 319 | goto destroy_neigh_entry; | 323 | goto destroy_neigh_entry; |
| 320 | } | 324 | } |
| 321 | 325 | ||
| 322 | e->encap_size = ipv4_encap_size; | ||
| 323 | e->encap_header = encap_header; | ||
| 324 | e->flags |= MLX5_ENCAP_ENTRY_VALID; | 326 | e->flags |= MLX5_ENCAP_ENTRY_VALID; |
| 325 | mlx5e_rep_queue_neigh_stats_work(netdev_priv(attr.out_dev)); | 327 | mlx5e_rep_queue_neigh_stats_work(netdev_priv(attr.out_dev)); |
| 326 | mlx5e_route_lookup_ipv4_put(&attr); | 328 | mlx5e_route_lookup_ipv4_put(&attr); |
| @@ -403,18 +405,23 @@ int mlx5e_tc_tun_update_header_ipv4(struct mlx5e_priv *priv, · 76 unmodified lines | |||
| 403 | if (err) | 405 | if (err) |
| 404 | goto free_encap; | 406 | goto free_encap; |
| 405 | 407 | ||
| 408 | e->encap_size = ipv4_encap_size; | ||
| 409 | kfree(e->encap_header); | ||
| 410 | e->encap_header = encap_header; | ||
| 411 | encap_header = NULL; | ||
| 412 | |||
| 406 | if (!(nud_state & NUD_VALID)) { | 413 | if (!(nud_state & NUD_VALID)) { |
| 407 | neigh_event_send(attr.n, NULL); | 414 | neigh_event_send(attr.n, NULL); |
| 408 | /* the encap entry will be made valid on neigh update event | 415 | /* the encap entry will be made valid on neigh update event |
| 409 | * and not used before that. | 416 | * and not used before that. |
| 410 | */ | 417 | */ |
| 411 | goto free_encap; | 418 | goto release_neigh; |
| 412 | } | 419 | } |
| 413 | 420 | ||
| 414 | memset(&reformat_params, 0, sizeof(reformat_params)); | 421 | memset(&reformat_params, 0, sizeof(reformat_params)); |
| 415 | reformat_params.type = e->reformat_type; | 422 | reformat_params.type = e->reformat_type; |
| 416 | reformat_params.size = ipv4_encap_size; | 423 | reformat_params.size = e->encap_size; |
| 417 | reformat_params.data = encap_header; | 424 | reformat_params.data = e->encap_header; |
| 418 | e->pkt_reformat = mlx5_packet_reformat_alloc(priv->mdev, &reformat_params, | 425 | e->pkt_reformat = mlx5_packet_reformat_alloc(priv->mdev, &reformat_params, |
| 419 | MLX5_FLOW_NAMESPACE_FDB); | 426 | MLX5_FLOW_NAMESPACE_FDB); |
| 420 | if (IS_ERR(e->pkt_reformat)) { | 427 | if (IS_ERR(e->pkt_reformat)) { |
| @@ -422,10 +429,6 @@ int mlx5e_tc_tun_update_header_ipv4(struct mlx5e_priv *priv, · 1 unmodified line | |||
| 422 | goto free_encap; | 429 | goto free_encap; |
| 423 | } | 430 | } |
| 424 | 431 | ||
| 425 | e->encap_size = ipv4_encap_size; | ||
| 426 | kfree(e->encap_header); | ||
| 427 | e->encap_header = encap_header; | ||
| 428 | |||
| 429 | e->flags |= MLX5_ENCAP_ENTRY_VALID; | 432 | e->flags |= MLX5_ENCAP_ENTRY_VALID; |
| 430 | mlx5e_rep_queue_neigh_stats_work(netdev_priv(attr.out_dev)); | 433 | mlx5e_rep_queue_neigh_stats_work(netdev_priv(attr.out_dev)); |
| 431 | mlx5e_route_lookup_ipv4_put(&attr); | 434 | mlx5e_route_lookup_ipv4_put(&attr); |
| @@ -567,6 +570,10 @@ int mlx5e_tc_tun_create_header_ipv6(struct mlx5e_priv *priv, · 135 unmodified lines | |||
| 567 | if (err) | 570 | if (err) |
| 568 | goto destroy_neigh_entry; | 571 | goto destroy_neigh_entry; |
| 569 | 572 | ||
| 573 | e->encap_size = ipv6_encap_size; | ||
| 574 | e->encap_header = encap_header; | ||
| 575 | encap_header = NULL; | ||
| 576 | |||
| 570 | if (!(nud_state & NUD_VALID)) { | 577 | if (!(nud_state & NUD_VALID)) { |
| 571 | neigh_event_send(attr.n, NULL); | 578 | neigh_event_send(attr.n, NULL); |
| 572 | /* the encap entry will be made valid on neigh update event | 579 | /* the encap entry will be made valid on neigh update event |
| @@ -577,8 +584,8 @@ int mlx5e_tc_tun_create_header_ipv6(struct mlx5e_priv *priv, · 4 unmodified lines | |||
| 577 | 584 | ||
| 578 | memset(&reformat_params, 0, sizeof(reformat_params)); | 585 | memset(&reformat_params, 0, sizeof(reformat_params)); |
| 579 | reformat_params.type = e->reformat_type; | 586 | reformat_params.type = e->reformat_type; |
| 580 | reformat_params.size = ipv6_encap_size; | 587 | reformat_params.size = e->encap_size; |
| 581 | reformat_params.data = encap_header; | 588 | reformat_params.data = e->encap_header; |
| 582 | e->pkt_reformat = mlx5_packet_reformat_alloc(priv->mdev, &reformat_params, | 589 | e->pkt_reformat = mlx5_packet_reformat_alloc(priv->mdev, &reformat_params, |
| 583 | MLX5_FLOW_NAMESPACE_FDB); | 590 | MLX5_FLOW_NAMESPACE_FDB); |
| 584 | if (IS_ERR(e->pkt_reformat)) { | 591 | if (IS_ERR(e->pkt_reformat)) { |
| @@ -586,8 +593,6 @@ int mlx5e_tc_tun_create_header_ipv6(struct mlx5e_priv *priv, · 1 unmodified line | |||
| 586 | goto destroy_neigh_entry; | 593 | goto destroy_neigh_entry; |
| 587 | } | 594 | } |
| 588 | 595 | ||
| 589 | e->encap_size = ipv6_encap_size; | ||
| 590 | e->encap_header = encap_header; | ||
| 591 | e->flags |= MLX5_ENCAP_ENTRY_VALID; | 596 | e->flags |= MLX5_ENCAP_ENTRY_VALID; |
| 592 | mlx5e_rep_queue_neigh_stats_work(netdev_priv(attr.out_dev)); | 597 | mlx5e_rep_queue_neigh_stats_work(netdev_priv(attr.out_dev)); |
| 593 | mlx5e_route_lookup_ipv6_put(&attr); | 598 | mlx5e_route_lookup_ipv6_put(&attr); |
| @@ -669,18 +674,23 @@ int mlx5e_tc_tun_update_header_ipv6(struct mlx5e_priv *priv, · 75 unmodified lines | |||
| 669 | if (err) | 674 | if (err) |
| 670 | goto free_encap; | 675 | goto free_encap; |
| 671 | 676 | ||
| 677 | e->encap_size = ipv6_encap_size; | ||
| 678 | kfree(e->encap_header); | ||
| 679 | e->encap_header = encap_header; | ||
| 680 | encap_header = NULL; | ||
| 681 | |||
| 672 | if (!(nud_state & NUD_VALID)) { | 682 | if (!(nud_state & NUD_VALID)) { |
| 673 | neigh_event_send(attr.n, NULL); | 683 | neigh_event_send(attr.n, NULL); |
| 674 | /* the encap entry will be made valid on neigh update event | 684 | /* the encap entry will be made valid on neigh update event |
| 675 | * and not used before that. | 685 | * and not used before that. |
| 676 | */ | 686 | */ |
| 677 | goto free_encap; | 687 | goto release_neigh; |
| 678 | } | 688 | } |
| 679 | 689 | ||
| 680 | memset(&reformat_params, 0, sizeof(reformat_params)); | 690 | memset(&reformat_params, 0, sizeof(reformat_params)); |
| 681 | reformat_params.type = e->reformat_type; | 691 | reformat_params.type = e->reformat_type; |
| 682 | reformat_params.size = ipv6_encap_size; | 692 | reformat_params.size = e->encap_size; |
| 683 | reformat_params.data = encap_header; | 693 | reformat_params.data = e->encap_header; |
| 684 | e->pkt_reformat = mlx5_packet_reformat_alloc(priv->mdev, &reformat_params, | 694 | e->pkt_reformat = mlx5_packet_reformat_alloc(priv->mdev, &reformat_params, |
| 685 | MLX5_FLOW_NAMESPACE_FDB); | 695 | MLX5_FLOW_NAMESPACE_FDB); |
| 686 | if (IS_ERR(e->pkt_reformat)) { | 696 | if (IS_ERR(e->pkt_reformat)) { |
| @@ -688,10 +698,6 @@ int mlx5e_tc_tun_update_header_ipv6(struct mlx5e_priv *priv, · 1 unmodified line | |||
| 688 | goto free_encap; | 698 | goto free_encap; |
| 689 | } | 699 | } |
| 690 | 700 | ||
| 691 | e->encap_size = ipv6_encap_size; | ||
| 692 | kfree(e->encap_header); | ||
| 693 | e->encap_header = encap_header; | ||
| 694 | |||
| 695 | e->flags |= MLX5_ENCAP_ENTRY_VALID; | 701 | e->flags |= MLX5_ENCAP_ENTRY_VALID; |
| 696 | mlx5e_rep_queue_neigh_stats_work(netdev_priv(attr.out_dev)); | 702 | mlx5e_rep_queue_neigh_stats_work(netdev_priv(attr.out_dev)); |
| 697 | mlx5e_route_lookup_ipv6_put(&attr); | 703 | mlx5e_route_lookup_ipv6_put(&attr); |
| @@ -1064,7 +1064,8 @@ int mlx5e_tc_tun_encap_dests_set(struct mlx5e_priv *priv, · 1063 unmodified lines | |||
| 1064 | 1064 | ||
| 1065 | out_priv = netdev_priv(encap_dev); | 1065 | out_priv = netdev_priv(encap_dev); |
| 1066 | rpriv = out_priv->ppriv; | 1066 | rpriv = out_priv->ppriv; |
| 1067 | esw_attr->dests[out_index].rep = rpriv->rep; | 1067 | esw_attr->dests[out_index].vport_valid = true; |
| 1068 | esw_attr->dests[out_index].vport = rpriv->rep->vport; | ||
| 1068 | esw_attr->dests[out_index].mdev = out_priv->mdev; | 1069 | esw_attr->dests[out_index].mdev = out_priv->mdev; |
| 1069 | } | 1070 | } |
| 1070 | 1071 | ||
| @@ -493,6 +493,7 @@ mlx5e_xmit_xdp_frame(struct mlx5e_xdpsq *sq, struct mlx5e_xmit_data *xdptxd, · 492 unmodified lines | |||
| 493 | dma_addr_t dma_addr = xdptxd->dma_addr; | 493 | dma_addr_t dma_addr = xdptxd->dma_addr; |
| 494 | u32 dma_len = xdptxd->len; | 494 | u32 dma_len = xdptxd->len; |
| 495 | u16 ds_cnt, inline_hdr_sz; | 495 | u16 ds_cnt, inline_hdr_sz; |
| 496 | unsigned int frags_size; | ||
| 496 | u8 num_wqebbs = 1; | 497 | u8 num_wqebbs = 1; |
| 497 | int num_frags = 0; | 498 | int num_frags = 0; |
| 498 | bool inline_ok; | 499 | bool inline_ok; |
| @@ -503,8 +504,9 @@ mlx5e_xmit_xdp_frame(struct mlx5e_xdpsq *sq, struct mlx5e_xmit_data *xdptxd, · 4 unmodified lines | |||
| 503 | 504 | ||
| 504 | inline_ok = sq->min_inline_mode == MLX5_INLINE_MODE_NONE || | 505 | inline_ok = sq->min_inline_mode == MLX5_INLINE_MODE_NONE || |
| 505 | dma_len >= MLX5E_XDP_MIN_INLINE; | 506 | dma_len >= MLX5E_XDP_MIN_INLINE; |
| 507 | frags_size = xdptxd->has_frags ? xdptxdf->sinfo->xdp_frags_size : 0; | ||
| 506 | 508 | ||
| 507 | if (unlikely(!inline_ok || sq->hw_mtu < dma_len)) { | 509 | if (unlikely(!inline_ok || sq->hw_mtu < dma_len + frags_size)) { |
| 508 | stats->err++; | 510 | stats->err++; |
| 509 | return false; | 511 | return false; |
| 510 | } | 512 | } |
| @@ -2142,7 +2142,7 @@ static int mlx5e_ipsec_block_tc_offload(struct mlx5_core_dev *mdev) · 2141 unmodified lines | |||
| 2142 | 2142 | ||
| 2143 | static void mlx5e_ipsec_unblock_tc_offload(struct mlx5_core_dev *mdev) | 2143 | static void mlx5e_ipsec_unblock_tc_offload(struct mlx5_core_dev *mdev) |
| 2144 | { | 2144 | { |
| 2145 | mdev->num_block_tc++; | 2145 | mdev->num_block_tc--; |
| 2146 | } | 2146 | } |
| 2147 | 2147 | ||
| 2148 | int mlx5e_accel_ipsec_fs_add_rule(struct mlx5e_ipsec_sa_entry *sa_entry) | 2148 | int mlx5e_accel_ipsec_fs_add_rule(struct mlx5e_ipsec_sa_entry *sa_entry) |
| @@ -49,7 +49,7 @@ void mlx5e_ethtool_get_drvinfo(struct mlx5e_priv *priv, · 48 unmodified lines | |||
| 49 | count = snprintf(drvinfo->fw_version, sizeof(drvinfo->fw_version), | 49 | count = snprintf(drvinfo->fw_version, sizeof(drvinfo->fw_version), |
| 50 | "%d.%d.%04d (%.16s)", fw_rev_maj(mdev), | 50 | "%d.%d.%04d (%.16s)", fw_rev_maj(mdev), |
| 51 | fw_rev_min(mdev), fw_rev_sub(mdev), mdev->board_id); | 51 | fw_rev_min(mdev), fw_rev_sub(mdev), mdev->board_id); |
| 52 | if (count == sizeof(drvinfo->fw_version)) | 52 | if (count >= sizeof(drvinfo->fw_version)) |
| 53 | snprintf(drvinfo->fw_version, sizeof(drvinfo->fw_version), | 53 | snprintf(drvinfo->fw_version, sizeof(drvinfo->fw_version), |
| 54 | "%d.%d.%04d", fw_rev_maj(mdev), | 54 | "%d.%d.%04d", fw_rev_maj(mdev), |
| 55 | fw_rev_min(mdev), fw_rev_sub(mdev)); | 55 | fw_rev_min(mdev), fw_rev_sub(mdev)); |
| @@ -78,7 +78,7 @@ static void mlx5e_rep_get_drvinfo(struct net_device *dev, · 77 unmodified lines | |||
| 78 | count = snprintf(drvinfo->fw_version, sizeof(drvinfo->fw_version), | 78 | count = snprintf(drvinfo->fw_version, sizeof(drvinfo->fw_version), |
| 79 | "%d.%d.%04d (%.16s)", fw_rev_maj(mdev), | 79 | "%d.%d.%04d (%.16s)", fw_rev_maj(mdev), |
| 80 | fw_rev_min(mdev), fw_rev_sub(mdev), mdev->board_id); | 80 | fw_rev_min(mdev), fw_rev_sub(mdev), mdev->board_id); |
| 81 | if (count == sizeof(drvinfo->fw_version)) | 81 | if (count >= sizeof(drvinfo->fw_version)) |
| 82 | snprintf(drvinfo->fw_version, sizeof(drvinfo->fw_version), | 82 | snprintf(drvinfo->fw_version, sizeof(drvinfo->fw_version), |
| 83 | "%d.%d.%04d", fw_rev_maj(mdev), | 83 | "%d.%d.%04d", fw_rev_maj(mdev), |
| 84 | fw_rev_min(mdev), fw_rev_sub(mdev)); | 84 | fw_rev_min(mdev), fw_rev_sub(mdev)); |
| @@ -3778,7 +3778,8 @@ alloc_branch_attr(struct mlx5e_tc_flow *flow, · 3777 unmodified lines | |||
| 3778 | break; | 3778 | break; |
| 3779 | case FLOW_ACTION_ACCEPT: | 3779 | case FLOW_ACTION_ACCEPT: |
| 3780 | case FLOW_ACTION_PIPE: | 3780 | case FLOW_ACTION_PIPE: |
| 3781 | if (set_branch_dest_ft(flow->priv, attr)) | 3781 | err = set_branch_dest_ft(flow->priv, attr); |
| 3782 | if (err) | ||
| 3782 | goto out_err; | 3783 | goto out_err; |
| 3783 | break; | 3784 | break; |
| 3784 | case FLOW_ACTION_JUMP: | 3785 | case FLOW_ACTION_JUMP: |
| @@ -3788,7 +3789,8 @@ alloc_branch_attr(struct mlx5e_tc_flow *flow, · 3 unmodified lines | |||
| 3788 | goto out_err; | 3789 | goto out_err; |
| 3789 | } | 3790 | } |
| 3790 | *jump_count = cond->extval; | 3791 | *jump_count = cond->extval; |
| 3791 | if (set_branch_dest_ft(flow->priv, attr)) | 3792 | err = set_branch_dest_ft(flow->priv, attr); |
| 3793 | if (err) | ||
| 3792 | goto out_err; | 3794 | goto out_err; |
| 3793 | break; | 3795 | break; |
| 3794 | default: | 3796 | default: |
| @@ -5736,8 +5738,10 @@ int mlx5e_tc_action_miss_mapping_get(struct mlx5e_priv *priv, struct mlx5_flow_a · 1941 unmodified lines | |||
| 5736 | 5738 | ||
| 5737 | esw = priv->mdev->priv.eswitch; | 5739 | esw = priv->mdev->priv.eswitch; |
| 5738 | attr->act_id_restore_rule = esw_add_restore_rule(esw, *act_miss_mapping); | 5740 | attr->act_id_restore_rule = esw_add_restore_rule(esw, *act_miss_mapping); |
| 5739 | if (IS_ERR(attr->act_id_restore_rule)) | 5741 | if (IS_ERR(attr->act_id_restore_rule)) { |
| 5742 | err = PTR_ERR(attr->act_id_restore_rule); | ||
| 5740 | goto err_rule; | 5743 | goto err_rule; |
| 5744 | } | ||
| 5741 | 5745 | ||
| 5742 | return 0; | 5746 | return 0; |
| 5743 | 5747 | ||
| @@ -526,7 +526,8 @@ struct mlx5_esw_flow_attr { · 525 unmodified lines | |||
| 526 | u8 total_vlan; | 526 | u8 total_vlan; |
| 527 | struct { | 527 | struct { |
| 528 | u32 flags; | 528 | u32 flags; |
| 529 | struct mlx5_eswitch_rep *rep; | 529 | bool vport_valid; |
| 530 | u16 vport; | ||
| 530 | struct mlx5_pkt_reformat *pkt_reformat; | 531 | struct mlx5_pkt_reformat *pkt_reformat; |
| 531 | struct mlx5_core_dev *mdev; | 532 | struct mlx5_core_dev *mdev; |
| 532 | struct mlx5_termtbl_handle *termtbl; | 533 | struct mlx5_termtbl_handle *termtbl; |
| @@ -287,10 +287,9 @@ static void esw_put_dest_tables_loop(struct mlx5_eswitch *esw, struct mlx5_flow_ · 286 unmodified lines | |||
| 287 | for (i = from; i < to; i++) | 287 | for (i = from; i < to; i++) |
| 288 | if (esw_attr->dests[i].flags & MLX5_ESW_DEST_CHAIN_WITH_SRC_PORT_CHANGE) | 288 | if (esw_attr->dests[i].flags & MLX5_ESW_DEST_CHAIN_WITH_SRC_PORT_CHANGE) |
| 289 | mlx5_chains_put_table(chains, 0, 1, 0); | 289 | mlx5_chains_put_table(chains, 0, 1, 0); |
| 290 | else if (mlx5_esw_indir_table_needed(esw, attr, esw_attr->dests[i].rep->vport, | 290 | else if (mlx5_esw_indir_table_needed(esw, attr, esw_attr->dests[i].vport, |
| 291 | esw_attr->dests[i].mdev)) | 291 | esw_attr->dests[i].mdev)) |
| 292 | mlx5_esw_indir_table_put(esw, esw_attr->dests[i].rep->vport, | 292 | mlx5_esw_indir_table_put(esw, esw_attr->dests[i].vport, false); |
| 293 | false); | ||
| 294 | } | 293 | } |
| 295 | 294 | ||
| 296 | static bool | 295 | static bool |
| @@ -358,8 +357,8 @@ esw_is_indir_table(struct mlx5_eswitch *esw, struct mlx5_flow_attr *attr) · 61 unmodified lines | |||
| 358 | * this criteria. | 357 | * this criteria. |
| 359 | */ | 358 | */ |
| 360 | for (i = esw_attr->split_count; i < esw_attr->out_count; i++) { | 359 | for (i = esw_attr->split_count; i < esw_attr->out_count; i++) { |
| 361 | if (esw_attr->dests[i].rep && | 360 | if (esw_attr->dests[i].vport_valid && |
| 362 | mlx5_esw_indir_table_needed(esw, attr, esw_attr->dests[i].rep->vport, | 361 | mlx5_esw_indir_table_needed(esw, attr, esw_attr->dests[i].vport, |
| 363 | esw_attr->dests[i].mdev)) { | 362 | esw_attr->dests[i].mdev)) { |
| 364 | result = true; | 363 | result = true; |
| 365 | } else { | 364 | } else { |
| @@ -388,7 +387,7 @@ esw_setup_indir_table(struct mlx5_flow_destination *dest, · 22 unmodified lines | |||
| 388 | dest[*i].type = MLX5_FLOW_DESTINATION_TYPE_FLOW_TABLE; | 387 | dest[*i].type = MLX5_FLOW_DESTINATION_TYPE_FLOW_TABLE; |
| 389 | 388 | ||
| 390 | dest[*i].ft = mlx5_esw_indir_table_get(esw, attr, | 389 | dest[*i].ft = mlx5_esw_indir_table_get(esw, attr, |
| 391 | esw_attr->dests[j].rep->vport, false); | 390 | esw_attr->dests[j].vport, false); |
| 392 | if (IS_ERR(dest[*i].ft)) { | 391 | if (IS_ERR(dest[*i].ft)) { |
| 393 | err = PTR_ERR(dest[*i].ft); | 392 | err = PTR_ERR(dest[*i].ft); |
| 394 | goto err_indir_tbl_get; | 393 | goto err_indir_tbl_get; |
| @@ -432,11 +431,11 @@ static bool esw_setup_uplink_fwd_ipsec_needed(struct mlx5_eswitch *esw, · 37 unmodified lines | |||
| 432 | int attr_idx) | 431 | int attr_idx) |
| 433 | { | 432 | { |
| 434 | if (esw->offloads.ft_ipsec_tx_pol && | 433 | if (esw->offloads.ft_ipsec_tx_pol && |
| 435 | esw_attr->dests[attr_idx].rep && | 434 | esw_attr->dests[attr_idx].vport_valid && |
| 436 | esw_attr->dests[attr_idx].rep->vport == MLX5_VPORT_UPLINK && | 435 | esw_attr->dests[attr_idx].vport == MLX5_VPORT_UPLINK && |
| 437 | /* To be aligned with software, encryption is needed only for tunnel device */ | 436 | /* To be aligned with software, encryption is needed only for tunnel device */ |
| 438 | (esw_attr->dests[attr_idx].flags & MLX5_ESW_DEST_ENCAP_VALID) && | 437 | (esw_attr->dests[attr_idx].flags & MLX5_ESW_DEST_ENCAP_VALID) && |
| 439 | esw_attr->dests[attr_idx].rep != esw_attr->in_rep && | 438 | esw_attr->dests[attr_idx].vport != esw_attr->in_rep->vport && |
| 440 | esw_same_vhca_id(esw_attr->dests[attr_idx].mdev, esw->dev)) | 439 | esw_same_vhca_id(esw_attr->dests[attr_idx].mdev, esw->dev)) |
| 441 | return true; | 440 | return true; |
| 442 | 441 | ||
| @@ -469,7 +468,7 @@ esw_setup_dest_fwd_vport(struct mlx5_flow_destination *dest, struct mlx5_flow_ac · 26 unmodified lines | |||
| 469 | int attr_idx, int dest_idx, bool pkt_reformat) | 468 | int attr_idx, int dest_idx, bool pkt_reformat) |
| 470 | { | 469 | { |
| 471 | dest[dest_idx].type = MLX5_FLOW_DESTINATION_TYPE_VPORT; | 470 | dest[dest_idx].type = MLX5_FLOW_DESTINATION_TYPE_VPORT; |
| 472 | dest[dest_idx].vport.num = esw_attr->dests[attr_idx].rep->vport; | 471 | dest[dest_idx].vport.num = esw_attr->dests[attr_idx].vport; |
| 473 | if (MLX5_CAP_ESW(esw->dev, merged_eswitch)) { | 472 | if (MLX5_CAP_ESW(esw->dev, merged_eswitch)) { |
| 474 | dest[dest_idx].vport.vhca_id = | 473 | dest[dest_idx].vport.vhca_id = |
| 475 | MLX5_CAP_GEN(esw_attr->dests[attr_idx].mdev, vhca_id); | 474 | MLX5_CAP_GEN(esw_attr->dests[attr_idx].mdev, vhca_id); |
| @@ -1177,9 +1176,9 @@ static int esw_add_fdb_peer_miss_rules(struct mlx5_eswitch *esw, · 701 unmodified lines | |||
| 1177 | struct mlx5_flow_handle *flow; | 1176 | struct mlx5_flow_handle *flow; |
| 1178 | struct mlx5_flow_spec *spec; | 1177 | struct mlx5_flow_spec *spec; |
| 1179 | struct mlx5_vport *vport; | 1178 | struct mlx5_vport *vport; |
| 1179 | int err, pfindex; | ||
| 1180 | unsigned long i; | 1180 | unsigned long i; |
| 1181 | void *misc; | 1181 | void *misc; |
| 1182 | int err; | ||
| 1183 | 1182 | ||
| 1184 | if (!MLX5_VPORT_MANAGER(esw->dev) && !mlx5_core_is_ecpf_esw_manager(esw->dev)) | 1183 | if (!MLX5_VPORT_MANAGER(esw->dev) && !mlx5_core_is_ecpf_esw_manager(esw->dev)) |
| 1185 | return 0; | 1184 | return 0; |
| @@ -1255,7 +1254,15 @@ static int esw_add_fdb_peer_miss_rules(struct mlx5_eswitch *esw, · 69 unmodified lines | |||
| 1255 | flows[vport->index] = flow; | 1254 | flows[vport->index] = flow; |
| 1256 | } | 1255 | } |
| 1257 | } | 1256 | } |
| 1258 | esw->fdb_table.offloads.peer_miss_rules[mlx5_get_dev_index(peer_dev)] = flows; | 1257 | |
| 1258 | pfindex = mlx5_get_dev_index(peer_dev); | ||
| 1259 | if (pfindex >= MLX5_MAX_PORTS) { | ||
| 1260 | esw_warn(esw->dev, "Peer dev index(%d) is over the max num defined(%d)\n", | ||
| 1261 | pfindex, MLX5_MAX_PORTS); | ||
| 1262 | err = -EINVAL; | ||
| 1263 | goto add_ec_vf_flow_err; | ||
| 1264 | } | ||
| 1265 | esw->fdb_table.offloads.peer_miss_rules[pfindex] = flows; | ||
| 1259 | 1266 | ||
| 1260 | kvfree(spec); | 1267 | kvfree(spec); |
| 1261 | return 0; | 1268 | return 0; |
| @@ -233,8 +233,8 @@ mlx5_eswitch_termtbl_required(struct mlx5_eswitch *esw, · 232 unmodified lines | |||
| 233 | 233 | ||
| 234 | /* hairpin */ | 234 | /* hairpin */ |
| 235 | for (i = esw_attr->split_count; i < esw_attr->out_count; i++) | 235 | for (i = esw_attr->split_count; i < esw_attr->out_count; i++) |
| 236 | if (!esw_attr->dest_int_port && esw_attr->dests[i].rep && | 236 | if (!esw_attr->dest_int_port && esw_attr->dests[i].vport_valid && |
| 237 | esw_attr->dests[i].rep->vport == MLX5_VPORT_UPLINK) | 237 | esw_attr->dests[i].vport == MLX5_VPORT_UPLINK) |
| 238 | return true; | 238 | return true; |
| 239 | 239 | ||
| 240 | return false; | 240 | return false; |
| @@ -277,7 +277,7 @@ int mlx5_query_nic_vport_mac_list(struct mlx5_core_dev *dev, · 276 unmodified lines | |||
| 277 | req_list_size = max_list_size; | 277 | req_list_size = max_list_size; |
| 278 | } | 278 | } |
| 279 | 279 | ||
| 280 | out_sz = MLX5_ST_SZ_BYTES(query_nic_vport_context_in) + | 280 | out_sz = MLX5_ST_SZ_BYTES(query_nic_vport_context_out) + |
| 281 | req_list_size * MLX5_ST_SZ_BYTES(mac_address_layout); | 281 | req_list_size * MLX5_ST_SZ_BYTES(mac_address_layout); |
| 282 | 282 | ||
| 283 | out = kvzalloc(out_sz, GFP_KERNEL); | 283 | out = kvzalloc(out_sz, GFP_KERNEL); |
| @@ -350,6 +350,8 @@ union ks8851_tx_hdr { · 349 unmodified lines | |||
| 350 | * @rxd: Space for receiving SPI data, in DMA-able space. | 350 | * @rxd: Space for receiving SPI data, in DMA-able space. |
| 351 | * @txd: Space for transmitting SPI data, in DMA-able space. | 351 | * @txd: Space for transmitting SPI data, in DMA-able space. |
| 352 | * @msg_enable: The message flags controlling driver output (see ethtool). | 352 | * @msg_enable: The message flags controlling driver output (see ethtool). |
| 353 | * @tx_space: Free space in the hardware TX buffer (cached copy of KS_TXMIR). | ||
| 354 | * @queued_len: Space required in hardware TX buffer for queued packets in txq. | ||
| 353 | * @fid: Incrementing frame id tag. | 355 | * @fid: Incrementing frame id tag. |
| 354 | * @rc_ier: Cached copy of KS_IER. | 356 | * @rc_ier: Cached copy of KS_IER. |
| 355 | * @rc_ccr: Cached copy of KS_CCR. | 357 | * @rc_ccr: Cached copy of KS_CCR. |
| @@ -399,6 +401,7 @@ struct ks8851_net { · 43 unmodified lines | |||
| 399 | struct work_struct rxctrl_work; | 401 | struct work_struct rxctrl_work; |
| 400 | 402 | ||
| 401 | struct sk_buff_head txq; | 403 | struct sk_buff_head txq; |
| 404 | unsigned int queued_len; | ||
| 402 | 405 | ||
| 403 | struct eeprom_93cx6 eeprom; | 406 | struct eeprom_93cx6 eeprom; |
| 404 | struct regulator *vdd_reg; | 407 | struct regulator *vdd_reg; |
| @@ -362,16 +362,18 @@ static irqreturn_t ks8851_irq(int irq, void *_ks) · 361 unmodified lines | |||
| 362 | handled |= IRQ_RXPSI; | 362 | handled |= IRQ_RXPSI; |
| 363 | 363 | ||
| 364 | if (status & IRQ_TXI) { | 364 | if (status & IRQ_TXI) { |
| 365 | handled |= IRQ_TXI; | 365 | unsigned short tx_space = ks8851_rdreg16(ks, KS_TXMIR); |
| 366 | 366 | ||
| 367 | /* no lock here, tx queue should have been stopped */ | 367 | netif_dbg(ks, intr, ks->netdev, |
| 368 | "%s: txspace %d\n", __func__, tx_space); | ||
| 368 | 369 | ||
| 369 | /* update our idea of how much tx space is available to the | 370 | spin_lock(&ks->statelock); |
| 370 | * system */ | 371 | ks->tx_space = tx_space; |
| 371 | ks->tx_space = ks8851_rdreg16(ks, KS_TXMIR); | 372 | if (netif_queue_stopped(ks->netdev)) |
| 373 | netif_wake_queue(ks->netdev); | ||
| 374 | spin_unlock(&ks->statelock); | ||
| 372 | 375 | ||
| 373 | netif_dbg(ks, intr, ks->netdev, | 376 | handled |= IRQ_TXI; |
| 374 | "%s: txspace %d\n", __func__, ks->tx_space); | ||
| 375 | } | 377 | } |
| 376 | 378 | ||
| 377 | if (status & IRQ_RXI) | 379 | if (status & IRQ_RXI) |
| @@ -414,9 +416,6 @@ static irqreturn_t ks8851_irq(int irq, void *_ks) · 36 unmodified lines | |||
| 414 | if (status & IRQ_LCI) | 416 | if (status & IRQ_LCI) |
| 415 | mii_check_link(&ks->mii); | 417 | mii_check_link(&ks->mii); |
| 416 | 418 | ||
| 417 | if (status & IRQ_TXI) | ||
| 418 | netif_wake_queue(ks->netdev); | ||
| 419 | |||
| 420 | return IRQ_HANDLED; | 419 | return IRQ_HANDLED; |
| 421 | } | 420 | } |
| 422 | 421 | ||
| @@ -500,6 +499,7 @@ static int ks8851_net_open(struct net_device *dev) · 77 unmodified lines | |||
| 500 | ks8851_wrreg16(ks, KS_ISR, ks->rc_ier); | 499 | ks8851_wrreg16(ks, KS_ISR, ks->rc_ier); |
| 501 | ks8851_wrreg16(ks, KS_IER, ks->rc_ier); | 500 | ks8851_wrreg16(ks, KS_IER, ks->rc_ier); |
| 502 | 501 | ||
| 502 | ks->queued_len = 0; | ||
| 503 | netif_start_queue(ks->netdev); | 503 | netif_start_queue(ks->netdev); |
| 504 | 504 | ||
| 505 | netif_dbg(ks, ifup, ks->netdev, "network device up\n"); | 505 | netif_dbg(ks, ifup, ks->netdev, "network device up\n"); |
| @@ -286,6 +286,18 @@ static void ks8851_wrfifo_spi(struct ks8851_net *ks, struct sk_buff *txp, · 285 unmodified lines | |||
| 286 | netdev_err(ks->netdev, "%s: spi_sync() failed\n", __func__); | 286 | netdev_err(ks->netdev, "%s: spi_sync() failed\n", __func__); |
| 287 | } | 287 | } |
| 288 | 288 | ||
| 289 | /** | ||
| 290 | * calc_txlen - calculate size of message to send packet | ||
| 291 | * @len: Length of data | ||
| 292 | * | ||
| 293 | * Returns the size of the TXFIFO message needed to send | ||
| 294 | * this packet. | ||
| 295 | */ | ||
| 296 | static unsigned int calc_txlen(unsigned int len) | ||
| 297 | { | ||
| 298 | return ALIGN(len + 4, 4); | ||
| 299 | } | ||
| 300 | |||
| 289 | /** | 301 | /** |
| 290 | * ks8851_rx_skb_spi - receive skbuff | 302 | * ks8851_rx_skb_spi - receive skbuff |
| 291 | * @ks: The device state | 303 | * @ks: The device state |
| @@ -305,7 +317,9 @@ static void ks8851_rx_skb_spi(struct ks8851_net *ks, struct sk_buff *skb) · 13 unmodified lines | |||
| 305 | */ | 317 | */ |
| 306 | static void ks8851_tx_work(struct work_struct *work) | 318 | static void ks8851_tx_work(struct work_struct *work) |
| 307 | { | 319 | { |
| 320 | unsigned int dequeued_len = 0; | ||
| 308 | struct ks8851_net_spi *kss; | 321 | struct ks8851_net_spi *kss; |
| 322 | unsigned short tx_space; | ||
| 309 | struct ks8851_net *ks; | 323 | struct ks8851_net *ks; |
| 310 | unsigned long flags; | 324 | unsigned long flags; |
| 311 | struct sk_buff *txb; | 325 | struct sk_buff *txb; |
| @@ -322,6 +336,8 @@ static void ks8851_tx_work(struct work_struct *work) · 10 unmodified lines | |||
| 322 | last = skb_queue_empty(&ks->txq); | 336 | last = skb_queue_empty(&ks->txq); |
| 323 | 337 | ||
| 324 | if (txb) { | 338 | if (txb) { |
| 339 | dequeued_len += calc_txlen(txb->len); | ||
| 340 | |||
| 325 | ks8851_wrreg16_spi(ks, KS_RXQCR, | 341 | ks8851_wrreg16_spi(ks, KS_RXQCR, |
| 326 | ks->rc_rxqcr | RXQCR_SDA); | 342 | ks->rc_rxqcr | RXQCR_SDA); |
| 327 | ks8851_wrfifo_spi(ks, txb, last); | 343 | ks8851_wrfifo_spi(ks, txb, last); |
| @@ -332,6 +348,13 @@ static void ks8851_tx_work(struct work_struct *work) · 4 unmodified lines | |||
| 332 | } | 348 | } |
| 333 | } | 349 | } |
| 334 | 350 | ||
| 351 | tx_space = ks8851_rdreg16_spi(ks, KS_TXMIR); | ||
| 352 | |||
| 353 | spin_lock(&ks->statelock); | ||
| 354 | ks->queued_len -= dequeued_len; | ||
| 355 | ks->tx_space = tx_space; | ||
| 356 | spin_unlock(&ks->statelock); | ||
| 357 | |||
| 335 | ks8851_unlock_spi(ks, &flags); | 358 | ks8851_unlock_spi(ks, &flags); |
| 336 | } | 359 | } |
| 337 | 360 | ||
| @@ -346,18 +369,6 @@ static void ks8851_flush_tx_work_spi(struct ks8851_net *ks) · 8 unmodified lines | |||
| 346 | flush_work(&kss->tx_work); | 369 | flush_work(&kss->tx_work); |
| 347 | } | 370 | } |
| 348 | 371 | ||
| 349 | /** | ||
| 350 | * calc_txlen - calculate size of message to send packet | ||
| 351 | * @len: Length of data | ||
| 352 | * | ||
| 353 | * Returns the size of the TXFIFO message needed to send | ||
| 354 | * this packet. | ||
| 355 | */ | ||
| 356 | static unsigned int calc_txlen(unsigned int len) | ||
| 357 | { | ||
| 358 | return ALIGN(len + 4, 4); | ||
| 359 | } | ||
| 360 | |||
| 361 | /** | 372 | /** |
| 362 | * ks8851_start_xmit_spi - transmit packet using SPI | 373 | * ks8851_start_xmit_spi - transmit packet using SPI |
| 363 | * @skb: The buffer to transmit | 374 | * @skb: The buffer to transmit |
| @@ -386,16 +397,17 @@ static netdev_tx_t ks8851_start_xmit_spi(struct sk_buff *skb, · 22 unmodified lines | |||
| 386 | 397 | ||
| 387 | spin_lock(&ks->statelock); | 398 | spin_lock(&ks->statelock); |
| 388 | 399 | ||
| 389 | if (needed > ks->tx_space) { | 400 | if (ks->queued_len + needed > ks->tx_space) { |
| 390 | netif_stop_queue(dev); | 401 | netif_stop_queue(dev); |
| 391 | ret = NETDEV_TX_BUSY; | 402 | ret = NETDEV_TX_BUSY; |
| 392 | } else { | 403 | } else { |
| 393 | ks->tx_space -= needed; | 404 | ks->queued_len += needed; |
| 394 | skb_queue_tail(&ks->txq, skb); | 405 | skb_queue_tail(&ks->txq, skb); |
| 395 | } | 406 | } |
| 396 | 407 | ||
| 397 | spin_unlock(&ks->statelock); | 408 | spin_unlock(&ks->statelock); |
| 398 | schedule_work(&kss->tx_work); | 409 | if (ret == NETDEV_TX_OK) |
| 410 | schedule_work(&kss->tx_work); | ||
| 399 | 411 | ||
| 400 | return ret; | 412 | return ret; |
| 401 | } | 413 | } |
| @@ -20,6 +20,7 @@ config MICROSOFT_MANA · 19 unmodified lines | |||
| 20 | depends on PCI_MSI && X86_64 | 20 | depends on PCI_MSI && X86_64 |
| 21 | depends on PCI_HYPERV | 21 | depends on PCI_HYPERV |
| 22 | select AUXILIARY_BUS | 22 | select AUXILIARY_BUS |
| 23 | select PAGE_POOL | ||
| 23 | help | 24 | help |
| 24 | This driver supports Microsoft Azure Network Adapter (MANA). | 25 | This driver supports Microsoft Azure Network Adapter (MANA). |
| 25 | So far, the driver is only supported on X86_64. | 26 | So far, the driver is only supported on X86_64. |
| @@ -582,10 +582,10 @@ static void ocelot_port_rmon_stats_cb(struct ocelot *ocelot, int port, void *pri · 581 unmodified lines | |||
| 582 | rmon_stats->hist_tx[0] = s[OCELOT_STAT_TX_64]; | 582 | rmon_stats->hist_tx[0] = s[OCELOT_STAT_TX_64]; |
| 583 | rmon_stats->hist_tx[1] = s[OCELOT_STAT_TX_65_127]; | 583 | rmon_stats->hist_tx[1] = s[OCELOT_STAT_TX_65_127]; |
| 584 | rmon_stats->hist_tx[2] = s[OCELOT_STAT_TX_128_255]; | 584 | rmon_stats->hist_tx[2] = s[OCELOT_STAT_TX_128_255]; |
| 585 | rmon_stats->hist_tx[3] = s[OCELOT_STAT_TX_128_255]; | 585 | rmon_stats->hist_tx[3] = s[OCELOT_STAT_TX_256_511]; |
| 586 | rmon_stats->hist_tx[4] = s[OCELOT_STAT_TX_256_511]; | 586 | rmon_stats->hist_tx[4] = s[OCELOT_STAT_TX_512_1023]; |
| 587 | rmon_stats->hist_tx[5] = s[OCELOT_STAT_TX_512_1023]; | 587 | rmon_stats->hist_tx[5] = s[OCELOT_STAT_TX_1024_1526]; |
| 588 | rmon_stats->hist_tx[6] = s[OCELOT_STAT_TX_1024_1526]; | 588 | rmon_stats->hist_tx[6] = s[OCELOT_STAT_TX_1527_MAX]; |
| 589 | } | 589 | } |
| 590 | 590 | ||
| 591 | static void ocelot_port_pmac_rmon_stats_cb(struct ocelot *ocelot, int port, | 591 | static void ocelot_port_pmac_rmon_stats_cb(struct ocelot *ocelot, int port, |
| @@ -610,10 +610,10 @@ static void ocelot_port_pmac_rmon_stats_cb(struct ocelot *ocelot, int port, · 18 unmodified lines | |||
| 610 | rmon_stats->hist_tx[0] = s[OCELOT_STAT_TX_PMAC_64]; | 610 | rmon_stats->hist_tx[0] = s[OCELOT_STAT_TX_PMAC_64]; |
| 611 | rmon_stats->hist_tx[1] = s[OCELOT_STAT_TX_PMAC_65_127]; | 611 | rmon_stats->hist_tx[1] = s[OCELOT_STAT_TX_PMAC_65_127]; |
| 612 | rmon_stats->hist_tx[2] = s[OCELOT_STAT_TX_PMAC_128_255]; | 612 | rmon_stats->hist_tx[2] = s[OCELOT_STAT_TX_PMAC_128_255]; |
| 613 | rmon_stats->hist_tx[3] = s[OCELOT_STAT_TX_PMAC_128_255]; | 613 | rmon_stats->hist_tx[3] = s[OCELOT_STAT_TX_PMAC_256_511]; |
| 614 | rmon_stats->hist_tx[4] = s[OCELOT_STAT_TX_PMAC_256_511]; | 614 | rmon_stats->hist_tx[4] = s[OCELOT_STAT_TX_PMAC_512_1023]; |
| 615 | rmon_stats->hist_tx[5] = s[OCELOT_STAT_TX_PMAC_512_1023]; | 615 | rmon_stats->hist_tx[5] = s[OCELOT_STAT_TX_PMAC_1024_1526]; |
| 616 | rmon_stats->hist_tx[6] = s[OCELOT_STAT_TX_PMAC_1024_1526]; | 616 | rmon_stats->hist_tx[6] = s[OCELOT_STAT_TX_PMAC_1527_MAX]; |
| 617 | } | 617 | } |
| 618 | 618 | ||
| 619 | void ocelot_port_get_rmon_stats(struct ocelot *ocelot, int port, | 619 | void ocelot_port_get_rmon_stats(struct ocelot *ocelot, int port, |
| @@ -237,7 +237,7 @@ static void timestamp_interrupt(struct stmmac_priv *priv) · 236 unmodified lines | |||
| 237 | */ | 237 | */ |
| 238 | ts_status = readl(priv->ioaddr + GMAC_TIMESTAMP_STATUS); | 238 | ts_status = readl(priv->ioaddr + GMAC_TIMESTAMP_STATUS); |
| 239 | 239 | ||
| 240 | if (priv->plat->flags & STMMAC_FLAG_EXT_SNAPSHOT_EN) | 240 | if (!(priv->plat->flags & STMMAC_FLAG_EXT_SNAPSHOT_EN)) |
| 241 | return; | 241 | return; |
| 242 | 242 | ||
| 243 | num_snapshot = (ts_status & GMAC_TIMESTAMP_ATSNS_MASK) >> | 243 | num_snapshot = (ts_status & GMAC_TIMESTAMP_ATSNS_MASK) >> |
| @@ -160,60 +160,6 @@ static __le32 wx_test_staterr(union wx_rx_desc *rx_desc, · 159 unmodified lines | |||
| 160 | return rx_desc->wb.upper.status_error & cpu_to_le32(stat_err_bits); | 160 | return rx_desc->wb.upper.status_error & cpu_to_le32(stat_err_bits); |
| 161 | } | 161 | } |
| 162 | 162 | ||
| 163 | static bool wx_can_reuse_rx_page(struct wx_rx_buffer *rx_buffer, | ||
| 164 | int rx_buffer_pgcnt) | ||
| 165 | { | ||
| 166 | unsigned int pagecnt_bias = rx_buffer->pagecnt_bias; | ||
| 167 | struct page *page = rx_buffer->page; | ||
| 168 | |||
| 169 | /* avoid re-using remote and pfmemalloc pages */ | ||
| 170 | if (!dev_page_is_reusable(page)) | ||
| 171 | return false; | ||
| 172 | |||
| 173 | #if (PAGE_SIZE < 8192) | ||
| 174 | /* if we are only owner of page we can reuse it */ | ||
| 175 | if (unlikely((rx_buffer_pgcnt - pagecnt_bias) > 1)) | ||
| 176 | return false; | ||
| 177 | #endif | ||
| 178 | |||
| 179 | /* If we have drained the page fragment pool we need to update | ||
| 180 | * the pagecnt_bias and page count so that we fully restock the | ||
| 181 | * number of references the driver holds. | ||
| 182 | */ | ||
| 183 | if (unlikely(pagecnt_bias == 1)) { | ||
| 184 | page_ref_add(page, USHRT_MAX - 1); | ||
| 185 | rx_buffer->pagecnt_bias = USHRT_MAX; | ||
| 186 | } | ||
| 187 | |||
| 188 | return true; | ||
| 189 | } | ||
| 190 | |||
| 191 | /** | ||
| 192 | * wx_reuse_rx_page - page flip buffer and store it back on the ring | ||
| 193 | * @rx_ring: rx descriptor ring to store buffers on | ||
| 194 | * @old_buff: donor buffer to have page reused | ||
| 195 | * | ||
| 196 | * Synchronizes page for reuse by the adapter | ||
| 197 | **/ | ||
| 198 | static void wx_reuse_rx_page(struct wx_ring *rx_ring, | ||
| 199 | struct wx_rx_buffer *old_buff) | ||
| 200 | { | ||
| 201 | u16 nta = rx_ring->next_to_alloc; | ||
| 202 | struct wx_rx_buffer *new_buff; | ||
| 203 | |||
| 204 | new_buff = &rx_ring->rx_buffer_info[nta]; | ||
| 205 | |||
| 206 | /* update, and store next to alloc */ | ||
| 207 | nta++; | ||
| 208 | rx_ring->next_to_alloc = (nta < rx_ring->count) ? nta : 0; | ||
| 209 | |||
| 210 | /* transfer page from old buffer to new buffer */ | ||
| 211 | new_buff->page = old_buff->page; | ||
| 212 | new_buff->page_dma = old_buff->page_dma; | ||
| 213 | new_buff->page_offset = old_buff->page_offset; | ||
| 214 | new_buff->pagecnt_bias = old_buff->pagecnt_bias; | ||
| 215 | } | ||
| 216 | |||
| 217 | static void wx_dma_sync_frag(struct wx_ring *rx_ring, | 163 | static void wx_dma_sync_frag(struct wx_ring *rx_ring, |
| 218 | struct wx_rx_buffer *rx_buffer) | 164 | struct wx_rx_buffer *rx_buffer) |
| 219 | { | 165 | { |
| @@ -270,8 +216,6 @@ static struct wx_rx_buffer *wx_get_rx_buffer(struct wx_ring *rx_ring, · 50 unmodified lines | |||
| 270 | size, | 216 | size, |
| 271 | DMA_FROM_DEVICE); | 217 | DMA_FROM_DEVICE); |
| 272 | skip_sync: | 218 | skip_sync: |
| 273 | rx_buffer->pagecnt_bias--; | ||
| 274 | |||
| 275 | return rx_buffer; | 219 | return rx_buffer; |
| 276 | } | 220 | } |
| 277 | 221 | ||
| @@ -280,19 +224,9 @@ static void wx_put_rx_buffer(struct wx_ring *rx_ring, · 2 unmodified lines | |||
| 280 | struct sk_buff *skb, | 224 | struct sk_buff *skb, |
| 281 | int rx_buffer_pgcnt) | 225 | int rx_buffer_pgcnt) |
| 282 | { | 226 | { |
| 283 | if (wx_can_reuse_rx_page(rx_buffer, rx_buffer_pgcnt)) { | 227 | if (!IS_ERR(skb) && WX_CB(skb)->dma == rx_buffer->dma) |
| 284 | /* hand second half of page back to the ring */ | 228 | /* the page has been released from the ring */ |
| 285 | wx_reuse_rx_page(rx_ring, rx_buffer); | 229 | WX_CB(skb)->page_released = true; |
| 286 | } else { | ||
| 287 | if (!IS_ERR(skb) && WX_CB(skb)->dma == rx_buffer->dma) | ||
| 288 | /* the page has been released from the ring */ | ||
| 289 | WX_CB(skb)->page_released = true; | ||
| 290 | else | ||
| 291 | page_pool_put_full_page(rx_ring->page_pool, rx_buffer->page, false); | ||
| 292 | |||
| 293 | __page_frag_cache_drain(rx_buffer->page, | ||
| 294 | rx_buffer->pagecnt_bias); | ||
| 295 | } | ||
| 296 | 230 | ||
| 297 | /* clear contents of rx_buffer */ | 231 | /* clear contents of rx_buffer */ |
| 298 | rx_buffer->page = NULL; | 232 | rx_buffer->page = NULL; |
| @@ -335,11 +269,12 @@ static struct sk_buff *wx_build_skb(struct wx_ring *rx_ring, · 36 unmodified lines | |||
| 335 | if (size <= WX_RXBUFFER_256) { | 269 | if (size <= WX_RXBUFFER_256) { |
| 336 | memcpy(__skb_put(skb, size), page_addr, | 270 | memcpy(__skb_put(skb, size), page_addr, |
| 337 | ALIGN(size, sizeof(long))); | 271 | ALIGN(size, sizeof(long))); |
| 338 | rx_buffer->pagecnt_bias++; | 272 | page_pool_put_full_page(rx_ring->page_pool, rx_buffer->page, true); |
| 339 | |||
| 340 | return skb; | 273 | return skb; |
| 341 | } | 274 | } |
| 342 | 275 | ||
| 276 | skb_mark_for_recycle(skb); | ||
| 277 | |||
| 343 | if (!wx_test_staterr(rx_desc, WX_RXD_STAT_EOP)) | 278 | if (!wx_test_staterr(rx_desc, WX_RXD_STAT_EOP)) |
| 344 | WX_CB(skb)->dma = rx_buffer->dma; | 279 | WX_CB(skb)->dma = rx_buffer->dma; |
| 345 | 280 | ||
| @@ -382,8 +317,6 @@ static bool wx_alloc_mapped_page(struct wx_ring *rx_ring, · 36 unmodified lines | |||
| 382 | bi->page_dma = dma; | 317 | bi->page_dma = dma; |
| 383 | bi->page = page; | 318 | bi->page = page; |
| 384 | bi->page_offset = 0; | 319 | bi->page_offset = 0; |
| 385 | page_ref_add(page, USHRT_MAX - 1); | ||
| 386 | bi->pagecnt_bias = USHRT_MAX; | ||
| 387 | 320 | ||
| 388 | return true; | 321 | return true; |
| 389 | } | 322 | } |
| @@ -723,7 +656,6 @@ static int wx_clean_rx_irq(struct wx_q_vector *q_vector, · 333 unmodified lines | |||
| 723 | /* exit if we failed to retrieve a buffer */ | 656 | /* exit if we failed to retrieve a buffer */ |
| 724 | if (!skb) { | 657 | if (!skb) { |
| 725 | rx_ring->rx_stats.alloc_rx_buff_failed++; | 658 | rx_ring->rx_stats.alloc_rx_buff_failed++; |
| 726 | rx_buffer->pagecnt_bias++; | ||
| 727 | break; | 659 | break; |
| 728 | } | 660 | } |
| 729 | 661 | ||
| @@ -2248,8 +2180,6 @@ static void wx_clean_rx_ring(struct wx_ring *rx_ring) · 1518 unmodified lines | |||
| 2248 | 2180 | ||
| 2249 | /* free resources associated with mapping */ | 2181 | /* free resources associated with mapping */ |
| 2250 | page_pool_put_full_page(rx_ring->page_pool, rx_buffer->page, false); | 2182 | page_pool_put_full_page(rx_ring->page_pool, rx_buffer->page, false); |
| 2251 | __page_frag_cache_drain(rx_buffer->page, | ||
| 2252 | rx_buffer->pagecnt_bias); | ||
| 2253 | 2183 | ||
| 2254 | i++; | 2184 | i++; |
| 2255 | rx_buffer++; | 2185 | rx_buffer++; |
| @@ -787,7 +787,6 @@ struct wx_rx_buffer { · 786 unmodified lines | |||
| 787 | dma_addr_t page_dma; | 787 | dma_addr_t page_dma; |
| 788 | struct page *page; | 788 | struct page *page; |
| 789 | unsigned int page_offset; | 789 | unsigned int page_offset; |
| 790 | u16 pagecnt_bias; | ||
| 791 | }; | 790 | }; |
| 792 | 791 | ||
| 793 | struct wx_queue_stats { | 792 | struct wx_queue_stats { |
| @@ -1548,7 +1548,8 @@ int phy_attach_direct(struct net_device *dev, struct phy_device *phydev, · 1547 unmodified lines | |||
| 1548 | goto error; | 1548 | goto error; |
| 1549 | 1549 | ||
| 1550 | phy_resume(phydev); | 1550 | phy_resume(phydev); |
| 1551 | phy_led_triggers_register(phydev); | 1551 | if (!phydev->is_on_sfp_module) |
| 1552 | phy_led_triggers_register(phydev); | ||
| 1552 | 1553 | ||
| 1553 | /** | 1554 | /** |
| 1554 | * If the external phy used by current mac interface is managed by | 1555 | * If the external phy used by current mac interface is managed by |
| @@ -1817,7 +1818,8 @@ void phy_detach(struct phy_device *phydev) · 262 unmodified lines | |||
| 1817 | } | 1818 | } |
| 1818 | phydev->phylink = NULL; | 1819 | phydev->phylink = NULL; |
| 1819 | 1820 | ||
| 1820 | phy_led_triggers_unregister(phydev); | 1821 | if (!phydev->is_on_sfp_module) |
| 1822 | phy_led_triggers_unregister(phydev); | ||
| 1821 | 1823 | ||
| 1822 | if (phydev->mdio.dev.driver) | 1824 | if (phydev->mdio.dev.driver) |
| 1823 | module_put(phydev->mdio.dev.driver->owner); | 1825 | module_put(phydev->mdio.dev.driver->owner); |
| @@ -1385,7 +1385,7 @@ static void iwl_pcie_rx_handle_rb(struct iwl_trans *trans, · 1384 unmodified lines | |||
| 1385 | * if it is true then one of the handlers took the page. | 1385 | * if it is true then one of the handlers took the page. |
| 1386 | */ | 1386 | */ |
| 1387 | 1387 | ||
| 1388 | if (reclaim) { | 1388 | if (reclaim && txq) { |
| 1389 | u16 sequence = le16_to_cpu(pkt->hdr.sequence); | 1389 | u16 sequence = le16_to_cpu(pkt->hdr.sequence); |
| 1390 | int index = SEQ_TO_INDEX(sequence); | 1390 | int index = SEQ_TO_INDEX(sequence); |
| 1391 | int cmd_index = iwl_txq_get_cmd_index(txq, index); | 1391 | int cmd_index = iwl_txq_get_cmd_index(txq, index); |
| @@ -3106,7 +3106,7 @@ static u32 iwl_trans_pcie_dump_rbs(struct iwl_trans *trans, · 3105 unmodified lines | |||
| 3106 | struct iwl_rxq *rxq = &trans_pcie->rxq[0]; | 3106 | struct iwl_rxq *rxq = &trans_pcie->rxq[0]; |
| 3107 | u32 i, r, j, rb_len = 0; | 3107 | u32 i, r, j, rb_len = 0; |
| 3108 | 3108 | ||
| 3109 | spin_lock(&rxq->lock); | 3109 | spin_lock_bh(&rxq->lock); |
| 3110 | 3110 | ||
| 3111 | r = iwl_get_closed_rb_stts(trans, rxq); | 3111 | r = iwl_get_closed_rb_stts(trans, rxq); |
| 3112 | 3112 | ||
| @@ -3130,7 +3130,7 @@ static u32 iwl_trans_pcie_dump_rbs(struct iwl_trans *trans, · 17 unmodified lines | |||
| 3130 | *data = iwl_fw_error_next_data(*data); | 3130 | *data = iwl_fw_error_next_data(*data); |
| 3131 | } | 3131 | } |
| 3132 | 3132 | ||
| 3133 | spin_unlock(&rxq->lock); | 3133 | spin_unlock_bh(&rxq->lock); |
| 3134 | 3134 | ||
| 3135 | return rb_len; | 3135 | return rb_len; |
| 3136 | } | 3136 | } |
| @@ -783,7 +783,7 @@ mt76_dma_rx_reset(struct mt76_dev *dev, enum mt76_rxq_id qid) · 782 unmodified lines | |||
| 783 | 783 | ||
| 784 | static void | 784 | static void |
| 785 | mt76_add_fragment(struct mt76_dev *dev, struct mt76_queue *q, void *data, | 785 | mt76_add_fragment(struct mt76_dev *dev, struct mt76_queue *q, void *data, |
| 786 | int len, bool more, u32 info) | 786 | int len, bool more, u32 info, bool allow_direct) |
| 787 | { | 787 | { |
| 788 | struct sk_buff *skb = q->rx_head; | 788 | struct sk_buff *skb = q->rx_head; |
| 789 | struct skb_shared_info *shinfo = skb_shinfo(skb); | 789 | struct skb_shared_info *shinfo = skb_shinfo(skb); |
| @@ -795,7 +795,7 @@ mt76_add_fragment(struct mt76_dev *dev, struct mt76_queue *q, void *data, · 5 unmodified lines | |||
| 795 | 795 | ||
| 796 | skb_add_rx_frag(skb, nr_frags, page, offset, len, q->buf_size); | 796 | skb_add_rx_frag(skb, nr_frags, page, offset, len, q->buf_size); |
| 797 | } else { | 797 | } else { |
| 798 | mt76_put_page_pool_buf(data, true); | 798 | mt76_put_page_pool_buf(data, allow_direct); |
| 799 | } | 799 | } |
| 800 | 800 | ||
| 801 | if (more) | 801 | if (more) |
| @@ -815,6 +815,7 @@ mt76_dma_rx_process(struct mt76_dev *dev, struct mt76_queue *q, int budget) · 13 unmodified lines | |||
| 815 | struct sk_buff *skb; | 815 | struct sk_buff *skb; |
| 816 | unsigned char *data; | 816 | unsigned char *data; |
| 817 | bool check_ddone = false; | 817 | bool check_ddone = false; |
| 818 | bool allow_direct = !mt76_queue_is_wed_rx(q); | ||
| 818 | bool more; | 819 | bool more; |
| 819 | 820 | ||
| 820 | if (IS_ENABLED(CONFIG_NET_MEDIATEK_SOC_WED) && | 821 | if (IS_ENABLED(CONFIG_NET_MEDIATEK_SOC_WED) && |
| @@ -855,7 +856,8 @@ mt76_dma_rx_process(struct mt76_dev *dev, struct mt76_queue *q, int budget) · 34 unmodified lines | |||
| 855 | } | 856 | } |
| 856 | 857 | ||
| 857 | if (q->rx_head) { | 858 | if (q->rx_head) { |
| 858 | mt76_add_fragment(dev, q, data, len, more, info); | 859 | mt76_add_fragment(dev, q, data, len, more, info, |
| 860 | allow_direct); | ||
| 859 | continue; | 861 | continue; |
| 860 | } | 862 | } |
| 861 | 863 | ||
| @@ -884,7 +886,7 @@ mt76_dma_rx_process(struct mt76_dev *dev, struct mt76_queue *q, int budget) · 22 unmodified lines | |||
| 884 | continue; | 886 | continue; |
| 885 | 887 | ||
| 886 | free_frag: | 888 | free_frag: |
| 887 | mt76_put_page_pool_buf(data, true); | 889 | mt76_put_page_pool_buf(data, allow_direct); |
| 888 | } | 890 | } |
| 889 | 891 | ||
| 890 | mt76_dma_rx_fill(dev, q, true); | 892 | mt76_dma_rx_fill(dev, q, true); |
| @@ -142,9 +142,13 @@ BPF_LINK_TYPE(BPF_LINK_TYPE_ITER, iter) · 141 unmodified lines | |||
| 142 | #ifdef CONFIG_NET | 142 | #ifdef CONFIG_NET |
| 143 | BPF_LINK_TYPE(BPF_LINK_TYPE_NETNS, netns) | 143 | BPF_LINK_TYPE(BPF_LINK_TYPE_NETNS, netns) |
| 144 | BPF_LINK_TYPE(BPF_LINK_TYPE_XDP, xdp) | 144 | BPF_LINK_TYPE(BPF_LINK_TYPE_XDP, xdp) |
| 145 | BPF_LINK_TYPE(BPF_LINK_TYPE_NETFILTER, netfilter) | ||
| 146 | BPF_LINK_TYPE(BPF_LINK_TYPE_TCX, tcx) | ||
| 147 | BPF_LINK_TYPE(BPF_LINK_TYPE_NETKIT, netkit) | ||
| 145 | #endif | 148 | #endif |
| 146 | #ifdef CONFIG_PERF_EVENTS | 149 | #ifdef CONFIG_PERF_EVENTS |
| 147 | BPF_LINK_TYPE(BPF_LINK_TYPE_PERF_EVENT, perf) | 150 | BPF_LINK_TYPE(BPF_LINK_TYPE_PERF_EVENT, perf) |
| 148 | #endif | 151 | #endif |
| 149 | BPF_LINK_TYPE(BPF_LINK_TYPE_KPROBE_MULTI, kprobe_multi) | 152 | BPF_LINK_TYPE(BPF_LINK_TYPE_KPROBE_MULTI, kprobe_multi) |
| 150 | BPF_LINK_TYPE(BPF_LINK_TYPE_STRUCT_OPS, struct_ops) | 153 | BPF_LINK_TYPE(BPF_LINK_TYPE_STRUCT_OPS, struct_ops) |
| 154 | BPF_LINK_TYPE(BPF_LINK_TYPE_UPROBE_MULTI, uprobe_multi) | ||
| @@ -4447,7 +4447,8 @@ ieee80211_is_protected_dual_of_public_action(struct sk_buff *skb) · 4446 unmodified lines | |||
| 4447 | action != WLAN_PUB_ACTION_LOC_TRACK_NOTI && | 4447 | action != WLAN_PUB_ACTION_LOC_TRACK_NOTI && |
| 4448 | action != WLAN_PUB_ACTION_FTM_REQUEST && | 4448 | action != WLAN_PUB_ACTION_FTM_REQUEST && |
| 4449 | action != WLAN_PUB_ACTION_FTM_RESPONSE && | 4449 | action != WLAN_PUB_ACTION_FTM_RESPONSE && |
| 4450 | action != WLAN_PUB_ACTION_FILS_DISCOVERY; | 4450 | action != WLAN_PUB_ACTION_FILS_DISCOVERY && |
| 4451 | action != WLAN_PUB_ACTION_VENDOR_SPECIFIC; | ||
| 4451 | } | 4452 | } |
| 4452 | 4453 | ||
| 4453 | /** | 4454 | /** |
| @@ -189,6 +189,7 @@ struct blocked_key { · 188 unmodified lines | |||
| 189 | struct smp_csrk { | 189 | struct smp_csrk { |
| 190 | bdaddr_t bdaddr; | 190 | bdaddr_t bdaddr; |
| 191 | u8 bdaddr_type; | 191 | u8 bdaddr_type; |
| 192 | u8 link_type; | ||
| 192 | u8 type; | 193 | u8 type; |
| 193 | u8 val[16]; | 194 | u8 val[16]; |
| 194 | }; | 195 | }; |
| @@ -198,6 +199,7 @@ struct smp_ltk { · 3 unmodified lines | |||
| 198 | struct rcu_head rcu; | 199 | struct rcu_head rcu; |
| 199 | bdaddr_t bdaddr; | 200 | bdaddr_t bdaddr; |
| 200 | u8 bdaddr_type; | 201 | u8 bdaddr_type; |
| 202 | u8 link_type; | ||
| 201 | u8 authenticated; | 203 | u8 authenticated; |
| 202 | u8 type; | 204 | u8 type; |
| 203 | u8 enc_size; | 205 | u8 enc_size; |
| @@ -212,6 +214,7 @@ struct smp_irk { · 8 unmodified lines | |||
| 212 | bdaddr_t rpa; | 214 | bdaddr_t rpa; |
| 213 | bdaddr_t bdaddr; | 215 | bdaddr_t bdaddr; |
| 214 | u8 addr_type; | 216 | u8 addr_type; |
| 217 | u8 link_type; | ||
| 215 | u8 val[16]; | 218 | u8 val[16]; |
| 216 | }; | 219 | }; |
| 217 | 220 | ||
| @@ -219,6 +222,8 @@ struct link_key { · 1 unmodified line | |||
| 219 | struct list_head list; | 222 | struct list_head list; |
| 220 | struct rcu_head rcu; | 223 | struct rcu_head rcu; |
| 221 | bdaddr_t bdaddr; | 224 | bdaddr_t bdaddr; |
| 225 | u8 bdaddr_type; | ||
| 226 | u8 link_type; | ||
| 222 | u8 type; | 227 | u8 type; |
| 223 | u8 val[HCI_LINK_KEY_SIZE]; | 228 | u8 val[HCI_LINK_KEY_SIZE]; |
| 224 | u8 pin_len; | 229 | u8 pin_len; |
| @@ -1227,11 +1232,11 @@ static inline struct hci_conn *hci_conn_hash_lookup_cis(struct hci_dev *hdev, · 1002 unmodified lines | |||
| 1227 | continue; | 1232 | continue; |
| 1228 | 1233 | ||
| 1229 | /* Match CIG ID if set */ | 1234 | /* Match CIG ID if set */ |
| 1230 | if (cig != BT_ISO_QOS_CIG_UNSET && cig != c->iso_qos.ucast.cig) | 1235 | if (cig != c->iso_qos.ucast.cig) |
| 1231 | continue; | 1236 | continue; |
| 1232 | 1237 | ||
| 1233 | /* Match CIS ID if set */ | 1238 | /* Match CIS ID if set */ |
| 1234 | if (id != BT_ISO_QOS_CIS_UNSET && id != c->iso_qos.ucast.cis) | 1239 | if (id != c->iso_qos.ucast.cis) |
| 1235 | continue; | 1240 | continue; |
| 1236 | 1241 | ||
| 1237 | /* Match destination address if set */ | 1242 | /* Match destination address if set */ |
| @@ -179,9 +179,6 @@ struct fib6_info { · 178 unmodified lines | |||
| 179 | 179 | ||
| 180 | refcount_t fib6_ref; | 180 | refcount_t fib6_ref; |
| 181 | unsigned long expires; | 181 | unsigned long expires; |
| 182 | |||
| 183 | struct hlist_node gc_link; | ||
| 184 | |||
| 185 | struct dst_metrics *fib6_metrics; | 182 | struct dst_metrics *fib6_metrics; |
| 186 | #define fib6_pmtu fib6_metrics->metrics[RTAX_MTU-1] | 183 | #define fib6_pmtu fib6_metrics->metrics[RTAX_MTU-1] |
| 187 | 184 | ||
| @@ -250,6 +247,19 @@ static inline bool fib6_requires_src(const struct fib6_info *rt) · 62 unmodified lines | |||
| 250 | return rt->fib6_src.plen > 0; | 247 | return rt->fib6_src.plen > 0; |
| 251 | } | 248 | } |
| 252 | 249 | ||
| 250 | static inline void fib6_clean_expires(struct fib6_info *f6i) | ||
| 251 | { | ||
| 252 | f6i->fib6_flags &= ~RTF_EXPIRES; | ||
| 253 | f6i->expires = 0; | ||
| 254 | } | ||
| 255 | |||
| 256 | static inline void fib6_set_expires(struct fib6_info *f6i, | ||
| 257 | unsigned long expires) | ||
| 258 | { | ||
| 259 | f6i->expires = expires; | ||
| 260 | f6i->fib6_flags |= RTF_EXPIRES; | ||
| 261 | } | ||
| 262 | |||
| 253 | static inline bool fib6_check_expired(const struct fib6_info *f6i) | 263 | static inline bool fib6_check_expired(const struct fib6_info *f6i) |
| 254 | { | 264 | { |
| 255 | if (f6i->fib6_flags & RTF_EXPIRES) | 265 | if (f6i->fib6_flags & RTF_EXPIRES) |
| @@ -257,11 +267,6 @@ static inline bool fib6_check_expired(const struct fib6_info *f6i) · 1 unmodified line | |||
| 257 | return false; | 267 | return false; |
| 258 | } | 268 | } |
| 259 | 269 | ||
| 260 | static inline bool fib6_has_expires(const struct fib6_info *f6i) | ||
| 261 | { | ||
| 262 | return f6i->fib6_flags & RTF_EXPIRES; | ||
| 263 | } | ||
| 264 | |||
| 265 | /* Function to safely get fn->fn_sernum for passed in rt | 270 | /* Function to safely get fn->fn_sernum for passed in rt |
| 266 | * and store result in passed in cookie. | 271 | * and store result in passed in cookie. |
| 267 | * Return true if we can get cookie safely | 272 | * Return true if we can get cookie safely |
| @@ -383,7 +388,6 @@ struct fib6_table { · 115 unmodified lines | |||
| 383 | struct inet_peer_base tb6_peers; | 388 | struct inet_peer_base tb6_peers; |
| 384 | unsigned int flags; | 389 | unsigned int flags; |
| 385 | unsigned int fib_seq; | 390 | unsigned int fib_seq; |
| 386 | struct hlist_head tb6_gc_hlist; /* GC candidates */ | ||
| 387 | #define RT6_TABLE_HAS_DFLT_ROUTER BIT(0) | 391 | #define RT6_TABLE_HAS_DFLT_ROUTER BIT(0) |
| 388 | }; | 392 | }; |
| 389 | 393 | ||
| @@ -500,48 +504,6 @@ void fib6_gc_cleanup(void); · 110 unmodified lines | |||
| 500 | 504 | ||
| 501 | int fib6_init(void); | 505 | int fib6_init(void); |
| 502 | 506 | ||
| 503 | /* fib6_info must be locked by the caller, and fib6_info->fib6_table can be | ||
| 504 | * NULL. | ||
| 505 | */ | ||
| 506 | static inline void fib6_set_expires_locked(struct fib6_info *f6i, | ||
| 507 | unsigned long expires) | ||
| 508 | { | ||
| 509 | struct fib6_table *tb6; | ||
| 510 | |||
| 511 | tb6 = f6i->fib6_table; | ||
| 512 | f6i->expires = expires; | ||
| 513 | if (tb6 && !fib6_has_expires(f6i)) | ||
| 514 | hlist_add_head(&f6i->gc_link, &tb6->tb6_gc_hlist); | ||
| 515 | f6i->fib6_flags |= RTF_EXPIRES; | ||
| 516 | } | ||
| 517 | |||
| 518 | /* fib6_info must be locked by the caller, and fib6_info->fib6_table can be | ||
| 519 | * NULL. If fib6_table is NULL, the fib6_info will no be inserted into the | ||
| 520 | * list of GC candidates until it is inserted into a table. | ||
| 521 | */ | ||
| 522 | static inline void fib6_set_expires(struct fib6_info *f6i, | ||
| 523 | unsigned long expires) | ||
| 524 | { | ||
| 525 | spin_lock_bh(&f6i->fib6_table->tb6_lock); | ||
| 526 | fib6_set_expires_locked(f6i, expires); | ||
| 527 | spin_unlock_bh(&f6i->fib6_table->tb6_lock); | ||
| 528 | } | ||
| 529 | |||
| 530 | static inline void fib6_clean_expires_locked(struct fib6_info *f6i) | ||
| 531 | { | ||
| 532 | if (fib6_has_expires(f6i)) | ||
| 533 | hlist_del_init(&f6i->gc_link); | ||
| 534 | f6i->fib6_flags &= ~RTF_EXPIRES; | ||
| 535 | f6i->expires = 0; | ||
| 536 | } | ||
| 537 | |||
| 538 | static inline void fib6_clean_expires(struct fib6_info *f6i) | ||
| 539 | { | ||
| 540 | spin_lock_bh(&f6i->fib6_table->tb6_lock); | ||
| 541 | fib6_clean_expires_locked(f6i); | ||
| 542 | spin_unlock_bh(&f6i->fib6_table->tb6_lock); | ||
| 543 | } | ||
| 544 | |||
| 545 | struct ipv6_route_iter { | 507 | struct ipv6_route_iter { |
| 546 | struct seq_net_private p; | 508 | struct seq_net_private p; |
| 547 | struct fib6_walker w; | 509 | struct fib6_walker w; |
| @@ -2799,6 +2799,11 @@ static inline bool sk_is_tcp(const struct sock *sk) · 2798 unmodified lines | |||
| 2799 | return sk->sk_type == SOCK_STREAM && sk->sk_protocol == IPPROTO_TCP; | 2799 | return sk->sk_type == SOCK_STREAM && sk->sk_protocol == IPPROTO_TCP; |
| 2800 | } | 2800 | } |
| 2801 | 2801 | ||
| 2802 | static inline bool sk_is_stream_unix(const struct sock *sk) | ||
| 2803 | { | ||
| 2804 | return sk->sk_family == AF_UNIX && sk->sk_type == SOCK_STREAM; | ||
| 2805 | } | ||
| 2806 | |||
| 2802 | /** | 2807 | /** |
| 2803 | * sk_eat_skb - Release a skb if it is no longer needed | 2808 | * sk_eat_skb - Release a skb if it is no longer needed |
| 2804 | * @sk: socket to eat this skb from | 2809 | * @sk: socket to eat this skb from |
| @@ -407,6 +407,8 @@ int vlan_vids_add_by_dev(struct net_device *dev, · 406 unmodified lines | |||
| 407 | return 0; | 407 | return 0; |
| 408 | 408 | ||
| 409 | list_for_each_entry(vid_info, &vlan_info->vid_list, list) { | 409 | list_for_each_entry(vid_info, &vlan_info->vid_list, list) { |
| 410 | if (!vlan_hw_filter_capable(by_dev, vid_info->proto)) | ||
| 411 | continue; | ||
| 410 | err = vlan_vid_add(dev, vid_info->proto, vid_info->vid); | 412 | err = vlan_vid_add(dev, vid_info->proto, vid_info->vid); |
| 411 | if (err) | 413 | if (err) |
| 412 | goto unwind; | 414 | goto unwind; |
| @@ -417,6 +419,8 @@ unwind: · 4 unmodified lines | |||
| 417 | list_for_each_entry_continue_reverse(vid_info, | 419 | list_for_each_entry_continue_reverse(vid_info, |
| 418 | &vlan_info->vid_list, | 420 | &vlan_info->vid_list, |
| 419 | list) { | 421 | list) { |
| 422 | if (!vlan_hw_filter_capable(by_dev, vid_info->proto)) | ||
| 423 | continue; | ||
| 420 | vlan_vid_del(dev, vid_info->proto, vid_info->vid); | 424 | vlan_vid_del(dev, vid_info->proto, vid_info->vid); |
| 421 | } | 425 | } |
| 422 | 426 | ||
| @@ -436,8 +440,11 @@ void vlan_vids_del_by_dev(struct net_device *dev, · 13 unmodified lines | |||
| 436 | if (!vlan_info) | 440 | if (!vlan_info) |
| 437 | return; | 441 | return; |
| 438 | 442 | ||
| 439 | list_for_each_entry(vid_info, &vlan_info->vid_list, list) | 443 | list_for_each_entry(vid_info, &vlan_info->vid_list, list) { |
| 444 | if (!vlan_hw_filter_capable(by_dev, vid_info->proto)) | ||
| 445 | continue; | ||
| 440 | vlan_vid_del(dev, vid_info->proto, vid_info->vid); | 446 | vlan_vid_del(dev, vid_info->proto, vid_info->vid); |
| 447 | } | ||
| 441 | } | 448 | } |
| 442 | EXPORT_SYMBOL(vlan_vids_del_by_dev); | 449 | EXPORT_SYMBOL(vlan_vids_del_by_dev); |
| 443 | 450 | ||
| @@ -309,11 +309,14 @@ int bt_sock_recvmsg(struct socket *sock, struct msghdr *msg, size_t len, · 308 unmodified lines | |||
| 309 | if (flags & MSG_OOB) | 309 | if (flags & MSG_OOB) |
| 310 | return -EOPNOTSUPP; | 310 | return -EOPNOTSUPP; |
| 311 | 311 | ||
| 312 | lock_sock(sk); | ||
| 313 | |||
| 312 | skb = skb_recv_datagram(sk, flags, &err); | 314 | skb = skb_recv_datagram(sk, flags, &err); |
| 313 | if (!skb) { | 315 | if (!skb) { |
| 314 | if (sk->sk_shutdown & RCV_SHUTDOWN) | 316 | if (sk->sk_shutdown & RCV_SHUTDOWN) |
| 315 | return 0; | 317 | err = 0; |
| 316 | 318 | ||
| 319 | release_sock(sk); | ||
| 317 | return err; | 320 | return err; |
| 318 | } | 321 | } |
| 319 | 322 | ||
| @@ -343,6 +346,8 @@ int bt_sock_recvmsg(struct socket *sock, struct msghdr *msg, size_t len, · 23 unmodified lines | |||
| 343 | 346 | ||
| 344 | skb_free_datagram(sk, skb); | 347 | skb_free_datagram(sk, skb); |
| 345 | 348 | ||
| 349 | release_sock(sk); | ||
| 350 | |||
| 346 | if (flags & MSG_TRUNC) | 351 | if (flags & MSG_TRUNC) |
| 347 | copied = skblen; | 352 | copied = skblen; |
| 348 | 353 | ||
| @@ -516,6 +516,9 @@ static u8 hci_cc_read_class_of_dev(struct hci_dev *hdev, void *data, · 515 unmodified lines | |||
| 516 | { | 516 | { |
| 517 | struct hci_rp_read_class_of_dev *rp = data; | 517 | struct hci_rp_read_class_of_dev *rp = data; |
| 518 | 518 | ||
| 519 | if (WARN_ON(!hdev)) | ||
| 520 | return HCI_ERROR_UNSPECIFIED; | ||
| 521 | |||
| 519 | bt_dev_dbg(hdev, "status 0x%2.2x", rp->status); | 522 | bt_dev_dbg(hdev, "status 0x%2.2x", rp->status); |
| 520 | 523 | ||
| 521 | if (rp->status) | 524 | if (rp->status) |
| @@ -747,9 +750,23 @@ static u8 hci_cc_read_enc_key_size(struct hci_dev *hdev, void *data, · 225 unmodified lines | |||
| 747 | } else { | 750 | } else { |
| 748 | conn->enc_key_size = rp->key_size; | 751 | conn->enc_key_size = rp->key_size; |
| 749 | status = 0; | 752 | status = 0; |
| 753 | |||
| 754 | if (conn->enc_key_size < hdev->min_enc_key_size) { | ||
| 755 | /* As slave role, the conn->state has been set to | ||
| 756 | * BT_CONNECTED and l2cap conn req might not be received | ||
| 757 | * yet, at this moment the l2cap layer almost does | ||
| 758 | * nothing with the non-zero status. | ||
| 759 | * So we also clear encrypt related bits, and then the | ||
| 760 | * handler of l2cap conn req will get the right secure | ||
| 761 | * state at a later time. | ||
| 762 | */ | ||
| 763 | status = HCI_ERROR_AUTH_FAILURE; | ||
| 764 | clear_bit(HCI_CONN_ENCRYPT, &conn->flags); | ||
| 765 | clear_bit(HCI_CONN_AES_CCM, &conn->flags); | ||
| 766 | } | ||
| 750 | } | 767 | } |
| 751 | 768 | ||
| 752 | hci_encrypt_cfm(conn, 0); | 769 | hci_encrypt_cfm(conn, status); |
| 753 | 770 | ||
| 754 | done: | 771 | done: |
| 755 | hci_dev_unlock(hdev); | 772 | hci_dev_unlock(hdev); |
| @@ -820,8 +837,6 @@ static u8 hci_cc_write_auth_payload_timeout(struct hci_dev *hdev, void *data, · 64 unmodified lines | |||
| 820 | if (!rp->status) | 837 | if (!rp->status) |
| 821 | conn->auth_payload_timeout = get_unaligned_le16(sent + 2); | 838 | conn->auth_payload_timeout = get_unaligned_le16(sent + 2); |
| 822 | 839 | ||
| 823 | hci_encrypt_cfm(conn, 0); | ||
| 824 | |||
| 825 | unlock: | 840 | unlock: |
| 826 | hci_dev_unlock(hdev); | 841 | hci_dev_unlock(hdev); |
| 827 | 842 | ||
| @@ -2304,7 +2319,8 @@ static void hci_cs_inquiry(struct hci_dev *hdev, __u8 status) · 1476 unmodified lines | |||
| 2304 | return; | 2319 | return; |
| 2305 | } | 2320 | } |
| 2306 | 2321 | ||
| 2307 | set_bit(HCI_INQUIRY, &hdev->flags); | 2322 | if (hci_sent_cmd_data(hdev, HCI_OP_INQUIRY)) |
| 2323 | set_bit(HCI_INQUIRY, &hdev->flags); | ||
| 2308 | } | 2324 | } |
| 2309 | 2325 | ||
| 2310 | static void hci_cs_create_conn(struct hci_dev *hdev, __u8 status) | 2326 | static void hci_cs_create_conn(struct hci_dev *hdev, __u8 status) |
| @@ -3683,12 +3699,8 @@ static void hci_encrypt_change_evt(struct hci_dev *hdev, void *data, · 1372 unmodified lines | |||
| 3683 | cp.handle = cpu_to_le16(conn->handle); | 3699 | cp.handle = cpu_to_le16(conn->handle); |
| 3684 | cp.timeout = cpu_to_le16(hdev->auth_payload_timeout); | 3700 | cp.timeout = cpu_to_le16(hdev->auth_payload_timeout); |
| 3685 | if (hci_send_cmd(conn->hdev, HCI_OP_WRITE_AUTH_PAYLOAD_TO, | 3701 | if (hci_send_cmd(conn->hdev, HCI_OP_WRITE_AUTH_PAYLOAD_TO, |
| 3686 | sizeof(cp), &cp)) { | 3702 | sizeof(cp), &cp)) |
| 3687 | bt_dev_err(hdev, "write auth payload timeout failed"); | 3703 | bt_dev_err(hdev, "write auth payload timeout failed"); |
| 3688 | goto notify; | ||
| 3689 | } | ||
| 3690 | |||
| 3691 | goto unlock; | ||
| 3692 | } | 3704 | } |
| 3693 | 3705 | ||
| 3694 | notify: | 3706 | notify: |
| @@ -6492,6 +6492,14 @@ drop: · 6491 unmodified lines | |||
| 6492 | kfree_skb(skb); | 6492 | kfree_skb(skb); |
| 6493 | } | 6493 | } |
| 6494 | 6494 | ||
| 6495 | static inline void l2cap_sig_send_rej(struct l2cap_conn *conn, u16 ident) | ||
| 6496 | { | ||
| 6497 | struct l2cap_cmd_rej_unk rej; | ||
| 6498 | |||
| 6499 | rej.reason = cpu_to_le16(L2CAP_REJ_NOT_UNDERSTOOD); | ||
| 6500 | l2cap_send_cmd(conn, ident, L2CAP_COMMAND_REJ, sizeof(rej), &rej); | ||
| 6501 | } | ||
| 6502 | |||
| 6495 | static inline void l2cap_sig_channel(struct l2cap_conn *conn, | 6503 | static inline void l2cap_sig_channel(struct l2cap_conn *conn, |
| 6496 | struct sk_buff *skb) | 6504 | struct sk_buff *skb) |
| 6497 | { | 6505 | { |
| @@ -6517,23 +6525,24 @@ static inline void l2cap_sig_channel(struct l2cap_conn *conn, · 19 unmodified lines | |||
| 6517 | 6525 | ||
| 6518 | if (len > skb->len || !cmd->ident) { | 6526 | if (len > skb->len || !cmd->ident) { |
| 6519 | BT_DBG("corrupted command"); | 6527 | BT_DBG("corrupted command"); |
| 6528 | l2cap_sig_send_rej(conn, cmd->ident); | ||
| 6520 | break; | 6529 | break; |
| 6521 | } | 6530 | } |
| 6522 | 6531 | ||
| 6523 | err = l2cap_bredr_sig_cmd(conn, cmd, len, skb->data); | 6532 | err = l2cap_bredr_sig_cmd(conn, cmd, len, skb->data); |
| 6524 | if (err) { | 6533 | if (err) { |
| 6525 | struct l2cap_cmd_rej_unk rej; | ||
| 6526 | |||
| 6527 | BT_ERR("Wrong link type (%d)", err); | 6534 | BT_ERR("Wrong link type (%d)", err); |
| 6528 | 6535 | l2cap_sig_send_rej(conn, cmd->ident); | |
| 6529 | rej.reason = cpu_to_le16(L2CAP_REJ_NOT_UNDERSTOOD); | ||
| 6530 | l2cap_send_cmd(conn, cmd->ident, L2CAP_COMMAND_REJ, | ||
| 6531 | sizeof(rej), &rej); | ||
| 6532 | } | 6536 | } |
| 6533 | 6537 | ||
| 6534 | skb_pull(skb, len); | 6538 | skb_pull(skb, len); |
| 6535 | } | 6539 | } |
| 6536 | 6540 | ||
| 6541 | if (skb->len > 0) { | ||
| 6542 | BT_DBG("corrupted command"); | ||
| 6543 | l2cap_sig_send_rej(conn, 0); | ||
| 6544 | } | ||
| 6545 | |||
| 6537 | drop: | 6546 | drop: |
| 6538 | kfree_skb(skb); | 6547 | kfree_skb(skb); |
| 6539 | } | 6548 | } |
| @@ -2897,7 +2897,8 @@ static int load_link_keys(struct sock *sk, struct hci_dev *hdev, void *data, · 2896 unmodified lines | |||
| 2897 | for (i = 0; i < key_count; i++) { | 2897 | for (i = 0; i < key_count; i++) { |
| 2898 | struct mgmt_link_key_info *key = &cp->keys[i]; | 2898 | struct mgmt_link_key_info *key = &cp->keys[i]; |
| 2899 | 2899 | ||
| 2900 | if (key->addr.type != BDADDR_BREDR || key->type > 0x08) | 2900 | /* Considering SMP over BREDR/LE, there is no need to check addr_type */ |
| 2901 | if (key->type > 0x08) | ||
| 2901 | return mgmt_cmd_status(sk, hdev->id, | 2902 | return mgmt_cmd_status(sk, hdev->id, |
| 2902 | MGMT_OP_LOAD_LINK_KEYS, | 2903 | MGMT_OP_LOAD_LINK_KEYS, |
| 2903 | MGMT_STATUS_INVALID_PARAMS); | 2904 | MGMT_STATUS_INVALID_PARAMS); |
| @@ -7130,6 +7131,7 @@ static int load_irks(struct sock *sk, struct hci_dev *hdev, void *cp_data, · 4226 unmodified lines | |||
| 7130 | 7131 | ||
| 7131 | for (i = 0; i < irk_count; i++) { | 7132 | for (i = 0; i < irk_count; i++) { |
| 7132 | struct mgmt_irk_info *irk = &cp->irks[i]; | 7133 | struct mgmt_irk_info *irk = &cp->irks[i]; |
| 7134 | u8 addr_type = le_addr_type(irk->addr.type); | ||
| 7133 | 7135 | ||
| 7134 | if (hci_is_blocked_key(hdev, | 7136 | if (hci_is_blocked_key(hdev, |
| 7135 | HCI_BLOCKED_KEY_TYPE_IRK, | 7137 | HCI_BLOCKED_KEY_TYPE_IRK, |
| @@ -7139,8 +7141,12 @@ static int load_irks(struct sock *sk, struct hci_dev *hdev, void *cp_data, · 3 unmodified lines | |||
| 7139 | continue; | 7141 | continue; |
| 7140 | } | 7142 | } |
| 7141 | 7143 | ||
| 7144 | /* When using SMP over BR/EDR, the addr type should be set to BREDR */ | ||
| 7145 | if (irk->addr.type == BDADDR_BREDR) | ||
| 7146 | addr_type = BDADDR_BREDR; | ||
| 7147 | |||
| 7142 | hci_add_irk(hdev, &irk->addr.bdaddr, | 7148 | hci_add_irk(hdev, &irk->addr.bdaddr, |
| 7143 | le_addr_type(irk->addr.type), irk->val, | 7149 | addr_type, irk->val, |
| 7144 | BDADDR_ANY); | 7150 | BDADDR_ANY); |
| 7145 | } | 7151 | } |
| 7146 | 7152 | ||
| @@ -7221,6 +7227,7 @@ static int load_long_term_keys(struct sock *sk, struct hci_dev *hdev, · 74 unmodified lines | |||
| 7221 | for (i = 0; i < key_count; i++) { | 7227 | for (i = 0; i < key_count; i++) { |
| 7222 | struct mgmt_ltk_info *key = &cp->keys[i]; | 7228 | struct mgmt_ltk_info *key = &cp->keys[i]; |
| 7223 | u8 type, authenticated; | 7229 | u8 type, authenticated; |
| 7230 | u8 addr_type = le_addr_type(key->addr.type); | ||
| 7224 | 7231 | ||
| 7225 | if (hci_is_blocked_key(hdev, | 7232 | if (hci_is_blocked_key(hdev, |
| 7226 | HCI_BLOCKED_KEY_TYPE_LTK, | 7233 | HCI_BLOCKED_KEY_TYPE_LTK, |
| @@ -7255,8 +7262,12 @@ static int load_long_term_keys(struct sock *sk, struct hci_dev *hdev, · 28 unmodified lines | |||
| 7255 | continue; | 7262 | continue; |
| 7256 | } | 7263 | } |
| 7257 | 7264 | ||
| 7265 | /* When using SMP over BR/EDR, the addr type should be set to BREDR */ | ||
| 7266 | if (key->addr.type == BDADDR_BREDR) | ||
| 7267 | addr_type = BDADDR_BREDR; | ||
| 7268 | |||
| 7258 | hci_add_ltk(hdev, &key->addr.bdaddr, | 7269 | hci_add_ltk(hdev, &key->addr.bdaddr, |
| 7259 | le_addr_type(key->addr.type), type, authenticated, | 7270 | addr_type, type, authenticated, |
| 7260 | key->val, key->enc_size, key->ediv, key->rand); | 7271 | key->val, key->enc_size, key->ediv, key->rand); |
| 7261 | } | 7272 | } |
| 7262 | 7273 | ||
| @@ -9523,7 +9534,7 @@ void mgmt_new_link_key(struct hci_dev *hdev, struct link_key *key, · 2260 unmodified lines | |||
| 9523 | 9534 | ||
| 9524 | ev.store_hint = persistent; | 9535 | ev.store_hint = persistent; |
| 9525 | bacpy(&ev.key.addr.bdaddr, &key->bdaddr); | 9536 | bacpy(&ev.key.addr.bdaddr, &key->bdaddr); |
| 9526 | ev.key.addr.type = BDADDR_BREDR; | 9537 | ev.key.addr.type = link_to_bdaddr(key->link_type, key->bdaddr_type); |
| 9527 | ev.key.type = key->type; | 9538 | ev.key.type = key->type; |
| 9528 | memcpy(ev.key.val, key->val, HCI_LINK_KEY_SIZE); | 9539 | memcpy(ev.key.val, key->val, HCI_LINK_KEY_SIZE); |
| 9529 | ev.key.pin_len = key->pin_len; | 9540 | ev.key.pin_len = key->pin_len; |
| @@ -9574,7 +9585,7 @@ void mgmt_new_ltk(struct hci_dev *hdev, struct smp_ltk *key, bool persistent) · 44 unmodified lines | |||
| 9574 | ev.store_hint = persistent; | 9585 | ev.store_hint = persistent; |
| 9575 | 9586 | ||
| 9576 | bacpy(&ev.key.addr.bdaddr, &key->bdaddr); | 9587 | bacpy(&ev.key.addr.bdaddr, &key->bdaddr); |
| 9577 | ev.key.addr.type = link_to_bdaddr(LE_LINK, key->bdaddr_type); | 9588 | ev.key.addr.type = link_to_bdaddr(key->link_type, key->bdaddr_type); |
| 9578 | ev.key.type = mgmt_ltk_type(key); | 9589 | ev.key.type = mgmt_ltk_type(key); |
| 9579 | ev.key.enc_size = key->enc_size; | 9590 | ev.key.enc_size = key->enc_size; |
| 9580 | ev.key.ediv = key->ediv; | 9591 | ev.key.ediv = key->ediv; |
| @@ -9603,7 +9614,7 @@ void mgmt_new_irk(struct hci_dev *hdev, struct smp_irk *irk, bool persistent) · 22 unmodified lines | |||
| 9603 | 9614 | ||
| 9604 | bacpy(&ev.rpa, &irk->rpa); | 9615 | bacpy(&ev.rpa, &irk->rpa); |
| 9605 | bacpy(&ev.irk.addr.bdaddr, &irk->bdaddr); | 9616 | bacpy(&ev.irk.addr.bdaddr, &irk->bdaddr); |
| 9606 | ev.irk.addr.type = link_to_bdaddr(LE_LINK, irk->addr_type); | 9617 | ev.irk.addr.type = link_to_bdaddr(irk->link_type, irk->addr_type); |
| 9607 | memcpy(ev.irk.val, irk->val, sizeof(irk->val)); | 9618 | memcpy(ev.irk.val, irk->val, sizeof(irk->val)); |
| 9608 | 9619 | ||
| 9609 | mgmt_event(MGMT_EV_NEW_IRK, hdev, &ev, sizeof(ev), NULL); | 9620 | mgmt_event(MGMT_EV_NEW_IRK, hdev, &ev, sizeof(ev), NULL); |
| @@ -9632,7 +9643,7 @@ void mgmt_new_csrk(struct hci_dev *hdev, struct smp_csrk *csrk, · 22 unmodified lines | |||
| 9632 | ev.store_hint = persistent; | 9643 | ev.store_hint = persistent; |
| 9633 | 9644 | ||
| 9634 | bacpy(&ev.key.addr.bdaddr, &csrk->bdaddr); | 9645 | bacpy(&ev.key.addr.bdaddr, &csrk->bdaddr); |
| 9635 | ev.key.addr.type = link_to_bdaddr(LE_LINK, csrk->bdaddr_type); | 9646 | ev.key.addr.type = link_to_bdaddr(csrk->link_type, csrk->bdaddr_type); |
| 9636 | ev.key.type = csrk->type; | 9647 | ev.key.type = csrk->type; |
| 9637 | memcpy(ev.key.val, csrk->val, sizeof(csrk->val)); | 9648 | memcpy(ev.key.val, csrk->val, sizeof(csrk->val)); |
| 9638 | 9649 | ||
| @@ -1059,6 +1059,7 @@ static void smp_notify_keys(struct l2cap_conn *conn) · 1058 unmodified lines | |||
| 1059 | } | 1059 | } |
| 1060 | 1060 | ||
| 1061 | if (smp->remote_irk) { | 1061 | if (smp->remote_irk) { |
| 1062 | smp->remote_irk->link_type = hcon->type; | ||
| 1062 | mgmt_new_irk(hdev, smp->remote_irk, persistent); | 1063 | mgmt_new_irk(hdev, smp->remote_irk, persistent); |
| 1063 | 1064 | ||
| 1064 | /* Now that user space can be considered to know the | 1065 | /* Now that user space can be considered to know the |
| @@ -1078,24 +1079,28 @@ static void smp_notify_keys(struct l2cap_conn *conn) · 13 unmodified lines | |||
| 1078 | } | 1079 | } |
| 1079 | 1080 | ||
| 1080 | if (smp->csrk) { | 1081 | if (smp->csrk) { |
| 1082 | smp->csrk->link_type = hcon->type; | ||
| 1081 | smp->csrk->bdaddr_type = hcon->dst_type; | 1083 | smp->csrk->bdaddr_type = hcon->dst_type; |
| 1082 | bacpy(&smp->csrk->bdaddr, &hcon->dst); | 1084 | bacpy(&smp->csrk->bdaddr, &hcon->dst); |
| 1083 | mgmt_new_csrk(hdev, smp->csrk, persistent); | 1085 | mgmt_new_csrk(hdev, smp->csrk, persistent); |
| 1084 | } | 1086 | } |
| 1085 | 1087 | ||
| 1086 | if (smp->responder_csrk) { | 1088 | if (smp->responder_csrk) { |
| 1089 | smp->responder_csrk->link_type = hcon->type; | ||
| 1087 | smp->responder_csrk->bdaddr_type = hcon->dst_type; | 1090 | smp->responder_csrk->bdaddr_type = hcon->dst_type; |
| 1088 | bacpy(&smp->responder_csrk->bdaddr, &hcon->dst); | 1091 | bacpy(&smp->responder_csrk->bdaddr, &hcon->dst); |
| 1089 | mgmt_new_csrk(hdev, smp->responder_csrk, persistent); | 1092 | mgmt_new_csrk(hdev, smp->responder_csrk, persistent); |
| 1090 | } | 1093 | } |
| 1091 | 1094 | ||
| 1092 | if (smp->ltk) { | 1095 | if (smp->ltk) { |
| 1096 | smp->ltk->link_type = hcon->type; | ||
| 1093 | smp->ltk->bdaddr_type = hcon->dst_type; | 1097 | smp->ltk->bdaddr_type = hcon->dst_type; |
| 1094 | bacpy(&smp->ltk->bdaddr, &hcon->dst); | 1098 | bacpy(&smp->ltk->bdaddr, &hcon->dst); |
| 1095 | mgmt_new_ltk(hdev, smp->ltk, persistent); | 1099 | mgmt_new_ltk(hdev, smp->ltk, persistent); |
| 1096 | } | 1100 | } |
| 1097 | 1101 | ||
| 1098 | if (smp->responder_ltk) { | 1102 | if (smp->responder_ltk) { |
| 1103 | smp->responder_ltk->link_type = hcon->type; | ||
| 1099 | smp->responder_ltk->bdaddr_type = hcon->dst_type; | 1104 | smp->responder_ltk->bdaddr_type = hcon->dst_type; |
| 1100 | bacpy(&smp->responder_ltk->bdaddr, &hcon->dst); | 1105 | bacpy(&smp->responder_ltk->bdaddr, &hcon->dst); |
| 1101 | mgmt_new_ltk(hdev, smp->responder_ltk, persistent); | 1106 | mgmt_new_ltk(hdev, smp->responder_ltk, persistent); |
| @@ -1115,6 +1120,8 @@ static void smp_notify_keys(struct l2cap_conn *conn) · 13 unmodified lines | |||
| 1115 | key = hci_add_link_key(hdev, smp->conn->hcon, &hcon->dst, | 1120 | key = hci_add_link_key(hdev, smp->conn->hcon, &hcon->dst, |
| 1116 | smp->link_key, type, 0, &persistent); | 1121 | smp->link_key, type, 0, &persistent); |
| 1117 | if (key) { | 1122 | if (key) { |
| 1123 | key->link_type = hcon->type; | ||
| 1124 | key->bdaddr_type = hcon->dst_type; | ||
| 1118 | mgmt_new_link_key(hdev, key, persistent); | 1125 | mgmt_new_link_key(hdev, key, persistent); |
| 1119 | 1126 | ||
| 1120 | /* Don't keep debug keys around if the relevant | 1127 | /* Don't keep debug keys around if the relevant |
| @@ -3472,6 +3472,9 @@ static netdev_features_t gso_features_check(const struct sk_buff *skb, · 3471 unmodified lines | |||
| 3472 | if (gso_segs > READ_ONCE(dev->gso_max_segs)) | 3472 | if (gso_segs > READ_ONCE(dev->gso_max_segs)) |
| 3473 | return features & ~NETIF_F_GSO_MASK; | 3473 | return features & ~NETIF_F_GSO_MASK; |
| 3474 | 3474 | ||
| 3475 | if (unlikely(skb->len >= READ_ONCE(dev->gso_max_size))) | ||
| 3476 | return features & ~NETIF_F_GSO_MASK; | ||
| 3477 | |||
| 3475 | if (!skb_shinfo(skb)->gso_type) { | 3478 | if (!skb_shinfo(skb)->gso_type) { |
| 3476 | skb_warn_bad_offload(skb); | 3479 | skb_warn_bad_offload(skb); |
| 3477 | return features & ~NETIF_F_GSO_MASK; | 3480 | return features & ~NETIF_F_GSO_MASK; |
| @@ -4825,7 +4825,9 @@ static __always_inline unsigned int skb_ext_total_length(void) · 4824 unmodified lines | |||
| 4825 | static void skb_extensions_init(void) | 4825 | static void skb_extensions_init(void) |
| 4826 | { | 4826 | { |
| 4827 | BUILD_BUG_ON(SKB_EXT_NUM >= 8); | 4827 | BUILD_BUG_ON(SKB_EXT_NUM >= 8); |
| 4828 | #if !IS_ENABLED(CONFIG_KCOV_INSTRUMENT_ALL) | ||
| 4828 | BUILD_BUG_ON(skb_ext_total_length() > 255); | 4829 | BUILD_BUG_ON(skb_ext_total_length() > 255); |
| 4830 | #endif | ||
| 4829 | 4831 | ||
| 4830 | skbuff_ext_cache = kmem_cache_create("skbuff_ext_cache", | 4832 | skbuff_ext_cache = kmem_cache_create("skbuff_ext_cache", |
| 4831 | SKB_EXT_ALIGN_VALUE * skb_ext_total_length(), | 4833 | SKB_EXT_ALIGN_VALUE * skb_ext_total_length(), |
| @@ -536,6 +536,8 @@ static bool sock_map_sk_state_allowed(const struct sock *sk) · 535 unmodified lines | |||
| 536 | { | 536 | { |
| 537 | if (sk_is_tcp(sk)) | 537 | if (sk_is_tcp(sk)) |
| 538 | return (1 << sk->sk_state) & (TCPF_ESTABLISHED | TCPF_LISTEN); | 538 | return (1 << sk->sk_state) & (TCPF_ESTABLISHED | TCPF_LISTEN); |
| 539 | if (sk_is_stream_unix(sk)) | ||
| 540 | return (1 << sk->sk_state) & TCPF_ESTABLISHED; | ||
| 539 | return true; | 541 | return true; |
| 540 | } | 542 | } |
| 541 | 543 | ||
| @@ -79,7 +79,7 @@ int sk_stream_wait_connect(struct sock *sk, long *timeo_p) · 78 unmodified lines | |||
| 79 | remove_wait_queue(sk_sleep(sk), &wait); | 79 | remove_wait_queue(sk_sleep(sk), &wait); |
| 80 | sk->sk_write_pending--; | 80 | sk->sk_write_pending--; |
| 81 | } while (!done); | 81 | } while (!done); |
| 82 | return 0; | 82 | return done < 0 ? done : 0; |
| 83 | } | 83 | } |
| 84 | EXPORT_SYMBOL(sk_stream_wait_connect); | 84 | EXPORT_SYMBOL(sk_stream_wait_connect); |
| 85 | 85 | ||
| @@ -82,6 +82,7 @@ void *ife_decode(struct sk_buff *skb, u16 *metalen) · 81 unmodified lines | |||
| 82 | if (unlikely(!pskb_may_pull(skb, total_pull))) | 82 | if (unlikely(!pskb_may_pull(skb, total_pull))) |
| 83 | return NULL; | 83 | return NULL; |
| 84 | 84 | ||
| 85 | ifehdr = (struct ifeheadr *)(skb->data + skb->dev->hard_header_len); | ||
| 85 | skb_set_mac_header(skb, total_pull); | 86 | skb_set_mac_header(skb, total_pull); |
| 86 | __skb_pull(skb, total_pull); | 87 | __skb_pull(skb, total_pull); |
| 87 | *metalen = ifehdrln - IFE_METAHDRLEN; | 88 | *metalen = ifehdrln - IFE_METAHDRLEN; |
| @@ -160,8 +160,6 @@ struct fib6_info *fib6_info_alloc(gfp_t gfp_flags, bool with_fib6_nh) · 159 unmodified lines | |||
| 160 | INIT_LIST_HEAD(&f6i->fib6_siblings); | 160 | INIT_LIST_HEAD(&f6i->fib6_siblings); |
| 161 | refcount_set(&f6i->fib6_ref, 1); | 161 | refcount_set(&f6i->fib6_ref, 1); |
| 162 | 162 | ||
| 163 | INIT_HLIST_NODE(&f6i->gc_link); | ||
| 164 | |||
| 165 | return f6i; | 163 | return f6i; |
| 166 | } | 164 | } |
| 167 | 165 | ||
| @@ -248,7 +246,6 @@ static struct fib6_table *fib6_alloc_table(struct net *net, u32 id) · 80 unmodified lines | |||
| 248 | net->ipv6.fib6_null_entry); | 246 | net->ipv6.fib6_null_entry); |
| 249 | table->tb6_root.fn_flags = RTN_ROOT | RTN_TL_ROOT | RTN_RTINFO; | 247 | table->tb6_root.fn_flags = RTN_ROOT | RTN_TL_ROOT | RTN_RTINFO; |
| 250 | inet_peer_base_init(&table->tb6_peers); | 248 | inet_peer_base_init(&table->tb6_peers); |
| 251 | INIT_HLIST_HEAD(&table->tb6_gc_hlist); | ||
| 252 | } | 249 | } |
| 253 | 250 | ||
| 254 | return table; | 251 | return table; |
| @@ -1060,8 +1057,6 @@ static void fib6_purge_rt(struct fib6_info *rt, struct fib6_node *fn, · 805 unmodified lines | |||
| 1060 | lockdep_is_held(&table->tb6_lock)); | 1057 | lockdep_is_held(&table->tb6_lock)); |
| 1061 | } | 1058 | } |
| 1062 | } | 1059 | } |
| 1063 | |||
| 1064 | fib6_clean_expires_locked(rt); | ||
| 1065 | } | 1060 | } |
| 1066 | 1061 | ||
| 1067 | /* | 1062 | /* |
| @@ -1123,10 +1118,9 @@ static int fib6_add_rt2node(struct fib6_node *fn, struct fib6_info *rt, · 55 unmodified lines | |||
| 1123 | if (!(iter->fib6_flags & RTF_EXPIRES)) | 1118 | if (!(iter->fib6_flags & RTF_EXPIRES)) |
| 1124 | return -EEXIST; | 1119 | return -EEXIST; |
| 1125 | if (!(rt->fib6_flags & RTF_EXPIRES)) | 1120 | if (!(rt->fib6_flags & RTF_EXPIRES)) |
| 1126 | fib6_clean_expires_locked(iter); | 1121 | fib6_clean_expires(iter); |
| 1127 | else | 1122 | else |
| 1128 | fib6_set_expires_locked(iter, | 1123 | fib6_set_expires(iter, rt->expires); |
| 1129 | rt->expires); | ||
| 1130 | 1124 | ||
| 1131 | if (rt->fib6_pmtu) | 1125 | if (rt->fib6_pmtu) |
| 1132 | fib6_metric_set(iter, RTAX_MTU, | 1126 | fib6_metric_set(iter, RTAX_MTU, |
| @@ -1485,10 +1479,6 @@ int fib6_add(struct fib6_node *root, struct fib6_info *rt, · 352 unmodified lines | |||
| 1485 | if (rt->nh) | 1479 | if (rt->nh) |
| 1486 | list_add(&rt->nh_list, &rt->nh->f6i_list); | 1480 | list_add(&rt->nh_list, &rt->nh->f6i_list); |
| 1487 | __fib6_update_sernum_upto_root(rt, fib6_new_sernum(info->nl_net)); | 1481 | __fib6_update_sernum_upto_root(rt, fib6_new_sernum(info->nl_net)); |
| 1488 | |||
| 1489 | if (fib6_has_expires(rt)) | ||
| 1490 | hlist_add_head(&rt->gc_link, &table->tb6_gc_hlist); | ||
| 1491 | |||
| 1492 | fib6_start_gc(info->nl_net, rt); | 1482 | fib6_start_gc(info->nl_net, rt); |
| 1493 | } | 1483 | } |
| 1494 | 1484 | ||
| @@ -2291,8 +2281,9 @@ static void fib6_flush_trees(struct net *net) · 796 unmodified lines | |||
| 2291 | * Garbage collection | 2281 | * Garbage collection |
| 2292 | */ | 2282 | */ |
| 2293 | 2283 | ||
| 2294 | static int fib6_age(struct fib6_info *rt, struct fib6_gc_args *gc_args) | 2284 | static int fib6_age(struct fib6_info *rt, void *arg) |
| 2295 | { | 2285 | { |
| 2286 | struct fib6_gc_args *gc_args = arg; | ||
| 2296 | unsigned long now = jiffies; | 2287 | unsigned long now = jiffies; |
| 2297 | 2288 | ||
| 2298 | /* | 2289 | /* |
| @@ -2300,7 +2291,7 @@ static int fib6_age(struct fib6_info *rt, struct fib6_gc_args *gc_args) · 1 unmodified line | |||
| 2300 | * Routes are expired even if they are in use. | 2291 | * Routes are expired even if they are in use. |
| 2301 | */ | 2292 | */ |
| 2302 | 2293 | ||
| 2303 | if (fib6_has_expires(rt) && rt->expires) { | 2294 | if (rt->fib6_flags & RTF_EXPIRES && rt->expires) { |
| 2304 | if (time_after(now, rt->expires)) { | 2295 | if (time_after(now, rt->expires)) { |
| 2305 | RT6_TRACE("expiring %p\n", rt); | 2296 | RT6_TRACE("expiring %p\n", rt); |
| 2306 | return -1; | 2297 | return -1; |
| @@ -2317,40 +2308,6 @@ static int fib6_age(struct fib6_info *rt, struct fib6_gc_args *gc_args) · 10 unmodified lines | |||
| 2317 | return 0; | 2308 | return 0; |
| 2318 | } | 2309 | } |
| 2319 | 2310 | ||
| 2320 | static void fib6_gc_table(struct net *net, | ||
| 2321 | struct fib6_table *tb6, | ||
| 2322 | struct fib6_gc_args *gc_args) | ||
| 2323 | { | ||
| 2324 | struct fib6_info *rt; | ||
| 2325 | struct hlist_node *n; | ||
| 2326 | struct nl_info info = { | ||
| 2327 | .nl_net = net, | ||
| 2328 | .skip_notify = false, | ||
| 2329 | }; | ||
| 2330 | |||
| 2331 | hlist_for_each_entry_safe(rt, n, &tb6->tb6_gc_hlist, gc_link) | ||
| 2332 | if (fib6_age(rt, gc_args) == -1) | ||
| 2333 | fib6_del(rt, &info); | ||
| 2334 | } | ||
| 2335 | |||
| 2336 | static void fib6_gc_all(struct net *net, struct fib6_gc_args *gc_args) | ||
| 2337 | { | ||
| 2338 | struct fib6_table *table; | ||
| 2339 | struct hlist_head *head; | ||
| 2340 | unsigned int h; | ||
| 2341 | |||
| 2342 | rcu_read_lock(); | ||
| 2343 | for (h = 0; h < FIB6_TABLE_HASHSZ; h++) { | ||
| 2344 | head = &net->ipv6.fib_table_hash[h]; | ||
| 2345 | hlist_for_each_entry_rcu(table, head, tb6_hlist) { | ||
| 2346 | spin_lock_bh(&table->tb6_lock); | ||
| 2347 | fib6_gc_table(net, table, gc_args); | ||
| 2348 | spin_unlock_bh(&table->tb6_lock); | ||
| 2349 | } | ||
| 2350 | } | ||
| 2351 | rcu_read_unlock(); | ||
| 2352 | } | ||
| 2353 | |||
| 2354 | void fib6_run_gc(unsigned long expires, struct net *net, bool force) | 2311 | void fib6_run_gc(unsigned long expires, struct net *net, bool force) |
| 2355 | { | 2312 | { |
| 2356 | struct fib6_gc_args gc_args; | 2313 | struct fib6_gc_args gc_args; |
| @@ -2366,7 +2323,7 @@ void fib6_run_gc(unsigned long expires, struct net *net, bool force) · 9 unmodified lines | |||
| 2366 | net->ipv6.sysctl.ip6_rt_gc_interval; | 2323 | net->ipv6.sysctl.ip6_rt_gc_interval; |
| 2367 | gc_args.more = 0; | 2324 | gc_args.more = 0; |
| 2368 | 2325 | ||
| 2369 | fib6_gc_all(net, &gc_args); | 2326 | fib6_clean_all(net, fib6_age, &gc_args); |
| 2370 | now = jiffies; | 2327 | now = jiffies; |
| 2371 | net->ipv6.ip6_rt_last_gc = now; | 2328 | net->ipv6.ip6_rt_last_gc = now; |
| 2372 | 2329 | ||
| @@ -3763,10 +3763,10 @@ static struct fib6_info *ip6_route_info_create(struct fib6_config *cfg, · 3762 unmodified lines | |||
| 3763 | rt->dst_nocount = true; | 3763 | rt->dst_nocount = true; |
| 3764 | 3764 | ||
| 3765 | if (cfg->fc_flags & RTF_EXPIRES) | 3765 | if (cfg->fc_flags & RTF_EXPIRES) |
| 3766 | fib6_set_expires_locked(rt, jiffies + | 3766 | fib6_set_expires(rt, jiffies + |
| 3767 | clock_t_to_jiffies(cfg->fc_expires)); | 3767 | clock_t_to_jiffies(cfg->fc_expires)); |
| 3768 | else | 3768 | else |
| 3769 | fib6_clean_expires_locked(rt); | 3769 | fib6_clean_expires(rt); |
| 3770 | 3770 | ||
| 3771 | if (cfg->fc_protocol == RTPROT_UNSPEC) | 3771 | if (cfg->fc_protocol == RTPROT_UNSPEC) |
| 3772 | cfg->fc_protocol = RTPROT_BOOT; | 3772 | cfg->fc_protocol = RTPROT_BOOT; |
| @@ -1788,10 +1788,10 @@ static int sta_link_apply_parameters(struct ieee80211_local *local, · 1787 unmodified lines | |||
| 1788 | lockdep_is_held(&local->hw.wiphy->mtx)); | 1788 | lockdep_is_held(&local->hw.wiphy->mtx)); |
| 1789 | 1789 | ||
| 1790 | /* | 1790 | /* |
| 1791 | * If there are no changes, then accept a link that doesn't exist, | 1791 | * If there are no changes, then accept a link that exist, |
| 1792 | * unless it's a new link. | 1792 | * unless it's a new link. |
| 1793 | */ | 1793 | */ |
| 1794 | if (params->link_id < 0 && !new_link && | 1794 | if (params->link_id >= 0 && !new_link && |
| 1795 | !params->link_mac && !params->txpwr_set && | 1795 | !params->link_mac && !params->txpwr_set && |
| 1796 | !params->supported_rates_len && | 1796 | !params->supported_rates_len && |
| 1797 | !params->ht_capa && !params->vht_capa && | 1797 | !params->ht_capa && !params->vht_capa && |
| @@ -1,7 +1,7 @@ | |||
| 1 | // SPDX-License-Identifier: GPL-2.0-only | 1 | // SPDX-License-Identifier: GPL-2.0-only |
| 2 | /* | 2 | /* |
| 3 | * Copyright 2015 Intel Deutschland GmbH | 3 | * Copyright 2015 Intel Deutschland GmbH |
| 4 | * Copyright (C) 2022 Intel Corporation | 4 | * Copyright (C) 2022-2023 Intel Corporation |
| 5 | */ | 5 | */ |
| 6 | #include <net/mac80211.h> | 6 | #include <net/mac80211.h> |
| 7 | #include "ieee80211_i.h" | 7 | #include "ieee80211_i.h" |
| @@ -589,6 +589,10 @@ int drv_change_sta_links(struct ieee80211_local *local, · 581 unmodified lines | |||
| 589 | if (ret) | 589 | if (ret) |
| 590 | return ret; | 590 | return ret; |
| 591 | 591 | ||
| 592 | /* during reconfig don't add it to debugfs again */ | ||
| 593 | if (local->in_reconfig) | ||
| 594 | return 0; | ||
| 595 | |||
| 592 | for_each_set_bit(link_id, &links_to_add, IEEE80211_MLD_MAX_NUM_LINKS) { | 596 | for_each_set_bit(link_id, &links_to_add, IEEE80211_MLD_MAX_NUM_LINKS) { |
| 593 | link_sta = rcu_dereference_protected(info->link[link_id], | 597 | link_sta = rcu_dereference_protected(info->link[link_id], |
| 594 | lockdep_is_held(&local->hw.wiphy->mtx)); | 598 | lockdep_is_held(&local->hw.wiphy->mtx)); |
| @@ -1068,8 +1068,8 @@ mesh_plink_get_event(struct ieee80211_sub_if_data *sdata, · 1067 unmodified lines | |||
| 1068 | case WLAN_SP_MESH_PEERING_OPEN: | 1068 | case WLAN_SP_MESH_PEERING_OPEN: |
| 1069 | if (!matches_local) | 1069 | if (!matches_local) |
| 1070 | event = OPN_RJCT; | 1070 | event = OPN_RJCT; |
| 1071 | if (!mesh_plink_free_count(sdata) || | 1071 | else if (!mesh_plink_free_count(sdata) || |
| 1072 | (sta->mesh->plid && sta->mesh->plid != plid)) | 1072 | (sta->mesh->plid && sta->mesh->plid != plid)) |
| 1073 | event = OPN_IGNR; | 1073 | event = OPN_IGNR; |
| 1074 | else | 1074 | else |
| 1075 | event = OPN_ACPT; | 1075 | event = OPN_ACPT; |
| @@ -1077,9 +1077,9 @@ mesh_plink_get_event(struct ieee80211_sub_if_data *sdata, · 1 unmodified line | |||
| 1077 | case WLAN_SP_MESH_PEERING_CONFIRM: | 1077 | case WLAN_SP_MESH_PEERING_CONFIRM: |
| 1078 | if (!matches_local) | 1078 | if (!matches_local) |
| 1079 | event = CNF_RJCT; | 1079 | event = CNF_RJCT; |
| 1080 | if (!mesh_plink_free_count(sdata) || | 1080 | else if (!mesh_plink_free_count(sdata) || |
| 1081 | sta->mesh->llid != llid || | 1081 | sta->mesh->llid != llid || |
| 1082 | (sta->mesh->plid && sta->mesh->plid != plid)) | 1082 | (sta->mesh->plid && sta->mesh->plid != plid)) |
| 1083 | event = CNF_IGNR; | 1083 | event = CNF_IGNR; |
| 1084 | else | 1084 | else |
| 1085 | event = CNF_ACPT; | 1085 | event = CNF_ACPT; |
| @@ -1247,6 +1247,8 @@ void mesh_rx_plink_frame(struct ieee80211_sub_if_data *sdata, · 161 unmodified lines | |||
| 1247 | return; | 1247 | return; |
| 1248 | } | 1248 | } |
| 1249 | elems = ieee802_11_parse_elems(baseaddr, len - baselen, true, NULL); | 1249 | elems = ieee802_11_parse_elems(baseaddr, len - baselen, true, NULL); |
| 1250 | mesh_process_plink_frame(sdata, mgmt, elems, rx_status); | 1250 | if (elems) { |
| 1251 | kfree(elems); | 1251 | mesh_process_plink_frame(sdata, mgmt, elems, rx_status); |
| 1252 | kfree(elems); | ||
| 1253 | } | ||
| 1252 | } | 1254 | } |
| @@ -5782,7 +5782,7 @@ static void ieee80211_ml_reconfiguration(struct ieee80211_sub_if_data *sdata, · 5781 unmodified lines | |||
| 5782 | { | 5782 | { |
| 5783 | const struct ieee80211_multi_link_elem *ml; | 5783 | const struct ieee80211_multi_link_elem *ml; |
| 5784 | const struct element *sub; | 5784 | const struct element *sub; |
| 5785 | size_t ml_len; | 5785 | ssize_t ml_len; |
| 5786 | unsigned long removed_links = 0; | 5786 | unsigned long removed_links = 0; |
| 5787 | u16 link_removal_timeout[IEEE80211_MLD_MAX_NUM_LINKS] = {}; | 5787 | u16 link_removal_timeout[IEEE80211_MLD_MAX_NUM_LINKS] = {}; |
| 5788 | u8 link_id; | 5788 | u8 link_id; |
| @@ -5798,6 +5798,8 @@ static void ieee80211_ml_reconfiguration(struct ieee80211_sub_if_data *sdata, · 9 unmodified lines | |||
| 5798 | elems->scratch + elems->scratch_len - | 5798 | elems->scratch + elems->scratch_len - |
| 5799 | elems->scratch_pos, | 5799 | elems->scratch_pos, |
| 5800 | WLAN_EID_FRAGMENT); | 5800 | WLAN_EID_FRAGMENT); |
| 5801 | if (ml_len < 0) | ||
| 5802 | return; | ||
| 5801 | 5803 | ||
| 5802 | elems->ml_reconf = (const void *)elems->scratch_pos; | 5804 | elems->ml_reconf = (const void *)elems->scratch_pos; |
| 5803 | elems->ml_reconf_len = ml_len; | 5805 | elems->ml_reconf_len = ml_len; |
| @@ -70,3 +70,4 @@ static struct kunit_suite mptcp_crypto_suite = { · 69 unmodified lines | |||
| 70 | kunit_test_suite(mptcp_crypto_suite); | 70 | kunit_test_suite(mptcp_crypto_suite); |
| 71 | 71 | ||
| 72 | MODULE_LICENSE("GPL"); | 72 | MODULE_LICENSE("GPL"); |
| 73 | MODULE_DESCRIPTION("KUnit tests for MPTCP Crypto"); | ||
| @@ -3402,12 +3402,12 @@ static void mptcp_release_cb(struct sock *sk) · 3401 unmodified lines | |||
| 3402 | if (__test_and_clear_bit(MPTCP_CLEAN_UNA, &msk->cb_flags)) | 3402 | if (__test_and_clear_bit(MPTCP_CLEAN_UNA, &msk->cb_flags)) |
| 3403 | __mptcp_clean_una_wakeup(sk); | 3403 | __mptcp_clean_una_wakeup(sk); |
| 3404 | if (unlikely(msk->cb_flags)) { | 3404 | if (unlikely(msk->cb_flags)) { |
| 3405 | /* be sure to set the current sk state before taking actions | 3405 | /* be sure to sync the msk state before taking actions |
| 3406 | * depending on sk_state (MPTCP_ERROR_REPORT) | 3406 | * depending on sk_state (MPTCP_ERROR_REPORT) |
| 3407 | * On sk release avoid actions depending on the first subflow | 3407 | * On sk release avoid actions depending on the first subflow |
| 3408 | */ | 3408 | */ |
| 3409 | if (__test_and_clear_bit(MPTCP_CONNECTED, &msk->cb_flags) && msk->first) | 3409 | if (__test_and_clear_bit(MPTCP_SYNC_STATE, &msk->cb_flags) && msk->first) |
| 3410 | __mptcp_set_connected(sk); | 3410 | __mptcp_sync_state(sk, msk->pending_state); |
| 3411 | if (__test_and_clear_bit(MPTCP_ERROR_REPORT, &msk->cb_flags)) | 3411 | if (__test_and_clear_bit(MPTCP_ERROR_REPORT, &msk->cb_flags)) |
| 3412 | __mptcp_error_report(sk); | 3412 | __mptcp_error_report(sk); |
| 3413 | if (__test_and_clear_bit(MPTCP_SYNC_SNDBUF, &msk->cb_flags)) | 3413 | if (__test_and_clear_bit(MPTCP_SYNC_SNDBUF, &msk->cb_flags)) |
| @@ -124,7 +124,7 @@ · 123 unmodified lines | |||
| 124 | #define MPTCP_ERROR_REPORT 3 | 124 | #define MPTCP_ERROR_REPORT 3 |
| 125 | #define MPTCP_RETRANSMIT 4 | 125 | #define MPTCP_RETRANSMIT 4 |
| 126 | #define MPTCP_FLUSH_JOIN_LIST 5 | 126 | #define MPTCP_FLUSH_JOIN_LIST 5 |
| 127 | #define MPTCP_CONNECTED 6 | 127 | #define MPTCP_SYNC_STATE 6 |
| 128 | #define MPTCP_SYNC_SNDBUF 7 | 128 | #define MPTCP_SYNC_SNDBUF 7 |
| 129 | 129 | ||
| 130 | struct mptcp_skb_cb { | 130 | struct mptcp_skb_cb { |
| @@ -296,6 +296,9 @@ struct mptcp_sock { · 165 unmodified lines | |||
| 296 | bool use_64bit_ack; /* Set when we received a 64-bit DSN */ | 296 | bool use_64bit_ack; /* Set when we received a 64-bit DSN */ |
| 297 | bool csum_enabled; | 297 | bool csum_enabled; |
| 298 | bool allow_infinite_fallback; | 298 | bool allow_infinite_fallback; |
| 299 | u8 pending_state; /* A subflow asked to set this sk_state, | ||
| 300 | * protected by the msk data lock | ||
| 301 | */ | ||
| 299 | u8 mpc_endpoint_id; | 302 | u8 mpc_endpoint_id; |
| 300 | u8 recvmsg_inq:1, | 303 | u8 recvmsg_inq:1, |
| 301 | cork:1, | 304 | cork:1, |
| @@ -728,7 +731,7 @@ void mptcp_get_options(const struct sk_buff *skb, · 426 unmodified lines | |||
| 728 | struct mptcp_options_received *mp_opt); | 731 | struct mptcp_options_received *mp_opt); |
| 729 | 732 | ||
| 730 | void mptcp_finish_connect(struct sock *sk); | 733 | void mptcp_finish_connect(struct sock *sk); |
| 731 | void __mptcp_set_connected(struct sock *sk); | 734 | void __mptcp_sync_state(struct sock *sk, int state); |
| 732 | void mptcp_reset_tout_timer(struct mptcp_sock *msk, unsigned long fail_tout); | 735 | void mptcp_reset_tout_timer(struct mptcp_sock *msk, unsigned long fail_tout); |
| 733 | 736 | ||
| 734 | static inline void mptcp_stop_tout_timer(struct sock *sk) | 737 | static inline void mptcp_stop_tout_timer(struct sock *sk) |
| @@ -1115,7 +1118,7 @@ static inline bool subflow_simultaneous_connect(struct sock *sk) · 380 unmodified lines | |||
| 1115 | { | 1118 | { |
| 1116 | struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(sk); | 1119 | struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(sk); |
| 1117 | 1120 | ||
| 1118 | return sk->sk_state == TCP_ESTABLISHED && | 1121 | return (1 << sk->sk_state) & (TCPF_ESTABLISHED | TCPF_FIN_WAIT1) && |
| 1119 | is_active_ssk(subflow) && | 1122 | is_active_ssk(subflow) && |
| 1120 | !subflow->conn_finished; | 1123 | !subflow->conn_finished; |
| 1121 | } | 1124 | } |
| @@ -419,22 +419,28 @@ static bool subflow_use_different_dport(struct mptcp_sock *msk, const struct soc · 418 unmodified lines | |||
| 419 | return inet_sk(sk)->inet_dport != inet_sk((struct sock *)msk)->inet_dport; | 419 | return inet_sk(sk)->inet_dport != inet_sk((struct sock *)msk)->inet_dport; |
| 420 | } | 420 | } |
| 421 | 421 | ||
| 422 | void __mptcp_set_connected(struct sock *sk) | 422 | void __mptcp_sync_state(struct sock *sk, int state) |
| 423 | { | 423 | { |
| 424 | __mptcp_propagate_sndbuf(sk, mptcp_sk(sk)->first); | 424 | struct mptcp_sock *msk = mptcp_sk(sk); |
| 425 | |||
| 426 | __mptcp_propagate_sndbuf(sk, msk->first); | ||
| 425 | if (sk->sk_state == TCP_SYN_SENT) { | 427 | if (sk->sk_state == TCP_SYN_SENT) { |
| 426 | inet_sk_state_store(sk, TCP_ESTABLISHED); | 428 | inet_sk_state_store(sk, state); |
| 427 | sk->sk_state_change(sk); | 429 | sk->sk_state_change(sk); |
| 428 | } | 430 | } |
| 429 | } | 431 | } |
| 430 | 432 | ||
| 431 | static void mptcp_set_connected(struct sock *sk) | 433 | static void mptcp_propagate_state(struct sock *sk, struct sock *ssk) |
| 432 | { | 434 | { |
| 435 | struct mptcp_sock *msk = mptcp_sk(sk); | ||
| 436 | |||
| 433 | mptcp_data_lock(sk); | 437 | mptcp_data_lock(sk); |
| 434 | if (!sock_owned_by_user(sk)) | 438 | if (!sock_owned_by_user(sk)) { |
| 435 | __mptcp_set_connected(sk); | 439 | __mptcp_sync_state(sk, ssk->sk_state); |
| 436 | else | 440 | } else { |
| 437 | __set_bit(MPTCP_CONNECTED, &mptcp_sk(sk)->cb_flags); | 441 | msk->pending_state = ssk->sk_state; |
| 442 | __set_bit(MPTCP_SYNC_STATE, &msk->cb_flags); | ||
| 443 | } | ||
| 438 | mptcp_data_unlock(sk); | 444 | mptcp_data_unlock(sk); |
| 439 | } | 445 | } |
| 440 | 446 | ||
| @@ -496,7 +502,7 @@ static void subflow_finish_connect(struct sock *sk, const struct sk_buff *skb) · 55 unmodified lines | |||
| 496 | subflow_set_remote_key(msk, subflow, &mp_opt); | 502 | subflow_set_remote_key(msk, subflow, &mp_opt); |
| 497 | MPTCP_INC_STATS(sock_net(sk), MPTCP_MIB_MPCAPABLEACTIVEACK); | 503 | MPTCP_INC_STATS(sock_net(sk), MPTCP_MIB_MPCAPABLEACTIVEACK); |
| 498 | mptcp_finish_connect(sk); | 504 | mptcp_finish_connect(sk); |
| 499 | mptcp_set_connected(parent); | 505 | mptcp_propagate_state(parent, sk); |
| 500 | } else if (subflow->request_join) { | 506 | } else if (subflow->request_join) { |
| 501 | u8 hmac[SHA256_DIGEST_SIZE]; | 507 | u8 hmac[SHA256_DIGEST_SIZE]; |
| 502 | 508 | ||
| @@ -540,7 +546,7 @@ static void subflow_finish_connect(struct sock *sk, const struct sk_buff *skb) · 37 unmodified lines | |||
| 540 | } else if (mptcp_check_fallback(sk)) { | 546 | } else if (mptcp_check_fallback(sk)) { |
| 541 | fallback: | 547 | fallback: |
| 542 | mptcp_rcv_space_init(msk, sk); | 548 | mptcp_rcv_space_init(msk, sk); |
| 543 | mptcp_set_connected(parent); | 549 | mptcp_propagate_state(parent, sk); |
| 544 | } | 550 | } |
| 545 | return; | 551 | return; |
| 546 | 552 | ||
| @@ -1740,7 +1746,7 @@ static void subflow_state_change(struct sock *sk) · 1193 unmodified lines | |||
| 1740 | mptcp_rcv_space_init(msk, sk); | 1746 | mptcp_rcv_space_init(msk, sk); |
| 1741 | pr_fallback(msk); | 1747 | pr_fallback(msk); |
| 1742 | subflow->conn_finished = 1; | 1748 | subflow->conn_finished = 1; |
| 1743 | mptcp_set_connected(parent); | 1749 | mptcp_propagate_state(parent, sk); |
| 1744 | } | 1750 | } |
| 1745 | 1751 | ||
| 1746 | /* as recvmsg() does not acquire the subflow socket for ssk selection | 1752 | /* as recvmsg() does not acquire the subflow socket for ssk selection |
| @@ -143,3 +143,4 @@ static struct kunit_suite mptcp_token_suite = { · 142 unmodified lines | |||
| 143 | kunit_test_suite(mptcp_token_suite); | 143 | kunit_test_suite(mptcp_token_suite); |
| 144 | 144 | ||
| 145 | MODULE_LICENSE("GPL"); | 145 | MODULE_LICENSE("GPL"); |
| 146 | MODULE_DESCRIPTION("KUnit tests for MPTCP Token"); | ||
| @@ -126,6 +126,14 @@ static int rfkill_gpio_probe(struct platform_device *pdev) · 125 unmodified lines | |||
| 126 | return -EINVAL; | 126 | return -EINVAL; |
| 127 | } | 127 | } |
| 128 | 128 | ||
| 129 | ret = gpiod_direction_output(rfkill->reset_gpio, true); | ||
| 130 | if (ret) | ||
| 131 | return ret; | ||
| 132 | |||
| 133 | ret = gpiod_direction_output(rfkill->shutdown_gpio, true); | ||
| 134 | if (ret) | ||
| 135 | return ret; | ||
| 136 | |||
| 129 | rfkill->rfkill_dev = rfkill_alloc(rfkill->name, &pdev->dev, | 137 | rfkill->rfkill_dev = rfkill_alloc(rfkill->name, &pdev->dev, |
| 130 | rfkill->type, &rfkill_gpio_ops, | 138 | rfkill->type, &rfkill_gpio_ops, |
| 131 | rfkill); | 139 | rfkill); |
| @@ -182,21 +182,47 @@ void rose_kill_by_neigh(struct rose_neigh *neigh) · 181 unmodified lines | |||
| 182 | */ | 182 | */ |
| 183 | static void rose_kill_by_device(struct net_device *dev) | 183 | static void rose_kill_by_device(struct net_device *dev) |
| 184 | { | 184 | { |
| 185 | struct sock *s; | 185 | struct sock *sk, *array[16]; |
| 186 | struct rose_sock *rose; | ||
| 187 | bool rescan; | ||
| 188 | int i, cnt; | ||
| 186 | 189 | ||
| 190 | start: | ||
| 191 | rescan = false; | ||
| 192 | cnt = 0; | ||
| 187 | spin_lock_bh(&rose_list_lock); | 193 | spin_lock_bh(&rose_list_lock); |
| 188 | sk_for_each(s, &rose_list) { | 194 | sk_for_each(sk, &rose_list) { |
| 189 | struct rose_sock *rose = rose_sk(s); | 195 | rose = rose_sk(sk); |
| 196 | if (rose->device == dev) { | ||
| 197 | if (cnt == ARRAY_SIZE(array)) { | ||
| 198 | rescan = true; | ||
| 199 | break; | ||
| 200 | } | ||
| 201 | sock_hold(sk); | ||
| 202 | array[cnt++] = sk; | ||
| 203 | } | ||
| 204 | } | ||
| 205 | spin_unlock_bh(&rose_list_lock); | ||
| 190 | 206 | ||
| 207 | for (i = 0; i < cnt; i++) { | ||
| 208 | sk = array[cnt]; | ||
| 209 | rose = rose_sk(sk); | ||
| 210 | lock_sock(sk); | ||
| 211 | spin_lock_bh(&rose_list_lock); | ||
| 191 | if (rose->device == dev) { | 212 | if (rose->device == dev) { |
| 192 | rose_disconnect(s, ENETUNREACH, ROSE_OUT_OF_ORDER, 0); | 213 | rose_disconnect(sk, ENETUNREACH, ROSE_OUT_OF_ORDER, 0); |
| 193 | if (rose->neighbour) | 214 | if (rose->neighbour) |
| 194 | rose->neighbour->use--; | 215 | rose->neighbour->use--; |
| 195 | netdev_put(rose->device, &rose->dev_tracker); | 216 | netdev_put(rose->device, &rose->dev_tracker); |
| 196 | rose->device = NULL; | 217 | rose->device = NULL; |
| 197 | } | 218 | } |
| 219 | spin_unlock_bh(&rose_list_lock); | ||
| 220 | release_sock(sk); | ||
| 221 | sock_put(sk); | ||
| 222 | cond_resched(); | ||
| 198 | } | 223 | } |
| 199 | spin_unlock_bh(&rose_list_lock); | 224 | if (rescan) |
| 225 | goto start; | ||
| 200 | } | 226 | } |
| 201 | 227 | ||
| 202 | /* | 228 | /* |
| @@ -656,7 +682,10 @@ static int rose_release(struct socket *sock) · 453 unmodified lines | |||
| 656 | break; | 682 | break; |
| 657 | } | 683 | } |
| 658 | 684 | ||
| 685 | spin_lock_bh(&rose_list_lock); | ||
| 659 | netdev_put(rose->device, &rose->dev_tracker); | 686 | netdev_put(rose->device, &rose->dev_tracker); |
| 687 | rose->device = NULL; | ||
| 688 | spin_unlock_bh(&rose_list_lock); | ||
| 660 | sock->sk = NULL; | 689 | sock->sk = NULL; |
| 661 | release_sock(sk); | 690 | release_sock(sk); |
| 662 | sock_put(sk); | 691 | sock_put(sk); |
| @@ -0,0 +1,87 @@ | |||
| 1 | /* Chen-Yu Tsai's regdb certificate */ | ||
| 2 | 0x30, 0x82, 0x02, 0xa7, 0x30, 0x82, 0x01, 0x8f, | ||
| 3 | 0x02, 0x14, 0x61, 0xc0, 0x38, 0x65, 0x1a, 0xab, | ||
| 4 | 0xdc, 0xf9, 0x4b, 0xd0, 0xac, 0x7f, 0xf0, 0x6c, | ||
| 5 | 0x72, 0x48, 0xdb, 0x18, 0xc6, 0x00, 0x30, 0x0d, | ||
| 6 | 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, | ||
| 7 | 0x01, 0x01, 0x0b, 0x05, 0x00, 0x30, 0x0f, 0x31, | ||
| 8 | 0x0d, 0x30, 0x0b, 0x06, 0x03, 0x55, 0x04, 0x03, | ||
| 9 | 0x0c, 0x04, 0x77, 0x65, 0x6e, 0x73, 0x30, 0x20, | ||
| 10 | 0x17, 0x0d, 0x32, 0x33, 0x31, 0x32, 0x30, 0x31, | ||
| 11 | 0x30, 0x37, 0x34, 0x31, 0x31, 0x34, 0x5a, 0x18, | ||
| 12 | 0x0f, 0x32, 0x31, 0x32, 0x33, 0x31, 0x31, 0x30, | ||
| 13 | 0x37, 0x30, 0x37, 0x34, 0x31, 0x31, 0x34, 0x5a, | ||
| 14 | 0x30, 0x0f, 0x31, 0x0d, 0x30, 0x0b, 0x06, 0x03, | ||
| 15 | 0x55, 0x04, 0x03, 0x0c, 0x04, 0x77, 0x65, 0x6e, | ||
| 16 | 0x73, 0x30, 0x82, 0x01, 0x22, 0x30, 0x0d, 0x06, | ||
| 17 | 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, | ||
| 18 | 0x01, 0x01, 0x05, 0x00, 0x03, 0x82, 0x01, 0x0f, | ||
| 19 | 0x00, 0x30, 0x82, 0x01, 0x0a, 0x02, 0x82, 0x01, | ||
| 20 | 0x01, 0x00, 0xa9, 0x7a, 0x2c, 0x78, 0x4d, 0xa7, | ||
| 21 | 0x19, 0x2d, 0x32, 0x52, 0xa0, 0x2e, 0x6c, 0xef, | ||
| 22 | 0x88, 0x7f, 0x15, 0xc5, 0xb6, 0x69, 0x54, 0x16, | ||
| 23 | 0x43, 0x14, 0x79, 0x53, 0xb7, 0xae, 0x88, 0xfe, | ||
| 24 | 0xc0, 0xb7, 0x5d, 0x47, 0x8e, 0x1a, 0xe1, 0xef, | ||
| 25 | 0xb3, 0x90, 0x86, 0xda, 0xd3, 0x64, 0x81, 0x1f, | ||
| 26 | 0xce, 0x5d, 0x9e, 0x4b, 0x6e, 0x58, 0x02, 0x3e, | ||
| 27 | 0xb2, 0x6f, 0x5e, 0x42, 0x47, 0x41, 0xf4, 0x2c, | ||
| 28 | 0xb8, 0xa8, 0xd4, 0xaa, 0xc0, 0x0e, 0xe6, 0x48, | ||
| 29 | 0xf0, 0xa8, 0xce, 0xcb, 0x08, 0xae, 0x37, 0xaf, | ||
| 30 | 0xf6, 0x40, 0x39, 0xcb, 0x55, 0x6f, 0x5b, 0x4f, | ||
| 31 | 0x85, 0x34, 0xe6, 0x69, 0x10, 0x50, 0x72, 0x5e, | ||
| 32 | 0x4e, 0x9d, 0x4c, 0xba, 0x38, 0x36, 0x0d, 0xce, | ||
| 33 | 0x73, 0x38, 0xd7, 0x27, 0x02, 0x2a, 0x79, 0x03, | ||
| 34 | 0xe1, 0xac, 0xcf, 0xb0, 0x27, 0x85, 0x86, 0x93, | ||
| 35 | 0x17, 0xab, 0xec, 0x42, 0x77, 0x37, 0x65, 0x8a, | ||
| 36 | 0x44, 0xcb, 0xd6, 0x42, 0x93, 0x92, 0x13, 0xe3, | ||
| 37 | 0x39, 0x45, 0xc5, 0x6e, 0x00, 0x4a, 0x7f, 0xcb, | ||
| 38 | 0x42, 0x17, 0x2b, 0x25, 0x8c, 0xb8, 0x17, 0x3b, | ||
| 39 | 0x15, 0x36, 0x59, 0xde, 0x42, 0xce, 0x21, 0xe6, | ||
| 40 | 0xb6, 0xc7, 0x6e, 0x5e, 0x26, 0x1f, 0xf7, 0x8a, | ||
| 41 | 0x57, 0x9e, 0xa5, 0x96, 0x72, 0xb7, 0x02, 0x32, | ||
| 42 | 0xeb, 0x07, 0x2b, 0x73, 0xe2, 0x4f, 0x66, 0x58, | ||
| 43 | 0x9a, 0xeb, 0x0f, 0x07, 0xb6, 0xab, 0x50, 0x8b, | ||
| 44 | 0xc3, 0x8f, 0x17, 0xfa, 0x0a, 0x99, 0xc2, 0x16, | ||
| 45 | 0x25, 0xbf, 0x2d, 0x6b, 0x1a, 0xaa, 0xe6, 0x3e, | ||
| 46 | 0x5f, 0xeb, 0x6d, 0x9b, 0x5d, 0x4d, 0x42, 0x83, | ||
| 47 | 0x2d, 0x39, 0xb8, 0xc9, 0xac, 0xdb, 0x3a, 0x91, | ||
| 48 | 0x50, 0xdf, 0xbb, 0xb1, 0x76, 0x6d, 0x15, 0x73, | ||
| 49 | 0xfd, 0xc6, 0xe6, 0x6b, 0x71, 0x9e, 0x67, 0x36, | ||
| 50 | 0x22, 0x83, 0x79, 0xb1, 0xd6, 0xb8, 0x84, 0x52, | ||
| 51 | 0xaf, 0x96, 0x5b, 0xc3, 0x63, 0x02, 0x4e, 0x78, | ||
| 52 | 0x70, 0x57, 0x02, 0x03, 0x01, 0x00, 0x01, 0x30, | ||
| 53 | 0x0d, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, | ||
| 54 | 0x0d, 0x01, 0x01, 0x0b, 0x05, 0x00, 0x03, 0x82, | ||
| 55 | 0x01, 0x01, 0x00, 0x24, 0x28, 0xee, 0x22, 0x74, | ||
| 56 | 0x7f, 0x7c, 0xfa, 0x6c, 0x1f, 0xb3, 0x18, 0xd1, | ||
| 57 | 0xc2, 0x3d, 0x7d, 0x29, 0x42, 0x88, 0xad, 0x82, | ||
| 58 | 0xa5, 0xb1, 0x8a, 0x05, 0xd0, 0xec, 0x5c, 0x91, | ||
| 59 | 0x20, 0xf6, 0x82, 0xfd, 0xd5, 0x67, 0x60, 0x5f, | ||
| 60 | 0x31, 0xf5, 0xbd, 0x88, 0x91, 0x70, 0xbd, 0xb8, | ||
| 61 | 0xb9, 0x8c, 0x88, 0xfe, 0x53, 0xc9, 0x54, 0x9b, | ||
| 62 | 0x43, 0xc4, 0x7a, 0x43, 0x74, 0x6b, 0xdd, 0xb0, | ||
| 63 | 0xb1, 0x3b, 0x33, 0x45, 0x46, 0x78, 0xa3, 0x1c, | ||
| 64 | 0xef, 0x54, 0x68, 0xf7, 0x85, 0x9c, 0xe4, 0x51, | ||
| 65 | 0x6f, 0x06, 0xaf, 0x81, 0xdb, 0x2a, 0x7b, 0x7b, | ||
| 66 | 0x6f, 0xa8, 0x9c, 0x67, 0xd8, 0xcb, 0xc9, 0x91, | ||
| 67 | 0x40, 0x00, 0xae, 0xd9, 0xa1, 0x9f, 0xdd, 0xa6, | ||
| 68 | 0x43, 0x0e, 0x28, 0x7b, 0xaa, 0x1b, 0xe9, 0x84, | ||
| 69 | 0xdb, 0x76, 0x64, 0x42, 0x70, 0xc9, 0xc0, 0xeb, | ||
| 70 | 0xae, 0x84, 0x11, 0x16, 0x68, 0x4e, 0x84, 0x9e, | ||
| 71 | 0x7e, 0x92, 0x36, 0xee, 0x1c, 0x3b, 0x08, 0x63, | ||
| 72 | 0xeb, 0x79, 0x84, 0x15, 0x08, 0x9d, 0xaf, 0xc8, | ||
| 73 | 0x9a, 0xc7, 0x34, 0xd3, 0x94, 0x4b, 0xd1, 0x28, | ||
| 74 | 0x97, 0xbe, 0xd1, 0x45, 0x75, 0xdc, 0x35, 0x62, | ||
| 75 | 0xac, 0x1d, 0x1f, 0xb7, 0xb7, 0x15, 0x87, 0xc8, | ||
| 76 | 0x98, 0xc0, 0x24, 0x31, 0x56, 0x8d, 0xed, 0xdb, | ||
| 77 | 0x06, 0xc6, 0x46, 0xbf, 0x4b, 0x6d, 0xa6, 0xd5, | ||
| 78 | 0xab, 0xcc, 0x60, 0xfc, 0xe5, 0x37, 0xb6, 0x53, | ||
| 79 | 0x7d, 0x58, 0x95, 0xa9, 0x56, 0xc7, 0xf7, 0xee, | ||
| 80 | 0xc3, 0xa0, 0x76, 0xf7, 0x65, 0x4d, 0x53, 0xfa, | ||
| 81 | 0xff, 0x5f, 0x76, 0x33, 0x5a, 0x08, 0xfa, 0x86, | ||
| 82 | 0x92, 0x5a, 0x13, 0xfa, 0x1a, 0xfc, 0xf2, 0x1b, | ||
| 83 | 0x8c, 0x7f, 0x42, 0x6d, 0xb7, 0x7e, 0xb7, 0xb4, | ||
| 84 | 0xf0, 0xc7, 0x83, 0xbb, 0xa2, 0x81, 0x03, 0x2d, | ||
| 85 | 0xd4, 0x2a, 0x63, 0x3f, 0xf7, 0x31, 0x2e, 0x40, | ||
| 86 | 0x33, 0x5c, 0x46, 0xbc, 0x9b, 0xc1, 0x05, 0xa5, | ||
| 87 | 0x45, 0x4e, 0xc3, | ||
| @@ -524,6 +524,37 @@ out: · 523 unmodified lines | |||
| 524 | test_sockmap_pass_prog__destroy(pass); | 524 | test_sockmap_pass_prog__destroy(pass); |
| 525 | } | 525 | } |
| 526 | 526 | ||
| 527 | static void test_sockmap_unconnected_unix(void) | ||
| 528 | { | ||
| 529 | int err, map, stream = 0, dgram = 0, zero = 0; | ||
| 530 | struct test_sockmap_pass_prog *skel; | ||
| 531 | |||
| 532 | skel = test_sockmap_pass_prog__open_and_load(); | ||
| 533 | if (!ASSERT_OK_PTR(skel, "open_and_load")) | ||
| 534 | return; | ||
| 535 | |||
| 536 | map = bpf_map__fd(skel->maps.sock_map_rx); | ||
| 537 | |||
| 538 | stream = xsocket(AF_UNIX, SOCK_STREAM, 0); | ||
| 539 | if (stream < 0) | ||
| 540 | return; | ||
| 541 | |||
| 542 | dgram = xsocket(AF_UNIX, SOCK_DGRAM, 0); | ||
| 543 | if (dgram < 0) { | ||
| 544 | close(stream); | ||
| 545 | return; | ||
| 546 | } | ||
| 547 | |||
| 548 | err = bpf_map_update_elem(map, &zero, &stream, BPF_ANY); | ||
| 549 | ASSERT_ERR(err, "bpf_map_update_elem(stream)"); | ||
| 550 | |||
| 551 | err = bpf_map_update_elem(map, &zero, &dgram, BPF_ANY); | ||
| 552 | ASSERT_OK(err, "bpf_map_update_elem(dgram)"); | ||
| 553 | |||
| 554 | close(stream); | ||
| 555 | close(dgram); | ||
| 556 | } | ||
| 557 | |||
| 527 | void test_sockmap_basic(void) | 558 | void test_sockmap_basic(void) |
| 528 | { | 559 | { |
| 529 | if (test__start_subtest("sockmap create_update_free")) | 560 | if (test__start_subtest("sockmap create_update_free")) |
| @@ -566,4 +597,7 @@ void test_sockmap_basic(void) · 36 unmodified lines | |||
| 566 | test_sockmap_skb_verdict_fionread(false); | 597 | test_sockmap_skb_verdict_fionread(false); |
| 567 | if (test__start_subtest("sockmap skb_verdict msg_f_peek")) | 598 | if (test__start_subtest("sockmap skb_verdict msg_f_peek")) |
| 568 | test_sockmap_skb_verdict_peek(); | 599 | test_sockmap_skb_verdict_peek(); |
| 600 | |||
| 601 | if (test__start_subtest("sockmap unconnected af_unix")) | ||
| 602 | test_sockmap_unconnected_unix(); | ||
| 569 | } | 603 | } |
| @@ -91,6 +91,7 @@ TEST_PROGS += test_bridge_neigh_suppress.sh · 90 unmodified lines | |||
| 91 | TEST_PROGS += test_vxlan_nolocalbypass.sh | 91 | TEST_PROGS += test_vxlan_nolocalbypass.sh |
| 92 | TEST_PROGS += test_bridge_backup_port.sh | 92 | TEST_PROGS += test_bridge_backup_port.sh |
| 93 | TEST_PROGS += fdb_flush.sh | 93 | TEST_PROGS += fdb_flush.sh |
| 94 | TEST_PROGS += vlan_hw_filter.sh | ||
| 94 | 95 | ||
| 95 | TEST_FILES := settings | 96 | TEST_FILES := settings |
| 96 | 97 | ||
| @@ -2776,7 +2776,7 @@ backup_tests() · 2775 unmodified lines | |||
| 2776 | fi | 2776 | fi |
| 2777 | 2777 | ||
| 2778 | if reset "mpc backup" && | 2778 | if reset "mpc backup" && |
| 2779 | continue_if mptcp_lib_kallsyms_doesnt_have "mptcp_subflow_send_ack$"; then | 2779 | continue_if mptcp_lib_kallsyms_doesnt_have "T mptcp_subflow_send_ack$"; then |
| 2780 | pm_nl_add_endpoint $ns2 10.0.1.2 flags subflow,backup | 2780 | pm_nl_add_endpoint $ns2 10.0.1.2 flags subflow,backup |
| 2781 | speed=slow \ | 2781 | speed=slow \ |
| 2782 | run_tests $ns1 $ns2 10.0.1.1 | 2782 | run_tests $ns1 $ns2 10.0.1.1 |
| @@ -2785,7 +2785,7 @@ backup_tests() · 2 unmodified lines | |||
| 2785 | fi | 2785 | fi |
| 2786 | 2786 | ||
| 2787 | if reset "mpc backup both sides" && | 2787 | if reset "mpc backup both sides" && |
| 2788 | continue_if mptcp_lib_kallsyms_doesnt_have "mptcp_subflow_send_ack$"; then | 2788 | continue_if mptcp_lib_kallsyms_doesnt_have "T mptcp_subflow_send_ack$"; then |
| 2789 | pm_nl_add_endpoint $ns1 10.0.1.1 flags subflow,backup | 2789 | pm_nl_add_endpoint $ns1 10.0.1.1 flags subflow,backup |
| 2790 | pm_nl_add_endpoint $ns2 10.0.1.2 flags subflow,backup | 2790 | pm_nl_add_endpoint $ns2 10.0.1.2 flags subflow,backup |
| 2791 | speed=slow \ | 2791 | speed=slow \ |
| @@ -2795,7 +2795,7 @@ backup_tests() · 3 unmodified lines | |||
| 2795 | fi | 2795 | fi |
| 2796 | 2796 | ||
| 2797 | if reset "mpc switch to backup" && | 2797 | if reset "mpc switch to backup" && |
| 2798 | continue_if mptcp_lib_kallsyms_doesnt_have "mptcp_subflow_send_ack$"; then | 2798 | continue_if mptcp_lib_kallsyms_doesnt_have "T mptcp_subflow_send_ack$"; then |
| 2799 | pm_nl_add_endpoint $ns2 10.0.1.2 flags subflow | 2799 | pm_nl_add_endpoint $ns2 10.0.1.2 flags subflow |
| 2800 | sflags=backup speed=slow \ | 2800 | sflags=backup speed=slow \ |
| 2801 | run_tests $ns1 $ns2 10.0.1.1 | 2801 | run_tests $ns1 $ns2 10.0.1.1 |
| @@ -2804,7 +2804,7 @@ backup_tests() · 2 unmodified lines | |||
| 2804 | fi | 2804 | fi |
| 2805 | 2805 | ||
| 2806 | if reset "mpc switch to backup both sides" && | 2806 | if reset "mpc switch to backup both sides" && |
| 2807 | continue_if mptcp_lib_kallsyms_doesnt_have "mptcp_subflow_send_ack$"; then | 2807 | continue_if mptcp_lib_kallsyms_doesnt_have "T mptcp_subflow_send_ack$"; then |
| 2808 | pm_nl_add_endpoint $ns1 10.0.1.1 flags subflow | 2808 | pm_nl_add_endpoint $ns1 10.0.1.1 flags subflow |
| 2809 | pm_nl_add_endpoint $ns2 10.0.1.2 flags subflow | 2809 | pm_nl_add_endpoint $ns2 10.0.1.2 flags subflow |
| 2810 | sflags=backup speed=slow \ | 2810 | sflags=backup speed=slow \ |
| @@ -297,7 +297,7 @@ kci_test_addrlft() · 296 unmodified lines | |||
| 297 | done | 297 | done |
| 298 | 298 | ||
| 299 | sleep 5 | 299 | sleep 5 |
| 300 | run_cmd_grep "10.23.11." ip addr show dev "$devdummy" | 300 | run_cmd_grep_fail "10.23.11." ip addr show dev "$devdummy" |
| 301 | if [ $? -eq 0 ]; then | 301 | if [ $? -eq 0 ]; then |
| 302 | check_err 1 | 302 | check_err 1 |
| 303 | end_test "FAIL: preferred_lft addresses remaining" | 303 | end_test "FAIL: preferred_lft addresses remaining" |
| @@ -0,0 +1,29 @@ | |||
| 1 | #!/bin/sh | ||
| 2 | # SPDX-License-Identifier: GPL-2.0 | ||
| 3 | |||
| 4 | readonly NETNS="ns-$(mktemp -u XXXXXX)" | ||
| 5 | |||
| 6 | ret=0 | ||
| 7 | |||
| 8 | cleanup() { | ||
| 9 | ip netns del $NETNS | ||
| 10 | } | ||
| 11 | |||
| 12 | trap cleanup EXIT | ||
| 13 | |||
| 14 | fail() { | ||
| 15 | echo "ERROR: ${1:-unexpected return code} (ret: $_)" >&2 | ||
| 16 | ret=1 | ||
| 17 | } | ||
| 18 | |||
| 19 | ip netns add ${NETNS} | ||
| 20 | ip netns exec ${NETNS} ip link add bond0 type bond mode 0 | ||
| 21 | ip netns exec ${NETNS} ip link add bond_slave_1 type veth peer veth2 | ||
| 22 | ip netns exec ${NETNS} ip link set bond_slave_1 master bond0 | ||
| 23 | ip netns exec ${NETNS} ethtool -K bond0 rx-vlan-filter off | ||
| 24 | ip netns exec ${NETNS} ip link add link bond_slave_1 name bond_slave_1.0 type vlan id 0 | ||
| 25 | ip netns exec ${NETNS} ip link add link bond0 name bond0.0 type vlan id 0 | ||
| 26 | ip netns exec ${NETNS} ip link set bond_slave_1 nomaster | ||
| 27 | ip netns exec ${NETNS} ip link del veth2 || fail "Please check vlan HW filter function" | ||
| 28 | |||
| 29 | exit $ret | ||