netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [net-next PATCH] octeon_ep: pack hardware structures
@ 2023-10-06 12:02 Shinas Rasheed
  2023-10-10  9:28 ` Paolo Abeni
  0 siblings, 1 reply; 5+ messages in thread
From: Shinas Rasheed @ 2023-10-06 12:02 UTC (permalink / raw)
  To: netdev, linux-kernel, hgani
  Cc: egallen, mschmidt, Shinas Rasheed, Veerasenareddy Burru,
	Sathesh Edara, David S. Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni

Add packed attribute to hardware structures.

Signed-off-by: Shinas Rasheed <srasheed@marvell.com>
---
 drivers/net/ethernet/marvell/octeon_ep/octep_rx.h | 6 +++---
 drivers/net/ethernet/marvell/octeon_ep/octep_tx.h | 8 ++++----
 2 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/drivers/net/ethernet/marvell/octeon_ep/octep_rx.h b/drivers/net/ethernet/marvell/octeon_ep/octep_rx.h
index 782a24f27f3e..ca42ddb77491 100644
--- a/drivers/net/ethernet/marvell/octeon_ep/octep_rx.h
+++ b/drivers/net/ethernet/marvell/octeon_ep/octep_rx.h
@@ -19,7 +19,7 @@
 struct octep_oq_desc_hw {
 	dma_addr_t buffer_ptr;
 	u64 info_ptr;
-};
+} __packed;
 
 #define OCTEP_OQ_DESC_SIZE    (sizeof(struct octep_oq_desc_hw))
 
@@ -38,7 +38,7 @@ struct octep_oq_resp_hw_ext {
 
 	/* checksum verified. */
 	u64 csum_verified:2;
-};
+} __packed;
 
 #define  OCTEP_OQ_RESP_HW_EXT_SIZE   (sizeof(struct octep_oq_resp_hw_ext))
 
@@ -49,7 +49,7 @@ struct octep_oq_resp_hw_ext {
 struct octep_oq_resp_hw {
 	/* The Length of the packet. */
 	__be64 length;
-};
+} __packed;
 
 #define OCTEP_OQ_RESP_HW_SIZE   (sizeof(struct octep_oq_resp_hw))
 
diff --git a/drivers/net/ethernet/marvell/octeon_ep/octep_tx.h b/drivers/net/ethernet/marvell/octeon_ep/octep_tx.h
index 21e75ff9f5e7..74189e5a7d33 100644
--- a/drivers/net/ethernet/marvell/octeon_ep/octep_tx.h
+++ b/drivers/net/ethernet/marvell/octeon_ep/octep_tx.h
@@ -35,7 +35,7 @@
 struct octep_tx_sglist_desc {
 	u16 len[4];
 	dma_addr_t dma_ptr[4];
-};
+} __packed;
 
 /* Each Scatter/Gather entry sent to hardwar hold four pointers.
  * So, number of entries required is (MAX_SKB_FRAGS + 1)/4, where '+1'
@@ -238,7 +238,7 @@ struct octep_instr_hdr {
 
 	/* Reserved3 */
 	u64 reserved3:1;
-};
+} __packed;
 
 /* Hardware Tx completion response header */
 struct octep_instr_resp_hdr {
@@ -262,7 +262,7 @@ struct octep_instr_resp_hdr {
 
 	/* Opcode for the return packet  */
 	u64 opcode:16;
-};
+} __packed;
 
 /* 64-byte Tx instruction format.
  * Format of instruction for a 64-byte mode input queue.
@@ -292,7 +292,7 @@ struct octep_tx_desc_hw {
 
 	/* Additional headers available in a 64-byte instruction. */
 	u64 exhdr[4];
-};
+} __packed;
 
 #define OCTEP_IQ_DESC_SIZE (sizeof(struct octep_tx_desc_hw))
 #endif /* _OCTEP_TX_H_ */
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [net-next PATCH] octeon_ep: pack hardware structures
  2023-10-06 12:02 [net-next PATCH] octeon_ep: pack hardware structures Shinas Rasheed
@ 2023-10-10  9:28 ` Paolo Abeni
  2023-10-10 19:20   ` [EXT] " Shinas Rasheed
  0 siblings, 1 reply; 5+ messages in thread
From: Paolo Abeni @ 2023-10-10  9:28 UTC (permalink / raw)
  To: Shinas Rasheed, netdev, linux-kernel, hgani
  Cc: egallen, mschmidt, Veerasenareddy Burru, Sathesh Edara,
	David S. Miller, Eric Dumazet, Jakub Kicinski

On Fri, 2023-10-06 at 05:02 -0700, Shinas Rasheed wrote:
> Add packed attribute to hardware structures.

Could you please elaborate a bit more why this is needed? Is this a
bugfix? Or something needed by later changes? Please update the
changelog accordingly

Thanks!

Paolo


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [EXT] Re: [net-next PATCH] octeon_ep: pack hardware structures
  2023-10-10  9:28 ` Paolo Abeni
@ 2023-10-10 19:20   ` Shinas Rasheed
  2023-10-10 19:40     ` [net-next PATCH v2] " Shinas Rasheed
  0 siblings, 1 reply; 5+ messages in thread
From: Shinas Rasheed @ 2023-10-10 19:20 UTC (permalink / raw)
  To: Paolo Abeni, netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	Haseeb Gani
  Cc: egallen@redhat.com, mschmidt@redhat.com, Veerasenareddy Burru,
	Sathesh B Edara, David S. Miller, Eric Dumazet, Jakub Kicinski

Hi Paolo,

Could you please elaborate a bit more why this is needed? 
>>> This is a necessary commit as these structures should be packed since they represent hardware data structures and padding is not allowed by hardware.

