[PATCH rtems-libbsd] ppp: Fix transmitting data

Chris Johns chrisj at rtems.org
Fri Aug 13 08:01:07 UTC 2021


On 13/8/21 5:22 pm, Christian MAUDERER wrote:
> Hello Chris,
> 
> Am 13.08.21 um 04:46 schrieb Chris Johns:
>> On 12/8/21 9:42 pm, Christian Mauderer wrote:
>>> The pppstart expected that a driver write would somehow magically
>>> process all data passed to the write function. Because ppp disables all
>>> buffering that originally has been in termios, that assumption is not
>>> true for all but polled drivers.
>>>
>>> With this patch, the pppstart now gets and processes the feedback that
>>> is returned from the driver via rtems_termios_dequeue_characters.
>>>
>>> Fixes #4493
>>> ---
>>>   rtemsbsd/sys/net/if_ppp.c    | 11 ++++++-----
>>>   rtemsbsd/sys/net/if_pppvar.h |  1 +
>>>   rtemsbsd/sys/net/ppp_tty.c   | 32 ++++++++++++++++++++++++++++----
>>>   3 files changed, 35 insertions(+), 9 deletions(-)
>>>
>>> diff --git a/rtemsbsd/sys/net/if_ppp.c b/rtemsbsd/sys/net/if_ppp.c
>>> index 709f13e04..e134dc760 100644
>>> --- a/rtemsbsd/sys/net/if_ppp.c
>>> +++ b/rtemsbsd/sys/net/if_ppp.c
>>> @@ -313,11 +313,12 @@ static rtems_task ppp_txdaemon(rtems_task_argument arg)
>>>         frag=0;
>>>           /* initialize output values */
>>> -      sc->sc_outfcs    = PPP_INITFCS;
>>> -      sc->sc_outbuf    = (u_char *)0;
>>> -      sc->sc_outlen    = (short   )0;
>>> -      sc->sc_outoff    = (short   )0;
>>> -      sc->sc_outfcslen = (short   )0;
>>> +      sc->sc_outfcs        = PPP_INITFCS;
>>> +      sc->sc_outbuf        = (u_char *)0;
>>> +      sc->sc_outlen        = (short   )0;
>>> +      sc->sc_outoff        = (short   )0;
>>> +      sc->sc_outoff_update = false;
>>> +      sc->sc_outfcslen     = (short   )0;
>>
>> This is not the FreeBSD clang-format. Once my changes are pushed you can use the
>> style to reformat this code.
> 
> I touched only a small part of the file and therefore I adapted to the style in
> that file (also it's a bit messy).

Ah ok and yes we are sort of all over the place.

> If we want the code in the ppp parts
> reformatted, I would suggest an extra patch that applies the coding style to the
> complete file. What do you think?

I have only just learnt about this requirement and I think it is a good one. I
am no expert on what is the FreeBSd format so I can only highlight what I have
observed after reformatting my code.

I think it would be good to have a single pass to clean this up but it is
painful because it breaks blame. So I do not know and happy to see what everyone
else thinks.

Chris


More information about the devel mailing list