Re: [PATCH/RFC net-next] ravb: use clock rate as basis for GTI.TIV

2015-11-01 Thread Geert Uytterhoeven
On Mon, Nov 2, 2015 at 2:40 AM, Simon Horman  wrote:
> The motivation for this is to use the correct rate on
> the r8a7795/Slavator-X which is advertised as 133MHz but

Salvator-X

> may differ depending on the extal present on the Slavator-X.

Salvator-X

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- ge...@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH net-next 2/5] dp83640: Delay scheduled work.

2015-11-01 Thread Sørensen , Stefan
On Fri, 2015-10-30 at 21:37 +0100, Richard Cochran wrote:
> 
> NAK.  We want to have the time stamp ASAP, because the delay between
> the transmission of the Sync and its application in the servo
> degrades or even spoils synchronization.  Think of an ARM SoC with
> HZ=100.  Two jiffies are 20 milliseconds.

The workqueue is only used for delivering packets where the timestamp
was lost - if a timestamp is received, the packet is delivered
immediately. This patch may introduce a slight delay of the packets
where the timestamp never arrives, by these packets are properly not
very useful to the application anyway.

Stefan
N�r��yb�X��ǧv�^�)޺{.n�+���z�^�)w*jg����ݢj/���z�ޖ��2�ޙ&�)ߡ�a�����G���h��j:+v���w��٥

Re: [PATCH v6] isdn: Use ktime_t instead of 'struct timeval'

2015-11-01 Thread Tina Ruchandani
>
> Therefore please adjust the variable name appropriately, thanks.

David,
Thanks for the feedback, I will send out a v3.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


RE: [PATCH] net: smsc911x: Reset PHY during initialization

2015-11-01 Thread Pavel Fedin
 Hello!

> > On certain hardware after software reboot the chip may get stuck and fail
> > to reinitialize during reset. This can be fixed by ensuring that PHY is
> > reset too.
> >
> > Old PHY resetting method required operational MDIO interface, therefore
> > the chip should have been already set up. In order to be able to function
> > during probe, it is changed to use PMT_CTRL register.
> >
> > The problem could be observed on SMDK5410 board.
> >
> > Signed-off-by: Pavel Fedin 
> 
> I'm pretty sure this is going to break the PHY loopback test.

 It's not (at least in normal situation), because first we do the test, and 
only then, if it fails, we reset the PHY. So, during
normal operation of the driver, when loopback test succeeds at first attempt, 
we never attempt to reset the PHY. And, by the way, at
least on my board this PHY reset did nothing useful, because after it loopback 
test still failed, all 100 times.
 And, we don't use PHY reset anywhere outside of loopback test.

> This is such a tricky and fragile area to get right, therefore I
> want you to specifically guard any change in how PHY reset is
> done with tests against the specific chips that have the problem.

 Well, i could do one (or some combination) of the following, if you really 
want to:
 a) Leave PHY reset inside loopback test as it is, but add a second routine and 
call it only before smsc911x_soft_reset().
 b) Reset PHY only conditionally, using the following algorithm:
if smsc911x_soft_reset() {
/* NIC reset failed, kick the PHY and retry */
smsc911x_phy_reset()
if (smsc_911x_soft_reset())
return -ENODEV;
}
 c) Do extra PHY reset only if some hint in device tree is specified (or the 
machine is known to have the problem)

 But, i dislike approach (a) for code duplication, because datasheet says that 
both reset methods are equivalent; i dislike approach
(b) for actually being a hack; and i dislike (c) for adding extra stuff which 
seems to be not necessary. After all, what is wrong
with just extra PHY reset before attempting to program anything? By the way, i 
test my patch with both software reboot and hardware
reboot, and even powercycle. Everything is quite stable.
 Well, it's up to you to decide. But i'd like to get the fix upstreamed somehow 
because from time to time we use these boards for
tests, and it's quite annoiying to be unable to reboot them properly.

> Furthermore, I want you to test whether this has any negative
> effects on the PHY loopback test.

 I did. I never disabled loopback test, so i actually discovered a problem 
(even two) with it. First, the problem was chip reset
timeout. By increasing it to 300ms this problem seemed to be fixed, but 
loopback test started to fail. This was how i found and
fixed crash with missing phy_disconnect(). I examined the code and discovered 
that upon loopback test failure we reset the PHY and
retry. But in my case this PHY reset never did the right thing, and all 
loopback attempts (10x10 IIRC) were failing.
 Some comments in the code gave me a clue that the main NIC can misbehave on 
reset if e.g. PHY is in powerdown state. I printed
value of its control register and discovered that it was not the case. But then 
i discovered that we actually never try to reset the
PHY before doing anything. Also, while studying the datasheed i discovered that 
there is a shorthand for resetting PHY without MDIO
bus set up, but our driver doesn't use it, preferring MDIO method instead, 
which already requires operational NIC.
 So, i suggested that PHY is just not being reset when board is rebooted by 
software. I wrote the patch and it worked. I verified it
by reverting my previous NIC reset timeout increase, and it continued to work. 
After this loopback test on my board passes at first
attempt.

Kind regards,
Pavel Fedin
Expert Engineer
Samsung Electronics Research center Russia


--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [Bug 106241] New: shutdown(3)/close(3) behaviour is incorrect for sockets in accept(3)

2015-11-01 Thread Al Viro
On Sun, Nov 01, 2015 at 06:14:43PM -0800, Eric Dumazet wrote:
> On Mon, 2015-11-02 at 00:24 +, Al Viro wrote:
> 
> > This ought to be a bit cleaner.  Eric, could you test the variant below on 
> > your
> > setup?
> 
> Sure !
> 
> 5 runs of :
> lpaa24:~# taskset ff0ff ./opensock -t 16 -n 1000 -l 10
> 
> total = 4386311
> total = 4560402
> total = 4437309
> total = 4516227
> total = 4478778

Umm...  With Linus' variant it was what, around 400?  +10% or so, then...

> With 48 threads :
> 
> ./opensock -t 48 -n 1000 -l 10
> total = 4940245
> total = 4848513
> total = 4813153
> total = 4813946
> total = 5127804

And that - +40%?  Interesting...  And it looks like at 48 threads you are
still seeing arseloads of contention, but apparently less than with Linus'
variant...  What if you throw the __clear_close_on_exec() patch on
top of that?

Looks like it's spending less time under ->files_lock...  Could you get
information on fs/file.o hotspots?
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: HW communication debugging interface - ideas?

2015-11-01 Thread Jiri Pirko
Sun, Nov 01, 2015 at 05:51:16PM CET, da...@davemloft.net wrote:
>From: Jiri Pirko 
>Date: Wed, 30 Sep 2015 15:51:41 +0200
>
>> 2) generic Netlink (genl) interface. Easy to put metadata in, including the
>> device identificator (pci address). User then can use nlmon in order to
>> be able to use wireshark to see the netlink messages.
>> 
>> Looks like 2) might be viable, well-defined, generic interface to carry
>> this info. What do you think? Does this make sense?
>
>Sorry for the late response.  I definitely prefer this netlink idea,
>particularly for the metadata aspect.
>
>Yes, the ethernet frames should "identify" the device, but I much more
>like the idea of precisely having the geographic ID of the device (PCI
>ID, whatever) available as metadata as well.

Okay. Thanks!
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH net-next RFC] mpls: support for dead routes

2015-11-01 Thread Eric W. Biederman
roopa  writes:

> On 11/1/15, 1:27 PM, Eric W. Biederman wrote:
>> Roopa Prabhu  writes:
>>
>>> diff --git a/net/mpls/af_mpls.c b/net/mpls/af_mpls.c
>>> index c70d750..7db9678 100644
>>> --- a/net/mpls/af_mpls.c
>>> +++ b/net/mpls/af_mpls.c
>>> @@ -27,6 +27,8 @@
>>>   */
>>>  #define MAX_MP_SELECT_LABELS 4
>>>  
>>> +u32 mpls_multipath_secret __read_mostly;
>> This mpls_multipath_secret is never used.
>>
> It is used in mpls_multipath_rebalance, same as fib_rebalance.

fib_multipath_secret is only initialized in fib_rebalalance.
fib_multipath_secret is used used in fib_multipath_hash,
which is called in fib_select_path.

The equivalent code does not exist in your mpls patch.

Eric

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: Exporting obscene amounts of data in rtnl_link_ops->fill_info()

2015-11-01 Thread Jason A. Donenfeld
Hi folks,

Just a follow-up on this thread...

The basic issue is that for a given net device, I want to export to
userspace more data than what can fit in a netlink sk_buff. On first
glance, using RTM_GETLINK with the ops->fill_info() hook seemed
perfect. It provides a simple interface for my rtnetlink driver to
provide additional information back to userspace. Unfortunately, the
size of messages it can export back to userspace is limited, as
mentioned.

So, I see two options from here:

One is registering a new type of netlink message for a new PF, with
rtnl_register(). Inside of this, I'd have a more clean API of sending
back information in chunks, which can fit inside a netlink packet.

The other is to implement ops->ndo_do_ioctl() with a very simple
mechanism of copying structs back to userspace, directly into
userspace-allocated buffers. This would be _much_ simpler and easier
to implement, and probably less prone to race-conditions too.

So I want to add the ioctl. I can practically already see the code in
my head. But everywhere I look, folks are turning to netlink. It's
hard to imagine a new driver passing review on this mailing list if it
adds "yet another" ioctl interface. So, I'm then pushed toward doing
the awkward netlink dance, because "all the cool kids are doing it."

But, before I succumb to what is potentially a false dichotomy, I
thought I'd write in here to get some opinions on the best way
forward. To repeat, the basic idea is - I need to return lots of
per-interface information to userspace from a netdevice. RTM_GETLINK
has a maximum message size, so it won't do. What's the cleanest and
most acceptable way forward?

Thanks,
Jason
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [Bug 106241] New: shutdown(3)/close(3) behaviour is incorrect for sockets in accept(3)

2015-11-01 Thread Eric Dumazet
On Mon, 2015-11-02 at 00:24 +, Al Viro wrote:

> This ought to be a bit cleaner.  Eric, could you test the variant below on 
> your
> setup?

Sure !

5 runs of :
lpaa24:~# taskset ff0ff ./opensock -t 16 -n 1000 -l 10

total = 4386311
total = 4560402
total = 4437309
total = 4516227
total = 4478778


With 48 threads :

./opensock -t 48 -n 1000 -l 10
total = 4940245
total = 4848513
total = 4813153
total = 4813946
total = 5127804

Perf output taken on the 16 threads run :

74.71%   opensock  opensock   [.] memset

 |
 --- memset

 5.64%   opensock  [kernel.kallsyms]  [k] queued_spin_lock_slowpath 

 |
 --- queued_spin_lock_slowpath
|  
|--99.89%-- _raw_spin_lock
|  |  
|  |--52.74%-- __close_fd
|  |  sys_close
|  |  entry_SYSCALL_64_fastpath
|  |  __libc_close
|  |  |  
|  |   --100.00%-- 0x0
|  |  
|  |--46.97%-- __alloc_fd
|  |  get_unused_fd_flags
|  |  sock_map_fd
|  |  sys_socket
|  |  entry_SYSCALL_64_fastpath
|  |  __socket
|  |  |  
|  |   --100.00%-- 0x0
|   --0.30%-- [...]
 --0.11%-- [...]

 1.69%   opensock  [kernel.kallsyms]  [k] _raw_spin_lock

 |
 --- _raw_spin_lock
|  
|--27.37%-- get_unused_fd_flags
|  sock_map_fd
|  sys_socket
|  entry_SYSCALL_64_fastpath
|  __socket
|  
|--22.40%-- sys_close
|  entry_SYSCALL_64_fastpath
|  __libc_close
|  
|--15.79%-- cache_alloc_refill
|  |  
|  |--99.27%-- kmem_cache_alloc
|  |  |  
|  |  |--81.25%-- sk_prot_alloc
|  |  |  sk_alloc
|  |  |  inet_create
|  |  |  __sock_create
|  |  |  sock_create
|  |  |  sys_socket
|  |  |  entry_SYSCALL_64_fastpath
|  |  |  __socket
|  |  |  
|  |  |--9.08%-- sock_alloc_inode
|  |  |  alloc_inode
|  |  |  new_inode_pseudo
|  |  |  sock_alloc
|  |  |  __sock_create
|  |  |  sock_create
|  |  |  sys_socket
|  |  |  entry_SYSCALL_64_fastpath
|  |  |  __socket
|  |  |  
|  |  |--4.98%-- __d_alloc
|  |  |  d_alloc_pseudo
|  |  |  sock_alloc_file
|  |  |  sock_map_fd
|  |  |  sys_socket
|  |  |  entry_SYSCALL_64_fastpath
|  |  |  __socket
|  |  |  
|  |   --4.69%-- get_empty_filp
|  | alloc_file
|  | sock_alloc_file
|  | sock_map_fd
|  | sys_socket
|  | entry_SYSCALL_64_fastpath
|  | __socket
|  |  
|   --0.73%-- kmem_ca

[PATCH/RFC net-next] ravb: use clock rate as basis for GTI.TIV

2015-11-01 Thread Simon Horman
The GTI.TIV may be set to 2GHz^2 / rate, where rate is
that of the clock of the device. Rather than assuming a
rate of 130MHz use the actual rate of the clock.

The motivation for this is to use the correct rate on
the r8a7795/Slavator-X which is advertised as 133MHz but
may differ depending on the extal present on the Slavator-X.

Signed-off-by: Simon Horman 

