Skip to content

Commit 7391daf

Browse files
committed
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
Pull networking fixes from David Miller: "Some straggler bug fixes: 1) Batman-adv DAT must consider VLAN IDs when choosing candidate nodes, from Antonio Quartulli. 2) Fix botched reference counting of vlan objects and neigh nodes in batman-adv, from Sven Eckelmann. 3) netem can crash when it sees GSO packets, the fix is to segment then upon ->enqueue. Fix from Neil Horman with help from Eric Dumazet. 4) Fix VXLAN dependencies in mlx5 driver Kconfig, from Matthew Finlay. 5) Handle VXLAN ops outside of rcu lock, via a workqueue, in mlx5, since it can sleep. Fix also from Matthew Finlay. 6) Check mdiobus_scan() return values properly in pxa168_eth and macb drivers. From Sergei Shtylyov. 7) If the netdevice doesn't support checksumming, disable segmentation. From Alexandery Duyck. 8) Fix races between RDS tcp accept and sending, from Sowmini Varadhan. 9) In macb driver, probe MDIO bus before we register the netdev, otherwise we can try to open the device before it is really ready for that. Fix from Florian Fainelli. 10) Netlink attribute size for ILA "tunnels" not calculated properly, fix from Nicolas Dichtel" * git://git.kernel.org/pub/scm/linux/kernel/git/davem/net: ipv6/ila: fix nlsize calculation for lwtunnel net: macb: Probe MDIO bus before registering netdev RDS: TCP: Synchronize accept() and connect() paths on t_conn_lock. RDS:TCP: Synchronize rds_tcp_accept_one with rds_send_xmit when resetting t_sock vxlan: Add checksum check to the features check function net: Disable segmentation if checksumming is not supported net: mvneta: Remove superfluous SMP function call macb: fix mdiobus_scan() error check pxa168_eth: fix mdiobus_scan() error check net/mlx5e: Use workqueue for vxlan ops net/mlx5e: Implement a mlx5e workqueue net/mlx5: Kconfig: Fix MLX5_EN/VXLAN build issue net/mlx5: Unmap only the relevant IO memory mapping netem: Segment GSO packets on enqueue batman-adv: Fix reference counting of hardif_neigh_node object for neigh_node batman-adv: Fix reference counting of vlan object for tt_local_entry batman-adv: B.A.T.M.A.N V - make sure iface is reactivated upon NETDEV_UP event batman-adv: fix DAT candidate selection (must use vid)
2 parents 610603a + 79e8dc8 commit 7391daf

24 files changed

Lines changed: 259 additions & 127 deletions

File tree

‎drivers/net/ethernet/cadence/macb.c‎

Lines changed: 21 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -441,7 +441,7 @@ static int macb_mii_init(struct macb *bp)
441441
snprintf(bp->mii_bus->id, MII_BUS_ID_SIZE, "%s-%x",
442442
bp->pdev->name, bp->pdev->id);
443443
bp->mii_bus->priv = bp;
444-
bp->mii_bus->parent = &bp->dev->dev;
444+
bp->mii_bus->parent = &bp->pdev->dev;
445445
pdata = dev_get_platdata(&bp->pdev->dev);
446446

447447
dev_set_drvdata(&bp->dev->dev, bp->mii_bus);
@@ -458,7 +458,8 @@ static int macb_mii_init(struct macb *bp)
458458
struct phy_device *phydev;
459459

