Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/jkirsher/next...
authorDavid S. Miller <davem@davemloft.net>
Thu, 4 Jun 2015 03:19:16 +0000 (20:19 -0700)
committerDavid S. Miller <davem@davemloft.net>
Thu, 4 Jun 2015 03:19:16 +0000 (20:19 -0700)
Jeff Kirsher says:

====================
Intel Wired LAN Driver Updates 2015-06-03

This series contains updates to e1000e only.

Yanir provides 8 fixes and 1 version bump for e1000e.  First fix resolves
a possible unit hang if multiple descriptors are available in the rings
during reset or runtime suspend.  Fixed a warning on SPARC compile based
on a suggested solution from Alex Duyck.  Fixed a logical error, where
a "if" condition under which a flush should occur, was revered.  Fixed
a hardware issue that prevented i219 from working in legacy interrupts
mode.  Fixed the hardware clock configuration and suprious non-linear
increment.  Lastly, fixed a system hang which occurred during execution
of "ethtool -t <NIC>", by disabling MULR for the loopback test to avoid
the hand state.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
12 files changed:
Documentation/devicetree/bindings/net/ti,dp83867.txt [new file with mode: 0644]
drivers/net/ethernet/dec/tulip/uli526x.c
drivers/net/ethernet/mellanox/mlx4/cmd.c
drivers/net/ethernet/mellanox/mlx4/eq.c
drivers/net/ethernet/mellanox/mlx4/main.c
drivers/net/ethernet/micrel/ksz884x.c
drivers/net/phy/Kconfig
drivers/net/phy/Makefile
drivers/net/phy/dp83867.c [new file with mode: 0644]
include/dt-bindings/net/ti-dp83867.h [new file with mode: 0644]
include/uapi/linux/bpf.h
net/core/filter.c

diff --git a/Documentation/devicetree/bindings/net/ti,dp83867.txt b/Documentation/devicetree/bindings/net/ti,dp83867.txt
new file mode 100644 (file)
index 0000000..46bb67a
--- /dev/null
@@ -0,0 +1,19 @@
+* Texas Instruments - dp83867 Giga bit ethernet phy
+
+Required properties:
+       - reg - The ID number for the phy, usually a small integer
+       - ti,rx_int_delay - RGMII Recieve Clock Delay - see dt-bindings/net/ti-dp83867.h
+               for applicable values
+       - ti,tx_int_delay - RGMII Transmit Clock Delay - see dt-bindings/net/ti-dp83867.h
+               for applicable values
+       - ti,fifo_depth - Transmitt FIFO depth- see dt-bindings/net/ti-dp83867.h
+               for applicable values
+
+Example:
+
+       ethernet-phy@0 {
+               reg = <0>;
+               ti,rx_int_delay = <DP83867_RGMIIDCTL_2_25_NS>;
+               ti,tx_int_delay = <DP83867_RGMIIDCTL_2_75_NS>;
+               ti,fifo_depth = <DP83867_PHYCR_FIFO_DEPTH_4_B_NIB>;
+       };
index 2c30c0c..447d092 100644 (file)
@@ -1115,7 +1115,7 @@ static void uli526x_timer(unsigned long data)
                                netif_carrier_off(dev);
                        }
                }
-               db->init=0;
+       db->init = 0;
 
        /* Timer active again */
        db->timer.expires = ULI526X_TIMER_WUT;
index 91d8344..68ae765 100644 (file)
@@ -2917,7 +2917,7 @@ int mlx4_set_vf_mac(struct mlx4_dev *dev, int port, int vf, u64 mac)
        port = mlx4_slaves_closest_port(dev, slave, port);
        s_info = &priv->mfunc.master.vf_admin[slave].vport[port];
        s_info->mac = mac;
-       mlx4_info(dev, "default mac on vf %d port %d to %llX will take afect only after vf restart\n",
+       mlx4_info(dev, "default mac on vf %d port %d to %llX will take effect only after vf restart\n",
                  vf, port, s_info->mac);
        return 0;
 }
index 1116882..aae13ad 100644 (file)
@@ -221,6 +221,7 @@ static void mlx4_slave_event(struct mlx4_dev *dev, int slave,
        slave_event(dev, slave, eqe);
 }
 
+#if defined(CONFIG_SMP)
 static void mlx4_set_eq_affinity_hint(struct mlx4_priv *priv, int vec)
 {
        int hint_err;
@@ -234,6 +235,7 @@ static void mlx4_set_eq_affinity_hint(struct mlx4_priv *priv, int vec)
        if (hint_err)
                mlx4_warn(dev, "irq_set_affinity_hint failed, err %d\n", hint_err);
 }
