Skip to contentSkip to conversation

staging: r8188eu: comment about the chip's packet format

RFC PATCH In review Martin Kaiser 4 participants 4 messages Feb 18, 2022 Staging

lore
Share & tools
lore
#0 lore raw

RFC PATCH 1/1 staging: r8188eu: comment about the chip's packet format

The structs phy_rx_agc_info and phy_status_rpt define parts of the header data that the r8188eu chipset sends to this driver via usb.

Add a comment to clarify that we cannot modify the content of these structures and remove seemingly unused fields.

---

Dear all,

I experimented with "cleaning up" these structures and related code before discovering that their content comes from usb packets we receive from the r8188eu chipset.

Would it make sense to add a word of warning to prevent others from repeating this exercise?

Thanks,
Martin

 drivers/staging/r8188eu/include/odm_HWConfig.h | 7 +++++++
 1 file changed, 7 insertions(+)
drivers/staging/r8188eu/include/odm_HWConfig.h +7 -0
index b37962edb2ed..35a562372a1a 100644
@@ -14,6 +14,13 @@
 
 /*  structure and define */
 
+/*
+ * Attention: struct phy_status_rpt and struct phy_rx_agc_info describe
+ * data structures that this driver receives from the r8188eu chip via usb.
+ * Do not change the content of these structures, do not remove seemingly
+ * unused entries.
+ */
+
 struct phy_rx_agc_info {
 	#ifdef __LITTLE_ENDIAN
 		u8	gain:7, trsw:1;
Signature · 1 line
2.30.2
#1 lore raw
Quoted 9 lines · Martin Kaiser

The structs phy_rx_agc_info and phy_status_rpt define parts of the header data that the r8188eu chipset sends to this driver via usb.

Add a comment to clarify that we cannot modify the content of these structures and remove seemingly unused fields.

---

Quoted 8 lines

Dear all,

I experimented with "cleaning up" these structures and related code before discovering that their content comes from usb packets we receive from the r8188eu chipset.

Would it make sense to add a word of warning to prevent others from repeating this exercise?

Just the fact that these structs are endian means they're from the firmware or the network.

If a struct has a pointer in it, then it's rarely part of the UAPI but if it has endian data then it probably is.

regards,
dan carpenter

#2 lore raw

Thus wrote Dan Carpenter ([email protected]):

Quoted 10 lines · Martin Kaiser
Quoted 3 lines

Would it make sense to add a word of warning to prevent others from repeating this exercise?

Just the fact that these structs are endian means they're from the firmware or the network.

If a struct has a pointer in it, then it's rarely part of the UAPI but if it has endian data then it probably is.

ah, these are useful criteria, thanks. I see that the comment isn't really necessary...

#3 lore raw
In reply to Dan Carpenter
Quoted 16 lines · Dan Carpenter
Quoted 15 lines · Martin Kaiser

The structs phy_rx_agc_info and phy_status_rpt define parts of the header data that the r8188eu chipset sends to this driver via usb.

Add a comment to clarify that we cannot modify the content of these structures and remove seemingly unused fields.

---

Dear all,

I experimented with "cleaning up" these structures and related code before discovering that their content comes from usb packets we receive from the r8188eu chipset.

Quoted 8 lines
Quoted 2 lines

Would it make sense to add a word of warning to prevent others from repeating this exercise?

Just the fact that these structs are endian means they're from the firmware or the network.

If a struct has a pointer in it, then it's rarely part of the UAPI but if it has endian data then it probably is.

Additionally, do not change any struct with the __packed attribute. Most will have endian variables as well, but not all will.

Testing after modifying any struct is a necessity.

Larry