Skip to content

Commit

Permalink
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
Browse files Browse the repository at this point in the history
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
  • Loading branch information
Linus Torvalds committed Oct 2, 2016
2 parents f51fdff + 1cceda7 commit bb6bbc7
Show file tree
Hide file tree
Showing 26 changed files with 171 additions and 127 deletions.
27 changes: 17 additions & 10 deletions drivers/net/can/dev.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
#include <linux/slab.h>
#include <linux/netdevice.h>
#include <linux/if_arp.h>
#include <linux/workqueue.h>
#include <linux/can.h>
#include <linux/can/dev.h>
#include <linux/can/skb.h>
Expand Down Expand Up @@ -501,9 +502,8 @@ EXPORT_SYMBOL_GPL(can_free_echo_skb);
/*
* CAN device restart for bus-off recovery
*/
static void can_restart(unsigned long data)
static void can_restart(struct net_device *dev)
{
struct net_device *dev = (struct net_device *)data;
struct can_priv *priv = netdev_priv(dev);
struct net_device_stats *stats = &dev->stats;
struct sk_buff *skb;
Expand Down Expand Up @@ -543,6 +543,14 @@ static void can_restart(unsigned long data)
netdev_err(dev, "Error %d during restart", err);
}

static void can_restart_work(struct work_struct *work)
{
struct delayed_work *dwork = to_delayed_work(work);
struct can_priv *priv = container_of(dwork, struct can_priv, restart_work);

can_restart(priv->dev);
}

int can_restart_now(struct net_device *dev)
{
struct can_priv *priv = netdev_priv(dev);
Expand All @@ -556,8 +564,8 @@ int can_restart_now(struct net_device *dev)
if (priv->state != CAN_STATE_BUS_OFF)
return -EBUSY;

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

return 0;
}
Expand All @@ -578,8 +586,8 @@ void can_bus_off(struct net_device *dev)
netif_carrier_off(dev);

if (priv->restart_ms)
mod_timer(&priv->restart_timer,
jiffies + (priv->restart_ms * HZ) / 1000);
schedule_delayed_work(&priv->restart_work,
msecs_to_jiffies(priv->restart_ms));
}
EXPORT_SYMBOL_GPL(can_bus_off);

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

priv = netdev_priv(dev);
priv->dev = dev;

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

priv->state = CAN_STATE_STOPPED;

init_timer(&priv->restart_timer);
INIT_DELAYED_WORK(&priv->restart_work, can_restart_work);

return dev;
}
Expand Down Expand Up @@ -778,8 +787,6 @@ int open_candev(struct net_device *dev)
if (!netif_carrier_ok(dev))
netif_carrier_on(dev);

setup_timer(&priv->restart_timer, can_restart, (unsigned long)dev);

return 0;
}
EXPORT_SYMBOL_GPL(open_candev);
Expand All @@ -794,7 +801,7 @@ void close_candev(struct net_device *dev)
{
struct can_priv *priv = netdev_priv(dev);

del_timer_sync(&priv->restart_timer);
cancel_delayed_work_sync(&priv->restart_work);
can_flush_echo_skb(dev);
}
EXPORT_SYMBOL_GPL(close_candev);
Expand Down
45 changes: 25 additions & 20 deletions drivers/net/ethernet/broadcom/genet/bcmgenet.c
Original file line number Diff line number Diff line change
Expand Up @@ -453,25 +453,29 @@ static inline void bcmgenet_rdma_ring_writel(struct bcmgenet_priv *priv,
static int bcmgenet_get_settings(struct net_device *dev,
struct ethtool_cmd *cmd)
{
struct bcmgenet_priv *priv = netdev_priv(dev);

if (!netif_running(dev))
return -EINVAL;

if (!dev->phydev)
if (!priv->phydev)
return -ENODEV;

return phy_ethtool_gset(dev->phydev, cmd);
return phy_ethtool_gset(priv->phydev, cmd);
}

static int bcmgenet_set_settings(struct net_device *dev,
struct ethtool_cmd *cmd)
{
struct bcmgenet_priv *priv = netdev_priv(dev);

if (!netif_running(dev))
return -EINVAL;

if (!dev->phydev)
if (!priv->phydev)
return -ENODEV;

return phy_ethtool_sset(dev->phydev, cmd);
return phy_ethtool_sset(priv->phydev, cmd);
}

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

return phy_ethtool_get_eee(dev->phydev, e);
return phy_ethtool_get_eee(priv->phydev, e);
}

static int bcmgenet_set_eee(struct net_device *dev, struct ethtool_eee *e)
Expand All @@ -954,7 +958,7 @@ static int bcmgenet_set_eee(struct net_device *dev, struct ethtool_eee *e)
if (!p->eee_enabled) {
bcmgenet_eee_enable_set(dev, false);
} else {
ret = phy_init_eee(dev->phydev, 0);
ret = phy_init_eee(priv->phydev, 0);
if (ret) {
netif_err(priv, hw, dev, "EEE initialization failed\n");
return ret;
Expand All @@ -964,12 +968,14 @@ static int bcmgenet_set_eee(struct net_device *dev, struct ethtool_eee *e)
bcmgenet_eee_enable_set(dev, true);
}

return phy_ethtool_set_eee(dev->phydev, e);
return phy_ethtool_set_eee(priv->phydev, e);
}

static int bcmgenet_nway_reset(struct net_device *dev)
{
return genphy_restart_aneg(dev->phydev);
struct bcmgenet_priv *priv = netdev_priv(dev);

return genphy_restart_aneg(priv->phydev);
}

/* standard ethtool support functions. */
Expand All @@ -996,13 +1002,12 @@ static struct ethtool_ops bcmgenet_ethtool_ops = {
static int bcmgenet_power_down(struct bcmgenet_priv *priv,
enum bcmgenet_power_mode mode)
{
struct net_device *ndev = priv->dev;
int ret = 0;
u32 reg;

switch (mode) {
case GENET_POWER_CABLE_SENSE:
phy_detach(ndev->phydev);
phy_detach(priv->phydev);
break;

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

if (!netif_running(dev))
Expand All @@ -1072,10 +1078,10 @@ static int bcmgenet_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
case SIOCGMIIPHY:
case SIOCGMIIREG:
case SIOCSMIIREG:
if (!dev->phydev)
if (!priv->phydev)
val = -ENODEV;
else
val = phy_mii_ioctl(dev->phydev, rq, cmd);
val = phy_mii_ioctl(priv->phydev, rq, cmd);
break;

default:
Expand Down Expand Up @@ -2458,7 +2464,6 @@ static void bcmgenet_irq_task(struct work_struct *work)
{
struct bcmgenet_priv *priv = container_of(
work, struct bcmgenet_priv, bcmgenet_irq_work);
struct net_device *ndev = priv->dev;

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

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

/* Link UP/DOWN event */
if (priv->irq0_stat & UMAC_IRQ_LINK_EVENT) {
phy_mac_interrupt(ndev->phydev,
phy_mac_interrupt(priv->phydev,
!!(priv->irq0_stat & UMAC_IRQ_LINK_UP));
priv->irq0_stat &= ~UMAC_IRQ_LINK_EVENT;
}
Expand Down Expand Up @@ -2833,7 +2838,7 @@ static void bcmgenet_netif_start(struct net_device *dev)
/* Monitor link interrupts now */
bcmgenet_link_intr_enable(priv);

phy_start(dev->phydev);
phy_start(priv->phydev);
}

static int bcmgenet_open(struct net_device *dev)
Expand Down Expand Up @@ -2932,7 +2937,7 @@ static void bcmgenet_netif_stop(struct net_device *dev)
struct bcmgenet_priv *priv = netdev_priv(dev);

netif_tx_stop_all_queues(dev);
phy_stop(dev->phydev);
phy_stop(priv->phydev);
bcmgenet_intr_disable(priv);
bcmgenet_disable_rx_napi(priv);
bcmgenet_disable_tx_napi(priv);
Expand All @@ -2958,7 +2963,7 @@ static int bcmgenet_close(struct net_device *dev)
bcmgenet_netif_stop(dev);

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

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

bcmgenet_netif_stop(dev);

phy_suspend(dev->phydev);
phy_suspend(priv->phydev);

netif_device_detach(dev);

Expand Down Expand Up @@ -3581,7 +3586,7 @@ static int bcmgenet_resume(struct device *d)
if (priv->wolopts)
clk_disable_unprepare(priv->clk_wol);

phy_init_hw(dev->phydev);
phy_init_hw(priv->phydev);
/* Speed settings must be restored */
bcmgenet_mii_config(priv->dev);

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

netif_device_attach(dev);

phy_resume(dev->phydev);
phy_resume(priv->phydev);

if (priv->eee.eee_enabled)
bcmgenet_eee_enable_set(dev, true);
Expand Down
1 change: 1 addition & 0 deletions drivers/net/ethernet/broadcom/genet/bcmgenet.h
Original file line number Diff line number Diff line change
Expand Up @@ -597,6 +597,7 @@ struct bcmgenet_priv {

/* MDIO bus variables */
wait_queue_head_t wq;
struct phy_device *phydev;
bool internal_phy;
struct device_node *phy_dn;
struct device_node *mdio_dn;
Expand Down
24 changes: 13 additions & 11 deletions drivers/net/ethernet/broadcom/genet/bcmmii.c
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ static int bcmgenet_mii_write(struct mii_bus *bus, int phy_id,
void bcmgenet_mii_setup(struct net_device *dev)
{
struct bcmgenet_priv *priv = netdev_priv(dev);
struct phy_device *phydev = dev->phydev;
struct phy_device *phydev = priv->phydev;
u32 reg, cmd_bits = 0;
bool status_changed = false;

Expand Down Expand Up @@ -183,9 +183,9 @@ void bcmgenet_mii_reset(struct net_device *dev)
if (GENET_IS_V4(priv))
return;

if (dev->phydev) {
phy_init_hw(dev->phydev);
phy_start_aneg(dev->phydev);
if (priv->phydev) {
phy_init_hw(priv->phydev);
phy_start_aneg(priv->phydev);
}
}

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

static void bcmgenet_moca_phy_setup(struct bcmgenet_priv *priv)
{
struct net_device *ndev = priv->dev;
u32 reg;

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

if (priv->hw_params->flags & GENET_HAS_MOCA_LINK_DET)
fixed_phy_set_link_update(ndev->phydev,
fixed_phy_set_link_update(priv->phydev,
bcmgenet_fixed_phy_link_update);
}

int bcmgenet_mii_config(struct net_device *dev)
{
struct bcmgenet_priv *priv = netdev_priv(dev);
struct phy_device *phydev = dev->phydev;
struct phy_device *phydev = priv->phydev;
struct device *kdev = &priv->pdev->dev;
const char *phy_name = NULL;
u32 id_mode_dis = 0;
Expand Down Expand Up @@ -303,7 +302,7 @@ int bcmgenet_mii_config(struct net_device *dev)
* capabilities, use that knowledge to also configure the
* Reverse MII interface correctly.
*/
if ((phydev->supported & PHY_BASIC_FEATURES) ==
if ((priv->phydev->supported & PHY_BASIC_FEATURES) ==
PHY_BASIC_FEATURES)
port_ctrl = PORT_MODE_EXT_RVMII_25;
else
Expand Down Expand Up @@ -372,7 +371,7 @@ int bcmgenet_mii_probe(struct net_device *dev)
return -ENODEV;
}
} else {
phydev = dev->phydev;
phydev = priv->phydev;
phydev->dev_flags = phy_flags;

ret = phy_connect_direct(dev, phydev, bcmgenet_mii_setup,
Expand All @@ -383,14 +382,16 @@ int bcmgenet_mii_probe(struct net_device *dev)
}
}

priv->phydev = phydev;

/* Configure port multiplexer based on what the probed PHY device since
* reading the 'max-speed' property determines the maximum supported
* PHY speed which is needed for bcmgenet_mii_config() to configure
* things appropriately.
*/
ret = bcmgenet_mii_config(dev);
if (ret) {
phy_disconnect(phydev);
phy_disconnect(priv->phydev);
return ret;
}

Expand All @@ -400,7 +401,7 @@ int bcmgenet_mii_probe(struct net_device *dev)
* Ethernet MAC ISRs
*/
if (priv->internal_phy)
phydev->irq = PHY_IGNORE_INTERRUPT;
priv->phydev->irq = PHY_IGNORE_INTERRUPT;

return 0;
}
Expand Down Expand Up @@ -605,6 +606,7 @@ static int bcmgenet_mii_pd_init(struct bcmgenet_priv *priv)

}

priv->phydev = phydev;
priv->phy_interface = pd->phy_interface;

return 0;
Expand Down
Loading

0 comments on commit bb6bbc7

Please sign in to comment.