Skip to content

Commit 40e196a

Browse files
committed
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
Pull networking fixes from David Miller: 1) Fix suspend and resume in mt76x0u USB driver, from Stanislaw Gruszka. 2) Missing memory barriers in xsk, from Magnus Karlsson. 3) rhashtable fixes in mac80211 from Herbert Xu. 4) 32-bit MIPS eBPF JIT fixes from Paul Burton. 5) Fix for_each_netdev_feature() on big endian, from Hauke Mehrtens. 6) GSO validation fixes from Willem de Bruijn. 7) Endianness fix for dwmac4 timestamp handling, from Alexandre Torgue. 8) More strict checks in tcp_v4_err(), from Eric Dumazet. 9) af_alg_release should NULL out the sk after the sock_put(), from Mao Wenan. 10) Missing unlock in mac80211 mesh error path, from Wei Yongjun. 11) Missing device put in hns driver, from Salil Mehta. * git://git.kernel.org/pub/scm/linux/kernel/git/davem/net: (44 commits) sky2: Increase D3 delay again vhost: correctly check the return value of translate_desc() in log_used() net: netcp: Fix ethss driver probe issue net: hns: Fixes the missing put_device in positive leg for roce reset net: stmmac: Fix a race in EEE enable callback qed: Fix iWARP syn packet mac address validation. qed: Fix iWARP buffer size provided for syn packet processing. r8152: Add support for MAC address pass through on RTL8153-BD mac80211: mesh: fix missing unlock on error in table_path_del() net/mlx4_en: fix spelling mistake: "quiting" -> "quitting" net: crypto set sk to NULL when af_alg_release. net: Do not allocate page fragments that are not skb aligned mm: Use fixed constant in page_frag_alloc instead of size + 1 tcp: tcp_v4_err() should be more careful tcp: clear icsk_backoff in tcp_write_queue_purge() net: mv643xx_eth: disable clk on error path in mv643xx_eth_shared_probe() qmi_wwan: apply SET_DTR quirk to Sierra WP7607 net: stmmac: handle endianness in dwmac4_get_timestamp doc: Mention MSG_ZEROCOPY implementation for UDP mlxsw: __mlxsw_sp_port_headroom_set(): Fix a use of local variable ...
2 parents b5372fe + 1765f5d commit 40e196a

File tree

41 files changed

+355
-244
lines changed

Some content is hidden

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

41 files changed

+355
-244
lines changed

Documentation/networking/msg_zerocopy.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ Intro
77
=====
88

99
The MSG_ZEROCOPY flag enables copy avoidance for socket send calls.
10-
The feature is currently implemented for TCP sockets.
10+
The feature is currently implemented for TCP and UDP sockets.
1111

1212

1313
Opportunity and Caveats

arch/mips/net/ebpf_jit.c

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -79,8 +79,6 @@ enum reg_val_type {
7979
REG_64BIT_32BIT,
8080
/* 32-bit compatible, need truncation for 64-bit ops. */
8181
REG_32BIT,
82-
/* 32-bit zero extended. */
83-
REG_32BIT_ZERO_EX,
8482
/* 32-bit no sign/zero extension needed. */
8583
REG_32BIT_POS
8684
};
@@ -343,12 +341,15 @@ static int build_int_epilogue(struct jit_ctx *ctx, int dest_reg)
343341
const struct bpf_prog *prog = ctx->skf;
344342
int stack_adjust = ctx->stack_size;
345343
int store_offset = stack_adjust - 8;
344+
enum reg_val_type td;
346345
int r0 = MIPS_R_V0;
347346

348-
if (dest_reg == MIPS_R_RA &&
349-
get_reg_val_type(ctx, prog->len, BPF_REG_0) == REG_32BIT_ZERO_EX)
347+
if (dest_reg == MIPS_R_RA) {
350348
/* Don't let zero extended value escape. */
351-
emit_instr(ctx, sll, r0, r0, 0);
349+
td = get_reg_val_type(ctx, prog->len, BPF_REG_0);
350+
if (td == REG_64BIT)
351+
emit_instr(ctx, sll, r0, r0, 0);
352+
}
352353

