Skip to content

Commit

Permalink
liquidio: stop using huge static buffer, save 4096k in .data
Browse files Browse the repository at this point in the history
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 <[email protected]>
CC: Felix Manlunas <[email protected]>
CC: Prasad Kanneganti <[email protected]>
CC: Derek Chickles <[email protected]>
CC: David Miller <[email protected]>
CC: [email protected]
CC: [email protected]
Acked-by: Felix Manlunas <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
dvlasenk authored and davem330 committed Jun 22, 2017
1 parent 3d09198 commit b381f78
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 8 deletions.
6 changes: 1 addition & 5 deletions drivers/net/ethernet/cavium/liquidio/octeon_console.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions drivers/net/ethernet/cavium/liquidio/octeon_mem_ops.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion drivers/net/ethernet/cavium/liquidio/octeon_mem_ops.h
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit b381f78

Please sign in to comment.