[PATCH v2 11/12] ftgmac100: Add support for fragmented tx

2017-04-09 Thread Benjamin Herrenschmidt
Add NETIF_F_SG and create multiple TX ring entries for skb fragments. On reclaim, the skb is only freed on the segment marked as "last". Signed-off-by: Benjamin Herrenschmidt <b...@kernel.crashing.org> -- v2. - Remove skb headlen size adjustments now that we use

[PATCH v2 07/12] ftgmac100: Cleanup tx queue handling

2017-04-09 Thread Benjamin Herrenschmidt
nt reclaim. The aspeed chips aren't SMP today but I prefer the code being right and future proof. So rip that out and replace it with more "standard" queue handling, currently with a threshold of 1 queue element, which will be increased when we implement fragmented sends. Signed-off-by: Be

[PATCH v2 06/12] ftgmac100: Store tx skbs in a separate array

2017-04-09 Thread Benjamin Herrenschmidt
s. Signed-off-by: Benjamin Herrenschmidt <b...@kernel.crashing.org> --- v2. - Fix patch splitting mistake --- drivers/net/ethernet/faraday/ftgmac100.c | 59 +--- 1 file changed, 16 insertions(+), 43 deletions(-) diff --git a/drivers/net/ethernet/faraday/ftgmac

[PATCH v2 08/12] ftgmac100: Move the barrier out of ftgmac100_txdes_set_dma_own()

2017-04-09 Thread Benjamin Herrenschmidt
We'll use variants of this accessor without barriers when building series of descriptors for fragmented sends Signed-off-by: Benjamin Herrenschmidt <b...@kernel.crashing.org> --- drivers/net/ethernet/faraday/ftgmac100.c | 9 - 1 file changed, 4 insertions(+), 5 deletions(-) diff

[PATCH v2 12/12] ftgmac100: Remove tx descriptor accessors

2017-04-09 Thread Benjamin Herrenschmidt
Directly access the fields when needed. The accessors add clutter not clarity and in some cases cause unnecessary read-modify-write type access on the slow (uncached) descriptor memory. Signed-off-by: Benjamin Herrenschmidt <b...@kernel.crashing.org> --- v2. - Adjust for changes in pr

[PATCH v2 09/12] ftgmac100: Split tx packet freeing from ftgmac100_tx_complete_packet()

2017-04-09 Thread Benjamin Herrenschmidt
This moves the packet freeing to a separate function which is also used by ftgmac100_free_buffers() and will be used more in the error path of fragmented sends. Signed-off-by: Benjamin Herrenschmidt <b...@kernel.crashing.org> --- drivers/net/ethernet/faraday/ftgmac100.

[PATCH v2 05/12] ftgmac100: Pad small frames properly

2017-04-09 Thread Benjamin Herrenschmidt
Rather than just transmitting garbage past the end of the small packet. Signed-off-by: Benjamin Herrenschmidt <b...@kernel.crashing.org> -- v2. Use eth_skb_pad (wrapper around skb_put_padto) --- drivers/net/ethernet/faraday/ftgmac100.c | 10 -- 1 file changed, 8 insertions

[PATCH v2 01/12] ftgmac100: Add a tx timeout handler

2017-04-09 Thread Benjamin Herrenschmidt
We have a reset task to reset our chip, use it. Signed-off-by: Benjamin Herrenschmidt <b...@kernel.crashing.org> --- drivers/net/ethernet/faraday/ftgmac100.c | 13 + 1 file changed, 13 insertions(+) diff --git a/drivers/net/ethernet/faraday/ftgmac100.c b/drivers/net/et

[PATCH v2 00/12] ftgmac100: Rework batch 3 - TX path

2017-04-09 Thread Benjamin Herrenschmidt
This is version 2 of the third batch of updates to the ftgmac100 driver. This one tackles the TX path of the driver. This provides the bulk of the performance improvements by adding support for fragmented sends along with a bunch of cleanups. Version 2 fixes a patch splitting mistake and uses

Re: [PATCH 02/12] ftgmac100: Move ftgmac100_hard_start_xmit() around

2017-04-07 Thread Benjamin Herrenschmidt
On Fri, 2017-04-07 at 05:49 -0700, David Miller wrote: > >    /* Tx ring */ > > + struct sk_buff *tx_skbs[TX_QUEUE_ENTRIES]; > >    unsigned int tx_clean_pointer; > >    unsigned int tx_pointer; > >    unsigned int tx_pending; > > Add this only in patch #6 or wherever it is

Re: [PATCH 11/12] ftgmac100: Add support for fragmented tx

2017-04-07 Thread Benjamin Herrenschmidt
On Fri, 2017-04-07 at 06:26 -0700, Florian Fainelli wrote: > > On 04/06/2017 08:31 PM, Benjamin Herrenschmidt wrote: > > Add NETIF_F_SG and create multiple TX ring entries for skb fragments. > > > > On reclaim, the skb is only freed on the segment marked as "l

Re: [PATCH 05/12] ftgmac100: Pad small frames properly

2017-04-07 Thread Benjamin Herrenschmidt
On Fri, 2017-04-07 at 06:05 -0700, Florian Fainelli wrote: > You may want to use skb_put_padto() which also takes care of bumping > skb->len accordingly, in case that makes a difference for the > ftgmac100 hardware. Subsequent patch adds fragments, so it needs to bump headlen. I'll have a look

Re: [PATCH 02/12] ftgmac100: Move ftgmac100_hard_start_xmit() around

2017-04-07 Thread Benjamin Herrenschmidt
On Fri, 2017-04-07 at 13:09 +0300, Sergei Shtylyov wrote: > Hello! > > On 4/7/2017 6:30 AM, Benjamin Herrenschmidt wrote: > > > Move it below ftgmac100_xmit() and the rest of the tx path > > > > No code change. > > > > Signed-off-by: Benjam

[PATCH 12/12] ftgmac100: Remove tx descriptor accessors

2017-04-06 Thread Benjamin Herrenschmidt
Directly access the fields when needed. The accessors add clutter not clarity and in some cases cause unnecessary read-modify-write type access on the slow (uncached) descriptor memory. Signed-off-by: Benjamin Herrenschmidt <b...@kernel.crashing.org> --- drivers/net/ethernet/faraday/ftgma

[PATCH 08/12] ftgmac100: Move the barrier out of ftgmac100_txdes_set_dma_own()

2017-04-06 Thread Benjamin Herrenschmidt
We'll use variants of this accessor without barriers when building series of descriptors for fragmented sends Signed-off-by: Benjamin Herrenschmidt <b...@kernel.crashing.org> --- drivers/net/ethernet/faraday/ftgmac100.c | 9 - 1 file changed, 4 insertions(+), 5 deletions(-) diff

[PATCH 05/12] ftgmac100: Pad small frames properly

2017-04-06 Thread Benjamin Herrenschmidt
Rather than just transmitting garbage past the end of the small packet. Signed-off-by: Benjamin Herrenschmidt <b...@kernel.crashing.org> --- drivers/net/ethernet/faraday/ftgmac100.c | 7 +++ 1 file changed, 7 insertions(+) diff --git a/drivers/net/ethernet/faraday/ftgmac100.c b/drive

[PATCH 06/12] ftgmac100: Store tx skbs in a separate array

2017-04-06 Thread Benjamin Herrenschmidt
s. Signed-off-by: Benjamin Herrenschmidt <b...@kernel.crashing.org> --- drivers/net/ethernet/faraday/ftgmac100.c | 58 +--- 1 file changed, 15 insertions(+), 43 deletions(-) diff --git a/drivers/net/ethernet/faraday/ftgmac100.c b/drivers/net/ethernet/faraday/f

[PATCH 04/12] ftgmac100: Factor tx packet dropping path

2017-04-06 Thread Benjamin Herrenschmidt
Use a simple goto to a drop path at the tail of the function, it will be used in a few more cases soon Signed-off-by: Benjamin Herrenschmidt <b...@kernel.crashing.org> --- drivers/net/ethernet/faraday/ftgmac100.c | 17 + 1 file changed, 9 insertions(+), 8 deletions(-) diff

[PATCH 01/12] ftgmac100: Add a tx timeout handler

2017-04-06 Thread Benjamin Herrenschmidt
We have a reset task to reset our chip, use it. Signed-off-by: Benjamin Herrenschmidt <b...@kernel.crashing.org> --- drivers/net/ethernet/faraday/ftgmac100.c | 13 + 1 file changed, 13 insertions(+) diff --git a/drivers/net/ethernet/faraday/ftgmac100.c b/drivers/net/et

[PATCH 09/12] ftgmac100: Split tx packet freeing from ftgmac100_tx_complete_packet()

2017-04-06 Thread Benjamin Herrenschmidt
This moves the packet freeing to a separate function which is also used by ftgmac100_free_buffers() and will be used more in the error path of fragmented sends. Signed-off-by: Benjamin Herrenschmidt <b...@kernel.crashing.org> --- drivers/net/ethernet/faraday/ftgmac100.

[PATCH 10/12] ftgmac100: Don't clear tx desc fields unnecessarily

2017-04-06 Thread Benjamin Herrenschmidt
Those are non-cachable stores, let's avoid those we don't need. Remove the helper, it's not particularly helpful and since it uses "priv" I can't move it to the header file. Signed-off-by: Benjamin Herrenschmidt <b...@kernel.crashing.org> --- drivers/net/ethernet/faraday/

[PATCH 03/12] ftgmac100: Merge ftgmac100_xmit() into ftgmac100_hard_start_xmit()

2017-04-06 Thread Benjamin Herrenschmidt
This will make subsequent rework of the tx path simpler Signed-off-by: Benjamin Herrenschmidt <b...@kernel.crashing.org> --- drivers/net/ethernet/faraday/ftgmac100.c | 58 ++-- 1 file changed, 25 insertions(+), 33 deletions(-) diff --git a/drivers/net/et

[PATCH 02/12] ftgmac100: Move ftgmac100_hard_start_xmit() around

2017-04-06 Thread Benjamin Herrenschmidt
Move it below ftgmac100_xmit() and the rest of the tx path No code change. Signed-off-by: Benjamin Herrenschmidt <b...@kernel.crashing.org> --- drivers/net/ethernet/faraday/ftgmac100.c | 59 1 file changed, 30 insertions(+), 29 deletions(-) diff --git a/d

[PATCH 07/12] ftgmac100: Cleanup tx queue handling

2017-04-06 Thread Benjamin Herrenschmidt
nt reclaim. The aspeed chips aren't SMP today but I prefer the code being right and future proof. So rip that out and replace it with more "standard" queue handling, currently with a threshold of 1 queue element, which will be increased when we implement fragmented sends. Signed-off-by: Be

[PATCH 11/12] ftgmac100: Add support for fragmented tx

2017-04-06 Thread Benjamin Herrenschmidt
Add NETIF_F_SG and create multiple TX ring entries for skb fragments. On reclaim, the skb is only freed on the segment marked as "last". Signed-off-by: Benjamin Herrenschmidt <b...@kernel.crashing.org> # Conflicts: # drivers/net/ethernet/faraday/ftgmac100.c --- driv

[PATCH 00/12] ftgmac100: Rework batch 3 - TX path

2017-04-06 Thread Benjamin Herrenschmidt
This is the third batch of updates to the ftgmac100 driver. This one tackles the TX path of the driver. This provides the bulk of the performance improvements by adding support for fragmented sends along with a bunch of cleanups. Subsequent batches will add various features (ethtool functions,

Documentation error for checksum offload check ?

2017-04-06 Thread Benjamin Herrenschmidt
I noticed in both Documentation/networking/checksum-offload.txt and include/linux/skbuff.h reference to helpers skb_csum_off_chk* Now, I can't find anything like that with grep ... :-) Am I missing something ? Cheers, Ben.

Re: [PATCH v2 00/13] ftgmac100: Rework batch 1 - Link & Interrupts

2017-04-06 Thread Benjamin Herrenschmidt
On Thu, 2017-04-06 at 12:46 -0700, Florian Fainelli wrote: > > I thought a while ago we could add some dev flag to prevent the link > > watch from doing that, but never got to look into it myself and > > apparently neither did Gavin. > > It sounds like a similar situation to e.g: 802.1x, you want

[PATCH 07/10] ftgmac100: Directly receive into sk_buffs

2017-04-05 Thread Benjamin Herrenschmidt
. Signed-off-by: Benjamin Herrenschmidt <b...@kernel.crashing.org> --- drivers/net/ethernet/faraday/ftgmac100.c | 142 --- 1 file changed, 56 insertions(+), 86 deletions(-) diff --git a/drivers/net/ethernet/faraday/ftgmac100.c b/drivers/net/ethernet/faraday/ftgma

[PATCH 08/10] ftgmac100: Add missing barrier in ftgmac100_rx_packet()

2017-04-05 Thread Benjamin Herrenschmidt
Signed-off-by: Benjamin Herrenschmidt <b...@kernel.crashing.org> --- drivers/net/ethernet/faraday/ftgmac100.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/net/ethernet/faraday/ftgmac100.c b/drivers/net/ethernet/faraday/ftgmac100.c index 86bda0a..594af30 100644 --- a/drive

[PATCH 05/10] ftgmac100: Simplify rx packets error handling

2017-04-05 Thread Benjamin Herrenschmidt
. Signed-off-by: Benjamin Herrenschmidt <b...@kernel.crashing.org> --- drivers/net/ethernet/faraday/ftgmac100.c | 61 +--- 1 file changed, 25 insertions(+), 36 deletions(-) diff --git a/drivers/net/ethernet/faraday/ftgmac100.c b/drivers/net/ethernet/faraday/ftgma

[PATCH 06/10] ftgmac100: Simplify rx pointer handling in the rx path

2017-04-05 Thread Benjamin Herrenschmidt
We don't handle fragmented RX packets, so the "looping" helpers to locate the first segment of a packet or to drop a packet aren't actually helping. Take them out and simplify ftgmac100_rx_packet() further as a result. Signed-off-by: Benjamin Herrenschmidt <b...@kernel.crashing.org&

[PATCH 09/10] ftgmac100: Remove rx descriptor accessors

2017-04-05 Thread Benjamin Herrenschmidt
Directly access the fields when needed. The accessors add clutter not clarity and in some cases cause unnecessary read-modify-write type access on the slow (uncached) descriptor memory. Signed-off-by: Benjamin Herrenschmidt <b...@kernel.crashing.org> --- drivers/net/ethernet/faraday/ftgma

[PATCH 10/10] ftgmac100: Work around HW bug in runt frame detection

2017-04-05 Thread Benjamin Herrenschmidt
stripping is enabled or not. This works around it by ignoring the "runt" error bit of the frame has been vlan tagged and is at least 60 bytes. Signed-off-by: Benjamin Herrenschmidt <b...@kernel.crashing.org> --- drivers/net/ethernet/faraday/ftgmac100.c | 35 +++---

[PATCH 04/10] ftgmac100: Cleanup rx checksum handling

2017-04-05 Thread Benjamin Herrenschmidt
Read the descriptor field only once and check for IP header checksum errors as well Signed-off-by: Benjamin Herrenschmidt <b...@kernel.crashing.org> --- drivers/net/ethernet/faraday/ftgmac100.c | 63 +--- 1 file changed, 25 insertions(+), 38 deletions(-) diff

[PATCH 02/10] ftgmac100: Drop support for fragmented receive

2017-04-05 Thread Benjamin Herrenschmidt
and improvements to the RX path Signed-off-by: Benjamin Herrenschmidt <b...@kernel.crashing.org> --- drivers/net/ethernet/faraday/ftgmac100.c | 37 1 file changed, 18 insertions(+), 19 deletions(-) diff --git a/drivers/net/ethernet/faraday/ftgmac100.c b/drivers/net/et

[PATCH 03/10] ftgmac100: Use a scratch buffer for failed RX allocations

2017-04-05 Thread Benjamin Herrenschmidt
a proper buffer can be allocated. It will help later on when re-initializing the whole ring at runtime on link changes since there is no clean failure path there unlike open(). Signed-off-by: Benjamin Herrenschmidt <b...@kernel.crashing.org> --- drivers/net/ethernet/faraday/ftgmac100.

[PATCH 01/10] ftgmac100: Move ftgmac100_alloc_rx_page() before its users

2017-04-05 Thread Benjamin Herrenschmidt
Avoids a forward declaration Signed-off-by: Benjamin Herrenschmidt <b...@kernel.crashing.org> --- drivers/net/ethernet/faraday/ftgmac100.c | 59 +++- 1 file changed, 28 insertions(+), 31 deletions(-) diff --git a/drivers/net/ethernet/faraday/ftgmac100.c b/d

[PATCH 00/10] ftgmac: Rework batch 2 - RX path

2017-04-05 Thread Benjamin Herrenschmidt
This is the second batch of updates to the ftgmac100 driver. This one tackles the RX path of the driver, simplifying it greatly to match common practice while significantly increasing the performance. (The bulk of the performance gains of my series will be provided by the TX path improvements,

Re: [PATCH v2 00/13] ftgmac100: Rework batch 1 - Link & Interrupts

2017-04-05 Thread Benjamin Herrenschmidt
On Tue, 2017-04-04 at 23:02 -0700, Florian Fainelli wrote: > We don't necessarily have a phydev attached when using NC-SI, so it was > > easier to have the core code path not have to go fishing for those > > settings in different places based on whether we're using NC-SI or not. > > Oh right, I

Re: [PATCH v2 00/13] ftgmac100: Rework batch 1 - Link & Interrupts

2017-04-04 Thread Benjamin Herrenschmidt
On Tue, 2017-04-04 at 21:21 -0700, Florian Fainelli wrote: > > This looks pretty good to me, two minor things: > > - most drivers keep track of the old status/duplex/pause/link variables > instead of the current one which is already available within struct > phy_device, any particular reason for

[PATCH v2 02/13] ftgmac100: Remove "banner" comments

2017-04-04 Thread Benjamin Herrenschmidt
The divisions they represent are not particularily meaningful and things are going to be moving around with upcoming changes making these comments more a burden than anything else. Signed-off-by: Benjamin Herrenschmidt <b...@kernel.crashing.org> --- drivers/net/ethernet/faraday/ftgmac100.

[PATCH v2 09/13] ftgmac100: Move the bulk of inits to a separate function

2017-04-04 Thread Benjamin Herrenschmidt
The link monitoring and error handling code will have to redo the ring inits and HW setup so move the code out of ftgmac100_open() into a dedicated function. This forces a bit of re-ordering of ftgmac100_open() but nothing dramatic. Signed-off-by: Benjamin Herrenschmidt <b...@kernel.crashing.

[PATCH v2 08/13] ftgmac100: Request the interrupt only after HW is reset

2017-04-04 Thread Benjamin Herrenschmidt
The interrupt isn't shared, so this will keep it masked until we have the HW in a known sane state. Signed-off-by: Benjamin Herrenschmidt <b...@kernel.crashing.org> --- drivers/net/ethernet/faraday/ftgmac100.c | 19 ++- 1 file changed, 10 insertions(+), 9 deletions(-) diff

[PATCH v2 03/13] ftgmac100: Reorder struct fields and comment

2017-04-04 Thread Benjamin Herrenschmidt
Reorder the fields in struct ftgmac in slightly more logical groups. Will make more sense as I add/remove some. No code change. Signed-off-by: Benjamin Herrenschmidt <b...@kernel.crashing.org> --- drivers/net/ethernet/faraday/ftgmac100.c | 19 --- 1 file changed, 12 inse

[PATCH v2 12/13] ftgmac100: Remove useless tests in interrupt handler

2017-04-04 Thread Benjamin Herrenschmidt
The interrupt is neither enabled nor registered when the interface isn't running (regardless of whether we use nc-si or not) so the test isn't useful. Signed-off-by: Benjamin Herrenschmidt <b...@kernel.crashing.org> --- drivers/net/ethernet/faraday/ftgmac100.c | 11 +++ 1 file chan

[PATCH v2 10/13] ftgmac100: Add a reset task and use it for link changes

2017-04-04 Thread Benjamin Herrenschmidt
as well. Signed-off-by: Benjamin Herrenschmidt <b...@kernel.crashing.org> -- v2. Fix lock ordering Add mdio_bus mutex --- drivers/net/ethernet/faraday/ftgmac100.c | 87 +++- 1 file changed, 74 insertions(+), 13 deletions(-) diff --git a/drivers/net/ethernet/f

[PATCH v2 07/13] ftgmac100: Move napi_add/del to open/close

2017-04-04 Thread Benjamin Herrenschmidt
Rather than probe/remove Signed-off-by: Benjamin Herrenschmidt <b...@kernel.crashing.org> --- drivers/net/ethernet/faraday/ftgmac100.c | 8 +--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/drivers/net/ethernet/faraday/ftgmac100.c b/drivers/net/ethernet/faraday/ftgma

[PATCH v2 11/13] ftgmac100: Rework MAC reset and init

2017-04-04 Thread Benjamin Herrenschmidt
. Move the ring pointers initialization there too in order to reflect the HW change. Also reduce the timeout for the MAC reset as it shouldn't take more than 300 clock cycles according to the doc. Signed-off-by: Benjamin Herrenschmidt <b...@kernel.crashing.org> --- drivers/net/ethernet/f

[PATCH v2 13/13] ftgmac100: Rework NAPI & interrupts handling

2017-04-04 Thread Benjamin Herrenschmidt
ts is less efficient than letting NAPI run a while longer while the queue drains. Signed-off-by: Benjamin Herrenschmidt <b...@kernel.crashing.org> --- drivers/net/ethernet/faraday/ftgmac100.c | 137 +-- drivers/net/ethernet/faraday/ftgmac100.h | 14 2 files change

[PATCH v2 06/13] ftgmac100: Split ring alloc, init and rx buffer alloc

2017-04-04 Thread Benjamin Herrenschmidt
handling when the rings will be repopulated but not freed. Signed-off-by: Benjamin Herrenschmidt <b...@kernel.crashing.org> --- drivers/net/ethernet/faraday/ftgmac100.c | 68 ++-- 1 file changed, 47 insertions(+), 21 deletions(-) diff --git a/drivers/net/et

[PATCH v2 05/13] ftgmac100: Cleanup speed/duplex tracking and fix duplex config

2017-04-04 Thread Benjamin Herrenschmidt
-by: Benjamin Herrenschmidt <b...@kernel.crashing.org> -- v2. Use phy_print_status() Only bail out on link down *after* updating priv->cur_speed --- drivers/net/ethernet/faraday/ftgmac100.c | 52 +++- 1 file changed, 44 insertions(+), 8 deletions(-) diff --git a/dr

[PATCH v2 01/13] ftgmac100: Use netdev->irq instead of private copy

2017-04-04 Thread Benjamin Herrenschmidt
There's a placeholder already for the irq, use it Signed-off-by: Benjamin Herrenschmidt <b...@kernel.crashing.org> --- drivers/net/ethernet/faraday/ftgmac100.c | 13 ++--- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/drivers/net/ethernet/faraday/ftgmac100.c b/d

[PATCH v2 04/13] ftgmac100: Remove "enabled" flags

2017-04-04 Thread Benjamin Herrenschmidt
It's not used in any meaningful way Signed-off-by: Benjamin Herrenschmidt <b...@kernel.crashing.org> --- drivers/net/ethernet/faraday/ftgmac100.c | 7 --- 1 file changed, 7 deletions(-) diff --git a/drivers/net/ethernet/faraday/ftgmac100.c b/drivers/net/ethernet/faraday/ftgmac100.c

[PATCH v2 00/13] ftgmac100: Rework batch 1 - Link & Interrupts

2017-04-04 Thread Benjamin Herrenschmidt
This is version 2 of the first batch of updates to the ftgmac100 driver. Essentially: - A few misc cleanups - Fixing link speed & duplex handling (including dealing with an Aspeed requirement to double reset the controller when the speed changes) - And addition of a reset task workqueue

Re: [PATCH 10/13] ftgmac100: Add a reset task and use it for link changes

2017-04-03 Thread Benjamin Herrenschmidt
On Mon, 2017-04-03 at 07:24 +1000, Benjamin Herrenschmidt wrote: > On Sun, 2017-04-02 at 20:42 +0200, Andrew Lunn wrote: > > > Have you run lockdep tests on this? > > Good idea. For some reason I run it regularly on powerpc but it never > occurred to me to try it

Re: [PATCH 05/13] ftgmac100: Cleanup speed/duplex tracking and fix duplex config

2017-04-02 Thread Benjamin Herrenschmidt
On Sun, 2017-04-02 at 20:28 +0200, Andrew Lunn wrote: > Please consider using phy_print_status(). So in a subsequent (not yet posted) patch, I add Pause support. I noticed that phy_print_status() doesn't distinguish between full and partial (asym) pause support. Is that intentional ?

Re: [PATCH 05/13] ftgmac100: Cleanup speed/duplex tracking and fix duplex config

2017-04-02 Thread Benjamin Herrenschmidt
On Sun, 2017-04-02 at 13:35 +1000, Benjamin Herrenschmidt wrote: > +   } else if (priv->cur_speed) { > +   /* No link, just return. Leave the HW alone so it can > +    * continue draining the tx ring. > +    */ > +   netdev_

Re: [PATCH 10/13] ftgmac100: Add a reset task and use it for link changes

2017-04-02 Thread Benjamin Herrenschmidt
On Sun, 2017-04-02 at 20:42 +0200, Andrew Lunn wrote: > Have you run lockdep tests on this? Good idea. For some reason I run it regularly on powerpc but it never occurred to me to try it on that 800Mhz ARM11 :-) Cheers, Ben.

Resend all vs. individual patch updates

2017-04-02 Thread Benjamin Herrenschmidt
Hi Dave ! What is your preference when a couple of patches in a series of about a dozen get updated as a result of reviews ? Just send updates to those few or resend the whole series ? In the latter case I'll wait a bit longer for more comments. Cheers, Ben.

Re: [PATCH 10/13] ftgmac100: Add a reset task and use it for link changes

2017-04-02 Thread Benjamin Herrenschmidt
On Sun, 2017-04-02 at 20:42 +0200, Andrew Lunn wrote: > Have you run lockdep tests on this? I think it is normal to take the > rtnl lock first, then the phydev lock. Try some ethtool operations > and see if you get a splat. You are right. I actually realized that was wrong last night ;-) It will