+#endif
 
 int mlx4_gen_pkey_eqe(struct mlx4_dev *dev, int slave, u8 port)
 {
@@ -1207,8 +1209,8 @@ int mlx4_init_eq_table(struct mlx4_dev *dev)
                                             MLX4_NUM_ASYNC_EQE + MLX4_NUM_SPARE_EQE,
                                             0, &priv->eq_table.eq[MLX4_EQ_ASYNC]);
                } else {
-#ifdef CONFIG_RFS_ACCEL
                        struct mlx4_eq  *eq = &priv->eq_table.eq[i];
+#ifdef CONFIG_RFS_ACCEL
                        int port = find_first_bit(eq->actv_ports.ports,
                                                  dev->caps.num_ports) + 1;
 
index 0dbd704..7d57777 100644 (file)
@@ -2824,6 +2824,7 @@ disable_sriov:
 free_mem:
        dev->persist->num_vfs = 0;
        kfree(dev->dev_vfs);
+        dev->dev_vfs = NULL;
        return dev_flags & ~MLX4_FLAG_MASTER;
 }
 
@@ -2975,6 +2976,7 @@ slave_start:
                                                                  existing_vfs,
                                                                  reset_flow);
 
+                               mlx4_close_fw(dev);
                                mlx4_cmd_cleanup(dev, MLX4_CMD_CLEANUP_ALL);
                                dev->flags = dev_flags;
                                if (!SRIOV_VALID_STATE(dev->flags)) {
index 6f332eb..48d2aec 100644 (file)
@@ -6664,7 +6664,7 @@ static void mib_read_work(struct work_struct *work)
                                wake_up_interruptible(
                                        &hw_priv->counter[i].counter);
                        }
-               } else if (jiffies >= hw_priv->counter[i].time) {
+               } else if (time_after_eq(jiffies, hw_priv->counter[i].time)) {
                        /* Only read MIB counters when the port is connected. */
                        if (media_connected == mib->state)
                                hw_priv->counter[i].read = 1;
index 7c0cb87..cf18940 100644 (file)
@@ -112,6 +112,11 @@ config MICREL_PHY
        ---help---
          Supports the KSZ9021, VSC8201, KS8001 PHYs.
 
+config DP83867_PHY
+       tristate "Drivers for Texas Instruments DP83867 Gigabit PHY"
+       ---help---
+         Currently supports the DP83867 PHY.
+
 config FIXED_PHY
        tristate "Driver for MDIO Bus/PHY emulation with fixed speed/link PHYs"
        depends on PHYLIB
@@ -205,7 +210,6 @@ config MDIO_BCM_UNIMAC
          This hardware can be found in the Broadcom GENET Ethernet MAC
          controllers as well as some Broadcom Ethernet switches such as the
          Starfighter 2 switches.
-
 endif # PHYLIB
 
 config MICREL_KS8995MA
index e97e7f9..fcc25a0 100644 (file)
@@ -22,6 +22,7 @@ obj-$(CONFIG_MDIO_BITBANG)    += mdio-bitbang.o
 obj-$(CONFIG_MDIO_GPIO)                += mdio-gpio.o
 obj-$(CONFIG_NATIONAL_PHY)     += national.o
 obj-$(CONFIG_DP83640_PHY)      += dp83640.o
+obj-$(CONFIG_DP83867_PHY)      += dp83867.o
 obj-$(CONFIG_STE10XP)          += ste10Xp.o
 obj-$(CONFIG_MICREL_PHY)       += micrel.o
 obj-$(CONFIG_MDIO_OCTEON)      += mdio-octeon.o
diff --git a/drivers/net/phy/dp83867.c b/drivers/net/phy/dp83867.c
new file mode 100644 (file)
index 0000000..ef0b4eb
--- /dev/null
@@ -0,0 +1,239 @@
+/*
+ * Driver for the Texas Instruments DP83867 PHY
+ *
+ * Copyright (C) 2015 Texas Instruments Inc.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
+
+#include <linux/ethtool.h>
+#include <linux/kernel.h>
+#include <linux/mii.h>
+#include <linux/module.h>
+#include <linux/of.h>
+#include <linux/phy.h>
+
+#include <dt-bindings/net/ti-dp83867.h>
+
+#define DP83867_PHY_ID         0x2000a231
+#define DP83867_DEVADDR                0x1f
+
+#define MII_DP83867_PHYCTRL    0x10
+#define MII_DP83867_MICR       0x12
+#define MII_DP83867_ISR                0x13
+#define DP83867_CTRL           0x1f
+
+/* Extended Registers */
+#define DP83867_RGMIICTL       0x0032
+#define DP83867_RGMIIDCTL      0x0086
+
+#define DP83867_SW_RESET       BIT(15)
+#define DP83867_SW_RESTART     BIT(14)
+
+/* MICR Interrupt bits */
+#define MII_DP83867_MICR_AN_ERR_INT_EN         BIT(15)
+#define MII_DP83867_MICR_SPEED_CHNG_INT_EN     BIT(14)
+#define MII_DP83867_MICR_DUP_MODE_CHNG_INT_EN  BIT(13)
+#define MII_DP83867_MICR_PAGE_RXD_INT_EN       BIT(12)
+#define MII_DP83867_MICR_AUTONEG_COMP_INT_EN   BIT(11)
+#define MII_DP83867_MICR_LINK_STS_CHNG_INT_EN  BIT(10)
+#define MII_DP83867_MICR_FALSE_CARRIER_INT_EN  BIT(8)
+#define MII_DP83867_MICR_SLEEP_MODE_CHNG_INT_EN        BIT(4)
+#define MII_DP83867_MICR_WOL_INT_EN            BIT(3)
+#define MII_DP83867_MICR_XGMII_ERR_INT_EN      BIT(2)
+#define MII_DP83867_MICR_POL_CHNG_INT_EN       BIT(1)
+#define MII_DP83867_MICR_JABBER_INT_EN         BIT(0)
+
+/* RGMIICTL bits */
+#define DP83867_RGMII_TX_CLK_DELAY_EN          BIT(1)
+#define DP83867_RGMII_RX_CLK_DELAY_EN          BIT(0)
+
+/* PHY CTRL bits */
+#define DP83867_PHYCR_FIFO_DEPTH_SHIFT         14
+
+/* RGMIIDCTL bits */
+#define DP83867_RGMII_TX_CLK_DELAY_SHIFT       4
+
+struct dp83867_private {
+       int rx_id_delay;
+       int tx_id_delay;
+       int fifo_depth;
+};
+
+static int dp83867_ack_interrupt(struct phy_device *phydev)
+{
+       int err = phy_read(phydev, MII_DP83867_ISR);
+
+       if (err < 0)
+               return err;
+
+       return 0;
+}
+
+static int dp83867_config_intr(struct phy_device *phydev)
+{
+       int micr_status;
+
+       if (phydev->interrupts == PHY_INTERRUPT_ENABLED) {
+               micr_status = phy_read(phydev, MII_DP83867_MICR);
+               if (micr_status < 0)
+                       return micr_status;
+
+               micr_status |=
+                       (MII_DP83867_MICR_AN_ERR_INT_EN |
+                       MII_DP83867_MICR_SPEED_CHNG_INT_EN |
+                       MII_DP83867_MICR_DUP_MODE_CHNG_INT_EN |
+                       MII_DP83867_MICR_SLEEP_MODE_CHNG_INT_EN);
+
+               return phy_write(phydev, MII_DP83867_MICR, micr_status);
+       }
+
+       micr_status = 0x0;
+       return phy_write(phydev, MII_DP83867_MICR, micr_status);
+}
+
+#ifdef CONFIG_OF_MDIO
+static int dp83867_of_init(struct phy_device *phydev)
+{
+       struct dp83867_private *dp83867 = phydev->priv;
+       struct device *dev = &phydev->dev;
+       struct device_node *of_node = dev->of_node;
+       int ret;
+
+       if (!of_node && dev->parent->of_node)
+               of_node = dev->parent->of_node;
+
+       if (!phydev->dev.of_node)
+               return -ENODEV;
+
+       ret = of_property_read_u32(of_node, "ti,rx_int_delay",
+                                  &dp83867->rx_id_delay);
+       if (ret)
+               return ret;
+
+       ret = of_property_read_u32(of_node, "ti,tx_int_delay",
+                                  &dp83867->tx_id_delay);
+       if (ret)
+               return ret;
+
+       ret = of_property_read_u32(of_node, "ti,fifo_depth",
+                                  &dp83867->fifo_depth);
+       if (ret)
+               return ret;
+
+       return 0;
+}
+#else
+static int dp83867_of_init(struct phy_device *phydev)
+{
+       return 0;
+}
+#endif /* CONFIG_OF_MDIO */
+
+static int dp83867_config_init(struct phy_device *phydev)
+{
+       struct dp83867_private *dp83867;
+       int ret;
+       u16 val, delay;
+
+       if (!phydev->priv) {
+               dp83867 = devm_kzalloc(&phydev->dev, sizeof(*dp83867),
+                                      GFP_KERNEL);
+               if (!dp83867)
+                       return -ENOMEM;
+
+               phydev->priv = dp83867;
+               ret = dp83867_of_init(phydev);
+               if (ret)
+                       return ret;
+       } else {
+               dp83867 = (struct dp83867_private *)phydev->priv;
+       }
+
+       if (phy_interface_is_rgmii(phydev)) {
+               ret = phy_write(phydev, MII_DP83867_PHYCTRL,
+                       (dp83867->fifo_depth << DP83867_PHYCR_FIFO_DEPTH_SHIFT));
+               if (ret)
+                       return ret;
+       }
+
+       if ((phydev->interface >= PHY_INTERFACE_MODE_RGMII_ID) ||
+           (phydev->interface <= PHY_INTERFACE_MODE_RGMII_RXID)) {
+               val = phy_read_mmd_indirect(phydev, DP83867_RGMIICTL,
+                                           DP83867_DEVADDR, phydev->addr);
+
+               if (phydev->interface == PHY_INTERFACE_MODE_RGMII_ID)
+                       val |= (DP83867_RGMII_TX_CLK_DELAY_EN | DP83867_RGMII_RX_CLK_DELAY_EN);
+
+               if (phydev->interface == PHY_INTERFACE_MODE_RGMII_TXID)
+                       val |= DP83867_RGMII_TX_CLK_DELAY_EN;
+
+               if (phydev->interface == PHY_INTERFACE_MODE_RGMII_RXID)
+                       val |= DP83867_RGMII_RX_CLK_DELAY_EN;
+
+               phy_write_mmd_indirect(phydev, DP83867_RGMIICTL,
+                                      DP83867_DEVADDR, phydev->addr, val);
+
+               delay = (dp83867->rx_id_delay |
+                       (dp83867->tx_id_delay << DP83867_RGMII_TX_CLK_DELAY_SHIFT));
+
+               phy_write_mmd_indirect(phydev, DP83867_RGMIIDCTL,
+                                      DP83867_DEVADDR, phydev->addr, delay);
+       }
+
+       return 0;
+}
+
+static int dp83867_phy_reset(struct phy_device *phydev)
+{
+       int err;
+
+       err = phy_write(phydev, DP83867_CTRL, DP83867_SW_RESET);
+       if (err < 0)
+               return err;
+
+       return dp83867_config_init(phydev);
+}
+
+static struct phy_driver dp83867_driver[] = {
+       {
+               .phy_id         = DP83867_PHY_ID,
+               .phy_id_mask    = 0xfffffff0,
+               .name           = "TI DP83867",
+               .features       = PHY_GBIT_FEATURES,
+               .flags          = PHY_HAS_INTERRUPT,
+
+               .config_init    = dp83867_config_init,
+               .soft_reset     = dp83867_phy_reset,
+
+               /* IRQ related */
+               .ack_interrupt  = dp83867_ack_interrupt,
+               .config_intr    = dp83867_config_intr,
+
+               .config_aneg    = genphy_config_aneg,
+               .read_status    = genphy_read_status,
+               .suspend        = genphy_suspend,
+               .resume         = genphy_resume,
+
+               .driver         = {.owner = THIS_MODULE,}
+       },
+};
+module_phy_driver(dp83867_driver);
+
+static struct mdio_device_id __maybe_unused dp83867_tbl[] = {
+       { DP83867_PHY_ID, 0xfffffff0 },
+       { }
+};
+
+MODULE_DEVICE_TABLE(mdio, dp83867_tbl);
+
+MODULE_DESCRIPTION("Texas Instruments DP83867 PHY driver");
+MODULE_AUTHOR("Dan Murphy <dmurphy@ti.com");
+MODULE_LICENSE("GPL");
diff --git a/include/dt-bindings/net/ti-dp83867.h b/include/dt-bindings/net/ti-dp83867.h
new file mode 100644 (file)
index 0000000..172744a
--- /dev/null
@@ -0,0 +1,45 @@
+/*
+ * Device Tree constants for the Texas Instruments DP83867 PHY
+ *
+ * Author: Dan Murphy <dmurphy@ti.com>
+ *
+ * Copyright:   (C) 2015 Texas Instruments, Inc.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ */
+
+#ifndef _DT_BINDINGS_TI_DP83867_H
+#define _DT_BINDINGS_TI_DP83867_H
+
+/* PHY CTRL bits */
+#define DP83867_PHYCR_FIFO_DEPTH_3_B_NIB       0x00
+#define DP83867_PHYCR_FIFO_DEPTH_4_B_NIB       0x01
+#define DP83867_PHYCR_FIFO_DEPTH_6_B_NIB       0x02
+#define DP83867_PHYCR_FIFO_DEPTH_8_B_NIB       0x03
+
+/* RGMIIDCTL internal delay for rx and tx */
+#define        DP83867_RGMIIDCTL_250_PS        0x0
+#define        DP83867_RGMIIDCTL_500_PS        0x1
+#define        DP83867_RGMIIDCTL_750_PS        0x2
+#define        DP83867_RGMIIDCTL_1_NS          0x3
+#define        DP83867_RGMIIDCTL_1_25_NS       0x4
+#define        DP83867_RGMIIDCTL_1_50_NS       0x5
+#define        DP83867_RGMIIDCTL_1_75_NS       0x6
+#define        DP83867_RGMIIDCTL_2_00_NS       0x7
+#define        DP83867_RGMIIDCTL_2_25_NS       0x8
+#define        DP83867_RGMIIDCTL_2_50_NS       0x9
+#define        DP83867_RGMIIDCTL_2_75_NS       0xa
+#define        DP83867_RGMIIDCTL_3_00_NS       0xb
+#define        DP83867_RGMIIDCTL_3_25_NS       0xc
+#define        DP83867_RGMIIDCTL_3_50_NS       0xd
+#define        DP83867_RGMIIDCTL_3_75_NS       0xe
+#define        DP83867_RGMIIDCTL_4_00_NS       0xf
+
+#endif
index 72f3080..42aa19a 100644 (file)
@@ -220,6 +220,16 @@ enum bpf_func_id {
         * Return: 0 on success
         */
        BPF_FUNC_tail_call,
+
+       /**
+        * bpf_clone_redirect(skb, ifindex, flags) - redirect to another netdev
+        * @skb: pointer to skb
+        * @ifindex: ifindex of the net device
+        * @flags: bit 0 - if set, redirect to ingress instead of egress
+        *         other bits - reserved
+        * Return: 0 on success
+        */
+       BPF_FUNC_clone_redirect,
        __BPF_FUNC_MAX_ID,
 };
 
index b78a010..64c121c 100644 (file)
@@ -46,6 +46,7 @@
 #include <linux/seccomp.h>
 #include <linux/if_vlan.h>
 #include <linux/bpf.h>
+#include <net/sch_generic.h>
 
 /**
  *     sk_filter - run a packet through a socket filter
@@ -1407,6 +1408,43 @@ const struct bpf_func_proto bpf_l4_csum_replace_proto = {
        .arg5_type      = ARG_ANYTHING,
 };
 
+#define BPF_IS_REDIRECT_INGRESS(flags) ((flags) & 1)
+
+static u64 bpf_clone_redirect(u64 r1, u64 ifindex, u64 flags, u64 r4, u64 r5)
+{
+       struct sk_buff *skb = (struct sk_buff *) (long) r1, *skb2;
+       struct net_device *dev;
+
+       dev = dev_get_by_index_rcu(dev_net(skb->dev), ifindex);
+       if (unlikely(!dev))
+               return -EINVAL;
+
+       if (unlikely(!(dev->flags & IFF_UP)))
+               return -EINVAL;
+
+       skb2 = skb_clone(skb, GFP_ATOMIC);
+       if (unlikely(!skb2))
+               return -ENOMEM;
+
+       if (G_TC_AT(skb2->tc_verd) & AT_INGRESS)
+               skb_push(skb2, skb2->mac_len);
+
+       if (BPF_IS_REDIRECT_INGRESS(flags))
+               return dev_forward_skb(dev, skb2);
+
+       skb2->dev = dev;
+       return dev_queue_xmit(skb2);
+}
+
+const struct bpf_func_proto bpf_clone_redirect_proto = {
+       .func           = bpf_clone_redirect,
+       .gpl_only       = false,
+       .ret_type       = RET_INTEGER,
+       .arg1_type      = ARG_PTR_TO_CTX,
+       .arg2_type      = ARG_ANYTHING,
+       .arg3_type      = ARG_ANYTHING,
+};
+
 static const struct bpf_func_proto *
 sk_filter_func_proto(enum bpf_func_id func_id)
 {
@@ -1440,6 +1478,8 @@ tc_cls_act_func_proto(enum bpf_func_id func_id)
                return &bpf_l3_csum_replace_proto;
        case BPF_FUNC_l4_csum_replace:
                return &bpf_l4_csum_replace_proto;
+       case BPF_FUNC_clone_redirect:
+               return &bpf_clone_redirect_proto;
        default:
                return sk_filter_func_proto(func_id);
        }