Skip to content

Commit 2ad0d52

Browse files
committed
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
Pull networking fixes from David Miller: 1) Fix races in IPVS, from Tan Hu. 2) Missing unbind in matchall classifier, from Hangbin Liu. 3) Missing act_ife action release, from Vlad Buslov. 4) Cure lockdep splats in ila, from Cong Wang. 5) veth queue leak on link delete, from Toshiaki Makita. 6) Disable isdn's IIOCDBGVAR ioctl, it exposes kernel addresses. From Kees Cook. 7) RCU usage fixup in XDP, from Tariq Toukan. 8) Two TCP ULP fixes from Daniel Borkmann. 9) r8169 needs REALTEK_PHY as a Kconfig dependency, from Heiner Kallweit. 10) Always take tcf_lock with BH disabled, otherwise we can deadlock with rate estimator code paths. From Vlad Buslov. 11) Don't use MSI-X on RTL8106e r8169 chips, they don't resume properly. From Jian-Hong Pan. * git://git.kernel.org/pub/scm/linux/kernel/git/davem/net: (41 commits) ip6_vti: fix creating fallback tunnel device for vti6 ip_vti: fix a null pointer deferrence when create vti fallback tunnel r8169: don't use MSI-X on RTL8106e net: lan743x_ptp: convert to ktime_get_clocktai_ts64 net: sched: always disable bh when taking tcf_lock ip6_vti: simplify stats handling in vti6_xmit bpf: fix redirect to map under tail calls r8169: add missing Kconfig dependency tools/bpf: fix bpf selftest test_cgroup_storage failure bpf, sockmap: fix sock_map_ctx_update_elem race with exist/noexist bpf, sockmap: fix map elem deletion race with smap_stop_sock bpf, sockmap: fix leakage of smap_psock_map_entry tcp, ulp: fix leftover icsk_ulp_ops preventing sock from reattach tcp, ulp: add alias for all ulp modules bpf: fix a rcu usage warning in bpf_prog_array_copy_core() samples/bpf: all XDP samples should unload xdp/bpf prog on SIGTERM net/xdp: Fix suspicious RCU usage warning net/mlx5e: Delete unneeded function argument Documentation: networking: ti-cpsw: correct cbs parameters for Eth1 100Mb isdn: Disable IIOCDBGVAR ...
2 parents e61cf2e + e2948e5 commit 2ad0d52

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

60 files changed

+430
-352
lines changed

Documentation/devicetree/bindings/net/dsa/ksz.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@ Microchip KSZ Series Ethernet switches
44
Required properties:
55

66
- compatible: For external switch chips, compatible string must be exactly one
7-
of: "microchip,ksz9477"
7+
of the following:
8+
- "microchip,ksz9477"
9+
- "microchip,ksz9897"
810

911
See Documentation/devicetree/bindings/net/dsa/dsa.txt for a list of additional
1012
required and optional properties.

Documentation/devicetree/bindings/net/renesas,ravb.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ Required properties:
1616
- "renesas,etheravb-rcar-gen2" as a fallback for the above
1717
R-Car Gen2 and RZ/G1 devices.
1818

19+
- "renesas,etheravb-r8a774a1" for the R8A774A1 SoC.
1920
- "renesas,etheravb-r8a7795" for the R8A7795 SoC.
2021
- "renesas,etheravb-r8a7796" for the R8A7796 SoC.
2122
- "renesas,etheravb-r8a77965" for the R8A77965 SoC.
@@ -24,7 +25,7 @@ Required properties:
2425
- "renesas,etheravb-r8a77990" for the R8A77990 SoC.
2526
- "renesas,etheravb-r8a77995" for the R8A77995 SoC.
2627
- "renesas,etheravb-rcar-gen3" as a fallback for the above
27-
R-Car Gen3 devices.
28+
R-Car Gen3 and RZ/G2 devices.
2829

2930
When compatible with the generic version, nodes must list the
3031
SoC-specific version corresponding to the platform first followed by

