octeon_ep: assert hardware structure sizes
authorShinas Rasheed <srasheed@marvell.com>
Fri, 20 Oct 2023 11:43:01 +0000 (04:43 -0700)
committerDavid S. Miller <davem@davemloft.net>
Sat, 21 Oct 2023 14:41:00 +0000 (15:41 +0100)
Clean up structure defines related to hardware data to be
asserted to fixed sizes, as padding is not allowed
by hardware.

Signed-off-by: Shinas Rasheed <srasheed@marvell.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/marvell/octeon_ep/octep_rx.h
drivers/net/ethernet/marvell/octeon_ep/octep_tx.h

index 782a24f27f3e0f1f3ba6b11fab19167de8ae0a91..49feae80d7d289dc36c89266683f561d99236d4c 100644 (file)
@@ -20,6 +20,7 @@ struct octep_oq_desc_hw {
        dma_addr_t buffer_ptr;
        u64 info_ptr;
 };
+static_assert(sizeof(struct octep_oq_desc_hw) == 16);
 
 #define OCTEP_OQ_DESC_SIZE    (sizeof(struct octep_oq_desc_hw))
 
@@ -39,6 +40,7 @@ struct octep_oq_resp_hw_ext {
        /* checksum verified. */
        u64 csum_verified:2;
 };
+static_assert(sizeof(struct octep_oq_resp_hw_ext) == 8);
 
 #define  OCTEP_OQ_RESP_HW_EXT_SIZE   (sizeof(struct octep_oq_resp_hw_ext))
 
@@ -50,6 +52,7 @@ struct octep_oq_resp_hw {
        /* The Length of the packet. */
        __be64 length;
 };
+static_assert(sizeof(struct octep_oq_resp_hw) == 8);
 
 #define OCTEP_OQ_RESP_HW_SIZE   (sizeof(struct octep_oq_resp_hw))
 
index 21e75ff9f5e71165be04cdefd72678bd5911a663..86c98b13fc44198e03fb80cfe957a1eebe59542a 100644 (file)
@@ -36,6 +36,7 @@ struct octep_tx_sglist_desc {
        u16 len[4];
        dma_addr_t dma_ptr[4];
 };
+static_assert(sizeof(struct octep_tx_sglist_desc) == 40);
 
 /* Each Scatter/Gather entry sent to hardwar hold four pointers.
  * So, number of entries required is (MAX_SKB_FRAGS + 1)/4, where '+1'
@@ -239,6 +240,7 @@ struct octep_instr_hdr {
        /* Reserved3 */
        u64 reserved3:1;
 };
+static_assert(sizeof(struct octep_instr_hdr) == 8);
 
 /* Hardware Tx completion response header */
 struct octep_instr_resp_hdr {
@@ -263,6 +265,7 @@ struct octep_instr_resp_hdr {
        /* Opcode for the return packet  */
        u64 opcode:16;
 };
+static_assert(sizeof(struct octep_instr_hdr) == 8);
 
 /* 64-byte Tx instruction format.
  * Format of instruction for a 64-byte mode input queue.
@@ -293,6 +296,7 @@ struct octep_tx_desc_hw {
        /* Additional headers available in a 64-byte instruction. */
        u64 exhdr[4];
 };
+static_assert(sizeof(struct octep_tx_desc_hw) == 64);
 
 #define OCTEP_IQ_DESC_SIZE (sizeof(struct octep_tx_desc_hw))
 #endif /* _OCTEP_TX_H_ */