Skip to content

Commit

Permalink
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
Browse files Browse the repository at this point in the history
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
  ...
  • Loading branch information
torvalds committed Aug 19, 2018
2 parents e61cf2e + e2948e5 commit 2ad0d52
Show file tree
Hide file tree
Showing 60 changed files with 430 additions and 352 deletions.
4 changes: 3 additions & 1 deletion Documentation/devicetree/bindings/net/dsa/ksz.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@ Microchip KSZ Series Ethernet switches
Required properties:

- compatible: For external switch chips, compatible string must be exactly one
of: "microchip,ksz9477"
of the following:
- "microchip,ksz9477"
- "microchip,ksz9897"

See Documentation/devicetree/bindings/net/dsa/dsa.txt for a list of additional
required and optional properties.
Expand Down
3 changes: 2 additions & 1 deletion Documentation/devicetree/bindings/net/renesas,ravb.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ Required properties:
- "renesas,etheravb-rcar-gen2" as a fallback for the above
R-Car Gen2 and RZ/G1 devices.

- "renesas,etheravb-r8a774a1" for the R8A774A1 SoC.
- "renesas,etheravb-r8a7795" for the R8A7795 SoC.
- "renesas,etheravb-r8a7796" for the R8A7796 SoC.
- "renesas,etheravb-r8a77965" for the R8A77965 SoC.
Expand All @@ -24,7 +25,7 @@ Required properties:
- "renesas,etheravb-r8a77990" for the R8A77990 SoC.
- "renesas,etheravb-r8a77995" for the R8A77995 SoC.
- "renesas,etheravb-rcar-gen3" as a fallback for the above
R-Car Gen3 devices.
R-Car Gen3 and RZ/G2 devices.

When compatible with the generic version, nodes must list the
SoC-specific version corresponding to the platform first followed by
Expand Down
11 changes: 6 additions & 5 deletions Documentation/networking/ti-cpsw.txt
Original file line number Diff line number Diff line change
Expand Up @@ -469,17 +469,18 @@ $ tc -g class show dev eth1

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

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

16)
Expand Down
34 changes: 27 additions & 7 deletions Documentation/networking/tproxy.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,28 @@ This feature adds Linux 2.2-like transparent proxy support to current kernels.
To use it, enable the socket match and the TPROXY target in your kernel config.
You will need policy routing too, so be sure to enable that as well.

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

1. Making non-local sockets work
================================

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

# iptables -t mangle -N DIVERT
# iptables -t mangle -A PREROUTING -p tcp -m socket -j DIVERT
# iptables -t mangle -A DIVERT -j MARK --set-mark 1
# iptables -t mangle -A DIVERT -j ACCEPT

Alternatively you can do this in nft with the following commands:

# nft add table filter
# nft add chain filter divert "{ type filter hook prerouting priority -150; }"
# nft add rule filter divert meta l4proto tcp socket transparent 1 meta mark set 1 accept

And then match on that value using policy routing to have those packets
delivered locally:

# ip rule add fwmark 1 lookup 100
# ip route add local 0.0.0.0/0 dev lo table 100

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

Or the following rule to nft:

# nft add rule filter divert tcp dport 80 tproxy to :50080 meta mark set 1 accept

Note that for this to work you'll have to modify the proxy to enable (SOL_IP,
IP_TRANSPARENT) for the listening socket.

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

3. Iptables extensions
======================
3. Iptables and nf_tables extensions
====================================

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

Or the floowing modules for nf_tables:
- NFT_SOCKET
- NFT_TPROXY

4. Application support
======================
Expand Down
8 changes: 1 addition & 7 deletions drivers/isdn/i4l/isdn_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -1640,13 +1640,7 @@ isdn_ioctl(struct file *file, uint cmd, ulong arg)
} else
return -EINVAL;
case IIOCDBGVAR:
if (arg) {
if (copy_to_user(argp, &dev, sizeof(ulong)))
return -EFAULT;
return 0;
} else
return -EINVAL;
break;
return -EINVAL;
default:
if ((cmd & IIOCDRVCTL) == IIOCDRVCTL)
cmd = ((cmd >> _IOC_NRSHIFT) & _IOC_NRMASK) & ISDN_DRVIOCTL_MASK;
Expand Down
9 changes: 9 additions & 0 deletions drivers/net/dsa/microchip/ksz_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -1102,6 +1102,15 @@ static const struct ksz_chip_data ksz_switch_chips[] = {
.cpu_ports = 0x7F, /* can be configured as cpu port */
.port_cnt = 7, /* total physical port count */
},
{
.chip_id = 0x00989700,
.dev_name = "KSZ9897",
.num_vlans = 4096,
.num_alus = 4096,
.num_statics = 16,
.cpu_ports = 0x7F, /* can be configured as cpu port */
.port_cnt = 7, /* total physical port count */
},
};