Documentation/networking/ti-cpsw.txt

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -469,17 +469,18 @@ $ tc -g class show dev eth1
469469

470470
14)
471471
// Set rate for class A - 31 Mbit (tc0, txq2) using CBS Qdisc for Eth1
472-
// here only idle slope is important, others ignored
472+
// here only idle slope is important, others ignored, but calculated
473+
// for interface speed - 100Mb for eth1 port.
473474
// Set it +1 Mb for reserve (important!)
474-
$ tc qdisc add dev eth1 parent 100:3 cbs locredit -1453 \
475-
hicredit 47 sendslope -969000 idleslope 31000 offload 1
475+
$ tc qdisc add dev eth1 parent 100:3 cbs locredit -1035 \
476+
hicredit 465 sendslope -69000 idleslope 31000 offload 1
476477
net eth1: set FIFO3 bw = 31
477478

478479
15)
479480
// Set rate for class B - 11 Mbit (tc1, txq3) using CBS Qdisc for Eth1
480481
// Set it +1 Mb for reserve (important!)
481-
$ tc qdisc add dev eth1 parent 100:4 cbs locredit -1483 \
482-
hicredit 34 sendslope -989000 idleslope 11000 offload 1
482+
$ tc qdisc add dev eth1 parent 100:4 cbs locredit -1335 \
483+
hicredit 405 sendslope -89000 idleslope 11000 offload 1
483484
net eth1: set FIFO2 bw = 11
484485

485486
16)

Documentation/networking/tproxy.txt

Lines changed: 27 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,19 +5,28 @@ This feature adds Linux 2.2-like transparent proxy support to current kernels.
55
To use it, enable the socket match and the TPROXY target in your kernel config.
66
You will need policy routing too, so be sure to enable that as well.
77

8+
From Linux 4.18 transparent proxy support is also available in nf_tables.
89

910
1. Making non-local sockets work
1011
================================
1112

1213
The idea is that you identify packets with destination address matching a local
13-
socket on your box, set the packet mark to a certain value, and then match on that
14-
value using policy routing to have those packets delivered locally:
14+
socket on your box, set the packet mark to a certain value:
1515

1616
# iptables -t mangle -N DIVERT
1717
# iptables -t mangle -A PREROUTING -p tcp -m socket -j DIVERT
1818
# iptables -t mangle -A DIVERT -j MARK --set-mark 1
1919
# iptables -t mangle -A DIVERT -j ACCEPT
2020

21+
Alternatively you can do this in nft with the following commands:
22+
23+
# nft add table filter
24+
# nft add chain filter divert "{ type filter hook prerouting priority -150; }"
25+
# nft add rule filter divert meta l4proto tcp socket transparent 1 meta mark set 1 accept
26+
27+
And then match on that value using policy routing to have those packets
28+
delivered locally:
29+
2130
# ip rule add fwmark 1 lookup 100
2231
# ip route add local 0.0.0.0/0 dev lo table 100
2332

@@ -57,17 +66,28 @@ add rules like this to the iptables ruleset above:
5766
# iptables -t mangle -A PREROUTING -p tcp --dport 80 -j TPROXY \
5867
--tproxy-mark 0x1/0x1 --on-port 50080
5968

69+
Or the following rule to nft:
70+
71+
# nft add rule filter divert tcp dport 80 tproxy to :50080 meta mark set 1 accept
72+
6073
Note that for this to work you'll have to modify the proxy to enable (SOL_IP,
6174
IP_TRANSPARENT) for the listening socket.
6275

76+
As an example implementation, tcprdr is available here:
77+
https://git.breakpoint.cc/cgit/fw/tcprdr.git/
78+
This tool is written by Florian Westphal and it was used for testing during the
79+
nf_tables implementation.
6380

64-
3. Iptables extensions
65-
======================
81+
3. Iptables and nf_tables extensions
82+
====================================
6683

67-
To use tproxy you'll need to have the 'socket' and 'TPROXY' modules
68-
compiled for iptables. A patched version of iptables is available
69-
here: http://git.balabit.hu/?p=bazsi/iptables-tproxy.git
84+
To use tproxy you'll need to have the following modules compiled for iptables:
85+
- NETFILTER_XT_MATCH_SOCKET
86+
- NETFILTER_XT_TARGET_TPROXY
7087

