idpf: add missing cpu_to_le32 in idpf_tx_splitq_build_flow_desc
Subsystems (3)
PATCH v2 1/1 idpf: add missing cpu_to_le32 in idpf_tx_splitq_build_flow_desc
From: Willem de Bruijn <[email protected]>
idpf_tx_splitq_build_flow_desc performs a 32-bit store to &cmd_dtype to set the 8-bit cmd_dtype and zero the adjacent 3-byte timestamp field in a single operation.
Descriptors are in little endian. Add missing cpu_to_le32 and cast to __le32 to ensure the fields are written correctly also on big endian platforms.
---
Changes
v1 -> v2
- add Fixes tag, Tony's Reviewed-by and Cc: [email protected]
v1: https://lore.kernel.org/netdev/[email protected]/
--- drivers/net/ethernet/intel/idpf/idpf_txrx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/intel/idpf/idpf_txrx.c +1 -1
@@ -2408,7 +2408,7 @@ void idpf_tx_splitq_build_flow_desc(union idpf_tx_flex_desc *desc,struct idpf_tx_splitq_params *params, u16 td_cmd, u16 size) { - *(u32 *)&desc->flow.qw1.cmd_dtype = (u8)(params->dtype | td_cmd); + *(__le32 *)&desc->flow.qw1.cmd_dtype = cpu_to_le32((u8)(params->dtype | td_cmd)); desc->flow.qw1.rxr_bufsize =cpu_to_le16 ((u16 )size); desc->flow.qw1.compl_tag =cpu_to_le16 (params->compl_tag); }
Signature · 1 line
2.55.0.629.g250fe7f194-goog
Quoted 7 lines · Willem de Bruijn
From: Willem de Bruijn <[email protected]>
idpf_tx_splitq_build_flow_descperforms a 32-bit store to&cmd_dtypeto set the 8-bitcmd_dtypeand zero the adjacent 3-byte timestamp field in a single operation.
Quoted 7 lines
Descriptors are in little endian. Add missing
cpu_to_le32and cast to__le32to ensure the fields are written correctly also on big endian platforms.Fixes 1a49cf814fe1 ("idpf: add Tx timestamp flows")Signed-off-by Willem de Bruijn <[email protected]>Reviewed-by Tony Nguyen <[email protected]>
Thanks,
Jason
Quoted 58 lines
-----Original Message-----
From: Intel-wired-lan <[email protected]> On Behalf Of Willem de Bruijn
Sent: Monday, August 3, 2026 11:06 PM
To: [email protected]
Cc: [email protected]; Nguyen, Anthony L <[email protected]>; Hay, Joshua A <[email protected]>; Kitszel, Przemyslaw <[email protected]>; Willem de Bruijn <[email protected]>
Subject: [Intel-wired-lan] [PATCH iwl-net v2] idpf: add missingcpu_to_le32inidpf_tx_splitq_build_flow_descFrom: Willem de Bruijn <[email protected]>
idpf_tx_splitq_build_flow_descperforms a 32-bit store to&cmd_dtypeto set the 8-bitcmd_dtypeand zero the adjacent 3-byte timestamp field in a single operation.Descriptors are in little endian. Add missing
cpu_to_le32and cast to__le32to ensure the fields are written correctly also on big endian platforms.Fixes 1a49cf814fe1 ("idpf: add Tx timestamp flows")Signed-off-by Willem de Bruijn <[email protected]>Reviewed-by Tony Nguyen <[email protected]>---
Changes
v1 -> v2
- add Fixes tag, Tony's Reviewed-by and Cc: intel-wired-
[email protected]
v1: https://lore.kernel.org/netdev/20260731103137.4000876-1-
[email protected]/--- drivers/net/ethernet/intel/idpf/idpf_txrx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/net/ethernet/intel/idpf/idpf_txrx.c +1
-1@@ -2408,7 +2408,7 @@ void idpf_tx_splitq_build_flow_desc(unionidpf_tx_flex_desc *desc, struct idpf_tx_splitq_params *params, u16 td_cmd, u16 size) { - *(u32 *)&desc->flow.qw1.cmd_dtype = (u8)(params->dtype | td_cmd); + *(__le32 *)&desc->flow.qw1.cmd_dtype = cpu_to_le32((u8)(params-Quoted 1 line
dtype
+|
td_cmd));drivers/net/ethernet/intel/idpf/idpf_txrx.c +0
-1desc->flow.qw1.rxr_bufsize =cpu_to_le16 ((u16 )size); desc->flow.qw1.compl_tag =cpu_to_le16 (params->compl_tag); } --
Quoted 1 line
2.55.0.629.g250fe7f194-goog
Quoted 29 lines · Willem de Bruijn
From: Willem de Bruijn <[email protected]>
idpf_tx_splitq_build_flow_descperforms a 32-bit store to&cmd_dtypeto set the 8-bitcmd_dtypeand zero the adjacent 3-byte timestamp field in a single operation.Descriptors are in little endian. Add missing
cpu_to_le32and cast to__le32to ensure the fields are written correctly also on big endian platforms.Fixes 1a49cf814fe1 ("idpf: add Tx timestamp flows")Signed-off-by Willem de Bruijn <[email protected]>Reviewed-by Tony Nguyen <[email protected]>---
Changes
v1 -> v2
- add Fixes tag, Tony's Reviewed-by and Cc: [email protected]
v1: https://lore.kernel.org/netdev/[email protected]/--- drivers/net/ethernet/intel/idpf/idpf_txrx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/net/ethernet/intel/idpf/idpf_txrx.c +0
-0
drivers/net/ethernet/intel/idpf/idpf_txrx.c void idpf_tx_splitq_build_flow_desc(union idpf_tx_flex_desc *desc, · line 2411
Quoted 5 lines
drivers/net/ethernet/intel/idpf/idpf_txrx.c +1
-1@@ -2408,7 +2408,7 @@ void idpf_tx_splitq_build_flow_desc(union idpf_tx_flex_desc *desc,struct idpf_tx_splitq_params *params, u16 td_cmd, u16 size) { - *(u32 *)&desc->flow.qw1.cmd_dtype = (u8)(params->dtype | td_cmd); + *(__le32 *)&desc->flow.qw1.cmd_dtype = cpu_to_le32((u8)(params->dtype | td_cmd));
While it technically works, I find it unreadable. Looking at this line without reading commit msg, it looks like a bug where a 4-byte value is written to u8 field. The intent to zero an adjacent, unrelated field is not clear. Consider assigning these 4 fields manually, or adding a comment/function doc.
Thanks,
Marcin
Quoted 3 lines
drivers/net/ethernet/intel/idpf/idpf_txrx.c +0
-0desc->flow.qw1.rxr_bufsize =cpu_to_le16 ((u16 )size); desc->flow.qw1.compl_tag =cpu_to_le16 (params->compl_tag); }
Quoted 27 lines · Marcin Szycik
Quoted 24 lines · Willem de Bruijn
From: Willem de Bruijn <[email protected]>
idpf_tx_splitq_build_flow_descperforms a 32-bit store to&cmd_dtypeto set the 8-bitcmd_dtypeand zero the adjacent 3-byte timestamp field in a single operation.Descriptors are in little endian. Add missing
cpu_to_le32and cast to__le32to ensure the fields are written correctly also on big endian platforms.Fixes 1a49cf814fe1 ("idpf: add Tx timestamp flows")Signed-off-by Willem de Bruijn <[email protected]>Reviewed-by Tony Nguyen <[email protected]>---
Changes
v1 -> v2
- add Fixes tag, Tony's Reviewed-by and Cc: [email protected]
v1: https://lore.kernel.org/netdev/[email protected]/--- drivers/net/ethernet/intel/idpf/idpf_txrx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 16 lines
drivers/net/ethernet/intel/idpf/idpf_txrx.c void idpf_tx_splitq_build_flow_desc(union idpf_tx_flex_desc *desc, · line 2411
Quoted 10 lines
drivers/net/ethernet/intel/idpf/idpf_txrx.c +1
-1@@ -2408,7 +2408,7 @@ void idpf_tx_splitq_build_flow_desc(union idpf_tx_flex_desc *desc,struct idpf_tx_splitq_params *params, u16 td_cmd, u16 size) { - *(u32 *)&desc->flow.qw1.cmd_dtype = (u8)(params->dtype | td_cmd); + *(__le32 *)&desc->flow.qw1.cmd_dtype = cpu_to_le32((u8)(params->dtype | td_cmd));While it technically works, I find it unreadable. Looking at this line without reading commit msg, it looks like a bug where a 4-byte value is written to u8 field. The intent to zero an adjacent, unrelated field is not clear. Consider assigning these 4 fields manually, or adding a comment/function doc.
This is a bug fix, which generally should be the smallest surgical change only.
That said, I do agree on the style, and a follow-up for net-next will clean that up too:
@@ -2408,7 +2410,12 @@ void idpf_tx_splitq_build_flow_desc(union idpf_tx_flex_desc *desc,
struct idpf_tx_splitq_params *params, u16 td_cmd, u16 size)
{
- *(__le32 *)&desc->flow.qw1.cmd_dtype = cpu_to_le32((u8)(params->dtype | td_cmd));
+ desc->flow.qw1.cmd_dtype = (u8)(params->dtype | td_cmd);
+
+ desc->flow.qw1.ts[0] = params->offload.desc_ts[0];
+ desc->flow.qw1.ts[1] = params->offload.desc_ts[1];
+ desc->flow.qw1.ts[2] = params->offload.desc_ts[2];
The fix is queued. If there is consensus, I can respin. But given that we will clean this up in net-next properly, my preference is to keep the minimal fix as is.
Quoted 45 lines · Willem de Bruijn
Quoted 27 lines · Marcin Szycik
Quoted 24 lines · Willem de Bruijn
From: Willem de Bruijn <[email protected]>
idpf_tx_splitq_build_flow_descperforms a 32-bit store to&cmd_dtypeto set the 8-bitcmd_dtypeand zero the adjacent 3-byte timestamp field in a single operation.Descriptors are in little endian. Add missing
cpu_to_le32and cast to__le32to ensure the fields are written correctly also on big endian platforms.Fixes 1a49cf814fe1 ("idpf: add Tx timestamp flows")Signed-off-by Willem de Bruijn <[email protected]>Reviewed-by Tony Nguyen <[email protected]>---
Changes
v1 -> v2
- add Fixes tag, Tony's Reviewed-by and Cc: [email protected]
v1: https://lore.kernel.org/netdev/[email protected]/--- drivers/net/ethernet/intel/idpf/idpf_txrx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)Quoted 16 lines
drivers/net/ethernet/intel/idpf/idpf_txrx.c void idpf_tx_splitq_build_flow_desc(union idpf_tx_flex_desc *desc, · line 2411
Quoted 10 lines
drivers/net/ethernet/intel/idpf/idpf_txrx.c +1
-1@@ -2408,7 +2408,7 @@ void idpf_tx_splitq_build_flow_desc(union idpf_tx_flex_desc *desc,struct idpf_tx_splitq_params *params, u16 td_cmd, u16 size) { - *(u32 *)&desc->flow.qw1.cmd_dtype = (u8)(params->dtype | td_cmd); + *(__le32 *)&desc->flow.qw1.cmd_dtype = cpu_to_le32((u8)(params->dtype | td_cmd));While it technically works, I find it unreadable. Looking at this line without reading commit msg, it looks like a bug where a 4-byte value is written to u8 field. The intent to zero an adjacent, unrelated field is not clear. Consider assigning these 4 fields manually, or adding a comment/function doc.
Quoted 2 lines
This is a bug fix, which generally should be the smallest surgical change only.
Agreed.
Quoted 14 lines
That said, I do agree on the style, and a follow-up for net-next will clean that up too:
@@ -2408,7 +2410,12 @@ void idpf_tx_splitq_build_flow_desc(union
idpf_tx_flex_desc*desc,
structidpf_tx_splitq_params*params, u16td_cmd, u16 size)
{
- *(__le32 *)&desc->flow.qw1.cmd_dtype =cpu_to_le32((u8)(params->dtype | td_cmd));
+desc->flow.qw1.cmd_dtype= (u8)(params->dtype |td_cmd);
+
+ desc->flow.qw1.ts[0] = params->offload.desc_ts[0];
+ desc->flow.qw1.ts[1] = params->offload.desc_ts[1];
+ desc->flow.qw1.ts[2] = params->offload.desc_ts[2];
Quoted 3 lines
The fix is queued. If there is consensus, I can respin. But given that we will clean this up in net-next properly, my preference is to keep the minimal fix as is.
I'm fine with this. Was the cleanup patch already posted to next?
Thanks,
Marcin
Quoted 66 lines · Marcin Szycik
Quoted 45 lines · Willem de Bruijn
Quoted 27 lines · Marcin Szycik
Quoted 24 lines · Willem de Bruijn
From: Willem de Bruijn <[email protected]>
idpf_tx_splitq_build_flow_descperforms a 32-bit store to&cmd_dtypeto set the 8-bitcmd_dtypeand zero the adjacent 3-byte timestamp field in a single operation.Descriptors are in little endian. Add missing
cpu_to_le32and cast to__le32to ensure the fields are written correctly also on big endian platforms.Fixes 1a49cf814fe1 ("idpf: add Tx timestamp flows")Signed-off-by Willem de Bruijn <[email protected]>Reviewed-by Tony Nguyen <[email protected]>---
Changes
v1 -> v2
- add Fixes tag, Tony's Reviewed-by and Cc: [email protected]
v1: https://lore.kernel.org/netdev/[email protected]/--- drivers/net/ethernet/intel/idpf/idpf_txrx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)Quoted 16 lines
drivers/net/ethernet/intel/idpf/idpf_txrx.c void idpf_tx_splitq_build_flow_desc(union idpf_tx_flex_desc *desc, · line 2411
Quoted 10 lines
drivers/net/ethernet/intel/idpf/idpf_txrx.c +1
-1@@ -2408,7 +2408,7 @@ void idpf_tx_splitq_build_flow_desc(union idpf_tx_flex_desc *desc,struct idpf_tx_splitq_params *params, u16 td_cmd, u16 size) { - *(u32 *)&desc->flow.qw1.cmd_dtype = (u8)(params->dtype | td_cmd); + *(__le32 *)&desc->flow.qw1.cmd_dtype = cpu_to_le32((u8)(params->dtype | td_cmd));While it technically works, I find it unreadable. Looking at this line without reading commit msg, it looks like a bug where a 4-byte value is written to u8 field. The intent to zero an adjacent, unrelated field is not clear. Consider assigning these 4 fields manually, or adding a comment/function doc.
Quoted 2 lines
This is a bug fix, which generally should be the smallest surgical change only.
Agreed.
Quoted 14 lines
That said, I do agree on the style, and a follow-up for net-next will clean that up too:
@@ -2408,7 +2410,12 @@ void idpf_tx_splitq_build_flow_desc(union
idpf_tx_flex_desc*desc,
structidpf_tx_splitq_params*params, u16td_cmd, u16 size)
{
- *(__le32 *)&desc->flow.qw1.cmd_dtype =cpu_to_le32((u8)(params->dtype | td_cmd));
+desc->flow.qw1.cmd_dtype= (u8)(params->dtype |td_cmd);
+
+ desc->flow.qw1.ts[0] = params->offload.desc_ts[0];
+ desc->flow.qw1.ts[1] = params->offload.desc_ts[1];
+ desc->flow.qw1.ts[2] = params->offload.desc_ts[2];
Quoted 5 lines
Quoted 3 lines
The fix is queued. If there is consensus, I can respin. But given that we will clean this up in net-next properly, my preference is to keep the minimal fix as is.
I'm fine with this.
Great.
Quoted 1 line
Was the cleanup patch already posted to next?
Not yet. I'll try to send the series later today.
It will have a (trivial) conflict with this line. But I will likely need to respin again, so don't want t wait for that (and the merge window).