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) Don't use MMIO on certain iwlwifi devices otherwise we get a
    firmware crash.

 2) Don't corrupt the GRO lists of mac80211 contexts by doing sends via
    timer interrupt, from Johannes Berg.

 3) SKB tailroom is miscalculated in AP_VLAN crypto code, from Michal
    Kazior.

 4) Fix fw_status memory leak in iwlwifi, from Haim Dreyfuss.

 5) Fix use after free in iwl_mvm_d0i3_enable_tx(), from Eliad Peller.

 6) JIT'ing of large BPF programs is broken on x86, from Alexei
    Starovoitov.

 7) EMAC driver ethtool register dump size is miscalculated, from Ivan
    Mikhaylov.

 8) Fix PHY initial link mode when autonegotiation is disabled in
    amd-xgbe, from Tom Lendacky.

 9) Fix NULL deref on SOCK_DEAD socket in AF_UNIX and CAIF protocols,
    from Mark Salyzyn.

10) credit_bytes not initialized properly in xen-netback, from Ross
   Lagerwall.

11) Fallback from MSI-X to INTx interrupts not handled properly in mlx4
    driver, fix from Benjamin Poirier.

12) Perform ->attach() after binding dev->qdisc in packet scheduler,
    otherwise we can crash.  From Cong WANG.

13) Don't clobber data in sctp_v4_map_v6().  From Jason Gunthorpe.

* git://git.kernel.org/pub/scm/linux/kernel/git/davem/net: (30 commits)
  sctp: Fix mangled IPv4 addresses on a IPv6 listening socket
  net_sched: invoke ->attach() after setting dev->qdisc
  xen-netfront: properly destroy queues when removing device
  mlx4_core: Fix fallback from MSI-X to INTx
  xen/netback: Properly initialize credit_bytes
  net: netxen: correct sysfs bin attribute return code
  tools: bpf_jit_disasm: fix segfault on disabled debugging log output
  unix/caif: sk_socket can disappear when state is unlocked
  amd-xgbe-phy: Fix initial mode when autoneg is disabled
  net: dp83640: fix improper double spin locking.
  net: dp83640: reinforce locking rules.
  net: dp83640: fix broken calibration routine.
  net: stmmac: create one debugfs dir per net-device
  net/ibm/emac: fix size of emac dump memory areas
  x86: bpf_jit: fix compilation of large bpf programs
  net: phy: bcm7xxx: Fix 7425 PHY ID and flags
  iwlwifi: mvm: avoid use-after-free on iwl_mvm_d0i3_enable_tx()
  iwlwifi: mvm: clean net-detect info if device was reset during suspend
  iwlwifi: mvm: take the UCODE_DOWN reference when resuming
  iwlwifi: mvm: BT Coex - duplicate the command if sent ASYNC
  ...
  • Loading branch information
Linus Torvalds committed May 27, 2015
2 parents 7ffb9e1 + 9302d7b commit 8f98bcd
Show file tree
Hide file tree
Showing 37 changed files with 351 additions and 170 deletions.
7 changes: 6 additions & 1 deletion arch/x86/net/bpf_jit_comp.c
Original file line number Diff line number Diff line change
Expand Up @@ -966,7 +966,12 @@ void bpf_int_jit_compile(struct bpf_prog *prog)
}
ctx.cleanup_addr = proglen;

