Skip to contentSkip to conversation

PPP: Fix transmit ACCM and receive ACCM setting issue

PATCH In review [email protected] 4 participants 9 messages Feb 12, 2011 – Feb 17, 2011

lore
Share & tools
lore
#0 lore raw

PATCH v3 1/3 PPP: Fix transmit ACCM and receive ACCM setting issue

From: Martin Xu <[email protected]>

Tramsmit ACCM and receive ACCM is mixed up. According to RFC1662 Section 7.1, ACCM Configuration Option is used to inform the peer which control characters MUST remain mapped when the peer sends them.

---
 gatchat/ppp_lcp.c |   16 ++++++++++++++--
 1 files changed, 14 insertions(+), 2 deletions(-)
gatchat/ppp_lcp.c +14 -2
index 3a80a62..cc3e231 100644
@@ -149,7 +149,13 @@ static void lcp_rca(struct pppcp_data *pppcp, const struct pppcp_packet *packet)
 	while (ppp_option_iter_next(&iter) == TRUE) {
 		switch (ppp_option_iter_get_type(&iter)) {
 		case ACCM:
-			ppp_set_xmit_accm(pppcp_get_ppp(pppcp), 0);
+			/*
+			 * RFC1662 Section 7.1
+			 * The Configuration Option is used to inform the peer
+			 * which control characters MUST remain mapped when
+			 * the peer sends them.
+			 */
+			ppp_set_recv_accm(pppcp_get_ppp(pppcp), 0);
 			break;
 		default:
 			break;
@@ -263,7 +269,13 @@ static enum rcr_result lcp_rcr(struct pppcp_data *pppcp,
 	while (ppp_option_iter_next(&iter) == TRUE) {
 		switch (ppp_option_iter_get_type(&iter)) {
 		case ACCM:
-			ppp_set_recv_accm(ppp,
+			/*
+			 * RFC1662 Section 7.1
+			 * The Configuration Option is used to inform the peer
+			 * which control characters MUST remain mapped when
+			 * the peer sends them.
+			 */
+			ppp_set_xmit_accm(ppp,
 				get_host_long(ppp_option_iter_get_data(&iter)));
 			break;
 		case AUTH_PROTO:
Signature · 1 line
1.6.1.3
#1 lore raw

PATCH v3 2/3 PPP: Use default ACCM (0xffffffff) to trasmit package

From: Martin Xu <[email protected]>

Using my Huawei EM770W modem, if set ACCM as 0x00000000, RXJ- event breaks PPP link, after IP package transmit for a while. Using default ACCM, the issue can be fixed.
I tested it at China Unicom networks.

---
 gatchat/ppp_lcp.c |    8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)
gatchat/ppp_lcp.c +5 -3
index cc3e231..91a8b67 100644
@@ -105,8 +105,7 @@ static void lcp_generate_config_options(struct lcp_data *lcp)
 
 static void lcp_reset_config_options(struct lcp_data *lcp)
 {
-	lcp->req_options = REQ_OPTION_ACCM;
-	lcp->accm = 0;
+	/* Using the default ACCM */
 
 	lcp_generate_config_options(lcp);
 }
@@ -147,6 +146,7 @@ static void lcp_rca(struct pppcp_data *pppcp, const struct pppcp_packet *packet)
 	ppp_option_iter_init(&iter, packet);
 
 	while (ppp_option_iter_next(&iter) == TRUE) {
+		const guint8 *data = ppp_option_iter_get_data(&iter);
 		switch (ppp_option_iter_get_type(&iter)) {
 		case ACCM:
 			/*
@@ -155,7 +155,9 @@ static void lcp_rca(struct pppcp_data *pppcp, const struct pppcp_packet *packet)
 			 * which control characters MUST remain mapped when
 			 * the peer sends them.
 			 */
-			ppp_set_recv_accm(pppcp_get_ppp(pppcp), 0);
+
+			ppp_set_recv_accm(pppcp_get_ppp(pppcp),
+					pppcpget_host_long(data));
 			break;
 		default:
 			break;
Signature · 1 line
1.6.1.3
#2 lore raw

PATCH v3 3/3 Huawei: set Huawei EM770W modem device to 00

From: Martin Xu <[email protected]>

Device 00 is ppp port. Setting it as 01, my Huawei EM770W modem PPP connection can't work

---
 plugins/ofono.rules |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
plugins/ofono.rules +1 -1
index 111f071..7dec243 100644
@@ -37,7 +37,7 @@ ATTRS{idVendor}=="12d1", ATTRS{idProduct}=="1401", ENV{OFONO_IFACE_NUM}=="02", E
 ATTRS{idVendor}=="12d1", ATTRS{idProduct}=="1402", ENV{OFONO_IFACE_NUM}=="00", ENV{OFONO_HUAWEI_TYPE}="Modem"
 ATTRS{idVendor}=="12d1", ATTRS{idProduct}=="1402", ENV{OFONO_IFACE_NUM}=="02", ENV{OFONO_HUAWEI_TYPE}="Pcui"
 
-ATTRS{idVendor}=="12d1", ATTRS{idProduct}=="1404", ENV{OFONO_IFACE_NUM}=="01", ENV{OFONO_HUAWEI_TYPE}="Modem"
+ATTRS{idVendor}=="12d1", ATTRS{idProduct}=="1404", ENV{OFONO_IFACE_NUM}=="00", ENV{OFONO_HUAWEI_TYPE}="Modem"
 ATTRS{idVendor}=="12d1", ATTRS{idProduct}=="1404", ENV{OFONO_IFACE_NUM}=="02", ENV{OFONO_HUAWEI_TYPE}="Pcui"
 ATTRS{idVendor}=="12d1", ATTRS{idProduct}=="1404", ENV{OFONO_HUAWEI_VOICE}="1"
 
Signature · 1 line
1.6.1.3
#3 lore raw

Re: [V3 PATCH 3/3] Huawei: set Huawei EM770W modem device to 00

Hi Martin,

Quoted 8 lines · martin.xu(a)intel.com

From: Martin Xu <[email protected]>

Device 00 is ppp port. Setting it as 01, my Huawei EM770W modem PPP connection can't work

---
 plugins/ofono.rules |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

This contradicts commit bb58a729073abcb6c5b0b2fb8b120973dfa42a07.

We really need a proper fix for this.

Regards,
-Denis

#4 lore raw

RE: [V3 PATCH 3/3] Huawei: set Huawei EM770W modem device to 00

Denis/Marcel:

Quoted 12 lines

-----Original Message-----
From: Denis Kenzior [mailto:denkenz(a)gmail.com]
Sent: Tuesday, February 15, 2011 4:28 AM
To: ofono(a)ofono.org
Cc: Xu, Martin
Subject: Re: [V3 PATCH 3/3] Huawei: set Huawei EM770W modem device to 00

Hi Martin,

Quoted 2 lines · martin.xu(a)intel.com

From: Martin Xu <[email protected]>

Quoted 8 lines
Quoted 6 lines

Device 00 is ppp port. Setting it as 01, my Huawei EM770W modem PPP connection can't work

---
 plugins/ofono.rules |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

This contradicts commit bb58a729073abcb6c5b0b2fb8b120973dfa42a07.

I can't quite understand why Dietrich needs to this commit. We formal configure can just make EM770W works. Could you help on this?

#5 lore raw

Re: [V3 PATCH 3/3] Huawei: set Huawei EM770W modem device to 00

Hi Martin,

Quoted 20 lines · Martin

Denis/Marcel:

Quoted 19 lines

-----Original Message-----
From: Denis Kenzior [mailto:denkenz(a)gmail.com]
Sent: Tuesday, February 15, 2011 4:28 AM
To: ofono(a)ofono.org
Cc: Xu, Martin
Subject: Re: [V3 PATCH 3/3] Huawei: set Huawei EM770W modem device to 00

Hi Martin,

Quoted 8 lines · martin.xu(a)intel.com

From: Martin Xu <[email protected]>

Device 00 is ppp port. Setting it as 01, my Huawei EM770W modem PPP connection can't work

---
 plugins/ofono.rules |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
Quoted 3 lines
Quoted 1 line

This contradicts commit bb58a729073abcb6c5b0b2fb8b120973dfa42a07.

I can't quite understand why Dietrich needs to this commit. We formal configure can just make EM770W works. Could you help on this?

The Huawei firmware is funny, it can actually reconfigure the modem and pcui ports (e.g. swap them). So we might have to be a bit smarter and figure out which ports are actually being used for what inside the modem driver.

Talk to Marcel, I believe he has played with the Huawei hardware the most and might have ideas on how to fix this.

Regards,
-Denis

#6 lore raw

Re: [V3 PATCH 3/3] Huawei: set Huawei EM770W modem device to 00

Hi Denis,

Quoted 8 lines
Quoted 3 lines
Quoted 1 line

This contradicts commit bb58a729073abcb6c5b0b2fb8b120973dfa42a07.

I can't quite understand why Dietrich needs to this commit. We formal configure can just make EM770W works. Could you help on this?

The Huawei firmware is funny, it can actually reconfigure the modem and pcui ports (e.g. swap them). So we might have to be a bit smarter and figure out which ports are actually being used for what inside the modem driver.

so I did apply this patch now since in the default settings the MDM port should be on interface 0. All other ones are tempered with.

Quoted 2 lines

Talk to Marcel, I believe he has played with the Huawei hardware the most and might have ideas on how to fix this.

And yes, I will add auto-detection for this now. It should be be possible to figure this out.

ofonod[908]: PCUI: > AT^GETPORTMODE\r
ofonod[908]: PCUI: < \r\n^getportmode:type:WCDMA:Qualcomm,MDM:0,NDIS:1,DIAG:2,PCUI:3\r\n\r\nOK\r\n

All latest modules support ^GETPORTMODE command and the ones that don't have only two ports anyway.

Regards

Marcel

#7 lore raw

Re: [V3 PATCH 2/3] PPP: Use default ACCM (0xffffffff) to trasmit package

In reply to [email protected]

Hi Martin,

Quoted 33 lines · martin.xu(a)intel.com

From: Martin Xu <[email protected]>

Using my Huawei EM770W modem, if set ACCM as 0x00000000, RXJ- event breaks PPP link, after IP package transmit for a while. Using default ACCM, the issue can be fixed.
I tested it at China Unicom networks.

---
 gatchat/ppp_lcp.c |    8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)
gatchat/ppp_lcp.c +2 -2
index cc3e231..91a8b67 100644
@@ -105,8 +105,7 @@ static void lcp_generate_config_options(struct lcp_data *lcp)
 
 static void lcp_reset_config_options(struct lcp_data *lcp)
 {
-	lcp->req_options = REQ_OPTION_ACCM;
-	lcp->accm = 0;
+	/* Using the default ACCM */
 
 	lcp_generate_config_options(lcp);
 }
@@ -147,6 +146,7 @@ static void lcp_rca(struct pppcp_data *pppcp, const struct pppcp_packet *packet)
 	ppp_option_iter_init(&iter, packet);
 
 	while (ppp_option_iter_next(&iter) == TRUE) {
+		const guint8 *data = ppp_option_iter_get_data(&iter);
 		switch (ppp_option_iter_get_type(&iter)) {
 		case ACCM:
 			/*

gatchat/ppp_lcp.c static void lcp_rca(struct pppcp_data *pppcp, const struct pppcp_packet *packet) · line 160

Quoted 7 lines
gatchat/ppp_lcp.c +3 -1
@@ -155,7 +155,9 @@ static void lcp_rca(struct pppcp_data *pppcp, const struct pppcp_packet *packet)
 			 * which control characters MUST remain mapped when
 			 * the peer sends them.
 			 */
-			ppp_set_recv_accm(pppcp_get_ppp(pppcp), 0);
+
+			ppp_set_recv_accm(pppcp_get_ppp(pppcp),
+					pppcpget_host_long(data));

make --no-print-directory all-am
CC gatchat/ppp_lcp.o
cc1: warnings being treated as errors gatchat/ppp_lcp.c: In function ‘lcp_rca’:
gatchat/ppp_lcp.c:160: error: implicit declaration of function ‘pppcpget_host_long’
make[1]: *** [gatchat/ppp_lcp.o] Error 1
make: *** [all] Error 2

gatchat/ppp_lcp.c static void lcp_rca(struct pppcp_data *pppcp, const struct pppcp_packet *packet) · line 163

Quoted 3 lines
gatchat/ppp_lcp.c +0 -0
 			break;
 		default:
 			break;

Regards,
-Denis

#8 lore raw
In reply to [email protected]

Hi Martin,

Quoted 10 lines · martin.xu(a)intel.com

From: Martin Xu <[email protected]>

Tramsmit ACCM and receive ACCM is mixed up. According to RFC1662 Section 7.1, ACCM Configuration Option is used to inform the peer which control characters MUST remain mapped when the peer sends them.

---
 gatchat/ppp_lcp.c |   16 ++++++++++++++--
 1 files changed, 14 insertions(+), 2 deletions(-)

Patch has been applied, thanks.

Regards,
-Denis