diff options
author | Marian Chereji <marian.chereji@freescale.com> | 2013-07-30 15:21:39 (GMT) |
---|---|---|
committer | Schmitt Richard-B43082 <B43082@freescale.com> | 2013-08-08 20:28:52 (GMT) |
commit | 56fefd712b54327e340ece05a7f115a1d5af5fff (patch) | |
tree | d6462ce78a46d7c43fc5d0e9c542e135afde21b5 | |
parent | 605d2ad9a561593fa1187b72568fc9b353815a2f (diff) | |
download | linux-fsl-qoriq-56fefd712b54327e340ece05a7f115a1d5af5fff.tar.xz |
dpa_offload: Add possibility to query classification table miss action details
Added a new function to query classification table miss action details.
This function is only advertised as internal API and is needed by the
DPA Stats component to acquire Miss Action Statistics.
Signed-off-by: Marian Chereji <marian.chereji@freescale.com>
Change-Id: If9f506316c887bc44ebd5363c526a8f4fda3da1c
Reviewed-on: http://git.am.freescale.net:8181/3829
Reviewed-by: Schmitt Richard-B43082 <B43082@freescale.com>
Tested-by: Schmitt Richard-B43082 <B43082@freescale.com>
-rw-r--r-- | drivers/staging/fsl_dpa_offload/dpa_classifier.c | 23 | ||||
-rw-r--r-- | drivers/staging/fsl_dpa_offload/dpa_classifier.h | 9 |
2 files changed, 32 insertions, 0 deletions
diff --git a/drivers/staging/fsl_dpa_offload/dpa_classifier.c b/drivers/staging/fsl_dpa_offload/dpa_classifier.c index a39fc69..5056b2e 100644 --- a/drivers/staging/fsl_dpa_offload/dpa_classifier.c +++ b/drivers/staging/fsl_dpa_offload/dpa_classifier.c @@ -462,6 +462,9 @@ int dpa_classif_table_modify_miss_action(int td, return -EBUSY; } } + + memcpy(&ptable->miss_action, miss_action, sizeof(*miss_action)); + RELEASE_OBJECT(ptable); dpa_cls_dbg(("DEBUG: dpa_classifier %s (%d) <--\n", __func__, @@ -3230,6 +3233,26 @@ static inline void key_apply_mask(const struct dpa_offload_lookup_key *key, new_key[i] = key->byte[i] & key->mask[i]; } +int dpa_classif_get_miss_action(int td, struct dpa_cls_tbl_action *miss_action) +{ + struct dpa_cls_table *ptable; + + if (!miss_action) + return -EINVAL; + + LOCK_OBJECT(table_array, td, ptable, -EINVAL); + if (ptable->miss_action.type == DPA_CLS_TBL_ACTION_NONE) { + /* No miss action was specified for this table */ + RELEASE_OBJECT(ptable); + return -ENODEV; + } else + memcpy(miss_action, &ptable->miss_action, sizeof(*miss_action)); + + RELEASE_OBJECT(ptable); + + return 0; +} + static int nat_hm_check_params(const struct dpa_cls_hm_nat_params *nat_params) { unsigned int ip_ver = 0; diff --git a/drivers/staging/fsl_dpa_offload/dpa_classifier.h b/drivers/staging/fsl_dpa_offload/dpa_classifier.h index 0667782..659e1b7 100644 --- a/drivers/staging/fsl_dpa_offload/dpa_classifier.h +++ b/drivers/staging/fsl_dpa_offload/dpa_classifier.h @@ -206,6 +206,9 @@ struct dpa_cls_table { /* (Initial) parameters of the DPA Classifier table. */ struct dpa_cls_tbl_params params; + /* Table miss action. */ + struct dpa_cls_tbl_action miss_action; + /* Access control object for this table to avoid race conditions. */ struct mutex access; }; @@ -675,6 +678,12 @@ int dpa_classif_import_static_hm(void *hm, int next_hmd, int *hmd); void *dpa_classif_get_static_hm_handle(int hmd); /* + * Provides details about the miss action configured on a classification + * table. + */ +int dpa_classif_get_miss_action(int td, struct dpa_cls_tbl_action *miss_action); + +/* * Locks a header manipulation chain (marks as "used"). The header manipulation * operations cannot be removed as long as they are locked. The function * provides the FMan driver handle of the manip node which is chain head. |