Skip to content

Commit aec5127

Browse files
author
Simon
committed
fix ecm
1 parent 4e1ddae commit aec5127

2 files changed

Lines changed: 211 additions & 4 deletions

File tree

PATCH/pkgs/sfev2/qca-nss-ecm/files/sfe-ecm.init

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,12 @@ sfe_enabled() {
3232
start_service() {
3333
if sfe_enabled; then
3434
logger -t sfe-ecm "SFE v2 + ECM acceleration: enabling"
35-
rmmod shortcut-fe 2>/dev/null
36-
rmmod shortcut-fe-ipv6 2>/dev/null
35+
lsmod | grep -q "^shortcut[-_]fe " && rmmod shortcut-fe
36+
lsmod | grep -q "^shortcut[-_]fe[-_]ipv6 " && rmmod shortcut-fe-ipv6
3737
modprobe qca-nss-sfe 2>/dev/null
3838
modprobe ecm 2>/dev/null
3939
sysctl -w net.ecm.ecm_classifier_default.accel_mode=2 2>/dev/null
40-
sysctl -w net.ecm.ecm_classifier_default.accel_delay_pkts=1 2>/dev/null
40+
sysctl -w net.ecm.ecm_classifier_default.accel_delay_pkts_v2=3 2>/dev/null
4141
fi
4242
}
4343

@@ -55,7 +55,7 @@ reload_service() {
5555
modprobe qca-nss-sfe 2>/dev/null
5656
modprobe ecm 2>/dev/null
5757
sysctl -w net.ecm.ecm_classifier_default.accel_mode=2 2>/dev/null
58-
sysctl -w net.ecm.ecm_classifier_default.accel_delay_pkts=1 2>/dev/null
58+
sysctl -w net.ecm.ecm_classifier_default.accel_delay_pkts_v2=3 2>/dev/null
5959
fi
6060
else
6161
# Should be disabled, unload if loaded
Lines changed: 207 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,207 @@
1+
--- a/ecm_classifier.c
2+
+++ b/ecm_classifier.c
3+
@@ -75,7 +75,7 @@
4+
* 1 - Acceleration will not start until both direction traffic is seen.
5+
* N - Acceleration will not start until N packets are seen in the slow path.
6+
*/
7+
-int ecm_classifier_accel_delay_pkts = 0;
8+
+int ecm_classifier_accel_delay_pkts_v2 = 0;
9+
10+
/*
11+
* ecm_classifier_assign_classifier()
12+
--- a/ecm_classifier.h
13+
+++ b/ecm_classifier.h
14+
@@ -19,7 +19,7 @@
15+
16+
#define ECM_CLASSIFIER_UDP_IPSEC_PORT 5200 /* Default port for UDP IPsec */
17+
18+
-extern int ecm_classifier_accel_delay_pkts; /* Default slow path packets allowed before the acceleration */
19+
+extern int ecm_classifier_accel_delay_pkts_v2; /* Default slow path packets allowed before the acceleration */
20+
21+
struct ecm_classifier_instance;
22+
23+
--- a/ecm_classifier_default.c
24+
+++ b/ecm_classifier_default.c
25+
@@ -231,7 +231,7 @@ static bool ecm_classifier_default_ready
26+
/*
27+
* Delay forever until seeing the reply packet.
28+
*/
29+
- if (ecm_classifier_accel_delay_pkts == 1) {
30+
+ if (ecm_classifier_accel_delay_pkts_v2 == 1) {
31+
DEBUG_INFO("%px: Checking both direction traffic\n", cdii);
32+
33+
/*
34+
@@ -251,7 +251,7 @@ static bool ecm_classifier_default_ready
35+
36+
/*
37+
* Delay the acceleration until we see <N> number of packets.
38+
- * ecm_classifier_accel_delay_pkts = <N>
39+
+ * ecm_classifier_accel_delay_pkts_v2 = <N>
40+
*/
41+
ci = ecm_db_connection_serial_find_and_ref(cdii->ci_serial);
42+
if (!ci) {
43+
@@ -270,9 +270,9 @@ static bool ecm_classifier_default_ready
44+
/*
45+
* Check if we have seen slow path packets as the predefined count.
46+
*/
47+
- if (slow_pkts < ecm_classifier_accel_delay_pkts) {
48+
+ if (slow_pkts < ecm_classifier_accel_delay_pkts_v2) {
49+
DEBUG_TRACE("%px: delay the acceleration: slow packets: %llu default delay packet count: %d\n",
50+
- cdii, slow_pkts, ecm_classifier_accel_delay_pkts);
51+
+ cdii, slow_pkts, ecm_classifier_accel_delay_pkts_v2);
52+
53+
/*
54+
* We haven't reached the slow path packet limit.
55+
@@ -440,7 +440,7 @@ check_delay:
56+
/*
57+
* Should we delay the acceleration?
58+
*/
59+
- if (ecm_classifier_accel_delay_pkts) {
60+
+ if (ecm_classifier_accel_delay_pkts_v2) {
61+
if (!ecm_classifier_default_ready_for_accel(cdii, sender)) {
62+
DEBUG_INFO("%px: connection is not ready for accel\n", cdii);
63+
spin_lock_bh(&ecm_classifier_default_lock);
64+
@@ -621,7 +621,7 @@ static int ecm_classifier_default_state_
65+
if ((result = ecm_state_write(sfi, "timer_group", "%d", timer_group))) {
66+
return result;
67+
}
68+
- if ((result = ecm_state_write(sfi, "accel_delay_pkt_default", "%d", ecm_classifier_accel_delay_pkts))) {
69+
+ if ((result = ecm_state_write(sfi, "accel_delay_pkt_default", "%d", ecm_classifier_accel_delay_pkts_v2))) {
70+
return result;
71+
}
72+
73+
@@ -750,11 +750,11 @@ static int ecm_classifier_default_accel_
74+
}
75+
76+
/*
77+
- * ecm_classifier_accel_delay_pkts_handler()
78+
+ * ecm_classifier_accel_delay_pkts_v2_handler()
79+
* Proc handler to handle slow path packets allowed
80+
* before acceleration
81+
*/
82+
-static int ecm_classifier_accel_delay_pkts_handler(const struct ctl_table *ctl, int write, void *buffer, size_t *lenp, loff_t *ppos)
83+
+static int ecm_classifier_accel_delay_pkts_v2_handler(const struct ctl_table *ctl, int write, void *buffer, size_t *lenp, loff_t *ppos)
84+
{
85+
/*
86+
* Usage:
87+
@@ -779,7 +779,7 @@ static int ecm_classifier_accel_delay_pk
88+
/*
89+
* Write the value with user input
90+
*/
91+
- current_val = ecm_classifier_accel_delay_pkts;
92+
+ current_val = ecm_classifier_accel_delay_pkts_v2;
93+
if (write) {
94+
int *valp = (int *)buffer;
95+
printk(KERN_ALERT "ECM DEBUG: accel_delay_pkts handler called. Write=1. Old=%d. User wants to write %d (from buffer?? proc_dointvec will parse it)\n", current_val, *valp);
96+
@@ -797,8 +797,8 @@ static int ecm_classifier_accel_delay_pk
97+
return ret;
98+
}
99+
100+
- if (ecm_classifier_accel_delay_pkts < 0) {
101+
- ecm_classifier_accel_delay_pkts = current_val;
102+
+ if (ecm_classifier_accel_delay_pkts_v2 < 0) {
103+
+ ecm_classifier_accel_delay_pkts_v2 = current_val;
104+
DEBUG_ERROR("Invalid input, Valid inout should be positive\n");
105+
return -EINVAL;
106+
}
107+
@@ -822,11 +822,11 @@ static const struct ctl_table ecm_classi
108+
.proc_handler = &ecm_classifier_default_accel_mode_handler,
109+
},
110+
{
111+
- .procname = "accel_delay_pkts",
112+
- .data = &ecm_classifier_accel_delay_pkts,
113+
+ .procname = "accel_delay_pkts_v2",
114+
+ .data = &ecm_classifier_accel_delay_pkts_v2,
115+
.maxlen = sizeof(int),
116+
.mode = 0644,
117+
- .proc_handler = &ecm_classifier_accel_delay_pkts_handler,
118+
+ .proc_handler = &ecm_classifier_accel_delay_pkts_v2_handler,
119+
},
120+
{ }
121+
};
122+
@@ -980,8 +980,8 @@ int ecm_classifier_default_init(struct d
123+
(u32 *)&ecm_classifier_default_enabled);
124+
ecm_debugfs_create_u32("accel_mode", S_IRUGO | S_IWUSR, ecm_classifier_default_dentry,
125+
(u32 *)&ecm_classifier_default_accel_mode);
126+
- ecm_debugfs_create_u32("accel_delay_pkts", S_IRUGO | S_IWUSR, ecm_classifier_default_dentry,
127+
- (u32 *)&ecm_classifier_accel_delay_pkts);
128+
+ ecm_debugfs_create_u32("accel_delay_pkts_v2", S_IRUGO | S_IWUSR, ecm_classifier_default_dentry,
129+
+ (u32 *)&ecm_classifier_accel_delay_pkts_v2);
130+
131+
return 0;
132+
}
133+
--- a/ecm_classifier_dscp.c
134+
+++ b/ecm_classifier_dscp.c
135+
@@ -461,7 +461,7 @@ static void ecm_classifier_dscp_process(
136+
* Option 2: Wait for seeing N number of packets. If we still don't see reply,
137+
* set the uni-directional values.
138+
*/
139+
- if (ecm_classifier_accel_delay_pkts) {
140+
+ if (ecm_classifier_accel_delay_pkts_v2) {
141+
/*
142+
* Stop the processing if both side packets are already seen.
143+
* Above the process response is already set to allow the
144+
@@ -485,11 +485,11 @@ static void ecm_classifier_dscp_process(
145+
/*
146+
* Deny the acceleration if any of the below options holds true.
147+
* For option 1, we wait forever
148+
- * For option 2, we wait until seeing ecm_classifier_accel_delay_pkts.
149+
+ * For option 2, we wait until seeing ecm_classifier_accel_delay_pkts_v2.
150+
*/
151+
- if ((ecm_classifier_accel_delay_pkts == 1) || (slow_pkts < ecm_classifier_accel_delay_pkts)) {
152+
+ if ((ecm_classifier_accel_delay_pkts_v2 == 1) || (slow_pkts < ecm_classifier_accel_delay_pkts_v2)) {
153+
DEBUG_TRACE("%px: accel_delay_pkts: %d slow_pkts: %llu accel is not allowed yet\n",
154+
- cdscpi, ecm_classifier_accel_delay_pkts, slow_pkts);
155+
+ cdscpi, ecm_classifier_accel_delay_pkts_v2, slow_pkts);
156+
cdscpi->process_response.accel_mode = ECM_CLASSIFIER_ACCELERATION_MODE_NO;
157+
goto dscp_classifier_out;
158+
}
159+
--- a/ecm_classifier_emesh.c
160+
+++ b/ecm_classifier_emesh.c
161+
@@ -2245,7 +2245,7 @@ sawf_classifier_out:
162+
* Option 2: Wait for seeing N number of packets. If we still don't see reply,
163+
* set the uni-directional values.
164+
*/
165+
- if (ecm_classifier_accel_delay_pkts) {
166+
+ if (ecm_classifier_accel_delay_pkts_v2) {
167+
/*
168+
* Stop the processing if both side packets are already seen.
169+
* Above the process response is already set to allow the
170+
@@ -2269,11 +2269,11 @@ sawf_classifier_out:
171+
/*
172+
* Deny the acceleration if any of the below options holds true.
173+
* For option 1, we wait forever
174+
- * For option 2, we wait until seeing ecm_classifier_accel_delay_pkts.
175+
+ * For option 2, we wait until seeing ecm_classifier_accel_delay_pkts_v2.
176+
*/
177+
- if ((ecm_classifier_accel_delay_pkts == 1) || (slow_pkts < ecm_classifier_accel_delay_pkts)) {
178+
+ if ((ecm_classifier_accel_delay_pkts_v2 == 1) || (slow_pkts < ecm_classifier_accel_delay_pkts_v2)) {
179+
DEBUG_TRACE("%px: accel_delay_pkts: %d slow_pkts: %llu accel is not allowed yet\n",
180+
- cemi, ecm_classifier_accel_delay_pkts, slow_pkts);
181+
+ cemi, ecm_classifier_accel_delay_pkts_v2, slow_pkts);
182+
spin_lock_bh(&ecm_classifier_emesh_sawf_lock);
183+
cemi->process_response.accel_mode = ECM_CLASSIFIER_ACCELERATION_MODE_NO;
184+
goto sawf_emesh_classifier_out;
185+
--- a/ecm_classifier_wifi.c
186+
+++ b/ecm_classifier_wifi.c
187+
@@ -382,7 +382,7 @@ static void ecm_classifier_wifi_process(
188+
goto process_wifi_classifier_out;
189+
}
190+
191+
- if (ecm_classifier_accel_delay_pkts) {
192+
+ if (ecm_classifier_accel_delay_pkts_v2) {
193+
194+
/*
195+
* Store the PCP value in the classifier instance and
196+
@@ -390,9 +390,9 @@ static void ecm_classifier_wifi_process(
197+
*/
198+
ecm_classifier_wifi_fill_pcp(cwifii, sender, skb);
199+
200+
- if ((ecm_classifier_accel_delay_pkts == 1) || (slow_pkts < ecm_classifier_accel_delay_pkts)) {
201+
+ if ((ecm_classifier_accel_delay_pkts_v2 == 1) || (slow_pkts < ecm_classifier_accel_delay_pkts_v2)) {
202+
DEBUG_TRACE("%px: accel_delay_pkts: %d slow_pkts: %llu accel is not allowed yet\n",
203+
- cwifii, ecm_classifier_accel_delay_pkts, slow_pkts);
204+
+ cwifii, ecm_classifier_accel_delay_pkts_v2, slow_pkts);
205+
cwifii->process_response.accel_mode = ECM_CLASSIFIER_ACCELERATION_MODE_NO;
206+
goto process_wifi_classifier_out;
207+
}

0 commit comments

Comments
 (0)