Re: [PATCH 05/13] ftgmac100: Cleanup speed/duplex tracking and fix duplex config

2017-04-02 Thread Benjamin Herrenschmidt
On Sun, 2017-04-02 at 20:28 +0200, Andrew Lunn wrote: > > + if (new_speed) { > > + netdev_info(netdev, "Link up at %d Mbit/s %s > > duplex\n", > > + new_speed, > > + phydev->duplex == DUPLEX_FULL ? "full" > > : "half"); > > + } else if

Re: [PATCH 10/13] ftgmac100: Add a reset task and use it for link changes

2017-04-02 Thread Benjamin Herrenschmidt
On Sun, 2017-04-02 at 13:35 +1000, Benjamin Herrenschmidt wrote: > +   /* Block PHY polling */ > +   if (netdev->phydev) > +   mutex_lock(>phydev->lock); > + > +   rtnl_lock(); Self-given brown paper bag, those two need to be taken the oth

[PATCH 13/13] ftgmac100: Rework NAPI & interrupts handling

2017-04-01 Thread Benjamin Herrenschmidt
ts is less efficient than letting NAPI run a while longer while the queue drains. Signed-off-by: Benjamin Herrenschmidt <b...@kernel.crashing.org> --- drivers/net/ethernet/faraday/ftgmac100.c | 137 +-- drivers/net/ethernet/faraday/ftgmac100.h | 14 2 files change

