ice: fix undersized tx_flags field
Subsystems (3)
PATCH 1/1 ice: fix undersized tx_flags field
As not all ICE_TX_FLAGS_* fit in current 16-bit limited tx_flags field, some flags would not properly apply.
Fix that by removing 16 bit limitation.
--- drivers/net/ethernet/intel/ice/ice_txrx.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/intel/ice/ice_txrx.h +1 -1
@@ -183,7 +183,7 @@ struct ice_tx_buf {unsigned int nr_frags;/* used for mbuf XDP */ }; u32 type:16; /* &ice_tx_buf_type */ - u32 tx_flags:16; +u32 tx_flags;DEFINE_DMA_UNMAP_LEN (len);DEFINE_DMA_UNMAP_ADDR (dma); };
Signature · 6 lines
2.31.1 _______________________________________________ Intel-wired-lan mailing list [email protected] https://lists.osuosl.org/mailman/listinfo/intel-wired-lan
From: Jan Sokolowski <[email protected]>
Date: Tue, 11 Apr 2023 09:37:07 +0200
Please always add original authors to Ccs when you modify some code. I found this mail only by scrolling IWL, while I should've got it from the start.
+ Cc netdev (no idea why you didn't do that)
Quoted 2 lines
As not all ICE_TX_FLAGS_* fit in current 16-bit limited
tx_flagsfield, some flags would not properly apply.
Could you give more details here? With the actual definitions and also how it was found and what's the regression is.
I found that there's VLAN tag which uses upper 16 bits only by browsing the code, while I'd say you should've written it here.
Quoted 5 lines
Fix that by removing 16 bit limitation.
Signed-off-by Jan Sokolowski <[email protected]>Fixes aa1d3faf71a6 ("ice: Robustify cleaning/completing XDP Tx buffers")
Your SoB must go last, i.e. "Fixes:" should be placed above it.
Quoted 9 lines
--- drivers/net/ethernet/intel/ice/ice_txrx.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/net/ethernet/intel/ice/ice_txrx.h +0
-0
drivers/net/ethernet/intel/ice/ice_txrx.h struct ice_tx_buf { · line 186
Quoted 5 lines
drivers/net/ethernet/intel/ice/ice_txrx.h +1
-1@@ -183,7 +183,7 @@ struct ice_tx_buf {unsigned int nr_frags;/* used for mbuf XDP */ }; u32 type:16; /* &ice_tx_buf_type */ - u32 tx_flags:16; +u32 tx_flags;
Please always provide pahole output when you change fields size/structure. Here you create a 16-bit hole and increase structure size with no mentioning.
I wouldn't say the fix is optimal. From what I see, we have such flags (correct me if I'm wrong):
TSO BIT(0)
[bits 1-7 are used]OUTER_SINGLE_VLAN BIT(8)
[bits 9-15 are UNused]VLAN_S (shift) 16
[bits 16-31 are used for VLAN tag]
So you have 7 free bits to reuse for &ice_tx_buf_type, but you just restored the before-commit ::tx_flags size =\
I would do the following:
u32 tx_flags:12; u32 type:4; u32 vid:16;
* no structure size change (even no layout change);
* ::type range is 0-15 -- more than enough, as the last &ice_tx_buf_type value is 6;
* ::tx_flags still has 3 free bits left (9, 10, and 11);
* ::vid makes it easier to set a VLAN tag (no explicit masking-shifting, just don't forget to adjust the places where %ICE_TX_VLAN_{M,S} are used).
Don't just use "first that works" approach =\
drivers/net/ethernet/intel/ice/ice_txrx.h struct ice_tx_buf { · line 189
Quoted 3 lines
drivers/net/ethernet/intel/ice/ice_txrx.h +0
-0DEFINE_DMA_UNMAP_LEN (len);DEFINE_DMA_UNMAP_ADDR (dma); };
Thanks,
Olek
_______________________________________________
Intel-wired-lan mailing list
[email protected]
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan
From: Lobakin, Aleksander <[email protected]>
Sent: Wednesday, April 12, 2023 6:49 PM
To: Sokolowski, Jan <[email protected]>
Cc: [email protected]; [email protected]
Quoted 8 lines
Subject: Re: [Intel-wired-lan] [PATCH net v1] ice: fix undersized
tx_flagsfieldQuoted 2 lines
From: Jan Sokolowski <[email protected]>
Date: Tue, 11 Apr 2023 09:37:07 +0200Please always add original authors to Ccs when you modify some code. I found this mail only by scrolling IWL, while I should've got it from the start.
Quoted 8 lines
+ Cc netdev (no idea why you didn't do that)
Quoted 2 lines
As not all ICE_TX_FLAGS_* fit in current 16-bit limited
tx_flagsfield, some flags would not properly apply.Could you give more details here? With the actual definitions and also how it was found and what's the regression is.
I found that there's VLAN tag which uses upper 16 bits only by browsing the code, while I'd say you should've written it here.
The definitions are ICE_TX_FLAGS_VLAN_* ones, for example ICE_TX_FLAGS_VLAN_M that is a 0xffff0000 mask.
The regression found was with some vlan traffic no longer passing through after commit aa1d3faf71a6 ("ice: Robustify cleaning/completing XDP Tx buffers")
Quoted 12 lines
Quoted 5 lines
Fix that by removing 16 bit limitation.
Signed-off-by Jan Sokolowski <[email protected]>Fixes aa1d3faf71a6 ("ice: Robustify cleaning/completing XDP Tx buffers")Your SoB must go last, i.e. "Fixes:" should be placed above it.
Quoted 4 lines
--- drivers/net/ethernet/intel/ice/ice_txrx.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 14 lines
drivers/net/ethernet/intel/ice/ice_txrx.h struct ice_tx_buf { · line 186
Quoted 10 lines
drivers/net/ethernet/intel/ice/ice_txrx.h +1
-1@@ -183,7 +183,7 @@ struct ice_tx_buf {unsigned int nr_frags;/* used for mbuf XDP */ }; u32 type:16; /* &ice_tx_buf_type */ - u32 tx_flags:16; +u32 tx_flags;Please always provide pahole output when you change fields size/structure. Here you create a 16-bit hole and increase structure size with no mentioning.
Ok, will do that.
Quoted 10 lines
I wouldn't say the fix is optimal. From what I see, we have such flags (correct me if I'm wrong):
TSO BIT(0)
[bits 1-7 are used]OUTER_SINGLE_VLANBIT(8)
[bits 9-15 are UNused]VLAN_S(shift) 16
[bits 16-31 are used for VLAN tag]
Quoted 7 lines
So you have 7 free bits to reuse for
&ice_tx_buf_type, but you just restored the before-commit ::tx_flags size =\
I would do the following:u32 tx_flags:12; u32 type:4; u32 vid:16;
Ok, will try to refactor it in this way and see whether it'll work.
Quoted 8 lines
* no structure size change (even no layout change);
* ::type range is 0-15 -- more than enough, as the last&ice_tx_buf_typevalue is 6;
* ::tx_flags still has 3 free bits left (9, 10, and 11);
* ::vid makes it easier to set a VLAN tag (no explicit masking-shifting, just don't forget to adjust the places where %ICE_TX_VLAN_{M,S} are used).
Quoted 8 lines
Don't just use "first that works" approach =\
drivers/net/ethernet/intel/ice/ice_txrx.h struct ice_tx_buf { · line 189
Quoted 3 lines
drivers/net/ethernet/intel/ice/ice_txrx.h +0
-0DEFINE_DMA_UNMAP_LEN (len);DEFINE_DMA_UNMAP_ADDR (dma); };Thanks,
Olek
_______________________________________________
Intel-wired-lan mailing list
[email protected]
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan