From: Ivan Malov <ivan.ma...@oktetlabs.ru>

Riverhead boards maintain support for MAE, a low-level Match-Action Engine.
The feature is documented in SF-122526-TC.

The new field will help client drivers to test
NIC support for MAE status.

Signed-off-by: Ivan Malov <ivan.ma...@oktetlabs.ru>
Signed-off-by: Andrew Rybchenko <arybche...@solarflare.com>
Reviewed-by: Andy Moreton <amore...@xilinx.com>
---
 drivers/common/sfc_efx/base/ef10_nic.c  | 15 +++++++++++++++
 drivers/common/sfc_efx/base/efx.h       |  2 ++
 drivers/common/sfc_efx/base/efx_check.h |  6 ++++++
 drivers/common/sfc_efx/base/siena_nic.c |  2 ++
 drivers/common/sfc_efx/efsys.h          |  2 ++
 5 files changed, 27 insertions(+)

diff --git a/drivers/common/sfc_efx/base/ef10_nic.c 
b/drivers/common/sfc_efx/base/ef10_nic.c
index df7db6a803..68414d9fa9 100644
--- a/drivers/common/sfc_efx/base/ef10_nic.c
+++ b/drivers/common/sfc_efx/base/ef10_nic.c
@@ -1421,8 +1421,23 @@ ef10_get_datapath_caps(
        else
                encp->enc_filter_action_mark_max = 0;
 
+#if EFSYS_OPT_MAE
+       /*
+        * Indicate support for MAE.
+        * MAE is supported by Riverhead boards starting with R2,
+        * and it is required that FW is built with MAE support, too.
+        */
+       if (CAP_FLAGS3(req, MAE_SUPPORTED))
+               encp->enc_mae_supported = B_TRUE;
+       else
+               encp->enc_mae_supported = B_FALSE;
+#else
+       encp->enc_mae_supported = B_FALSE;
+#endif /* EFSYS_OPT_MAE */
+
 #undef CAP_FLAGS1
 #undef CAP_FLAGS2
+#undef CAP_FLAGS3
 
        return (0);
 
diff --git a/drivers/common/sfc_efx/base/efx.h 
b/drivers/common/sfc_efx/base/efx.h
index bd1ac303b1..9947882d26 100644
--- a/drivers/common/sfc_efx/base/efx.h
+++ b/drivers/common/sfc_efx/base/efx.h
@@ -1593,6 +1593,8 @@ typedef struct efx_nic_cfg_s {
        uint32_t                enc_mac_stats_nstats;
        boolean_t               enc_fec_counters;
        boolean_t               enc_hlb_counters;
+       /* NIC support for Match-Action Engine (MAE). */
+       boolean_t               enc_mae_supported;
        /* Firmware support for "FLAG" and "MARK" filter actions */
        boolean_t               enc_filter_action_flag_supported;
        boolean_t               enc_filter_action_mark_supported;
diff --git a/drivers/common/sfc_efx/base/efx_check.h 
b/drivers/common/sfc_efx/base/efx_check.h
index 8f42d87a04..078e5b9811 100644
--- a/drivers/common/sfc_efx/base/efx_check.h
+++ b/drivers/common/sfc_efx/base/efx_check.h
@@ -401,4 +401,10 @@
 # endif
 #endif /* EFSYS_OPT_DESC_PROXY */
 
+#if EFSYS_OPT_MAE
+# if !EFSYS_OPT_RIVERHEAD
+#  error "MAE requires RIVERHEAD"
+# endif
+#endif /* EFSYS_OPT_MAE */
+
 #endif /* _SYS_EFX_CHECK_H */
diff --git a/drivers/common/sfc_efx/base/siena_nic.c 
b/drivers/common/sfc_efx/base/siena_nic.c
index 4137c1e245..e2af0ff3dc 100644
--- a/drivers/common/sfc_efx/base/siena_nic.c
+++ b/drivers/common/sfc_efx/base/siena_nic.c
@@ -196,6 +196,8 @@ siena_board_cfg(
        encp->enc_filter_action_mark_supported = B_FALSE;
        encp->enc_filter_action_mark_max = 0;
 
+       encp->enc_mae_supported = B_FALSE;
+
        return (0);
 
 fail2:
diff --git a/drivers/common/sfc_efx/efsys.h b/drivers/common/sfc_efx/efsys.h
index f7d5f8a060..8636e73b68 100644
--- a/drivers/common/sfc_efx/efsys.h
+++ b/drivers/common/sfc_efx/efsys.h
@@ -167,6 +167,8 @@ prefetch_read_once(const volatile void *addr)
 
 #define EFSYS_OPT_DESC_PROXY 0
 
+#define EFSYS_OPT_MAE 0
+
 /* ID */
 
 typedef struct __efsys_identifier_s efsys_identifier_t;
-- 
2.17.1

Reply via email to