Skip to content

Commit bb6bbc7

Browse files
committed
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
Pull networking fixes from David Miller: 1) Fix wrong TCP checksums on MTU probing when checksum offloading is disabled, from Douglas Caetano dos Santos. 2) Fix qdisc backlog updates in qfq and sfb schedulers, from Cong Wang. 3) Route lookup flow key protocol value is wrong in ip6gre_xmit_other(), fix from Lance Richardson. 4) Scheduling while atomic in multicast routing code of ipv4 and ipv6, fix from Nikolay Aleksandrov. 5) Fix packet alignment in fec driver, from Eric Nelson. 6) Fix perf regression in sctp due to struct layout and cache misses, from Xin Long. * git://git.kernel.org/pub/scm/linux/kernel/git/davem/net: sctp: fix the issue sctp_diag uses lock_sock in rcu_read_lock sctp: change to check peer prsctp_capable when using prsctp polices sctp: remove prsctp_param from sctp_chunk sctp: move sent_count to the memory hole in sctp_chunk tg3: Avoid NULL pointer dereference in tg3_io_error_detected() act_ife: Fix false encoding act_ife: Fix external mac header on encode VSOCK: Don't dec ack backlog twice for rejected connections Revert "net: ethernet: bcmgenet: use phydev from struct net_device" net: fec: align IP header in hardware net: fec: remove QUIRK_HAS_RACC from i.mx27 net: fec: remove QUIRK_HAS_RACC from i.mx25 ipmr, ip6mr: fix scheduling while atomic and a deadlock with ipmr_get_route ip6_gre: fix flowi6_proto value in ip6gre_xmit_other() tcp: fix a compile error in DBGUNDO() tcp: fix wrong checksum calculation on MTU probing sch_sfb: keep backlog updated with qlen sch_qfq: keep backlog updated with qlen can: dev: fix deadlock reported after bus-off
2 parents f51fdff + 1cceda7 commit bb6bbc7

File tree

26 files changed

+171
-127
lines changed

26 files changed

+171
-127
lines changed

drivers/net/can/dev.c

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
#include <linux/slab.h>
2222
#include <linux/netdevice.h>
2323
#include <linux/if_arp.h>
24+
#include <linux/workqueue.h>
2425
#include <linux/can.h>
2526
#include <linux/can/dev.h>
2627
#include <linux/can/skb.h>
@@ -501,9 +502,8 @@ EXPORT_SYMBOL_GPL(can_free_echo_skb);
501502
/*
502503
* CAN device restart for bus-off recovery
503504
*/
504-
static void can_restart(unsigned long data)
505+
static void can_restart(struct net_device *dev)
505506
{
506-
struct net_device *dev = (struct net_device *)data;
507507
struct can_priv *priv = netdev_priv(dev);
508508
struct net_device_stats *stats = &dev->stats;
509509
struct sk_buff *skb;
@@ -543,6 +543,14 @@ static void can_restart(unsigned long data)
543543
netdev_err(dev, "Error %d during restart", err);
544544
}
545545

546+
static void can_restart_work(struct work_struct *work)
547+
{
548+
struct delayed_work *dwork = to_delayed_work(work);
549+
struct can_priv *priv = container_of(dwork, struct can_priv, restart_work);
550+
551+
can_restart(priv->dev);
552+
}
553+
546554
int can_restart_now(struct net_device *dev)
547555
{
548556
struct can_priv *priv = netdev_priv(dev);
@@ -556,8 +564,8 @@ int can_restart_now(struct net_device *dev)
556564
if (priv->state != CAN_STATE_BUS_OFF)
557565
return -EBUSY;
558566

559-
/* Runs as soon as possible in the timer context */
560-
mod_timer(&priv->restart_timer, jiffies);
567+
cancel_delayed_work_sync(&priv->restart_work);
568+
can_restart(dev);
561569

562570
return 0;
563571
}
@@ -578,8 +586,8 @@ void can_bus_off(struct net_device *dev)
578586
netif_carrier_off(dev);
579587

580588
if (priv->restart_ms)
581-
mod_timer(&priv->restart_timer,
582-
jiffies + (priv->restart_ms * HZ) / 1000);
589+
schedule_delayed_work(&priv->restart_work,
590+
msecs_to_jiffies(priv->restart_ms));
583591
}
584592
EXPORT_SYMBOL_GPL(can_bus_off);
585593

@@ -688,6 +696,7 @@ struct net_device *alloc_candev(int sizeof_priv, unsigned int echo_skb_max)
688696
return NULL;
689697

690698
priv = netdev_priv(dev);
699+
priv->dev = dev;
691700