460460
phydev = mdiobus_scan(bp->mii_bus, i);
461-
if (IS_ERR(phydev)) {
461+
if (IS_ERR(phydev) &&
462+
PTR_ERR(phydev) != -ENODEV) {
462463
err = PTR_ERR(phydev);
463464
break;
464465
}
@@ -3019,29 +3020,36 @@ static int macb_probe(struct platform_device *pdev)
30193020
if (err)
30203021
goto err_out_free_netdev;
30213022

3023+
err = macb_mii_init(bp);
3024+
if (err)
3025+
goto err_out_free_netdev;
3026+
3027+
phydev = bp->phy_dev;
3028+
3029+
netif_carrier_off(dev);
3030+
30223031
err = register_netdev(dev);
30233032
if (err) {
30243033
dev_err(&pdev->dev, "Cannot register net device, aborting.\n");
3025-
goto err_out_unregister_netdev;
3034+
goto err_out_unregister_mdio;
30263035
}
30273036

3028-
err = macb_mii_init(bp);
3029-
if (err)
3030-
goto err_out_unregister_netdev;
3031-
3032-
netif_carrier_off(dev);
3037+
phy_attached_info(phydev);
30333038

30343039
netdev_info(dev, "Cadence %s rev 0x%08x at 0x%08lx irq %d (%pM)\n",
30353040
macb_is_gem(bp) ? "GEM" : "MACB", macb_readl(bp, MID),
30363041
dev->base_addr, dev->irq, dev->dev_addr);
30373042

3038-
phydev = bp->phy_dev;
3039-
phy_attached_info(phydev);
3040-
30413043
return 0;
30423044

3043-
err_out_unregister_netdev:
3044-
unregister_netdev(dev);
3045+
err_out_unregister_mdio:
3046+
phy_disconnect(bp->phy_dev);
3047+
mdiobus_unregister(bp->mii_bus);
3048+
mdiobus_free(bp->mii_bus);
3049+
3050+
/* Shutdown the PHY if there is a GPIO reset */
3051+
if (bp->reset_gpio)
3052+
gpiod_set_value(bp->reset_gpio, 0);
30453053

30463054
err_out_free_netdev:
30473055
free_netdev(dev);

‎drivers/net/ethernet/marvell/mvneta.c‎

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3354,8 +3354,7 @@ static int mvneta_percpu_notifier(struct notifier_block *nfb,
33543354
/* Enable per-CPU interrupts on the CPU that is
33553355
* brought up.
33563356
*/
3357-
smp_call_function_single(cpu, mvneta_percpu_enable,
3358-
pp, true);
3357+
mvneta_percpu_enable(pp);
33593358

33603359
/* Enable per-CPU interrupt on the one CPU we care
33613360
* about.
@@ -3387,8 +3386,7 @@ static int mvneta_percpu_notifier(struct notifier_block *nfb,
33873386
/* Disable per-CPU interrupts on the CPU that is
33883387
* brought down.
33893388
*/
3390-
smp_call_function_single(cpu, mvneta_percpu_disable,
3391-
pp, true);
3389+
mvneta_percpu_disable(pp);
33923390

33933391
break;
33943392
case CPU_DEAD:

‎drivers/net/ethernet/marvell/pxa168_eth.c‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -979,6 +979,8 @@ static int pxa168_init_phy(struct net_device *dev)
979979
return 0;
980980

981981
pep->phy = mdiobus_scan(pep->smi_bus, pep->phy_addr);
982+
if (IS_ERR(pep->phy))
983+
return PTR_ERR(pep->phy);
982984
if (!pep->phy)
983985
return -ENODEV;
984986

‎drivers/net/ethernet/mellanox/mlx5/core/Kconfig‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ config MLX5_CORE_EN
1414
bool "Mellanox Technologies ConnectX-4 Ethernet support"
1515
depends on NETDEVICES && ETHERNET && PCI && MLX5_CORE
1616
select PTP_1588_CLOCK
17+
select VXLAN if MLX5_CORE=y
1718
default n
1819
---help---
1920
Ethernet support in Mellanox Technologies ConnectX-4 NIC.

‎drivers/net/ethernet/mellanox/mlx5/core/en.h‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -567,6 +567,7 @@ struct mlx5e_priv {
567567
struct mlx5e_vxlan_db vxlan;
568568

569569
struct mlx5e_params params;
570+
struct workqueue_struct *wq;
570571
struct work_struct update_carrier_work;
571572
struct work_struct set_rx_mode_work;
572573
struct delayed_work update_stats_work;

‎drivers/net/ethernet/mellanox/mlx5/core/en_main.c‎

Lines changed: 21 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -262,9 +262,8 @@ static void mlx5e_update_stats_work(struct work_struct *work)
262262
mutex_lock(&priv->state_lock);
263263
if (test_bit(MLX5E_STATE_OPENED, &priv->state)) {
264264
mlx5e_update_stats(priv);
265-
schedule_delayed_work(dwork,
266-
msecs_to_jiffies(
267-
MLX5E_UPDATE_STATS_INTERVAL));
265+
queue_delayed_work(priv->wq, dwork,
266+
msecs_to_jiffies(MLX5E_UPDATE_STATS_INTERVAL));
268267
}
269268
mutex_unlock(&priv->state_lock);
270269
}
@@ -280,7 +279,7 @@ static void mlx5e_async_event(struct mlx5_core_dev *mdev, void *vpriv,
280279
switch (event) {
281280
case MLX5_DEV_EVENT_PORT_UP:
282281
case MLX5_DEV_EVENT_PORT_DOWN:
283-
schedule_work(&priv->update_carrier_work);
282+
queue_work(priv->wq, &priv->update_carrier_work);
284283
break;
285284

286285
default:
@@ -1505,7 +1504,7 @@ int mlx5e_open_locked(struct net_device *netdev)
15051504
mlx5e_update_carrier(priv);
15061505
mlx5e_timestamp_init(priv);
15071506

1508-
schedule_delayed_work(&priv->update_stats_work, 0);
1507+
queue_delayed_work(priv->wq, &priv->update_stats_work, 0);
15091508

15101509
return 0;
15111510

@@ -1961,7 +1960,7 @@ static void mlx5e_set_rx_mode(struct net_device *dev)
19611960
{
19621961
struct mlx5e_priv *priv = netdev_priv(dev);
19631962

1964-
schedule_work(&priv->set_rx_mode_work);
1963+
queue_work(priv->wq, &priv->set_rx_mode_work);
19651964
}
19661965

19671966
static int mlx5e_set_mac(struct net_device *netdev, void *addr)
@@ -1976,7 +1975,7 @@ static int mlx5e_set_mac(struct net_device *netdev, void *addr)
19761975
ether_addr_copy(netdev->dev_addr, saddr->sa_data);
19771976
netif_addr_unlock_bh(netdev);
19781977

1979-
schedule_work(&priv->set_rx_mode_work);
1978+
queue_work(priv->wq, &priv->set_rx_mode_work);
19801979

19811980
return 0;
19821981
}
@@ -2158,7 +2157,7 @@ static void mlx5e_add_vxlan_port(struct net_device *netdev,
21582157
if (!mlx5e_vxlan_allowed(priv->mdev))
21592158
return;
21602159

2161-
mlx5e_vxlan_add_port(priv, be16_to_cpu(port));
2160+
mlx5e_vxlan_queue_work(priv, sa_family, be16_to_cpu(port), 1);
21622161
}
21632162

21642163
static void mlx5e_del_vxlan_port(struct net_device *netdev,
@@ -2169,7 +2168,7 @@ static void mlx5e_del_vxlan_port(struct net_device *netdev,
21692168
if (!mlx5e_vxlan_allowed(priv->mdev))
21702169
return;
21712170

2172-
mlx5e_vxlan_del_port(priv, be16_to_cpu(port));
2171+
mlx5e_vxlan_queue_work(priv, sa_family, be16_to_cpu(port), 0);
21732172
}
21742173

21752174
static netdev_features_t mlx5e_vxlan_features_check(struct mlx5e_priv *priv,
@@ -2498,10 +2497,14 @@ static void *mlx5e_create_netdev(struct mlx5_core_dev *mdev)
24982497

24992498
priv = netdev_priv(netdev);
25002499

2500+
priv->wq = create_singlethread_workqueue("mlx5e");
2501+
if (!priv->wq)
2502+
goto err_free_netdev;
2503+
25012504
err = mlx5_alloc_map_uar(mdev, &priv->cq_uar, false);
25022505
if (err) {
25032506
mlx5_core_err(mdev, "alloc_map uar failed, %d\n", err);
2504-
goto err_free_netdev;
2507+
goto err_destroy_wq;
25052508
}
25062509

25072510
err = mlx5_core_alloc_pd(mdev, &priv->pdn);
@@ -2580,7 +2583,7 @@ static void *mlx5e_create_netdev(struct mlx5_core_dev *mdev)
25802583
vxlan_get_rx_port(netdev);
25812584

25822585
mlx5e_enable_async_events(priv);
2583-
schedule_work(&priv->set_rx_mode_work);
2586+
queue_work(priv->wq, &priv->set_rx_mode_work);
25842587

25852588
return priv;
25862589

@@ -2617,6 +2620,9 @@ static void *mlx5e_create_netdev(struct mlx5_core_dev *mdev)
26172620
err_unmap_free_uar:
26182621
mlx5_unmap_free_uar(mdev, &priv->cq_uar);
26192622

2623+
err_destroy_wq:
2624+
destroy_workqueue(priv->wq);
2625+
26202626
err_free_netdev:
26212627
free_netdev(netdev);
26222628

@@ -2630,9 +2636,9 @@ static void mlx5e_destroy_netdev(struct mlx5_core_dev *mdev, void *vpriv)
26302636

26312637
set_bit(MLX5E_STATE_DESTROYING, &priv->state);
26322638

2633-
schedule_work(&priv->set_rx_mode_work);
2639+
queue_work(priv->wq, &priv->set_rx_mode_work);
26342640
mlx5e_disable_async_events(priv);
2635-
flush_scheduled_work();
2641+
flush_workqueue(priv->wq);
26362642
if (test_bit(MLX5_INTERFACE_STATE_SHUTDOWN, &mdev->intf_state)) {
26372643
netif_device_detach(netdev);
26382644
mutex_lock(&priv->state_lock);
@@ -2655,6 +2661,8 @@ static void mlx5e_destroy_netdev(struct mlx5_core_dev *mdev, void *vpriv)
26552661
mlx5_core_dealloc_transport_domain(priv->mdev, priv->tdn);
26562662
mlx5_core_dealloc_pd(priv->mdev, priv->pdn);
26572663
mlx5_unmap_free_uar(priv->mdev, &priv->cq_uar);
2664+
cancel_delayed_work_sync(&priv->update_stats_work);
2665+
destroy_workqueue(priv->wq);
26582666

26592667
if (!test_bit(MLX5_INTERFACE_STATE_SHUTDOWN, &mdev->intf_state))
26602668
free_netdev(netdev);

‎drivers/net/ethernet/mellanox/mlx5/core/uar.c‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -269,8 +269,10 @@ EXPORT_SYMBOL(mlx5_alloc_map_uar);
269269

270270
void mlx5_unmap_free_uar(struct mlx5_core_dev *mdev, struct mlx5_uar *uar)
271271
{
272-
iounmap(uar->map);
273-
iounmap(uar->bf_map);
272+
if (uar->map)
273+
iounmap(uar->map);
274+
else
275+
iounmap(uar->bf_map);
274276
mlx5_cmd_free_uar(mdev, uar->index);
275277
}
276278
EXPORT_SYMBOL(mlx5_unmap_free_uar);

‎drivers/net/ethernet/mellanox/mlx5/core/vxlan.c‎

Lines changed: 38 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -95,21 +95,22 @@ struct mlx5e_vxlan *mlx5e_vxlan_lookup_port(struct mlx5e_priv *priv, u16 port)
9595
return vxlan;
9696
}
9797

98-
int mlx5e_vxlan_add_port(struct mlx5e_priv *priv, u16 port)
98+
static void mlx5e_vxlan_add_port(struct work_struct *work)
9999
{
100+
struct mlx5e_vxlan_work *vxlan_work =
101+
container_of(work, struct mlx5e_vxlan_work, work);
102+
struct mlx5e_priv *priv = vxlan_work->priv;
100103
struct mlx5e_vxlan_db *vxlan_db = &priv->vxlan;
104+
u16 port = vxlan_work->port;
101105
struct mlx5e_vxlan *vxlan;
102106
int err;
103107

104-
err = mlx5e_vxlan_core_add_port_cmd(priv->mdev, port);
105-
if (err)
106-
return err;
108+
if (mlx5e_vxlan_core_add_port_cmd(priv->mdev, port))
109+
goto free_work;
107110

108111
vxlan = kzalloc(sizeof(*vxlan), GFP_KERNEL);
109-
if (!vxlan) {
110-
err = -ENOMEM;
112+
if (!vxlan)
111113
goto err_delete_port;
112-
}
113114

114115
vxlan->udp_port = port;
115116

@@ -119,13 +120,14 @@ int mlx5e_vxlan_add_port(struct mlx5e_priv *priv, u16 port)
119120
if (err)
120121
goto err_free;
121122

122-
return 0;
123+
goto free_work;
123124

124125
err_free:
125126
kfree(vxlan);
126127
err_delete_port:
127128
mlx5e_vxlan_core_del_port_cmd(priv->mdev, port);
128-
return err;
129+
free_work:
130+
kfree(vxlan_work);
129131
}
130132

131133
static void __mlx5e_vxlan_core_del_port(struct mlx5e_priv *priv, u16 port)
@@ -145,12 +147,36 @@ static void __mlx5e_vxlan_core_del_port(struct mlx5e_priv *priv, u16 port)
145147
kfree(vxlan);
146148
}
147149

148-
void mlx5e_vxlan_del_port(struct mlx5e_priv *priv, u16 port)
150+
static void mlx5e_vxlan_del_port(struct work_struct *work)
149151
{
150-
if (!mlx5e_vxlan_lookup_port(priv, port))
151-
return;
152+
struct mlx5e_vxlan_work *vxlan_work =
153+
container_of(work, struct mlx5e_vxlan_work, work);
154+
struct mlx5e_priv *priv = vxlan_work->priv;
155+
u16 port = vxlan_work->port;
152156

153157
__mlx5e_vxlan_core_del_port(priv, port);
158+
159+
kfree(vxlan_work);
160+
}
161+
162+
void mlx5e_vxlan_queue_work(struct mlx5e_priv *priv, sa_family_t sa_family,
163+
u16 port, int add)
164+
{
165+
struct mlx5e_vxlan_work *vxlan_work;
166+
167+
vxlan_work = kmalloc(sizeof(*vxlan_work), GFP_ATOMIC);
168+
if (!vxlan_work)
169+
return;
170+
171+
if (add)
172+
INIT_WORK(&vxlan_work->work, mlx5e_vxlan_add_port);
173+
else
174+
INIT_WORK(&vxlan_work->work, mlx5e_vxlan_del_port);
175+
176+
vxlan_work->priv = priv;
177+
vxlan_work->port = port;
178+
vxlan_work->sa_family = sa_family;
179+
queue_work(priv->wq, &vxlan_work->work);
154180
}
155181

156182
void mlx5e_vxlan_cleanup(struct mlx5e_priv *priv)

‎drivers/net/ethernet/mellanox/mlx5/core/vxlan.h‎

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,15 +39,22 @@ struct mlx5e_vxlan {
3939
u16 udp_port;
4040
};
4141

42+
struct mlx5e_vxlan_work {
43+
struct work_struct work;
44+
struct mlx5e_priv *priv;
45+
sa_family_t sa_family;
46+
u16 port;
47+
};
48+
4249
static inline bool mlx5e_vxlan_allowed(struct mlx5_core_dev *mdev)
4350
{
4451
return (MLX5_CAP_ETH(mdev, tunnel_stateless_vxlan) &&
4552
mlx5_core_is_pf(mdev));
4653
}
4754

4855
void mlx5e_vxlan_init(struct mlx5e_priv *priv);
49-
int mlx5e_vxlan_add_port(struct mlx5e_priv *priv, u16 port);
50-
void mlx5e_vxlan_del_port(struct mlx5e_priv *priv, u16 port);
56+
void mlx5e_vxlan_queue_work(struct mlx5e_priv *priv, sa_family_t sa_family,
57+
u16 port, int add);
5158
struct mlx5e_vxlan *mlx5e_vxlan_lookup_port(struct mlx5e_priv *priv, u16 port);
5259
void mlx5e_vxlan_cleanup(struct mlx5e_priv *priv);
5360

‎include/linux/if_ether.h‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,11 @@ static inline struct ethhdr *eth_hdr(const struct sk_buff *skb)
2828
return (struct ethhdr *)skb_mac_header(skb);
2929
}
3030

31+
static inline struct ethhdr *inner_eth_hdr(const struct sk_buff *skb)
32+
{
33+
return (struct ethhdr *)skb_inner_mac_header(skb);
34+
}
35+
3136
int eth_header_parse(const struct sk_buff *skb, unsigned char *haddr);
3237

3338
extern ssize_t sysfs_format_mac(char *buf, const unsigned char *addr, int len);

0 commit comments

Comments
 (0)