Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1481949 > unrolled thread
| Started by | Asbjoern Sloth Toennesen <asbjorn@asbjorn.st> |
|---|---|
| First post | 2016-09-12 22:50 +0200 |
| Last post | 2016-09-13 00:10 +0200 |
| Articles | 5 — 4 participants |
Back to article view | Back to linux.kernel
[PATCH] MIPS: Octeon: Use defines instead of magic numbers Asbjoern Sloth Toennesen <asbjorn@asbjorn.st> - 2016-09-12 22:50 +0200
Re: [PATCH] MIPS: Octeon: Use defines instead of magic numbers Aaro Koskinen <aaro.koskinen@iki.fi> - 2016-09-12 23:10 +0200
Re: [PATCH] MIPS: Octeon: Use defines instead of magic numbers Asbjørn Sloth Tønnesen <asbjorn@asbjorn.st> - 2016-09-13 21:20 +0200
Re: [PATCH] MIPS: Octeon: Use defines instead of magic numbers Aaro Koskinen <aaro.koskinen@iki.fi> - 2016-09-13 21:40 +0200
Re: [PATCH] MIPS: Octeon: Use defines instead of magic numbers David Daney <ddaney.cavm@gmail.com> - 2016-09-13 00:10 +0200
| From | Asbjoern Sloth Toennesen <asbjorn@asbjorn.st> |
|---|---|
| Date | 2016-09-12 22:50 +0200 |
| Subject | [PATCH] MIPS: Octeon: Use defines instead of magic numbers |
| Message-ID | <sgGkV-8vM-7@gated-at.bofh.it> |
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(-)
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))
--
2.9.3
[toc] | [next] | [standalone]
| From | Aaro Koskinen <aaro.koskinen@iki.fi> |
|---|---|
| Date | 2016-09-12 23:10 +0200 |
| Message-ID | <sgGEi-uI-25@gated-at.bofh.it> |
| In reply to | #1481949 |
On Mon, Sep 12, 2016 at 08:33:43PM +0000, Asbjoern Sloth Toennesen wrote:
> The patch will be followed by a similar patch to
> drivers/staging/octeon/ethernet.c
I think you should:
1. Move this function to staging/octeon
2. Do required cleanups there
3. Finally delete the function under arch/mips
We shouldn't start making cleanups (except code removal) to ethernet code
under mips/cavium-octeon/executive as it really does not belong there...
A.
> 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(-)
>
> 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))
> --
> 2.9.3
>
>
[toc] | [prev] | [next] | [standalone]
| From | Asbjørn Sloth Tønnesen <asbjorn@asbjorn.st> |
|---|---|
| Date | 2016-09-13 21:20 +0200 |
| Message-ID | <sh1po-64P-23@gated-at.bofh.it> |
| In reply to | #1481973 |
[Multipart message — attachments visible in raw view] — view raw
Hi Aaro, On Tue, 13 Sep 2016 00:03:14 +0300, Aaro Koskinen <aaro.koskinen@iki.fi> wrote: > On Mon, Sep 12, 2016 at 08:33:43PM +0000, Asbjoern Sloth Toennesen wrote: > > The patch will be followed by a similar patch to > > drivers/staging/octeon/ethernet.c > > I think you should: > > 1. Move this function to staging/octeon > > 2. Do required cleanups there > > 3. Finally delete the function under arch/mips > > We shouldn't start making cleanups (except code removal) to ethernet code > under mips/cavium-octeon/executive as it really does not belong there... I agree that this would make sense, however I just came across this looking at the general MTU code across drivers, and don't have a real interest in this particular driver nor mips, so I am not looking to fall that deep into the rabbit hole. -- Best regards Asbjørn Sloth Tønnesen
[toc] | [prev] | [next] | [standalone]
| From | Aaro Koskinen <aaro.koskinen@iki.fi> |
|---|---|
| Date | 2016-09-13 21:40 +0200 |
| Message-ID | <sh1IJ-6cg-25@gated-at.bofh.it> |
| In reply to | #1482723 |
Hi, On Tue, Sep 13, 2016 at 07:04:54PM +0000, Asbjørn Sloth Tønnesen wrote: > On Tue, 13 Sep 2016 00:03:14 +0300, Aaro Koskinen <aaro.koskinen@iki.fi> wrote: > > On Mon, Sep 12, 2016 at 08:33:43PM +0000, Asbjoern Sloth Toennesen wrote: > > > The patch will be followed by a similar patch to > > > drivers/staging/octeon/ethernet.c > > > > I think you should: > > > > 1. Move this function to staging/octeon > > > > 2. Do required cleanups there > > > > 3. Finally delete the function under arch/mips > > > > We shouldn't start making cleanups (except code removal) to ethernet code > > under mips/cavium-octeon/executive as it really does not belong there... > > I agree that this would make sense, however I just came across this looking > at the general MTU code across drivers, and don't have a real interest in > this particular driver nor mips, so I am not looking to fall that deep into > the rabbit hole. In that case please leave the code alone. NAK for this patch. A.
[toc] | [prev] | [next] | [standalone]
| From | David Daney <ddaney.cavm@gmail.com> |
|---|---|
| Date | 2016-09-13 00:10 +0200 |
| Message-ID | <sgHAl-172-25@gated-at.bofh.it> |
| In reply to | #1481949 |
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))
>
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web