88+
Or the floowing modules for nf_tables:
89+
- NFT_SOCKET
90+
- NFT_TPROXY
7191

7292
4. Application support
7393
======================

drivers/isdn/i4l/isdn_common.c

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1640,13 +1640,7 @@ isdn_ioctl(struct file *file, uint cmd, ulong arg)
16401640
} else
16411641
return -EINVAL;
16421642
case IIOCDBGVAR:
1643-
if (arg) {
1644-
if (copy_to_user(argp, &dev, sizeof(ulong)))
1645-
return -EFAULT;
1646-
return 0;
1647-
} else
1648-
return -EINVAL;
1649-
break;
1643+
return -EINVAL;
16501644
default:
16511645
if ((cmd & IIOCDRVCTL) == IIOCDRVCTL)
16521646
cmd = ((cmd >> _IOC_NRSHIFT) & _IOC_NRMASK) & ISDN_DRVIOCTL_MASK;

drivers/net/dsa/microchip/ksz_common.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1102,6 +1102,15 @@ static const struct ksz_chip_data ksz_switch_chips[] = {
11021102
.cpu_ports = 0x7F, /* can be configured as cpu port */
11031103
.port_cnt = 7, /* total physical port count */
11041104
},
1105+
{
1106+
.chip_id = 0x00989700,
1107+
.dev_name = "KSZ9897",
1108+
.num_vlans = 4096,
1109+
.num_alus = 4096,
1110+
.num_statics = 16,
1111+
.cpu_ports = 0x7F, /* can be configured as cpu port */
1112+
.port_cnt = 7, /* total physical port count */
1113+
},
11051114
};
11061115

11071116
static int ksz_switch_init(struct ksz_device *dev)

drivers/net/dsa/microchip/ksz_spi.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,7 @@ static int ksz_spi_remove(struct spi_device *spi)
195195

196196
static const struct of_device_id ksz_dt_ids[] = {
197197
{ .compatible = "microchip,ksz9477" },
198+
{ .compatible = "microchip,ksz9897" },
198199
{},
199200
};
200201
MODULE_DEVICE_TABLE(of, ksz_dt_ids);

