Thread (22 messages) flat view 22 messages, 5 authors, 2021-10-18

RE: [PATCH v3 1/4] iwlwifi: mei: add the driver to allow cooperation with CSME

From: Grumbach, Emmanuel <hidden>
Date: 2021-08-07 18:38:05

quoted
quoted
quoted
+     BUILD_BUG_ON((u32)IWL_MEI_AKM_AUTH_OPEN !=
+                  (u32)SAP_WIFI_AUTH_TYPE_OPEN);
+     BUILD_BUG_ON((u32)IWL_MEI_AKM_AUTH_RSNA !=
+                  (u32)SAP_WIFI_AUTH_TYPE_RSNA);
+     BUILD_BUG_ON((u32)IWL_MEI_AKM_AUTH_RSNA_PSK !=
+                  (u32)SAP_WIFI_AUTH_TYPE_RSNA_PSK);
+     BUILD_BUG_ON((u32)IWL_MEI_AKM_AUTH_SAE !=
+                  (u32)SAP_WIFI_AUTH_TYPE_SAE);
+
+     BUILD_BUG_ON((u32)IWL_MEI_CIPHER_NONE !=
+                  (u32)SAP_WIFI_CIPHER_ALG_NONE);
+     BUILD_BUG_ON((u32)IWL_MEI_CIPHER_CCMP !=
+                  (u32)SAP_WIFI_CIPHER_ALG_CCMP);
+     BUILD_BUG_ON((u32)IWL_MEI_CIPHER_GCMP !=
+                  (u32)SAP_WIFI_CIPHER_ALG_GCMP);
+     BUILD_BUG_ON((u32)IWL_MEI_CIPHER_GCMP_256 !=
+                  (u32)SAP_WIFI_CIPHER_ALG_GCMP_256);
These look just weird, and suspicious. You are using two different
enums but they have to be same values, or what?
Exactly. I don't want the userspace to have to include all the SAP
protocol header file. OTOH, I don't want to have to translate between
vendor commands attributes values and the SAP values.
Why not? I assume you would just need a helper function with switch
statements to "translate" between enums, not much more lines of code but
a lot cleaner code.
I disagree that it'll give us a cleaner code.
What we'll have is two different enums with two different values and functions
that translate from one value to another. This is very bug prone. When you want
to debug, you get a value, you always need to think of what type of enum you're
dealing with.
I believe your suggestion is not good, but since I am tired arguing I will do it to
make you happy.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help