net/sfc/base: correct PIO buffer dimensions for Medford2
authorAndy Moreton <amoreton@solarflare.com>
Tue, 20 Feb 2018 07:33:26 +0000 (07:33 +0000)
committerFerruh Yigit <ferruh.yigit@intel.com>
Fri, 30 Mar 2018 12:08:42 +0000 (14:08 +0200)
Signed-off-by: Andy Moreton <amoreton@solarflare.com>
Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
drivers/net/sfc/base/ef10_impl.h
drivers/net/sfc/base/hunt_nic.c
drivers/net/sfc/base/medford2_nic.c
drivers/net/sfc/base/medford_nic.c

index e79f4d5..164e9cc 100644 (file)
 extern "C" {
 #endif
 
-#if (EFSYS_OPT_HUNTINGTON && EFSYS_OPT_MEDFORD)
-#define        EF10_MAX_PIOBUF_NBUFS   MAX(HUNT_PIOBUF_NBUFS, MEDFORD_PIOBUF_NBUFS)
-#elif EFSYS_OPT_HUNTINGTON
-#define        EF10_MAX_PIOBUF_NBUFS   HUNT_PIOBUF_NBUFS
-#elif EFSYS_OPT_MEDFORD
-#define        EF10_MAX_PIOBUF_NBUFS   MEDFORD_PIOBUF_NBUFS
-#endif
+
+/* Number of hardware PIO buffers (for compile-time resource dimensions) */
+#define        EF10_MAX_PIOBUF_NBUFS   (16)
+
+#if EFSYS_OPT_HUNTINGTON
+# if (EF10_MAX_PIOBUF_NBUFS < HUNT_PIOBUF_NBUFS)
+#  error "EF10_MAX_PIOBUF_NBUFS too small"
+# endif
+#endif /* EFSYS_OPT_HUNTINGTON */
+#if EFSYS_OPT_MEDFORD
+# if (EF10_MAX_PIOBUF_NBUFS < MEDFORD_PIOBUF_NBUFS)
+#  error "EF10_MAX_PIOBUF_NBUFS too small"
+# endif
+#endif /* EFSYS_OPT_MEDFORD */
+#if EFSYS_OPT_MEDFORD2
+# if (EF10_MAX_PIOBUF_NBUFS < MEDFORD2_PIOBUF_NBUFS)
+#  error "EF10_MAX_PIOBUF_NBUFS too small"
+# endif
+#endif /* EFSYS_OPT_MEDFORD2 */
+
+
 
 /*
  * FIXME: This is just a power of 2 which fits in an MCDI v1 message, and could
index d03cc13..fb39850 100644 (file)
@@ -306,6 +306,7 @@ hunt_board_cfg(
 
        encp->enc_buftbl_limit = 0xFFFFFFFF;
 
+       EFX_STATIC_ASSERT(HUNT_PIOBUF_NBUFS <= EF10_MAX_PIOBUF_NBUFS);
        encp->enc_piobuf_limit = HUNT_PIOBUF_NBUFS;
        encp->enc_piobuf_size = HUNT_PIOBUF_SIZE;
        encp->enc_piobuf_min_alloc_size = HUNT_MIN_PIO_ALLOC_SIZE;
index 68435a0..8873211 100644 (file)
@@ -307,6 +307,7 @@ medford2_board_cfg(
 
        encp->enc_buftbl_limit = 0xFFFFFFFF;
 
+       EFX_STATIC_ASSERT(MEDFORD2_PIOBUF_NBUFS <= EF10_MAX_PIOBUF_NBUFS);
        encp->enc_piobuf_limit = MEDFORD2_PIOBUF_NBUFS;
        encp->enc_piobuf_size = MEDFORD2_PIOBUF_SIZE;
        encp->enc_piobuf_min_alloc_size = MEDFORD2_MIN_PIO_ALLOC_SIZE;
index 1365e9e..9b91a82 100644 (file)
@@ -305,6 +305,7 @@ medford_board_cfg(
 
        encp->enc_buftbl_limit = 0xFFFFFFFF;
 
+       EFX_STATIC_ASSERT(MEDFORD_PIOBUF_NBUFS <= EF10_MAX_PIOBUF_NBUFS);
        encp->enc_piobuf_limit = MEDFORD_PIOBUF_NBUFS;
        encp->enc_piobuf_size = MEDFORD_PIOBUF_SIZE;
        encp->enc_piobuf_min_alloc_size = MEDFORD_MIN_PIO_ALLOC_SIZE;