[PATCH] classic networking: do not reference

Joel Sherrill joel at rtems.org
Fri Aug 5 01:00:33 UTC 2016


On Aug 4, 2016 6:27 PM, "Pavel Pisa" <ppisa4lists at pikron.com> wrote:
>
> Hello Joel,
>
> On Thursday 04 of August 2016 23:53:16 Joel Sherrill wrote:
> > This sounds and looks reasonable.
>
> If you think, that it is OK, I can push that tomorrow
> morning. I am not sure if isOn is really not used now/can be NULL.
> Other option is to define these functions as NoOp
> and return one (or zero?) always.
>
> Have you some opinion there?

I have no idea honestly but it needs to move to the newer interrupt model
so when we finally get APIC support, there isn't a larger change set.

Fwiw I would expect that the old stack is still testable with the old Intel
NIC driver and qemu for PC  but the stack needs newer drivers for any
modern NIC.

> I have tried to test integrated networking to help
> Saeed with dlopen and networking. I have tested
> x86 as sidestep but I have not been too much sucesfull.
>
> For
>
> static struct rtems_bsdnet_ifconfig netdriver_config = {
>         .name = (char *)BSP_NE2000_NETWORK_DRIVER_NAME,
>         .attach = BSP_NE2000_NETWORK_DRIVER_ATTACH,
>         .next = NULL,
>         .ip_address = "192.168.3.66",
>         .ip_netmask = "255.255.255.0",
>         .hardware_address = ethernet_address,
>         .ignore_broadcast = 0,
>         .mtu = 0,
>         .rbuf_count = 0,
>         .xbuf_count = 0,
>         .port = 0x300,
>         .irno = 9,
>         .bpar = 0,
>         .drv_ctrl = NULL
> };
>
> struct rtems_bsdnet_config rtems_bsdnet_config = {
>         .ifconfig = &netdriver_config,
> /*      .bootp = rtems_bsdnet_do_bootp,*/
> /*      .bootp = rtems_bsdnet_do_dhcp,*/
>         .bootp = rtems_bsdnet_do_dhcp_failsafe,
>         .network_task_priority = 0,             /* 100        */
>         .mbuf_bytecount = 256 * 1024,           /* 64 kbytes  */
>         .mbuf_cluster_bytecount = 256 * 1024,   /* 128 kbytes */
>         .hostname = NULL,
>         .domainname = NULL,
>         .gateway = "192.168.3.1",
>         .log_host = NULL,
>         .name_server = { "NULL" },
>         .ntp_server = { "NULL" },
>         .sb_efficiency = 0,
>         .udp_tx_buf_size = 0,                   /* UDP TX: 9216 bytes */
>         .udp_rx_buf_size = 0,                   /* UDP RX: 40 * (1024 +
sizeof(struct sockaddr_in)) */
>         .tcp_tx_buf_size = 0,                   /* TCP TX: 16 * 1024
bytes */
>         .tcp_rx_buf_size = 0,                   /* TCP TX: 16 * 1024
bytes */
> };
>
> and
>
> qemu-system-x86_64 -enable-kvm -kernel $APP_BINARY \
>       -vga cirrus \
>       -net nic,vlan=0,macaddr=00:80:7F:22:61:77,model=ne2k_isa -net
user,vlan=0 \
>       -append "--console=/dev/com1" \
>       -serial stdio \
>
> I get address from internal QEMU DHCP server but TFTP does not
> seem to work even that I use same QEMU setup with user (internal
> UDP/TCP only) NAT successfully for other systems.
>
> I would like to switch to PCI, so I have tested
>
> int rtems_fxp_attach(struct rtems_bsdnet_ifconfig *config, int attaching);
>
> static struct rtems_bsdnet_ifconfig netdriver_config = {
>         .name = "fxp1",
>         .attach = rtems_fxp_attach,
>
>
> qemu-system-x86_64 -enable-kvm -kernel $APP_BINARY \
>       -vga cirrus \
>       -net nic,vlan=0,model=i82557b -net user,vlan=0 \
>       -append "--console=/dev/com1" \
>       -serial stdio \
>
> which finds card on PCI but the it does not work.
> Is it possible that interrupts are not correctly
> routed, registered?
>
> Can be IRQ number obtained from
>
>  bus_alloc_resource(dev, SYS_RES_IRQ, &rid, 0, ~0, 1,
>                     RF_SHAREABLE | RF_ACTIVE);
>
> used directly in
>
>   BSP_install_rtems_irq_handler
>
> or
>
>   rtems_interrupt_handler_install
>
> or some mapping is required?
>
> Has nomebody tested some of these PCI drivers with QEMU?
>
>
> Best wishes,
>
>                Pavel
>
> > The old stack needs to be moved into its own build tree.
> >
> > On Aug 4, 2016 5:43 PM, "Pavel Pisa" <ppisa4lists at pikron.com> wrote:
> > > This change is required to build RTEMS with classic
"--enable-networking"
> > > and link applications/tests which reference RTEMS_BSP_NETWORK_DRIVER_
> > > ATTACH.
> > > ---
> > >  c/src/lib/libbsp/i386/pc386/ne2000/ne2000.c | 10 +---------
> > >  c/src/libchip/network/dec21140.c            |  7 +------
> > >  c/src/libchip/network/elnk.c                | 12 +-----------
> > >  c/src/libchip/network/if_dc.c               |  9 +--------
> > >  c/src/libchip/network/if_fxp.c              |  7 +------
> > >  5 files changed, 5 insertions(+), 40 deletions(-)
> > >
> > >  Discussion: I have stumbled over problem to build some external tests
> > >  for i386 because original integrated Ethernet drivers cannot be
linked
> > >  into application. Even that libbsd is a future goal it worth to
correct
> > >  this at least for testing. It seems that original i8259s concept
> > >  handling is finally overcome by generic approach.
> > >  I hope that field isOn is no longer referenced by any architecture
> > >  or if referenced, that NULL is valid option.
> > >
> > >  I am leaving for next week so I would not push this change probably.
> > >
> > >  In the longer perspective, I think that even for these deprecated
> > > drivers rtems_interrupt_handler_install generic concept could/should
be
> > > used. If it is agreed that it is right change then I can prepare patch
> > > for that in future.
> > >
> > >  But I think that correction of the builds in meantime worth
> > >  to be pushed.
> > >
> > > diff --git a/c/src/lib/libbsp/i386/pc386/ne2000/ne2000.c
> > > b/c/src/lib/libbsp/i386/pc386/ne2000/ne2000.c
> > > index 5a13b29..d757e27 100644
> > > --- a/c/src/lib/libbsp/i386/pc386/ne2000/ne2000.c
> > > +++ b/c/src/lib/libbsp/i386/pc386/ne2000/ne2000.c
> > > @@ -428,14 +428,6 @@ ne_interrupt_off (const rtems_irq_connect_data
*irq)
> > >      outport_byte (sc->port + IMR, 0);
> > >  }
> > >
> > > -/* Return whether NE2000 interrupts are on.  */
> > > -
> > > -static int
> > > -ne_interrupt_is_on (const rtems_irq_connect_data *irq)
> > > -{
> > > -  return BSP_irq_enabled_at_i8259s (irq->name);
> > > -}
> > > -
> > >  /* Initialize the NE2000 hardware.  */
> > >
> > >  static void
> > > @@ -526,7 +518,7 @@ ne_init_irq_handler(int irno)
> > >    irq.handle = (rtems_irq_hdl) irno;
> > >    irq.on = ne_interrupt_on;
> > >    irq.off = ne_interrupt_off;
> > > -  irq.isOn = ne_interrupt_is_on;
> > > +  irq.isOn = NULL;
> > >
> > >    if (!BSP_install_rtems_irq_handler (&irq))
> > >      rtems_panic ("Can't attach NE interrupt handler for irq %d\n",
> > > irno); diff --git a/c/src/libchip/network/dec21140.c
> > > b/c/src/libchip/network/ dec21140.c
> > > index aa6be29..3bfc91d 100644
> > > --- a/c/src/libchip/network/dec21140.c
> > > +++ b/c/src/libchip/network/dec21140.c
> > > @@ -345,11 +345,6 @@ static void no_op(const rtems_irq_connect_data*
irq)
> > >     return;
> > >  }
> > >
> > > -static int dec21140IsOn(const rtems_irq_connect_data* irq)
> > > -{
> > > -  return BSP_irq_enabled_at_i8259s (irq->name);
> > > -}
> > > -
> > >  /*
> > >   * DEC21140 interrupt handler
> > >   */
> > > @@ -539,7 +534,7 @@ dec21140Enet_initialize_hardware (struct
> > > dec21140_softc *sc)
> > >     sc->irqInfo.hdl  = (rtems_irq_hdl)dec21140Enet_
> > > interrupt_handler_entry;
> > >     sc->irqInfo.on   = no_op;
> > >     sc->irqInfo.off  = no_op;
> > > -   sc->irqInfo.isOn = dec21140IsOn;
> > > +   sc->irqInfo.isOn = NULL;
> > >
> > >  #ifdef DEC_DEBUG
> > >     printk( "dec2114x: Installing IRQ %d\n", sc->irqInfo.name );
> > > diff --git a/c/src/libchip/network/elnk.c
b/c/src/libchip/network/elnk.c
> > > index 06ece5b..1c63e35 100644
> > > --- a/c/src/libchip/network/elnk.c
> > > +++ b/c/src/libchip/network/elnk.c
> > > @@ -1875,16 +1875,6 @@ static void no_op(const rtems_irq_connect_data*
> > > irq)
> > >
> > >
> > >
> > > -static int elnkIsOn(const rtems_irq_connect_data* irq)
> > > -{
> > > -  return BSP_irq_enabled_at_i8259s (irq->name);
> > > -}
> > > -
> > > -
> > > -
> > > -
> > > -
> > > -
> > >  static void
> > >  elnk_start_txchain( struct elnk_softc *sc, struct TXMD *chainhead )
> > >  {
> > > @@ -2214,7 +2204,7 @@ elnk_initialize_hardware (struct elnk_softc *sc)
> > >     sc->irqInfo.hdl  = (rtems_irq_hdl)elnk_interrupt_handler_entry;
> > >     sc->irqInfo.on   = no_op;
> > >     sc->irqInfo.off  = no_op;
> > > -   sc->irqInfo.isOn = elnkIsOn;
> > > +   sc->irqInfo.isOn = NULL;
> > >
> > >     if( sc->irqInfo.name != 255 )
> > >     {
> > > diff --git a/c/src/libchip/network/if_dc.c
> > > b/c/src/libchip/network/if_dc.c index 1563be5..24f2fc1 100644
> > > --- a/c/src/libchip/network/if_dc.c
> > > +++ b/c/src/libchip/network/if_dc.c
> > > @@ -1893,13 +1893,6 @@ nop(const rtems_irq_connect_data* unused)
> > >  {
> > >  }
> > >
> > > -static int
> > > -decISON(const rtems_irq_connect_data* irq)
> > > -{
> > > -       return (BSP_irq_enabled_at_i8259s(irq->name));
> > > -}
> > > -
> > > -
> > >  /*
> > >   * Attach the interface. Allocate softc structures, do ifmedia
> > >   * setup and ethernet/BPF attach.
> > > @@ -2023,7 +2016,7 @@ rtems_dc_driver_attach(struct
rtems_bsdnet_ifconfig
> > > *config, int attaching)
> > >         sc->irqInfo.handle = (void *)sc; /* new parameter */
> > >         sc->irqInfo.on = nop;
> > >         sc->irqInfo.off = nop;
> > > -       sc->irqInfo.isOn = decISON;
> > > +       sc->irqInfo.isOn = NULL;
> > >
> > >  #ifdef BSP_SHARED_HANDLER_SUPPORT
> > >         rc = BSP_install_rtems_shared_irq_handler( &sc->irqInfo );
> > > diff --git a/c/src/libchip/network/if_fxp.c
b/c/src/libchip/network/if_
> > > fxp.c
> > > index ce59db1..35d7c07 100644
> > > --- a/c/src/libchip/network/if_fxp.c
> > > +++ b/c/src/libchip/network/if_fxp.c
> > > @@ -431,11 +431,6 @@ static void nopOn(const rtems_irq_connect_data*
> > > notUsed)
> > >     */
> > >  }
> > >
> > > -static int fxpIsOn(const rtems_irq_connect_data* irq)
> > > -{
> > > -  return BSP_irq_enabled_at_i8259s (irq->name);
> > > -}
> > > -
> > >  int
> > >  rtems_fxp_attach(struct rtems_bsdnet_ifconfig *config, int attaching)
> > >  {
> > > @@ -1933,7 +1928,7 @@ rtems_task_wake_after(100);
> > >                 sc->irqInfo.hdl = (rtems_irq_hdl)fxp_intr;
> > >                 sc->irqInfo.on  = nopOn;
> > >                 sc->irqInfo.off = nopOn;
> > > -               sc->irqInfo.isOn = fxpIsOn;
> > > +               sc->irqInfo.isOn = NULL;
> > >                 rv = BSP_install_rtems_irq_handler (&sc->irqInfo);
> > >                 if (rv != 1) {
> > >                   rtems_panic ("Can't attach fxp interrupt handler for
> > > irq %d\n",
> > > --
> > > 1.9.1
> > >
> > > _______________________________________________
> > > devel mailing list
> > > devel at rtems.org
> > > http://lists.rtems.org/mailman/listinfo/devel
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/devel/attachments/20160804/e4deccb8/attachment-0002.html>


More information about the devel mailing list