Intel-Wired-Lan Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Alexander Duyck <alexander.h.duyck@redhat.com>
To: intel-wired-lan@osuosl.org
Subject: [Intel-wired-lan] [net-next S4 13/15] i40e/i40evf: force inline transmit functions
Date: Tue, 05 May 2015 09:55:39 -0700	[thread overview]
Message-ID: <5548F60B.3000209@redhat.com> (raw)
In-Reply-To: <1429229172-143692-14-git-send-email-catherine.sullivan@intel.com>

On 04/16/2015 05:06 PM, Catherine Sullivan wrote:
> From: Jesse Brandeburg <jesse.brandeburg@intel.com>
>
> Inlining these functions gives us about 15% more 64 byte packets per
> second when using pktgen. 13.3 million to 15 million with a single
> queue.
>
> Also fix the function names in i40evf to i40evf not i40e while we are
> touching the function header.
>
> Signed-off-by: Jesse Brandeburg <jesse.brandeburg@intel.com>
> Signed-off-by: Catherine Sullivan <catherine.sullivan@intel.com>
> Change-ID: I3294ae9b085cf438672b6db5f9af122490ead9d0
> ---

The code below is ugly.  If you are going to inline it anyway you might 
as well just move the inline functions to a header file so that they can 
all be static inline.  Also what is the difference in size between the 
before/after with FCoE for this part enabled?  It would be useful to 
have that info in the patch description.  I suspect the change is fairly 
significant since you are doubling the map function which is fairly sizable.

I suspect most of these changes are only showing gains in the FCoE 
case.  Really you guys should look at reachitecting things rather than 
bloating the driver by doubling up the xmit path.  You could probably do 
a quick check against the netdev and then just call some FCoE specific 
offload path before getting back to i40e_tx_map.

Comments inline below.

- Alex

