diff options
| author | Linus Torvalds <torvalds@linux-foundation.org> | 2018-06-20 18:13:42 -0400 |
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2018-06-20 18:13:42 -0400 |
| commit | d8894a08d91e230c5af9eed3de80114c5aaa3ccf (patch) | |
| tree | d7cf7cb1bc5bc85a5c0f00dcae0f624c1212d67d | |
| parent | 81e97f01371f4e1701feeafe484665112cd9ddc2 (diff) | |
| parent | 9887cba19978a5f288100ef90a37684cc8d5e0a6 (diff) | |
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
Pull networking fixes from David Miller:
1) Fix crash on bpf_prog_load() errors, from Daniel Borkmann.
2) Fix ATM VCC memory accounting, from David Woodhouse.
3) fib6_info objects need RCU freeing, from Eric Dumazet.
4) Fix SO_BINDTODEVICE handling for TCP sockets, from David Ahern.
5) Fix clobbered error code in enic_open() failure path, from
Govindarajulu Varadarajan.
6) Propagate dev_get_valid_name() error returns properly, from Li
RongQing.
7) Fix suspend/resume in davinci_emac driver, from Bartosz Golaszewski.
8) Various act_ife fixes (recursive locking, IDR leaks, etc.) from
Davide Caratti.
9) Fix buggy checksum handling in sungem driver, from Eric Dumazet.
* git://git.kernel.org/pub/scm/linux/kernel/git/davem/net: (40 commits)
ip: limit use of gso_size to udp
stmmac: fix DMA channel hang in half-duplex mode
net: stmmac: socfpga: add additional ocp reset line for Stratix10
net: sungem: fix rx checksum support
bpfilter: ignore binary files
bpfilter: fix build error
net/usb/drivers: Remove useless hrtimer_active check
net/sched: act_ife: preserve the action control in case of error
net/sched: act_ife: fix recursive lock and idr leak
net: ethernet: fix suspend/resume in davinci_emac
net: propagate dev_get_valid_name return code
enic: do not overwrite error code
net/tcp: Fix socket lookups with SO_BINDTODEVICE
ptp: replace getnstimeofday64() with ktime_get_real_ts64()
net/ipv6: respect rcu grace period before freeing fib6_info
net: net_failover: fix typo in net_failover_slave_register()
ipvlan: use ETH_MAX_MTU as max mtu
net: hamradio: use eth_broadcast_addr
enic: initialize enic->rfs_h.lock in enic_probe
MAINTAINERS: Add Sam as the maintainer for NCSI
...
53 files changed, 371 insertions, 195 deletions
diff --git a/MAINTAINERS b/MAINTAINERS index 1d7d648d8aad..edf3cf5ea691 100644 --- a/MAINTAINERS +++ b/MAINTAINERS | |||
| @@ -9751,6 +9751,11 @@ L: linux-scsi@vger.kernel.org | |||
| 9751 | S: Maintained | 9751 | S: Maintained |
| 9752 | F: drivers/scsi/NCR_D700.* | 9752 | F: drivers/scsi/NCR_D700.* |
| 9753 | 9753 | ||
| 9754 | NCSI LIBRARY: | ||
| 9755 | M: Samuel Mendoza-Jonas <sam@mendozajonas.com> | ||
| 9756 | S: Maintained | ||
| 9757 | F: net/ncsi/ | ||
| 9758 | |||
| 9754 | NCT6775 HARDWARE MONITOR DRIVER | 9759 | NCT6775 HARDWARE MONITOR DRIVER |
| 9755 | M: Guenter Roeck <linux@roeck-us.net> | 9760 | M: Guenter Roeck <linux@roeck-us.net> |
| 9756 | L: linux-hwmon@vger.kernel.org | 9761 | L: linux-hwmon@vger.kernel.org |
diff --git a/drivers/bluetooth/hci_nokia.c b/drivers/bluetooth/hci_nokia.c index 14d159e2042d..2dc33e65d2d0 100644 --- a/drivers/bluetooth/hci_nokia.c +++ b/drivers/bluetooth/hci_nokia.c | |||
| @@ -29,7 +29,7 @@ | |||
| 29 | #include <linux/slab.h> | 29 | #include <linux/slab.h> |
| 30 | #include <linux/string.h> | 30 | #include <linux/string.h> |
| 31 | #include <linux/types.h> | 31 | #include <linux/types.h> |
| 32 | #include <linux/unaligned/le_struct.h> | 32 | #include <asm/unaligned.h> |
| 33 | #include <net/bluetooth/bluetooth.h> | 33 | #include <net/bluetooth/bluetooth.h> |
| 34 | #include <net/bluetooth/hci_core.h> | 34 | #include <net/bluetooth/hci_core.h> |
| 35 | 35 | ||
diff --git a/drivers/net/ethernet/cisco/enic/enic_clsf.c b/drivers/net/ethernet/cisco/enic/enic_clsf.c index 973c1fb70d09..99038dfc7fbe 100644 --- a/drivers/net/ethernet/cisco/enic/enic_clsf.c +++ b/drivers/net/ethernet/cisco/enic/enic_clsf.c | |||
| @@ -79,7 +79,6 @@ void enic_rfs_flw_tbl_init(struct enic *enic) | |||
| 79 | enic->rfs_h.max = enic->config.num_arfs; | 79 | enic->rfs_h.max = enic->config.num_arfs; |
| 80 | enic->rfs_h.free = enic->rfs_h.max; | 80 | enic->rfs_h.free = enic->rfs_h.max; |
| 81 | enic->rfs_h.toclean = 0; | 81 | enic->rfs_h.toclean = 0; |
| 82 | enic_rfs_timer_start(enic); | ||
| 83 | } | 82 | } |
| 84 | 83 | ||
| 85 | void enic_rfs_flw_tbl_free(struct enic *enic) | 84 | void enic_rfs_flw_tbl_free(struct enic *enic) |
| @@ -88,7 +87,6 @@ void enic_rfs_flw_tbl_free(struct enic *enic) | |||
| 88 | 87 | ||
| 89 | enic_rfs_timer_stop(enic); | 88 | enic_rfs_timer_stop(enic); |
| 90 | spin_lock_bh(&enic->rfs_h.lock); | 89 | spin_lock_bh(&enic->rfs_h.lock); |
| 91 | enic->rfs_h.free = 0; | ||
| 92 | for (i = 0; i < (1 << ENIC_RFS_FLW_BITSHIFT); i++) { | 90 | for (i = 0; i < (1 << ENIC_RFS_FLW_BITSHIFT); i++) { |
| 93 | struct hlist_head *hhead; | 91 | struct hlist_head *hhead; |
| 94 | struct hlist_node *tmp; | 92 | struct hlist_node *tmp; |
| @@ -99,6 +97,7 @@ void enic_rfs_flw_tbl_free(struct enic *enic) | |||
| 99 | enic_delfltr(enic, n->fltr_id); | 97 | enic_delfltr(enic, n->fltr_id); |
| 100 | hlist_del(&n->node); | 98 | hlist_del(&n->node); |
| 101 | kfree(n); | 99 | kfree(n); |
| 100 | enic->rfs_h.free++; | ||
| 102 | } | 101 | } |
| 103 | } | 102 | } |
| 104 | spin_unlock_bh(&enic->rfs_h.lock); | 103 | spin_unlock_bh(&enic->rfs_h.lock); |
diff --git a/drivers/net/ethernet/cisco/enic/enic_main.c b/drivers/net/ethernet/cisco/enic/enic_main.c index 30d2eaa18c04..90c645b8538e 100644 --- a/drivers/net/ethernet/cisco/enic/enic_main.c +++ b/drivers/net/ethernet/cisco/enic/enic_main.c | |||
| @@ -1920,7 +1920,7 @@ static int enic_open(struct net_device *netdev) | |||
| 1920 | { | 1920 | { |
| 1921 | struct enic *enic = netdev_priv(netdev); | 1921 | struct enic *enic = netdev_priv(netdev); |
| 1922 | unsigned int i; | 1922 | unsigned int i; |
| 1923 | int err; | 1923 | int err, ret; |
| 1924 | 1924 | ||
| 1925 | err = enic_request_intr(enic); | 1925 | err = enic_request_intr(enic); |
| 1926 | if (err) { | 1926 | if (err) { |
| @@ -1971,16 +1971,15 @@ static int enic_open(struct net_device *netdev) | |||
| 1971 | vnic_intr_unmask(&enic->intr[i]); | 1971 | vnic_intr_unmask(&enic->intr[i]); |
| 1972 | 1972 | ||
| 1973 | enic_notify_timer_start(enic); | 1973 | enic_notify_timer_start(enic); |
| 1974 | enic_rfs_flw_tbl_init(enic); | 1974 | enic_rfs_timer_start(enic); |
| 1975 | 1975 | ||
| 1976 | return 0; | 1976 | return 0; |
| 1977 | 1977 | ||
| 1978 | err_out_free_rq: | 1978 | err_out_free_rq: |
| 1979 | for (i = 0; i < enic->rq_count; i++) { | 1979 | for (i = 0; i < enic->rq_count; i++) { |
| 1980 | err = vnic_rq_disable(&enic->rq[i]); | 1980 | ret = vnic_rq_disable(&enic->rq[i]); |
| 1981 | if (err) | 1981 | if (!ret) |
| 1982 | return err; | 1982 | vnic_rq_clean(&enic->rq[i], enic_free_rq_buf); |
| 1983 | vnic_rq_clean(&enic->rq[i], enic_free_rq_buf); | ||
| 1984 | } | 1983 | } |
| 1985 | enic_dev_notify_unset(enic); | 1984 | enic_dev_notify_unset(enic); |
| 1986 | err_out_free_intr: | 1985 | err_out_free_intr: |
| @@ -2904,6 +2903,7 @@ static int enic_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
| 2904 | 2903 | ||
| 2905 | timer_setup(&enic->notify_timer, enic_notify_timer, 0); | 2904 | timer_setup(&enic->notify_timer, enic_notify_timer, 0); |
| 2906 | 2905 | ||
| 2906 | enic_rfs_flw_tbl_init(enic); | ||
| 2907 | enic_set_rx_coal_setting(enic); | 2907 | enic_set_rx_coal_setting(enic); |
| 2908 | INIT_WORK(&enic->reset, enic_reset); | 2908 | INIT_WORK(&enic->reset, enic_reset); |
| 2909 | INIT_WORK(&enic->tx_hang_reset, enic_tx_hang_reset); | 2909 | INIT_WORK(&enic->tx_hang_reset, enic_tx_hang_reset); |
diff --git a/drivers/net/ethernet/faraday/ftgmac100.c b/drivers/net/ethernet/faraday/ftgmac100.c index 78db8e62a83f..ed6c76d20b45 100644 --- a/drivers/net/ethernet/faraday/ftgmac100.c +++ b/drivers/net/ethernet/faraday/ftgmac100.c | |||
| @@ -1735,8 +1735,8 @@ static void ftgmac100_ncsi_handler(struct ncsi_dev *nd) | |||
| 1735 | if (unlikely(nd->state != ncsi_dev_state_functional)) | 1735 | if (unlikely(nd->state != ncsi_dev_state_functional)) |
| 1736 | return; | 1736 | return; |
| 1737 | 1737 | ||
| 1738 | netdev_info(nd->dev, "NCSI interface %s\n", | 1738 | netdev_dbg(nd->dev, "NCSI interface %s\n", |
| 1739 | nd->link_up ? "up" : "down"); | 1739 | nd->link_up ? "up" : "down"); |
| 1740 | } | 1740 | } |
| 1741 | 1741 | ||
| 1742 | static void ftgmac100_setup_clk(struct ftgmac100 *priv) | 1742 | static void ftgmac100_setup_clk(struct ftgmac100 *priv) |
diff --git a/drivers/net/ethernet/intel/i40e/i40e_txrx.c b/drivers/net/ethernet/intel/i40e/i40e_txrx.c index 8ffb7454e67c..ed6dbcfd4e96 100644 --- a/drivers/net/ethernet/intel/i40e/i40e_txrx.c +++ b/drivers/net/ethernet/intel/i40e/i40e_txrx.c | |||
| @@ -2103,9 +2103,8 @@ static struct sk_buff *i40e_build_skb(struct i40e_ring *rx_ring, | |||
| 2103 | unsigned int truesize = i40e_rx_pg_size(rx_ring) / 2; | 2103 | unsigned int truesize = i40e_rx_pg_size(rx_ring) / 2; |
| 2104 | #else | 2104 | #else |
| 2105 | unsigned int truesize = SKB_DATA_ALIGN(sizeof(struct skb_shared_info)) + | 2105 | unsigned int truesize = SKB_DATA_ALIGN(sizeof(struct skb_shared_info)) + |
| 2106 | SKB_DATA_ALIGN(I40E_SKB_PAD + | 2106 | SKB_DATA_ALIGN(xdp->data_end - |
| 2107 | (xdp->data_end - | 2107 | xdp->data_hard_start); |
| 2108 | xdp->data_hard_start)); | ||
| 2109 | #endif | 2108 | #endif |
| 2110 | struct sk_buff *skb; | 2109 | struct sk_buff *skb; |
| 2111 | 2110 | ||
| @@ -2124,7 +2123,7 @@ static struct sk_buff *i40e_build_skb(struct i40e_ring *rx_ring, | |||
| 2124 | return NULL; | 2123 | return NULL; |
| 2125 | 2124 | ||
| 2126 | /* update pointers within the skb to store the data */ | 2125 | /* update pointers within the skb to store the data */ |
| 2127 | skb_reserve(skb, I40E_SKB_PAD + (xdp->data - xdp->data_hard_start)); | 2126 | skb_reserve(skb, xdp->data - xdp->data_hard_start); |
| 2128 | __skb_put(skb, xdp->data_end - xdp->data); | 2127 | __skb_put(skb, xdp->data_end - xdp->data); |
| 2129 | if (metasize) | 2128 | if (metasize) |
| 2130 | skb_metadata_set(skb, metasize); | 2129 | skb_metadata_set(skb, metasize); |
diff --git a/drivers/net/ethernet/qlogic/qed/qed_dcbx.c b/drivers/net/ethernet/qlogic/qed/qed_dcbx.c index 8f31406ec894..f0b01385d5cb 100644 --- a/drivers/net/ethernet/qlogic/qed/qed_dcbx.c +++ b/drivers/net/ethernet/qlogic/qed/qed_dcbx.c | |||
| @@ -255,9 +255,8 @@ qed_dcbx_get_app_protocol_type(struct qed_hwfn *p_hwfn, | |||
| 255 | *type = DCBX_PROTOCOL_ROCE_V2; | 255 | *type = DCBX_PROTOCOL_ROCE_V2; |
| 256 | } else { | 256 | } else { |
| 257 | *type = DCBX_MAX_PROTOCOL_TYPE; | 257 | *type = DCBX_MAX_PROTOCOL_TYPE; |
| 258 | DP_ERR(p_hwfn, | 258 | DP_ERR(p_hwfn, "No action required, App TLV entry = 0x%x\n", |
| 259 | "No action required, App TLV id = 0x%x app_prio_bitmap = 0x%x\n", | 259 | app_prio_bitmap); |
| 260 | id, app_prio_bitmap); | ||
| 261 | return false; | 260 | return false; |
| 262 | } | 261 | } |
| 263 | 262 | ||
| @@ -1479,8 +1478,8 @@ static u8 qed_dcbnl_getcap(struct qed_dev *cdev, int capid, u8 *cap) | |||
| 1479 | *cap = 0x80; | 1478 | *cap = 0x80; |
| 1480 | break; | 1479 | break; |
| 1481 | case DCB_CAP_ATTR_DCBX: | 1480 | case DCB_CAP_ATTR_DCBX: |
| 1482 | *cap = (DCB_CAP_DCBX_LLD_MANAGED | DCB_CAP_DCBX_VER_CEE | | 1481 | *cap = (DCB_CAP_DCBX_VER_CEE | DCB_CAP_DCBX_VER_IEEE | |
| 1483 | DCB_CAP_DCBX_VER_IEEE | DCB_CAP_DCBX_STATIC); | 1482 | DCB_CAP_DCBX_STATIC); |
| 1484 | break; | 1483 | break; |
| 1485 | default: | 1484 | default: |
| 1486 | *cap = false; | 1485 | *cap = false; |
| @@ -1548,8 +1547,6 @@ static u8 qed_dcbnl_getdcbx(struct qed_dev *cdev) | |||
| 1548 | if (!dcbx_info) | 1547 | if (!dcbx_info) |
| 1549 | return 0; | 1548 | return 0; |
| 1550 | 1549 | ||
| 1551 | if (dcbx_info->operational.enabled) | ||
| 1552 | mode |= DCB_CAP_DCBX_LLD_MANAGED; | ||
| 1553 | if (dcbx_info->operational.ieee) | 1550 | if (dcbx_info->operational.ieee) |
| 1554 | mode |= DCB_CAP_DCBX_VER_IEEE; | 1551 | mode |= DCB_CAP_DCBX_VER_IEEE; |
| 1555 | if (dcbx_info->operational.cee) | 1552 | if (dcbx_info->operational.cee) |
diff --git a/drivers/net/ethernet/qlogic/qed/qed_ll2.c b/drivers/net/ethernet/qlogic/qed/qed_ll2.c index c97ebd681c47..012973d75ad0 100644 --- a/drivers/net/ethernet/qlogic/qed/qed_ll2.c +++ b/drivers/net/ethernet/qlogic/qed/qed_ll2.c | |||
| @@ -201,8 +201,9 @@ void qed_ll2b_complete_rx_packet(void *cxt, struct qed_ll2_comp_rx_data *data) | |||
| 201 | 201 | ||
| 202 | skb = build_skb(buffer->data, 0); | 202 | skb = build_skb(buffer->data, 0); |
| 203 | if (!skb) { | 203 | if (!skb) { |
| 204 | rc = -ENOMEM; | 204 | DP_INFO(cdev, "Failed to build SKB\n"); |
| 205 | goto out_post; | 205 | kfree(buffer->data); |
| 206 | goto out_post1; | ||
| 206 | } | 207 | } |
| 207 | 208 | ||
| 208 | data->u.placement_offset += NET_SKB_PAD; | 209 | data->u.placement_offset += NET_SKB_PAD; |
| @@ -224,8 +225,14 @@ void qed_ll2b_complete_rx_packet(void *cxt, struct qed_ll2_comp_rx_data *data) | |||
| 224 | cdev->ll2->cbs->rx_cb(cdev->ll2->cb_cookie, skb, | 225 | cdev->ll2->cbs->rx_cb(cdev->ll2->cb_cookie, skb, |
| 225 | data->opaque_data_0, | 226 | data->opaque_data_0, |
| 226 | data->opaque_data_1); | 227 | data->opaque_data_1); |
| 228 | } else { | ||
| 229 | DP_VERBOSE(p_hwfn, (NETIF_MSG_RX_STATUS | NETIF_MSG_PKTDATA | | ||
| 230 | QED_MSG_LL2 | QED_MSG_STORAGE), | ||
| 231 | "Dropping the packet\n"); | ||
| 232 | kfree(buffer->data); | ||
| 227 | } | 233 | } |
| 228 | 234 | ||
| 235 | out_post1: | ||
| 229 | /* Update Buffer information and update FW producer */ | 236 | /* Update Buffer information and update FW producer */ |
| 230 | buffer->data = new_data; | 237 | buffer->data = new_data; |
| 231 | buffer->phys_addr = new_phys_addr; | 238 | buffer->phys_addr = new_phys_addr; |
diff --git a/drivers/net/ethernet/qlogic/qed/qed_main.c b/drivers/net/ethernet/qlogic/qed/qed_main.c index b04d57ca5176..5c10fd7210c3 100644 --- a/drivers/net/ethernet/qlogic/qed/qed_main.c +++ b/drivers/net/ethernet/qlogic/qed/qed_main.c | |||
| @@ -567,8 +567,16 @@ static irqreturn_t qed_single_int(int irq, void *dev_instance) | |||
| 567 | /* Fastpath interrupts */ | 567 | /* Fastpath interrupts */ |
| 568 | for (j = 0; j < 64; j++) { | 568 | for (j = 0; j < 64; j++) { |
| 569 | if ((0x2ULL << j) & status) { | 569 | if ((0x2ULL << j) & status) { |
| 570 | hwfn->simd_proto_handler[j].func( | 570 | struct qed_simd_fp_handler *p_handler = |
| 571 | hwfn->simd_proto_handler[j].token); | 571 | &hwfn->simd_proto_handler[j]; |
| 572 | |||
| 573 | if (p_handler->func) | ||
| 574 | p_handler->func(p_handler->token); | ||
| 575 | else | ||
| 576 | DP_NOTICE(hwfn, | ||
| 577 | "Not calling fastpath handler as it is NULL [handler #%d, status 0x%llx]\n", | ||
| 578 | j, status); | ||
| 579 | |||
| 572 | status &= ~(0x2ULL << j); | 580 | status &= ~(0x2ULL << j); |
| 573 | rc = IRQ_HANDLED; | 581 | rc = IRQ_HANDLED; |
| 574 | } | 582 | } |
diff --git a/drivers/net/ethernet/stmicro/stmmac/Kconfig b/drivers/net/ethernet/stmicro/stmmac/Kconfig index cb5b0f58c395..edf20361ea5f 100644 --- a/drivers/net/ethernet/stmicro/stmmac/Kconfig +++ b/drivers/net/ethernet/stmicro/stmmac/Kconfig | |||
| @@ -111,7 +111,7 @@ config DWMAC_ROCKCHIP | |||
| 111 | config DWMAC_SOCFPGA | 111 | config DWMAC_SOCFPGA |
| 112 | tristate "SOCFPGA dwmac support" | 112 | tristate "SOCFPGA dwmac support" |
| 113 | default ARCH_SOCFPGA | 113 | default ARCH_SOCFPGA |
| 114 | depends on OF && (ARCH_SOCFPGA || COMPILE_TEST) | 114 | depends on OF && (ARCH_SOCFPGA || ARCH_STRATIX10 || COMPILE_TEST) |
| 115 | select MFD_SYSCON | 115 | select MFD_SYSCON |
| 116 | help | 116 | help |
| 117 | Support for ethernet controller on Altera SOCFPGA | 117 | Support for ethernet controller on Altera SOCFPGA |
diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c index 6e359572b9f0..5b3b06a0a3bf 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c | |||
| @@ -55,6 +55,7 @@ struct socfpga_dwmac { | |||
| 55 | struct device *dev; | 55 | struct device *dev; |
| 56 | struct regmap *sys_mgr_base_addr; | 56 | struct regmap *sys_mgr_base_addr; |
| 57 | struct reset_control *stmmac_rst; | 57 | struct reset_control *stmmac_rst; |
| 58 | struct reset_control *stmmac_ocp_rst; | ||
| 58 | void __iomem *splitter_base; | 59 | void __iomem *splitter_base; |
| 59 | bool f2h_ptp_ref_clk; | 60 | bool f2h_ptp_ref_clk; |
| 60 | struct tse_pcs pcs; | 61 | struct tse_pcs pcs; |
| @@ -262,8 +263,8 @@ static int socfpga_dwmac_set_phy_mode(struct socfpga_dwmac *dwmac) | |||
| 262 | val = SYSMGR_EMACGRP_CTRL_PHYSEL_ENUM_GMII_MII; | 263 | val = SYSMGR_EMACGRP_CTRL_PHYSEL_ENUM_GMII_MII; |
| 263 | 264 | ||
| 264 | /* Assert reset to the enet controller before changing the phy mode */ | 265 | /* Assert reset to the enet controller before changing the phy mode */ |
| 265 | if (dwmac->stmmac_rst) | 266 | reset_control_assert(dwmac->stmmac_ocp_rst); |
| 266 | reset_control_assert(dwmac->stmmac_rst); | 267 | reset_control_assert(dwmac->stmmac_rst); |
| 267 | 268 | ||
| 268 | regmap_read(sys_mgr_base_addr, reg_offset, &ctrl); | 269 | regmap_read(sys_mgr_base_addr, reg_offset, &ctrl); |
| 269 | ctrl &= ~(SYSMGR_EMACGRP_CTRL_PHYSEL_MASK << reg_shift); | 270 | ctrl &= ~(SYSMGR_EMACGRP_CTRL_PHYSEL_MASK << reg_shift); |
| @@ -288,8 +289,8 @@ static int socfpga_dwmac_set_phy_mode(struct socfpga_dwmac *dwmac) | |||
| 288 | /* Deassert reset for the phy configuration to be sampled by | 289 | /* Deassert reset for the phy configuration to be sampled by |
| 289 | * the enet controller, and operation to start in requested mode | 290 | * the enet controller, and operation to start in requested mode |
| 290 | */ | 291 | */ |
| 291 | if (dwmac->stmmac_rst) | 292 | reset_control_deassert(dwmac->stmmac_ocp_rst); |
| 292 | reset_control_deassert(dwmac->stmmac_rst); | 293 | reset_control_deassert(dwmac->stmmac_rst); |
| 293 | if (phymode == PHY_INTERFACE_MODE_SGMII) { | 294 | if (phymode == PHY_INTERFACE_MODE_SGMII) { |
| 294 | if (tse_pcs_init(dwmac->pcs.tse_pcs_base, &dwmac->pcs) != 0) { | 295 | if (tse_pcs_init(dwmac->pcs.tse_pcs_base, &dwmac->pcs) != 0) { |
| 295 | dev_err(dwmac->dev, "Unable to initialize TSE PCS"); | 296 | dev_err(dwmac->dev, "Unable to initialize TSE PCS"); |
| @@ -324,6 +325,15 @@ static int socfpga_dwmac_probe(struct platform_device *pdev) | |||
| 324 | goto err_remove_config_dt; | 325 | goto err_remove_config_dt; |
| 325 | } | 326 | } |
| 326 | 327 | ||
| 328 | dwmac->stmmac_ocp_rst = devm_reset_control_get_optional(dev, "stmmaceth-ocp"); | ||
| 329 | if (IS_ERR(dwmac->stmmac_ocp_rst)) { | ||
| 330 | ret = PTR_ERR(dwmac->stmmac_ocp_rst); | ||
| 331 | dev_err(dev, "error getting reset control of ocp %d\n", ret); | ||
| 332 | goto err_remove_config_dt; | ||
| 333 | } | ||
| 334 | |||
| 335 | reset_control_deassert(dwmac->stmmac_ocp_rst); | ||
| 336 | |||
| 327 | ret = socfpga_dwmac_parse_data(dwmac, dev); | 337 | ret = socfpga_dwmac_parse_data(dwmac, dev); |
| 328 | if (ret) { | 338 | if (ret) { |
| 329 | dev_err(dev, "Unable to parse OF data\n"); | 339 | dev_err(dev, "Unable to parse OF data\n"); |
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c index e79b0d7b388a..cba46b62a1cd 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | |||
| @@ -928,6 +928,7 @@ static void stmmac_check_pcs_mode(struct stmmac_priv *priv) | |||
| 928 | static int stmmac_init_phy(struct net_device *dev) | 928 | static int stmmac_init_phy(struct net_device *dev) |
| 929 | { | 929 | { |
| 930 | struct stmmac_priv *priv = netdev_priv(dev); | 930 | struct stmmac_priv *priv = netdev_priv(dev); |
| 931 | u32 tx_cnt = priv->plat->tx_queues_to_use; | ||
| 931 | struct phy_device *phydev; | 932 | struct phy_device *phydev; |
| 932 | char phy_id_fmt[MII_BUS_ID_SIZE + 3]; | 933 | char phy_id_fmt[MII_BUS_ID_SIZE + 3]; |
| 933 | char bus_id[MII_BUS_ID_SIZE]; | 934 | char bus_id[MII_BUS_ID_SIZE]; |
| @@ -969,6 +970,15 @@ static int stmmac_init_phy(struct net_device *dev) | |||
| 969 | SUPPORTED_1000baseT_Full); | 970 | SUPPORTED_1000baseT_Full); |
| 970 | 971 | ||
| 971 | /* | 972 | /* |
| 973 | * Half-duplex mode not supported with multiqueue | ||
| 974 | * half-duplex can only works with single queue | ||
| 975 | */ | ||
| 976 | if (tx_cnt > 1) | ||
| 977 | phydev->supported &= ~(SUPPORTED_1000baseT_Half | | ||
| 978 | SUPPORTED_100baseT_Half | | ||
| 979 | SUPPORTED_10baseT_Half); | ||
| 980 | |||
| 981 | /* | ||
| 972 | * Broken HW is sometimes missing the pull-up resistor on the | 982 | * Broken HW is sometimes missing the pull-up resistor on the |
| 973 | * MDIO line, which results in reads to non-existent devices returning | 983 | * MDIO line, which results in reads to non-existent devices returning |
| 974 | * 0 rather than 0xffff. Catch this here and treat 0 as a non-existent | 984 | * 0 rather than 0xffff. Catch this here and treat 0 as a non-existent |
diff --git a/drivers/net/ethernet/sun/sungem.c b/drivers/net/ethernet/sun/sungem.c index 7a16d40a72d1..b9221fc1674d 100644 --- a/drivers/net/ethernet/sun/sungem.c +++ b/drivers/net/ethernet/sun/sungem.c | |||
| @@ -60,8 +60,7 @@ | |||
| 60 | #include <linux/sungem_phy.h> | 60 | #include <linux/sungem_phy.h> |
| 61 | #include "sungem.h" | 61 | #include "sungem.h" |
| 62 | 62 | ||
| 63 | /* Stripping FCS is causing problems, disabled for now */ | 63 | #define STRIP_FCS |
| 64 | #undef STRIP_FCS | ||
| 65 | 64 | ||
| 66 | #define DEFAULT_MSG (NETIF_MSG_DRV | \ | 65 | #define DEFAULT_MSG (NETIF_MSG_DRV | \ |
| 67 | NETIF_MSG_PROBE | \ | 66 | NETIF_MSG_PROBE | \ |
| @@ -435,7 +434,7 @@ static int gem_rxmac_reset(struct gem *gp) | |||
| 435 | writel(desc_dma & 0xffffffff, gp->regs + RXDMA_DBLOW); | 434 | writel(desc_dma & 0xffffffff, gp->regs + RXDMA_DBLOW); |
| 436 | writel(RX_RING_SIZE - 4, gp->regs + RXDMA_KICK); | 435 | writel(RX_RING_SIZE - 4, gp->regs + RXDMA_KICK); |
| 437 | val = (RXDMA_CFG_BASE | (RX_OFFSET << 10) | | 436 | val = (RXDMA_CFG_BASE | (RX_OFFSET << 10) | |
| 438 | ((14 / 2) << 13) | RXDMA_CFG_FTHRESH_128); | 437 | (ETH_HLEN << 13) | RXDMA_CFG_FTHRESH_128); |
| 439 | writel(val, gp->regs + RXDMA_CFG); | 438 | writel(val, gp->regs + RXDMA_CFG); |
| 440 | if (readl(gp->regs + GREG_BIFCFG) & GREG_BIFCFG_M66EN) | 439 | if (readl(gp->regs + GREG_BIFCFG) & GREG_BIFCFG_M66EN) |
| 441 | writel(((5 & RXDMA_BLANK_IPKTS) | | 440 | writel(((5 & RXDMA_BLANK_IPKTS) | |
| @@ -760,7 +759,6 @@ static int gem_rx(struct gem *gp, int work_to_do) | |||
| 760 | struct net_device *dev = gp->dev; | 759 | struct net_device *dev = gp->dev; |
| 761 | int entry, drops, work_done = 0; | 760 | int entry, drops, work_done = 0; |
| 762 | u32 done; | 761 | u32 done; |
| 763 | __sum16 csum; | ||
| 764 | 762 | ||
| 765 | if (netif_msg_rx_status(gp)) | 763 | if (netif_msg_rx_status(gp)) |
| 766 | printk(KERN_DEBUG "%s: rx interrupt, done: %d, rx_new: %d\n", | 764 | printk(KERN_DEBUG "%s: rx interrupt, done: %d, rx_new: %d\n", |
| @@ -855,9 +853,13 @@ static int gem_rx(struct gem *gp, int work_to_do) | |||
| 855 | skb = copy_skb; | 853 | skb = copy_skb; |
| 856 | } | 854 | } |
| 857 | 855 | ||
| 858 | csum = (__force __sum16)htons((status & RXDCTRL_TCPCSUM) ^ 0xffff); | 856 | if (likely(dev->features & NETIF_F_RXCSUM)) { |
| 859 | skb->csum = csum_unfold(csum); | 857 | __sum16 csum; |
| 860 | skb->ip_summed = CHECKSUM_COMPLETE; | 858 | |
| 859 | csum = (__force __sum16)htons((status & RXDCTRL_TCPCSUM) ^ 0xffff); | ||
| 860 | skb->csum = csum_unfold(csum); | ||
| 861 | skb->ip_summed = CHECKSUM_COMPLETE; | ||
| 862 | } | ||
| 861 | skb->protocol = eth_type_trans(skb, gp->dev); | 863 | skb->protocol = eth_type_trans(skb, gp->dev); |
| 862 | 864 | ||
| 863 | napi_gro_receive(&gp->napi, skb); | 865 | napi_gro_receive(&gp->napi, skb); |
| @@ -1761,7 +1763,7 @@ static void gem_init_dma(struct gem *gp) | |||
| 1761 | writel(0, gp->regs + TXDMA_KICK); | 1763 | writel(0, gp->regs + TXDMA_KICK); |
| 1762 | 1764 | ||
| 1763 | val = (RXDMA_CFG_BASE | (RX_OFFSET << 10) | | 1765 | val = (RXDMA_CFG_BASE | (RX_OFFSET << 10) | |
| 1764 | ((14 / 2) << 13) | RXDMA_CFG_FTHRESH_128); | 1766 | (ETH_HLEN << 13) | RXDMA_CFG_FTHRESH_128); |
| 1765 | writel(val, gp->regs + RXDMA_CFG); | 1767 | writel(val, gp->regs + RXDMA_CFG); |
| 1766 | 1768 | ||
| 1767 | writel(desc_dma >> 32, gp->regs + RXDMA_DBHI); | 1769 | writel(desc_dma >> 32, gp->regs + RXDMA_DBHI); |
| @@ -2985,8 +2987,8 @@ static int gem_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
| 2985 | pci_set_drvdata(pdev, dev); | 2987 | pci_set_drvdata(pdev, dev); |
| 2986 | 2988 | ||
| 2987 | /* We can do scatter/gather and HW checksum */ | 2989 | /* We can do scatter/gather and HW checksum */ |
| 2988 | dev->hw_features = NETIF_F_SG | NETIF_F_HW_CSUM; | 2990 | dev->hw_features = NETIF_F_SG | NETIF_F_HW_CSUM | NETIF_F_RXCSUM; |
| 2989 | dev->features |= dev->hw_features | NETIF_F_RXCSUM; | 2991 | dev->features = dev->hw_features; |
| 2990 | if (pci_using_dac) | 2992 | if (pci_using_dac) |
| 2991 | dev->features |= NETIF_F_HIGHDMA; | 2993 | dev->features |= NETIF_F_HIGHDMA; |
| 2992 | 2994 | ||
diff --git a/drivers/net/ethernet/ti/davinci_emac.c b/drivers/net/ethernet/ti/davinci_emac.c index 06d7c9e4dcda..a1a6445b5a7e 100644 --- a/drivers/net/ethernet/ti/davinci_emac.c +++ b/drivers/net/ethernet/ti/davinci_emac.c | |||
| @@ -1385,6 +1385,11 @@ static int emac_devioctl(struct net_device *ndev, struct ifreq *ifrq, int cmd) | |||
| 1385 | return -EOPNOTSUPP; | 1385 | return -EOPNOTSUPP; |
| 1386 | } | 1386 | } |
| 1387 | 1387 | ||
| 1388 | static int match_first_device(struct device *dev, void *data) | ||
| 1389 | { | ||
| 1390 | return !strncmp(dev_name(dev), "davinci_mdio", 12); | ||
| 1391 | } | ||
| 1392 | |||
| 1388 | /** | 1393 | /** |
| 1389 | * emac_dev_open - EMAC device open | 1394 | * emac_dev_open - EMAC device open |
| 1390 | * @ndev: The DaVinci EMAC network adapter | 1395 | * @ndev: The DaVinci EMAC network adapter |
| @@ -1484,8 +1489,14 @@ static int emac_dev_open(struct net_device *ndev) | |||
| 1484 | 1489 | ||
| 1485 | /* use the first phy on the bus if pdata did not give us a phy id */ | 1490 | /* use the first phy on the bus if pdata did not give us a phy id */ |
| 1486 | if (!phydev && !priv->phy_id) { | 1491 | if (!phydev && !priv->phy_id) { |
| 1487 | phy = bus_find_device_by_name(&mdio_bus_type, NULL, | 1492 | /* NOTE: we can't use bus_find_device_by_name() here because |
| 1488 | "davinci_mdio"); | 1493 | * the device name is not guaranteed to be 'davinci_mdio'. On |
| 1494 | * some systems it can be 'davinci_mdio.0' so we need to use | ||
| 1495 | * strncmp() against the first part of the string to correctly | ||
| 1496 | * match it. | ||
| 1497 | */ | ||
| 1498 | phy = bus_find_device(&mdio_bus_type, NULL, NULL, | ||
| 1499 | match_first_device); | ||
| 1489 | if (phy) { | 1500 | if (phy) { |
| 1490 | priv->phy_id = dev_name(phy); | 1501 | priv->phy_id = dev_name(phy); |
| 1491 | if (!priv->phy_id || !*priv->phy_id) | 1502 | if (!priv->phy_id || !*priv->phy_id) |
diff --git a/drivers/net/hamradio/bpqether.c b/drivers/net/hamradio/bpqether.c index f347fd9c5b28..777fa59f5e0c 100644 --- a/drivers/net/hamradio/bpqether.c +++ b/drivers/net/hamradio/bpqether.c | |||
| @@ -89,10 +89,6 @@ | |||
| 89 | static const char banner[] __initconst = KERN_INFO \ | 89 | static const char banner[] __initconst = KERN_INFO \ |
| 90 | "AX.25: bpqether driver version 004\n"; | 90 | "AX.25: bpqether driver version 004\n"; |
| 91 | 91 | ||
| 92 | static char bcast_addr[6]={0xFF,0xFF,0xFF,0xFF,0xFF,0xFF}; | ||
| 93 | |||
| 94 | static char bpq_eth_addr[6]; | ||
| 95 | |||
| 96 | static int bpq_rcv(struct sk_buff *, struct net_device *, struct packet_type *, struct net_device *); | 92 | static int bpq_rcv(struct sk_buff *, struct net_device *, struct packet_type *, struct net_device *); |
| 97 | static int bpq_device_event(struct notifier_block *, unsigned long, void *); | 93 | static int bpq_device_event(struct notifier_block *, unsigned long, void *); |
| 98 | 94 | ||
| @@ -501,8 +497,8 @@ static int bpq_new_device(struct net_device *edev) | |||
| 501 | bpq->ethdev = edev; | 497 | bpq->ethdev = edev; |
| 502 | bpq->axdev = ndev; | 498 | bpq->axdev = ndev; |
| 503 | 499 | ||
| 504 | memcpy(bpq->dest_addr, bcast_addr, sizeof(bpq_eth_addr)); | 500 | eth_broadcast_addr(bpq->dest_addr); |
| 505 | memcpy(bpq->acpt_addr, bcast_addr, sizeof(bpq_eth_addr)); | 501 | eth_broadcast_addr(bpq->acpt_addr); |
| 506 | 502 | ||
| 507 | err = register_netdevice(ndev); | 503 | err = register_netdevice(ndev); |
| 508 | if (err) | 504 | if (err) |
diff --git a/drivers/net/ipvlan/ipvlan_main.c b/drivers/net/ipvlan/ipvlan_main.c index 4377c26f714d..d02f0a7c534e 100644 --- a/drivers/net/ipvlan/ipvlan_main.c +++ b/drivers/net/ipvlan/ipvlan_main.c | |||
| @@ -693,6 +693,7 @@ void ipvlan_link_setup(struct net_device *dev) | |||
| 693 | { | 693 | { |
| 694 | ether_setup(dev); | 694 | ether_setup(dev); |
| 695 | 695 | ||
| 696 | dev->max_mtu = ETH_MAX_MTU; | ||
| 696 | dev->priv_flags &= ~(IFF_XMIT_DST_RELEASE | IFF_TX_SKB_SHARING); | 697 | dev->priv_flags &= ~(IFF_XMIT_DST_RELEASE | IFF_TX_SKB_SHARING); |
| 697 | dev->priv_flags |= IFF_UNICAST_FLT | IFF_NO_QUEUE; | 698 | dev->priv_flags |= IFF_UNICAST_FLT | IFF_NO_QUEUE; |
| 698 | dev->netdev_ops = &ipvlan_netdev_ops; | 699 | dev->netdev_ops = &ipvlan_netdev_ops; |
diff --git a/drivers/net/net_failover.c b/drivers/net/net_failover.c index 83f7420ddea5..4f390fa557e4 100644 --- a/drivers/net/net_failover.c +++ b/drivers/net/net_failover.c | |||
| @@ -527,7 +527,7 @@ static int net_failover_slave_register(struct net_device *slave_dev, | |||
| 527 | 527 | ||
| 528 | netif_addr_lock_bh(failover_dev); | 528 | netif_addr_lock_bh(failover_dev); |
| 529 | dev_uc_sync_multiple(slave_dev, failover_dev); | 529 | dev_uc_sync_multiple(slave_dev, failover_dev); |
| 530 | dev_uc_sync_multiple(slave_dev, failover_dev); | 530 | dev_mc_sync_multiple(slave_dev, failover_dev); |
| 531 | netif_addr_unlock_bh(failover_dev); | 531 | netif_addr_unlock_bh(failover_dev); |
| 532 | 532 | ||
| 533 | err = vlan_vids_add_by_dev(slave_dev, failover_dev); | 533 | err = vlan_vids_add_by_dev(slave_dev, failover_dev); |
diff --git a/drivers/net/usb/cdc_ncm.c b/drivers/net/usb/cdc_ncm.c index b0e8b9613054..1eaec648bd1f 100644 --- a/drivers/net/usb/cdc_ncm.c +++ b/drivers/net/usb/cdc_ncm.c | |||
| @@ -967,8 +967,7 @@ void cdc_ncm_unbind(struct usbnet *dev, struct usb_interface *intf) | |||
| 967 | 967 | ||
| 968 | atomic_set(&ctx->stop, 1); | 968 | atomic_set(&ctx->stop, 1); |
| 969 | 969 | ||
| 970 | if (hrtimer_active(&ctx->tx_timer)) | 970 | hrtimer_cancel(&ctx->tx_timer); |
| 971 | hrtimer_cancel(&ctx->tx_timer); | ||
| 972 | 971 | ||
| 973 | tasklet_kill(&ctx->bh); | 972 | tasklet_kill(&ctx->bh); |
| 974 | 973 | ||
diff --git a/drivers/ptp/ptp_chardev.c b/drivers/ptp/ptp_chardev.c index 767c485af59b..547dbdac9d54 100644 --- a/drivers/ptp/ptp_chardev.c +++ b/drivers/ptp/ptp_chardev.c | |||
| @@ -221,7 +221,7 @@ long ptp_ioctl(struct posix_clock *pc, unsigned int cmd, unsigned long arg) | |||
| 221 | } | 221 | } |
| 222 | pct = &sysoff->ts[0]; | 222 | pct = &sysoff->ts[0]; |
| 223 | for (i = 0; i < sysoff->n_samples; i++) { | 223 | for (i = 0; i < sysoff->n_samples; i++) { |
| 224 | getnstimeofday64(&ts); | 224 | ktime_get_real_ts64(&ts); |
| 225 | pct->sec = ts.tv_sec; | 225 | pct->sec = ts.tv_sec; |
| 226 | pct->nsec = ts.tv_nsec; | 226 | pct->nsec = ts.tv_nsec; |
| 227 | pct++; | 227 | pct++; |
| @@ -230,7 +230,7 @@ long ptp_ioctl(struct posix_clock *pc, unsigned int cmd, unsigned long arg) | |||
| 230 | pct->nsec = ts.tv_nsec; | 230 | pct->nsec = ts.tv_nsec; |
| 231 | pct++; | 231 | pct++; |
| 232 | } | 232 | } |
| 233 | getnstimeofday64(&ts); | 233 | ktime_get_real_ts64(&ts); |
| 234 | pct->sec = ts.tv_sec; | 234 | pct->sec = ts.tv_sec; |
| 235 | pct->nsec = ts.tv_nsec; | 235 | pct->nsec = ts.tv_nsec; |
| 236 | if (copy_to_user((void __user *)arg, sysoff, sizeof(*sysoff))) | 236 | if (copy_to_user((void __user *)arg, sysoff, sizeof(*sysoff))) |
diff --git a/drivers/ptp/ptp_qoriq.c b/drivers/ptp/ptp_qoriq.c index 1468a1642b49..e8652c148c52 100644 --- a/drivers/ptp/ptp_qoriq.c +++ b/drivers/ptp/ptp_qoriq.c | |||
| @@ -374,7 +374,7 @@ static int qoriq_ptp_probe(struct platform_device *dev) | |||
| 374 | pr_err("ioremap ptp registers failed\n"); | 374 | pr_err("ioremap ptp registers failed\n"); |
| 375 | goto no_ioremap; | 375 | goto no_ioremap; |
| 376 | } | 376 | } |
| 377 | getnstimeofday64(&now); | 377 | ktime_get_real_ts64(&now); |
| 378 | ptp_qoriq_settime(&qoriq_ptp->caps, &now); | 378 | ptp_qoriq_settime(&qoriq_ptp->caps, &now); |
| 379 | 379 | ||
| 380 | tmr_ctrl = | 380 | tmr_ctrl = |
diff --git a/include/linux/atmdev.h b/include/linux/atmdev.h index 0c27515d2cf6..8124815eb121 100644 --- a/include/linux/atmdev.h +++ b/include/linux/atmdev.h | |||
| @@ -214,6 +214,7 @@ struct atmphy_ops { | |||
| 214 | struct atm_skb_data { | 214 | struct atm_skb_data { |
| 215 | struct atm_vcc *vcc; /* ATM VCC */ | 215 | struct atm_vcc *vcc; /* ATM VCC */ |
| 216 | unsigned long atm_options; /* ATM layer options */ | 216 | unsigned long atm_options; /* ATM layer options */ |
| 217 | unsigned int acct_truesize; /* truesize accounted to vcc */ | ||
| 217 | }; | 218 | }; |
| 218 | 219 | ||
| 219 | #define VCC_HTABLE_SIZE 32 | 220 | #define VCC_HTABLE_SIZE 32 |
| @@ -241,6 +242,20 @@ void vcc_insert_socket(struct sock *sk); | |||
| 241 | 242 | ||
| 242 | void atm_dev_release_vccs(struct atm_dev *dev); | 243 | void atm_dev_release_vccs(struct atm_dev *dev); |
| 243 | 244 | ||
| 245 | static inline void atm_account_tx(struct atm_vcc *vcc, struct sk_buff *skb) | ||
| 246 | { | ||
| 247 | /* | ||
| 248 | * Because ATM skbs may not belong to a sock (and we don't | ||
| 249 | * necessarily want to), skb->truesize may be adjusted, | ||
| 250 | * escaping the hack in pskb_expand_head() which avoids | ||
| 251 | * doing so for some cases. So stash the value of truesize | ||
| 252 | * at the time we accounted it, and atm_pop_raw() can use | ||
| 253 | * that value later, in case it changes. | ||
| 254 | */ | ||
| 255 | refcount_add(skb->truesize, &sk_atm(vcc)->sk_wmem_alloc); | ||
| 256 | ATM_SKB(skb)->acct_truesize = skb->truesize; | ||
| 257 | ATM_SKB(skb)->atm_options = vcc->atm_options; | ||
| 258 | } | ||
| 244 | 259 | ||
| 245 | static inline void atm_force_charge(struct atm_vcc *vcc,int truesize) | 260 | static inline void atm_force_charge(struct atm_vcc *vcc,int truesize) |
| 246 | { | 261 | { |
diff --git a/include/linux/bpf.h b/include/linux/bpf.h index 995c3b1e59bf..7df32a3200f7 100644 --- a/include/linux/bpf.h +++ b/include/linux/bpf.h | |||
| @@ -488,12 +488,15 @@ void bpf_patch_call_args(struct bpf_insn *insn, u32 stack_depth); | |||
| 488 | 488 | ||
| 489 | /* Map specifics */ | 489 | /* Map specifics */ |
| 490 | struct xdp_buff; | 490 | struct xdp_buff; |
| 491 | struct sk_buff; | ||
| 491 | 492 | ||
| 492 | struct bpf_dtab_netdev *__dev_map_lookup_elem(struct bpf_map *map, u32 key); | 493 | struct bpf_dtab_netdev *__dev_map_lookup_elem(struct bpf_map *map, u32 key); |
| 493 | void __dev_map_insert_ctx(struct bpf_map *map, u32 index); | 494 | void __dev_map_insert_ctx(struct bpf_map *map, u32 index); |
| 494 | void __dev_map_flush(struct bpf_map *map); | 495 | void __dev_map_flush(struct bpf_map *map); |
| 495 | int dev_map_enqueue(struct bpf_dtab_netdev *dst, struct xdp_buff *xdp, | 496 | int dev_map_enqueue(struct bpf_dtab_netdev *dst, struct xdp_buff *xdp, |
| 496 | struct net_device *dev_rx); | 497 | struct net_device *dev_rx); |
| 498 | int dev_map_generic_redirect(struct bpf_dtab_netdev *dst, struct sk_buff *skb, | ||
| 499 | struct bpf_prog *xdp_prog); | ||
| 497 | 500 | ||
| 498 | struct bpf_cpu_map_entry *__cpu_map_lookup_elem(struct bpf_map *map, u32 key); | 501 | struct bpf_cpu_map_entry *__cpu_map_lookup_elem(struct bpf_map *map, u32 key); |
| 499 | void __cpu_map_insert_ctx(struct bpf_map *map, u32 index); | 502 | void __cpu_map_insert_ctx(struct bpf_map *map, u32 index); |
| @@ -586,6 +589,15 @@ int dev_map_enqueue(struct bpf_dtab_netdev *dst, struct xdp_buff *xdp, | |||
| 586 | return 0; | 589 | return 0; |
| 587 | } | 590 | } |
| 588 | 591 | ||
| 592 | struct sk_buff; | ||
| 593 | |||
| 594 | static inline int dev_map_generic_redirect(struct bpf_dtab_netdev *dst, | ||
| 595 | struct sk_buff *skb, | ||
| 596 | struct bpf_prog *xdp_prog) | ||
| 597 | { | ||
| 598 | return 0; | ||
| 599 | } | ||
| 600 | |||
| 589 | static inline | 601 | static inline |
| 590 | struct bpf_cpu_map_entry *__cpu_map_lookup_elem(struct bpf_map *map, u32 key) | 602 | struct bpf_cpu_map_entry *__cpu_map_lookup_elem(struct bpf_map *map, u32 key) |
| 591 | { | 603 | { |
diff --git a/include/linux/filter.h b/include/linux/filter.h index 45fc0f5000d8..b615df57b7d5 100644 --- a/include/linux/filter.h +++ b/include/linux/filter.h | |||
| @@ -19,6 +19,7 @@ | |||
| 19 | #include <linux/cryptohash.h> | 19 | #include <linux/cryptohash.h> |
| 20 | #include <linux/set_memory.h> | 20 | #include <linux/set_memory.h> |
| 21 | #include <linux/kallsyms.h> | 21 | #include <linux/kallsyms.h> |
| 22 | #include <linux/if_vlan.h> | ||
| 22 | 23 | ||
| 23 | #include <net/sch_generic.h> | 24 | #include <net/sch_generic.h> |
| 24 | 25 | ||
| @@ -469,7 +470,8 @@ struct sock_fprog_kern { | |||
| 469 | }; | 470 | }; |
| 470 | 471 | ||
| 471 | struct bpf_binary_header { | 472 | struct bpf_binary_header { |
| 472 | unsigned int pages; | 473 | u16 pages; |
| 474 | u16 locked:1; | ||
| 473 | u8 image[]; | 475 | u8 image[]; |
| 474 | }; | 476 | }; |
| 475 | 477 | ||
| @@ -671,15 +673,18 @@ bpf_ctx_narrow_access_ok(u32 off, u32 size, u32 size_default) | |||
| 671 | 673 | ||
| 672 | #define bpf_classic_proglen(fprog) (fprog->len * sizeof(fprog->filter[0])) | 674 | #define bpf_classic_proglen(fprog) (fprog->len * sizeof(fprog->filter[0])) |
| 673 | 675 | ||
| 674 | #ifdef CONFIG_ARCH_HAS_SET_MEMORY | ||
| 675 | static inline void bpf_prog_lock_ro(struct bpf_prog *fp) | 676 | static inline void bpf_prog_lock_ro(struct bpf_prog *fp) |
| 676 | { | 677 | { |
| 678 | #ifdef CONFIG_ARCH_HAS_SET_MEMORY | ||
| 677 | fp->locked = 1; | 679 | fp->locked = 1; |
| 678 | WARN_ON_ONCE(set_memory_ro((unsigned long)fp, fp->pages)); | 680 | if (set_memory_ro((unsigned long)fp, fp->pages)) |
| 681 | fp->locked = 0; | ||
| 682 | #endif | ||
| 679 | } | 683 | } |
| 680 | 684 | ||
| 681 | static inline void bpf_prog_unlock_ro(struct bpf_prog *fp) | 685 | static inline void bpf_prog_unlock_ro(struct bpf_prog *fp) |
| 682 | { | 686 | { |
| 687 | #ifdef CONFIG_ARCH_HAS_SET_MEMORY | ||
| 683 | if (fp->locked) { | 688 | if (fp->locked) { |
| 684 | WARN_ON_ONCE(set_memory_rw((unsigned long)fp, fp->pages)); | 689 | WARN_ON_ONCE(set_memory_rw((unsigned long)fp, fp->pages)); |
| 685 | /* In case set_memory_rw() fails, we want to be the first | 690 | /* In case set_memory_rw() fails, we want to be the first |
| @@ -687,34 +692,30 @@ static inline void bpf_prog_unlock_ro(struct bpf_prog *fp) | |||
| 687 | */ | 692 | */ |
| 688 | fp->locked = 0; | 693 | fp->locked = 0; |
| 689 | } | 694 | } |
| 695 | #endif | ||
| 690 | } | 696 | } |
| 691 | 697 | ||
| 692 | static inline void bpf_jit_binary_lock_ro(struct bpf_binary_header *hdr) | 698 | static inline void bpf_jit_binary_lock_ro(struct bpf_binary_header *hdr) |
| 693 | { | 699 | { |
| 694 | WARN_ON_ONCE(set_memory_ro((unsigned long)hdr, hdr->pages)); | 700 | #ifdef CONFIG_ARCH_HAS_SET_MEMORY |
| 695 | } | 701 | hdr->locked = 1; |
| 696 | 702 | if (set_memory_ro((unsigned long)hdr, hdr->pages)) | |
| 697 | static inline void bpf_jit_binary_unlock_ro(struct bpf_binary_header *hdr) | 703 | hdr->locked = 0; |
| 698 | { | 704 | #endif |
| 699 | WARN_ON_ONCE(set_memory_rw((unsigned long)hdr, hdr->pages)); | ||
| 700 | } | ||
| 701 | #else | ||
| 702 | static inline void bpf_prog_lock_ro(struct bpf_prog *fp) | ||
| 703 | { | ||
| 704 | } | ||
| 705 | |||
| 706 | static inline void bpf_prog_unlock_ro(struct bpf_prog *fp) | ||
| 707 | { | ||
| 708 | } | ||
| 709 | |||
| 710 | static inline void bpf_jit_binary_lock_ro(struct bpf_binary_header *hdr) | ||
| 711 | { | ||
| 712 | } | 705 | } |
| 713 | 706 | ||
| 714 | static inline void bpf_jit_binary_unlock_ro(struct bpf_binary_header *hdr) | 707 | static inline void bpf_jit_binary_unlock_ro(struct bpf_binary_header *hdr) |
| 715 | { | 708 | { |
| 709 | #ifdef CONFIG_ARCH_HAS_SET_MEMORY | ||
| 710 | if (hdr->locked) { | ||
| 711 | WARN_ON_ONCE(set_memory_rw((unsigned long)hdr, hdr->pages)); | ||
| 712 | /* In case set_memory_rw() fails, we want to be the first | ||
| 713 | * to crash here instead of some random place later on. | ||
| 714 | */ | ||
| 715 | hdr->locked = 0; | ||
| 716 | } | ||
| 717 | #endif | ||
| 716 | } | 718 | } |
| 717 | #endif /* CONFIG_ARCH_HAS_SET_MEMORY */ | ||
| 718 | 719 | ||
| 719 | static inline struct bpf_binary_header * | 720 | static inline struct bpf_binary_header * |
| 720 | bpf_jit_binary_hdr(const struct bpf_prog *fp) | 721 | bpf_jit_binary_hdr(const struct bpf_prog *fp) |
| @@ -725,6 +726,22 @@ bpf_jit_binary_hdr(const struct bpf_prog *fp) | |||
| 725 | return (void *)addr; | 726 | return (void *)addr; |
| 726 | } | 727 | } |
| 727 | 728 | ||
| 729 | #ifdef CONFIG_ARCH_HAS_SET_MEMORY | ||
| 730 | static inline int bpf_prog_check_pages_ro_single(const struct bpf_prog *fp) | ||
| 731 | { | ||
| 732 | if (!fp->locked) | ||
| 733 | return -ENOLCK; | ||
| 734 | if (fp->jited) { | ||
| 735 | const struct bpf_binary_header *hdr = bpf_jit_binary_hdr(fp); | ||
| 736 | |||
| 737 | if (!hdr->locked) | ||
| 738 | return -ENOLCK; | ||
| 739 | } | ||
| 740 | |||
| 741 | return 0; | ||
| 742 | } | ||
| 743 | #endif | ||
| 744 | |||
| 728 | int sk_filter_trim_cap(struct sock *sk, struct sk_buff *skb, unsigned int cap); | 745 | int sk_filter_trim_cap(struct sock *sk, struct sk_buff *skb, unsigned int cap); |
| 729 | static inline int sk_filter(struct sock *sk, struct sk_buff *skb) | 746 | static inline int sk_filter(struct sock *sk, struct sk_buff *skb) |
| 730 | { | 747 | { |
| @@ -786,6 +803,21 @@ static inline bool bpf_dump_raw_ok(void) | |||
| 786 | struct bpf_prog *bpf_patch_insn_single(struct bpf_prog *prog, u32 off, | 803 | struct bpf_prog *bpf_patch_insn_single(struct bpf_prog *prog, u32 off, |
| 787 | const struct bpf_insn *patch, u32 len); | 804 | const struct bpf_insn *patch, u32 len); |
| 788 | 805 | ||
| 806 | static inline int __xdp_generic_ok_fwd_dev(struct sk_buff *skb, | ||
| 807 | struct net_device *fwd) | ||
| 808 | { | ||
| 809 | unsigned int len; | ||
| 810 | |||
| 811 | if (unlikely(!(fwd->flags & IFF_UP))) | ||
| 812 | return -ENETDOWN; | ||
| 813 | |||
| 814 | len = fwd->mtu + fwd->hard_header_len + VLAN_HLEN; | ||
| 815 | if (skb->len > len) | ||
| 816 | return -EMSGSIZE; | ||
| 817 | |||
| 818 | return 0; | ||
| 819 | } | ||
| 820 | |||
| 789 | /* The pair of xdp_do_redirect and xdp_do_flush_map MUST be called in the | 821 | /* The pair of xdp_do_redirect and xdp_do_flush_map MUST be called in the |
| 790 | * same cpu context. Further for best results no more than a single map | 822 | * same cpu context. Further for best results no more than a single map |
| 791 | * for the do_redirect/do_flush pair should be used. This limitation is | 823 | * for the do_redirect/do_flush pair should be used. This limitation is |
| @@ -961,6 +993,9 @@ static inline void bpf_prog_kallsyms_del(struct bpf_prog *fp) | |||
| 961 | } | 993 | } |
| 962 | #endif /* CONFIG_BPF_JIT */ | 994 | #endif /* CONFIG_BPF_JIT */ |
| 963 | 995 | ||
| 996 | void bpf_prog_kallsyms_del_subprogs(struct bpf_prog *fp); | ||
| 997 | void bpf_prog_kallsyms_del_all(struct bpf_prog *fp); | ||
| 998 | |||
| 964 | #define BPF_ANC BIT(15) | 999 | #define BPF_ANC BIT(15) |
| 965 | 1000 | ||
| 966 | static inline bool bpf_needs_clear_a(const struct sock_filter *first) | 1001 | static inline bool bpf_needs_clear_a(const struct sock_filter *first) |
diff --git a/include/net/ip6_fib.h b/include/net/ip6_fib.h index 5cba71d2dc44..71b9043aa0e7 100644 --- a/include/net/ip6_fib.h +++ b/include/net/ip6_fib.h | |||
| @@ -170,6 +170,7 @@ struct fib6_info { | |||
| 170 | unused:3; | 170 | unused:3; |
| 171 | 171 | ||
| 172 | struct fib6_nh fib6_nh; | 172 | struct fib6_nh fib6_nh; |
| 173 | struct rcu_head rcu; | ||
| 173 | }; | 174 | }; |
| 174 | 175 | ||
| 175 | struct rt6_info { | 176 | struct rt6_info { |
| @@ -273,7 +274,7 @@ static inline void ip6_rt_put(struct rt6_info *rt) | |||
| 273 | } | 274 | } |
| 274 | 275 | ||
| 275 | struct fib6_info *fib6_info_alloc(gfp_t gfp_flags); | 276 | struct fib6_info *fib6_info_alloc(gfp_t gfp_flags); |
| 276 | void fib6_info_destroy(struct fib6_info *f6i); | 277 | void fib6_info_destroy_rcu(struct rcu_head *head); |
| 277 | 278 | ||
| 278 | static inline void fib6_info_hold(struct fib6_info *f6i) | 279 | static inline void fib6_info_hold(struct fib6_info *f6i) |
| 279 | { | 280 | { |
| @@ -283,7 +284,7 @@ static inline void fib6_info_hold(struct fib6_info *f6i) | |||
| 283 | static inline void fib6_info_release(struct fib6_info *f6i) | 284 | static inline void fib6_info_release(struct fib6_info *f6i) |
| 284 | { | 285 | { |
| 285 | if (f6i && atomic_dec_and_test(&f6i->fib6_ref)) | 286 | if (f6i && atomic_dec_and_test(&f6i->fib6_ref)) |
| 286 | fib6_info_destroy(f6i); | 287 | call_rcu(&f6i->rcu, fib6_info_destroy_rcu); |
| 287 | } | 288 | } |
| 288 | 289 | ||
| 289 | enum fib6_walk_state { | 290 | enum fib6_walk_state { |
diff --git a/kernel/bpf/core.c b/kernel/bpf/core.c index 9f1493705f40..a9e6c04d0f4a 100644 --- a/kernel/bpf/core.c +++ b/kernel/bpf/core.c | |||
| @@ -350,6 +350,20 @@ struct bpf_prog *bpf_patch_insn_single(struct bpf_prog *prog, u32 off, | |||
| 350 | return prog_adj; | 350 | return prog_adj; |
| 351 | } | 351 | } |
| 352 | 352 | ||
| 353 | void bpf_prog_kallsyms_del_subprogs(struct bpf_prog *fp) | ||
| 354 | { | ||
| 355 | int i; | ||
| 356 | |||
| 357 | for (i = 0; i < fp->aux->func_cnt; i++) | ||
| 358 | bpf_prog_kallsyms_del(fp->aux->func[i]); | ||
| 359 | } | ||
| 360 | |||
| 361 | void bpf_prog_kallsyms_del_all(struct bpf_prog *fp) | ||
| 362 | { | ||
| 363 | bpf_prog_kallsyms_del_subprogs(fp); | ||
| 364 | bpf_prog_kallsyms_del(fp); | ||
| 365 | } | ||
| 366 | |||
| 353 | #ifdef CONFIG_BPF_JIT | 367 | #ifdef CONFIG_BPF_JIT |
| 354 | /* All BPF JIT sysctl knobs here. */ | 368 | /* All BPF JIT sysctl knobs here. */ |
| 355 | int bpf_jit_enable __read_mostly = IS_BUILTIN(CONFIG_BPF_JIT_ALWAYS_ON); | 369 | int bpf_jit_enable __read_mostly = IS_BUILTIN(CONFIG_BPF_JIT_ALWAYS_ON); |
| @@ -584,6 +598,8 @@ bpf_jit_binary_alloc(unsigned int proglen, u8 **image_ptr, | |||
| 584 | bpf_fill_ill_insns(hdr, size); | 598 | bpf_fill_ill_insns(hdr, size); |
| 585 | 599 | ||
| 586 | hdr->pages = size / PAGE_SIZE; | 600 | hdr->pages = size / PAGE_SIZE; |
| 601 | hdr->locked = 0; | ||
| 602 | |||
| 587 | hole = min_t(unsigned int, size - (proglen + sizeof(*hdr)), | 603 | hole = min_t(unsigned int, size - (proglen + sizeof(*hdr)), |
| 588 | PAGE_SIZE - sizeof(*hdr)); | 604 | PAGE_SIZE - sizeof(*hdr)); |
| 589 | start = (get_random_int() % hole) & ~(alignment - 1); | 605 | start = (get_random_int() % hole) & ~(alignment - 1); |
| @@ -1434,6 +1450,33 @@ static int bpf_check_tail_call(const struct bpf_prog *fp) | |||
| 1434 | return 0; | 1450 | return 0; |
| 1435 | } | 1451 | } |
| 1436 | 1452 | ||
| 1453 | static int bpf_prog_check_pages_ro_locked(const struct bpf_prog *fp) | ||
| 1454 | { | ||
| 1455 | #ifdef CONFIG_ARCH_HAS_SET_MEMORY | ||
| 1456 | int i, err; | ||
| 1457 | |||
| 1458 | for (i = 0; i < fp->aux->func_cnt; i++) { | ||
| 1459 | err = bpf_prog_check_pages_ro_single(fp->aux->func[i]); | ||
| 1460 | if (err) | ||
| 1461 | return err; | ||
| 1462 | } | ||
| 1463 | |||
| 1464 | return bpf_prog_check_pages_ro_single(fp); | ||
| 1465 | #endif | ||
| 1466 | return 0; | ||
| 1467 | } | ||
| 1468 | |||
| 1469 | static void bpf_prog_select_func(struct bpf_prog *fp) | ||
| 1470 | { | ||
| 1471 | #ifndef CONFIG_BPF_JIT_ALWAYS_ON | ||
| 1472 | u32 stack_depth = max_t(u32, fp->aux->stack_depth, 1); | ||
| 1473 | |||
| 1474 | fp->bpf_func = interpreters[(round_up(stack_depth, 32) / 32) - 1]; | ||
| 1475 | #else | ||
| 1476 | fp->bpf_func = __bpf_prog_ret0_warn; | ||
| 1477 | #endif | ||
| 1478 | } | ||
| 1479 | |||
| 1437 | /** | 1480 | /** |
| 1438 | * bpf_prog_select_runtime - select exec runtime for BPF program | 1481 | * bpf_prog_select_runtime - select exec runtime for BPF program |
| 1439 | * @fp: bpf_prog populated with internal BPF program | 1482 | * @fp: bpf_prog populated with internal BPF program |
| @@ -1444,13 +1487,13 @@ static int bpf_check_tail_call(const struct bpf_prog *fp) | |||
| 1444 | */ | 1487 | */ |
| 1445 | struct bpf_prog *bpf_prog_select_runtime(struct bpf_prog *fp, int *err) | 1488 | struct bpf_prog *bpf_prog_select_runtime(struct bpf_prog *fp, int *err) |
| 1446 | { | 1489 | { |
| 1447 | #ifndef CONFIG_BPF_JIT_ALWAYS_ON | 1490 | /* In case of BPF to BPF calls, verifier did all the prep |
| 1448 | u32 stack_depth = max_t(u32, fp->aux->stack_depth, 1); | 1491 | * work with regards to JITing, etc. |
| 1492 | */ | ||
| 1493 | if (fp->bpf_func) | ||
| 1494 | goto finalize; | ||
| 1449 | 1495 | ||
| 1450 | fp->bpf_func = interpreters[(round_up(stack_depth, 32) / 32) - 1]; | 1496 | bpf_prog_select_func(fp); |
| 1451 | #else | ||
| 1452 | fp->bpf_func = __bpf_prog_ret0_warn; | ||
| 1453 | #endif | ||
| 1454 | 1497 | ||
| 1455 | /* eBPF JITs can rewrite the program in case constant | 1498 | /* eBPF JITs can rewrite the program in case constant |
| 1456 | * blinding is active. However, in case of error during | 1499 | * blinding is active. However, in case of error during |
| @@ -1471,6 +1514,8 @@ struct bpf_prog *bpf_prog_select_runtime(struct bpf_prog *fp, int *err) | |||
| 1471 | if (*err) | 1514 | if (*err) |
| 1472 | return fp; | 1515 | return fp; |
| 1473 | } | 1516 | } |
| 1517 | |||
| 1518 | finalize: | ||
| 1474 | bpf_prog_lock_ro(fp); | 1519 | bpf_prog_lock_ro(fp); |
| 1475 | 1520 | ||
| 1476 | /* The tail call compatibility check can only be done at | 1521 | /* The tail call compatibility check can only be done at |
| @@ -1479,7 +1524,17 @@ struct bpf_prog *bpf_prog_select_runtime(struct bpf_prog *fp, int *err) | |||
| 1479 | * all eBPF JITs might immediately support all features. | 1524 | * all eBPF JITs might immediately support all features. |
| 1480 | */ | 1525 | */ |
| 1481 | *err = bpf_check_tail_call(fp); | 1526 | *err = bpf_check_tail_call(fp); |
| 1482 | 1527 | if (*err) | |
| 1528 | return fp; | ||
| 1529 | |||
| 1530 | /* Checkpoint: at this point onwards any cBPF -> eBPF or | ||
| 1531 | * native eBPF program is read-only. If we failed to change | ||
| 1532 | * the page attributes (e.g. allocation failure from | ||
| 1533 | * splitting large pages), then reject the whole program | ||
| 1534 | * in order to guarantee not ending up with any W+X pages | ||
| 1535 | * from BPF side in kernel. | ||
| 1536 | */ | ||
| 1537 | *err = bpf_prog_check_pages_ro_locked(fp); | ||
| 1483 | return fp; | 1538 | return fp; |
| 1484 | } | 1539 | } |
| 1485 | EXPORT_SYMBOL_GPL(bpf_prog_select_runtime); | 1540 | EXPORT_SYMBOL_GPL(bpf_prog_select_runtime); |
diff --git a/kernel/bpf/devmap.c b/kernel/bpf/devmap.c index a7cc7b3494a9..642c97f6d1b8 100644 --- a/kernel/bpf/devmap.c +++ b/kernel/bpf/devmap.c | |||
| @@ -345,6 +345,20 @@ int dev_map_enqueue(struct bpf_dtab_netdev *dst, struct xdp_buff *xdp, | |||
| 345 | return bq_enqueue(dst, xdpf, dev_rx); | 345 | return bq_enqueue(dst, xdpf, dev_rx); |
| 346 | } | 346 | } |
| 347 | 347 | ||
| 348 | int dev_map_generic_redirect(struct bpf_dtab_netdev *dst, struct sk_buff *skb, | ||
| 349 | struct bpf_prog *xdp_prog) | ||
| 350 | { | ||
| 351 | int err; | ||
| 352 | |||
| 353 | err = __xdp_generic_ok_fwd_dev(skb, dst->dev); | ||
| 354 | if (unlikely(err)) | ||
| 355 | return err; | ||
| 356 | skb->dev = dst->dev; | ||
| 357 | generic_xdp_tx(skb, xdp_prog); | ||
| 358 | |||
| 359 | return 0; | ||
| 360 | } | ||
| 361 | |||
| 348 | static void *dev_map_lookup_elem(struct bpf_map *map, void *key) | 362 | static void *dev_map_lookup_elem(struct bpf_map *map, void *key) |
| 349 | { | 363 | { |
| 350 | struct bpf_dtab_netdev *obj = __dev_map_lookup_elem(map, *(u32 *)key); | 364 | struct bpf_dtab_netdev *obj = __dev_map_lookup_elem(map, *(u32 *)key); |
diff --git a/kernel/bpf/syscall.c b/kernel/bpf/syscall.c index 0fa20624707f..35dc466641f2 100644 --- a/kernel/bpf/syscall.c +++ b/kernel/bpf/syscall.c | |||
| @@ -1034,14 +1034,9 @@ static void __bpf_prog_put_rcu(struct rcu_head *rcu) | |||
| 1034 | static void __bpf_prog_put(struct bpf_prog *prog, bool do_idr_lock) | 1034 | static void __bpf_prog_put(struct bpf_prog *prog, bool do_idr_lock) |
| 1035 | { | 1035 | { |
| 1036 | if (atomic_dec_and_test(&prog->aux->refcnt)) { | 1036 | if (atomic_dec_and_test(&prog->aux->refcnt)) { |
| 1037 | int i; | ||
| 1038 | |||
| 1039 | /* bpf_prog_free_id() must be called first */ | 1037 | /* bpf_prog_free_id() must be called first */ |
| 1040 | bpf_prog_free_id(prog, do_idr_lock); | 1038 | bpf_prog_free_id(prog, do_idr_lock); |
| 1041 | 1039 | bpf_prog_kallsyms_del_all(prog); | |
| 1042 | for (i = 0; i < prog->aux->func_cnt; i++) | ||
| 1043 | bpf_prog_kallsyms_del(prog->aux->func[i]); | ||
| 1044 | bpf_prog_kallsyms_del(prog); | ||
| 1045 | 1040 | ||
| 1046 | call_rcu(&prog->aux->rcu, __bpf_prog_put_rcu); | 1041 | call_rcu(&prog->aux->rcu, __bpf_prog_put_rcu); |
| 1047 | } | 1042 | } |
| @@ -1358,9 +1353,7 @@ static int bpf_prog_load(union bpf_attr *attr) | |||
| 1358 | if (err < 0) | 1353 | if (err < 0) |
| 1359 | goto free_used_maps; | 1354 | goto free_used_maps; |
| 1360 | 1355 | ||
| 1361 | /* eBPF program is ready to be JITed */ | 1356 | prog = bpf_prog_select_runtime(prog, &err); |
| 1362 | if (!prog->bpf_func) | ||
| 1363 | prog = bpf_prog_select_runtime(prog, &err); | ||
| 1364 | if (err < 0) | 1357 | if (err < 0) |
| 1365 | goto free_used_maps; | 1358 | goto free_used_maps; |
| 1366 | 1359 | ||
| @@ -1384,6 +1377,7 @@ static int bpf_prog_load(union bpf_attr *attr) | |||
| 1384 | return err; | 1377 | return err; |
| 1385 | 1378 | ||
| 1386 | free_used_maps: | 1379 | free_used_maps: |
| 1380 | bpf_prog_kallsyms_del_subprogs(prog); | ||
| 1387 | free_used_maps(prog->aux); | 1381 | free_used_maps(prog->aux); |
| 1388 | free_prog: | 1382 | free_prog: |
| 1389 | bpf_prog_uncharge_memlock(prog); | 1383 | bpf_prog_uncharge_memlock(prog); |
diff --git a/net/atm/br2684.c b/net/atm/br2684.c index 36b3adacc0dd..10462de734ea 100644 --- a/net/atm/br2684.c +++ b/net/atm/br2684.c | |||
| @@ -252,8 +252,7 @@ static int br2684_xmit_vcc(struct sk_buff *skb, struct net_device *dev, | |||
| 252 | 252 | ||
| 253 | ATM_SKB(skb)->vcc = atmvcc = brvcc->atmvcc; | 253 | ATM_SKB(skb)->vcc = atmvcc = brvcc->atmvcc; |
| 254 | pr_debug("atm_skb(%p)->vcc(%p)->dev(%p)\n", skb, atmvcc, atmvcc->dev); | 254 | pr_debug("atm_skb(%p)->vcc(%p)->dev(%p)\n", skb, atmvcc, atmvcc->dev); |
| 255 | refcount_add(skb->truesize, &sk_atm(atmvcc)->sk_wmem_alloc); | 255 | atm_account_tx(atmvcc, skb); |
| 256 | ATM_SKB(skb)->atm_options = atmvcc->atm_options; | ||
| 257 | dev->stats.tx_packets++; | 256 | dev->stats.tx_packets++; |
| 258 | dev->stats.tx_bytes += skb->len; | 257 | dev->stats.tx_bytes += skb->len; |
| 259 | 258 | ||
diff --git a/net/atm/clip.c b/net/atm/clip.c index 66caa48a27c2..d795b9c5aea4 100644 --- a/net/atm/clip.c +++ b/net/atm/clip.c | |||
| @@ -381,8 +381,7 @@ static netdev_tx_t clip_start_xmit(struct sk_buff *skb, | |||
| 381 | memcpy(here, llc_oui, sizeof(llc_oui)); | 381 | memcpy(here, llc_oui, sizeof(llc_oui)); |
| 382 | ((__be16 *) here)[3] = skb->protocol; | 382 | ((__be16 *) here)[3] = skb->protocol; |
| 383 | } | 383 | } |
| 384 | refcount_add(skb->truesize, &sk_atm(vcc)->sk_wmem_alloc); | 384 | atm_account_tx(vcc, skb); |
| 385 | ATM_SKB(skb)->atm_options = vcc->atm_options; | ||
| 386 | entry->vccs->last_use = jiffies; | 385 | entry->vccs->last_use = jiffies; |
| 387 | pr_debug("atm_skb(%p)->vcc(%p)->dev(%p)\n", skb, vcc, vcc->dev); | 386 | pr_debug("atm_skb(%p)->vcc(%p)->dev(%p)\n", skb, vcc, vcc->dev); |
| 388 | old = xchg(&entry->vccs->xoff, 1); /* assume XOFF ... */ | 387 | old = xchg(&entry->vccs->xoff, 1); /* assume XOFF ... */ |
diff --git a/net/atm/common.c b/net/atm/common.c index 1f2af59935db..ff5748b2190f 100644 --- a/net/atm/common.c +++ b/net/atm/common.c | |||
| @@ -630,10 +630,9 @@ int vcc_sendmsg(struct socket *sock, struct msghdr *m, size_t size) | |||
| 630 | goto out; | 630 | goto out; |
| 631 | } | 631 | } |
| 632 | pr_debug("%d += %d\n", sk_wmem_alloc_get(sk), skb->truesize); | 632 | pr_debug("%d += %d\n", sk_wmem_alloc_get(sk), skb->truesize); |
| 633 | refcount_add(skb->truesize, &sk->sk_wmem_alloc); | 633 | atm_account_tx(vcc, skb); |
| 634 | 634 | ||
| 635 | skb->dev = NULL; /* for paths shared with net_device interfaces */ | 635 | skb->dev = NULL; /* for paths shared with net_device interfaces */ |
| 636 | ATM_SKB(skb)->atm_options = vcc->atm_options; | ||
| 637 | if (!copy_from_iter_full(skb_put(skb, size), size, &m->msg_iter)) { | 636 | if (!copy_from_iter_full(skb_put(skb, size), size, &m->msg_iter)) { |
| 638 | kfree_skb(skb); | 637 | kfree_skb(skb); |
| 639 | error = -EFAULT; | 638 | error = -EFAULT; |
diff --git a/net/atm/lec.c b/net/atm/lec.c index 5a95fcf6f9b6..d7f5cf5b7594 100644 --- a/net/atm/lec.c +++ b/net/atm/lec.c | |||
| @@ -182,9 +182,8 @@ lec_send(struct atm_vcc *vcc, struct sk_buff *skb) | |||
| 182 | struct net_device *dev = skb->dev; | 182 | struct net_device *dev = skb->dev; |
| 183 | 183 | ||
| 184 | ATM_SKB(skb)->vcc = vcc; | 184 | ATM_SKB(skb)->vcc = vcc; |
| 185 | ATM_SKB(skb)->atm_options = vcc->atm_options; | 185 | atm_account_tx(vcc, skb); |
| 186 | 186 | ||
| 187 | refcount_add(skb->truesize, &sk_atm(vcc)->sk_wmem_alloc); | ||
| 188 | if (vcc->send(vcc, skb) < 0) { | 187 | if (vcc->send(vcc, skb) < 0) { |
| 189 | dev->stats.tx_dropped++; | 188 | dev->stats.tx_dropped++; |
| 190 | return; | 189 | return; |
diff --git a/net/atm/mpc.c b/net/atm/mpc.c index 75620c2f2617..24b53c4c39c6 100644 --- a/net/atm/mpc.c +++ b/net/atm/mpc.c | |||
| @@ -555,8 +555,7 @@ static int send_via_shortcut(struct sk_buff *skb, struct mpoa_client *mpc) | |||
| 555 | sizeof(struct llc_snap_hdr)); | 555 | sizeof(struct llc_snap_hdr)); |
| 556 | } | 556 | } |
| 557 | 557 | ||
| 558 | refcount_add(skb->truesize, &sk_atm(entry->shortcut)->sk_wmem_alloc); | 558 | atm_account_tx(entry->shortcut, skb); |
| 559 | ATM_SKB(skb)->atm_options = entry->shortcut->atm_options; | ||
| 560 | entry->shortcut->send(entry->shortcut, skb); | 559 | entry->shortcut->send(entry->shortcut, skb); |
| 561 | entry->packets_fwded++; | 560 | entry->packets_fwded++; |
| 562 | mpc->in_ops->put(entry); | 561 | mpc->in_ops->put(entry); |
diff --git a/net/atm/pppoatm.c b/net/atm/pppoatm.c index 21d9d341a619..af8c4b38b746 100644 --- a/net/atm/pppoatm.c +++ b/net/atm/pppoatm.c | |||
| @@ -350,8 +350,7 @@ static int pppoatm_send(struct ppp_channel *chan, struct sk_buff *skb) | |||
| 350 | return 1; | 350 | return 1; |
| 351 | } | 351 | } |
| 352 | 352 | ||
| 353 | refcount_add(skb->truesize, &sk_atm(ATM_SKB(skb)->vcc)->sk_wmem_alloc); | 353 | atm_account_tx(vcc, skb); |
| 354 | ATM_SKB(skb)->atm_options = ATM_SKB(skb)->vcc->atm_options; | ||
| 355 | pr_debug("atm_skb(%p)->vcc(%p)->dev(%p)\n", | 354 | pr_debug("atm_skb(%p)->vcc(%p)->dev(%p)\n", |
| 356 | skb, ATM_SKB(skb)->vcc, ATM_SKB(skb)->vcc->dev); | 355 | skb, ATM_SKB(skb)->vcc, ATM_SKB(skb)->vcc->dev); |
| 357 | ret = ATM_SKB(skb)->vcc->send(ATM_SKB(skb)->vcc, skb) | 356 | ret = ATM_SKB(skb)->vcc->send(ATM_SKB(skb)->vcc, skb) |
diff --git a/net/atm/raw.c b/net/atm/raw.c index ee10e8d46185..b3ba44aab0ee 100644 --- a/net/atm/raw.c +++ b/net/atm/raw.c | |||
| @@ -35,8 +35,8 @@ static void atm_pop_raw(struct atm_vcc *vcc, struct sk_buff *skb) | |||
| 35 | struct sock *sk = sk_atm(vcc); | 35 | struct sock *sk = sk_atm(vcc); |
| 36 | 36 | ||
| 37 | pr_debug("(%d) %d -= %d\n", | 37 | pr_debug("(%d) %d -= %d\n", |
| 38 | vcc->vci, sk_wmem_alloc_get(sk), skb->truesize); | 38 | vcc->vci, sk_wmem_alloc_get(sk), ATM_SKB(skb)->acct_truesize); |
| 39 | WARN_ON(refcount_sub_and_test(skb->truesize, &sk->sk_wmem_alloc)); | 39 | WARN_ON(refcount_sub_and_test(ATM_SKB(skb)->acct_truesize, &sk->sk_wmem_alloc)); |
| 40 | dev_kfree_skb_any(skb); | 40 | dev_kfree_skb_any(skb); |
| 41 | sk->sk_write_space(sk); | 41 | sk->sk_write_space(sk); |
| 42 | } | 42 | } |
diff --git a/net/bpfilter/.gitignore b/net/bpfilter/.gitignore new file mode 100644 index 000000000000..e97084e3eea2 --- /dev/null +++ b/net/bpfilter/.gitignore | |||
| @@ -0,0 +1 @@ | |||
| bpfilter_umh | |||
diff --git a/net/bpfilter/Makefile b/net/bpfilter/Makefile index e0bbe7583e58..dd86b022eff0 100644 --- a/net/bpfilter/Makefile +++ b/net/bpfilter/Makefile | |||
| @@ -21,8 +21,10 @@ endif | |||
| 21 | # which bpfilter_kern.c passes further into umh blob loader at run-time | 21 | # which bpfilter_kern.c passes further into umh blob loader at run-time |
| 22 | quiet_cmd_copy_umh = GEN $@ | 22 | quiet_cmd_copy_umh = GEN $@ |
| 23 | cmd_copy_umh = echo ':' > $(obj)/.bpfilter_umh.o.cmd; \ | 23 | cmd_copy_umh = echo ':' > $(obj)/.bpfilter_umh.o.cmd; \ |
| 24 | $(OBJCOPY) -I binary -O `$(OBJDUMP) -f $<|grep format|cut -d' ' -f8` \ | 24 | $(OBJCOPY) -I binary \ |
| 25 | -B `$(OBJDUMP) -f $<|grep architecture|cut -d, -f1|cut -d' ' -f2` \ | 25 | `LC_ALL=C objdump -f net/bpfilter/bpfilter_umh \ |
| 26 | |awk -F' |,' '/file format/{print "-O",$$NF} \ | ||
| 27 | /^architecture:/{print "-B",$$2}'` \ | ||
| 26 | --rename-section .data=.init.rodata $< $@ | 28 | --rename-section .data=.init.rodata $< $@ |
| 27 | 29 | ||
| 28 | $(obj)/bpfilter_umh.o: $(obj)/bpfilter_umh | 30 | $(obj)/bpfilter_umh.o: $(obj)/bpfilter_umh |
diff --git a/net/core/dev.c b/net/core/dev.c index 57b7bab5f70b..a5aa1c7444e6 100644 --- a/net/core/dev.c +++ b/net/core/dev.c | |||
| @@ -8643,7 +8643,8 @@ int dev_change_net_namespace(struct net_device *dev, struct net *net, const char | |||
| 8643 | /* We get here if we can't use the current device name */ | 8643 | /* We get here if we can't use the current device name */ |
| 8644 | if (!pat) | 8644 | if (!pat) |
| 8645 | goto out; | 8645 | goto out; |
| 8646 | if (dev_get_valid_name(net, dev, pat) < 0) | 8646 | err = dev_get_valid_name(net, dev, pat); |
| 8647 | if (err < 0) | ||
| 8647 | goto out; | 8648 | goto out; |
| 8648 | } | 8649 | } |
| 8649 | 8650 | ||
| @@ -8655,7 +8656,6 @@ int dev_change_net_namespace(struct net_device *dev, struct net *net, const char | |||
| 8655 | dev_close(dev); | 8656 | dev_close(dev); |
| 8656 | 8657 | ||
| 8657 | /* And unlink it from device chain */ | 8658 | /* And unlink it from device chain */ |
| 8658 | err = -ENODEV; | ||
| 8659 | unlist_netdevice(dev); | 8659 | unlist_netdevice(dev); |
| 8660 | 8660 | ||
| 8661 | synchronize_net(); | 8661 | synchronize_net(); |
diff --git a/net/core/filter.c b/net/core/filter.c index 3d9ba7e5965a..e7f12e9f598c 100644 --- a/net/core/filter.c +++ b/net/core/filter.c | |||
| @@ -3214,20 +3214,6 @@ err: | |||
| 3214 | } | 3214 | } |
| 3215 | EXPORT_SYMBOL_GPL(xdp_do_redirect); | 3215 | EXPORT_SYMBOL_GPL(xdp_do_redirect); |
| 3216 | 3216 | ||
| 3217 | static int __xdp_generic_ok_fwd_dev(struct sk_buff *skb, struct net_device *fwd) | ||
| 3218 | { | ||
| 3219 | unsigned int len; | ||
| 3220 | |||
| 3221 | if (unlikely(!(fwd->flags & IFF_UP))) | ||
| 3222 | return -ENETDOWN; | ||
| 3223 | |||
| 3224 | len = fwd->mtu + fwd->hard_header_len + VLAN_HLEN; | ||
| 3225 | if (skb->len > len) | ||
| 3226 | return -EMSGSIZE; | ||
| 3227 | |||
| 3228 | return 0; | ||
| 3229 | } | ||
| 3230 | |||
| 3231 | static int xdp_do_generic_redirect_map(struct net_device *dev, | 3217 | static int xdp_do_generic_redirect_map(struct net_device *dev, |
| 3232 | struct sk_buff *skb, | 3218 | struct sk_buff *skb, |
| 3233 | struct xdp_buff *xdp, | 3219 | struct xdp_buff *xdp, |
| @@ -3256,10 +3242,11 @@ static int xdp_do_generic_redirect_map(struct net_device *dev, | |||
| 3256 | } | 3242 | } |
| 3257 | 3243 | ||
| 3258 | if (map->map_type == BPF_MAP_TYPE_DEVMAP) { | 3244 | if (map->map_type == BPF_MAP_TYPE_DEVMAP) { |
| 3259 | if (unlikely((err = __xdp_generic_ok_fwd_dev(skb, fwd)))) | 3245 | struct bpf_dtab_netdev *dst = fwd; |
| 3246 | |||
| 3247 | err = dev_map_generic_redirect(dst, skb, xdp_prog); | ||
| 3248 | if (unlikely(err)) | ||
| 3260 | goto err; | 3249 | goto err; |
| 3261 | skb->dev = fwd; | ||
| 3262 | generic_xdp_tx(skb, xdp_prog); | ||
| 3263 | } else if (map->map_type == BPF_MAP_TYPE_XSKMAP) { | 3250 | } else if (map->map_type == BPF_MAP_TYPE_XSKMAP) { |
| 3264 | struct xdp_sock *xs = fwd; | 3251 | struct xdp_sock *xs = fwd; |
| 3265 | 3252 | ||
diff --git a/net/ipv4/inet_hashtables.c b/net/ipv4/inet_hashtables.c index 31ff46daae97..3647167c8fa3 100644 --- a/net/ipv4/inet_hashtables.c +++ b/net/ipv4/inet_hashtables.c | |||
| @@ -243,9 +243,9 @@ static inline int compute_score(struct sock *sk, struct net *net, | |||
| 243 | bool dev_match = (sk->sk_bound_dev_if == dif || | 243 | bool dev_match = (sk->sk_bound_dev_if == dif || |
| 244 | sk->sk_bound_dev_if == sdif); | 244 | sk->sk_bound_dev_if == sdif); |
| 245 | 245 | ||
| 246 | if (exact_dif && !dev_match) | 246 | if (!dev_match) |
| 247 | return -1; | 247 | return -1; |
| 248 | if (sk->sk_bound_dev_if && dev_match) | 248 | if (sk->sk_bound_dev_if) |
| 249 | score += 4; | 249 | score += 4; |
| 250 | } | 250 | } |
| 251 | if (sk->sk_incoming_cpu == raw_smp_processor_id()) | 251 | if (sk->sk_incoming_cpu == raw_smp_processor_id()) |
diff --git a/net/ipv4/ip_output.c b/net/ipv4/ip_output.c index af5a830ff6ad..b3308e9d9762 100644 --- a/net/ipv4/ip_output.c +++ b/net/ipv4/ip_output.c | |||
| @@ -1145,7 +1145,8 @@ static int ip_setup_cork(struct sock *sk, struct inet_cork *cork, | |||
| 1145 | cork->fragsize = ip_sk_use_pmtu(sk) ? | 1145 | cork->fragsize = ip_sk_use_pmtu(sk) ? |
| 1146 | dst_mtu(&rt->dst) : rt->dst.dev->mtu; | 1146 | dst_mtu(&rt->dst) : rt->dst.dev->mtu; |
| 1147 | 1147 | ||
| 1148 | cork->gso_size = sk->sk_type == SOCK_DGRAM ? ipc->gso_size : 0; | 1148 | cork->gso_size = sk->sk_type == SOCK_DGRAM && |
| 1149 | sk->sk_protocol == IPPROTO_UDP ? ipc->gso_size : 0; | ||
| 1149 | cork->dst = &rt->dst; | 1150 | cork->dst = &rt->dst; |
| 1150 | cork->length = 0; | 1151 | cork->length = 0; |
| 1151 | cork->ttl = ipc->ttl; | 1152 | cork->ttl = ipc->ttl; |
diff --git a/net/ipv6/inet6_hashtables.c b/net/ipv6/inet6_hashtables.c index 2febe26de6a1..595ad408dba0 100644 --- a/net/ipv6/inet6_hashtables.c +++ b/net/ipv6/inet6_hashtables.c | |||
| @@ -113,9 +113,9 @@ static inline int compute_score(struct sock *sk, struct net *net, | |||
| 113 | bool dev_match = (sk->sk_bound_dev_if == dif || | 113 | bool dev_match = (sk->sk_bound_dev_if == dif || |
| 114 | sk->sk_bound_dev_if == sdif); | 114 | sk->sk_bound_dev_if == sdif); |
| 115 | 115 | ||
| 116 | if (exact_dif && !dev_match) | 116 | if (!dev_match) |
| 117 | return -1; | 117 | return -1; |
| 118 | if (sk->sk_bound_dev_if && dev_match) | 118 | if (sk->sk_bound_dev_if) |
| 119 | score++; | 119 | score++; |
| 120 | } | 120 | } |
| 121 | if (sk->sk_incoming_cpu == raw_smp_processor_id()) | 121 | if (sk->sk_incoming_cpu == raw_smp_processor_id()) |
diff --git a/net/ipv6/ip6_fib.c b/net/ipv6/ip6_fib.c index 39d1d487eca2..1fb2f3118d60 100644 --- a/net/ipv6/ip6_fib.c +++ b/net/ipv6/ip6_fib.c | |||
| @@ -167,8 +167,9 @@ struct fib6_info *fib6_info_alloc(gfp_t gfp_flags) | |||
| 167 | return f6i; | 167 | return f6i; |
| 168 | } | 168 | } |
| 169 | 169 | ||
| 170 | void fib6_info_destroy(struct fib6_info *f6i) | 170 | void fib6_info_destroy_rcu(struct rcu_head *head) |
| 171 | { | 171 | { |
| 172 | struct fib6_info *f6i = container_of(head, struct fib6_info, rcu); | ||
| 172 | struct rt6_exception_bucket *bucket; | 173 | struct rt6_exception_bucket *bucket; |
| 173 | struct dst_metrics *m; | 174 | struct dst_metrics *m; |
| 174 | 175 | ||
| @@ -206,7 +207,7 @@ void fib6_info_destroy(struct fib6_info *f6i) | |||
| 206 | 207 | ||
| 207 | kfree(f6i); | 208 | kfree(f6i); |
| 208 | } | 209 | } |
| 209 | EXPORT_SYMBOL_GPL(fib6_info_destroy); | 210 | EXPORT_SYMBOL_GPL(fib6_info_destroy_rcu); |
| 210 | 211 | ||
| 211 | static struct fib6_node *node_alloc(struct net *net) | 212 | static struct fib6_node *node_alloc(struct net *net) |
| 212 | { | 213 | { |
diff --git a/net/ipv6/ip6_output.c b/net/ipv6/ip6_output.c index 021e5aef6ba3..a14fb4fcdf18 100644 --- a/net/ipv6/ip6_output.c +++ b/net/ipv6/ip6_output.c | |||
| @@ -1219,7 +1219,8 @@ static int ip6_setup_cork(struct sock *sk, struct inet_cork_full *cork, | |||
| 1219 | if (mtu < IPV6_MIN_MTU) | 1219 | if (mtu < IPV6_MIN_MTU) |
| 1220 | return -EINVAL; | 1220 | return -EINVAL; |
| 1221 | cork->base.fragsize = mtu; | 1221 | cork->base.fragsize = mtu; |
| 1222 | cork->base.gso_size = sk->sk_type == SOCK_DGRAM ? ipc6->gso_size : 0; | 1222 | cork->base.gso_size = sk->sk_type == SOCK_DGRAM && |
| 1223 | sk->sk_protocol == IPPROTO_UDP ? ipc6->gso_size : 0; | ||
| 1223 | 1224 | ||
| 1224 | if (dst_allfrag(xfrm_dst_path(&rt->dst))) | 1225 | if (dst_allfrag(xfrm_dst_path(&rt->dst))) |
| 1225 | cork->base.flags |= IPCORK_ALLFRAG; | 1226 | cork->base.flags |= IPCORK_ALLFRAG; |
diff --git a/net/ncsi/ncsi-aen.c b/net/ncsi/ncsi-aen.c index e7b05de1e6d1..25e483e8278b 100644 --- a/net/ncsi/ncsi-aen.c +++ b/net/ncsi/ncsi-aen.c | |||
| @@ -73,8 +73,8 @@ static int ncsi_aen_handler_lsc(struct ncsi_dev_priv *ndp, | |||
| 73 | ncm->data[2] = data; | 73 | ncm->data[2] = data; |
| 74 | ncm->data[4] = ntohl(lsc->oem_status); | 74 | ncm->data[4] = ntohl(lsc->oem_status); |
| 75 | 75 | ||
| 76 | netdev_info(ndp->ndev.dev, "NCSI: LSC AEN - channel %u state %s\n", | 76 | netdev_dbg(ndp->ndev.dev, "NCSI: LSC AEN - channel %u state %s\n", |
| 77 | nc->id, data & 0x1 ? "up" : "down"); | 77 | nc->id, data & 0x1 ? "up" : "down"); |
| 78 | 78 | ||
| 79 | chained = !list_empty(&nc->link); | 79 | chained = !list_empty(&nc->link); |
| 80 | state = nc->state; | 80 | state = nc->state; |
| @@ -148,9 +148,9 @@ static int ncsi_aen_handler_hncdsc(struct ncsi_dev_priv *ndp, | |||
| 148 | hncdsc = (struct ncsi_aen_hncdsc_pkt *)h; | 148 | hncdsc = (struct ncsi_aen_hncdsc_pkt *)h; |
| 149 | ncm->data[3] = ntohl(hncdsc->status); | 149 | ncm->data[3] = ntohl(hncdsc->status); |
| 150 | spin_unlock_irqrestore(&nc->lock, flags); | 150 | spin_unlock_irqrestore(&nc->lock, flags); |
| 151 | netdev_printk(KERN_DEBUG, ndp->ndev.dev, | 151 | netdev_dbg(ndp->ndev.dev, |
| 152 | "NCSI: host driver %srunning on channel %u\n", | 152 | "NCSI: host driver %srunning on channel %u\n", |
| 153 | ncm->data[3] & 0x1 ? "" : "not ", nc->id); | 153 | ncm->data[3] & 0x1 ? "" : "not ", nc->id); |
| 154 | 154 | ||
| 155 | return 0; | 155 | return 0; |
| 156 | } | 156 | } |
diff --git a/net/ncsi/ncsi-manage.c b/net/ncsi/ncsi-manage.c index 5561e221b71f..091284760d21 100644 --- a/net/ncsi/ncsi-manage.c +++ b/net/ncsi/ncsi-manage.c | |||
| @@ -788,8 +788,8 @@ static void ncsi_configure_channel(struct ncsi_dev_priv *ndp) | |||
| 788 | } | 788 | } |
| 789 | break; | 789 | break; |
| 790 | case ncsi_dev_state_config_done: | 790 | case ncsi_dev_state_config_done: |
| 791 | netdev_printk(KERN_DEBUG, ndp->ndev.dev, | 791 | netdev_dbg(ndp->ndev.dev, "NCSI: channel %u config done\n", |
| 792 | "NCSI: channel %u config done\n", nc->id); | 792 | nc->id); |
| 793 | spin_lock_irqsave(&nc->lock, flags); | 793 | spin_lock_irqsave(&nc->lock, flags); |
| 794 | if (nc->reconfigure_needed) { | 794 | if (nc->reconfigure_needed) { |
| 795 | /* This channel's configuration has been updated | 795 | /* This channel's configuration has been updated |
| @@ -804,8 +804,7 @@ static void ncsi_configure_channel(struct ncsi_dev_priv *ndp) | |||
| 804 | list_add_tail_rcu(&nc->link, &ndp->channel_queue); | 804 | list_add_tail_rcu(&nc->link, &ndp->channel_queue); |
| 805 | spin_unlock_irqrestore(&ndp->lock, flags); | 805 | spin_unlock_irqrestore(&ndp->lock, flags); |
| 806 | 806 | ||
| 807 | netdev_printk(KERN_DEBUG, dev, | 807 | netdev_dbg(dev, "Dirty NCSI channel state reset\n"); |
| 808 | "Dirty NCSI channel state reset\n"); | ||
| 809 | ncsi_process_next_channel(ndp); | 808 | ncsi_process_next_channel(ndp); |
| 810 | break; | 809 | break; |
| 811 | } | 810 | } |
| @@ -816,9 +815,9 @@ static void ncsi_configure_channel(struct ncsi_dev_priv *ndp) | |||
| 816 | } else { | 815 | } else { |
| 817 | hot_nc = NULL; | 816 | hot_nc = NULL; |
| 818 | nc->state = NCSI_CHANNEL_INACTIVE; | 817 | nc->state = NCSI_CHANNEL_INACTIVE; |
| 819 | netdev_warn(ndp->ndev.dev, | 818 | netdev_dbg(ndp->ndev.dev, |
| 820 | "NCSI: channel %u link down after config\n", | 819 | "NCSI: channel %u link down after config\n", |
| 821 | nc->id); | 820 | nc->id); |
| 822 | } | 821 | } |
| 823 | spin_unlock_irqrestore(&nc->lock, flags); | 822 | spin_unlock_irqrestore(&nc->lock, flags); |
| 824 | 823 | ||
| @@ -908,9 +907,9 @@ static int ncsi_choose_active_channel(struct ncsi_dev_priv *ndp) | |||
| 908 | } | 907 | } |
| 909 | 908 | ||
| 910 | ncm = &found->modes[NCSI_MODE_LINK]; | 909 | ncm = &found->modes[NCSI_MODE_LINK]; |
| 911 | netdev_printk(KERN_DEBUG, ndp->ndev.dev, | 910 | netdev_dbg(ndp->ndev.dev, |
| 912 | "NCSI: Channel %u added to queue (link %s)\n", | 911 | "NCSI: Channel %u added to queue (link %s)\n", |
| 913 | found->id, ncm->data[2] & 0x1 ? "up" : "down"); | 912 | found->id, ncm->data[2] & 0x1 ? "up" : "down"); |
| 914 | 913 | ||
| 915 | out: | 914 | out: |
| 916 | spin_lock_irqsave(&ndp->lock, flags); | 915 | spin_lock_irqsave(&ndp->lock, flags); |
| @@ -1199,14 +1198,14 @@ int ncsi_process_next_channel(struct ncsi_dev_priv *ndp) | |||
| 1199 | switch (old_state) { | 1198 | switch (old_state) { |
| 1200 | case NCSI_CHANNEL_INACTIVE: | 1199 | case NCSI_CHANNEL_INACTIVE: |
| 1201 | ndp->ndev.state = ncsi_dev_state_config; | 1200 | ndp->ndev.state = ncsi_dev_state_config; |
| 1202 | netdev_info(ndp->ndev.dev, "NCSI: configuring channel %u\n", | 1201 | netdev_dbg(ndp->ndev.dev, "NCSI: configuring channel %u\n", |
| 1203 | nc->id); | 1202 | nc->id); |
| 1204 | ncsi_configure_channel(ndp); | 1203 | ncsi_configure_channel(ndp); |
| 1205 | break; | 1204 | break; |
| 1206 | case NCSI_CHANNEL_ACTIVE: | 1205 | case NCSI_CHANNEL_ACTIVE: |
| 1207 | ndp->ndev.state = ncsi_dev_state_suspend; | 1206 | ndp->ndev.state = ncsi_dev_state_suspend; |
| 1208 | netdev_info(ndp->ndev.dev, "NCSI: suspending channel %u\n", | 1207 | netdev_dbg(ndp->ndev.dev, "NCSI: suspending channel %u\n", |
| 1209 | nc->id); | 1208 | nc->id); |
| 1210 | ncsi_suspend_channel(ndp); | 1209 | ncsi_suspend_channel(ndp); |
| 1211 | break; | 1210 | break; |
| 1212 | default: | 1211 | default: |
| @@ -1226,8 +1225,6 @@ out: | |||
| 1226 | return ncsi_choose_active_channel(ndp); | 1225 | return ncsi_choose_active_channel(ndp); |
| 1227 | } | 1226 | } |
| 1228 | 1227 | ||
| 1229 | netdev_printk(KERN_DEBUG, ndp->ndev.dev, | ||
| 1230 | "NCSI: No more channels to process\n"); | ||
| 1231 | ncsi_report_link(ndp, false); | 1228 | ncsi_report_link(ndp, false); |
| 1232 | return -ENODEV; | 1229 | return -ENODEV; |
| 1233 | } | 1230 | } |
| @@ -1318,9 +1315,9 @@ static int ncsi_kick_channels(struct ncsi_dev_priv *ndp) | |||
| 1318 | if ((ndp->ndev.state & 0xff00) == | 1315 | if ((ndp->ndev.state & 0xff00) == |
| 1319 | ncsi_dev_state_config || | 1316 | ncsi_dev_state_config || |
| 1320 | !list_empty(&nc->link)) { | 1317 | !list_empty(&nc->link)) { |
| 1321 | netdev_printk(KERN_DEBUG, nd->dev, | 1318 | netdev_dbg(nd->dev, |
| 1322 | "NCSI: channel %p marked dirty\n", | 1319 | "NCSI: channel %p marked dirty\n", |
| 1323 | nc); | 1320 | nc); |
| 1324 | nc->reconfigure_needed = true; | 1321 | nc->reconfigure_needed = true; |
| 1325 | } | 1322 | } |
| 1326 | spin_unlock_irqrestore(&nc->lock, flags); | 1323 | spin_unlock_irqrestore(&nc->lock, flags); |
| @@ -1338,8 +1335,7 @@ static int ncsi_kick_channels(struct ncsi_dev_priv *ndp) | |||
| 1338 | list_add_tail_rcu(&nc->link, &ndp->channel_queue); | 1335 | list_add_tail_rcu(&nc->link, &ndp->channel_queue); |
| 1339 | spin_unlock_irqrestore(&ndp->lock, flags); | 1336 | spin_unlock_irqrestore(&ndp->lock, flags); |
| 1340 | 1337 | ||
| 1341 | netdev_printk(KERN_DEBUG, nd->dev, | 1338 | netdev_dbg(nd->dev, "NCSI: kicked channel %p\n", nc); |
| 1342 | "NCSI: kicked channel %p\n", nc); | ||
| 1343 | n++; | 1339 | n++; |
| 1344 | } | 1340 | } |
| 1345 | } | 1341 | } |
| @@ -1370,8 +1366,8 @@ int ncsi_vlan_rx_add_vid(struct net_device *dev, __be16 proto, u16 vid) | |||
| 1370 | list_for_each_entry_rcu(vlan, &ndp->vlan_vids, list) { | 1366 | list_for_each_entry_rcu(vlan, &ndp->vlan_vids, list) { |
| 1371 | n_vids++; | 1367 | n_vids++; |
| 1372 | if (vlan->vid == vid) { | 1368 | if (vlan->vid == vid) { |
| 1373 | netdev_printk(KERN_DEBUG, dev, | 1369 | netdev_dbg(dev, "NCSI: vid %u already registered\n", |
| 1374 | "NCSI: vid %u already registered\n", vid); | 1370 | vid); |
| 1375 | return 0; | 1371 | return 0; |
| 1376 | } | 1372 | } |
| 1377 | } | 1373 | } |
| @@ -1390,7 +1386,7 @@ int ncsi_vlan_rx_add_vid(struct net_device *dev, __be16 proto, u16 vid) | |||
| 1390 | vlan->vid = vid; | 1386 | vlan->vid = vid; |
| 1391 | list_add_rcu(&vlan->list, &ndp->vlan_vids); | 1387 | list_add_rcu(&vlan->list, &ndp->vlan_vids); |
| 1392 | 1388 | ||
| 1393 | netdev_printk(KERN_DEBUG, dev, "NCSI: Added new vid %u\n", vid); | 1389 | netdev_dbg(dev, "NCSI: Added new vid %u\n", vid); |
| 1394 | 1390 | ||
| 1395 | found = ncsi_kick_channels(ndp) != 0; | 1391 | found = ncsi_kick_channels(ndp) != 0; |
| 1396 | 1392 | ||
| @@ -1419,8 +1415,7 @@ int ncsi_vlan_rx_kill_vid(struct net_device *dev, __be16 proto, u16 vid) | |||
| 1419 | /* Remove the VLAN id from our internal list */ | 1415 | /* Remove the VLAN id from our internal list */ |
| 1420 | list_for_each_entry_safe(vlan, tmp, &ndp->vlan_vids, list) | 1416 | list_for_each_entry_safe(vlan, tmp, &ndp->vlan_vids, list) |
| 1421 | if (vlan->vid == vid) { | 1417 | if (vlan->vid == vid) { |
| 1422 | netdev_printk(KERN_DEBUG, dev, | 1418 | netdev_dbg(dev, "NCSI: vid %u found, removing\n", vid); |
| 1423 | "NCSI: vid %u found, removing\n", vid); | ||
| 1424 | list_del_rcu(&vlan->list); | 1419 | list_del_rcu(&vlan->list); |
| 1425 | found = true; | 1420 | found = true; |
| 1426 | kfree(vlan); | 1421 | kfree(vlan); |
| @@ -1547,7 +1542,7 @@ void ncsi_stop_dev(struct ncsi_dev *nd) | |||
| 1547 | } | 1542 | } |
| 1548 | } | 1543 | } |
| 1549 | 1544 | ||
| 1550 | netdev_printk(KERN_DEBUG, ndp->ndev.dev, "NCSI: Stopping device\n"); | 1545 | netdev_dbg(ndp->ndev.dev, "NCSI: Stopping device\n"); |
| 1551 | ncsi_report_link(ndp, true); | 1546 | ncsi_report_link(ndp, true); |
| 1552 | } | 1547 | } |
| 1553 | EXPORT_SYMBOL_GPL(ncsi_stop_dev); | 1548 | EXPORT_SYMBOL_GPL(ncsi_stop_dev); |
diff --git a/net/sched/act_ife.c b/net/sched/act_ife.c index 8527cfdc446d..20d7d36b2fc9 100644 --- a/net/sched/act_ife.c +++ b/net/sched/act_ife.c | |||
| @@ -415,7 +415,8 @@ static void tcf_ife_cleanup(struct tc_action *a) | |||
| 415 | spin_unlock_bh(&ife->tcf_lock); | 415 | spin_unlock_bh(&ife->tcf_lock); |
| 416 | 416 | ||
| 417 | p = rcu_dereference_protected(ife->params, 1); | 417 | p = rcu_dereference_protected(ife->params, 1); |
| 418 | kfree_rcu(p, rcu); | 418 | if (p) |
| 419 | kfree_rcu(p, rcu); | ||
| 419 | } | 420 | } |
| 420 | 421 | ||
| 421 | /* under ife->tcf_lock for existing action */ | 422 | /* under ife->tcf_lock for existing action */ |
| @@ -516,8 +517,6 @@ static int tcf_ife_init(struct net *net, struct nlattr *nla, | |||
| 516 | saddr = nla_data(tb[TCA_IFE_SMAC]); | 517 | saddr = nla_data(tb[TCA_IFE_SMAC]); |
| 517 | } | 518 | } |
| 518 | 519 | ||
| 519 | ife->tcf_action = parm->action; | ||
| 520 | |||
| 521 | if (parm->flags & IFE_ENCODE) { | 520 | if (parm->flags & IFE_ENCODE) { |
| 522 | if (daddr) | 521 | if (daddr) |
| 523 | ether_addr_copy(p->eth_dst, daddr); | 522 | ether_addr_copy(p->eth_dst, daddr); |
| @@ -543,10 +542,8 @@ static int tcf_ife_init(struct net *net, struct nlattr *nla, | |||
| 543 | NULL, NULL); | 542 | NULL, NULL); |
| 544 | if (err) { | 543 | if (err) { |
| 545 | metadata_parse_err: | 544 | metadata_parse_err: |
| 546 | if (exists) | ||
| 547 | tcf_idr_release(*a, bind); | ||
| 548 | if (ret == ACT_P_CREATED) | 545 | if (ret == ACT_P_CREATED) |
| 549 | _tcf_ife_cleanup(*a); | 546 | tcf_idr_release(*a, bind); |
| 550 | 547 | ||
| 551 | if (exists) | 548 | if (exists) |
| 552 | spin_unlock_bh(&ife->tcf_lock); | 549 | spin_unlock_bh(&ife->tcf_lock); |
| @@ -567,7 +564,7 @@ metadata_parse_err: | |||
| 567 | err = use_all_metadata(ife); | 564 | err = use_all_metadata(ife); |
| 568 | if (err) { | 565 | if (err) { |
| 569 | if (ret == ACT_P_CREATED) | 566 | if (ret == ACT_P_CREATED) |
| 570 | _tcf_ife_cleanup(*a); | 567 | tcf_idr_release(*a, bind); |
| 571 | 568 | ||
| 572 | if (exists) | 569 | if (exists) |
| 573 | spin_unlock_bh(&ife->tcf_lock); | 570 | spin_unlock_bh(&ife->tcf_lock); |
| @@ -576,6 +573,7 @@ metadata_parse_err: | |||
| 576 | } | 573 | } |
| 577 | } | 574 | } |
| 578 | 575 | ||
| 576 | ife->tcf_action = parm->action; | ||
| 579 | if (exists) | 577 | if (exists) |
| 580 | spin_unlock_bh(&ife->tcf_lock); | 578 | spin_unlock_bh(&ife->tcf_lock); |
| 581 | 579 | ||
diff --git a/net/sched/sch_blackhole.c b/net/sched/sch_blackhole.c index c98a61e980ba..9c4c2bb547d7 100644 --- a/net/sched/sch_blackhole.c +++ b/net/sched/sch_blackhole.c | |||
| @@ -21,7 +21,7 @@ static int blackhole_enqueue(struct sk_buff *skb, struct Qdisc *sch, | |||
| 21 | struct sk_buff **to_free) | 21 | struct sk_buff **to_free) |
| 22 | { | 22 | { |
| 23 | qdisc_drop(skb, sch, to_free); | 23 | qdisc_drop(skb, sch, to_free); |
| 24 | return NET_XMIT_SUCCESS; | 24 | return NET_XMIT_SUCCESS | __NET_XMIT_BYPASS; |
| 25 | } | 25 | } |
| 26 | 26 | ||
| 27 | static struct sk_buff *blackhole_dequeue(struct Qdisc *sch) | 27 | static struct sk_buff *blackhole_dequeue(struct Qdisc *sch) |
diff --git a/net/xdp/xsk.c b/net/xdp/xsk.c index 36919a254ba3..3b3410ada097 100644 --- a/net/xdp/xsk.c +++ b/net/xdp/xsk.c | |||
| @@ -118,6 +118,9 @@ int xsk_generic_rcv(struct xdp_sock *xs, struct xdp_buff *xdp) | |||
| 118 | u64 addr; | 118 | u64 addr; |
| 119 | int err; | 119 | int err; |
| 120 | 120 | ||
| 121 | if (xs->dev != xdp->rxq->dev || xs->queue_id != xdp->rxq->queue_index) | ||
| 122 | return -EINVAL; | ||
| 123 | |||
| 121 | if (!xskq_peek_addr(xs->umem->fq, &addr) || | 124 | if (!xskq_peek_addr(xs->umem->fq, &addr) || |
| 122 | len > xs->umem->chunk_size_nohr) { | 125 | len > xs->umem->chunk_size_nohr) { |
| 123 | xs->rx_dropped++; | 126 | xs->rx_dropped++; |
diff --git a/tools/bpf/bpftool/perf.c b/tools/bpf/bpftool/perf.c index ac6b1a12c9b7..b76b77dcfd1f 100644 --- a/tools/bpf/bpftool/perf.c +++ b/tools/bpf/bpftool/perf.c | |||
| @@ -29,9 +29,10 @@ static bool has_perf_query_support(void) | |||
| 29 | if (perf_query_supported) | 29 | if (perf_query_supported) |
| 30 | goto out; | 30 | goto out; |
| 31 | 31 | ||
| 32 | fd = open(bin_name, O_RDONLY); | 32 | fd = open("/", O_RDONLY); |
| 33 | if (fd < 0) { | 33 | if (fd < 0) { |
| 34 | p_err("perf_query_support: %s", strerror(errno)); | 34 | p_err("perf_query_support: cannot open directory \"/\" (%s)", |
| 35 | strerror(errno)); | ||
| 35 | goto out; | 36 | goto out; |
| 36 | } | 37 | } |
| 37 | 38 | ||
diff --git a/tools/bpf/bpftool/prog.c b/tools/bpf/bpftool/prog.c index a4f435203fef..05f42a46d6ed 100644 --- a/tools/bpf/bpftool/prog.c +++ b/tools/bpf/bpftool/prog.c | |||
| @@ -90,7 +90,9 @@ static void print_boot_time(__u64 nsecs, char *buf, unsigned int size) | |||
| 90 | } | 90 | } |
| 91 | 91 | ||
| 92 | wallclock_secs = (real_time_ts.tv_sec - boot_time_ts.tv_sec) + | 92 | wallclock_secs = (real_time_ts.tv_sec - boot_time_ts.tv_sec) + |
| 93 | nsecs / 1000000000; | 93 | (real_time_ts.tv_nsec - boot_time_ts.tv_nsec + nsecs) / |
| 94 | 1000000000; | ||
| 95 | |||
| 94 | 96 | ||
| 95 | if (!localtime_r(&wallclock_secs, &load_tm)) { | 97 | if (!localtime_r(&wallclock_secs, &load_tm)) { |
| 96 | snprintf(buf, size, "%llu", nsecs / 1000000000); | 98 | snprintf(buf, size, "%llu", nsecs / 1000000000); |
diff --git a/tools/testing/selftests/bpf/config b/tools/testing/selftests/bpf/config index 1eefe211a4a8..7eb613ffef55 100644 --- a/tools/testing/selftests/bpf/config +++ b/tools/testing/selftests/bpf/config | |||
| @@ -7,3 +7,13 @@ CONFIG_CGROUP_BPF=y | |||
| 7 | CONFIG_NETDEVSIM=m | 7 | CONFIG_NETDEVSIM=m |
| 8 | CONFIG_NET_CLS_ACT=y | 8 | CONFIG_NET_CLS_ACT=y |
| 9 | CONFIG_NET_SCH_INGRESS=y | 9 | CONFIG_NET_SCH_INGRESS=y |
| 10 | CONFIG_NET_IPIP=y | ||
| 11 | CONFIG_IPV6=y | ||
| 12 | CONFIG_NET_IPGRE_DEMUX=y | ||
| 13 | CONFIG_NET_IPGRE=y | ||
| 14 | CONFIG_IPV6_GRE=y | ||
| 15 | CONFIG_CRYPTO_USER_API_HASH=m | ||
| 16 | CONFIG_CRYPTO_HMAC=m | ||
| 17 | CONFIG_CRYPTO_SHA256=m | ||
| 18 | CONFIG_VXLAN=y | ||
| 19 | CONFIG_GENEVE=y | ||
diff --git a/tools/testing/selftests/bpf/test_offload.py b/tools/testing/selftests/bpf/test_offload.py index e78aad0a68bb..be800d0e7a84 100755 --- a/tools/testing/selftests/bpf/test_offload.py +++ b/tools/testing/selftests/bpf/test_offload.py | |||
| @@ -163,6 +163,10 @@ def bpftool(args, JSON=True, ns="", fail=True): | |||
| 163 | 163 | ||
| 164 | def bpftool_prog_list(expected=None, ns=""): | 164 | def bpftool_prog_list(expected=None, ns=""): |
| 165 | _, progs = bpftool("prog show", JSON=True, ns=ns, fail=True) | 165 | _, progs = bpftool("prog show", JSON=True, ns=ns, fail=True) |
| 166 | # Remove the base progs | ||
| 167 | for p in base_progs: | ||
| 168 | if p in progs: | ||
| 169 | progs.remove(p) | ||
| 166 | if expected is not None: | 170 | if expected is not None: |
| 167 | if len(progs) != expected: | 171 | if len(progs) != expected: |
| 168 | fail(True, "%d BPF programs loaded, expected %d" % | 172 | fail(True, "%d BPF programs loaded, expected %d" % |
| @@ -171,6 +175,10 @@ def bpftool_prog_list(expected=None, ns=""): | |||
| 171 | 175 | ||
| 172 | def bpftool_map_list(expected=None, ns=""): | 176 | def bpftool_map_list(expected=None, ns=""): |
| 173 | _, maps = bpftool("map show", JSON=True, ns=ns, fail=True) | 177 | _, maps = bpftool("map show", JSON=True, ns=ns, fail=True) |
| 178 | # Remove the base maps | ||
| 179 | for m in base_maps: | ||
| 180 | if m in maps: | ||
| 181 | maps.remove(m) | ||
| 174 | if expected is not None: | 182 | if expected is not None: |
| 175 | if len(maps) != expected: | 183 | if len(maps) != expected: |
| 176 | fail(True, "%d BPF maps loaded, expected %d" % | 184 | fail(True, "%d BPF maps loaded, expected %d" % |
| @@ -585,8 +593,8 @@ skip(os.getuid() != 0, "test must be run as root") | |||
| 585 | # Check tools | 593 | # Check tools |
| 586 | ret, progs = bpftool("prog", fail=False) | 594 | ret, progs = bpftool("prog", fail=False) |
| 587 | skip(ret != 0, "bpftool not installed") | 595 | skip(ret != 0, "bpftool not installed") |
| 588 | # Check no BPF programs are loaded | 596 | base_progs = progs |
| 589 | skip(len(progs) != 0, "BPF programs already loaded on the system") | 597 | _, base_maps = bpftool("map") |
| 590 | 598 | ||
| 591 | # Check netdevsim | 599 | # Check netdevsim |
| 592 | ret, out = cmd("modprobe netdevsim", fail=False) | 600 | ret, out = cmd("modprobe netdevsim", fail=False) |
diff --git a/tools/testing/selftests/bpf/test_tunnel.sh b/tools/testing/selftests/bpf/test_tunnel.sh index aeb2901f21f4..546aee3e9fb4 100755 --- a/tools/testing/selftests/bpf/test_tunnel.sh +++ b/tools/testing/selftests/bpf/test_tunnel.sh | |||
| @@ -608,28 +608,26 @@ setup_xfrm_tunnel() | |||
| 608 | test_xfrm_tunnel() | 608 | test_xfrm_tunnel() |
| 609 | { | 609 | { |
| 610 | config_device | 610 | config_device |
| 611 | #tcpdump -nei veth1 ip & | 611 | > /sys/kernel/debug/tracing/trace |
| 612 | output=$(mktemp) | 612 | setup_xfrm_tunnel |
| 613 | cat /sys/kernel/debug/tracing/trace_pipe | tee $output & | ||
| 614 | setup_xfrm_tunnel | ||
| 615 | tc qdisc add dev veth1 clsact | 613 | tc qdisc add dev veth1 clsact |
| 616 | tc filter add dev veth1 proto ip ingress bpf da obj test_tunnel_kern.o \ | 614 | tc filter add dev veth1 proto ip ingress bpf da obj test_tunnel_kern.o \ |
| 617 | sec xfrm_get_state | 615 | sec xfrm_get_state |
| 618 | ip netns exec at_ns0 ping $PING_ARG 10.1.1.200 | 616 | ip netns exec at_ns0 ping $PING_ARG 10.1.1.200 |
| 619 | sleep 1 | 617 | sleep 1 |
| 620 | grep "reqid 1" $output | 618 | grep "reqid 1" /sys/kernel/debug/tracing/trace |
| 621 | check_err $? | 619 | check_err $? |
| 622 | grep "spi 0x1" $output | 620 | grep "spi 0x1" /sys/kernel/debug/tracing/trace |
| 623 | check_err $? | 621 | check_err $? |
| 624 | grep "remote ip 0xac100164" $output | 622 | grep "remote ip 0xac100164" /sys/kernel/debug/tracing/trace |
| 625 | check_err $? | 623 | check_err $? |
| 626 | cleanup | 624 | cleanup |
| 627 | 625 | ||
| 628 | if [ $ret -ne 0 ]; then | 626 | if [ $ret -ne 0 ]; then |
| 629 | echo -e ${RED}"FAIL: xfrm tunnel"${NC} | 627 | echo -e ${RED}"FAIL: xfrm tunnel"${NC} |
| 630 | return 1 | 628 | return 1 |
| 631 | fi | 629 | fi |
| 632 | echo -e ${GREEN}"PASS: xfrm tunnel"${NC} | 630 | echo -e ${GREEN}"PASS: xfrm tunnel"${NC} |
| 633 | } | 631 | } |
| 634 | 632 | ||
| 635 | attach_bpf() | 633 | attach_bpf() |
| @@ -657,6 +655,10 @@ cleanup() | |||
| 657 | ip link del ip6geneve11 2> /dev/null | 655 | ip link del ip6geneve11 2> /dev/null |
| 658 | ip link del erspan11 2> /dev/null | 656 | ip link del erspan11 2> /dev/null |
| 659 | ip link del ip6erspan11 2> /dev/null | 657 | ip link del ip6erspan11 2> /dev/null |
| 658 | ip xfrm policy delete dir out src 10.1.1.200/32 dst 10.1.1.100/32 2> /dev/null | ||
| 659 | ip xfrm policy delete dir in src 10.1.1.100/32 dst 10.1.1.200/32 2> /dev/null | ||
| 660 | ip xfrm state delete src 172.16.1.100 dst 172.16.1.200 proto esp spi 0x1 2> /dev/null | ||
| 661 | ip xfrm state delete src 172.16.1.200 dst 172.16.1.100 proto esp spi 0x2 2> /dev/null | ||
| 660 | } | 662 | } |
| 661 | 663 | ||
| 662 | cleanup_exit() | 664 | cleanup_exit() |
| @@ -668,7 +670,7 @@ cleanup_exit() | |||
| 668 | 670 | ||
| 669 | check() | 671 | check() |
| 670 | { | 672 | { |
| 671 | ip link help $1 2>&1 | grep -q "^Usage:" | 673 | ip link help 2>&1 | grep -q "\s$1\s" |
| 672 | if [ $? -ne 0 ];then | 674 | if [ $? -ne 0 ];then |
| 673 | echo "SKIP $1: iproute2 not support" | 675 | echo "SKIP $1: iproute2 not support" |
| 674 | cleanup | 676 | cleanup |
