Netdev List
 help / color / mirror / Atom feed
* RE: [PATCH net 3/4] lan78xx: Fix for eeprom read/write when device autosuspend
From: Nisar.Sayed @ 2017-09-06 17:34 UTC (permalink / raw)
  To: andrew; +Cc: davem, UNGLinuxDriver, netdev
In-Reply-To: <20170906140605.GD11864@lunn.ch>

Thanks, will make separate patch.

> Hi Nisar
> 
> > +	else if ((ee->magic == LAN78XX_EEPROM_MAGIC) &&
> > +		 (ee->offset >= 0 && ee->offset < MAX_EEPROM_SIZE) &&
> > +		 (ee->len > 0 && (ee->offset + ee->len) <=
> MAX_EEPROM_SIZE))
> > +		ret = lan78xx_write_raw_eeprom(dev, ee->offset, ee->len,
> data);
> 
> This change does not appear to have anything to do with auto suspend.
> Please make it a separate patch.
> 
>        Andrew

^ permalink raw reply

* Re: [patch net] net: sched: fix memleak for chain zero
From: Jakub Kicinski @ 2017-09-06 17:38 UTC (permalink / raw)
  To: Jiri Pirko; +Cc: netdev, davem, jhs, xiyou.wangcong, mlxsw
In-Reply-To: <20170906111419.5115-1-jiri@resnulli.us>

On Wed,  6 Sep 2017 13:14:19 +0200, Jiri Pirko wrote:
> From: Jiri Pirko <jiri@mellanox.com>
> 
> There's a memleak happening for chain 0. The thing is, chain 0 needs to
> be always present, not created on demand. Therefore tcf_block_get upon
> creation of block calls the tcf_chain_create function directly. The
> chain is created with refcnt == 1, which is not correct in this case and
> causes the memleak. So move the refcnt increment into tcf_chain_get
> function even for the case when chain needs to be created.
> 
> Reported-by: Jakub Kicinski <kubakici@wp.pl>
> Fixes: 5bc1701881e3 ("net: sched: introduce multichain support for filters")
> Signed-off-by: Jiri Pirko <jiri@mellanox.com>

Tested-by: Jakub Kicinski <jakub.kicinski@netronome.com>

^ permalink raw reply

* Re: [patch net] net: sched: fix memleak for chain zero
From: Cong Wang @ 2017-09-06 17:40 UTC (permalink / raw)
  To: Jiri Pirko
  Cc: Linux Kernel Network Developers, David Miller, Jamal Hadi Salim,
	Jakub Kicinski, mlxsw
In-Reply-To: <20170906111419.5115-1-jiri@resnulli.us>

On Wed, Sep 6, 2017 at 4:14 AM, Jiri Pirko <jiri@resnulli.us> wrote:
> From: Jiri Pirko <jiri@mellanox.com>
>
> There's a memleak happening for chain 0. The thing is, chain 0 needs to
> be always present, not created on demand. Therefore tcf_block_get upon
> creation of block calls the tcf_chain_create function directly. The
> chain is created with refcnt == 1, which is not correct in this case and
> causes the memleak. So move the refcnt increment into tcf_chain_get
> function even for the case when chain needs to be created.
>

Your approach could work but you just make the code even
uglier than it is now:

1. The current code is already ugly for special-casing chain 0:

        if (--chain->refcnt == 0 && !chain->filter_chain && chain->index != 0)
                tcf_chain_destroy(chain);

2. With your patch, chain 0 has a different _initial_ refcnt with others.

3. Allowing an object (chain 0) exists with refcnt==0

Compare it with my patch:

1. No special-case for chain 0, the above ugly part is removed

2. Every chain is equal and created with refcnt==1

3. Any chain with refcnt==0 is destroyed

^ permalink raw reply

* Re: [pull request][net-next 0/3] Mellanox, mlx5 GRE tunnel offloads
From: Alexander Duyck @ 2017-09-06 17:43 UTC (permalink / raw)
  To: Tom Herbert
  Cc: Hannes Frederic Sowa, Saeed Mahameed, Saeed Mahameed,
	David S. Miller, Linux Netdev List
In-Reply-To: <CALx6S37eY4eWEtBhfGqqRxtr3B4T5qpuBThUa0yH0CKCj6j4_w@mail.gmail.com>

On Wed, Sep 6, 2017 at 9:17 AM, Tom Herbert <tom@herbertland.com> wrote:
> On Tue, Sep 5, 2017 at 8:06 PM, Alexander Duyck
> <alexander.duyck@gmail.com> wrote:
>> On Tue, Sep 5, 2017 at 2:13 PM, Tom Herbert <tom@herbertland.com> wrote:
>>>> The situation with encapsulation is even more complicated:
>>>>
>>>> We are basically only interested in the UDP/vxlan/Ethernet/IP/UDP
>>>> constellation. If we do the fragmentation inside the vxlan tunnel and
>>>> carry over the skb hash to all resulting UDP/vxlan packets source ports,
>>>> we are fine and reordering on the receiver NIC won't happen in this
>>>> case. If the fragmentation happens on the outer UDP header, this will
>>>> result in reordering of the inner L2 flow. Unfortunately this depends on
>>>> how the vxlan tunnel was set up, how other devices do that and (I
>>>> believe so) on the kernel version.
>>>>
>>> This really isn't that complicated. The assumption that an IP network
>>> always delivers packets in order is simply wrong. The inventors of
>>> VXLAN must have know full well that when you use IP, packets can and
>>> eventually will be delivered out of order. This isn't just because of
>>> fragmentation, there are many other reasons that packets can be
>>> delivered OOO. This also must have been known when IP/GRE and any
>>> other protocol that carries L2 over IP was invented. If OOO is an
>>> issue for these protocols then they need to be fixed-- this is not a
>>> concern with IP protocol nor the stack.
>>>
>>> Tom
>>
>> As far as a little background on the original patch I believe the
>> issue that was fixed by the patch was a video streaming application
>> that was sending/receiving a mix of fragmented and non-fragmented
>> packets. Receiving them out of order due to the fragmentation was
>> causing issues with stutters in the video and so we ended up disabling
>> UDP by default in the NICs listed. We decided to go that way as UDP
>> RSS was viewed as a performance optimization, while the out-of-order
>> problems were viewed as a functionality issue.
>>
> Hi Alex,
>
> Thanks for the details! Were you able to find the root cause for this?
> In particular, it would be interesting to know if it is the kernel or
> device that introduced the jitter, or if it's the application that
> doesn't handle OOO well...
>
> Tom

It is hard to say since my memory of the events from 7 years ago is
pretty vague at this point, but I'm pretty sure it was the
application. Basically getting the frames out of order was causing
them to have to drop video data if I recall correctly.

- Alex

^ permalink raw reply

* Re: [PATCH net] Revert "net: phy: Correctly process PHY_HALTED in phy_stop_machine()"
From: David Daney @ 2017-09-06 17:53 UTC (permalink / raw)
  To: Mason, Florian Fainelli
  Cc: Marc Gonzalez, netdev, Geert Uytterhoeven, David Miller,
	Andrew Lunn, Mans Rullgard, Thibaud Cornic
In-Reply-To: <6721135d-8c3f-57a0-f423-9d18cd6e0947@free.fr>

On 09/06/2017 07:33 AM, Mason wrote:
> On 31/08/2017 20:29, Florian Fainelli wrote:
>> On 08/31/2017 11:12 AM, Mason wrote:
>>> On 31/08/2017 19:53, Florian Fainelli wrote:
>>>> On 08/31/2017 10:49 AM, Mason wrote:
>>>>> On 31/08/2017 18:57, Florian Fainelli wrote:
>>>>>> And the race is between phy_detach() setting phydev->attached_dev 
>>>>>> = NULL
>>>>>> and phy_state_machine() running in PHY_HALTED state and calling
>>>>>> netif_carrier_off().
>>>>>
>>>>> I must be missing something.
>>>>> (Since a thread cannot race against itself.)
>>>>>
>>>>> phy_disconnect calls phy_stop_machine which
>>>>> 1) stops the work queue from running in a separate thread
>>>>> 2) calls phy_state_machine *synchronously*
>>>>>       which runs the PHY_HALTED case with everything well-defined
>>>>> end of phy_stop_machine
>>>>>
>>>>> phy_disconnect only then calls phy_detach()
>>>>> which makes future calls of phy_state_machine perilous.
>>>>>
>>>>> This all happens in the same thread, so I'm not yet
>>>>> seeing where the race happens?
>>>>
>>>> The race is as described in David's earlier email, so let's recap:
>>>>
>>>> Thread 1            Thread 2
>>>> phy_disconnect()
>>>> phy_stop_interrupts()
>>>> phy_stop_machine()
>>>> phy_state_machine()
>>>>   -> queue_delayed_work()
>>>> phy_detach()
>>>>                 phy_state_machine()
>>>>                 -> netif_carrier_off()
>>>>
>>>> If phy_detach() finishes earlier than the workqueue had a chance to be
>>>> scheduled and process PHY_HALTED again, then we trigger the NULL 
>>>> pointer
>>>> de-reference.
>>>>
>>>> workqueues are not tasklets, the CPU scheduling them gets no guarantee
>>>> they will run on the same CPU.
>>>
>>> Something does not add up.
>>>
>>> The synchronous call to phy_state_machine() does:
>>>
>>>     case PHY_HALTED:
>>>         if (phydev->link) {
>>>             phydev->link = 0;
>>>             netif_carrier_off(phydev->attached_dev);
>>>             phy_adjust_link(phydev);
>>>             do_suspend = true;
>>>         }
>>>
>>> then sets phydev->link = 0; therefore subsequent calls to
>>> phy_state_machin() will be no-op.
>>
>> Actually you are right, once phydev->link is set to 0 these would become
>> no-ops. Still scratching my head as to what happens for David then...
>>
>>>
>>> Also, queue_delayed_work() is only called in polling mode.
>>> David stated that he's using interrupt mode.
>>
>> Right that's confusing too now. David can you check if you tree has:
>>
>> 49d52e8108a21749dc2114b924c907db43358984 ("net: phy: handle state
>> correctly in phy_stop_machine")
> 
> Hello David,
> 
> A week ago, you wrote about my patch:
> "This is broken.  Please revert."
> 
> I assume you tested the revert locally, and that reverting did make
> the crash disappear. Is that correct?
> 

Yes, I always test things before making this type of assertion.


> The reason I ask is because the analysis you provided contains some
> flaws, as noted above. But, if reverting my patch did fix your issue,
> then perhaps understanding *why* is unimportant.

I didn't want to take the time to generate calling sequence traces to 
verify each step of my analysis, but I believe the overall concept is 
essentially correct.

Once the polling work is canceled and we set a bunch of essential 
pointers to NULL, you cannot go blindly restarting the polling.

> 
> I'm a bit baffled that it took less than 90 minutes for your request
> to be approved, and the patch reverted in all branches, before I even
> had a chance to comment.
> 

o The last chance for patches to v4.13 was fast approaching.

o There were multiple reports of failures caused by the patch.

o The patch was clearly stand-alone.

The kernel maintainers are a model of efficiency, there was no reason to 
delay.

^ permalink raw reply

* Re: [PATCH net] Revert "net: phy: Correctly process PHY_HALTED in phy_stop_machine()"
From: David Daney @ 2017-09-06 18:00 UTC (permalink / raw)
  To: Florian Fainelli, Mason
  Cc: Marc Gonzalez, netdev, Geert Uytterhoeven, David Miller,
	Andrew Lunn, Mans Rullgard
In-Reply-To: <4ea8b432-4968-1616-eff9-48a2689dd3ce@gmail.com>

On 08/31/2017 11:29 AM, Florian Fainelli wrote:
> On 08/31/2017 11:12 AM, Mason wrote:
>> On 31/08/2017 19:53, Florian Fainelli wrote:
>>> On 08/31/2017 10:49 AM, Mason wrote:
>>>> On 31/08/2017 18:57, Florian Fainelli wrote:
>>>>> And the race is between phy_detach() setting phydev->attached_dev = NULL
>>>>> and phy_state_machine() running in PHY_HALTED state and calling
>>>>> netif_carrier_off().
>>>>
>>>> I must be missing something.
>>>> (Since a thread cannot race against itself.)
>>>>
>>>> phy_disconnect calls phy_stop_machine which
>>>> 1) stops the work queue from running in a separate thread
>>>> 2) calls phy_state_machine *synchronously*
>>>>       which runs the PHY_HALTED case with everything well-defined
>>>> end of phy_stop_machine
>>>>
>>>> phy_disconnect only then calls phy_detach()
>>>> which makes future calls of phy_state_machine perilous.
>>>>
>>>> This all happens in the same thread, so I'm not yet
>>>> seeing where the race happens?
>>>
>>> The race is as described in David's earlier email, so let's recap:
>>>
>>> Thread 1			Thread 2
>>> phy_disconnect()
>>> phy_stop_interrupts()
>>> phy_stop_machine()
>>> phy_state_machine()
>>>   -> queue_delayed_work()
>>> phy_detach()
>>> 				phy_state_machine()
>>> 				-> netif_carrier_off()
>>>
>>> If phy_detach() finishes earlier than the workqueue had a chance to be
>>> scheduled and process PHY_HALTED again, then we trigger the NULL pointer
>>> de-reference.
>>>
>>> workqueues are not tasklets, the CPU scheduling them gets no guarantee
>>> they will run on the same CPU.
>>
>> Something does not add up.
>>
>> The synchronous call to phy_state_machine() does:
>>
>> 	case PHY_HALTED:
>> 		if (phydev->link) {
>> 			phydev->link = 0;
>> 			netif_carrier_off(phydev->attached_dev);
>> 			phy_adjust_link(phydev);
>> 			do_suspend = true;
>> 		}
>>
>> then sets phydev->link = 0; therefore subsequent calls to
>> phy_state_machin() will be no-op.
> 
> Actually you are right, once phydev->link is set to 0 these would become
> no-ops. Still scratching my head as to what happens for David then...
> 
>>
>> Also, queue_delayed_work() is only called in polling mode.
>> David stated that he's using interrupt mode.

Did you see what I wrote?

phy_disconnect() calls phy_stop_interrupts() which puts it into polling 
mode.  So the polling work gets queued unconditionally.



> 
> Right that's confusing too now. David can you check if you tree has:
> 
> 49d52e8108a21749dc2114b924c907db43358984 ("net: phy: handle state
> correctly in phy_stop_machine")
> 

Yes, I am using the 4.9 stable branch, and that commit was also present.

David.

^ permalink raw reply

* Re: [PATCH net-next RFC 2/2] tun: enable napi_gro_frags() for TUN/TAP driver
From: Eric Dumazet @ 2017-09-06 18:01 UTC (permalink / raw)
  To: Petar Penkov
  Cc: netdev, Eric Dumazet, Mahesh Bandewar, Willem de Bruijn, davem,
	ppenkov
In-Reply-To: <20170905223551.27925-3-ppenkov@google.com>

On Tue, 2017-09-05 at 15:35 -0700, Petar Penkov wrote:
> Add a TUN/TAP receive mode that exercises the napi_gro_frags()
> interface. This mode is available only in TAP mode, as the interface
> expects packets with Ethernet headers.
> 


Hi Petar, thanks a lot for this work.

I must confess I have to retract one feedback I gave while reviewing
your patches.


> +		local_bh_disable();
> +		data = napi_alloc_frag(fragsz);
> +		local_bh_enable();
> +		if (!data) {
> +			err = -ENOMEM;
> +			goto free;
> +		}
> +
> +		page = virt_to_page(data);
> +		offset = offset_in_page(data);

These two lines above indeed trigger too many problems in the kernel.
(Like the one you tried to cover here
https://patchwork.kernel.org/patch/9927927/ )

Please use for your next submission the code you originally had :

	page = virt_to_head_page(data);
	offset = data - page_address(page);


Thanks !

^ permalink raw reply

* Re: [PATCH net-next] xdp: implement xdp_redirect_map for generic XDP
From: Jesper Dangaard Brouer @ 2017-09-06 18:18 UTC (permalink / raw)
  To: Daniel Borkmann
  Cc: netdev, David S. Miller, John Fastabend, Andy Gospodarek, brouer
In-Reply-To: <59B02127.5020904@iogearbox.net>

On Wed, 06 Sep 2017 18:24:07 +0200
Daniel Borkmann <daniel@iogearbox.net> wrote:

> On 09/06/2017 05:26 PM, Jesper Dangaard Brouer wrote:
> > Using bpf_redirect_map is allowed for generic XDP programs, but the
> > appropriate map lookup was never performed in xdp_do_generic_redirect().
> >
> > Instead the map-index is directly used as the ifindex.  For the  
> 
> Good point, but ...
> 
> [...]
> >   net/core/filter.c |   29 +++++++++++++++++++++++++++++
> >   1 file changed, 29 insertions(+)
> >
> > diff --git a/net/core/filter.c b/net/core/filter.c
> > index 5912c738a7b2..6a4745bf2c9f 100644
> > --- a/net/core/filter.c
> > +++ b/net/core/filter.c
> > @@ -2562,6 +2562,32 @@ int xdp_do_redirect(struct net_device *dev, struct xdp_buff *xdp,
> >   }
> >   EXPORT_SYMBOL_GPL(xdp_do_redirect);
> >
> > +static int xdp_do_generic_redirect_map(struct net_device *dev,
> > +				       struct sk_buff *skb,
> > +				       struct bpf_prog *xdp_prog)
> > +{
> > +	struct redirect_info *ri = this_cpu_ptr(&redirect_info);
> > +	struct bpf_map *map = ri->map;
> > +	u32 index = ri->ifindex;
> > +	struct net_device *fwd;
> > +	int err;
> > +
> > +	ri->ifindex = 0;
> > +	ri->map = NULL;
> > +
> > +	fwd = __dev_map_lookup_elem(map, index);
> > +	if (!fwd) {
> > +		err = -EINVAL;
> > +		goto err;
> > +	}
> > +	skb->dev = fwd;
> > +	_trace_xdp_redirect_map(dev, xdp_prog, fwd, map, index);
> > +	return 0;
> > +err:
> > +	_trace_xdp_redirect_map_err(dev, xdp_prog, fwd, map, index, err);
> > +	return err;
> > +}
> > +
> >   int xdp_do_generic_redirect(struct net_device *dev, struct sk_buff *skb,
> >   			    struct bpf_prog *xdp_prog)
> >   {
> > @@ -2571,6 +2597,9 @@ int xdp_do_generic_redirect(struct net_device *dev, struct sk_buff *skb,
> >   	unsigned int len;
> >   	int err = 0;
> >
> > +	if (ri->map)
> > +		return xdp_do_generic_redirect_map(dev, skb, xdp_prog);  
> 
> This is not quite correct. Really, the only thing you want
> to do here is more or less ...
> 
> int xdp_do_generic_redirect(struct net_device *dev, struct sk_buff *skb,
> 			    struct bpf_prog *xdp_prog)
> {
> 	struct redirect_info *ri = this_cpu_ptr(&redirect_info);
> 	struct bpf_map *map = ri->map;
> 	u32 index = ri->ifindex;
> 	struct net_device *fwd;
> 	unsigned int len;
> 	int err = 0;
> 
> 	ri->ifindex = 0;
> 	ri->map = NULL;
> 
> 	if (map)
> 		fwd = __dev_map_lookup_elem(map, index);
> 	else
> 		fwd = dev_get_by_index_rcu(dev_net(dev), index);
> 	if (unlikely(!fwd)) {
> 		err = -EINVAL;
> 		goto err;
> 	}
> [...]
> 
> ... such that you have a common path to also do the IFF_UP
> and MTU checks that are done here, but otherwise omitted in
> your patch.

Ah, yes. My patch miss the IFF_UP and MTU check. (I was too inspired by
xdp_do_redirect_map).


> Otherwise it looks good, but note that it also doesn't really
> resolve the issue you mention wrt stale map pointers by the
> way.  [...]

I actually discovered more cases where we can crash the kernel :-(

E.g. driver not supporting XDP_REDIRECT, are still allowed to load an
XDP bpf_prog that call bpf_redirect_map() and set the ->map pointer,
but it will never call xdp_do_redirect() (which is responsible for
clearing/consuming ->map pointer).

Another case: You can also call bpf_redirect_map() and then NOT return
XDP_REDIRECT (it is obviously strange, but the bpf-helper API allows it).

-- 
Best regards,
  Jesper Dangaard Brouer
  MSc.CS, Principal Kernel Engineer at Red Hat
  LinkedIn: http://www.linkedin.com/in/brouer

^ permalink raw reply

* Re: [PATCH v2 rfc 0/8] IGMP snooping for local traffic
From: Vivien Didelot @ 2017-09-06 18:29 UTC (permalink / raw)
  To: Andrew Lunn; +Cc: netdev, jiri, nikolay, Florian Fainelli
In-Reply-To: <20170906170120.GF15315@lunn.ch>

Hi Andrew,

Andrew Lunn <andrew@lunn.ch> writes:

>> I don't understand why SWITCHDEV_OBJ_ID_PORT_MDB cannot be used. Isn't
>> setting the obj->orig_dev to the bridge device itself enough to
>> distinguish br0 from a switch port?
>
> I did consider this. But conceptually, it seems wrong.
> SWITCHDEV_OBJ_ID_PORT_MDB has always been about egress. I don't like
> adding a special case for ingress. Adding a new switchdev object
> avoids this special case.

SWITCHDEV_OBJ_ID_PORT_MDB means manipulating an MDB entry on a port.
When one want to add an MDB entry to br0, SWITCHDEV_OBJ_ID_PORT_MDB is
used. If the device is br->dev, the lower devices (bridged ports) get
recursively notified and switchdev users can program themselves
accordingly. In the case of DSA, a slave port will program its
associated CPU port (port->cpu_dp) if orig_dev is a bridge.

This seems totally correct to me. I don't see any reason for adding and
maintaining a new switchdev object. What do switchdev guys think?

>> The main problem is that we will soon want support for multiple CPU
>> ports.
>
> We keep saying that, but it never actually happens. We should solve
> multiple CPU problems when we actually add support for multiple CPUs.
> Probably at that point, we need to push SWITCHDEV_OBJ_ID_PORT_HOST_MDB
> right down to a port, so that port can setup what needs setting up so
> its frames goes to its CPU port.

This is not correct. I am currently making this easier, i.e. the
dsa_master patchset I sent before net-next closed.

I do understand your point however and even if this multi-CPU feature
takes time to arrive, we can always find a proper design which makes it
easy. Assuming that each port has its dedicated CPU port is the correct
concept to follow.

>> So adding the MDB entry to all CPU ports as you did in a patch 5/8 in
>> dsa_switch_host_mdb_*() is not correct because you can have CPU port
>> sw0p0 being a member of br0 and CPU port sw0p10 being a member of br1.
>
> Be careful, you are making assumptions about mapping cpu ports to
> bridges. That is not been defined yet.

I am not making any assumptions, but you did because you assume that all
CPU ports will be part of the same bridge.

We need to handle things at the DSA core level the following way:

If one programs the bridge device itself, a switchdev object is
notified, and each DSA slave devices member of the bridge will call the
correct dsa_port_* function (agnostic to the port type) with its cpu_dp.

This covers cleanly all cases. You also don't need any new DSA notifier.
You only need your 6/8 patch. To acheive that, there is two ways:

1) either we keep SWITCHDEV_OBJ_ID_PORT_MDB for the bridge device itself
and the slave devices are notified accordingly with a correct orig_dev:

    static int dsa_slave_port_obj_add(struct net_device *dev,
                                      const struct switchdev_obj *obj,
                                      struct switchdev_trans *trans)
    {
            struct dsa_slave_priv *p = netdev_priv(dev);
            struct dsa_port *port = p->dp;
    
            /* Program the CPU port if the target is the bridge itself */
            if (obj->orig_dev == port->br)
                    port = port->cpu_dp;
    
            switch (obj->id) {
            case SWITCHDEV_OBJ_ID_PORT_MDB:
                return dsa_port_mdb_add(port, obj, trans);
            ...
            }
    }

2) or you introduce a switchdev object which, by definition, targets the
CPU ports of our bridge members:

    static int dsa_slave_port_obj_add(struct net_device *dev,
                                      const struct switchdev_obj *obj,
                                      struct switchdev_trans *trans)
    {
            struct dsa_slave_priv *p = netdev_priv(dev);
            struct dsa_port *port = p->dp;

            switch (obj->id) {
            case SWITCHDEV_OBJ_ID_PORT_HOST_MDB:
                port = port->cpu_dp;
                /* fall through... */
            case SWITCHDEV_OBJ_ID_PORT_MDB:
                return dsa_port_mdb_add(port, obj, trans);
            ...
            }
    }

You basically just need that and your 6/8 patch for the DSA part.


Thanks,

        Vivien

^ permalink raw reply

* Re: [PATCH net-next] xdp: implement xdp_redirect_map for generic XDP
From: John Fastabend @ 2017-09-06 18:42 UTC (permalink / raw)
  To: Jesper Dangaard Brouer, Daniel Borkmann
  Cc: netdev, David S. Miller, Andy Gospodarek
In-Reply-To: <20170906201835.7bc26f4f@redhat.com>

On 09/06/2017 11:18 AM, Jesper Dangaard Brouer wrote:
> On Wed, 06 Sep 2017 18:24:07 +0200
> Daniel Borkmann <daniel@iogearbox.net> wrote:
> 
>> On 09/06/2017 05:26 PM, Jesper Dangaard Brouer wrote:
>>> Using bpf_redirect_map is allowed for generic XDP programs, but the
>>> appropriate map lookup was never performed in xdp_do_generic_redirect().
>>>
>>> Instead the map-index is directly used as the ifindex.  For the  
>>
>> Good point, but ...
>>
>> [...]
>>>   net/core/filter.c |   29 +++++++++++++++++++++++++++++
>>>   1 file changed, 29 insertions(+)
>>>
>>> diff --git a/net/core/filter.c b/net/core/filter.c
>>> index 5912c738a7b2..6a4745bf2c9f 100644
>>> --- a/net/core/filter.c
>>> +++ b/net/core/filter.c
>>> @@ -2562,6 +2562,32 @@ int xdp_do_redirect(struct net_device *dev, struct xdp_buff *xdp,
>>>   }
>>>   EXPORT_SYMBOL_GPL(xdp_do_redirect);
>>>
>>> +static int xdp_do_generic_redirect_map(struct net_device *dev,
>>> +				       struct sk_buff *skb,
>>> +				       struct bpf_prog *xdp_prog)
>>> +{
>>> +	struct redirect_info *ri = this_cpu_ptr(&redirect_info);
>>> +	struct bpf_map *map = ri->map;
>>> +	u32 index = ri->ifindex;
>>> +	struct net_device *fwd;
>>> +	int err;
>>> +
>>> +	ri->ifindex = 0;
>>> +	ri->map = NULL;
>>> +
>>> +	fwd = __dev_map_lookup_elem(map, index);
>>> +	if (!fwd) {
>>> +		err = -EINVAL;
>>> +		goto err;
>>> +	}
>>> +	skb->dev = fwd;
>>> +	_trace_xdp_redirect_map(dev, xdp_prog, fwd, map, index);
>>> +	return 0;
>>> +err:
>>> +	_trace_xdp_redirect_map_err(dev, xdp_prog, fwd, map, index, err);
>>> +	return err;
>>> +}
>>> +
>>>   int xdp_do_generic_redirect(struct net_device *dev, struct sk_buff *skb,
>>>   			    struct bpf_prog *xdp_prog)
>>>   {
>>> @@ -2571,6 +2597,9 @@ int xdp_do_generic_redirect(struct net_device *dev, struct sk_buff *skb,
>>>   	unsigned int len;
>>>   	int err = 0;
>>>
>>> +	if (ri->map)
>>> +		return xdp_do_generic_redirect_map(dev, skb, xdp_prog);  
>>
>> This is not quite correct. Really, the only thing you want
>> to do here is more or less ...
>>
>> int xdp_do_generic_redirect(struct net_device *dev, struct sk_buff *skb,
>> 			    struct bpf_prog *xdp_prog)
>> {
>> 	struct redirect_info *ri = this_cpu_ptr(&redirect_info);
>> 	struct bpf_map *map = ri->map;
>> 	u32 index = ri->ifindex;
>> 	struct net_device *fwd;
>> 	unsigned int len;
>> 	int err = 0;
>>
>> 	ri->ifindex = 0;
>> 	ri->map = NULL;
>>
>> 	if (map)
>> 		fwd = __dev_map_lookup_elem(map, index);
>> 	else
>> 		fwd = dev_get_by_index_rcu(dev_net(dev), index);
>> 	if (unlikely(!fwd)) {
>> 		err = -EINVAL;
>> 		goto err;
>> 	}
>> [...]
>>
>> ... such that you have a common path to also do the IFF_UP
>> and MTU checks that are done here, but otherwise omitted in
>> your patch.
> 
> Ah, yes. My patch miss the IFF_UP and MTU check. (I was too inspired by
> xdp_do_redirect_map).
> 
> 
>> Otherwise it looks good, but note that it also doesn't really
>> resolve the issue you mention wrt stale map pointers by the
>> way.  [...]
> 
> I actually discovered more cases where we can crash the kernel :-(
> 
> E.g. driver not supporting XDP_REDIRECT, are still allowed to load an
> XDP bpf_prog that call bpf_redirect_map() and set the ->map pointer,
> but it will never call xdp_do_redirect() (which is responsible for
> clearing/consuming ->map pointer).
> 
> Another case: You can also call bpf_redirect_map() and then NOT return
> XDP_REDIRECT (it is obviously strange, but the bpf-helper API allows it).
> 

I think we can cover both these cases with previous suggestion to check
prog pointers. Working up a patch now.

^ permalink raw reply

* Re: [PATCH net-next] xdp: implement xdp_redirect_map for generic XDP
From: Daniel Borkmann @ 2017-09-06 18:51 UTC (permalink / raw)
  To: John Fastabend, Jesper Dangaard Brouer
  Cc: netdev, David S. Miller, Andy Gospodarek
In-Reply-To: <59B0418A.5090609@gmail.com>

On 09/06/2017 08:42 PM, John Fastabend wrote:
> On 09/06/2017 11:18 AM, Jesper Dangaard Brouer wrote:
>> On Wed, 06 Sep 2017 18:24:07 +0200
>> Daniel Borkmann <daniel@iogearbox.net> wrote:
>>> On 09/06/2017 05:26 PM, Jesper Dangaard Brouer wrote:
>>>> Using bpf_redirect_map is allowed for generic XDP programs, but the
>>>> appropriate map lookup was never performed in xdp_do_generic_redirect().
>>>>
>>>> Instead the map-index is directly used as the ifindex.  For the
>>>
>>> Good point, but ...
>>>
>>> [...]
>>>>    net/core/filter.c |   29 +++++++++++++++++++++++++++++
>>>>    1 file changed, 29 insertions(+)
>>>>
>>>> diff --git a/net/core/filter.c b/net/core/filter.c
>>>> index 5912c738a7b2..6a4745bf2c9f 100644
>>>> --- a/net/core/filter.c
>>>> +++ b/net/core/filter.c
>>>> @@ -2562,6 +2562,32 @@ int xdp_do_redirect(struct net_device *dev, struct xdp_buff *xdp,
>>>>    }
>>>>    EXPORT_SYMBOL_GPL(xdp_do_redirect);
>>>>
>>>> +static int xdp_do_generic_redirect_map(struct net_device *dev,
>>>> +				       struct sk_buff *skb,
>>>> +				       struct bpf_prog *xdp_prog)
>>>> +{
>>>> +	struct redirect_info *ri = this_cpu_ptr(&redirect_info);
>>>> +	struct bpf_map *map = ri->map;
>>>> +	u32 index = ri->ifindex;
>>>> +	struct net_device *fwd;
>>>> +	int err;
>>>> +
>>>> +	ri->ifindex = 0;
>>>> +	ri->map = NULL;
>>>> +
>>>> +	fwd = __dev_map_lookup_elem(map, index);
>>>> +	if (!fwd) {
>>>> +		err = -EINVAL;
>>>> +		goto err;
>>>> +	}
>>>> +	skb->dev = fwd;
>>>> +	_trace_xdp_redirect_map(dev, xdp_prog, fwd, map, index);
>>>> +	return 0;
>>>> +err:
>>>> +	_trace_xdp_redirect_map_err(dev, xdp_prog, fwd, map, index, err);
>>>> +	return err;
>>>> +}
>>>> +
>>>>    int xdp_do_generic_redirect(struct net_device *dev, struct sk_buff *skb,
>>>>    			    struct bpf_prog *xdp_prog)
>>>>    {
>>>> @@ -2571,6 +2597,9 @@ int xdp_do_generic_redirect(struct net_device *dev, struct sk_buff *skb,
>>>>    	unsigned int len;
>>>>    	int err = 0;
>>>>
>>>> +	if (ri->map)
>>>> +		return xdp_do_generic_redirect_map(dev, skb, xdp_prog);
>>>
>>> This is not quite correct. Really, the only thing you want
>>> to do here is more or less ...
>>>
>>> int xdp_do_generic_redirect(struct net_device *dev, struct sk_buff *skb,
>>> 			    struct bpf_prog *xdp_prog)
>>> {
>>> 	struct redirect_info *ri = this_cpu_ptr(&redirect_info);
>>> 	struct bpf_map *map = ri->map;
>>> 	u32 index = ri->ifindex;
>>> 	struct net_device *fwd;
>>> 	unsigned int len;
>>> 	int err = 0;
>>>
>>> 	ri->ifindex = 0;
>>> 	ri->map = NULL;
>>>
>>> 	if (map)
>>> 		fwd = __dev_map_lookup_elem(map, index);
>>> 	else
>>> 		fwd = dev_get_by_index_rcu(dev_net(dev), index);
>>> 	if (unlikely(!fwd)) {
>>> 		err = -EINVAL;
>>> 		goto err;
>>> 	}
>>> [...]
>>>
>>> ... such that you have a common path to also do the IFF_UP
>>> and MTU checks that are done here, but otherwise omitted in
>>> your patch.
>>
>> Ah, yes. My patch miss the IFF_UP and MTU check. (I was too inspired by
>> xdp_do_redirect_map).
>>
>>> Otherwise it looks good, but note that it also doesn't really
>>> resolve the issue you mention wrt stale map pointers by the
>>> way.  [...]
>>
>> I actually discovered more cases where we can crash the kernel :-(
>>
>> E.g. driver not supporting XDP_REDIRECT, are still allowed to load an
>> XDP bpf_prog that call bpf_redirect_map() and set the ->map pointer,
>> but it will never call xdp_do_redirect() (which is responsible for
>> clearing/consuming ->map pointer).
>>
>> Another case: You can also call bpf_redirect_map() and then NOT return
>> XDP_REDIRECT (it is obviously strange, but the bpf-helper API allows it).
>
> I think we can cover both these cases with previous suggestion to check
> prog pointers. Working up a patch now.

Yep, they would both be covered.

^ permalink raw reply

* Re: [PATCH net] Revert "net: phy: Correctly process PHY_HALTED in phy_stop_machine()"
From: Florian Fainelli @ 2017-09-06 18:59 UTC (permalink / raw)
  To: David Daney, Mason
  Cc: Marc Gonzalez, netdev, Geert Uytterhoeven, David Miller,
	Andrew Lunn, Mans Rullgard
In-Reply-To: <ff070239-28b7-d41b-8abe-c9f810561372@caviumnetworks.com>

On 09/06/2017 11:00 AM, David Daney wrote:
> On 08/31/2017 11:29 AM, Florian Fainelli wrote:
>> On 08/31/2017 11:12 AM, Mason wrote:
>>> On 31/08/2017 19:53, Florian Fainelli wrote:
>>>> On 08/31/2017 10:49 AM, Mason wrote:
>>>>> On 31/08/2017 18:57, Florian Fainelli wrote:
>>>>>> And the race is between phy_detach() setting phydev->attached_dev
>>>>>> = NULL
>>>>>> and phy_state_machine() running in PHY_HALTED state and calling
>>>>>> netif_carrier_off().
>>>>>
>>>>> I must be missing something.
>>>>> (Since a thread cannot race against itself.)
>>>>>
>>>>> phy_disconnect calls phy_stop_machine which
>>>>> 1) stops the work queue from running in a separate thread
>>>>> 2) calls phy_state_machine *synchronously*
>>>>>       which runs the PHY_HALTED case with everything well-defined
>>>>> end of phy_stop_machine
>>>>>
>>>>> phy_disconnect only then calls phy_detach()
>>>>> which makes future calls of phy_state_machine perilous.
>>>>>
>>>>> This all happens in the same thread, so I'm not yet
>>>>> seeing where the race happens?
>>>>
>>>> The race is as described in David's earlier email, so let's recap:
>>>>
>>>> Thread 1            Thread 2
>>>> phy_disconnect()
>>>> phy_stop_interrupts()
>>>> phy_stop_machine()
>>>> phy_state_machine()
>>>>   -> queue_delayed_work()
>>>> phy_detach()
>>>>                 phy_state_machine()
>>>>                 -> netif_carrier_off()
>>>>
>>>> If phy_detach() finishes earlier than the workqueue had a chance to be
>>>> scheduled and process PHY_HALTED again, then we trigger the NULL
>>>> pointer
>>>> de-reference.
>>>>
>>>> workqueues are not tasklets, the CPU scheduling them gets no guarantee
>>>> they will run on the same CPU.
>>>
>>> Something does not add up.
>>>
>>> The synchronous call to phy_state_machine() does:
>>>
>>>     case PHY_HALTED:
>>>         if (phydev->link) {
>>>             phydev->link = 0;
>>>             netif_carrier_off(phydev->attached_dev);
>>>             phy_adjust_link(phydev);
>>>             do_suspend = true;
>>>         }
>>>
>>> then sets phydev->link = 0; therefore subsequent calls to
>>> phy_state_machin() will be no-op.
>>
>> Actually you are right, once phydev->link is set to 0 these would become
>> no-ops. Still scratching my head as to what happens for David then...
>>
>>>
>>> Also, queue_delayed_work() is only called in polling mode.
>>> David stated that he's using interrupt mode.
> 
> Did you see what I wrote?

Still not following, see below.

> 
> phy_disconnect() calls phy_stop_interrupts() which puts it into polling
> mode.  So the polling work gets queued unconditionally.

What part of phy_stop_interrupts() is responsible for changing
phydev->irq to PHY_POLL? free_irq() cannot touch phydev->irq otherwise
subsequent request_irq() calls won't work anymore.
phy_disable_interrupts() only calls back into the PHY driver to
acknowledge and clear interrupts.

If we were using a PHY with PHY_POLL, as Marc said, the first
synchronous call to phy_state_machine() would have acted on PHY_HALTED
and even if we incorrectly keep re-scheduling the state machine from
PHY_HALTED to PHY_HALTED the second time around nothing can happen.

What are we missing here?

> 
> 
> 
>>
>> Right that's confusing too now. David can you check if you tree has:
>>
>> 49d52e8108a21749dc2114b924c907db43358984 ("net: phy: handle state
>> correctly in phy_stop_machine")
>>
> 
> Yes, I am using the 4.9 stable branch, and that commit was also present.

Thanks for checking that.
-- 
Florian

^ permalink raw reply

* Re: [pull request][net-next 0/3] Mellanox, mlx5 GRE tunnel offloads
From: Tom Herbert @ 2017-09-06 19:01 UTC (permalink / raw)
  To: Alexander Duyck
  Cc: Hannes Frederic Sowa, Saeed Mahameed, Saeed Mahameed,
	David S. Miller, Linux Netdev List
In-Reply-To: <CAKgT0UeK0njpy1unJUV+=-JGOHTEZCJu0mNd-UuX8aO2G2zKmQ@mail.gmail.com>

On Wed, Sep 6, 2017 at 10:43 AM, Alexander Duyck
<alexander.duyck@gmail.com> wrote:
> On Wed, Sep 6, 2017 at 9:17 AM, Tom Herbert <tom@herbertland.com> wrote:
>> On Tue, Sep 5, 2017 at 8:06 PM, Alexander Duyck
>> <alexander.duyck@gmail.com> wrote:
>>> On Tue, Sep 5, 2017 at 2:13 PM, Tom Herbert <tom@herbertland.com> wrote:
>>>>> The situation with encapsulation is even more complicated:
>>>>>
>>>>> We are basically only interested in the UDP/vxlan/Ethernet/IP/UDP
>>>>> constellation. If we do the fragmentation inside the vxlan tunnel and
>>>>> carry over the skb hash to all resulting UDP/vxlan packets source ports,
>>>>> we are fine and reordering on the receiver NIC won't happen in this
>>>>> case. If the fragmentation happens on the outer UDP header, this will
>>>>> result in reordering of the inner L2 flow. Unfortunately this depends on
>>>>> how the vxlan tunnel was set up, how other devices do that and (I
>>>>> believe so) on the kernel version.
>>>>>
>>>> This really isn't that complicated. The assumption that an IP network
>>>> always delivers packets in order is simply wrong. The inventors of
>>>> VXLAN must have know full well that when you use IP, packets can and
>>>> eventually will be delivered out of order. This isn't just because of
>>>> fragmentation, there are many other reasons that packets can be
>>>> delivered OOO. This also must have been known when IP/GRE and any
>>>> other protocol that carries L2 over IP was invented. If OOO is an
>>>> issue for these protocols then they need to be fixed-- this is not a
>>>> concern with IP protocol nor the stack.
>>>>
>>>> Tom
>>>
>>> As far as a little background on the original patch I believe the
>>> issue that was fixed by the patch was a video streaming application
>>> that was sending/receiving a mix of fragmented and non-fragmented
>>> packets. Receiving them out of order due to the fragmentation was
>>> causing issues with stutters in the video and so we ended up disabling
>>> UDP by default in the NICs listed. We decided to go that way as UDP
>>> RSS was viewed as a performance optimization, while the out-of-order
>>> problems were viewed as a functionality issue.
>>>
>> Hi Alex,
>>
>> Thanks for the details! Were you able to find the root cause for this?
>> In particular, it would be interesting to know if it is the kernel or
>> device that introduced the jitter, or if it's the application that
>> doesn't handle OOO well...
>>
>> Tom
>
> It is hard to say since my memory of the events from 7 years ago is
> pretty vague at this point, but I'm pretty sure it was the
> application. Basically getting the frames out of order was causing
> them to have to drop video data if I recall correctly.
>
Oh, I didn't notice that patch was from 2010. Maybe the application
has been fixed by now! :-)

Perhaps, it's time to try to turn UDP hashing on again by default?
Even if NICs aren't doing this, there are network devices that are
looking at UDP for ECMP and that doesn't seem to be causing widespread
problems currently...

Tom

^ permalink raw reply

* Re: [PATCH net] Revert "net: phy: Correctly process PHY_HALTED in phy_stop_machine()"
From: Mason @ 2017-09-06 19:14 UTC (permalink / raw)
  To: David Daney, Florian Fainelli
  Cc: Marc Gonzalez, netdev, Geert Uytterhoeven, David Miller,
	Andrew Lunn, Mans Rullgard
In-Reply-To: <ff070239-28b7-d41b-8abe-c9f810561372@caviumnetworks.com>

On 06/09/2017 20:00, David Daney wrote:
> On 08/31/2017 11:29 AM, Florian Fainelli wrote:
>> On 08/31/2017 11:12 AM, Mason wrote:
>>> On 31/08/2017 19:53, Florian Fainelli wrote:
>>>> On 08/31/2017 10:49 AM, Mason wrote:
>>>>> On 31/08/2017 18:57, Florian Fainelli wrote:
>>>>>> And the race is between phy_detach() setting phydev->attached_dev = NULL
>>>>>> and phy_state_machine() running in PHY_HALTED state and calling
>>>>>> netif_carrier_off().
>>>>>
>>>>> I must be missing something.
>>>>> (Since a thread cannot race against itself.)
>>>>>
>>>>> phy_disconnect calls phy_stop_machine which
>>>>> 1) stops the work queue from running in a separate thread
>>>>> 2) calls phy_state_machine *synchronously*
>>>>>       which runs the PHY_HALTED case with everything well-defined
>>>>> end of phy_stop_machine
>>>>>
>>>>> phy_disconnect only then calls phy_detach()
>>>>> which makes future calls of phy_state_machine perilous.
>>>>>
>>>>> This all happens in the same thread, so I'm not yet
>>>>> seeing where the race happens?
>>>>
>>>> The race is as described in David's earlier email, so let's recap:
>>>>
>>>> Thread 1			Thread 2
>>>> phy_disconnect()
>>>> phy_stop_interrupts()
>>>> phy_stop_machine()
>>>> phy_state_machine()
>>>>   -> queue_delayed_work()
>>>> phy_detach()
>>>> 				phy_state_machine()
>>>> 				-> netif_carrier_off()
>>>>
>>>> If phy_detach() finishes earlier than the workqueue had a chance to be
>>>> scheduled and process PHY_HALTED again, then we trigger the NULL pointer
>>>> de-reference.
>>>>
>>>> workqueues are not tasklets, the CPU scheduling them gets no guarantee
>>>> they will run on the same CPU.
>>>
>>> Something does not add up.
>>>
>>> The synchronous call to phy_state_machine() does:
>>>
>>> 	case PHY_HALTED:
>>> 		if (phydev->link) {
>>> 			phydev->link = 0;
>>> 			netif_carrier_off(phydev->attached_dev);
>>> 			phy_adjust_link(phydev);
>>> 			do_suspend = true;
>>> 		}
>>>
>>> then sets phydev->link = 0; therefore subsequent calls to
>>> phy_state_machin() will be no-op.
>>
>> Actually you are right, once phydev->link is set to 0 these would become
>> no-ops. Still scratching my head as to what happens for David then...
>>
>>>
>>> Also, queue_delayed_work() is only called in polling mode.
>>> David stated that he's using interrupt mode.
> 
> Did you see what I wrote?
> 
> phy_disconnect() calls phy_stop_interrupts() which puts it into polling 
> mode.  So the polling work gets queued unconditionally.

I did address that remark in
https://www.mail-archive.com/netdev@vger.kernel.org/msg186336.html

int phy_stop_interrupts(struct phy_device *phydev)
{
	int err = phy_disable_interrupts(phydev);

	if (err)
		phy_error(phydev);

	free_irq(phydev->irq, phydev);

	/* If work indeed has been cancelled, disable_irq() will have
	 * been left unbalanced from phy_interrupt() and enable_irq()
	 * has to be called so that other devices on the line work.
	 */
	while (atomic_dec_return(&phydev->irq_disable) >= 0)
		enable_irq(phydev->irq);

	return err;
}

Which part of this function changes phydev->irq to PHY_POLL?

Perhaps phydev->drv->config_intr?

What PHY are you using?

Regards.

^ permalink raw reply

* Re: [PATCH net] Revert "net: phy: Correctly process PHY_HALTED in phy_stop_machine()"
From: Florian Fainelli @ 2017-09-06 19:28 UTC (permalink / raw)
  To: Mason
  Cc: Marc Gonzalez, David Daney, netdev, Geert Uytterhoeven,
	David Miller, Andrew Lunn, Mans Rullgard, Thibaud Cornic
In-Reply-To: <927413e9-4f1f-963c-2d3a-5a88de2eac9e@free.fr>

On 09/06/2017 07:55 AM, Mason wrote:
> On 31/08/2017 21:18, Florian Fainelli wrote:
> 
>> On 08/31/2017 12:09 PM, Mason wrote:
>>
>>> 1) nb8800_link_reconfigure() calls phy_print_status()
>>> which prints the "Link down" and "Link up" messages
>>> to the console. With the patch reverted, nothing is
>>> printed when the link goes down, and the result is
>>> random when the link comes up. Sometimes, we get
>>> down + up, sometimes just up.
>>
>> Nothing printed when you bring down the network interface as a result of
>> not signaling the link down, there is a small nuance here.
> 
> Let me first focus on the "Link down" message.
> 
> Do you agree that such a message should be printed when the
> link goes down, not when the link comes up?

The question is not so much about printing the message rather than a)
having the adjust_link callback be called and b) having this particular
callback correctly determine if a "change" has occurred, but let's focus
on the notification too. Printing the message is a consequence of these
two conditions and that's what matters.

There is not unfortunately a hard and fast answer it's clearly a
philosophical problem here.

The link is not physically down, the cable is still plugged so
generating a link down even is not necessarily correct. It would be
convenient for network manager programs, just like it is for network
drivers to treat it as such because that allows them to act like if the
cable was unplugged, which may be a good way to perform a number of
actions including but not limited to: entering a low power state,
re-initialization parts of the Ethernet MAC that need it (DMA, etc.,
etc.). That does not appear to be an absolute requirement for most, if
not all drivers since it changed after 3.4 and no one did bat an eye
about it.

Upon bringing the interface back up again, same thing, if the cable was
not disconnected should we just generate a link UP event, and if we do
that, are we going to confuse any network manager application?
Generating a link transition DOWN -> UP is certainly helpful for any
network application in that they do not need to keep any state just like
it clearly indicates a change was detected.

> 
> Perhaps the issue is that the 2 following cases need to be
> handled differently:
> A) operator sets link down on the command-line

This is already handled differently since when you administratively
bring down an interface you call ndo_stop() which will be doing a
phy_stop() + phy_disconnect() which result in stopping the PHY state
machine and disconnecting from the PHY.

> B) asynchronous event makes link go down (peer is dead, cable is cut, etc)
> 
> In B) the PHY state machine keeps on running, and eventually
> calls adjust_link()

Correct.

> 
> In A) the driver calls phy_stop() and phy_disconnect() and
> therefore adjust_link() will not be called?

That is the current behavior (after the revert) and we can always change
it if deemed necessary, problem is, this broke for two people (one still
being discussed as of right now), so at this point I am very wary of
making any changes without more testing. I really need to get one of
these PHY interrupts wired to one of my boards or create a software
model of such a configuration before accepting new changes in that area.

Thank you
-- 
Florian

^ permalink raw reply

* [wireless-testsing2:master 4/5] drivers/net//ethernet/marvell/mvpp2.c:7618:2: warning: passing argument 4 of 'mvpp2_port_copy_mac_addr' from incompatible pointer type
From: kbuild test robot @ 2017-09-06 19:30 UTC (permalink / raw)
  To: David S. Miller; +Cc: kbuild-all, netdev, Bob Copeland

[-- Attachment #1: Type: text/plain, Size: 16010 bytes --]

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/wireless/wireless-testing.git master
head:   d17be7f7503bf9492198a242779a68af93fd92de
commit: 96c03618031bae5e9068b16f9e437b79f98f6482 [4/5] Merge remote-tracking branch 'mac80211-next/master'
config: xtensa-allyesconfig (attached as .config)
compiler: xtensa-linux-gcc (GCC) 4.9.0
reproduce:
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        git checkout 96c03618031bae5e9068b16f9e437b79f98f6482
        # save the attached .config to linux build tree
        make.cross ARCH=xtensa 

All warnings (new ones prefixed by >>):

   drivers/net//ethernet/marvell/mvpp2.c: In function 'mvpp2_port_probe':
>> drivers/net//ethernet/marvell/mvpp2.c:7618:2: warning: passing argument 4 of 'mvpp2_port_copy_mac_addr' from incompatible pointer type
     mvpp2_port_copy_mac_addr(dev, priv, port_node, &mac_from);
     ^
   drivers/net//ethernet/marvell/mvpp2.c:7468:13: note: expected 'char **' but argument is of type 'const char **'
    static void mvpp2_port_copy_mac_addr(struct net_device *dev, struct mvpp2 *priv,
                ^
   drivers/net//ethernet/marvell/mvpp2.c:7509:7: warning: unused variable 'hw_mac_addr' [-Wunused-variable]
     char hw_mac_addr[ETH_ALEN] = {0};
          ^
   drivers/net//ethernet/marvell/mvpp2.c:7507:14: warning: unused variable 'dt_mac_addr' [-Wunused-variable]
     const char *dt_mac_addr;
                 ^

vim +/mvpp2_port_copy_mac_addr +7618 drivers/net//ethernet/marvell/mvpp2.c

3ba8c81e1 Antoine Tenart   2017-09-02  7495  
3f518509d Marcin Wojtas    2014-07-10  7496  /* Ports initialization */
3f518509d Marcin Wojtas    2014-07-10  7497  static int mvpp2_port_probe(struct platform_device *pdev,
3f518509d Marcin Wojtas    2014-07-10  7498  			    struct device_node *port_node,
59b9a31ed Thomas Petazzoni 2017-03-07  7499  			    struct mvpp2 *priv)
3f518509d Marcin Wojtas    2014-07-10  7500  {
3f518509d Marcin Wojtas    2014-07-10  7501  	struct device_node *phy_node;
542897d98 Antoine Tenart   2017-08-30  7502  	struct phy *comphy;
3f518509d Marcin Wojtas    2014-07-10  7503  	struct mvpp2_port *port;
edc660fa0 Marcin Wojtas    2015-08-06  7504  	struct mvpp2_port_pcpu *port_pcpu;
3f518509d Marcin Wojtas    2014-07-10  7505  	struct net_device *dev;
3f518509d Marcin Wojtas    2014-07-10  7506  	struct resource *res;
3f518509d Marcin Wojtas    2014-07-10  7507  	const char *dt_mac_addr;
96c036180 Bob Copeland     2017-09-04  7508  	const char *mac_from = "";
4c2286826 Antoine Tenart   2017-08-25  7509  	char hw_mac_addr[ETH_ALEN] = {0};
09f839755 Thomas Petazzoni 2017-08-03  7510  	unsigned int ntxqs, nrxqs;
213f428f5 Thomas Petazzoni 2017-08-03  7511  	bool has_tx_irqs;
3f518509d Marcin Wojtas    2014-07-10  7512  	u32 id;
3f518509d Marcin Wojtas    2014-07-10  7513  	int features;
3f518509d Marcin Wojtas    2014-07-10  7514  	int phy_mode;
edc660fa0 Marcin Wojtas    2015-08-06  7515  	int err, i, cpu;
3f518509d Marcin Wojtas    2014-07-10  7516  
213f428f5 Thomas Petazzoni 2017-08-03  7517  	has_tx_irqs = mvpp2_port_has_tx_irqs(priv, port_node);
213f428f5 Thomas Petazzoni 2017-08-03  7518  
213f428f5 Thomas Petazzoni 2017-08-03  7519  	if (!has_tx_irqs)
213f428f5 Thomas Petazzoni 2017-08-03  7520  		queue_mode = MVPP2_QDIST_SINGLE_MODE;
213f428f5 Thomas Petazzoni 2017-08-03  7521  
09f839755 Thomas Petazzoni 2017-08-03  7522  	ntxqs = MVPP2_MAX_TXQ;
213f428f5 Thomas Petazzoni 2017-08-03  7523  	if (priv->hw_version == MVPP22 && queue_mode == MVPP2_QDIST_MULTI_MODE)
213f428f5 Thomas Petazzoni 2017-08-03  7524  		nrxqs = MVPP2_DEFAULT_RXQ * num_possible_cpus();
213f428f5 Thomas Petazzoni 2017-08-03  7525  	else
09f839755 Thomas Petazzoni 2017-08-03  7526  		nrxqs = MVPP2_DEFAULT_RXQ;
09f839755 Thomas Petazzoni 2017-08-03  7527  
09f839755 Thomas Petazzoni 2017-08-03  7528  	dev = alloc_etherdev_mqs(sizeof(*port), ntxqs, nrxqs);
3f518509d Marcin Wojtas    2014-07-10  7529  	if (!dev)
3f518509d Marcin Wojtas    2014-07-10  7530  		return -ENOMEM;
3f518509d Marcin Wojtas    2014-07-10  7531  
3f518509d Marcin Wojtas    2014-07-10  7532  	phy_node = of_parse_phandle(port_node, "phy", 0);
3f518509d Marcin Wojtas    2014-07-10  7533  	phy_mode = of_get_phy_mode(port_node);
3f518509d Marcin Wojtas    2014-07-10  7534  	if (phy_mode < 0) {
3f518509d Marcin Wojtas    2014-07-10  7535  		dev_err(&pdev->dev, "incorrect phy mode\n");
3f518509d Marcin Wojtas    2014-07-10  7536  		err = phy_mode;
3f518509d Marcin Wojtas    2014-07-10  7537  		goto err_free_netdev;
3f518509d Marcin Wojtas    2014-07-10  7538  	}
3f518509d Marcin Wojtas    2014-07-10  7539  
542897d98 Antoine Tenart   2017-08-30  7540  	comphy = devm_of_phy_get(&pdev->dev, port_node, NULL);
542897d98 Antoine Tenart   2017-08-30  7541  	if (IS_ERR(comphy)) {
542897d98 Antoine Tenart   2017-08-30  7542  		if (PTR_ERR(comphy) == -EPROBE_DEFER) {
542897d98 Antoine Tenart   2017-08-30  7543  			err = -EPROBE_DEFER;
542897d98 Antoine Tenart   2017-08-30  7544  			goto err_free_netdev;
542897d98 Antoine Tenart   2017-08-30  7545  		}
542897d98 Antoine Tenart   2017-08-30  7546  		comphy = NULL;
542897d98 Antoine Tenart   2017-08-30  7547  	}
542897d98 Antoine Tenart   2017-08-30  7548  
3f518509d Marcin Wojtas    2014-07-10  7549  	if (of_property_read_u32(port_node, "port-id", &id)) {
3f518509d Marcin Wojtas    2014-07-10  7550  		err = -EINVAL;
3f518509d Marcin Wojtas    2014-07-10  7551  		dev_err(&pdev->dev, "missing port-id value\n");
3f518509d Marcin Wojtas    2014-07-10  7552  		goto err_free_netdev;
3f518509d Marcin Wojtas    2014-07-10  7553  	}
3f518509d Marcin Wojtas    2014-07-10  7554  
3f518509d Marcin Wojtas    2014-07-10  7555  	dev->tx_queue_len = MVPP2_MAX_TXD;
3f518509d Marcin Wojtas    2014-07-10  7556  	dev->watchdog_timeo = 5 * HZ;
3f518509d Marcin Wojtas    2014-07-10  7557  	dev->netdev_ops = &mvpp2_netdev_ops;
3f518509d Marcin Wojtas    2014-07-10  7558  	dev->ethtool_ops = &mvpp2_eth_tool_ops;
3f518509d Marcin Wojtas    2014-07-10  7559  
3f518509d Marcin Wojtas    2014-07-10  7560  	port = netdev_priv(dev);
591f4cfab Thomas Petazzoni 2017-08-03  7561  	port->dev = dev;
09f839755 Thomas Petazzoni 2017-08-03  7562  	port->ntxqs = ntxqs;
09f839755 Thomas Petazzoni 2017-08-03  7563  	port->nrxqs = nrxqs;
213f428f5 Thomas Petazzoni 2017-08-03  7564  	port->priv = priv;
213f428f5 Thomas Petazzoni 2017-08-03  7565  	port->has_tx_irqs = has_tx_irqs;
3f518509d Marcin Wojtas    2014-07-10  7566  
591f4cfab Thomas Petazzoni 2017-08-03  7567  	err = mvpp2_queue_vectors_init(port, port_node);
591f4cfab Thomas Petazzoni 2017-08-03  7568  	if (err)
3f518509d Marcin Wojtas    2014-07-10  7569  		goto err_free_netdev;
3f518509d Marcin Wojtas    2014-07-10  7570  
fd3651b2a Antoine Tenart   2017-09-01  7571  	port->link_irq = of_irq_get_byname(port_node, "link");
fd3651b2a Antoine Tenart   2017-09-01  7572  	if (port->link_irq == -EPROBE_DEFER) {
fd3651b2a Antoine Tenart   2017-09-01  7573  		err = -EPROBE_DEFER;
fd3651b2a Antoine Tenart   2017-09-01  7574  		goto err_deinit_qvecs;
fd3651b2a Antoine Tenart   2017-09-01  7575  	}
fd3651b2a Antoine Tenart   2017-09-01  7576  	if (port->link_irq <= 0)
fd3651b2a Antoine Tenart   2017-09-01  7577  		/* the link irq is optional */
fd3651b2a Antoine Tenart   2017-09-01  7578  		port->link_irq = 0;
fd3651b2a Antoine Tenart   2017-09-01  7579  
3f518509d Marcin Wojtas    2014-07-10  7580  	if (of_property_read_bool(port_node, "marvell,loopback"))
3f518509d Marcin Wojtas    2014-07-10  7581  		port->flags |= MVPP2_F_LOOPBACK;
3f518509d Marcin Wojtas    2014-07-10  7582  
3f518509d Marcin Wojtas    2014-07-10  7583  	port->id = id;
59b9a31ed Thomas Petazzoni 2017-03-07  7584  	if (priv->hw_version == MVPP21)
09f839755 Thomas Petazzoni 2017-08-03  7585  		port->first_rxq = port->id * port->nrxqs;
59b9a31ed Thomas Petazzoni 2017-03-07  7586  	else
59b9a31ed Thomas Petazzoni 2017-03-07  7587  		port->first_rxq = port->id * priv->max_port_rxqs;
59b9a31ed Thomas Petazzoni 2017-03-07  7588  
3f518509d Marcin Wojtas    2014-07-10  7589  	port->phy_node = phy_node;
3f518509d Marcin Wojtas    2014-07-10  7590  	port->phy_interface = phy_mode;
542897d98 Antoine Tenart   2017-08-30  7591  	port->comphy = comphy;
3f518509d Marcin Wojtas    2014-07-10  7592  
a786841df Thomas Petazzoni 2017-03-07  7593  	if (priv->hw_version == MVPP21) {
a786841df Thomas Petazzoni 2017-03-07  7594  		res = platform_get_resource(pdev, IORESOURCE_MEM, 2 + id);
3f518509d Marcin Wojtas    2014-07-10  7595  		port->base = devm_ioremap_resource(&pdev->dev, res);
3f518509d Marcin Wojtas    2014-07-10  7596  		if (IS_ERR(port->base)) {
3f518509d Marcin Wojtas    2014-07-10  7597  			err = PTR_ERR(port->base);
fd3651b2a Antoine Tenart   2017-09-01  7598  			goto err_free_irq;
3f518509d Marcin Wojtas    2014-07-10  7599  		}
a786841df Thomas Petazzoni 2017-03-07  7600  	} else {
a786841df Thomas Petazzoni 2017-03-07  7601  		if (of_property_read_u32(port_node, "gop-port-id",
a786841df Thomas Petazzoni 2017-03-07  7602  					 &port->gop_id)) {
a786841df Thomas Petazzoni 2017-03-07  7603  			err = -EINVAL;
a786841df Thomas Petazzoni 2017-03-07  7604  			dev_err(&pdev->dev, "missing gop-port-id value\n");
591f4cfab Thomas Petazzoni 2017-08-03  7605  			goto err_deinit_qvecs;
a786841df Thomas Petazzoni 2017-03-07  7606  		}
a786841df Thomas Petazzoni 2017-03-07  7607  
a786841df Thomas Petazzoni 2017-03-07  7608  		port->base = priv->iface_base + MVPP22_GMAC_BASE(port->gop_id);
a786841df Thomas Petazzoni 2017-03-07  7609  	}
3f518509d Marcin Wojtas    2014-07-10  7610  
3f518509d Marcin Wojtas    2014-07-10  7611  	/* Alloc per-cpu stats */
3f518509d Marcin Wojtas    2014-07-10  7612  	port->stats = netdev_alloc_pcpu_stats(struct mvpp2_pcpu_stats);
3f518509d Marcin Wojtas    2014-07-10  7613  	if (!port->stats) {
3f518509d Marcin Wojtas    2014-07-10  7614  		err = -ENOMEM;
fd3651b2a Antoine Tenart   2017-09-01  7615  		goto err_free_irq;
3f518509d Marcin Wojtas    2014-07-10  7616  	}
3f518509d Marcin Wojtas    2014-07-10  7617  
3ba8c81e1 Antoine Tenart   2017-09-02 @7618  	mvpp2_port_copy_mac_addr(dev, priv, port_node, &mac_from);
3f518509d Marcin Wojtas    2014-07-10  7619  
3f518509d Marcin Wojtas    2014-07-10  7620  	port->tx_ring_size = MVPP2_MAX_TXD;
3f518509d Marcin Wojtas    2014-07-10  7621  	port->rx_ring_size = MVPP2_MAX_RXD;
3f518509d Marcin Wojtas    2014-07-10  7622  	SET_NETDEV_DEV(dev, &pdev->dev);
3f518509d Marcin Wojtas    2014-07-10  7623  
3f518509d Marcin Wojtas    2014-07-10  7624  	err = mvpp2_port_init(port);
3f518509d Marcin Wojtas    2014-07-10  7625  	if (err < 0) {
3f518509d Marcin Wojtas    2014-07-10  7626  		dev_err(&pdev->dev, "failed to init port %d\n", id);
3f518509d Marcin Wojtas    2014-07-10  7627  		goto err_free_stats;
3f518509d Marcin Wojtas    2014-07-10  7628  	}
269758214 Thomas Petazzoni 2017-03-07  7629  
269758214 Thomas Petazzoni 2017-03-07  7630  	mvpp2_port_periodic_xon_disable(port);
269758214 Thomas Petazzoni 2017-03-07  7631  
269758214 Thomas Petazzoni 2017-03-07  7632  	if (priv->hw_version == MVPP21)
269758214 Thomas Petazzoni 2017-03-07  7633  		mvpp2_port_fc_adv_enable(port);
269758214 Thomas Petazzoni 2017-03-07  7634  
269758214 Thomas Petazzoni 2017-03-07  7635  	mvpp2_port_reset(port);
3f518509d Marcin Wojtas    2014-07-10  7636  
edc660fa0 Marcin Wojtas    2015-08-06  7637  	port->pcpu = alloc_percpu(struct mvpp2_port_pcpu);
edc660fa0 Marcin Wojtas    2015-08-06  7638  	if (!port->pcpu) {
edc660fa0 Marcin Wojtas    2015-08-06  7639  		err = -ENOMEM;
edc660fa0 Marcin Wojtas    2015-08-06  7640  		goto err_free_txq_pcpu;
edc660fa0 Marcin Wojtas    2015-08-06  7641  	}
edc660fa0 Marcin Wojtas    2015-08-06  7642  
213f428f5 Thomas Petazzoni 2017-08-03  7643  	if (!port->has_tx_irqs) {
edc660fa0 Marcin Wojtas    2015-08-06  7644  		for_each_present_cpu(cpu) {
edc660fa0 Marcin Wojtas    2015-08-06  7645  			port_pcpu = per_cpu_ptr(port->pcpu, cpu);
edc660fa0 Marcin Wojtas    2015-08-06  7646  
edc660fa0 Marcin Wojtas    2015-08-06  7647  			hrtimer_init(&port_pcpu->tx_done_timer, CLOCK_MONOTONIC,
edc660fa0 Marcin Wojtas    2015-08-06  7648  				     HRTIMER_MODE_REL_PINNED);
edc660fa0 Marcin Wojtas    2015-08-06  7649  			port_pcpu->tx_done_timer.function = mvpp2_hr_timer_cb;
edc660fa0 Marcin Wojtas    2015-08-06  7650  			port_pcpu->timer_scheduled = false;
edc660fa0 Marcin Wojtas    2015-08-06  7651  
213f428f5 Thomas Petazzoni 2017-08-03  7652  			tasklet_init(&port_pcpu->tx_done_tasklet,
213f428f5 Thomas Petazzoni 2017-08-03  7653  				     mvpp2_tx_proc_cb,
edc660fa0 Marcin Wojtas    2015-08-06  7654  				     (unsigned long)dev);
edc660fa0 Marcin Wojtas    2015-08-06  7655  		}
213f428f5 Thomas Petazzoni 2017-08-03  7656  	}
edc660fa0 Marcin Wojtas    2015-08-06  7657  
186cd4d4e Antoine Tenart   2017-08-23  7658  	features = NETIF_F_SG | NETIF_F_IP_CSUM | NETIF_F_TSO;
3f518509d Marcin Wojtas    2014-07-10  7659  	dev->features = features | NETIF_F_RXCSUM;
3f518509d Marcin Wojtas    2014-07-10  7660  	dev->hw_features |= features | NETIF_F_RXCSUM | NETIF_F_GRO;
3f518509d Marcin Wojtas    2014-07-10  7661  	dev->vlan_features |= features;
3f518509d Marcin Wojtas    2014-07-10  7662  
5777987e0 Jarod Wilson     2016-10-17  7663  	/* MTU range: 68 - 9676 */
5777987e0 Jarod Wilson     2016-10-17  7664  	dev->min_mtu = ETH_MIN_MTU;
5777987e0 Jarod Wilson     2016-10-17  7665  	/* 9676 == 9700 - 20 and rounding to 8 */
5777987e0 Jarod Wilson     2016-10-17  7666  	dev->max_mtu = 9676;
5777987e0 Jarod Wilson     2016-10-17  7667  
3f518509d Marcin Wojtas    2014-07-10  7668  	err = register_netdev(dev);
3f518509d Marcin Wojtas    2014-07-10  7669  	if (err < 0) {
3f518509d Marcin Wojtas    2014-07-10  7670  		dev_err(&pdev->dev, "failed to register netdev\n");
edc660fa0 Marcin Wojtas    2015-08-06  7671  		goto err_free_port_pcpu;
3f518509d Marcin Wojtas    2014-07-10  7672  	}
3f518509d Marcin Wojtas    2014-07-10  7673  	netdev_info(dev, "Using %s mac address %pM\n", mac_from, dev->dev_addr);
3f518509d Marcin Wojtas    2014-07-10  7674  
3f518509d Marcin Wojtas    2014-07-10  7675  	priv->port_list[id] = port;
3f518509d Marcin Wojtas    2014-07-10  7676  	return 0;
3f518509d Marcin Wojtas    2014-07-10  7677  
edc660fa0 Marcin Wojtas    2015-08-06  7678  err_free_port_pcpu:
edc660fa0 Marcin Wojtas    2015-08-06  7679  	free_percpu(port->pcpu);
3f518509d Marcin Wojtas    2014-07-10  7680  err_free_txq_pcpu:
09f839755 Thomas Petazzoni 2017-08-03  7681  	for (i = 0; i < port->ntxqs; i++)
3f518509d Marcin Wojtas    2014-07-10  7682  		free_percpu(port->txqs[i]->pcpu);
3f518509d Marcin Wojtas    2014-07-10  7683  err_free_stats:
3f518509d Marcin Wojtas    2014-07-10  7684  	free_percpu(port->stats);
fd3651b2a Antoine Tenart   2017-09-01  7685  err_free_irq:
fd3651b2a Antoine Tenart   2017-09-01  7686  	if (port->link_irq)
fd3651b2a Antoine Tenart   2017-09-01  7687  		irq_dispose_mapping(port->link_irq);
591f4cfab Thomas Petazzoni 2017-08-03  7688  err_deinit_qvecs:
591f4cfab Thomas Petazzoni 2017-08-03  7689  	mvpp2_queue_vectors_deinit(port);
3f518509d Marcin Wojtas    2014-07-10  7690  err_free_netdev:
ccb80393c Peter Chen       2016-08-01  7691  	of_node_put(phy_node);
3f518509d Marcin Wojtas    2014-07-10  7692  	free_netdev(dev);
3f518509d Marcin Wojtas    2014-07-10  7693  	return err;
3f518509d Marcin Wojtas    2014-07-10  7694  }
3f518509d Marcin Wojtas    2014-07-10  7695  

:::::: The code at line 7618 was first introduced by commit
:::::: 3ba8c81e15c11fc396d0b5d11adaf9db6ed39533 net: mvpp2: move the mac retrieval/copy logic into its own function

:::::: TO: Antoine Tenart <antoine.tenart@free-electrons.com>
:::::: CC: David S. Miller <davem@davemloft.net>

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 51119 bytes --]

^ permalink raw reply

* RE: [PATCH] vsock: only load vmci transport on VMware hypervisor by default
From: Dexuan Cui @ 2017-09-06 19:39 UTC (permalink / raw)
  To: Jorgen S. Hansen, Stefan Hajnoczi
  Cc: Michal Kubecek, joe@perches.com, olaf@aepfle.de,
	Stephen Hemminger, jasowang@redhat.com, netdev@vger.kernel.org,
	Haiyang Zhang, Dave Scott, apw@canonical.com,
	linux-kernel@vger.kernel.org, Vitaly Kuznetsov, Rolf Neugebauer,
	gregkh@linuxfoundation.org, Marcelo Cerri,
	devel@linuxdriverproject.org, Asias He, davem@davemloft.net,
	George Zhang, Dan Carpenter
In-Reply-To: <8E47FDFD-809F-4EE9-9068-65BE50BE8BEB@vmware.com>

> From: Jorgen S. Hansen [mailto:jhansen@vmware.com]
> Sent: Wednesday, September 6, 2017 7:11 AM
>> ...
> > I'm currently working on NFS over AF_VSOCK and sock_diag support (for
> > ss(8) and netstat-like tools).
> >
> > Multi-transport support is lower priority for me at the moment.  I'm
> > happy to review patches though.  If there is no progress on this by the
> > end of the year then I will have time to work on it.
> >
> 
> I’ll try to find time to write a more coherent proposal in the coming weeks,
> and we can discuss that.
> 
> Jorgen

Thank you! 

Thanks,
-- Dexuan
_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

^ permalink raw reply

* Re: [PATCH net] Revert "net: phy: Correctly process PHY_HALTED in phy_stop_machine()"
From: Florian Fainelli @ 2017-09-06 19:42 UTC (permalink / raw)
  To: Mason, Andrew Lunn
  Cc: Marc Gonzalez, David Daney, netdev, Geert Uytterhoeven,
	David Miller, Mans Rullgard, Thibaud Cornic
In-Reply-To: <730292be-affa-c19d-75ab-edba367788e8@free.fr>

On 09/06/2017 08:51 AM, Mason wrote:
> On 31/08/2017 21:18, Florian Fainelli wrote:
> 
>> On 08/31/2017 12:09 PM, Mason wrote:
>>
>>> On 31/08/2017 19:03, Florian Fainelli wrote:
>>>
>>>> On 08/31/2017 05:29 AM, Marc Gonzalez wrote:
>>>>
>>>>> On 31/08/2017 02:49, Florian Fainelli wrote:
>>>>>
>>>>>> The original motivation for this change originated from Marc Gonzalez
>>>>>> indicating that his network driver did not have its adjust_link
>>>>>> callback
>>>>>> executing with phydev->link = 0 while he was expecting it.
>>>>>
>>>>> I expect the core to call phy_adjust_link() for link changes.
>>>>> This used to work back in 3.4 and was broken somewhere along
>>>>> the way.
>>>>
>>>> If that was working correctly in 3.4 surely we can look at the diff and
>>>> figure out what changed, even maybe find the offending commit, can you
>>>> do that?
>>>
>>> Bisecting would a be a huge pain because my platform was
>>> not upstream until v4.4
>>
>> Then just diff the file and try to pinpoint which commit may have
>> changed that?
> 
> Running 'ip link set eth0 down' on the command-line.
> 
> In v3.4 => adjust_link() callback is called
> In v4.5 => adjust_link() callback is NOT called
> 
> $ git log --oneline --no-merges v3.4..v4.5 drivers/net/phy/phy.c | wc -l
> 59
> 
> I'm not sure what "just diff the file" entails.

git log -p --no-merges v3.4..v4.5 drivers/net/phy/{phy,phy_device.c} and
see what would seem remotely sensible to what you are observing.

> I can't move 3.4 up, nor move 4.5 down.

You can always copy the PHYLIB files at any given commit back into an
older tree, or vice versa because it is largely self contained with
little to no dependencies on other headers/files/facilities etc. This is
not convenient I agree, but it's a poor man's way of determining what
changed within PHYLIB that results in what you are seeing.

AFAICT you could use QEMU with the versatile board that has smsc911x as
an Ethernet adapter which is PHYLIB compliant which may be used to
pinpoint which commit start changing this behavior. It's long, it's painful.

> I'm not even sure the problem comes from drivers/net/phy/phy.c
> to be honest.

If that's the case then I am not sure what else we can do.
-- 
Florian

^ permalink raw reply

* Re: [PATCH v2 rfc 0/8] IGMP snooping for local traffic
From: Florian Fainelli @ 2017-09-06 19:54 UTC (permalink / raw)
  To: Andrew Lunn
  Cc: Roopa Prabhu, netdev, Vivien Didelot, Woojung.Huh, jbe, sean.wang,
	john
In-Reply-To: <20170906164217.GE15315@lunn.ch>

On 09/06/2017 09:42 AM, Andrew Lunn wrote:
>>> On the switch asics we work with, the driver has information if the
>>> packet was
>>> forwarded in hardware. This is per packet reason code telling why the
>>> CPU is seeing the packet.
>>> The driver can use this information to reset skb->offload_fwd_mark to
>>> allow software forward.
> 
>> I am not positive this is universally available across different
>> switch vendors.
> 
> It is not universally available. We cannot rely on it being available
> with switches supported by DSA.
> 
> We have a few choices:
> 
> 1) We assume anything the switch forwards to the CPU has also been
>    sent out whatever ports of the switch it needs to. Set
>    offload_fwd_mark.
> 
> 2) We assume anything the switch forwards to the CPU has not gone
>    anywhere else, and the bridge needs to send it out whatever ports
>    it thinks. Don't set offload_fwd_mark.
> 
> 3) We define some rules about what packets the switch should handle,
>    and then do some deep packet inspection to decide if
>    offload_fwd_mark should be set or not.
> 
> I don't see 3) being possible. We are dealing with a fixed silicon
> data path, not something which is fully programmable.
> 
> So it is down to 1) or 2). I've been assuming 1), but maybe we need to
> discuss that as well.

