[qca-ssdk]Add default flow forward command
When flow mismatch, default traffic forward
behavior can be defined by customer so that
default traffic can follow customer's request
Remove some blank char
Change-Id: Ice00fd9a91fc8b8060e7583f3ae9cf59c0dd3256
Signed-off-by: Zou Shunxiang <shunxian@codeaurora.org>
diff --git a/include/api/api_desc.h b/include/api/api_desc.h
index 3b1404c..428c0af 100755
--- a/include/api/api_desc.h
+++ b/include/api/api_desc.h
@@ -2137,6 +2137,30 @@
SW_PARAM_DEF(SW_API_IP_RFS_IP6_DEL, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
SW_PARAM_DEF(SW_API_IP_RFS_IP6_DEL, SW_IP_RFS_IP6, sizeof(fal_ip6_rfs_t), SW_PARAM_PTR|SW_PARAM_IN, "RfsIp6"),
+#define SW_API_IP_DEFAULT_FLOW_CMD_SET_DESC \
+ SW_PARAM_DEF(SW_API_IP_DEFAULT_FLOW_CMD_SET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_IP_DEFAULT_FLOW_CMD_SET, SW_UINT32, 4, SW_PARAM_IN, "Vrf ID"), \
+ SW_PARAM_DEF(SW_API_IP_DEFAULT_FLOW_CMD_SET, SW_FLOWTYPE, sizeof(fal_flow_type_t), SW_PARAM_IN, "FlowType"), \
+ SW_PARAM_DEF(SW_API_IP_DEFAULT_FLOW_CMD_SET, SW_FLOWCMD, sizeof(fal_default_flow_cmd_t), SW_PARAM_IN, "FlowCmd"),
+
+#define SW_API_IP_DEFAULT_FLOW_CMD_GET_DESC \
+ SW_PARAM_DEF(SW_API_IP_DEFAULT_FLOW_CMD_GET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_IP_DEFAULT_FLOW_CMD_GET, SW_UINT32, 4, SW_PARAM_IN, "Vrf ID"), \
+ SW_PARAM_DEF(SW_API_IP_DEFAULT_FLOW_CMD_GET, SW_FLOWTYPE, sizeof(fal_flow_type_t), SW_PARAM_IN, "FlowType"), \
+ SW_PARAM_DEF(SW_API_IP_DEFAULT_FLOW_CMD_GET, SW_FLOWCMD, sizeof(fal_default_flow_cmd_t), SW_PARAM_PTR|SW_PARAM_OUT, "FlowCmd"),
+
+#define SW_API_IP_DEFAULT_RT_FLOW_CMD_SET_DESC \
+ SW_PARAM_DEF(SW_API_IP_DEFAULT_RT_FLOW_CMD_SET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_IP_DEFAULT_RT_FLOW_CMD_SET, SW_UINT32, 4, SW_PARAM_IN, "Vrf ID"), \
+ SW_PARAM_DEF(SW_API_IP_DEFAULT_RT_FLOW_CMD_SET, SW_FLOWTYPE, sizeof(fal_flow_type_t), SW_PARAM_IN, "FlowType"), \
+ SW_PARAM_DEF(SW_API_IP_DEFAULT_RT_FLOW_CMD_SET, SW_FLOWCMD, sizeof(fal_default_flow_cmd_t), SW_PARAM_IN, "FlowCmd"),
+
+#define SW_API_IP_DEFAULT_RT_FLOW_CMD_GET_DESC \
+ SW_PARAM_DEF(SW_API_IP_DEFAULT_RT_FLOW_CMD_GET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
+ SW_PARAM_DEF(SW_API_IP_DEFAULT_RT_FLOW_CMD_GET, SW_UINT32, 4, SW_PARAM_IN, "Vrf ID"), \
+ SW_PARAM_DEF(SW_API_IP_DEFAULT_RT_FLOW_CMD_GET, SW_FLOWTYPE, sizeof(fal_flow_type_t), SW_PARAM_IN, "FlowType"), \
+ SW_PARAM_DEF(SW_API_IP_DEFAULT_RT_FLOW_CMD_GET, SW_FLOWCMD, sizeof(fal_default_flow_cmd_t), SW_PARAM_PTR|SW_PARAM_OUT, "FlowCmd"),
+
#define SW_API_NAT_ADD_DESC \
diff --git a/include/api/sw_api.h b/include/api/sw_api.h
index 76b17bf..4861a75 100755
--- a/include/api/sw_api.h
+++ b/include/api/sw_api.h
@@ -62,6 +62,8 @@
SW_STP,
SW_LEAKY,
SW_MACCMD,
+ SW_FLOWTYPE,
+ SW_FLOWCMD,
SW_UINT_A,
SW_ACLRULE,
SW_LEDPATTERN,
diff --git a/include/api/sw_ioctl.h b/include/api/sw_ioctl.h
index 79cfd54..a92fd0c 100755
--- a/include/api/sw_ioctl.h
+++ b/include/api/sw_ioctl.h
@@ -502,8 +502,10 @@
#define SW_API_IP_RFS_IP6_SET (38 + SW_API_IP_OFFSET)
#define SW_API_IP_RFS_IP4_DEL (39 + SW_API_IP_OFFSET)
#define SW_API_IP_RFS_IP6_DEL (40 + SW_API_IP_OFFSET)
-
-
+#define SW_API_IP_DEFAULT_FLOW_CMD_SET (41 + SW_API_IP_OFFSET)
+#define SW_API_IP_DEFAULT_FLOW_CMD_GET (42 + SW_API_IP_OFFSET)
+#define SW_API_IP_DEFAULT_RT_FLOW_CMD_SET (43 + SW_API_IP_OFFSET)
+#define SW_API_IP_DEFAULT_RT_FLOW_CMD_GET (44 + SW_API_IP_OFFSET)
/* nat */
diff --git a/include/fal/fal_api.h b/include/fal/fal_api.h
index 2763ebb..afc4739 100755
--- a/include/fal/fal_api.h
+++ b/include/fal/fal_api.h
@@ -961,7 +961,11 @@
SW_API_DEF(SW_API_IP_RFS_IP4_SET, fal_ip_rfs_ip4_rule_set), \
SW_API_DEF(SW_API_IP_RFS_IP6_SET, fal_ip_rfs_ip6_rule_set), \
SW_API_DEF(SW_API_IP_RFS_IP4_DEL, fal_ip_rfs_ip4_rule_del), \
- SW_API_DEF(SW_API_IP_RFS_IP6_DEL, fal_ip_rfs_ip6_rule_del),
+ SW_API_DEF(SW_API_IP_RFS_IP6_DEL, fal_ip_rfs_ip6_rule_del), \
+ SW_API_DEF(SW_API_IP_DEFAULT_FLOW_CMD_SET, fal_default_flow_cmd_set), \
+ SW_API_DEF(SW_API_IP_DEFAULT_FLOW_CMD_GET, fal_default_flow_cmd_get), \
+ SW_API_DEF(SW_API_IP_DEFAULT_RT_FLOW_CMD_SET, fal_default_rt_flow_cmd_set), \
+ SW_API_DEF(SW_API_IP_DEFAULT_RT_FLOW_CMD_GET, fal_default_rt_flow_cmd_get),
#define IP_API_PARAM \
SW_API_DESC(SW_API_IP_HOST_ADD) \
@@ -1004,7 +1008,11 @@
SW_API_DESC(SW_API_IP_RFS_IP4_SET) \
SW_API_DESC(SW_API_IP_RFS_IP6_SET) \
SW_API_DESC(SW_API_IP_RFS_IP4_DEL) \
- SW_API_DESC(SW_API_IP_RFS_IP6_DEL)
+ SW_API_DESC(SW_API_IP_RFS_IP6_DEL) \
+ SW_API_DESC(SW_API_IP_DEFAULT_FLOW_CMD_SET) \
+ SW_API_DESC(SW_API_IP_DEFAULT_FLOW_CMD_GET) \
+ SW_API_DESC(SW_API_IP_DEFAULT_RT_FLOW_CMD_SET) \
+ SW_API_DESC(SW_API_IP_DEFAULT_RT_FLOW_CMD_GET)
#else
#define IP_API
#define IP_API_PARAM
diff --git a/include/fal/fal_ip.h b/include/fal/fal_ip.h
index df2d28f..9b136fc 100755
--- a/include/fal/fal_ip.h
+++ b/include/fal/fal_ip.h
@@ -80,6 +80,22 @@
typedef enum
{
+ FAL_DEFAULT_FLOW_FORWARD = 0,
+ FAL_DEFAULT_FLOW_DROP,
+ FAL_DEFAULT_FLOW_RDT_TO_CPU,
+ FAL_DEFAULT_FLOW_ADMIT_ALL,
+ } fal_default_flow_cmd_t;
+
+ typedef enum
+ {
+ FAL_FLOW_LAN_TO_LAN = 0,
+ FAL_FLOW_WAN_TO_LAN,
+ FAL_FLOW_LAN_TO_WAN,
+ FAL_FLOW_WAN_TO_WAN,
+ } fal_flow_type_t;
+
+ typedef enum
+ {
FAL_ARP_LEARN_LOCAL = 0,
FAL_ARP_LEARN_ALL,
} fal_arp_learn_mode_t;
@@ -285,6 +301,22 @@
sw_error_t
fal_ip_rfs_ip6_rule_del(a_uint32_t dev_id, fal_ip6_rfs_t * rfs);
+ sw_error_t
+ fal_default_flow_cmd_set(a_uint32_t dev_id, a_uint32_t vrf_id,
+ fal_flow_type_t type, fal_default_flow_cmd_t cmd);
+
+ sw_error_t
+ fal_default_flow_cmd_get(a_uint32_t dev_id, a_uint32_t vrf_id,
+ fal_flow_type_t type, fal_default_flow_cmd_t * cmd);
+
+ sw_error_t
+ fal_default_rt_flow_cmd_set(a_uint32_t dev_id, a_uint32_t vrf_id,
+ fal_flow_type_t type, fal_default_flow_cmd_t cmd);
+
+ sw_error_t
+ fal_default_rt_flow_cmd_get(a_uint32_t dev_id, a_uint32_t vrf_id,
+ fal_flow_type_t type, fal_default_flow_cmd_t * cmd);
+
#ifdef __cplusplus
}
#endif /* __cplusplus */
diff --git a/include/hsl/dess/dess_api.h b/include/hsl/dess/dess_api.h
index 98cc9fd..e8b44aa 100755
--- a/include/hsl/dess/dess_api.h
+++ b/include/hsl/dess/dess_api.h
@@ -861,7 +861,11 @@
SW_API_DEF(SW_API_IP_AGE_TIME_SET, dess_ip_age_time_set), \
SW_API_DEF(SW_API_IP_AGE_TIME_GET, dess_ip_age_time_get), \
SW_API_DEF(SW_API_WCMP_HASH_MODE_SET, dess_ip_wcmp_hash_mode_set), \
- SW_API_DEF(SW_API_WCMP_HASH_MODE_GET, dess_ip_wcmp_hash_mode_get),
+ SW_API_DEF(SW_API_WCMP_HASH_MODE_GET, dess_ip_wcmp_hash_mode_get), \
+ SW_API_DEF(SW_API_IP_DEFAULT_FLOW_CMD_SET, dess_default_flow_cmd_set), \
+ SW_API_DEF(SW_API_IP_DEFAULT_FLOW_CMD_GET, dess_default_flow_cmd_get), \
+ SW_API_DEF(SW_API_IP_DEFAULT_RT_FLOW_CMD_SET, dess_default_rt_flow_cmd_set), \
+ SW_API_DEF(SW_API_IP_DEFAULT_RT_FLOW_CMD_GET, dess_default_rt_flow_cmd_get),
#define IP_API_PARAM \
SW_API_DESC(SW_API_IP_HOST_ADD) \
@@ -890,7 +894,11 @@
SW_API_DESC(SW_API_IP_AGE_TIME_SET) \
SW_API_DESC(SW_API_IP_AGE_TIME_GET) \
SW_API_DESC(SW_API_WCMP_HASH_MODE_SET) \
- SW_API_DESC(SW_API_WCMP_HASH_MODE_GET)
+ SW_API_DESC(SW_API_WCMP_HASH_MODE_GET) \
+ SW_API_DESC(SW_API_IP_DEFAULT_FLOW_CMD_SET) \
+ SW_API_DESC(SW_API_IP_DEFAULT_FLOW_CMD_GET) \
+ SW_API_DESC(SW_API_IP_DEFAULT_RT_FLOW_CMD_SET) \
+ SW_API_DESC(SW_API_IP_DEFAULT_RT_FLOW_CMD_GET)
#else
#define IP_API
diff --git a/include/hsl/dess/dess_ip.h b/include/hsl/dess/dess_ip.h
index d4034e0..339bd83 100755
--- a/include/hsl/dess/dess_ip.h
+++ b/include/hsl/dess/dess_ip.h
@@ -181,6 +181,18 @@
HSL_LOCAL sw_error_t
dess_ip_host_route_get(a_uint32_t dev_id, a_uint32_t hroute_id, fal_host_route_t * entry);
+ HSL_LOCAL sw_error_t
+ dess_default_flow_cmd_set(a_uint32_t dev_id, a_uint32_t vrf_id, fal_flow_type_t type, fal_default_flow_cmd_t cmd);
+
+ HSL_LOCAL sw_error_t
+ dess_default_flow_cmd_get(a_uint32_t dev_id, a_uint32_t vrf_id, fal_flow_type_t type, fal_default_flow_cmd_t * cmd);
+
+ HSL_LOCAL sw_error_t
+ dess_default_rt_flow_cmd_set(a_uint32_t dev_id, a_uint32_t vrf_id, fal_flow_type_t type, fal_default_flow_cmd_t cmd);
+
+ HSL_LOCAL sw_error_t
+ dess_default_rt_flow_cmd_get(a_uint32_t dev_id, a_uint32_t vrf_id, fal_flow_type_t type, fal_default_flow_cmd_t * cmd);
+
#endif
#ifdef __cplusplus
diff --git a/include/hsl/dess/dess_reg.h b/include/hsl/dess/dess_reg.h
index 84ad17b..48c5a2e 100755
--- a/include/hsl/dess/dess_reg.h
+++ b/include/hsl/dess/dess_reg.h
@@ -4015,6 +4015,60 @@
+#define FlOW_CMD_CTL
+#define FlOW_CMD_CTL_OFFSET 0x0ea0
+#define FlOW_CMD_CTL_E_LENGTH 4
+#define FlOW_CMD_CTL_E_OFFSET 0x0
+#define FlOW_CMD_CTL_NR_E 8
+
+#define LAN_2_LAN_DEFAULT
+#define FlOW_CMD_CTL_LAN_2_LAN_DEFAULT_BOFFSET 26
+#define FlOW_CMD_CTL_LAN_2_LAN_DEFAULT_BLEN 2
+#define FlOW_CMD_CTL_LAN_2_LAN_DEFAULT_FLAG HSL_RW
+
+#define WAN_2_LAN_DEFAULT
+#define FlOW_CMD_CTL_WAN_2_LAN_DEFAULT_BOFFSET 24
+#define FlOW_CMD_CTL_WAN_2_LAN_DEFAULT_BLEN 2
+#define FlOW_CMD_CTL_WAN_2_LAN_DEFAULT_FLAG HSL_RW
+
+#define LAN_2_WAN_DEFAULT
+#define FlOW_CMD_CTL_LAN_2_WAN_DEFAULT_BOFFSET 22
+#define FlOW_CMD_CTL_LAN_2_WAN_DEFAULT_BLEN 2
+#define FlOW_CMD_CTL_LAN_2_WAN_DEFAULT_FLAG HSL_RW
+
+#define WAN_2_WAN_DEFAULT
+#define FlOW_CMD_CTL_WAN_2_WAN_DEFAULT_BOFFSET 20
+#define FlOW_CMD_CTL_WAN_2_WAN_DEFAULT_BLEN 2
+#define FlOW_CMD_CTL_WAN_2_WAN_DEFAULT_FLAG HSL_RW
+
+
+#define FlOW_RT_CMD_CTL
+#define FlOW_RT_CMD_CTL_OFFSET 0x0ec0
+#define FlOW_RT_CMD_CTL_E_LENGTH 4
+#define FlOW_RT_CMD_CTL_E_OFFSET 0x0
+#define FlOW_RT_CMD_CTL_NR_E 8
+
+#define LAN_2_LAN_DEFAULT
+#define FlOW_RT_CMD_CTL_LAN_2_LAN_DEFAULT_BOFFSET 26
+#define FlOW_RT_CMD_CTL_LAN_2_LAN_DEFAULT_BLEN 2
+#define FlOW_RT_CMD_CTL_LAN_2_LAN_DEFAULT_FLAG HSL_RW
+
+#define WAN_2_LAN_DEFAULT
+#define FlOW_RT_CMD_CTL_WAN_2_LAN_DEFAULT_BOFFSET 24
+#define FlOW_RT_CMD_CTL_WAN_2_LAN_DEFAULT_BLEN 2
+#define FlOW_RT_CMD_CTL_WAN_2_LAN_DEFAULT_FLAG HSL_RW
+
+#define LAN_2_WAN_DEFAULT
+#define FlOW_RT_CMD_CTL_LAN_2_WAN_DEFAULT_BOFFSET 22
+#define FlOW_RT_CMD_CTL_LAN_2_WAN_DEFAULT_BLEN 2
+#define FlOW_RT_CMD_CTL_LAN_2_WAN_DEFAULT_FLAG HSL_RW
+
+#define WAN_2_WAN_DEFAULT
+#define FlOW_RT_CMD_CTL_WAN_2_WAN_DEFAULT_BOFFSET 20
+#define FlOW_RT_CMD_CTL_WAN_2_WAN_DEFAULT_BLEN 2
+#define FlOW_RT_CMD_CTL_WAN_2_WAN_DEFAULT_FLAG HSL_RW
+
+
#define PRV_BASEADDR
#define PRV_BASEADDR_OFFSET 0x0e5c
diff --git a/include/hsl/hsl_api.h b/include/hsl/hsl_api.h
index c9e94d7..4239ee5 100755
--- a/include/hsl/hsl_api.h
+++ b/include/hsl/hsl_api.h
@@ -1497,6 +1497,7 @@
typedef sw_error_t
(*hsl_ip_wcmp_entry_get)(a_uint32_t dev_id,
a_uint32_t wcmp_id, fal_ip_wcmp_t * wcmp);
+
typedef sw_error_t
(*hsl_ip_rfs_ip4_set)(a_uint32_t dev_id,
fal_ip4_rfs_t * rfs);
@@ -1512,6 +1513,22 @@
(*hsl_ip_rfs_ip6_del)(a_uint32_t dev_id,
fal_ip6_rfs_t * rfs);
+ typedef sw_error_t
+ (*hsl_default_flow_cmd_set)(a_uint32_t dev_id,
+ a_uint32_t vrf_id, fal_flow_type_t type, fal_default_flow_cmd_t cmd);
+
+ typedef sw_error_t
+ (*hsl_default_flow_cmd_get)(a_uint32_t dev_id,
+ a_uint32_t vrf_id, fal_flow_type_t type, fal_default_flow_cmd_t * cmd);
+
+ typedef sw_error_t
+ (*hsl_default_rt_flow_cmd_set)(a_uint32_t dev_id,
+ a_uint32_t vrf_id, fal_flow_type_t type, fal_default_flow_cmd_t cmd);
+
+ typedef sw_error_t
+ (*hsl_default_rt_flow_cmd_get)(a_uint32_t dev_id,
+ a_uint32_t vrf_id, fal_flow_type_t type, fal_default_flow_cmd_t * cmd);
+
/* NAT */
#define NAT_FUNC_PROTOTYPE_DEF
typedef sw_error_t
@@ -2164,6 +2181,10 @@
hsl_ip_rfs_ip6_set ip_rfs_ip6_set;
hsl_ip_rfs_ip4_del ip_rfs_ip4_del;
hsl_ip_rfs_ip6_del ip_rfs_ip6_del;
+ hsl_default_flow_cmd_set ip_default_flow_cmd_set;
+ hsl_default_flow_cmd_get ip_default_flow_cmd_get;
+ hsl_default_rt_flow_cmd_set ip_default_rt_flow_cmd_set;
+ hsl_default_rt_flow_cmd_get ip_default_rt_flow_cmd_get;
/* NAT */
hsl_nat_add nat_add;
diff --git a/include/shell_lib/shell_io.h b/include/shell_lib/shell_io.h
index eeccbe7..b9816fd 100755
--- a/include/shell_lib/shell_io.h
+++ b/include/shell_lib/shell_io.h
@@ -74,6 +74,10 @@
a_uint32_t size);
sw_error_t cmd_data_check_maccmd(char *cmdstr, fal_fwd_cmd_t * val,
a_uint32_t size);
+sw_error_t cmd_data_check_flowcmd(char *cmdstr, fal_default_flow_cmd_t * val,
+ a_uint32_t size);
+sw_error_t cmd_data_check_flowtype(char *cmdstr, fal_flow_type_t * val,
+ a_uint32_t size);
sw_error_t cmd_data_check_ledpattern(char *info, void * val, a_uint32_t size);
diff --git a/src/fal/fal_ip.c b/src/fal/fal_ip.c
index 531bf3f..f1ba745 100755
--- a/src/fal/fal_ip.c
+++ b/src/fal/fal_ip.c
@@ -663,6 +663,69 @@
return rv;
}
+static sw_error_t
+_fal_default_flow_cmd_set(a_uint32_t dev_id, a_uint32_t vrf_id,
+ fal_flow_type_t type, fal_default_flow_cmd_t cmd)
+{
+ sw_error_t rv;
+ hsl_api_t *p_api;
+
+ SW_RTN_ON_NULL(p_api = hsl_api_ptr_get(dev_id));
+
+ if (NULL == p_api->ip_default_flow_cmd_set)
+ return SW_NOT_SUPPORTED;
+
+ rv = p_api->ip_default_flow_cmd_set(dev_id, vrf_id, type, cmd);
+ return rv;
+}
+
+sw_error_t
+_fal_default_flow_cmd_get(a_uint32_t dev_id, a_uint32_t vrf_id,
+ fal_flow_type_t type, fal_default_flow_cmd_t * cmd)
+{
+ sw_error_t rv;
+ hsl_api_t *p_api;
+
+ SW_RTN_ON_NULL(p_api = hsl_api_ptr_get(dev_id));
+
+ if (NULL == p_api->ip_default_flow_cmd_get)
+ return SW_NOT_SUPPORTED;
+
+ rv = p_api->ip_default_flow_cmd_get(dev_id, vrf_id, type, cmd);
+ return rv;
+}
+
+sw_error_t
+_fal_default_rt_flow_cmd_set(a_uint32_t dev_id, a_uint32_t vrf_id,
+ fal_flow_type_t type, fal_default_flow_cmd_t cmd)
+{
+ sw_error_t rv;
+ hsl_api_t *p_api;
+
+ SW_RTN_ON_NULL(p_api = hsl_api_ptr_get(dev_id));
+
+ if (NULL == p_api->ip_default_rt_flow_cmd_set)
+ return SW_NOT_SUPPORTED;
+
+ rv = p_api->ip_default_rt_flow_cmd_set(dev_id, vrf_id, type, cmd);
+ return rv;
+}
+
+sw_error_t
+_fal_default_rt_flow_cmd_get(a_uint32_t dev_id, a_uint32_t vrf_id,
+ fal_flow_type_t type, fal_default_flow_cmd_t * cmd)
+{
+ sw_error_t rv;
+ hsl_api_t *p_api;
+
+ SW_RTN_ON_NULL(p_api = hsl_api_ptr_get(dev_id));
+
+ if (NULL == p_api->ip_default_rt_flow_cmd_get)
+ return SW_NOT_SUPPORTED;
+
+ rv = p_api->ip_default_rt_flow_cmd_get(dev_id, vrf_id, type, cmd);
+ return rv;
+}
/**
* @brief Add one host entry to one particular device.
@@ -1396,5 +1459,85 @@
EXPORT_SYMBOL(ssdk_ip_rfs_ip6_rule_del);
/**
+ * @brief Set default flow forward command
+ * @param[in] dev_id device id
+ * @param[in] vrf_id VRF route index, from 0~7
+ * @param[in] type traffic flow type pass through switch core
+ * @param[in] fal_default_flow_cmd_t default flow forward command when flow table mismatch
+ * @return SW_OK or error code
+ */
+sw_error_t
+fal_default_flow_cmd_set(a_uint32_t dev_id, a_uint32_t vrf_id,
+ fal_flow_type_t type, fal_default_flow_cmd_t cmd)
+{
+ sw_error_t rv;
+
+ FAL_API_LOCK;
+ rv = _fal_default_flow_cmd_set(dev_id, vrf_id, type, cmd);
+ FAL_API_UNLOCK;
+ return rv;
+}
+
+/**
+ * @brief Get flow type traffic default forward command.
+ * @param[in] dev_id device id
+ * @param[in] vrf_id VRF route index, from 0~7
+ * @param[in] type traffic flow type pass through switch core
+ * @param[out] fal_default_flow_cmd_t default flow forward command when flow table mismatch
+ * @return SW_OK or error code
+ */
+sw_error_t
+fal_default_flow_cmd_get(a_uint32_t dev_id, a_uint32_t vrf_id,
+ fal_flow_type_t type, fal_default_flow_cmd_t * cmd)
+{
+ sw_error_t rv;
+
+ FAL_API_LOCK;
+ rv = _fal_default_flow_cmd_get(dev_id, vrf_id, type, cmd);
+ FAL_API_UNLOCK;
+ return rv;
+}
+
+/**
+ * @brief Set default route flow forward command
+ * @param[in] dev_id device id
+ * @param[in] vrf_id VRF route index, from 0~7
+ * @param[in] type traffic flow type pass through switch core
+ * @param[in] fal_default_flow_cmd_t default route flow forward command when flow table mismatch
+ * @return SW_OK or error code
+ */
+sw_error_t
+fal_default_rt_flow_cmd_set(a_uint32_t dev_id, a_uint32_t vrf_id,
+ fal_flow_type_t type, fal_default_flow_cmd_t cmd)
+{
+ sw_error_t rv;
+
+ FAL_API_LOCK;
+ rv = _fal_default_rt_flow_cmd_set(dev_id, vrf_id, type, cmd);
+ FAL_API_UNLOCK;
+ return rv;
+}
+
+/**
+ * @brief Get flow type traffic default forward command.
+ * @param[in] dev_id device id
+ * @param[in] vrf_id VRF route index, from 0~7
+ * @param[in] type traffic flow type pass through switch core
+ * @param[out] fal_default_flow_cmd_t default route flow forward command when flow table mismatch
+ * @return SW_OK or error code
+ */
+sw_error_t
+fal_default_rt_flow_cmd_get(a_uint32_t dev_id, a_uint32_t vrf_id,
+ fal_flow_type_t type, fal_default_flow_cmd_t * cmd)
+{
+ sw_error_t rv;
+
+ FAL_API_LOCK;
+ rv = _fal_default_rt_flow_cmd_get(dev_id, vrf_id, type, cmd);
+ FAL_API_UNLOCK;
+ return rv;
+}
+
+/**
* @}
*/
diff --git a/src/hsl/dess/dess_ip.c b/src/hsl/dess/dess_ip.c
index 9f57e6a..2ac93cc 100755
--- a/src/hsl/dess/dess_ip.c
+++ b/src/hsl/dess/dess_ip.c
@@ -2427,6 +2427,7 @@
return SW_OK;
}
+
#define RFS_ADD_OP 1
#define RFS_DEL_OP 2
static sw_error_t
@@ -2545,7 +2546,239 @@
return ret;
}
+static sw_error_t
+_dess_default_flow_cmd_set(a_uint32_t dev_id, a_uint32_t vrf_id, fal_flow_type_t type, fal_default_flow_cmd_t cmd)
+{
+ sw_error_t rv;
+ a_uint32_t data;
+ HSL_DEV_ID_CHECK(dev_id);
+
+ rv = _dess_ip_feature_check(dev_id);
+ SW_RTN_ON_ERROR(rv);
+
+ if (FAL_DEFAULT_FLOW_FORWARD == cmd)
+ {
+ data = 0;
+ }
+ else if (FAL_DEFAULT_FLOW_DROP == cmd)
+ {
+ data = 1;
+ }
+ else if (FAL_DEFAULT_FLOW_RDT_TO_CPU == cmd)
+ {
+ data = 2;
+ }
+ else if (FAL_DEFAULT_FLOW_ADMIT_ALL == cmd)
+ {
+ data = 3;
+ }
+ else
+ {
+ return SW_NOT_SUPPORTED;
+ }
+
+ if (FAL_FLOW_LAN_TO_LAN == type)
+ {
+ HSL_REG_FIELD_SET(rv, dev_id, FlOW_CMD_CTL, vrf_id, LAN_2_LAN_DEFAULT,
+ (a_uint8_t *) (&data), sizeof (a_uint32_t));
+ }
+ else if (FAL_FLOW_WAN_TO_LAN == type)
+ {
+ HSL_REG_FIELD_SET(rv, dev_id, FlOW_CMD_CTL, vrf_id, WAN_2_LAN_DEFAULT,
+ (a_uint8_t *) (&data), sizeof (a_uint32_t));
+ }
+ else if (FAL_FLOW_LAN_TO_WAN == type)
+ {
+ HSL_REG_FIELD_SET(rv, dev_id, FlOW_CMD_CTL, vrf_id, LAN_2_WAN_DEFAULT,
+ (a_uint8_t *) (&data), sizeof (a_uint32_t));
+ }
+ else if (FAL_FLOW_WAN_TO_WAN == type)
+ {
+ HSL_REG_FIELD_SET(rv, dev_id, FlOW_CMD_CTL, vrf_id, WAN_2_WAN_DEFAULT,
+ (a_uint8_t *) (&data), sizeof (a_uint32_t));
+ }
+ else
+ {
+ return SW_NOT_SUPPORTED;
+ }
+
+ return rv;
+}
+
+static sw_error_t
+_dess_default_flow_cmd_get(a_uint32_t dev_id, a_uint32_t vrf_id, fal_flow_type_t type, fal_default_flow_cmd_t * cmd)
+{
+ sw_error_t rv;
+ a_uint32_t data;
+
+ HSL_DEV_ID_CHECK(dev_id);
+
+ rv = _dess_ip_feature_check(dev_id);
+ SW_RTN_ON_ERROR(rv);
+
+ if (FAL_FLOW_LAN_TO_LAN == type)
+ {
+ HSL_REG_FIELD_GET(rv, dev_id, FlOW_CMD_CTL, vrf_id, LAN_2_LAN_DEFAULT,
+ (a_uint8_t *) (&data), sizeof (a_uint32_t));
+ }
+ else if (FAL_FLOW_WAN_TO_LAN == type)
+ {
+ HSL_REG_FIELD_GET(rv, dev_id, FlOW_CMD_CTL, vrf_id, WAN_2_LAN_DEFAULT,
+ (a_uint8_t *) (&data), sizeof (a_uint32_t));
+ }
+ else if (FAL_FLOW_LAN_TO_WAN == type)
+ {
+ HSL_REG_FIELD_GET(rv, dev_id, FlOW_CMD_CTL, vrf_id, LAN_2_WAN_DEFAULT,
+ (a_uint8_t *) (&data), sizeof (a_uint32_t));
+ }
+ else if (FAL_FLOW_WAN_TO_WAN == type)
+ {
+ HSL_REG_FIELD_GET(rv, dev_id, FlOW_CMD_CTL, vrf_id, WAN_2_WAN_DEFAULT,
+ (a_uint8_t *) (&data), sizeof (a_uint32_t));
+ }
+ else
+ {
+ return SW_NOT_SUPPORTED;
+ }
+ SW_RTN_ON_ERROR(rv);
+
+ if (0 == data)
+ {
+ *cmd = FAL_DEFAULT_FLOW_FORWARD;
+ }
+ else if (1 == data)
+ {
+ *cmd = FAL_DEFAULT_FLOW_DROP;
+ }
+ else if (2 == data)
+ {
+ *cmd = FAL_DEFAULT_FLOW_RDT_TO_CPU;
+ }
+ else if (3 == data)
+ {
+ *cmd = FAL_DEFAULT_FLOW_ADMIT_ALL;
+ }
+
+ return SW_OK;
+}
+
+static sw_error_t
+_dess_default_rt_flow_cmd_set(a_uint32_t dev_id, a_uint32_t vrf_id, fal_flow_type_t type, fal_default_flow_cmd_t cmd)
+{
+ sw_error_t rv;
+ a_uint32_t data;
+
+ HSL_DEV_ID_CHECK(dev_id);
+
+ rv = _dess_ip_feature_check(dev_id);
+ SW_RTN_ON_ERROR(rv);
+
+ if (FAL_DEFAULT_FLOW_FORWARD == cmd)
+ {
+ data = 0;
+ }
+ else if (FAL_DEFAULT_FLOW_DROP == cmd)
+ {
+ data = 1;
+ }
+ else if (FAL_DEFAULT_FLOW_RDT_TO_CPU == cmd)
+ {
+ data = 2;
+ }
+ else if (FAL_DEFAULT_FLOW_ADMIT_ALL == cmd)
+ {
+ data = 3;
+ }
+ else
+ {
+ return SW_NOT_SUPPORTED;
+ }
+
+ if (FAL_FLOW_LAN_TO_LAN == type)
+ {
+ HSL_REG_FIELD_SET(rv, dev_id, FlOW_RT_CMD_CTL, vrf_id, LAN_2_LAN_DEFAULT,
+ (a_uint8_t *) (&data), sizeof (a_uint32_t));
+ }
+ else if (FAL_FLOW_WAN_TO_LAN == type)
+ {
+ HSL_REG_FIELD_SET(rv, dev_id, FlOW_RT_CMD_CTL, vrf_id, WAN_2_LAN_DEFAULT,
+ (a_uint8_t *) (&data), sizeof (a_uint32_t));
+ }
+ else if (FAL_FLOW_LAN_TO_WAN == type)
+ {
+ HSL_REG_FIELD_SET(rv, dev_id, FlOW_RT_CMD_CTL, vrf_id, LAN_2_WAN_DEFAULT,
+ (a_uint8_t *) (&data), sizeof (a_uint32_t));
+ }
+ else if (FAL_FLOW_WAN_TO_WAN == type)
+ {
+ HSL_REG_FIELD_SET(rv, dev_id, FlOW_RT_CMD_CTL, vrf_id, WAN_2_WAN_DEFAULT,
+ (a_uint8_t *) (&data), sizeof (a_uint32_t));
+ }
+ else
+ {
+ return SW_NOT_SUPPORTED;
+ }
+
+ return rv;
+}
+
+static sw_error_t
+_dess_default_rt_flow_cmd_get(a_uint32_t dev_id, a_uint32_t vrf_id, fal_flow_type_t type, fal_default_flow_cmd_t * cmd)
+{
+ sw_error_t rv;
+ a_uint32_t data;
+
+ HSL_DEV_ID_CHECK(dev_id);
+
+ rv = _dess_ip_feature_check(dev_id);
+ SW_RTN_ON_ERROR(rv);
+
+ if (FAL_FLOW_LAN_TO_LAN == type)
+ {
+ HSL_REG_FIELD_GET(rv, dev_id, FlOW_RT_CMD_CTL, vrf_id, LAN_2_LAN_DEFAULT,
+ (a_uint8_t *) (&data), sizeof (a_uint32_t));
+ }
+ else if (FAL_FLOW_WAN_TO_LAN == type)
+ {
+ HSL_REG_FIELD_GET(rv, dev_id, FlOW_RT_CMD_CTL, vrf_id, WAN_2_LAN_DEFAULT,
+ (a_uint8_t *) (&data), sizeof (a_uint32_t));
+ }
+ else if (FAL_FLOW_LAN_TO_WAN == type)
+ {
+ HSL_REG_FIELD_GET(rv, dev_id, FlOW_RT_CMD_CTL, vrf_id, LAN_2_WAN_DEFAULT,
+ (a_uint8_t *) (&data), sizeof (a_uint32_t));
+ }
+ else if (FAL_FLOW_WAN_TO_WAN == type)
+ {
+ HSL_REG_FIELD_GET(rv, dev_id, FlOW_RT_CMD_CTL, vrf_id, WAN_2_WAN_DEFAULT,
+ (a_uint8_t *) (&data), sizeof (a_uint32_t));
+ }
+ else
+ {
+ return SW_NOT_SUPPORTED;
+ }
+ SW_RTN_ON_ERROR(rv);
+
+ if (0 == data)
+ {
+ *cmd = FAL_DEFAULT_FLOW_FORWARD;
+ }
+ else if (1 == data)
+ {
+ *cmd = FAL_DEFAULT_FLOW_DROP;
+ }
+ else if (2 == data)
+ {
+ *cmd = FAL_DEFAULT_FLOW_RDT_TO_CPU;
+ }
+ else if (3 == data)
+ {
+ *cmd = FAL_DEFAULT_FLOW_ADMIT_ALL;
+ }
+
+ return SW_OK;
+}
sw_error_t
dess_ip_reset(a_uint32_t dev_id)
@@ -3346,6 +3579,81 @@
return rv;
}
+/**
+ * @brief Set flow type traffic default forward command.
+ * @param[in] dev_id device id
+ * @param[in] vrf_id VRF route index, from 0~7
+ * @param[in] type traffic flow type pass through switch core
+ * @param[in] fal_default_flow_cmd_mode_t default flow forward command when flow table mismatch
+ * @return SW_OK or error code
+ */
+HSL_LOCAL sw_error_t
+dess_default_flow_cmd_set(a_uint32_t dev_id, a_uint32_t vrf_id, fal_flow_type_t type, fal_default_flow_cmd_t cmd)
+{
+ sw_error_t rv;
+
+ HSL_API_LOCK;
+ rv = _dess_default_flow_cmd_set(dev_id, vrf_id, type, cmd);
+ HSL_API_UNLOCK;
+ return rv;
+}
+
+/**
+ * @brief Get flow type traffic default forward command.
+ * @param[in] dev_id device id
+ * @param[in] vrf_id VRF route index, from 0~7
+ * @param[in] type traffic flow type pass through switch core
+ * @param[out] fal_default_flow_cmd_mode_t default flow forward command when flow table mismatch
+ * @return SW_OK or error code
+ */
+HSL_LOCAL sw_error_t
+dess_default_flow_cmd_get(a_uint32_t dev_id, a_uint32_t vrf_id, fal_flow_type_t type, fal_default_flow_cmd_t * cmd)
+{
+ sw_error_t rv;
+
+ HSL_API_LOCK;
+ rv = _dess_default_flow_cmd_get(dev_id, vrf_id, type, cmd);
+ HSL_API_UNLOCK;
+ return rv;
+}
+
+/**
+ * @brief Set flow&route type traffic default forward command.
+ * @param[in] dev_id device id
+ * @param[in] vrf_id VRF route index, from 0~7
+ * @param[in] type traffic flow type pass through switch core
+ * @param[in] fal_default_flow_cmd_mode_t default flow&route forward command when route mac match but flow table mismatch
+ * @return SW_OK or error code
+ */
+HSL_LOCAL sw_error_t
+dess_default_rt_flow_cmd_set(a_uint32_t dev_id, a_uint32_t vrf_id, fal_flow_type_t type, fal_default_flow_cmd_t cmd)
+{
+ sw_error_t rv;
+
+ HSL_API_LOCK;
+ rv = _dess_default_rt_flow_cmd_set(dev_id, vrf_id, type, cmd);
+ HSL_API_UNLOCK;
+ return rv;
+}
+
+/**
+ * @brief Get flow&route type traffic default forward command.
+ * @param[in] dev_id device id
+ * @param[in] vrf_id VRF route index, from 0~7
+ * @param[in] type traffic flow type pass through switch core
+ * @param[in] fal_default_flow_cmd_mode_t default flow&route forward command when route mac match but flow table mismatch
+ * @return SW_OK or error code
+ */
+HSL_LOCAL sw_error_t
+dess_default_rt_flow_cmd_get(a_uint32_t dev_id, a_uint32_t vrf_id, fal_flow_type_t type, fal_default_flow_cmd_t * cmd)
+{
+ sw_error_t rv;
+
+ HSL_API_LOCK;
+ rv = _dess_default_rt_flow_cmd_get(dev_id, vrf_id, type, cmd);
+ HSL_API_UNLOCK;
+ return rv;
+}
sw_error_t
dess_ip_init(a_uint32_t dev_id)
@@ -3407,6 +3715,10 @@
p_api->ip_rfs_ip6_set = dess_ip_rfs_ip6_set;
p_api->ip_rfs_ip4_del = dess_ip_rfs_ip4_del;
p_api->ip_rfs_ip6_del = dess_ip_rfs_ip6_del;
+ p_api->ip_default_flow_cmd_set = dess_default_flow_cmd_set;
+ p_api->ip_default_flow_cmd_get = dess_default_flow_cmd_get;
+ p_api->ip_default_rt_flow_cmd_set = dess_default_rt_flow_cmd_set;
+ p_api->ip_default_rt_flow_cmd_get = dess_default_rt_flow_cmd_get;
}
#endif
diff --git a/src/ref/ref_uci.c b/src/ref/ref_uci.c
index 09bb506..4e11d04 100755
--- a/src/ref/ref_uci.c
+++ b/src/ref/ref_uci.c
@@ -3920,6 +3920,66 @@
}
static int
+parse_ip_defaultflowcmd(struct switch_val *val)
+{
+ struct switch_ext *switch_ext_p, *switch_ext_tmp, *ext_value_p;
+ int rv = 0;
+ switch_ext_p = val->value.ext_val;
+ while(switch_ext_p) {
+ ext_value_p = switch_ext_p;
+
+ if(!strcmp(ext_value_p->option_name, "name")) {
+ switch_ext_p = switch_ext_p->next;
+ continue;
+ } else if(!strcmp(ext_value_p->option_name, "vrf_id")) {
+ val_ptr[0] = ext_value_p->option_value;
+ } else if(!strcmp(ext_value_p->option_name, "flow_type")) {
+ val_ptr[1] = ext_value_p->option_value;
+ } else if(!strcmp(ext_value_p->option_name, "flow_cmd")) {
+ val_ptr[2] = ext_value_p->option_value;
+ } else {
+ rv = -1;
+ break;
+ }
+
+ parameter_length++;
+ switch_ext_p = switch_ext_p->next;
+ }
+
+ return rv;
+}
+
+static int
+parse_ip_defaultrtflowcmd(struct switch_val *val)
+{
+ struct switch_ext *switch_ext_p, *switch_ext_tmp, *ext_value_p;
+ int rv = 0;
+ switch_ext_p = val->value.ext_val;
+ while(switch_ext_p) {
+ ext_value_p = switch_ext_p;
+
+ if(!strcmp(ext_value_p->option_name, "name")) {
+ switch_ext_p = switch_ext_p->next;
+ continue;
+ } else if(!strcmp(ext_value_p->option_name, "vrf_id")) {
+ val_ptr[0] = ext_value_p->option_value;
+ } else if(!strcmp(ext_value_p->option_name, "flow_type")) {
+ val_ptr[1] = ext_value_p->option_value;
+ } else if(!strcmp(ext_value_p->option_name, "flow_cmd")) {
+ val_ptr[2] = ext_value_p->option_value;
+ } else {
+ rv = -1;
+ break;
+ }
+
+ parameter_length++;
+ switch_ext_p = switch_ext_p->next;
+ }
+
+ return rv;
+}
+
+static int
parse_nat_natentry(struct switch_val *val)
{
struct switch_ext *switch_ext_p, *switch_ext_tmp, *ext_value_p;
@@ -5468,6 +5528,10 @@
rv = parse_ip_agetime(val);
} else if(!strcmp(command_name, "Wcmphashmode")) {
rv = parse_ip_wcmphashmode(val);
+ } else if(!strcmp(command_name, "Defaultflowcmd")) {
+ rv = parse_ip_defaultflowcmd(val);
+ } else if(!strcmp(command_name, "Defaultrtflowcmd")) {
+ rv = parse_ip_defaultrtflowcmd(val);
}
return rv;
diff --git a/src/shell_lib/shell_config.c b/src/shell_lib/shell_config.c
index ca37a5a..586f03e 100755
--- a/src/shell_lib/shell_config.c
+++ b/src/shell_lib/shell_config.c
@@ -459,6 +459,8 @@
{"arpunksrc", "set", "set arp unkown source command", "<forward|drop|cpycpu|rdtcpu>", SW_API_ARP_UNK_SOURCE_CMD_SET, NULL},
{"ipagetime", "set", "set dynamic ip entry age time", "<time>", SW_API_IP_AGE_TIME_SET, NULL},
{"wcmphashmode", "set", "set wcmp hash mode", "<hashmode>", SW_API_WCMP_HASH_MODE_SET, NULL},
+ {"defaultflowcmd", "set", "set default flow command", "<vrf id> <lan2lan|wan2lan|lan2wan|wan2wan> <forward|drop|rdtcpu|admit_all>", SW_API_IP_DEFAULT_FLOW_CMD_SET, NULL},
+ {"defaultrtflowcmd", "set", "set default route flow command", "<vrf id> <lan2lan|wan2lan|lan2wan|wan2wan> <forward|drop|rdtcpu|admit_all>", SW_API_IP_DEFAULT_RT_FLOW_CMD_SET, NULL},
{NULL, NULL, NULL, NULL, (int)NULL, NULL}/*end of desc*/
},
},
diff --git a/src/shell_lib/shell_io.c b/src/shell_lib/shell_io.c
index 4949c90..d49ac51 100755
--- a/src/shell_lib/shell_io.c
+++ b/src/shell_lib/shell_io.c
@@ -117,6 +117,8 @@
SW_TYPE_DEF(SW_STP, cmd_data_check_stp_state, NULL),
SW_TYPE_DEF(SW_LEAKY, cmd_data_check_leaky, NULL),
SW_TYPE_DEF(SW_MACCMD, cmd_data_check_maccmd, NULL),
+ SW_TYPE_DEF(SW_FLOWCMD, cmd_data_check_flowcmd, NULL),
+ SW_TYPE_DEF(SW_FLOWTYPE, cmd_data_check_flowtype, NULL),
SW_TYPE_DEF(SW_UINT_A, cmd_data_check_uinta, NULL),
SW_TYPE_DEF(SW_ACLRULE, NULL, NULL),
SW_TYPE_DEF(SW_LEDPATTERN, cmd_data_check_ledpattern, NULL),
@@ -784,6 +786,75 @@
return SW_OK;
}
+/*flow*/
+sw_error_t
+cmd_data_check_flowcmd(char *cmdstr, fal_default_flow_cmd_t * val, a_uint32_t size)
+{
+ if (NULL == cmdstr)
+ {
+ return SW_BAD_VALUE;
+ }
+
+ if (0 == cmdstr[0])
+ {
+ *val = FAL_DEFAULT_FLOW_FORWARD; //default
+ }
+ else if (!strcasecmp(cmdstr, "forward"))
+ {
+ *val = FAL_DEFAULT_FLOW_FORWARD;
+ }
+ else if (!strcasecmp(cmdstr, "drop"))
+ {
+ *val = FAL_DEFAULT_FLOW_DROP;
+ }
+ else if (!strcasecmp(cmdstr, "rdtcpu"))
+ {
+ *val = FAL_DEFAULT_FLOW_RDT_TO_CPU;
+ }
+ else if (!strcasecmp(cmdstr, "admit_all"))
+ {
+ *val = FAL_DEFAULT_FLOW_ADMIT_ALL;
+ }
+ else
+ {
+ return SW_BAD_VALUE;
+ }
+
+ return SW_OK;
+}
+
+sw_error_t
+cmd_data_check_flowtype(char *cmd_str, fal_flow_type_t * arg_val,
+ a_uint32_t size)
+{
+ if (NULL == cmd_str)
+ {
+ return SW_BAD_VALUE;
+ }
+
+ if (!strcasecmp(cmd_str, "lan2lan"))
+ {
+ *arg_val = FAL_FLOW_LAN_TO_LAN;
+ }
+ else if (!strcasecmp(cmd_str, "wan2lan"))
+ {
+ *arg_val = FAL_FLOW_WAN_TO_LAN;
+ }
+ else if (!strcasecmp(cmd_str, "lan2wan"))
+ {
+ *arg_val = FAL_FLOW_LAN_TO_WAN;
+ }
+ else if (!strcasecmp(cmd_str, "wan2wan"))
+ {
+ *arg_val = FAL_FLOW_WAN_TO_WAN;
+ }
+ else
+ {
+ return SW_BAD_VALUE;
+ }
+
+ return SW_OK;
+}
sw_error_t
cmd_data_check_confirm(char *cmdstr, a_bool_t def, a_bool_t * val,