Hi,

The issue is in odp-linux implementation of odp_pktio_close(). It should try to 
flush only if the interface was ever started (there would be something to 
flush). We'd need to extend pktio interface states so that close call can tell 
the difference of open() -> close() (state == STATE_OPENED) vs. open() -> 
start() -> stop() -> close() (STATE == STOPPED).

int odp_pktio_close(odp_pktio_t id)
{
        pktio_entry_t *entry;
        int res;

        entry = get_pktio_entry(id);
        if (entry == NULL)
                return -1;

Add this if clause here:
        // Flush if state STOPPED, don’t flush if only OPENED
        // Error check if state is STARTED (interface is active).
        if (entry->s.state == STATE_STOPPED)
                flush_in_queues(entry);


-Petri


> -----Original Message-----
> From: EXT Zoltan Kiss [mailto:[email protected]]
> Sent: Thursday, March 31, 2016 9:00 PM
> To: Elo, Matias (Nokia - FI/Espoo) <[email protected]>; Savolainen,
> Petri (Nokia - FI/Espoo) <[email protected]>
> Cc: lng-odp <[email protected]>
> Subject: Re: flush_in_queues() on devices never started
> 
> I forgot to Cc the list
> 
> On 31/03/16 17:03, Zoltan Kiss wrote:
> > Hi,
> >
> > I ran into a problem when pktio_test_pktin_queue_config_direct() plays
> > with queue config then call close. That calls flush_in_queues(), which
> > tries to receive on a device which was never started, therefore run into
> > a segfault when trying to access the queues never created.
> > I've used the pkt_dpdk->started variable to avoid that in
> > recv_pkt_dpdk_queue(), but I wonder if that's the proper way. I guess
> > odp-linux would have the same issue on DPDK pktio. Any better idea?
> > I would also prefer avoiding branching on a hotpath like this. And we
> > should check if we need a similar check on send side.
> >
> > diff --git a/platform/linux-dpdk/odp_packet_dpdk.c
> > b/platform/linux-dpdk/odp_packet_dpdk.c
> > index 7ddbac6..fdc461e 100644
> > --- a/platform/linux-dpdk/odp_packet_dpdk.c
> > +++ b/platform/linux-dpdk/odp_packet_dpdk.c
> > @@ -352,6 +352,9 @@ static int recv_pkt_dpdk_queue(pktio_entry_t
> > *pktio_entry, int index,
> >          pkt_dpdk_t * const pkt_dpdk = &pktio_entry->s.pkt_dpdk;
> >          uint8_t min = pkt_dpdk->min_rx_burst;
> >
> > +       if (!pkt_dpdk->started)
> > +               return 0;
> > +
> >          if (odp_unlikely(min > len)) {
> >                  ODP_DBG("PMD requires >%d buffers burst. "
> >                          "Current %d, dropped %d\n", min, len, min -
> len);
> >
> >
> > Regards,
> >
> > Zoltan
_______________________________________________
lng-odp mailing list
[email protected]
https://lists.linaro.org/mailman/listinfo/lng-odp

Reply via email to