* Re: [PATCH v2 2/4] net: ethoc: don't advertise gigabit speed on attached PHY
From: Max Filippov @ 2014-01-29 18:32 UTC (permalink / raw)
To: Florian Fainelli
Cc: Marc Gauthier, Ben Hutchings, LKML, David S. Miller, Chris Zankel,
linux-xtensa@linux-xtensa.org, netdev
In-Reply-To: <CAGVrzcboHp8-qHZseGOVm14u1-cTcOjRZGExFxNu_nbK__XCSA@mail.gmail.com>
On Wed, Jan 29, 2014 at 9:12 PM, Florian Fainelli <f.fainelli@gmail.com> wrote:
> On Jan 28, 2014 11:01 PM, "Max Filippov" <jcmvbkbc@gmail.com> wrote:
>>
>> On Wed, Jan 29, 2014 at 10:47 AM, Florian Fainelli <f.fainelli@gmail.com>
>> wrote:
>> > Hi Max,
>> >
>> > Le 28/01/2014 22:00, Max Filippov a écrit :
>> >
>> >> OpenCores 10/100 Mbps MAC does not support speeds above 100 Mbps, but
>> >> does
>> >> not disable advertisement when PHY supports them. This results in
>> >> non-functioning network when the MAC is connected to a gigabit PHY
>> >> connected
>> >> to a gigabit switch.
>> >>
>> >> The fix is to disable gigabit speed advertisement on attached PHY
>> >> unconditionally.
>> >>
>> >> Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
>> >> ---
>> >> Changes v1->v2:
>> >> - disable both gigabit advertisement and support.
>> >>
>> >> drivers/net/ethernet/ethoc.c | 8 ++++++++
>> >> 1 file changed, 8 insertions(+)
>> >>
>> >> diff --git a/drivers/net/ethernet/ethoc.c
>> >> b/drivers/net/ethernet/ethoc.c
>> >> index 4de8cfd..5643b2d 100644
>> >> --- a/drivers/net/ethernet/ethoc.c
>> >> +++ b/drivers/net/ethernet/ethoc.c
>> >> @@ -688,6 +688,14 @@ static int ethoc_mdio_probe(struct net_device
>> >> *dev)
>> >> }
>> >>
>> >> priv->phy = phy;
>> >> + phy_update_advert(phy,
>> >> + ADVERTISED_1000baseT_Full |
>> >> + ADVERTISED_1000baseT_Half, 0);
>> >> + phy_start_aneg(phy);
>> >
>> >
>> > This does not look necessary, you should not have to call
>> > phy_start_aneg()
>> > because the PHY state machine is not yet started, at best this calls
>> > does
>> > nothing.
>>
>> This call actually makes the whole thing work, because otherwise once
>> gigabit
>> support is cleared from the supported mask genphy_config_advert does not
>> update gigabit advertisement register, leaving it enabled.
>
> OK, then we need to figure out what is wrong with ethoc since this is
> unusual.
Maybe they boot up with gigabit advertisement disabled in their PHY
and thus they don't see the problem?
> Other drivers do the following:
>
> - connect to the PHY
> - phydev->supported = PHY_BASIC_FEATURES
> - phydev->advertising &= phydev->supported
> - start the PHY state machine
>
> And they work just fine. Is the PHY driver you are bound to the "Generic
> PHY" or something else which does something funky in config_aneg()?
It's marvell 88E1111 from the KC-705 board, but the behaviour doesn't
change if I disable it and the generic phy is used.
--
Thanks.
-- Max
^ permalink raw reply
* Re: [PATCH] netfilter: nf_conntrack: fix RCU race in nf_conntrack_find_get (v3)
From: Pablo Neira Ayuso @ 2014-01-29 19:21 UTC (permalink / raw)
To: Eric Dumazet
Cc: Andrey Vagin, netfilter-devel, netfilter, coreteam, netdev,
linux-kernel, vvs, Florian Westphal, Patrick McHardy,
Jozsef Kadlecsik, David S. Miller, Cyrill Gorcunov
In-Reply-To: <1389558074.31367.187.camel@edumazet-glaptop2.roam.corp.google.com>
On Sun, Jan 12, 2014 at 12:21:14PM -0800, Eric Dumazet wrote:
> On Sun, 2014-01-12 at 21:50 +0400, Andrey Vagin wrote:
> > Lets look at destroy_conntrack:
> >
> > hlist_nulls_del_rcu(&ct->tuplehash[IP_CT_DIR_ORIGINAL].hnnode);
> > ...
> > nf_conntrack_free(ct)
> > kmem_cache_free(net->ct.nf_conntrack_cachep, ct);
> >
> > net->ct.nf_conntrack_cachep is created with SLAB_DESTROY_BY_RCU.
> >
> > The hash is protected by rcu, so readers look up conntracks without
> > locks.
> > A conntrack is removed from the hash, but in this moment a few readers
> > still can use the conntrack. Then this conntrack is released and another
> > thread creates conntrack with the same address and the equal tuple.
> > After this a reader starts to validate the conntrack:
> > * It's not dying, because a new conntrack was created
> > * nf_ct_tuple_equal() returns true.
> ...
>
>
> > v2: move nf_ct_is_confirmed into the unlikely() annotation
> > v3: Eric suggested to fix refcnt, so that it becomes zero before adding
> > in a hash, but we can't find a way how to do that. Another way is to
> > interpret the confirm bit as part of a search key and check it in
> > ____nf_conntrack_find() too.
> >
> > Cc: Eric Dumazet <eric.dumazet@gmail.com>
> > Cc: Florian Westphal <fw@strlen.de>
> > Cc: Pablo Neira Ayuso <pablo@netfilter.org>
> > Cc: Patrick McHardy <kaber@trash.net>
> > Cc: Jozsef Kadlecsik <kadlec@blackhole.kfki.hu>
> > Cc: "David S. Miller" <davem@davemloft.net>
> > Cc: Cyrill Gorcunov <gorcunov@openvz.org>
> > Signed-off-by: Andrey Vagin <avagin@openvz.org>
> > ---
>
> Acked-by: Eric Dumazet <edumazet@google.com>
Applied, thanks everyone!
^ permalink raw reply
* Re: [PATCH stable 3.11+] can: use private sk reference to detect originating socket
From: Oliver Hartkopp @ 2014-01-29 19:30 UTC (permalink / raw)
To: Eric Dumazet
Cc: David Miller, Linux Netdev List, Andre Naujoks,
linux-can@vger.kernel.org
In-Reply-To: <1391010437.28432.39.camel@edumazet-glaptop2.roam.corp.google.com>
On 29.01.2014 16:47, Eric Dumazet wrote:
> On Wed, 2014-01-29 at 07:30 -0800, Eric Dumazet wrote:
>> On Wed, 2014-01-29 at 07:02 -0800, Eric Dumazet wrote:
>>
>>> Thats how every protocol does this, with variants.
>>>
>>> Check l2tp_sock_wfree()/l2tp_skb_set_owner_w() for an example
>>
>> Also keep in mind this patch is needed for all kernels, not only 3.11+
>>
>> So better keep it as simple as possible, to ease backports.
>
> Please try the following patch.
>
Hello Eric,
there were at least two problems with your patch:
1. Only the stuff in net/can was addressed (missing drivers/net/can)
2. The check for sk and the additional skb_orphan() is not needed as the
can_skb_set_owner() is invoked only after 'fresh' skb allocation or after
clone/skb_orphan() - so we know the skb state very good.
I moved your suggested inline functions to include/linux/can/skb.h where
all users (net/can and drivers) can access them.
So what has been done:
- can_skb_set_owner() is invoked on new created skbuffs (tx path)
- can_skb_set_owner() is invoked on orphaned/cloned skbs (echo in drvs)
I did some tests with real CAN hardware and everything seems fine.
Please take a look if it looks correct to you.
If so I'll send a proper patch for it.
Regards,
Oliver
diff --git a/drivers/net/can/dev.c b/drivers/net/can/dev.c
index 13a9098..17a0a00 100644
--- a/drivers/net/can/dev.c
+++ b/drivers/net/can/dev.c
@@ -325,17 +325,20 @@ void can_put_echo_skb(struct sk_buff *skb, struct net_device *dev,
if (!priv->echo_skb[idx]) {
struct sock *srcsk = skb->sk;
- if (atomic_read(&skb->users) != 1) {
- struct sk_buff *old_skb = skb;
+ if (skb_shared(skb)) {
+ struct sk_buff *nskb = skb_clone(skb, GFP_ATOMIC);
- skb = skb_clone(old_skb, GFP_ATOMIC);
- kfree_skb(old_skb);
- if (!skb)
+ if (likely(nskb))
+ consume_skb(skb);
+ else {
+ kfree_skb(skb);
return;
+ }
+ skb = nskb;
} else
skb_orphan(skb);
- skb->sk = srcsk;
+ can_skb_set_owner(skb, srcsk);
/* make settings for echo to reduce code in irq context */
skb->protocol = htons(ETH_P_CAN);
diff --git a/drivers/net/can/janz-ican3.c b/drivers/net/can/janz-ican3.c
index e24e669..ee48cb1 100644
--- a/drivers/net/can/janz-ican3.c
+++ b/drivers/net/can/janz-ican3.c
@@ -18,6 +18,7 @@
#include <linux/netdevice.h>
#include <linux/can.h>
#include <linux/can/dev.h>
+#include <linux/can/skb.h>
#include <linux/can/error.h>
#include <linux/mfd/janz.h>
@@ -1135,18 +1136,20 @@ static void ican3_put_echo_skb(struct ican3_dev *mod, struct sk_buff *skb)
{
struct sock *srcsk = skb->sk;
- if (atomic_read(&skb->users) != 1) {
- struct sk_buff *old_skb = skb;
+ if (skb_shared(skb)) {
+ struct sk_buff *nskb = skb_clone(skb, GFP_ATOMIC);
- skb = skb_clone(old_skb, GFP_ATOMIC);
- kfree_skb(old_skb);
- if (!skb)
+ if (likely(nskb))
+ consume_skb(skb);
+ else {
+ kfree_skb(skb);
return;
- } else {
+ }
+ skb = nskb;
+ } else
skb_orphan(skb);
- }
- skb->sk = srcsk;
+ can_skb_set_owner(skb, srcsk);
/* save this skb for tx interrupt echo handling */
skb_queue_tail(&mod->echoq, skb);
diff --git a/drivers/net/can/vcan.c b/drivers/net/can/vcan.c
index 0a2a5ee..f764f00 100644
--- a/drivers/net/can/vcan.c
+++ b/drivers/net/can/vcan.c
@@ -46,6 +46,7 @@
#include <linux/if_ether.h>
#include <linux/can.h>
#include <linux/can/dev.h>
+#include <linux/can/skb.h>
#include <linux/slab.h>
#include <net/rtnetlink.h>
@@ -118,12 +119,22 @@ static netdev_tx_t vcan_tx(struct sk_buff *skb, struct net_device *dev)
if (loop) {
struct sock *srcsk = skb->sk;
- skb = skb_share_check(skb, GFP_ATOMIC);
- if (!skb)
- return NETDEV_TX_OK;
+ if (skb_shared(skb)) {
+ struct sk_buff *nskb = skb_clone(skb, GFP_ATOMIC);
+
+ if (likely(nskb))
+ consume_skb(skb);
+ else {
+ kfree_skb(skb);
+ return NETDEV_TX_OK;
+ }
+ skb = nskb;
+ } else
+ skb_orphan(skb);
+
+ can_skb_set_owner(skb, srcsk);
/* receive with packet counting */
- skb->sk = srcsk;
vcan_rx(skb, dev);
} else {
/* no looped packets => no counting */
diff --git a/include/linux/can/skb.h b/include/linux/can/skb.h
index 2f0543f..0429d36 100644
--- a/include/linux/can/skb.h
+++ b/include/linux/can/skb.h
@@ -11,7 +11,9 @@
#define CAN_SKB_H
#include <linux/types.h>
+#include <linux/skbuff.h>
#include <linux/can.h>
+#include <net/sock.h>
/*
* The struct can_skb_priv is used to transport additional information along
@@ -42,4 +44,16 @@ static inline void can_skb_reserve(struct sk_buff *skb)
skb_reserve(skb, sizeof(struct can_skb_priv));
}
+static inline void can_skb_destructor(struct sk_buff *skb)
+{
+ sock_put(skb->sk);
+}
+
+static inline void can_skb_set_owner(struct sk_buff *skb, struct sock *sk)
+{
+ sock_hold(sk);
+ skb->destructor = can_skb_destructor;
+ skb->sk = sk;
+}
+
#endif /* CAN_SKB_H */
diff --git a/net/can/af_can.c b/net/can/af_can.c
index d249874..7e4101b 100644
--- a/net/can/af_can.c
+++ b/net/can/af_can.c
@@ -290,7 +290,7 @@ int can_send(struct sk_buff *skb, int loop)
return -ENOMEM;
}
- newskb->sk = skb->sk;
+ can_skb_set_owner(newskb, skb->sk);
newskb->ip_summed = CHECKSUM_UNNECESSARY;
newskb->pkt_type = PACKET_BROADCAST;
}
diff --git a/net/can/bcm.c b/net/can/bcm.c
index 3fc737b..dcb75c0 100644
--- a/net/can/bcm.c
+++ b/net/can/bcm.c
@@ -268,7 +268,7 @@ static void bcm_can_tx(struct bcm_op *op)
/* send with loopback */
skb->dev = dev;
- skb->sk = op->sk;
+ can_skb_set_owner(skb, op->sk);
can_send(skb, 1);
/* update statistics */
@@ -1223,7 +1223,7 @@ static int bcm_tx_send(struct msghdr *msg, int ifindex, struct sock *sk)
can_skb_prv(skb)->ifindex = dev->ifindex;
skb->dev = dev;
- skb->sk = sk;
+ can_skb_set_owner(skb, sk);
err = can_send(skb, 1); /* send with loopback */
dev_put(dev);
^ permalink raw reply related
* Re: [PATCH] iproute: Fix Netid value for multi-families output
From: François-Xavier Le Bail @ 2014-01-29 19:29 UTC (permalink / raw)
To: Stephen Hemminger, Linux Netdev List, Pavel Emelyanov
In-Reply-To: <52E74D0F.4050806@parallels.com>
On Tue, 1/28/14, Pavel Emelyanov <xemul@parallels.com> wrote:
> When requesting simultaneous output of TCP and UDP sockets
> the netid field shows "tcp" always.
[...]
> Reported-by: François-Xavier Le Bail <fx.lebail@yahoo.com>
> Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
> ---
Tested-by: François-Xavier Le Bail <fx.lebail@yahoo.com>
^ permalink raw reply
* Re: [PATCH] iproute: Properly handle protocol level diag module absence
From: François-Xavier Le Bail @ 2014-01-29 19:39 UTC (permalink / raw)
To: Stephen Hemminger, Linux Netdev List, Pavel Emelyanov
In-Reply-To: <52E7E990.7050501@parallels.com>
On Tue, 1/28/14, Pavel Emelyanov <xemul@parallels.com> wrote:
> When *_diag module is missing in the kernel, the ss tool should go
> ad read legacry /proc/* files.
> This is the case when all *_diag stuff is missing, but in case the
> inet_diag.ko is loaded, but (tcp|udp)_diag.ko is not, the ss tool
> doesn't notice this and produces empty output. The reason for that
> is -- error from the inet_diag module (which means, that e.g. the
> udp_diag is missing) is reported in the NLMSG_DONE message body.
> That said, we need to check the NLMSG_DONE's message return code
> and act respectively.
> Reported-by: François-Xavier Le Bail <fx.lebail@yahoo.com>
> Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
> ---
Tested-by: François-Xavier Le Bail <fx.lebail@yahoo.com>
^ permalink raw reply
* Fwd: RFC 7112 on Implications of Oversized IPv6 Header Chains
From: Fernando Gont @ 2014-01-29 19:25 UTC (permalink / raw)
To: netdev
In-Reply-To: <20140129173044.D475C7FC17B@rfc-editor.org>
Folks,
FYI. This one has important implications -- it allows stateless
filtering in IPv6 (otherwise not really possible)
-------- Original Message --------
Subject: RFC 7112 on Implications of Oversized IPv6 Header Chains
Date: Wed, 29 Jan 2014 09:30:44 -0800 (PST)
From: rfc-editor@rfc-editor.org
To: ietf-announce@ietf.org, rfc-dist@rfc-editor.org
CC: drafts-update-ref@iana.org, ipv6@ietf.org, rfc-editor@rfc-editor.org
A new Request for Comments is now available in online RFC libraries.
RFC 7112
Title: Implications of Oversized IPv6 Header
Chains
Author: F. Gont, V. Manral,
R. Bonica
Status: Standards Track
Stream: IETF
Date: January 2014
Mailbox: fgont@si6networks.com,
vishwas@ionosnetworks.com,
rbonica@juniper.net
Pages: 8
Characters: 15897
Updates: RFC 2460
I-D Tag: draft-ietf-6man-oversized-header-chain-09.txt
URL: http://www.rfc-editor.org/rfc/rfc7112.txt
The IPv6 specification allows IPv6 Header Chains of an arbitrary
size. The specification also allows options that can, in turn,
extend each of the headers. In those scenarios in which the IPv6
Header Chain or options are unusually long and packets are
fragmented, or scenarios in which the fragment size is very small,
the First Fragment of a packet may fail to include the entire IPv6
Header Chain. This document discusses the interoperability and
security problems of such traffic, and updates RFC 2460 such that the
First Fragment of a packet is required to contain the entire IPv6
Header Chain.
This document is a product of the IPv6 Maintenance Working Group of the
IETF.
This is now a Proposed Standard.
STANDARDS TRACK: This document specifies an Internet standards track
protocol for the Internet community,and requests discussion and suggestions
for improvements. Please refer to the current edition of the Internet
Official Protocol Standards (STD 1) for the standardization state and
status of this protocol. Distribution of this memo is unlimited.
This announcement is sent to the IETF-Announce and rfc-dist lists.
To subscribe or unsubscribe, see
http://www.ietf.org/mailman/listinfo/ietf-announce
http://mailman.rfc-editor.org/mailman/listinfo/rfc-dist
For searching the RFC series, see
http://www.rfc-editor.org/search/rfc_search.php
For downloading RFCs, see http://www.rfc-editor.org/rfc.html
Requests for special distribution should be addressed to either the
author of the RFC in question, or to rfc-editor@rfc-editor.org. Unless
specifically noted otherwise on the RFC itself, all RFCs are for
unlimited distribution.
The RFC Editor Team
Association Management Solutions, LLC
--------------------------------------------------------------------
IETF IPv6 working group mailing list
ipv6@ietf.org
Administrative Requests: https://www.ietf.org/mailman/listinfo/ipv6
--------------------------------------------------------------------
--
Fernando Gont
e-mail: fernando@gont.com.ar || fgont@si6networks.com
PGP Fingerprint: 7809 84F5 322E 45C7 F1C9 3945 96EE A9EF D076 FFF1
^ permalink raw reply
* Re: [PATCH stable 3.11+] can: use private sk reference to detect originating socket
From: Eric Dumazet @ 2014-01-29 19:55 UTC (permalink / raw)
To: Oliver Hartkopp
Cc: David Miller, Linux Netdev List, Andre Naujoks,
linux-can@vger.kernel.org
In-Reply-To: <52E956E6.7090002@hartkopp.net>
On Wed, 2014-01-29 at 20:30 +0100, Oliver Hartkopp wrote:
>
> On 29.01.2014 16:47, Eric Dumazet wrote:
> > On Wed, 2014-01-29 at 07:30 -0800, Eric Dumazet wrote:
> >> On Wed, 2014-01-29 at 07:02 -0800, Eric Dumazet wrote:
> >>
> >>> Thats how every protocol does this, with variants.
> >>>
> >>> Check l2tp_sock_wfree()/l2tp_skb_set_owner_w() for an example
> >>
> >> Also keep in mind this patch is needed for all kernels, not only 3.11+
> >>
> >> So better keep it as simple as possible, to ease backports.
> >
> > Please try the following patch.
> >
>
> Hello Eric,
>
> there were at least two problems with your patch:
>
> 1. Only the stuff in net/can was addressed (missing drivers/net/can)
>
> 2. The check for sk and the additional skb_orphan() is not needed as the
> can_skb_set_owner() is invoked only after 'fresh' skb allocation or after
> clone/skb_orphan() - so we know the skb state very good.
Yep, but then you added skb_orphan() calls. when skb is not shared.
>
> I moved your suggested inline functions to include/linux/can/skb.h where
> all users (net/can and drivers) can access them.
>
> So what has been done:
>
> - can_skb_set_owner() is invoked on new created skbuffs (tx path)
> - can_skb_set_owner() is invoked on orphaned/cloned skbs (echo in drvs)
>
> I did some tests with real CAN hardware and everything seems fine.
>
> Please take a look if it looks correct to you.
>
> If so I'll send a proper patch for it.
>
> Regards,
> Oliver
>
> diff --git a/drivers/net/can/dev.c b/drivers/net/can/dev.c
> index 13a9098..17a0a00 100644
> --- a/drivers/net/can/dev.c
> +++ b/drivers/net/can/dev.c
> @@ -325,17 +325,20 @@ void can_put_echo_skb(struct sk_buff *skb, struct net_device *dev,
> if (!priv->echo_skb[idx]) {
> struct sock *srcsk = skb->sk;
>
This is still buggy.
You should not consume_skb() before having
a ref count on skb->sk.
> - if (atomic_read(&skb->users) != 1) {
> - struct sk_buff *old_skb = skb;
> + if (skb_shared(skb)) {
> + struct sk_buff *nskb = skb_clone(skb, GFP_ATOMIC);
>
> - skb = skb_clone(old_skb, GFP_ATOMIC);
> - kfree_skb(old_skb);
> - if (!skb)
> + if (likely(nskb))
> + consume_skb(skb);
> + else {
> + kfree_skb(skb);
> return;
> + }
> + skb = nskb;
> } else
> skb_orphan(skb);
>
> - skb->sk = srcsk;
> + can_skb_set_owner(skb, srcsk);
Only after this point you can do the :
consume_skb(original_skb);
>
> /* make settings for echo to reduce code in irq context */
> skb->protocol = htons(ETH_P_CAN);
> diff --git a/drivers/net/can/janz-ican3.c b/drivers/net/can/janz-ican3.c
> index e24e669..ee48cb1 100644
> --- a/drivers/net/can/janz-ican3.c
> +++ b/drivers/net/can/janz-ican3.c
> @@ -18,6 +18,7 @@
> #include <linux/netdevice.h>
> #include <linux/can.h>
> #include <linux/can/dev.h>
> +#include <linux/can/skb.h>
> #include <linux/can/error.h>
>
> #include <linux/mfd/janz.h>
> @@ -1135,18 +1136,20 @@ static void ican3_put_echo_skb(struct ican3_dev *mod, struct sk_buff *skb)
> {
> struct sock *srcsk = skb->sk;
>
Same problem here.
> - if (atomic_read(&skb->users) != 1) {
> - struct sk_buff *old_skb = skb;
> + if (skb_shared(skb)) {
> + struct sk_buff *nskb = skb_clone(skb, GFP_ATOMIC);
>
> - skb = skb_clone(old_skb, GFP_ATOMIC);
> - kfree_skb(old_skb);
> - if (!skb)
> + if (likely(nskb))
> + consume_skb(skb);
> + else {
> + kfree_skb(skb);
> return;
> - } else {
> + }
> + skb = nskb;
> + } else
> skb_orphan(skb);
> - }
>
> - skb->sk = srcsk;
> + can_skb_set_owner(skb, srcsk);
>
> /* save this skb for tx interrupt echo handling */
> skb_queue_tail(&mod->echoq, skb);
> diff --git a/drivers/net/can/vcan.c b/drivers/net/can/vcan.c
> index 0a2a5ee..f764f00 100644
> --- a/drivers/net/can/vcan.c
> +++ b/drivers/net/can/vcan.c
> @@ -46,6 +46,7 @@
> #include <linux/if_ether.h>
> #include <linux/can.h>
> #include <linux/can/dev.h>
> +#include <linux/can/skb.h>
> #include <linux/slab.h>
> #include <net/rtnetlink.h>
>
> @@ -118,12 +119,22 @@ static netdev_tx_t vcan_tx(struct sk_buff *skb, struct net_device *dev)
> if (loop) {
> struct sock *srcsk = skb->sk;
>
Same problem
> - skb = skb_share_check(skb, GFP_ATOMIC);
> - if (!skb)
> - return NETDEV_TX_OK;
> + if (skb_shared(skb)) {
> + struct sk_buff *nskb = skb_clone(skb, GFP_ATOMIC);
> +
> + if (likely(nskb))
> + consume_skb(skb);
> + else {
> + kfree_skb(skb);
> + return NETDEV_TX_OK;
> + }
> + skb = nskb;
> + } else
> + skb_orphan(skb);
> +
> + can_skb_set_owner(skb, srcsk);
>
> /* receive with packet counting */
> - skb->sk = srcsk;
> vcan_rx(skb, dev);
> } else {
> /* no looped packets => no counting */
I think you really should have a helper instead of copying this 3 times.
/*
* like skb_share_check(), but transfert the skb->sk ownership
*/
static inline struct sk_buff *can_skb_share_check(struct sk_buff *skb)
{
if (skb_shared(skb)) {
struct sk_buff *nskb = skb_clone(skb, GFP_ATOMIC);
if (likely(nskb)) {
if (skb->sk)
can_skb_set_owner(nskb, skb->sk);
consume_skb(skb);
return nskb;
}
kfree_skb(skb);
return NULL;
}
return skb;
}
^ permalink raw reply
* [PATCH 0/4] OpenCores 10/100 MAC ethtool operations
From: Max Filippov @ 2014-01-29 19:56 UTC (permalink / raw)
To: netdev, linux-kernel
Cc: David S. Miller, Florian Fainelli, Marc Gauthier, Max Filippov
Hello David, Florian and everybody,
this series implements ethtool callbacks for the ethoc driver as was
requested by Florian.
Max Filippov (4):
net: ethoc: implement basic ethtool operations
net: ethoc: implement ethtool get/set settings
net: ethoc: implement ethtool get registers
net: ethoc: implement ethtool get/set ring parameters
drivers/net/ethernet/ethoc.c | 85 ++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 85 insertions(+)
--
1.8.1.4
^ permalink raw reply
* [PATCH 1/4] net: ethoc: implement basic ethtool operations
From: Max Filippov @ 2014-01-29 19:56 UTC (permalink / raw)
To: netdev, linux-kernel
Cc: David S. Miller, Florian Fainelli, Marc Gauthier, Max Filippov
In-Reply-To: <1391025397-14965-1-git-send-email-jcmvbkbc@gmail.com>
The following methods are implemented:
- get link state (standard implementation);
- get timestamping info (standard implementation).
Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
---
drivers/net/ethernet/ethoc.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/drivers/net/ethernet/ethoc.c b/drivers/net/ethernet/ethoc.c
index 5854d41..6de6352 100644
--- a/drivers/net/ethernet/ethoc.c
+++ b/drivers/net/ethernet/ethoc.c
@@ -900,6 +900,11 @@ out:
return NETDEV_TX_OK;
}
+const struct ethtool_ops ethoc_ethtool_ops = {
+ .get_link = ethtool_op_get_link,
+ .get_ts_info = ethtool_op_get_ts_info,
+};
+
static const struct net_device_ops ethoc_netdev_ops = {
.ndo_open = ethoc_open,
.ndo_stop = ethoc_stop,
@@ -1148,6 +1153,7 @@ static int ethoc_probe(struct platform_device *pdev)
netdev->netdev_ops = ðoc_netdev_ops;
netdev->watchdog_timeo = ETHOC_TIMEOUT;
netdev->features |= 0;
+ netdev->ethtool_ops = ðoc_ethtool_ops;
/* setup NAPI */
netif_napi_add(netdev, &priv->napi, ethoc_poll, 64);
--
1.8.1.4
^ permalink raw reply related
* [PATCH 2/4] net: ethoc: implement ethtool get/set settings
From: Max Filippov @ 2014-01-29 19:56 UTC (permalink / raw)
To: netdev, linux-kernel
Cc: David S. Miller, Florian Fainelli, Marc Gauthier, Max Filippov
In-Reply-To: <1391025397-14965-1-git-send-email-jcmvbkbc@gmail.com>
Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
---
drivers/net/ethernet/ethoc.c | 24 ++++++++++++++++++++++++
1 file changed, 24 insertions(+)
diff --git a/drivers/net/ethernet/ethoc.c b/drivers/net/ethernet/ethoc.c
index 6de6352..9518023 100644
--- a/drivers/net/ethernet/ethoc.c
+++ b/drivers/net/ethernet/ethoc.c
@@ -900,7 +900,31 @@ out:
return NETDEV_TX_OK;
}
+static int ethoc_get_settings(struct net_device *dev, struct ethtool_cmd *cmd)
+{
+ struct ethoc *priv = netdev_priv(dev);
+ struct phy_device *phydev = priv->phy;
+
+ if (!phydev)
+ return -ENODEV;
+
+ return phy_ethtool_gset(phydev, cmd);
+}
+
+static int ethoc_set_settings(struct net_device *dev, struct ethtool_cmd *cmd)
+{
+ struct ethoc *priv = netdev_priv(dev);
+ struct phy_device *phydev = priv->phy;
+
+ if (!phydev)
+ return -ENODEV;
+
+ return phy_ethtool_sset(phydev, cmd);
+}
+
const struct ethtool_ops ethoc_ethtool_ops = {
+ .get_settings = ethoc_get_settings,
+ .set_settings = ethoc_set_settings,
.get_link = ethtool_op_get_link,
.get_ts_info = ethtool_op_get_ts_info,
};
--
1.8.1.4
^ permalink raw reply related
* [PATCH 3/4] net: ethoc: implement ethtool get registers
From: Max Filippov @ 2014-01-29 19:56 UTC (permalink / raw)
To: netdev, linux-kernel
Cc: David S. Miller, Florian Fainelli, Marc Gauthier, Max Filippov
In-Reply-To: <1391025397-14965-1-git-send-email-jcmvbkbc@gmail.com>
Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
---
drivers/net/ethernet/ethoc.c | 20 ++++++++++++++++++++
1 file changed, 20 insertions(+)
diff --git a/drivers/net/ethernet/ethoc.c b/drivers/net/ethernet/ethoc.c
index 9518023..0bf297b 100644
--- a/drivers/net/ethernet/ethoc.c
+++ b/drivers/net/ethernet/ethoc.c
@@ -52,6 +52,7 @@ MODULE_PARM_DESC(buffer_size, "DMA buffer allocation size");
#define ETH_HASH0 0x48
#define ETH_HASH1 0x4c
#define ETH_TXCTRL 0x50
+#define ETH_END 0x54
/* mode register */
#define MODER_RXEN (1 << 0) /* receive enable */
@@ -922,9 +923,28 @@ static int ethoc_set_settings(struct net_device *dev, struct ethtool_cmd *cmd)
return phy_ethtool_sset(phydev, cmd);
}
+static int ethoc_get_regs_len(struct net_device *netdev)
+{
+ return ETH_END;
+}
+
+static void ethoc_get_regs(struct net_device *dev, struct ethtool_regs *regs,
+ void *p)
+{
+ struct ethoc *priv = netdev_priv(dev);
+ u32 *regs_buff = p;
+ unsigned i;
+
+ regs->version = 0;
+ for (i = 0; i < ETH_END / sizeof(u32); ++i)
+ regs_buff[i] = ethoc_read(priv, i * sizeof(u32));
+}
+
const struct ethtool_ops ethoc_ethtool_ops = {
.get_settings = ethoc_get_settings,
.set_settings = ethoc_set_settings,
+ .get_regs_len = ethoc_get_regs_len,
+ .get_regs = ethoc_get_regs,
.get_link = ethtool_op_get_link,
.get_ts_info = ethtool_op_get_ts_info,
};
--
1.8.1.4
^ permalink raw reply related
* [PATCH 4/4] net: ethoc: implement ethtool get/set ring parameters
From: Max Filippov @ 2014-01-29 19:56 UTC (permalink / raw)
To: netdev, linux-kernel
Cc: David S. Miller, Florian Fainelli, Marc Gauthier, Max Filippov
In-Reply-To: <1391025397-14965-1-git-send-email-jcmvbkbc@gmail.com>
TX and RX rings share memory and descriptors. Maximal number of
descriptors reported is one less than the total available nuber of
descriptors. For the set operation the requested number of TX descriptors
is rounded down to the nearest power of two (driver logic requirement), the
rest are RX descriptors. If less RX descriptors is requested the rest is
left unused.
Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
---
drivers/net/ethernet/ethoc.c | 35 +++++++++++++++++++++++++++++++++++
1 file changed, 35 insertions(+)
diff --git a/drivers/net/ethernet/ethoc.c b/drivers/net/ethernet/ethoc.c
index 0bf297b..c873946 100644
--- a/drivers/net/ethernet/ethoc.c
+++ b/drivers/net/ethernet/ethoc.c
@@ -181,6 +181,7 @@ MODULE_PARM_DESC(buffer_size, "DMA buffer allocation size");
* @membase: pointer to buffer memory region
* @dma_alloc: dma allocated buffer size
* @io_region_size: I/O memory region size
+ * @num_bd: number of buffer descriptors
* @num_tx: number of send buffers
* @cur_tx: last send buffer written
* @dty_tx: last buffer actually sent
@@ -201,6 +202,7 @@ struct ethoc {
int dma_alloc;
resource_size_t io_region_size;
+ unsigned int num_bd;
unsigned int num_tx;
unsigned int cur_tx;
unsigned int dty_tx;
@@ -940,12 +942,44 @@ static void ethoc_get_regs(struct net_device *dev, struct ethtool_regs *regs,
regs_buff[i] = ethoc_read(priv, i * sizeof(u32));
}
+static void ethoc_get_ringparam(struct net_device *dev,
+ struct ethtool_ringparam *ring)
+{
+ struct ethoc *priv = netdev_priv(dev);
+
+ ring->rx_max_pending = priv->num_bd - 1;
+ ring->rx_mini_max_pending = 0;
+ ring->rx_jumbo_max_pending = 0;
+ ring->tx_max_pending = priv->num_bd - 1;
+
+ ring->rx_pending = priv->num_rx;
+ ring->rx_mini_pending = 0;
+ ring->rx_jumbo_pending = 0;
+ ring->tx_pending = priv->num_tx;
+}
+
+static int ethoc_set_ringparam(struct net_device *dev,
+ struct ethtool_ringparam *ring)
+{
+ struct ethoc *priv = netdev_priv(dev);
+
+ if (netif_running(dev))
+ return -EBUSY;
+ priv->num_tx = rounddown_pow_of_two(ring->tx_pending);
+ priv->num_rx = priv->num_bd - priv->num_tx;
+ if (priv->num_rx > ring->rx_pending)
+ priv->num_rx = ring->rx_pending;
+ return 0;
+}
+
const struct ethtool_ops ethoc_ethtool_ops = {
.get_settings = ethoc_get_settings,
.set_settings = ethoc_set_settings,
.get_regs_len = ethoc_get_regs_len,
.get_regs = ethoc_get_regs,
.get_link = ethtool_op_get_link,
+ .get_ringparam = ethoc_get_ringparam,
+ .set_ringparam = ethoc_set_ringparam,
.get_ts_info = ethtool_op_get_ts_info,
};
@@ -1077,6 +1111,7 @@ static int ethoc_probe(struct platform_device *pdev)
ret = -ENODEV;
goto error;
}
+ priv->num_bd = num_bd;
/* num_tx must be a power of two */
priv->num_tx = rounddown_pow_of_two(num_bd >> 1);
priv->num_rx = num_bd - priv->num_tx;
--
1.8.1.4
^ permalink raw reply related
* Re: [PATCH 0/4] OpenCores 10/100 MAC ethtool operations
From: Florian Fainelli @ 2014-01-29 20:01 UTC (permalink / raw)
To: Max Filippov
Cc: netdev, linux-kernel@vger.kernel.org, David S. Miller,
Marc Gauthier
In-Reply-To: <1391025397-14965-1-git-send-email-jcmvbkbc@gmail.com>
2014-01-29 Max Filippov <jcmvbkbc@gmail.com>:
> Hello David, Florian and everybody,
>
> this series implements ethtool callbacks for the ethoc driver as was
> requested by Florian.
Thanks Max, this does look good to me now:
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
>
> Max Filippov (4):
> net: ethoc: implement basic ethtool operations
> net: ethoc: implement ethtool get/set settings
> net: ethoc: implement ethtool get registers
> net: ethoc: implement ethtool get/set ring parameters
>
> drivers/net/ethernet/ethoc.c | 85 ++++++++++++++++++++++++++++++++++++++++++++
> 1 file changed, 85 insertions(+)
>
> --
> 1.8.1.4
>
--
Florian
^ permalink raw reply
* Re: [PATCH stable 3.11+] can: use private sk reference to detect originating socket
From: Oliver Hartkopp @ 2014-01-29 20:40 UTC (permalink / raw)
To: Eric Dumazet
Cc: David Miller, Linux Netdev List, Andre Naujoks,
linux-can@vger.kernel.org
In-Reply-To: <1391025348.28432.63.camel@edumazet-glaptop2.roam.corp.google.com>
On 29.01.2014 20:55, Eric Dumazet wrote:
>> 2. The check for sk and the additional skb_orphan() is not needed as the
>> can_skb_set_owner() is invoked only after 'fresh' skb allocation or after
>> clone/skb_orphan() - so we know the skb state very good.
>
> Yep, but then you added skb_orphan() calls. when skb is not shared.
I did that e.g. in the sources placed in driver/net/can because I assume that
I can not be sure that I always get skbs created by AF_CAN.
E.g. one could also use AF_PACKET to send CAN frames to the CAN interfaces.
Btw. assuming AF_PACKET does it correct too with the destructor I will omit
the skb_orphan() / can_skb_set_owner() sequence in drivers/net/can in the next
attempt.
Tnx
Oliver
>
> I think you really should have a helper instead of copying this 3 times.
>
ok
^ permalink raw reply
* Re: [PATCH 0/2] [BUG FIXES - 3.10.27] sit: More backports
From: Steven Rostedt @ 2014-01-29 20:48 UTC (permalink / raw)
To: nicolas.dichtel
Cc: linux-kernel, netdev, stable, Clark Williams,
Luis Claudio R. Goncalves, John Kacur, Willem de Bruijn
In-Reply-To: <52E9267C.90403@6wind.com>
On Wed, 29 Jan 2014 17:04:12 +0100
Nicolas Dichtel <nicolas.dichtel@6wind.com> wrote:
> Your patch serie seems to be the good way to go (note that patch 1/2 does not
> compile) but I think the fix is smaller because we don't have x-netns.
>
> Here is my proposal, if you agree, I will send the same patch for ip6_tunnnel,
> which have the netns leak.
>
Hold on. Seems that the kernels that were being tested in QA had more
code than what I was testing. Clark had backported "sit: fix use after
free of fb_tunnel_dev" and that was what was causing the
unlist_netdevice() to be missed.
When I started working on vanilla 3.10.27 as well, I first did my
original patch (which just removes the call to
unregister_netdevice_queue() from sit_exit_net()). I asked to have that
added to our kernel for testing, and they told me it was already there
via Clark's backport. Then I did the full backport as well and looked
for the leak. I'm now thinking that the full backport is not needed as
that was what caused the leak.
According to commit 9434266f2c645d4fcf62a03a8e36ad8075e37943 "sit: fix
use after free of fb_tunnel_dev", it states:
Bug: The fallback device is created in sit_init_net and assumed to
be freed in sit_exit_net. First, it is dereferenced in that
function, in sit_destroy_tunnels:
struct net *net = dev_net(sitn->fb_tunnel_dev);
Prior to this, rtnl_unlink_register has removed all devices that
match rtnl_link_ops == sit_link_ops.
Commit 205983c43700 added the line
+ sitn->fb_tunnel_dev->rtnl_link_ops = &sit_link_ops;
which cases the fallback device to match here and be freed before it
is last dereferenced.
Commit 205983c43700 was backported to 3.10, but without commit
5e6700b3bf98 "sit: add support of x-netns" which was what added the
net = dev_net(sitn->fb_tunnel_dev);
Which looks to me that the only reason I need to port back commit
5e6700b3bf98 is if I add the full backport of 9434266f2c645d4f.
Seems to me that my original patch may be good enough. The one that I
said this series obsoletes.
Note, I've talked with the people that are doing the testing, and I'm
having them revert all changes except for that one fix and rerun the
tests again. I should know the results by tomorrow.
Let me know if "sit: fix use after free of fb_tunnel_dev" still needs
to be backported due to some other way that the fallback device can be
dereferenced after being freed.
-- Steve
^ permalink raw reply
* Re: [PATCH stable 3.11+] can: use private sk reference to detect originating socket
From: Oliver Hartkopp @ 2014-01-29 21:00 UTC (permalink / raw)
To: Eric Dumazet
Cc: David Miller, Linux Netdev List, Andre Naujoks,
linux-can@vger.kernel.org
In-Reply-To: <52E9675A.4070201@hartkopp.net>
So here we are:
Introduced can_create_echo_skb() which creates a skb which is properly
owned to be send back (echo'ed) into the network stack.
Regards,
Oliver
diff --git a/drivers/net/can/dev.c b/drivers/net/can/dev.c
index 13a9098..fc59bc6 100644
--- a/drivers/net/can/dev.c
+++ b/drivers/net/can/dev.c
@@ -323,19 +323,10 @@ void can_put_echo_skb(struct sk_buff *skb, struct net_device *dev,
}
if (!priv->echo_skb[idx]) {
- struct sock *srcsk = skb->sk;
- if (atomic_read(&skb->users) != 1) {
- struct sk_buff *old_skb = skb;
-
- skb = skb_clone(old_skb, GFP_ATOMIC);
- kfree_skb(old_skb);
- if (!skb)
- return;
- } else
- skb_orphan(skb);
-
- skb->sk = srcsk;
+ skb = can_create_echo_skb(skb);
+ if (!skb)
+ return;
/* make settings for echo to reduce code in irq context */
skb->protocol = htons(ETH_P_CAN);
diff --git a/drivers/net/can/janz-ican3.c b/drivers/net/can/janz-ican3.c
index e24e669..2124c679 100644
--- a/drivers/net/can/janz-ican3.c
+++ b/drivers/net/can/janz-ican3.c
@@ -18,6 +18,7 @@
#include <linux/netdevice.h>
#include <linux/can.h>
#include <linux/can/dev.h>
+#include <linux/can/skb.h>
#include <linux/can/error.h>
#include <linux/mfd/janz.h>
@@ -1133,20 +1134,9 @@ static void ican3_handle_message(struct ican3_dev *mod, struct ican3_msg *msg)
*/
static void ican3_put_echo_skb(struct ican3_dev *mod, struct sk_buff *skb)
{
- struct sock *srcsk = skb->sk;
-
- if (atomic_read(&skb->users) != 1) {
- struct sk_buff *old_skb = skb;
-
- skb = skb_clone(old_skb, GFP_ATOMIC);
- kfree_skb(old_skb);
- if (!skb)
- return;
- } else {
- skb_orphan(skb);
- }
-
- skb->sk = srcsk;
+ skb = can_create_echo_skb(skb);
+ if (!skb)
+ return;
/* save this skb for tx interrupt echo handling */
skb_queue_tail(&mod->echoq, skb);
diff --git a/drivers/net/can/vcan.c b/drivers/net/can/vcan.c
index 0a2a5ee..4e94057 100644
--- a/drivers/net/can/vcan.c
+++ b/drivers/net/can/vcan.c
@@ -46,6 +46,7 @@
#include <linux/if_ether.h>
#include <linux/can.h>
#include <linux/can/dev.h>
+#include <linux/can/skb.h>
#include <linux/slab.h>
#include <net/rtnetlink.h>
@@ -109,25 +110,23 @@ static netdev_tx_t vcan_tx(struct sk_buff *skb, struct net_device *dev)
stats->rx_packets++;
stats->rx_bytes += cfd->len;
}
- kfree_skb(skb);
+ consume_skb(skb);
return NETDEV_TX_OK;
}
/* perform standard echo handling for CAN network interfaces */
if (loop) {
- struct sock *srcsk = skb->sk;
- skb = skb_share_check(skb, GFP_ATOMIC);
+ skb = can_create_echo_skb(skb);
if (!skb)
return NETDEV_TX_OK;
/* receive with packet counting */
- skb->sk = srcsk;
vcan_rx(skb, dev);
} else {
/* no looped packets => no counting */
- kfree_skb(skb);
+ consume_skb(skb);
}
return NETDEV_TX_OK;
}
diff --git a/include/linux/can/skb.h b/include/linux/can/skb.h
index 2f0543f..f9bbbb4 100644
--- a/include/linux/can/skb.h
+++ b/include/linux/can/skb.h
@@ -11,7 +11,9 @@
#define CAN_SKB_H
#include <linux/types.h>
+#include <linux/skbuff.h>
#include <linux/can.h>
+#include <net/sock.h>
/*
* The struct can_skb_priv is used to transport additional information along
@@ -42,4 +44,40 @@ static inline void can_skb_reserve(struct sk_buff *skb)
skb_reserve(skb, sizeof(struct can_skb_priv));
}
+static inline void can_skb_destructor(struct sk_buff *skb)
+{
+ sock_put(skb->sk);
+}
+
+static inline void can_skb_set_owner(struct sk_buff *skb, struct sock *sk)
+{
+ if (sk) {
+ sock_hold(sk);
+ skb->destructor = can_skb_destructor;
+ skb->sk = sk;
+ }
+}
+
+/*
+ * returns an unshared skb owned by the original sock to be echo'ed back
+ */
+static inline struct sk_buff *can_create_echo_skb(struct sk_buff *skb)
+{
+ if (skb_shared(skb)) {
+ struct sk_buff *nskb = skb_clone(skb, GFP_ATOMIC);
+
+ if (likely(nskb)) {
+ can_skb_set_owner(nskb, skb->sk);
+ consume_skb(skb);
+ return nskb;
+ } else {
+ kfree_skb(skb);
+ return NULL;
+ }
+ }
+
+ /* we can assume to have an unshared skb with proper owner */
+ return skb;
+}
+
#endif /* CAN_SKB_H */
diff --git a/net/can/af_can.c b/net/can/af_can.c
index d249874..a27f8aa 100644
--- a/net/can/af_can.c
+++ b/net/can/af_can.c
@@ -57,6 +57,7 @@
#include <linux/skbuff.h>
#include <linux/can.h>
#include <linux/can/core.h>
+#include <linux/can/skb.h>
#include <linux/ratelimit.h>
#include <net/net_namespace.h>
#include <net/sock.h>
@@ -290,7 +291,7 @@ int can_send(struct sk_buff *skb, int loop)
return -ENOMEM;
}
- newskb->sk = skb->sk;
+ can_skb_set_owner(newskb, skb->sk);
newskb->ip_summed = CHECKSUM_UNNECESSARY;
newskb->pkt_type = PACKET_BROADCAST;
}
diff --git a/net/can/bcm.c b/net/can/bcm.c
index 3fc737b..dcb75c0 100644
--- a/net/can/bcm.c
+++ b/net/can/bcm.c
@@ -268,7 +268,7 @@ static void bcm_can_tx(struct bcm_op *op)
/* send with loopback */
skb->dev = dev;
- skb->sk = op->sk;
+ can_skb_set_owner(skb, op->sk);
can_send(skb, 1);
/* update statistics */
@@ -1223,7 +1223,7 @@ static int bcm_tx_send(struct msghdr *msg, int ifindex, struct sock *sk)
can_skb_prv(skb)->ifindex = dev->ifindex;
skb->dev = dev;
- skb->sk = sk;
+ can_skb_set_owner(skb, sk);
err = can_send(skb, 1); /* send with loopback */
dev_put(dev);
On 29.01.2014 21:40, Oliver Hartkopp wrote:
> On 29.01.2014 20:55, Eric Dumazet wrote:
>
>>> 2. The check for sk and the additional skb_orphan() is not needed as the
>>> can_skb_set_owner() is invoked only after 'fresh' skb allocation or after
>>> clone/skb_orphan() - so we know the skb state very good.
>>
>> Yep, but then you added skb_orphan() calls. when skb is not shared.
>
> I did that e.g. in the sources placed in driver/net/can because I assume that
> I can not be sure that I always get skbs created by AF_CAN.
>
> E.g. one could also use AF_PACKET to send CAN frames to the CAN interfaces.
>
> Btw. assuming AF_PACKET does it correct too with the destructor I will omit
> the skb_orphan() / can_skb_set_owner() sequence in drivers/net/can in the next
> attempt.
>
> Tnx
> Oliver
>
>>
>> I think you really should have a helper instead of copying this 3 times.
>>
>
> ok
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-can" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
^ permalink raw reply related
* Re: [PATCH stable 3.11+] can: use private sk reference to detect originating socket
From: Eric Dumazet @ 2014-01-29 21:06 UTC (permalink / raw)
To: Oliver Hartkopp
Cc: David Miller, Linux Netdev List, Andre Naujoks,
linux-can@vger.kernel.org
In-Reply-To: <52E96BDC.9070209@hartkopp.net>
On Wed, 2014-01-29 at 22:00 +0100, Oliver Hartkopp wrote:
> So here we are:
>
> Introduced can_create_echo_skb() which creates a skb which is properly
> owned to be send back (echo'ed) into the network stack.
>
> Regards,
> Oliver
This seems much better ;)
^ permalink raw reply
* [PATCH 3/3] can: janz-ican3: fix uninitialized variable warnings
From: Marc Kleine-Budde @ 2014-01-29 21:11 UTC (permalink / raw)
To: netdev; +Cc: davem, linux-can, kernel, Ira W. Snyder, Marc Kleine-Budde
In-Reply-To: <1391029863-23099-1-git-send-email-mkl@pengutronix.de>
From: "Ira W. Snyder" <iws@ovro.caltech.edu>
Analysis of the code shows that the struct ican3_msg variable cannot be
used uninitialized. Error conditions are checked and the loop terminates
before calling the ican3_handle_message() function with an uninitialized
value.
Signed-off-by: Ira W. Snyder <iws@ovro.caltech.edu>
Acked-by: Oliver Hartkopp <socketcan@hartkopp.net>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
---
drivers/net/can/janz-ican3.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/can/janz-ican3.c b/drivers/net/can/janz-ican3.c
index e24e669..07f0ba0 100644
--- a/drivers/net/can/janz-ican3.c
+++ b/drivers/net/can/janz-ican3.c
@@ -1322,7 +1322,7 @@ static int ican3_napi(struct napi_struct *napi, int budget)
/* process all communication messages */
while (true) {
- struct ican3_msg msg;
+ struct ican3_msg uninitialized_var(msg);
ret = ican3_recv_msg(mod, &msg);
if (ret)
break;
--
1.8.5.3
^ permalink raw reply related
* pull-request: can 2014-01-29
From: Marc Kleine-Budde @ 2014-01-29 21:11 UTC (permalink / raw)
To: netdev; +Cc: davem, linux-can, kernel
Hello David,
this is a pull request with three fixes for net/master, for the current release
cycle.
Arnd Bergmann provides a fix for the flexcan driver, enabling compilation on
all combinations of big and little endian on ARM and PowerPc. A patch by Ira W.
Snyder fixes uninitialized variable warnings in the janz-ican3 driver.
Rostislav Lisovy contributes a patch to propagate the SO_PRIORITY of raw
sockets to skbs.
Marc
---
The following changes since commit c044dc2132d19d8c643cdd340f21afcec177c046:
qeth: fix build of s390 allmodconfig (2014-01-29 00:43:33 -0800)
are available in the git repository at:
git://gitorious.org/linux-can/linux-can.git tags/linux-can-fixes-for-3.14-20140129
for you to fetch changes up to 73615c8669ef1c497c942cae0d5079b95824332a:
can: janz-ican3: fix uninitialized variable warnings (2014-01-29 20:23:23 +0100)
----------------------------------------------------------------
linux-can-fixes-for-3.14-20140129
----------------------------------------------------------------
Arnd Bergmann (1):
can: flexcan: fix flexcan driver build for big endian on ARM and little endian on PowerPc
Ira W. Snyder (1):
can: janz-ican3: fix uninitialized variable warnings
Rostislav Lisovy (1):
can: Propagate SO_PRIORITY of raw sockets to skbs
drivers/net/can/Kconfig | 2 +-
drivers/net/can/flexcan.c | 7 +++++--
drivers/net/can/janz-ican3.c | 2 +-
net/can/raw.c | 1 +
4 files changed, 8 insertions(+), 4 deletions(-)
^ permalink raw reply
* [PATCH 1/3] can: flexcan: fix flexcan driver build for big endian on ARM and little endian on PowerPc
From: Marc Kleine-Budde @ 2014-01-29 21:11 UTC (permalink / raw)
To: netdev
Cc: davem, linux-can, kernel, Arnd Bergmann, Guenter Roeck,
Lothar Waßmann, Marc Kleine-Budde
In-Reply-To: <1391029863-23099-1-git-send-email-mkl@pengutronix.de>
From: Arnd Bergmann <arnd@arndb.de>
There is no reason to disallow building the driver on big-endian ARM kernels.
Furthermore, the current behavior is actually broken on little-endian PowerPC
as well.
The choice of register accessor functions must purely depend on the CPU
architecture, not which endianess the CPU is running on. Note that we nowadays
allow both big-endian ARM and little-endian PowerPC kernels.
With this patch applied, we will do the right thing in all four combinations.
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Cc: Guenter Roeck <linux@roeck-us.net>
Cc: Lothar Waßmann <LW@KARO-electronics.de>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
---
drivers/net/can/Kconfig | 2 +-
drivers/net/can/flexcan.c | 7 +++++--
2 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/drivers/net/can/Kconfig b/drivers/net/can/Kconfig
index d447b88..9e7d95d 100644
--- a/drivers/net/can/Kconfig
+++ b/drivers/net/can/Kconfig
@@ -104,7 +104,7 @@ config CAN_JANZ_ICAN3
config CAN_FLEXCAN
tristate "Support for Freescale FLEXCAN based chips"
- depends on (ARM && CPU_LITTLE_ENDIAN) || PPC
+ depends on ARM || PPC
---help---
Say Y here if you want to support for Freescale FlexCAN.
diff --git a/drivers/net/can/flexcan.c b/drivers/net/can/flexcan.c
index aaed97b..320bef2 100644
--- a/drivers/net/can/flexcan.c
+++ b/drivers/net/can/flexcan.c
@@ -235,9 +235,12 @@ static const struct can_bittiming_const flexcan_bittiming_const = {
};
/*
- * Abstract off the read/write for arm versus ppc.
+ * Abstract off the read/write for arm versus ppc. This
+ * assumes that PPC uses big-endian registers and everything
+ * else uses little-endian registers, independent of CPU
+ * endianess.
*/
-#if defined(__BIG_ENDIAN)
+#if defined(CONFIG_PPC)
static inline u32 flexcan_read(void __iomem *addr)
{
return in_be32(addr);
--
1.8.5.3
^ permalink raw reply related
* [PATCH 2/3] can: Propagate SO_PRIORITY of raw sockets to skbs
From: Marc Kleine-Budde @ 2014-01-29 21:11 UTC (permalink / raw)
To: netdev
Cc: davem, linux-can, kernel, Rostislav Lisovy, Michal Sojka,
Marc Kleine-Budde
In-Reply-To: <1391029863-23099-1-git-send-email-mkl@pengutronix.de>
From: Rostislav Lisovy <lisovy@gmail.com>
This allows controlling certain queueing disciplines by setting the
socket's SO_PRIORITY option.
For example, with the default pfifo_fast queueing discipline, which
provides three priorities, socket priority TC_PRIO_CONTROL means
higher than default and TC_PRIO_BULK means lower than default.
Signed-off-by: Rostislav Lisovy <lisovy@gmail.com>
Signed-off-by: Michal Sojka <sojkam1@fel.cvut.cz>
Acked-by: Oliver Hartkopp <socketcan@hartkopp.net>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
---
net/can/raw.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/net/can/raw.c b/net/can/raw.c
index 07d72d8..8be757c 100644
--- a/net/can/raw.c
+++ b/net/can/raw.c
@@ -715,6 +715,7 @@ static int raw_sendmsg(struct kiocb *iocb, struct socket *sock,
skb->dev = dev;
skb->sk = sk;
+ skb->priority = sk->sk_priority;
err = can_send(skb, ro->loopback);
--
1.8.5.3
^ permalink raw reply related
* Re: Help testing for USB ethernet/xHCI regression
From: Sarah Sharp @ 2014-01-29 21:18 UTC (permalink / raw)
To: Mark Lord; +Cc: Greg Kroah-Hartman, linux-usb, netdev, David Laight
In-Reply-To: <52E883FB.7010704@pobox.com>
On Tue, Jan 28, 2014 at 11:30:51PM -0500, Mark Lord wrote:
> On 14-01-28 03:30 PM, Sarah Sharp wrote:
> ..
> > Can you please pull this branch, which contains a 3.13 kernel with
> > David's patch reverted, and test whether your USB ethernet device works
> > or fails?
>
> Fails. dmesg log attached.
It's funny, because there's certainly data transferred over endpoint
0x82, even though there were link TRBs in the middle of transfers. Did
the "untransferred" messages stop when the device stopped working, or
did they continue?
> All I do is something akin to this:
>
> mount /server/ /x
> mount --bind / /t
> mirrordir -v --strict-mtimes /t /x/backups/empress
>
> "mirrordir" is similar to "rsync", but less cryptic.
> The sequence above maintains a clone of the root filesystem
> of my ultrabook ("empress") on an NFS server over GigE.
Please send me the output of `sudo lsusb -t` and `sudo lsusb -v` with
the USB device attached. I'd like to know whether you and David have
the same device and driver. Perhaps the link TRB issue only impacts
that device, and we can limit scatter-gather under xHCI for that device.
If not, we'll have to look at bigger fixes.
Sarah Sharp
^ permalink raw reply
* Re: [Patch resend nf] ipvs: fix AF assignment in ip_vs_conn_new()
From: Julian Anastasov @ 2014-01-29 21:24 UTC (permalink / raw)
To: Michal Kubecek
Cc: netfilter-devel, netdev, lvs-devel, Wensong Zhang, Simon Horman,
Pablo Neira Ayuso, Patrick McHardy, Jozsef Kadlecsik,
David S. Miller
In-Reply-To: <20140129145437.69F56E916F@unicorn.suse.cz>
Hello,
On Wed, 29 Jan 2014, Michal Kubecek wrote:
> If a fwmark is passed to ip_vs_conn_new(), it is passed in
> vaddr, not daddr. Therefore we should set AF to AF_UNSPEC in
> vaddr assignment (like we do in ip_vs_ct_in_get()).
>
> Signed-off-by: Bogdano Arendartchuk <barendartchuk@suse.com>
> Signed-off-by: Michal Kubecek <mkubecek@suse.cz>
> ---
> (first time it didn't reach all recipients due to a malformed header)
> ---
> net/netfilter/ipvs/ip_vs_conn.c | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/net/netfilter/ipvs/ip_vs_conn.c b/net/netfilter/ipvs/ip_vs_conn.c
> index 59a1a85..282b39b 100644
> --- a/net/netfilter/ipvs/ip_vs_conn.c
> +++ b/net/netfilter/ipvs/ip_vs_conn.c
> @@ -871,11 +871,11 @@ ip_vs_conn_new(const struct ip_vs_conn_param *p,
> cp->protocol = p->protocol;
> ip_vs_addr_set(p->af, &cp->caddr, p->caddr);
> cp->cport = p->cport;
> - ip_vs_addr_set(p->af, &cp->vaddr, p->vaddr);
> - cp->vport = p->vport;
> - /* proto should only be IPPROTO_IP if d_addr is a fwmark */
> + /* proto should only be IPPROTO_IP if p->vaddr is a fwmark */
> ip_vs_addr_set(p->protocol == IPPROTO_IP ? AF_UNSPEC : p->af,
> - &cp->daddr, daddr);
> + &cp->vaddr, vaddr);
Patch does not compile due to vaddr and p->daddr
usage but you are in the right direction. Such change should
fix a problem where connection templates don't get full
IPv6 address for the real server, only the first 4 bytes
are copied and as result it works only for IPv4.
> + cp->vport = p->vport;
> + ip_vs_addr_set(p->af, &cp->daddr, p->daddr);
> cp->dport = dport;
> cp->flags = flags;
> cp->fwmark = fwmark;
> --
> 1.8.1.4
Regards
--
Julian Anastasov <ja@ssi.bg>
^ permalink raw reply
* Re: [PATCH stable 3.11+] can: use private sk reference to detect originating socket
From: Oliver Hartkopp @ 2014-01-29 21:25 UTC (permalink / raw)
To: Eric Dumazet
Cc: David Miller, Linux Netdev List, Andre Naujoks,
linux-can@vger.kernel.org
In-Reply-To: <1391029578.28432.64.camel@edumazet-glaptop2.roam.corp.google.com>
On 29.01.2014 22:06, Eric Dumazet wrote:
> On Wed, 2014-01-29 at 22:00 +0100, Oliver Hartkopp wrote:
>> So here we are:
>>
>> Introduced can_create_echo_skb() which creates a skb which is properly
>> owned to be send back (echo'ed) into the network stack.
>>
>> Regards,
>> Oliver
>
> This seems much better ;)
>
Great!
I'll give it some more testing on my Laptop and will send the patch with a
proper description tomorrow morning.
Thanks for your support fixing this issue!
Regards,
Oliver
^ permalink raw reply
* Re: Help testing for USB ethernet/xHCI regression
From: Sarah Sharp @ 2014-01-29 21:54 UTC (permalink / raw)
To: renevant; +Cc: linux-usb, Mark Lord, Greg Kroah-Hartman, netdev, David Laight
In-Reply-To: <22081260.RNay0J72dY@athas>
On Wed, Jan 29, 2014 at 04:21:00PM +1100, renevant@internode.on.net wrote:
> Hello,
>
> I am someone who has been struggling to get an ax88179 net adapter working
> reliably.
>
> I have an integrated Asmedia 1042 xhci controller that is reportedly version
> 0.96 on an ASUS M5A99FX PRO R2.0, BIOS 2201 motherboard based on the AMD 990FX
> chipset.
>
> The big issue I am currently facing is that I cannot get the device to work at
> all with 3.13 and current 3.14 mainline. This does not occur with 3.12.
With the working kernel, were you using vanilla 3.12, or a later 3.12
stable release, like 3.12.5?
> Current issue is when plugging in the ax88179 there is lag when bringing the
> interface up and a bunch of kernel messages:
With which kernel?
> [ 63.389440] ax88179_178a 2-1:1.0 eth0: register 'ax88179_178a' at
> usb-0000:07:00.0-1, ASIX AX88179 USB 3.0 Gigabit Ethernet, 80:3f:5d:08:0c:65
> [ 63.389500] usbcore: registered new interface driver ax88179_178a
> [ 63.423942] systemd-udevd[560]: renamed network interface eth0 to enp7s0u1
> [ 79.481028] IPv6: ADDRCONF(NETDEV_UP): enp7s0u1: link is not ready
> [ 82.210721] ax88179_178a 2-1:1.0 enp7s0u1: ax88179 - Link status is: 1
> [ 82.338947] ax88179_178a 2-1:1.0 enp7s0u1: ax88179 - Link status is: 1
> [ 82.467148] ax88179_178a 2-1:1.0 enp7s0u1: kevent 4 may have been dropped
> [ 82.470028] ax88179_178a 2-1:1.0 enp7s0u1: ax88179 - Link status is: 1
> [ 82.595364] ax88179_178a 2-1:1.0 enp7s0u1: kevent 4 may have been dropped
> [ 82.598312] ax88179_178a 2-1:1.0 enp7s0u1: ax88179 - Link status is: 1
> [ 82.723580] ax88179_178a 2-1:1.0 enp7s0u1: kevent 4 may have been dropped
> [ 82.726487] ax88179_178a 2-1:1.0 enp7s0u1: ax88179 - Link status is: 1
> [ 82.851796] ax88179_178a 2-1:1.0 enp7s0u1: kevent 4 may have been dropped
> [ 82.854642] ax88179_178a 2-1:1.0 enp7s0u1: ax88179 - Link status is: 1
> [snip]
> [ 87.218379] ax88179_178a 2-1:1.0 enp7s0u1: Failed to write reg index
> 0x0002: -110
Can you enable xHCI debugging as well, and send dmesg? You'll need to
have CONFIG_USB_DEBUG turned on, and also run this command as root:
echo -n 'module xhci_hcd =p' > /sys/kernel/debug/dynamic_debug/control
> Any traffic sent to the nic isn't seen by Linux.
>
>
> I can confirm the following problems for me with 3.14:
>
> reverting the writeq patch made USB 3 work for me again.
>
> http://marc.info/?t=139093294600002&r=1&w=2
So what was the issue that caused you to revert that patch? The traffic
not going to the device, or the device not being enumerated at all?
> and
>
> http://marc.info/?l=linux-usb&m=139092084714232&w=2
>
> got rid of transiever errors
>
>
>
>
> I cannot really test stability for the ax88179 until I can get it to work when
> plugging it in as above. I've tried the frag reversion and it's made no
> difference to this issue.
What about also reverting the writeq patch, on top of the other patches
I asked Mark to try?
Sarah Sharp
^ 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