---
Tested on the topic/gen3-latest branch of Geert Uytterhoeven's
renesas-drivers tree on kernel.org: 3f5a88be9fea ("[WIP] arm64: renesas:
r8a7795: Convert to new CPG/MSSR bindings")
---
 drivers/net/ethernet/renesas/ravb.h  |  3 +++
 drivers/net/ethernet/renesas/ravb_main.c | 35 +++-
 2 files changed, 37 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/renesas/ravb.h 
b/drivers/net/ethernet/renesas/ravb.h
index 0623fff932e4..f9dee7436e81 100644
--- a/drivers/net/ethernet/renesas/ravb.h
+++ b/drivers/net/ethernet/renesas/ravb.h
@@ -576,6 +576,9 @@ enum GTI_BIT {
GTI_TIV = 0x0FFF,
 };
 
+#define GTI_TIV_MAXGTI_TIV
+#define GTI_TIV_MIN0x20
+
 /* GIC */
 enum GIC_BIT {
GIC_PTCE= 0x0001,   /* Undocumented? */
diff --git a/drivers/net/ethernet/renesas/ravb_main.c 
b/drivers/net/ethernet/renesas/ravb_main.c
index 8cc5ec5ed19a..af52c88b8b8f 100644
--- a/drivers/net/ethernet/renesas/ravb_main.c
+++ b/drivers/net/ethernet/renesas/ravb_main.c
@@ -1659,6 +1659,37 @@ static const struct of_device_id ravb_match_table[] = {
 };
 MODULE_DEVICE_TABLE(of, ravb_match_table);
 
+static int ravb_set_gti(struct net_device *ndev)
+{
+
+   struct device *dev = ndev->dev.parent;
+   struct device_node *np = dev->of_node;
+   unsigned long long rate;
+   unsigned long inc;
+   struct clk *clk;
+
+   clk = of_clk_get(np, 0);
+   if (IS_ERR(clk)) {
+   dev_err(dev, "could not get clock\n");
+   return PTR_ERR(clk);
+   }
+
+   rate = clk_get_rate(clk);
+   clk_put(clk);
+
+   inc = (10ULL << 20) / rate;
+
+   if (inc < GTI_TIV_MIN || inc > GTI_TIV_MAX) {
+   dev_err(dev, "gti.tiv increment 0x%lx is outside the range 0x%x 
- 0x%x\n",
+   inc, GTI_TIV_MIN, GTI_TIV_MAX);
+   return -EINVAL;
+   }
+
+   ravb_write(ndev, inc, GTI);
+
+   return 0;
+}
+
 static int ravb_probe(struct platform_device *pdev)
 {
struct device_node *np = pdev->dev.of_node;
@@ -1755,7 +1786,9 @@ static int ravb_probe(struct platform_device *pdev)
   CCC);
 
/* Set GTI value */
-   ravb_write(ndev, ((1000 << 20) / 130) & GTI_TIV, GTI);
+   error = ravb_set_gti(ndev);
+   if (error)
+   goto out_release;
 
/* Request GTI loading */
ravb_write(ndev, ravb_read(ndev, GCCR) | GCCR_LTI, GCCR);
-- 
2.1.4

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH net-next] ravb: use pdev rather than ndev for error messages

2015-11-01 Thread Simon Horman
This corrects what appear to be typos, making the code consistent with
itself, and allowing meaningful prefixes to be displayed with the errors in
question.

Before:
 (null): failed to initialize MDIO
 (null): Cannot allocate desc base address table (size 176 bytes)

After:
ravb e680.ethernet: failed to initialize MDIO
ravb e680.ethernet: Cannot allocate desc base address table (size 176 bytes)

Signed-off-by: Simon Horman 

---

Tested using an r8a7795/Salvatore-X on the topic/gen3-latest branch of
Geert Uytterhoeven's renesas-drivers tree on kernel.org: 3f5a88be9fea
("[WIP] arm64: renesas: r8a7795: Convert to new CPG/MSSR bindings")
---
 drivers/net/ethernet/renesas/ravb_main.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/renesas/ravb_main.c 
b/drivers/net/ethernet/renesas/ravb_main.c
index af52c88b8b8f..2f345da1cc66 100644
--- a/drivers/net/ethernet/renesas/ravb_main.c
+++ b/drivers/net/ethernet/renesas/ravb_main.c
@@ -1798,7 +1798,7 @@ static int ravb_probe(struct platform_device *pdev)
priv->desc_bat = dma_alloc_coherent(ndev->dev.parent, 
priv->desc_bat_size,
&priv->desc_bat_dma, GFP_KERNEL);
if (!priv->desc_bat) {
-   dev_err(&ndev->dev,
+   dev_err(&pdev->dev,
"Cannot allocate desc base address table (size %d 
bytes)\n",
priv->desc_bat_size);
error = -ENOMEM;
@@ -1825,7 +1825,7 @@ static int ravb_probe(struct platform_device *pdev)
/* MDIO bus init */
error = ravb_mdio_init(priv);
if (error) {
-   dev_err(&ndev->dev, "failed to initialize MDIO\n");
+   dev_err(&pdev->dev, "failed to initialize MDIO\n");
goto out_dma_free;
}
 
-- 
2.1.4

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH net-next RFC] mpls: support for dead routes

2015-11-01 Thread roopa
On 11/1/15, 1:27 PM, Eric W. Biederman wrote:
> Roopa Prabhu  writes:
>
>> diff --git a/net/mpls/af_mpls.c b/net/mpls/af_mpls.c
>> index c70d750..7db9678 100644
>> --- a/net/mpls/af_mpls.c
>> +++ b/net/mpls/af_mpls.c
>> @@ -27,6 +27,8 @@
>>   */
>>  #define MAX_MP_SELECT_LABELS 4
>>  
>> +u32 mpls_multipath_secret __read_mostly;
> This mpls_multipath_secret is never used.
>
It is used in mpls_multipath_rebalance, same as fib_rebalance.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] bpf: fix trivial comment typo

2015-11-01 Thread Matthew Fernandez

bpf: fix trivial comment typo

Signed-off-by: Matthew Fernandez 

diff --git a/kernel/bpf/core.c b/kernel/bpf/core.c
index 67c380c..996db5c 100644
--- a/kernel/bpf/core.c
+++ b/kernel/bpf/core.c
@@ -456,7 +456,7 @@ select_insn:

/* ARG1 at this point is guaranteed to point to CTX from
 * the verifier side due to the fact that the tail call is
-* handeled like a helper, that is, bpf_tail_call_proto,
+* handled like a helper, that is, bpf_tail_call_proto,
 * where arg1_type is ARG_PTR_TO_CTX.
 */
insn = prog->insnsi;
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [Bug 106241] New: shutdown(3)/close(3) behaviour is incorrect for sockets in accept(3)

2015-11-01 Thread Linus Torvalds
On Sun, Nov 1, 2015 at 4:24 PM, Al Viro  wrote:
>
> This ought to be a bit cleaner.  Eric, could you test the variant below on 
> your
> setup?

I'd love to see the numbers, but at the same time I really can't say I
love your patch.

I've merged my own two patches for now (not actually pushed out - I
don't want to distract people from just testing 4.3 for a while),
because I felt that those had a unreasonably high bang-for-the-buck
(ie big speedups for something that still keeps the code very simple).

I'm definitely open to improving this further, even go as far as your
patch, but just looking at your version of __alloc_fd(), I just don't
get the warm and fuzzies.

  Linus
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [Bug 106241] New: shutdown(3)/close(3) behaviour is incorrect for sockets in accept(3)

