Re: [PATCH v3 2/4] virtio_net: Add a set_rx_mode interface

Rusty Russell
2009-02-03T02:54:00Z

On Tuesday 03 February 2009 08:04:07 Alex Williamson wrote:
> Hi Rusty,
>
> On Mon, 2009-02-02 at 20:22 +1030, Rusty Russell wrote:
> > static bool virtnet_send_command(struct virtnet_info *vi, u8 class, u8 cmd,
> > struct scatterlist *out, struct scatterlist *in);
...
> I think the caller still ends up passing the counts of out and in
> entries here or else we have to walk the lists in send_command().
> Doable, but doesn't seem to be common practice that I can find.

Yes, I've frequently expressed unhappiness with the API. I lost that debate
and it doesn't seem fruitful to return to it.

It's not speed-critical, so just iterate. I refuse to make *my* APIs suck.

> We
> should also then clear the termination once we copy the sg[] into our
> own, but functions to do that don't seem to exist (need an
> sg_unmark_end()).

Ideally we would chain them, but the caller would have to allocate an extra
sg element.

Implement sg_unmark_end() in a separate patch; be sure to CC Jens.

> I had avoided anything that would call
> sg_init_table() on the caller provided sg[] to avoid that problem, does
> it need to be addressed?

I don't think so: those args should in fact be const struct scatterlist *.

Thanks,
Rusty.