[PATCH rtems-net-legacy 2/2] greth.c: Pull RTEMS commit for variable size descriptor
Vijay Kumar Banerjee
vijay at rtems.org
Tue Mar 30 15:53:59 UTC 2021
Hi,
On Tue, Mar 30, 2021 at 7:57 AM Gedare Bloom <gedare at rtems.org> wrote:
>
> On Tue, Mar 23, 2021 at 2:10 PM Vijay Kumar Banerjee <vijay at rtems.org> wrote:
> >
> > RTEMS commit hash: 053b17ce8e3f710167e9ec3f44b37756cbdcbec0
> Please preserve the git authorship information.
Sent a new patch with the proper authorship information and commit
message from RTEMS tree. Please have a look.
Best regards,
Vijay
>
> > ---
> > bsps/shared/grlib/net/greth.c | 22 +++++++++++++++-------
> > 1 file changed, 15 insertions(+), 7 deletions(-)
> >
> > diff --git a/bsps/shared/grlib/net/greth.c b/bsps/shared/grlib/net/greth.c
> > index 8b19b48..84efcd7 100644
> > --- a/bsps/shared/grlib/net/greth.c
> > +++ b/bsps/shared/grlib/net/greth.c
> > @@ -187,6 +187,7 @@ struct greth_softc
> > unsigned int advmodes; /* advertise ethernet speed modes. 0 = all modes. */
> > struct timespec auto_neg_time;
> > int mc_available;
> > + int num_descs;
> >
> > /*
> > * Statistics
> > @@ -423,7 +424,7 @@ greth_initialize_hardware (struct greth_softc *sc)
> > int tmp2;
> > struct timespec tstart, tnow;
> > greth_regs *regs;
> > - unsigned int advmodes, speed;
> > + unsigned int advmodes, speed, tabsize;
> >
> > regs = sc->regs;
> >
> > @@ -617,8 +618,9 @@ auto_neg_done:
> > /* Initialize rx/tx descriptor table pointers. Due to alignment we
> > * always allocate maximum table size.
> > */
> > - sc->txdesc = (greth_rxtxdesc *) almalloc(0x800, 0x400);
> > - sc->rxdesc = (greth_rxtxdesc *) &sc->txdesc[128];
> > + tabsize = sc->num_descs * 8;
> > + sc->txdesc = (greth_rxtxdesc *) almalloc(tabsize * 2, tabsize);
> > + sc->rxdesc = (greth_rxtxdesc *) (tabsize + (void *)sc->txdesc);
> > sc->tx_ptr = 0;
> > sc->tx_dptr = 0;
> > sc->tx_cnt = 0;
> > @@ -632,8 +634,8 @@ auto_neg_done:
> > CPUMEM_TO_DMA,
> > (void *)sc->txdesc,
> > (void **)&sc->txdesc_remote,
> > - 0x800);
> > - sc->rxdesc_remote = sc->txdesc_remote + 0x400;
> > + tabsize * 2);
> > + sc->rxdesc_remote = sc->txdesc_remote + tabsize;
> > regs->txdesc = (int) sc->txdesc_remote;
> > regs->rxdesc = (int) sc->rxdesc_remote;
> >
> > @@ -1555,6 +1557,7 @@ int greth_device_init(struct greth_softc *sc)
> > struct ambapp_core *pnpinfo;
> > union drvmgr_key_value *value;
> > unsigned int speed;
> > + int i, nrd;
> >
> > /* Get device information from AMBA PnP information */
> > ambadev = (struct amba_dev_info *)sc->dev->businfo;
> > @@ -1608,12 +1611,17 @@ int greth_device_init(struct greth_softc *sc)
> > sc->rxbufs = 32;
> > sc->phyaddr = -1;
> >
> > + /* Probe the number of descriptors available the */
> > + nrd = (sc->regs->status & GRETH_STATUS_NRD) >> 24;
> > + for (sc->num_descs = 128, i = 0; i < nrd; i++)
> > + sc->num_descs = sc->num_descs * 2;
> > +
> > value = drvmgr_dev_key_get(sc->dev, "txDescs", DRVMGR_KT_INT);
> > - if ( value && (value->i <= 128) )
> > + if ( value && (value->i <= sc->num_descs) )
> > sc->txbufs = value->i;
> >
> > value = drvmgr_dev_key_get(sc->dev, "rxDescs", DRVMGR_KT_INT);
> > - if ( value && (value->i <= 128) )
> > + if ( value && (value->i <= sc->num_descs) )
> > sc->rxbufs = value->i;
> >
> > value = drvmgr_dev_key_get(sc->dev, "phyAdr", DRVMGR_KT_INT);
> > --
> > 2.26.2
> >
> > _______________________________________________
> > devel mailing list
> > devel at rtems.org
> > http://lists.rtems.org/mailman/listinfo/devel
More information about the devel
mailing list