netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next] i40e: skb->xmit_more support
@ 2014-10-07 20:30 Eric Dumazet
  2014-10-07 20:37 ` David Miller
                   ` (3 more replies)
  0 siblings, 4 replies; 9+ messages in thread
From: Eric Dumazet @ 2014-10-07 20:30 UTC (permalink / raw)
  To: David Miller; +Cc: netdev, Daniel Borkmann, Jeff Kirsher

From: Eric Dumazet <edumazet@google.com>

Support skb->xmit_more in i40e is straightforward : we need to move
around i40e_maybe_stop_tx() call to correctly test netif_xmit_stopped()
before taking the decision to not kick the NIC.

Signed-off-by: Eric Dumazet <edumazet@google.com>
---
 drivers/net/ethernet/intel/i40e/i40e_txrx.c |   90 +++++++++---------
 1 file changed, 46 insertions(+), 44 deletions(-)

diff --git a/drivers/net/ethernet/intel/i40e/i40e_txrx.c b/drivers/net/ethernet/intel/i40e/i40e_txrx.c
index 267992b3de8a..3195d82e4942 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_txrx.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_txrx.c
@@ -2053,6 +2053,47 @@ static void i40e_create_tx_ctx(struct i40e_ring *tx_ring,
 }
 
 /**
+ * __i40e_maybe_stop_tx - 2nd level check for tx stop conditions
+ * @tx_ring: the ring to be checked
+ * @size:    the size buffer we want to assure is available
+ *
+ * Returns -EBUSY if a stop is needed, else 0
+ **/
+static inline int __i40e_maybe_stop_tx(struct i40e_ring *tx_ring, int size)
+{
+	netif_stop_subqueue(tx_ring->netdev, tx_ring->queue_index);
+	/* Memory barrier before checking head and tail */
+	smp_mb();
+
+	/* Check again in a case another CPU has just made room available. */
+	if (likely(I40E_DESC_UNUSED(tx_ring) < size))
+		return -EBUSY;
+
+	/* A reprieve! - use start_queue because it doesn't call schedule */
+	netif_start_subqueue(tx_ring->netdev, tx_ring->queue_index);
+	++tx_ring->tx_stats.restart_queue;
+	return 0;
+}
+
+/**
+ * i40e_maybe_stop_tx - 1st level check for tx stop conditions
+ * @tx_ring: the ring to be checked
+ * @size:    the size buffer we want to assure is available
+ *
+ * Returns 0 if stop is not needed
+ **/
+#ifdef I40E_FCOE
+int i40e_maybe_stop_tx(struct i40e_ring *tx_ring, int size)
+#else
+static int i40e_maybe_stop_tx(struct i40e_ring *tx_ring, int size)
+#endif
+{
+	if (likely(I40E_DESC_UNUSED(tx_ring) >= size))
+		return 0;
+	return __i40e_maybe_stop_tx(tx_ring, size);
+}
+
+/**
  * i40e_tx_map - Build the Tx descriptor
  * @tx_ring:  ring to send buffer on
  * @skb:      send buffer
@@ -2195,8 +2236,12 @@ static void i40e_tx_map(struct i40e_ring *tx_ring, struct sk_buff *skb,
 
 	tx_ring->next_to_use = i;
 
+	i40e_maybe_stop_tx(tx_ring, DESC_NEEDED);
 	/* notify HW of packet */
-	writel(i, tx_ring->tail);
+	if (!skb->xmit_more ||
+	    netif_xmit_stopped(netdev_get_tx_queue(tx_ring->netdev,
+						   tx_ring->queue_index)))
+		writel(i, tx_ring->tail);
 
 	return;
 
@@ -2218,47 +2263,6 @@ dma_error:
 }
 
 /**
- * __i40e_maybe_stop_tx - 2nd level check for tx stop conditions
- * @tx_ring: the ring to be checked
- * @size:    the size buffer we want to assure is available
- *
- * Returns -EBUSY if a stop is needed, else 0
- **/
-static inline int __i40e_maybe_stop_tx(struct i40e_ring *tx_ring, int size)
-{
-	netif_stop_subqueue(tx_ring->netdev, tx_ring->queue_index);
-	/* Memory barrier before checking head and tail */
-	smp_mb();
-
-	/* Check again in a case another CPU has just made room available. */
-	if (likely(I40E_DESC_UNUSED(tx_ring) < size))
-		return -EBUSY;
-
-	/* A reprieve! - use start_queue because it doesn't call schedule */
-	netif_start_subqueue(tx_ring->netdev, tx_ring->queue_index);
-	++tx_ring->tx_stats.restart_queue;
-	return 0;
-}
-
-/**
- * i40e_maybe_stop_tx - 1st level check for tx stop conditions
- * @tx_ring: the ring to be checked
- * @size:    the size buffer we want to assure is available
- *
- * Returns 0 if stop is not needed
- **/
-#ifdef I40E_FCOE
-int i40e_maybe_stop_tx(struct i40e_ring *tx_ring, int size)
-#else
-static int i40e_maybe_stop_tx(struct i40e_ring *tx_ring, int size)
-#endif
-{
-	if (likely(I40E_DESC_UNUSED(tx_ring) >= size))
-		return 0;
-	return __i40e_maybe_stop_tx(tx_ring, size);
-}
-
-/**
  * i40e_xmit_descriptor_count - calculate number of tx descriptors needed
  * @skb:     send buffer
  * @tx_ring: ring to send buffer on
@@ -2372,8 +2376,6 @@ static netdev_tx_t i40e_xmit_frame_ring(struct sk_buff *skb,
 	i40e_tx_map(tx_ring, skb, first, tx_flags, hdr_len,
 		    td_cmd, td_offset);
 
-	i40e_maybe_stop_tx(tx_ring, DESC_NEEDED);
-
 	return NETDEV_TX_OK;
 
 out_drop:

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [PATCH net-next] i40e: skb->xmit_more support
  2014-10-07 20:30 [PATCH net-next] i40e: skb->xmit_more support Eric Dumazet
@ 2014-10-07 20:37 ` David Miller
  2014-10-08  4:02   ` Jeff Kirsher
  2014-10-07 22:03 ` Daniel Borkmann
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 9+ messages in thread
From: David Miller @ 2014-10-07 20:37 UTC (permalink / raw)
  To: eric.dumazet; +Cc: netdev, dborkman, jeffrey.t.kirsher

From: Eric Dumazet <eric.dumazet@gmail.com>
Date: Tue, 07 Oct 2014 13:30:23 -0700

> From: Eric Dumazet <edumazet@google.com>
> 
> Support skb->xmit_more in i40e is straightforward : we need to move
> around i40e_maybe_stop_tx() call to correctly test netif_xmit_stopped()
> before taking the decision to not kick the NIC.
> 
> Signed-off-by: Eric Dumazet <edumazet@google.com>

Intel folks, if I could get a quick review of this that would be great.

Thanks.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH net-next] i40e: skb->xmit_more support
  2014-10-07 20:30 [PATCH net-next] i40e: skb->xmit_more support Eric Dumazet
  2014-10-07 20:37 ` David Miller
@ 2014-10-07 22:03 ` Daniel Borkmann
  2014-10-08 12:29   ` Jeff Kirsher
  2014-10-08 17:02 ` Greg Rose
  2014-10-08 20:04 ` David Miller
  3 siblings, 1 reply; 9+ messages in thread
From: Daniel Borkmann @ 2014-10-07 22:03 UTC (permalink / raw)
  To: Eric Dumazet; +Cc: David Miller, netdev, Jeff Kirsher

On 10/07/2014 10:30 PM, Eric Dumazet wrote:
> From: Eric Dumazet <edumazet@google.com>
>
> Support skb->xmit_more in i40e is straightforward : we need to move
> around i40e_maybe_stop_tx() call to correctly test netif_xmit_stopped()
> before taking the decision to not kick the NIC.
>
> Signed-off-by: Eric Dumazet <edumazet@google.com>

Jeff, feel free to drop the same version I've sent you yesterday
directly since this here is already in patchwork ...

Thanks, Eric!

Signed-off-by: Daniel Borkmann <dborkman@redhat.com>

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH net-next] i40e: skb->xmit_more support
  2014-10-07 20:37 ` David Miller
@ 2014-10-08  4:02   ` Jeff Kirsher
  0 siblings, 0 replies; 9+ messages in thread
From: Jeff Kirsher @ 2014-10-08  4:02 UTC (permalink / raw)
  To: David Miller; +Cc: eric.dumazet, netdev, dborkman

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

On Tue, 2014-10-07 at 16:37 -0400, David Miller wrote:
> From: Eric Dumazet <eric.dumazet@gmail.com>
> Date: Tue, 07 Oct 2014 13:30:23 -0700
> 
> > From: Eric Dumazet <edumazet@google.com>
> > 
> > Support skb->xmit_more in i40e is straightforward : we need to move
> > around i40e_maybe_stop_tx() call to correctly test netif_xmit_stopped()
> > before taking the decision to not kick the NIC.
> > 
> > Signed-off-by: Eric Dumazet <edumazet@google.com>
> 
> Intel folks, if I could get a quick review of this that would be great.
> 
> Thanks.

Working on it, let you know tomorrow.

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH net-next] i40e: skb->xmit_more support
  2014-10-07 22:03 ` Daniel Borkmann
@ 2014-10-08 12:29   ` Jeff Kirsher
  0 siblings, 0 replies; 9+ messages in thread
From: Jeff Kirsher @ 2014-10-08 12:29 UTC (permalink / raw)
  To: Daniel Borkmann; +Cc: Eric Dumazet, David Miller, netdev

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

On Wed, 2014-10-08 at 00:03 +0200, Daniel Borkmann wrote:
> On 10/07/2014 10:30 PM, Eric Dumazet wrote:
> > From: Eric Dumazet <edumazet@google.com>
> >
> > Support skb->xmit_more in i40e is straightforward : we need to move
> > around i40e_maybe_stop_tx() call to correctly test netif_xmit_stopped()
> > before taking the decision to not kick the NIC.
> >
> > Signed-off-by: Eric Dumazet <edumazet@google.com>
> 
> Jeff, feel free to drop the same version I've sent you yesterday
> directly since this here is already in patchwork ...
> 
> Thanks, Eric!
> 
> Signed-off-by: Daniel Borkmann <dborkman@redhat.com>

Done, I have dropped your patch for this patch.

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH net-next] i40e: skb->xmit_more support
  2014-10-07 20:30 [PATCH net-next] i40e: skb->xmit_more support Eric Dumazet
  2014-10-07 20:37 ` David Miller
  2014-10-07 22:03 ` Daniel Borkmann
@ 2014-10-08 17:02 ` Greg Rose
  2014-10-08 17:35   ` David Miller
  2014-10-08 20:04 ` David Miller
  3 siblings, 1 reply; 9+ messages in thread
From: Greg Rose @ 2014-10-08 17:02 UTC (permalink / raw)
  To: Eric Dumazet; +Cc: David Miller, netdev, Daniel Borkmann, Jeff Kirsher

On Tue, 7 Oct 2014 13:30:23 -0700
Eric Dumazet <eric.dumazet@gmail.com> wrote:

> From: Eric Dumazet <edumazet@google.com>
> 
> Support skb->xmit_more in i40e is straightforward : we need to move
> around i40e_maybe_stop_tx() call to correctly test
> netif_xmit_stopped() before taking the decision to not kick the NIC.
> 
> Signed-off-by: Eric Dumazet <edumazet@google.com>

Looks good to me.

- Greg

> ---
>  drivers/net/ethernet/intel/i40e/i40e_txrx.c |   90 +++++++++---------
>  1 file changed, 46 insertions(+), 44 deletions(-)
> 
> diff --git a/drivers/net/ethernet/intel/i40e/i40e_txrx.c
> b/drivers/net/ethernet/intel/i40e/i40e_txrx.c index
> 267992b3de8a..3195d82e4942 100644 ---
> a/drivers/net/ethernet/intel/i40e/i40e_txrx.c +++
> b/drivers/net/ethernet/intel/i40e/i40e_txrx.c @@ -2053,6 +2053,47 @@
> static void i40e_create_tx_ctx(struct i40e_ring *tx_ring, }
>  
>  /**
> + * __i40e_maybe_stop_tx - 2nd level check for tx stop conditions
> + * @tx_ring: the ring to be checked
> + * @size:    the size buffer we want to assure is available
> + *
> + * Returns -EBUSY if a stop is needed, else 0
> + **/
> +static inline int __i40e_maybe_stop_tx(struct i40e_ring *tx_ring,
> int size) +{
> +	netif_stop_subqueue(tx_ring->netdev, tx_ring->queue_index);
> +	/* Memory barrier before checking head and tail */
> +	smp_mb();
> +
> +	/* Check again in a case another CPU has just made room
> available. */
> +	if (likely(I40E_DESC_UNUSED(tx_ring) < size))
> +		return -EBUSY;
> +
> +	/* A reprieve! - use start_queue because it doesn't call
> schedule */
> +	netif_start_subqueue(tx_ring->netdev, tx_ring->queue_index);
> +	++tx_ring->tx_stats.restart_queue;
> +	return 0;
> +}
> +
> +/**
> + * i40e_maybe_stop_tx - 1st level check for tx stop conditions
> + * @tx_ring: the ring to be checked
> + * @size:    the size buffer we want to assure is available
> + *
> + * Returns 0 if stop is not needed
> + **/
> +#ifdef I40E_FCOE
> +int i40e_maybe_stop_tx(struct i40e_ring *tx_ring, int size)
> +#else
> +static int i40e_maybe_stop_tx(struct i40e_ring *tx_ring, int size)
> +#endif
> +{
> +	if (likely(I40E_DESC_UNUSED(tx_ring) >= size))
> +		return 0;
> +	return __i40e_maybe_stop_tx(tx_ring, size);
> +}
> +
> +/**
>   * i40e_tx_map - Build the Tx descriptor
>   * @tx_ring:  ring to send buffer on
>   * @skb:      send buffer
> @@ -2195,8 +2236,12 @@ static void i40e_tx_map(struct i40e_ring
> *tx_ring, struct sk_buff *skb, 
>  	tx_ring->next_to_use = i;
>  
> +	i40e_maybe_stop_tx(tx_ring, DESC_NEEDED);
>  	/* notify HW of packet */
> -	writel(i, tx_ring->tail);
> +	if (!skb->xmit_more ||
> +	    netif_xmit_stopped(netdev_get_tx_queue(tx_ring->netdev,
> +
> tx_ring->queue_index)))
> +		writel(i, tx_ring->tail);
>  
>  	return;
>  
> @@ -2218,47 +2263,6 @@ dma_error:
>  }
>  
>  /**
> - * __i40e_maybe_stop_tx - 2nd level check for tx stop conditions
> - * @tx_ring: the ring to be checked
> - * @size:    the size buffer we want to assure is available
> - *
> - * Returns -EBUSY if a stop is needed, else 0
> - **/
> -static inline int __i40e_maybe_stop_tx(struct i40e_ring *tx_ring,
> int size) -{
> -	netif_stop_subqueue(tx_ring->netdev, tx_ring->queue_index);
> -	/* Memory barrier before checking head and tail */
> -	smp_mb();
> -
> -	/* Check again in a case another CPU has just made room
> available. */
> -	if (likely(I40E_DESC_UNUSED(tx_ring) < size))
> -		return -EBUSY;
> -
> -	/* A reprieve! - use start_queue because it doesn't call
> schedule */
> -	netif_start_subqueue(tx_ring->netdev, tx_ring->queue_index);
> -	++tx_ring->tx_stats.restart_queue;
> -	return 0;
> -}
> -
> -/**
> - * i40e_maybe_stop_tx - 1st level check for tx stop conditions
> - * @tx_ring: the ring to be checked
> - * @size:    the size buffer we want to assure is available
> - *
> - * Returns 0 if stop is not needed
> - **/
> -#ifdef I40E_FCOE
> -int i40e_maybe_stop_tx(struct i40e_ring *tx_ring, int size)
> -#else
> -static int i40e_maybe_stop_tx(struct i40e_ring *tx_ring, int size)
> -#endif
> -{
> -	if (likely(I40E_DESC_UNUSED(tx_ring) >= size))
> -		return 0;
> -	return __i40e_maybe_stop_tx(tx_ring, size);
> -}
> -
> -/**
>   * i40e_xmit_descriptor_count - calculate number of tx descriptors
> needed
>   * @skb:     send buffer
>   * @tx_ring: ring to send buffer on
> @@ -2372,8 +2376,6 @@ static netdev_tx_t i40e_xmit_frame_ring(struct
> sk_buff *skb, i40e_tx_map(tx_ring, skb, first, tx_flags, hdr_len,
>  		    td_cmd, td_offset);
>  
> -	i40e_maybe_stop_tx(tx_ring, DESC_NEEDED);
> -
>  	return NETDEV_TX_OK;
>  
>  out_drop:
> 
> 
> --
> To unsubscribe from this list: send the line "unsubscribe netdev" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH net-next] i40e: skb->xmit_more support
  2014-10-08 17:02 ` Greg Rose
@ 2014-10-08 17:35   ` David Miller
  2014-10-08 18:16     ` Jeff Kirsher
  0 siblings, 1 reply; 9+ messages in thread
From: David Miller @ 2014-10-08 17:35 UTC (permalink / raw)
  To: gregory.v.rose; +Cc: eric.dumazet, netdev, dborkman, jeffrey.t.kirsher

From: Greg Rose <gregory.v.rose@intel.com>
Date: Wed, 8 Oct 2014 10:02:58 -0700

> On Tue, 7 Oct 2014 13:30:23 -0700
> Eric Dumazet <eric.dumazet@gmail.com> wrote:
> 
>> From: Eric Dumazet <edumazet@google.com>
>> 
>> Support skb->xmit_more in i40e is straightforward : we need to move
>> around i40e_maybe_stop_tx() call to correctly test
>> netif_xmit_stopped() before taking the decision to not kick the NIC.
>> 
>> Signed-off-by: Eric Dumazet <edumazet@google.com>
> 
> Looks good to me.

Jeff, ok for me to apply this directly now?

Thanks.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH net-next] i40e: skb->xmit_more support
  2014-10-08 17:35   ` David Miller
@ 2014-10-08 18:16     ` Jeff Kirsher
  0 siblings, 0 replies; 9+ messages in thread
From: Jeff Kirsher @ 2014-10-08 18:16 UTC (permalink / raw)
  To: David Miller; +Cc: gregory.v.rose, eric.dumazet, netdev, dborkman

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

On Wed, 2014-10-08 at 13:35 -0400, David Miller wrote:
> From: Greg Rose <gregory.v.rose@intel.com>
> Date: Wed, 8 Oct 2014 10:02:58 -0700
> 
> > On Tue, 7 Oct 2014 13:30:23 -0700
> > Eric Dumazet <eric.dumazet@gmail.com> wrote:
> > 
> >> From: Eric Dumazet <edumazet@google.com>
> >> 
> >> Support skb->xmit_more in i40e is straightforward : we need to move
> >> around i40e_maybe_stop_tx() call to correctly test
> >> netif_xmit_stopped() before taking the decision to not kick the NIC.
> >> 
> >> Signed-off-by: Eric Dumazet <edumazet@google.com>
> > 
> > Looks good to me.
> 
> Jeff, ok for me to apply this directly now?
> 
> Thanks.

Yes, please do.

Acked-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH net-next] i40e: skb->xmit_more support
  2014-10-07 20:30 [PATCH net-next] i40e: skb->xmit_more support Eric Dumazet
                   ` (2 preceding siblings ...)
  2014-10-08 17:02 ` Greg Rose
@ 2014-10-08 20:04 ` David Miller
  3 siblings, 0 replies; 9+ messages in thread
From: David Miller @ 2014-10-08 20:04 UTC (permalink / raw)
  To: eric.dumazet; +Cc: netdev, dborkman, jeffrey.t.kirsher

From: Eric Dumazet <eric.dumazet@gmail.com>
Date: Tue, 07 Oct 2014 13:30:23 -0700

> From: Eric Dumazet <edumazet@google.com>
> 
> Support skb->xmit_more in i40e is straightforward : we need to move
> around i40e_maybe_stop_tx() call to correctly test netif_xmit_stopped()
> before taking the decision to not kick the NIC.
> 
> Signed-off-by: Eric Dumazet <edumazet@google.com>

Applied, thanks everyone.

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2014-10-08 20:04 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-10-07 20:30 [PATCH net-next] i40e: skb->xmit_more support Eric Dumazet
2014-10-07 20:37 ` David Miller
2014-10-08  4:02   ` Jeff Kirsher
2014-10-07 22:03 ` Daniel Borkmann
2014-10-08 12:29   ` Jeff Kirsher
2014-10-08 17:02 ` Greg Rose
2014-10-08 17:35   ` David Miller
2014-10-08 18:16     ` Jeff Kirsher
2014-10-08 20:04 ` 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).