summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYin Honghua-R63875 <Hong-Hua.Yin@freescale.com>2015-11-24 06:43:01 (GMT)
committerYin Honghua-R63875 <Hong-Hua.Yin@freescale.com>2015-11-24 06:43:01 (GMT)
commitfd8e7c71bf30389a5145efc9d088775e0f22402c (patch)
tree948300f57ef8d1bca163fbc1102ccb480ee6ef87
parent1c291fd8f4204f5515e27cbd2e7413320efd3b0b (diff)
parenta9d0ea5a4d3b679ae3316c93b455d2ccc993772d (diff)
downloadlinux-fsl-qoriq-fd8e7c71bf30389a5145efc9d088775e0f22402c.tar.xz
Merge pull request #69 in SDK/linux-devel from ~R27762/linux-devel:add_hm_node_stats to master
* commit 'a9d0ea5a4d3b679ae3316c93b455d2ccc993772d': fmd: Render header manip node statistics available in user space
-rw-r--r--drivers/net/ethernet/freescale/fman/src/wrapper/lnxwrp_ioctls_fm.c71
-rw-r--r--drivers/net/ethernet/freescale/fman/src/wrapper/lnxwrp_ioctls_fm_compat.c24
-rw-r--r--drivers/net/ethernet/freescale/fman/src/wrapper/lnxwrp_ioctls_fm_compat.h10
-rw-r--r--include/uapi/linux/fmd/Peripherals/fm_pcd_ioctls.h25
4 files changed, 130 insertions, 0 deletions
diff --git a/drivers/net/ethernet/freescale/fman/src/wrapper/lnxwrp_ioctls_fm.c b/drivers/net/ethernet/freescale/fman/src/wrapper/lnxwrp_ioctls_fm.c
index caebc2e..b25ff3d 100644
--- a/drivers/net/ethernet/freescale/fman/src/wrapper/lnxwrp_ioctls_fm.c
+++ b/drivers/net/ethernet/freescale/fman/src/wrapper/lnxwrp_ioctls_fm.c
@@ -2893,6 +2893,77 @@ invalid_port_id:
break;
}
+#if defined(CONFIG_COMPAT)
+ case FM_PCD_IOC_MANIP_GET_STATS_COMPAT:
+#endif
+ case FM_PCD_IOC_MANIP_GET_STATS:
+ {
+ ioc_fm_pcd_manip_get_stats_t param;
+
+#if defined(CONFIG_COMPAT)
+ if (compat)
+ {
+ ioc_compat_fm_pcd_manip_get_stats_t *compat_param;
+
+ compat_param = (ioc_compat_fm_pcd_manip_get_stats_t *) XX_Malloc(
+ sizeof(ioc_compat_fm_pcd_manip_get_stats_t));
+ if (!compat_param)
+ RETURN_ERROR(MINOR, E_NO_MEMORY, ("IOCTL FM PCD"));
+
+ memset(compat_param, 0, sizeof(ioc_compat_fm_pcd_manip_get_stats_t));
+ if (copy_from_user(compat_param,
+ (ioc_compat_fm_pcd_manip_get_stats_t *)compat_ptr(arg),
+ sizeof(ioc_compat_fm_pcd_manip_get_stats_t)))
+ {
+ XX_Free(compat_param);
+ RETURN_ERROR(MINOR, E_WRITE_FAILED, NO_MSG);
+ }
+
+ compat_copy_fm_pcd_manip_get_stats(compat_param, &param, COMPAT_US_TO_K);
+
+ XX_Free(compat_param);
+ }
+ else
+#endif
+ {
+ if (copy_from_user(&param, (ioc_fm_pcd_manip_get_stats_t *)arg,
+ sizeof(ioc_fm_pcd_manip_get_stats_t)))
+ RETURN_ERROR(MINOR, E_WRITE_FAILED, NO_MSG);
+ }
+
+ err = FM_PCD_ManipGetStatistics((t_Handle) param.id,
+ (t_FmPcdManipStats*) &param.stats);
+
+#if defined(CONFIG_COMPAT)
+ if (compat)
+ {
+ ioc_compat_fm_pcd_manip_get_stats_t *compat_param;
+
+ compat_param = (ioc_compat_fm_pcd_manip_get_stats_t*) XX_Malloc(
+ sizeof(ioc_compat_fm_pcd_manip_get_stats_t));
+ if (!compat_param)
+ RETURN_ERROR(MINOR, E_NO_MEMORY, ("IOCTL FM PCD"));
+
+ memset(compat_param, 0, sizeof(ioc_compat_fm_pcd_manip_get_stats_t));
+ compat_copy_fm_pcd_manip_get_stats(compat_param, &param, COMPAT_K_TO_US);
+ if (copy_to_user((ioc_compat_fm_pcd_manip_get_stats_t*) compat_ptr(arg),
+ compat_param,
+ sizeof(ioc_compat_fm_pcd_manip_get_stats_t))){
+ XX_Free(compat_param);
+ RETURN_ERROR(MINOR, E_READ_FAILED, NO_MSG);
+ }
+ XX_Free(compat_param);
+ }
+ else
+#endif
+ if (copy_to_user((ioc_fm_pcd_manip_get_stats_t *)arg,
+ &param,
+ sizeof(ioc_fm_pcd_manip_get_stats_t)))
+ RETURN_ERROR(MINOR, E_READ_FAILED, NO_MSG);
+
+ break;
+ }
+
#if (DPAA_VERSION >= 11)
#if defined(CONFIG_COMPAT)
case FM_PCD_IOC_FRM_REPLIC_GROUP_SET_COMPAT:
diff --git a/drivers/net/ethernet/freescale/fman/src/wrapper/lnxwrp_ioctls_fm_compat.c b/drivers/net/ethernet/freescale/fman/src/wrapper/lnxwrp_ioctls_fm_compat.c
index baf2a33..5d2d306 100644
--- a/drivers/net/ethernet/freescale/fman/src/wrapper/lnxwrp_ioctls_fm_compat.c
+++ b/drivers/net/ethernet/freescale/fman/src/wrapper/lnxwrp_ioctls_fm_compat.c
@@ -1099,6 +1099,30 @@ void compat_fm_pcd_manip_set_node(
}
}
+void compat_copy_fm_pcd_manip_get_stats(
+ ioc_compat_fm_pcd_manip_get_stats_t *compat_param,
+ ioc_fm_pcd_manip_get_stats_t *param,
+ uint8_t compat)
+{
+ _fm_cpt_dbg (compat, " {->...\n");
+
+ if (compat == COMPAT_US_TO_K)
+ {
+ param->id = compat_pcd_id2ptr(compat_param->id);
+ memcpy(&param->stats, &compat_param->stats,
+ sizeof(ioc_fm_pcd_manip_stats_t));
+ }
+ else
+ {
+ compat_param->id = compat_add_ptr2id(param->id,
+ FM_MAP_TYPE_PCD_NODE);
+ memcpy(&compat_param->stats, &param->stats,
+ sizeof(ioc_fm_pcd_manip_stats_t));
+ }
+
+ _fm_cpt_dbg (compat, " ...->}\n");
+}
+
#if (DPAA_VERSION >= 11)
void compat_copy_fm_pcd_frm_replic_group_params(
ioc_compat_fm_pcd_frm_replic_group_params_t *compat_param,
diff --git a/drivers/net/ethernet/freescale/fman/src/wrapper/lnxwrp_ioctls_fm_compat.h b/drivers/net/ethernet/freescale/fman/src/wrapper/lnxwrp_ioctls_fm_compat.h
index e2f779a..3b6fb59 100644
--- a/drivers/net/ethernet/freescale/fman/src/wrapper/lnxwrp_ioctls_fm_compat.h
+++ b/drivers/net/ethernet/freescale/fman/src/wrapper/lnxwrp_ioctls_fm_compat.h
@@ -485,6 +485,11 @@ typedef struct ioc_compat_fm_pcd_manip_params_t {
compat_uptr_t id;
} ioc_compat_fm_pcd_manip_params_t;
+typedef struct ioc_compat_fm_pcd_manip_get_stats_t {
+ compat_uptr_t id;
+ ioc_fm_pcd_manip_stats_t stats;
+} ioc_compat_fm_pcd_manip_get_stats_t;
+
#if (DPAA_VERSION >= 11)
typedef struct ioc_compat_fm_pcd_frm_replic_group_params_t {
uint8_t max_num_of_entries;
@@ -672,6 +677,11 @@ void compat_fm_pcd_manip_set_node(
ioc_fm_pcd_manip_params_t *param,
uint8_t compat);
+void compat_copy_fm_pcd_manip_get_stats(
+ ioc_compat_fm_pcd_manip_get_stats_t *compat_param,
+ ioc_fm_pcd_manip_get_stats_t *param,
+ uint8_t compat);
+
void compat_copy_fm_port_pcd_modify_tree(
ioc_compat_fm_obj_t *compat_id,
ioc_fm_obj_t *id,
diff --git a/include/uapi/linux/fmd/Peripherals/fm_pcd_ioctls.h b/include/uapi/linux/fmd/Peripherals/fm_pcd_ioctls.h
index 99f654b..ad655cc 100644
--- a/include/uapi/linux/fmd/Peripherals/fm_pcd_ioctls.h
+++ b/include/uapi/linux/fmd/Peripherals/fm_pcd_ioctls.h
@@ -2331,6 +2331,14 @@ typedef struct ioc_fm_pcd_manip_stats_t {
} u;
} ioc_fm_pcd_manip_stats_t;
+/**************************************************************************//**
+ @Description Parameters for acquiring manipulation statistics
+*//***************************************************************************/
+typedef struct ioc_fm_pcd_manip_get_stats_t {
+ void *id;
+ ioc_fm_pcd_manip_stats_t stats;
+} ioc_fm_pcd_manip_get_stats_t;
+
#if DPAA_VERSION >= 11
/**************************************************************************//**
@Description Parameters for defining frame replicator group and its members
@@ -2897,6 +2905,23 @@ typedef struct ioc_fm_pcd_cc_tbl_get_stats_t {
#define FM_PCD_IOC_MANIP_NODE_DELETE _IOW(FM_IOC_TYPE_BASE, FM_PCD_IOC_NUM(44), ioc_fm_obj_t)
/**************************************************************************//**
+ @Function FM_PCD_ManipGetStatistics
+
+ @Description Retrieve the manipulation statistics.
+
+ @Param[in] h_ManipNode A handle to a manipulation node.
+ @Param[out] p_FmPcdManipStats A structure for retrieving the manipulation statistics
+
+ @Return E_OK on success; Error code otherwise.
+
+ @Cautions Allowed only following FM_PCD_ManipNodeSet().
+*//***************************************************************************/
+#if defined(CONFIG_COMPAT)
+#define FM_PCD_IOC_MANIP_GET_STATS_COMPAT _IOWR(FM_IOC_TYPE_BASE, FM_PCD_IOC_NUM(50), ioc_compat_fm_pcd_manip_get_stats_t)
+#endif
+#define FM_PCD_IOC_MANIP_GET_STATS _IOWR(FM_IOC_TYPE_BASE, FM_PCD_IOC_NUM(50), ioc_fm_pcd_manip_get_stats_t)
+
+/**************************************************************************//**
@Function FM_PCD_SetAdvancedOffloadSupport
@Description This routine must be called in order to support the following features: