public inbox for ecos-bugs@sourceware.org
help / color / mirror / Atom feed
From: bugzilla-daemon@bugs.ecos.sourceware.org
To: unassigned@bugs.ecos.sourceware.org
Subject: [Bug 1001873] Patches to upgrade lwip to 1.4.1
Date: Tue, 10 Jun 2014 08:27:00 -0000	[thread overview]
Message-ID: <bug-1001873-777-jZIcS6dUex@http.bugs.ecos.sourceware.org/> (raw)
In-Reply-To: <bug-1001873-777@http.bugs.ecos.sourceware.org/>

Please do not reply to this email, use the link below.

http://bugs.ecos.sourceware.org/show_bug.cgi?id=1001873

--- Comment #48 from Oleg Uzenkov <o.uzenkov@unicore.co.ua> ---
Ilija,

(In reply to comment #47)
> Oleg
> 
> (In reply to comment #46)
> 
> Thank you for your report. I have some additional questions.
> 
> > Hi Ilija,
> > 
> 
> [SNIP]
> 
> > 
> > (This is just a snipet from the log.)
> > Apparently, it meant that I did not receive anything from GPRS modem through
> > the serial port. That happened quite often, however, successful connection
> > did happen also.
> 
> What was your serial line setting: baud rate, (hardware) handshaking ?

Serial settings: 9600, 8N1 (no hw/sw control)

> 
> > 
> > But when I started using GPRS VPN service from my cellular network provider
> > this problem has not shown up yet. I have tested it several times and there
> > was always  a successfull connection. So I believe now, the problem was
> > related to the quality of service and not to the PPP (1.4.1) implementation.
> 
> Can you try different locations?

I tired two providers. 

> 
> Ilija

Another problem came up:
Sometimes when ppp connection gets terminated (it can happen all of a sudden,
not sure why) and the stack is then trying to reconnect (i have a state machine
logic, see below), it cannot open serial port (pppOpen, pd is negative, see
below) again after it has been closed with pppClose. Please note, sometimes it
can reopen serial port, but not always. The lwip stack is in simple mode (i.e.
NO_SYS=1).

With 1.3.2 version of ppp I do not have these problems.

Here is the code snippet with the logic:
  void ppp_service::_thread_func (cyg_addrword_t p)
  {
    int err;
    cyg_uint32 len;
    cyg_uint32 cfg_data;
    int pd = -1;
    sio_fd_t sd;
    chat_t chat;

    int count;
    static const cyg_uint32 buf_length = 128;
    u8_t rxbuf[buf_length];

    ppp_service * srv = reinterpret_cast<ppp_service *> (p);

    /*configure serial port */
    err = cyg_io_lookup (SERIAL_PORT, &sd);
    LOG_ASSERT (err == ENOERR);
    LOG_ASSERT (sd != NULL);

    /* read port configuration */
    cyg_serial_info_t port_info;
    cyg_uint32 port_info_len = sizeof (port_info);
    err = cyg_io_get_config (sd,
              CYG_IO_GET_CONFIG_SERIAL_INFO,
              &port_info,
              &port_info_len);
    LOG_ASSERT (err == ENOERR);

    /* update port configuration */
    port_info_len = sizeof (port_info);

    port_info.baud = CYGNUM_SERIAL_BAUD_9600;
    port_info.stop = CYGNUM_SERIAL_STOP_1;
    port_info.parity = CYGNUM_SERIAL_PARITY_NONE;
    port_info.word_length = CYGNUM_SERIAL_WORD_LENGTH_8;

    err = cyg_io_set_config (sd,
              CYG_IO_SET_CONFIG_SERIAL_INFO,
              &port_info,
              &port_info_len);
    LOG_ASSERT (err == ENOERR);

    /**
     * configure cyg_io_read to be non-blocking
     * since blocking cannot be used in interrupts
     */
    cfg_data = 0;
    len = sizeof(cfg_data);
    err = cyg_io_set_config (sd, CYG_IO_SET_CONFIG_READ_BLOCKING, &cfg_data,
&len);
    LOG_ASSERT (err == ENOERR);


    while (1) {
      switch (srv->_init_state) {
        case CHAT_INIT:
          chat = chat_new(sd, chat_items, CHAT_TIMEOUT, srv->_chat_cb,
                          srv->_chat_send_cb, static_cast<void*>(srv));
          srv->_init_state = CHAT_RUN;
          break;
        case CHAT_RUN:
          chat_poll(chat);
          break;
        case CHAT_FINISH:
          chat_free(chat);
          chat = NULL;
          if (srv->_chat_ok) {
            srv->_init_state = PPP_INIT;
          } else {
            srv->_init_state = CHAT_INIT;
          }
          break;
        case PPP_INIT:          
          pppInit();          
          pd = pppOpen(sd, srv->_ppp_status_cb, static_cast<void*>(srv));
          if (pd < 0) {
            syslog (LOG_CRIT, "Cannot open PPP over serial\n");
          }
          pppSetAuth(PPPAUTHTYPE_ANY, PPP_USER, PPP_PASSWORD);          
          srv->_init_state = PPP_INIT_WAIT;
          break;
        case PPP_INIT_WAIT:
          sys_check_timeouts();
          count = sio_read(sd, (u8_t*)rxbuf, buf_length);
          if(count > 0) 
          {
            pppos_input(pd, rxbuf, count);
          }
          else
          {
            sys_msleep(1);
            //cyg_thread_delay(10);
          }
          srv->_init_state = PPP_UP;
          break;        
        case PPP_UP:
          sys_check_timeouts();
          count = sio_read(sd, (u8_t*)rxbuf, buf_length);
          if(count > 0) 
          {
            pppos_input(pd, rxbuf, count);
          }
          else
          {
            sys_msleep(1);
            //cyg_thread_delay(10);
          }
          break;
        case FINISH:
          pppClose(pd);
          /* free chat if reconnect happend whilst chat init */
          if (chat != NULL)
          {
            chat_free(chat);
          }
          srv->_init_state = FINISH_WAIT;
          break;
        case FINISH_WAIT:
          srv->_init_state = CHAT_INIT;
          cyg_thread_delay(20); //wait for x clks
          break;
      }
      cyg_thread_yield();
    }
  }

We do need to port ppp-new branch to ecos as judging from the author's comments
it is more stable than the ppp implementation in vanilla 1.4.1 ppp stack (link:
http://lists.gnu.org/archive/html/lwip-users/2014-03/msg00061.html)

Oleg

-- 
You are receiving this mail because:
You are the assignee for the bug.


  parent reply	other threads:[~2014-06-10  8:27 UTC|newest]

Thread overview: 86+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-28  6:50 [Bug 1001873] New: " bugzilla-daemon
2013-06-28  6:50 ` [Bug 1001873] " bugzilla-daemon
2013-06-28  6:50 ` bugzilla-daemon
2013-06-28  6:51 ` bugzilla-daemon
2013-06-28  6:51 ` bugzilla-daemon
2013-06-28  6:51 ` bugzilla-daemon
2013-06-28  6:51 ` bugzilla-daemon
2013-06-28  6:52 ` bugzilla-daemon
2013-06-28  6:52 ` bugzilla-daemon
2013-06-30 22:03 ` bugzilla-daemon
2013-07-01 11:54 ` bugzilla-daemon
2013-07-01 11:55 ` bugzilla-daemon
2013-07-01 11:55 ` bugzilla-daemon
2013-07-01 11:56 ` bugzilla-daemon
2013-07-01 11:56 ` bugzilla-daemon
2013-07-01 11:56 ` bugzilla-daemon
2013-07-01 11:57 ` bugzilla-daemon
2013-07-01 11:57 ` bugzilla-daemon
2013-07-01 11:57 ` bugzilla-daemon
2013-07-01 11:58 ` bugzilla-daemon
2013-07-01 13:34 ` bugzilla-daemon
2013-08-09 16:13 ` bugzilla-daemon
2013-08-10 15:51 ` bugzilla-daemon
2013-09-06  7:00 ` bugzilla-daemon
2013-09-06  7:01 ` bugzilla-daemon
2013-09-13 20:30 ` bugzilla-daemon
2014-02-15  2:58 ` bugzilla-daemon
2014-02-25 15:44 ` bugzilla-daemon
2014-02-25 15:46 ` bugzilla-daemon
2014-02-25 15:47 ` bugzilla-daemon
2014-02-25 15:48 ` bugzilla-daemon
2014-02-25 15:48 ` bugzilla-daemon
2014-02-25 15:48 ` bugzilla-daemon
2014-02-25 15:49 ` bugzilla-daemon
2014-02-25 15:49 ` bugzilla-daemon
2014-02-25 15:50 ` bugzilla-daemon
2014-02-25 16:09 ` bugzilla-daemon
2014-02-25 16:09 ` bugzilla-daemon
2014-03-11 22:25 ` bugzilla-daemon
2014-05-07 14:57 ` bugzilla-daemon
2014-06-04 14:38 ` bugzilla-daemon
2014-06-06  7:46 ` bugzilla-daemon
2014-06-10  8:27 ` bugzilla-daemon [this message]
  -- strict thread matches above, loose matches on Subject: below --
2013-06-28  6:50 [Bug 1001873] New: " bugzilla-daemon
2013-06-28  6:50 ` [Bug 1001873] " bugzilla-daemon
2013-06-28  6:50 ` bugzilla-daemon
2013-06-28  6:51 ` bugzilla-daemon
2013-06-28  6:51 ` bugzilla-daemon
2013-06-28  6:51 ` bugzilla-daemon
2013-06-28  6:51 ` bugzilla-daemon
2013-06-28  6:52 ` bugzilla-daemon
2013-06-28  6:52 ` bugzilla-daemon
2013-06-30 22:03 ` bugzilla-daemon
2013-07-01 11:54 ` bugzilla-daemon
2013-07-01 11:55 ` bugzilla-daemon
2013-07-01 11:56 ` bugzilla-daemon
2013-07-01 11:56 ` bugzilla-daemon
2013-07-01 11:56 ` bugzilla-daemon
2013-07-01 11:56 ` bugzilla-daemon
2013-07-01 11:57 ` bugzilla-daemon
2013-07-01 11:57 ` bugzilla-daemon
2013-07-01 11:57 ` bugzilla-daemon
2013-07-01 11:58 ` bugzilla-daemon
2013-07-01 13:34 ` bugzilla-daemon
2013-08-09 16:13 ` bugzilla-daemon
2013-08-10 15:51 ` bugzilla-daemon
2013-09-06  7:01 ` bugzilla-daemon
2013-09-06  7:01 ` bugzilla-daemon
2014-02-25 15:44 ` bugzilla-daemon
2014-02-25 15:46 ` bugzilla-daemon
2014-02-25 15:47 ` bugzilla-daemon
2014-02-25 15:48 ` bugzilla-daemon
2014-02-25 15:48 ` bugzilla-daemon
2014-02-25 15:48 ` bugzilla-daemon
2014-02-25 15:49 ` bugzilla-daemon
2014-02-25 15:49 ` bugzilla-daemon
2014-02-25 15:50 ` bugzilla-daemon
2014-02-25 16:09 ` bugzilla-daemon
2014-02-25 16:09 ` bugzilla-daemon
2014-03-12  9:17 ` bugzilla-daemon
2014-03-12  9:36 ` bugzilla-daemon
2014-05-05 23:08 ` bugzilla-daemon
2014-06-04 14:38 ` bugzilla-daemon
2014-06-05 10:06 ` bugzilla-daemon
2014-06-06  7:46 ` bugzilla-daemon
2014-06-10  8:27 ` bugzilla-daemon
2014-06-10 11:05 ` bugzilla-daemon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-1001873-777-jZIcS6dUex@http.bugs.ecos.sourceware.org/ \
    --to=bugzilla-daemon@bugs.ecos.sourceware.org \
    --cc=unassigned@bugs.ecos.sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).