Skip to content

Commit 7f151f1

Browse files
committed
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
Pull networking fixes from David Miller: 1) Fix list tests in netfilter ingress support, from Florian Westphal. 2) Fix reversal of input and output interfaces in ingress hook invocation, from Pablo Neira Ayuso. 3) We have a use after free in r8169, caught by Dave Jones, fixed by Francois Romieu. 4) Splice use-after-free fix in AF_UNIX frmo Hannes Frederic Sowa. 5) Three ipv6 route handling bug fixes from Martin KaFai Lau: a) Don't create clone routes not managed by the fib6 tree b) Don't forget to check expiration of DST_NOCACHE routes. c) Handle rt->dst.from == NULL properly. 6) Several AF_PACKET fixes wrt transport header setting and SKB protocol setting, from Daniel Borkmann. 7) Fix thunder driver crash on shutdown, from Pavel Fedin. 8) Several Mellanox driver fixes (max MTU calculations, use of correct DMA unmap in TX path, etc.) from Saeed Mahameed, Tariq Toukan, Doron Tsur, Achiad Shochat, Eran Ben Elisha, and Noa Osherovich. 9) Several mv88e6060 DSA driver fixes (wrong bit definitions for certain registers, etc.) from Neil Armstrong. 10) Make sure to disable preemption while updating per-cpu stats of ip tunnels, from Jason A. Donenfeld. 11) Various ARM64 bpf JIT fixes, from Yang Shi. 12) Flush icache properly in ARM JITs, from Daniel Borkmann. 13) Fix masking of RX and TX interrupts in ravb driver, from Masaru Nagai. 14) Fix netdev feature propagation for devices not implementing ->ndo_set_features(). From Nikolay Aleksandrov. 15) Big endian fix in vmxnet3 driver, from Shrikrishna Khare. 16) RAW socket code increments incorrect SNMP counters, fix from Ben Cartwright-Cox. 17) IPv6 multicast SNMP counters are bumped twice, fix from Neil Horman. 18) Fix handling of VLAN headers on stacked devices when REORDER is disabled. From Vlad Yasevich. 19) Fix SKB leaks and use-after-free in ipvlan and macvlan drivers, from Sabrina Dubroca. * git://git.kernel.org/pub/scm/linux/kernel/git/davem/net: (83 commits) MAINTAINERS: Update Mellanox's Eth NIC driver entries net/core: revert "net: fix __netdev_update_features return.." and add comment af_unix: take receive queue lock while appending new skb rtnetlink: fix frame size warning in rtnl_fill_ifinfo net: use skb_clone to avoid alloc_pages failure. packet: Use PAGE_ALIGNED macro packet: Don't check frames_per_block against negative values net: phy: Use interrupts when available in NOLINK state phy: marvell: Add support for 88E1540 PHY arm64: bpf: make BPF prologue and epilogue align with ARM64 AAPCS macvlan: fix leak in macvlan_handle_frame ipvlan: fix use after free of skb ipvlan: fix leak in ipvlan_rcv_frame vlan: Do not put vlan headers back on bridge and macvlan ports vlan: Fix untag operations of stacked vlans with REORDER_HEADER off via-velocity: unconditionally drop frames with bad l2 length ipg: Remove ipg driver dl2k: Add support for IP1000A-based cards snmp: Remove duplicate OUTMCAST stat increment net: thunder: Check for driver data in nicvf_remove() ...
2 parents a18ab2f + e7523a4 commit 7f151f1

Some content is hidden

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

84 files changed

+1036
-3650
lines changed

MAINTAINERS

+9-8
Original file line numberDiff line numberDiff line change
@@ -5711,13 +5711,6 @@ M: Juanjo Ciarlante <[email protected]>
57115711
S: Maintained
57125712
F: net/ipv4/netfilter/ipt_MASQUERADE.c
57135713

5714-
IP1000A 10/100/1000 GIGABIT ETHERNET DRIVER
5715-
M: Francois Romieu <[email protected]>
5716-
M: Sorbica Shieh <[email protected]>
5717-
5718-
S: Maintained
5719-
F: drivers/net/ethernet/icplus/ipg.*
5720-
57215714
IPATH DRIVER
57225715
M: Mike Marciniszyn <[email protected]>
57235716
@@ -6923,13 +6916,21 @@ F: drivers/scsi/megaraid.*
69236916
F: drivers/scsi/megaraid/
69246917