353354
if (ctx->flags & EBPF_SAVE_RA) {
354355
emit_instr(ctx, ld, MIPS_R_RA, store_offset, MIPS_R_SP);
@@ -692,7 +693,7 @@ static int build_one_insn(const struct bpf_insn *insn, struct jit_ctx *ctx,
692693
if (dst < 0)
693694
return dst;
694695
td = get_reg_val_type(ctx, this_idx, insn->dst_reg);
695-
if (td == REG_64BIT || td == REG_32BIT_ZERO_EX) {
696+
if (td == REG_64BIT) {
696697
/* sign extend */
697698
emit_instr(ctx, sll, dst, dst, 0);
698699
}
@@ -707,7 +708,7 @@ static int build_one_insn(const struct bpf_insn *insn, struct jit_ctx *ctx,
707708
if (dst < 0)
708709
return dst;
709710
td = get_reg_val_type(ctx, this_idx, insn->dst_reg);
710-
if (td == REG_64BIT || td == REG_32BIT_ZERO_EX) {
711+
if (td == REG_64BIT) {
711712
/* sign extend */
712713
emit_instr(ctx, sll, dst, dst, 0);
713714
}
@@ -721,7 +722,7 @@ static int build_one_insn(const struct bpf_insn *insn, struct jit_ctx *ctx,
721722
if (dst < 0)
722723
return dst;
723724
td = get_reg_val_type(ctx, this_idx, insn->dst_reg);
724-
if (td == REG_64BIT || td == REG_32BIT_ZERO_EX)
725+
if (td == REG_64BIT)
725726
/* sign extend */
726727
emit_instr(ctx, sll, dst, dst, 0);
727728
if (insn->imm == 1) {
@@ -860,13 +861,13 @@ static int build_one_insn(const struct bpf_insn *insn, struct jit_ctx *ctx,
860861
if (src < 0 || dst < 0)
861862
return -EINVAL;
862863
td = get_reg_val_type(ctx, this_idx, insn->dst_reg);
863-
if (td == REG_64BIT || td == REG_32BIT_ZERO_EX) {
864+
if (td == REG_64BIT) {
864865
/* sign extend */
865866
emit_instr(ctx, sll, dst, dst, 0);
866867
}
867868
did_move = false;
868869
ts = get_reg_val_type(ctx, this_idx, insn->src_reg);
869-
if (ts == REG_64BIT || ts == REG_32BIT_ZERO_EX) {
870+
if (ts == REG_64BIT) {
870871
int tmp_reg = MIPS_R_AT;
871872

872873
if (bpf_op == BPF_MOV) {
@@ -1254,8 +1255,7 @@ static int build_one_insn(const struct bpf_insn *insn, struct jit_ctx *ctx,
12541255
if (insn->imm == 64 && td == REG_32BIT)
12551256
emit_instr(ctx, dinsu, dst, MIPS_R_ZERO, 32, 32);
12561257

1257-
if (insn->imm != 64 &&
1258-
(td == REG_64BIT || td == REG_32BIT_ZERO_EX)) {
1258+
if (insn->imm != 64 && td == REG_64BIT) {
12591259
/* sign extend */
12601260
emit_instr(ctx, sll, dst, dst, 0);
12611261
}

crypto/af_alg.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,8 +122,10 @@ static void alg_do_release(const struct af_alg_type *type, void *private)
122122

123123
int af_alg_release(struct socket *sock)
124124
{
125-
if (sock->sk)
125+
if (sock->sk) {
126126
sock_put(sock->sk);
127+
sock->sk = NULL;
128+
}
127129
return 0;
128130
}
129131
EXPORT_SYMBOL_GPL(af_alg_release);

drivers/net/dsa/b53/b53_common.c

Lines changed: 71 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -344,7 +344,8 @@ static void b53_set_forwarding(struct b53_device *dev, int enable)
344344
b53_write8(dev, B53_CTRL_PAGE, B53_SWITCH_CTRL, mgmt);
345345
}
346346

347-
static void b53_enable_vlan(struct b53_device *dev, bool enable)
347+
static void b53_enable_vlan(struct b53_device *dev, bool enable,
348+
bool enable_filtering)
348349
{
349350
u8 mgmt, vc0, vc1, vc4 = 0, vc5;
350351

@@ -369,8 +370,13 @@ static void b53_enable_vlan(struct b53_device *dev, bool enable)
369370
vc0 |= VC0_VLAN_EN | VC0_VID_CHK_EN | VC0_VID_HASH_VID;
370371
vc1 |= VC1_RX_MCST_UNTAG_EN | VC1_RX_MCST_FWD_EN;
371372
vc4 &= ~VC4_ING_VID_CHECK_MASK;
372-
vc4 |= VC4_ING_VID_VIO_DROP << VC4_ING_VID_CHECK_S;
373-
vc5 |= VC5_DROP_VTABLE_MISS;
373+
if (enable_filtering) {
374+
vc4 |= VC4_ING_VID_VIO_DROP << VC4_ING_VID_CHECK_S;
375+
vc5 |= VC5_DROP_VTABLE_MISS;
376+
} else {
377+
vc4 |= VC4_ING_VID_VIO_FWD << VC4_ING_VID_CHECK_S;
378+
vc5 &= ~VC5_DROP_VTABLE_MISS;
379+
}
374380

375381
if (is5325(dev))
376382
vc0 &= ~VC0_RESERVED_1;
@@ -420,6 +426,9 @@ static void b53_enable_vlan(struct b53_device *dev, bool enable)
420426
}
421427

422428
b53_write8(dev, B53_CTRL_PAGE, B53_SWITCH_MODE, mgmt);
429+
430+
dev->vlan_enabled = enable;
431+
dev->vlan_filtering_enabled = enable_filtering;
423432
}
424433

425434
static int b53_set_jumbo(struct b53_device *dev, bool enable, bool allow_10_100)
@@ -632,25 +641,35 @@ static void b53_enable_mib(struct b53_device *dev)
632641
b53_write8(dev, B53_MGMT_PAGE, B53_GLOBAL_CONFIG, gc);
633642
}
634643

644+
static u16 b53_default_pvid(struct b53_device *dev)
645+
{
646+
if (is5325(dev) || is5365(dev))
647+
return 1;
648+
else
649+
return 0;
650+
}
651+
635652
int b53_configure_vlan(struct dsa_switch *ds)
636653
{
637654
struct b53_device *dev = ds->priv;
638655
struct b53_vlan vl = { 0 };
639-
int i;
656+
int i, def_vid;
657+
658+
def_vid = b53_default_pvid(dev);
640659

641660
/* clear all vlan entries */
642661
if (is5325(dev) || is5365(dev)) {
643-
for (i = 1; i < dev->num_vlans; i++)
662+
for (i = def_vid; i < dev->num_vlans; i++)
644663
b53_set_vlan_entry(dev, i, &vl);
645664
} else {
646665
b53_do_vlan_op(dev, VTA_CMD_CLEAR);
647666
}
648667

649-
b53_enable_vlan(dev, false);
668+
b53_enable_vlan(dev, false, dev->vlan_filtering_enabled);
650669

651670
b53_for_each_port(dev, i)
652671
b53_write16(dev, B53_VLAN_PAGE,
653-
B53_VLAN_PORT_DEF_TAG(i), 1);
672+
B53_VLAN_PORT_DEF_TAG(i), def_vid);
654673

655674
if (!is5325(dev) && !is5365(dev))
656675
b53_set_jumbo(dev, dev->enable_jumbo, false);
@@ -1255,6 +1274,46 @@ EXPORT_SYMBOL(b53_phylink_mac_link_up);
12551274

12561275
int b53_vlan_filtering(struct dsa_switch *ds, int port, bool vlan_filtering)
12571276
{
1277+
struct b53_device *dev = ds->priv;
1278+
struct net_device *bridge_dev;
1279+
unsigned int i;
1280+
u16 pvid, new_pvid;
1281+
1282+
/* Handle the case were multiple bridges span the same switch device
1283+
* and one of them has a different setting than what is being requested
1284+
* which would be breaking filtering semantics for any of the other
1285+
* bridge devices.
1286+
*/
1287+
b53_for_each_port(dev, i) {
1288+
bridge_dev = dsa_to_port(ds, i)->bridge_dev;
1289+
if (bridge_dev &&
1290+
bridge_dev != dsa_to_port(ds, port)->bridge_dev &&
1291+
br_vlan_enabled(bridge_dev) != vlan_filtering) {
1292+
netdev_err(bridge_dev,
1293+
"VLAN filtering is global to the switch!\n");
1294+
return -EINVAL;
1295+
}
1296+
}
1297+
1298+
b53_read16(dev, B53_VLAN_PAGE, B53_VLAN_PORT_DEF_TAG(port), &pvid);
1299+
new_pvid = pvid;
1300+
if (dev->vlan_filtering_enabled && !vlan_filtering) {
1301+
/* Filtering is currently enabled, use the default PVID since
1302+
* the bridge does not expect tagging anymore
1303+
*/
1304+
dev->ports[port].pvid = pvid;
1305+
new_pvid = b53_default_pvid(dev);
1306+
} else if (!dev->vlan_filtering_enabled && vlan_filtering) {
1307+
/* Filtering is currently disabled, restore the previous PVID */
1308+
new_pvid = dev->ports[port].pvid;
1309+
}
1310+
1311+
if (pvid != new_pvid)
1312+
b53_write16(dev, B53_VLAN_PAGE, B53_VLAN_PORT_DEF_TAG(port),
1313+
new_pvid);
1314+
1315+
b53_enable_vlan(dev, dev->vlan_enabled, vlan_filtering);
1316+
12581317
return 0;
12591318
}
12601319
EXPORT_SYMBOL(b53_vlan_filtering);
@@ -1270,7 +1329,7 @@ int b53_vlan_prepare(struct dsa_switch *ds, int port,
12701329
if (vlan->vid_end > dev->num_vlans)
12711330
return -ERANGE;
12721331

1273-
b53_enable_vlan(dev, true);
1332+
b53_enable_vlan(dev, true, dev->vlan_filtering_enabled);
12741333

12751334
return 0;
12761335
}
@@ -1300,7 +1359,7 @@ void b53_vlan_add(struct dsa_switch *ds, int port,
13001359
b53_fast_age_vlan(dev, vid);
13011360
}
13021361

1303-
if (pvid) {
1362+
if (pvid && !dsa_is_cpu_port(ds, port)) {
13041363
b53_write16(dev, B53_VLAN_PAGE, B53_VLAN_PORT_DEF_TAG(port),
13051364
vlan->vid_end);
13061365
b53_fast_age_vlan(dev, vid);
@@ -1326,12 +1385,8 @@ int b53_vlan_del(struct dsa_switch *ds, int port,
13261385

13271386
vl->members &= ~BIT(port);
13281387

1329-
if (pvid == vid) {
1330-
if (is5325(dev) || is5365(dev))
1331-
pvid = 1;
1332-
else
1333-
pvid = 0;
1334-
}
1388+
if (pvid == vid)
1389+
pvid = b53_default_pvid(dev);
13351390

13361391
if (untagged && !dsa_is_cpu_port(ds, port))
13371392
vl->untag &= ~(BIT(port));
@@ -1644,10 +1699,7 @@ void b53_br_leave(struct dsa_switch *ds, int port, struct net_device *br)
16441699
b53_write16(dev, B53_PVLAN_PAGE, B53_PVLAN_PORT_MASK(port), pvlan);
16451700
dev->ports[port].vlan_ctl_mask = pvlan;
16461701

1647-
if (is5325(dev) || is5365(dev))
1648-
pvid = 1;
1649-
else
1650-
pvid = 0;
1702+
pvid = b53_default_pvid(dev);
16511703

16521704
/* Make this port join all VLANs without VLAN entries */
16531705
if (is58xx(dev)) {

drivers/net/dsa/b53/b53_priv.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@ enum {
9191
struct b53_port {
9292
u16 vlan_ctl_mask;
9393
struct ethtool_eee eee;
94+
u16 pvid;
9495
};
9596

9697
struct b53_vlan {
@@ -137,6 +138,8 @@ struct b53_device {
137138

138139
unsigned int num_vlans;
139140
struct b53_vlan *vlans;
141+
bool vlan_enabled;
142+
bool vlan_filtering_enabled;
140143
unsigned int num_ports;
141144
struct b53_port *ports;
142145
};

drivers/net/dsa/bcm_sf2.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -726,10 +726,11 @@ static void bcm_sf2_sw_get_wol(struct dsa_switch *ds, int port,
726726
{
727727
struct net_device *p = ds->ports[port].cpu_dp->master;
728728
struct bcm_sf2_priv *priv = bcm_sf2_to_priv(ds);
729-
struct ethtool_wolinfo pwol;
729+
struct ethtool_wolinfo pwol = { };
730730

731731
/* Get the parent device WoL settings */
732-
p->ethtool_ops->get_wol(p, &pwol);
732+
if (p->ethtool_ops->get_wol)
733+
p->ethtool_ops->get_wol(p, &pwol);
733734

734735
/* Advertise the parent device supported settings */
735736
wol->supported = pwol.supported;
@@ -750,9 +751,10 @@ static int bcm_sf2_sw_set_wol(struct dsa_switch *ds, int port,
750751
struct net_device *p = ds->ports[port].cpu_dp->master;
751752
struct bcm_sf2_priv *priv = bcm_sf2_to_priv(ds);
752753
s8 cpu_port = ds->ports[port].cpu_dp->index;
753-
struct ethtool_wolinfo pwol;
754+
struct ethtool_wolinfo pwol = { };
754755

755-
p->ethtool_ops->get_wol(p, &pwol);
756+
if (p->ethtool_ops->get_wol)
757+
p->ethtool_ops->get_wol(p, &pwol);
756758
if (wol->wolopts & ~pwol.supported)
757759
return -EINVAL;
758760

drivers/net/ethernet/broadcom/bcmsysport.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,10 @@ static void bcm_sysport_set_rx_csum(struct net_device *dev,
134134

135135
priv->rx_chk_en = !!(wanted & NETIF_F_RXCSUM);
136136
reg = rxchk_readl(priv, RXCHK_CONTROL);
137+
/* Clear L2 header checks, which would prevent BPDUs
138+
* from being received.
139+
*/
140+
reg &= ~RXCHK_L2_HDR_DIS;
137141
if (priv->rx_chk_en)
138142
reg |= RXCHK_EN;
139143
else

drivers/net/ethernet/hisilicon/hns/hns_dsaf_main.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3128,6 +3128,9 @@ int hns_dsaf_roce_reset(struct fwnode_handle *dsaf_fwnode, bool dereset)
31283128
dsaf_set_bit(credit, DSAF_SBM_ROCEE_CFG_CRD_EN_B, 1);
31293129
dsaf_write_dev(dsaf_dev, DSAF_SBM_ROCEE_CFG_REG_REG, credit);
31303130
}
3131+
3132+
put_device(&pdev->dev);
3133+
31313134
return 0;
31323135
}
31333136
EXPORT_SYMBOL(hns_dsaf_roce_reset);

drivers/net/ethernet/marvell/mv643xx_eth.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2879,14 +2879,19 @@ static int mv643xx_eth_shared_probe(struct platform_device *pdev)
28792879

28802880
ret = mv643xx_eth_shared_of_probe(pdev);
28812881
if (ret)
2882-
return ret;
2882+
goto err_put_clk;
28832883
pd = dev_get_platdata(&pdev->dev);
28842884

28852885
msp->tx_csum_limit = (pd != NULL && pd->tx_csum_limit) ?
28862886
pd->tx_csum_limit : 9 * 1024;
28872887
infer_hw_params(msp);
28882888

28892889
return 0;
2890+
2891+
err_put_clk:
2892+
if (!IS_ERR(msp->clk))
2893+
clk_disable_unprepare(msp->clk);
2894+
return ret;
28902895
}
28912896

28922897
static int mv643xx_eth_shared_remove(struct platform_device *pdev)

drivers/net/ethernet/marvell/sky2.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5073,7 +5073,7 @@ static int sky2_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
50735073
INIT_WORK(&hw->restart_work, sky2_restart);
50745074

50755075
pci_set_drvdata(pdev, hw);
5076-
pdev->d3_delay = 200;
5076+
pdev->d3_delay = 300;
50775077

50785078
return 0;
50795079

drivers/net/ethernet/mellanox/mlx4/en_netdev.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3360,7 +3360,7 @@ int mlx4_en_init_netdev(struct mlx4_en_dev *mdev, int port,
33603360
dev->addr_len = ETH_ALEN;
33613361
mlx4_en_u64_to_mac(dev->dev_addr, mdev->dev->caps.def_mac[priv->port]);
33623362
if (!is_valid_ether_addr(dev->dev_addr)) {
3363-
en_err(priv, "Port: %d, invalid mac burned: %pM, quiting\n",
3363+
en_err(priv, "Port: %d, invalid mac burned: %pM, quitting\n",
33643364
priv->port, dev->dev_addr);
33653365
err = -EINVAL;
33663366
goto out;

0 commit comments

Comments
 (0)