linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Zumeng Chen <zumeng.chen@gmail.com>
To: Claudiu Manoil <claudiu.manoil@nxp.com>,
	"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Cc: "davem@davemloft.net" <davem@davemloft.net>
Subject: Re: [PATCH 1/1] gianfar: fix a flooded alignment reports because of padding issue.
Date: Tue, 5 Dec 2017 10:18:42 +0800	[thread overview]
Message-ID: <46d11607-d9bc-d24f-5c1d-62eb74c721c2@gmail.com> (raw)
In-Reply-To: <AM5PR0401MB256141EAA45FA0BBB301D8B7963C0@AM5PR0401MB2561.eurprd04.prod.outlook.com>

On 12/05/2017 12:06 AM, Claudiu Manoil wrote:
>> -----Original Message-----
>> From: Zumeng Chen [mailto:zumeng.chen@gmail.com]
>> Sent: Monday, December 04, 2017 5:22 AM
>> To: netdev@vger.kernel.org; linux-kernel@vger.kernel.org
>> Cc: Claudiu Manoil <claudiu.manoil@nxp.com>; davem@davemloft.net
>> Subject: [PATCH 1/1] gianfar: fix a flooded alignment reports because of padding
>> issue.
>>
>> According to LS1021A RM, the value of PAL can be set so that the start of the
>> IP header in the receive data buffer is aligned to a 32-bit boundary. Normally,
>> setting PAL = 2 provides minimal padding to ensure such alignment of the IP
>> header.
>>
>> However every incoming packet's 8-byte time stamp will be inserted into the
>> packet data buffer as padding alignment bytes when hardware time stamping is
>> enabled.
>>
>> So we set the padding 8+2 here to avoid the flooded alignment faults:
>>
>> root@128:~# cat /proc/cpu/alignment
>> User:           0
>> System:         17539 (inet_gro_receive+0x114/0x2c0)
>> Skipped:        0
>> Half:           0
>> Word:           0
>> DWord:          0
>> Multi:          17539
>> User faults:    2 (fixup)
>>
> [...]
>> drivers/net/ethernet/freescale/gianfar.c | 6 ++++--
>> 1 file changed, 4 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/net/ethernet/freescale/gianfar.c
>> b/drivers/net/ethernet/freescale/gianfar.c
>> index e616b71..e47945f 100644
>> --- a/drivers/net/ethernet/freescale/gianfar.c
>> +++ b/drivers/net/ethernet/freescale/gianfar.c
>> @@ -1413,9 +1413,11 @@ static int gfar_probe(struct platform_device *ofdev)
>>
>> 	gfar_init_addr_hash_table(priv);
>>
>> -	/* Insert receive time stamps into padding alignment bytes */
>> +	/* Insert receive time stamps into padding alignment bytes, and
>> +	 * plus 2 bytes padding to ensure the cpu alignment.
>> +	 */
>> 	if (priv->device_flags & FSL_GIANFAR_DEV_HAS_TIMER)
>> -		priv->padding = 8;
>> +		priv->padding = 8 + DEFAULT_PADDING;
>>
>> 	if (dev->features & NETIF_F_IP_CSUM ||
>> 	    priv->device_flags & FSL_GIANFAR_DEV_HAS_TIMER)
>> --
>> 2.5.0
> Why handle only the rx timestamp path (HAS_TIMER) when the issue,

Sorry, missed this one. Because the mis-alignment is only been
seen in gfar_clean_rx_ring from padding issue so far.

>   as presented
> by you, should be applicable to the default path as well?
>
> The code change according to the patch description should be more likely:
>
> +       priv->padding = DEFAULT_PADDING;
>          /* Insert receive time stamps into padding alignment bytes */
>          if (priv->device_flags & FSL_GIANFAR_DEV_HAS_TIMER)
> -               priv->padding = 8;
> +               priv->padding += 8;

I just did a sanity testing on your change, it's OK.

root@1021:~# cat /proc/cpu/alignment
User:        0
System:        0 (  (null))
Skipped:    0
Half:        0
Word:        0
DWord:        0
Multi:        0
User faults:    2 (fixup)

>
>
> Do you have any performance numbers for this change?
>
> Thanks,
> Claudiu

  parent reply	other threads:[~2017-12-05  2:17 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-04  3:22 [PATCH 1/1] gianfar: fix a flooded alignment reports because of padding issue Zumeng Chen
2017-12-04 16:06 ` Claudiu Manoil
2017-12-05  0:24   ` Zumeng Chen
2017-12-05  2:18   ` Zumeng Chen [this message]
2017-12-05 16:48 ` David Miller

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=46d11607-d9bc-d24f-5c1d-62eb74c721c2@gmail.com \
    --to=zumeng.chen@gmail.com \
    --cc=claudiu.manoil@nxp.com \
    --cc=davem@davemloft.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.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;
as well as URLs for NNTP newsgroup(s).