From: Alexander Duyck <alexander.duyck@gmail.com>
To: Mark Zhang <bomb.zhang@gmail.com>
Cc: Ralf Baechle <ralf@linux-mips.org>,
David Miller <davem@davemloft.net>,
Alexander Duyck <aduyck@mirantis.com>,
linux-mips@linux-mips.org,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [Bug fix]mips 64bits checksum error -- csum_tcpudp_nofold
Date: Thu, 26 Jan 2017 07:57:49 -0800 [thread overview]
Message-ID: <CAKgT0UdNMH89JD95f7qmMLe32W3R6pupOOG_mSn=_ZkpUASBJw@mail.gmail.com> (raw)
In-Reply-To: <CAEbrdOB4AQx6frAZr=_u4hutzfXS9R5TOtpdJox=9Tmw4WN0sA@mail.gmail.com>
On Wed, Jan 25, 2017 at 6:33 PM, Mark Zhang <bomb.zhang@gmail.com> wrote:
> Hi Alex,
>
> Thanks for your reply.
> I tested your correction. The result is correct.
> The C language will cause this function(csum_tcpudp_nofold) become
> 176 MIPS instructions. The assemble code is 150 MIPS instruction.
> If the MIPS CPU is running as 1GHz, C language cause more 60 nano
> seconds during send/receive each tcp/udp packet. I'm not sure whether
> it will cause any negative result if the frequency of CPU was lower.
> MIPS arch is usually used in networking equipments.
> I think Ralf's correction is better.
>
> - Mark
>
> Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
>
> arch/mips/include/asm/checksum.h | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/arch/mips/include/asm/checksum.h b/arch/mips/include/asm/checksum.h
> index 5c585c5..08b6ba3 100644
> --- a/arch/mips/include/asm/checksum.h
> +++ b/arch/mips/include/asm/checksum.h
> @@ -186,7 +186,9 @@ static inline __wsum csum_tcpudp_nofold(__be32 saddr,
> " daddu %0, %4 \n"
> " dsll32 $1, %0, 0 \n"
> " daddu %0, $1 \n"
> + " sltu $1, %0, $1 \n"
> " dsra32 %0, %0, 0 \n"
> + " daddu %0, $1 \n"
> #endif
> " .set pop"
> : "=r" (sum)
>
This looks good to me.
Acked-by: Alexander Duyck <alexander.h.duyck@intel.com>
next prev parent reply other threads:[~2017-01-26 15:58 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-01-25 4:35 [Bug fix]mips 64bits checksum error -- csum_tcpudp_nofold Mark Zhang
2017-01-25 18:13 ` Alexander Duyck
2017-01-26 2:33 ` Mark Zhang
2017-01-26 15:57 ` Alexander Duyck [this message]
2017-01-26 16:11 ` Ralf Baechle
2017-01-26 8:09 ` Ralf Baechle
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='CAKgT0UdNMH89JD95f7qmMLe32W3R6pupOOG_mSn=_ZkpUASBJw@mail.gmail.com' \
--to=alexander.duyck@gmail.com \
--cc=aduyck@mirantis.com \
--cc=bomb.zhang@gmail.com \
--cc=davem@davemloft.net \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mips@linux-mips.org \
--cc=ralf@linux-mips.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).