Skip to content

Commit 7d0d46d

Browse files
committed
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
Pull networking fixes from David Miller: 1) The value choosen for the new SO_MAX_PACING_RATE socket option on parisc was very poorly choosen, let's fix it while we still can. From Eric Dumazet. 2) Our generic reciprocal divide was found to handle some edge cases incorrectly, part of this is encoded into the BPF as deep as the JIT engines themselves. Just use a real divide throughout for now. From Eric Dumazet. 3) Because the initial lookup is lockless, the TCP metrics engine can end up creating two entries for the same lookup key. Fix this by doing a second lookup under the lock before we actually create the new entry. From Christoph Paasch. 4) Fix scatter-gather list init in usbnet driver, from Bjørn Mork. 5) Fix unintended 32-bit truncation in cxgb4 driver's bit shifting. From Dan Carpenter. 6) Netlink socket dumping uses the wrong socket state for timewait sockets. Fix from Neal Cardwell. 7) Fix netlink memory leak in ieee802154_add_iface(), from Christian Engelmayer. 8) Multicast forwarding in ipv4 can overflow the per-rule reference counts, causing all multicast traffic to cease. Fix from Hannes Frederic Sowa. 9) via-rhine needs to stop all TX queues when it resets the device, from Richard Weinberger. 10) Fix RDS per-cpu accesses broken by the this_cpu_* conversions. From Gerald Schaefer. * git://git.kernel.org/pub/scm/linux/kernel/git/davem/net: s390/bpf,jit: fix 32 bit divisions, use unsigned divide instructions parisc: fix SO_MAX_PACING_RATE typo ipv6: simplify detection of first operational link-local address on interface tcp: metrics: Avoid duplicate entries with the same destination-IP net: rds: fix per-cpu helper usage e1000e: Fix compilation warning when !CONFIG_PM_SLEEP bpf: do not use reciprocal divide be2net: add dma_mapping_error() check for dma_map_page() bnx2x: Don't release PCI bars on shutdown net,via-rhine: Fix tx_timeout handling batman-adv: fix batman-adv header overhead calculation qlge: Fix vlan netdev features. net: avoid reference counter overflows on fib_rules in multicast forwarding dm9601: add USB IDs for new dm96xx variants MAINTAINERS: add virtio-dev ML for virtio ieee802154: Fix memory leak in ieee802154_add_iface() net: usbnet: fix SG initialisation inet_diag: fix inet_diag_dump_icsk() to use correct state for timewait sockets cxgb4: silence shift wrapping static checker warning
2 parents 48ba620 + 3af57f7 commit 7d0d46d

File tree

25 files changed

+169
-130
lines changed

25 files changed

+169
-130
lines changed

MAINTAINERS

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9231,6 +9231,7 @@ F: include/media/videobuf2-*
92319231

92329232
VIRTIO CONSOLE DRIVER
92339233
M: Amit Shah <[email protected]>
9234+
92349235
92359236
S: Maintained
92369237
F: drivers/char/virtio_console.c
@@ -9240,6 +9241,7 @@ F: include/uapi/linux/virtio_console.h
92409241
VIRTIO CORE, NET AND BLOCK DRIVERS
92419242
M: Rusty Russell <[email protected]>
92429243
M: "Michael S. Tsirkin" <[email protected]>
9244+
92439245
92449246
S: Maintained
92459247
F: drivers/virtio/
@@ -9252,6 +9254,7 @@ F: include/uapi/linux/virtio_*.h
92529254
VIRTIO HOST (VHOST)
92539255
M: "Michael S. Tsirkin" <[email protected]>
92549256
9257+
92559258
92569259
92579260
S: Maintained

