* Re: [PATCH net-next 1/2] net: erspan: fix wrong return value
From: 严海双 @ 2017-12-16 7:33 UTC (permalink / raw)
To: William Tu; +Cc: netdev
In-Reply-To: <1513376864-33777-2-git-send-email-u9012063@gmail.com>
> On 2017年12月16日, at 上午6:27, William Tu <u9012063@gmail.com> wrote:
>
> If pskb_may_pull return failed, return PACKET_REJECT
> instead of -ENOMEM.
>
> Fixes: 94d7d8f29287 ("ip6_gre: add erspan v2 support")
> Fixes: f551c91de262 ("net: erspan: introduce erspan v2 for ip_gre")
> Signed-off-by: William Tu <u9012063@gmail.com>
> Cc: Haishuang Yan <yanhaishuang@cmss.chinamobile.com>
Acked-by: Haishuang Yan <yanhaishuang@cmss.chinamobile.com>
^ permalink raw reply
* Re: [PATCH v2 net-next 2/4] net: tracepoint: replace tcp_set_state tracepoint with sock_set_state tracepoint
From: Yafang Shao @ 2017-12-16 6:34 UTC (permalink / raw)
To: Song Liu
Cc: David Miller, marcelo.leitner@gmail.com, Steven Rostedt,
Brendan Gregg, netdev@vger.kernel.org,
linux-kernel@vger.kernel.org
In-Reply-To: <4AB9713E-7E2D-4232-868B-ACE8364E33A0@fb.com>
2017-12-16 6:47 GMT+08:00 Song Liu <songliubraving@fb.com>:
>
>> On Dec 15, 2017, at 9:56 AM, Yafang Shao <laoar.shao@gmail.com> wrote:
>>
>> As sk_state is a common field for struct sock, so the state
>> transition should not be a TCP specific feature.
>> So I rename tcp_set_state tracepoint to sock_set_state tracepoint with
>> some minor changes and move it into file trace/events/sock.h.
>>
>> Two helpers are introduced to trace sk_state transition
>> - void sk_state_store(struct sock *sk, int state);
>> - void sk_set_state(struct sock *sk, int state);
>> As trace header should not be included in other header files,
>> so they are defined in sock.c.
>>
>> The protocol such as SCTP maybe compiled as a ko, hence export
>> sk_set_state().
>>
>> Signed-off-by: Yafang Shao <laoar.shao@gmail.com>
>> ---
>> include/net/sock.h | 15 +-----
>> include/trace/events/sock.h | 106 ++++++++++++++++++++++++++++++++++++++++
>> include/trace/events/tcp.h | 91 ----------------------------------
>> net/core/sock.c | 13 +++++
>> net/ipv4/inet_connection_sock.c | 4 +-
>> net/ipv4/inet_hashtables.c | 2 +-
>> net/ipv4/tcp.c | 4 --
>> 7 files changed, 124 insertions(+), 111 deletions(-)
>>
>> diff --git a/include/net/sock.h b/include/net/sock.h
>> index 9a90472..988ce82 100644
>> --- a/include/net/sock.h
>> +++ b/include/net/sock.h
>> @@ -2344,19 +2344,8 @@ static inline int sk_state_load(const struct sock *sk)
>> return smp_load_acquire(&sk->sk_state);
>> }
>>
>> -/**
>> - * sk_state_store - update sk->sk_state
>> - * @sk: socket pointer
>> - * @newstate: new state
>> - *
>> - * Paired with sk_state_load(). Should be used in contexts where
>> - * state change might impact lockless readers.
>> - */
>> -static inline void sk_state_store(struct sock *sk, int newstate)
>> -{
>> - smp_store_release(&sk->sk_state, newstate);
>> -}
>> -
>> +void sk_state_store(struct sock *sk, int newstate);
>> +void sk_set_state(struct sock *sk, int state);
>> void sock_enable_timestamp(struct sock *sk, int flag);
>> int sock_get_timestamp(struct sock *, struct timeval __user *);
>> int sock_get_timestampns(struct sock *, struct timespec __user *);
>> diff --git a/include/trace/events/sock.h b/include/trace/events/sock.h
>> index ec4dade..61977e5 100644
>> --- a/include/trace/events/sock.h
>> +++ b/include/trace/events/sock.h
>> @@ -6,7 +6,49 @@
>> #define _TRACE_SOCK_H
>>
>> #include <net/sock.h>
>> +#include <net/ipv6.h>
>> #include <linux/tracepoint.h>
>> +#include <linux/ipv6.h>
>> +#include <linux/tcp.h>
>> +
>> +#define inet_protocol_names \
>> + EM(IPPROTO_TCP) \
>> + EM(IPPROTO_DCCP) \
>> + EMe(IPPROTO_SCTP)
>> +
>> +#define tcp_state_names \
>> + EM(TCP_ESTABLISHED) \
>> + EM(TCP_SYN_SENT) \
>> + EM(TCP_SYN_RECV) \
>> + EM(TCP_FIN_WAIT1) \
>> + EM(TCP_FIN_WAIT2) \
>> + EM(TCP_TIME_WAIT) \
>> + EM(TCP_CLOSE) \
>> + EM(TCP_CLOSE_WAIT) \
>> + EM(TCP_LAST_ACK) \
>> + EM(TCP_LISTEN) \
>> + EM(TCP_CLOSING) \
>> + EMe(TCP_NEW_SYN_RECV)
>
> Please keep these backslashes aligned.
>
OK
This is because I made it aligned with TAB in my original code.
>> +/* enums need to be exported to user space */
>> +#undef EM
>> +#undef EMe
>> +#define EM(a) TRACE_DEFINE_ENUM(a);
>> +#define EMe(a) TRACE_DEFINE_ENUM(a);
>> +
>> +inet_protocol_names
>> +tcp_state_names
>> +
>> +#undef EM
>> +#undef EMe
>> +#define EM(a) { a, #a },
>> +#define EMe(a) { a, #a }
>> +
>> +#define show_inet_protocol_name(val) \
>> + __print_symbolic(val, inet_protocol_names)
>> +
>> +#define show_tcp_state_name(val) \
>> + __print_symbolic(val, tcp_state_names)
>>
>> TRACE_EVENT(sock_rcvqueue_full,
>>
>> @@ -63,6 +105,70 @@
>> __entry->rmem_alloc)
>> );
>>
>> +TRACE_EVENT(sock_set_state,
>> +
>> + TP_PROTO(const struct sock *sk, const int oldstate, const int newstate),
>> +
>> + TP_ARGS(sk, oldstate, newstate),
>> +
>> + TP_STRUCT__entry(
>> + __field(const void *, skaddr)
>> + __field(int, oldstate)
>> + __field(int, newstate)
>> + __field(__u16, sport)
>> + __field(__u16, dport)
>> + __field(__u8, protocol)
>> + __array(__u8, saddr, 4)
>> + __array(__u8, daddr, 4)
>> + __array(__u8, saddr_v6, 16)
>> + __array(__u8, daddr_v6, 16)
>> + ),
>> +
>> + TP_fast_assign(
>> + struct inet_sock *inet = inet_sk(sk);
>> + struct in6_addr *pin6;
>> + __be32 *p32;
>> +
>> + __entry->skaddr = sk;
>> + __entry->oldstate = oldstate;
>> + __entry->newstate = newstate;
>> +
>> + __entry->protocol = sk->sk_protocol;
>> + __entry->sport = ntohs(inet->inet_sport);
>> + __entry->dport = ntohs(inet->inet_dport);
>> +
>> + p32 = (__be32 *) __entry->saddr;
>> + *p32 = inet->inet_saddr;
>> +
>> + p32 = (__be32 *) __entry->daddr;
>> + *p32 = inet->inet_daddr;
>> +
>> +#if IS_ENABLED(CONFIG_IPV6)
>> + if (sk->sk_family == AF_INET6) {
>> + pin6 = (struct in6_addr *)__entry->saddr_v6;
>> + *pin6 = sk->sk_v6_rcv_saddr;
>> + pin6 = (struct in6_addr *)__entry->daddr_v6;
>> + *pin6 = sk->sk_v6_daddr;
>> + } else
>> +#endif
>> + {
>> + pin6 = (struct in6_addr *)__entry->saddr_v6;
>> + ipv6_addr_set_v4mapped(inet->inet_saddr, pin6);
>> + pin6 = (struct in6_addr *)__entry->daddr_v6;
>> + ipv6_addr_set_v4mapped(inet->inet_daddr, pin6);
>> + }
>> + ),
>
> What if sk_family is not AF_INET or AF_INET6? We are probably OK not
> checking it for tcp, but we should definitely consider this for all
> sockets in general.
>
This is the question I had been think of.
Do it make sense to trace as much protocol as possible ?
Maybe not.
Take IPPROTO_UDP for example, it only has two states, TCP_CLOSE and
TCP_ESTABLISHED.
Maybe it is useless to trace UDP sk_state transition.
So In this patch I only trace TCP/DCCP/SCTP state transition, which
have multi states and the states transition could help us analyze
problems.
All these three protocol are AF_INET/AF_INET6.
IMO, maybe it doesn't need to trace protocols which are not
AF_INET/AF_INET6. So we don't need to make the code complicate and
output some usless infomation.
Thanks
Yafang
^ permalink raw reply
* [net-next:master 353/390] drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c:1290:37-38: Unneeded semicolon
From: kbuild test robot @ 2017-12-16 5:49 UTC (permalink / raw)
To: Salil Mehta; +Cc: kbuild-all, netdev, lipeng
tree: https://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next.git master
head: 28dc4c8f4557d82e9be020e85e2362239270e704
commit: e963cb789a29b890678b58ef7da5d7c497510b7e [353/390] net: hns3: Add HNS3 VF driver to kernel build framework
coccinelle warnings: (new ones prefixed by >>)
>> drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c:1290:37-38: Unneeded semicolon
vim +1290 drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c
e2cb1dec Salil Mehta 2017-12-14 1262
e2cb1dec Salil Mehta 2017-12-14 1263 static int hclgevf_pci_init(struct hclgevf_dev *hdev)
e2cb1dec Salil Mehta 2017-12-14 1264 {
e2cb1dec Salil Mehta 2017-12-14 1265 struct pci_dev *pdev = hdev->pdev;
e2cb1dec Salil Mehta 2017-12-14 1266 struct hclgevf_hw *hw;
e2cb1dec Salil Mehta 2017-12-14 1267 int ret;
e2cb1dec Salil Mehta 2017-12-14 1268
e2cb1dec Salil Mehta 2017-12-14 1269 ret = pci_enable_device(pdev);
e2cb1dec Salil Mehta 2017-12-14 1270 if (ret) {
e2cb1dec Salil Mehta 2017-12-14 1271 dev_err(&pdev->dev, "failed to enable PCI device\n");
e2cb1dec Salil Mehta 2017-12-14 1272 goto err_no_drvdata;
e2cb1dec Salil Mehta 2017-12-14 1273 }
e2cb1dec Salil Mehta 2017-12-14 1274
e2cb1dec Salil Mehta 2017-12-14 1275 ret = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64));
e2cb1dec Salil Mehta 2017-12-14 1276 if (ret) {
e2cb1dec Salil Mehta 2017-12-14 1277 dev_err(&pdev->dev, "can't set consistent PCI DMA, exiting");
e2cb1dec Salil Mehta 2017-12-14 1278 goto err_disable_device;
e2cb1dec Salil Mehta 2017-12-14 1279 }
e2cb1dec Salil Mehta 2017-12-14 1280
e2cb1dec Salil Mehta 2017-12-14 1281 ret = pci_request_regions(pdev, HCLGEVF_DRIVER_NAME);
e2cb1dec Salil Mehta 2017-12-14 1282 if (ret) {
e2cb1dec Salil Mehta 2017-12-14 1283 dev_err(&pdev->dev, "PCI request regions failed %d\n", ret);
e2cb1dec Salil Mehta 2017-12-14 1284 goto err_disable_device;
e2cb1dec Salil Mehta 2017-12-14 1285 }
e2cb1dec Salil Mehta 2017-12-14 1286
e2cb1dec Salil Mehta 2017-12-14 1287 pci_set_master(pdev);
e2cb1dec Salil Mehta 2017-12-14 1288 hw = &hdev->hw;
e2cb1dec Salil Mehta 2017-12-14 1289 hw->hdev = hdev;
e2cb1dec Salil Mehta 2017-12-14 @1290 hw->io_base = pci_iomap(pdev, 2, 0);;
e2cb1dec Salil Mehta 2017-12-14 1291 if (!hw->io_base) {
e2cb1dec Salil Mehta 2017-12-14 1292 dev_err(&pdev->dev, "can't map configuration register space\n");
e2cb1dec Salil Mehta 2017-12-14 1293 ret = -ENOMEM;
e2cb1dec Salil Mehta 2017-12-14 1294 goto err_clr_master;
e2cb1dec Salil Mehta 2017-12-14 1295 }
e2cb1dec Salil Mehta 2017-12-14 1296
e2cb1dec Salil Mehta 2017-12-14 1297 return 0;
e2cb1dec Salil Mehta 2017-12-14 1298
e2cb1dec Salil Mehta 2017-12-14 1299 err_clr_master:
e2cb1dec Salil Mehta 2017-12-14 1300 pci_clear_master(pdev);
e2cb1dec Salil Mehta 2017-12-14 1301 pci_release_regions(pdev);
e2cb1dec Salil Mehta 2017-12-14 1302 err_disable_device:
e2cb1dec Salil Mehta 2017-12-14 1303 pci_disable_device(pdev);
e2cb1dec Salil Mehta 2017-12-14 1304 err_no_drvdata:
e2cb1dec Salil Mehta 2017-12-14 1305 pci_set_drvdata(pdev, NULL);
e2cb1dec Salil Mehta 2017-12-14 1306 return ret;
e2cb1dec Salil Mehta 2017-12-14 1307 }
e2cb1dec Salil Mehta 2017-12-14 1308
:::::: The code at line 1290 was first introduced by commit
:::::: e2cb1dec9779ba2d89302a653eb0abaeb8682196 net: hns3: Add HNS3 VF HCL(Hardware Compatibility Layer) Support
:::::: TO: Salil Mehta <salil.mehta@huawei.com>
:::::: CC: David S. Miller <davem@davemloft.net>
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
^ permalink raw reply
* [PATCH v4 2/2] ARM64: dts: meson-axg: enable ethernet for A113D S400 board
From: Yixun Lan @ 2017-12-16 3:55 UTC (permalink / raw)
To: devicetree, Kevin Hilman
Cc: Neil Armstrong, Jerome Brunet, Giuseppe Cavallaro,
Alexandre Torgue, Carlo Caione, Yixun Lan, linux-amlogic,
linux-arm-kernel, linux-kernel, netdev
In-Reply-To: <20171216035527.96952-1-yixun.lan@amlogic.com>
This is tested in the S400 dev board which use a RTL8211F PHY,
and the pins connect to the 'eth_rgmii_y_pins' group.
Reviewed-by: Neil Armstrong <narmstrong@baylibre.com>
Signed-off-by: Yixun Lan <yixun.lan@amlogic.com>
---
arch/arm64/boot/dts/amlogic/meson-axg-s400.dts | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/arch/arm64/boot/dts/amlogic/meson-axg-s400.dts b/arch/arm64/boot/dts/amlogic/meson-axg-s400.dts
index 70eca1f8736a..8932654f5090 100644
--- a/arch/arm64/boot/dts/amlogic/meson-axg-s400.dts
+++ b/arch/arm64/boot/dts/amlogic/meson-axg-s400.dts
@@ -17,6 +17,13 @@
};
};
+ðmac {
+ status = "okay";
+ phy-mode = "rgmii";
+ pinctrl-0 = <ð_rgmii_y_pins>;
+ pinctrl-names = "default";
+};
+
&uart_AO {
status = "okay";
};
--
2.15.1
^ permalink raw reply related
* [PATCH v4 1/2] ARM64: dts: meson-axg: add ethernet mac controller
From: Yixun Lan @ 2017-12-16 3:55 UTC (permalink / raw)
To: devicetree, Kevin Hilman
Cc: Neil Armstrong, Jerome Brunet, Giuseppe Cavallaro,
Alexandre Torgue, Carlo Caione, Yixun Lan, linux-amlogic,
linux-arm-kernel, linux-kernel, netdev
In-Reply-To: <20171216035527.96952-1-yixun.lan@amlogic.com>
Add DT info for the stmmac ethernet MAC which found in
the Amlogic's Meson-AXG SoC, also describe the ethernet
pinctrl & clock information here.
Reviewed-by: Neil Armstrong <narmstrong@baylibre.com>
Signed-off-by: Yixun Lan <yixun.lan@amlogic.com>
---
arch/arm64/boot/dts/amlogic/meson-axg.dtsi | 54 ++++++++++++++++++++++++++++++
1 file changed, 54 insertions(+)
diff --git a/arch/arm64/boot/dts/amlogic/meson-axg.dtsi b/arch/arm64/boot/dts/amlogic/meson-axg.dtsi
index d288d4724ae3..dea1bc31b4de 100644
--- a/arch/arm64/boot/dts/amlogic/meson-axg.dtsi
+++ b/arch/arm64/boot/dts/amlogic/meson-axg.dtsi
@@ -7,6 +7,7 @@
#include <dt-bindings/gpio/gpio.h>
#include <dt-bindings/interrupt-controller/irq.h>
#include <dt-bindings/interrupt-controller/arm-gic.h>
+#include <dt-bindings/clock/axg-clkc.h>
/ {
compatible = "amlogic,meson-axg";
@@ -155,6 +156,19 @@
};
};
+ ethmac: ethernet@ff3f0000 {
+ compatible = "amlogic,meson-gxbb-dwmac", "snps,dwmac";
+ reg = <0x0 0xff3f0000 0x0 0x10000
+ 0x0 0xff634540 0x0 0x8>;
+ interrupts = <GIC_SPI 8 IRQ_TYPE_EDGE_RISING>;
+ interrupt-names = "macirq";
+ clocks = <&clkc CLKID_ETH>,
+ <&clkc CLKID_FCLK_DIV2>,
+ <&clkc CLKID_MPLL2>;
+ clock-names = "stmmaceth", "clkin0", "clkin1";
+ status = "disabled";
+ };
+
gic: interrupt-controller@ffc01000 {
compatible = "arm,gic-400";
reg = <0x0 0xffc01000 0 0x1000>,
@@ -215,6 +229,46 @@
gpio-ranges = <&pinctrl_periphs 0 0 86>;
};
+ eth_rgmii_x_pins: eth-x-rgmii {
+ mux {
+ groups = "eth_mdio_x",
+ "eth_mdc_x",
+ "eth_rgmii_rx_clk_x",
+ "eth_rx_dv_x",
+ "eth_rxd0_x",
+ "eth_rxd1_x",
+ "eth_rxd2_rgmii",
+ "eth_rxd3_rgmii",
+ "eth_rgmii_tx_clk",
+ "eth_txen_x",
+ "eth_txd0_x",
+ "eth_txd1_x",
+ "eth_txd2_rgmii",
+ "eth_txd3_rgmii";
+ function = "eth";
+ };
+ };
+
+ eth_rgmii_y_pins: eth-y-rgmii {
+ mux {
+ groups = "eth_mdio_y",
+ "eth_mdc_y",
+ "eth_rgmii_rx_clk_y",
+ "eth_rx_dv_y",
+ "eth_rxd0_y",
+ "eth_rxd1_y",
+ "eth_rxd2_rgmii",
+ "eth_rxd3_rgmii",
+ "eth_rgmii_tx_clk",
+ "eth_txen_y",
+ "eth_txd0_y",
+ "eth_txd1_y",
+ "eth_txd2_rgmii",
+ "eth_txd3_rgmii";
+ function = "eth";
+ };
+ };
+
pwm_a_a_pins: pwm_a_a {
mux {
groups = "pwm_a_a";
--
2.15.1
^ permalink raw reply related
* [PATCH v4 0/2] Add ethernet support for Meson-AXG SoC
From: Yixun Lan @ 2017-12-16 3:55 UTC (permalink / raw)
To: devicetree-u79uwXL29TY76Z2rM5mHXA, Kevin Hilman
Cc: Neil Armstrong, Jerome Brunet, Giuseppe Cavallaro,
Alexandre Torgue, Carlo Caione, Yixun Lan,
linux-amlogic-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
linux-kernel-u79uwXL29TY76Z2rM5mHXA,
netdev-u79uwXL29TY76Z2rM5mHXA
This series try to add support for the ethernet MAC controller
found in Meson-AXG SoC, and also enable it in the S400 board.
Hi Kevin:
You still need to at least merge the clock patch[3] in order to
compile the DTS, or just merge the tag from meson-clock's tree[6]
- the tag is 'meson-clk-for-v4.16-2', since the clock part already
taken there.
Changes in v4 since [5]:
- rebase to kevin's v4.16/dt64
- fix order
Changes in v3 since [4]:
- put clock DT info in soc.dtsi
- separate DT for 'add support for the controller' vs 'enable in board'
Changes in v2 since [1]:
- rebase to kevin's v4.16/dt64 branch
- add Neil's Reviewed-by
- move clock info to board.dts instead of in soc.dtsi
- drop "meson-axg-dwmac" compatible string, since we didn't use this
we could re-add it later when we really need.
- note: to make ethernet work properly,it depend on clock & pinctrl[2],
to compile the DTS, the patch [3] is required.
the code part will be taken via clock & pinctrl subsystem tree.
[5]
http://lists.infradead.org/pipermail/linux-amlogic/2017-December/005783.html
http://lists.infradead.org/pipermail/linux-amlogic/2017-December/005784.html
http://lists.infradead.org/pipermail/linux-amlogic/2017-December/005785.html
[4]
http://lists.infradead.org/pipermail/linux-amlogic/2017-December/005768.html
[1]
http://lists.infradead.org/pipermail/linux-amlogic/2017-November/005301.html
[2]
http://lists.infradead.org/pipermail/linux-amlogic/2017-December/005735.html
http://lists.infradead.org/pipermail/linux-amlogic/2017-December/005694.html
[3]
http://lists.infradead.org/pipermail/linux-amlogic/2017-December/005738.html
[6] git://github.com/BayLibre/clk-meson.git
Yixun Lan (2):
ARM64: dts: meson-axg: add ethernet mac controller
ARM64: dts: meson-axg: enable ethernet for A113D S400 board
arch/arm64/boot/dts/amlogic/meson-axg-s400.dts | 7 ++++
arch/arm64/boot/dts/amlogic/meson-axg.dtsi | 54 ++++++++++++++++++++++++++
2 files changed, 61 insertions(+)
--
2.15.1
--
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 v3 1/2] ARM64: dts: meson-axg: add ethernet mac controller
From: Yixun Lan @ 2017-12-16 3:38 UTC (permalink / raw)
To: Kevin Hilman
Cc: yixun.lan, devicetree, Neil Armstrong, Jerome Brunet,
Giuseppe Cavallaro, Alexandre Torgue, Carlo Caione, linux-amlogic,
linux-arm-kernel, linux-kernel, netdev
In-Reply-To: <7ho9mz94dg.fsf@baylibre.com>
HI Kevin
On 12/16/2017 03:29 AM, Kevin Hilman wrote:
> Yixun Lan <yixun.lan@amlogic.com> writes:
>
>> Add DT info for the stmmac ethernet MAC which found in
>> the Amlogic's Meson-AXG SoC, also describe the ethernet
>> pinctrl & clock information here.
>>
>> Reviewed-by: Neil Armstrong <narmstrong@baylibre.com>
>> Signed-off-by: Yixun Lan <yixun.lan@amlogic.com>
>
> This patch does not apply, and dependencies are not described.
>
>> ---
>> arch/arm64/boot/dts/amlogic/meson-axg.dtsi | 54 ++++++++++++++++++++++++++++++
>> 1 file changed, 54 insertions(+)
>>
>> diff --git a/arch/arm64/boot/dts/amlogic/meson-axg.dtsi b/arch/arm64/boot/dts/amlogic/meson-axg.dtsi
>> index d356ce74ad89..94c4972222b7 100644
>> --- a/arch/arm64/boot/dts/amlogic/meson-axg.dtsi
>> +++ b/arch/arm64/boot/dts/amlogic/meson-axg.dtsi
>> @@ -7,6 +7,7 @@
>> #include <dt-bindings/gpio/gpio.h>
>> #include <dt-bindings/interrupt-controller/irq.h>
>> #include <dt-bindings/interrupt-controller/arm-gic.h>
>> +#include <dt-bindings/clock/axg-clkc.h>
>>
>> / {
>> compatible = "amlogic,meson-axg";
>> @@ -148,6 +149,19 @@
>> #address-cells = <0>;
>> };
>>
>> + ethmac: ethernet@ff3f0000 {
>> + compatible = "amlogic,meson-gxbb-dwmac", "snps,dwmac";
>> + reg = <0x0 0xff3f0000 0x0 0x10000
>> + 0x0 0xff634540 0x0 0x8>;
>> + interrupts = <GIC_SPI 8 IRQ_TYPE_EDGE_RISING>;
>> + interrupt-names = "macirq";
>> + clocks = <&clkc CLKID_ETH>,
>> + <&clkc CLKID_FCLK_DIV2>,
>> + <&clkc CLKID_MPLL2>;
>> + clock-names = "stmmaceth", "clkin0", "clkin1";
>> + status = "disabled";
>> + };
>> +
>> hiubus: bus@ff63c000 {
>> compatible = "simple-bus";
>> reg = <0x0 0xff63c000 0x0 0x1c00>;
>
> Based on the hiubus node, presumably this depends on the patch from the
> clock series.
>
yes, it depend on clock, also the pinctrl patch
>> @@ -194,6 +208,46 @@
>> #gpio-cells = <2>;
>> gpio-ranges = <&pinctrl_periphs 0 0 86>;
>> };
>
> I'm not sure where this part is coming from, but it causes the rest of
> it to not apply.
>
> Please be sure to describe all dependencies.
>
.
exactly, it depend on pinctrl
actually, once you apply the clock & pinctrl DT patch, this one should
go fine. I will send another v4 which base on your recent v4.16/dt64
branch for your convenience.
Yixun
^ permalink raw reply
* [PATCH v2,net-next 2/2] ip6_gre: fix error path when ip6erspan_rcv failed
From: Haishuang Yan @ 2017-12-16 2:58 UTC (permalink / raw)
To: David S. Miller, Alexey Kuznetsov, Hideaki YOSHIFUJI
Cc: netdev, linux-kernel, Haishuang Yan, William Tu
In-Reply-To: <1513393104-30749-1-git-send-email-yanhaishuang@cmss.chinamobile.com>
Same as ipv4 code, when ip6erspan_rcv call return PACKET_REJECT, we
should call icmpv6_send to send icmp unreachable message in error path.
Fixes: 5a963eb61b7c ("ip6_gre: Add ERSPAN native tunnel support")
Acked-by: William Tu <u9012063@gmail.com>
Cc: William Tu <u9012063@gmail.com>
Signed-off-by: Haishuang Yan <yanhaishuang@cmss.chinamobile.com>
Change since v2:
* Rebase on latest master branch.
---
net/ipv6/ip6_gre.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/net/ipv6/ip6_gre.c b/net/ipv6/ip6_gre.c
index 8ce9d42..f210f9c 100644
--- a/net/ipv6/ip6_gre.c
+++ b/net/ipv6/ip6_gre.c
@@ -603,12 +603,13 @@ static int gre_rcv(struct sk_buff *skb)
tpi.proto == htons(ETH_P_ERSPAN2))) {
if (ip6erspan_rcv(skb, hdr_len, &tpi) == PACKET_RCVD)
return 0;
- goto drop;
+ goto out;
}
if (ip6gre_rcv(skb, &tpi) == PACKET_RCVD)
return 0;
+out:
icmpv6_send(skb, ICMPV6_DEST_UNREACH, ICMPV6_PORT_UNREACH, 0);
drop:
kfree_skb(skb);
--
1.8.3.1
^ permalink raw reply related
* [PATCH v2,net-next 1/2] ip_gre: fix error path when erspan_rcv failed
From: Haishuang Yan @ 2017-12-16 2:58 UTC (permalink / raw)
To: David S. Miller, Alexey Kuznetsov, Hideaki YOSHIFUJI
Cc: netdev, linux-kernel, Haishuang Yan, William Tu
When erspan_rcv call return PACKET_REJECT, we shoudn't call ipgre_rcv to
process packets again, instead send icmp unreachable message in error
path.
Fixes: 84e54fe0a5ea ("gre: introduce native tunnel support for ERSPAN")
Acked-by: William Tu <u9012063@gmail.com>
Cc: William Tu <u9012063@gmail.com>
Signed-off-by: Haishuang Yan <yanhaishuang@cmss.chinamobile.com>
Change since v2:
* Rebase on latest master branch.
---
net/ipv4/ip_gre.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/net/ipv4/ip_gre.c b/net/ipv4/ip_gre.c
index 33af55a..ccfc5bc 100644
--- a/net/ipv4/ip_gre.c
+++ b/net/ipv4/ip_gre.c
@@ -434,11 +434,13 @@ static int gre_rcv(struct sk_buff *skb)
tpi.proto == htons(ETH_P_ERSPAN2))) {
if (erspan_rcv(skb, &tpi, hdr_len) == PACKET_RCVD)
return 0;
+ goto out;
}
if (ipgre_rcv(skb, &tpi, hdr_len) == PACKET_RCVD)
return 0;
+out:
icmp_send(skb, ICMP_DEST_UNREACH, ICMP_PORT_UNREACH, 0);
drop:
kfree_skb(skb);
--
1.8.3.1
^ permalink raw reply related
* [PATCH v2,net-next 2/2] ip6_gre: fix potential memory leak in ip6erspan_rcv
From: Haishuang Yan @ 2017-12-16 2:48 UTC (permalink / raw)
To: David S. Miller, Alexey Kuznetsov, Hideaki YOSHIFUJI
Cc: netdev, linux-kernel, Haishuang Yan, William Tu
In-Reply-To: <1513392519-30127-1-git-send-email-yanhaishuang@cmss.chinamobile.com>
If md is NULL, tun_dst must be freed, otherwise it will cause memory
leak.
Fixes: ef7baf5e083c ("ip6_gre: add ip6 erspan collect_md mode")
Cc: William Tu <u9012063@gmail.com>
Signed-off-by: Haishuang Yan <yanhaishuang@cmss.chinamobile.com>
Change since v2:
* Rebase on latest master branch.
* Correct wrong fix information.
---
net/ipv6/ip6_gre.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/net/ipv6/ip6_gre.c b/net/ipv6/ip6_gre.c
index 5c9c65f..8ce9d42 100644
--- a/net/ipv6/ip6_gre.c
+++ b/net/ipv6/ip6_gre.c
@@ -549,8 +549,10 @@ static int ip6erspan_rcv(struct sk_buff *skb, int gre_hdr_len,
info = &tun_dst->u.tun_info;
md = ip_tunnel_info_opts(info);
- if (!md)
+ if (!md) {
+ dst_release((struct dst_entry *)tun_dst);
return PACKET_REJECT;
+ }
memcpy(md, pkt_md, sizeof(*md));
md->version = ver;
--
1.8.3.1
^ permalink raw reply related
* [PATCH v2,net-next 1/2] ip_gre: fix potential memory leak in erspan_rcv
From: Haishuang Yan @ 2017-12-16 2:48 UTC (permalink / raw)
To: David S. Miller, Alexey Kuznetsov, Hideaki YOSHIFUJI
Cc: netdev, linux-kernel, Haishuang Yan, William Tu
If md is NULL, tun_dst must be freed, otherwise it will cause memory
leak.
Fixes: 1a66a836da6 ("gre: add collect_md mode to ERSPAN tunnel")
Cc: William Tu <u9012063@gmail.com>
Signed-off-by: Haishuang Yan <yanhaishuang@cmss.chinamobile.com>
Change since v2:
* Rebase on latest master branch.
* Correct wrong fix information.
---
net/ipv4/ip_gre.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/net/ipv4/ip_gre.c b/net/ipv4/ip_gre.c
index 004800b..33af55a 100644
--- a/net/ipv4/ip_gre.c
+++ b/net/ipv4/ip_gre.c
@@ -311,8 +311,10 @@ static int erspan_rcv(struct sk_buff *skb, struct tnl_ptk_info *tpi,
return PACKET_REJECT;
md = ip_tunnel_info_opts(&tun_dst->u.tun_info);
- if (!md)
+ if (!md) {
+ dst_release((struct dst_entry *)tun_dst);
return PACKET_REJECT;
+ }
memcpy(md, pkt_md, sizeof(*md));
md->version = ver;
--
1.8.3.1
^ permalink raw reply related
* [PATCH] trace: reenable preemption if we modify the ip
From: Josef Bacik @ 2017-12-16 2:42 UTC (permalink / raw)
To: netdev, mhiramat, ast, daniel, darrick.wong, linux-kernel; +Cc: Josef Bacik
From: Josef Bacik <jbacik@fb.com>
Things got moved around between the original bpf_override_return patches
and the final version, and now the ftrace kprobe dispatcher assumes if
you modified the ip that you also enabled preemption. Make a comment of
this and enable preemption, this fixes the lockdep splat that happened
when using this feature.
Signed-off-by: Josef Bacik <jbacik@fb.com>
---
kernel/trace/trace_kprobe.c | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/kernel/trace/trace_kprobe.c b/kernel/trace/trace_kprobe.c
index 5db849809a56..91f4b57dab82 100644
--- a/kernel/trace/trace_kprobe.c
+++ b/kernel/trace/trace_kprobe.c
@@ -1322,8 +1322,15 @@ static int kprobe_dispatcher(struct kprobe *kp, struct pt_regs *regs)
if (tk->tp.flags & TP_FLAG_TRACE)
kprobe_trace_func(tk, regs);
#ifdef CONFIG_PERF_EVENTS
- if (tk->tp.flags & TP_FLAG_PROFILE)
+ if (tk->tp.flags & TP_FLAG_PROFILE) {
ret = kprobe_perf_func(tk, regs);
+ /*
+ * The ftrace kprobe handler leaves it up to us to re-enable
+ * preemption here before returning if we've modified the ip.
+ */
+ if (ret)
+ preempt_enable_no_resched();
+ }
#endif
return ret;
}
--
2.7.5
^ permalink raw reply related
* [PATCH v2,net-next] ip6_gre: fix a pontential issue in ip6erspan_rcv
From: Haishuang Yan @ 2017-12-16 2:25 UTC (permalink / raw)
To: David S. Miller, Alexey Kuznetsov, Hideaki YOSHIFUJI
Cc: netdev, linux-kernel, Haishuang Yan, William Tu
pskb_may_pull() can change skb->data, so we need to load ipv6h/ershdr at
the right place.
Fixes: 5a963eb61b7c ("ip6_gre: Add ERSPAN native tunnel support")
Acked-by: William Tu <u9012063@gmail.com>
Cc: William Tu <u9012063@gmail.com>
Signed-off-by: Haishuang Yan <yanhaishuang@cmss.chinamobile.com>
---
Change since v2:
* Rebase on latest master.
---
net/ipv6/ip6_gre.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/net/ipv6/ip6_gre.c b/net/ipv6/ip6_gre.c
index f210f9c..aa1512e 100644
--- a/net/ipv6/ip6_gre.c
+++ b/net/ipv6/ip6_gre.c
@@ -507,12 +507,11 @@ static int ip6erspan_rcv(struct sk_buff *skb, int gre_hdr_len,
struct ip6_tnl *tunnel;
u8 ver;
- ipv6h = ipv6_hdr(skb);
- ershdr = (struct erspan_base_hdr *)skb->data;
-
if (unlikely(!pskb_may_pull(skb, sizeof(*ershdr))))
return PACKET_REJECT;
+ ipv6h = ipv6_hdr(skb);
+ ershdr = (struct erspan_base_hdr *)skb->data;
ver = (ntohs(ershdr->ver_vlan) & VER_MASK) >> VER_OFFSET;
tpi->key = cpu_to_be32(ntohs(ershdr->session_id) & ID_MASK);
pkt_md = (struct erspan_metadata *)(ershdr + 1);
--
1.8.3.1
^ permalink raw reply related
* Re: [PATCH] ip6_gre: fix a pontential issue in ip6erspan_rcv
From: 严海双 @ 2017-12-16 1:27 UTC (permalink / raw)
To: David Miller; +Cc: kuznet, yoshfuji, netdev, linux-kernel, u9012063
In-Reply-To: <20171215.141110.526841119374252341.davem@davemloft.net>
> On 2017年12月16日, at 上午3:11, David Miller <davem@davemloft.net> wrote:
>
> From: Haishuang Yan <yanhaishuang@cmss.chinamobile.com>
> Date: Fri, 15 Dec 2017 10:46:38 +0800
>
>> pskb_may_pull() can change skb->data, so we need to load ipv6h/ershdr at
>> the right place.
>>
>> Fixes: 5a963eb61b7c ("ip6_gre: Add ERSPAN native tunnel support")
>> Cc: William Tu <u9012063@gmail.com>
>> Signed-off-by: Haishuang Yan <yanhaishuang@cmss.chinamobile.com>
>
> The mentioned commit ID only exists in net-next, and this patch does not apply
> cleanly there.
>
Okay, I will send v2 commit rebased on latest master and with prefix [net-next].
Thanks.
^ permalink raw reply
* [PATCH v2 iproute2 net-next] erspan: add erspan version II support
From: William Tu @ 2017-12-16 1:06 UTC (permalink / raw)
To: netdev
The patch adds support for configuring the erspan v2, for both
ipv4 and ipv6 erspan implementation. Three additional fields
are added: 'erspan_ver' for distinguishing v1 or v2, 'erspan_dir'
for specifying direction of the mirrored traffic, and 'erspan_hwid'
for users to set ERSPAN engine ID within a system.
As for manpage, the ERSPAN descriptions used to be under GRE, IPIP,
SIT Type paragraph. Since IP6GRE/IP6GRETAP also supports ERSPAN,
the patch removes the old one, creates a separate ERSPAN paragrah,
and adds an example.
Signed-off-by: William Tu <u9012063@gmail.com>
---
change in v2:
- fix typo ETH_P_ERSPAN2
- fix space and indent
---
include/uapi/linux/if_ether.h | 1 +
include/uapi/linux/if_tunnel.h | 3 ++
ip/link_gre.c | 59 ++++++++++++++++++++++++--
ip/link_gre6.c | 60 +++++++++++++++++++++++++--
man/man8/ip-link.8.in | 94 ++++++++++++++++++++++++++++++++++++------
5 files changed, 198 insertions(+), 19 deletions(-)
diff --git a/include/uapi/linux/if_ether.h b/include/uapi/linux/if_ether.h
index 2eb529a90250..133567bf2e04 100644
--- a/include/uapi/linux/if_ether.h
+++ b/include/uapi/linux/if_ether.h
@@ -47,6 +47,7 @@
#define ETH_P_PUP 0x0200 /* Xerox PUP packet */
#define ETH_P_PUPAT 0x0201 /* Xerox PUP Addr Trans packet */
#define ETH_P_TSN 0x22F0 /* TSN (IEEE 1722) packet */
+#define ETH_P_ERSPAN2 0x22EB /* ERSPAN version 2 (type III) */
#define ETH_P_IP 0x0800 /* Internet Protocol packet */
#define ETH_P_X25 0x0805 /* CCITT X.25 */
#define ETH_P_ARP 0x0806 /* Address Resolution packet */
diff --git a/include/uapi/linux/if_tunnel.h b/include/uapi/linux/if_tunnel.h
index 38cdf90692f8..ecdc76669cfd 100644
--- a/include/uapi/linux/if_tunnel.h
+++ b/include/uapi/linux/if_tunnel.h
@@ -137,6 +137,9 @@ enum {
IFLA_GRE_IGNORE_DF,
IFLA_GRE_FWMARK,
IFLA_GRE_ERSPAN_INDEX,
+ IFLA_GRE_ERSPAN_VER,
+ IFLA_GRE_ERSPAN_DIR,
+ IFLA_GRE_ERSPAN_HWID,
__IFLA_GRE_MAX,
};
diff --git a/ip/link_gre.c b/ip/link_gre.c
index 43cb1af6196a..924a05530f5c 100644
--- a/ip/link_gre.c
+++ b/ip/link_gre.c
@@ -98,6 +98,9 @@ static int gre_parse_opt(struct link_util *lu, int argc, char **argv,
__u8 ignore_df = 0;
__u32 fwmark = 0;
__u32 erspan_idx = 0;
+ __u8 erspan_ver = 0;
+ __u8 erspan_dir = 0;
+ __u16 erspan_hwid = 0;
if (!(n->nlmsg_flags & NLM_F_CREATE)) {
if (rtnl_talk(&rth, &req.n, &answer) < 0) {
@@ -179,6 +182,15 @@ get_failed:
if (greinfo[IFLA_GRE_ERSPAN_INDEX])
erspan_idx = rta_getattr_u32(greinfo[IFLA_GRE_ERSPAN_INDEX]);
+ if (greinfo[IFLA_GRE_ERSPAN_VER])
+ erspan_ver = rta_getattr_u8(greinfo[IFLA_GRE_ERSPAN_VER]);
+
+ if (greinfo[IFLA_GRE_ERSPAN_DIR])
+ erspan_dir = rta_getattr_u8(greinfo[IFLA_GRE_ERSPAN_DIR]);
+
+ if (greinfo[IFLA_GRE_ERSPAN_HWID])
+ erspan_hwid = rta_getattr_u16(greinfo[IFLA_GRE_ERSPAN_HWID]);
+
free(answer);
}
@@ -343,6 +355,22 @@ get_failed:
invarg("invalid erspan index\n", *argv);
if (erspan_idx & ~((1<<20) - 1) || erspan_idx == 0)
invarg("erspan index must be > 0 and <= 20-bit\n", *argv);
+ } else if (strcmp(*argv, "erspan_ver") == 0) {
+ NEXT_ARG();
+ if (get_u8(&erspan_ver, *argv, 0))
+ invarg("invalid erspan version\n", *argv);
+ if (erspan_ver != 1 && erspan_ver != 2)
+ invarg("erspan version must be 1 or 2\n", *argv);
+ } else if (strcmp(*argv, "erspan_dir") == 0) {
+ NEXT_ARG();
+ if (get_u8(&erspan_dir, *argv, 0))
+ invarg("invalid erspan direction\n", *argv);
+ if (erspan_dir != 0 && erspan_dir != 1)
+ invarg("erspan direction must be 0(Ingress) or 1(Egress)\n", *argv);
+ } else if (strcmp(*argv, "erspan_hwid") == 0) {
+ NEXT_ARG();
+ if (get_u16(&erspan_hwid, *argv, 0))
+ invarg("invalid erspan hwid\n", *argv);
} else
usage();
argc--; argv++;
@@ -374,8 +402,15 @@ get_failed:
addattr_l(n, 1024, IFLA_GRE_TTL, &ttl, 1);
addattr_l(n, 1024, IFLA_GRE_TOS, &tos, 1);
addattr32(n, 1024, IFLA_GRE_FWMARK, fwmark);
- if (erspan_idx != 0)
- addattr32(n, 1024, IFLA_GRE_ERSPAN_INDEX, erspan_idx);
+ if (erspan_ver) {
+ addattr8(n, 1024, IFLA_GRE_ERSPAN_VER, erspan_ver);
+ if (erspan_ver == 1 && erspan_idx != 0) {
+ addattr32(n, 1024, IFLA_GRE_ERSPAN_INDEX, erspan_idx);
+ } else if (erspan_ver == 2) {
+ addattr8(n, 1024, IFLA_GRE_ERSPAN_DIR, erspan_dir);
+ addattr16(n, 1024, IFLA_GRE_ERSPAN_HWID, erspan_hwid);
+ }
+ }
} else {
addattr_l(n, 1024, IFLA_GRE_COLLECT_METADATA, NULL, 0);
}
@@ -514,7 +549,25 @@ static void gre_print_opt(struct link_util *lu, FILE *f, struct rtattr *tb[])
if (tb[IFLA_GRE_ERSPAN_INDEX]) {
__u32 erspan_idx = rta_getattr_u32(tb[IFLA_GRE_ERSPAN_INDEX]);
- fprintf(f, "erspan_index %u ", erspan_idx);
+ print_uint(PRINT_ANY, "erspan_index", "erspan_index %u", erspan_idx);
+ }
+
+ if (tb[IFLA_GRE_ERSPAN_VER]) {
+ __u8 erspan_ver = rta_getattr_u8(tb[IFLA_GRE_ERSPAN_VER]);
+
+ print_uint(PRINT_ANY, "erspan_ver", "erspan_ver %u", erspan_ver);
+ }
+
+ if (tb[IFLA_GRE_ERSPAN_DIR]) {
+ __u8 erspan_dir = rta_getattr_u8(tb[IFLA_GRE_ERSPAN_DIR]);
+
+ print_uint(PRINT_ANY, "erspan_dir", "erspan_dir %u", erspan_dir);
+ }
+
+ if (tb[IFLA_GRE_ERSPAN_HWID]) {
+ __u16 erspan_hwid = rta_getattr_u16(tb[IFLA_GRE_ERSPAN_HWID]);
+
+ print_hex(PRINT_ANY, "erspan_hwid", "erspan_hwid %x", erspan_hwid);
}
if (tb[IFLA_GRE_ENCAP_TYPE] &&
diff --git a/ip/link_gre6.c b/ip/link_gre6.c
index 2cb46ca116d0..e0f9a7ccb65e 100644
--- a/ip/link_gre6.c
+++ b/ip/link_gre6.c
@@ -109,6 +109,9 @@ static int gre_parse_opt(struct link_util *lu, int argc, char **argv,
int len;
__u32 fwmark = 0;
__u32 erspan_idx = 0;
+ __u8 erspan_ver = 0;
+ __u8 erspan_dir = 0;
+ __u16 erspan_hwid = 0;
if (!(n->nlmsg_flags & NLM_F_CREATE)) {
if (rtnl_talk(&rth, &req.n, &answer) < 0) {
@@ -191,6 +194,15 @@ get_failed:
if (greinfo[IFLA_GRE_ERSPAN_INDEX])
erspan_idx = rta_getattr_u32(greinfo[IFLA_GRE_ERSPAN_INDEX]);
+ if (greinfo[IFLA_GRE_ERSPAN_VER])
+ erspan_ver = rta_getattr_u8(greinfo[IFLA_GRE_ERSPAN_VER]);
+
+ if (greinfo[IFLA_GRE_ERSPAN_DIR])
+ erspan_dir = rta_getattr_u8(greinfo[IFLA_GRE_ERSPAN_DIR]);
+
+ if (greinfo[IFLA_GRE_ERSPAN_HWID])
+ erspan_hwid = rta_getattr_u16(greinfo[IFLA_GRE_ERSPAN_HWID]);
+
free(answer);
}
@@ -389,6 +401,22 @@ get_failed:
invarg("invalid erspan index\n", *argv);
if (erspan_idx & ~((1<<20) - 1) || erspan_idx == 0)
invarg("erspan index must be > 0 and <= 20-bit\n", *argv);
+ } else if (strcmp(*argv, "erspan_ver") == 0) {
+ NEXT_ARG();
+ if (get_u8(&erspan_ver, *argv, 0))
+ invarg("invalid erspan version\n", *argv);
+ if (erspan_ver != 1 && erspan_ver != 2)
+ invarg("erspan version must be 1 or 2\n", *argv);
+ } else if (strcmp(*argv, "erspan_dir") == 0) {
+ NEXT_ARG();
+ if (get_u8(&erspan_dir, *argv, 0))
+ invarg("invalid erspan direction\n", *argv);
+ if (erspan_dir != 0 && erspan_dir != 1)
+ invarg("erspan direction must be 0(Ingress) or 1(Egress)\n", *argv);
+ } else if (strcmp(*argv, "erspan_hwid") == 0) {
+ NEXT_ARG();
+ if (get_u16(&erspan_hwid, *argv, 0))
+ invarg("invalid erspan hwid\n", *argv);
} else
usage();
argc--; argv++;
@@ -408,9 +436,15 @@ get_failed:
addattr_l(n, 1024, IFLA_GRE_FLOWINFO, &flowinfo, 4);
addattr32(n, 1024, IFLA_GRE_FLAGS, flags);
addattr32(n, 1024, IFLA_GRE_FWMARK, fwmark);
- if (erspan_idx != 0)
- addattr32(n, 1024, IFLA_GRE_ERSPAN_INDEX, erspan_idx);
-
+ if (erspan_ver) {
+ addattr8(n, 1024, IFLA_GRE_ERSPAN_VER, erspan_ver);
+ if (erspan_ver == 1 && erspan_idx != 0) {
+ addattr32(n, 1024, IFLA_GRE_ERSPAN_INDEX, erspan_idx);
+ } else {
+ addattr8(n, 1024, IFLA_GRE_ERSPAN_DIR, erspan_dir);
+ addattr16(n, 1024, IFLA_GRE_ERSPAN_HWID, erspan_hwid);
+ }
+ }
addattr16(n, 1024, IFLA_GRE_ENCAP_TYPE, encaptype);
addattr16(n, 1024, IFLA_GRE_ENCAP_FLAGS, encapflags);
addattr16(n, 1024, IFLA_GRE_ENCAP_SPORT, htons(encapsport));
@@ -587,7 +621,25 @@ static void gre_print_opt(struct link_util *lu, FILE *f, struct rtattr *tb[])
if (tb[IFLA_GRE_ERSPAN_INDEX]) {
__u32 erspan_idx = rta_getattr_u32(tb[IFLA_GRE_ERSPAN_INDEX]);
- fprintf(f, "erspan_index %u ", erspan_idx);
+ print_uint(PRINT_ANY, "erspan_index", "erspan_index %u ", erspan_idx);
+ }
+
+ if (tb[IFLA_GRE_ERSPAN_VER]) {
+ __u8 erspan_ver = rta_getattr_u8(tb[IFLA_GRE_ERSPAN_VER]);
+
+ print_uint(PRINT_ANY, "erspan_ver", "erspan_ver %u", erspan_ver);
+ }
+
+ if (tb[IFLA_GRE_ERSPAN_DIR]) {
+ __u8 erspan_dir = rta_getattr_u8(tb[IFLA_GRE_ERSPAN_DIR]);
+
+ print_uint(PRINT_ANY, "erspan_dir", "erspan_dir %u", erspan_dir);
+ }
+
+ if (tb[IFLA_GRE_ERSPAN_HWID]) {
+ __u16 erspan_hwid = rta_getattr_u16(tb[IFLA_GRE_ERSPAN_HWID]);
+
+ print_hex(PRINT_ANY, "erspan_hwid", "erspan_hwid %x", erspan_hwid);
}
if (tb[IFLA_GRE_ENCAP_TYPE] &&
diff --git a/man/man8/ip-link.8.in b/man/man8/ip-link.8.in
index 9e9a5f0d2cef..6be6936185a3 100644
--- a/man/man8/ip-link.8.in
+++ b/man/man8/ip-link.8.in
@@ -665,13 +665,13 @@ keyword.
.in -8
.TP
-GRE, IPIP, SIT, ERSPAN Type Support
+GRE, IPIP, SIT Type Support
For a link of types
-.I GRE/IPIP/SIT/ERSPAN
+.I GRE/IPIP/SIT
the following additional arguments are supported:
.BI "ip link add " DEVICE
-.BR type " { " gre " | " ipip " | " sit " | " erspan " }"
+.BR type " { " gre " | " ipip " | " sit " }"
.BI " remote " ADDR " local " ADDR
[
.BR encap " { " fou " | " gue " | " none " }"
@@ -685,8 +685,6 @@ the following additional arguments are supported:
.I " [no]encap-remcsum "
] [
.I " mode " { ip6ip | ipip | mplsip | any } "
-] [
-.BR erspan " \fIIDX "
]
.in +8
@@ -731,13 +729,6 @@ MPLS-Over-IPv4, "any" indicates IPv6, IPv4 or MPLS Over IPv4. Supported for
SIT where the default is "ip6ip" and IPIP where the default is "ipip".
IPv6-Over-IPv4 is not supported for IPIP.
-.sp
-.BR erspan " \fIIDX "
-- specifies the ERSPAN index field.
-.IR IDX
-indicates a 20 bit index/port number associated with the ERSPAN
-traffic's source port and direction.
-
.in -8
.TP
@@ -883,6 +874,78 @@ the following additional arguments are supported:
- specifies the mode (datagram or connected) to use.
.TP
+ERSPAN Type Support
+For a link of type
+.I ERSPAN/IP6ERSPAN
+the following additional arguments are supported:
+
+.BI "ip link add " DEVICE
+.BR type " { " erspan " | " ip6erspan " }"
+.BI remote " ADDR " local " ADDR " seq
+.RB key
+.I KEY
+.BR erspan_ver " \fIversion "
+[
+.BR erspan " \fIIDX "
+] [
+.BR erspan_dir " \fIdirection "
+] [
+.BR erspan_hwid " \fIhwid "
+] [
+.RB external
+]
+
+.in +8
+.sp
+.BI remote " ADDR "
+- specifies the remote address of the tunnel.
+
+.sp
+.BI local " ADDR "
+- specifies the fixed local address for tunneled packets.
+It must be an address on another interface on this host.
+
+.sp
+.BR erspan_ver " \fIversion "
+- specifies the ERSPAN version number.
+.IR version
+indicates the ERSPAN version to be created: 1 for version 1 (type II)
+or 2 for version 2 (type III).
+
+.sp
+.BR erspan " \fIIDX "
+- specifies the ERSPAN v1 index field.
+.IR IDX
+indicates a 20 bit index/port number associated with the ERSPAN
+traffic's source port and direction.
+
+.sp
+.BR erspan_dir " \fIdirection "
+- specifies the ERSPAN v2 mirrored traffic's direction.
+.IR direction
+value (0) for ingress or (1) for egress.
+
+.sp
+.BR erspan_hwid " \fIhwid "
+- an unique identifier of an ERSPAN v2 engine within a system.
+.IR hwid
+is a 6-bit value for users to configure.
+
+.sp
+.BR external
+- make this tunnel externally controlled (or not, which is the default).
+In the kernel, this is referred to as collect metadata mode. This flag is
+mutually exclusive with the
+.BR remote ,
+.BR local ,
+.BR erspan_ver ,
+.BR erspan ,
+.BR erspan_dir " and " erspan_hwid
+options.
+
+.in -8
+
+.TP
GENEVE Type Support
For a link of type
.I GENEVE
@@ -2062,6 +2125,13 @@ ip link add link wpan0 lowpan0 type lowpan
Creates a 6LoWPAN interface named lowpan0 on the underlying
IEEE 802.15.4 device wpan0.
.RE
+.PP
+ip link add dev ip6erspan11 type ip6erspan seq key 102
+local fc00:100::2 remote fc00:100::1
+erspan_ver 2 erspan_dir 1 erspan_hwid 17
+.RS 4
+Creates a IP6ERSPAN version 2 interface named ip6erspan00.
+.RE
.SH SEE ALSO
.br
--
2.7.4
^ permalink raw reply related
* Re: [PATCH v2 iproute2 net-next] erspan: add erspan version II support
From: William Tu @ 2017-12-16 0:55 UTC (permalink / raw)
To: Roman Mashak; +Cc: Linux Kernel Network Developers
In-Reply-To: <854lorfss4.fsf@mojatatu.com>
On Fri, Dec 15, 2017 at 3:58 PM, Roman Mashak <mrv@mojatatu.com> wrote:
> William Tu <u9012063@gmail.com> writes:
>
>> The patch adds support for configuring the erspan v2, for both
>> ipv4 and ipv6 erspan implementation. Three additional fields
>> are added: 'erspan_ver' for distinguishing v1 or v2, 'erspan_dir'
>> for specifying direction of the mirrored traffic, and 'erspan_hwid'
>> for users to set ERSPAN engine ID within a system.
>>
>> As for manpage, the ERSPAN descriptions used to be under GRE, IPIP,
>> SIT Type paragraph. Since IP6GRE/IP6GRETAP also supports ERSPAN,
>> the patch removes the old one, creates a separate ERSPAN paragrah,
>> and adds an example.
>>
>> Signed-off-by: William Tu <u9012063@gmail.com>
>> ---
>> change in v2:
>> - clean up and update manpage.
>> ---
>> include/uapi/linux/if_ether.h | 1 +
>> include/uapi/linux/if_tunnel.h | 3 ++
>> ip/link_gre.c | 59 ++++++++++++++++++++++++--
>> ip/link_gre6.c | 61 +++++++++++++++++++++++++--
>> man/man8/ip-link.8.in | 94 ++++++++++++++++++++++++++++++++++++------
>> 5 files changed, 199 insertions(+), 19 deletions(-)
>>
>> diff --git a/include/uapi/linux/if_ether.h b/include/uapi/linux/if_ether.h
>> index 2eb529a90250..5fd5c12ef8e9 100644
>> --- a/include/uapi/linux/if_ether.h
>> +++ b/include/uapi/linux/if_ether.h
>> @@ -47,6 +47,7 @@
>> #define ETH_P_PUP 0x0200 /* Xerox PUP packet */
>> #define ETH_P_PUPAT 0x0201 /* Xerox PUP Addr Trans packet */
>> #define ETH_P_TSN 0x22F0 /* TSN (IEEE 1722) packet */
>> +#define ETH_P_ERsPAN2 0x22EB /* ERSPAN version 2 (type III) */
> ^ Is it intention to have a lower case 's' in macro name or typo?
>
> [...]
Sorry, that's my mistake. Let me fix it and resubmit. Thank you.
William
^ permalink raw reply
* BUG: unable to handle kernel NULL pointer dereference in fdb_find_rcu
From: Andrei Vagin @ 2017-12-16 0:37 UTC (permalink / raw)
To: Linux Kernel Network Developers, Nikolay Aleksandrov, LKML
Hi,
We run criu tests for linux-next and today we get this bug:
The kernel version is 4.15.0-rc3-next-20171215
[ 235.397328] BUG: unable to handle kernel NULL pointer dereference
at 000000000000000c
[ 235.398624] IP: fdb_find_rcu+0x3c/0x130
[ 235.399365] PGD 51970067 P4D 51970067 PUD 51971067 PMD 0
[ 235.400400] Oops: 0000 [#1] SMP
[ 235.400959] Modules linked in:
[ 235.401455] CPU: 1 PID: 32057 Comm: criu Not tainted
4.15.0-rc3-next-20171215-00002-g2e56147d7dc8 #10
[ 235.402935] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996),
BIOS 1.10.2-1.fc26 04/01/2014
[ 235.404356] RIP: 0010:fdb_find_rcu+0x3c/0x130
[ 235.405069] RSP: 0018:ffffbc64c05f76e8 EFLAGS: 00010246
[ 235.405908] RAX: 000000000000e871 RBX: 0000000000000000 RCX: 0000000000000000
[ 235.407062] RDX: 0000000000000000 RSI: ffff9d9b69a04798 RDI: ffff9d9b64c14948
[ 235.408370] RBP: ffff9d9b64c14948 R08: ffffbc64c05f7c18 R09: ffff9d9b64c140a0
[ 235.409518] R10: 0000000064c140a0 R11: ffff9d9b75743968 R12: ffff9d9b757ce260
[ 235.410674] R13: 0000000000000000 R14: ffffbc64c05f7c18 R15: ffffffffa5384560
[ 235.411837] FS: 00007ffac2660100(0000) GS:ffff9d9b7fd00000(0000)
knlGS:0000000000000000
[ 235.412920] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[ 235.413764] CR2: 000000000000000c CR3: 000000006a7ff004 CR4: 00000000003606e0
[ 235.414829] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
[ 235.416096] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
[ 235.417365] Call Trace:
[ 235.417774] br_fdb_change_mac_address+0x31/0x80
[ 235.418538] br_stp_change_bridge_id+0x25/0x110
[ 235.419280] br_dev_newlink+0x43/0xa0
[ 235.419796] rtnl_newlink+0x70f/0x940
[ 235.420391] ? nla_parse+0x83/0xf0
[ 235.420948] ? nla_strlcpy+0x48/0x50
[ 235.421540] ? rtnl_link_ops_get+0x34/0x50
[ 235.422211] ? rtnl_newlink+0x193/0x940
[ 235.422843] ? deactivate_slab.isra.78+0x11b/0x3b0
[ 235.423599] rtnetlink_rcv_msg+0x25d/0x2d0
[ 235.424189] ? __alloc_skb+0x82/0x1e0
[ 235.424718] ? __slab_alloc+0x1c/0x30
[ 235.425420] ? rtnl_calcit.isra.27+0x110/0x110
[ 235.426354] netlink_rcv_skb+0x8d/0x130
[ 235.426995] netlink_unicast+0x19d/0x250
[ 235.427754] netlink_sendmsg+0x2a5/0x3a0
[ 235.428387] sock_sendmsg+0x30/0x40
[ 235.428807] ___sys_sendmsg+0x269/0x2c0
[ 235.429277] ? generic_perform_write+0x122/0x1b0
[ 235.429828] ? __generic_file_write_iter+0x192/0x1c0
[ 235.430422] ? ext4_file_write_iter+0x20c/0x3e0
[ 235.430975] ? SyS_setns+0xc2/0xd0
[ 235.431425] ? __vfs_write+0xf9/0x170
[ 235.431886] ? __sys_sendmsg+0x51/0x90
[ 235.432501] __sys_sendmsg+0x51/0x90
[ 235.433098] entry_SYSCALL_64_fastpath+0x1a/0x7d
[ 235.433822] RIP: 0033:0x7ffac1e170f7
[ 235.434409] RSP: 002b:00007ffc5610c688 EFLAGS: 00000246 ORIG_RAX:
000000000000002e
[ 235.435635] RAX: ffffffffffffffda RBX: 00000000022eb010 RCX: 00007ffac1e170f7
[ 235.436796] RDX: 0000000000000000 RSI: 00007ffc5610c6c0 RDI: 0000000000000002
[ 235.437956] RBP: 0000000000000000 R08: 0000000000000000 R09: 0000000000000000
[ 235.439125] R10: 0000000000000000 R11: 0000000000000246 R12: 00007ffc5610cbac
[ 235.440556] R13: 0005005800000011 R14: 00007ffac2666158 R15: 0000000000000001
[ 235.442175] Code: fd 48 83 ec 10 65 48 8b 04 25 28 00 00 00 48 89
44 24 08 31 c0 8b 06 48 8b 1f 66 89 54 24 06 89 04 24 0f b7 46 04 66
89 44 24 04 <8b> 43 0c 8b 14 24 8d b0 f7 be ad de 8b 44 24 04 01 f2 01
f0 89
[ 235.444717] RIP: fdb_find_rcu+0x3c/0x130 RSP: ffffbc64c05f76e8
[ 235.445636] CR2: 000000000000000c
[ 235.446278] ---[ end trace b77358b1e42a9dd7 ]---
[ 235.447170] Kernel panic - not syncing: Fatal exception in interrupt
[ 235.448379] Kernel Offset: 0x23000000 from 0xffffffff81000000
(relocation range: 0xffffffff80000000-0xffffffffbfffffff)
[ 235.449750] ---[ end Kernel panic - not syncing: Fatal exception in interrupt
^ permalink raw reply
* [PATCH ethtool] ethtool: Support for FEC encoding control
From: Jakub Kicinski @ 2017-12-16 0:35 UTC (permalink / raw)
To: John W . Linville
Cc: netdev, oss-drivers, Roopa Prabhu, Dustin Byford,
Vidya Sagar Ravipati, Dirk van der Merwe
From: Dustin Byford <dustin@cumulusnetworks.com>
As FEC settings and different FEC modes are mandatory
and configurable across various interfaces of 25G/50G/100G/40G,
the lack of FEC encoding control and reporting today is a source
for interoperability issues for many vendors
set-fec/show-fec option(s) are designed to provide control and report
the FEC encoding on the link.
$ethtool --set-fec swp1 encoding [off | RS | BaseR | auto]
Encoding: Types of encoding
Off : Turning off FEC
RS : Force RS-FEC encoding
BaseR : Force BaseR encoding
Auto : Default FEC settings for drivers, and would represent
asking the hardware to essentially go into a best effort mode.
Here are a few examples of what we would expect if encoding=auto:
- if autoneg is on, we are expecting FEC to be negotiated as on or off
as long as protocol supports it
- if the hardware is capable of detecting the FEC encoding on it's
receiver it will reconfigure its encoder to match
- in absence of the above, the configuration would be set to IEEE
defaults.
>From our understanding, this is essentially what most hardware/driver
combinations are doing today in the absence of a way for users to
control the behavior.
$ethtool --show-fec swp1
FEC parameters for swp1:
FEC encodings: RS
ethtool devname output:
$ethtool swp1
Settings for swp1:
root@hpe-7712-03:~# ethtool swp18
Settings for swp18:
Supported ports: [ FIBRE ]
Supported link modes: 40000baseCR4/Full
40000baseSR4/Full
40000baseLR4/Full
100000baseSR4/Full
100000baseCR4/Full
100000baseLR4_ER4/Full
Supported pause frame use: No
Supports auto-negotiation: Yes
Supported FEC modes: [RS | BaseR | None | Not reported]
Advertised link modes: Not reported
Advertised pause frame use: No
Advertised auto-negotiation: No
Advertised FEC modes: [RS | BaseR | None | Not reported]
Speed: 100000Mb/s
Duplex: Full
Port: FIBRE
PHYAD: 106
Transceiver: internal
Auto-negotiation: off
Link detected: yes
Signed-off-by: Vidya Sagar Ravipati <vidya.chowdary@gmail.com>
Signed-off-by: Dustin Byford <dustin@cumulusnetworks.com>
[code style + man page edits + commit message update]
Signed-off-by: Dirk van der Merwe <dirk.vandermerwe@netronome.com>
---
ethtool.8.in | 31 ++++++++++++++++
ethtool.c | 119 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 150 insertions(+)
diff --git a/ethtool.8.in b/ethtool.8.in
index 7ca8bfe43607..9573ffdc985d 100644
--- a/ethtool.8.in
+++ b/ethtool.8.in
@@ -378,6 +378,13 @@ ethtool \- query or control network driver and hardware settings
.RB [ ap-shared ]
.RB [ dedicated ]
.RB [ all ]
+.HP
+.B ethtool \-\-show\-fec
+.I devname
+.HP
+.B ethtool \-\-set\-fec
+.I devname
+.B4 encoding auto off rs baser
.
.\" Adjust lines (i.e. full justification) and hyphenate.
.ad
@@ -1070,6 +1077,30 @@ All components dedicated to this interface
.B all
All components used by this interface, even if shared
.RE
+.TP
+.B \-\-show\-fec
+Queries the specified network device for its support of Forward Error Correction.
+.TP
+.B \-\-set\-fec
+Configures Forward Error Correction for the specified network device.
+
+Forward Error Correction modes selected by a user are expected to be persisted
+after any hotplug events. If a module is swapped that does not support the
+current FEC mode, the driver or firmware must take the link down
+administratively and report the problem in the system logs for users to correct.
+.RS 4
+.TP
+.A4 encoding auto off rs baser
+Sets the FEC encoding for the device.
+.TS
+nokeep;
+lB l.
+auto Use the driver's default encoding
+off Turn off FEC
+RS Force RS-FEC encoding
+BaseR Force BaseR encoding
+.TE
+.RE
.SH BUGS
Not supported (in part or whole) on all network drivers.
.SH AUTHOR
diff --git a/ethtool.c b/ethtool.c
index 488f6bfb8378..434be0f893d2 100644
--- a/ethtool.c
+++ b/ethtool.c
@@ -542,6 +542,9 @@ static void init_global_link_mode_masks(void)
ETHTOOL_LINK_MODE_Pause_BIT,
ETHTOOL_LINK_MODE_Asym_Pause_BIT,
ETHTOOL_LINK_MODE_Backplane_BIT,
+ ETHTOOL_LINK_MODE_FEC_NONE_BIT,
+ ETHTOOL_LINK_MODE_FEC_RS_BIT,
+ ETHTOOL_LINK_MODE_FEC_BASER_BIT,
};
unsigned int i;
@@ -689,6 +692,7 @@ static void dump_link_caps(const char *prefix, const char *an_prefix,
};
int indent;
int did1, new_line_pend, i;
+ int fecreported = 0;
/* Indent just like the separate functions used to */
indent = strlen(prefix) + 14;
@@ -740,6 +744,26 @@ static void dump_link_caps(const char *prefix, const char *an_prefix,
fprintf(stdout, "Yes\n");
else
fprintf(stdout, "No\n");
+
+ fprintf(stdout, " %s FEC modes:", prefix);
+ if (ethtool_link_mode_test_bit(
+ ETHTOOL_LINK_MODE_FEC_NONE_BIT, mask)) {
+ fprintf(stdout, " None");
+ fecreported = 1;
+ }
+ if (ethtool_link_mode_test_bit(
+ ETHTOOL_LINK_MODE_FEC_BASER_BIT, mask)) {
+ fprintf(stdout, " BaseR");
+ fecreported = 1;
+ }
+ if (ethtool_link_mode_test_bit(
+ ETHTOOL_LINK_MODE_FEC_RS_BIT, mask)) {
+ fprintf(stdout, " RS");
+ fecreported = 1;
+ }
+ if (!fecreported)
+ fprintf(stdout, " Not reported");
+ fprintf(stdout, "\n");
}
}
@@ -1562,6 +1586,20 @@ static void dump_eeecmd(struct ethtool_eee *ep)
dump_link_caps("Link partner advertised EEE", "", link_mode, 1);
}
+static void dump_fec(u32 fec)
+{
+ if (fec & ETHTOOL_FEC_NONE)
+ fprintf(stdout, " None");
+ if (fec & ETHTOOL_FEC_AUTO)
+ fprintf(stdout, " Auto");
+ if (fec & ETHTOOL_FEC_OFF)
+ fprintf(stdout, " Off");
+ if (fec & ETHTOOL_FEC_BASER)
+ fprintf(stdout, " BaseR");
+ if (fec & ETHTOOL_FEC_RS)
+ fprintf(stdout, " RS");
+}
+
#define N_SOTS 7
static char *so_timestamping_labels[N_SOTS] = {
@@ -4812,6 +4850,84 @@ static int do_set_phy_tunable(struct cmd_context *ctx)
return err;
}
+static int fecmode_str_to_type(const char *str)
+{
+ int fecmode = 0;
+
+ if (!str)
+ return fecmode;
+
+ if (!strcasecmp(str, "auto"))
+ fecmode |= ETHTOOL_FEC_AUTO;
+ else if (!strcasecmp(str, "off"))
+ fecmode |= ETHTOOL_FEC_OFF;
+ else if (!strcasecmp(str, "rs"))
+ fecmode |= ETHTOOL_FEC_RS;
+ else if (!strcasecmp(str, "baser"))
+ fecmode |= ETHTOOL_FEC_BASER;
+
+ return fecmode;
+}
+
+static int do_gfec(struct cmd_context *ctx)
+{
+ struct ethtool_fecparam feccmd = { 0 };
+ int rv;
+
+ if (ctx->argc != 0)
+ exit_bad_args();
+
+ feccmd.cmd = ETHTOOL_GFECPARAM;
+ rv = send_ioctl(ctx, &feccmd);
+ if (rv != 0) {
+ perror("Cannot get FEC settings");
+ return rv;
+ }
+
+ fprintf(stdout, "FEC parameters for %s:\n", ctx->devname);
+ fprintf(stdout, "Configured FEC encodings:");
+ dump_fec(feccmd.fec);
+ fprintf(stdout, "\n");
+
+ fprintf(stdout, "Active FEC encoding:");
+ dump_fec(feccmd.active_fec);
+ fprintf(stdout, "\n");
+
+ return 0;
+}
+
+static int do_sfec(struct cmd_context *ctx)
+{
+ char *fecmode_str = NULL;
+ struct ethtool_fecparam feccmd;
+ struct cmdline_info cmdline_fec[] = {
+ { "encoding", CMDL_STR, &fecmode_str, &feccmd.fec},
+ };
+ int changed;
+ int fecmode;
+ int rv;
+
+ parse_generic_cmdline(ctx, &changed, cmdline_fec,
+ ARRAY_SIZE(cmdline_fec));
+
+ if (!fecmode_str)
+ exit_bad_args();
+
+ fecmode = fecmode_str_to_type(fecmode_str);
+ if (!fecmode)
+ exit_bad_args();
+
+ feccmd.cmd = ETHTOOL_SFECPARAM;
+ feccmd.fec = fecmode;
+ rv = send_ioctl(ctx, &feccmd);
+ if (rv != 0) {
+ perror("Cannot set FEC settings");
+ return rv;
+ }
+
+ return 0;
+}
+
#ifndef TEST_ETHTOOL
int send_ioctl(struct cmd_context *ctx, void *cmd)
{
@@ -5000,6 +5116,9 @@ static const struct option {
" [ ap-shared ]\n"
" [ dedicated ]\n"
" [ all ]\n"},
+ { "--show-fec", 1, do_gfec, "Show FEC settings"},
+ { "--set-fec", 1, do_sfec, "Set FEC settings",
+ " [ encoding auto|off|rs|baser ]\n"},
{ "-h|--help", 0, show_usage, "Show this help" },
{ "--version", 0, do_version, "Show version number" },
{}
--
2.15.1
^ permalink raw reply related
* [PATCH bpf-next] nfp: set flags in the correct member of netdev_bpf
From: Jakub Kicinski @ 2017-12-16 0:29 UTC (permalink / raw)
To: netdev; +Cc: oss-drivers, daniel, alexei.starovoitov, Jakub Kicinski
netdev_bpf.flags is the input member for installing the program.
netdev_bpf.prog_flags is the output member for querying. Set
the correct one on query.
Fixes: 92f0292b35a0 ("net: xdp: report flags program was installed with on query")
Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Reviewed-by: Quentin Monnet <quentin.monnet@netronome.com>
---
drivers/net/ethernet/netronome/nfp/nfp_net_common.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/netronome/nfp/nfp_net_common.c b/drivers/net/ethernet/netronome/nfp/nfp_net_common.c
index ad3e9f6a61e5..0add4870ce2e 100644
--- a/drivers/net/ethernet/netronome/nfp/nfp_net_common.c
+++ b/drivers/net/ethernet/netronome/nfp/nfp_net_common.c
@@ -3392,7 +3392,7 @@ static int nfp_net_xdp(struct net_device *netdev, struct netdev_bpf *xdp)
if (nn->dp.bpf_offload_xdp)
xdp->prog_attached = XDP_ATTACHED_HW;
xdp->prog_id = nn->xdp_prog ? nn->xdp_prog->aux->id : 0;
- xdp->flags = nn->xdp_prog ? nn->xdp_flags : 0;
+ xdp->prog_flags = nn->xdp_prog ? nn->xdp_flags : 0;
return 0;
case BPF_OFFLOAD_VERIFIER_PREP:
return nfp_app_bpf_verifier_prep(nn->app, nn, xdp);
--
2.15.1
^ permalink raw reply related
* [PATCH bpf-next] libbpf: fix Makefile exit code if libelf not found
From: Jakub Kicinski @ 2017-12-16 0:19 UTC (permalink / raw)
To: netdev; +Cc: oss-drivers, daniel, alexei.starovoitov, Jakub Kicinski
/bin/sh's exit does not recognize -1 as a number, leading to
the following error message:
/bin/sh: 1: exit: Illegal number: -1
Use 1 as the exit code.
Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Reviewed-by: Quentin Monnet <quentin.monnet@netronome.com>
---
tools/lib/bpf/Makefile | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/tools/lib/bpf/Makefile b/tools/lib/bpf/Makefile
index 4555304dc18e..8ed43ae9db9b 100644
--- a/tools/lib/bpf/Makefile
+++ b/tools/lib/bpf/Makefile
@@ -213,10 +213,10 @@ PHONY += force elfdep bpfdep
force:
elfdep:
- @if [ "$(feature-libelf)" != "1" ]; then echo "No libelf found"; exit -1 ; fi
+ @if [ "$(feature-libelf)" != "1" ]; then echo "No libelf found"; exit 1 ; fi
bpfdep:
- @if [ "$(feature-bpf)" != "1" ]; then echo "BPF API too old"; exit -1 ; fi
+ @if [ "$(feature-bpf)" != "1" ]; then echo "BPF API too old"; exit 1 ; fi
# Declare the contents of the .PHONY variable as phony. We keep that
# information in a variable so we can use it in if_changed and friends.
--
2.15.1
^ permalink raw reply related
* Re: [PATCH v2 iproute2 net-next] erspan: add erspan version II support
From: Roman Mashak @ 2017-12-15 23:58 UTC (permalink / raw)
To: William Tu; +Cc: netdev
In-Reply-To: <1513374172-5875-1-git-send-email-u9012063@gmail.com>
William Tu <u9012063@gmail.com> writes:
> The patch adds support for configuring the erspan v2, for both
> ipv4 and ipv6 erspan implementation. Three additional fields
> are added: 'erspan_ver' for distinguishing v1 or v2, 'erspan_dir'
> for specifying direction of the mirrored traffic, and 'erspan_hwid'
> for users to set ERSPAN engine ID within a system.
>
> As for manpage, the ERSPAN descriptions used to be under GRE, IPIP,
> SIT Type paragraph. Since IP6GRE/IP6GRETAP also supports ERSPAN,
> the patch removes the old one, creates a separate ERSPAN paragrah,
> and adds an example.
>
> Signed-off-by: William Tu <u9012063@gmail.com>
> ---
> change in v2:
> - clean up and update manpage.
> ---
> include/uapi/linux/if_ether.h | 1 +
> include/uapi/linux/if_tunnel.h | 3 ++
> ip/link_gre.c | 59 ++++++++++++++++++++++++--
> ip/link_gre6.c | 61 +++++++++++++++++++++++++--
> man/man8/ip-link.8.in | 94 ++++++++++++++++++++++++++++++++++++------
> 5 files changed, 199 insertions(+), 19 deletions(-)
>
> diff --git a/include/uapi/linux/if_ether.h b/include/uapi/linux/if_ether.h
> index 2eb529a90250..5fd5c12ef8e9 100644
> --- a/include/uapi/linux/if_ether.h
> +++ b/include/uapi/linux/if_ether.h
> @@ -47,6 +47,7 @@
> #define ETH_P_PUP 0x0200 /* Xerox PUP packet */
> #define ETH_P_PUPAT 0x0201 /* Xerox PUP Addr Trans packet */
> #define ETH_P_TSN 0x22F0 /* TSN (IEEE 1722) packet */
> +#define ETH_P_ERsPAN2 0x22EB /* ERSPAN version 2 (type III) */
^ Is it intention to have a lower case 's' in macro name or typo?
[...]
^ permalink raw reply
* Re: [PATCH 1/2] dt-bindings: net: add TI CC2560 Bluetooth chip
From: Rob Herring @ 2017-12-15 23:05 UTC (permalink / raw)
To: David Lechner
Cc: devicetree-u79uwXL29TY76Z2rM5mHXA,
linux-bluetooth-u79uwXL29TY76Z2rM5mHXA, Mark Rutland,
Marcel Holtmann, Johan Hedberg, netdev-u79uwXL29TY76Z2rM5mHXA,
linux-kernel-u79uwXL29TY76Z2rM5mHXA
In-Reply-To: <1513124971-23717-2-git-send-email-david-nq/r/kbU++upp/zk7JDF2g@public.gmane.org>
On Tue, Dec 12, 2017 at 06:29:30PM -0600, David Lechner wrote:
> This adds a compatible string for the Texas Instruments CC2560 Bluetooth
> chip to the existing TI WiLink shared transport bindings. These chips are
> similar enough that the same bindings work for both. The file is renamed
> to ti-bluetooth.txt to make it more generic.
>
> Signed-off-by: David Lechner <david-nq/r/kbU++upp/zk7JDF2g@public.gmane.org>
> ---
> .../bindings/net/{ti,wilink-st.txt => ti-bluetooth.txt} | 13 +++++++++++--
> 1 file changed, 11 insertions(+), 2 deletions(-)
> rename Documentation/devicetree/bindings/net/{ti,wilink-st.txt => ti-bluetooth.txt} (78%)
Reviewed-by: Rob Herring <robh-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
--
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
* [PATCH] qed: Remove unused QED_RDMA_DEV_CAP_* symbols and dev->dev_caps
From: Bjorn Helgaas @ 2017-12-15 23:03 UTC (permalink / raw)
To: netdev; +Cc: linux-pci, Ariel Elior, everest-linux-l2
From: Bjorn Helgaas <bhelgaas@google.com>
The QED_RDMA_DEV_CAP_* symbols are only used to set bits in dev->dev_caps.
Nobody ever looks at those bits. Remove the symbols and dev_caps itself.
Note that if these are ever used and added back, it looks incorrect to set
QED_RDMA_DEV_CAP_ATOMIC_OP based on PCI_EXP_DEVCTL2_LTR_EN. LTR is the
Latency Tolerance Reporting mechanism, which has nothing to do with Atomic
Ops.
No functional change intended.
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
---
drivers/net/ethernet/qlogic/qed/qed_rdma.c | 20 ----------
include/linux/qed/qed_rdma_if.h | 55 +---------------------------
2 files changed, 1 insertion(+), 74 deletions(-)
diff --git a/drivers/net/ethernet/qlogic/qed/qed_rdma.c b/drivers/net/ethernet/qlogic/qed/qed_rdma.c
index c8c4b3940564..1091b6aae0c6 100644
--- a/drivers/net/ethernet/qlogic/qed/qed_rdma.c
+++ b/drivers/net/ethernet/qlogic/qed/qed_rdma.c
@@ -394,7 +394,6 @@ static void qed_rdma_init_devinfo(struct qed_hwfn *p_hwfn,
{
struct qed_rdma_device *dev = p_hwfn->p_rdma_info->dev;
struct qed_dev *cdev = p_hwfn->cdev;
- u32 pci_status_control;
u32 num_qps;
/* Vendor specific information */
@@ -468,25 +467,6 @@ static void qed_rdma_init_devinfo(struct qed_hwfn *p_hwfn,
dev->max_ah = p_hwfn->p_rdma_info->num_qps;
dev->max_stats_queues = (u8)RESC_NUM(p_hwfn, QED_RDMA_STATS_QUEUE);
- /* Set capablities */
- dev->dev_caps = 0;
- SET_FIELD(dev->dev_caps, QED_RDMA_DEV_CAP_RNR_NAK, 1);
- SET_FIELD(dev->dev_caps, QED_RDMA_DEV_CAP_PORT_ACTIVE_EVENT, 1);
- SET_FIELD(dev->dev_caps, QED_RDMA_DEV_CAP_PORT_CHANGE_EVENT, 1);
- SET_FIELD(dev->dev_caps, QED_RDMA_DEV_CAP_RESIZE_CQ, 1);
- SET_FIELD(dev->dev_caps, QED_RDMA_DEV_CAP_BASE_MEMORY_EXT, 1);
- SET_FIELD(dev->dev_caps, QED_RDMA_DEV_CAP_BASE_QUEUE_EXT, 1);
- SET_FIELD(dev->dev_caps, QED_RDMA_DEV_CAP_ZBVA, 1);
- SET_FIELD(dev->dev_caps, QED_RDMA_DEV_CAP_LOCAL_INV_FENCE, 1);
-
- /* Check atomic operations support in PCI configuration space. */
- pci_read_config_dword(cdev->pdev,
- cdev->pdev->pcie_cap + PCI_EXP_DEVCTL2,
- &pci_status_control);
-
- if (pci_status_control & PCI_EXP_DEVCTL2_LTR_EN)
- SET_FIELD(dev->dev_caps, QED_RDMA_DEV_CAP_ATOMIC_OP, 1);
-
if (QED_IS_IWARP_PERSONALITY(p_hwfn))
qed_iwarp_init_devinfo(p_hwfn);
}
diff --git a/include/linux/qed/qed_rdma_if.h b/include/linux/qed/qed_rdma_if.h
index 4dd72ba210f5..a8db5572d3c2 100644
--- a/include/linux/qed/qed_rdma_if.h
+++ b/include/linux/qed/qed_rdma_if.h
@@ -109,60 +109,7 @@ struct qed_rdma_device {
u8 max_pkey;
u16 max_srq_wr;
u8 max_stats_queues;
- u32 dev_caps;
-
- /* Abilty to support RNR-NAK generation */
-
-#define QED_RDMA_DEV_CAP_RNR_NAK_MASK 0x1
-#define QED_RDMA_DEV_CAP_RNR_NAK_SHIFT 0
- /* Abilty to support shutdown port */
-#define QED_RDMA_DEV_CAP_SHUTDOWN_PORT_MASK 0x1
-#define QED_RDMA_DEV_CAP_SHUTDOWN_PORT_SHIFT 1
- /* Abilty to support port active event */
-#define QED_RDMA_DEV_CAP_PORT_ACTIVE_EVENT_MASK 0x1
-#define QED_RDMA_DEV_CAP_PORT_ACTIVE_EVENT_SHIFT 2
- /* Abilty to support port change event */
-#define QED_RDMA_DEV_CAP_PORT_CHANGE_EVENT_MASK 0x1
-#define QED_RDMA_DEV_CAP_PORT_CHANGE_EVENT_SHIFT 3
- /* Abilty to support system image GUID */
-#define QED_RDMA_DEV_CAP_SYS_IMAGE_MASK 0x1
-#define QED_RDMA_DEV_CAP_SYS_IMAGE_SHIFT 4
- /* Abilty to support bad P_Key counter support */
-#define QED_RDMA_DEV_CAP_BAD_PKEY_CNT_MASK 0x1
-#define QED_RDMA_DEV_CAP_BAD_PKEY_CNT_SHIFT 5
- /* Abilty to support atomic operations */
-#define QED_RDMA_DEV_CAP_ATOMIC_OP_MASK 0x1
-#define QED_RDMA_DEV_CAP_ATOMIC_OP_SHIFT 6
-#define QED_RDMA_DEV_CAP_RESIZE_CQ_MASK 0x1
-#define QED_RDMA_DEV_CAP_RESIZE_CQ_SHIFT 7
- /* Abilty to support modifying the maximum number of
- * outstanding work requests per QP
- */
-#define QED_RDMA_DEV_CAP_RESIZE_MAX_WR_MASK 0x1
-#define QED_RDMA_DEV_CAP_RESIZE_MAX_WR_SHIFT 8
- /* Abilty to support automatic path migration */
-#define QED_RDMA_DEV_CAP_AUTO_PATH_MIG_MASK 0x1
-#define QED_RDMA_DEV_CAP_AUTO_PATH_MIG_SHIFT 9
- /* Abilty to support the base memory management extensions */
-#define QED_RDMA_DEV_CAP_BASE_MEMORY_EXT_MASK 0x1
-#define QED_RDMA_DEV_CAP_BASE_MEMORY_EXT_SHIFT 10
-#define QED_RDMA_DEV_CAP_BASE_QUEUE_EXT_MASK 0x1
-#define QED_RDMA_DEV_CAP_BASE_QUEUE_EXT_SHIFT 11
- /* Abilty to support multipile page sizes per memory region */
-#define QED_RDMA_DEV_CAP_MULTI_PAGE_PER_MR_EXT_MASK 0x1
-#define QED_RDMA_DEV_CAP_MULTI_PAGE_PER_MR_EXT_SHIFT 12
- /* Abilty to support block list physical buffer list */
-#define QED_RDMA_DEV_CAP_BLOCK_MODE_MASK 0x1
-#define QED_RDMA_DEV_CAP_BLOCK_MODE_SHIFT 13
- /* Abilty to support zero based virtual addresses */
-#define QED_RDMA_DEV_CAP_ZBVA_MASK 0x1
-#define QED_RDMA_DEV_CAP_ZBVA_SHIFT 14
- /* Abilty to support local invalidate fencing */
-#define QED_RDMA_DEV_CAP_LOCAL_INV_FENCE_MASK 0x1
-#define QED_RDMA_DEV_CAP_LOCAL_INV_FENCE_SHIFT 15
- /* Abilty to support Loopback on QP */
-#define QED_RDMA_DEV_CAP_LB_INDICATOR_MASK 0x1
-#define QED_RDMA_DEV_CAP_LB_INDICATOR_SHIFT 16
+
u64 page_size_caps;
u8 dev_ack_delay;
u32 reserved_lkey;
^ permalink raw reply related
* [PATCH] cxgb4: Simplify PCIe Completion Timeout setting
From: Bjorn Helgaas @ 2017-12-15 23:01 UTC (permalink / raw)
To: netdev; +Cc: linux-pci, Ganesh Goudar
From: Bjorn Helgaas <bhelgaas@google.com>
Simplify PCIe Completion Timeout setting by using the
pcie_capability_clear_and_set_word() interface. No functional change
intended.
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
---
drivers/net/ethernet/chelsio/cxgb4/t4_hw.c | 21 +++------------------
1 file changed, 3 insertions(+), 18 deletions(-)
diff --git a/drivers/net/ethernet/chelsio/cxgb4/t4_hw.c b/drivers/net/ethernet/chelsio/cxgb4/t4_hw.c
index f63210f15579..4c99fdb2e13b 100644
--- a/drivers/net/ethernet/chelsio/cxgb4/t4_hw.c
+++ b/drivers/net/ethernet/chelsio/cxgb4/t4_hw.c
@@ -8492,22 +8492,6 @@ static int t4_get_flash_params(struct adapter *adap)
return 0;
}
-static void set_pcie_completion_timeout(struct adapter *adapter, u8 range)
-{
- u16 val;
- u32 pcie_cap;
-
- pcie_cap = pci_find_capability(adapter->pdev, PCI_CAP_ID_EXP);
- if (pcie_cap) {
- pci_read_config_word(adapter->pdev,
- pcie_cap + PCI_EXP_DEVCTL2, &val);
- val &= ~PCI_EXP_DEVCTL2_COMP_TIMEOUT;
- val |= range;
- pci_write_config_word(adapter->pdev,
- pcie_cap + PCI_EXP_DEVCTL2, val);
- }
-}
-
/**
* t4_prep_adapter - prepare SW and HW for operation
* @adapter: the adapter
@@ -8593,8 +8577,9 @@ int t4_prep_adapter(struct adapter *adapter)
adapter->params.portvec = 1;
adapter->params.vpd.cclk = 50000;
- /* Set pci completion timeout value to 4 seconds. */
- set_pcie_completion_timeout(adapter, 0xd);
+ /* Set PCIe completion timeout to 4 seconds. */
+ pcie_capability_clear_and_set_word(adapter->pdev, PCI_EXP_DEVCTL2,
+ PCI_EXP_DEVCTL2_COMP_TIMEOUT, 0xd);
return 0;
}
^ permalink raw reply related
* Re: [RFC v3 0/4] flow_dissector: Provide basic batman-adv unicast handling
From: Willem de Bruijn @ 2017-12-15 22:51 UTC (permalink / raw)
To: Sven Eckelmann
Cc: Network Development, b.a.t.m.a.n, Eric Dumazet, LKML, Jiri Pirko,
David S . Miller, Tom Herbert
In-Reply-To: <20171215182313.15767-1-sven.eckelmann@openmesh.com>
On Fri, Dec 15, 2017 at 1:23 PM, Sven Eckelmann
<sven.eckelmann@openmesh.com> wrote:
> Hi,
>
> we are currently starting to use batman-adv as mesh protocol on multicore
> embedded devices. These usually don't have a lot of CPU power per core but
> are reasonable fast when using multiple cores.
>
> It was noticed that sending was working very well but receiving was
> basically only using on CPU core per neighbor. The reason for that is
> format of the (normal) incoming packet:
>
> +--------------------+
> | ip(v6)hdr |
> +--------------------+
> | inner ethhdr |
> +--------------------+
> | batadv unicast hdr |
> +--------------------+
> | outer ethhdr |
> +--------------------+
>
> The flow dissector will therefore stop after parsing the outer ethernet
> header and will not parse the actual ipv(4|6)/... header of the packet. Our
> assumption was now that it would help us to add minimal support to the flow
> dissector to jump over the batman-adv unicast and inner ethernet header
> (like in gre ETH_P_TEB). The patch was implemented in a slightly hacky
> way [1] and the results looked quite promising.
>
> I didn't get any feedback how the files should actually be named and I am
> not really happy with the current names - so please feel free to propose
> better names.
>
> The discussion of the RFC v2 can be found in the related patches of
> https://patchwork.ozlabs.org/cover/844783/
>
>
> Changes in v3:
> ==============
>
> * removed change of uapi/linux/batman_adv.h to uapi/linux/batadv_genl.h
> - requested by Willem de Bruijn <willemdebruijn.kernel@gmail.com>
> * removed naming fixes for enums/defines in uapi/linux/batadv_genl.h
> - requested by Willem de Bruijn <willemdebruijn.kernel@gmail.com>
> * renamed uapi/linux/batadv.h to uapi/linux/batadv_packet.h
> * moved batadv dissector functionality in own function
> - requested by Tom Herbert <tom@herbertland.com>
> * added support for flags FLOW_DISSECTOR_F_STOP_AT_ENCAP and
> FLOW_DIS_ENCAPSULATION
> - requested by Willem de Bruijn <willemdebruijn.kernel@gmail.com>
Thanks for making these changes. The flow dissection looks good to me.
One possible issue is that this exposes kernel fixed width types u8/u16/..
to userspace. For posix compatibility reasons, uapi headers use the
variant with underscores.
^ permalink raw reply
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