* [PATCH v2 4/4] ARM: dts: Enable emac node on the rk3188-radxarock boards
From: Romain Perier @ 2014-09-08 17:14 UTC (permalink / raw)
To: heiko; +Cc: linux-rockchip, linux-arm-kernel, netdev, devicetree, arnd
In-Reply-To: <1410196490-5646-1-git-send-email-romain.perier@gmail.com>
This enables EMAC Rockchip support on radxa rock boards.
Signed-off-by: Romain Perier <romain.perier@gmail.com>
---
arch/arm/boot/dts/rk3188-radxarock.dts | 22 ++++++++++++++++++++++
1 file changed, 22 insertions(+)
diff --git a/arch/arm/boot/dts/rk3188-radxarock.dts b/arch/arm/boot/dts/rk3188-radxarock.dts
index 5e4e3c23..d63d685 100644
--- a/arch/arm/boot/dts/rk3188-radxarock.dts
+++ b/arch/arm/boot/dts/rk3188-radxarock.dts
@@ -76,6 +76,22 @@
};
};
+&emac {
+ status = "okay";
+
+ pinctrl-names = "default";
+ pinctrl-0 = <&emac_xfer>, <&emac_mdio>, <&phy_int>;
+
+ phy = <&phy0>;
+ phy-supply = <&vcc_rmii>;
+
+ phy0: ethernet-phy@0 {
+ reg = <0>;
+ interrupt-parent = <&gpio3>;
+ interrupts = <26 IRQ_TYPE_LEVEL_LOW>;
+ };
+};
+
&i2c1 {
status = "okay";
clock-frequency = <400000>;
@@ -201,6 +217,12 @@
};
};
+ lan8720a {
+ phy_int: phy-int {
+ rockchip,pins = <RK_GPIO3 26 RK_FUNC_GPIO &pcfg_pull_up>;
+ };
+ };
+
ir-receiver {
ir_recv_pin: ir-recv-pin {
rockchip,pins = <RK_GPIO0 10 RK_FUNC_GPIO &pcfg_pull_none>;
--
1.9.1
^ permalink raw reply related
* [PATCH v2 3/4] ARM: dts: Add emac nodes to the rk3188 device tree
From: Romain Perier @ 2014-09-08 17:14 UTC (permalink / raw)
To: heiko; +Cc: linux-rockchip, linux-arm-kernel, netdev, devicetree, arnd
In-Reply-To: <1410196490-5646-1-git-send-email-romain.perier@gmail.com>
This adds support for EMAC Rockchip driver on RK3188 SoCs.
Signed-off-by: Romain Perier <romain.perier@gmail.com>
---
arch/arm/boot/dts/rk3188.dtsi | 22 ++++++++++++++++++++++
arch/arm/boot/dts/rk3xxx.dtsi | 17 +++++++++++++++++
2 files changed, 39 insertions(+)
diff --git a/arch/arm/boot/dts/rk3188.dtsi b/arch/arm/boot/dts/rk3188.dtsi
index ee801a9..7f25bc5 100644
--- a/arch/arm/boot/dts/rk3188.dtsi
+++ b/arch/arm/boot/dts/rk3188.dtsi
@@ -147,6 +147,24 @@
bias-disable;
};
+ emac {
+ emac_xfer: emac-xfer {
+ rockchip,pins = <RK_GPIO3 16 RK_FUNC_2 &pcfg_pull_none>, /* tx_en */
+ <RK_GPIO3 17 RK_FUNC_2 &pcfg_pull_none>, /* txd1 */
+ <RK_GPIO3 18 RK_FUNC_2 &pcfg_pull_none>, /* txd0 */
+ <RK_GPIO3 19 RK_FUNC_2 &pcfg_pull_none>, /* rxd0 */
+ <RK_GPIO3 20 RK_FUNC_2 &pcfg_pull_none>, /* rxd1 */
+ <RK_GPIO3 21 RK_FUNC_2 &pcfg_pull_none>, /* mac_clk */
+ <RK_GPIO3 22 RK_FUNC_2 &pcfg_pull_none>, /* rx_err */
+ <RK_GPIO3 23 RK_FUNC_2 &pcfg_pull_none>; /* crs_dvalid */
+ };
+
+ emac_mdio: emac-mdio {
+ rockchip,pins = <RK_GPIO3 24 RK_FUNC_2 &pcfg_pull_none>,
+ <RK_GPIO3 25 RK_FUNC_2 &pcfg_pull_none>;
+ };
+ };
+
i2c0 {
i2c0_xfer: i2c0-xfer {
rockchip,pins = <RK_GPIO1 24 RK_FUNC_1 &pcfg_pull_none>,
@@ -323,6 +341,10 @@
};
};
+&emac {
+ compatible = "rockchip,rk3188-emac";
+};
+
&global_timer {
interrupts = <GIC_PPI 11 0xf04>;
};
diff --git a/arch/arm/boot/dts/rk3xxx.dtsi b/arch/arm/boot/dts/rk3xxx.dtsi
index 8caf85d..208b1df 100644
--- a/arch/arm/boot/dts/rk3xxx.dtsi
+++ b/arch/arm/boot/dts/rk3xxx.dtsi
@@ -91,6 +91,23 @@
status = "disabled";
};
+ emac: ethernet@10204000 {
+ compatible = "snps,arc-emac";
+ reg = <0x10204000 0x3c>;
+ interrupts = <GIC_SPI 19 IRQ_TYPE_LEVEL_HIGH>;
+ #address-cells = <1>;
+ #size-cells = <0>;
+
+ rockchip,grf = <&grf>;
+
+ clocks = <&cru HCLK_EMAC>, <&cru SCLK_MAC>;
+ clock-names = "hclk", "macref";
+ max-speed = <100>;
+ phy-mode = "rmii";
+
+ status = "disabled";
+ };
+
mmc0: dwmmc@10214000 {
compatible = "rockchip,rk2928-dw-mshc";
reg = <0x10214000 0x1000>;
--
1.9.1
^ permalink raw reply related
* [PATCH v2 2/4] dt-bindings: Document EMAC Rockchip
From: Romain Perier @ 2014-09-08 17:14 UTC (permalink / raw)
To: heiko; +Cc: linux-rockchip, linux-arm-kernel, netdev, devicetree, arnd
In-Reply-To: <1410196490-5646-1-git-send-email-romain.perier@gmail.com>
This adds the necessary binding documentation for the EMAC Rockchip platform
driver found in RK3066 and RK3188 SoCs.
Signed-off-by: Romain Perier <romain.perier@gmail.com>
---
.../devicetree/bindings/net/emac_rockchip.txt | 50 ++++++++++++++++++++++
1 file changed, 50 insertions(+)
create mode 100644 Documentation/devicetree/bindings/net/emac_rockchip.txt
diff --git a/Documentation/devicetree/bindings/net/emac_rockchip.txt b/Documentation/devicetree/bindings/net/emac_rockchip.txt
new file mode 100644
index 0000000..8dc1c79
--- /dev/null
+++ b/Documentation/devicetree/bindings/net/emac_rockchip.txt
@@ -0,0 +1,50 @@
+* ARC EMAC 10/100 Ethernet platform driver for Rockchip Rk3066/RK3188 SoCs
+
+Required properties:
+- compatible: Should be "rockchip,rk3066-emac" or "rockchip,rk3188-emac"
+ according to the target SoC.
+- reg: Address and length of the register set for the device
+- interrupts: Should contain the EMAC interrupts
+- rockchip,grf: phandle to the syscon grf used to control speed and mode
+ for emac.
+- phy: see ethernet.txt file in the same directory.
+- phy-mode: see ethernet.txt file in the same directory.
+
+Optional properties:
+- phy-supply: phandle to a regulator if the PHY needs one
+
+Clock handling:
+- clocks: Must contain an entry for each entry in clock-names.
+- clock-names: Shall be "hclk" for the host clock needed to calculate and set
+ polling period of EMAC and "macref" for the reference clock needed to transfer
+ data to and from the phy.
+
+Child nodes of the driver are the individual PHY devices connected to the
+MDIO bus. They must have a "reg" property given the PHY address on the MDIO bus.
+
+Examples:
+
+ethernet@10204000 {
+ compatible = "rockchip,rk3188-emac";
+ reg = <0xc0fc2000 0x3c>;
+ interrupts = <6>;
+ mac-address = [ 00 11 22 33 44 55 ];
+
+ clocks = <&cru HCLK_EMAC>, <&cru SCLK_MAC>;
+ clock-names = "hclk", "macref";
+
+ pinctrl-names = "default";
+ pinctrl-0 = <&emac_xfer>, <&emac_mdio>, <&phy_int>;
+
+ rockchip,grf = <&grf>;
+
+ phy = <&phy0>;
+ phy-mode = "rmii";
+ phy-supply = <&vcc_rmii>;
+
+ #address-cells = <1>;
+ #size-cells = <0>;
+ phy0: ethernet-phy@0 {
+ reg = <1>;
+ };
+};
--
1.9.1
^ permalink raw reply related
* [PATCH v6 1/4] ethernet: arc: Add support for Rockchip SoC layer device tree bindings
From: Romain Perier @ 2014-09-08 17:14 UTC (permalink / raw)
To: heiko; +Cc: linux-rockchip, linux-arm-kernel, netdev, devicetree, arnd
This patch defines a platform glue layer for Rockchip SoCs which
support arc-emac driver. It ensures that regulator for the rmii is on
before trying to connect to the ethernet controller. It applies right
speed and mode changes to the grf when ethernet settings change.
Signed-off-by: Romain Perier <romain.perier@gmail.com>
---
drivers/net/ethernet/arc/Kconfig | 10 ++
drivers/net/ethernet/arc/Makefile | 1 +
drivers/net/ethernet/arc/emac.h | 4 +-
drivers/net/ethernet/arc/emac_main.c | 2 +
drivers/net/ethernet/arc/emac_rockchip.c | 228 +++++++++++++++++++++++++++++++
5 files changed, 244 insertions(+), 1 deletion(-)
create mode 100644 drivers/net/ethernet/arc/emac_rockchip.c
diff --git a/drivers/net/ethernet/arc/Kconfig b/drivers/net/ethernet/arc/Kconfig
index 89e04fd..8e262e2 100644
--- a/drivers/net/ethernet/arc/Kconfig
+++ b/drivers/net/ethernet/arc/Kconfig
@@ -32,4 +32,14 @@ config ARC_EMAC
non-standard on-chip ethernet device ARC EMAC 10/100 is used.
Say Y here if you have such a board. If unsure, say N.
+config EMAC_ROCKCHIP
+ tristate "Rockchip EMAC support"
+ select ARC_EMAC_CORE
+ depends on OF_IRQ && OF_NET && REGULATOR
+ ---help---
+ Support for Rockchip RK3066/RK3188 EMAC ethernet controllers.
+ This selects Rockchip SoC glue layer support for the
+ emac device driver. This driver is used for RK3066/RK3188
+ EMAC ethernet controller.
+
endif # NET_VENDOR_ARC
diff --git a/drivers/net/ethernet/arc/Makefile b/drivers/net/ethernet/arc/Makefile
index 241bb80..79108af 100644
--- a/drivers/net/ethernet/arc/Makefile
+++ b/drivers/net/ethernet/arc/Makefile
@@ -5,3 +5,4 @@
arc_emac-objs := emac_main.o emac_mdio.o
obj-$(CONFIG_ARC_EMAC_CORE) += arc_emac.o
obj-$(CONFIG_ARC_EMAC) += emac_arc.o
+obj-$(CONFIG_EMAC_ROCKCHIP) += emac_rockchip.o
diff --git a/drivers/net/ethernet/arc/emac.h b/drivers/net/ethernet/arc/emac.h
index eb2ba67..dae1ac3 100644
--- a/drivers/net/ethernet/arc/emac.h
+++ b/drivers/net/ethernet/arc/emac.h
@@ -123,9 +123,11 @@ struct buffer_state {
* @speed: PHY's last set speed.
*/
struct arc_emac_priv {
- /* Devices */
const char *drv_name;
const char *drv_version;
+ void (*set_mac_speed)(void *priv, unsigned int speed);
+
+ /* Devices */
struct device *dev;
struct phy_device *phy_dev;
struct mii_bus *bus;
diff --git a/drivers/net/ethernet/arc/emac_main.c b/drivers/net/ethernet/arc/emac_main.c
index b35c69e..a08f343 100644
--- a/drivers/net/ethernet/arc/emac_main.c
+++ b/drivers/net/ethernet/arc/emac_main.c
@@ -48,6 +48,8 @@ static void arc_emac_adjust_link(struct net_device *ndev)
if (priv->speed != phy_dev->speed) {
priv->speed = phy_dev->speed;
state_changed = 1;
+ if (priv->set_mac_speed)
+ priv->set_mac_speed(priv, priv->speed);
}
if (priv->duplex != phy_dev->duplex) {
diff --git a/drivers/net/ethernet/arc/emac_rockchip.c b/drivers/net/ethernet/arc/emac_rockchip.c
new file mode 100644
index 0000000..51d0585
--- /dev/null
+++ b/drivers/net/ethernet/arc/emac_rockchip.c
@@ -0,0 +1,228 @@
+/**
+ * emac-rockchip.c - Rockchip EMAC specific glue layer
+ *
+ * Copyright (C) 2014 Romain Perier <romain.perier@gmail.com>
+ *
+ * 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, or
+ * (at your option) any later version.
+ *
+ * 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/etherdevice.h>
+#include <linux/mfd/syscon.h>
+#include <linux/module.h>
+#include <linux/of_net.h>
+#include <linux/platform_device.h>
+#include <linux/regmap.h>
+#include <linux/regulator/consumer.h>
+
+#include "emac.h"
+
+#define DRV_NAME "rockchip_emac"
+#define DRV_VERSION "1.0"
+
+#define GRF_MODE_MII (1UL << 0)
+#define GRF_MODE_RMII (0UL << 0)
+#define GRF_SPEED_10M (0UL << 1)
+#define GRF_SPEED_100M (1UL << 1)
+#define GRF_SPEED_ENABLE_BIT (1UL << 17)
+#define GRF_MODE_ENABLE_BIT (1UL << 16)
+
+struct emac_rockchip_soc_data {
+ int grf_offset;
+};
+
+struct rockchip_priv_data {
+ struct arc_emac_priv emac;
+ struct regmap *grf;
+ const struct emac_rockchip_soc_data *soc_data;
+ struct regulator *regulator;
+ struct clk *refclk;
+};
+
+static void emac_rockchip_set_mac_speed(void *priv, unsigned int speed)
+{
+ struct rockchip_priv_data *emac = priv;
+ u32 data;
+ int err = 0;
+
+ /* write-enable bits */
+ data = GRF_SPEED_ENABLE_BIT;
+
+ switch(speed) {
+ case 10:
+ data |= GRF_SPEED_10M;
+ break;
+ case 100:
+ data |= GRF_SPEED_100M;
+ break;
+ default:
+ pr_err("speed %u not supported\n", speed);
+ return;
+ }
+
+ err = regmap_write(emac->grf, emac->soc_data->grf_offset, data);
+ if (err)
+ pr_err("unable to apply speed %u to grf (%d)\n", speed, err);
+}
+
+static const struct emac_rockchip_soc_data emac_rockchip_dt_data[] = {
+ { .grf_offset = 0x154 }, /* rk3066 */
+ { .grf_offset = 0x0a4 }, /* rk3188 */
+};
+
+static const struct of_device_id emac_rockchip_dt_ids[] = {
+ { .compatible = "rockchip,rk3066-emac", .data = &emac_rockchip_dt_data[0] },
+ { .compatible = "rockchip,rk3188-emac", .data = &emac_rockchip_dt_data[1] },
+ { /* Sentinel */ }
+};
+
+MODULE_DEVICE_TABLE(of, emac_rockchip_dt_ids);
+
+static int emac_rockchip_probe(struct platform_device *pdev)
+{
+ struct device *dev = &pdev->dev;
+ struct net_device *ndev;
+ struct rockchip_priv_data *priv;
+ const struct of_device_id *match;
+ u32 data;
+ int err, interface;
+
+ if (!pdev->dev.of_node)
+ return -ENODEV;
+
+ ndev = alloc_etherdev(sizeof(struct rockchip_priv_data));
+ if (!ndev)
+ return -ENOMEM;
+ platform_set_drvdata(pdev, ndev);
+ SET_NETDEV_DEV(ndev, dev);
+
+ priv = netdev_priv(ndev);
+ priv->emac.drv_name = DRV_NAME;
+ priv->emac.drv_version = DRV_VERSION;
+ priv->emac.set_mac_speed = emac_rockchip_set_mac_speed;
+
+ interface = of_get_phy_mode(dev->of_node);
+
+ /* RK3066 and RK3188 SoCs only support RMII */
+ if (interface != PHY_INTERFACE_MODE_RMII) {
+ dev_err(dev, "unsupported phy interface mode %d\n", interface);
+ err = -ENOTSUPP;
+ goto out_netdev;
+ }
+
+ priv->grf = syscon_regmap_lookup_by_phandle(dev->of_node, "rockchip,grf");
+ if (IS_ERR(priv->grf)) {
+ dev_err(dev, "failed to retrieve global register file (%ld)\n", PTR_ERR(priv->grf));
+ err = PTR_ERR(priv->grf);
+ goto out_netdev;
+ }
+
+ match = of_match_node(emac_rockchip_dt_ids, dev->of_node);
+ priv->soc_data = match->data;
+
+ priv->emac.clk = devm_clk_get(dev, "hclk");
+ if (IS_ERR(priv->emac.clk)) {
+ dev_err(dev, "failed to retrieve host clock (%ld)\n", PTR_ERR(priv->emac.clk));
+ err = PTR_ERR(priv->emac.clk);
+ goto out_netdev;
+ }
+
+ priv->refclk = devm_clk_get(dev, "macref");
+ if (IS_ERR(priv->refclk)) {
+ dev_err(dev, "failed to retrieve reference clock (%ld)\n", PTR_ERR(priv->refclk));
+ err = PTR_ERR(priv->refclk);
+ goto out_netdev;
+ }
+
+ err = clk_prepare_enable(priv->refclk);
+ if (err) {
+ dev_err(dev, "failed to enable reference clock (%d)\n", err);
+ goto out_netdev;
+ }
+
+ /* Optional regulator for PHY */
+ priv->regulator = devm_regulator_get_optional(dev, "phy");
+ if (IS_ERR(priv->regulator)) {
+ if (PTR_ERR(priv->regulator) == -EPROBE_DEFER)
+ return -EPROBE_DEFER;
+ dev_err(dev, "no regulator found\n");
+ priv->regulator = NULL;
+ }
+
+ if (priv->regulator) {
+ err = regulator_enable(priv->regulator);
+ if (err) {
+ dev_err(dev, "failed to enable phy-supply (%d)\n", err);
+ goto out_clk_disable;
+ }
+ }
+
+ err = arc_emac_probe(ndev, interface);
+ if (err)
+ goto out_regulator_disable;
+
+ /* write-enable bits */
+ data = GRF_MODE_ENABLE_BIT | GRF_SPEED_ENABLE_BIT;
+
+ data |= GRF_SPEED_100M;
+ data |= GRF_MODE_RMII;
+
+ err = regmap_write(priv->grf, priv->soc_data->grf_offset, data);
+ if (err) {
+ dev_err(dev, "unable to apply initial settings to grf (%d)\n", err);
+ goto out_regulator_disable;
+ }
+
+ /* RMII interface needs always a rate of 50MHz */
+ err = clk_set_rate(priv->refclk, 50000000);
+ if (err)
+ dev_err(dev, "failed to change reference clock rate (%d)\n", err);
+ return 0;
+
+out_regulator_disable:
+ if (priv->regulator)
+ regulator_disable(priv->regulator);
+out_clk_disable:
+ clk_disable_unprepare(priv->refclk);
+out_netdev:
+ free_netdev(ndev);
+ return err;
+}
+
+static int emac_rockchip_remove(struct platform_device *pdev)
+{
+ struct net_device *ndev = platform_get_drvdata(pdev);
+ struct rockchip_priv_data *priv = netdev_priv(ndev);
+ int err;
+
+ clk_disable_unprepare(priv->refclk);
+
+ if (priv->regulator)
+ regulator_disable(priv->regulator);
+
+ err = arc_emac_remove(ndev);
+ free_netdev(ndev);
+ return err;
+}
+
+static struct platform_driver emac_rockchip_driver = {
+ .probe = emac_rockchip_probe,
+ .remove = emac_rockchip_remove,
+ .driver = {
+ .name = DRV_NAME,
+ .of_match_table = emac_rockchip_dt_ids,
+ },
+};
+
+module_platform_driver(emac_rockchip_driver);
+
+MODULE_AUTHOR("Romain Perier <romain.perier@gmail.com>");
+MODULE_DESCRIPTION("Rockchip EMAC platform driver");
+MODULE_LICENSE("GPL");
--
1.9.1
^ permalink raw reply related
* Re: [RFC PATCH net-next] ip6: Do not expire uncached routes for mtu invalidation
From: Alex Gartrell @ 2014-09-08 17:12 UTC (permalink / raw)
To: Eric Dumazet; +Cc: davem, edumazet, netdev, kernel-team, ps
In-Reply-To: <1410172253.11872.87.camel@edumazet-glaptop2.roam.corp.google.com>
Thank you for taking a look, Eric.
I'll admit that I have a distinct lack of confidence that I've got the
right solution to the problem here, but I've made it about as far as I
can without getting your collective comments, so it's much appreciated.
On 9/8/14 3:30 AM, Eric Dumazet wrote:
> On Mon, 2014-09-08 at 01:34 -0700, Alex Gartrell wrote:
>> diff --git a/include/net/ip6_fib.h b/include/net/ip6_fib.h
>> index 9bcb220..2f0d4d0 100644
>> --- a/include/net/ip6_fib.h
>> +++ b/include/net/ip6_fib.h
>> @@ -184,7 +184,8 @@ static inline void rt6_update_expires(struct rt6_info *rt0, int timeout)
>> rt0->dst.expires = rt->dst.expires;
>>
>> dst_set_expires(&rt0->dst, timeout);
>> - rt0->rt6i_flags |= RTF_EXPIRES;
>> + if (rt0->rt6i_flags & (RTF_CACHE | RTF_EXPIRES))
>> + rt0->rt6i_flags |= RTF_EXPIRES;
>
> This looks wrong. What could be the point of settinf RTF_EXPIRES if its
> already set ?
>
This is a good point. It was clearer to me at the time to include it
(more similar to the old implementation which set the bit
unconditionally), but I don't really care.
>> }
>>
>> static inline void rt6_set_from(struct rt6_info *rt, struct rt6_info *from)
>> diff --git a/net/ipv6/route.c b/net/ipv6/route.c
>> index f74b041..a509a06 100644
>> --- a/net/ipv6/route.c
>> +++ b/net/ipv6/route.c
>> @@ -947,8 +947,19 @@ restart:
>> nrt = rt6_alloc_cow(rt, &fl6->daddr, &fl6->saddr);
>> else if (!(rt->dst.flags & DST_HOST))
>> nrt = rt6_alloc_clone(rt, &fl6->daddr);
>> - else
>> + else {
>> + if (!(rt->rt6i_flags & RTF_EXPIRES) && rt->dst.expires &&
>> + time_after(jiffies, rt->dst.expires)) {
>> + /* Uncached routes may have expires set if we
>> + * intend to expire the MTU but not the dest
>> + * itself. In that case, we should reset the mtu
>> + * before handing it back */
>> + dst_metric_set(&rt->dst, RTAX_MTU, 0);
>> + rt6_clean_expires(rt);
>> + rt->rt6i_flags &= ~RTF_MODIFIED;
>
> Many cpus can perform this at the same time on same route, this looks
> racy.
Initially I was just going to agree with you here, but taking another
look at ip_vs_xmit at least, there doesn't appear to be any special
locking before invoking ->update_pmtu, which is playing with rt6i_flags
and dst.expires as well. Is that racy as well or is there something
else I'm missing here?
There are other ways to skin this particular cat though, and I've got no
specific attachment to any of them. The most logical thing to do IMO is
clone the route when it may be necessary to do so, but given the fact
that that was very deliberately undone in 7343ff3 "ipv6: Don't create
clones of host routes," I'm not sure that it's the right thing to do or
that it won't require major surgery.
Thanks again,
--
Alex Gartrell <agartrell@fb.com>
^ permalink raw reply
* Re: [PATCH net-next] skb: Add documentation for skb_clone_sk
From: Eric Dumazet @ 2014-09-08 17:11 UTC (permalink / raw)
To: Alexander Duyck; +Cc: netdev, richardcochran, davem
In-Reply-To: <20140908161748.13099.29093.stgit@ahduyck-bv4.jf.intel.com>
On Mon, 2014-09-08 at 12:18 -0400, Alexander Duyck wrote:
> This change adds some documentation to the call skb_clone_sk. This is
> meant to help clarify the purpose of the function for other developers.
>
> Signed-off-by: Alexander Duyck <alexander.h.duyck@intel.com>
> ---
> net/core/skbuff.c | 11 +++++++++++
> 1 file changed, 11 insertions(+)
>
> diff --git a/net/core/skbuff.c b/net/core/skbuff.c
> index a18dfb0..3f83a8a 100644
> --- a/net/core/skbuff.c
> +++ b/net/core/skbuff.c
> @@ -3511,6 +3511,17 @@ struct sk_buff *sock_dequeue_err_skb(struct sock *sk)
> }
> EXPORT_SYMBOL(sock_dequeue_err_skb);
>
> +/**
> + * skb_clone_sk - create clone of skb, and take reference to socket
> + * @skb: the skb to clone
> + *
> + * For functions such as timestamping it is necessary to clone an skb and
> + * hold a reference to the socket for it until the hardware delivers the
> + * actual timestamp or the timestamp is timed out. As as such this
> + * function is useful for creating a clone to later be handed off to
> + * skb_complete_tx_timestamp or kfree_skb to take care of cleaning up
> + * the reference handling for the socket.
> + */
> struct sk_buff *skb_clone_sk(struct sk_buff *skb)
> {
> struct sock *sk = skb->sk;
Note that I have serious doubts about the atomic_inc_not_zero() here.
At this point, we need to have consistent refcounting on the socket.
If we decide the reference is against sk_refcnt, then current sk_refcnt
cannot be 0 at this point.
This might hide a very serious bug.
In TCP tx path for example, we do not take reference on sk_refcnt for
each packet, but a reference on sk_wmem_alloc
If skb destructor is sock_wfree() or tcp_wfree(), then we should take an
extra reference on sk_wmem_alloc instead of sk_refcnt.
^ permalink raw reply
* Re: [PATCH] net: Fix GRE RX to use skb_transport_header for GRE header offset
From: Tom Herbert @ 2014-09-08 17:10 UTC (permalink / raw)
To: Eric Dumazet; +Cc: David Miller, Linux Netdev List
In-Reply-To: <1410191444.11872.113.camel@edumazet-glaptop2.roam.corp.google.com>
On Mon, Sep 8, 2014 at 8:50 AM, Eric Dumazet <eric.dumazet@gmail.com> wrote:
> On Mon, 2014-09-08 at 08:29 -0700, Tom Herbert wrote:
>> GRE assumes that the GRE header is at skb_network_header +
>> ip_hrdlen(skb). It is more general to use skb_transport_header
>> and this allows the possbility of inserting additional header
>> between IP and GRE (which is what we will done in Generic UDP
>> Encapsulation for GRE).
>>
>> Signed-off-by: Tom Herbert <therbert@google.com>
>> ---
>> net/ipv4/gre_demux.c | 5 ++---
>> 1 file changed, 2 insertions(+), 3 deletions(-)
>
> I am always confused why you do not include prior Acked-by when you
> repost same patch.
>
Sorry, I'll do that next time.
> This forces me to add it again.
>
> Note this should be a net-next patch, right ?
>
Yes.
> Acked-by: Eric Dumazet <edumazet@google.com>
>
>
^ permalink raw reply
* [PATCH net] net/mlx4_en: do not ignore autoneg in mlx4_en_set_pauseparam()
From: Ivan Vecera @ 2014-09-08 16:46 UTC (permalink / raw)
To: netdev; +Cc: Amir Vadai
The driver does not support pause autonegotiation so it should return
-EINVAL when the function is called with non-zero autoneg.
Cc: Amir Vadai <amirv@mellanox.com>
Signed-off-by: Ivan Vecera <ivecera@redhat.com>
---
drivers/net/ethernet/mellanox/mlx4/en_ethtool.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/net/ethernet/mellanox/mlx4/en_ethtool.c b/drivers/net/ethernet/mellanox/mlx4/en_ethtool.c
index e22f24f..35ff292 100644
--- a/drivers/net/ethernet/mellanox/mlx4/en_ethtool.c
+++ b/drivers/net/ethernet/mellanox/mlx4/en_ethtool.c
@@ -487,6 +487,9 @@ static int mlx4_en_set_pauseparam(struct net_device *dev,
struct mlx4_en_dev *mdev = priv->mdev;
int err;
+ if (pause->autoneg)
+ return -EINVAL;
+
priv->prof->tx_pause = pause->tx_pause != 0;
priv->prof->rx_pause = pause->rx_pause != 0;
err = mlx4_SET_PORT_general(mdev->dev, priv->port,
--
1.8.5.5
^ permalink raw reply related
* Re: [PATCH 05/13] ARM: dts: DRA7: Add DCAN nodes
From: Sergei Shtylyov @ 2014-09-08 16:40 UTC (permalink / raw)
To: Roger Quadros, wg, mkl, tony
Cc: tglx, linux-omap, linux-can, netdev, mugunthanvnm, george.cherian,
balbi, nsekhar, nm
In-Reply-To: <1410185442-907-6-git-send-email-rogerq@ti.com>
Hello.
On 9/8/2014 6:10 PM, Roger Quadros wrote:
> The SoC supports 2 DCAN nodes. Add them.
> Signed-off-by: Roger Quadros <rogerq@ti.com>
> ---
> arch/arm/boot/dts/dra7.dtsi | 30 ++++++++++++++++++++++++++++++
> 1 file changed, 30 insertions(+)
> diff --git a/arch/arm/boot/dts/dra7.dtsi b/arch/arm/boot/dts/dra7.dtsi
> index 370009e..4ce1a4f 100644
> --- a/arch/arm/boot/dts/dra7.dtsi
> +++ b/arch/arm/boot/dts/dra7.dtsi
[...]
> @@ -1267,6 +1269,34 @@
> ti,irqs-skip = <10 133 139 140>;
> ti,irqs-safe-map = <0>;
> };
> +
> + dcan1: d_can@481cc000 {
The ePAPR standard has something to say here:
>>
The name of a node should be somewhat generic, reflecting the function of the
device and not its precise programming model. If appropriate, the name should
be one of the following choices:
• can
>>
> + compatible = "bosch,d_can";
> + ti,hwmods = "dcan1";
> + reg = <0x4ae3c000 0x2000>,
> + <0x558 0x4>; /* index to RAMINIT reg within syscon */
> + raminit-syscon = <&dra7_ctrl_core>;
> + raminit-start-bit = <3>;
> + raminit-done-bit = <1>;
> + raminit-pulse;
Hm, aren't the above 4 properties vendor specific? If so, they should
start with a vendor prefix and comma.
> + interrupts = <GIC_SPI 222 IRQ_TYPE_LEVEL_HIGH>;
> + clocks = <&dcan1_sys_clk_mux>;
> + status = "disabled";
> + };
WBR, Sergei
^ permalink raw reply
* Re: [PATCH] drivers: net: ethernet: octeon_mgmt: fix a compiler warning
From: David Daney @ 2014-09-08 16:36 UTC (permalink / raw)
To: Aaro Koskinen, netdev, David Miller; +Cc: David Daney
In-Reply-To: <1410188513-2541-1-git-send-email-aaro.koskinen@nsn.com>
On 09/08/2014 08:01 AM, Aaro Koskinen wrote:
> Fix the following compiler warning:
>
> drivers/net/ethernet/octeon/octeon_mgmt.c: In function 'octeon_mgmt_clean_tx_buffers':
> drivers/net/ethernet/octeon/octeon_mgmt.c:295:4: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
> u64 ns = cvmx_read_csr(CVMX_MIXX_TSTAMP(p->port));
> ^
>
> Signed-off-by: Aaro Koskinen <aaro.koskinen@nsn.com>
For some reason we missed this when the initial patch was created.
Thanks for fixing it...
Acked-by: David Daney <david.daney@cavium.com>
> ---
> drivers/net/ethernet/octeon/octeon_mgmt.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/net/ethernet/octeon/octeon_mgmt.c b/drivers/net/ethernet/octeon/octeon_mgmt.c
> index 979c698..a422930 100644
> --- a/drivers/net/ethernet/octeon/octeon_mgmt.c
> +++ b/drivers/net/ethernet/octeon/octeon_mgmt.c
> @@ -290,9 +290,11 @@ static void octeon_mgmt_clean_tx_buffers(struct octeon_mgmt *p)
> /* Read the hardware TX timestamp if one was recorded */
> if (unlikely(re.s.tstamp)) {
> struct skb_shared_hwtstamps ts;
> + u64 ns;
> +
> memset(&ts, 0, sizeof(ts));
> /* Read the timestamp */
> - u64 ns = cvmx_read_csr(CVMX_MIXX_TSTAMP(p->port));
> + ns = cvmx_read_csr(CVMX_MIXX_TSTAMP(p->port));
> /* Remove the timestamp from the FIFO */
> cvmx_write_csr(CVMX_MIXX_TSCTL(p->port), 0);
> /* Tell the kernel about the timestamp */
>
^ permalink raw reply
* [PATCH net-next] skb: Add documentation for skb_clone_sk
From: Alexander Duyck @ 2014-09-08 16:18 UTC (permalink / raw)
To: netdev; +Cc: richardcochran, davem
This change adds some documentation to the call skb_clone_sk. This is
meant to help clarify the purpose of the function for other developers.
Signed-off-by: Alexander Duyck <alexander.h.duyck@intel.com>
---
net/core/skbuff.c | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/net/core/skbuff.c b/net/core/skbuff.c
index a18dfb0..3f83a8a 100644
--- a/net/core/skbuff.c
+++ b/net/core/skbuff.c
@@ -3511,6 +3511,17 @@ struct sk_buff *sock_dequeue_err_skb(struct sock *sk)
}
EXPORT_SYMBOL(sock_dequeue_err_skb);
+/**
+ * skb_clone_sk - create clone of skb, and take reference to socket
+ * @skb: the skb to clone
+ *
+ * For functions such as timestamping it is necessary to clone an skb and
+ * hold a reference to the socket for it until the hardware delivers the
+ * actual timestamp or the timestamp is timed out. As as such this
+ * function is useful for creating a clone to later be handed off to
+ * skb_complete_tx_timestamp or kfree_skb to take care of cleaning up
+ * the reference handling for the socket.
+ */
struct sk_buff *skb_clone_sk(struct sk_buff *skb)
{
struct sock *sk = skb->sk;
^ permalink raw reply related
* RE: [PATCH net-next] be2net: Learn and program mac to avoid packet replication in nPAR mode.
From: Venkat Duvvuru @ 2014-09-08 16:17 UTC (permalink / raw)
To: David Miller (davem@davemloft.net); +Cc: netdev@vger.kernel.org
In-Reply-To: <20140905.173456.2115240943907507122.davem@davemloft.net>
> -----Original Message-----
> From: David Miller [mailto:davem@davemloft.net]
> Sent: Saturday, September 06, 2014 6:05 AM
> To: Venkat Duvvuru
> Cc: netdev@vger.kernel.org
> Subject: Re: [PATCH net-next] be2net: Learn and program mac to avoid
> packet replication in nPAR mode.
>
> From: Venkat Duvvuru <VenkatKumar.Duvvuru@Emulex.com>
> Date: Thu, 4 Sep 2014 20:00:59 +0530
>
> > In a multi-channel setup, when an interface (channel/partition) is used
> > by a bridge or ovs, it is placed in promiscuous mode and the MAC addresses
> > of the VMs attached to the bridge are not configured on the base
> interface.
> > As a result of that, when a packet arrives to the port with
> > virtual machine's mac address, the card cannot determine which ring to
> > send the packet to, so replicates the packet on all the PFs of that port,
> > hence resulting in wastage of PCI bandwidth and CPU cycles. Packet
> replication
> > is also considered security risk as it can cause packets to reach an undesired
> VM.
> >
> > This patch will help solve the problem by learning the mac address and
> > programming it in the adapter. This patch also unlearns the MAC, if the
> MAC is
> > moved out of the machine or if the MAC is inactive for more than 5
> minutes.
> >
> > Signed-off-by: Venkat Duvvuru <VenkatKumar.Duvvuru@Emulex.com>
>
> This is non-trivial overhead to add to the fast paths of your primary
> packet input and output paths.
>
> I think you need to find a different solution to this problem.
A few points why I don't think this is non-trivial overhead
1. Mac learning happens only when there is a MAC miss and this is really a "once in a while" scenario.
2. There is no contention in the data path unless there is a MAC miss.
3. Our experiments show that
a. There is almost no impact on the CPU because of mac learning.
b. Throughput is not affected when there is no packet replication and this patch significantly improves the performance compared to throughput in a packet replication scenario.
Please let me know your thoughts.
^ permalink raw reply
* Re: [PATCH] net: Fix GRE RX to use skb_transport_header for GRE header offset
From: Eric Dumazet @ 2014-09-08 15:50 UTC (permalink / raw)
To: Tom Herbert; +Cc: davem, netdev
In-Reply-To: <1410190152-7396-1-git-send-email-therbert@google.com>
On Mon, 2014-09-08 at 08:29 -0700, Tom Herbert wrote:
> GRE assumes that the GRE header is at skb_network_header +
> ip_hrdlen(skb). It is more general to use skb_transport_header
> and this allows the possbility of inserting additional header
> between IP and GRE (which is what we will done in Generic UDP
> Encapsulation for GRE).
>
> Signed-off-by: Tom Herbert <therbert@google.com>
> ---
> net/ipv4/gre_demux.c | 5 ++---
> 1 file changed, 2 insertions(+), 3 deletions(-)
I am always confused why you do not include prior Acked-by when you
repost same patch.
This forces me to add it again.
Note this should be a net-next patch, right ?
Acked-by: Eric Dumazet <edumazet@google.com>
^ permalink raw reply
* [PATCH net-next] dp83640: Make use of skb_queue_purge instead of reimplementing the code
From: Alexander Duyck @ 2014-09-08 15:25 UTC (permalink / raw)
To: netdev; +Cc: richardcochran, davem
This change makes it so that dp83640_remove can use skb_queue_purge
instead of looping through itself to flush any entries out of the queue.
Signed-off-by: Alexander Duyck <alexander.h.duyck@intel.com>
---
drivers/net/phy/dp83640.c | 8 ++------
1 file changed, 2 insertions(+), 6 deletions(-)
diff --git a/drivers/net/phy/dp83640.c b/drivers/net/phy/dp83640.c
index 87648b3..99b5d20 100644
--- a/drivers/net/phy/dp83640.c
+++ b/drivers/net/phy/dp83640.c
@@ -1136,7 +1136,6 @@ static void dp83640_remove(struct phy_device *phydev)
struct dp83640_clock *clock;
struct list_head *this, *next;
struct dp83640_private *tmp, *dp83640 = phydev->priv;
- struct sk_buff *skb;
if (phydev->addr == BROADCAST_ADDR)
return;
@@ -1144,11 +1143,8 @@ static void dp83640_remove(struct phy_device *phydev)
enable_status_frames(phydev, false);
cancel_work_sync(&dp83640->ts_work);
- while ((skb = skb_dequeue(&dp83640->rx_queue)) != NULL)
- kfree_skb(skb);
-
- while ((skb = skb_dequeue(&dp83640->tx_queue)) != NULL)
- kfree_skb(skb);
+ skb_queue_purge(&dp83640->rx_queue);
+ skb_queue_purge(&dp83640->tx_queue);
clock = dp83640_clock_get(dp83640->clock);
^ permalink raw reply related
* [PATCH net-next] hp100: Convert the normal skb free path to dev_consume_skb_any()
From: Rick Jones @ 2014-09-08 15:31 UTC (permalink / raw)
To: netdev; +Cc: davem, perex
From: Rick Jones <rick.jones2@hp.com>
A bit of floor sweeping in a dusty old corner. Convert the "normal"
skb free calls to dev_consume_skb_any() so packet drop tracing will
be more sane.
Signed-off-by: Rick Jones <rick.jones2@hp.com>
---
Compile tested only. I wonder how many of these cards are still in
operation?-)
diff --git a/drivers/net/ethernet/hp/hp100.c b/drivers/net/ethernet/hp/hp100.c
index ed7916f..76a6e0c 100644
--- a/drivers/net/ethernet/hp/hp100.c
+++ b/drivers/net/ethernet/hp/hp100.c
@@ -1627,7 +1627,7 @@ static void hp100_clean_txring(struct net_device *dev)
#endif
/* Conversion to new PCI API : NOP */
pci_unmap_single(lp->pci_dev, (dma_addr_t) lp->txrhead->pdl[1], lp->txrhead->pdl[2], PCI_DMA_TODEVICE);
- dev_kfree_skb_any(lp->txrhead->skb);
+ dev_consume_skb_any(lp->txrhead->skb);
lp->txrhead->skb = NULL;
lp->txrhead = lp->txrhead->next;
lp->txrcommit--;
@@ -1745,7 +1745,7 @@ static netdev_tx_t hp100_start_xmit(struct sk_buff *skb,
hp100_ints_on();
spin_unlock_irqrestore(&lp->lock, flags);
- dev_kfree_skb_any(skb);
+ dev_consume_skb_any(skb);
#ifdef HP100_DEBUG_TX
printk("hp100: %s: start_xmit: end\n", dev->name);
^ permalink raw reply related
* [PATCH] net: Fix GRE RX to use skb_transport_header for GRE header offset
From: Tom Herbert @ 2014-09-08 15:29 UTC (permalink / raw)
To: davem, netdev
GRE assumes that the GRE header is at skb_network_header +
ip_hrdlen(skb). It is more general to use skb_transport_header
and this allows the possbility of inserting additional header
between IP and GRE (which is what we will done in Generic UDP
Encapsulation for GRE).
Signed-off-by: Tom Herbert <therbert@google.com>
---
net/ipv4/gre_demux.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/net/ipv4/gre_demux.c b/net/ipv4/gre_demux.c
index 7e0756d..4a7b5b2 100644
--- a/net/ipv4/gre_demux.c
+++ b/net/ipv4/gre_demux.c
@@ -98,7 +98,6 @@ EXPORT_SYMBOL_GPL(gre_build_header);
static int parse_gre_header(struct sk_buff *skb, struct tnl_ptk_info *tpi,
bool *csum_err)
{
- unsigned int ip_hlen = ip_hdrlen(skb);
const struct gre_base_hdr *greh;
__be32 *options;
int hdr_len;
@@ -106,7 +105,7 @@ static int parse_gre_header(struct sk_buff *skb, struct tnl_ptk_info *tpi,
if (unlikely(!pskb_may_pull(skb, sizeof(struct gre_base_hdr))))
return -EINVAL;
- greh = (struct gre_base_hdr *)(skb_network_header(skb) + ip_hlen);
+ greh = (struct gre_base_hdr *)skb_transport_header(skb);
if (unlikely(greh->flags & (GRE_VERSION | GRE_ROUTING)))
return -EINVAL;
@@ -116,7 +115,7 @@ static int parse_gre_header(struct sk_buff *skb, struct tnl_ptk_info *tpi,
if (!pskb_may_pull(skb, hdr_len))
return -EINVAL;
- greh = (struct gre_base_hdr *)(skb_network_header(skb) + ip_hlen);
+ greh = (struct gre_base_hdr *)skb_transport_header(skb);
tpi->proto = greh->protocol;
options = (__be32 *)(greh + 1);
--
2.1.0.rc2.206.gedb03e5
^ permalink raw reply related
* [PATCH v2 net-next] tcp: remove dst refcount false sharing for prequeue mode
From: Eric Dumazet @ 2014-09-08 15:06 UTC (permalink / raw)
To: David Miller; +Cc: therbert, alexander.h.duyck, netdev
In-Reply-To: <1410017237.11872.31.camel@edumazet-glaptop2.roam.corp.google.com>
From: Eric Dumazet <edumazet@google.com>
Alexander Duyck reported high false sharing on dst refcount in tcp stack
when prequeue is used. prequeue is the mechanism used when a thread is
blocked in recvmsg()/read() on a TCP socket, using a blocking model
rather than select()/poll()/epoll() non blocking one.
We already try to use RCU in input path as much as possible, but we were
forced to take a refcount on the dst when skb escaped RCU protected
region. When/if the user thread runs on different cpu, dst_release()
will then touch dst refcount again.
Commit 093162553c33 (tcp: force a dst refcount when prequeue packet)
was an example of a race fix.
It turns out the only remaining usage of skb->dst for a packet stored
in a TCP socket prequeue is IP early demux.
We can add a logic to detect when IP early demux is probably going
to use skb->dst. Because we do an optimistic check rather than duplicate
existing logic, we need to guard inet_sk_rx_dst_set() and
inet6_sk_rx_dst_set() from using a NULL dst.
Many thanks to Alexander for providing a nice bug report, git bisection,
and reproducer.
Tested using Alexander script on a 40Gb NIC, 8 RX queues.
Hosts have 24 cores, 48 hyper threads.
echo 0 >/proc/sys/net/ipv4/tcp_autocorking
for i in `seq 0 47`
do
for j in `seq 0 2`
do
netperf -H $DEST -t TCP_STREAM -l 1000 \
-c -C -T $i,$i -P 0 -- \
-m 64 -s 64K -D &
done
done
Before patch : ~6Mpps and ~95% cpu usage on receiver
After patch : ~9Mpps and ~35% cpu usage on receiver.
Signed-off-by: Eric Dumazet <edumazet@google.com>
Reported-by: Alexander Duyck <alexander.h.duyck@intel.com>
---
v2: remove the skb_dst_drop() before enqueue to backlog, as this is
currently valid only for ESTABLISHED sockets.
net/ipv4/tcp_ipv4.c | 20 ++++++++++++++++----
net/ipv6/tcp_ipv6.c | 15 +++++++++------
2 files changed, 25 insertions(+), 10 deletions(-)
diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c
index 3f9bc3f0bba0..7881b96d2b72 100644
--- a/net/ipv4/tcp_ipv4.c
+++ b/net/ipv4/tcp_ipv4.c
@@ -1559,7 +1559,17 @@ bool tcp_prequeue(struct sock *sk, struct sk_buff *skb)
skb_queue_len(&tp->ucopy.prequeue) == 0)
return false;
- skb_dst_force(skb);
+ /* Before escaping RCU protected region, we need to take care of skb
+ * dst. Prequeue is only enabled for established sockets.
+ * For such sockets, we might need the skb dst only to set sk->sk_rx_dst
+ * Instead of doing full sk_rx_dst validity here, let's perform
+ * an optimistic check.
+ */
+ if (likely(sk->sk_rx_dst))
+ skb_dst_drop(skb);
+ else
+ skb_dst_force(skb);
+
__skb_queue_tail(&tp->ucopy.prequeue, skb);
tp->ucopy.memory += skb->truesize;
if (tp->ucopy.memory > sk->sk_rcvbuf) {
@@ -1765,9 +1775,11 @@ void inet_sk_rx_dst_set(struct sock *sk, const struct sk_buff *skb)
{
struct dst_entry *dst = skb_dst(skb);
- dst_hold(dst);
- sk->sk_rx_dst = dst;
- inet_sk(sk)->rx_dst_ifindex = skb->skb_iif;
+ if (dst) {
+ dst_hold(dst);
+ sk->sk_rx_dst = dst;
+ inet_sk(sk)->rx_dst_ifindex = skb->skb_iif;
+ }
}
EXPORT_SYMBOL(inet_sk_rx_dst_set);
diff --git a/net/ipv6/tcp_ipv6.c b/net/ipv6/tcp_ipv6.c
index 5b3c70ff7a72..1835480336ac 100644
--- a/net/ipv6/tcp_ipv6.c
+++ b/net/ipv6/tcp_ipv6.c
@@ -93,13 +93,16 @@ static struct tcp_md5sig_key *tcp_v6_md5_do_lookup(struct sock *sk,
static void inet6_sk_rx_dst_set(struct sock *sk, const struct sk_buff *skb)
{
struct dst_entry *dst = skb_dst(skb);
- const struct rt6_info *rt = (const struct rt6_info *)dst;
- dst_hold(dst);
- sk->sk_rx_dst = dst;
- inet_sk(sk)->rx_dst_ifindex = skb->skb_iif;
- if (rt->rt6i_node)
- inet6_sk(sk)->rx_dst_cookie = rt->rt6i_node->fn_sernum;
+ if (dst) {
+ const struct rt6_info *rt = (const struct rt6_info *)dst;
+
+ dst_hold(dst);
+ sk->sk_rx_dst = dst;
+ inet_sk(sk)->rx_dst_ifindex = skb->skb_iif;
+ if (rt->rt6i_node)
+ inet6_sk(sk)->rx_dst_cookie = rt->rt6i_node->fn_sernum;
+ }
}
static void tcp_v6_hash(struct sock *sk)
^ permalink raw reply related
* [PATCH] drivers: net: ethernet: octeon_mgmt: fix a compiler warning
From: Aaro Koskinen @ 2014-09-08 15:01 UTC (permalink / raw)
To: netdev, David Daney; +Cc: Aaro Koskinen
Fix the following compiler warning:
drivers/net/ethernet/octeon/octeon_mgmt.c: In function 'octeon_mgmt_clean_tx_buffers':
drivers/net/ethernet/octeon/octeon_mgmt.c:295:4: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
u64 ns = cvmx_read_csr(CVMX_MIXX_TSTAMP(p->port));
^
Signed-off-by: Aaro Koskinen <aaro.koskinen@nsn.com>
---
drivers/net/ethernet/octeon/octeon_mgmt.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/octeon/octeon_mgmt.c b/drivers/net/ethernet/octeon/octeon_mgmt.c
index 979c698..a422930 100644
--- a/drivers/net/ethernet/octeon/octeon_mgmt.c
+++ b/drivers/net/ethernet/octeon/octeon_mgmt.c
@@ -290,9 +290,11 @@ static void octeon_mgmt_clean_tx_buffers(struct octeon_mgmt *p)
/* Read the hardware TX timestamp if one was recorded */
if (unlikely(re.s.tstamp)) {
struct skb_shared_hwtstamps ts;
+ u64 ns;
+
memset(&ts, 0, sizeof(ts));
/* Read the timestamp */
- u64 ns = cvmx_read_csr(CVMX_MIXX_TSTAMP(p->port));
+ ns = cvmx_read_csr(CVMX_MIXX_TSTAMP(p->port));
/* Remove the timestamp from the FIFO */
cvmx_write_csr(CVMX_MIXX_TSCTL(p->port), 0);
/* Tell the kernel about the timestamp */
--
2.1.0
^ permalink raw reply related
* Re: [PATCH net-next v2 0/2] sunvnet: Reduce LDC message overhead.
From: David L Stevens @ 2014-09-08 14:43 UTC (permalink / raw)
To: Sowmini Varadhan, David Miller; +Cc: raghuram.kothakota, netdev
In-Reply-To: <20140908143802.GF31377@oracle.com>
On 09/08/2014 10:38 AM, Sowmini Varadhan wrote:
>
> I'm not sure where we stand with this- do I need to resubmit any/all of
> those two patches?
Dave,
FWIW, I think there may be a memory barrier issue (missing rmb()),
which I'll look into and patch separately, if needed, but I don't think it
has anything to do with this patchset.
My original concern about the wmb() placement was wrong, I agree.
+-DLS
^ permalink raw reply
* Re: [PATCH v2 0/3] net: Add Keystone NetCP ethernet driver support
From: Santosh Shilimkar @ 2014-09-08 14:41 UTC (permalink / raw)
To: David Miller
Cc: netdev-u79uwXL29TY76Z2rM5mHXA,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
linux-kernel-u79uwXL29TY76Z2rM5mHXA,
robh+dt-DgEjT+Ai2ygdnm+yROfE0A,
grant.likely-QSEj5FYQhm4dnm+yROfE0A,
devicetree-u79uwXL29TY76Z2rM5mHXA, sandeep_n-l0cyMroinI0
In-Reply-To: <53F79DC5.8030003-l0cyMroinI0@public.gmane.org>
Hi Dave,
On 8/22/14 3:45 PM, Santosh Shilimkar wrote:
> Hi David,
>
> On Thursday 21 August 2014 07:36 PM, David Miller wrote:
>> From: Santosh Shilimkar <santosh.shilimkar-l0cyMroinI0@public.gmane.org>
>> Date: Fri, 15 Aug 2014 11:12:39 -0400
>>
>>> Update version after incorporating David Miller's comment from earlier
>>> posting [1]. I would like to get these merged for upcoming 3.18 merge
>>> window if there are no concerns on this version.
>>>
>>> The network coprocessor (NetCP) is a hardware accelerator that processes
>>> Ethernet packets. NetCP has a gigabit Ethernet (GbE) subsystem with a ethernet
>>> switch sub-module to send and receive packets. NetCP also includes a packet
>>> accelerator (PA) module to perform packet classification operations such as
>>> header matching, and packet modification operations such as checksum
>>> generation. NetCP can also optionally include a Security Accelerator(SA)
>>> capable of performing IPSec operations on ingress/egress packets.
>>>
>>> Keystone SoC's also have a 10 Gigabit Ethernet Subsystem (XGbE) which
>>> includes a 3-port Ethernet switch sub-module capable of 10Gb/s and
>>> 1Gb/s rates per Ethernet port.
>>>
>>> NetCP driver has a plug-in module architecture where each of the NetCP
>>> sub-modules exist as a loadable kernel module which plug in to the netcp
>>> core. These sub-modules are represented as "netcp-devices" in the dts
>>> bindings. It is mandatory to have the ethernet switch sub-module for
>>> the ethernet interface to be operational. Any other sub-module like the
>>> PA is optional.
>>>
>>> Both GBE and XGBE network processors supported using common driver. It
>>> is also designed to handle future variants of NetCP.
>>
>> I don't want to see an offload driver that doesn't plug into the existing
>> generic frameworks for configuration et al.
>>
>> If no existing facility exists to support what you need, you must work
>> with the upstream maintainers to design and create one.
>>
>> It is absolutely no reasonable for every "switch on a chip" driver to
>> export it's own configuration knob, we need a standard interface all
>> such drivers will plug into and provide.
>>
> The NetCP plugin module infrastructure use all the standard kernel
> infrastructure and its very tiny. To best represent the Network processor
> and its sub module hardware which have inter dependency and ordering
> needs, we needed such infrastructure. This lets us handle all the
> hardware needs without any code duplication per module.
>
> To elaborate more, there are 4 variants of network switch modules and
> then few accelerator modules like Packet accelerator, QOS and Security
> accelerator. There can be multiple instances of switches on same SOC.
> Example 1 Gbe and 10 Gbe switches. Then additional accelerator modules
> are inter connected with switch, streaming fabric and packet DMA.
> Packet routing changes based on the various offload modules presence and hence
> needs hooks for tx/rx to be called in particular order with special
> handling. This scheme is very hardware specific and doesn't have ways
> to isolate the modules from each other.
>
> On the other hand, we definitely wanted to have minimal code
> instead of duplicating ndo operations and core packet processing logic
> in multiple drivers or layers. The module approach helps
> to isolate the code based on the customer choice who can choose
> say not to build 10 Gbe hardware or say don't need QOS or Security
> accelerators. That way we keep the packet processing hot path as
> what we need without any overhead.
>
> As you can see, the tiny module handling was added more to represent
> the hardware, keep the modularity and avoid code duplication. The
> infrastructure is very minimal and NETCP specific. With this small
> infrastructure we are able to re-use code for NetCP1.0, NetCP1.5,
> 10 GBe and upcoming NetCP variants from just *one* driver.
>
> Hope this gives you a better idea and rationale behind the design.
>
Did you happen to see the reply ?
I am hoping to get this driver in for upcoming merge window.
Regards,
Santosh
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply
* Re: [PATCH net-next v2 0/2] sunvnet: Reduce LDC message overhead.
From: Sowmini Varadhan @ 2014-09-08 14:38 UTC (permalink / raw)
To: David Miller; +Cc: raghuram.kothakota, netdev
In-Reply-To: <20140904.223724.206826043871814498.davem@davemloft.net>
On (09/04/14 22:37), David Miller wrote:
>
> From: Sowmini Varadhan <sowmini.varadhan@oracle.com>
>
> > This patchset has an updated version of the v1 changes to reduce the
> > overhead from LDC messages.
>
> Let's hold on these changes until the memory barrier issues brought up
> by David is resolved.
On (09/07/14 16:19), David Miller wrote (in the patch 2/2 thread for this set):
>
> > So what (if any) is the outstanding question about wmb() at this
> > point?
>
> I don't think there is any, thanks.
I'm not sure where we stand with this- do I need to resubmit any/all of
those two patches?
--Sowmini
^ permalink raw reply
* [PATCH 11/13] ARM: dts: am437x-gp-evm: Add pinctrl sleep states for dcan pins
From: Roger Quadros @ 2014-09-08 14:10 UTC (permalink / raw)
To: wg, mkl, tony
Cc: tglx, linux-omap, linux-can, netdev, mugunthanvnm, george.cherian,
balbi, nsekhar, nm, Dave Gerlach
In-Reply-To: <1410185442-907-1-git-send-email-rogerq@ti.com>
From: Dave Gerlach <d-gerlach@ti.com>
Define pinctrl sleep states for both dcan0 and dcan1 to place pull downs
on the lines to optimize power savings during suspend.
Signed-off-by: Dave Gerlach <d-gerlach@ti.com>
Signed-off-by: Sekhar Nori <nsekhar@ti.com>
---
arch/arm/boot/dts/am437x-gp-evm.dts | 20 ++++++++++++++++++--
1 file changed, 18 insertions(+), 2 deletions(-)
diff --git a/arch/arm/boot/dts/am437x-gp-evm.dts b/arch/arm/boot/dts/am437x-gp-evm.dts
index 6d03baa..ca9e1ab 100644
--- a/arch/arm/boot/dts/am437x-gp-evm.dts
+++ b/arch/arm/boot/dts/am437x-gp-evm.dts
@@ -262,12 +262,26 @@
>;
};
+ dcan0_sleep: dcan0_sleep_pins {
+ pinctrl-single,pins = <
+ 0x178 (PIN_INPUT_PULLDOWN | MUX_MODE7)
+ 0x17c (PIN_INPUT_PULLDOWN | MUX_MODE7)
+ >;
+ };
+
dcan1_default: dcan1_default_pins {
pinctrl-single,pins = <
0x180 (PIN_OUTPUT_PULLDOWN | MUX_MODE2) /* uart1_rxd.d_can1_tx */
0x184 (PIN_INPUT_PULLUP | MUX_MODE2) /* uart1_txd.d_can1_rx */
>;
};
+
+ dcan1_sleep: dcan1_sleep_pins {
+ pinctrl-single,pins = <
+ 0x180 (PIN_INPUT_PULLDOWN | MUX_MODE7)
+ 0x184 (PIN_INPUT_PULLDOWN | MUX_MODE7)
+ >;
+ };
};
&i2c0 {
@@ -527,13 +541,15 @@
};
&dcan0 {
- pinctrl-names = "default";
+ pinctrl-names = "default", "sleep";
pinctrl-0 = <&dcan0_default>;
+ pinctrl-1 = <&dcan0_sleep>;
status = "okay";
};
&dcan1 {
- pinctrl-names = "default";
+ pinctrl-names = "default", "sleep";
pinctrl-0 = <&dcan1_default>;
+ pinctrl-1 = <&dcan1_sleep>;
status = "okay";
};
--
1.8.3.2
^ permalink raw reply related
* [PATCH 09/13] ARM: dts: AM43xx: Add aliases to d_can nodes
From: Roger Quadros @ 2014-09-08 14:10 UTC (permalink / raw)
To: wg, mkl, tony
Cc: tglx, linux-omap, linux-can, netdev, mugunthanvnm, george.cherian,
balbi, nsekhar, nm, Roger Quadros
In-Reply-To: <1410185442-907-1-git-send-email-rogerq@ti.com>
The d_can driver expects appropriately named aliases for
the d_can nodes for the RAMINIT control register access.
Provide those, otherwise RAMINIT register won't be configured.
Get's rid of the following messages during boot.
[ 16.419354] c_can_platform 481cc000.can: control memory is not used for raminit
[ 16.449142] c_can_platform 481d0000.can: control memory is not used for raminit
Signed-off-by: Roger Quadros <rogerq@ti.com>
Reviewed-by: Felipe Balbi <balbi@ti.com>
---
arch/arm/boot/dts/am4372.dtsi | 2 ++
1 file changed, 2 insertions(+)
diff --git a/arch/arm/boot/dts/am4372.dtsi b/arch/arm/boot/dts/am4372.dtsi
index 3514d0a..a705e50 100644
--- a/arch/arm/boot/dts/am4372.dtsi
+++ b/arch/arm/boot/dts/am4372.dtsi
@@ -25,6 +25,8 @@
serial0 = &uart0;
ethernet0 = &cpsw_emac0;
ethernet1 = &cpsw_emac1;
+ d_can0 = &dcan0;
+ d_can1 = &dcan1;
};
cpus {
--
1.8.3.2
^ permalink raw reply related
* [PATCH 08/13] arm: dts: am4372: Add dcan nodes
From: Roger Quadros @ 2014-09-08 14:10 UTC (permalink / raw)
To: wg, mkl, tony
Cc: tglx, linux-omap, linux-can, netdev, mugunthanvnm, george.cherian,
balbi, nsekhar, nm, Afzal Mohammed
In-Reply-To: <1410185442-907-1-git-send-email-rogerq@ti.com>
From: Afzal Mohammed <afzal@ti.com>
Add dcan nodes.
Signed-off-by: Afzal Mohammed <afzal@ti.com>
Signed-off-by: Mugunthan V N <mugunthanvnm@ti.com>
Signed-off-by: George Cherian <george.cherian@ti.com>
Signed-off-by: Sekhar Nori <nsekhar@ti.com>
---
arch/arm/boot/dts/am4372.dtsi | 22 ++++++++++++++++++++++
1 file changed, 22 insertions(+)
diff --git a/arch/arm/boot/dts/am4372.dtsi b/arch/arm/boot/dts/am4372.dtsi
index 8689949..3514d0a 100644
--- a/arch/arm/boot/dts/am4372.dtsi
+++ b/arch/arm/boot/dts/am4372.dtsi
@@ -885,6 +885,28 @@
clock-names = "fck";
};
};
+
+ dcan0: can@481cc000 {
+ compatible = "bosch,d_can";
+ ti,hwmods = "d_can0";
+ clocks = <&dcan0_fck>;
+ clock-names = "fck";
+ reg = <0x481cc000 0x2000
+ 0x44e10644 0x4>;
+ interrupts = <GIC_SPI 52 IRQ_TYPE_LEVEL_HIGH>;
+ status = "disabled";
+ };
+
+ dcan1: can@481d0000 {
+ compatible = "bosch,d_can";
+ ti,hwmods = "d_can1";
+ clocks = <&dcan1_fck>;
+ clock-names = "fck";
+ reg = <0x481d0000 0x2000
+ 0x44e10644 0x4>;
+ interrupts = <GIC_SPI 49 IRQ_TYPE_LEVEL_HIGH>;
+ status = "disabled";
+ };
};
};
--
1.8.3.2
^ permalink raw reply related
* [PATCH 07/13] ARM: dts: dra72-evm: Add CAN support
From: Roger Quadros @ 2014-09-08 14:10 UTC (permalink / raw)
To: wg, mkl, tony
Cc: tglx, linux-omap, linux-can, netdev, mugunthanvnm, george.cherian,
balbi, nsekhar, nm, Roger Quadros
In-Reply-To: <1410185442-907-1-git-send-email-rogerq@ti.com>
The board has 2 CAN ports but only the first one can be used.
Enable the first CAN port.
The second one cannot be used without hardware modification
so we don't enable the second port.
Signed-off-by: Roger Quadros <rogerq@ti.com>
---
arch/arm/boot/dts/dra72-evm.dts | 23 +++++++++++++++++++++++
1 file changed, 23 insertions(+)
diff --git a/arch/arm/boot/dts/dra72-evm.dts b/arch/arm/boot/dts/dra72-evm.dts
index 5147023..e5b7172 100644
--- a/arch/arm/boot/dts/dra72-evm.dts
+++ b/arch/arm/boot/dts/dra72-evm.dts
@@ -19,6 +19,29 @@
};
};
+&dra7_pmx_core {
+ dcan1_pins_default: dcan1_pins_default {
+ pinctrl-single,pins = <
+ 0x3d4 (PIN_INPUT | MUX_MODE0) /* dcan1_tx */
+ 0x418 (PIN_INPUT | MUX_MODE1) /* wakeup0.dcan1_rx */
+ >;
+ };
+
+ dcan1_pins_sleep: dcan1_pins_sleep {
+ pinctrl-single,pins = <
+ 0x3d4 (PIN_INPUT | MUX_MODE15) /* dcan1_tx.off */
+ 0x418 (PIN_INPUT | MUX_MODE15) /* wakeup0.off */
+ >;
+ };
+};
+
&uart1 {
status = "okay";
};
+
+&dcan1 {
+ status = "ok";
+ pinctrl-names = "default", "sleep";
+ pinctrl-0 = <&dcan1_pins_default>;
+ pinctrl-1 = <&dcan1_pins_sleep>;
+};
--
1.8.3.2
^ permalink raw reply related
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox