[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v2 5/9] hw/core: stream: Add an end-of-packet flag
From: |
Edgar E. Iglesias |
Subject: |
Re: [PATCH v2 5/9] hw/core: stream: Add an end-of-packet flag |
Date: |
Wed, 6 May 2020 14:42:09 +0200 |
User-agent: |
Mutt/1.10.1 (2018-07-13) |
On Wed, May 06, 2020 at 01:53:33PM +0200, Philippe Mathieu-Daudé wrote:
> Hi Edgar,
Hi Philippe,
>
> On 5/6/20 10:25 AM, Edgar E. Iglesias wrote:
> > From: "Edgar E. Iglesias" <address@hidden>
> >
> > Some stream clients stream an endless stream of data while
> > other clients stream data in packets. Stream interfaces
> > usually have a way to signal the end of a packet or the
> > last beat of a transfer.
> >
> > This adds an end-of-packet flag to the push interface.
> >
> > Reviewed-by: Alistair Francis <address@hidden>
> > Reviewed-by: Francisco Iglesias <address@hidden>
> > Signed-off-by: Edgar E. Iglesias <address@hidden>
> > ---
> > include/hw/stream.h | 5 +++--
> > hw/core/stream.c | 4 ++--
> > hw/dma/xilinx_axidma.c | 10 ++++++----
> > hw/net/xilinx_axienet.c | 14 ++++++++++----
> > hw/ssi/xilinx_spips.c | 2 +-
> > 5 files changed, 22 insertions(+), 13 deletions(-)
> >
> > diff --git a/include/hw/stream.h b/include/hw/stream.h
> > index d02f62ca89..ed09e83683 100644
> > --- a/include/hw/stream.h
> > +++ b/include/hw/stream.h
> > @@ -39,12 +39,13 @@ typedef struct StreamSlaveClass {
> > * @obj: Stream slave to push to
> > * @buf: Data to write
> > * @len: Maximum number of bytes to write
> > + * @eop: End of packet flag
> > */
> > - size_t (*push)(StreamSlave *obj, unsigned char *buf, size_t len);
> > + size_t (*push)(StreamSlave *obj, unsigned char *buf, size_t len, bool
> > eop);
>
> I'd split this patch, first add EOP in the push handler, keeping current
> code working, then the following patches (implementing the feature in the
> backend handlers), then ...
>
> > } StreamSlaveClass;
> > size_t
> > -stream_push(StreamSlave *sink, uint8_t *buf, size_t len);
> > +stream_push(StreamSlave *sink, uint8_t *buf, size_t len, bool eop);
>
> ... this final patch, enable the feature and let the frontends use it.
>
> > bool
> > stream_can_push(StreamSlave *sink, StreamCanPushNotifyFn notify,
> > diff --git a/hw/core/stream.c b/hw/core/stream.c
> > index 39b1e595cd..a65ad1208d 100644
> > --- a/hw/core/stream.c
> > +++ b/hw/core/stream.c
> > @@ -3,11 +3,11 @@
> > #include "qemu/module.h"
> > size_t
> > -stream_push(StreamSlave *sink, uint8_t *buf, size_t len)
> > +stream_push(StreamSlave *sink, uint8_t *buf, size_t len, bool eop)
> > {
> > StreamSlaveClass *k = STREAM_SLAVE_GET_CLASS(sink);
> > - return k->push(sink, buf, len);
> > + return k->push(sink, buf, len, eop);
>
> So in this first part patch I'd use 'false' here, and update by 'eop' in the
> other part (last patch in series). Does it make sense?
Current code implicitly assumes eop = true, so this patch keeps things
working as before. It just makes the assumption explicit and guarding
backends with asserts. The support for eop = false is then added
(where relevant) in future patches, roughly the way you describe it.
I can add something to the commit message to clarify that.
Best regards,
Edgar
- [PATCH v2 0/9] hw/core: stream: Add end-of-packet flag, Edgar E. Iglesias, 2020/05/06
- [PATCH v2 1/9] hw/net/xilinx_axienet: Auto-clear PHY Autoneg, Edgar E. Iglesias, 2020/05/06
- [PATCH v2 2/9] hw/net/xilinx_axienet: Cleanup stream->push assignment, Edgar E. Iglesias, 2020/05/06
- [PATCH v2 3/9] hw/net/xilinx_axienet: Remove unncessary cast, Edgar E. Iglesias, 2020/05/06
- [PATCH v2 4/9] hw/dma/xilinx_axidma: Add DMA memory-region property, Edgar E. Iglesias, 2020/05/06
- [PATCH v2 5/9] hw/core: stream: Add an end-of-packet flag, Edgar E. Iglesias, 2020/05/06
- [PATCH v2 6/9] hw/net/xilinx_axienet: Handle fragmented packets from DMA, Edgar E. Iglesias, 2020/05/06
- [PATCH v2 7/9] hw/dma/xilinx_axidma: mm2s: Stream descriptor by descriptor, Edgar E. Iglesias, 2020/05/06
- [PATCH v2 8/9] hw/dma/xilinx_axidma: s2mm: Support stream fragments, Edgar E. Iglesias, 2020/05/06
- [PATCH v2 9/9] MAINTAINERS: Add myself as streams maintainer, Edgar E. Iglesias, 2020/05/06