lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20230827232008.tjcuolelsdhh7o44@lion.mk-sys.cz>
Date:   Mon, 28 Aug 2023 01:20:08 +0200
From:   Michal Kubecek <mkubecek@...e.cz>
To:     Jijie Shao <shaojijie@...wei.com>
Cc:     mkubeck@...e.cz, yisen.zhuang@...wei.com, salil.mehta@...wei.com,
        davem@...emloft.net, edumazet@...gle.com, kuba@...nel.org,
        pabeni@...hat.com, shenjian15@...wei.com, wangjie125@...wei.com,
        liuyonglong@...wei.com, netdev@...r.kernel.org,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH ethtool] hns3: add support dump registers for hns3 driver

On Fri, Aug 18, 2023 at 04:56:11PM +0800, Jijie Shao wrote:
> Add support pretty printer for the registers of hns3 driver.
> This printer supports PF and VF, and is compatible with hns3
> drivers of earlier versions.
> 
> Sample output:
> 
> $ ethtool -d eth1
> [cmdq_regs]
>   comm_nic_csq_baseaddr_l : 0x48168000
>   comm_nic_csq_baseaddr_h : 0x00000000
>   comm_nic_csq_depth      : 0x00000080
>   comm_nic_csq_tail       : 0x00000050
>   comm_nic_csq_head       : 0x00000050
>   comm_nic_crq_baseaddr_l : 0x48170000
>   comm_nic_crq_baseaddr_h : 0x00000000
>   comm_nic_crq_depth      : 0x00000080
>   comm_nic_crq_tail       : 0x00000000
>   comm_nic_crq_head       : 0x00000000
>   comm_vector0_cmdq_src   : 0x00000000
>   comm_cmdq_intr_sts      : 0x00000000
>   comm_cmdq_intr_en       : 0x00000002
>   comm_cmdq_intr_gen      : 0x00000000
> [common_regs]
>   misc_vector_base    : 0x00000001
>   pf_other_int        : 0x00000040
>   misc_reset_sts      : 0x00000000
>   misc_vector_int_sts : 0x00000000
>   global_reset        : 0x00000000
>   fun_rst_ing         : 0x00000000
>   gro_en              : 0x00000001
> ...
> 
> Signed-off-by: Jijie Shao <shaojijie@...wei.com>
> ---
[...]
> --- /dev/null
> +++ b/hns3.c
[...]
> +#pragma pack(4)
> +struct hns3_reg_tlv {
> +	u16 tag;
> +	u16 len;
> +};
> +
> +struct hns3_reg_header {
> +	u64 magic_number;
> +	u8 is_vf;
> +	u8 rsv[7];
> +};
> +
> +#pragma pack()

Could we please avoid these #pragma directives? AFAIK this is a Microsoft
extension, which, while implemented in gcc for compatibility reasons, is
not very common in linux world. To be honest, I had to search the web to
see what exactly does it do - and even after that, only checking the object
file with gdb revealed that it does not really do anything except weakening
the alignment of struct hns3_reg_header (as a whole). Given how the
structure is used in this file, the only practical effect would be
header_len in hns3_dump_regs() being 12 rather than 16 (on 64-bit
architectures).

Michal

Download attachment "signature.asc" of type "application/pgp-signature" (489 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