ppp and GPRS

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

ppp and GPRS

Heike-2
Hi,

I try to setup a GPRS-PPP connection.
It works with the raw-API, but very slow.
I just want to try to run it with the sequential API, but I don't know
how to initialize it.

No I do it:
...
        tcp_init();
        //start TCP/IP Thread
        tcpip_init(tcpipInitDone,sem);

        pppInit();
       
...

    tcp_accept(pcb, http_accept);
   
    pppSetAuth(PPPAUTHTYPE_ANY,"wap","wap");
    //TODO number of port
        comPort = sio_open(3);
        //start PPP Thread
        hppp = pppOpen( comPort, linkStatusCB, NULL );
       
        m_ps_conn = netconn_new(NETCONN_TCP);
        netconn_bind(m_ps_conn,IP_ADDR_ANY,80); //(ip_addr*)NULL, 80);
       
        netconn_listen(m_ps_conn);
        while (1)
        {
            m_ps_newconn = netconn_accept(m_ps_conn);
            v_ProcessHTTPRequest();
            netconn_delete(m_ps_newconn);
        }

...

but netconn_accept receives no data ...

any ideas?

Heike



_______________________________________________
lwip-users mailing list
[hidden email]
http://lists.nongnu.org/mailman/listinfo/lwip-users
Reply | Threaded
Open this post in threaded view
|

Re: ppp and GPRS

Kieran Mansley
On Fri, 2006-10-27 at 16:06 +0200, [hidden email] wrote:
> Hi,
>
> I try to setup a GPRS-PPP connection.
> It works with the raw-API, but very slow.
> I just want to try to run it with the sequential API, but I don't know
> how to initialize it.

I'm no expert on PPP, but if you're hoping the sequential API is faster
than the raw API, you're going to be disappointed.  It's much slower in
most cases.

Kieran



_______________________________________________
lwip-users mailing list
[hidden email]
http://lists.nongnu.org/mailman/listinfo/lwip-users
Reply | Threaded
Open this post in threaded view
|

Re: ppp and GPRS

Janusz U.
In reply to this post by Heike-2
hi

> No I do it:
> ...
> tcp_init();
> //start TCP/IP Thread
> tcpip_init(tcpipInitDone,sem);
>
> pppInit();
>
> ...
>

it seems to be ok

>   tcp_accept(pcb, http_accept);

why??? it is not needed here!

>   pppSetAuth(PPPAUTHTYPE_ANY,"wap","wap");
>   //TODO number of port
> comPort = sio_open(3);
> //start PPP Thread
> hppp = pppOpen( comPort, linkStatusCB, NULL );

here you should wait for connection by linkStatusCB function or set instead
linkStatusCB NULL value if you want to know connection was established

> m_ps_conn = netconn_new(NETCONN_TCP);
> netconn_bind(m_ps_conn,IP_ADDR_ANY,80); //(ip_addr*)NULL, 80);
>
> netconn_listen(m_ps_conn);
> while (1)
> {
>     m_ps_newconn = netconn_accept(m_ps_conn);
>     v_ProcessHTTPRequest();
>     netconn_delete(m_ps_newconn);
> }

please try to set debug options in lwipopts.h:
/* ---------- PPP options ---------- */

#define PPP_SUPPORT                     1      /* Set for PPP */

#if PPP_SUPPORT
#define PPP_THREAD_PRIO     4//2
#define NUM_PPP                         1      /* Max PPP sessions. */
#define PAP_SUPPORT                     1      /* Set for PAP. */
#define CHAP_SUPPORT                    0      /* Set for CHAP. */
#define MSCHAP_SUPPORT                  0      /* Set for MSCHAP (NOT
FUNCTIONAL!) */
#define CBCP_SUPPORT                    0      /* Set for CBCP (NOT
FUNCTIONAL!) */
#define CCP_SUPPORT                     0      /* Set for CCP (NOT
FUNCTIONAL!) */
#define VJ_SUPPORT                      0      /* Set for VJ header
compression. */
#define MD5_SUPPORT                     1      /* Set for MD5 (see also
CHAP) */
#define PPP_DEBUG      1
#endif

#define IP_REASSEMBLY           1 // IP fragments