>   drivers/net/ethernet/intel/i40e/i40e_txrx.c   | 32 ++++++++++++------------
>   drivers/net/ethernet/intel/i40evf/i40e_txrx.c | 36 ++++++++++++---------------
>   2 files changed, 32 insertions(+), 36 deletions(-)
>
> diff --git a/drivers/net/ethernet/intel/i40e/i40e_txrx.c b/drivers/net/ethernet/intel/i40e/i40e_txrx.c
> index d6ad42b..ca21f9a 100644
> --- a/drivers/net/ethernet/intel/i40e/i40e_txrx.c
> +++ b/drivers/net/ethernet/intel/i40e/i40e_txrx.c
> @@ -2065,13 +2065,13 @@ static void i40e_atr(struct i40e_ring *tx_ring, struct sk_buff *skb,
>    * otherwise  returns 0 to indicate the flags has been set properly.
>    **/
>   #ifdef I40E_FCOE
> -int i40e_tx_prepare_vlan_flags(struct sk_buff *skb,
> -			       struct i40e_ring *tx_ring,
> -			       u32 *flags)
> -#else
> -static int i40e_tx_prepare_vlan_flags(struct sk_buff *skb,
> +inline int i40e_tx_prepare_vlan_flags(struct sk_buff *skb,
>   				      struct i40e_ring *tx_ring,
>   				      u32 *flags)
> +#else
> +static inline int i40e_tx_prepare_vlan_flags(struct sk_buff *skb,
> +					     struct i40e_ring *tx_ring,
> +					     u32 *flags)
>   #endif
>   {
>   	__be16 protocol = skb->protocol;
> @@ -2414,9 +2414,9 @@ static inline int __i40e_maybe_stop_tx(struct i40e_ring *tx_ring, int size)
>    * Returns 0 if stop is not needed
>    **/
>   #ifdef I40E_FCOE
> -int i40e_maybe_stop_tx(struct i40e_ring *tx_ring, int size)
> +inline 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)
> +static inline int i40e_maybe_stop_tx(struct i40e_ring *tx_ring, int size)
>   #endif
>   {
>   	if (likely(I40E_DESC_UNUSED(tx_ring) >= size))
> @@ -2496,13 +2496,13 @@ linearize_chk_done:
>    * @td_offset: offset for checksum or crc
>    **/
>   #ifdef I40E_FCOE
> -void i40e_tx_map(struct i40e_ring *tx_ring, struct sk_buff *skb,
> -		 struct i40e_tx_buffer *first, u32 tx_flags,
> -		 const u8 hdr_len, u32 td_cmd, u32 td_offset)
> -#else
> -static void i40e_tx_map(struct i40e_ring *tx_ring, struct sk_buff *skb,
> +inline void i40e_tx_map(struct i40e_ring *tx_ring, struct sk_buff *skb,
>   			struct i40e_tx_buffer *first, u32 tx_flags,
>   			const u8 hdr_len, u32 td_cmd, u32 td_offset)
> +#else
> +static inline void i40e_tx_map(struct i40e_ring *tx_ring, struct sk_buff *skb,
> +			       struct i40e_tx_buffer *first, u32 tx_flags,
> +			       const u8 hdr_len, u32 td_cmd, u32 td_offset)
>   #endif
>   {
>   	unsigned int data_len = skb->data_len;

Inlining i40e_tx_map is kind of overkill isn't it?  Isn't this most of 
the code for the xmit path?

> @@ -2663,11 +2663,11 @@ dma_error:
>    * one descriptor.
>    **/
>   #ifdef I40E_FCOE
> -int i40e_xmit_descriptor_count(struct sk_buff *skb,
> -			       struct i40e_ring *tx_ring)
> -#else
> -static int i40e_xmit_descriptor_count(struct sk_buff *skb,
> +inline int i40e_xmit_descriptor_count(struct sk_buff *skb,
>   				      struct i40e_ring *tx_ring)
> +#else
> +static inline int i40e_xmit_descriptor_count(struct sk_buff *skb,
> +					     struct i40e_ring *tx_ring)
>   #endif
>   {
>   	unsigned int f;

So the VF code is just a copy of this w/ some renaming so I dropped it.  
I'm assuming the actual gains are none for this patch on the VF, do I 
have that correct?  I'm assuming the compiler is smart enough to realize 
it can inline static functions that are only called once.

  parent reply	other threads:[~2015-05-05 16:55 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-17  0:05 [Intel-wired-lan] [net-next S4 00/15] i40e/i40evf updates Catherine Sullivan
2015-04-17  0:05 ` [Intel-wired-lan] [net-next S4 01/15] i40e: Collect PFC XOFF RX stats even in single TC case Catherine Sullivan
2015-05-05 17:44   ` Young, James M
2015-04-17  0:05 ` [Intel-wired-lan] [net-next S4 02/15] i40e: Disable offline diagnostics if VFs are enabled Catherine Sullivan
2015-05-05 17:53   ` Young, James M
2015-04-17  0:06 ` [Intel-wired-lan] [net-next S4 03/15] i40e/i40evf: Add ATR support for tunneled TCP/IPv4/IPv6 packets Catherine Sullivan
2015-05-08 19:24   ` Young, James M
2015-04-17  0:06 ` [Intel-wired-lan] [net-next S4 04/15] i40e/i40evf: Add stats to count Tunnel ATR hits Catherine Sullivan
2015-05-08 17:56   ` Young, James M
2015-04-17  0:06 ` [Intel-wired-lan] [net-next S4 05/15] i40e: Remove unnecessary pf members Catherine Sullivan
2015-05-06 16:33   ` Young, James M
2015-04-17  0:06 ` [Intel-wired-lan] [net-next S4 06/15] i40e/i40evf: Remove unneeded TODO Catherine Sullivan
2015-05-05 17:51   ` Young, James M
2015-04-17  0:06 ` [Intel-wired-lan] [net-next S4 07/15] i40evf: restore state Catherine Sullivan
2015-05-05 17:35   ` Young, James M
2015-04-17  0:06 ` [Intel-wired-lan] [net-next S4 08/15] i40e: fix unrecognized FCOE EOF case Catherine Sullivan
2015-05-05 16:15   ` Young, James M
2015-04-17  0:06 ` [Intel-wired-lan] [net-next S4 09/15] i40e: Move the FD ATR/SB messages to a higher debug level Catherine Sullivan
2015-05-09  0:06   ` Young, James M
2015-04-17  0:06 ` [Intel-wired-lan] [net-next S4 10/15] i40e/i40evf: Add stats to track FD ATR and SB dynamic enable state Catherine Sullivan
2015-04-17  0:06 ` [Intel-wired-lan] [net-next S4 11/15] i40e/i40evf: Update Flex-10 related device/function capabilities Catherine Sullivan
2015-04-17  0:06 ` [Intel-wired-lan] [net-next S4 12/15] i40evf: skb->xmit_more support Catherine Sullivan
2015-05-05 17:27   ` Alexander Duyck
2015-05-09  0:21   ` Young, James M
2015-04-17  0:06 ` [Intel-wired-lan] [net-next S4 13/15] i40e/i40evf: force inline transmit functions Catherine Sullivan
2015-05-05 16:12   ` Young, James M
2015-05-05 16:55   ` Alexander Duyck [this message]
2015-04-17  0:06 ` [Intel-wired-lan] [net-next S4 14/15] i40e/i40evf: remove time_stamp member Catherine Sullivan
2015-04-17  0:06 ` [Intel-wired-lan] [net-next S4 15/15] i40e: Bump version to 1.3.4 Catherine Sullivan
2015-05-05 16:11   ` Young, James M
2015-04-17 18:53 ` [Intel-wired-lan] [net-next S4 00/15] i40e/i40evf updates Jeff Kirsher

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5548F60B.3000209@redhat.com \
    --to=alexander.h.duyck@redhat.com \
    --cc=intel-wired-lan@osuosl.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox