Files
openwrt_NSS_ACW/package/qca/qca-nss-ecm/patches/405-Allow-egress-on-same-port-when-bridge-hairpin-is-enabled.patch
2022-10-10 14:13:00 -05:00

876 lines
34 KiB
Diff

From e23eabd570eabde1d1fc803127a97fd101642467 Mon Sep 17 00:00:00 2001
From: Varsha Mishra <varsham@codeaurora.org>
Date: Fri, 12 Jun 2020 01:06:58 +0530
Subject: [qca-nss-ecm] Allow egress on same port when bridge hairpin is
enabled.
When bridge hairpin is enabled, allow egress on same port. Wi-Fi intrabss
frames are getting exceptioned to stack. Bridge gets to make the decision
whether these frames need to be forwarded or dropped.
Signed-off-by: Varsha Mishra <varsham@codeaurora.org>
Change-Id: Ibdd72264d8887330ba0297ed12cbcfc390065bff
---
frontends/nss/ecm_nss_ipv4.c | 28 ++++++++++++++++++++++------
frontends/nss/ecm_nss_ipv6.c | 28 ++++++++++++++++++++++------
2 files changed, 44 insertions(+), 12 deletions(-)
--- a/frontends/nss/ecm_nss_ipv4.c
+++ b/frontends/nss/ecm_nss_ipv4.c
@@ -1712,7 +1712,9 @@ static unsigned int ecm_nss_ipv4_bridge_
* Case 2:
* For routed packets the skb will have the src mac matching the bridge mac.
* Case 3:
- * If the packet was not local (case 1) or routed (case 2) then we process.
+ * If the packet was not local (case 1) or routed (case 2) then
+ * we process. There is an exception to case 2: when hairpin mode
+ * is enabled, we process.
*/
/*
@@ -1724,16 +1726,30 @@ static unsigned int ecm_nss_ipv4_bridge_
dev_put(bridge);
return NF_ACCEPT;
}
+
+ /*
+ * This flag needs to be checked in slave port(eth0/ath0)
+ * and not on master interface(br-lan). Hairpin flag can be
+ * enabled/disabled for ports individually.
+ */
if (in == out) {
- DEBUG_TRACE("skb: %p, bridge: %p (%s), port bounce on %p (%s)\n", skb, bridge, bridge->name, out, out->name);
- dev_put(in);
- dev_put(bridge);
- return NF_ACCEPT;
+ if (!br_is_hairpin_enabled(in)) {
+ DEBUG_TRACE("skb: %p, bridge: %p (%s), ignoring"
+ "the packet, hairpin not enabled"
+ "on port %p (%s)\n", skb, bridge,
+ bridge->name, out, out->name);
+ dev_put(in);
+ dev_put(bridge);
+ return NF_ACCEPT;
+ }
+ DEBUG_TRACE("skb: %p, bridge: %p (%s), hairpin enabled on port"
+ "%p (%s)\n", skb, bridge, bridge->name, out, out->name);
}
+
+ /*
+ * Case 2: Routed trafffic would be handled by the INET post routing.
+ */
if (!ecm_mac_addr_equal(skb_eth_hdr->h_source, bridge->dev_addr)) {
- /*
- * Case 2: Routed trafffic would be handled by the INET post routing.
- */
DEBUG_TRACE("skb: %p, Ignoring routed packet to bridge: %p (%s)\n", skb, bridge, bridge->name);
dev_put(in);
dev_put(bridge);
@@ -2598,41 +2614,23 @@ int ecm_nss_ipv4_init(struct dentry *den
return result;
}
- if (!debugfs_create_u32("no_action_limit_default", S_IRUGO | S_IWUSR, ecm_nss_ipv4_dentry,
- (u32 *)&ecm_nss_ipv4_no_action_limit_default)) {
- DEBUG_ERROR("Failed to create ecm nss ipv4 no_action_limit_default file in debugfs\n");
- goto task_cleanup;
- }
+ debugfs_create_u32("no_action_limit_default", S_IRUGO | S_IWUSR, ecm_nss_ipv4_dentry,
+ (u32 *)&ecm_nss_ipv4_no_action_limit_default);
- if (!debugfs_create_u32("driver_fail_limit_default", S_IRUGO | S_IWUSR, ecm_nss_ipv4_dentry,
- (u32 *)&ecm_nss_ipv4_driver_fail_limit_default)) {
- DEBUG_ERROR("Failed to create ecm nss ipv4 driver_fail_limit_default file in debugfs\n");
- goto task_cleanup;
- }
+ debugfs_create_u32("driver_fail_limit_default", S_IRUGO | S_IWUSR, ecm_nss_ipv4_dentry,
+ (u32 *)&ecm_nss_ipv4_driver_fail_limit_default);
- if (!debugfs_create_u32("nack_limit_default", S_IRUGO | S_IWUSR, ecm_nss_ipv4_dentry,
- (u32 *)&ecm_nss_ipv4_nack_limit_default)) {
- DEBUG_ERROR("Failed to create ecm nss ipv4 nack_limit_default file in debugfs\n");
- goto task_cleanup;
- }
+ debugfs_create_u32("nack_limit_default", S_IRUGO | S_IWUSR, ecm_nss_ipv4_dentry,
+ (u32 *)&ecm_nss_ipv4_nack_limit_default);
- if (!debugfs_create_u32("accelerated_count", S_IRUGO, ecm_nss_ipv4_dentry,
- (u32 *)&ecm_nss_ipv4_accelerated_count)) {
- DEBUG_ERROR("Failed to create ecm nss ipv4 accelerated_count file in debugfs\n");
- goto task_cleanup;
- }
+ debugfs_create_u32("accelerated_count", S_IRUGO, ecm_nss_ipv4_dentry,
+ (u32 *)&ecm_nss_ipv4_accelerated_count);
- if (!debugfs_create_u32("pending_accel_count", S_IRUGO, ecm_nss_ipv4_dentry,
- (u32 *)&ecm_nss_ipv4_pending_accel_count)) {
- DEBUG_ERROR("Failed to create ecm nss ipv4 pending_accel_count file in debugfs\n");
- goto task_cleanup;
- }
+ debugfs_create_u32("pending_accel_count", S_IRUGO, ecm_nss_ipv4_dentry,
+ (u32 *)&ecm_nss_ipv4_pending_accel_count);
- if (!debugfs_create_u32("pending_decel_count", S_IRUGO, ecm_nss_ipv4_dentry,
- (u32 *)&ecm_nss_ipv4_pending_decel_count)) {
- DEBUG_ERROR("Failed to create ecm nss ipv4 pending_decel_count file in debugfs\n");
- goto task_cleanup;
- }
+ debugfs_create_u32("pending_decel_count", S_IRUGO, ecm_nss_ipv4_dentry,
+ (u32 *)&ecm_nss_ipv4_pending_decel_count);
if (!debugfs_create_file("accel_limit_mode", S_IRUGO | S_IWUSR, ecm_nss_ipv4_dentry,
NULL, &ecm_nss_ipv4_accel_limit_mode_fops)) {
@@ -2663,11 +2661,8 @@ int ecm_nss_ipv4_init(struct dentry *den
goto task_cleanup;
}
- if (!debugfs_create_u32("vlan_passthrough_set", S_IRUGO | S_IWUSR, ecm_nss_ipv4_dentry,
- (u32 *)&ecm_nss_ipv4_vlan_passthrough_enable)) {
- DEBUG_ERROR("Failed to create ecm nss ipv4 vlan passthrough file in debugfs\n");
- goto task_cleanup;
- }
+ debugfs_create_u32("vlan_passthrough_set", S_IRUGO | S_IWUSR, ecm_nss_ipv4_dentry,
+ (u32 *)&ecm_nss_ipv4_vlan_passthrough_enable);
#ifdef ECM_NON_PORTED_SUPPORT_ENABLE
if (!ecm_nss_non_ported_ipv4_debugfs_init(ecm_nss_ipv4_dentry)) {
--- a/frontends/nss/ecm_nss_ipv6.c
+++ b/frontends/nss/ecm_nss_ipv6.c
@@ -1458,7 +1458,9 @@ static unsigned int ecm_nss_ipv6_bridge_
* Case 2:
* For routed packets the skb will have the src mac matching the bridge mac.
* Case 3:
- * If the packet was not local (case 1) or routed (case 2) then we process.
+ * If the packet was not local (case 1) or routed (case 2) then
+ * we process. There is an exception to case 2: when hairpin mode
+ * is enabled, we process.
*/
/*
@@ -1470,16 +1472,30 @@ static unsigned int ecm_nss_ipv6_bridge_
dev_put(bridge);
return NF_ACCEPT;
}
+
+ /*
+ * This flag needs to be checked in slave port(eth0/ath0)
+ * and not on master interface(br-lan). Hairpin flag can be
+ * enabled/disabled for ports individually.
+ */
if (in == out) {
- DEBUG_TRACE("skb: %p, bridge: %p (%s), port bounce on %p (%s)\n", skb, bridge, bridge->name, out, out->name);
- dev_put(in);
- dev_put(bridge);
- return NF_ACCEPT;
+ if (!br_is_hairpin_enabled(in)) {
+ DEBUG_TRACE("skb: %p, bridge: %p (%s), ignoring"
+ "the packet, hairpin not enabled"
+ "on port %p (%s)\n", skb, bridge,
+ bridge->name, out, out->name);
+ dev_put(in);
+ dev_put(bridge);
+ return NF_ACCEPT;
+ }
+ DEBUG_TRACE("skb: %p, bridge: %p (%s), hairpin enabled on port"
+ "%p (%s)\n", skb, bridge, bridge->name, out, out->name);
}
+
+ /*
+ * Case 2: Routed trafffic would be handled by the INET post routing.
+ */
if (!ecm_mac_addr_equal(skb_eth_hdr->h_source, bridge->dev_addr)) {
- /*
- * Case 2: Routed trafffic would be handled by the INET post routing.
- */
DEBUG_TRACE("skb: %p, Ignoring routed packet to bridge: %p (%s)\n", skb, bridge, bridge->name);
dev_put(in);
dev_put(bridge);
@@ -2320,41 +2336,23 @@ int ecm_nss_ipv6_init(struct dentry *den
return result;
}
- if (!debugfs_create_u32("no_action_limit_default", S_IRUGO | S_IWUSR, ecm_nss_ipv6_dentry,
- (u32 *)&ecm_nss_ipv6_no_action_limit_default)) {
- DEBUG_ERROR("Failed to create ecm nss ipv6 no_action_limit_default file in debugfs\n");
- goto task_cleanup;
- }
+ debugfs_create_u32("no_action_limit_default", S_IRUGO | S_IWUSR, ecm_nss_ipv6_dentry,
+ (u32 *)&ecm_nss_ipv6_no_action_limit_default);
- if (!debugfs_create_u32("driver_fail_limit_default", S_IRUGO | S_IWUSR, ecm_nss_ipv6_dentry,
- (u32 *)&ecm_nss_ipv6_driver_fail_limit_default)) {
- DEBUG_ERROR("Failed to create ecm nss ipv6 driver_fail_limit_default file in debugfs\n");
- goto task_cleanup;
- }
+ debugfs_create_u32("driver_fail_limit_default", S_IRUGO | S_IWUSR, ecm_nss_ipv6_dentry,
+ (u32 *)&ecm_nss_ipv6_driver_fail_limit_default);
- if (!debugfs_create_u32("nack_limit_default", S_IRUGO | S_IWUSR, ecm_nss_ipv6_dentry,
- (u32 *)&ecm_nss_ipv6_nack_limit_default)) {
- DEBUG_ERROR("Failed to create ecm nss ipv6 nack_limit_default file in debugfs\n");
- goto task_cleanup;
- }
+ debugfs_create_u32("nack_limit_default", S_IRUGO | S_IWUSR, ecm_nss_ipv6_dentry,
+ (u32 *)&ecm_nss_ipv6_nack_limit_default);
- if (!debugfs_create_u32("accelerated_count", S_IRUGO, ecm_nss_ipv6_dentry,
- (u32 *)&ecm_nss_ipv6_accelerated_count)) {
- DEBUG_ERROR("Failed to create ecm nss ipv6 accelerated_count file in debugfs\n");
- goto task_cleanup;
- }
+ debugfs_create_u32("accelerated_count", S_IRUGO, ecm_nss_ipv6_dentry,
+ (u32 *)&ecm_nss_ipv6_accelerated_count);
- if (!debugfs_create_u32("pending_accel_count", S_IRUGO, ecm_nss_ipv6_dentry,
- (u32 *)&ecm_nss_ipv6_pending_accel_count)) {
- DEBUG_ERROR("Failed to create ecm nss ipv6 pending_accel_count file in debugfs\n");
- goto task_cleanup;
- }
+ debugfs_create_u32("pending_accel_count", S_IRUGO, ecm_nss_ipv6_dentry,
+ (u32 *)&ecm_nss_ipv6_pending_accel_count);
- if (!debugfs_create_u32("pending_decel_count", S_IRUGO, ecm_nss_ipv6_dentry,
- (u32 *)&ecm_nss_ipv6_pending_decel_count)) {
- DEBUG_ERROR("Failed to create ecm nss ipv6 pending_decel_count file in debugfs\n");
- goto task_cleanup;
- }
+ debugfs_create_u32("pending_decel_count", S_IRUGO, ecm_nss_ipv6_dentry,
+ (u32 *)&ecm_nss_ipv6_pending_decel_count);
if (!debugfs_create_file("accel_limit_mode", S_IRUGO | S_IWUSR, ecm_nss_ipv6_dentry,
NULL, &ecm_nss_ipv6_accel_limit_mode_fops)) {
@@ -2385,11 +2383,8 @@ int ecm_nss_ipv6_init(struct dentry *den
goto task_cleanup;
}
- if (!debugfs_create_u32("vlan_passthrough_set", S_IRUGO | S_IWUSR, ecm_nss_ipv6_dentry,
- (u32 *)&ecm_nss_ipv6_vlan_passthrough_enable)) {
- DEBUG_ERROR("Failed to create ecm nss ipv6 vlan passthrough file in debugfs\n");
- goto task_cleanup;
- }
+ debugfs_create_u32("vlan_passthrough_set", S_IRUGO | S_IWUSR, ecm_nss_ipv6_dentry,
+ (u32 *)&ecm_nss_ipv6_vlan_passthrough_enable);
#ifdef ECM_NON_PORTED_SUPPORT_ENABLE
if (!ecm_nss_non_ported_ipv6_debugfs_init(ecm_nss_ipv6_dentry)) {
--- a/ecm_classifier_default.c
+++ b/ecm_classifier_default.c
@@ -639,19 +639,11 @@ int ecm_classifier_default_init(struct d
return -1;
}
- if (!debugfs_create_u32("enabled", S_IRUGO | S_IWUSR, ecm_classifier_default_dentry,
- (u32 *)&ecm_classifier_default_enabled)) {
- DEBUG_ERROR("Failed to create ecm deafult classifier enabled file in debugfs\n");
- debugfs_remove_recursive(ecm_classifier_default_dentry);
- return -1;
- }
+ debugfs_create_u32("enabled", S_IRUGO | S_IWUSR, ecm_classifier_default_dentry,
+ (u32 *)&ecm_classifier_default_enabled);
- if (!debugfs_create_u32("accel_mode", S_IRUGO | S_IWUSR, ecm_classifier_default_dentry,
- (u32 *)&ecm_classifier_default_accel_mode)) {
- DEBUG_ERROR("Failed to create ecm deafult classifier accel_mode file in debugfs\n");
- debugfs_remove_recursive(ecm_classifier_default_dentry);
- return -1;
- }
+ debugfs_create_u32("accel_mode", S_IRUGO | S_IWUSR, ecm_classifier_default_dentry,
+ (u32 *)&ecm_classifier_default_accel_mode);
return 0;
}
--- a/ecm_classifier_dscp.c
+++ b/ecm_classifier_dscp.c
@@ -644,12 +644,8 @@ int ecm_classifier_dscp_init(struct dent
return -1;
}
- if (!debugfs_create_u32("enabled", S_IRUGO | S_IWUSR, ecm_classifier_dscp_dentry,
- (u32 *)&ecm_classifier_dscp_enabled)) {
- DEBUG_ERROR("Failed to create dscp enabled file in debugfs\n");
- debugfs_remove_recursive(ecm_classifier_dscp_dentry);
- return -1;
- }
+ debugfs_create_u32("enabled", S_IRUGO | S_IWUSR, ecm_classifier_dscp_dentry,
+ (u32 *)&ecm_classifier_dscp_enabled);
return 0;
}
--- a/ecm_classifier_hyfi.c
+++ b/ecm_classifier_hyfi.c
@@ -1100,11 +1100,8 @@ int ecm_classifier_hyfi_rules_init(struc
goto classifier_task_cleanup;
}
- if (!debugfs_create_u32("enabled", S_IRUGO | S_IWUSR, ecm_classifier_hyfi_dentry,
- (u32 *)&ecm_classifier_hyfi_enabled)) {
- DEBUG_ERROR("Failed to create ecm hyfi classifier enabled file in debugfs\n");
- goto classifier_task_cleanup;
- }
+ debugfs_create_u32("enabled", S_IRUGO | S_IWUSR, ecm_classifier_hyfi_dentry,
+ (u32 *)&ecm_classifier_hyfi_enabled);
if (!debugfs_create_file("cmd", S_IWUSR, ecm_classifier_hyfi_dentry,
NULL, &ecm_classifier_hyfi_cmd_fops)) {
--- a/ecm_classifier_mark.c
+++ b/ecm_classifier_mark.c
@@ -753,12 +753,8 @@ int ecm_classifier_mark_init(struct dent
return -1;
}
- if (!debugfs_create_u32("enabled", S_IRUGO | S_IWUSR, ecm_classifier_mark_dentry,
- (u32 *)&ecm_classifier_mark_enabled)) {
- DEBUG_ERROR("Failed to create mark enabled file in debugfs\n");
- debugfs_remove_recursive(ecm_classifier_mark_dentry);
- return -1;
- }
+ debugfs_create_u32("enabled", S_IRUGO | S_IWUSR, ecm_classifier_mark_dentry,
+ (u32 *)&ecm_classifier_mark_enabled);
return 0;
}
--- a/ecm_classifier_pcc.c
+++ b/ecm_classifier_pcc.c
@@ -1065,12 +1065,8 @@ int ecm_classifier_pcc_init(struct dentr
return -1;
}
- if (!debugfs_create_u32("enabled", S_IRUGO, ecm_classifier_pcc_dentry,
- (u32 *)&ecm_classifier_pcc_enabled)) {
- DEBUG_ERROR("Failed to create pcc enabled file in debugfs\n");
- debugfs_remove_recursive(ecm_classifier_pcc_dentry);
- return -1;
- }
+ debugfs_create_u32("enabled", S_IRUGO, ecm_classifier_pcc_dentry,
+ (u32 *)&ecm_classifier_pcc_enabled);
return 0;
}
--- a/ecm_conntrack_notifier.c
+++ b/ecm_conntrack_notifier.c
@@ -400,12 +400,8 @@ int ecm_conntrack_notifier_init(struct d
return -1;
}
- if (!debugfs_create_u32("stop", S_IRUGO | S_IWUSR, ecm_conntrack_notifier_dentry,
- (u32 *)&ecm_conntrack_notifier_stopped)) {
- DEBUG_ERROR("Failed to create ecm conntrack notifier stopped file in debugfs\n");
- debugfs_remove_recursive(ecm_conntrack_notifier_dentry);
- return -1;
- }
+ debugfs_create_u32("stop", S_IRUGO | S_IWUSR, ecm_conntrack_notifier_dentry,
+ (u32 *)&ecm_conntrack_notifier_stopped);
#ifdef CONFIG_NF_CONNTRACK_EVENTS
/*
--- a/ecm_db/ecm_db_connection.c
+++ b/ecm_db/ecm_db_connection.c
@@ -3266,11 +3266,8 @@ static struct file_operations ecm_db_con
*/
bool ecm_db_connection_init(struct dentry *dentry)
{
- if (!debugfs_create_u32("connection_count", S_IRUGO, dentry,
- (u32 *)&ecm_db_connection_count)) {
- DEBUG_ERROR("Failed to create ecm db connection count file in debugfs\n");
- return false;
- }
+ debugfs_create_u32("connection_count", S_IRUGO, dentry,
+ (u32 *)&ecm_db_connection_count);
if (!debugfs_create_file("connection_count_simple", S_IRUGO, dentry,
NULL, &ecm_db_connection_count_simple_fops)) {
--- a/ecm_db/ecm_db_host.c
+++ b/ecm_db/ecm_db_host.c
@@ -630,11 +630,8 @@ EXPORT_SYMBOL(ecm_db_host_alloc);
bool ecm_db_host_init(struct dentry *dentry)
{
- if (!debugfs_create_u32("host_count", S_IRUGO, dentry,
- (u32 *)&ecm_db_host_count)) {
- DEBUG_ERROR("Failed to create ecm db host count file in debugfs\n");
- return false;;
- }
+ debugfs_create_u32("host_count", S_IRUGO, dentry,
+ (u32 *)&ecm_db_host_count);
ecm_db_host_table = vzalloc(sizeof(struct ecm_db_host_instance *) * ECM_DB_HOST_HASH_SLOTS);
if (!ecm_db_host_table) {
--- a/ecm_db/ecm_db_iface.c
+++ b/ecm_db/ecm_db_iface.c
@@ -3254,11 +3254,8 @@ EXPORT_SYMBOL(ecm_db_iface_alloc);
*/
bool ecm_db_iface_init(struct dentry *dentry)
{
- if (!debugfs_create_u32("iface_count", S_IRUGO, dentry,
- (u32 *)&ecm_db_iface_count)) {
- DEBUG_ERROR("Failed to create ecm db iface count file in debugfs\n");
- return false;
- }
+ debugfs_create_u32("iface_count", S_IRUGO, dentry,
+ (u32 *)&ecm_db_iface_count);
return true;
}
--- a/ecm_db/ecm_db_mapping.c
+++ b/ecm_db/ecm_db_mapping.c
@@ -806,11 +806,8 @@ EXPORT_SYMBOL(ecm_db_mapping_alloc);
*/
bool ecm_db_mapping_init(struct dentry *dentry)
{
- if (!debugfs_create_u32("mapping_count", S_IRUGO, dentry,
- (u32 *)&ecm_db_mapping_count)) {
- DEBUG_ERROR("Failed to create ecm db mapping count file in debugfs\n");
- return false;
- }
+ debugfs_create_u32("mapping_count", S_IRUGO, dentry,
+ (u32 *)&ecm_db_mapping_count);
ecm_db_mapping_table = vzalloc(sizeof(struct ecm_db_mapping_instance *) * ECM_DB_MAPPING_HASH_SLOTS);
if (!ecm_db_mapping_table) {
--- a/ecm_db/ecm_db_node.c
+++ b/ecm_db/ecm_db_node.c
@@ -856,11 +856,8 @@ void ecm_db_traverse_node_connection_lis
*/
bool ecm_db_node_init(struct dentry *dentry)
{
- if (!debugfs_create_u32("node_count", S_IRUGO, dentry,
- (u32 *)&ecm_db_node_count)) {
- DEBUG_ERROR("Failed to create ecm db node count file in debugfs\n");
- return false;
- }
+ debugfs_create_u32("node_count", S_IRUGO, dentry,
+ (u32 *)&ecm_db_node_count);
ecm_db_node_table = vzalloc(sizeof(struct ecm_db_node_instance *) * ECM_DB_NODE_HASH_SLOTS);
if (!ecm_db_node_table) {
--- a/ecm_state.c
+++ b/ecm_state.c
@@ -899,17 +899,11 @@ int ecm_state_init(struct dentry *dentry
return -1;
}
- if (!debugfs_create_u32("state_dev_major", S_IRUGO, ecm_state_dentry,
- (u32 *)&ecm_state_dev_major_id)) {
- DEBUG_ERROR("Failed to create ecm state dev major file in debugfs\n");
- goto init_cleanup;
- }
+ debugfs_create_u32("state_dev_major", S_IRUGO, ecm_state_dentry,
+ (u32 *)&ecm_state_dev_major_id);
- if (!debugfs_create_u32("state_file_output_mask", S_IRUGO | S_IWUSR, ecm_state_dentry,
- (u32 *)&ecm_state_file_output_mask)) {
- DEBUG_ERROR("Failed to create ecm state output mask file in debugfs\n");
- goto init_cleanup;
- }
+ debugfs_create_u32("state_file_output_mask", S_IRUGO | S_IWUSR, ecm_state_dentry,
+ (u32 *)&ecm_state_file_output_mask);
/*
* Register a char device that we will use to provide a dump of our state
--- a/frontends/ecm_front_end_ipv4.c
+++ b/frontends/ecm_front_end_ipv4.c
@@ -356,11 +356,8 @@ void ecm_front_end_ipv4_stop(int num)
*/
int ecm_front_end_ipv4_init(struct dentry *dentry)
{
- if (!debugfs_create_u32("front_end_ipv4_stop", S_IRUGO | S_IWUSR, dentry,
- (u32 *)&ecm_front_end_ipv4_stopped)) {
- DEBUG_ERROR("Failed to create ecm front end ipv4 stop file in debugfs\n");
- return -1;
- }
+ debugfs_create_u32("front_end_ipv4_stop", S_IRUGO | S_IWUSR, dentry,
+ (u32 *)&ecm_front_end_ipv4_stopped);
switch (ecm_front_end_type_get()) {
case ECM_FRONT_END_TYPE_NSS:
--- a/frontends/ecm_front_end_ipv6.c
+++ b/frontends/ecm_front_end_ipv6.c
@@ -226,11 +226,8 @@ void ecm_front_end_ipv6_stop(int num)
*/
int ecm_front_end_ipv6_init(struct dentry *dentry)
{
- if (!debugfs_create_u32("front_end_ipv6_stop", S_IRUGO | S_IWUSR, dentry,
- (u32 *)&ecm_front_end_ipv6_stopped)) {
- DEBUG_ERROR("Failed to create ecm front end ipv6 stop file in debugfs\n");
- return -1;
- }
+ debugfs_create_u32("front_end_ipv6_stop", S_IRUGO | S_IWUSR, dentry,
+ (u32 *)&ecm_front_end_ipv6_stopped);
switch (ecm_front_end_type_get()) {
case ECM_FRONT_END_TYPE_NSS:
--- a/frontends/nss/ecm_nss_bond_notifier.c
+++ b/frontends/nss/ecm_nss_bond_notifier.c
@@ -240,12 +240,8 @@ int ecm_nss_bond_notifier_init(struct de
return -1;
}
- if (!debugfs_create_u32("stop", S_IRUGO | S_IWUSR, ecm_nss_bond_notifier_dentry,
- (u32 *)&ecm_nss_bond_notifier_stopped)) {
- DEBUG_ERROR("Failed to create ecm bond notifier stopped file in debugfs\n");
- debugfs_remove_recursive(ecm_nss_bond_notifier_dentry);
- return -1;
- }
+ debugfs_create_u32("stop", S_IRUGO | S_IWUSR, ecm_nss_bond_notifier_dentry,
+ (u32 *)&ecm_nss_bond_notifier_stopped);
/*
* Register Link Aggregation callbacks with the bonding driver
--- a/frontends/nss/ecm_nss_multicast_ipv4.c
+++ b/frontends/nss/ecm_nss_multicast_ipv4.c
@@ -3935,11 +3935,8 @@ void ecm_nss_multicast_ipv4_stop(int num
*/
int ecm_nss_multicast_ipv4_init(struct dentry *dentry)
{
- if (!debugfs_create_u32("ecm_nss_multicast_ipv4_stop", S_IRUGO | S_IWUSR, dentry,
- (u32 *)&ecm_front_end_ipv4_mc_stopped)) {
- DEBUG_ERROR("Failed to create ecm front end ipv4 mc stop file in debugfs\n");
- return -1;
- }
+ debugfs_create_u32("ecm_nss_multicast_ipv4_stop", S_IRUGO | S_IWUSR, dentry,
+ (u32 *)&ecm_front_end_ipv4_mc_stopped);
/*
* Register multicast update callback to MCS snooper
--- a/frontends/nss/ecm_nss_multicast_ipv6.c
+++ b/frontends/nss/ecm_nss_multicast_ipv6.c
@@ -3734,11 +3734,8 @@ void ecm_nss_multicast_ipv6_stop(int num
*/
int ecm_nss_multicast_ipv6_init(struct dentry *dentry)
{
- if (!debugfs_create_u32("ecm_nss_multicast_ipv6_stop", S_IRUGO | S_IWUSR, dentry,
- (u32 *)&ecm_front_end_ipv6_mc_stopped)) {
- DEBUG_ERROR("Failed to create ecm front end ipv6 mc stop file in debugfs\n");
- return -1;
- }
+ debugfs_create_u32("ecm_nss_multicast_ipv6_stop", S_IRUGO | S_IWUSR, dentry,
+ (u32 *)&ecm_front_end_ipv6_mc_stopped);
/*
* Register multicast update callback to MCS snooper
--- a/frontends/nss/ecm_nss_non_ported_ipv4.c
+++ b/frontends/nss/ecm_nss_non_ported_ipv4.c
@@ -2440,11 +2440,8 @@ done:
*/
bool ecm_nss_non_ported_ipv4_debugfs_init(struct dentry *dentry)
{
- if (!debugfs_create_u32("non_ported_accelerated_count", S_IRUGO, dentry,
- (u32 *)&ecm_nss_non_ported_ipv4_accelerated_count)) {
- DEBUG_ERROR("Failed to create ecm nss ipv4 non_ported_accelerated_count file in debugfs\n");
- return false;
- }
+ debugfs_create_u32("non_ported_accelerated_count", S_IRUGO, dentry,
+ (u32 *)&ecm_nss_non_ported_ipv4_accelerated_count);
return true;
}
--- a/frontends/nss/ecm_nss_non_ported_ipv6.c
+++ b/frontends/nss/ecm_nss_non_ported_ipv6.c
@@ -2163,11 +2163,8 @@ done:
*/
bool ecm_nss_non_ported_ipv6_debugfs_init(struct dentry *dentry)
{
- if (!debugfs_create_u32("non_ported_accelerated_count", S_IRUGO, dentry,
- (u32 *)&ecm_nss_non_ported_ipv6_accelerated_count)) {
- DEBUG_ERROR("Failed to create ecm nss ipv6 non_ported_accelerated_count file in debugfs\n");
- return false;
- }
+ debugfs_create_u32("non_ported_accelerated_count", S_IRUGO, dentry,
+ (u32 *)&ecm_nss_non_ported_ipv6_accelerated_count);
return true;
}
--- a/frontends/nss/ecm_nss_ported_ipv4.c
+++ b/frontends/nss/ecm_nss_ported_ipv4.c
@@ -2586,21 +2586,11 @@ done:
*/
bool ecm_nss_ported_ipv4_debugfs_init(struct dentry *dentry)
{
- struct dentry *udp_dentry;
- udp_dentry = debugfs_create_u32("udp_accelerated_count", S_IRUGO, dentry,
+ debugfs_create_u32("udp_accelerated_count", S_IRUGO, dentry,
&ecm_nss_ported_ipv4_accelerated_count[ECM_NSS_PORTED_IPV4_PROTO_UDP]);
- if (!udp_dentry) {
- DEBUG_ERROR("Failed to create ecm nss ipv4 udp_accelerated_count file in debugfs\n");
- return false;
- }
-
- if (!debugfs_create_u32("tcp_accelerated_count", S_IRUGO, dentry,
- &ecm_nss_ported_ipv4_accelerated_count[ECM_NSS_PORTED_IPV4_PROTO_TCP])) {
- DEBUG_ERROR("Failed to create ecm nss ipv4 tcp_accelerated_count file in debugfs\n");
- debugfs_remove(udp_dentry);
- return false;
- }
+ debugfs_create_u32("tcp_accelerated_count", S_IRUGO, dentry,
+ &ecm_nss_ported_ipv4_accelerated_count[ECM_NSS_PORTED_IPV4_PROTO_TCP]);
return true;
}
--- a/frontends/nss/ecm_nss_ported_ipv6.c
+++ b/frontends/nss/ecm_nss_ported_ipv6.c
@@ -2375,21 +2375,12 @@ done:
*/
bool ecm_nss_ported_ipv6_debugfs_init(struct dentry *dentry)
{
- struct dentry *udp_dentry;
- udp_dentry = debugfs_create_u32("udp_accelerated_count", S_IRUGO, dentry,
+ debugfs_create_u32("udp_accelerated_count", S_IRUGO, dentry,
&ecm_nss_ported_ipv6_accelerated_count[ECM_NSS_PORTED_IPV6_PROTO_UDP]);
- if (!udp_dentry) {
- DEBUG_ERROR("Failed to create ecm nss ipv6 udp_accelerated_count file in debugfs\n");
- return false;
- }
- if (!debugfs_create_u32("tcp_accelerated_count", S_IRUGO, dentry,
- &ecm_nss_ported_ipv6_accelerated_count[ECM_NSS_PORTED_IPV6_PROTO_TCP])) {
- DEBUG_ERROR("Failed to create ecm nss ipv6 tcp_accelerated_count file in debugfs\n");
- debugfs_remove(udp_dentry);
- return false;
- }
+ debugfs_create_u32("tcp_accelerated_count", S_IRUGO, dentry,
+ &ecm_nss_ported_ipv6_accelerated_count[ECM_NSS_PORTED_IPV6_PROTO_TCP]);
return true;
}
--- a/frontends/sfe/ecm_sfe_ipv4.c
+++ b/frontends/sfe/ecm_sfe_ipv4.c
@@ -1805,50 +1805,29 @@ int ecm_sfe_ipv4_init(struct dentry *den
}
#ifdef CONFIG_XFRM
- if (!debugfs_create_u32("reject_acceleration_for_ipsec", S_IRUGO | S_IWUSR, ecm_sfe_ipv4_dentry,
- (u32 *)&ecm_sfe_ipv4_reject_acceleration_for_ipsec)) {
- DEBUG_ERROR("Failed to create ecm sfe ipv4 reject_acceleration_for_ipsec file in debugfs\n");
- goto task_cleanup;
- }
+ debugfs_create_u32("reject_acceleration_for_ipsec", S_IRUGO | S_IWUSR, ecm_sfe_ipv4_dentry,
+ (u32 *)&ecm_sfe_ipv4_reject_acceleration_for_ipsec) ;
#endif
- if (!debugfs_create_u32("no_action_limit_default", S_IRUGO | S_IWUSR, ecm_sfe_ipv4_dentry,
- (u32 *)&ecm_sfe_ipv4_no_action_limit_default)) {
- DEBUG_ERROR("Failed to create ecm sfe ipv4 no_action_limit_default file in debugfs\n");
- goto task_cleanup;
- }
+ debugfs_create_u32("no_action_limit_default", S_IRUGO | S_IWUSR, ecm_sfe_ipv4_dentry,
+ (u32 *)&ecm_sfe_ipv4_no_action_limit_default);
- if (!debugfs_create_u32("driver_fail_limit_default", S_IRUGO | S_IWUSR, ecm_sfe_ipv4_dentry,
- (u32 *)&ecm_sfe_ipv4_driver_fail_limit_default)) {
- DEBUG_ERROR("Failed to create ecm sfe ipv4 driver_fail_limit_default file in debugfs\n");
- goto task_cleanup;
- }
+ debugfs_create_u32("driver_fail_limit_default", S_IRUGO | S_IWUSR, ecm_sfe_ipv4_dentry,
+ (u32 *)&ecm_sfe_ipv4_driver_fail_limit_default);
- if (!debugfs_create_u32("nack_limit_default", S_IRUGO | S_IWUSR, ecm_sfe_ipv4_dentry,
- (u32 *)&ecm_sfe_ipv4_nack_limit_default)) {
- DEBUG_ERROR("Failed to create ecm sfe ipv4 nack_limit_default file in debugfs\n");
- goto task_cleanup;
- }
+ debugfs_create_u32("nack_limit_default", S_IRUGO | S_IWUSR, ecm_sfe_ipv4_dentry,
+ (u32 *)&ecm_sfe_ipv4_nack_limit_default);
- if (!debugfs_create_u32("accelerated_count", S_IRUGO, ecm_sfe_ipv4_dentry,
- (u32 *)&ecm_sfe_ipv4_accelerated_count)) {
- DEBUG_ERROR("Failed to create ecm sfe ipv4 accelerated_count file in debugfs\n");
- goto task_cleanup;
- }
+ debugfs_create_u32("accelerated_count", S_IRUGO, ecm_sfe_ipv4_dentry,
+ (u32 *)&ecm_sfe_ipv4_accelerated_count);
- if (!debugfs_create_u32("pending_accel_count", S_IRUGO, ecm_sfe_ipv4_dentry,
- (u32 *)&ecm_sfe_ipv4_pending_accel_count)) {
- DEBUG_ERROR("Failed to create ecm sfe ipv4 pending_accel_count file in debugfs\n");
- goto task_cleanup;
- }
+ debugfs_create_u32("pending_accel_count", S_IRUGO, ecm_sfe_ipv4_dentry,
+ (u32 *)&ecm_sfe_ipv4_pending_accel_count);
- if (!debugfs_create_u32("pending_decel_count", S_IRUGO, ecm_sfe_ipv4_dentry,
- (u32 *)&ecm_sfe_ipv4_pending_decel_count)) {
- DEBUG_ERROR("Failed to create ecm sfe ipv4 pending_decel_count file in debugfs\n");
- goto task_cleanup;
- }
+ debugfs_create_u32("pending_decel_count", S_IRUGO, ecm_sfe_ipv4_dentry,
+ (u32 *)&ecm_sfe_ipv4_pending_decel_count);
- if (!debugfs_create_file("accel_limit_mode", S_IRUGO | S_IWUSR, ecm_sfe_ipv4_dentry,
+ if(!debugfs_create_file("accel_limit_mode", S_IRUGO | S_IWUSR, ecm_sfe_ipv4_dentry,
NULL, &ecm_sfe_ipv4_accel_limit_mode_fops)) {
DEBUG_ERROR("Failed to create ecm sfe ipv4 accel_limit_mode file in debugfs\n");
goto task_cleanup;
--- a/frontends/sfe/ecm_sfe_ipv6.c
+++ b/frontends/sfe/ecm_sfe_ipv6.c
@@ -1528,48 +1528,27 @@ int ecm_sfe_ipv6_init(struct dentry *den
}
#ifdef CONFIG_XFRM
- if (!debugfs_create_u32("reject_acceleration_for_ipsec", S_IRUGO | S_IWUSR, ecm_sfe_ipv6_dentry,
- (u32 *)&ecm_sfe_ipv6_reject_acceleration_for_ipsec)) {
- DEBUG_ERROR("Failed to create ecm sfe ipv6 reject_acceleration_for_ipsec file in debugfs\n");
- goto task_cleanup;
- }
+ debugfs_create_u32("reject_acceleration_for_ipsec", S_IRUGO | S_IWUSR, ecm_sfe_ipv6_dentry,
+ (u32 *)&ecm_sfe_ipv6_reject_acceleration_for_ipsec);
#endif
- if (!debugfs_create_u32("no_action_limit_default", S_IRUGO | S_IWUSR, ecm_sfe_ipv6_dentry,
- (u32 *)&ecm_sfe_ipv6_no_action_limit_default)) {
- DEBUG_ERROR("Failed to create ecm sfe ipv6 no_action_limit_default file in debugfs\n");
- goto task_cleanup;
- }
+ debugfs_create_u32("no_action_limit_default", S_IRUGO | S_IWUSR, ecm_sfe_ipv6_dentry,
+ (u32 *)&ecm_sfe_ipv6_no_action_limit_default);
- if (!debugfs_create_u32("driver_fail_limit_default", S_IRUGO | S_IWUSR, ecm_sfe_ipv6_dentry,
- (u32 *)&ecm_sfe_ipv6_driver_fail_limit_default)) {
- DEBUG_ERROR("Failed to create ecm sfe ipv6 driver_fail_limit_default file in debugfs\n");
- goto task_cleanup;
- }
+ debugfs_create_u32("driver_fail_limit_default", S_IRUGO | S_IWUSR, ecm_sfe_ipv6_dentry,
+ (u32 *)&ecm_sfe_ipv6_driver_fail_limit_default);
- if (!debugfs_create_u32("nack_limit_default", S_IRUGO | S_IWUSR, ecm_sfe_ipv6_dentry,
- (u32 *)&ecm_sfe_ipv6_nack_limit_default)) {
- DEBUG_ERROR("Failed to create ecm sfe ipv6 nack_limit_default file in debugfs\n");
- goto task_cleanup;
- }
+ debugfs_create_u32("nack_limit_default", S_IRUGO | S_IWUSR, ecm_sfe_ipv6_dentry,
+ (u32 *)&ecm_sfe_ipv6_nack_limit_default);
- if (!debugfs_create_u32("accelerated_count", S_IRUGO, ecm_sfe_ipv6_dentry,
- (u32 *)&ecm_sfe_ipv6_accelerated_count)) {
- DEBUG_ERROR("Failed to create ecm sfe ipv6 accelerated_count file in debugfs\n");
- goto task_cleanup;
- }
+ debugfs_create_u32("accelerated_count", S_IRUGO, ecm_sfe_ipv6_dentry,
+ (u32 *)&ecm_sfe_ipv6_accelerated_count);
- if (!debugfs_create_u32("pending_accel_count", S_IRUGO, ecm_sfe_ipv6_dentry,
- (u32 *)&ecm_sfe_ipv6_pending_accel_count)) {
- DEBUG_ERROR("Failed to create ecm sfe ipv6 pending_accel_count file in debugfs\n");
- goto task_cleanup;
- }
+ debugfs_create_u32("pending_accel_count", S_IRUGO, ecm_sfe_ipv6_dentry,
+ (u32 *)&ecm_sfe_ipv6_pending_accel_count);
- if (!debugfs_create_u32("pending_decel_count", S_IRUGO, ecm_sfe_ipv6_dentry,
- (u32 *)&ecm_sfe_ipv6_pending_decel_count)) {
- DEBUG_ERROR("Failed to create ecm sfe ipv6 pending_decel_count file in debugfs\n");
- goto task_cleanup;
- }
+ debugfs_create_u32("pending_decel_count", S_IRUGO, ecm_sfe_ipv6_dentry,
+ (u32 *)&ecm_sfe_ipv6_pending_decel_count);
if (!debugfs_create_file("accel_limit_mode", S_IRUGO | S_IWUSR, ecm_sfe_ipv6_dentry,
NULL, &ecm_sfe_ipv6_accel_limit_mode_fops)) {
--- a/frontends/sfe/ecm_sfe_non_ported_ipv4.c
+++ b/frontends/sfe/ecm_sfe_non_ported_ipv4.c
@@ -2239,11 +2239,8 @@ done:
*/
bool ecm_sfe_non_ported_ipv4_debugfs_init(struct dentry *dentry)
{
- if (!debugfs_create_u32("non_ported_accelerated_count", S_IRUGO, dentry,
- (u32 *)&ecm_sfe_non_ported_ipv4_accelerated_count)) {
- DEBUG_ERROR("Failed to create ecm sfe ipv4 non_ported_accelerated_count file in debugfs\n");
- return false;
- }
+ debugfs_create_u32("non_ported_accelerated_count", S_IRUGO, dentry,
+ (u32 *)&ecm_sfe_non_ported_ipv4_accelerated_count);
return true;
}
--- a/frontends/sfe/ecm_sfe_non_ported_ipv6.c
+++ b/frontends/sfe/ecm_sfe_non_ported_ipv6.c
@@ -2039,11 +2039,8 @@ done:
*/
bool ecm_sfe_non_ported_ipv6_debugfs_init(struct dentry *dentry)
{
- if (!debugfs_create_u32("non_ported_accelerated_count", S_IRUGO, dentry,
- (u32 *)&ecm_sfe_non_ported_ipv6_accelerated_count)) {
- DEBUG_ERROR("Failed to create ecm sfe ipv6 non_ported_accelerated_count file in debugfs\n");
- return false;
- }
+ debugfs_create_u32("non_ported_accelerated_count", S_IRUGO, dentry,
+ (u32 *)&ecm_sfe_non_ported_ipv6_accelerated_count);
return true;
}
--- a/frontends/sfe/ecm_sfe_ported_ipv4.c
+++ b/frontends/sfe/ecm_sfe_ported_ipv4.c
@@ -2451,12 +2451,8 @@ bool ecm_sfe_ported_ipv4_debugfs_init(st
return false;
}
- if (!debugfs_create_u32("tcp_accelerated_count", S_IRUGO, dentry,
- &ecm_sfe_ported_ipv4_accelerated_count[ECM_SFE_PORTED_IPV4_PROTO_TCP])) {
- DEBUG_ERROR("Failed to create ecm sfe ipv4 tcp_accelerated_count file in debugfs\n");
- debugfs_remove(udp_dentry);
- return false;
- }
+ debugfs_create_u32("tcp_accelerated_count", S_IRUGO, dentry,
+ &ecm_sfe_ported_ipv4_accelerated_count[ECM_SFE_PORTED_IPV4_PROTO_TCP]);
return true;
}
--- a/frontends/sfe/ecm_sfe_ported_ipv6.c
+++ b/frontends/sfe/ecm_sfe_ported_ipv6.c
@@ -2295,12 +2295,8 @@ bool ecm_sfe_ported_ipv6_debugfs_init(st
return false;
}
- if (!debugfs_create_u32("tcp_accelerated_count", S_IRUGO, dentry,
- &ecm_sfe_ported_ipv6_accelerated_count[ECM_SFE_PORTED_IPV6_PROTO_TCP])) {
- DEBUG_ERROR("Failed to create ecm sfe ipv6 tcp_accelerated_count file in debugfs\n");
- debugfs_remove(udp_dentry);
- return false;
- }
+ debugfs_create_u32("tcp_accelerated_count", S_IRUGO, dentry,
+ &ecm_sfe_ported_ipv6_accelerated_count[ECM_SFE_PORTED_IPV6_PROTO_TCP]);
return true;
}
--- a/ecm_interface.c
+++ b/ecm_interface.c
@@ -136,7 +136,7 @@ static struct ecm_interface_wifi_event _
/*
* TODO: Remove once the Linux image and headers get propogated.
*/
-struct net_device *ipv6_dev_find(struct net *net, struct in6_addr *addr, int strict);
+struct net_device *qca_ipv6_dev_find(struct net *net, struct in6_addr *addr, int strict);
#endif
#ifdef ECM_INTERFACE_IPSEC_GLUE_LAYER_SUPPORT_ENABLE
@@ -301,7 +301,7 @@ static struct net_device *ecm_interface_
struct net_device *dev;
ECM_IP_ADDR_TO_NIN6_ADDR(addr6, addr);
- dev = (struct net_device *)ipv6_dev_find(&init_net, &addr6, 1);
+ dev = (struct net_device *)qca_ipv6_dev_find(&init_net, &addr6, 1);
return dev;
}
#endif
@@ -716,7 +716,7 @@ static bool ecm_interface_mac_addr_get_i
* Get the MAC address that corresponds to IP address given.
*/
ECM_IP_ADDR_TO_NIN6_ADDR(daddr, addr);
- local_dev = ipv6_dev_find(&init_net, &daddr, 1);
+ local_dev = qca_ipv6_dev_find(&init_net, &daddr, 1);
if (local_dev) {
DEBUG_TRACE("%pi6 is a local address\n", &daddr);
memcpy(mac_addr, dev->dev_addr, ETH_ALEN);
--- a/Makefile
+++ b/Makefile
@@ -218,7 +218,7 @@ ccflags-$(ECM_CLASSIFIER_NL_ENABLE) += -
# #############################################################################
# Define ECM_CLASSIFIER_DSCP_ENABLE=y in order to enable DSCP classifier.
# #############################################################################
-ECM_CLASSIFIER_DSCP_ENABLE=y
+ECM_CLASSIFIER_DSCP_ENABLE=n
ecm-$(ECM_CLASSIFIER_DSCP_ENABLE) += ecm_classifier_dscp.o
ccflags-$(ECM_CLASSIFIER_DSCP_ENABLE) += -DECM_CLASSIFIER_DSCP_ENABLE