Re: [PATCH ethtool] hns3: add support dump registers for hns3 driver

From: Jijie Shao
Date: Tue Aug 29 2023 - 02:49:01 EST



on 2023/8/28 7:20, Michal Kubecek wrote:
+#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

okay, I will remove it in v2


Thanks,

Jijie Shao