[v4,3/6] net/sfc: fix non-constant expression in RTE_BUILD_BUG_ON()

Message ID 20240117182541.211125-4-stephen@networkplumber.org (mailing list archive)
State Superseded, archived
Delegated to: Thomas Monjalon
Headers
Series use static assert to cathc build errors |

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Stephen Hemminger Jan. 17, 2024, 6:19 p.m. UTC
  The macro RTE_MIN has some hidden assignments to provide type
safety which means the statement can not be fully evaluated in
first pass of compiler. Replace RTE_MIN() with equivalent macro.

Fixes: 4f936666d790 ("net/sfc: support TSO for EF100 native datapath")
Cc: ivan.malov@oktetlabs.ru
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Acked-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
---
 drivers/net/sfc/sfc_ef100_tx.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
  

Comments

Andrew Rybchenko Jan. 18, 2024, 9:40 a.m. UTC | #1
On 1/17/24 21:19, Stephen Hemminger wrote:
> The macro RTE_MIN has some hidden assignments to provide type
> safety which means the statement can not be fully evaluated in
> first pass of compiler. Replace RTE_MIN() with equivalent macro.
> 
> Fixes: 4f936666d790 ("net/sfc: support TSO for EF100 native datapath")
> Cc: ivan.malov@oktetlabs.ru
> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
> Acked-by: Tyler Retzlaff <roretzla@linux.microsoft.com>

One nit below, anyway:
Reviewed-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>

> ---
>   drivers/net/sfc/sfc_ef100_tx.c | 4 +---
>   1 file changed, 1 insertion(+), 3 deletions(-)
> 
> diff --git a/drivers/net/sfc/sfc_ef100_tx.c b/drivers/net/sfc/sfc_ef100_tx.c
> index 1b6374775f07..c49d004113d3 100644
> --- a/drivers/net/sfc/sfc_ef100_tx.c
> +++ b/drivers/net/sfc/sfc_ef100_tx.c
> @@ -26,7 +26,6 @@
>   #include "sfc_ef100.h"
>   #include "sfc_nic_dma_dp.h"
>   
> -

unrelated change

>   #define sfc_ef100_tx_err(_txq, ...) \
>   	SFC_DP_LOG(SFC_KVARG_DATAPATH_EF100, ERR, &(_txq)->dp.dpq, __VA_ARGS__)
>   
> @@ -563,8 +562,7 @@ sfc_ef100_tx_pkt_descs_max(const struct rte_mbuf *m)
>   		 * (split into many Tx descriptors).
>   		 */
>   		RTE_BUILD_BUG_ON(SFC_EF100_TX_SEND_DESC_LEN_MAX <
> -				 RTE_MIN((unsigned int)EFX_MAC_PDU_MAX,
> -				 SFC_MBUF_SEG_LEN_MAX));
> +				 RTE_MIN_T(EFX_MAC_PDU_MAX, SFC_MBUF_SEG_LEN_MAX, uint32_t));
>   	}
>   
>   	if (m->ol_flags & sfc_dp_mport_override) {
  

Patch

diff --git a/drivers/net/sfc/sfc_ef100_tx.c b/drivers/net/sfc/sfc_ef100_tx.c
index 1b6374775f07..c49d004113d3 100644
--- a/drivers/net/sfc/sfc_ef100_tx.c
+++ b/drivers/net/sfc/sfc_ef100_tx.c
@@ -26,7 +26,6 @@ 
 #include "sfc_ef100.h"
 #include "sfc_nic_dma_dp.h"
 
-
 #define sfc_ef100_tx_err(_txq, ...) \
 	SFC_DP_LOG(SFC_KVARG_DATAPATH_EF100, ERR, &(_txq)->dp.dpq, __VA_ARGS__)
 
@@ -563,8 +562,7 @@  sfc_ef100_tx_pkt_descs_max(const struct rte_mbuf *m)
 		 * (split into many Tx descriptors).
 		 */
 		RTE_BUILD_BUG_ON(SFC_EF100_TX_SEND_DESC_LEN_MAX <
-				 RTE_MIN((unsigned int)EFX_MAC_PDU_MAX,
-				 SFC_MBUF_SEG_LEN_MAX));
+				 RTE_MIN_T(EFX_MAC_PDU_MAX, SFC_MBUF_SEG_LEN_MAX, uint32_t));
 	}
 
 	if (m->ol_flags & sfc_dp_mport_override) {