* [PATCH net-next v2 0/2] net: bcmgenet: xmit_more support
@ 2015-03-13 19:11 Florian Fainelli
2015-03-13 19:11 ` [PATCH net-next v2 1/2] net: bcmgenet: update ring producer index and buffer count in xmit Florian Fainelli
` (2 more replies)
0 siblings, 3 replies; 6+ messages in thread
From: Florian Fainelli @ 2015-03-13 19:11 UTC (permalink / raw)
To: netdev; +Cc: edumazet, Florian Fainelli, davem, jaedon.shin, pgynther
Hi all,
This patch series adds xmit_more support to the GENET driver by allowing
the deferal of the producer index write to the TDMA engine.
Changes in v2:
- move the netif_tx_stop_queue check *before* updating the producer index
Florian Fainelli (2):
net: bcmgenet: update ring producer index and buffer count in xmit
net: bcmgenet: add support for xmit_more
drivers/net/ethernet/broadcom/genet/bcmgenet.c | 23 ++++++++---------------
1 file changed, 8 insertions(+), 15 deletions(-)
--
2.1.0
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH net-next v2 1/2] net: bcmgenet: update ring producer index and buffer count in xmit
2015-03-13 19:11 [PATCH net-next v2 0/2] net: bcmgenet: xmit_more support Florian Fainelli
@ 2015-03-13 19:11 ` Florian Fainelli
2015-03-13 19:52 ` Petri Gynther
2015-03-13 19:11 ` [PATCH net-next v2 2/2] net: bcmgenet: add support for xmit_more Florian Fainelli
2015-03-13 19:52 ` [PATCH net-next v2 0/2] net: bcmgenet: xmit_more support David Miller
2 siblings, 1 reply; 6+ messages in thread
From: Florian Fainelli @ 2015-03-13 19:11 UTC (permalink / raw)
To: netdev; +Cc: edumazet, Florian Fainelli, davem, jaedon.shin, pgynther
There is no need to have both bcmgenet_xmit_single() and
bcmgenet_xmit_frag() perform a free_bds decrement and a prod_index
increment by one. In case one of these functions fails to map a SKB or
fragment for transmit, we will return and exit bcmgenet_xmit() with an
error.
We can therefore safely use our local copy of nr_frags to know by how
much we should decrement the number of free buffers available, and by
how much the producer count must be incremented and do this in the tail
of bcmgenet_xmit().
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
Acked-by: Petri Gynther <pgynther@google.com>
---
drivers/net/ethernet/broadcom/genet/bcmgenet.c | 18 +++++-------------
1 file changed, 5 insertions(+), 13 deletions(-)
diff --git a/drivers/net/ethernet/broadcom/genet/bcmgenet.c b/drivers/net/ethernet/broadcom/genet/bcmgenet.c
index d3be1aeb7f47..f59427072a9b 100644
--- a/drivers/net/ethernet/broadcom/genet/bcmgenet.c
+++ b/drivers/net/ethernet/broadcom/genet/bcmgenet.c
@@ -1130,11 +1130,6 @@ static int bcmgenet_xmit_single(struct net_device *dev,
dmadesc_set(priv, tx_cb_ptr->bd_addr, mapping, length_status);
- /* Decrement total BD count and advance our write pointer */
- ring->free_bds -= 1;
- ring->prod_index += 1;
- ring->prod_index &= DMA_P_INDEX_MASK;
-
return 0;
}
@@ -1173,11 +1168,6 @@ static int bcmgenet_xmit_frag(struct net_device *dev,
(frag->size << DMA_BUFLENGTH_SHIFT) | dma_desc_flags |
(priv->hw_params->qtag_mask << DMA_TX_QTAG_SHIFT));
-
- ring->free_bds -= 1;
- ring->prod_index += 1;
- ring->prod_index &= DMA_P_INDEX_MASK;
-
return 0;
}
@@ -1321,9 +1311,11 @@ static netdev_tx_t bcmgenet_xmit(struct sk_buff *skb, struct net_device *dev)
skb_tx_timestamp(skb);
- /* we kept a software copy of how much we should advance the TDMA
- * producer index, now write it down to the hardware
- */
+ /* Decrement total BD count and advance our write pointer */
+ ring->free_bds -= nr_frags + 1;
+ ring->prod_index += nr_frags + 1;
+ ring->prod_index &= DMA_P_INDEX_MASK;
+
bcmgenet_tdma_ring_writel(priv, ring->index,
ring->prod_index, TDMA_PROD_INDEX);
--
2.1.0
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH net-next v2 2/2] net: bcmgenet: add support for xmit_more
2015-03-13 19:11 [PATCH net-next v2 0/2] net: bcmgenet: xmit_more support Florian Fainelli
2015-03-13 19:11 ` [PATCH net-next v2 1/2] net: bcmgenet: update ring producer index and buffer count in xmit Florian Fainelli
@ 2015-03-13 19:11 ` Florian Fainelli
2015-03-13 19:49 ` Eric Dumazet
2015-03-13 19:52 ` [PATCH net-next v2 0/2] net: bcmgenet: xmit_more support David Miller
2 siblings, 1 reply; 6+ messages in thread
From: Florian Fainelli @ 2015-03-13 19:11 UTC (permalink / raw)
To: netdev; +Cc: edumazet, Florian Fainelli, davem, jaedon.shin, pgynther
Delay the update of the TDMA producer index unless this is the last SKB
in a batch, or the queue is already stopped. Move the check for whether
the queue should be stopped before the xmit_more check to avoid locking
the transmit queue in case there was a SKB submitted which has xmit_more
set.
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
---
drivers/net/ethernet/broadcom/genet/bcmgenet.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/drivers/net/ethernet/broadcom/genet/bcmgenet.c b/drivers/net/ethernet/broadcom/genet/bcmgenet.c
index f59427072a9b..c9212e147fe9 100644
--- a/drivers/net/ethernet/broadcom/genet/bcmgenet.c
+++ b/drivers/net/ethernet/broadcom/genet/bcmgenet.c
@@ -1316,12 +1316,13 @@ static netdev_tx_t bcmgenet_xmit(struct sk_buff *skb, struct net_device *dev)
ring->prod_index += nr_frags + 1;
ring->prod_index &= DMA_P_INDEX_MASK;
- bcmgenet_tdma_ring_writel(priv, ring->index,
- ring->prod_index, TDMA_PROD_INDEX);
-
if (ring->free_bds <= (MAX_SKB_FRAGS + 1))
netif_tx_stop_queue(txq);
+ if (!skb->xmit_more || netif_xmit_stopped(txq))
+ /* Packets are ready, update producer index */
+ bcmgenet_tdma_ring_writel(priv, ring->index,
+ ring->prod_index, TDMA_PROD_INDEX);
out:
spin_unlock_irqrestore(&ring->lock, flags);
--
2.1.0
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH net-next v2 2/2] net: bcmgenet: add support for xmit_more
2015-03-13 19:11 ` [PATCH net-next v2 2/2] net: bcmgenet: add support for xmit_more Florian Fainelli
@ 2015-03-13 19:49 ` Eric Dumazet
0 siblings, 0 replies; 6+ messages in thread
From: Eric Dumazet @ 2015-03-13 19:49 UTC (permalink / raw)
To: Florian Fainelli; +Cc: netdev, edumazet, davem, jaedon.shin, pgynther
On Fri, 2015-03-13 at 12:11 -0700, Florian Fainelli wrote:
> Delay the update of the TDMA producer index unless this is the last SKB
> in a batch, or the queue is already stopped. Move the check for whether
> the queue should be stopped before the xmit_more check to avoid locking
> the transmit queue in case there was a SKB submitted which has xmit_more
> set.
>
> Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
Acked-by: Eric Dumazet <edumazet@google.com>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH net-next v2 1/2] net: bcmgenet: update ring producer index and buffer count in xmit
2015-03-13 19:11 ` [PATCH net-next v2 1/2] net: bcmgenet: update ring producer index and buffer count in xmit Florian Fainelli
@ 2015-03-13 19:52 ` Petri Gynther
0 siblings, 0 replies; 6+ messages in thread
From: Petri Gynther @ 2015-03-13 19:52 UTC (permalink / raw)
To: Florian Fainelli; +Cc: netdev, edumazet, David Miller, Jaedon Shin
On Fri, Mar 13, 2015 at 12:11 PM, Florian Fainelli <f.fainelli@gmail.com> wrote:
> There is no need to have both bcmgenet_xmit_single() and
> bcmgenet_xmit_frag() perform a free_bds decrement and a prod_index
> increment by one. In case one of these functions fails to map a SKB or
> fragment for transmit, we will return and exit bcmgenet_xmit() with an
> error.
>
> We can therefore safely use our local copy of nr_frags to know by how
> much we should decrement the number of free buffers available, and by
> how much the producer count must be incremented and do this in the tail
> of bcmgenet_xmit().
>
> Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
> Acked-by: Petri Gynther <pgynther@google.com>
Reviewed-by: Petri Gynther <pgynther@google.com>
> ---
> drivers/net/ethernet/broadcom/genet/bcmgenet.c | 18 +++++-------------
> 1 file changed, 5 insertions(+), 13 deletions(-)
>
> diff --git a/drivers/net/ethernet/broadcom/genet/bcmgenet.c b/drivers/net/ethernet/broadcom/genet/bcmgenet.c
> index d3be1aeb7f47..f59427072a9b 100644
> --- a/drivers/net/ethernet/broadcom/genet/bcmgenet.c
> +++ b/drivers/net/ethernet/broadcom/genet/bcmgenet.c
> @@ -1130,11 +1130,6 @@ static int bcmgenet_xmit_single(struct net_device *dev,
>
> dmadesc_set(priv, tx_cb_ptr->bd_addr, mapping, length_status);
>
> - /* Decrement total BD count and advance our write pointer */
> - ring->free_bds -= 1;
> - ring->prod_index += 1;
> - ring->prod_index &= DMA_P_INDEX_MASK;
> -
> return 0;
> }
>
> @@ -1173,11 +1168,6 @@ static int bcmgenet_xmit_frag(struct net_device *dev,
> (frag->size << DMA_BUFLENGTH_SHIFT) | dma_desc_flags |
> (priv->hw_params->qtag_mask << DMA_TX_QTAG_SHIFT));
>
> -
> - ring->free_bds -= 1;
> - ring->prod_index += 1;
> - ring->prod_index &= DMA_P_INDEX_MASK;
> -
> return 0;
> }
>
> @@ -1321,9 +1311,11 @@ static netdev_tx_t bcmgenet_xmit(struct sk_buff *skb, struct net_device *dev)
>
> skb_tx_timestamp(skb);
>
> - /* we kept a software copy of how much we should advance the TDMA
> - * producer index, now write it down to the hardware
> - */
> + /* Decrement total BD count and advance our write pointer */
> + ring->free_bds -= nr_frags + 1;
> + ring->prod_index += nr_frags + 1;
> + ring->prod_index &= DMA_P_INDEX_MASK;
> +
> bcmgenet_tdma_ring_writel(priv, ring->index,
> ring->prod_index, TDMA_PROD_INDEX);
>
> --
> 2.1.0
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH net-next v2 0/2] net: bcmgenet: xmit_more support
2015-03-13 19:11 [PATCH net-next v2 0/2] net: bcmgenet: xmit_more support Florian Fainelli
2015-03-13 19:11 ` [PATCH net-next v2 1/2] net: bcmgenet: update ring producer index and buffer count in xmit Florian Fainelli
2015-03-13 19:11 ` [PATCH net-next v2 2/2] net: bcmgenet: add support for xmit_more Florian Fainelli
@ 2015-03-13 19:52 ` David Miller
2 siblings, 0 replies; 6+ messages in thread
From: David Miller @ 2015-03-13 19:52 UTC (permalink / raw)
To: f.fainelli; +Cc: netdev, edumazet, jaedon.shin, pgynther
From: Florian Fainelli <f.fainelli@gmail.com>
Date: Fri, 13 Mar 2015 12:11:05 -0700
> This patch series adds xmit_more support to the GENET driver by allowing
> the deferal of the producer index write to the TDMA engine.
>
> Changes in v2:
>
> - move the netif_tx_stop_queue check *before* updating the producer index
Series applied, thanks Florian.
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2015-03-13 19:54 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-03-13 19:11 [PATCH net-next v2 0/2] net: bcmgenet: xmit_more support Florian Fainelli
2015-03-13 19:11 ` [PATCH net-next v2 1/2] net: bcmgenet: update ring producer index and buffer count in xmit Florian Fainelli
2015-03-13 19:52 ` Petri Gynther
2015-03-13 19:11 ` [PATCH net-next v2 2/2] net: bcmgenet: add support for xmit_more Florian Fainelli
2015-03-13 19:49 ` Eric Dumazet
2015-03-13 19:52 ` [PATCH net-next v2 0/2] net: bcmgenet: xmit_more support David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).