* Re: [PATCH V4 net 0/2] ipv6: fix flowlabel issue for reset packet
From: Tom Herbert @ 2017-08-15 14:08 UTC (permalink / raw)
To: Shaohua Li; +Cc: Linux Kernel Network Developers, David S. Miller, Shaohua Li
In-Reply-To: <20170815025224.trjgcp3z6i3cgfy2@kernel.org>
On Mon, Aug 14, 2017 at 7:52 PM, Shaohua Li <shli@kernel.org> wrote:
> On Fri, Aug 11, 2017 at 06:00:20PM -0700, Tom Herbert wrote:
>> On Thu, Aug 10, 2017 at 12:13 PM, Shaohua Li <shli@kernel.org> wrote:
>> > On Thu, Aug 10, 2017 at 11:30:51AM -0700, Tom Herbert wrote:
>> >> On Thu, Aug 10, 2017 at 9:30 AM, Shaohua Li <shli@kernel.org> wrote:
>> >> > On Wed, Aug 09, 2017 at 09:40:08AM -0700, Tom Herbert wrote:
>> >> >> On Mon, Jul 31, 2017 at 3:19 PM, Shaohua Li <shli@kernel.org> wrote:
>> >> >> > From: Shaohua Li <shli@fb.com>
>> >> >> >
>> >> >> > Please see below tcpdump output:
>> >> >> > 21:00:48.109122 IP6 (flowlabel 0x43304, hlim 64, next-header TCP (6) payload length: 40) fec0::5054:ff:fe12:3456.55804 > fec0::5054:ff:fe12:3456.5555: Flags [S], cksum 0x0529 (incorrect -> 0xf56c), seq 3282214508, win 43690, options [mss 65476,sackOK,TS val 2500903437 ecr 0,nop,wscale 7], length 0
>> >> >> > 21:00:48.109381 IP6 (flowlabel 0xd827f, hlim 64, next-header TCP (6) payload length: 40) fec0::5054:ff:fe12:3456.5555 > fec0::5054:ff:fe12:3456.55804: Flags [S.], cksum 0x0529 (incorrect -> 0x49ad), seq 1923801573, ack 3282214509, win 43690, options [mss 65476,sackOK,TS val 2500903437 ecr 2500903437,nop,wscale 7], length 0
>> >> >> > 21:00:48.109548 IP6 (flowlabel 0x43304, hlim 64, next-header TCP (6) payload length: 32) fec0::5054:ff:fe12:3456.55804 > fec0::5054:ff:fe12:3456.5555: Flags [.], cksum 0x0521 (incorrect -> 0x1bdf), seq 1, ack 1, win 342, options [nop,nop,TS val 2500903437 ecr 2500903437], length 0
>> >> >> > 21:00:48.109823 IP6 (flowlabel 0x43304, hlim 64, next-header TCP (6) payload length: 62) fec0::5054:ff:fe12:3456.55804 > fec0::5054:ff:fe12:3456.5555: Flags [P.], cksum 0x053f (incorrect -> 0xb8b1), seq 1:31, ack 1, win 342, options [nop,nop,TS val 2500903437 ecr 2500903437], length 30
>> >> >> > 21:00:48.109910 IP6 (flowlabel 0xd827f, hlim 64, next-header TCP (6) payload length: 32) fec0::5054:ff:fe12:3456.5555 > fec0::5054:ff:fe12:3456.55804: Flags [.], cksum 0x0521 (incorrect -> 0x1bc1), seq 1, ack 31, win 342, options [nop,nop,TS val 2500903437 ecr 2500903437], length 0
>> >> >> > 21:00:48.110043 IP6 (flowlabel 0xd827f, hlim 64, next-header TCP (6) payload length: 56) fec0::5054:ff:fe12:3456.5555 > fec0::5054:ff:fe12:3456.55804: Flags [P.], cksum 0x0539 (incorrect -> 0xb726), seq 1:25, ack 31, win 342, options [nop,nop,TS val 2500903438 ecr 2500903437], length 24
>> >> >> > 21:00:48.110173 IP6 (flowlabel 0x43304, hlim 64, next-header TCP (6) payload length: 32) fec0::5054:ff:fe12:3456.55804 > fec0::5054:ff:fe12:3456.5555: Flags [.], cksum 0x0521 (incorrect -> 0x1ba7), seq 31, ack 25, win 342, options [nop,nop,TS val 2500903438 ecr 2500903438], length 0
>> >> >> > 21:00:48.110211 IP6 (flowlabel 0xd827f, hlim 64, next-header TCP (6) payload length: 32) fec0::5054:ff:fe12:3456.5555 > fec0::5054:ff:fe12:3456.55804: Flags [F.], cksum 0x0521 (incorrect -> 0x1ba7), seq 25, ack 31, win 342, options [nop,nop,TS val 2500903438 ecr 2500903437], length 0
>> >> >> > 21:00:48.151099 IP6 (flowlabel 0x43304, hlim 64, next-header TCP (6) payload length: 32) fec0::5054:ff:fe12:3456.55804 > fec0::5054:ff:fe12:3456.5555: Flags [.], cksum 0x0521 (incorrect -> 0x1ba6), seq 31, ack 26, win 342, options [nop,nop,TS val 2500903438 ecr 2500903438], length 0
>> >> >> > 21:00:49.110524 IP6 (flowlabel 0x43304, hlim 64, next-header TCP (6) payload length: 56) fec0::5054:ff:fe12:3456.55804 > fec0::5054:ff:fe12:3456.5555: Flags [P.], cksum 0x0539 (incorrect -> 0xb324), seq 31:55, ack 26, win 342, options [nop,nop,TS val 2500904438 ecr 2500903438], length 24
>> >> >> > 21:00:49.110637 IP6 (flowlabel 0xb34d5, hlim 64, next-header TCP (6) payload length: 20) fec0::5054:ff:fe12:3456.5555 > fec0::5054:ff:fe12:3456.55804: Flags [R], cksum 0x0515 (incorrect -> 0x668c), seq 1923801599, win 0, length 0
>> >> >> >
>> >> >> > The flowlabel of reset packet (0xb34d5) and flowlabel of normal packet
>> >> >> > (0xd827f) are different. This causes our router doesn't correctly close tcp
>> >> >> > connection. The patches try to fix the issue.
>> >> >> >
>> >> >> Shaohua,
>> >> >>
>> >> >> Can you give some more detail about what the router doesn't close the
>> >> >> TCP connection means? I'm guessing the problem is either: 1) the
>> >> >> router is maintaining connection state that includes the flow label in
>> >> >> a connection tuple. 2) some router in the path is maintaining
>> >> >> connection state, but when the flow label changes the flow's packet
>> >> >> are routed through a different router that doesn't have a state for
>> >> >> the flow it drops the packet. #1 should be easily fix in the router,
>> >> >> flow labels cannot be used as state. #2 is the known problem that
>> >> >> stateful firewalls have killed our ability to use multihoming.
>> >> >
>> >> > The #2 is exactly the problem we saw.
>> >> >
>> >> >> Another consideration is that sk_txhash is also used in routing
>> >> >> decisions by the local host (flow label is normally derived from
>> >> >> txhash). If you want to ensure that connections are routed
>> >> >> consistently for timewait state you might need sk_txhash saved also.
>> >> >
>> >> > As far as I understood, we don't use sk_txhash for routing selection. The code
>> >> > does routing selection with flowlabel user configured, at that time we don't
>> >> > derive fl6.flowlabel from skb->hash (which is from sk_txhash). The code always
>> >> > does routing selection first and then uses ip6_make_flowlabel to build packet
>> >> > data where we derive flowlabel from skb->hash.
>> >> >
>> >> That is assuming one particular use case. Generally, if you want to
>> >> ensure all packets for a flow take the same path you'll need tx_hash
>> >> and make it persistent (disable flow bender). For instance, if you
>> >> were doing UDP encapsulation like in VXLAN the UDP source port
>> >> selection is unaffected by saved flow label for the lifetime of the
>> >> flow. So we would still hit #2 in that case and the stateful device
>> >> doesn't see whole flow. It might be just as easy to move tx_hash in
>> >> skc_common so that it's available in TW state for this purpose. Then
>> >> when moving to TW state just copy the tx_hash.
>> >
>> > Hi Tom,
>> >
>> > My original implementation is to add a tx_hash in tw sock, we then copy sock's
>> > tx_hash to the tw tx_hash. This does makes things simplier. One concern from
>> > Eric is this will increase the size of tw sock. If we move tx_hash to
>> > skc_common, all sock size will increase, is this acceptable?
>>
>> I think that can only be measured by how critical it is to
>> persistently route all packets the same exact way for every
>> connection. Page one of the IP book clearly states that IP packets can
>> be dropped, duplicated, or received out of order. Received OOO implies
>> that packet for the same flow are allowed to take different paths. The
>> requirement that packets for the same flow must always take the same
>> path through the network was created by stateful middleboxes-- it's
>> not inherent in the architecture of IP networking. Unfortunately,
>> we're seeing this become more and more of a problem as more devices
>> are multi-homed (like smart phones) and these network requirement
>> cripple our ability to take advantage of features like that.
>>
>> Personally, I wish the middleboxes fix the problem they created, but I
>> suppose we need to be pragmatic at least in the short term.
>
> Hmm, I still hesitate to add a new field in skc_common. Fixing current problem
> looks propriate in current stage. I'd defer fixing the generic issue till it's
> necessary.
>
Shaohua,
An alternative would be to not initialize sk_txhash, but instead defer
hash computation to use flow dissector in the TX path when the hash is
needed (to get flow label, src port for UDP encap, route for
multipath, etc.). At the first hash computation in TX path the result
in sk_txhash. In TW state there is no socket so flow dissector is
always used but that should yield the same hash. No extra fields would
be needed and additional cost is negligible.
Tom
> Thanks,
> Shaohua
^ permalink raw reply
* Re: [PATCH] net_sched/sfq: update hierarchical backlog when drop packet
From: Eric Dumazet @ 2017-08-15 14:09 UTC (permalink / raw)
To: Konstantin Khlebnikov
Cc: netdev, David S. Miller, Cong Wang, Jamal Hadi Salim
In-Reply-To: <150280422406.717624.15125218636935056461.stgit@buzz>
On Tue, 2017-08-15 at 16:37 +0300, Konstantin Khlebnikov wrote:
> When sfq_enqueue() drops head packet or packet from another queue it
> have to update backlog at upper qdiscs too.
>
> Signed-off-by: Konstantin Khlebnikov <khlebnikov@yandex-team.ru>
> Fixes: 2ccccf5fb43f ("net_sched: update hierarchical backlog too")
> ---
> net/sched/sch_sfq.c | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/net/sched/sch_sfq.c b/net/sched/sch_sfq.c
> index f80ea2cc5f1f..82469ef9655e 100644
> --- a/net/sched/sch_sfq.c
> +++ b/net/sched/sch_sfq.c
> @@ -437,6 +437,7 @@ sfq_enqueue(struct sk_buff *skb, struct Qdisc *sch, struct sk_buff **to_free)
> qdisc_drop(head, sch, to_free);
>
> slot_queue_add(slot, skb);
> + qdisc_tree_reduce_backlog(sch, 0, delta);
> return NET_XMIT_CN;
> }
>
> @@ -468,8 +469,10 @@ sfq_enqueue(struct sk_buff *skb, struct Qdisc *sch, struct sk_buff **to_free)
> /* Return Congestion Notification only if we dropped a packet
> * from this flow.
> */
> - if (qlen != slot->qlen)
> + if (qlen != slot->qlen) {
> + qdisc_tree_reduce_backlog(sch, 0, dropped - qdisc_pkt_len(skb));
> return NET_XMIT_CN;
> + }
>
> /* As we dropped a packet, better let upper stack know this */
> qdisc_tree_reduce_backlog(sch, 1, dropped);
>
Are you sure you have tested this patch ?
^ permalink raw reply
* Possible race in via-ircc.ko
From: Anton Volkov @ 2017-08-15 14:11 UTC (permalink / raw)
To: samuel, sda; +Cc: netdev, linux-kernel, ldv-project, Alexey Khoroshilov
Hello.
While searching for races in the Linux kernel I've come across
"drivers/net/irda/via-ircc.ko" module. Here are questions that I came up
with while analyzing results. Lines are given using the info from Linux
v4.12.
Consider the following case:
Thread 1: Thread 2:
via_ircc_net_open
request_irq
<turn on interrupts>
via_ircc_interrupt
-> via_ircc_dma_receive -> RxTimerHandler
(via-ircc.c: line 1488) (via-ircc.c: line 1315)
self->... = ... ... = self->...
In the via_ircc_dma_receive a lot of fields of 'self' structure are
initialized and via_ircc_interrupt with RxTimerHandler use those fields.
If no initialization happened interrupt handler and other functions that
it calls may work with incorrect data. I'm not sure how bad this case
can be and thus here are my questions. Is this situation feasible from
your point of view? If it is feasible, is it a benign race or something
serious?
Thank you for your time.
-- Anton Volkov
Linux Verification Center, ISPRAS
web: http://linuxtesting.org
e-mail: avolkov@ispras.ru
^ permalink raw reply
* Re: [patch net-next] ipv6: fib: Provide offload indication using nexthop flags
From: David Ahern @ 2017-08-15 14:18 UTC (permalink / raw)
To: Jiri Pirko, netdev
Cc: davem, idosch, mlxsw, roopa, nikolay, hannes, yoshfuji, kuznet
In-Reply-To: <20170815070949.1363-1-jiri@resnulli.us>
On 8/15/17 1:09 AM, Jiri Pirko wrote:
> From: Ido Schimmel <idosch@mellanox.com>
>
> IPv6 routes currently lack nexthop flags as in IPv4. This has several
> implications.
>
> In the forwarding path, it requires us to check the carrier state of the
> nexthop device and potentially ignore a linkdown route, instead of
> checking for RTNH_F_LINKDOWN.
>
> It also requires capable drivers to use the user facing IPv6-specific
> route flags to provide offload indication, instead of using the nexthop
> flags as in IPv4.
>
> Add nexthop flags to IPv6 routes in the 40 bytes hole and use it to
> provide offload indication instead of the RTF_OFFLOAD flag, which is
> removed while it's still not part of any official kernel release.
>
> In the near future we would like to use the field for the
> RTNH_F_{LINKDOWN,DEAD} flags, but this change is more involved and might
> not be ready in time for the current cycle.
>
> Signed-off-by: Ido Schimmel <idosch@mellanox.com>
> Signed-off-by: Jiri Pirko <jiri@mellanox.com>
> ---
> drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c | 8 ++++----
> include/net/ip6_fib.h | 2 ++
> include/uapi/linux/ipv6_route.h | 1 -
> net/ipv6/route.c | 7 +------
> 4 files changed, 7 insertions(+), 11 deletions(-)
LGTM.
Acked-by: David Ahern <dsahern@gmail.com>
^ permalink raw reply
* Re: [PATCH 2/5] net/9p: Improve 19 size determinations
From: Al Viro @ 2017-08-15 14:21 UTC (permalink / raw)
To: SF Markus Elfring
Cc: v9fs-developer, netdev, David S. Miller, Eric Van Hensbergen,
Latchesar Ionkov, Ron Minnich, LKML, kernel-janitors
In-Reply-To: <f9eeedc4-5d3d-6622-79f0-11174ea81c49@users.sourceforge.net>
On Tue, Aug 15, 2017 at 02:00:06PM +0200, SF Markus Elfring wrote:
> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Tue, 15 Aug 2017 09:36:20 +0200
>
> Replace the specification of data structures by variable references
> as the parameter for the operator "sizeof" to make the corresponding size
> determination a bit safer according to the Linux coding style convention.
Garbage. This makes it so much harder to find where the objects of given
type are created. It's _not_ safer and any patches of that sort around
VFS will be shitcanned. What to do with net/9p patches is up to net/9p
maintainers, but I would strongly recommend the same treatment.
^ permalink raw reply
* (unknown),
From: helga.brickl @ 2017-08-15 14:23 UTC (permalink / raw)
To: netdev
[-- Attachment #1: 55560763.zip --]
[-- Type: application/zip, Size: 3051 bytes --]
^ permalink raw reply
* Re: [PATCH] net_sched/sfq: update hierarchical backlog when drop packet
From: Konstantin Khlebnikov @ 2017-08-15 14:33 UTC (permalink / raw)
To: Eric Dumazet; +Cc: netdev, David S. Miller, Cong Wang, Jamal Hadi Salim
In-Reply-To: <1502806179.4936.76.camel@edumazet-glaptop3.roam.corp.google.com>
On 15.08.2017 17:09, Eric Dumazet wrote:
> On Tue, 2017-08-15 at 16:37 +0300, Konstantin Khlebnikov wrote:
>> When sfq_enqueue() drops head packet or packet from another queue it
>> have to update backlog at upper qdiscs too.
>>
>> Signed-off-by: Konstantin Khlebnikov <khlebnikov@yandex-team.ru>
>> Fixes: 2ccccf5fb43f ("net_sched: update hierarchical backlog too")
>> ---
>> net/sched/sch_sfq.c | 5 ++++-
>> 1 file changed, 4 insertions(+), 1 deletion(-)
>>
>> diff --git a/net/sched/sch_sfq.c b/net/sched/sch_sfq.c
>> index f80ea2cc5f1f..82469ef9655e 100644
>> --- a/net/sched/sch_sfq.c
>> +++ b/net/sched/sch_sfq.c
>> @@ -437,6 +437,7 @@ sfq_enqueue(struct sk_buff *skb, struct Qdisc *sch, struct sk_buff **to_free)
>> qdisc_drop(head, sch, to_free);
>>
>> slot_queue_add(slot, skb);
>> + qdisc_tree_reduce_backlog(sch, 0, delta);
>> return NET_XMIT_CN;
>> }
>>
>> @@ -468,8 +469,10 @@ sfq_enqueue(struct sk_buff *skb, struct Qdisc *sch, struct sk_buff **to_free)
>> /* Return Congestion Notification only if we dropped a packet
>> * from this flow.
>> */
>> - if (qlen != slot->qlen)
>> + if (qlen != slot->qlen) {
>> + qdisc_tree_reduce_backlog(sch, 0, dropped - qdisc_pkt_len(skb));
>> return NET_XMIT_CN;
>> + }
>>
>> /* As we dropped a packet, better let upper stack know this */
>> qdisc_tree_reduce_backlog(sch, 1, dropped);
>>
>
> Are you sure you have tested this patch ?
>
Nope. I'm not sure. But we have something similar in our 4.4 kernel for a while.
Also fq_codel and pfifo_head_drop do something similar tho this.
Probably this might crash without "[PATCH 1/2] net_sched: call qlen_notify only if child qdisc is empty".
I hadn't tested them separately.
^ permalink raw reply
* [PATCH net-next 0/4] inet: make RTM_GETROUTE work without rtnl
From: Florian Westphal @ 2017-08-15 14:34 UTC (permalink / raw)
To: netdev
ipv4 getroute doesn't assume rtnl lock is held anymore, also make
this true for ipv6, then switch both to DOIT_UNLOCKED.
^ permalink raw reply
* [PATCH net-next 1/4] selftests: add 'ip get' to rtnetlink.sh
From: Florian Westphal @ 2017-08-15 14:34 UTC (permalink / raw)
To: netdev; +Cc: Florian Westphal
In-Reply-To: <20170815143444.17002-1-fw@strlen.de>
exercise ip/ip6 RTM_GETROUTE doit() callpath.
Signed-off-by: Florian Westphal <fw@strlen.de>
---
tools/testing/selftests/net/rtnetlink.sh | 32 ++++++++++++++++++++++++++++++++
1 file changed, 32 insertions(+)
diff --git a/tools/testing/selftests/net/rtnetlink.sh b/tools/testing/selftests/net/rtnetlink.sh
index 5b04ad912525..84b4acf5baa9 100755
--- a/tools/testing/selftests/net/rtnetlink.sh
+++ b/tools/testing/selftests/net/rtnetlink.sh
@@ -164,6 +164,37 @@ kci_test_polrouting()
echo "PASS: policy routing"
}
+kci_test_route_get()
+{
+ ret=0
+
+ ip route get 127.0.0.1 > /dev/null
+ check_err $?
+ ip route get 127.0.0.1 dev "$devdummy" > /dev/null
+ check_err $?
+ ip route get ::1 > /dev/null
+ check_err $?
+ ip route get fe80::1 dev "$devdummy" > /dev/null
+ check_err $?
+ ip route get 127.0.0.1 from 127.0.0.1 oif lo tos 0x1 mark 0x1 > /dev/null
+ check_err $?
+ ip route get ::1 from ::1 iif lo oif lo tos 0x1 mark 0x1 > /dev/null
+ check_err $?
+ ip addr add dev "$devdummy" 10.23.7.11/24
+ check_err $?
+ ip route get 10.23.7.11 from 10.23.7.12 iif "$devdummy" > /dev/null
+ check_err $?
+ ip addr del dev "$devdummy" 10.23.7.11/24
+ check_err $?
+
+ if [ $ret -ne 0 ];then
+ echo "FAIL: route get"
+ return 1
+ fi
+
+ echo "PASS: route get"
+}
+
kci_test_rtnl()
{
kci_add_dummy
@@ -173,6 +204,7 @@ kci_test_rtnl()
fi
kci_test_polrouting
+ kci_test_route_get
kci_test_tc
kci_test_gre
kci_test_bridge
--
2.13.0
^ permalink raw reply related
* [PATCH net-next 2/4] ipv6: route: make rtm_getroute not assume rtnl is locked
From: Florian Westphal @ 2017-08-15 14:34 UTC (permalink / raw)
To: netdev; +Cc: Florian Westphal
In-Reply-To: <20170815143444.17002-1-fw@strlen.de>
__dev_get_by_index assumes RTNL is held, use _rcu version instead.
Signed-off-by: Florian Westphal <fw@strlen.de>
---
net/ipv6/route.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/net/ipv6/route.c b/net/ipv6/route.c
index 035762fed07d..ec694fdb8cc5 100644
--- a/net/ipv6/route.c
+++ b/net/ipv6/route.c
@@ -3616,8 +3616,11 @@ static int inet6_rtm_getroute(struct sk_buff *in_skb, struct nlmsghdr *nlh,
struct net_device *dev;
int flags = 0;
- dev = __dev_get_by_index(net, iif);
+ rcu_read_lock();
+
+ dev = dev_get_by_index_rcu(net, iif);
if (!dev) {
+ rcu_read_unlock();
err = -ENODEV;
goto errout;
}
@@ -3629,6 +3632,8 @@ static int inet6_rtm_getroute(struct sk_buff *in_skb, struct nlmsghdr *nlh,
if (!fibmatch)
dst = ip6_route_input_lookup(net, dev, &fl6, flags);
+
+ rcu_read_unlock();
} else {
fl6.flowi6_oif = oif;
--
2.13.0
^ permalink raw reply related
* [PATCH net-next 3/4] ipv6: route: set ipv6 RTM_GETROUTE to not use rtnl
From: Florian Westphal @ 2017-08-15 14:34 UTC (permalink / raw)
To: netdev; +Cc: Florian Westphal
In-Reply-To: <20170815143444.17002-1-fw@strlen.de>
Signed-off-by: Florian Westphal <fw@strlen.de>
---
net/ipv6/route.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/net/ipv6/route.c b/net/ipv6/route.c
index ec694fdb8cc5..3c15f005c90e 100644
--- a/net/ipv6/route.c
+++ b/net/ipv6/route.c
@@ -4112,7 +4112,8 @@ int __init ip6_route_init(void)
ret = -ENOBUFS;
if (__rtnl_register(PF_INET6, RTM_NEWROUTE, inet6_rtm_newroute, NULL, 0) ||
__rtnl_register(PF_INET6, RTM_DELROUTE, inet6_rtm_delroute, NULL, 0) ||
- __rtnl_register(PF_INET6, RTM_GETROUTE, inet6_rtm_getroute, NULL, 0))
+ __rtnl_register(PF_INET6, RTM_GETROUTE, inet6_rtm_getroute, NULL,
+ RTNL_FLAG_DOIT_UNLOCKED))
goto out_register_late_subsys;
ret = register_netdevice_notifier(&ip6_route_dev_notifier);
--
2.13.0
^ permalink raw reply related
* [PATCH net-next 4/4] ipv4: route: set ipv4 RTM_GETROUTE to not use rtnl
From: Florian Westphal @ 2017-08-15 14:34 UTC (permalink / raw)
To: netdev; +Cc: Florian Westphal
In-Reply-To: <20170815143444.17002-1-fw@strlen.de>
Signed-off-by: Florian Westphal <fw@strlen.de>
---
net/ipv4/route.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/net/ipv4/route.c b/net/ipv4/route.c
index 6810d2076b1b..618bbe1405fc 100644
--- a/net/ipv4/route.c
+++ b/net/ipv4/route.c
@@ -3073,7 +3073,8 @@ int __init ip_rt_init(void)
xfrm_init();
xfrm4_init();
#endif
- rtnl_register(PF_INET, RTM_GETROUTE, inet_rtm_getroute, NULL, 0);
+ rtnl_register(PF_INET, RTM_GETROUTE, inet_rtm_getroute, NULL,
+ RTNL_FLAG_DOIT_UNLOCKED);
#ifdef CONFIG_SYSCTL
register_pernet_subsys(&sysctl_route_ops);
--
2.13.0
^ permalink raw reply related
* [PATCH ] dt-bindings: net: ravb : Add support for r8a7745 SoC
From: Biju Das @ 2017-08-15 14:40 UTC (permalink / raw)
To: David S. Miller, Rob Herring, Mark Rutland, Russell King
Cc: Sergei Shtylyov, Simon Horman, Magnus Damm, Chris Paterson,
devicetree-u79uwXL29TY76Z2rM5mHXA,
linux-renesas-soc-u79uwXL29TY76Z2rM5mHXA,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
netdev-u79uwXL29TY76Z2rM5mHXA, Biju Das
Add a new compatible string for the RZ/G1E (R8A7745) SoC.
Signed-off-by: Biju Das <biju.das-kTT6dE0pTRh9uiUsa/gSgQ@public.gmane.org>
---
This patch is tested against linux-next tag next-20170815
as well as net-next.
Documentation/devicetree/bindings/net/renesas,ravb.txt | 1 +
1 file changed, 1 insertion(+)
diff --git a/Documentation/devicetree/bindings/net/renesas,ravb.txt b/Documentation/devicetree/bindings/net/renesas,ravb.txt
index 4717bc2..1672353 100644
--- a/Documentation/devicetree/bindings/net/renesas,ravb.txt
+++ b/Documentation/devicetree/bindings/net/renesas,ravb.txt
@@ -6,6 +6,7 @@ interface contains.
Required properties:
- compatible: Must contain one or more of the following:
- "renesas,etheravb-r8a7743" for the R8A7743 SoC.
+ - "renesas,etheravb-r8a7745" for the R8A7745 SoC.
- "renesas,etheravb-r8a7790" for the R8A7790 SoC.
- "renesas,etheravb-r8a7791" for the R8A7791 SoC.
- "renesas,etheravb-r8a7792" for the R8A7792 SoC.
--
1.9.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 related
* Re: [PATCH v11 0/5] Add new PCI_DEV_FLAGS_NO_RELAXED_ORDERING flag
From: Ding Tianhong @ 2017-08-15 14:45 UTC (permalink / raw)
To: Eric Dumazet, David Miller
Cc: mark.rutland, gabriele.paoloni, asit.k.mallick, catalin.marinas,
will.deacon, linuxarm, alexander.duyck, ashok.raj, helgaas,
jeffrey.t.kirsher, linux-pci, ganeshgr, Bob.Shaw, leedom,
patrick.j.cramer, bhelgaas, werner, linux-arm-kernel, amira,
netdev, linux-kernel, David.Laight, Suravee.Suthikulpanit,
robin.murphy, l.stach
In-Reply-To: <1502805794.4936.75.camel@edumazet-glaptop3.roam.corp.google.com>
On 2017/8/15 22:03, Eric Dumazet wrote:
> On Tue, 2017-08-15 at 06:58 -0700, Eric Dumazet wrote:
>> On Mon, 2017-08-14 at 22:15 -0700, David Miller wrote:
>>> From: Ding Tianhong <dingtianhong@huawei.com>
>>> Date: Tue, 15 Aug 2017 11:23:22 +0800
>>>
>>>> Some devices have problems with Transaction Layer Packets with the Relaxed
>>>> Ordering Attribute set. This patch set adds a new PCIe Device Flag,
>>>> PCI_DEV_FLAGS_NO_RELAXED_ORDERING, a set of PCI Quirks to catch some known
>>>> devices with Relaxed Ordering issues, and a use of this new flag by the
>>>> cxgb4 driver to avoid using Relaxed Ordering with problematic Root Complex
>>>> Ports.
>>> ...
>>>
>>> Series applied, thanks.
>>
>> I got a NULL deref in pci_find_pcie_root_port()
>>
>
> This was :
>
> [ 4.241029] BUG: unable to handle kernel NULL pointer dereference at 0000000000000050
> [ 4.247001] IP: pci_find_pcie_root_port+0x62/0x80
> [ 4.253011] PGD 0
> [ 4.253011] P4D 0
> [ 4.253011]
> [ 4.258013] Oops: 0000 [#1] SMP DEBUG_PAGEALLOC
> [ 4.262015] Modules linked in:
> [ 4.265005] CPU: 31 PID: 1 Comm: swapper/0 Not tainted 4.13.0-dbx-DEV #316
> [ 4.271002] Hardware name: Intel RML,PCH/Iota_QC_19, BIOS 2.40.0 06/22/2016
> [ 4.279002] task: ffffa2ee38cfa040 task.stack: ffffa51ec0004000
> [ 4.285001] RIP: 0010:pci_find_pcie_root_port+0x62/0x80
> [ 4.290012] RSP: 0000:ffffa51ec0007ab8 EFLAGS: 00010246
> [ 4.295003] RAX: 0000000000000000 RBX: ffffa2ee36bae000 RCX: 0000000000000006
> [ 4.303002] RDX: 000000000000081c RSI: ffffa2ee38cfa8c8 RDI: ffffa2ee36bae000
> [ 4.310013] RBP: ffffa51ec0007b58 R08: 0000000000000001 R09: 0000000000000000
> [ 4.317001] R10: 0000000000000000 R11: 0000000000000000 R12: ffffa51ec0007ad0
> [ 4.324005] R13: ffffa2ee36bae098 R14: 0000000000000002 R15: ffffa2ee37204818
> [ 4.331002] FS: 0000000000000000(0000) GS:ffffa2ee3fcc0000(0000) knlGS:0000000000000000
> [ 4.339002] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
> [ 4.345001] CR2: 0000000000000050 CR3: 000000401000f000 CR4: 00000000001406e0
> [ 4.351002] Call Trace:
> [ 4.354012] ? pci_configure_device+0x19f/0x570
> [ 4.359002] ? pci_conf1_read+0xb8/0xf0
> [ 4.363002] ? raw_pci_read+0x23/0x40
> [ 4.366011] ? pci_read+0x2c/0x30
> [ 4.370014] ? pci_read_config_word+0x67/0x70
> [ 4.374012] pci_device_add+0x28/0x230
> [ 4.378012] ? pci_vpd_f0_read+0x50/0x80
> [ 4.382014] pci_scan_single_device+0x96/0xc0
> [ 4.386012] pci_scan_slot+0x79/0xf0
> [ 4.389001] pci_scan_child_bus+0x31/0x180
> [ 4.394014] acpi_pci_root_create+0x1c6/0x240
> [ 4.398013] pci_acpi_scan_root+0x15f/0x1b0
> [ 4.402012] acpi_pci_root_add+0x2e6/0x400
> [ 4.406012] ? acpi_evaluate_integer+0x37/0x60
> [ 4.411002] acpi_bus_attach+0xdf/0x200
> [ 4.415002] acpi_bus_attach+0x6a/0x200
> [ 4.418014] acpi_bus_attach+0x6a/0x200
> [ 4.422013] acpi_bus_scan+0x38/0x70
> [ 4.426011] acpi_scan_init+0x10c/0x271
> [ 4.429001] acpi_init+0x2fa/0x348
> [ 4.433004] ? acpi_sleep_proc_init+0x2d/0x2d
> [ 4.437001] do_one_initcall+0x43/0x169
> [ 4.441001] kernel_init_freeable+0x1d0/0x258
> [ 4.445003] ? rest_init+0xe0/0xe0
> [ 4.449001] kernel_init+0xe/0x150
> [ 4.451002] ret_from_fork+0x27/0x40
> [ 4.457004] Code: 85 d2 74 27 80 7a 4a 00 74 21 48 89 d0 48 89 c2 f6 80 1b 09 00 00 10 74 07 48 8b 90 a0 0a 00 00 48 8b 52 10 48 83 7a 10 00 75 d0 <0f> b7 50 50 5d 81 e2 f0 00 00 00 83 fa 40 ba 00 00 00 00 48 0f
> [ 4.474012] RIP: pci_find_pcie_root_port+0x62/0x80 RSP: ffffa51ec0007ab8
> [ 4.481004] CR2: 0000000000000050
> [ 4.484001] ---[ end trace 6f9be6a057581199 ]---
> [ 4.488001] Kernel panic - not syncing: Fatal exception
> [ 4.494013] Rebooting in 10 seconds..
> [ 4.494013] ACPI MEMORY or I/O RESET_REG.
>
>>
>> This local hack seems to fix the issue.
>>
>> diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
>> index af0cc3456dc1b48b1325c06c5edd2ca8cc22a640..cfd8eb5a3d0ba8347d44952ffab28d9c761044d3 100644
>> --- a/drivers/pci/pci.c
>> +++ b/drivers/pci/pci.c
>> @@ -522,7 +522,7 @@ struct pci_dev *pci_find_pcie_root_port(struct pci_dev *dev)
>> bridge = pci_upstream_bridge(bridge);
>> }
>>
>> - if (pci_pcie_type(highest_pcie_bridge) != PCI_EXP_TYPE_ROOT_PORT)
>> + if (highest_pcie_bridge && pci_pcie_type(highest_pcie_bridge) != PCI_EXP_TYPE_ROOT_PORT)
>> return NULL;
>>
>> return highest_pcie_bridge;
>
It is very strange that I could not reproduce this problem on my server which is Xeon 2690v3,
but it is really a obviously issue when the dev could not find a upstream bridge in the
pci_find_pcie_root_port(), so the better way is just like your did in this patch. Thanks.
Regards
Tianhong
>
>
> .
>
^ permalink raw reply
* Re: [PATCH v2 net-next 1/3] ipv6: Prevent unexpected sk->sk_prot changes
From: Eric Dumazet @ 2017-08-15 14:45 UTC (permalink / raw)
To: Boris Pismenny
Cc: Ilya Lesokhin, netdev@vger.kernel.org, davem@davemloft.net,
davejwatson@fb.com, Aviad Yehezkel
In-Reply-To: <DB6PR05MB31768343CE15F47F8CC12CD8B08D0@DB6PR05MB3176.eurprd05.prod.outlook.com>
On Tue, 2017-08-15 at 13:08 +0000, Boris Pismenny wrote:
> Hi Eric,
>
> The IPV6_ADDRFORM socket option assumes that when
> (sk->sk_protocol == IPPROTO_TCP)
> then the sk_proto is set to tcpv6_prot and it replaces it with tcp_prot.
>
> This patch ensures that the IPV6_ADDRFORM socket option doesn't replace
> the socket's sk_prot to tcp when it is not expected. For example, TLS sockets
> also replace sk_prot, and we need to prevent IPV6_ADDRFORM from
> overriding these.
>
> Are you suggesting that each socket protocol will provide a method that
> converts it from IPv6 to IPv4?
I am just saying IPV6_ADDRFORM is becoming spaghetti code, and maybe
this is time to make it modular.
The UDP or TCP magic really should be implemented in TCP or UDP files.
(Who knows maybe one day SCTP or DCCP will support IPVADDRFORM)
^ permalink raw reply
* Re: [PATCH] net_sched/sfq: update hierarchical backlog when drop packet
From: Eric Dumazet @ 2017-08-15 14:50 UTC (permalink / raw)
To: Konstantin Khlebnikov
Cc: netdev, David S. Miller, Cong Wang, Jamal Hadi Salim
In-Reply-To: <9d01e66a-5855-ea9a-ff63-c029ceb46c98@yandex-team.ru>
On Tue, 2017-08-15 at 17:33 +0300, Konstantin Khlebnikov wrote:
> Nope. I'm not sure. But we have something similar in our 4.4 kernel
> for a while.
>
> Also fq_codel and pfifo_head_drop do something similar tho this.
>
> Probably this might crash without "[PATCH 1/2] net_sched: call
> qlen_notify only if child qdisc is empty".
> I hadn't tested them separately.
Thanks for the info. I've read this patch and it looks fine indeed :)
Acked-by: Eric Dumazet <edumazet@google.com>
^ permalink raw reply
* Re: general protection fault in fib_dump_info
From: Roopa Prabhu @ 2017-08-15 14:55 UTC (permalink / raw)
To: Florian Westphal
Cc: idaifish, davem@davemloft.net, Alexey Kuznetsov,
Hideaki YOSHIFUJI, netdev@vger.kernel.org, syzkaller
In-Reply-To: <20170815120528.GD16998@breakpoint.cc>
On Tue, Aug 15, 2017 at 5:05 AM, Florian Westphal <fw@strlen.de> wrote:
> idaifish <idaifish@gmail.com> wrote:
>> Syzkaller hit 'general protection fault in fib_dump_info' bug on
>> commit 4.13-rc5..
>
> CC Roopa
>
>> Guilty file: net/ipv4/fib_semantics.c
>>
>> kasan: GPF could be caused by NULL-ptr deref or user memory access
>> general protection fault: 0000 [#1] SMP KASAN
>> Modules linked in:
>> CPU: 0 PID: 2808 Comm: syz-executor0 Not tainted 4.13.0-rc5 #1
>> Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS
>> Ubuntu-1.8.2-1ubuntu1 04/01/2014
>> task: ffff880078562700 task.stack: ffff880078110000
>> RIP: 0010:fib_dump_info+0x388/0x1170 net/ipv4/fib_semantics.c:1314
>> RSP: 0018:ffff880078117010 EFLAGS: 00010206
>> RAX: dffffc0000000000 RBX: 00000000000000fe RCX: 0000000000000002
>> RDX: 0000000000000006 RSI: ffff880078117084 RDI: 0000000000000030
>> RBP: ffff880078117268 R08: 000000000000000c R09: ffff8800780d80c8
>> R10: 0000000058d629b4 R11: 0000000067fce681 R12: 0000000000000000
>> R13: ffff8800784bd540 R14: ffff8800780d80b5 R15: ffff8800780d80a4
>> FS: 00000000022fa940(0000) GS:ffff88007fc00000(0000) knlGS:0000000000000000
>> CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
>> CR2: 00000000004387d0 CR3: 0000000079135000 CR4: 00000000000006f0
>> Call Trace:
>> inet_rtm_getroute+0xc89/0x1f50 net/ipv4/route.c:2766
>> rtnetlink_rcv_msg+0x288/0x680 net/core/rtnetlink.c:4217
>
> Seems like this is from
> b61798130f1be5bff08712308126c2d7ebe390ef
>
> Roopa, it seems to assume res.fi != NULL, but afaics there
> is no guarantee, f.e. in ip_route_input_rcu() in the multicast
> branch res isn't changed at all.
yes, you are right. Just checked. Thanks for catching this and digging
into it further.
>
> If thats true, we might need this fix?
I think fib match should error out for this case.
still debating about the return error code... But the below should fix it.
diff --git a/net/ipv4/route.c b/net/ipv4/route.c
index 0383e66f..f21c760 100644
--- a/net/ipv4/route.c
+++ b/net/ipv4/route.c
@@ -2762,14 +2762,19 @@ static int inet_rtm_getroute(struct sk_buff
*in_skb, struct nlmsghdr *nlh,
if (rtm->rtm_flags & RTM_F_LOOKUP_TABLE)
table_id = rt->rt_table_id;
- if (rtm->rtm_flags & RTM_F_FIB_MATCH)
+ if (rtm->rtm_flags & RTM_F_FIB_MATCH) {
+ if (!res->fi) {
+ err = -EINVAL;
+ goto errout_free;
+ }
err = fib_dump_info(skb, NETLINK_CB(in_skb).portid,
nlh->nlmsg_seq, RTM_NEWROUTE, table_id,
rt->rt_type, res.prefix, res.prefixlen,
fl4.flowi4_tos, res.fi, 0);
- else
+ } else {
err = rt_fill_info(net, dst, src, table_id, &fl4, skb,
NETLINK_CB(in_skb).portid, nlh->nlmsg_seq);
+ }
if (err < 0)
goto errout_free;
^ permalink raw reply
* [PATCH net-next 00/12] s390/net: updates for 4.14
From: Julian Wiedmann @ 2017-08-15 15:02 UTC (permalink / raw)
To: David Miller
Cc: netdev, linux-s390, Martin Schwidefsky, Heiko Carstens,
Stefan Raspl, Ursula Braun, Julian Wiedmann
Hi Dave,
a mixed bag of minor fixes, cleanups and refactors for net-next. Please apply.
Thanks,
Julian
Julian Wiedmann (9):
s390/qeth: don't access skb after transmission
s390/qeth: remove extra L2 adapterparms query
s390/qeth: remove extra L3 adapterparms query
s390/qeth: simplify fragment type selection
s390/qeth: straighten out fill_buffer() interface
s390/qeth: clean up fill_buffer() offset logic
s390/qeth: make more use of skb API
s390/net: reduce inlining
s390/qeth: extract bridgeport cmd builder
Kittipon Meesompop (3):
s390/qeth: reject multicast rxip addresses
s390/qeth: fix trace-messages for deleting rxip addresses
s390/qeth: fix using of ref counter for rxip addresses
drivers/s390/net/ctcm_main.c | 2 +-
drivers/s390/net/lcs.c | 28 ++++----
drivers/s390/net/netiucv.c | 4 +-
drivers/s390/net/qeth_core.h | 11 ++-
drivers/s390/net/qeth_core_main.c | 147 ++++++++++++++++++--------------------
drivers/s390/net/qeth_core_sys.c | 2 +-
drivers/s390/net/qeth_l2_main.c | 116 +++++++++++-------------------
drivers/s390/net/qeth_l3_main.c | 49 +++++--------
drivers/s390/net/qeth_l3_sys.c | 17 +++++
9 files changed, 169 insertions(+), 207 deletions(-)
--
2.11.2
^ permalink raw reply
* [PATCH net-next 03/12] s390/qeth: remove extra L3 adapterparms query
From: Julian Wiedmann @ 2017-08-15 15:02 UTC (permalink / raw)
To: David Miller
Cc: netdev, linux-s390, Martin Schwidefsky, Heiko Carstens,
Stefan Raspl, Ursula Braun, Julian Wiedmann
In-Reply-To: <20170815150250.67158-1-jwi@linux.vnet.ibm.com>
qeth_l3_setadapter_parms() queries the device for supported
adapterparms, even though they already have been queried as part of the
device's high-level setup. Remove that extra call.
The only call chain for qeth_l3_setadapter_parms() is
__qeth_l3_set_online()
qeth_core_hardsetup_card()
qeth_query_setadapterparms()
qeth_l3_setadapter_parms()
qeth_query_setadapterparms()
, and we only reach qeth_l3_setadapter_parms() if the first
adapterparms query succeeds. Hence removing the second query results in
no loss of functionality.
Signed-off-by: Julian Wiedmann <jwi@linux.vnet.ibm.com>
Acked-by: Ursula Braun <ubraun@linux.vnet.ibm.com>
---
drivers/s390/net/qeth_l3_main.c | 14 +-------------
1 file changed, 1 insertion(+), 13 deletions(-)
diff --git a/drivers/s390/net/qeth_l3_main.c b/drivers/s390/net/qeth_l3_main.c
index 6648f02d61ea..13124e6fd9d3 100644
--- a/drivers/s390/net/qeth_l3_main.c
+++ b/drivers/s390/net/qeth_l3_main.c
@@ -890,22 +890,10 @@ static inline u8 qeth_l3_get_qeth_hdr_flags6(int cast_type)
static int qeth_l3_setadapter_parms(struct qeth_card *card)
{
- int rc;
+ int rc = 0;
QETH_DBF_TEXT(SETUP, 2, "setadprm");
- if (!qeth_is_supported(card, IPA_SETADAPTERPARMS)) {
- dev_info(&card->gdev->dev,
- "set adapter parameters not supported.\n");
- QETH_DBF_TEXT(SETUP, 2, " notsupp");
- return 0;
- }
- rc = qeth_query_setadapterparms(card);
- if (rc) {
- QETH_DBF_MESSAGE(2, "%s couldn't set adapter parameters: "
- "0x%x\n", dev_name(&card->gdev->dev), rc);
- return rc;
- }
if (qeth_adp_supported(card, IPA_SETADP_ALTER_MAC_ADDRESS)) {
rc = qeth_setadpparms_change_macaddr(card);
if (rc)
--
2.11.2
^ permalink raw reply related
* [PATCH net-next 01/12] s390/qeth: don't access skb after transmission
From: Julian Wiedmann @ 2017-08-15 15:02 UTC (permalink / raw)
To: David Miller
Cc: netdev, linux-s390, Martin Schwidefsky, Heiko Carstens,
Stefan Raspl, Ursula Braun, Julian Wiedmann
In-Reply-To: <20170815150250.67158-1-jwi@linux.vnet.ibm.com>
After transmitting a skb via send_packet[_fast](), the statistics
code accesses the skb once more to account for transmitted page frags.
This has a (theoretical?) race against the TX completion - if the TX
completion is processed and frees the skb before hard_start_xmit()
gets to the statistics part, we access random memory.
Fix this by caching the # of page frags, before the skb is transmitted.
Signed-off-by: Julian Wiedmann <jwi@linux.vnet.ibm.com>
Acked-by: Ursula Braun <ubraun@linux.vnet.ibm.com>
---
drivers/s390/net/qeth_l2_main.c | 14 ++++++--------
drivers/s390/net/qeth_l3_main.c | 4 ++--
2 files changed, 8 insertions(+), 10 deletions(-)
diff --git a/drivers/s390/net/qeth_l2_main.c b/drivers/s390/net/qeth_l2_main.c
index ad110abfdd47..28c9a7eda507 100644
--- a/drivers/s390/net/qeth_l2_main.c
+++ b/drivers/s390/net/qeth_l2_main.c
@@ -707,7 +707,7 @@ static netdev_tx_t qeth_l2_hard_start_xmit(struct sk_buff *skb,
int data_offset = -1;
int elements_needed = 0;
int hd_len = 0;
- int nr_frags;
+ unsigned int nr_frags;
if (card->qdio.do_prio_queueing || (cast_type &&
card->info.is_multicast_different))
@@ -747,6 +747,7 @@ static netdev_tx_t qeth_l2_hard_start_xmit(struct sk_buff *skb,
if (lin_rc)
goto tx_drop;
}
+ nr_frags = skb_shinfo(new_skb)->nr_frags;
if (card->info.type == QETH_CARD_TYPE_OSN)
hdr = (struct qeth_hdr *)skb->data;
@@ -799,13 +800,10 @@ static netdev_tx_t qeth_l2_hard_start_xmit(struct sk_buff *skb,
if (!rc) {
card->stats.tx_packets++;
card->stats.tx_bytes += tx_bytes;
- if (card->options.performance_stats) {
- nr_frags = skb_shinfo(new_skb)->nr_frags;
- if (nr_frags) {
- card->perf_stats.sg_skbs_sent++;
- /* nr_frags + skb->data */
- card->perf_stats.sg_frags_sent += nr_frags + 1;
- }
+ if (card->options.performance_stats && nr_frags) {
+ card->perf_stats.sg_skbs_sent++;
+ /* nr_frags + skb->data */
+ card->perf_stats.sg_frags_sent += nr_frags + 1;
}
if (new_skb != skb)
dev_kfree_skb_any(skb);
diff --git a/drivers/s390/net/qeth_l3_main.c b/drivers/s390/net/qeth_l3_main.c
index d42e758518ed..6648f02d61ea 100644
--- a/drivers/s390/net/qeth_l3_main.c
+++ b/drivers/s390/net/qeth_l3_main.c
@@ -2650,7 +2650,7 @@ static netdev_tx_t qeth_l3_hard_start_xmit(struct sk_buff *skb,
int tx_bytes = skb->len;
bool use_tso;
int data_offset = -1;
- int nr_frags;
+ unsigned int nr_frags;
if (((card->info.type == QETH_CARD_TYPE_IQD) &&
(((card->options.cq != QETH_CQ_ENABLED) && !ipv) ||
@@ -2727,6 +2727,7 @@ static netdev_tx_t qeth_l3_hard_start_xmit(struct sk_buff *skb,
if (lin_rc)
goto tx_drop;
}
+ nr_frags = skb_shinfo(new_skb)->nr_frags;
if (use_tso) {
hdr = skb_push(new_skb, sizeof(struct qeth_hdr_tso));
@@ -2786,7 +2787,6 @@ static netdev_tx_t qeth_l3_hard_start_xmit(struct sk_buff *skb,
if (new_skb != skb)
dev_kfree_skb_any(skb);
if (card->options.performance_stats) {
- nr_frags = skb_shinfo(new_skb)->nr_frags;
if (use_tso) {
card->perf_stats.large_send_bytes += tx_bytes;
card->perf_stats.large_send_cnt++;
--
2.11.2
^ permalink raw reply related
* [PATCH net-next 02/12] s390/qeth: remove extra L2 adapterparms query
From: Julian Wiedmann @ 2017-08-15 15:02 UTC (permalink / raw)
To: David Miller
Cc: netdev, linux-s390, Martin Schwidefsky, Heiko Carstens,
Stefan Raspl, Ursula Braun, Julian Wiedmann
In-Reply-To: <20170815150250.67158-1-jwi@linux.vnet.ibm.com>
qeth_l2_request_initial_mac() queries the device for its supported
adapterparms, even though they already have been queried as part of the
device's high-level setup. Remove that extra call.
The only call chain for qeth_l2_request_initial_mac() is
__qeth_l2_set_online()
qeth_core_hardsetup_card()
qeth_query_setadapterparms()
qeth_l2_setup_netdev()
qeth_l2_request_initial_mac()
qeth_query_setadapterparms()
, and we only reach qeth_l2_request_initial_mac() if the first
adapterparms query succeeds. Hence removing the second query results in
no loss of functionality.
Signed-off-by: Julian Wiedmann <jwi@linux.vnet.ibm.com>
Acked-by: Ursula Braun <ubraun@linux.vnet.ibm.com>
---
drivers/s390/net/qeth_l2_main.c | 9 ---------
1 file changed, 9 deletions(-)
diff --git a/drivers/s390/net/qeth_l2_main.c b/drivers/s390/net/qeth_l2_main.c
index 28c9a7eda507..a6ba897ed707 100644
--- a/drivers/s390/net/qeth_l2_main.c
+++ b/drivers/s390/net/qeth_l2_main.c
@@ -519,15 +519,6 @@ static int qeth_l2_request_initial_mac(struct qeth_card *card)
/* fall back to alternative mechanism: */
}
- if (qeth_is_supported(card, IPA_SETADAPTERPARMS)) {
- rc = qeth_query_setadapterparms(card);
- if (rc) {
- QETH_DBF_MESSAGE(2, "could not query adapter "
- "parameters on device %s: x%x\n",
- CARD_BUS_ID(card), rc);
- }
- }
-
if (card->info.type == QETH_CARD_TYPE_IQD ||
card->info.type == QETH_CARD_TYPE_OSM ||
card->info.type == QETH_CARD_TYPE_OSX ||
--
2.11.2
^ permalink raw reply related
* [PATCH net-next 04/12] s390/qeth: simplify fragment type selection
From: Julian Wiedmann @ 2017-08-15 15:02 UTC (permalink / raw)
To: David Miller
Cc: netdev, linux-s390, Martin Schwidefsky, Heiko Carstens,
Stefan Raspl, Ursula Braun, Julian Wiedmann
In-Reply-To: <20170815150250.67158-1-jwi@linux.vnet.ibm.com>
Improve readability of the code that determines a buffer element's
fragment type, and reduce the number of cases down from 5 to 3.
Signed-off-by: Julian Wiedmann <jwi@linux.vnet.ibm.com>
Acked-by: Ursula Braun <ubraun@linux.vnet.ibm.com>
---
drivers/s390/net/qeth_core_main.c | 23 ++++++++---------------
1 file changed, 8 insertions(+), 15 deletions(-)
diff --git a/drivers/s390/net/qeth_core_main.c b/drivers/s390/net/qeth_core_main.c
index 4792cabb862e..3623ba23ff0b 100644
--- a/drivers/s390/net/qeth_core_main.c
+++ b/drivers/s390/net/qeth_core_main.c
@@ -3918,23 +3918,16 @@ static inline void __qeth_fill_buffer(struct sk_buff *skb,
buffer->element[element].addr = data;
buffer->element[element].length = length_here;
length -= length_here;
- if (!length) {
- if (first_lap)
- if (skb_shinfo(skb)->nr_frags)
- buffer->element[element].eflags =
- SBAL_EFLAGS_FIRST_FRAG;
- else
- buffer->element[element].eflags = 0;
- else
- buffer->element[element].eflags =
- SBAL_EFLAGS_MIDDLE_FRAG;
- } else {
- if (first_lap)
+ if (first_lap) {
+ if (length || skb_is_nonlinear(skb))
+ /* skb needs additional elements */
buffer->element[element].eflags =
- SBAL_EFLAGS_FIRST_FRAG;
+ SBAL_EFLAGS_FIRST_FRAG;
else
- buffer->element[element].eflags =
- SBAL_EFLAGS_MIDDLE_FRAG;
+ buffer->element[element].eflags = 0;
+ } else {
+ buffer->element[element].eflags =
+ SBAL_EFLAGS_MIDDLE_FRAG;
}
data += length_here;
element++;
--
2.11.2
^ permalink raw reply related
* [PATCH net-next 05/12] s390/qeth: straighten out fill_buffer() interface
From: Julian Wiedmann @ 2017-08-15 15:02 UTC (permalink / raw)
To: David Miller
Cc: netdev, linux-s390, Martin Schwidefsky, Heiko Carstens,
Stefan Raspl, Ursula Braun, Julian Wiedmann
In-Reply-To: <20170815150250.67158-1-jwi@linux.vnet.ibm.com>
1. for adjusting the buffer's next_element_to_fill in __fill_buffer(),
just pass the full qeth_qdio_out_buffer struct
2. when adding a header element, be consistent about passing
a hint ('is_first_elem') to __fill_buffer()
No functional change.
Signed-off-by: Julian Wiedmann <jwi@linux.vnet.ibm.com>
Acked-by: Ursula Braun <ubraun@linux.vnet.ibm.com>
---
drivers/s390/net/qeth_core_main.c | 29 ++++++++++++++---------------
1 file changed, 14 insertions(+), 15 deletions(-)
diff --git a/drivers/s390/net/qeth_core_main.c b/drivers/s390/net/qeth_core_main.c
index 3623ba23ff0b..9796388780f9 100644
--- a/drivers/s390/net/qeth_core_main.c
+++ b/drivers/s390/net/qeth_core_main.c
@@ -3889,24 +3889,21 @@ int qeth_hdr_chk_and_bounce(struct sk_buff *skb, struct qeth_hdr **hdr, int len)
EXPORT_SYMBOL_GPL(qeth_hdr_chk_and_bounce);
static inline void __qeth_fill_buffer(struct sk_buff *skb,
- struct qdio_buffer *buffer, int is_tso, int *next_element_to_fill,
- int offset)
+ struct qeth_qdio_out_buffer *buf,
+ bool is_first_elem, int offset)
{
+ struct qdio_buffer *buffer = buf->buffer;
+ int element = buf->next_element_to_fill;
int length = skb_headlen(skb);
- int length_here;
- int element;
+ int length_here, cnt;
char *data;
- int first_lap, cnt;
struct skb_frag_struct *frag;
- element = *next_element_to_fill;
data = skb->data;
- first_lap = (is_tso == 0 ? 1 : 0);
if (offset >= 0) {
data = skb->data + offset;
length -= offset;
- first_lap = 0;
}
while (length > 0) {
@@ -3918,7 +3915,8 @@ static inline void __qeth_fill_buffer(struct sk_buff *skb,
buffer->element[element].addr = data;
buffer->element[element].length = length_here;
length -= length_here;
- if (first_lap) {
+ if (is_first_elem) {
+ is_first_elem = false;
if (length || skb_is_nonlinear(skb))
/* skb needs additional elements */
buffer->element[element].eflags =
@@ -3931,7 +3929,6 @@ static inline void __qeth_fill_buffer(struct sk_buff *skb,
}
data += length_here;
element++;
- first_lap = 0;
}
for (cnt = 0; cnt < skb_shinfo(skb)->nr_frags; cnt++) {
@@ -3957,7 +3954,7 @@ static inline void __qeth_fill_buffer(struct sk_buff *skb,
if (buffer->element[element - 1].eflags)
buffer->element[element - 1].eflags = SBAL_EFLAGS_LAST_FRAG;
- *next_element_to_fill = element;
+ buf->next_element_to_fill = element;
}
static inline int qeth_fill_buffer(struct qeth_qdio_out_q *queue,
@@ -3965,7 +3962,8 @@ static inline int qeth_fill_buffer(struct qeth_qdio_out_q *queue,
struct qeth_hdr *hdr, int offset, int hd_len)
{
struct qdio_buffer *buffer;
- int flush_cnt = 0, hdr_len, large_send = 0;
+ int flush_cnt = 0, hdr_len;
+ bool is_first_elem = true;
buffer = buf->buffer;
refcount_inc(&skb->users);
@@ -3974,6 +3972,7 @@ static inline int qeth_fill_buffer(struct qeth_qdio_out_q *queue,
/*check first on TSO ....*/
if (hdr->hdr.l3.id == QETH_HEADER_TYPE_TSO) {
int element = buf->next_element_to_fill;
+ is_first_elem = false;
hdr_len = sizeof(struct qeth_hdr_tso) +
((struct qeth_hdr_tso *)hdr)->ext.dg_hdr_len;
@@ -3984,11 +3983,12 @@ static inline int qeth_fill_buffer(struct qeth_qdio_out_q *queue,
buf->next_element_to_fill++;
skb->data += hdr_len;
skb->len -= hdr_len;
- large_send = 1;
}
if (offset >= 0) {
int element = buf->next_element_to_fill;
+ is_first_elem = false;
+
buffer->element[element].addr = hdr;
buffer->element[element].length = sizeof(struct qeth_hdr) +
hd_len;
@@ -3997,8 +3997,7 @@ static inline int qeth_fill_buffer(struct qeth_qdio_out_q *queue,
buf->next_element_to_fill++;
}
- __qeth_fill_buffer(skb, buffer, large_send,
- (int *)&buf->next_element_to_fill, offset);
+ __qeth_fill_buffer(skb, buf, is_first_elem, offset);
if (!queue->do_pack) {
QETH_CARD_TEXT(queue->card, 6, "fillbfnp");
--
2.11.2
^ permalink raw reply related
* [PATCH net-next 06/12] s390/qeth: clean up fill_buffer() offset logic
From: Julian Wiedmann @ 2017-08-15 15:02 UTC (permalink / raw)
To: David Miller
Cc: netdev, linux-s390, Martin Schwidefsky, Heiko Carstens,
Stefan Raspl, Ursula Braun, Julian Wiedmann
In-Reply-To: <20170815150250.67158-1-jwi@linux.vnet.ibm.com>
For some xmit paths we pass down a data offset to qeth_fill_buffer(),
to indicate that the first k bytes of the skb should be skipped when
mapping it into buffer elements.
Commit acd9776b5c45 ("s390/qeth: no ETH header for outbound AF_IUCV")
recently switched the offset for the IUCV-over-HiperSockets path
from 0 to ETH_HLEN, and now we have
device offset
OSA = 0
IQD > 0
for all xmit paths.
OSA would previously pass down -1 from do_send_packet(), to distinguish
between 1) OSA and 2) IQD with offset 0. That's no longer needed now,
so have it pass 0, make the offset unsigned and clean up how we apply
the offset in __qeth_fill_buffer().
No change of behaviour for any of our current xmit paths.
Signed-off-by: Julian Wiedmann <jwi@linux.vnet.ibm.com>
Acked-by: Ursula Braun <ubraun@linux.vnet.ibm.com>
---
drivers/s390/net/qeth_core.h | 6 ++++--
drivers/s390/net/qeth_core_main.c | 31 ++++++++++++++-----------------
2 files changed, 18 insertions(+), 19 deletions(-)
diff --git a/drivers/s390/net/qeth_core.h b/drivers/s390/net/qeth_core.h
index 7a0ffc71b25d..95266449a50a 100644
--- a/drivers/s390/net/qeth_core.h
+++ b/drivers/s390/net/qeth_core.h
@@ -951,8 +951,10 @@ int qeth_get_priority_queue(struct qeth_card *, struct sk_buff *, int, int);
int qeth_get_elements_no(struct qeth_card *card, struct sk_buff *skb,
int extra_elems, int data_offset);
int qeth_get_elements_for_frags(struct sk_buff *);
-int qeth_do_send_packet_fast(struct qeth_card *, struct qeth_qdio_out_q *,
- struct sk_buff *, struct qeth_hdr *, int, int);
+int qeth_do_send_packet_fast(struct qeth_card *card,
+ struct qeth_qdio_out_q *queue, struct sk_buff *skb,
+ struct qeth_hdr *hdr, unsigned int offset,
+ int hd_len);
int qeth_do_send_packet(struct qeth_card *, struct qeth_qdio_out_q *,
struct sk_buff *, struct qeth_hdr *, int);
int qeth_do_ioctl(struct net_device *dev, struct ifreq *rq, int cmd);
diff --git a/drivers/s390/net/qeth_core_main.c b/drivers/s390/net/qeth_core_main.c
index 9796388780f9..394bee93b891 100644
--- a/drivers/s390/net/qeth_core_main.c
+++ b/drivers/s390/net/qeth_core_main.c
@@ -3890,22 +3890,16 @@ EXPORT_SYMBOL_GPL(qeth_hdr_chk_and_bounce);
static inline void __qeth_fill_buffer(struct sk_buff *skb,
struct qeth_qdio_out_buffer *buf,
- bool is_first_elem, int offset)
+ bool is_first_elem, unsigned int offset)
{
struct qdio_buffer *buffer = buf->buffer;
int element = buf->next_element_to_fill;
- int length = skb_headlen(skb);
+ int length = skb_headlen(skb) - offset;
+ char *data = skb->data + offset;
int length_here, cnt;
- char *data;
struct skb_frag_struct *frag;
- data = skb->data;
-
- if (offset >= 0) {
- data = skb->data + offset;
- length -= offset;
- }
-
+ /* map linear part into buffer element(s) */
while (length > 0) {
/* length_here is the remaining amount of data in this page */
length_here = PAGE_SIZE - ((unsigned long) data % PAGE_SIZE);
@@ -3931,6 +3925,7 @@ static inline void __qeth_fill_buffer(struct sk_buff *skb,
element++;
}
+ /* map page frags into buffer element(s) */
for (cnt = 0; cnt < skb_shinfo(skb)->nr_frags; cnt++) {
frag = &skb_shinfo(skb)->frags[cnt];
data = (char *)page_to_phys(skb_frag_page(frag)) +
@@ -3958,8 +3953,9 @@ static inline void __qeth_fill_buffer(struct sk_buff *skb,
}
static inline int qeth_fill_buffer(struct qeth_qdio_out_q *queue,
- struct qeth_qdio_out_buffer *buf, struct sk_buff *skb,
- struct qeth_hdr *hdr, int offset, int hd_len)
+ struct qeth_qdio_out_buffer *buf,
+ struct sk_buff *skb, struct qeth_hdr *hdr,
+ unsigned int offset, int hd_len)
{
struct qdio_buffer *buffer;
int flush_cnt = 0, hdr_len;
@@ -3969,7 +3965,6 @@ static inline int qeth_fill_buffer(struct qeth_qdio_out_q *queue,
refcount_inc(&skb->users);
skb_queue_tail(&buf->skb_list, skb);
- /*check first on TSO ....*/
if (hdr->hdr.l3.id == QETH_HEADER_TYPE_TSO) {
int element = buf->next_element_to_fill;
is_first_elem = false;
@@ -3985,7 +3980,8 @@ static inline int qeth_fill_buffer(struct qeth_qdio_out_q *queue,
skb->len -= hdr_len;
}
- if (offset >= 0) {
+ /* IQD */
+ if (offset > 0) {
int element = buf->next_element_to_fill;
is_first_elem = false;
@@ -4022,8 +4018,9 @@ static inline int qeth_fill_buffer(struct qeth_qdio_out_q *queue,
}
int qeth_do_send_packet_fast(struct qeth_card *card,
- struct qeth_qdio_out_q *queue, struct sk_buff *skb,
- struct qeth_hdr *hdr, int offset, int hd_len)
+ struct qeth_qdio_out_q *queue, struct sk_buff *skb,
+ struct qeth_hdr *hdr, unsigned int offset,
+ int hd_len)
{
struct qeth_qdio_out_buffer *buffer;
int index;
@@ -4103,7 +4100,7 @@ int qeth_do_send_packet(struct qeth_card *card, struct qeth_qdio_out_q *queue,
}
}
}
- tmp = qeth_fill_buffer(queue, buffer, skb, hdr, -1, 0);
+ tmp = qeth_fill_buffer(queue, buffer, skb, hdr, 0, 0);
queue->next_buf_to_fill = (queue->next_buf_to_fill + tmp) %
QDIO_MAX_BUFFERS_PER_Q;
flush_count += tmp;
--
2.11.2
^ permalink raw reply related
* [PATCH net-next 07/12] s390/qeth: make more use of skb API
From: Julian Wiedmann @ 2017-08-15 15:02 UTC (permalink / raw)
To: David Miller
Cc: netdev, linux-s390, Martin Schwidefsky, Heiko Carstens,
Stefan Raspl, Ursula Braun, Julian Wiedmann
In-Reply-To: <20170815150250.67158-1-jwi@linux.vnet.ibm.com>
Replace some open-coded parts with their proper API calls.
Also remove two skb_[re]set_mac_header() calls in the L2
xmit paths that are clearly no longer required, since at least
commit 6d1ccff62780 ("net: reset mac header in dev_start_xmit()").
Signed-off-by: Julian Wiedmann <jwi@linux.vnet.ibm.com>
Acked-by: Ursula Braun <ubraun@linux.vnet.ibm.com>
---
drivers/s390/net/qeth_core.h | 5 -----
drivers/s390/net/qeth_core_main.c | 12 +++++-------
drivers/s390/net/qeth_l2_main.c | 7 +++----
drivers/s390/net/qeth_l3_main.c | 4 ++--
4 files changed, 10 insertions(+), 18 deletions(-)
diff --git a/drivers/s390/net/qeth_core.h b/drivers/s390/net/qeth_core.h
index 95266449a50a..4a4ca5cb37a0 100644
--- a/drivers/s390/net/qeth_core.h
+++ b/drivers/s390/net/qeth_core.h
@@ -857,11 +857,6 @@ static inline int qeth_get_ip_version(struct sk_buff *skb)
}
}
-static inline int qeth_get_ip_protocol(struct sk_buff *skb)
-{
- return ip_hdr(skb)->protocol;
-}
-
static inline void qeth_put_buffer_pool_entry(struct qeth_card *card,
struct qeth_buffer_pool_entry *entry)
{
diff --git a/drivers/s390/net/qeth_core_main.c b/drivers/s390/net/qeth_core_main.c
index 394bee93b891..6286a8e35924 100644
--- a/drivers/s390/net/qeth_core_main.c
+++ b/drivers/s390/net/qeth_core_main.c
@@ -3897,7 +3897,6 @@ static inline void __qeth_fill_buffer(struct sk_buff *skb,
int length = skb_headlen(skb) - offset;
char *data = skb->data + offset;
int length_here, cnt;
- struct skb_frag_struct *frag;
/* map linear part into buffer element(s) */
while (length > 0) {
@@ -3927,10 +3926,10 @@ static inline void __qeth_fill_buffer(struct sk_buff *skb,
/* map page frags into buffer element(s) */
for (cnt = 0; cnt < skb_shinfo(skb)->nr_frags; cnt++) {
- frag = &skb_shinfo(skb)->frags[cnt];
- data = (char *)page_to_phys(skb_frag_page(frag)) +
- frag->page_offset;
- length = frag->size;
+ skb_frag_t *frag = &skb_shinfo(skb)->frags[cnt];
+
+ data = skb_frag_address(frag);
+ length = skb_frag_size(frag);
while (length > 0) {
length_here = PAGE_SIZE -
((unsigned long) data % PAGE_SIZE);
@@ -3976,8 +3975,7 @@ static inline int qeth_fill_buffer(struct qeth_qdio_out_q *queue,
buffer->element[element].length = hdr_len;
buffer->element[element].eflags = SBAL_EFLAGS_FIRST_FRAG;
buf->next_element_to_fill++;
- skb->data += hdr_len;
- skb->len -= hdr_len;
+ skb_pull(skb, hdr_len);
}
/* IQD */
diff --git a/drivers/s390/net/qeth_l2_main.c b/drivers/s390/net/qeth_l2_main.c
index a6ba897ed707..9c789ad6831a 100644
--- a/drivers/s390/net/qeth_l2_main.c
+++ b/drivers/s390/net/qeth_l2_main.c
@@ -752,11 +752,11 @@ static netdev_tx_t qeth_l2_hard_start_xmit(struct sk_buff *skb,
if (!hdr)
goto tx_drop;
elements_needed++;
- skb_reset_mac_header(new_skb);
qeth_l2_fill_header(card, hdr, new_skb, cast_type);
hdr->hdr.l2.pkt_length = new_skb->len;
- memcpy(((char *)hdr) + sizeof(struct qeth_hdr),
- skb_mac_header(new_skb), ETH_HLEN);
+ skb_copy_from_linear_data(new_skb,
+ ((char *)hdr) + sizeof(*hdr),
+ ETH_HLEN);
} else {
/* create a clone with writeable headroom */
new_skb = skb_realloc_headroom(skb,
@@ -764,7 +764,6 @@ static netdev_tx_t qeth_l2_hard_start_xmit(struct sk_buff *skb,
if (!new_skb)
goto tx_drop;
hdr = skb_push(new_skb, sizeof(struct qeth_hdr));
- skb_set_mac_header(new_skb, sizeof(struct qeth_hdr));
qeth_l2_fill_header(card, hdr, new_skb, cast_type);
if (new_skb->ip_summed == CHECKSUM_PARTIAL)
qeth_l2_hdr_csum(card, hdr, new_skb);
diff --git a/drivers/s390/net/qeth_l3_main.c b/drivers/s390/net/qeth_l3_main.c
index 13124e6fd9d3..97ca8a6cbb21 100644
--- a/drivers/s390/net/qeth_l3_main.c
+++ b/drivers/s390/net/qeth_l3_main.c
@@ -2570,7 +2570,7 @@ static void qeth_tso_fill_header(struct qeth_card *card,
hdr->ext.hdr_len = 28;
/*insert non-fix values */
hdr->ext.mss = skb_shinfo(skb)->gso_size;
- hdr->ext.dg_hdr_len = (__u16)(iph->ihl*4 + tcph->doff*4);
+ hdr->ext.dg_hdr_len = (__u16)(ip_hdrlen(skb) + tcp_hdrlen(skb));
hdr->ext.payload_len = (__u16)(skb->len - hdr->ext.dg_hdr_len -
sizeof(struct qeth_hdr_tso));
tcph->check = 0;
@@ -2663,7 +2663,7 @@ static netdev_tx_t qeth_l3_hard_start_xmit(struct sk_buff *skb,
/* Ignore segment size from skb_is_gso(), 1 page is always used. */
use_tso = skb_is_gso(skb) &&
- (qeth_get_ip_protocol(skb) == IPPROTO_TCP) && (ipv == 4);
+ (skb_shinfo(skb)->gso_type & SKB_GSO_TCPV4);
if (card->info.type == QETH_CARD_TYPE_IQD) {
new_skb = skb;
--
2.11.2
^ permalink raw reply related
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox