-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
cxgb4: implement ethtool dump data operations
Implement operations to set/get dump data via ethtool. Also add template header that precedes dump data, which helps in decoding and extracting the dump data. Signed-off-by: Rahul Lakkireddy <rahul.lakkireddy@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
Oct 15, 2017
1 parent
4c7787b
commit ad75b7d
Showing
8 changed files
with
265 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
/* | ||
* Copyright (C) 2017 Chelsio Communications. All rights reserved. | ||
* | ||
* This program is free software; you can redistribute it and/or modify it | ||
* under the terms and conditions of the GNU General Public License, | ||
* version 2, as published by the Free Software Foundation. | ||
* | ||
* This program is distributed in the hope it will be useful, but WITHOUT | ||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | ||
* more details. | ||
* | ||
* The full GNU General Public License is included in this distribution in | ||
* the file called "COPYING". | ||
* | ||
*/ | ||
|
||
#ifndef __CUDBG_IF_H__ | ||
#define __CUDBG_IF_H__ | ||
|
||
#define CUDBG_MAJOR_VERSION 1 | ||
#define CUDBG_MINOR_VERSION 14 | ||
|
||
enum cudbg_dbg_entity_type { | ||
CUDBG_MAX_ENTITY = 70, | ||
}; | ||
|
||
struct cudbg_init { | ||
struct adapter *adap; /* Pointer to adapter structure */ | ||
void *outbuf; /* Output buffer */ | ||
u32 outbuf_size; /* Output buffer size */ | ||
}; | ||
#endif /* __CUDBG_IF_H__ */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
/* | ||
* Copyright (C) 2017 Chelsio Communications. All rights reserved. | ||
* | ||
* This program is free software; you can redistribute it and/or modify it | ||
* under the terms and conditions of the GNU General Public License, | ||
* version 2, as published by the Free Software Foundation. | ||
* | ||
* This program is distributed in the hope it will be useful, but WITHOUT | ||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | ||
* more details. | ||
* | ||
* The full GNU General Public License is included in this distribution in | ||
* the file called "COPYING". | ||
* | ||
*/ | ||
|
||
#ifndef __CUDBG_LIB_COMMON_H__ | ||
#define __CUDBG_LIB_COMMON_H__ | ||
|
||
#define CUDBG_SIGNATURE 67856866 /* CUDB in ascii */ | ||
|
||
enum cudbg_dump_type { | ||
CUDBG_DUMP_TYPE_MINI = 1, | ||
}; | ||
|
||
enum cudbg_compression_type { | ||
CUDBG_COMPRESSION_NONE = 1, | ||
}; | ||
|
||
struct cudbg_hdr { | ||
u32 signature; | ||
u32 hdr_len; | ||
u16 major_ver; | ||
u16 minor_ver; | ||
u32 data_len; | ||
u32 hdr_flags; | ||
u16 max_entities; | ||
u8 chip_ver; | ||
u8 dump_type:3; | ||
u8 reserved1:1; | ||
u8 compress_type:4; | ||
u32 reserved[8]; | ||
}; | ||
|
||
struct cudbg_entity_hdr { | ||
u32 entity_type; | ||
u32 start_offset; | ||
u32 size; | ||
int hdr_flags; | ||
u32 sys_warn; | ||
u32 sys_err; | ||
u8 num_pad; | ||
u8 flag; /* bit 0 is used to indicate ext data */ | ||
u8 reserved1[2]; | ||
u32 next_ext_offset; /* pointer to next extended entity meta data */ | ||
u32 reserved[5]; | ||
}; | ||
|
||
struct cudbg_buffer { | ||
u32 size; | ||
u32 offset; | ||
char *data; | ||
}; | ||
#endif /* __CUDBG_LIB_COMMON_H__ */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
/* | ||
* Copyright (C) 2017 Chelsio Communications. All rights reserved. | ||
* | ||
* This program is free software; you can redistribute it and/or modify it | ||
* under the terms and conditions of the GNU General Public License, | ||
* version 2, as published by the Free Software Foundation. | ||
* | ||
* This program is distributed in the hope it will be useful, but WITHOUT | ||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | ||
* more details. | ||
* | ||
* The full GNU General Public License is included in this distribution in | ||
* the file called "COPYING". | ||
* | ||
*/ | ||
|
||
#include "cxgb4.h" | ||
#include "cxgb4_cudbg.h" | ||
|
||
u32 cxgb4_get_dump_length(struct adapter *adap, u32 flag) | ||
{ | ||
return 0; | ||
} | ||
|
||
int cxgb4_cudbg_collect(struct adapter *adap, void *buf, u32 *buf_size, | ||
u32 flag) | ||
{ | ||
struct cudbg_init cudbg_init = { 0 }; | ||
struct cudbg_buffer dbg_buff = { 0 }; | ||
u32 size, min_size, total_size = 0; | ||
struct cudbg_hdr *cudbg_hdr; | ||
|
||
size = *buf_size; | ||
|
||
cudbg_init.adap = adap; | ||
cudbg_init.outbuf = buf; | ||
cudbg_init.outbuf_size = size; | ||
|
||
dbg_buff.data = buf; | ||
dbg_buff.size = size; | ||
dbg_buff.offset = 0; | ||
|
||
cudbg_hdr = (struct cudbg_hdr *)buf; | ||
cudbg_hdr->signature = CUDBG_SIGNATURE; | ||
cudbg_hdr->hdr_len = sizeof(struct cudbg_hdr); | ||
cudbg_hdr->major_ver = CUDBG_MAJOR_VERSION; | ||
cudbg_hdr->minor_ver = CUDBG_MINOR_VERSION; | ||
cudbg_hdr->max_entities = CUDBG_MAX_ENTITY; | ||
cudbg_hdr->chip_ver = adap->params.chip; | ||
cudbg_hdr->dump_type = CUDBG_DUMP_TYPE_MINI; | ||
cudbg_hdr->compress_type = CUDBG_COMPRESSION_NONE; | ||
|
||
min_size = sizeof(struct cudbg_hdr) + | ||
sizeof(struct cudbg_entity_hdr) * | ||
cudbg_hdr->max_entities; | ||
if (size < min_size) | ||
return -ENOMEM; | ||
|
||
dbg_buff.offset += min_size; | ||
total_size = dbg_buff.offset; | ||
|
||
cudbg_hdr->data_len = total_size; | ||
*buf_size = total_size; | ||
return 0; | ||
} | ||
|
||
void cxgb4_init_ethtool_dump(struct adapter *adapter) | ||
{ | ||
adapter->eth_dump.flag = CXGB4_ETH_DUMP_NONE; | ||
adapter->eth_dump.version = adapter->params.fw_vers; | ||
adapter->eth_dump.len = 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
/* | ||
* Copyright (C) 2017 Chelsio Communications. All rights reserved. | ||
* | ||
* This program is free software; you can redistribute it and/or modify it | ||
* under the terms and conditions of the GNU General Public License, | ||
* version 2, as published by the Free Software Foundation. | ||
* | ||
* This program is distributed in the hope it will be useful, but WITHOUT | ||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | ||
* more details. | ||
* | ||
* The full GNU General Public License is included in this distribution in | ||
* the file called "COPYING". | ||
* | ||
*/ | ||
|
||
#ifndef __CXGB4_CUDBG_H__ | ||
#define __CXGB4_CUDBG_H__ | ||
|
||
#include "cudbg_if.h" | ||
#include "cudbg_lib_common.h" | ||
|
||
enum CXGB4_ETHTOOL_DUMP_FLAGS { | ||
CXGB4_ETH_DUMP_NONE = ETH_FW_DUMP_DISABLE, | ||
}; | ||
|
||
u32 cxgb4_get_dump_length(struct adapter *adap, u32 flag); | ||
int cxgb4_cudbg_collect(struct adapter *adap, void *buf, u32 *buf_size, | ||
u32 flag); | ||
void cxgb4_init_ethtool_dump(struct adapter *adapter); | ||
#endif /* __CXGB4_CUDBG_H__ */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters