Netdev List
 help / color / mirror / Atom feed
* Re: [PATCH net] packet: only test po->has_vnet_hdr once in packet_snd
From: David Miller @ 2017-09-28 17:25 UTC (permalink / raw)
  To: willemdebruijn.kernel; +Cc: netdev, willemb
In-Reply-To: <20170926162017.60750-1-willemdebruijn.kernel@gmail.com>

aFrom: Willem de Bruijn <willemdebruijn.kernel@gmail.com>
Date: Tue, 26 Sep 2017 12:20:17 -0400

> From: Willem de Bruijn <willemb@google.com>
> 
> Packet socket option po->has_vnet_hdr can be updated concurrently with
> other operations if no ring is attached.
> 
> Do not test the option twice in packet_snd, as the value may change in
> between calls. A race on setsockopt disable may cause a packet > mtu
> to be sent without having GSO options set.
> 
> Fixes: bfd5f4a3d605 ("packet: Add GSO/csum offload support.")
> Signed-off-by: Willem de Bruijn <willemb@google.com>
> Reviewed-by: Eric Dumazet <edumazet@google.com>

Applied and queued up for -stable.

^ permalink raw reply

* Re: [PATCH net] packet: in packet_do_bind, test fanout with bind_lock held
From: David Miller @ 2017-09-28 17:25 UTC (permalink / raw)
  To: willemdebruijn.kernel; +Cc: netdev, willemb
In-Reply-To: <20170926161937.60597-1-willemdebruijn.kernel@gmail.com>

From: Willem de Bruijn <willemdebruijn.kernel@gmail.com>
Date: Tue, 26 Sep 2017 12:19:37 -0400

> From: Willem de Bruijn <willemb@google.com>
> 
> Once a socket has po->fanout set, it remains a member of the group
> until it is destroyed. The prot_hook must be constant and identical
> across sockets in the group.
> 
> If fanout_add races with packet_do_bind between the test of po->fanout
> and taking the lock, the bind call may make type or dev inconsistent
> with that of the fanout group.
> 
> Hold po->bind_lock when testing po->fanout to avoid this race.
> 
> I had to introduce artificial delay (local_bh_enable) to actually
> observe the race.
> 
> Fixes: dc99f600698d ("packet: Add fanout support.")
> Signed-off-by: Willem de Bruijn <willemb@google.com>
> Reviewed-by: Eric Dumazet <edumazet@google.com>

Applied and queued up for -stable.

^ permalink raw reply

* Re: [PATCH v2 net-next 0/2] bpf/verifier: disassembly improvements
From: David Miller @ 2017-09-28 17:24 UTC (permalink / raw)
  To: ecree; +Cc: netdev, daniel, alexei.starovoitov, ys114321
In-Reply-To: <52270348-67f1-4e7a-cd2f-9d611ae94064@solarflare.com>

From: Edward Cree <ecree@solarflare.com>
Date: Tue, 26 Sep 2017 16:32:15 +0100

> Fix the output of print_bpf_insn() for ALU ops that don't look like
>  compound assignment (i.e. BPF_END and BPF_NEG).
> 
> Sample output for a short test program:
> 0: (b4) (u32) r0 = (u32) 0
> 1: (dc) r0 = be32 r0
> 2: (84) r0 = (u32) -r0
> 3: (95) exit
> processed 4 insns, stack depth 0

Series applied.

^ permalink raw reply

* Re: [PATCH 2/4] ravb: Add optional PHY reset during system resume
From: Florian Fainelli @ 2017-09-28 17:22 UTC (permalink / raw)
  To: Geert Uytterhoeven, David S . Miller, Simon Horman, Magnus Damm
  Cc: Sergei Shtylyov, Andrew Lunn, Niklas Söderlund, netdev,
	linux-renesas-soc, devicetree
In-Reply-To: <1506614014-4398-3-git-send-email-geert+renesas@glider.be>