drivers/net/ethernet/mellanox/mlx5/core/en_stats.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -848,7 +848,7 @@ static const struct counter_desc pport_per_prio_traffic_stats_desc[] = {
848848

849849
#define NUM_PPORT_PER_PRIO_TRAFFIC_COUNTERS ARRAY_SIZE(pport_per_prio_traffic_stats_desc)
850850

851-
static int mlx5e_grp_per_prio_traffic_get_num_stats(struct mlx5e_priv *priv)
851+
static int mlx5e_grp_per_prio_traffic_get_num_stats(void)
852852
{
853853
return NUM_PPORT_PER_PRIO_TRAFFIC_COUNTERS * NUM_PPORT_PRIO;
854854
}
@@ -1006,7 +1006,7 @@ static int mlx5e_grp_per_prio_pfc_fill_stats(struct mlx5e_priv *priv,
10061006

10071007
static int mlx5e_grp_per_prio_get_num_stats(struct mlx5e_priv *priv)
10081008
{
1009-
return mlx5e_grp_per_prio_traffic_get_num_stats(priv) +
1009+
return mlx5e_grp_per_prio_traffic_get_num_stats() +
10101010
mlx5e_grp_per_prio_pfc_get_num_stats(priv);
10111011
}
10121012

drivers/net/ethernet/microchip/lan743x_ptp.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -831,8 +831,7 @@ static void lan743x_ptp_sync_to_system_clock(struct lan743x_adapter *adapter)
831831
{
832832
struct timespec64 ts;
833833

834-
memset(&ts, 0, sizeof(ts));
835-
timekeeping_clocktai64(&ts);
834+
ktime_get_clocktai_ts64(&ts);
836835

837836
lan743x_ptp_clock_set(adapter, ts.tv_sec, ts.tv_nsec, 0);
838837
}

drivers/net/ethernet/realtek/Kconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@ config R8169
100100
select FW_LOADER
101101
select CRC32
102102
select PHYLIB
103+
select REALTEK_PHY
103104
---help---
104105
Say Y here if you have a Realtek 8169 PCI Gigabit Ethernet adapter.
105106

drivers/net/ethernet/realtek/r8169.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7071,17 +7071,20 @@ static int rtl_alloc_irq(struct rtl8169_private *tp)
70717071
{
70727072
unsigned int flags;
70737073

7074-
if (tp->mac_version <= RTL_GIGA_MAC_VER_06) {
7074+
switch (tp->mac_version) {
7075+
case RTL_GIGA_MAC_VER_01 ... RTL_GIGA_MAC_VER_06:
70757076
RTL_W8(tp, Cfg9346, Cfg9346_Unlock);
70767077
RTL_W8(tp, Config2, RTL_R8(tp, Config2) & ~MSIEnable);
70777078
RTL_W8(tp, Cfg9346, Cfg9346_Lock);
70787079
flags = PCI_IRQ_LEGACY;
7079-
} else if (tp->mac_version == RTL_GIGA_MAC_VER_40) {
7080+
break;
7081+
case RTL_GIGA_MAC_VER_39 ... RTL_GIGA_MAC_VER_40:
70807082
/* This version was reported to have issues with resume
70817083
* from suspend when using MSI-X
70827084
*/
70837085
flags = PCI_IRQ_LEGACY | PCI_IRQ_MSI;
7084-
} else {
7086+
break;
7087+
default:
70857088
flags = PCI_IRQ_ALL_TYPES;
70867089
}
70877090

drivers/net/veth.c

Lines changed: 33 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -789,16 +789,48 @@ static int is_valid_veth_mtu(int mtu)
789789
return mtu >= ETH_MIN_MTU && mtu <= ETH_MAX_MTU;
790790
}
791791

792+
static int veth_alloc_queues(struct net_device *dev)
793+
{
794+
struct veth_priv *priv = netdev_priv(dev);
795+
int i;
796+
797+
priv->rq = kcalloc(dev->num_rx_queues, sizeof(*priv->rq), GFP_KERNEL);
798+
if (!priv->rq)
799+
return -ENOMEM;
800+
801+
for (i = 0; i < dev->num_rx_queues; i++)
802+
priv->rq[i].dev = dev;
803+
804+
return 0;
805+
}
806+
807+
static void veth_free_queues(struct net_device *dev)
808+
{
809+
struct veth_priv *priv = netdev_priv(dev);
810+
811+
kfree(priv->rq);
812+
}
813+
792814
static int veth_dev_init(struct net_device *dev)
793815
{
816+
int err;
817+
794818
dev->vstats = netdev_alloc_pcpu_stats(struct pcpu_vstats);
795819
if (!dev->vstats)
796820
return -ENOMEM;
821+
822+
err = veth_alloc_queues(dev);
823+
if (err) {
824+
free_percpu(dev->vstats);
825+
return err;
826+
}
827+
797828
return 0;
798829
}
799830

800831
static void veth_dev_free(struct net_device *dev)
801832
{
833+
veth_free_queues(dev);
802834
free_percpu(dev->vstats);
803835
}
804836

@@ -1040,31 +1072,13 @@ static int veth_validate(struct nlattr *tb[], struct nlattr *data[],
10401072
return 0;
10411073
}
10421074

1043-
static int veth_alloc_queues(struct net_device *dev)
1044-
{
1045-
struct veth_priv *priv = netdev_priv(dev);
1046-
1047-
priv->rq = kcalloc(dev->num_rx_queues, sizeof(*priv->rq), GFP_KERNEL);
1048-
if (!priv->rq)
1049-
return -ENOMEM;
1050-
1051-
return 0;
1052-
}
1053-
1054-
static void veth_free_queues(struct net_device *dev)
1055-
{
1056-
struct veth_priv *priv = netdev_priv(dev);
1057-
1058-
kfree(priv->rq);
1059-
}
1060-
10611075
static struct rtnl_link_ops veth_link_ops;
10621076

10631077
static int veth_newlink(struct net *src_net, struct net_device *dev,
10641078
struct nlattr *tb[], struct nlattr *data[],
10651079
struct netlink_ext_ack *extack)
10661080
{
1067-
int err, i;
1081+
int err;
10681082
struct net_device *peer;
10691083
struct veth_priv *priv;
10701084
char ifname[IFNAMSIZ];
@@ -1117,12 +1131,6 @@ static int veth_newlink(struct net *src_net, struct net_device *dev,
11171131
return PTR_ERR(peer);
11181132
}
11191133

1120-
err = veth_alloc_queues(peer);
1121-
if (err) {
1122-
put_net(net);
1123-
goto err_peer_alloc_queues;
1124-
}
1125-
11261134
if (!ifmp || !tbp[IFLA_ADDRESS])
11271135
eth_hw_addr_random(peer);
11281136

@@ -1151,10 +1159,6 @@ static int veth_newlink(struct net *src_net, struct net_device *dev,
11511159
* should be re-allocated
11521160
*/
11531161

1154-
err = veth_alloc_queues(dev);
1155-
if (err)
1156-
goto err_alloc_queues;
1157-
11581162
if (tb[IFLA_ADDRESS] == NULL)
11591163
eth_hw_addr_random(dev);
11601164

@@ -1174,28 +1178,20 @@ static int veth_newlink(struct net *src_net, struct net_device *dev,
11741178
*/
11751179

11761180
priv = netdev_priv(dev);
1177-
for (i = 0; i < dev->real_num_rx_queues; i++)
1178-
priv->rq[i].dev = dev;
11791181
rcu_assign_pointer(priv->peer, peer);
11801182

11811183
priv = netdev_priv(peer);
1182-
for (i = 0; i < peer->real_num_rx_queues; i++)
1183-
priv->rq[i].dev = peer;
11841184
rcu_assign_pointer(priv->peer, dev);
11851185

11861186
return 0;
11871187

11881188
err_register_dev:
1189-
veth_free_queues(dev);
1190-
err_alloc_queues:
11911189
/* nothing to do */
11921190
err_configure_peer:
11931191
unregister_netdevice(peer);
11941192
return err;
11951193

11961194
err_register_peer:
1197-
veth_free_queues(peer);
1198-
err_peer_alloc_queues:
11991195
free_netdev(peer);
12001196
return err;
12011197
}

include/linux/filter.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -543,7 +543,6 @@ struct bpf_redirect_info {
543543
u32 flags;
544544
struct bpf_map *map;
545545
struct bpf_map *map_to_flush;
546-
unsigned long map_owner;
547546
u32 kern_flags;
548547
};
549548

@@ -781,6 +780,8 @@ static inline bool bpf_dump_raw_ok(void)
781780
struct bpf_prog *bpf_patch_insn_single(struct bpf_prog *prog, u32 off,
782781
const struct bpf_insn *patch, u32 len);
783782

783+
void bpf_clear_redirect_map(struct bpf_map *map);
784+
784785
static inline bool xdp_return_frame_no_direct(void)
785786
{
786787
struct bpf_redirect_info *ri = this_cpu_ptr(&bpf_redirect_info);

include/linux/jiffies.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -447,6 +447,11 @@ static inline clock_t jiffies_delta_to_clock_t(long delta)
447447
return jiffies_to_clock_t(max(0L, delta));
448448
}
449449

450+
static inline unsigned int jiffies_delta_to_msecs(long delta)
451+
{
452+
return jiffies_to_msecs(max(0L, delta));
453+
}
454+
450455
extern unsigned long clock_t_to_jiffies(unsigned long x);
451456
extern u64 jiffies_64_to_clock_t(u64 x);
452457
extern u64 nsec_to_clock_t(u64 x);

0 commit comments

Comments
 (0)