arch/arm/net/bpf_jit_32.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -641,10 +641,10 @@ static int build_body(struct jit_ctx *ctx)
641641
emit(ARM_MUL(r_A, r_A, r_X), ctx);
642642
break;
643643
case BPF_S_ALU_DIV_K:
644-
/* current k == reciprocal_value(userspace k) */
644+
if (k == 1)
645+
break;
645646
emit_mov_i(r_scratch, k, ctx);
646-
/* A = top 32 bits of the product */
647-
emit(ARM_UMULL(r_scratch, r_A, r_A, r_scratch), ctx);
647+
emit_udiv(r_A, r_A, r_scratch, ctx);
648648
break;
649649
case BPF_S_ALU_DIV_X:
650650
update_on_xread(ctx);

arch/parisc/include/uapi/asm/socket.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,6 @@
7575

7676
#define SO_BUSY_POLL 0x4027
7777

78-
#define SO_MAX_PACING_RATE 0x4048
78+
#define SO_MAX_PACING_RATE 0x4028
7979

8080
#endif /* _UAPI_ASM_SOCKET_H */

arch/powerpc/net/bpf_jit_comp.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -223,10 +223,11 @@ static int bpf_jit_build_body(struct sk_filter *fp, u32 *image,
223223
}
224224
PPC_DIVWU(r_A, r_A, r_X);
225225
break;
226-
case BPF_S_ALU_DIV_K: /* A = reciprocal_divide(A, K); */
226+
case BPF_S_ALU_DIV_K: /* A /= K */
227+
if (K == 1)
228+
break;
227229
PPC_LI32(r_scratch1, K);
228-
/* Top 32 bits of 64bit result -> A */
229-
PPC_MULHWU(r_A, r_A, r_scratch1);
230+
PPC_DIVWU(r_A, r_A, r_scratch1);
230231
break;
231232
case BPF_S_ALU_AND_X:
232233
ctx->seen |= SEEN_XREG;