Is this a bugfix? 
>>> There are no issues observed due to this, but this should be updated anyway.

Please update the changelog accordingly
>>>  I shall include more information in the changelog as well.

Thanks!

Paolo

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [net-next PATCH v2] octeon_ep: pack hardware structures
  2023-10-10 19:20   ` [EXT] " Shinas Rasheed
@ 2023-10-10 19:40     ` Shinas Rasheed
  2023-10-13 11:15       ` Simon Horman
  0 siblings, 1 reply; 5+ messages in thread
From: Shinas Rasheed @ 2023-10-10 19:40 UTC (permalink / raw)
  To: pabeni, linux-kernel
  Cc: davem, edumazet, egallen, hgani, kuba, mschmidt, netdev, srasheed,
	sedara, vburru, vimleshk

Add packed attribute to structures correlating to hardware
data, as padding is not allowed by hardware.

Signed-off-by: Shinas Rasheed <srasheed@marvell.com>
---
V1 -> V2: Updated changelog

 drivers/net/ethernet/marvell/octeon_ep/octep_rx.h | 6 +++---
 drivers/net/ethernet/marvell/octeon_ep/octep_tx.h | 8 ++++----
 2 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/drivers/net/ethernet/marvell/octeon_ep/octep_rx.h b/drivers/net/ethernet/marvell/octeon_ep/octep_rx.h
index 782a24f27f3e..ca42ddb77491 100644
--- a/drivers/net/ethernet/marvell/octeon_ep/octep_rx.h
+++ b/drivers/net/ethernet/marvell/octeon_ep/octep_rx.h
@@ -19,7 +19,7 @@
 struct octep_oq_desc_hw {
 	dma_addr_t buffer_ptr;
 	u64 info_ptr;
-};
+} __packed;
 
 #define OCTEP_OQ_DESC_SIZE    (sizeof(struct octep_oq_desc_hw))
 
@@ -38,7 +38,7 @@ struct octep_oq_resp_hw_ext {
 
 	/* checksum verified. */
 	u64 csum_verified:2;
-};
+} __packed;
 
 #define  OCTEP_OQ_RESP_HW_EXT_SIZE   (sizeof(struct octep_oq_resp_hw_ext))
 
@@ -49,7 +49,7 @@ struct octep_oq_resp_hw_ext {
 struct octep_oq_resp_hw {
 	/* The Length of the packet. */
 	__be64 length;
-};
+} __packed;
 
 #define OCTEP_OQ_RESP_HW_SIZE   (sizeof(struct octep_oq_resp_hw))
 
diff --git a/drivers/net/ethernet/marvell/octeon_ep/octep_tx.h b/drivers/net/ethernet/marvell/octeon_ep/octep_tx.h
index 21e75ff9f5e7..74189e5a7d33 100644
--- a/drivers/net/ethernet/marvell/octeon_ep/octep_tx.h
+++ b/drivers/net/ethernet/marvell/octeon_ep/octep_tx.h
@@ -35,7 +35,7 @@
 struct octep_tx_sglist_desc {
 	u16 len[4];
 	dma_addr_t dma_ptr[4];
-};
+} __packed;
 
 /* Each Scatter/Gather entry sent to hardwar hold four pointers.
  * So, number of entries required is (MAX_SKB_FRAGS + 1)/4, where '+1'
@@ -238,7 +238,7 @@ struct octep_instr_hdr {
 
 	/* Reserved3 */
 	u64 reserved3:1;
-};
+} __packed;
 
 /* Hardware Tx completion response header */
 struct octep_instr_resp_hdr {
@@ -262,7 +262,7 @@ struct octep_instr_resp_hdr {
 
 	/* Opcode for the return packet  */
 	u64 opcode:16;
-};
+} __packed;
 
 /* 64-byte Tx instruction format.
  * Format of instruction for a 64-byte mode input queue.
@@ -292,7 +292,7 @@ struct octep_tx_desc_hw {
 
 	/* Additional headers available in a 64-byte instruction. */
 	u64 exhdr[4];
-};
+} __packed;
 
 #define OCTEP_IQ_DESC_SIZE (sizeof(struct octep_tx_desc_hw))
 #endif /* _OCTEP_TX_H_ */
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [net-next PATCH v2] octeon_ep: pack hardware structures
  2023-10-10 19:40     ` [net-next PATCH v2] " Shinas Rasheed
@ 2023-10-13 11:15       ` Simon Horman
  0 siblings, 0 replies; 5+ messages in thread
From: Simon Horman @ 2023-10-13 11:15 UTC (permalink / raw)
  To: Shinas Rasheed
  Cc: pabeni, linux-kernel, davem, edumazet, egallen, hgani, kuba,
	mschmidt, netdev, sedara, vburru, vimleshk

On Tue, Oct 10, 2023 at 12:40:26PM -0700, Shinas Rasheed wrote:
> Add packed attribute to structures correlating to hardware
> data, as padding is not allowed by hardware.

Hi Shinas,

in the v1 you stated that this is bot a bugfix.
So I am assuming, that by some happy coincidence,
the layout of the structures is the same before and after
this patch. And this patch is thus a cleanup.

If so I think it would be worth noting in the patch description.

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2023-10-13 11:15 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-10-06 12:02 [net-next PATCH] octeon_ep: pack hardware structures Shinas Rasheed
2023-10-10  9:28 ` Paolo Abeni
2023-10-10 19:20   ` [EXT] " Shinas Rasheed
2023-10-10 19:40     ` [net-next PATCH v2] " Shinas Rasheed
2023-10-13 11:15       ` Simon Horman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).