2015-11-01 Thread Al Viro
On Sat, Oct 31, 2015 at 08:29:29PM +, Al Viro wrote:
> On Sat, Oct 31, 2015 at 12:54:50PM -0700, Linus Torvalds wrote:
> > On Sat, Oct 31, 2015 at 12:34 PM, Al Viro  wrote:
> > >
> > > ... and here's the current variant of mine.
> > 
> > Ugh. I really liked how simple mine ended up being. Yours is definitely not.
> 
> Note that it's not the final variant - just something that should be
> testable.  There are all kinds of things that still need cleaning/simplifying
> in there - e.g. scan() is definitely more complex than needed (if nothing
> else, the "small bitmap" case is simply find_next_zero_bit(), and the
> rest all have size equal to full cacheline; moreover, I'd overdone the
> "... and check if there are other zero bits left" thing - its callers
> used to use that a lot, and with the execption of two of them it was
> absolutely worthless.  So it ended up more generic than necessary and
> I'm going to trim that crap down.
> 
> It's still going to end up more complex than yours, obviously, but not as
> badly as it is now.  I'm not sure if the speedup will be worth the
> extra complexity, thus asking for testing...  On _some_ loads it is
> considerably faster (at least by factor of 5), but whether those loads
> resemble anything that occurs on real systems...

This ought to be a bit cleaner.  Eric, could you test the variant below on your
setup?

diff --git a/fs/file.c b/fs/file.c
index 6c672ad..0144920 100644
--- a/fs/file.c
+++ b/fs/file.c
@@ -30,6 +30,9 @@ int sysctl_nr_open_min = BITS_PER_LONG;
 int sysctl_nr_open_max = __const_max(INT_MAX, ~(size_t)0/sizeof(void *)) &
 -BITS_PER_LONG;
 
+#define BITS_PER_CHUNK 512
+#define BYTES_PER_CHUNK (BITS_PER_CHUNK / 8)
+
 static void *alloc_fdmem(size_t size)
 {
/*
@@ -46,8 +49,10 @@ static void *alloc_fdmem(size_t size)
 
 static void __free_fdtable(struct fdtable *fdt)
 {
+   int i;
kvfree(fdt->fd);
-   kvfree(fdt->open_fds);
+   for (i = 0; i <= 3; i++)
+   kvfree(fdt->bitmaps[i]);
kfree(fdt);
 }
 
@@ -56,13 +61,23 @@ static void free_fdtable_rcu(struct rcu_head *rcu)
__free_fdtable(container_of(rcu, struct fdtable, rcu));
 }
 
+static inline bool cacheline_full(unsigned long *p)
+{
+   int n;
+
+   for (n = 0; n < BITS_PER_CHUNK / BITS_PER_LONG; n++)
+   if (likely(~p[n]))
+   return false;
+   return true;
+}
+
 /*
  * Expand the fdset in the files_struct.  Called with the files spinlock
  * held for write.
  */
 static void copy_fdtable(struct fdtable *nfdt, struct fdtable *ofdt)
 {
-   unsigned int cpy, set;
+   unsigned int cpy, set, to, from, level, n;
 
BUG_ON(nfdt->max_fds < ofdt->max_fds);
 
@@ -71,18 +86,48 @@ static void copy_fdtable(struct fdtable *nfdt, struct 
fdtable *ofdt)
memcpy(nfdt->fd, ofdt->fd, cpy);
memset((char *)(nfdt->fd) + cpy, 0, set);
 
-   cpy = ofdt->max_fds / BITS_PER_BYTE;
-   set = (nfdt->max_fds - ofdt->max_fds) / BITS_PER_BYTE;
-   memcpy(nfdt->open_fds, ofdt->open_fds, cpy);
-   memset((char *)(nfdt->open_fds) + cpy, 0, set);
+   cpy = ofdt->max_fds / 8;
+   set = (nfdt->max_fds - ofdt->max_fds) / 8;
memcpy(nfdt->close_on_exec, ofdt->close_on_exec, cpy);
memset((char *)(nfdt->close_on_exec) + cpy, 0, set);
+   if (likely(!nfdt->bitmaps[1])) {
+   // flat to flat
+   memcpy(nfdt->bitmaps[0], ofdt->bitmaps[0], cpy);
+   memset((char *)(nfdt->bitmaps[0]) + cpy, 0, set);
+   return;
+   }
+   to = round_up(nfdt->max_fds, BITS_PER_CHUNK);
+   set = (to - ofdt->max_fds) / 8;
+   // copy and pad the primary
+   memcpy(nfdt->bitmaps[0], ofdt->bitmaps[0], ofdt->max_fds / 8);
+   memset((char *)nfdt->bitmaps[0] + ofdt->max_fds / 8, 0, set);
+   // copy and pad the old secondaries
+   from = round_up(ofdt->max_fds, BITS_PER_CHUNK);
+   for (level = 1; level <= 3; level++) {
+   if (!ofdt->bitmaps[level])
+   break;
+   to = round_up(to / BITS_PER_CHUNK, BITS_PER_CHUNK);
+   from = round_up(from / BITS_PER_CHUNK, BITS_PER_CHUNK);
+   memcpy(nfdt->bitmaps[level], ofdt->bitmaps[level], from / 8);
+   memset((char *)nfdt->bitmaps[level] + from / 8, 0, (to - from) 
/ 8);
+   }
+   // zero the new ones (if any)
+   for (n = level; n <= 3; n++) {
+   if (!nfdt->bitmaps[n])
+   break;
+   to = round_up(to / BITS_PER_CHUNK, BITS_PER_CHUNK);
+   memset(nfdt->bitmaps[n], 0, to / 8);
+   }
+   // and maybe adjust bit 0 in the first new one.
+   if (unlikely(n != level && cacheline_full(nfdt->bitmaps[level - 1])))
+   __set_bit(0, nfdt->bitmaps[level]);
 }
 
 static struct fdtable * alloc_fdtable(unsigned int nr)
 {
struct fdtable *fdt;
void *data;
+   int level = 0;
 
   

[PATCH v2 net] ipv6: fix crash on ICMPv6 redirects with prohibited/blackholed source

2015-11-01 Thread Matthias Schiffer
There are other error values besides ip6_null_entry that can be returned by
ip6_route_redirect(): fib6_rule_action() can also result in
ip6_blk_hole_entry and ip6_prohibit_entry if such ip rules are installed.

Only checking for ip6_null_entry in rt6_do_redirect() causes ip6_ins_rt()
to be called with rt->rt6i_table == NULL in these cases, making the kernel
crash.

Signed-off-by: Matthias Schiffer 
---
v2: remove now unused variable net


 net/ipv6/route.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/net/ipv6/route.c b/net/ipv6/route.c
index 946880a..cc88a73 100644
--- a/net/ipv6/route.c
+++ b/net/ipv6/route.c
@@ -2099,7 +2099,6 @@ static int ip6_route_del(struct fib6_config *cfg)
 
 static void rt6_do_redirect(struct dst_entry *dst, struct sock *sk, struct 
sk_buff *skb)
 {
-   struct net *net = dev_net(skb->dev);
struct netevent_redirect netevent;
struct rt6_info *rt, *nrt = NULL;
struct ndisc_options ndopts;
@@ -2160,7 +2159,7 @@ static void rt6_do_redirect(struct dst_entry *dst, struct 
sock *sk, struct sk_bu
}
 
rt = (struct rt6_info *) dst;
-   if (rt == net->ipv6.ip6_null_entry) {
+   if (rt->rt6i_flags & RTF_REJECT) {
net_dbg_ratelimited("rt6_redirect: source isn't a valid nexthop 
for redirect target\n");
return;
}
-- 
2.6.2

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v3 net] i40e: Look up MAC address in Open Firmware or IDPROM

2015-11-01 Thread Sowmini Varadhan
On (11/01/15 21:03), Nelson, Shannon wrote:
> .. In the meantime, be sure to test what happens over a reset, such as what
> happens when the MTU is changed.  This will make sure that the replay
> of mac and vlan filters happens correctly.  You'll want to test this
> with and without vlans.

I assume you mean .1q (aka linux macvlan) as opposed to access/trunk vlans? 
I will test that tomorrow but I did a quick sanity check on mtu, as well
as turning tso on/off which also restarts the driver (I believe), and
it was "fine", i.e., able to ping offlink hosts. 

--Sowmini

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH net] ipv6: fix crash on ICMPv6 redirects with prohibited/blackholed source

2015-11-01 Thread kbuild test robot
Hi Matthias,

[auto build test WARNING on net/master -- if it's inappropriate base, please 
suggest rules for selecting the more suitable base]

url:
https://github.com/0day-ci/linux/commits/Matthias-Schiffer/ipv6-fix-crash-on-ICMPv6-redirects-with-prohibited-blackholed-source/20151102-072158
config: x86_64-allyesconfig (attached as .config)
reproduce:
# save the attached .config to linux build tree
make ARCH=x86_64 

All warnings (new ones prefixed by >>):

   net/ipv6/route.c: In function 'rt6_do_redirect':
>> net/ipv6/route.c:2102:14: warning: unused variable 'net' [-Wunused-variable]
 struct net *net = dev_net(skb->dev);
 ^

vim +/net +2102 net/ipv6/route.c

^1da177e Linus Torvalds   2005-04-16  2086  
continue;
86872cb5 Thomas Graf  2006-08-22  2087  
if (cfg->fc_metric && cfg->fc_metric != rt->rt6i_metric)
^1da177e Linus Torvalds   2005-04-16  2088  
continue;
d8d1f30b Changli Gao  2010-06-10  2089  
dst_hold(&rt->dst);
c71099ac Thomas Graf  2006-08-04  2090  
read_unlock_bh(&table->tb6_lock);
^1da177e Linus Torvalds   2005-04-16  2091  
86872cb5 Thomas Graf  2006-08-22  2092  
return __ip6_del_rt(rt, &cfg->fc_nlinfo);
^1da177e Linus Torvalds   2005-04-16  2093  }
^1da177e Linus Torvalds   2005-04-16  2094  }
c71099ac Thomas Graf  2006-08-04  2095  
read_unlock_bh(&table->tb6_lock);
^1da177e Linus Torvalds   2005-04-16  2096  
^1da177e Linus Torvalds   2005-04-16  2097  return err;
^1da177e Linus Torvalds   2005-04-16  2098  }
^1da177e Linus Torvalds   2005-04-16  2099  
6700c270 David S. Miller  2012-07-17  2100  static void 
rt6_do_redirect(struct dst_entry *dst, struct sock *sk, struct sk_buff *skb)
a6279458 YOSHIFUJI Hideaki2006-08-23  2101  {
e8599ff4 David S. Miller  2012-07-11 @2102  struct net *net 
= dev_net(skb->dev);
a6279458 YOSHIFUJI Hideaki2006-08-23  2103  struct 
netevent_redirect netevent;
e8599ff4 David S. Miller  2012-07-11  2104  struct rt6_info 
*rt, *nrt = NULL;
e8599ff4 David S. Miller  2012-07-11  2105  struct 
ndisc_options ndopts;
e8599ff4 David S. Miller  2012-07-11  2106  struct 
inet6_dev *in6_dev;
e8599ff4 David S. Miller  2012-07-11  2107  struct 
neighbour *neigh;
71bcdba0 YOSHIFUJI Hideaki / 吉藤英明 2013-01-05  2108  struct rd_msg *msg;
6e157b6a David S. Miller  2012-07-12  2109  int optlen, 
on_link;
6e157b6a David S. Miller  2012-07-12  2110  u8 *lladdr;

:: The code at line 2102 was first introduced by commit
:: e8599ff4b1d6b0d61e1074ae4ba9fca8dd0c41d0 ipv6: Move bulk of redirect 
handling into rt6_redirect().

:: TO: David S. Miller 
:: CC: David S. Miller 

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


.config.gz
Description: Binary data


RE: Donation

2015-11-01 Thread Marma, Amanda

cash grant to you by a kind hearted Family , send an email to them now 
requesting more information (sessil_malcol...@outlook.com)
Thank you



[cid:image3f8534.PNG@3b9b090f.49b9374b]

DesignTemplate2

This message contains confidential information and is intended only for the 
individual named. If you are not the named addressee you should not 
disseminate, distribute or copy this e-mail. Please notify the sender 
immediately by e-mail if you have received this e-mail by mistake and delete 
this e-mail from your system. E-mail transmission cannot be guaranteed to be 
secure or error-free as information could be intercepted, corrupted, lost, 
destroyed, arrive late or incomplete, or contain viruses. The sender therefore 
does not accept liability for any errors or omissions in the contents of this 
message, which arise as a result of e-mail transmission. If verification is 
required please request a hard-copy version.  (LCHOC VER 1.0)


[PATCH v2 net-next] net: make skb_set_owner_w() more robust

2015-11-01 Thread Eric Dumazet
From: Eric Dumazet 

skb_set_owner_w() is called from various places that assume
skb->sk always point to a full blown socket (as it changes
sk->sk_wmem_alloc)

We'd like to attach skb to request sockets, and in the future
to timewait sockets as well. For these kind of pseudo sockets,
we need to take a traditional refcount and use sock_edemux()
as the destructor.

It is now time to un-inline skb_set_owner_w(), being too big.

Fixes: ca6fb0651883 ("tcp: attach SYNACK messages to request sockets instead of 
listener")
Signed-off-by: Eric Dumazet 
Bisected-by: Haiyang Zhang 
---
v2: sock_edemux() must be guarded by CONFIG_INET

 include/net/sock.h|   17 ++---
 net/core/sock.c   |   22 ++
 net/ipv4/tcp_output.c |4 +---
 3 files changed, 25 insertions(+), 18 deletions(-)

diff --git a/include/net/sock.h b/include/net/sock.h
index aeed5c95f3ca..f570e75e3da9 100644
--- a/include/net/sock.h
+++ b/include/net/sock.h
@@ -1951,6 +1951,8 @@ static inline void skb_set_hash_from_sk(struct sk_buff 
*skb, struct sock *sk)
}
 }
 
+void skb_set_owner_w(struct sk_buff *skb, struct sock *sk);
+
 /*
  * Queue a received datagram if it will fit. Stream and sequenced
  * protocols can't normally use this as they need to fit buffers in
@@ -1959,21 +1961,6 @@ static inline void skb_set_hash_from_sk(struct sk_buff 
*skb, struct sock *sk)
  * Inlined as it's very short and called for pretty much every
  * packet ever received.
  */
-
-static inline void skb_set_owner_w(struct sk_buff *skb, struct sock *sk)
-{
-   skb_orphan(skb);
-   skb->sk = sk;
-   skb->destructor = sock_wfree;
-   skb_set_hash_from_sk(skb, sk);
-   /*
-* We used to take a refcount on sk, but following operation
-* is enough to guarantee sk_free() wont free this sock until
-* all in-flight packets are completed
-*/
-   atomic_add(skb->truesize, &sk->sk_wmem_alloc);
-}
-
 static inline void skb_set_owner_r(struct sk_buff *skb, struct sock *sk)
 {
skb_orphan(skb);
diff --git a/net/core/sock.c b/net/core/sock.c
index 0ef30aa90132..7529eb9463be 100644
--- a/net/core/sock.c
+++ b/net/core/sock.c
@@ -1656,6 +1656,28 @@ void sock_wfree(struct sk_buff *skb)
 }
 EXPORT_SYMBOL(sock_wfree);
 
+void skb_set_owner_w(struct sk_buff *skb, struct sock *sk)
+{
+   skb_orphan(skb);
+   skb->sk = sk;
+#ifdef CONFIG_INET
+   if (unlikely(!sk_fullsock(sk))) {
+   skb->destructor = sock_edemux;
+   sock_hold(sk);
+   return;
+   }
+#endif
+   skb->destructor = sock_wfree;
+   skb_set_hash_from_sk(skb, sk);
+   /*
+* We used to take a refcount on sk, but following operation
+* is enough to guarantee sk_free() wont free this sock until
+* all in-flight packets are completed
+*/
+   atomic_add(skb->truesize, &sk->sk_wmem_alloc);
+}
+EXPORT_SYMBOL(skb_set_owner_w);
+
 void skb_orphan_partial(struct sk_buff *skb)
 {
/* TCP stack sets skb->ooo_okay based on sk_wmem_alloc,
diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c
index f4f9793eb025..cb7ca569052c 100644
--- a/net/ipv4/tcp_output.c
+++ b/net/ipv4/tcp_output.c
@@ -2963,9 +2963,7 @@ struct sk_buff *tcp_make_synack(const struct sock *sk, 
struct dst_entry *dst,
skb_reserve(skb, MAX_TCP_HEADER);
 
if (attach_req) {
-   skb->destructor = sock_edemux;
-   sock_hold(req_to_sk(req));
-   skb->sk = req_to_sk(req);
+   skb_set_owner_w(skb, req_to_sk(req));
} else {
/* sk is a const pointer, because we want to express multiple
 * cpu might call us concurrently.


--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH net-next] net: make skb_set_owner_w() more robust

2015-11-01 Thread Eric Dumazet
On Mon, 2015-11-02 at 07:18 +0800, kbuild test robot wrote:
> Hi Eric,
> 
> [auto build test ERROR on net-next/master -- if it's inappropriate base, 
> please suggest rules for selecting the more suitable base]
> 
> url:
> https://github.com/0day-ci/linux/commits/Eric-Dumazet/net-make-skb_set_owner_w-more-robust/20151102-070107
> config: x86_64-randconfig-x019-201544 (attached as .config)
> reproduce:
> # save the attached .config to linux build tree
> make ARCH=x86_64 
> 
> All errors (new ones prefixed by >>):
> 
>net/core/sock.c: In function 'skb_set_owner_w':
> >> net/core/sock.c:1664:21: error: 'sock_edemux' undeclared (first use in 
> >> this function)
>   skb->destructor = sock_edemux;
> ^
>net/core/sock.c:1664:21: note: each undeclared identifier is reported only 
> once for each function it appears in

Yes, I forgot sock_edemux() was guarded by CONFIG_INET.

Kind of silly options really...

I will send a V2.


--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH net-next] net: make skb_set_owner_w() more robust

2015-11-01 Thread kbuild test robot
Hi Eric,

[auto build test ERROR on net-next/master -- if it's inappropriate base, please 
suggest rules for selecting the more suitable base]

url:
https://github.com/0day-ci/linux/commits/Eric-Dumazet/net-make-skb_set_owner_w-more-robust/20151102-070107
config: x86_64-randconfig-x019-201544 (attached as .config)
reproduce:
# save the attached .config to linux build tree
make ARCH=x86_64 

All errors (new ones prefixed by >>):

   net/core/sock.c: In function 'skb_set_owner_w':
>> net/core/sock.c:1664:21: error: 'sock_edemux' undeclared (first use in this 
>> function)
  skb->destructor = sock_edemux;
^
   net/core/sock.c:1664:21: note: each undeclared identifier is reported only 
once for each function it appears in

vim +/sock_edemux +1664 net/core/sock.c

  1658  
  1659  void skb_set_owner_w(struct sk_buff *skb, struct sock *sk)
  1660  {
  1661  skb_orphan(skb);
  1662  skb->sk = sk;
  1663  if (unlikely(!sk_fullsock(sk))) {
> 1664  skb->destructor = sock_edemux;
  1665  sock_hold(sk);
  1666  return;
  1667  }

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


.config.gz
Description: Binary data


[PATCH net] ipv6: fix crash on ICMPv6 redirects with prohibited/blackholed source

2015-11-01 Thread Matthias Schiffer
There are other error values besides ip6_null_entry that can be returned by
ip6_route_redirect(): fib6_rule_action() can also result in
ip6_blk_hole_entry and ip6_prohibit_entry if such ip rules are installed.

Only checking for ip6_null_entry in rt6_do_redirect() causes ip6_ins_rt()
to be called with rt->rt6i_table == NULL in these cases, making the kernel
crash.

Signed-off-by: Matthias Schiffer 
---

This bug exists pretty much forever, please queue up for all -stable
kernels.


 net/ipv6/route.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/ipv6/route.c b/net/ipv6/route.c
index 946880a..c196ed7 100644
--- a/net/ipv6/route.c
+++ b/net/ipv6/route.c
@@ -2160,7 +2160,7 @@ static void rt6_do_redirect(struct dst_entry *dst, struct 
sock *sk, struct sk_bu
}
 
rt = (struct rt6_info *) dst;
-   if (rt == net->ipv6.ip6_null_entry) {
+   if (rt->rt6i_flags & RTF_REJECT) {
net_dbg_ratelimited("rt6_redirect: source isn't a valid nexthop 
for redirect target\n");
return;
}
-- 
2.6.2

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[RFC][PATCH] net: arinc429: Add ARINC-429 stack

2015-11-01 Thread Marek Vasut
429_link_ops __read_mostly = {
+   .kind   = "varinc429",
+   .setup  = varinc429_setup,
+};
+
+static __init int varinc429_init_module(void)
+{
+   pr_info("varinc429: Virtual ARINC429 interface driver\n");
+
+   if (echo)
+   pr_info("varinc429: enabled echo on driver level.\n");
+
+   return rtnl_link_register(&varinc429_link_ops);
+}
+
+static __exit void varinc429_cleanup_module(void)
+{
+   rtnl_link_unregister(&varinc429_link_ops);
+}
+
+module_init(varinc429_init_module);
+module_exit(varinc429_cleanup_module);
diff --git a/include/linux/arinc429/core.h b/include/linux/arinc429/core.h
new file mode 100644
index 000..2e32858
--- /dev/null
+++ b/include/linux/arinc429/core.h
@@ -0,0 +1,61 @@
+/*
+ * linux/arinc429/core.h
+ *
+ * Protoypes and definitions for ARINC429 protocol modules
+ * using the PF_ARINC429 core.
+ *
+ * Copyright (C) 2015 Marek Vasut 
+ *
+ * Based on the SocketCAN stack.
+ */
+
+#ifndef __ARINC429_CORE_H__
+#define __ARINC429_CORE_H__
+
+#include 
+#include 
+#include 
+
+#define ARINC429_VERSION "20151101"
+
+/* Increment this number each time you change some user-space interface */
+#define ARINC429_ABI_VERSION "1"
+
+#define ARINC429_VERSION_STRING\
+   "rev " ARINC429_VERSION " abi " ARINC429_ABI_VERSION
+
+#define DNAME(dev) ((dev) ? (dev)->name : "any")
+
+/**
+ * struct arinc429_proto - ARINC429 protocol structure
+ * @type:   type argument in socket() syscall, e.g. SOCK_DGRAM.
+ * @protocol:   protocol number in socket() syscall.
+ * @ops:pointer to struct proto_ops for sock->ops.
+ * @prot:   pointer to struct proto structure.
+ */
+struct arinc429_proto {
+   int type;
+   int protocol;
+   const struct proto_ops  *ops;
+   struct proto*prot;
+};
+
+/* Function prototypes for the ARINC429 network layer core (af_arinc429.c) */
+extern int  arinc429_proto_register(const struct arinc429_proto *cp);
+extern void arinc429_proto_unregister(const struct arinc429_proto *cp);
+
+extern int  arinc429_rx_register(struct net_device *dev,
+struct arinc429_filter *filter,
+void (*func)(struct sk_buff *, void *),
+void *data, char *ident);
+
+extern void arinc429_rx_unregister(struct net_device *dev,
+  struct arinc429_filter *filter,
+  void (*func)(struct sk_buff *, void *),
+  void *data);
+
+extern int arinc429_send(struct sk_buff *skb, int loop);
+extern int arinc429_ioctl(struct socket *sock, unsigned int cmd,
+ unsigned long arg);
+
+#endif /* __ARINC429_CORE_H__ */
diff --git a/include/linux/arinc429/dev.h b/include/linux/arinc429/dev.h
new file mode 100644
index 000..e496fbf
--- /dev/null
+++ b/include/linux/arinc429/dev.h
@@ -0,0 +1,81 @@
+/*
+ * linux/arinc429/dev.h
+ *
+ * Definitions for the ARINC429 network device driver interface
+ *
+ * Copyright (C) 2015 Marek Vasut 
+ *
+ * Based on the SocketCAN stack.
+ */
+
+#ifndef __ARINC429_DEV_H__
+#define __ARINC429_DEV_H__
+
+#include 
+#include 
+
+/*
+ * ARINC429 mode
+ */
+enum arinc429_mode {
+   ARINC429_MODE_STOP = 0,
+   ARINC429_MODE_START,
+   ARINC429_MODE_SLEEP
+};
+
+/*
+ * ARINC429 common private data
+ */
+struct arinc429_priv {
+   struct arinc429_rate rate;
+   u32 ctrlmode;
+   u32 ctrlmode_supported;
+
+   int (*do_set_rate)(struct net_device *dev);
+   int (*do_set_mode)(struct net_device *dev, enum arinc429_mode mode);
+
+   unsigned int echo_skb_max;
+   struct sk_buff **echo_skb;
+};
+
+/* Drop a given socketbuffer if it does not contain a valid ARINC429 frame. */
+static inline int arinc429_dropped_invalid_skb(struct net_device *dev,
+  struct sk_buff *skb)
+{
+   if (skb->protocol == htons(ETH_P_ARINC429)) {
+   if (unlikely(skb->len != ARINC429_MTU))
+   goto inval_skb;
+   } else
+   goto inval_skb;
+
+   return 0;
+
+inval_skb:
+   kfree_skb(skb);
+   dev->stats.tx_dropped++;
+   return 1;
+}
+
+struct net_device *alloc_arinc429dev(int sizeof_priv,
+unsigned int echo_skb_max);
+void free_arinc429dev(struct net_device *dev);
+
+/* a arinc429dev safe wrapper around netdev_priv */
+struct arinc429_priv *safe_arinc429dev_priv(struct net_device *dev);
+
+int open_arinc429dev(struct net_device *dev);
+void close_arinc429dev(struct net_device *dev);
+int arinc429_change_mtu(struct net_device *dev, int new_mtu);
+
+int register_arinc429dev(struct net_device *dev);
+void unregister_arinc429dev(struct net_device *dev);
+
+void arinc429_put_echo_skb(struct s

Re: [PATCH] net: dsa: use switchdev obj for VLAN add/del ops

2015-11-01 Thread Vivien Didelot
Hi David,

On Nov. Sunday 01 (44) 03:56 PM, David Miller wrote:
> From: Vivien Didelot 
> Date: Sun,  1 Nov 2015 12:33:55 -0500
> 
> > Simplify DSA by pushing the switchdev objects for VLAN add and delete
> > operations down to its drivers. Currently only mv88e6xxx is affected.
> > 
> > Signed-off-by: Vivien Didelot 
> > ---
> > v2: make _mv88e6xxx_port_vlan_del static as spotted by the kbuild robot.
> 
> According to your previous submission this is targetted at net-next,
> so that's where I applied it.

Right.

> But please do not make me play guessing games like this in the future.

Oops, wrong command, sorry about that...

Thanks,
-v
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH net-next] net: make skb_set_owner_w() more robust

2015-11-01 Thread Eric Dumazet
From: Eric Dumazet 

skb_set_owner_w() is called from various places that assume
skb->sk always point to a full blown socket (as it changes
sk->sk_wmem_alloc)

We'd like to attach skb to request sockets, and in the future
to timewait sockets as well. For these kind of pseudo sockets,
we need to take a traditional refcount and use sock_edemux()
as the destructor.

It is now time to un-inline skb_set_owner_w(), being too big.

Fixes: ca6fb0651883 ("tcp: attach SYNACK messages to request sockets instead of 
listener")
Signed-off-by: Eric Dumazet 
Bisected-by: Haiyang Zhang 
---
 include/net/sock.h|   17 ++---
 net/core/sock.c   |   20 
 net/ipv4/tcp_output.c |4 +---
 3 files changed, 23 insertions(+), 18 deletions(-)

diff --git a/include/net/sock.h b/include/net/sock.h
index aeed5c95f3ca..f570e75e3da9 100644
--- a/include/net/sock.h
+++ b/include/net/sock.h
@@ -1951,6 +1951,8 @@ static inline void skb_set_hash_from_sk(struct sk_buff 
*skb, struct sock *sk)
}
 }
 
+void skb_set_owner_w(struct sk_buff *skb, struct sock *sk);
+
 /*
  * Queue a received datagram if it will fit. Stream and sequenced
  * protocols can't normally use this as they need to fit buffers in
@@ -1959,21 +1961,6 @@ static inline void skb_set_hash_from_sk(struct sk_buff 
*skb, struct sock *sk)
  * Inlined as it's very short and called for pretty much every
  * packet ever received.
  */
-
-static inline void skb_set_owner_w(struct sk_buff *skb, struct sock *sk)
-{
-   skb_orphan(skb);
-   skb->sk = sk;
-   skb->destructor = sock_wfree;
-   skb_set_hash_from_sk(skb, sk);
-   /*
-* We used to take a refcount on sk, but following operation
-* is enough to guarantee sk_free() wont free this sock until
-* all in-flight packets are completed
-*/
-   atomic_add(skb->truesize, &sk->sk_wmem_alloc);
-}
-
 static inline void skb_set_owner_r(struct sk_buff *skb, struct sock *sk)
 {
skb_orphan(skb);
diff --git a/net/core/sock.c b/net/core/sock.c
index 0ef30aa90132..8d8abcb4d8cd 100644
--- a/net/core/sock.c
+++ b/net/core/sock.c
@@ -1656,6 +1656,26 @@ void sock_wfree(struct sk_buff *skb)
 }
 EXPORT_SYMBOL(sock_wfree);
 
+void skb_set_owner_w(struct sk_buff *skb, struct sock *sk)
+{
+   skb_orphan(skb);
+   skb->sk = sk;
+   if (unlikely(!sk_fullsock(sk))) {
+   skb->destructor = sock_edemux;
+   sock_hold(sk);
+   return;
+   }
+   skb->destructor = sock_wfree;
+   skb_set_hash_from_sk(skb, sk);
+   /*
+* We used to take a refcount on sk, but following operation
+* is enough to guarantee sk_free() wont free this sock until
+* all in-flight packets are completed
+*/
+   atomic_add(skb->truesize, &sk->sk_wmem_alloc);
+}
+EXPORT_SYMBOL(skb_set_owner_w);
+
 void skb_orphan_partial(struct sk_buff *skb)
 {
/* TCP stack sets skb->ooo_okay based on sk_wmem_alloc,
diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c
index f4f9793eb025..cb7ca569052c 100644
--- a/net/ipv4/tcp_output.c
+++ b/net/ipv4/tcp_output.c
@@ -2963,9 +2963,7 @@ struct sk_buff *tcp_make_synack(const struct sock *sk, 
struct dst_entry *dst,
skb_reserve(skb, MAX_TCP_HEADER);
 
if (attach_req) {
-   skb->destructor = sock_edemux;
-   sock_hold(req_to_sk(req));
-   skb->sk = req_to_sk(req);
+   skb_set_owner_w(skb, req_to_sk(req));
} else {
/* sk is a const pointer, because we want to express multiple
 * cpu might call us concurrently.


--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] bpf: convert hashtab lock to raw lock

2015-11-01 Thread Alexei Starovoitov
On Sat, Oct 31, 2015 at 09:47:36AM -0400, Steven Rostedt wrote:
> On Fri, 30 Oct 2015 17:03:58 -0700
> Alexei Starovoitov  wrote:
> 
> > On Fri, Oct 30, 2015 at 03:16:26PM -0700, Yang Shi wrote:
> > > When running bpf samples on rt kernel, it reports the below warning:
> > > 
> > > BUG: sleeping function called from invalid context at 
> > > kernel/locking/rtmutex.c:917
> > > in_atomic(): 1, irqs_disabled(): 128, pid: 477, name: ping
> > > Preemption disabled at:[] kprobe_perf_func+0x30/0x228  
> > ...
> > > diff --git a/kernel/bpf/hashtab.c b/kernel/bpf/hashtab.c
> > > index 83c209d..972b76b 100644
> > > --- a/kernel/bpf/hashtab.c
> > > +++ b/kernel/bpf/hashtab.c
> > > @@ -17,7 +17,7 @@
> > >  struct bpf_htab {
> > >   struct bpf_map map;
> > >   struct hlist_head *buckets;
> > > - spinlock_t lock;
> > > + raw_spinlock_t lock;  
> > 
> > How do we address such things in general?
> > I bet there are tons of places around the kernel that
> > call spin_lock from atomic.
> > I'd hate to lose the benefits of lockdep of non-raw spin_lock
> > just to make rt happy.
> 
> You wont lose any benefits of lockdep. Lockdep still checks
> raw_spin_lock(). The only difference between raw_spin_lock and
> spin_lock is that in -rt spin_lock turns into an rt_mutex() and
> raw_spin_lock stays a spin lock.

I see. The patch makes sense then.
Would be good to document this peculiarity of spin_lock.

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH net-next] net: increase LL_MAX_HEADER if HYPERV_NET is enabled

2015-11-01 Thread Eric Dumazet
On Sun, 2015-11-01 at 15:58 -0500, David Miller wrote:
> From: Eric Dumazet 
> Date: Sun, 01 Nov 2015 09:20:59 -0800
> 
> > From: Eric Dumazet 
> > 
> > My recent commit, attaching SYNACK messages to request sockets
> > exposed a too small LL_MAX_HEADER when netvsc_drv.c is in use,
> > because this driver sets a needed_headroom of 220 bytes.
> > 
> > Increase LL_MAX_HEADER in this case, to avoid a realloc of all
> > TCP frames.
> > 
> > In another patch, I'll make skb_set_owner_w() more robust.
> > 
> > Fixes: ca6fb0651883 ("tcp: attach SYNACK messages to request sockets 
> > instead of listener")
> > Signed-off-by: Eric Dumazet 
> > Bisected-by: Haiyang Zhang 
> 
> Using a value of 256 just because HYPER-V is crazy imposes a huge
> unnecessary burdon upon the rest of the stack.
> 
> I rejected a previous attempt to use such a huge value for
> LL_MAX_HEADER, and I will do so again here.  We need a different fix
> for this issue, one that doesn't hurt everyone.

Sure, I was planning to send the skb_set_owner_w() fix as well.

I was not aware you already objected to LL_MAX_HEADER increase.




--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 1/1] ipmr: fix possible race resulting from improper usage of IP_INC_STATS_BH() in preemptible context.

2015-11-01 Thread Eric Dumazet
On Fri, 2015-10-30 at 16:54 -0700, Ani Sinha wrote:
> Fixes the following kernel BUG :

> Signed-off-by: Ani Sinha 
> ---
>  net/ipv4/ipmr.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)

Acked-by: Eric Dumazet 



--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH net-next 4/8] net/mlx5e: Consider IRQ affinity changes in NAPI poll

2015-11-01 Thread David Miller
From: Or Gerlitz 
Date: Sun,  1 Nov 2015 19:35:18 +0200

> @@ -49,6 +50,15 @@ struct mlx5_cqe64 *mlx5e_get_cqe(struct mlx5e_cq *cq)
>   return cqe;
>  }
>  
> +static inline bool mlx5e_no_channel_affinity_change(struct mlx5e_channel *c)
> +{
> + int current_cpu = smp_processor_id();
> + struct irq_data *d = irq_desc_get_irq_data(c->irq_desc);
> + struct cpumask *aff = irq_data_get_affinity_mask(d);
> +
> + return cpumask_test_cpu(current_cpu, aff);
> +}

This is so much pointer dereferencing and then a bitmask test as well.

Are you really sure sure an extremely rare situation warrants this
test every single NAPI poll call?

If this is a real problem, then every driver is susceptible to the
issue and it therefore warrants a generic solution.  And if we have
generic infrastructure for this situation in the code NAPI polling
networking code, I guarantee that it will probably be implemented much
more cheaply than this.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [1/1] stmmac: Correctly report PTP capabilities.

2015-11-01 Thread David Miller
From: Phil Reid 
Date: Fri, 30 Oct 2015 16:43:55 +0800

> priv->hwts_*_en indicate if timestamping is enabled/disabled at run
> time. But  priv->dma_cap.time_stamp  and priv->dma_cap.atime_stamp
> indicates HW is support for PTPv1/PTPv2.
> 
> Signed-off-by: Phil Reid 

Applied and queued up for -stable, thanks.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] [DCCP]: Use 64-bit timekeeping

2015-11-01 Thread David Miller
From: Tina Ruchandani 
Date: Fri, 30 Oct 2015 01:24:56 -0700

> This patch changes the use of struct timespec in
> dccp_probe to use struct timespec64 instead. timespec uses a 32-bit
> seconds field which will overflow in the year 2038 and beyond. timespec64
> uses a 64-bit seconds field. Note that the correctness of the code isn't
> changed, since the original code only uses the timestamps to compute a
> small elapsed interval. This patch is part of a larger attempt to remove
> instances of 32-bit timekeeping structures (timespec, timeval, time_t)
> from the kernel so it is easier to identify where the real 2038 issues
> are.
> 
> Signed-off-by: Tina Ruchandani 

Applied, thanks.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCHv3 net 0/2] ipv4: fix problems from the RTNH_F_LINKDOWN introduction

2015-11-01 Thread David Miller
From: Julian Anastasov 
Date: Fri, 30 Oct 2015 10:23:32 +0200

> Fix two problems from the change that introduced RTNH_F_LINKDOWN
> flag. The first patch deals with the removal of local route on
> DOWN event. The second patch makes sure the RTNH_F_LINKDOWN
> flag is properly updated on UP event because the DOWN event
> sets it in all cases.

Series applied and queued up for -stable, thanks Julian.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] net: smsc911x: Reset PHY during initialization

2015-11-01 Thread David Miller
From: Pavel Fedin 
Date: Fri, 30 Oct 2015 10:06:19 +0300

> On certain hardware after software reboot the chip may get stuck and fail
> to reinitialize during reset. This can be fixed by ensuring that PHY is
> reset too.
> 
> Old PHY resetting method required operational MDIO interface, therefore
> the chip should have been already set up. In order to be able to function
> during probe, it is changed to use PMT_CTRL register.
> 
> The problem could be observed on SMDK5410 board.
> 
> Signed-off-by: Pavel Fedin 

I'm pretty sure this is going to break the PHY loopback test.

This is such a tricky and fragile area to get right, therefore I
want you to specifically guard any change in how PHY reset is
done with tests against the specific chips that have the problem.

Furthermore, I want you to test whether this has any negative
effects on the PHY loopback test.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] NET: ATM: MPOA: Remove 32-bit timekeeping

2015-11-01 Thread David Miller
From: Tina Ruchandani 
Date: Thu, 29 Oct 2015 22:01:07 -0700

> @@ -14,9 +15,9 @@ void atm_mpoa_init_cache(struct mpoa_client *mpc);
>  typedef struct in_cache_entry {
>   struct in_cache_entry *next;
>   struct in_cache_entry *prev;
> - struct timeval  tv;
> - struct timeval  reply_wait;
> - struct timeval  hold_down;
> + time64_t  tv;
> + time64_t  reply_wait;
> + time64_t  hold_down;
>   uint32_t  packets_fwded;
>   uint16_t  entry_state;
>   uint32_t retry_time;
> @@ -51,7 +52,7 @@ struct in_cache_ops{
>  typedef struct eg_cache_entry{
>   struct   eg_cache_entry *next;
>   struct   eg_cache_entry *prev;
> - struct   timeval  tv;
> + time64_t tv;

Again, these structure member names like "tv" only make sense if
they store a "timeval".  Please rename these structure members
appropriately, thanks.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH net-next RFC] mpls: support for dead routes

2015-11-01 Thread Eric W. Biederman
Roopa Prabhu  writes:

> diff --git a/net/mpls/af_mpls.c b/net/mpls/af_mpls.c
> index c70d750..7db9678 100644
> --- a/net/mpls/af_mpls.c
> +++ b/net/mpls/af_mpls.c
> @@ -27,6 +27,8 @@
>   */
>  #define MAX_MP_SELECT_LABELS 4
>  
> +u32 mpls_multipath_secret __read_mostly;

This mpls_multipath_secret is never used.

Eric

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH net-next RFC] mpls: support for dead routes

2015-11-01 Thread Eric W. Biederman
Robert Shearman  writes:

> On 29/10/15 18:46, roopa wrote:
>> On 10/29/15, 9:53 AM, Robert Shearman wrote:
>>> On 29/10/15 15:49, Roopa Prabhu wrote:
 From: Roopa Prabhu 

 Adds support for both RTNH_F_DEAD and RTNH_F_LINKDOWN flags.
 This resembles ipv4 fib code. I also picked fib_rebalance from
 ipv4. Enabled weights support for nexthop, just because the
 infrastructure is already there.

 Signed-off-by: Roopa Prabhu 
 ---
 I want to get this in before net-next closes as promised.
 I have tested it for the dead/linkdown flags. The multipath selection
 and hash calculation in the face of dead routes needs some more
 work. I am short on cycles this week and thought of getting some
 early feedback. Hence sending this out as RFC. I will continue with some
 more testing.  Robert, I am using your hash algo but it needs some more
 work with dead routes. If you already have any thoughts on this, i will
 take them. thanks!.
>>>
>>> If you were to sort the array of nexthops (and by implication via 
>>> addresses) by their non-deadness keeping a count of the alive nexthops, 
>>> then there's no need to resort to an O(n) algorithm for selecting the 
>>> nexthop, and no need to store per-nh flags.
>>>
>>> E.g. before eth0 link down:
>>>
>>> +--+
>>> | rt_nhn = 3   |
>>> | rt_nhn_alive = 3 |
>>> +--+
>>> | nh 0:|
>>> | dev = eth0, ...  |
>>> +--+
>>> | nh 1:|
>>> | dev = eth1, ...  |
>>> +--+
>>> | nh 2:|
>>> | dev = eth0, ...  |
>>> +--+
>>> | vias ... |
>>> +--+
>>>
>>> after eth0 link down:
>>>
>>> +--+
>>> | rt_nhn = 3   |
>>> | rt_nhn_alive = 1 |
>>> +--+
>>> | nh 0:|
>>> | dev = eth1, ...  |
>>> +--+
>>> | nh 1:|
>>> | dev = eth0, ...  |
>>> +--+
>>> | nh 2:|
>>> | dev = eth0, ...  |
>>> +--+
>>> | vias ... |
>>> +--+
>>>
>>> The mpls_select_multipath algorithm just then needs to be changed to use 
>>> rt_nhn_alive instead of rt_nhn and will work otherwise as-is.
>>>
>>> On link down you'll need to alloc a new route for RCU-safety, but you can 
>>> presumably just do a kmemdup to reduce the amount of code you have to write 
>>> and sort the nexthops in the copy. Link up will be similar.
>> You mean sort the nexthops on every link and carrier event ?. I don't see a 
>> need for it.
>>>
>>> Then on the mpls_dump_route, if the index of the nexthop is >= rt_nhn_alive 
>>> then the path is link-down. If the nh_dev is NULL then generate 
>>> RTNH_F_DEAD|RTNH_F_LINKDOWN for the flags, otherwise just RTNH_F_LINKDOWN.
>> I was not thinking of making nh_dev NULL on RTNH_F_DEAD. And i would prefer 
>> to store the RTNH flags instead of deriving them on every dump.
>>>
>>> This would use less memory and be faster for forwarding.
>> Thanks for your inputs Robert. I am not see a huge advantage in sorting the 
>> nexthops on link events.
>> And i will be only saving an 'int' in a nexthop.
>
> It avoids the extra 12 bytes per nexthop and it means that you don't
> need to walk through every nexthop in the worst case to select a path
> during forwarding.

And the walk appears both inherent inherent in the notion of weighted
multipath forward.  Always forcing the code to use a O(N) algorithm when
forwarding packets seems unfortunate.

So please for this first round let's get equal cost multipath forwarding
working and then we can consider weighted multipath routing on it's own
merits.

Eric

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v6] isdn: Use ktime_t instead of 'struct timeval'

2015-11-01 Thread David Miller
From: Tina Ruchandani 
Date: Thu, 29 Oct 2015 21:08:16 -0700

> @@ -45,7 +46,7 @@ static u_int *debug;
>  static LIST_HEAD(iclock_list);
>  static DEFINE_RWLOCK(iclock_lock);
>  static u16 iclock_count; /* counter of last clock */
> -static struct timeval iclock_tv; /* time stamp of last clock */
> +static ktime_t iclock_tv;/* time stamp of last clock */
>  static int iclock_tv_valid;  /* already received one timestamp */

It only makes sense for this variable to be named "iclock_tv" when
it is of type "timeval".  And therefore it is confusing to keep
using this variable name after changing it's type to "ktime_t".

Therefore please adjust the variable name appropriately, thanks.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] net: hisilicon: Remove .owner assignment from platform_driver

2015-11-01 Thread David Miller
From: huangdaode 
Date: Fri, 30 Oct 2015 10:50:54 +0800

> platform_driver doesn't need to set .owner, because
> platform_driver_register() will set it.
> 
> Signed-off-by: huangdaode 

Applied to net-next, thanks.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


RE: [PATCH v3 net] i40e: Look up MAC address in Open Firmware or IDPROM

2015-11-01 Thread Nelson, Shannon
> -Original Message-
> From: Sowmini Varadhan [mailto:sowmini.varad...@oracle.com]
> Sent: Sunday, November 01, 2015 8:24 AM
> 

[...]

> So I figured out why it all "seemed to work" - my test env had another
> obscure init process that was marking the link promiscuous.  I guess
> that was having the side-effect of somehow setting the filters above.
> 
> But looks like there's more to getting this right than just calling
> i40e_aq_mac_address_write() - I think it also needs a
> i40e_aq_add_macvlan().
> 
> I was able to get this to work by calling a the core part of
> i40e_set_mac just before register_netdev. In my patch (RFC patch
> in a separate thread - please review) I now have this sequence in
> i40e_probe
> 
>   err = i40e_get_platform_mac_addr(pdev, hw->mac.addr);
>   if (err)
>   i40e_get_mac_addr(hw, hw->mac.addr);
>:
>   i40e_setup_pf_switch(..);
> 
> And the resulting i40e_vsi_setup() from i40e_setup_pf_switch()
> will end up doing the right thing by invoking the guts of
> i40e_set_mac(), which is basically the  sequence:
>   i40e_aq_mac_address_write()
>   i40e_aq_add_macvlan()
> 
> I dont know if it is necessary/possible/important to set up the
> filters sooner in the sequence- the add_macvlan needs an "seid",
> and I could not tell when (in the ":" code above) the right seid
> can be found.
> 
> Please review the RFC patch I'll be sending shortly.
> 
> --Sowmini

Yeah, because of the underlying HW we need to manage, and the fact that we 
can't ask it for the filters it knows, it becomes a bit convoluted.  To manage 
and replay the filter lists, we use the i40e_{add,del}_filter() routines on the 
individual VSI filter lists.  I'm thinking you're on the right track, but we 
may not want to bypass the VSI's filter list.

My brain's not in gear this weekend so I'll review the patch later.  In the 
meantime, be sure to test what happens over a reset, such as what happens when 
the MTU is changed.  This will make sure that the replay of mac and vlan 
filters happens correctly.  You'll want to test this with and without vlans.

sln

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH net-next] net: increase LL_MAX_HEADER if HYPERV_NET is enabled

2015-11-01 Thread David Miller
From: Eric Dumazet 
Date: Sun, 01 Nov 2015 09:20:59 -0800

> From: Eric Dumazet 
> 
> My recent commit, attaching SYNACK messages to request sockets
> exposed a too small LL_MAX_HEADER when netvsc_drv.c is in use,
> because this driver sets a needed_headroom of 220 bytes.
> 
> Increase LL_MAX_HEADER in this case, to avoid a realloc of all
> TCP frames.
> 
> In another patch, I'll make skb_set_owner_w() more robust.
> 
> Fixes: ca6fb0651883 ("tcp: attach SYNACK messages to request sockets instead 
> of listener")
> Signed-off-by: Eric Dumazet 
> Bisected-by: Haiyang Zhang 

Using a value of 256 just because HYPER-V is crazy imposes a huge
unnecessary burdon upon the rest of the stack.

I rejected a previous attempt to use such a huge value for
LL_MAX_HEADER, and I will do so again here.  We need a different fix
for this issue, one that doesn't hurt everyone.

Every distribution is going to turn all the options on, so you might
as well consider the largest LL_MAX_HEADER value the one %99.999
users end up paying the price for.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] net: dsa: use switchdev obj for VLAN add/del ops

2015-11-01 Thread David Miller
From: Vivien Didelot 
Date: Sun,  1 Nov 2015 12:33:55 -0500

> Simplify DSA by pushing the switchdev objects for VLAN add and delete
> operations down to its drivers. Currently only mv88e6xxx is affected.
> 
> Signed-off-by: Vivien Didelot 
> ---
> v2: make _mv88e6xxx_port_vlan_del static as spotted by the kbuild robot.

According to your previous submission this is targetted at net-next,
so that's where I applied it.

But please do not make me play guessing games like this in the future.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: HW communication debugging interface - ideas?

2015-11-01 Thread Guy Harris

On Oct 6, 2015, at 8:02 AM, Andrew Lunn  wrote:

>> Sure just throwing out an idea. I suspect whatever interface you have
>> will include the vendor-id or some other identifier and a set of
>> parsers in user space to pretty print the msg.
> 
> If you are going to use wireshark, in this case, all you need to do is
> make the stream as being Ethernet frames. The destination and
> Ethertype tell you all you need to know to identify the protocol.

You will, of course, have registered that Ethertype with the IEEE, to ensure 
nobody else registers it for use with a different protocol.--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] net: dsa: use switchdev obj for VLAN add/del ops

2015-11-01 Thread Vivien Didelot
Simplify DSA by pushing the switchdev objects for VLAN add and delete
operations down to its drivers. Currently only mv88e6xxx is affected.

Signed-off-by: Vivien Didelot 
---
v2: make _mv88e6xxx_port_vlan_del static as spotted by the kbuild robot.

 drivers/net/dsa/mv88e6171.c |   2 +-
 drivers/net/dsa/mv88e6352.c |   2 +-
 drivers/net/dsa/mv88e6xxx.c | 108 +++-
 drivers/net/dsa/mv88e6xxx.h |  12 +++--
 include/net/dsa.h   |  13 --
 net/dsa/slave.c |  29 
 6 files changed, 115 insertions(+), 51 deletions(-)

diff --git a/drivers/net/dsa/mv88e6171.c b/drivers/net/dsa/mv88e6171.c
index 2c8eb6f..1bd876e 100644
--- a/drivers/net/dsa/mv88e6171.c
+++ b/drivers/net/dsa/mv88e6171.c
@@ -115,7 +115,7 @@ struct dsa_switch_driver mv88e6171_switch_driver = {
.get_regs   = mv88e6xxx_get_regs,
.port_stp_update= mv88e6xxx_port_stp_update,
.port_pvid_get  = mv88e6xxx_port_pvid_get,
-   .port_pvid_set  = mv88e6xxx_port_pvid_set,
+   .port_vlan_prepare  = mv88e6xxx_port_vlan_prepare,
.port_vlan_add  = mv88e6xxx_port_vlan_add,
.port_vlan_del  = mv88e6xxx_port_vlan_del,
.vlan_getnext   = mv88e6xxx_vlan_getnext,
diff --git a/drivers/net/dsa/mv88e6352.c b/drivers/net/dsa/mv88e6352.c
index cbf4dd8..4458d6a 100644
--- a/drivers/net/dsa/mv88e6352.c
+++ b/drivers/net/dsa/mv88e6352.c
@@ -342,7 +342,7 @@ struct dsa_switch_driver mv88e6352_switch_driver = {
.get_regs   = mv88e6xxx_get_regs,
.port_stp_update= mv88e6xxx_port_stp_update,
.port_pvid_get  = mv88e6xxx_port_pvid_get,
-   .port_pvid_set  = mv88e6xxx_port_pvid_set,
+   .port_vlan_prepare  = mv88e6xxx_port_vlan_prepare,
.port_vlan_add  = mv88e6xxx_port_vlan_add,
.port_vlan_del  = mv88e6xxx_port_vlan_del,
.vlan_getnext   = mv88e6xxx_vlan_getnext,
diff --git a/drivers/net/dsa/mv88e6xxx.c b/drivers/net/dsa/mv88e6xxx.c
index b1b14f5..9ee1be2 100644
--- a/drivers/net/dsa/mv88e6xxx.c
+++ b/drivers/net/dsa/mv88e6xxx.c
@@ -1121,6 +1121,19 @@ int mv88e6xxx_port_stp_update(struct dsa_switch *ds, int 
port, u8 state)
return 0;
 }
 
+static int _mv88e6xxx_port_pvid_get(struct dsa_switch *ds, int port, u16 *pvid)
+{
+   int ret;
+
+   ret = _mv88e6xxx_reg_read(ds, REG_PORT(port), PORT_DEFAULT_VLAN);
+   if (ret < 0)
+   return ret;
+
+   *pvid = ret & PORT_DEFAULT_VLAN_MASK;
+
+   return 0;
+}
+
 int mv88e6xxx_port_pvid_get(struct dsa_switch *ds, int port, u16 *pvid)
 {
int ret;
@@ -1134,9 +1147,9 @@ int mv88e6xxx_port_pvid_get(struct dsa_switch *ds, int 
port, u16 *pvid)
return 0;
 }
 
-int mv88e6xxx_port_pvid_set(struct dsa_switch *ds, int port, u16 pvid)
+static int _mv88e6xxx_port_pvid_set(struct dsa_switch *ds, int port, u16 pvid)
 {
-   return mv88e6xxx_reg_write(ds, REG_PORT(port), PORT_DEFAULT_VLAN,
+   return _mv88e6xxx_reg_write(ds, REG_PORT(port), PORT_DEFAULT_VLAN,
   pvid & PORT_DEFAULT_VLAN_MASK);
 }
 
@@ -1441,61 +1454,87 @@ static int _mv88e6xxx_vlan_init(struct dsa_switch *ds, 
u16 vid,
return 0;
 }
 
-int mv88e6xxx_port_vlan_add(struct dsa_switch *ds, int port, u16 vid,
-   bool untagged)
+int mv88e6xxx_port_vlan_prepare(struct dsa_switch *ds, int port,
+   const struct switchdev_obj_port_vlan *vlan,
+   struct switchdev_trans *trans)
+{
+   /* We don't need any dynamic resource from the kernel (yet),
+* so skip the prepare phase.
+*/
+   return 0;
+}
+
+static int _mv88e6xxx_port_vlan_add(struct dsa_switch *ds, int port, u16 vid,
+   bool untagged)
 {
-   struct mv88e6xxx_priv_state *ps = ds_to_priv(ds);
struct mv88e6xxx_vtu_stu_entry vlan;
int err;
 
-   mutex_lock(&ps->smi_mutex);
-
err = _mv88e6xxx_vtu_vid_write(ds, vid - 1);
if (err)
-   goto unlock;
+   return err;
 
err = _mv88e6xxx_vtu_getnext(ds, &vlan);
if (err)
-   goto unlock;
+   return err;
 
if (vlan.vid != vid || !vlan.valid) {
err = _mv88e6xxx_vlan_init(ds, vid, &vlan);
if (err)
-   goto unlock;
+   return err;
}
 
vlan.data[port] = untagged ?
GLOBAL_VTU_DATA_MEMBER_TAG_UNTAGGED :
GLOBAL_VTU_DATA_MEMBER_TAG_TAGGED;
 
-   err = _mv88e6xxx_vtu_loadpurge(ds, &vlan);
+   return _mv88e6xxx_vtu_loadpurge(ds, &vlan);
+}
+
+int mv88e6xxx_port_vlan_add(struct dsa_switch *ds, int port,
+   const struct switchdev_obj_port_vlan *vlan,
+   struct switchdev_trans *trans)
+{
+   struct mv8

[PATCH net-next 6/8] net/mlx5e: Return error in case mlx5e_set_features() fails

2015-11-01 Thread Or Gerlitz
From: Achiad Shochat 

In case mlx5e_set_features() fails, return the failure status rather
than 0.

Signed-off-by: Achiad Shochat 
Signed-off-by: Or Gerlitz 
---
 drivers/net/ethernet/mellanox/mlx5/core/en_main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c 
b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
index df9cecd..b284bfc 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
@@ -1844,7 +1844,7 @@ static int mlx5e_set_features(struct net_device *netdev,
mlx5e_disable_vlan_filter(priv);
}
 
-   return 0;
+   return err;
 }
 
 static int mlx5e_change_mtu(struct net_device *netdev, int new_mtu)
-- 
2.3.7

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH net-next 5/8] net/mlx5e: Don't allow more than max supported channels

2015-11-01 Thread Or Gerlitz
From: Achiad Shochat 

Consider MLX5E_MAX_NUM_CHANNELS @ethtool set/get_channels

Signed-off-by: Achiad Shochat 
Signed-off-by: Or Gerlitz 
---
 drivers/net/ethernet/mellanox/mlx5/core/en.h | 6 ++
 drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c | 5 ++---
 drivers/net/ethernet/mellanox/mlx5/core/en_main.c| 3 +--
 3 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en.h 
b/drivers/net/ethernet/mellanox/mlx5/core/en.h
index 3c5c900..c403a83 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en.h
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en.h
@@ -620,5 +620,11 @@ static inline void mlx5e_cq_arm(struct mlx5e_cq *cq)
mlx5_cq_arm(mcq, MLX5_CQ_DB_REQ_NOT, mcq->uar->map, NULL, cq->wq.cc);
 }
 
+static inline int mlx5e_get_max_num_channels(struct mlx5_core_dev *mdev)
+{
+   return min_t(int, mdev->priv.eq_table.num_comp_vectors,
+MLX5E_MAX_NUM_CHANNELS);
+}
+
 extern const struct ethtool_ops mlx5e_ethtool_ops;
 u16 mlx5e_get_max_inline_cap(struct mlx5_core_dev *mdev);
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c 
b/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c
index bce9126..2e022e9 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c
@@ -345,9 +345,8 @@ static void mlx5e_get_channels(struct net_device *dev,
   struct ethtool_channels *ch)
 {
struct mlx5e_priv *priv = netdev_priv(dev);
-   int ncv = priv->mdev->priv.eq_table.num_comp_vectors;
 
-   ch->max_combined   = ncv;
+   ch->max_combined   = mlx5e_get_max_num_channels(priv->mdev);
ch->combined_count = priv->params.num_channels;
 }
 
@@ -355,7 +354,7 @@ static int mlx5e_set_channels(struct net_device *dev,
  struct ethtool_channels *ch)
 {
struct mlx5e_priv *priv = netdev_priv(dev);
-   int ncv = priv->mdev->priv.eq_table.num_comp_vectors;
+   int ncv = mlx5e_get_max_num_channels(priv->mdev);
unsigned int count = ch->combined_count;
bool was_opened;
int err = 0;
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c 
b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
index bdbef9f..df9cecd 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
@@ -2048,8 +2048,7 @@ static void *mlx5e_create_netdev(struct mlx5_core_dev 
*mdev)
 {
struct net_device *netdev;
struct mlx5e_priv *priv;
-   int nch = min_t(int, mdev->priv.eq_table.num_comp_vectors,
-   MLX5E_MAX_NUM_CHANNELS);
+   int nch = mlx5e_get_max_num_channels(mdev);
int err;
 
if (mlx5e_check_required_hca_cap(mdev))
-- 
2.3.7

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH net-next 8/8] net/mlx5e: Fix LSO vlan insertion

2015-11-01 Thread Or Gerlitz
From: Achiad Shochat 

Consider vlan insertion impact on headers copy size also for LSO
packets.

Signed-off-by: Achiad Shochat 
Signed-off-by: Or Gerlitz 
---
 drivers/net/ethernet/mellanox/mlx5/core/en_tx.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_tx.c 
b/drivers/net/ethernet/mellanox/mlx5/core/en_tx.c
index 5105288..cd8f85a 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_tx.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_tx.c
@@ -116,7 +116,7 @@ static inline u16 mlx5e_get_inline_hdr_size(struct mlx5e_sq 
*sq,
 * headers and occur before the data gather.
 * Therefore these headers must be copied into the WQE
 */
-#define MLX5E_MIN_INLINE (ETH_HLEN + 2/*vlan tag*/)
+#define MLX5E_MIN_INLINE ETH_HLEN
 
if (bf && (skb_headlen(skb) <= sq->max_inline))
return skb_headlen(skb);
@@ -128,7 +128,7 @@ static inline void mlx5e_insert_vlan(void *start, struct 
sk_buff *skb, u16 ihs)
 {
struct vlan_ethhdr *vhdr = (struct vlan_ethhdr *)start;
int cpy1_sz = 2 * ETH_ALEN;
-   int cpy2_sz = ihs - cpy1_sz - VLAN_HLEN;
+   int cpy2_sz = ihs - cpy1_sz;
 
skb_copy_from_linear_data(skb, vhdr, cpy1_sz);
skb_pull_inline(skb, cpy1_sz);
@@ -192,6 +192,7 @@ static netdev_tx_t mlx5e_sq_xmit(struct mlx5e_sq *sq, 
struct sk_buff *skb)
 
if (skb_vlan_tag_present(skb)) {
mlx5e_insert_vlan(eseg->inline_hdr_start, skb, ihs);
+   ihs += VLAN_HLEN;
} else {
skb_copy_from_linear_data(skb, eseg->inline_hdr_start, ihs);
skb_pull_inline(skb, ihs);
-- 
2.3.7

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH net-next 0/8] Mellanox driver update, Nov 1 2015

2015-11-01 Thread Or Gerlitz
Hi Dave,

This series contains bunch of small fixes to the mlx5e driver from Achiad.

Applies on net-next commit e7b63ff "Merge branch 'master' of 
git://git.kernel.org/pub/scm/linux/kernel/git/klassert/ipsec-next"

Or.

Achiad Shochat (8):
  net/mlx5e: Avoid NULL pointer access in case of configuration failure
  net/mlx5e: Wait for RX buffers initialization in a more proper manner
  net/mlx5_core: Use the the real irqn in eq->irqn
  net/mlx5e: Consider IRQ affinity changes in NAPI poll
  net/mlx5e: Don't allow more than max supported channels
  net/mlx5e: Return error in case mlx5e_set_features() fails
  net/mlx5e: Re-eanble client vlan TX acceleration
  net/mlx5e: Fix LSO vlan insertion

 drivers/net/ethernet/mellanox/mlx5/core/en.h   |  9 
 .../net/ethernet/mellanox/mlx5/core/en_ethtool.c   |  5 ++---
 drivers/net/ethernet/mellanox/mlx5/core/en_main.c  | 17 +-
 drivers/net/ethernet/mellanox/mlx5/core/en_tx.c| 26 +++---
 drivers/net/ethernet/mellanox/mlx5/core/en_txrx.c  | 12 +-
 drivers/net/ethernet/mellanox/mlx5/core/eq.c   |  8 +++
 6 files changed, 61 insertions(+), 16 deletions(-)

-- 
2.3.7

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH net-next 2/8] net/mlx5e: Wait for RX buffers initialization in a more proper manner

2015-11-01 Thread Or Gerlitz
From: Achiad Shochat 

Use jiffies rather than wait loop with msleep().

The wait loop didn't take into consideration time when the
process was not executing.

Signed-off-by: Achiad Shochat 
Signed-off-by: Or Gerlitz 
---
 drivers/net/ethernet/mellanox/mlx5/core/en_main.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c 
b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
index 9df6f9a..0bab33c 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
@@ -442,12 +442,12 @@ static void mlx5e_disable_rq(struct mlx5e_rq *rq)
 
 static int mlx5e_wait_for_min_rx_wqes(struct mlx5e_rq *rq)
 {
+   unsigned long exp_time = jiffies + msecs_to_jiffies(2);
struct mlx5e_channel *c = rq->channel;
struct mlx5e_priv *priv = c->priv;
struct mlx5_wq_ll *wq = &rq->wq;
-   int i;
 
-   for (i = 0; i < 1000; i++) {
+   while (time_before(jiffies, exp_time)) {
if (wq->cur_sz >= priv->params.min_rx_wqes)
return 0;
 
-- 
2.3.7

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH net-next 7/8] net/mlx5e: Re-eanble client vlan TX acceleration

2015-11-01 Thread Or Gerlitz
From: Achiad Shochat 

This reverts commit cd58c714acb9 "net/mlx5e: Disable client vlan TX 
acceleration".

Bring back client vlan insertion offload, the original
performance issue was found and fixed in the next patch.

Signed-off-by: Achiad Shochat 
Signed-off-by: Or Gerlitz 
---
 drivers/net/ethernet/mellanox/mlx5/core/en_main.c |  1 +
 drivers/net/ethernet/mellanox/mlx5/core/en_tx.c   | 23 +--
 2 files changed, 22 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c 
b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
index b284bfc..b87f5f2 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
@@ -2005,6 +2005,7 @@ static void mlx5e_build_netdev(struct net_device *netdev)
netdev->vlan_features|= NETIF_F_LRO;
 
netdev->hw_features   = netdev->vlan_features;
+   netdev->hw_features  |= NETIF_F_HW_VLAN_CTAG_TX;
netdev->hw_features  |= NETIF_F_HW_VLAN_CTAG_RX;
netdev->hw_features  |= NETIF_F_HW_VLAN_CTAG_FILTER;
 
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_tx.c 
b/drivers/net/ethernet/mellanox/mlx5/core/en_tx.c
index b73672f..5105288 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_tx.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_tx.c
@@ -124,6 +124,21 @@ static inline u16 mlx5e_get_inline_hdr_size(struct 
mlx5e_sq *sq,
return MLX5E_MIN_INLINE;
 }
 
+static inline void mlx5e_insert_vlan(void *start, struct sk_buff *skb, u16 ihs)
+{
+   struct vlan_ethhdr *vhdr = (struct vlan_ethhdr *)start;
+   int cpy1_sz = 2 * ETH_ALEN;
+   int cpy2_sz = ihs - cpy1_sz - VLAN_HLEN;
+
+   skb_copy_from_linear_data(skb, vhdr, cpy1_sz);
+   skb_pull_inline(skb, cpy1_sz);
+   vhdr->h_vlan_proto = skb->vlan_proto;
+   vhdr->h_vlan_TCI = cpu_to_be16(skb_vlan_tag_get(skb));
+   skb_copy_from_linear_data(skb, &vhdr->h_vlan_encapsulated_proto,
+ cpy2_sz);
+   skb_pull_inline(skb, cpy2_sz);
+}
+
 static netdev_tx_t mlx5e_sq_xmit(struct mlx5e_sq *sq, struct sk_buff *skb)
 {
struct mlx5_wq_cyc   *wq   = &sq->wq;
@@ -175,8 +190,12 @@ static netdev_tx_t mlx5e_sq_xmit(struct mlx5e_sq *sq, 
struct sk_buff *skb)
ETH_ZLEN);
}
 
-   skb_copy_from_linear_data(skb, eseg->inline_hdr_start, ihs);
-   skb_pull_inline(skb, ihs);
+   if (skb_vlan_tag_present(skb)) {
+   mlx5e_insert_vlan(eseg->inline_hdr_start, skb, ihs);
+   } else {
+   skb_copy_from_linear_data(skb, eseg->inline_hdr_start, ihs);
+   skb_pull_inline(skb, ihs);
+   }
 
eseg->inline_hdr_sz = cpu_to_be16(ihs);
 
-- 
2.3.7

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH net-next 3/8] net/mlx5_core: Use the the real irqn in eq->irqn

2015-11-01 Thread Or Gerlitz
From: Achiad Shochat 

Instead of storing the msix array index in eq->irqn (vecidx),
store the real irq number.

Signed-off-by: Achiad Shochat 
Signed-off-by: Saeed Mahameed 
Signed-off-by: Or Gerlitz 
---
 drivers/net/ethernet/mellanox/mlx5/core/eq.c | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/eq.c 
b/drivers/net/ethernet/mellanox/mlx5/core/eq.c
index 1f01fe8..713ead5 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/eq.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/eq.c
@@ -382,10 +382,10 @@ int mlx5_create_map_eq(struct mlx5_core_dev *dev, struct 
mlx5_eq *eq, u8 vecidx,
 name, pci_name(dev->pdev));
 
eq->eqn = out.eq_number;
-   eq->irqn = vecidx;
+   eq->irqn = priv->msix_arr[vecidx].vector;
eq->dev = dev;
eq->doorbell = uar->map + MLX5_EQ_DOORBEL_OFFSET;
-   err = request_irq(priv->msix_arr[vecidx].vector, mlx5_msix_handler, 0,
+   err = request_irq(eq->irqn, mlx5_msix_handler, 0,
  priv->irq_info[vecidx].name, eq);
if (err)
goto err_eq;
@@ -421,12 +421,12 @@ int mlx5_destroy_unmap_eq(struct mlx5_core_dev *dev, 
struct mlx5_eq *eq)
int err;
 
mlx5_debug_eq_remove(dev, eq);
-   free_irq(dev->priv.msix_arr[eq->irqn].vector, eq);
+   free_irq(eq->irqn, eq);
err = mlx5_cmd_destroy_eq(dev, eq->eqn);
if (err)
mlx5_core_warn(dev, "failed to destroy a previously created eq: 
eqn %d\n",
   eq->eqn);
-   synchronize_irq(dev->priv.msix_arr[eq->irqn].vector);
+   synchronize_irq(eq->irqn);
mlx5_buf_free(dev, &eq->buf);
 
return err;
-- 
2.3.7

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH net-next 4/8] net/mlx5e: Consider IRQ affinity changes in NAPI poll

2015-11-01 Thread Or Gerlitz
From: Achiad Shochat 

Under heavy network traffic load we may be in NAPI poll mode for
a long time, thus IRQ affinity changes do not affect NAPI as desired.

Now once in a NAPI poll session we check the channel IRQ affinity,
if it points to a different CPU core than the current, stop polling
and the following device interrupt will fix the NAPI affinity.

Signed-off-by: Achiad Shochat 
Signed-off-by: Or Gerlitz 
---
 drivers/net/ethernet/mellanox/mlx5/core/en.h  |  3 +++
 drivers/net/ethernet/mellanox/mlx5/core/en_main.c |  1 +
 drivers/net/ethernet/mellanox/mlx5/core/en_txrx.c | 12 +++-
 3 files changed, 15 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en.h 
b/drivers/net/ethernet/mellanox/mlx5/core/en.h
index 0983a20..3c5c900 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en.h
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en.h
@@ -406,6 +406,9 @@ struct mlx5e_channel {
u8 num_tc;
unsigned long  flags;
 
+   /* data path - accessed per napi poll */
+   struct irq_desc   *irq_desc;
+
/* control */
struct mlx5e_priv *priv;
intix;
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c 
b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
index 0bab33c..bdbef9f 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
@@ -1004,6 +1004,7 @@ static int mlx5e_open_channel(struct mlx5e_priv *priv, 
int ix,
goto err_close_sqs;
 
netif_set_xps_queue(netdev, get_cpu_mask(c->cpu), ix);
+   c->irq_desc = irq_to_desc(c->rq.cq.mcq.irqn);
*cp = c;
 
return 0;
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_txrx.c 
b/drivers/net/ethernet/mellanox/mlx5/core/en_txrx.c
index 2c7cb67..99e29c9 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_txrx.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_txrx.c
@@ -30,6 +30,7 @@
  * SOFTWARE.
  */
 
+#include 
 #include "en.h"
 
 struct mlx5_cqe64 *mlx5e_get_cqe(struct mlx5e_cq *cq)
@@ -49,6 +50,15 @@ struct mlx5_cqe64 *mlx5e_get_cqe(struct mlx5e_cq *cq)
return cqe;
 }
 
+static inline bool mlx5e_no_channel_affinity_change(struct mlx5e_channel *c)
+{
+   int current_cpu = smp_processor_id();
+   struct irq_data *d = irq_desc_get_irq_data(c->irq_desc);
+   struct cpumask *aff = irq_data_get_affinity_mask(d);
+
+   return cpumask_test_cpu(current_cpu, aff);
+}
+
 int mlx5e_napi_poll(struct napi_struct *napi, int budget)
 {
struct mlx5e_channel *c = container_of(napi, struct mlx5e_channel,
@@ -65,7 +75,7 @@ int mlx5e_napi_poll(struct napi_struct *napi, int budget)
 
busy |= mlx5e_post_rx_wqes(&c->rq);
 
-   if (busy)
+   if (busy && likely(mlx5e_no_channel_affinity_change(c)))
return budget;
 
napi_complete(napi);
-- 
2.3.7

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH net-next 1/8] net/mlx5e: Avoid NULL pointer access in case of configuration failure

2015-11-01 Thread Or Gerlitz
From: Achiad Shochat 

In case a configuration operation that involves closing and re-opening
resources (e.g RX/TX queue size change) fails at the re-opening stage
these resources will remain closed.
So when executing (following) configuration operations (e.g ifconfig
down) we cannot assume that these resources are available.

Signed-off-by: Achiad Shochat 
Signed-off-by: Or Gerlitz 
---
 drivers/net/ethernet/mellanox/mlx5/core/en_main.c | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c 
b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
index bb801a9..9df6f9a 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
@@ -1404,6 +1404,12 @@ int mlx5e_close_locked(struct net_device *netdev)
 {
struct mlx5e_priv *priv = netdev_priv(netdev);
 
+   /* May already be CLOSED in case a previous configuration operation
+* (e.g RX/TX queue size change) that involves close&open failed.
+*/
+   if (!test_bit(MLX5E_STATE_OPENED, &priv->state))
+   return 0;
+
clear_bit(MLX5E_STATE_OPENED, &priv->state);
 
mlx5e_redirect_rqts(priv);
-- 
2.3.7

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH net-next] net: increase LL_MAX_HEADER if HYPERV_NET is enabled

2015-11-01 Thread Eric Dumazet
From: Eric Dumazet 

My recent commit, attaching SYNACK messages to request sockets
exposed a too small LL_MAX_HEADER when netvsc_drv.c is in use,
because this driver sets a needed_headroom of 220 bytes.

Increase LL_MAX_HEADER in this case, to avoid a realloc of all
TCP frames.

In another patch, I'll make skb_set_owner_w() more robust.

Fixes: ca6fb0651883 ("tcp: attach SYNACK messages to request sockets instead of 
listener")
Signed-off-by: Eric Dumazet 
Bisected-by: Haiyang Zhang 
---
 include/linux/netdevice.h |6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index 4ac653b7b8ac..04e3864e660e 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -132,8 +132,10 @@ static inline bool dev_xmit_complete(int rc)
  * used.
  */
 
-#if defined(CONFIG_WLAN) || IS_ENABLED(CONFIG_AX25)
-# if defined(CONFIG_MAC80211_MESH)
+#if defined(CONFIG_WLAN) || IS_ENABLED(CONFIG_AX25) || 
IS_ENABLED(CONFIG_HYPERV_NET)
+# if IS_ENABLED(CONFIG_HYPERV_NET)
+# define LL_MAX_HEADER 256
+# elif defined(CONFIG_MAC80211_MESH)
 #  define LL_MAX_HEADER 128
 # else
 #  define LL_MAX_HEADER 96


--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Apsveicam Uzvarētājs - Ref Nē: Sp/229/0-01/07/5-02/ES.

2015-11-01 Thread Jennifer Sullivan
Apsveicam Uzvarētājs - Ref Nē: Sp/229/0-01/07/5-02/ES.
Jūsu e-pasts ID ir tikko ieguva € 150,000.00 Eiro(Viens simts piecdesmit 
tūkstoši. Eiro) uz Uplift Starptautiskā Labdarības programma. Ref Nr 
Sp/229/0-01/07/5-02/ES. Lucky Nr 9/11/13/24/40.
Lai iegūtu vairāk informācijas un kontaktu prasījuma procedūrām;
CAPITAL CLAIM AGENCY
Mr. John Carlos.
E-pasts: infoasse...@gmail.com
Tel: +34-672-853-656 (Runāt un Angleščina tikai)
Ar savu vārdu un uzvārdu, adresi, vecums, nodarbošanās, tālruņa numurus
Sūtiet savu atbildi uz šo e-pastu: 
infoasse...@gmail.com
Piezīme: Šis ir starptautisks loterija programmu. Šī ziņa tika tulkots no 
Latvijas Angleščina
Apsveicam!
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH net-next v2 0/5] BPF updates

2015-11-01 Thread David Miller
From: Daniel Borkmann 
Date: Thu, 29 Oct 2015 14:58:05 +0100

> This set adds support for persistent maps/progs. Please see
> individual patches for further details. A man-page update
> to bpf(2) will be sent later on, also a iproute2 patch for
> support in tc.
> 
> Thanks!
> 
> v1 -> v2:
>   - Reworked most of patch 4 and 5
>   - Rebased to latest net-next

I'm going to let this sit for a little bit of review time since
this facility seems to be generating at least a little bit of
controversy :-)
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] VSOCK: define VSOCK_SS_LISTEN once only

2015-11-01 Thread David Miller
From: Stefan Hajnoczi 
Date: Thu, 29 Oct 2015 11:57:42 +

> The SS_LISTEN socket state is defined by both af_vsock.c and
> vmci_transport.c.  This is risky since the value could be changed in one
> file and the other would be out of sync.
> 
> Rename from SS_LISTEN to VSOCK_SS_LISTEN since the constant is not part
> of enum socket_state (SS_CONNECTED, ...).  This way it is clear that the
> constant is vsock-specific.
> 
> The big text reflow in af_vsock.c was necessary to keep to the maximum
> line length.  Text is unchanged except for s/SS_LISTEN/VSOCK_SS_LISTEN/.
> 
> Signed-off-by: Stefan Hajnoczi 

Applied to net-next, thanks.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] net: phy: fix a bug in get_phy_c45_ids

2015-11-01 Thread David Miller
From: 
Date: Thu, 29 Oct 2015 17:09:37 +0800

> From: Shaohui Xie 
> 
> When probing devices-in-package for a c45 phy, device zero is the last
> device to probe, in a rare situation which driver can read a '0' from
> the device zero, thus c45_ids->devices_in_package is set to '0', so the
> loop condition of probing is matched, see codes below:
> 
> for (i = 1;i < num_ids && c45_ids->devices_in_package == 0;i++)
> 
> driver will run in a dead loop.
> 
> So after probing the device zero, driver should stop the probing loop.
> 
> Signed-off-by: Shaohui Xie 

This bug only exists because the loop is extremely confusing.

Please fix this by restructuring the loop:

1) Break out this code:

reg_addr = MII_ADDR_C45 | i << 16 | MDIO_DEVS2;
phy_reg = mdiobus_read(bus, addr, reg_addr);
if (phy_reg < 0)
return -EIO;
c45_ids->devices_in_package = (phy_reg & 0x) << 16;

reg_addr = MII_ADDR_C45 | i << 16 | MDIO_DEVS1;
phy_reg = mdiobus_read(bus, addr, reg_addr);
if (phy_reg < 0)
return -EIO;
c45_ids->devices_in_package |= (phy_reg & 0x);

   into a helper function that takes "c45_ids, bus, addr, i" as arguments
   and returns an error, either 0 or -EIO.  Call it "phy_check_devs_in_pkg"
   or similar.

2) Rewrite the loop as:

for (i = 1;
 i < num_ids && c45_ids->devices_in_package == 0;
 i++) {
err = phy_check_devs_in_pkg(c45_ids, bus, addr, i);
if (err < 0)
return err;
if ((c45_ids->devices_in_package & 0x1fff) == 0x1fff) {
if (i) {
/*  If mostly Fs, there is no device there,
 *  then let's continue to probe more, as some
 *  10G PHYs have zero Devices In package,
 *  e.g. Cortina CS4315/CS4340 PHY.
 */
err = phy_check_devs_in_pkg(c45_ids, bus, addr, 
0);
if (err)
return err;
break;
}
} else {
/* no device there, let's get out of here */
*phy_id = 0x;
return 0;
}
}
}

Thanks.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] net: smsc911x: Fix crash if loopback test fails

2015-11-01 Thread David Miller
From: Pavel Fedin 
Date: Thu, 29 Oct 2015 09:45:22 +0300

> On certain hardware in certain situations loopback test fails and the
> driver gets removed. During mdiobus_unregister() instance of PHY driver
> gets disposed. But by this time it has already been started using
> phy_connect_direct().
> 
> PHY driver uses DELAYED_WORK in order to maintain its state. Attempting
> to dispose the driver without calling phy_disconnect() causes deallocation
> of DELAYED_WORK being active. This shortly causes a bad crash in timer
> code.
> 
> The problem can be discovered by enabling CONFIG_DEBUG_OBJECTS_TIMERS and
> CONFIG_DEBUG_OBJECTS_FREE
> 
> Signed-off-by: Pavel Fedin 

Applied, thanks.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH net 1/1] tipc: linearize arriving NAME_DISTR and LINK_PROTO buffers

2015-11-01 Thread David Miller
From: Jon Maloy 
Date: Wed, 28 Oct 2015 13:09:53 -0400

> Testing of the new UDP bearer has revealed that reception of
> NAME_DISTRIBUTOR, LINK_PROTOCOL/RESET and LINK_PROTOCOL/ACTIVATE
> message buffers is not prepared for the case that those may be
> non-linear.
> 
> We now linearize all such buffers before they are delivered up to the
> generic reception layer.
> 
> In order for the commit to apply cleanly to 'net' and 'stable', we do
> the change in the function tipc_udp_recv() for now. Later, we will post
> a commit to 'net-next' moving the linearization to generic code, in
> tipc_named_rcv() and tipc_link_proto_rcv().
> 
> Fixes: commit d0f91938bede ("tipc: add ip/udp media type")
> Signed-off-by: Jon Maloy 

Applied and queued up for -stable, thanks.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH net] amd-xgbe: Fix race between access of desc and desc index

2015-11-01 Thread David Miller
From: Tom Lendacky 
Date: Wed, 28 Oct 2015 08:48:36 -0500

> On 10/27/2015 09:50 PM, David Miller wrote:
>> From: Tom Lendacky 
>> Date: Mon, 26 Oct 2015 17:13:54 -0500
>>
>>> During Tx cleanup it's still possible for the descriptor data to be
>>> read ahead of the descriptor index. A memory barrier is required
>>> between
>>> the read of the descriptor index and the start of the Tx cleanup loop.
>>> This allows a change to a lighter-weight barrier in the Tx transmit
>>> routine just before updating the current descriptor index.
>>>
>>> Since the memory barrier does result in extra overhead on arm64, keep
>>> the previous change to not chase the current descriptor value. This
>>> prevents the execution of the barrier for each loop performed.
>>>
>>> Suggested-by: Alexander Duyck 
>>> Signed-off-by: Tom Lendacky 
>>
>> Applied, thanks.
>>
> 
> Thanks David.  Could you queue this up for the 4.1 and 4.2 stable
> trees?

Ok, done.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] fec: Use gpio_set_value_cansleep()

2015-11-01 Thread David Miller
From: Fabio Estevam 
Date: Wed, 28 Oct 2015 10:20:30 -0200

> From: Fabio Estevam 
> 
> We are in a context where we can sleep, and the FEC PHY reset gpio
> may be on an I2C expander. Use the cansleep() variant when
> setting the GPIO value.
> 
> Based on a patch from Russell King for pci-mvebu.c.
> 
> Signed-off-by: Fabio Estevam 

Applied.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH net-next v3 0/4] net: clean up interactions of CHECKSUM_PARTIAL and fragmentation

2015-11-01 Thread David Miller
From: Hannes Frederic Sowa 
Date: Tue, 27 Oct 2015 22:40:38 +0100

> This series fixes wrong checksums on the wire for IPv4 and IPv6. Large
> send buffers and especially NFS lead to wrong checksums in both IPv4
> and IPv6.
> 
> CHECKSUM_PARTIAL skbs should not receive the respective fragmentations
> functions, so we add WARN_ON_ONCE to those functions to fix up those as
> soon as they get reported.
> 
> Changelog:
> v2: added v4 checks
> v3: removed WARN_ON_ONCES (advice by Tom Herbert)

Series applied, thanks.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: HW communication debugging interface - ideas?

2015-11-01 Thread David Miller
From: Jiri Pirko 
Date: Wed, 30 Sep 2015 15:51:41 +0200

> 2) generic Netlink (genl) interface. Easy to put metadata in, including the
> device identificator (pci address). User then can use nlmon in order to
> be able to use wireshark to see the netlink messages.
> 
> Looks like 2) might be viable, well-defined, generic interface to carry
> this info. What do you think? Does this make sense?

Sorry for the late response.  I definitely prefer this netlink idea,
particularly for the metadata aspect.

Yes, the ethernet frames should "identify" the device, but I much more
like the idea of precisely having the geographic ID of the device (PCI
ID, whatever) available as metadata as well.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] ip: find correct route for socket which is not bound (v2)

2015-11-01 Thread David Miller
From: Wengang Wang 
Date: Fri, 25 Sep 2015 09:52:40 +0800

> diff --git a/net/ipv4/route.c b/net/ipv4/route.c
> index 5f4a556..c0534c2 100644
> --- a/net/ipv4/route.c
> +++ b/net/ipv4/route.c
> @@ -2097,7 +2097,10 @@ struct rtable *__ip_route_output_key(struct net *net, 
> struct flowi4 *fl4)
>*/
>  
>   fl4->flowi4_oif = dev_out->ifindex;
> - goto make_route;
> + if (dev_out->flags & IFF_LOOPBACK)
> + goto make_route;
> + else
> + goto lookup;
>   }

This is still broken.

By definition invoking fib_lookup() and depending upon it finding
something in this path is going to break things for somebody,
somewhere.  Before your change, if we lacked a multicast route,
the user would still get a functioning path.

Furthermore, most of the other "goto make_route" cases in this
function suffer from the same exact problem you're trying to
solve.  Therefore, special casing one instance makes no sense
at all.

I want you to, instead of making potentially lethal semantic changes
here, fix the real problem instead.

That is, I want you to fix how we do not cache routes we create merely
because we lack a fib_info.

Thanks.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH net-next] bridge: vlan: Use rcu_dereference instead of rtnl_dereference

2015-11-01 Thread Ido Schimmel
br_should_learn() is protected by RCU and not by RTNL, so use correct
flavor of nbp_vlan_group().

Fixes: 907b1e6e83ed ("bridge: vlan: use proper rcu for the vlgrp
member")
Signed-off-by: Ido Schimmel 
Acked-by: Nikolay Aleksandrov 
---
 net/bridge/br_vlan.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/bridge/br_vlan.c b/net/bridge/br_vlan.c
index 5f0d0cc..99a083e 100644
--- a/net/bridge/br_vlan.c
+++ b/net/bridge/br_vlan.c
@@ -482,7 +482,7 @@ bool br_should_learn(struct net_bridge_port *p, struct 
sk_buff *skb, u16 *vid)
if (!br->vlan_enabled)
return true;
 
-   vg = nbp_vlan_group(p);
+   vg = nbp_vlan_group_rcu(p);
if (!vg || !vg->num_vlans)
return false;
 
-- 
2.4.10

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v4 RFC net] i40e: Look up MAC address in Open Firmware or IDPROM

2015-11-01 Thread Sowmini Varadhan
This is the i40e equivalent of commit c762dff24c06 ("ixgbe: Look up MAC
address in Open Firmware or IDPROM").

As with that fix, attempt to look up the MAC address in Open Firmware
on systems that support it, and use IDPROM on SPARC if no OF address
is found.

In the case of the i40e there is an assumption that the default mac
address has already been set up as the primary mac filter on probe,
so if this filter is obtained from the Open Firmware or IDPROM, an
explicit write is needed via i40e_aq_mac_address_write() and
i40e_aq_add_macvlan() invocation.

Reviewers: please check if invoking i40e_macaddr_init() on 
platforms that use the default mac address (i.e., when it is not from
OF or idprom) will cause harm, and if it is necessary/possible to
move this invocation to an earlier point in i40e_probe().

Reviewed-by: Martin K. Petersen 
Signed-off-by: Sowmini Varadhan 
---
v2, v3: Andy Shevchenko comments
v4: 

 drivers/net/ethernet/intel/i40e/i40e_main.c |   53 ++-
 1 files changed, 52 insertions(+), 1 deletions(-)

diff --git a/drivers/net/ethernet/intel/i40e/i40e_main.c 
b/drivers/net/ethernet/intel/i40e/i40e_main.c
index b825f97..3c81c0c 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_main.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_main.c
@@ -24,6 +24,15 @@
  *
  
**/
 
+#include 
+#include 
+#include 
+
+#ifdef CONFIG_SPARC
+#include 
+#include 
+#endif
+
 /* Local includes */
 #include "i40e.h"
 #include "i40e_diag.h"
@@ -9212,6 +9221,25 @@ static struct i40e_vsi *i40e_vsi_reinit_setup(struct 
i40e_vsi *vsi)
return NULL;
 }
 
+static int i40e_macaddr_init( struct i40e_vsi *vsi, u8 *macaddr)
+{
+   int ret; 
+   struct i40e_aqc_add_macvlan_element_data element;
+
+   ret = i40e_aq_mac_address_write(&vsi->back->hw,
+   I40E_AQC_WRITE_TYPE_LAA_WOL,
+   macaddr, NULL);
+   if (ret)
+   return -EADDRNOTAVAIL;
+
+   memset(&element, 0, sizeof(element));
+   ether_addr_copy(element.mac_addr, macaddr);
+   element.flags = cpu_to_le16(I40E_AQC_MACVLAN_ADD_PERFECT_MATCH);
+   i40e_aq_add_macvlan(&vsi->back->hw, vsi->seid, &element, 1, NULL);
+
+   return ret;
+}
+
 /**
  * i40e_vsi_setup - Set up a VSI by a given type
  * @pf: board private structure
@@ -9341,6 +9369,9 @@ struct i40e_vsi *i40e_vsi_setup(struct i40e_pf *pf, u8 
type,
ret = i40e_config_netdev(vsi);
if (ret)
goto err_netdev;
+   ret = i40e_macaddr_init(vsi, pf->hw.mac.addr); 
+   if (ret)
+   goto err_netdev;
ret = register_netdev(vsi->netdev);
if (ret)
goto err_netdev;
@@ -10162,6 +10193,24 @@ static void i40e_print_features(struct i40e_pf *pf)
kfree(string);
 }
 
+static int i40e_get_platform_mac_addr(struct pci_dev *pdev, u8 *mac_addr)
+{
+   struct device_node *dp = pci_device_to_OF_node(pdev);
+   const unsigned char *addr;
+
+   addr = of_get_mac_address(dp);
+   if (addr) {
+   ether_addr_copy(mac_addr, addr);
+   return 0;
+   }
+#ifdef CONFIG_SPARC
+   ether_addr_copy(mac_addr, idprom->id_ethaddr);
+   return 0;
+#else
+   return -EINVAL;
+#endif /* CONFIG_SPARC */
+}
+
 /**
  * i40e_probe - Device initialization routine
  * @pdev: PCI device information struct
@@ -10360,7 +10409,9 @@ static int i40e_probe(struct pci_dev *pdev, const 
struct pci_device_id *ent)
i40e_aq_stop_lldp(hw, true, NULL);
}
 
-   i40e_get_mac_addr(hw, hw->mac.addr);
+   err = i40e_get_platform_mac_addr(pdev, hw->mac.addr);
+   if (err)
+   i40e_get_mac_addr(hw, hw->mac.addr);
if (!is_valid_ether_addr(hw->mac.addr)) {
dev_info(&pdev->dev, "invalid MAC address %pM\n", hw->mac.addr);
err = -EIO;
-- 
1.7.1

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v3 net] i40e: Look up MAC address in Open Firmware or IDPROM

2015-11-01 Thread Sowmini Varadhan
On (10/30/15 19:13), Sowmini Varadhan wrote:
> > In looking at a couple other drivers, I see the difference being that
> > they typically are writing the primary mac filter on probe (and any
> > other reset), whereas the i40e "knows" that the default mac address is
> > already set up as the filter and doesn't bother with a redundant write.
> > If you want to add this Open Filter code, you'll need to arrange for
> > this write to happen.  You can't call i40e_set_mac() to do it, but you
> > can see the i40e_aq_mac_address_write() code there that is involved in
> > updating the mac address as an example.  You probably will want to look
> > at section 4.2.1.5.3 of the XL710 data sheet in order to know how to
> > use i40e_aq_mac_address_write() for your situation.
>
> ok. I'll look into it (and also why this did not show up in my testing).

So I figured out why it all "seemed to work" - my test env had another
obscure init process that was marking the link promiscuous.  I guess
that was having the side-effect of somehow setting the filters above.

But looks like there's more to getting this right than just calling
i40e_aq_mac_address_write() - I think it also needs a i40e_aq_add_macvlan().  

I was able to get this to work by calling a the core part of
i40e_set_mac just before register_netdev. In my patch (RFC patch 
in a separate thread - please review) I now have this sequence in
i40e_probe

err = i40e_get_platform_mac_addr(pdev, hw->mac.addr);
if (err)
i40e_get_mac_addr(hw, hw->mac.addr);
 : 
i40e_setup_pf_switch(..);

And the resulting i40e_vsi_setup() from i40e_setup_pf_switch()
will end up doing the right thing by invoking the guts of 
i40e_set_mac(), which is basically the  sequence:
i40e_aq_mac_address_write()
i40e_aq_add_macvlan()   

I dont know if it is necessary/possible/important to set up the
filters sooner in the sequence- the add_macvlan needs an "seid",
and I could not tell when (in the ":" code above) the right seid 
can be found.  

Please review the RFC patch I'll be sending shortly.

--Sowmini

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH net 1/2] isdn_ppp: Add checks for allocation failure in isdn_ppp_open()

2015-11-01 Thread Ben Hutchings
On Fri, 2015-10-30 at 09:03 -0400, Josh Boyer wrote:
> On Fri, Oct 16, 2015 at 3:46 AM, David Miller 
> wrote:
> > From: Ben Hutchings 
> > Date: Wed, 14 Oct 2015 18:51:14 +0100
> > 
> > > Compile-tested only.
> > > 
> > > Signed-off-by: Ben Hutchings 
> > > ---
> > >  drivers/isdn/i4l/isdn_ppp.c | 6 ++
> > >  1 file changed, 6 insertions(+)
> > > 
> > > diff --git a/drivers/isdn/i4l/isdn_ppp.c
> > > b/drivers/isdn/i4l/isdn_ppp.c
> > > index c4198fa..86f9abe 100644
> > > --- a/drivers/isdn/i4l/isdn_ppp.c
> > > +++ b/drivers/isdn/i4l/isdn_ppp.c
> > > @@ -301,6 +301,8 @@ isdn_ppp_open(int min, struct file *file)
> > >   is->compflags = 0;
> > > 
> > >   is->reset = isdn_ppp_ccp_reset_alloc(is);
> > > + if (!is->reset)
> > > + return -ENOMEM;
> > 
> > Ben, your email client has corrupted both of these patches.
> > 
> > Please fix this up and resubmit, thanks.
> 
> Ben, did you resubmit these as David suggested?  I haven't found a v2
> anywhere.

I've just done so.

Ben.

-- 
Ben Hutchings
Nothing is ever a complete failure; it can always serve as a bad example.


signature.asc
Description: This is a digitally signed message part


Re: [PATCH net 1/2] isdn_ppp: Add checks for allocation failure in isdn_ppp_open()

2015-11-01 Thread Ben Hutchings
On Fri, 2015-10-16 at 00:46 -0700, David Miller wrote:
> From: Ben Hutchings 
> Date: Wed, 14 Oct 2015 18:51:14 +0100
> 
> > Compile-tested only.
> > 
> > Signed-off-by: Ben Hutchings 
> > ---
> >  drivers/isdn/i4l/isdn_ppp.c | 6 ++
> >  1 file changed, 6 insertions(+)
> > 
> > diff --git a/drivers/isdn/i4l/isdn_ppp.c
> b/drivers/isdn/i4l/isdn_ppp.c
> > index c4198fa..86f9abe 100644
> > --- a/drivers/isdn/i4l/isdn_ppp.c
> > +++ b/drivers/isdn/i4l/isdn_ppp.c
> > @@ -301,6 +301,8 @@ isdn_ppp_open(int min, struct file *file)
> >   is->compflags = 0;
> >  
> >   is->reset = isdn_ppp_ccp_reset_alloc(is);
> > + if (!is->reset)
> > + return -ENOMEM;
> 
> Ben, your email client has corrupted both of these patches.
> 
> Please fix this up and resubmit, thanks.

Sorry about that; it is a regression in Evolution 3.18.

Ben.

-- 
Ben Hutchings
Nothing is ever a complete failure; it can always serve as a bad example.


signature.asc
Description: This is a digitally signed message part


[PATCH v2 net 2/2] ppp, slip: Validate VJ compression slot parameters completely

2015-11-01 Thread Ben Hutchings
Currently slhc_init() treats out-of-range values of rslots and tslots
as equivalent to 0, except that if tslots is too large it will
dereference a null pointer (CVE-2015-7799).

Add a range-check at the top of the function and make it return an
ERR_PTR() on error instead of NULL.  Change the callers accordingly.

Compile-tested only.

Reported-by: 郭永刚 
References: http://article.gmane.org/gmane.comp.security.oss.general/17908
Signed-off-by: Ben Hutchings 
---
Re-sent using mutt since Evolution 3.18 mangles patches.

Ben.

 drivers/isdn/i4l/isdn_ppp.c   | 10 --
 drivers/net/ppp/ppp_generic.c |  6 ++
 drivers/net/slip/slhc.c   | 12 
 drivers/net/slip/slip.c   |  2 +-
 4 files changed, 15 insertions(+), 15 deletions(-)

diff --git a/drivers/isdn/i4l/isdn_ppp.c b/drivers/isdn/i4l/isdn_ppp.c
index 86f9abe..9c1e8ad 100644
--- a/drivers/isdn/i4l/isdn_ppp.c
+++ b/drivers/isdn/i4l/isdn_ppp.c
@@ -322,9 +322,9 @@ isdn_ppp_open(int min, struct file *file)
 * VJ header compression init
 */
is->slcomp = slhc_init(16, 16); /* not necessary for 2. link in bundle 
*/
-   if (!is->slcomp) {
+   if (IS_ERR(is->slcomp)) {
isdn_ppp_ccp_reset_free(is);
-   return -ENOMEM;
+   return PTR_ERR(is->slcomp);
}
 #endif
 #ifdef CONFIG_IPPP_FILTER
@@ -573,10 +573,8 @@ isdn_ppp_ioctl(int min, struct file *file, unsigned int 
cmd, unsigned long arg)
is->maxcid = val;
 #ifdef CONFIG_ISDN_PPP_VJ
sltmp = slhc_init(16, val);
-   if (!sltmp) {
-   printk(KERN_ERR "ippp, can't realloc slhc 
struct\n");
-   return -ENOMEM;
-   }
+   if (IS_ERR(sltmp))
+   return PTR_ERR(sltmp);
if (is->slcomp)
slhc_free(is->slcomp);
is->slcomp = sltmp;
diff --git a/drivers/net/ppp/ppp_generic.c b/drivers/net/ppp/ppp_generic.c
index ed00446..9a863c6 100644
--- a/drivers/net/ppp/ppp_generic.c
+++ b/drivers/net/ppp/ppp_generic.c
@@ -721,10 +721,8 @@ static long ppp_ioctl(struct file *file, unsigned int cmd, 
unsigned long arg)
val &= 0x;
}
vj = slhc_init(val2+1, val+1);
-   if (!vj) {
-   netdev_err(ppp->dev,
-  "PPP: no memory (VJ compressor)\n");
-   err = -ENOMEM;
+   if (IS_ERR(vj)) {
+   err = PTR_ERR(vj);
break;
}
ppp_lock(ppp);
diff --git a/drivers/net/slip/slhc.c b/drivers/net/slip/slhc.c
index 079f7ad..27ed252 100644
--- a/drivers/net/slip/slhc.c
+++ b/drivers/net/slip/slhc.c
@@ -84,8 +84,9 @@ static long decode(unsigned char **cpp);
 static unsigned char * put16(unsigned char *cp, unsigned short x);
 static unsigned short pull16(unsigned char **cpp);
 
-/* Initialize compression data structure
+/* Allocate compression data structure
  * slots must be in range 0 to 255 (zero meaning no compression)
+ * Returns pointer to structure or ERR_PTR() on error.
  */
 struct slcompress *
 slhc_init(int rslots, int tslots)
@@ -94,11 +95,14 @@ slhc_init(int rslots, int tslots)
register struct cstate *ts;
struct slcompress *comp;
 
+   if (rslots < 0 || rslots > 255 || tslots < 0 || tslots > 255)
+   return ERR_PTR(-EINVAL);
+
comp = kzalloc(sizeof(struct slcompress), GFP_KERNEL);
if (! comp)
goto out_fail;
 
-   if ( rslots > 0  &&  rslots < 256 ) {
+   if (rslots > 0) {
size_t rsize = rslots * sizeof(struct cstate);
comp->rstate = kzalloc(rsize, GFP_KERNEL);
if (! comp->rstate)
@@ -106,7 +110,7 @@ slhc_init(int rslots, int tslots)
comp->rslot_limit = rslots - 1;
}
 
-   if ( tslots > 0  &&  tslots < 256 ) {
+   if (tslots > 0) {
size_t tsize = tslots * sizeof(struct cstate);
comp->tstate = kzalloc(tsize, GFP_KERNEL);
if (! comp->tstate)
@@ -141,7 +145,7 @@ out_free2:
 out_free:
kfree(comp);
 out_fail:
-   return NULL;
+   return ERR_PTR(-ENOMEM);
 }
 
 
diff --git a/drivers/net/slip/slip.c b/drivers/net/slip/slip.c
index 05387b1..a17d86a 100644
--- a/drivers/net/slip/slip.c
+++ b/drivers/net/slip/slip.c
@@ -164,7 +164,7 @@ static int sl_alloc_bufs(struct slip *sl, int mtu)
if (cbuff == NULL)
goto err_exit;
slcomp = slhc_init(16, 16);
-   if (slcomp == NULL)
+   if (IS_ERR(slcomp))
goto err_exit;
 #endif
spin_lock_bh(&sl->lock);


signature.asc
Description: Digital signature


[PATCH v2 net 1/2] isdn_ppp: Add checks for allocation failure in isdn_ppp_open()

2015-11-01 Thread Ben Hutchings
Compile-tested only.

Signed-off-by: Ben Hutchings 
---
Re-sent using mutt since Evolution 3.18 mangles patches.

Ben.

 drivers/isdn/i4l/isdn_ppp.c | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/drivers/isdn/i4l/isdn_ppp.c b/drivers/isdn/i4l/isdn_ppp.c
index c4198fa..86f9abe 100644
--- a/drivers/isdn/i4l/isdn_ppp.c
+++ b/drivers/isdn/i4l/isdn_ppp.c
@@ -301,6 +301,8 @@ isdn_ppp_open(int min, struct file *file)
is->compflags = 0;
 
is->reset = isdn_ppp_ccp_reset_alloc(is);
+   if (!is->reset)
+   return -ENOMEM;
 
is->lp = NULL;
is->mp_seqno = 0;   /* MP sequence number */
@@ -320,6 +322,10 @@ isdn_ppp_open(int min, struct file *file)
 * VJ header compression init
 */
is->slcomp = slhc_init(16, 16); /* not necessary for 2. link in bundle 
*/
+   if (!is->slcomp) {
+   isdn_ppp_ccp_reset_free(is);
+   return -ENOMEM;
+   }
 #endif
 #ifdef CONFIG_IPPP_FILTER
is->pass_filter = NULL;



signature.asc
Description: Digital signature


Business deal

2015-11-01 Thread Gan-Shyee
Business deal of $18.3M with you. For details contact me on my email: 
ganny...@gmail.com

---
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


linux-next: manual merge of the spi tree with the net-next tree

2015-11-01 Thread Stephen Rothwell
Hi Mark,

Today's linux-next merge of the spi tree got a conflict in:

  drivers/nfc/trf7970a.c

between commit:

  3c39c1a54a26 ("NFC: trf7970a: Add OF match table")

from the net-next tree and commit:

  3821a065f567 ("spi: Drop owner assignment from spi_drivers")

from the spi tree.

I fixed it up (see below) and can carry the fix as necessary (no action
is required).

-- 
Cheers,
Stephen Rothwells...@canb.auug.org.au

diff --cc drivers/nfc/trf7970a.c
index 123aa981c9d8,4036788c78b6..
--- a/drivers/nfc/trf7970a.c
+++ b/drivers/nfc/trf7970a.c
@@@ -2229,8 -2223,6 +2229,7 @@@ static struct spi_driver trf7970a_spi_d
.id_table   = trf7970a_id_table,
.driver = {
.name   = "trf7970a",
 +  .of_match_table = of_match_ptr(trf7970a_of_match),
-   .owner  = THIS_MODULE,
.pm = &trf7970a_pm_ops,
},
  };
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html