At the very least we should probably move the skb->offload_fwd_mark
setting down into the individual taggers since they should be in a
better position to set it or not based on the switch device they are
driving, this should address, on a per-switch basis whether 2) or 3)
applies to a given switch.

That being said, I have a feeling that the Marvell switches behave a
tiny bit differently than others in that they do not flood broadcast by
default in a given L2 domain.

On b53/bcm_sf2 there is the ability to disable the reception of
broadcast frames on the management/CPU port, and while there is the
ability to configure which ports should be flooded in case of
unicast/multicast lookup failures, I don't see anything for Broadcast,
so I am assuming this will get forwarded by default. Will test with your
patch set later on time permitting.
-- 
Florian

^ permalink raw reply

* Re: [net-next:master 491/511] xt_hashlimit.c:undefined reference to `__aeabi_uldivmod'
From: Arnd Bergmann @ 2017-09-06 19:57 UTC (permalink / raw)
  To: kbuild test robot; +Cc: kbuild-all, Networking
In-Reply-To: <201709062318.dBly2cas%fengguang.wu@intel.com>

On Wed, Sep 6, 2017 at 5:27 PM, kbuild test robot
<fengguang.wu@intel.com> wrote:
> Hi Arnd,
>
> It's probably a bug fix that unveils the link errors.

Correct.

>    net/netfilter/xt_hashlimit.o: In function `hashlimit_mt_common':
>>> xt_hashlimit.c:(.text+0x1f68): undefined reference to `__aeabi_uldivmod'

I actually wrote a patch for that yesterday, but it seems I forgot to submit it.
I've sent it now.

       Arnd

^ permalink raw reply

* [PATCH] netfilter: xt_hashlimit: avoid 64-bit division
From: Arnd Bergmann @ 2017-09-06 19:57 UTC (permalink / raw)
  To: Pablo Neira Ayuso, Jozsef Kadlecsik, Florian Westphal,
	David S. Miller
  Cc: Arnd Bergmann, Vishwanath Pai, Josh Hunt, netfilter-devel,
	coreteam, netdev, linux-kernel

64-bit division is expensive on 32-bit architectures, and
requires a special function call to avoid a link error like:

net/netfilter/xt_hashlimit.o: In function `hashlimit_mt_common':
xt_hashlimit.c:(.text+0x1328): undefined reference to `__aeabi_uldivmod'

In the case of hashlimit_mt_common, we don't actually need a
64-bit operation, we can simply rewrite the function slightly
to make that clear to the compiler.

Fixes: bea74641e378 ("netfilter: xt_hashlimit: add rate match mode")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 net/netfilter/xt_hashlimit.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/net/netfilter/xt_hashlimit.c b/net/netfilter/xt_hashlimit.c
index 10d48234f5f4..50b53d86eef5 100644
--- a/net/netfilter/xt_hashlimit.c
+++ b/net/netfilter/xt_hashlimit.c
@@ -531,7 +531,10 @@ static u64 user2rate_bytes(u64 user)
 {
 	u64 r;
 
-	r = user ? 0xFFFFFFFFULL / user : 0xFFFFFFFFULL;
+	if (user > 0xFFFFFFFFULL)
+		return 0;
+
+	r = user ? 0xFFFFFFFFULL / (u32)user : 0xFFFFFFFFULL;
 	r = (r - 1) << 4;
 	return r;
 }
-- 
2.9.0

^ permalink raw reply related

* Re: [PATCH] netfilter: xt_hashlimit: avoid 64-bit division
From: Vishwanath Pai @ 2017-09-06 20:22 UTC (permalink / raw)
  To: Arnd Bergmann, Pablo Neira Ayuso, Jozsef Kadlecsik,
	Florian Westphal, David S. Miller
  Cc: Josh Hunt, netfilter-devel, coreteam, netdev, linux-kernel
In-Reply-To: <20170906195825.3715290-1-arnd@arndb.de>

On 09/06/2017 03:57 PM, Arnd Bergmann wrote:
> 64-bit division is expensive on 32-bit architectures, and
> requires a special function call to avoid a link error like:
> 
> net/netfilter/xt_hashlimit.o: In function `hashlimit_mt_common':
> xt_hashlimit.c:(.text+0x1328): undefined reference to `__aeabi_uldivmod'
> 
> In the case of hashlimit_mt_common, we don't actually need a
> 64-bit operation, we can simply rewrite the function slightly
> to make that clear to the compiler.
> 
> Fixes: bea74641e378 ("netfilter: xt_hashlimit: add rate match mode")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---
>  net/netfilter/xt_hashlimit.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/net/netfilter/xt_hashlimit.c b/net/netfilter/xt_hashlimit.c
> index 10d48234f5f4..50b53d86eef5 100644
> --- a/net/netfilter/xt_hashlimit.c
> +++ b/net/netfilter/xt_hashlimit.c
> @@ -531,7 +531,10 @@ static u64 user2rate_bytes(u64 user)
>  {
>  	u64 r;
>  
> -	r = user ? 0xFFFFFFFFULL / user : 0xFFFFFFFFULL;
> +	if (user > 0xFFFFFFFFULL)
> +		return 0;
> +
> +	r = user ? 0xFFFFFFFFULL / (u32)user : 0xFFFFFFFFULL;
>  	r = (r - 1) << 4;
>  	return r;
>  }
> 

I have submitted another patch to fix this:
https://patchwork.ozlabs.org/patch/809881/

We have seen this problem before, I was careful not to introduce this
again in the new patch but clearly I overlooked this particular line :(

In the other cases we fixed it by replacing division with div64_u64().

-Vishwanath

^ permalink raw reply

* [PATCH 13/14] netfilter/ipvs: Use %pS printk format for direct addresses
From: Helge Deller @ 2017-09-06 20:28 UTC (permalink / raw)
  To: linux-kernel
  Cc: Sergey Senozhatsky, Petr Mladek, Andrew Morton, Wensong Zhang,
	netdev, lvs-devel, netfilter-devel
In-Reply-To: <1504729681-3504-1-git-send-email-deller@gmx.de>

The debug and error printk functions in ipvs uses wrongly the %pF instead of
the %pS printk format specifier for printing symbols for the address returned
by _builtin_return_address(0). Fix it for the ia64, ppc64 and parisc64
architectures.

Signed-off-by: Helge Deller <deller@gmx.de>
Cc: Wensong Zhang <wensong@linux-vs.org>
Cc: netdev@vger.kernel.org
Cc: lvs-devel@vger.kernel.org
Cc: netfilter-devel@vger.kernel.org
---
 net/netfilter/ipvs/ip_vs_conn.c | 2 +-
 net/netfilter/ipvs/ip_vs_ctl.c  | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/net/netfilter/ipvs/ip_vs_conn.c b/net/netfilter/ipvs/ip_vs_conn.c
index 3d2ac71a..f73561c 100644
--- a/net/netfilter/ipvs/ip_vs_conn.c
+++ b/net/netfilter/ipvs/ip_vs_conn.c
@@ -185,7 +185,7 @@ static inline int ip_vs_conn_hash(struct ip_vs_conn *cp)
 		hlist_add_head_rcu(&cp->c_list, &ip_vs_conn_tab[hash]);
 		ret = 1;
 	} else {
-		pr_err("%s(): request for already hashed, called from %pF\n",
+		pr_err("%s(): request for already hashed, called from %pS\n",
 		       __func__, __builtin_return_address(0));
 		ret = 0;
 	}
diff --git a/net/netfilter/ipvs/ip_vs_ctl.c b/net/netfilter/ipvs/ip_vs_ctl.c
index 1fa3c23..88fc58a 100644
--- a/net/netfilter/ipvs/ip_vs_ctl.c
+++ b/net/netfilter/ipvs/ip_vs_ctl.c
@@ -300,7 +300,7 @@ static int ip_vs_svc_hash(struct ip_vs_service *svc)
 	unsigned int hash;
 
 	if (svc->flags & IP_VS_SVC_F_HASHED) {
-		pr_err("%s(): request for already hashed, called from %pF\n",
+		pr_err("%s(): request for already hashed, called from %pS\n",
 		       __func__, __builtin_return_address(0));
 		return 0;
 	}
@@ -334,7 +334,7 @@ static int ip_vs_svc_hash(struct ip_vs_service *svc)
 static int ip_vs_svc_unhash(struct ip_vs_service *svc)
 {
 	if (!(svc->flags & IP_VS_SVC_F_HASHED)) {
-		pr_err("%s(): request for unhash flagged, called from %pF\n",
+		pr_err("%s(): request for unhash flagged, called from %pS\n",
 		       __func__, __builtin_return_address(0));
 		return 0;
 	}
-- 
2.1.0

^ permalink raw reply related

* Re: [patch net] net: sched: fix memleak for chain zero
From: Jiri Pirko @ 2017-09-06 20:33 UTC (permalink / raw)
  To: Cong Wang
  Cc: Linux Kernel Network Developers, David Miller, Jamal Hadi Salim,
	Jakub Kicinski, mlxsw
In-Reply-To: <CAM_iQpWZJ9VVD66h6RMNofobKyoFyztx2jYqBEHuE6_iAu7PNQ@mail.gmail.com>

Wed, Sep 06, 2017 at 07:40:02PM CEST, xiyou.wangcong@gmail.com wrote:
>On Wed, Sep 6, 2017 at 4:14 AM, Jiri Pirko <jiri@resnulli.us> wrote:
>> From: Jiri Pirko <jiri@mellanox.com>
>>
>> There's a memleak happening for chain 0. The thing is, chain 0 needs to
>> be always present, not created on demand. Therefore tcf_block_get upon
>> creation of block calls the tcf_chain_create function directly. The
>> chain is created with refcnt == 1, which is not correct in this case and
>> causes the memleak. So move the refcnt increment into tcf_chain_get
>> function even for the case when chain needs to be created.
>>
>
>Your approach could work but you just make the code even
>uglier than it is now:
>
>1. The current code is already ugly for special-casing chain 0:
>
>        if (--chain->refcnt == 0 && !chain->filter_chain && chain->index != 0)
>                tcf_chain_destroy(chain);
>
>2. With your patch, chain 0 has a different _initial_ refcnt with others.

No. Initial refcnt is the same. ! for every action that holds the chain.
So actually, it returns it back where it should be.


>
>3. Allowing an object (chain 0) exists with refcnt==0

So? That is for every chain that does not have goto_chain action
pointing at. Please read the code.


>
>Compare it with my patch:
>
>1. No special-case for chain 0, the above ugly part is removed
>
>2. Every chain is equal and created with refcnt==1
>
>3. Any chain with refcnt==0 is destroyed

^ permalink raw reply

* Re: [PATCH] netfilter: xt_hashlimit: avoid 64-bit division
From: Arnd Bergmann @ 2017-09-06 20:48 UTC (permalink / raw)
  To: Vishwanath Pai
  Cc: Pablo Neira Ayuso, Jozsef Kadlecsik, Florian Westphal,
	David S. Miller, Josh Hunt, netfilter-devel, coreteam, Networking,
	Linux Kernel Mailing List
In-Reply-To: <7791dee1-64a9-dcaa-c5d9-0b04a44bc526@akamai.com>

On Wed, Sep 6, 2017 at 10:22 PM, Vishwanath Pai <vpai@akamai.com> wrote:
> On 09/06/2017 03:57 PM, Arnd Bergmann wrote:
>> 64-bit division is expensive on 32-bit architectures, and
>> requires a special function call to avoid a link error like:
>>
>> net/netfilter/xt_hashlimit.o: In function `hashlimit_mt_common':
>> xt_hashlimit.c:(.text+0x1328): undefined reference to `__aeabi_uldivmod'
>>
>> In the case of hashlimit_mt_common, we don't actually need a
>> 64-bit operation, we can simply rewrite the function slightly
>> to make that clear to the compiler.
>>
>> Fixes: bea74641e378 ("netfilter: xt_hashlimit: add rate match mode")
>> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
>> ---
>>  net/netfilter/xt_hashlimit.c | 5 ++++-
>>  1 file changed, 4 insertions(+), 1 deletion(-)
>>
>> diff --git a/net/netfilter/xt_hashlimit.c b/net/netfilter/xt_hashlimit.c
>> index 10d48234f5f4..50b53d86eef5 100644
>> --- a/net/netfilter/xt_hashlimit.c
>> +++ b/net/netfilter/xt_hashlimit.c
>> @@ -531,7 +531,10 @@ static u64 user2rate_bytes(u64 user)
>>  {
>>       u64 r;
>>
>> -     r = user ? 0xFFFFFFFFULL / user : 0xFFFFFFFFULL;
>> +     if (user > 0xFFFFFFFFULL)
>> +             return 0;
>> +
>> +     r = user ? 0xFFFFFFFFULL / (u32)user : 0xFFFFFFFFULL;
>>       r = (r - 1) << 4;
>>       return r;
>>  }
>>
>
> I have submitted another patch to fix this:
> https://patchwork.ozlabs.org/patch/809881/
>
> We have seen this problem before, I was careful not to introduce this
> again in the new patch but clearly I overlooked this particular line :(
>
> In the other cases we fixed it by replacing division with div64_u64().

div64_u64() seems needlessly expensive here since the dividend
is known to be a 32-bit number. I guess the function is not called
frequently though, so it doesn't matter much.

      Arnd

^ permalink raw reply


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