692701
if (echo_skb_max) {
693702
priv->echo_skb_max = echo_skb_max;
@@ -697,7 +706,7 @@ struct net_device *alloc_candev(int sizeof_priv, unsigned int echo_skb_max)
697706

698707
priv->state = CAN_STATE_STOPPED;
699708

700-
init_timer(&priv->restart_timer);
709+
INIT_DELAYED_WORK(&priv->restart_work, can_restart_work);
701710

702711
return dev;
703712
}
@@ -778,8 +787,6 @@ int open_candev(struct net_device *dev)
778787
if (!netif_carrier_ok(dev))
779788
netif_carrier_on(dev);
780789

781-
setup_timer(&priv->restart_timer, can_restart, (unsigned long)dev);
782-
783790
return 0;
784791
}
785792
EXPORT_SYMBOL_GPL(open_candev);
@@ -794,7 +801,7 @@ void close_candev(struct net_device *dev)
794801
{
795802
struct can_priv *priv = netdev_priv(dev);
796803

797-
del_timer_sync(&priv->restart_timer);
804+
cancel_delayed_work_sync(&priv->restart_work);
798805
can_flush_echo_skb(dev);
799806
}
800807
EXPORT_SYMBOL_GPL(close_candev);

drivers/net/ethernet/broadcom/genet/bcmgenet.c

Lines changed: 25 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -453,25 +453,29 @@ static inline void bcmgenet_rdma_ring_writel(struct bcmgenet_priv *priv,
453453
static int bcmgenet_get_settings(struct net_device *dev,
454454
struct ethtool_cmd *cmd)
455455
{
456+
struct bcmgenet_priv *priv = netdev_priv(dev);
457+
456458
if (!netif_running(dev))
457459
return -EINVAL;
458460

459-
if (!dev->phydev)
461+
if (!priv->phydev)
460462
return -ENODEV;
461463

462-
return phy_ethtool_gset(dev->phydev, cmd);
464+
return phy_ethtool_gset(priv->phydev, cmd);
463465
}
464466

465467
static int bcmgenet_set_settings(struct net_device *dev,
466468
struct ethtool_cmd *cmd)
467469
{
470+
struct bcmgenet_priv *priv = netdev_priv(dev);
471+
468472
if (!netif_running(dev))
469473
return -EINVAL;
470474

471-
if (!dev->phydev)
475+
if (!priv->phydev)
472476
return -ENODEV;
473477

474-
return phy_ethtool_sset(dev->phydev, cmd);
478+
return phy_ethtool_sset(priv->phydev, cmd);
475479
}
476480

477481
static int bcmgenet_set_rx_csum(struct net_device *dev,
@@ -937,7 +941,7 @@ static int bcmgenet_get_eee(struct net_device *dev, struct ethtool_eee *e)
937941
e->eee_active = p->eee_active;
938942
e->tx_lpi_timer = bcmgenet_umac_readl(priv, UMAC_EEE_LPI_TIMER);
939943

940-
return phy_ethtool_get_eee(dev->phydev, e);
944+
return phy_ethtool_get_eee(priv->phydev, e);
941945
}
942946

943947
static int bcmgenet_set_eee(struct net_device *dev, struct ethtool_eee *e)
@@ -954,7 +958,7 @@ static int bcmgenet_set_eee(struct net_device *dev, struct ethtool_eee *e)
954958
if (!p->eee_enabled) {
955959
bcmgenet_eee_enable_set(dev, false);
956960
} else {
957-
ret = phy_init_eee(dev->phydev, 0);
961+
ret = phy_init_eee(priv->phydev, 0);
958962
if (ret) {
959963
netif_err(priv, hw, dev, "EEE initialization failed\n");
960964
return ret;
@@ -964,12 +968,14 @@ static int bcmgenet_set_eee(struct net_device *dev, struct ethtool_eee *e)
964968
bcmgenet_eee_enable_set(dev, true);
965969
}
966970

967-
return phy_ethtool_set_eee(dev->phydev, e);
971+
return phy_ethtool_set_eee(priv->phydev, e);
968972
}
969973

970974
static int bcmgenet_nway_reset(struct net_device *dev)
971975
{
972-
return genphy_restart_aneg(dev->phydev);
976+
struct bcmgenet_priv *priv = netdev_priv(dev);
977+
978+
return genphy_restart_aneg(priv->phydev);
973979
}
974980

975981
/* standard ethtool support functions. */
@@ -996,13 +1002,12 @@ static struct ethtool_ops bcmgenet_ethtool_ops = {
9961002
static int bcmgenet_power_down(struct bcmgenet_priv *priv,
9971003
enum bcmgenet_power_mode mode)
9981004
{
999-
struct net_device *ndev = priv->dev;
10001005
int ret = 0;
10011006
u32 reg;
10021007

10031008
switch (mode) {
10041009
case GENET_POWER_CABLE_SENSE:
1005-
phy_detach(ndev->phydev);
1010+
phy_detach(priv->phydev);
10061011
break;
10071012

10081013
case GENET_POWER_WOL_MAGIC:
@@ -1063,6 +1068,7 @@ static void bcmgenet_power_up(struct bcmgenet_priv *priv,
10631068
/* ioctl handle special commands that are not present in ethtool. */
10641069
static int bcmgenet_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
10651070
{
1071+
struct bcmgenet_priv *priv = netdev_priv(dev);
10661072
int val = 0;
10671073

10681074
if (!netif_running(dev))
@@ -1072,10 +1078,10 @@ static int bcmgenet_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
10721078
case SIOCGMIIPHY:
10731079
case SIOCGMIIREG:
10741080
case SIOCSMIIREG:
1075-
if (!dev->phydev)
1081+
if (!priv->phydev)
10761082
val = -ENODEV;
10771083
else
1078-
val = phy_mii_ioctl(dev->phydev, rq, cmd);
1084+
val = phy_mii_ioctl(priv->phydev, rq, cmd);
10791085
break;
10801086

10811087
default:
@@ -2458,7 +2464,6 @@ static void bcmgenet_irq_task(struct work_struct *work)
24582464
{
24592465
struct bcmgenet_priv *priv = container_of(
24602466
work, struct bcmgenet_priv, bcmgenet_irq_work);
2461-
struct net_device *ndev = priv->dev;
24622467

24632468
netif_dbg(priv, intr, priv->dev, "%s\n", __func__);
24642469

@@ -2471,7 +2476,7 @@ static void bcmgenet_irq_task(struct work_struct *work)
24712476

24722477
/* Link UP/DOWN event */
24732478
if (priv->irq0_stat & UMAC_IRQ_LINK_EVENT) {
2474-
phy_mac_interrupt(ndev->phydev,
2479+
phy_mac_interrupt(priv->phydev,
24752480
!!(priv->irq0_stat & UMAC_IRQ_LINK_UP));
24762481
priv->irq0_stat &= ~UMAC_IRQ_LINK_EVENT;
24772482
}
@@ -2833,7 +2838,7 @@ static void bcmgenet_netif_start(struct net_device *dev)
28332838
/* Monitor link interrupts now */
28342839
bcmgenet_link_intr_enable(priv);
28352840

2836-
phy_start(dev->phydev);
2841+
phy_start(priv->phydev);
28372842
}
28382843

28392844
static int bcmgenet_open(struct net_device *dev)
@@ -2932,7 +2937,7 @@ static void bcmgenet_netif_stop(struct net_device *dev)
29322937
struct bcmgenet_priv *priv = netdev_priv(dev);
29332938

29342939
netif_tx_stop_all_queues(dev);
2935-
phy_stop(dev->phydev);
2940+
phy_stop(priv->phydev);
29362941
bcmgenet_intr_disable(priv);
29372942
bcmgenet_disable_rx_napi(priv);
29382943
bcmgenet_disable_tx_napi(priv);
@@ -2958,7 +2963,7 @@ static int bcmgenet_close(struct net_device *dev)
29582963
bcmgenet_netif_stop(dev);
29592964

29602965
/* Really kill the PHY state machine and disconnect from it */
2961-
phy_disconnect(dev->phydev);
2966+
phy_disconnect(priv->phydev);
29622967

29632968
/* Disable MAC receive */
29642969
umac_enable_set(priv, CMD_RX_EN, false);
@@ -3517,7 +3522,7 @@ static int bcmgenet_suspend(struct device *d)
35173522

35183523
bcmgenet_netif_stop(dev);
35193524

3520-
phy_suspend(dev->phydev);
3525+
phy_suspend(priv->phydev);
35213526

35223527
netif_device_detach(dev);
35233528

@@ -3581,7 +3586,7 @@ static int bcmgenet_resume(struct device *d)
35813586
if (priv->wolopts)
35823587
clk_disable_unprepare(priv->clk_wol);
35833588

3584-
phy_init_hw(dev->phydev);
3589+
phy_init_hw(priv->phydev);
35853590
/* Speed settings must be restored */
35863591
bcmgenet_mii_config(priv->dev);
35873592

@@ -3614,7 +3619,7 @@ static int bcmgenet_resume(struct device *d)
36143619

36153620
netif_device_attach(dev);
36163621

3617-
phy_resume(dev->phydev);
3622+
phy_resume(priv->phydev);
36183623

36193624
if (priv->eee.eee_enabled)
36203625
bcmgenet_eee_enable_set(dev, true);

drivers/net/ethernet/broadcom/genet/bcmgenet.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -597,6 +597,7 @@ struct bcmgenet_priv {
597597

598598
/* MDIO bus variables */
599599
wait_queue_head_t wq;
600+
struct phy_device *phydev;
600601
bool internal_phy;
601602
struct device_node *phy_dn;
602603
struct device_node *mdio_dn;

drivers/net/ethernet/broadcom/genet/bcmmii.c

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ static int bcmgenet_mii_write(struct mii_bus *bus, int phy_id,
8686
void bcmgenet_mii_setup(struct net_device *dev)
8787
{
8888
struct bcmgenet_priv *priv = netdev_priv(dev);
89-
struct phy_device *phydev = dev->phydev;
89+
struct phy_device *phydev = priv->phydev;
9090
u32 reg, cmd_bits = 0;
9191
bool status_changed = false;
9292

@@ -183,9 +183,9 @@ void bcmgenet_mii_reset(struct net_device *dev)
183183
if (GENET_IS_V4(priv))
184184
return;
185185

186-
if (dev->phydev) {
187-
phy_init_hw(dev->phydev);
188-
phy_start_aneg(dev->phydev);
186+
if (priv->phydev) {
187+
phy_init_hw(priv->phydev);
188+
phy_start_aneg(priv->phydev);
189189
}
190190
}
191191

@@ -236,7 +236,6 @@ static void bcmgenet_internal_phy_setup(struct net_device *dev)
236236

237237
static void bcmgenet_moca_phy_setup(struct bcmgenet_priv *priv)
238238
{
239-
struct net_device *ndev = priv->dev;
240239
u32 reg;
241240

242241
/* Speed settings are set in bcmgenet_mii_setup() */
@@ -245,14 +244,14 @@ static void bcmgenet_moca_phy_setup(struct bcmgenet_priv *priv)
245244
bcmgenet_sys_writel(priv, reg, SYS_PORT_CTRL);
246245

247246
if (priv->hw_params->flags & GENET_HAS_MOCA_LINK_DET)
248-
fixed_phy_set_link_update(ndev->phydev,
247+
fixed_phy_set_link_update(priv->phydev,
249248
bcmgenet_fixed_phy_link_update);
250249
}
251250

252251
int bcmgenet_mii_config(struct net_device *dev)
253252
{
254253
struct bcmgenet_priv *priv = netdev_priv(dev);
255-
struct phy_device *phydev = dev->phydev;
254+
struct phy_device *phydev = priv->phydev;
256255
struct device *kdev = &priv->pdev->dev;
257256
const char *phy_name = NULL;
258257
u32 id_mode_dis = 0;
@@ -303,7 +302,7 @@ int bcmgenet_mii_config(struct net_device *dev)
303302
* capabilities, use that knowledge to also configure the
304303
* Reverse MII interface correctly.
305304
*/
306-
if ((phydev->supported & PHY_BASIC_FEATURES) ==
305+
if ((priv->phydev->supported & PHY_BASIC_FEATURES) ==
307306
PHY_BASIC_FEATURES)
308307
port_ctrl = PORT_MODE_EXT_RVMII_25;
309308
else
@@ -372,7 +371,7 @@ int bcmgenet_mii_probe(struct net_device *dev)
372371
return -ENODEV;
373372
}
374373
} else {
375-
phydev = dev->phydev;
374+
phydev = priv->phydev;
376375
phydev->dev_flags = phy_flags;
377376

378377
ret = phy_connect_direct(dev, phydev, bcmgenet_mii_setup,
@@ -383,14 +382,16 @@ int bcmgenet_mii_probe(struct net_device *dev)
383382
}
384383
}
385384

385+
priv->phydev = phydev;
386+
386387
/* Configure port multiplexer based on what the probed PHY device since
387388
* reading the 'max-speed' property determines the maximum supported
388389
* PHY speed which is needed for bcmgenet_mii_config() to configure
389390
* things appropriately.
390391
*/
391392
ret = bcmgenet_mii_config(dev);
392393
if (ret) {
393-
phy_disconnect(phydev);
394+
phy_disconnect(priv->phydev);
394395
return ret;
395396
}
396397

@@ -400,7 +401,7 @@ int bcmgenet_mii_probe(struct net_device *dev)
400401
* Ethernet MAC ISRs
401402
*/
402403
if (priv->internal_phy)
403-
phydev->irq = PHY_IGNORE_INTERRUPT;
404+
priv->phydev->irq = PHY_IGNORE_INTERRUPT;
404405

405406
return 0;
406407
}
@@ -605,6 +606,7 @@ static int bcmgenet_mii_pd_init(struct bcmgenet_priv *priv)
605606

606607
}
607608

609+
priv->phydev = phydev;
608610
priv->phy_interface = pd->phy_interface;
609611

610612
return 0;

0 commit comments

Comments
 (0)