static int ksz_switch_init(struct ksz_device *dev)
Expand Down
1 change: 1 addition & 0 deletions drivers/net/dsa/microchip/ksz_spi.c
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,7 @@ static int ksz_spi_remove(struct spi_device *spi)

static const struct of_device_id ksz_dt_ids[] = {
{ .compatible = "microchip,ksz9477" },
{ .compatible = "microchip,ksz9897" },
{},
};
MODULE_DEVICE_TABLE(of, ksz_dt_ids);
Expand Down
4 changes: 2 additions & 2 deletions drivers/net/ethernet/mellanox/mlx5/core/en_stats.c
Original file line number Diff line number Diff line change
Expand Up @@ -848,7 +848,7 @@ static const struct counter_desc pport_per_prio_traffic_stats_desc[] = {

#define NUM_PPORT_PER_PRIO_TRAFFIC_COUNTERS ARRAY_SIZE(pport_per_prio_traffic_stats_desc)

static int mlx5e_grp_per_prio_traffic_get_num_stats(struct mlx5e_priv *priv)
static int mlx5e_grp_per_prio_traffic_get_num_stats(void)
{
return NUM_PPORT_PER_PRIO_TRAFFIC_COUNTERS * NUM_PPORT_PRIO;
}
Expand Down Expand Up @@ -1006,7 +1006,7 @@ static int mlx5e_grp_per_prio_pfc_fill_stats(struct mlx5e_priv *priv,

static int mlx5e_grp_per_prio_get_num_stats(struct mlx5e_priv *priv)
{
return mlx5e_grp_per_prio_traffic_get_num_stats(priv) +
return mlx5e_grp_per_prio_traffic_get_num_stats() +
mlx5e_grp_per_prio_pfc_get_num_stats(priv);
}

Expand Down
3 changes: 1 addition & 2 deletions drivers/net/ethernet/microchip/lan743x_ptp.c
Original file line number Diff line number Diff line change
Expand Up @@ -831,8 +831,7 @@ static void lan743x_ptp_sync_to_system_clock(struct lan743x_adapter *adapter)
{
struct timespec64 ts;

memset(&ts, 0, sizeof(ts));
timekeeping_clocktai64(&ts);
ktime_get_clocktai_ts64(&ts);

lan743x_ptp_clock_set(adapter, ts.tv_sec, ts.tv_nsec, 0);
}
Expand Down
1 change: 1 addition & 0 deletions drivers/net/ethernet/realtek/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ config R8169
select FW_LOADER
select CRC32
select PHYLIB
select REALTEK_PHY
---help---
Say Y here if you have a Realtek 8169 PCI Gigabit Ethernet adapter.

Expand Down
9 changes: 6 additions & 3 deletions drivers/net/ethernet/realtek/r8169.c
Original file line number Diff line number Diff line change
Expand Up @@ -7071,17 +7071,20 @@ static int rtl_alloc_irq(struct rtl8169_private *tp)
{
unsigned int flags;

if (tp->mac_version <= RTL_GIGA_MAC_VER_06) {
switch (tp->mac_version) {
case RTL_GIGA_MAC_VER_01 ... RTL_GIGA_MAC_VER_06:
RTL_W8(tp, Cfg9346, Cfg9346_Unlock);
RTL_W8(tp, Config2, RTL_R8(tp, Config2) & ~MSIEnable);
RTL_W8(tp, Cfg9346, Cfg9346_Lock);
flags = PCI_IRQ_LEGACY;
} else if (tp->mac_version == RTL_GIGA_MAC_VER_40) {
break;
case RTL_GIGA_MAC_VER_39 ... RTL_GIGA_MAC_VER_40:
/* This version was reported to have issues with resume
* from suspend when using MSI-X
*/
flags = PCI_IRQ_LEGACY | PCI_IRQ_MSI;
} else {
break;
default:
flags = PCI_IRQ_ALL_TYPES;
}

Expand Down
70 changes: 33 additions & 37 deletions drivers/net/veth.c
Original file line number Diff line number Diff line change
Expand Up @@ -789,16 +789,48 @@ static int is_valid_veth_mtu(int mtu)
return mtu >= ETH_MIN_MTU && mtu <= ETH_MAX_MTU;
}

static int veth_alloc_queues(struct net_device *dev)
{
struct veth_priv *priv = netdev_priv(dev);
int i;

priv->rq = kcalloc(dev->num_rx_queues, sizeof(*priv->rq), GFP_KERNEL);
if (!priv->rq)
return -ENOMEM;

for (i = 0; i < dev->num_rx_queues; i++)
priv->rq[i].dev = dev;

return 0;
}

static void veth_free_queues(struct net_device *dev)
{
struct veth_priv *priv = netdev_priv(dev);

kfree(priv->rq);
}

static int veth_dev_init(struct net_device *dev)
{
int err;

dev->vstats = netdev_alloc_pcpu_stats(struct pcpu_vstats);
if (!dev->vstats)
return -ENOMEM;

err = veth_alloc_queues(dev);
if (err) {
free_percpu(dev->vstats);
return err;
}

return 0;
}

static void veth_dev_free(struct net_device *dev)
{
veth_free_queues(dev);
free_percpu(dev->vstats);
}

Expand Down Expand Up @@ -1040,31 +1072,13 @@ static int veth_validate(struct nlattr *tb[], struct nlattr *data[],
return 0;
}

static int veth_alloc_queues(struct net_device *dev)
{
struct veth_priv *priv = netdev_priv(dev);

priv->rq = kcalloc(dev->num_rx_queues, sizeof(*priv->rq), GFP_KERNEL);
if (!priv->rq)
return -ENOMEM;

return 0;
}

static void veth_free_queues(struct net_device *dev)
{
struct veth_priv *priv = netdev_priv(dev);

kfree(priv->rq);
}

static struct rtnl_link_ops veth_link_ops;

static int veth_newlink(struct net *src_net, struct net_device *dev,
struct nlattr *tb[], struct nlattr *data[],
struct netlink_ext_ack *extack)
{
int err, i;
int err;
struct net_device *peer;
struct veth_priv *priv;
char ifname[IFNAMSIZ];
Expand Down Expand Up @@ -1117,12 +1131,6 @@ static int veth_newlink(struct net *src_net, struct net_device *dev,
return PTR_ERR(peer);
}

err = veth_alloc_queues(peer);
if (err) {
put_net(net);
goto err_peer_alloc_queues;
}

if (!ifmp || !tbp[IFLA_ADDRESS])
eth_hw_addr_random(peer);

Expand Down Expand Up @@ -1151,10 +1159,6 @@ static int veth_newlink(struct net *src_net, struct net_device *dev,
* should be re-allocated
*/

err = veth_alloc_queues(dev);
if (err)
goto err_alloc_queues;

if (tb[IFLA_ADDRESS] == NULL)
eth_hw_addr_random(dev);

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

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

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

return 0;

err_register_dev:
veth_free_queues(dev);
err_alloc_queues:
/* nothing to do */
err_configure_peer:
unregister_netdevice(peer);
return err;

err_register_peer:
veth_free_queues(peer);
err_peer_alloc_queues:
free_netdev(peer);
return err;
}
Expand Down
3 changes: 2 additions & 1 deletion include/linux/filter.h
Original file line number Diff line number Diff line change
Expand Up @@ -543,7 +543,6 @@ struct bpf_redirect_info {
u32 flags;
struct bpf_map *map;
struct bpf_map *map_to_flush;
unsigned long map_owner;
u32 kern_flags;
};

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

void bpf_clear_redirect_map(struct bpf_map *map);

static inline bool xdp_return_frame_no_direct(void)
{
struct bpf_redirect_info *ri = this_cpu_ptr(&bpf_redirect_info);
Expand Down
5 changes: 5 additions & 0 deletions include/linux/jiffies.h
Original file line number Diff line number Diff line change
Expand Up @@ -447,6 +447,11 @@ static inline clock_t jiffies_delta_to_clock_t(long delta)
return jiffies_to_clock_t(max(0L, delta));
}

static inline unsigned int jiffies_delta_to_msecs(long delta)
{
return jiffies_to_msecs(max(0L, delta));
}

extern unsigned long clock_t_to_jiffies(unsigned long x);
extern u64 jiffies_64_to_clock_t(u64 x);
extern u64 nsec_to_clock_t(u64 x);
Expand Down
Loading

0 comments on commit 2ad0d52

Please sign in to comment.