#define LWIP_DEBUG
extern void kprintf(const char *format,...);
#define LWIP_PLATFORM_DIAG(x) kprintf x

#define DBG_TYPES_ON                    0xff
#define ETHARP_DEBUG                    DBG_OFF
#define NETIF_DEBUG                     DBG_OFF
#define PBUF_DEBUG                      DBG_OFF
#define API_LIB_DEBUG                   DBG_OFF
#define API_MSG_DEBUG                   DBG_OFF
#define SOCKETS_DEBUG                   DBG_OFF
#define ICMP_DEBUG                      DBG_OFF
#define INET_DEBUG                      DBG_OFF
#define IP_DEBUG                        DBG_OFF
#define IP_REASS_DEBUG                  DBG_OFF
#define RAW_DEBUG                       DBG_OFF
#define MEM_DEBUG                       DBG_OFF
#define MEMP_DEBUG                      DBG_OFF
#define SYS_DEBUG                       DBG_OFF
#define TCP_DEBUG                       DBG_ON
#define TCP_INPUT_DEBUG                 DBG_OFF
#define TCP_FR_DEBUG                    DBG_OFF
#define TCP_RTO_DEBUG                   DBG_OFF
#define TCP_REXMIT_DEBUG                DBG_OFF
#define TCP_CWND_DEBUG                  DBG_OFF
#define TCP_WND_DEBUG                   DBG_OFF
#define TCP_OUTPUT_DEBUG                DBG_OFF
#define TCP_RST_DEBUG                   DBG_OFF
#define TCP_QLEN_DEBUG                  DBG_OFF
#define UDP_DEBUG                       DBG_OFF
#define TCPIP_DEBUG                     DBG_OFF
#define DBG_MIN_LEVEL                   DBG_LEVEL_OFF

kind regards
Janusz U.



_______________________________________________
lwip-users mailing list
[hidden email]
http://lists.nongnu.org/mailman/listinfo/lwip-users
Reply | Threaded
Open this post in threaded view
|

Re: ppp and GPRS

Janusz U.
In reply to this post by Kieran Mansley
> I'm no expert on PPP, but if you're hoping the sequential API is faster
> than the raw API, you're going to be disappointed.  It's much slower in
> most cases.

exactly. Your PPP is as efficient as your link connection and sio_read
function. I've modified my sio_read function several times - it is hard to
do it finally ideal with queues of OS like eg. freeRTOS, interrupts and flow
control. You should check by debug console how often you receive ppp packets
(netif: pppInput) and send packets (netif: pppOutput).

example:
static char comm_read_blocked[COMM_MAX];

int comm_read(int port, char *buf, int n)
{
 char line;
 int len;

 if (n < 1) return COMM_ERRBUFSIZE;
 comm_read_blocked[port] = 1;
 comm_blockRx(port);
 len = 0;
 while (1) {         // readout
  // getc with line
  if (xQueueReceive( xCharsRx[port], buf, comRX_BLOCK_TIME ) != pdTRUE) {
    //kprintf("comm_read COMM_ERRNOCHAR!\n");
    if (!comm_read_blocked[port]) {
     comm_unblockRx(port);
     return COMM_READABORT;
    }
    if (len != 0) break;
  } else {
   if (*buf == comLINECHAR) {
    if (xQueueReceive( xLinesRx[port], &line, comRX_BLOCK_TIME ) != pdTRUE)
     kprintf("comm_read COMM_ERRQUEUE!\n");
   }

   if (xFlowCTL[port] == FLOWCTRL_SW) {
    switch(port) {
     case USART0:
      if (uxQueueMessagesWaiting(xCharsRx[USART0]) <= USART0_RX_LOWATER)
       USART0_clrRTS();
      break;

     case USART1:
      if (uxQueueMessagesWaiting(xCharsRx[USART1]) <= USART1_RX_LOWATER)
       USART1_clrRTS();
      break;

     case DUSART:
      break;

     default:
      comm_unblockRx(port);
      return COMM_ERRPORT;
    } // switch
   }
   buf++;
   len++;
   if (len >= n) break;    // buffer is full
  }
 }
 comm_unblockRx(port);
    return len;
}

best regards
Janusz U.



_______________________________________________
lwip-users mailing list
[hidden email]
http://lists.nongnu.org/mailman/listinfo/lwip-users