[PATCH rtems-net-legacy v2] Remove RTEMS_NETWORKING checks

Vijay Kumar Banerjee vijay at rtems.org
Wed Apr 14 05:59:58 UTC 2021


On Mon, Apr 5, 2021 at 10:33 AM Gedare Bloom <gedare at rtems.org> wrote:
>
> On Sat, Apr 3, 2021 at 2:13 PM Vijay Kumar Banerjee <vijay at rtems.org> wrote:
> >
> >
> >
> > On Sat, Apr 3, 2021 at 12:27 PM Gedare Bloom <gedare at rtems.org> wrote:
> > >
> > > On Fri, Apr 2, 2021 at 7:32 PM Vijay Kumar Banerjee <vijay at rtems.org> wrote:
> > > >
> > > > * Remove nfsclient wscript and build from netlegacy.py
> > >
> > > These two different changes probably should have been two different
> > > patches? I barely even noticed the nfsclient change, since it isn't
> > > reflected in the first line of the commit subject, so it is harder to
> > > spot. I think split them in two if that is ok.
> >
> > Thanks. I'll split them into 2 different patches.
> > >
> > > > ---
> > > >  bsps/powerpc/mpc55xxevb/net/smsc9218i.c |  4 +--
> > > >  libmisc/dummy-networking.c              | 44 ++++++++++++-------------
> > > >  netlegacy.py                            | 18 +++++++++-
> > > >  nfsclient/wscript                       |  1 +
> > > >  telnetd/telnetd.c                       |  4 ---
> > > >  wscript                                 |  2 +-
> > > >  6 files changed, 42 insertions(+), 31 deletions(-)
> > > >
> > > > diff --git a/bsps/powerpc/mpc55xxevb/net/smsc9218i.c b/bsps/powerpc/mpc55xxevb/net/smsc9218i.c
> > > > index d88aa8a..384f9cd 100644
> > > > --- a/bsps/powerpc/mpc55xxevb/net/smsc9218i.c
> > > > +++ b/bsps/powerpc/mpc55xxevb/net/smsc9218i.c
> > > > @@ -24,7 +24,7 @@
> > > >
> > > >  #include <mpc55xx/regs.h>
> > > >
> > > > -#if defined(RTEMS_NETWORKING) && defined(MPC55XX_HAS_SIU)
> > > > +#if defined(MPC55XX_HAS_SIU)
> > > >
> > > >  #include <machine/rtems-bsd-kernel-space.h>
> > > >
> > > > @@ -2121,4 +2121,4 @@ int smsc9218i_attach_detach(
> > > >    return 0;
> > > >  }
> > > >
> > > > -#endif /* defined(RTEMS_NETWORKING) && defined(MPC55XX_HAS_SIU) */
> > > > +#endif /* defined(MPC55XX_HAS_SIU) */
> > > > diff --git a/libmisc/dummy-networking.c b/libmisc/dummy-networking.c
> > > > index 379e23e..b7f15c8 100644
> > > > --- a/libmisc/dummy-networking.c
> > > > +++ b/libmisc/dummy-networking.c
> > > > @@ -16,27 +16,25 @@
> > > >  #include <rtems.h>
> > > >
> > > >  /* Loopback Network Configuration */
> > > > -#if defined(RTEMS_NETWORKING)
> > > > -  #include <rtems/rtems_bsdnet.h>
> > > > -  #include <sys/socket.h>
> > > > -  #include <netinet/in.h>
> > > > +#include <rtems/rtems_bsdnet.h>
> > > > +#include <sys/socket.h>
> > > > +#include <netinet/in.h>
> > > >
> > > > -  struct rtems_bsdnet_config rtems_bsdnet_config = {
> > > > -      NULL,                   /* Network interface */
> > > > -      NULL,                   /* Use fixed network configuration */
> > > > -      0,                      /* Default network task priority */
> > > > -      0,                      /* Default mbuf capacity */
> > > > -      0,                      /* Default mbuf cluster capacity */
> > > > -      "testSystem",           /* Host name */
> > > > -      "nowhere.com",          /* Domain name */
> > > > -      "127.0.0.1",            /* Gateway */
> > > > -      "127.0.0.1",            /* Log host */
> > > > -      {"127.0.0.1" },         /* Name server(s) */
> > > > -      {"127.0.0.1" },         /* NTP server(s) */
> > > > -      1,                      /* sb_efficiency */
> > > > -      0,                      /* udp_tx_buf_size */
> > > > -      0,                      /* udp_rx_buf_size */
> > > > -      0,                      /* tcp_tx_buf_size */
> > > > -      0                       /* tcp_rx_buf_size */
> > > > -  };
> > > > -#endif
> > > > +struct rtems_bsdnet_config rtems_bsdnet_config = {
> > > > +    NULL,                   /* Network interface */
> > > > +    NULL,                   /* Use fixed network configuration */
> > > > +    0,                      /* Default network task priority */
> > > > +    0,                      /* Default mbuf capacity */
> > > > +    0,                      /* Default mbuf cluster capacity */
> > > > +    "testSystem",           /* Host name */
> > > > +    "nowhere.com",          /* Domain name */
> > > > +    "127.0.0.1",            /* Gateway */
> > > > +    "127.0.0.1",            /* Log host */
> > > > +    {"127.0.0.1" },         /* Name server(s) */
> > > > +    {"127.0.0.1" },         /* NTP server(s) */
> > > > +    1,                      /* sb_efficiency */
> > > > +    0,                      /* udp_tx_buf_size */
> > > > +    0,                      /* udp_rx_buf_size */
> > > > +    0,                      /* tcp_tx_buf_size */
> > > > +    0                       /* tcp_rx_buf_size */
> > > > +};
> > > > diff --git a/netlegacy.py b/netlegacy.py
> > > > index 0889548..85c523e 100644
> > > > --- a/netlegacy.py
> > > > +++ b/netlegacy.py
> > > > @@ -54,6 +54,13 @@ def build(bld):
> > > >                     for s in os.listdir('./pppd') if s[-2:] == '.c']
> > > >      telnetd_source = [os.path.join('./telnetd', s)
> > > >                        for s in os.listdir('telnetd') if s[-2:] == '.c']
> > > > +    nfs_source = []
> > > > +    for root, dirs, files in os.walk('./nfsclient'):
> > > > +        for name in files:
> > > > +            ext = os.path.splitext(name)[1]
> > > > +            if ext == '.c':
> > > > +                src_root = os.path.split(root)[1]
> > > > +                nfs_source.append(os.path.join('./nfsclient', src_root, name))
> > > >
> > > >      bsp_dirs, bsp_sources = bsp_drivers.bsp_files(bld)
> > > >
> > > > @@ -66,6 +73,7 @@ def build(bld):
> > > >                           './bsps/include'])
> > > >      arch_lib_path = rtems.arch_bsp_lib_path(bld.env.RTEMS_VERSION,
> > > >                                              bld.env.RTEMS_ARCH_BSP)
> > > > +    lib_path = os.path.join(bld.env.PREFIX, arch_lib_path)
> > > >      include_path.append(os.path.relpath(os.path.join(bld.env.PREFIX,
> > > >                                                       arch_lib_path)))
> > > >      include_path.append(os.path.relpath(os.path.join(bld.env.PREFIX,
> > > > @@ -73,6 +81,8 @@ def build(bld):
> > > >                                                       'include')))
> > > >      include_path.append('./bsps/include/libchip')
> > > >
> > > > +    bld.read_stlib('rtemsbsp', paths=[lib_path])
> > > > +
> > > >      if bsp in bsp_dirs:
> > > >          include_path.extend(bsp_dirs[bsp])
> > > >
> > > > @@ -107,8 +117,14 @@ def build(bld):
> > > >                use='networking',
> > > >                source=telnetd_source)
> > > >
> > > > +    bld.stlib(target='nfs',
> > > > +              features='c',
> > > > +              includes=ip,
> > > > +              use=['rtemsbsp', 'networking'],
> > > > +              source=nfs_source)
> > > > +
> > > >      bld.install_files(os.path.join('${PREFIX}', arch_lib_path),
> > > > -                      ["libnetworking.a", 'libpppd.a', 'libtelnetd.a'])
> > > > +                      ["libnetworking.a", 'libpppd.a', 'libtelnetd.a', 'libnfs.a'])
> > > >      bld.install_files(os.path.join('${PREFIX}', arch_lib_path,
> > > >                                     'include', 'libchip'),
> > > >                        [os.path.join('./bsps/include/libchip/', f)
> > > > diff --git a/nfsclient/wscript b/nfsclient/wscript
> > > > index bc2f994..c0fe420 100644
> > > > --- a/nfsclient/wscript
> > > > +++ b/nfsclient/wscript
> > > > @@ -52,5 +52,6 @@ def build(bld):
> > > >                features='c',
> > > >                cflags=['-O2', '-g'],
> > > >                includes=include_path,
> > > > +              use=['networking'],
> > > >                source=source_files)
> > > >      bld.install_files(os.path.join('${PREFIX}', arch_lib_path), ['libnfs.a'])
> > > > diff --git a/telnetd/telnetd.c b/telnetd/telnetd.c
> > > > index b8adec2..3d401ff 100644
> > > > --- a/telnetd/telnetd.c
> > > > +++ b/telnetd/telnetd.c
> > > > @@ -58,9 +58,7 @@
> > > >  #include <rtems/thread.h>
> > > >  #include <rtems/userenv.h>
> > > >
> > > > -#ifdef RTEMS_NETWORKING
> > > >  #include <rtems/rtems_bsdnet.h>
> > > > -#endif
> > > >
> > > >  #define TELNETD_EVENT_SUCCESS RTEMS_EVENT_0
> > > >
> > > > @@ -401,11 +399,9 @@ rtems_status_code rtems_telnetd_start(const rtems_telnetd_config_table* config)
> > > >    LIST_INIT(&ctx->free_sessions);
> > > >
> > > >    /* Check priority */
> > > > -#ifdef RTEMS_NETWORKING
> > > >    if (ctx->config.priority == 0) {
> > > >      ctx->config.priority = rtems_bsdnet_config.network_task_priority;
> > > >    }
> > > > -#endif
> > > Is this (and the header above) the only difference between the legacy
> > > network stack implementation for telnetd and the libbsd one? If so, it
> > > seems they could be shared easily, and it might be good to keep track
> > > of where they differ.
> >
> > Yes, this is the only difference. The only small issue would be the lack of RTEMS_NETWORKING macro, making it difficult to keep it in RTEMS, so I just removed these lines and proposed a patch to add that version to libbsd:
> > https://lists.rtems.org/pipermail/devel/2021-March/065872.html
> >
> ok. I'm not a fan of having duplicated code in multiple of our repos,
> but since legacy stack is heading toward maintenance-only mode, I
> think this is fine--if no one else complains :)
>
Hi,

I pushed this without the telnetd edits.

Best regards,
Vijay

> > I will send a v3 of this and another patch for nfsclient.
> >
> >
> > >
> > > >    if (ctx->config.priority == 0) {
> > > >      ctx->config.priority = 100;
> > > >    }
> > > > diff --git a/wscript b/wscript
> > > > index 07f774d..7af317d 100644
> > > > --- a/wscript
> > > > +++ b/wscript
> > > > @@ -33,7 +33,7 @@ import sys
> > > >  top = '.'
> > > >
> > > >  rtems_version = "6"
> > > > -subdirs = ['nfsclient', 'testsuites']
> > > > +subdirs = ['testsuites']
> > > >
> > > >  try:
> > > >      import rtems_waf.rtems as rtems
> > > > --
> > > > 2.26.2
> > > >
> > > > _______________________________________________
> > > > devel mailing list
> > > > devel at rtems.org
> > > > http://lists.rtems.org/mailman/listinfo/devel


More information about the devel mailing list