[PATCH 11/13] ftgmac100: Rework MAC reset and init

2017-04-01 Thread Benjamin Herrenschmidt
. Move the ring pointers initialization there too in order to reflect the HW change. Also reduce the timeout for the MAC reset as it shouldn't take more than 300 clock cycles according to the doc. Signed-off-by: Benjamin Herrenschmidt <b...@kernel.crashing.org> --- drivers/net/ethernet/f

[PATCH 12/13] ftgmac100: Remove useless tests in interrupt handler

2017-04-01 Thread Benjamin Herrenschmidt
The interrupt is neither enabled nor registered when the interface isn't running (regardless of whether we use nc-si or not) so the test isn't useful. Signed-off-by: Benjamin Herrenschmidt <b...@kernel.crashing.org> --- drivers/net/ethernet/faraday/ftgmac100.c | 11 +++ 1 file chan

[PATCH 02/13] ftgmac100: Remove "banner" comments

2017-04-01 Thread Benjamin Herrenschmidt
The divisions they represent are not particularily meaningful and things are going to be moving around with upcoming changes making these comments more a burden than anything else. Signed-off-by: Benjamin Herrenschmidt <b...@kernel.crashing.org> --- drivers/net/ethernet/faraday/ftgmac100.

[PATCH 07/13] ftgmac100: Move napi_add/del to open/close

