common/sfc_efx/base: add action set spec init/fini APIs
authorIvan Malov <ivan.malov@oktetlabs.ru>
Tue, 20 Oct 2020 09:12:54 +0000 (10:12 +0100)
committerFerruh Yigit <ferruh.yigit@intel.com>
Tue, 3 Nov 2020 22:24:24 +0000 (23:24 +0100)
The engine is only able to carry out chosen actions on matching packets in
a strict order. No MCDI exists to identify supported actions and the order.
Still, the definition of the latter is available from the FW documentation.

The general idea is to define an action specification structure and supply
a client driver with APIs for adding actions individually, order-dependent.
A client driver is supposed to invoke an API on every action passed by the
application, and if an out-of-order action follows, the API will reject it.

Add an action set specification stub and supply initialise / finalise APIs.

Signed-off-by: Ivan Malov <ivan.malov@oktetlabs.ru>
Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
Reviewed-by: Andy Moreton <amoreton@xilinx.com>
drivers/common/sfc_efx/base/efx.h
drivers/common/sfc_efx/base/efx_impl.h
drivers/common/sfc_efx/base/efx_mae.c
drivers/common/sfc_efx/version.map

index c91f794..cd0b22d 100644 (file)
@@ -4098,6 +4098,26 @@ efx_mae_match_spec_is_valid(
        __in                            efx_nic_t *enp,
        __in                            const efx_mae_match_spec_t *spec);
 
+typedef struct efx_mae_actions_s efx_mae_actions_t;
+
+LIBEFX_API
+extern __checkReturn                   efx_rc_t
+efx_mae_action_set_spec_init(
+       __in                            efx_nic_t *enp,
+       __out                           efx_mae_actions_t **specp);
+
+LIBEFX_API
+extern                                 void
+efx_mae_action_set_spec_fini(
+       __in                            efx_nic_t *enp,
+       __in                            efx_mae_actions_t *spec);
+
+LIBEFX_API
+extern __checkReturn                   boolean_t
+efx_mae_action_set_specs_equal(
+       __in                            const efx_mae_actions_t *left,
+       __in                            const efx_mae_actions_t *right);
+
 /*
  * Conduct a comparison to check whether two match specifications
  * of equal rule type (action / outer) and priority would map to
index 2b872bb..44e6467 100644 (file)
@@ -1699,6 +1699,9 @@ struct efx_mae_match_spec_s {
        } emms_mask_value_pairs;
 };
 
+struct efx_mae_actions_s {
+};
+
 #endif /* EFSYS_OPT_MAE */
 
 #ifdef __cplusplus
index a126cba..81c586d 100644 (file)
@@ -434,6 +434,45 @@ efx_mae_match_spec_is_valid(
        return (is_valid);
 }
 
+       __checkReturn                   efx_rc_t
+efx_mae_action_set_spec_init(
+       __in                            efx_nic_t *enp,
+       __out                           efx_mae_actions_t **specp)
+{
+       efx_mae_actions_t *spec;
+       efx_rc_t rc;
+
+       EFSYS_KMEM_ALLOC(enp->en_esip, sizeof (*spec), spec);
+       if (spec == NULL) {
+               rc = ENOMEM;
+               goto fail1;
+       }
+
+       *specp = spec;
+
+       return (0);
+
+fail1:
+       EFSYS_PROBE1(fail1, efx_rc_t, rc);
+       return (rc);
+}
+
+                                       void
+efx_mae_action_set_spec_fini(
+       __in                            efx_nic_t *enp,
+       __in                            efx_mae_actions_t *spec)
+{
+       EFSYS_KMEM_FREE(enp->en_esip, sizeof (*spec), spec);
+}
+
+       __checkReturn                   boolean_t
+efx_mae_action_set_specs_equal(
+       __in                            const efx_mae_actions_t *left,
+       __in                            const efx_mae_actions_t *right)
+{
+       return ((memcmp(left, right, sizeof (*left)) == 0) ? B_TRUE : B_FALSE);
+}
+
        __checkReturn                   efx_rc_t
 efx_mae_match_specs_class_cmp(
        __in                            efx_nic_t *enp,
index aeb6f4d..8a4d2b2 100644 (file)
@@ -85,6 +85,9 @@ INTERNAL {
        efx_mac_stats_upload;
        efx_mac_up;
 
+       efx_mae_action_set_spec_fini;
+       efx_mae_action_set_spec_init;
+       efx_mae_action_set_specs_equal;
        efx_mae_fini;
        efx_mae_get_limits;
        efx_mae_init;