On 7/8/2020 11:50 PM, Rasesh Mody wrote: > Add support for .get_reg eth_dev ops which will be used to collect the > firmware debug data. > > PMD on detecting on some HW errors will collect the FW/HW Dump to a > buffer and then it will save it to a file implemented in > qede_save_fw_dump(). > > Dump file location and name: > Location: <RTE_SDK> or DPDK root > Name: qede_pmd_dump_mm-dd-yy_hh-mm-ss.bin > > DPDK applications can initiate a debug data collection by invoking DPDK > library’s rte_eth_dev_get_reg_info() API. This API invokes .get_reg() > interface in the PMD. > > PMD implementation of .get_reg() collects the FW/HW Dump, saves it to > data field of rte_dev_reg_info and passes it to the application. It’s > the responsibility of the application to save the FW/HW Dump to a file. > We recommendation using the file name format used by qede_save_fw_dump(). > > Signed-off-by: Rasesh Mody <rm...@marvell.com> > Signed-off-by: Igor Russkikh <irussk...@marvell.com>
<...> > +static int > +qede_write_fwdump(const char *dump_file, void *dump, size_t len) > +{ > + int err = 0; > + FILE *f; > + size_t bytes; > + > + f = fopen(dump_file, "wb+"); > + > + if (!f) { > + fprintf(stderr, "Can't open file %s: %s\n", > + dump_file, strerror(errno)); > + return 1; > + } > + bytes = fwrite(dump, 1, len, f); > + if (bytes != len) { > + fprintf(stderr, "Can not write all of dump data bytes=%ld > len=%ld\n", > + bytes, len); Travis is giving build error on this for 32 bits [1], fixing while merging by replacing '%ld' -> '%zd', please double check in next-net. [1] ../drivers/net/qede/qede_regs.c: In function ‘qede_write_fwdump’: ../drivers/net/qede/qede_regs.c:229:59: error: format ‘%ld’ expects argument of type ‘long int’, but argument 3 has type ‘size_t {aka unsigned int}’ [-Werror=format=] fprintf(stderr, "Can not write all of dump data bytes=%ld len=%ld\n", ~~^ %d ../drivers/net/qede/qede_regs.c:229:67: error: format ‘%ld’ expects argument of type ‘long int’, but argument 4 has type ‘size_t {aka unsigned int}’ [-Werror=format=] fprintf(stderr, "Can not write all of dump data bytes=%ld len=%ld\n", ~~^ %d