2017-04-01 Thread Benjamin Herrenschmidt
Rather than probe/remove Signed-off-by: Benjamin Herrenschmidt <b...@kernel.crashing.org> --- drivers/net/ethernet/faraday/ftgmac100.c | 8 +--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/drivers/net/ethernet/faraday/ftgmac100.c b/drivers/net/ethernet/faraday/ftgma

[PATCH 09/13] ftgmac100: Move the bulk of inits to a separate function

2017-04-01 Thread Benjamin Herrenschmidt
The link monitoring and error handling code will have to redo the ring inits and HW setup so move the code out of ftgmac100_open() into a dedicated function. This forces a bit of re-ordering of ftgmac100_open() but nothing dramatic. Signed-off-by: Benjamin Herrenschmidt <b...@kernel.crashing.

[PATCH 06/13] ftgmac100: Split ring alloc, init and rx buffer alloc

2017-04-01 Thread Benjamin Herrenschmidt
handling when the rings will be repopulated but not freed. Signed-off-by: Benjamin Herrenschmidt <b...@kernel.crashing.org> --- drivers/net/ethernet/faraday/ftgmac100.c | 68 ++-- 1 file changed, 47 insertions(+), 21 deletions(-) diff --git a/drivers/net/et

[PATCH 08/13] ftgmac100: Request the interrupt only after HW is reset

2017-04-01 Thread Benjamin Herrenschmidt
The interrupt isn't shared, so this will keep it masked until we have the HW in a known sane state. Signed-off-by: Benjamin Herrenschmidt <b...@kernel.crashing.org> --- drivers/net/ethernet/faraday/ftgmac100.c | 19 ++- 1 file changed, 10 insertions(+), 9 deletions(-) diff

[PATCH 10/13] ftgmac100: Add a reset task and use it for link changes

2017-04-01 Thread Benjamin Herrenschmidt
as well. Signed-off-by: Benjamin Herrenschmidt <b...@kernel.crashing.org> --- drivers/net/ethernet/faraday/ftgmac100.c | 85 +++- 1 file changed, 72 insertions(+), 13 deletions(-) diff --git a/drivers/net/ethernet/faraday/ftgmac100.c b/drivers/net/ethernet/f

[PATCH 04/13] ftgmac100: Remove "enabled" flags

2017-04-01 Thread Benjamin Herrenschmidt
It's not used in any meaningful way Signed-off-by: Benjamin Herrenschmidt <b...@kernel.crashing.org> --- drivers/net/ethernet/faraday/ftgmac100.c | 7 --- 1 file changed, 7 deletions(-) diff --git a/drivers/net/ethernet/faraday/ftgmac100.c b/drivers/net/ethernet/faraday/ftgmac100.c

[PATCH 01/13] ftgmac100: Use netdev->irq instead of private copy

2017-04-01 Thread Benjamin Herrenschmidt
There's a placeholder already for the irq, use it Signed-off-by: Benjamin Herrenschmidt <b...@kernel.crashing.org> --- drivers/net/ethernet/faraday/ftgmac100.c | 13 ++--- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/drivers/net/ethernet/faraday/ftgmac100.c b/d

[PATCH 05/13] ftgmac100: Cleanup speed/duplex tracking and fix duplex config

2017-04-01 Thread Benjamin Herrenschmidt
-by: Benjamin Herrenschmidt <b...@kernel.crashing.org> --- drivers/net/ethernet/faraday/ftgmac100.c | 54 +++- 1 file changed, 46 insertions(+), 8 deletions(-) diff --git a/drivers/net/ethernet/faraday/ftgmac100.c b/drivers/net/ethernet/faraday/ftgmac100.c index cc2271b..2

[PATCH 03/13] ftgmac100: Reorder struct fields and comment

2017-04-01 Thread Benjamin Herrenschmidt
Reorder the fields in struct ftgmac in slightly more logical groups. Will make more sense as I add/remove some. No code change. Signed-off-by: Benjamin Herrenschmidt <b...@kernel.crashing.org> --- drivers/net/ethernet/faraday/ftgmac100.c | 19 --- 1 file changed, 12 inse

[PATCH 00/13] ftgmac100: Rework batch 1 - Link & Interrupts

2017-04-01 Thread Benjamin Herrenschmidt
This is the first batch of updates to the ftgmac100 driver. Essentially: - A few misc cleanups - Fixing link speed & duplex handling (including dealing with an Aspeed requirement to double reset the controller when the speed changes) - And addition of a reset task workqueue which will

Re: [PATCH net] ftgmac100: Mostly rewrite the driver

2017-03-31 Thread Benjamin Herrenschmidt
On Fri, 2017-03-31 at 15:52 +0200, Andrew Lunn wrote: > > We're running some more testing tonight, if it's all solid I'll shoot > > it out tomorrow or sunday. Dave, it's ok to just spam the list with a > > 55 patches series like that ? > > Hi Ben > > Is there a good reason to spam the list with

Re: [PATCH net] ftgmac100: Mostly rewrite the driver

2017-03-31 Thread Benjamin Herrenschmidt
On Wed, 2017-03-29 at 20:15 -0700, David Miller wrote: > > > I've started re-doing the work in the form of a series of patches. > >  > > I can't promise I'll manage to make them all really small but I'll > > do my best. So hold onto reviewing if you haven't started already. > >  > > The end

Re: [PATCH net] ftgmac100: Mostly rewrite the driver

2017-03-29 Thread Benjamin Herrenschmidt
On Thu, 2017-03-30 at 08:08 +1100, Benjamin Herrenschmidt wrote: > On Wed, 2017-03-29 at 11:08 -0700, Florian Fainelli wrote: > > I hear your point that you are the only users of the driver and > > it's > > already in a bad shape, but take this as an opportunity to increase

Re: [PATCH net] ftgmac100: Mostly rewrite the driver

2017-03-29 Thread Benjamin Herrenschmidt
On Wed, 2017-03-29 at 11:08 -0700, Florian Fainelli wrote: > I hear your point that you are the only users of the driver and it's > already in a bad shape, but take this as an opportunity to increase > your commit count ;) Haha, my commit count is fine thanks ;-) I'll see what I can do. I need

Re: [PATCH net] ftgmac100: Mostly rewrite the driver

2017-03-28 Thread Benjamin Herrenschmidt
On Tue, 2017-03-28 at 22:10 -0700, David Miller wrote: >  Do you prefer that I submit it as a new driver for that IP block > > instead and take out the old one later ? > > You've decided to do this work in a way that makes it nearly > impossible to audit the individual changes for regressions and

Re: [PATCH net] ftgmac100: Mostly rewrite the driver

2017-03-28 Thread Benjamin Herrenschmidt
On Tue, 2017-03-28 at 21:57 -0700, David Miller wrote: > This is unreviewable. > > You must break this up into small, reviewable pieces. > > If you didn't save the steps of your work in that way, that isn't > our problem. That's not realistic, it would probably not improve the readability much.

[PATCH net] ftgmac100: Mostly rewrite the driver

2017-03-28 Thread Benjamin Herrenschmidt
, and various corner cases fixed, such as recovery in some error situations. Signed-off-by: Benjamin Herrenschmidt <b...@kernel.crashing.org> -- While I tried initially to do an incremental series of patch this quickly became unrealistic as I rewrote more of the driver. This is better reviewed as

Re: genphy_read_status() vs. 1000bT Pause capability

2017-03-28 Thread Benjamin Herrenschmidt
On Tue, 2017-03-28 at 12:31 +0100, Russell King - ARM Linux wrote: > > Interesting. I tried and it worked :-) Could be something funny in > > the config of our switches. > > It could be that the switch supports pause frames, but it's not > advertised because there's some corner cases that it

Re: genphy_read_status() vs. 1000bT Pause capability

2017-03-28 Thread Benjamin Herrenschmidt
On Tue, 2017-03-28 at 10:42 +0100, Russell King - ARM Linux wrote: > The 1000X definitions are for 1000BaseX (fiber), not for 1000BaseT > (copper). > > I have a working setup here with gigabit pause.  The pause bits come > from bits 11 and 10, just like for older copper PHYs.  Your link > parter

Re: genphy_read_status() vs. 1000bT Pause capability

2017-03-27 Thread Benjamin Herrenschmidt
On Tue, 2017-03-28 at 16:17 +1100, Benjamin Herrenschmidt wrote: > Hence my question ... how "standard" is the re-use of the LPA bits > for these alternate meanings in 1000bT and should we update genphy > to perform that decoding ? And btw, I'm happy to provide patches if we ag

Re: genphy_read_status() vs. 1000bT Pause capability

2017-03-27 Thread Benjamin Herrenschmidt
On Mon, 2017-03-27 at 21:14 -0700, Florian Fainelli wrote: > > Doesn't fix my other problem with Pause in 1000bT land. Do you know if > > that way of reflecting the pause capability by hijacking the old > > LPA bits is widely implemented enough that we should put it in > > genphy_read_status() ? >

Re: genphy_read_status() vs. 1000bT Pause capability

2017-03-27 Thread Benjamin Herrenschmidt
On Tue, 2017-03-28 at 13:28 +1100, Benjamin Herrenschmidt wrote: > > > Hi Ben > > > > It is worth reading Documentation/networking/phy.txt > > > > The MAC should set SUPPORTED_Pause and SUPPORTED_Asym_Pause if the MAC > > supports these features. Th

Re: genphy_read_status() vs. 1000bT Pause capability

2017-03-27 Thread Benjamin Herrenschmidt
On Tue, 2017-03-28 at 03:09 +0200, Andrew Lunn wrote: > On Tue, Mar 28, 2017 at 11:49:50AM +1100, Benjamin Herrenschmidt wrote: > > Hi ! > > > > I noticed that flow control isn't being enabled on a system I'm > > working on by default. I've tracked it down to two things

genphy_read_status() vs. 1000bT Pause capability

2017-03-27 Thread Benjamin Herrenschmidt
Hi ! I noticed that flow control isn't being enabled on a system I'm working on by default. I've tracked it down to two things: - The realtec.c PHY driver doesn't have Pause or Asym_Pause in its exposed capabilities. This is in part because PHY_GBIT_FEATURES does not include SUPPORTED_Pause and

Re: TX vs RX pause frame question

2017-03-26 Thread Benjamin Herrenschmidt
On Sun, 2017-03-26 at 10:55 -0700, John Fastabend wrote: > On 17-03-26 03:11 AM, Benjamin Herrenschmidt wrote: > > Hi ! > > > > It's not 100% clear to me looking at various drivers what is > > considered "rx_pause" and what is "tx_pause" (from the

TX vs RX pause frame question

2017-03-26 Thread Benjamin Herrenschmidt
Hi ! It's not 100% clear to me looking at various drivers what is considered "rx_pause" and what is "tx_pause" (from the ethtool terminology). Is "rx_pause" about receiving pause frame to throttle the transmitter or is it about sending pause frames when the receiver gets full ? Thanks, Ben.

Re: [PATCH 3/3] powerpc: bpf: implement in-register swap for 64-bit endian operations

2017-01-15 Thread Benjamin Herrenschmidt
On Fri, 2017-01-13 at 23:22 +0530, 'Naveen N. Rao' wrote: > > That rather depends on whether the processor has a store to load forwarder > > that will satisfy the read from the store buffer. > > I don't know about ppc, but at least some x86 will do that. > > Interesting - good to know that. > >

Re: [PATCH net-next 6/7] net/faraday: Fix phy link irq on Aspeed G5 SoCs

2016-09-21 Thread Benjamin Herrenschmidt
On Wed, 2016-09-21 at 18:48 +0930, Joel Stanley wrote: > > What line is it out of the PHY ? The PHY IRQ ? If yes then it's meant > > to be telling you to go look at the PHY registers for a link status > > change, but only works if the PHY has also been configured > > appropriately... > > Yep, PHY

Re: [PATCH net-next 6/7] net/faraday: Fix phy link irq on Aspeed G5 SoCs

2016-09-21 Thread Benjamin Herrenschmidt
On Wed, 2016-09-21 at 11:32 +0930, Joel Stanley wrote: > I had a look at the eval board schematic and it appears that the line > has pull down resistors on it, explaining why the IRQ fires when it's > configured to active low. Other machines re-use the pin pin as a GPIO. > So yes, I will change

Re: [PATCH net-next 6/7] net/faraday: Fix phy link irq on Aspeed G5 SoCs

2016-09-20 Thread Benjamin Herrenschmidt
On Tue, 2016-09-20 at 16:00 +0930, Joel Stanley wrote: > On Aspeed SoC with a direct PHY connection (non-NSCI), we receive > continual PHYSTS interrupts: > >  [   20.28] ftgmac100 1e66.ethernet eth0: [ISR] = 0x200: PHYSTS_CHG >  [   20.28] ftgmac100 1e66.ethernet eth0: [ISR] =

Re: [PATCHv2 3/4] pci: Determine actual VPD size on first access

2016-08-15 Thread Benjamin Herrenschmidt
On Mon, 2016-08-15 at 23:16 +, Rustad, Mark D wrote: > > Bugs in existing guests is an interesting case, but I have been focused on   > getting acceptable behavior from a properly functioning guest, in the face   > of hardware issues that can only be resolved in a single place. > > I agree

Re: [PATCHv2 3/4] pci: Determine actual VPD size on first access

2016-08-15 Thread Benjamin Herrenschmidt
On Tue, 2016-08-16 at 08:23 +1000, Benjamin Herrenschmidt wrote: > > I don't think desktop users appreciate hangs any more than anyone else, and  > >   > > that is one of the symptoms that can arise here without the vfio   > > coordination. > > And can happen wit

Re: [PATCHv2 3/4] pci: Determine actual VPD size on first access

2016-08-15 Thread Benjamin Herrenschmidt
On Mon, 2016-08-15 at 17:59 +, Rustad, Mark D wrote: > > Benjamin Herrenschmidt <b...@kernel.crashing.org> wrote: > > > > > We may want some kind of "strict" vs. "relaxed" model here to > > differenciate the desktop user wanting to give a

<    1   2   3   4   5   >