On 09/28/2017 08:53 AM, Geert Uytterhoeven wrote:
> If the optional "reset-gpios" property is specified in DT, the generic
> MDIO bus code takes care of resetting the PHY during device probe.
> However, the PHY may still have to be reset explicitly after system
> resume.
> 
> This allows to restore Ethernet operation after resume from s2ram on
> Salvator-XS, where the enable pin of the regulator providing PHY power
> is connected to PRESETn, and PSCI suspend powers down the SoC.
> 
> Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
> ---
>  drivers/net/ethernet/renesas/ravb_main.c | 9 +++++++++
>  1 file changed, 9 insertions(+)
> 
> diff --git a/drivers/net/ethernet/renesas/ravb_main.c b/drivers/net/ethernet/renesas/ravb_main.c
> index fdf30bfa403bf416..96d1d48e302f8c9a 100644
> --- a/drivers/net/ethernet/renesas/ravb_main.c
> +++ b/drivers/net/ethernet/renesas/ravb_main.c
> @@ -19,6 +19,7 @@
>  #include <linux/etherdevice.h>
>  #include <linux/ethtool.h>
>  #include <linux/if_vlan.h>
> +#include <linux/gpio/consumer.h>
>  #include <linux/kernel.h>
>  #include <linux/list.h>
>  #include <linux/module.h>
> @@ -2268,6 +2269,7 @@ static int __maybe_unused ravb_resume(struct device *dev)
>  {
>  	struct net_device *ndev = dev_get_drvdata(dev);
>  	struct ravb_private *priv = netdev_priv(ndev);
> +	struct mii_bus *bus = priv->mii_bus;
>  	int ret = 0;
>  
>  	if (priv->wol_enabled) {
> @@ -2302,6 +2304,13 @@ static int __maybe_unused ravb_resume(struct device *dev)
>  	 * reopen device if it was running before system suspended.
>  	 */
>  
> +	/* PHY reset */
> +	if (bus->reset_gpiod) {
> +		gpiod_set_value_cansleep(bus->reset_gpiod, 1);
> +		udelay(bus->reset_delay_us);
> +		gpiod_set_value_cansleep(bus->reset_gpiod, 0);
> +	}

This is a clever hack, but unfortunately this is also misusing the MDIO
bus reset line into a PHY reset line. As commented in patch 3, if this
reset line is tied to the PHY, then this should be a PHY property and
you cannot (ab)use the MDIO bus GPIO reset logic anymore...

Should not you also try to manage this reset line during ravb_open() to
achiever better power savings?
-- 
Florian

^ permalink raw reply

* Re: [PATCH][next] cxgb4: make function ch_flower_stats_cb, fixes warning
From: David Miller @ 2017-09-28 17:22 UTC (permalink / raw)
  To: colin.king; +Cc: ganeshgr, netdev, kernel-janitors, linux-kernel
In-Reply-To: <20170926151409.18244-1-colin.king@canonical.com>

From: Colin King <colin.king@canonical.com>
Date: Tue, 26 Sep 2017 16:14:09 +0100

> From: Colin Ian King <colin.king@canonical.com>
> 
> The function ch_flower_stats_cb is local to the source and does not need
> to be in global scope, so make it static.
> 
> Cleans up sparse warnings:
> symbol 'ch_flower_stats_cb' was not declared. Should it be static?
> 
> Signed-off-by: Colin Ian King <colin.king@canonical.com>

Applied.

^ permalink raw reply

* Re: [PATCH net-next v4 0/4] rtnetlink: preparation patches for further rtnl lock pushdown/removal
From: David Miller @ 2017-09-28 17:21 UTC (permalink / raw)
  To: fw; +Cc: netdev
In-Reply-To: <20170926115843.12013-1-fw@strlen.de>

From: Florian Westphal <fw@strlen.de>
Date: Tue, 26 Sep 2017 13:58:39 +0200

> Patches split large rtnl_fill_ifinfo into smaller chunks
> to better see which parts
> 
> 1. require rtnl
> 2. do not require it at all
> 3. rely on rtnl locking now but could be converted
> 
> Changes since v3:
> 
> I dropped the 'ifalias' patch, I have a change to decouple ifalias and
> rtnl mutex, I will send it once this series has been merged.

Series applied.

^ permalink raw reply

* Re: [PATCH 3/4] arm64: dts: renesas: salvator-common: Add EthernetAVB PHY reset
From: Florian Fainelli @ 2017-09-28 17:20 UTC (permalink / raw)
  To: Geert Uytterhoeven, David S . Miller, Simon Horman, Magnus Damm
  Cc: Sergei Shtylyov, Andrew Lunn, Niklas Söderlund,
	netdev-u79uwXL29TY76Z2rM5mHXA,
	linux-renesas-soc-u79uwXL29TY76Z2rM5mHXA,
	devicetree-u79uwXL29TY76Z2rM5mHXA
In-Reply-To: <1506614014-4398-4-git-send-email-geert+renesas-gXvu3+zWzMSzQB+pC5nmwQ@public.gmane.org>

On 09/28/2017 08:53 AM, Geert Uytterhoeven wrote:
> Describe the GPIO used to reset the Ethernet PHY for EthernetAVB.
> This allows the driver to reset the PHY during probe and after system
> resume.
> 
> This fixes Ethernet operation after resume from s2ram on Salvator-XS,
> where the enable pin of the regulator providing PHY power is connected
> to PRESETn, and PSCI powers down the SoC during system suspend.
> 
> On Salvator-X, the enable pin is always pulled high, but the driver may
> still need to reset the PHY if this wasn't done by the bootloader
> before.
> 
> Inspired by patches in the BSP for the individual Salvator-X/XS boards
> by Kazuya Mizuguchi.
> 
> Signed-off-by: Geert Uytterhoeven <geert+renesas-gXvu3+zWzMSzQB+pC5nmwQ@public.gmane.org>
> ---
> For proper PHY reset operation during system resume, this depends on
> "ravb: Add missing PHY reset during system resume".
> However, this patch can be applied independently.
> ---
>  arch/arm64/boot/dts/renesas/salvator-common.dtsi | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/arch/arm64/boot/dts/renesas/salvator-common.dtsi b/arch/arm64/boot/dts/renesas/salvator-common.dtsi
> index ed4a8dfead3c2e58..db00e7c484f76eac 100644
> --- a/arch/arm64/boot/dts/renesas/salvator-common.dtsi
> +++ b/arch/arm64/boot/dts/renesas/salvator-common.dtsi
> @@ -296,6 +296,7 @@
>  	pinctrl-names = "default";
>  	renesas,no-ether-link;
>  	phy-handle = <&phy0>;
> +	reset-gpios = <&gpio2 10 GPIO_ACTIVE_LOW>;
>  	status = "okay";
>  
>  	phy0: ethernet-phy@0 {

This should be a PHY node property, unless this GPIO pin really is
global to the MDIO bus itself.
Florian
--
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: stmmac: dwmac4: Re-enable MAC Rx before powering down
From: David Miller @ 2017-09-28 17:19 UTC (permalink / raw)
  To: ed.blake; +Cc: peppe.cavallaro, alexandre.torgue, netdev
In-Reply-To: <1506422693-26144-1-git-send-email-ed.blake@sondrel.com>

From: Ed Blake <ed.blake@sondrel.com>
Date: Tue, 26 Sep 2017 11:44:53 +0100

> Re-enable the MAC receiver by setting CONFIG_RE before powering down,
> as instructed in section 6.3.5.1 of [1].  Without this the MAC fails
> to receive WoL packets and never wakes up.
> 
> [1] DWC Ethernet QoS Databook 4.10a October 2014
> 
> Signed-off-by: Ed Blake <ed.blake@sondrel.com>

Applied.

^ permalink raw reply

* Re: [PATCH] net: stmmac: dwc-qos: Add suspend / resume support
From: David Miller @ 2017-09-28 17:19 UTC (permalink / raw)
  To: ed.blake; +Cc: peppe.cavallaro, alexandre.torgue, netdev
In-Reply-To: <1506422626-26058-1-git-send-email-ed.blake@sondrel.com>

From: Ed Blake <ed.blake@sondrel.com>
Date: Tue, 26 Sep 2017 11:43:46 +0100

> Add hook to stmmac_pltfr_pm_ops for suspend / resume handling.
> 
> Signed-off-by: Ed Blake <ed.blake@sondrel.com>

Applied.

^ permalink raw reply

* Re: [PATCH net-next v4] selftests: rtnetlink.sh: add rudimentary vrf test
From: David Miller @ 2017-09-28 17:14 UTC (permalink / raw)
  To: fw; +Cc: netdev
In-Reply-To: <20170926054042.2750-1-fw@strlen.de>

From: Florian Westphal <fw@strlen.de>
Date: Tue, 26 Sep 2017 07:40:42 +0200

> Acked-by: David Ahern <dsahern@gmail.com>
> Signed-off-by: Florian Westphal <fw@strlen.de>
> ---
>  Changes since v1: indent all lines with tabs, not spaces
> 
>  detaching this from the series, I want to avoid needless v5.

Applied, thanks.

^ permalink raw reply

* Re: [PATCH net] net: dsa: Fix network device registration order
From: David Miller @ 2017-09-28 17:13 UTC (permalink / raw)
  To: f.fainelli; +Cc: netdev, andrew, vivien.didelot, linux-kernel
In-Reply-To: <20170925225553.566-1-f.fainelli@gmail.com>

From: Florian Fainelli <f.fainelli@gmail.com>
Date: Mon, 25 Sep 2017 15:55:53 -0700

> We cannot be registering the network device first, then setting its
> carrier off and finally connecting it to a PHY, doing that leaves a
> window during which the carrier is at best inconsistent, and at worse
> the device is not usable without a down/up sequence since the network
> device is visible to user space with possibly no PHY device attached.
> 
> Re-order steps so that they make logical sense. This fixes some devices
> where the port was not usable after e.g: an unbind then bind of the
> driver.
> 
> Fixes: 0071f56e46da ("dsa: Register netdev before phy")
> Fixes: 91da11f870f0 ("net: Distributed Switch Architecture protocol support")
> Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>

Applied and queued up for -stable.

^ permalink raw reply

* Re: [PATCH net-next RFC 2/9] net: dsa: mv88e6xxx: expose switch time as a PTP hardware clock
From: Andrew Lunn @ 2017-09-28 17:03 UTC (permalink / raw)
  To: Brandon Streiff
  Cc: netdev, linux-kernel, David S. Miller, Florian Fainelli,
	Vivien Didelot, Richard Cochran, Erik Hons
In-Reply-To: <1506612341-18061-3-git-send-email-brandon.streiff@ni.com>

> +/* The 32-bit timestamp counter overflows every ~34.3 seconds; this task
> + * forces periodic reads so that we don't miss any wraparounds.
> + */
> +#define MV88E6XXX_TAI_OVERFLOW_PERIOD (34 * HZ / 2)
> +static void mv88e6xxx_ptp_overflow_check(struct work_struct *work)
> +{
> +	struct delayed_work *dw = to_delayed_work(work);
> +	struct mv88e6xxx_chip *chip =
> +		container_of(dw, struct mv88e6xxx_chip, overflow_work);
> +	bool timeout = time_is_before_jiffies(chip->last_overflow_check +
> +					      MV88E6XXX_TAI_OVERFLOW_PERIOD);
> +
> +	if (timeout) {

Why do you need this timeout? Do you think the kernel will call this
more often than required?

Also, if it did call this function early, you skip the read, and
reschedule. There is then a danger the next read is after the
wraparound.....

> +		mutex_lock(&chip->reg_lock);
> +		timecounter_read(&chip->tstamp_tc);
> +		chip->last_overflow_check = jiffies;
> +		mutex_unlock(&chip->reg_lock);
> +	}
> +
> +	schedule_delayed_work(&chip->overflow_work,
> +			      MV88E6XXX_TAI_OVERFLOW_PERIOD);
> +}

Thanks
	Andrew

^ permalink raw reply

* Re: [PATCH net-next RFC 2/9] net: dsa: mv88e6xxx: expose switch time as a PTP hardware clock
From: Andrew Lunn @ 2017-09-28 16:56 UTC (permalink / raw)
  To: Brandon Streiff
  Cc: netdev, linux-kernel, David S. Miller, Florian Fainelli,
	Vivien Didelot, Richard Cochran, Erik Hons
In-Reply-To: <1506612341-18061-3-git-send-email-brandon.streiff@ni.com>

On Thu, Sep 28, 2017 at 10:25:34AM -0500, Brandon Streiff wrote:
> This patch adds basic support for exposing the 32-bit timestamp counter
> inside the mv88e6xxx switch code as a ptp_clock.
> 
> Signed-off-by: Brandon Streiff <brandon.streiff@ni.com>
> ---
>  drivers/net/dsa/mv88e6xxx/Kconfig  |  10 +++
>  drivers/net/dsa/mv88e6xxx/Makefile |   1 +
>  drivers/net/dsa/mv88e6xxx/chip.c   |  20 +++++
>  drivers/net/dsa/mv88e6xxx/chip.h   |  16 ++++
>  drivers/net/dsa/mv88e6xxx/ptp.c    | 180 +++++++++++++++++++++++++++++++++++++
>  drivers/net/dsa/mv88e6xxx/ptp.h    |  83 +++++++++++++++++
>  6 files changed, 310 insertions(+)
>  create mode 100644 drivers/net/dsa/mv88e6xxx/ptp.c
>  create mode 100644 drivers/net/dsa/mv88e6xxx/ptp.h
> 
> diff --git a/drivers/net/dsa/mv88e6xxx/Kconfig b/drivers/net/dsa/mv88e6xxx/Kconfig
> index 1aaa7a9..ae9e7f7 100644
> --- a/drivers/net/dsa/mv88e6xxx/Kconfig
> +++ b/drivers/net/dsa/mv88e6xxx/Kconfig
> @@ -18,3 +18,13 @@ config NET_DSA_MV88E6XXX_GLOBAL2
>  
>  	  It is required on most chips. If the chip you compile the support for
>  	  doesn't have such registers set, say N here. In doubt, say Y.
> +
> +config NET_DSA_MV88E6XXX_PTP
> +	bool "PTP support for Marvell 88E6xxx"
> +	default n
> +	depends on NET_DSA_MV88E6XXX_GLOBAL2
> +	imply NETWORK_PHY_TIMESTAMPING

Hi Brandon

Cool to see this code.

One probably dumb question so far..

It is the MAC which is doing the time stamping, not they PHY?
So why NETWORK_PHY_TIMESTAMPING?

   Andrew

^ permalink raw reply

* Re: [patch net] net: dsa: mv88e6xxx: Allow dsa and cpu ports in multiple vlans
From: David Miller @ 2017-09-28 16:45 UTC (permalink / raw)
  To: andrew; +Cc: vivien.didelot, netdev
In-Reply-To: <1506375140-2853-1-git-send-email-andrew@lunn.ch>

From: Andrew Lunn <andrew@lunn.ch>
Date: Mon, 25 Sep 2017 23:32:20 +0200

> Ports with the same VLAN must all be in the same bridge. However the
> CPU and DSA ports need to be in multiple VLANs spread over multiple
> bridges. So exclude them when performing this test.
> 
> Fixes: b2f81d304cee ("net: dsa: add CPU and DSA ports as VLAN members")
> Signed-off-by: Andrew Lunn <andrew@lunn.ch>

Applied and queued up for -stable, thanks.

^ permalink raw reply

* Re: [Patch net-next v2] net_sched: use idr to allocate u32 filter handles
From: David Miller @ 2017-09-28 16:44 UTC (permalink / raw)
  To: xiyou.wangcong; +Cc: netdev, chrism, jhs
In-Reply-To: <20170925171351.4956-3-xiyou.wangcong@gmail.com>

From: Cong Wang <xiyou.wangcong@gmail.com>
Date: Mon, 25 Sep 2017 10:13:51 -0700

> Instead of calling u32_lookup_ht() in a loop to find
> a unused handle, just switch to idr API to allocate
> new handles. u32 filters are special as the handle
> could contain a hash table id and a key id, so we
> need two IDR to allocate each of them.
> 
> Cc: Chris Mi <chrism@mellanox.com>
> Cc: Jamal Hadi Salim <jhs@mojatatu.com>
> Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>

Applied.

^ permalink raw reply

* Re: [Patch net-next v2] net_sched: use idr to allocate basic filter handles
From: David Miller @ 2017-09-28 16:44 UTC (permalink / raw)
  To: xiyou.wangcong; +Cc: netdev, chrism, jhs
In-Reply-To: <20170925171351.4956-2-xiyou.wangcong@gmail.com>

From: Cong Wang <xiyou.wangcong@gmail.com>
Date: Mon, 25 Sep 2017 10:13:50 -0700

> Instead of calling basic_get() in a loop to find
> a unused handle, just switch to idr API to allocate
> new handles.
> 
> Cc: Chris Mi <chrism@mellanox.com>
> Cc: Jamal Hadi Salim <jhs@mojatatu.com>
> Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>

Applied.

^ permalink raw reply

* Re: [Patch net-next v2] net_sched: use idr to allocate bpf filter handles
From: David Miller @ 2017-09-28 16:44 UTC (permalink / raw)
  To: xiyou.wangcong; +Cc: netdev, daniel, chrism, jhs
In-Reply-To: <20170925171351.4956-1-xiyou.wangcong@gmail.com>

From: Cong Wang <xiyou.wangcong@gmail.com>
Date: Mon, 25 Sep 2017 10:13:49 -0700

> Instead of calling cls_bpf_get() in a loop to find
> a unused handle, just switch to idr API to allocate
> new handles.
> 
> Cc: Daniel Borkmann <daniel@iogearbox.net>
> Cc: Chris Mi <chrism@mellanox.com>
> Cc: Jamal Hadi Salim <jhs@mojatatu.com>
> Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>

Applied.

^ permalink raw reply

* Re: [PATCH net-next] inetpeer: speed up inetpeer_invalidate_tree()
From: David Miller @ 2017-09-28 16:41 UTC (permalink / raw)
  To: eric.dumazet; +Cc: netdev
In-Reply-To: <1506356054.6617.13.camel@edumazet-glaptop3.roam.corp.google.com>

From: Eric Dumazet <eric.dumazet@gmail.com>
Date: Mon, 25 Sep 2017 09:14:14 -0700

> From: Eric Dumazet <edumazet@google.com>
> 
> As measured in my prior patch ("sch_netem: faster rb tree removal"),
> rbtree_postorder_for_each_entry_safe() is nice looking but much slower
> than using rb_next() directly, except when tree is small enough
> to fit in CPU caches (then the cost is the same)
> 
> From: Eric Dumazet <edumazet@google.com>

Applied, thanks Eric.

^ permalink raw reply

* Re: [PATCH net] inetpeer: fix RCU lookup() again
From: David Miller @ 2017-09-28 16:40 UTC (permalink / raw)
  To: eric.dumazet; +Cc: netdev
In-Reply-To: <1506354002.6617.10.camel@edumazet-glaptop3.roam.corp.google.com>

From: Eric Dumazet <eric.dumazet@gmail.com>
Date: Mon, 25 Sep 2017 08:40:02 -0700

> From: Eric Dumazet <edumazet@google.com>
> 
> My prior fix was not complete, as we were dereferencing a pointer
> three times per node, not twice as I initially thought.
> 
> Fixes: 4cc5b44b29a9 ("inetpeer: fix RCU lookup()")
> Fixes: b145425f269a ("inetpeer: remove AVL implementation in favor of RB tree")
> Signed-off-by: Eric Dumazet <edumazet@google.com>

Applied.

^ permalink raw reply

* [PATCH v5 2/2] ip_tunnel: add mpls over gre encapsulation
From: Amine Kherbouche @ 2017-09-28 16:34 UTC (permalink / raw)
  To: netdev, davem, xeb, roopa; +Cc: amine.kherbouche, equinox
In-Reply-To: <cover.1506616214.git.amine.kherbouche@6wind.com>

This commit introduces the MPLSoGRE support (RFC 4023), using ip tunnel
API.

Encap:
  - Add a new iptunnel type mpls.
  - Share tx path: gre type mpls loaded from skb->protocol.

Decap:
  - pull gre hdr and call mpls_forward().

Signed-off-by: Amine Kherbouche <amine.kherbouche@6wind.com>
Acked-by: Roopa Prabhu <roopa@cumulusnetworks.com>
---
 include/net/gre.h              |  1 +
 include/uapi/linux/if_tunnel.h |  1 +
 net/ipv4/gre_demux.c           | 27 +++++++++++++++++++++++++++
 net/ipv4/ip_gre.c              |  3 +++
 net/ipv6/ip6_gre.c             |  3 +++
 net/mpls/af_mpls.c             | 36 ++++++++++++++++++++++++++++++++++++
 6 files changed, 71 insertions(+)

diff --git a/include/net/gre.h b/include/net/gre.h
index d25d836..aa3c4d3 100644
--- a/include/net/gre.h
+++ b/include/net/gre.h
@@ -35,6 +35,7 @@ struct net_device *gretap_fb_dev_create(struct net *net, const char *name,
 				       u8 name_assign_type);
 int gre_parse_header(struct sk_buff *skb, struct tnl_ptk_info *tpi,
 		     bool *csum_err, __be16 proto, int nhs);
+int mpls_gre_rcv(struct sk_buff *skb, int gre_hdr_len);
 
 static inline int gre_calc_hlen(__be16 o_flags)
 {
diff --git a/include/uapi/linux/if_tunnel.h b/include/uapi/linux/if_tunnel.h
index 2e52088..a2f48c0 100644
--- a/include/uapi/linux/if_tunnel.h
+++ b/include/uapi/linux/if_tunnel.h
@@ -84,6 +84,7 @@ enum tunnel_encap_types {
 	TUNNEL_ENCAP_NONE,
 	TUNNEL_ENCAP_FOU,
 	TUNNEL_ENCAP_GUE,
+	TUNNEL_ENCAP_MPLS,
 };
 
 #define TUNNEL_ENCAP_FLAG_CSUM		(1<<0)
diff --git a/net/ipv4/gre_demux.c b/net/ipv4/gre_demux.c
index b798862..40484a3 100644
--- a/net/ipv4/gre_demux.c
+++ b/net/ipv4/gre_demux.c
@@ -23,6 +23,9 @@
 #include <linux/netdevice.h>
 #include <linux/if_tunnel.h>
 #include <linux/spinlock.h>
+#if IS_ENABLED(CONFIG_MPLS)
+#include <linux/mpls.h>
+#endif
 #include <net/protocol.h>
 #include <net/gre.h>
 
@@ -122,6 +125,30 @@ int gre_parse_header(struct sk_buff *skb, struct tnl_ptk_info *tpi,
 }
 EXPORT_SYMBOL(gre_parse_header);
 
+#if IS_ENABLED(CONFIG_MPLS)
+int mpls_gre_rcv(struct sk_buff *skb, int gre_hdr_len)
+{
+	if (unlikely(!pskb_may_pull(skb, gre_hdr_len)))
+		goto drop;
+
+	/* Pop GRE hdr and reset the skb */
+	skb_pull(skb, gre_hdr_len);
+	skb_reset_network_header(skb);
+
+	return mpls_forward(skb, skb->dev, NULL, NULL);
+drop:
+	kfree_skb(skb);
+	return NET_RX_DROP;
+}
+#else
+int mpls_gre_rcv(struct sk_buff *skb, int gre_hdr_len)
+{
+	kfree_skb(skb);
+	return NET_RX_DROP;
+}
+#endif
+EXPORT_SYMBOL(mpls_gre_rcv);
+
 static int gre_rcv(struct sk_buff *skb)
 {
 	const struct gre_protocol *proto;
diff --git a/net/ipv4/ip_gre.c b/net/ipv4/ip_gre.c
index 9cee986..7a50e4f 100644
--- a/net/ipv4/ip_gre.c
+++ b/net/ipv4/ip_gre.c
@@ -412,6 +412,9 @@ static int gre_rcv(struct sk_buff *skb)
 			return 0;
 	}
 
+	if (unlikely(tpi.proto == htons(ETH_P_MPLS_UC)))
+		return mpls_gre_rcv(skb, hdr_len);
+
 	if (ipgre_rcv(skb, &tpi, hdr_len) == PACKET_RCVD)
 		return 0;
 
diff --git a/net/ipv6/ip6_gre.c b/net/ipv6/ip6_gre.c
index c82d41e..440efb1 100644
--- a/net/ipv6/ip6_gre.c
+++ b/net/ipv6/ip6_gre.c
@@ -476,6 +476,9 @@ static int gre_rcv(struct sk_buff *skb)
 	if (hdr_len < 0)
 		goto drop;
 
+	if (unlikely(tpi.proto == htons(ETH_P_MPLS_UC)))
+		return mpls_gre_rcv(skb, hdr_len);
+
 	if (iptunnel_pull_header(skb, hdr_len, tpi.proto, false))
 		goto drop;
 
diff --git a/net/mpls/af_mpls.c b/net/mpls/af_mpls.c
index 36ea2ad..4274243 100644
--- a/net/mpls/af_mpls.c
+++ b/net/mpls/af_mpls.c
@@ -16,6 +16,7 @@
 #include <net/arp.h>
 #include <net/ip_fib.h>
 #include <net/netevent.h>
+#include <net/ip_tunnels.h>
 #include <net/netns/generic.h>
 #if IS_ENABLED(CONFIG_IPV6)
 #include <net/ipv6.h>
@@ -39,6 +40,36 @@ static int one = 1;
 static int label_limit = (1 << 20) - 1;
 static int ttl_max = 255;
 
+#if IS_ENABLED(CONFIG_NET_IP_TUNNEL)
+size_t ipgre_mpls_encap_hlen(struct ip_tunnel_encap *e)
+{
+	return sizeof(struct mpls_shim_hdr);
+}
+
+static const struct ip_tunnel_encap_ops mpls_iptun_ops = {
+	.encap_hlen	= ipgre_mpls_encap_hlen,
+};
+
+static int ipgre_tunnel_encap_add_mpls_ops(void)
+{
+	return ip_tunnel_encap_add_ops(&mpls_iptun_ops, TUNNEL_ENCAP_MPLS);
+}
+
+static void ipgre_tunnel_encap_del_mpls_ops(void)
+{
+	ip_tunnel_encap_del_ops(&mpls_iptun_ops, TUNNEL_ENCAP_MPLS);
+}
+#else
+static int ipgre_tunnel_encap_add_mpls_ops(void)
+{
+	return 0;
+}
+
+static void ipgre_tunnel_encap_del_mpls_ops(void)
+{
+}
+#endif
+
 static void rtmsg_lfib(int event, u32 label, struct mpls_route *rt,
 		       struct nlmsghdr *nlh, struct net *net, u32 portid,
 		       unsigned int nlm_flags);
@@ -2486,6 +2517,10 @@ static int __init mpls_init(void)
 		      0);
 	rtnl_register(PF_MPLS, RTM_GETNETCONF, mpls_netconf_get_devconf,
 		      mpls_netconf_dump_devconf, 0);
+	err = ipgre_tunnel_encap_add_mpls_ops();
+	if (err)
+		pr_err("Can't add mpls over gre tunnel ops\n");
+
 	err = 0;
 out:
 	return err;
@@ -2503,6 +2538,7 @@ static void __exit mpls_exit(void)
 	dev_remove_pack(&mpls_packet_type);
 	unregister_netdevice_notifier(&mpls_dev_notifier);
 	unregister_pernet_subsys(&mpls_net_ops);
+	ipgre_tunnel_encap_del_mpls_ops();
 }
 module_exit(mpls_exit);
 
-- 
2.1.4

^ permalink raw reply related

* [PATCH v5 1/2] mpls: export mpls_forward()
From: Amine Kherbouche @ 2017-09-28 16:34 UTC (permalink / raw)
  To: netdev, davem, xeb, roopa; +Cc: amine.kherbouche, equinox
In-Reply-To: <cover.1506616214.git.amine.kherbouche@6wind.com>

Exporting mpls_forward() function to be able to be called from elsewhere
such as MPLSoverGRE in the next commit.

Signed-off-by: Amine Kherbouche <amine.kherbouche@6wind.com>
Acked-by: Roopa Prabhu <roopa@cumulusnetworks.com>
---
 include/linux/mpls.h | 4 ++++
 net/mpls/af_mpls.c   | 5 +++--
 2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/include/linux/mpls.h b/include/linux/mpls.h
index 384fb22..b0579ab 100644
--- a/include/linux/mpls.h
+++ b/include/linux/mpls.h
@@ -2,10 +2,14 @@
 #define _LINUX_MPLS_H
 
 #include <uapi/linux/mpls.h>
+#include <linux/netdevice.h>
 
 #define MPLS_TTL_MASK		(MPLS_LS_TTL_MASK >> MPLS_LS_TTL_SHIFT)
 #define MPLS_BOS_MASK		(MPLS_LS_S_MASK >> MPLS_LS_S_SHIFT)
 #define MPLS_TC_MASK		(MPLS_LS_TC_MASK >> MPLS_LS_TC_SHIFT)
 #define MPLS_LABEL_MASK		(MPLS_LS_LABEL_MASK >> MPLS_LS_LABEL_SHIFT)
 
+int mpls_forward(struct sk_buff *skb, struct net_device *dev,
+		 struct packet_type *pt, struct net_device *orig_dev);
+
 #endif  /* _LINUX_MPLS_H */
diff --git a/net/mpls/af_mpls.c b/net/mpls/af_mpls.c
index c5b9ce4..36ea2ad 100644
--- a/net/mpls/af_mpls.c
+++ b/net/mpls/af_mpls.c
@@ -307,8 +307,8 @@ static bool mpls_egress(struct net *net, struct mpls_route *rt,
 	return success;
 }
 
-static int mpls_forward(struct sk_buff *skb, struct net_device *dev,
-			struct packet_type *pt, struct net_device *orig_dev)
+int mpls_forward(struct sk_buff *skb, struct net_device *dev,
+		 struct packet_type *pt, struct net_device *orig_dev)
 {
 	struct net *net = dev_net(dev);
 	struct mpls_shim_hdr *hdr;
@@ -442,6 +442,7 @@ static int mpls_forward(struct sk_buff *skb, struct net_device *dev,
 	kfree_skb(skb);
 	return NET_RX_DROP;
 }
+EXPORT_SYMBOL(mpls_forward);
 
 static struct packet_type mpls_packet_type __read_mostly = {
 	.type = cpu_to_be16(ETH_P_MPLS_UC),
-- 
2.1.4

^ permalink raw reply related

* [PATCH v5 0/2] Introduce MPLS over GRE
From: Amine Kherbouche @ 2017-09-28 16:34 UTC (permalink / raw)
  To: netdev, davem, xeb, roopa; +Cc: amine.kherbouche, equinox

This series introduces the MPLS over GRE encapsulation (RFC 4023).

Various applications of MPLS make use of label stacks with multiple
entries.  In some cases, it is possible to replace the top label of
the stack with an IP-based encapsulation, thereby, it is possible for
two LSRs that are adjacent on an LSP to be separated by an IP network,
even if that IP network does not provide MPLS.

Changes in v5:
  - Reword first commit title.

Changes in v4:
  - Bring back mpls_forward() function exportation patch.
  - Move back mpls_gre_rcv() to gre module file and wrap it under
    ifdef.

Changes in v3:
  - remove mpls_forward() function exportation patch.
  - wrap efficiently mpls iptunnel add/del functions and dependent
    function/structure.
  - move mpls_gre_rcv to af_mpls.c file and export it.
  - remove unnecessary functions.
 
Changes in v2:
  - wrap ip tunnel functions under ifdef in mpls file.
  - fix indentation.
  - check return code.

An example of configuration:


         node1                LER1                       LER2                node2
        +-----+             +------+                   +------+             +-----+
        |     |             |      |                   |      |             |     |
        |     |             |      |p3  GRE tunnel   p4|      |             |     |
        |     |p1         p2|      +-------------------+      |p5         p6|     |
        |     +-------------+      +-------------------+      +------------+|     |
        |     |10.100.0.0/24|      |                   |      |10.200.0.0/24|     |
        |     |fd00:100::/64|      |  10.125.0.0/24    |      |fd00:200::/64|     |
        |     |             |      |  fd00:125::/64    |      |             |     |
        |     |             |      |                   |      |             |     |
        |     |             |      |                   |      |             |     |
        |     |             |      |                   |      |             |     |
        |     |             |      |                   |      |             |     |
        +-----+             +------+                   +------+             +-----+


		###	node1	###

ip link set p1 up
ip addr add 10.100.0.1/24 dev p1

		###	LER1	###

ip link set p2 up
ip addr add 10.100.0.2/24 dev p2

ip link set p3 up
ip addr add 10.125.0.1/24 dev p3

modprobe mpls_router
sysctl -w net.mpls.conf.p2.input=1
sysctl -w net.mpls.conf.p3.input=1
sysctl -w net.mpls.platform_labels=1000

ip link add gre1 type gre ttl 64 local 10.125.0.1 remote 10.125.0.2 dev p3
ip link set dev gre1 up

ip -M route add 111 as 222 dev gre1
ip -M route add 555 as 666 via inet 10.100.0.1 dev p2

		###	LER2	###

ip link set p5 up
ip addr add 10.200.0.2/24 dev p5

ip link set p4 up
ip addr add 10.125.0.2/24 dev p4

modprobe mpls_router
sysctl -w net.mpls.conf.p4.input=1
sysctl -w net.mpls.conf.p5.input=1
sysctl -w net.mpls.platform_labels=1000

ip link add gre1 type gre ttl 64 local 10.125.0.2 remote 10.125.0.1 dev p4
ip link set dev gre1 up

ip -M route add 444 as 555 dev gre1
ip -M route add 222 as 333 via inet 10.200.0.1 dev p5

		###	node2	###

ip link set p6 up
ip addr add 10.200.0.1/24 dev p6


Now using this scapy to forge and send packets from the port p1 of node1:

p = Ether(src='de:ed:01:0c:41:09', dst='de:ed:01:2f:3b:ba')
p /= MPLS(s=1, ttl=64, label=111)/Raw(load='\xde')
sendp(p, iface="p1", count=20, inter=0.1)

Amine Kherbouche (2):
  mpls: export mpls_forward()
  ip_tunnel: add mpls over gre encapsulation

 include/linux/mpls.h           |  4 ++++
 include/net/gre.h              |  1 +
 include/uapi/linux/if_tunnel.h |  1 +
 net/ipv4/gre_demux.c           | 27 +++++++++++++++++++++++++++
 net/ipv4/ip_gre.c              |  3 +++
 net/ipv6/ip6_gre.c             |  3 +++
 net/mpls/af_mpls.c             | 41 +++++++++++++++++++++++++++++++++++++++--
 7 files changed, 78 insertions(+), 2 deletions(-)

-- 
2.1.4

^ permalink raw reply

* Re: [PATCH net v2 0/3] net: mvpp2: various fixes
From: David Miller @ 2017-09-28 16:34 UTC (permalink / raw)
  To: antoine.tenart
  Cc: andrew, gregory.clement, thomas.petazzoni, miquel.raynal, nadavh,
	linux, linux-kernel, mw, stefanc, netdev
In-Reply-To: <20170925125948.13507-1-antoine.tenart@free-electrons.com>

From: Antoine Tenart <antoine.tenart@free-electrons.com>
Date: Mon, 25 Sep 2017 14:59:45 +0200

> This series contains 3 fixes for the Marvell PPv2 driver.

Series applied, thanks.

^ permalink raw reply

* Re: [PATCH] isdn/eicon: do integrity check on cmd->adapter == a->controller early
From: David Miller @ 2017-09-28 16:32 UTC (permalink / raw)
  To: mengxu.gatech; +Cc: mac, isdn, netdev, linux-kernel, meng.xu, sanidhya, taesoo
In-Reply-To: <1506266081-22895-1-git-send-email-mengxu.gatech@gmail.com>

From: Meng Xu <mengxu.gatech@gmail.com>
Date: Sun, 24 Sep 2017 11:14:41 -0400

> +		/* do the integrity check early */
> +		if(((diva_xdi_um_cfg_cmd_t *)data)->adapter != a->controller){
> +			DBG_ERR(("A: A(%d) write, invalid controller=%d != %d",
> +						((diva_xdi_um_cfg_cmd_t *)data)->adapter, a->controller));
> +

DBG_ERR() has a trailing semicolon in it's definition, so if you add
another one when you invoke it there will be two ";;".

This whole code base is such a mess, I really think there is little
to no value in trying to make minor changes here.

So unless you are fixing some kind of exploitable hole, please drop
this.

Thank you.

^ permalink raw reply

* Re: [PATCH net-next RFC 1/9] net: dsa: mv88e6xxx: add accessors for PTP/TAI registers
From: Vivien Didelot @ 2017-09-28 16:29 UTC (permalink / raw)
  To: Brandon Streiff, netdev
  Cc: linux-kernel, David S. Miller, Florian Fainelli, Andrew Lunn,
	Richard Cochran, Erik Hons, Brandon Streiff
In-Reply-To: <1506612341-18061-2-git-send-email-brandon.streiff@ni.com>

Hi Brandon,

Brandon Streiff <brandon.streiff@ni.com> writes:

> +	.port_ptp_read		= mv88e6352_port_ptp_read,
> +	.port_ptp_write		= mv88e6352_port_ptp_write,
> +	.ptp_read		= mv88e6352_ptp_read,
> +	.ptp_write		= mv88e6352_ptp_write,
> +	.tai_read		= mv88e6352_tai_read,
> +	.tai_write		= mv88e6352_tai_write,

> +	.port_ptp_read		= mv88e6390_port_ptp_read,
> +	.port_ptp_write		= mv88e6390_port_ptp_write,
> +	.ptp_read		= mv88e6390_ptp_read,
> +	.ptp_write		= mv88e6390_ptp_write,
> +	.tai_read		= mv88e6390_tai_read,
> +	.tai_write		= mv88e6390_tai_write,

Only nitpick: please keep the mv88e63{52,90}_g2_avb_ prefix here.

Otherwise thanks for respecting the code organization, very clear patch:

Reviewed-by: Vivien Didelot <vivien.didelot@savoirfairelinux.com>


             Vivien

^ permalink raw reply


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox