All of lore.kernel.org
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@infradead.org>
To: Greg Ungerer <gerg@snapgear.com>
Cc: linux-kernel@vger.kernel.org, gerg@uclinux.org,
	linux-m68k@vger.kernel.org
Subject: Re: [PATCH] m68k: merge the mmu and non-mmu versions of checksum.h
Date: Thu, 18 Jun 2009 15:45:21 -0400	[thread overview]
Message-ID: <20090618194521.GA7464@infradead.org> (raw)
In-Reply-To: <200906170711.n5H7BFw9009030@localhost.localdomain>

On Wed, Jun 17, 2009 at 05:11:15PM +1000, Greg Ungerer wrote:
> +#ifdef CONFIG_MMU
>  /*
>   *	This is a version of ip_compute_csum() optimized for IP headers,
>   *	which always checksum on 4 octet boundaries.
> @@ -59,6 +61,9 @@ static inline __sum16 ip_fast_csum(const void *iph, unsigned int ihl)
>  		 : "memory");
>  	return (__force __sum16)~sum;
>  }
> +#else
> +__sum16 ip_fast_csum(const void *iph, unsigned int ihl);
> +#endif

Any good reason this is inline for all mmu processors and out of line
for nommu, independent of the actual cpu variant?

>  static inline __sum16 csum_fold(__wsum sum)
>  {
>  	unsigned int tmp = (__force u32)sum;
> +#ifdef CONFIG_COLDFIRE
> +	tmp = (tmp & 0xffff) + (tmp >> 16);
> +	tmp = (tmp & 0xffff) + (tmp >> 16);
> +	return (__force __sum16)~tmp;
> +#else
>  	__asm__("swap %1\n\t"
>  		"addw %1, %0\n\t"
>  		"clrw %1\n\t"
> @@ -74,6 +84,7 @@ static inline __sum16 csum_fold(__wsum sum)
>  		: "=&d" (sum), "=&d" (tmp)
>  		: "0" (sum), "1" (tmp));
>  	return (__force __sum16)~sum;
> +#endif
>  }

I think this would be cleaner by having totally separate functions
for both cases, e.g.

#ifdef CONFIG_COLDFIRE
static inline __sum16 csum_fold(__wsum sum)
{
	unsigned int tmp = (__force u32)sum;

	tmp = (tmp & 0xffff) + (tmp >> 16);
	tmp = (tmp & 0xffff) + (tmp >> 16);

	return (__force __sum16)~tmp;
}
#else
...
#endif

  reply	other threads:[~2009-06-18 19:45 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-06-17  7:11 [PATCH] m68k: merge the mmu and non-mmu versions of checksum.h Greg Ungerer
2009-06-18 19:45 ` Christoph Hellwig [this message]
2009-06-19  6:54   ` Greg Ungerer

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=20090618194521.GA7464@infradead.org \
    --to=hch@infradead.org \
    --cc=gerg@snapgear.com \
    --cc=gerg@uclinux.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-m68k@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.