69256918
MELLANOX ETHERNET DRIVER (mlx4_en)
6926-
M: Amir Vadai <amirv@mellanox.com>
6919+
M: Eugenia Emantayev <eugenia@mellanox.com>
69276920
69286921
S: Supported
69296922
W: http://www.mellanox.com
69306923
Q: http://patchwork.ozlabs.org/project/netdev/list/
69316924
F: drivers/net/ethernet/mellanox/mlx4/en_*
69326925

6926+
MELLANOX ETHERNET DRIVER (mlx5e)
6927+
M: Saeed Mahameed <[email protected]>
6928+
6929+
S: Supported
6930+
W: http://www.mellanox.com
6931+
Q: http://patchwork.ozlabs.org/project/netdev/list/
6932+
F: drivers/net/ethernet/mellanox/mlx5/core/en_*
6933+
69336934
MELLANOX ETHERNET SWITCH DRIVERS
69346935
M: Jiri Pirko <[email protected]>
69356936
M: Ido Schimmel <[email protected]>

arch/arm/net/bpf_jit_32.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -1061,7 +1061,7 @@ void bpf_jit_compile(struct bpf_prog *fp)
10611061
}
10621062
build_epilogue(&ctx);
10631063

1064-
flush_icache_range((u32)ctx.target, (u32)(ctx.target + ctx.idx));
1064+
flush_icache_range((u32)header, (u32)(ctx.target + ctx.idx));
10651065

10661066
#if __LINUX_ARM_ARCH__ < 7
10671067
if (ctx.imm_count)

arch/arm64/net/bpf_jit_comp.c

+41-7
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ static const int bpf2a64[] = {
5050
[BPF_REG_8] = A64_R(21),
5151
[BPF_REG_9] = A64_R(22),
5252
/* read-only frame pointer to access stack */
53-
[BPF_REG_FP] = A64_FP,
53+
[BPF_REG_FP] = A64_R(25),
5454
/* temporary register for internal BPF JIT */
5555
[TMP_REG_1] = A64_R(23),
5656
[TMP_REG_2] = A64_R(24),
@@ -155,18 +155,49 @@ static void build_prologue(struct jit_ctx *ctx)
155155
stack_size += 4; /* extra for skb_copy_bits buffer */
156156
stack_size = STACK_ALIGN(stack_size);
157157

158+
/*
159+
* BPF prog stack layout
160+
*
161+
* high
162+
* original A64_SP => 0:+-----+ BPF prologue
163+
* |FP/LR|
164+
* current A64_FP => -16:+-----+
165+
* | ... | callee saved registers
166+
* +-----+
167+
* | | x25/x26
168+
* BPF fp register => -80:+-----+
169+
* | |
170+
* | ... | BPF prog stack
171+
* | |
172+
* | |
173+
* current A64_SP => +-----+
174+
* | |
175+
* | ... | Function call stack
176+
* | |
177+
* +-----+
178+
* low
179+
*
180+
*/
181+
182+
/* Save FP and LR registers to stay align with ARM64 AAPCS */
183+
emit(A64_PUSH(A64_FP, A64_LR, A64_SP), ctx);
184+
emit(A64_MOV(1, A64_FP, A64_SP), ctx);
185+
158186
/* Save callee-saved register */
159187
emit(A64_PUSH(r6, r7, A64_SP), ctx);
160188
emit(A64_PUSH(r8, r9, A64_SP), ctx);
161189
if (ctx->tmp_used)
162190
emit(A64_PUSH(tmp1, tmp2, A64_SP), ctx);
163191

164-
/* Set up BPF stack */
165-
emit(A64_SUB_I(1, A64_SP, A64_SP, stack_size), ctx);
192+
/* Save fp (x25) and x26. SP requires 16 bytes alignment */
193+
emit(A64_PUSH(fp, A64_R(26), A64_SP), ctx);
166194

167-
/* Set up frame pointer */
195+
/* Set up BPF prog stack base register (x25) */
168196
emit(A64_MOV(1, fp, A64_SP), ctx);
169197

198+
/* Set up function call stack */
199+
emit(A64_SUB_I(1, A64_SP, A64_SP, stack_size), ctx);
200+
170201
/* Clear registers A and X */
171202
emit_a64_mov_i64(ra, 0, ctx);
172203
emit_a64_mov_i64(rx, 0, ctx);
@@ -190,14 +221,17 @@ static void build_epilogue(struct jit_ctx *ctx)
190221
/* We're done with BPF stack */
191222
emit(A64_ADD_I(1, A64_SP, A64_SP, stack_size), ctx);
192223

224+
/* Restore fs (x25) and x26 */
225+
emit(A64_POP(fp, A64_R(26), A64_SP), ctx);
226+
193227
/* Restore callee-saved register */
194228
if (ctx->tmp_used)
195229
emit(A64_POP(tmp1, tmp2, A64_SP), ctx);
196230
emit(A64_POP(r8, r9, A64_SP), ctx);
197231
emit(A64_POP(r6, r7, A64_SP), ctx);
198232

199-
/* Restore frame pointer */
200-
emit(A64_MOV(1, fp, A64_SP), ctx);
233+
/* Restore FP/LR registers */
234+
emit(A64_POP(A64_FP, A64_LR, A64_SP), ctx);
201235

202236
/* Set return value */
203237
emit(A64_MOV(1, A64_R(0), r0), ctx);
@@ -758,7 +792,7 @@ void bpf_int_jit_compile(struct bpf_prog *prog)
758792
if (bpf_jit_enable > 1)
759793
bpf_jit_dump(prog->len, image_size, 2, ctx.image);
760794

761-
bpf_flush_icache(ctx.image, ctx.image + ctx.idx);
795+
bpf_flush_icache(header, ctx.image + ctx.idx);
762796

763797
set_memory_ro((unsigned long)header, header->pages);
764798
prog->bpf_func = (void *)ctx.image;

drivers/net/dsa/mv88e6060.c

+38-76
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,7 @@
1515
#include <linux/netdevice.h>
1616
#include <linux/phy.h>
1717
#include <net/dsa.h>
18-
19-
#define REG_PORT(p) (8 + (p))
20-
#define REG_GLOBAL 0x0f
18+
#include "mv88e6060.h"
2119

2220
static int reg_read(struct dsa_switch *ds, int addr, int reg)
2321
{
@@ -67,13 +65,14 @@ static char *mv88e6060_probe(struct device *host_dev, int sw_addr)
6765
if (bus == NULL)
6866
return NULL;
6967

70-
ret = mdiobus_read(bus, sw_addr + REG_PORT(0), 0x03);
68+
ret = mdiobus_read(bus, sw_addr + REG_PORT(0), PORT_SWITCH_ID);
7169
if (ret >= 0) {
72-
if (ret == 0x0600)
70+
if (ret == PORT_SWITCH_ID_6060)
7371
return "Marvell 88E6060 (A0)";
74-
if (ret == 0x0601 || ret == 0x0602)
72+
if (ret == PORT_SWITCH_ID_6060_R1 ||
73+
ret == PORT_SWITCH_ID_6060_R2)
7574
return "Marvell 88E6060 (B0)";
76-
if ((ret & 0xfff0) == 0x0600)
75+
if ((ret & PORT_SWITCH_ID_6060_MASK) == PORT_SWITCH_ID_6060)
7776
return "Marvell 88E6060";
7877
}
7978

@@ -87,22 +86,26 @@ static int mv88e6060_switch_reset(struct dsa_switch *ds)
8786
unsigned long timeout;
8887

8988
/* Set all ports to the disabled state. */
90-
for (i = 0; i < 6; i++) {
91-
ret = REG_READ(REG_PORT(i), 0x04);
92-
REG_WRITE(REG_PORT(i), 0x04, ret & 0xfffc);
89+
for (i = 0; i < MV88E6060_PORTS; i++) {
90+
ret = REG_READ(REG_PORT(i), PORT_CONTROL);
91+
REG_WRITE(REG_PORT(i), PORT_CONTROL,
92+
ret & ~PORT_CONTROL_STATE_MASK);
9393
}
9494

9595
/* Wait for transmit queues to drain. */
9696
usleep_range(2000, 4000);
9797

9898
/* Reset the switch. */
99-
REG_WRITE(REG_GLOBAL, 0x0a, 0xa130);
99+
REG_WRITE(REG_GLOBAL, GLOBAL_ATU_CONTROL,
100+
GLOBAL_ATU_CONTROL_SWRESET |
101+
GLOBAL_ATU_CONTROL_ATUSIZE_1024 |
102+
GLOBAL_ATU_CONTROL_ATE_AGE_5MIN);
100103

101104
/* Wait up to one second for reset to complete. */
102105
timeout = jiffies + 1 * HZ;
103106
while (time_before(jiffies, timeout)) {
104-
ret = REG_READ(REG_GLOBAL, 0x00);
105-
if ((ret & 0x8000) == 0x0000)
107+
ret = REG_READ(REG_GLOBAL, GLOBAL_STATUS);
108+
if (ret & GLOBAL_STATUS_INIT_READY)
106109
break;
107110

108111
usleep_range(1000, 2000);
@@ -119,13 +122,15 @@ static int mv88e6060_setup_global(struct dsa_switch *ds)
119122
* set the maximum frame size to 1536 bytes, and mask all
120123
* interrupt sources.
121124
*/
122-
REG_WRITE(REG_GLOBAL, 0x04, 0x0800);
125+
REG_WRITE(REG_GLOBAL, GLOBAL_CONTROL, GLOBAL_CONTROL_MAX_FRAME_1536);
123126

124127
/* Enable automatic address learning, set the address
125128
* database size to 1024 entries, and set the default aging
126129
* time to 5 minutes.
127130
*/
128-
REG_WRITE(REG_GLOBAL, 0x0a, 0x2130);
131+
REG_WRITE(REG_GLOBAL, GLOBAL_ATU_CONTROL,
132+
GLOBAL_ATU_CONTROL_ATUSIZE_1024 |
133+
GLOBAL_ATU_CONTROL_ATE_AGE_5MIN);
129134

130135
return 0;
131136
}
@@ -139,25 +144,30 @@ static int mv88e6060_setup_port(struct dsa_switch *ds, int p)
139144
* state to Forwarding. Additionally, if this is the CPU
140145
* port, enable Ingress and Egress Trailer tagging mode.
141146
*/
142-
REG_WRITE(addr, 0x04, dsa_is_cpu_port(ds, p) ? 0x4103 : 0x0003);
147+
REG_WRITE(addr, PORT_CONTROL,
148+
dsa_is_cpu_port(ds, p) ?
149+
PORT_CONTROL_TRAILER |
150+
PORT_CONTROL_INGRESS_MODE |
151+
PORT_CONTROL_STATE_FORWARDING :
152+
PORT_CONTROL_STATE_FORWARDING);
143153

144154
/* Port based VLAN map: give each port its own address
145155
* database, allow the CPU port to talk to each of the 'real'
146156
* ports, and allow each of the 'real' ports to only talk to
147157
* the CPU port.
148158
*/
149-
REG_WRITE(addr, 0x06,
150-
((p & 0xf) << 12) |
151-
(dsa_is_cpu_port(ds, p) ?
152-
ds->phys_port_mask :
153-
(1 << ds->dst->cpu_port)));
159+
REG_WRITE(addr, PORT_VLAN_MAP,
160+
((p & 0xf) << PORT_VLAN_MAP_DBNUM_SHIFT) |
161+
(dsa_is_cpu_port(ds, p) ?
162+
ds->phys_port_mask :
163+
BIT(ds->dst->cpu_port)));
154164

155165
/* Port Association Vector: when learning source addresses
156166
* of packets, add the address to the address database using
157167
* a port bitmap that has only the bit for this port set and
158168
* the other bits clear.
159169
*/
160-
REG_WRITE(addr, 0x0b, 1 << p);
170+
REG_WRITE(addr, PORT_ASSOC_VECTOR, BIT(p));
161171

162172
return 0;
163173
}
@@ -177,7 +187,7 @@ static int mv88e6060_setup(struct dsa_switch *ds)
177187
if (ret < 0)
178188
return ret;
179189

180-
for (i = 0; i < 6; i++) {
190+
for (i = 0; i < MV88E6060_PORTS; i++) {
181191
ret = mv88e6060_setup_port(ds, i);
182192
if (ret < 0)
183193
return ret;
@@ -188,16 +198,17 @@ static int mv88e6060_setup(struct dsa_switch *ds)
188198

189199
static int mv88e6060_set_addr(struct dsa_switch *ds, u8 *addr)
190200
{
191-
REG_WRITE(REG_GLOBAL, 0x01, (addr[0] << 8) | addr[1]);
192-
REG_WRITE(REG_GLOBAL, 0x02, (addr[2] << 8) | addr[3]);
193-
REG_WRITE(REG_GLOBAL, 0x03, (addr[4] << 8) | addr[5]);
201+
/* Use the same MAC Address as FD Pause frames for all ports */
202+
REG_WRITE(REG_GLOBAL, GLOBAL_MAC_01, (addr[0] << 9) | addr[1]);
203+
REG_WRITE(REG_GLOBAL, GLOBAL_MAC_23, (addr[2] << 8) | addr[3]);
204+
REG_WRITE(REG_GLOBAL, GLOBAL_MAC_45, (addr[4] << 8) | addr[5]);
194205

195206
return 0;
196207
}
197208

198209
static int mv88e6060_port_to_phy_addr(int port)
199210
{
200-
if (port >= 0 && port <= 5)
211+
if (port >= 0 && port < MV88E6060_PORTS)
201212
return port;
202213
return -1;
203214
}
@@ -225,62 +236,13 @@ mv88e6060_phy_write(struct dsa_switch *ds, int port, int regnum, u16 val)
225236
return reg_write(ds, addr, regnum, val);
226237
}
227238

228-
static void mv88e6060_poll_link(struct dsa_switch *ds)
229-
{
230-
int i;
231-
232-
for (i = 0; i < DSA_MAX_PORTS; i++) {
233-
struct net_device *dev;
234-
int uninitialized_var(port_status);
235-
int link;
236-
int speed;
237-
int duplex;
238-
int fc;
239-
240-
dev = ds->ports[i];
241-
if (dev == NULL)
242-
continue;
243-
244-
link = 0;
245-
if (dev->flags & IFF_UP) {
246-
port_status = reg_read(ds, REG_PORT(i), 0x00);
247-
if (port_status < 0)
248-
continue;
249-
250-
link = !!(port_status & 0x1000);
251-
}
252-
253-
if (!link) {
254-
if (netif_carrier_ok(dev)) {
255-
netdev_info(dev, "link down\n");
256-
netif_carrier_off(dev);
257-
}
258-
continue;
259-
}
260-
261-
speed = (port_status & 0x0100) ? 100 : 10;
262-
duplex = (port_status & 0x0200) ? 1 : 0;
263-
fc = ((port_status & 0xc000) == 0xc000) ? 1 : 0;
264-
265-
if (!netif_carrier_ok(dev)) {
266-
netdev_info(dev,
267-
"link up, %d Mb/s, %s duplex, flow control %sabled\n",
268-
speed,
269-
duplex ? "full" : "half",
270-
fc ? "en" : "dis");
271-
netif_carrier_on(dev);
272-
}
273-
}
274-
}
275-
276239
static struct dsa_switch_driver mv88e6060_switch_driver = {
277240
.tag_protocol = DSA_TAG_PROTO_TRAILER,
278241
.probe = mv88e6060_probe,
279242
.setup = mv88e6060_setup,
280243
.set_addr = mv88e6060_set_addr,
281244
.phy_read = mv88e6060_phy_read,
282245
.phy_write = mv88e6060_phy_write,
283-
.poll_link = mv88e6060_poll_link,
284246
};
285247

286248
static int __init mv88e6060_init(void)

0 commit comments

Comments
 (0)