All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] liquidio: stop using huge static buffer, save 4096k in .data
@ 2017-06-19 19:50 Denys Vlasenko
  2017-06-20 19:21 ` David Miller
  2017-06-22 15:03 ` David Miller
  0 siblings, 2 replies; 7+ messages in thread
From: Denys Vlasenko @ 2017-06-19 19:50 UTC (permalink / raw)
  To: netdev
  Cc: Denys Vlasenko, Felix Manlunas, Prasad Kanneganti,
	Derek Chickles, David Miller, linux-kernel

Only compile-tested - I don't have the hardware.

>From code inspection, octeon_pci_write_core_mem() appears to be safe wrt
unaligned source. In any case, u8 fbuf[] was not guaranteed to be aligned
anyway.

Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
CC: Felix Manlunas <felix.manlunas@cavium.com>
CC: Prasad Kanneganti <prasad.kanneganti@cavium.com>
CC: Derek Chickles <derek.chickles@cavium.com>
CC: David Miller <davem@davemloft.net>
CC: netdev@vger.kernel.org
CC: linux-kernel@vger.kernel.org
---
 drivers/net/ethernet/cavium/liquidio/octeon_console.c | 6 +-----
 drivers/net/ethernet/cavium/liquidio/octeon_mem_ops.c | 4 ++--
 drivers/net/ethernet/cavium/liquidio/octeon_mem_ops.h | 2 +-
 3 files changed, 4 insertions(+), 8 deletions(-)

diff --git a/drivers/net/ethernet/cavium/liquidio/octeon_console.c b/drivers/net/ethernet/cavium/liquidio/octeon_console.c
index 53f38d0..e08f760 100644
--- a/drivers/net/ethernet/cavium/liquidio/octeon_console.c
+++ b/drivers/net/ethernet/cavium/liquidio/octeon_console.c
@@ -724,13 +724,11 @@ static int octeon_console_read(struct octeon_device *oct, u32 console_num,
 }
 
 #define FBUF_SIZE	(4 * 1024 * 1024)
-u8 fbuf[FBUF_SIZE];
 
 int octeon_download_firmware(struct octeon_device *oct, const u8 *data,
 			     size_t size)
 {
 	int ret = 0;
-	u8 *p = fbuf;
 	u32 crc32_result;
 	u64 load_addr;
 	u32 image_len;
@@ -805,10 +803,8 @@ int octeon_download_firmware(struct octeon_device *oct, const u8 *data,
 			else
 				size = FBUF_SIZE;
 
-			memcpy(p, data, size);
-
 			/* download the image */
-			octeon_pci_write_core_mem(oct, load_addr, p, (u32)size);
+			octeon_pci_write_core_mem(oct, load_addr, data, (u32)size);
 
 			data += size;
 			rem -= (u32)size;
diff --git a/drivers/net/ethernet/cavium/liquidio/octeon_mem_ops.c b/drivers/net/ethernet/cavium/liquidio/octeon_mem_ops.c
index 5cd96e7..4c85ae6 100644
--- a/drivers/net/ethernet/cavium/liquidio/octeon_mem_ops.c
+++ b/drivers/net/ethernet/cavium/liquidio/octeon_mem_ops.c
@@ -167,10 +167,10 @@ octeon_pci_read_core_mem(struct octeon_device *oct,
 void
 octeon_pci_write_core_mem(struct octeon_device *oct,
 			  u64 coreaddr,
-			  u8 *buf,
+			  const u8 *buf,
 			  u32 len)
 {
-	__octeon_pci_rw_core_mem(oct, coreaddr, buf, len, 0);
+	__octeon_pci_rw_core_mem(oct, coreaddr, (u8 *)buf, len, 0);
 }
 
 u64 octeon_read_device_mem64(struct octeon_device *oct, u64 coreaddr)
diff --git a/drivers/net/ethernet/cavium/liquidio/octeon_mem_ops.h b/drivers/net/ethernet/cavium/liquidio/octeon_mem_ops.h
index bae2fdd..47a3ff5 100644
--- a/drivers/net/ethernet/cavium/liquidio/octeon_mem_ops.h
+++ b/drivers/net/ethernet/cavium/liquidio/octeon_mem_ops.h
@@ -66,7 +66,7 @@ octeon_pci_read_core_mem(struct octeon_device *oct,
 void
 octeon_pci_write_core_mem(struct octeon_device *oct,
 			  u64 coreaddr,
-			  u8 *buf,
+			  const u8 *buf,
 			  u32 len);
 
 #endif
-- 
2.9.2

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH] liquidio: stop using huge static buffer, save 4096k in .data
  2017-06-19 19:50 [PATCH] liquidio: stop using huge static buffer, save 4096k in .data Denys Vlasenko
@ 2017-06-20 19:21 ` David Miller
  2017-06-20 20:15   ` Chickles, Derek
  2017-06-22 15:03 ` David Miller
  1 sibling, 1 reply; 7+ messages in thread
From: David Miller @ 2017-06-20 19:21 UTC (permalink / raw)
  To: dvlasenk
  Cc: netdev, felix.manlunas, prasad.kanneganti, derek.chickles, linux-kernel

From: Denys Vlasenko <dvlasenk@redhat.com>
Date: Mon, 19 Jun 2017 21:50:52 +0200

> Only compile-tested - I don't have the hardware.
> 
> From code inspection, octeon_pci_write_core_mem() appears to be safe wrt
> unaligned source. In any case, u8 fbuf[] was not guaranteed to be aligned
> anyway.
> 
> Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>

Looks good to me but I'll let one of the liquidio guys review this first
before I apply it.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* RE: [PATCH] liquidio: stop using huge static buffer, save 4096k in .data
  2017-06-20 19:21 ` David Miller
@ 2017-06-20 20:15   ` Chickles, Derek
  2017-06-20 20:51     ` Felix Manlunas
  0 siblings, 1 reply; 7+ messages in thread
From: Chickles, Derek @ 2017-06-20 20:15 UTC (permalink / raw)
  To: David Miller, dvlasenk
  Cc: netdev, Manlunas, Felix, Kanneganti, Prasad, linux-kernel

> From: David Miller [mailto:davem@davemloft.net]
> Sent: Tuesday, June 20, 2017 12:22 PM
> 
> From: Denys Vlasenko <dvlasenk@redhat.com>
> Date: Mon, 19 Jun 2017 21:50:52 +0200
> 
> > Only compile-tested - I don't have the hardware.
> >
> > From code inspection, octeon_pci_write_core_mem() appears to be safe wrt
> > unaligned source. In any case, u8 fbuf[] was not guaranteed to be aligned
> > anyway.
> >
> > Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
> 
> Looks good to me but I'll let one of the liquidio guys review this first
> before I apply it.

Felix is going to try this out this week to confirm. Let's wait for his ack.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] liquidio: stop using huge static buffer, save 4096k in .data
  2017-06-20 20:15   ` Chickles, Derek
@ 2017-06-20 20:51     ` Felix Manlunas
  2017-06-21  1:17       ` David Miller
  0 siblings, 1 reply; 7+ messages in thread
From: Felix Manlunas @ 2017-06-20 20:51 UTC (permalink / raw)
  To: Derek Chickles
  Cc: David Miller, dvlasenk, netdev, Kanneganti, Prasad, linux-kernel

From: Derek Chickles <Derek.Chickles@cavium.com>
Date: Tue, 20 Jun 2017 13:15:34 -0700

> > From: David Miller [mailto:davem@davemloft.net]
> > Sent: Tuesday, June 20, 2017 12:22 PM
> > 
> > From: Denys Vlasenko <dvlasenk@redhat.com>
> > Date: Mon, 19 Jun 2017 21:50:52 +0200
> > 
> > > Only compile-tested - I don't have the hardware.
> > >
> > > From code inspection, octeon_pci_write_core_mem() appears to be safe wrt
> > > unaligned source. In any case, u8 fbuf[] was not guaranteed to be aligned
> > > anyway.
> > >
> > > Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
> > 
> > Looks good to me but I'll let one of the liquidio guys review this first
> > before I apply it.
> 
> Felix is going to try this out this week to confirm. Let's wait for his ack.

This patch works.  I tested it with a LiquidIO II adapter.

ACK

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] liquidio: stop using huge static buffer, save 4096k in .data
  2017-06-20 20:51     ` Felix Manlunas
@ 2017-06-21  1:17       ` David Miller
  2017-06-21  2:59         ` Felix Manlunas
  0 siblings, 1 reply; 7+ messages in thread
From: David Miller @ 2017-06-21  1:17 UTC (permalink / raw)
  To: felix.manlunas
  Cc: Derek.Chickles, dvlasenk, netdev, Prasad.Kanneganti, linux-kernel

From: Felix Manlunas <felix.manlunas@cavium.com>
Date: Tue, 20 Jun 2017 13:51:25 -0700

> From: Derek Chickles <Derek.Chickles@cavium.com>
> Date: Tue, 20 Jun 2017 13:15:34 -0700
> 
>> > From: David Miller [mailto:davem@davemloft.net]
>> > Sent: Tuesday, June 20, 2017 12:22 PM
>> > 
>> > From: Denys Vlasenko <dvlasenk@redhat.com>
>> > Date: Mon, 19 Jun 2017 21:50:52 +0200
>> > 
>> > > Only compile-tested - I don't have the hardware.
>> > >
>> > > From code inspection, octeon_pci_write_core_mem() appears to be safe wrt
>> > > unaligned source. In any case, u8 fbuf[] was not guaranteed to be aligned
>> > > anyway.
>> > >
>> > > Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
>> > 
>> > Looks good to me but I'll let one of the liquidio guys review this first
>> > before I apply it.
>> 
>> Felix is going to try this out this week to confirm. Let's wait for his ack.
> 
> This patch works.  I tested it with a LiquidIO II adapter.
> 
> ACK

Please ACK patches in the standard way which is in the form of:

Acked-by: David S. Miller <davem@davemloft.net>

This tag is recognized by tools and in particular the patchwork
site where networking patches are maintained, automatically
including your ACK into the patch I apply.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] liquidio: stop using huge static buffer, save 4096k in .data
  2017-06-21  1:17       ` David Miller
@ 2017-06-21  2:59         ` Felix Manlunas
  0 siblings, 0 replies; 7+ messages in thread
From: Felix Manlunas @ 2017-06-21  2:59 UTC (permalink / raw)
  To: David Miller
  Cc: Derek.Chickles, dvlasenk, netdev, Prasad.Kanneganti, linux-kernel

From: David Miller <davem@davemloft.net>
Date: Tue, 20 Jun 2017 21:17:13 -0400

> From: Felix Manlunas <felix.manlunas@cavium.com>
> Date: Tue, 20 Jun 2017 13:51:25 -0700
> 
> > From: Derek Chickles <Derek.Chickles@cavium.com>
> > Date: Tue, 20 Jun 2017 13:15:34 -0700
> > 
> >> > From: David Miller [mailto:davem@davemloft.net]
> >> > Sent: Tuesday, June 20, 2017 12:22 PM
> >> > 
> >> > From: Denys Vlasenko <dvlasenk@redhat.com>
> >> > Date: Mon, 19 Jun 2017 21:50:52 +0200
> >> > 
> >> > > Only compile-tested - I don't have the hardware.
> >> > >
> >> > > From code inspection, octeon_pci_write_core_mem() appears to be safe wrt
> >> > > unaligned source. In any case, u8 fbuf[] was not guaranteed to be aligned
> >> > > anyway.
> >> > >
> >> > > Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
> >> > 
> >> > Looks good to me but I'll let one of the liquidio guys review this first
> >> > before I apply it.
> >> 
> >> Felix is going to try this out this week to confirm. Let's wait for his ack.
> > 
> > This patch works.  I tested it with a LiquidIO II adapter.
> > 
> > ACK
> 
> Please ACK patches in the standard way which is in the form of:
> 
> Acked-by: David S. Miller <davem@davemloft.net>
> 
> This tag is recognized by tools and in particular the patchwork
> site where networking patches are maintained, automatically
> including your ACK into the patch I apply.

Acked-by: Felix Manlunas <felix.manlunas@cavium.com>

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] liquidio: stop using huge static buffer, save 4096k in .data
  2017-06-19 19:50 [PATCH] liquidio: stop using huge static buffer, save 4096k in .data Denys Vlasenko
  2017-06-20 19:21 ` David Miller
@ 2017-06-22 15:03 ` David Miller
  1 sibling, 0 replies; 7+ messages in thread
From: David Miller @ 2017-06-22 15:03 UTC (permalink / raw)
  To: dvlasenk
  Cc: netdev, felix.manlunas, prasad.kanneganti, derek.chickles, linux-kernel

From: Denys Vlasenko <dvlasenk@redhat.com>
Date: Mon, 19 Jun 2017 21:50:52 +0200

> Only compile-tested - I don't have the hardware.
> 
> From code inspection, octeon_pci_write_core_mem() appears to be safe wrt
> unaligned source. In any case, u8 fbuf[] was not guaranteed to be aligned
> anyway.
> 
> Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>

Applied to net-next, thanks.

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2017-06-22 15:03 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-06-19 19:50 [PATCH] liquidio: stop using huge static buffer, save 4096k in .data Denys Vlasenko
2017-06-20 19:21 ` David Miller
2017-06-20 20:15   ` Chickles, Derek
2017-06-20 20:51     ` Felix Manlunas
2017-06-21  1:17       ` David Miller
2017-06-21  2:59         ` Felix Manlunas
2017-06-22 15:03 ` David Miller

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.