public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: David Daney <ddaney.cavm@gmail.com>
To: Asbjoern Sloth Toennesen <asbjorn@asbjorn.st>
Cc: Ralf Baechle <ralf@linux-mips.org>,
	linux-mips@linux-mips.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] MIPS: Octeon: Use defines instead of magic numbers
Date: Mon, 12 Sep 2016 15:00:21 -0700	[thread overview]
Message-ID: <57D72575.8060506@gmail.com> (raw)
In-Reply-To: <20160912203343.26751-1-asbjorn@asbjorn.st>

On 09/12/2016 01:33 PM, Asbjoern Sloth Toennesen wrote:
> The patch will be followed by a similar patch to
> drivers/staging/octeon/ethernet.c
>
> Signed-off-by: Asbjoern Sloth Toennesen <asbjorn@asbjorn.st>
> ---
>   arch/mips/cavium-octeon/executive/cvmx-helper.c | 15 ++++++++++-----
>   arch/mips/include/asm/octeon/cvmx-ipd-defs.h    |  2 ++
>   2 files changed, 12 insertions(+), 5 deletions(-)
>

Nobody knows what the purpose of 
__cvmx_helper_errata_fix_ipd_ptr_alignment() is.  Since there are no 
commercially available devices with the effected hardware (cn30xx, 
cn31xx), perhaps we should just remove the whole thing.


> diff --git a/arch/mips/cavium-octeon/executive/cvmx-helper.c b/arch/mips/cavium-octeon/executive/cvmx-helper.c
> index ff26d02..9b938c8 100644
> --- a/arch/mips/cavium-octeon/executive/cvmx-helper.c
> +++ b/arch/mips/cavium-octeon/executive/cvmx-helper.c
> @@ -46,6 +46,8 @@
>   #include <asm/octeon/cvmx-smix-defs.h>
>   #include <asm/octeon/cvmx-asxx-defs.h>
>
> +#include <linux/if_ether.h>
> +
>   /**
>    * cvmx_override_pko_queue_priority(int ipd_port, uint64_t
>    * priorities[16]) is a function pointer. It is meant to allow
> @@ -918,7 +920,8 @@ int __cvmx_helper_errata_fix_ipd_ptr_alignment(void)
>   		p64 = (uint64_t *) cvmx_phys_to_ptr(pkt_buffer.s.addr);
>   		p64[0] = 0xffffffffffff0000ull;
>   		p64[1] = 0x08004510ull;
> -		p64[2] = ((uint64_t) (size - 14) << 48) | 0x5ae740004000ull;
> +		p64[2] = ((uint64_t) (size - ETH_HLEN) << 48)
> +			| 0x5ae740004000ull;
>   		p64[3] = 0x3a5fc0a81073c0a8ull;
>
>   		for (i = 0; i < num_segs; i++) {
> @@ -954,11 +957,13 @@ int __cvmx_helper_errata_fix_ipd_ptr_alignment(void)
>   			       1 << INDEX(FIX_IPD_OUTPORT));
>
>   		cvmx_write_csr(CVMX_GMXX_RXX_JABBER
> -			       (INDEX(FIX_IPD_OUTPORT),
> -				INTERFACE(FIX_IPD_OUTPORT)), 65392 - 14 - 4);
> +				(INDEX(FIX_IPD_OUTPORT),
> +					INTERFACE(FIX_IPD_OUTPORT)),
> +				CVMX_IPD_MAX_MTU - ETH_HLEN - ETH_FCS_LEN);
>   		cvmx_write_csr(CVMX_GMXX_RXX_FRM_MAX
> -			       (INDEX(FIX_IPD_OUTPORT),
> -				INTERFACE(FIX_IPD_OUTPORT)), 65392 - 14 - 4);
> +				(INDEX(FIX_IPD_OUTPORT),
> +					INTERFACE(FIX_IPD_OUTPORT)),
> +				CVMX_IPD_MAX_MTU - ETH_HLEN - ETH_FCS_LEN);
>
>   		cvmx_pko_send_packet_prepare(FIX_IPD_OUTPORT,
>   					     cvmx_pko_get_base_queue
> diff --git a/arch/mips/include/asm/octeon/cvmx-ipd-defs.h b/arch/mips/include/asm/octeon/cvmx-ipd-defs.h
> index 1193f73..a877917 100644
> --- a/arch/mips/include/asm/octeon/cvmx-ipd-defs.h
> +++ b/arch/mips/include/asm/octeon/cvmx-ipd-defs.h
> @@ -28,6 +28,8 @@
>   #ifndef __CVMX_IPD_DEFS_H__
>   #define __CVMX_IPD_DEFS_H__
>
> +#define CVMX_IPD_MAX_MTU 65392
> +
>   #define CVMX_IPD_1ST_MBUFF_SKIP (CVMX_ADD_IO_SEG(0x00014F0000000000ull))
>   #define CVMX_IPD_1st_NEXT_PTR_BACK (CVMX_ADD_IO_SEG(0x00014F0000000150ull))
>   #define CVMX_IPD_2nd_NEXT_PTR_BACK (CVMX_ADD_IO_SEG(0x00014F0000000158ull))
>

      parent reply	other threads:[~2016-09-12 22:00 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-12 20:33 [PATCH] MIPS: Octeon: Use defines instead of magic numbers Asbjoern Sloth Toennesen
2016-09-12 21:03 ` Aaro Koskinen
2016-09-13 19:04   ` Asbjørn Sloth Tønnesen
2016-09-13 19:31     ` Aaro Koskinen
2016-09-12 22:00 ` David Daney [this message]

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=57D72575.8060506@gmail.com \
    --to=ddaney.cavm@gmail.com \
    --cc=asbjorn@asbjorn.st \
    --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