arch/s390/net/bpf_jit_comp.c

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -368,14 +368,16 @@ static int bpf_jit_insn(struct bpf_jit *jit, struct sock_filter *filter,
368368
EMIT4_PCREL(0xa7840000, (jit->ret0_ip - jit->prg));
369369
/* lhi %r4,0 */
370370
EMIT4(0xa7480000);
371-
/* dr %r4,%r12 */
372-
EMIT2(0x1d4c);
371+
/* dlr %r4,%r12 */
372+
EMIT4(0xb997004c);
373373
break;
374-
case BPF_S_ALU_DIV_K: /* A = reciprocal_divide(A, K) */
375-
/* m %r4,<d(K)>(%r13) */
376-
EMIT4_DISP(0x5c40d000, EMIT_CONST(K));
377-
/* lr %r5,%r4 */
378-
EMIT2(0x1854);
374+
case BPF_S_ALU_DIV_K: /* A /= K */
375+
if (K == 1)
376+
break;
377+
/* lhi %r4,0 */
378+
EMIT4(0xa7480000);
379+
/* dl %r4,<d(K)>(%r13) */
380+
EMIT6_DISP(0xe340d000, 0x0097, EMIT_CONST(K));
379381
break;
380382
case BPF_S_ALU_MOD_X: /* A %= X */
381383
jit->seen |= SEEN_XREG | SEEN_RET0;
@@ -385,16 +387,21 @@ static int bpf_jit_insn(struct bpf_jit *jit, struct sock_filter *filter,
385387
EMIT4_PCREL(0xa7840000, (jit->ret0_ip - jit->prg));
386388
/* lhi %r4,0 */
387389
EMIT4(0xa7480000);
388-
/* dr %r4,%r12 */
389-
EMIT2(0x1d4c);
390+
/* dlr %r4,%r12 */
391+
EMIT4(0xb997004c);
390392
/* lr %r5,%r4 */
391393
EMIT2(0x1854);
392394
break;
393395
case BPF_S_ALU_MOD_K: /* A %= K */
396+
if (K == 1) {
397+
/* lhi %r5,0 */
398+
EMIT4(0xa7580000);
399+
break;
400+
}
394401
/* lhi %r4,0 */
395402
EMIT4(0xa7480000);
396-
/* d %r4,<d(K)>(%r13) */
397-
EMIT4_DISP(0x5d40d000, EMIT_CONST(K));
403+
/* dl %r4,<d(K)>(%r13) */
404+
EMIT6_DISP(0xe340d000, 0x0097, EMIT_CONST(K));
398405
/* lr %r5,%r4 */
399406
EMIT2(0x1854);
400407
break;

arch/sparc/net/bpf_jit_comp.c

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -497,9 +497,20 @@ void bpf_jit_compile(struct sk_filter *fp)
497497
case BPF_S_ALU_MUL_K: /* A *= K */
498498
emit_alu_K(MUL, K);
499499
break;
500-
case BPF_S_ALU_DIV_K: /* A /= K */
501-
emit_alu_K(MUL, K);
502-
emit_read_y(r_A);
500+
case BPF_S_ALU_DIV_K: /* A /= K with K != 0*/
501+
if (K == 1)
502+
break;
503+
emit_write_y(G0);
504+
#ifdef CONFIG_SPARC32
505+
/* The Sparc v8 architecture requires
506+
* three instructions between a %y
507+
* register write and the first use.
508+
*/
509+
emit_nop();
510+
emit_nop();
511+
emit_nop();
512+
#endif
513+
emit_alu_K(DIV, K);
503514
break;
504515
case BPF_S_ALU_DIV_X: /* A /= X; */
505516
emit_cmpi(r_X, 0);

arch/x86/net/bpf_jit_comp.c

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -359,15 +359,21 @@ void bpf_jit_compile(struct sk_filter *fp)
359359
EMIT2(0x89, 0xd0); /* mov %edx,%eax */
360360
break;
361361
case BPF_S_ALU_MOD_K: /* A %= K; */
362+
if (K == 1) {
363+
CLEAR_A();
364+
break;
365+
}
362366
EMIT2(0x31, 0xd2); /* xor %edx,%edx */
363367
EMIT1(0xb9);EMIT(K, 4); /* mov imm32,%ecx */
364368
EMIT2(0xf7, 0xf1); /* div %ecx */
365369
EMIT2(0x89, 0xd0); /* mov %edx,%eax */
366370
break;
367-
case BPF_S_ALU_DIV_K: /* A = reciprocal_divide(A, K); */
368-
EMIT3(0x48, 0x69, 0xc0); /* imul imm32,%rax,%rax */
369-
EMIT(K, 4);
370-
EMIT4(0x48, 0xc1, 0xe8, 0x20); /* shr $0x20,%rax */
371+
case BPF_S_ALU_DIV_K: /* A /= K */
372+
if (K == 1)
373+
break;
374+
EMIT2(0x31, 0xd2); /* xor %edx,%edx */
375+
EMIT1(0xb9);EMIT(K, 4); /* mov imm32,%ecx */
376+
EMIT2(0xf7, 0xf1); /* div %ecx */
371377
break;
372378
case BPF_S_ALU_AND_X:
373379
seen |= SEEN_XREG;

drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -12942,25 +12942,26 @@ static void __bnx2x_remove(struct pci_dev *pdev,
1294212942
pci_set_power_state(pdev, PCI_D3hot);
1294312943
}
1294412944

12945-
if (bp->regview)
12946-
iounmap(bp->regview);
12945+
if (remove_netdev) {
12946+
if (bp->regview)
12947+
iounmap(bp->regview);
1294712948

12948-
/* for vf doorbells are part of the regview and were unmapped along with
12949-
* it. FW is only loaded by PF.
12950-
*/
12951-
if (IS_PF(bp)) {
12952-
if (bp->doorbells)
12953-
iounmap(bp->doorbells);
12949+
/* For vfs, doorbells are part of the regview and were unmapped
12950+
* along with it. FW is only loaded by PF.
12951+
*/
12952+
if (IS_PF(bp)) {
12953+
if (bp->doorbells)
12954+
iounmap(bp->doorbells);
1295412955

12955-
bnx2x_release_firmware(bp);
12956-
}
12957-
bnx2x_free_mem_bp(bp);
12956+
bnx2x_release_firmware(bp);
12957+
}
12958+
bnx2x_free_mem_bp(bp);
1295812959

12959-
if (remove_netdev)
1296012960
free_netdev(dev);
1296112961

12962-
if (atomic_read(&pdev->enable_cnt) == 1)
12963-
pci_release_regions(pdev);
12962+
if (atomic_read(&pdev->enable_cnt) == 1)
12963+
pci_release_regions(pdev);
12964+
}
1296412965

1296512966
pci_disable_device(pdev);
1296612967
}

drivers/net/ethernet/chelsio/cxgb4/l2t.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -423,7 +423,7 @@ u64 cxgb4_select_ntuple(struct net_device *dev,
423423
* in the Compressed Filter Tuple.
424424
*/
425425
if (tp->vlan_shift >= 0 && l2t->vlan != VLAN_NONE)
426-
ntuple |= (F_FT_VLAN_VLD | l2t->vlan) << tp->vlan_shift;
426+
ntuple |= (u64)(F_FT_VLAN_VLD | l2t->vlan) << tp->vlan_shift;
427427

428428
if (tp->port_shift >= 0)
429429
ntuple |= (u64)l2t->lport << tp->port_shift;

drivers/net/ethernet/emulex/benet/be_main.c

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1776,6 +1776,7 @@ static void be_post_rx_frags(struct be_rx_obj *rxo, gfp_t gfp)
17761776
struct be_rx_page_info *page_info = NULL, *prev_page_info = NULL;
17771777
struct be_queue_info *rxq = &rxo->q;
17781778
struct page *pagep = NULL;
1779+
struct device *dev = &adapter->pdev->dev;
17791780
struct be_eth_rx_d *rxd;
17801781
u64 page_dmaaddr = 0, frag_dmaaddr;
17811782
u32 posted, page_offset = 0;
@@ -1788,9 +1789,15 @@ static void be_post_rx_frags(struct be_rx_obj *rxo, gfp_t gfp)
17881789
rx_stats(rxo)->rx_post_fail++;
17891790
break;
17901791
}
1791-
page_dmaaddr = dma_map_page(&adapter->pdev->dev, pagep,
1792-
0, adapter->big_page_size,
1792+
page_dmaaddr = dma_map_page(dev, pagep, 0,
1793+
adapter->big_page_size,
17931794
DMA_FROM_DEVICE);
1795+
if (dma_mapping_error(dev, page_dmaaddr)) {
1796+
put_page(pagep);
1797+
pagep = NULL;
1798+
rx_stats(rxo)->rx_post_fail++;
1799+
break;
1800+
}
17941801
page_info->page_offset = 0;
17951802
} else {
17961803
get_page(pagep);

drivers/net/ethernet/intel/e1000e/netdev.c

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6174,7 +6174,7 @@ static int __e1000_resume(struct pci_dev *pdev)
61746174
return 0;
61756175
}
61766176

6177-
#ifdef CONFIG_PM
6177+
#ifdef CONFIG_PM_SLEEP
61786178
static int e1000_suspend(struct device *dev)
61796179
{
61806180
struct pci_dev *pdev = to_pci_dev(dev);
@@ -6193,7 +6193,7 @@ static int e1000_resume(struct device *dev)
61936193

61946194
return __e1000_resume(pdev);
61956195
}
6196-
#endif /* CONFIG_PM */
6196+
#endif /* CONFIG_PM_SLEEP */
61976197

61986198
#ifdef CONFIG_PM_RUNTIME
61996199
static int e1000_runtime_suspend(struct device *dev)
@@ -7015,25 +7015,21 @@ static DEFINE_PCI_DEVICE_TABLE(e1000_pci_tbl) = {
70157015
};
70167016
MODULE_DEVICE_TABLE(pci, e1000_pci_tbl);
70177017

7018-
#ifdef CONFIG_PM
70197018
static const struct dev_pm_ops e1000_pm_ops = {
70207019
SET_SYSTEM_SLEEP_PM_OPS(e1000_suspend, e1000_resume)
70217020
SET_RUNTIME_PM_OPS(e1000_runtime_suspend, e1000_runtime_resume,
70227021
e1000_idle)
70237022
};
7024-
#endif
70257023

70267024
/* PCI Device API Driver */
70277025
static struct pci_driver e1000_driver = {
70287026
.name = e1000e_driver_name,
70297027
.id_table = e1000_pci_tbl,
70307028
.probe = e1000_probe,
70317029
.remove = e1000_remove,
7032-
#ifdef CONFIG_PM
70337030
.driver = {
70347031
.pm = &e1000_pm_ops,
70357032
},
7036-
#endif
70377033
.shutdown = e1000_shutdown,
70387034
.err_handler = &e1000_err_handler
70397035
};

drivers/net/ethernet/qlogic/qlge/qlge_main.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4765,6 +4765,8 @@ static int qlge_probe(struct pci_dev *pdev,
47654765
NETIF_F_RXCSUM;
47664766
ndev->features = ndev->hw_features;
47674767
ndev->vlan_features = ndev->hw_features;
4768+
/* vlan gets same features (except vlan filter) */
4769+
ndev->vlan_features &= ~NETIF_F_HW_VLAN_CTAG_FILTER;
47684770

47694771
if (test_bit(QL_DMA64, &qdev->flags))
47704772
ndev->features |= NETIF_F_HIGHDMA;

drivers/net/ethernet/via/via-rhine.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1618,6 +1618,7 @@ static void rhine_reset_task(struct work_struct *work)
16181618
goto out_unlock;
16191619

16201620
napi_disable(&rp->napi);
1621+
netif_tx_disable(dev);
16211622
spin_lock_bh(&rp->lock);
16221623

16231624
/* clear all descriptors */

drivers/net/usb/dm9601.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -614,6 +614,18 @@ static const struct usb_device_id products[] = {
614614
USB_DEVICE(0x0a46, 0x9621), /* DM9621A USB to Fast Ethernet Adapter */
615615
.driver_info = (unsigned long)&dm9601_info,
616616
},
617+
{
618+
USB_DEVICE(0x0a46, 0x9622), /* DM9622 USB to Fast Ethernet Adapter */
619+
.driver_info = (unsigned long)&dm9601_info,
620+
},
621+
{
622+
USB_DEVICE(0x0a46, 0x0269), /* DM962OA USB to Fast Ethernet Adapter */
623+
.driver_info = (unsigned long)&dm9601_info,
624+
},
625+
{
626+
USB_DEVICE(0x0a46, 0x1269), /* DM9621A USB to Fast Ethernet Adapter */
627+
.driver_info = (unsigned long)&dm9601_info,
628+
},
617629
{}, // END
618630
};
619631

drivers/net/usb/usbnet.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1245,7 +1245,7 @@ static int build_dma_sg(const struct sk_buff *skb, struct urb *urb)
12451245
return -ENOMEM;
12461246

12471247
urb->num_sgs = num_sgs;
1248-
sg_init_table(urb->sg, urb->num_sgs);
1248+
sg_init_table(urb->sg, urb->num_sgs + 1);
12491249

12501250
sg_set_buf(&urb->sg[s++], skb->data, skb_headlen(skb));
12511251
total_len += skb_headlen(skb);

include/net/if_inet6.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,6 @@ struct inet6_dev {
165165
struct net_device *dev;
166166

167167
struct list_head addr_list;
168-
int valid_ll_addr_cnt;
169168

170169
struct ifmcaddr6 *mc_list;
171170
struct ifmcaddr6 *mc_tomb;

net/batman-adv/main.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -277,7 +277,7 @@ int batadv_max_header_len(void)
277277
sizeof(struct batadv_coded_packet));
278278
#endif
279279

280-
return header_len;
280+
return header_len + ETH_HLEN;
281281
}
282282

283283
/**

0 commit comments

Comments
 (0)