Skip to content

Commit

Permalink
cxgb4: update dump collection logic to use compression
Browse files Browse the repository at this point in the history
Update firmware dump collection logic to use compression when available.
Let collection logic attempt to do compression, instead of returning out
of memory early.

Signed-off-by: Rahul Lakkireddy <rahul.lakkireddy@chelsio.com>
Signed-off-by: Vishal Kulkarni <vishal@chelsio.com>
Signed-off-by: Ganesh Goudar <ganeshgr@chelsio.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Rahul Lakkireddy authored and David S. Miller committed Jan 19, 2018
1 parent 5165674 commit 56cf263
Show file tree
Hide file tree
Showing 6 changed files with 207 additions and 147 deletions.
24 changes: 19 additions & 5 deletions drivers/net/ethernet/chelsio/cxgb4/cudbg_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@
#include "cudbg_if.h"
#include "cudbg_lib_common.h"

int cudbg_get_buff(struct cudbg_buffer *pdbg_buff, u32 size,
int cudbg_get_buff(struct cudbg_init *pdbg_init,
struct cudbg_buffer *pdbg_buff, u32 size,
struct cudbg_buffer *pin_buff)
{
u32 offset;
Expand All @@ -28,17 +29,30 @@ int cudbg_get_buff(struct cudbg_buffer *pdbg_buff, u32 size,
if (offset + size > pdbg_buff->size)
return CUDBG_STATUS_NO_MEM;

if (pdbg_init->compress_type != CUDBG_COMPRESSION_NONE) {
if (size > pdbg_init->compress_buff_size)
return CUDBG_STATUS_NO_MEM;

pin_buff->data = (char *)pdbg_init->compress_buff;
pin_buff->offset = 0;
pin_buff->size = size;
return 0;
}

pin_buff->data = (char *)pdbg_buff->data + offset;
pin_buff->offset = offset;
pin_buff->size = size;
pdbg_buff->size -= size;
return 0;
}

void cudbg_put_buff(struct cudbg_buffer *pin_buff,
struct cudbg_buffer *pdbg_buff)
void cudbg_put_buff(struct cudbg_init *pdbg_init,
struct cudbg_buffer *pin_buff)
{
pdbg_buff->size += pin_buff->size;
/* Clear compression buffer for re-use */
if (pdbg_init->compress_type != CUDBG_COMPRESSION_NONE)
memset(pdbg_init->compress_buff, 0,
pdbg_init->compress_buff_size);

pin_buff->data = NULL;
pin_buff->offset = 0;
pin_buff->size = 0;
Expand Down
3 changes: 3 additions & 0 deletions drivers/net/ethernet/chelsio/cxgb4/cudbg_if.h
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,9 @@ struct cudbg_init {
struct adapter *adap; /* Pointer to adapter structure */
void *outbuf; /* Output buffer */
u32 outbuf_size; /* Output buffer size */
u8 compress_type; /* Type of compression to use */
void *compress_buff; /* Compression buffer */
u32 compress_buff_size; /* Compression buffer size */
};

static inline unsigned int cudbg_mbytes_to_bytes(unsigned int size)
Expand Down
Loading

0 comments on commit 56cf263

Please sign in to comment.