for (pass = 0; pass < 10; pass++) {
/* JITed image shrinks with every pass and the loop iterates
* until the image stops shrinking. Very large bpf programs
* may converge on the last pass. In such case do one more
* pass to emit the final image
*/
for (pass = 0; pass < 10 || image; pass++) {
proglen = do_jit(prog, addrs, image, oldproglen, &ctx);
if (proglen <= 0) {
image = NULL;
Expand Down
16 changes: 6 additions & 10 deletions drivers/net/ethernet/ibm/emac/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -2084,12 +2084,8 @@ static void emac_ethtool_get_pauseparam(struct net_device *ndev,

static int emac_get_regs_len(struct emac_instance *dev)
{
if (emac_has_feature(dev, EMAC_FTR_EMAC4))
return sizeof(struct emac_ethtool_regs_subhdr) +
EMAC4_ETHTOOL_REGS_SIZE(dev);
else
return sizeof(struct emac_ethtool_regs_subhdr) +
EMAC_ETHTOOL_REGS_SIZE(dev);
sizeof(struct emac_regs);
}

static int emac_ethtool_get_regs_len(struct net_device *ndev)
Expand All @@ -2114,15 +2110,15 @@ static void *emac_dump_regs(struct emac_instance *dev, void *buf)
struct emac_ethtool_regs_subhdr *hdr = buf;

hdr->index = dev->cell_index;
if (emac_has_feature(dev, EMAC_FTR_EMAC4)) {
if (emac_has_feature(dev, EMAC_FTR_EMAC4SYNC)) {
hdr->version = EMAC4SYNC_ETHTOOL_REGS_VER;
} else if (emac_has_feature(dev, EMAC_FTR_EMAC4)) {
hdr->version = EMAC4_ETHTOOL_REGS_VER;
memcpy_fromio(hdr + 1, dev->emacp, EMAC4_ETHTOOL_REGS_SIZE(dev));
return (void *)(hdr + 1) + EMAC4_ETHTOOL_REGS_SIZE(dev);
} else {
hdr->version = EMAC_ETHTOOL_REGS_VER;
memcpy_fromio(hdr + 1, dev->emacp, EMAC_ETHTOOL_REGS_SIZE(dev));
return (void *)(hdr + 1) + EMAC_ETHTOOL_REGS_SIZE(dev);
}
memcpy_fromio(hdr + 1, dev->emacp, sizeof(struct emac_regs));
return (void *)(hdr + 1) + sizeof(struct emac_regs);
}

static void emac_ethtool_get_regs(struct net_device *ndev,
Expand Down
7 changes: 2 additions & 5 deletions drivers/net/ethernet/ibm/emac/core.h
Original file line number Diff line number Diff line change
Expand Up @@ -461,10 +461,7 @@ struct emac_ethtool_regs_subhdr {
};

#define EMAC_ETHTOOL_REGS_VER 0
#define EMAC_ETHTOOL_REGS_SIZE(dev) ((dev)->rsrc_regs.end - \
(dev)->rsrc_regs.start + 1)
#define EMAC4_ETHTOOL_REGS_VER 1
#define EMAC4_ETHTOOL_REGS_SIZE(dev) ((dev)->rsrc_regs.end - \
(dev)->rsrc_regs.start + 1)
#define EMAC4_ETHTOOL_REGS_VER 1
#define EMAC4SYNC_ETHTOOL_REGS_VER 2

#endif /* __IBM_NEWEMAC_CORE_H */
9 changes: 7 additions & 2 deletions drivers/net/ethernet/mellanox/mlx4/cmd.c
Original file line number Diff line number Diff line change
Expand Up @@ -714,8 +714,13 @@ static int mlx4_cmd_wait(struct mlx4_dev *dev, u64 in_param, u64 *out_param,
msecs_to_jiffies(timeout))) {
mlx4_warn(dev, "command 0x%x timed out (go bit not cleared)\n",
op);
err = -EIO;
goto out_reset;
if (op == MLX4_CMD_NOP) {
err = -EBUSY;
goto out;
} else {
err = -EIO;
goto out_reset;
}
}

err = context->result;
Expand Down
6 changes: 3 additions & 3 deletions drivers/net/ethernet/qlogic/netxen/netxen_nic_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -3025,9 +3025,9 @@ netxen_sysfs_read_dimm(struct file *filp, struct kobject *kobj,
u8 dw, rows, cols, banks, ranks;
u32 val;

if (size != sizeof(struct netxen_dimm_cfg)) {
if (size < attr->size) {
netdev_err(netdev, "Invalid size\n");
return -1;
return -EINVAL;
}

memset(&dimm, 0, sizeof(struct netxen_dimm_cfg));
Expand Down Expand Up @@ -3137,7 +3137,7 @@ netxen_sysfs_read_dimm(struct file *filp, struct kobject *kobj,

static struct bin_attribute bin_attr_dimm = {
.attr = { .name = "dimm", .mode = (S_IRUGO | S_IWUSR) },
.size = 0,
.size = sizeof(struct netxen_dimm_cfg),
.read = netxen_sysfs_read_dimm,
};

Expand Down
6 changes: 6 additions & 0 deletions drivers/net/ethernet/stmicro/stmmac/stmmac.h
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,12 @@ struct stmmac_priv {
int use_riwt;
int irq_wake;
spinlock_t ptp_lock;

#ifdef CONFIG_DEBUG_FS
struct dentry *dbgfs_dir;
struct dentry *dbgfs_rings_status;
struct dentry *dbgfs_dma_cap;
#endif
};

int stmmac_mdio_unregister(struct net_device *ndev);
Expand Down
76 changes: 53 additions & 23 deletions drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ static irqreturn_t stmmac_interrupt(int irq, void *dev_id);

#ifdef CONFIG_DEBUG_FS
static int stmmac_init_fs(struct net_device *dev);
static void stmmac_exit_fs(void);
static void stmmac_exit_fs(struct net_device *dev);
#endif

#define STMMAC_COAL_TIMER(x) (jiffies + usecs_to_jiffies(x))
Expand Down Expand Up @@ -1916,7 +1916,7 @@ static int stmmac_release(struct net_device *dev)
netif_carrier_off(dev);

#ifdef CONFIG_DEBUG_FS
stmmac_exit_fs();
stmmac_exit_fs(dev);
#endif

stmmac_release_ptp(priv);
Expand Down Expand Up @@ -2508,8 +2508,6 @@ static int stmmac_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)

#ifdef CONFIG_DEBUG_FS
static struct dentry *stmmac_fs_dir;
static struct dentry *stmmac_rings_status;
static struct dentry *stmmac_dma_cap;

static void sysfs_display_ring(void *head, int size, int extend_desc,
struct seq_file *seq)
Expand Down Expand Up @@ -2648,48 +2646,51 @@ static const struct file_operations stmmac_dma_cap_fops = {

static int stmmac_init_fs(struct net_device *dev)
{
/* Create debugfs entries */
stmmac_fs_dir = debugfs_create_dir(STMMAC_RESOURCE_NAME, NULL);
struct stmmac_priv *priv = netdev_priv(dev);

/* Create per netdev entries */
priv->dbgfs_dir = debugfs_create_dir(dev->name, stmmac_fs_dir);

if (!stmmac_fs_dir || IS_ERR(stmmac_fs_dir)) {
pr_err("ERROR %s, debugfs create directory failed\n",
STMMAC_RESOURCE_NAME);
if (!priv->dbgfs_dir || IS_ERR(priv->dbgfs_dir)) {
pr_err("ERROR %s/%s, debugfs create directory failed\n",
STMMAC_RESOURCE_NAME, dev->name);

return -ENOMEM;
}

/* Entry to report DMA RX/TX rings */
stmmac_rings_status = debugfs_create_file("descriptors_status",
S_IRUGO, stmmac_fs_dir, dev,
&stmmac_rings_status_fops);
priv->dbgfs_rings_status =
debugfs_create_file("descriptors_status", S_IRUGO,
priv->dbgfs_dir, dev,
&stmmac_rings_status_fops);

if (!stmmac_rings_status || IS_ERR(stmmac_rings_status)) {
if (!priv->dbgfs_rings_status || IS_ERR(priv->dbgfs_rings_status)) {
pr_info("ERROR creating stmmac ring debugfs file\n");
debugfs_remove(stmmac_fs_dir);
debugfs_remove_recursive(priv->dbgfs_dir);

return -ENOMEM;
}

/* Entry to report the DMA HW features */
stmmac_dma_cap = debugfs_create_file("dma_cap", S_IRUGO, stmmac_fs_dir,
dev, &stmmac_dma_cap_fops);
priv->dbgfs_dma_cap = debugfs_create_file("dma_cap", S_IRUGO,
priv->dbgfs_dir,
dev, &stmmac_dma_cap_fops);

if (!stmmac_dma_cap || IS_ERR(stmmac_dma_cap)) {
if (!priv->dbgfs_dma_cap || IS_ERR(priv->dbgfs_dma_cap)) {
pr_info("ERROR creating stmmac MMC debugfs file\n");
debugfs_remove(stmmac_rings_status);
debugfs_remove(stmmac_fs_dir);
debugfs_remove_recursive(priv->dbgfs_dir);

return -ENOMEM;
}

return 0;
}

static void stmmac_exit_fs(void)
static void stmmac_exit_fs(struct net_device *dev)
{
debugfs_remove(stmmac_rings_status);
debugfs_remove(stmmac_dma_cap);
debugfs_remove(stmmac_fs_dir);
struct stmmac_priv *priv = netdev_priv(dev);

debugfs_remove_recursive(priv->dbgfs_dir);
}
#endif /* CONFIG_DEBUG_FS */

Expand Down Expand Up @@ -3149,6 +3150,35 @@ static int __init stmmac_cmdline_opt(char *str)
__setup("stmmaceth=", stmmac_cmdline_opt);
#endif /* MODULE */

static int __init stmmac_init(void)
{
#ifdef CONFIG_DEBUG_FS
/* Create debugfs main directory if it doesn't exist yet */
if (!stmmac_fs_dir) {
stmmac_fs_dir = debugfs_create_dir(STMMAC_RESOURCE_NAME, NULL);

if (!stmmac_fs_dir || IS_ERR(stmmac_fs_dir)) {
pr_err("ERROR %s, debugfs create directory failed\n",
STMMAC_RESOURCE_NAME);

return -ENOMEM;
}
}
#endif

return 0;
}

static void __exit stmmac_exit(void)
{
#ifdef CONFIG_DEBUG_FS
debugfs_remove_recursive(stmmac_fs_dir);
#endif
}

module_init(stmmac_init)
module_exit(stmmac_exit)

MODULE_DESCRIPTION("STMMAC 10/100/1000 Ethernet device driver");
MODULE_AUTHOR("Giuseppe Cavallaro <peppe.cavallaro@st.com>");
MODULE_LICENSE("GPL");
45 changes: 42 additions & 3 deletions drivers/net/phy/amd-xgbe-phy.c
Original file line number Diff line number Diff line change
Expand Up @@ -755,6 +755,45 @@ static int amd_xgbe_phy_set_mode(struct phy_device *phydev,
return ret;
}

static bool amd_xgbe_phy_use_xgmii_mode(struct phy_device *phydev)
{
if (phydev->autoneg == AUTONEG_ENABLE) {
if (phydev->advertising & ADVERTISED_10000baseKR_Full)
return true;
} else {
if (phydev->speed == SPEED_10000)
return true;
}

return false;
}

static bool amd_xgbe_phy_use_gmii_2500_mode(struct phy_device *phydev)
{
if (phydev->autoneg == AUTONEG_ENABLE) {
if (phydev->advertising & ADVERTISED_2500baseX_Full)
return true;
} else {
if (phydev->speed == SPEED_2500)
return true;
}

return false;
}

static bool amd_xgbe_phy_use_gmii_mode(struct phy_device *phydev)
{
if (phydev->autoneg == AUTONEG_ENABLE) {
if (phydev->advertising & ADVERTISED_1000baseKX_Full)
return true;
} else {
if (phydev->speed == SPEED_1000)
return true;
}

return false;
}

static int amd_xgbe_phy_set_an(struct phy_device *phydev, bool enable,
bool restart)
{
Expand Down Expand Up @@ -1235,11 +1274,11 @@ static int amd_xgbe_phy_config_init(struct phy_device *phydev)
/* Set initial mode - call the mode setting routines
* directly to insure we are properly configured
*/
if (phydev->advertising & SUPPORTED_10000baseKR_Full)
if (amd_xgbe_phy_use_xgmii_mode(phydev))
ret = amd_xgbe_phy_xgmii_mode(phydev);
else if (phydev->advertising & SUPPORTED_1000baseKX_Full)
else if (amd_xgbe_phy_use_gmii_mode(phydev))
ret = amd_xgbe_phy_gmii_mode(phydev);
else if (phydev->advertising & SUPPORTED_2500baseX_Full)
else if (amd_xgbe_phy_use_gmii_2500_mode(phydev))
ret = amd_xgbe_phy_gmii_2500_mode(phydev);
else
ret = -EINVAL;
Expand Down
2 changes: 1 addition & 1 deletion drivers/net/phy/bcm7xxx.c
Original file line number Diff line number Diff line change
Expand Up @@ -404,7 +404,7 @@ static struct phy_driver bcm7xxx_driver[] = {
.name = "Broadcom BCM7425",
.features = PHY_GBIT_FEATURES |
SUPPORTED_Pause | SUPPORTED_Asym_Pause,
.flags = 0,
.flags = PHY_IS_INTERNAL,
.config_init = bcm7xxx_config_init,
.config_aneg = genphy_config_aneg,
.read_status = genphy_read_status,
Expand Down
23 changes: 19 additions & 4 deletions drivers/net/phy/dp83640.c
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
#define PSF_TX 0x1000
#define EXT_EVENT 1
#define CAL_EVENT 7
#define CAL_TRIGGER 7
#define CAL_TRIGGER 1
#define DP83640_N_PINS 12

#define MII_DP83640_MICR 0x11
Expand Down Expand Up @@ -496,7 +496,9 @@ static int ptp_dp83640_enable(struct ptp_clock_info *ptp,
else
evnt |= EVNT_RISE;
}
mutex_lock(&clock->extreg_lock);
ext_write(0, phydev, PAGE5, PTP_EVNT, evnt);
mutex_unlock(&clock->extreg_lock);
return 0;

case PTP_CLK_REQ_PEROUT:
Expand Down Expand Up @@ -532,16 +534,22 @@ static u8 status_frame_src[6] = { 0x08, 0x00, 0x17, 0x0B, 0x6B, 0x0F };

static void enable_status_frames(struct phy_device *phydev, bool on)
{
struct dp83640_private *dp83640 = phydev->priv;
struct dp83640_clock *clock = dp83640->clock;
u16 cfg0 = 0, ver;

if (on)
cfg0 = PSF_EVNT_EN | PSF_RXTS_EN | PSF_TXTS_EN | ENDIAN_FLAG;

ver = (PSF_PTPVER & VERSIONPTP_MASK) << VERSIONPTP_SHIFT;

mutex_lock(&clock->extreg_lock);

ext_write(0, phydev, PAGE5, PSF_CFG0, cfg0);
ext_write(0, phydev, PAGE6, PSF_CFG1, ver);

mutex_unlock(&clock->extreg_lock);

if (!phydev->attached_dev) {
pr_warn("expected to find an attached netdevice\n");
return;
Expand Down Expand Up @@ -838,7 +846,7 @@ static void decode_rxts(struct dp83640_private *dp83640,
list_del_init(&rxts->list);
phy2rxts(phy_rxts, rxts);

spin_lock_irqsave(&dp83640->rx_queue.lock, flags);
spin_lock(&dp83640->rx_queue.lock);
skb_queue_walk(&dp83640->rx_queue, skb) {
struct dp83640_skb_info *skb_info;

Expand All @@ -853,7 +861,7 @@ static void decode_rxts(struct dp83640_private *dp83640,
break;
}
}
spin_unlock_irqrestore(&dp83640->rx_queue.lock, flags);
spin_unlock(&dp83640->rx_queue.lock);

if (!shhwtstamps)
list_add_tail(&rxts->list, &dp83640->rxts);
Expand Down Expand Up @@ -1173,11 +1181,18 @@ static int dp83640_config_init(struct phy_device *phydev)

if (clock->chosen && !list_empty(&clock->phylist))
recalibrate(clock);
else
else {
mutex_lock(&clock->extreg_lock);
enable_broadcast(phydev, clock->page, 1);
mutex_unlock(&clock->extreg_lock);
}

enable_status_frames(phydev, true);

mutex_lock(&clock->extreg_lock);
ext_write(0, phydev, PAGE4, PTP_CTL, PTP_ENABLE);
mutex_unlock(&clock->extreg_lock);

return 0;
}

Expand Down
Loading

0 comments on commit 8f98bcd

Please sign in to comment.