virtualization.lists.linux-foundation.org archive mirror
 help / color / mirror / Atom feed
From: Xuan Zhuo <xuanzhuo@linux.alibaba.com>
To: "Michael S. Tsirkin" <mst@redhat.com>
Cc: Jesper Dangaard Brouer <hawk@kernel.org>,
	Daniel Borkmann <daniel@iogearbox.net>,
	netdev@vger.kernel.org, John Fastabend <john.fastabend@gmail.com>,
	Alexei Starovoitov <ast@kernel.org>,
	virtualization@lists.linux-foundation.org,
	Eric Dumazet <edumazet@google.com>,
	Jakub Kicinski <kuba@kernel.org>,
	bpf@vger.kernel.org, Paolo Abeni <pabeni@redhat.com>,
	"David S. Miller" <davem@davemloft.net>
Subject: Re: [PATCH 00/16] virtio-net: split virtio-net.c
Date: Fri, 31 Mar 2023 16:10:14 +0800	[thread overview]
Message-ID: <1680250214.4751976-2-xuanzhuo@linux.alibaba.com> (raw)
In-Reply-To: <20230331035942-mutt-send-email-mst@kernel.org>

On Fri, 31 Mar 2023 04:00:22 -0400, "Michael S. Tsirkin" <mst@redhat.com> wrote:
> On Fri, Mar 31, 2023 at 03:48:00PM +0800, Xuan Zhuo wrote:
> > On Fri, 31 Mar 2023 15:35:14 +0800, Jason Wang <jasowang@redhat.com> wrote:
> > > On Fri, Mar 31, 2023 at 3:31 PM Xuan Zhuo <xuanzhuo@linux.alibaba.com> wrote:
> > > >
> > > > On Thu, 30 Mar 2023 02:17:43 -0400, "Michael S. Tsirkin" <mst@redhat.com> wrote:
> > > > > On Tue, Mar 28, 2023 at 05:28:31PM +0800, Xuan Zhuo wrote:
> > > > > > Considering the complexity of virtio-net.c and the new features we want
> > > > > > to add, it is time to split virtio-net.c into multiple independent
> > > > > > module files.
> > > > > >
> > > > > > This is beneficial to the maintenance and adding new functions.
> > > > > >
> > > > > > And AF_XDP support will be added later, then a separate xsk.c file will
> > > > > > be added.
> > > > > >
> > > > > > This patchset split virtio-net.c into these parts:
> > > > > >
> > > > > > * virtnet.c:         virtio net device ops (napi, tx, rx, device ops, ...)
> > > > > > * virtnet_common.c:  virtio net common code
> > > > > > * virtnet_ethtool.c: virtio net ethtool callbacks
> > > > > > * virtnet_ctrl.c:    virtio net ctrl queue command APIs
> > > > > > * virtnet_virtio.c:  virtio net virtio callbacks/ops (driver register, virtio probe, virtio free, ...)
> > > > > >
> > > > > > Please review.
> > > > > >
> > > > > > Thanks.
> > > > >
> > > > >
> > > > > I don't feel this is an improvement as presented, will need more work
> > > > > to make code placement more logical.
> > > >
> > > > Yes, this does need some time and energy. But I think this always need to do,
> > > > just when to do it. I think it is currently an opportunity.
> > > >
> > > >
> > > > >
> > > > > For example where do I find code to update rq stats?
> > > > > Rx data path should be virtnet.c?
> > > > > No it's in virtnet_ethtool.c because rq stats can be
> > > > > accessed by ethtool.
> > > >
> > > > That's what I do.
> > > >
> > > > > A bunch of stuff seems to be in headers just because of technicalities.
> > > > > virtio common seems to be a dumping ground with no guiding principle at
> > > > > all.
> > > >
> > > > Yes, I agree, with the development of time, common will indeed become a dumping
> > > > group. This is something we should pay attention to after this.
> > > >
> > > >
> > > > > drivers/net/virtio/virtnet_virtio.c is weird with
> > > > > virt repeated three times in the path.
> > > >
> > > > Any good idea.
> > > >
> > > > >
> > > > > These things only get murkier with time, at the point of reorg
> > > > > I would expect very logical placement, since
> > > > > without clear guiding rule finding where something is becomes harder but
> > > > > more importantly we'll now get endless heartburn about where does each new
> > > > > function go.
> > > > >
> > > > >
> > > > > The reorg is unfortunately not free - for example git log --follow will
> > > > > no longer easily match virtio because --follow works with exactly one
> > > > > path.
> > > >
> > > > One day we will face this problem.
> > > >
> > > > > It's now also extra work to keep headers self-consistent.
> > > >
> > > > Can we make it simpler, first complete the split.
> > > >
> > > >
> > > > > So it better be a big improvement to be worth it.
> > > >
> > > >
> > > > Or about split, do you have any better thoughts? Or do you think we have always
> > > > been like this and make Virtio-Net more and more complicated?
> > >
> > > My feeling is that maybe it's worth it to start using a separate file
> > > for xsk support.
> >
> > I agree.
> >
> > @Michael at this point, what is your thought?
> >
> >
> > Thanks.
> >
>
> I am fine with either adding just xsk in a new file or even
> just adding in same file working on a split later.

Okay, we are on the same page with xsk.

So the remaining problem is whether do we need to split ethtool, ctrl command,
and virtio out?

I think at least ctrl command and ethtool are very clear. The split of virtio
has indeed encountered some problems. I have independent modifications into a
separate commit. The patches to move the code do not include any other
modifications.


Thanks.




>
>
> > >
> > > Thanks
> > >
> > > >
> > > >
> > > > Thanks.
> > > >
> > > > >
> > > > >
> > > > >
> > > > >
> > > > > > Xuan Zhuo (16):
> > > > > >   virtio_net: add a separate directory for virtio-net
> > > > > >   virtio_net: move struct to header file
> > > > > >   virtio_net: add prefix to the struct inside header file
> > > > > >   virtio_net: separating cpu-related funs
> > > > > >   virtio_net: separate virtnet_ctrl_set_queues()
> > > > > >   virtio_net: separate virtnet_ctrl_set_mac_address()
> > > > > >   virtio_net: remove lock from virtnet_ack_link_announce()
> > > > > >   virtio_net: separating the APIs of cq
> > > > > >   virtio_net: introduce virtnet_rq_update_stats()
> > > > > >   virtio_net: separating the funcs of ethtool
> > > > > >   virtio_net: introduce virtnet_dev_rx_queue_group()
> > > > > >   virtio_net: introduce virtnet_get_netdev()
> > > > > >   virtio_net: prepare for virtio
> > > > > >   virtio_net: move virtnet_[en/dis]able_delayed_refill to header file
> > > > > >   virtio_net: add APIs to register/unregister virtio driver
> > > > > >   virtio_net: separating the virtio code
> > > > > >
> > > > > >  MAINTAINERS                                   |    2 +-
> > > > > >  drivers/net/Kconfig                           |    8 +-
> > > > > >  drivers/net/Makefile                          |    2 +-
> > > > > >  drivers/net/virtio/Kconfig                    |   11 +
> > > > > >  drivers/net/virtio/Makefile                   |   10 +
> > > > > >  .../net/{virtio_net.c => virtio/virtnet.c}    | 2368 ++---------------
> > > > > >  drivers/net/virtio/virtnet.h                  |  213 ++
> > > > > >  drivers/net/virtio/virtnet_common.c           |  138 +
> > > > > >  drivers/net/virtio/virtnet_common.h           |   14 +
> > > > > >  drivers/net/virtio/virtnet_ctrl.c             |  272 ++
> > > > > >  drivers/net/virtio/virtnet_ctrl.h             |   45 +
> > > > > >  drivers/net/virtio/virtnet_ethtool.c          |  578 ++++
> > > > > >  drivers/net/virtio/virtnet_ethtool.h          |    8 +
> > > > > >  drivers/net/virtio/virtnet_virtio.c           |  880 ++++++
> > > > > >  drivers/net/virtio/virtnet_virtio.h           |    8 +
> > > > > >  15 files changed, 2366 insertions(+), 2191 deletions(-)
> > > > > >  create mode 100644 drivers/net/virtio/Kconfig
> > > > > >  create mode 100644 drivers/net/virtio/Makefile
> > > > > >  rename drivers/net/{virtio_net.c => virtio/virtnet.c} (50%)
> > > > > >  create mode 100644 drivers/net/virtio/virtnet.h
> > > > > >  create mode 100644 drivers/net/virtio/virtnet_common.c
> > > > > >  create mode 100644 drivers/net/virtio/virtnet_common.h
> > > > > >  create mode 100644 drivers/net/virtio/virtnet_ctrl.c
> > > > > >  create mode 100644 drivers/net/virtio/virtnet_ctrl.h
> > > > > >  create mode 100644 drivers/net/virtio/virtnet_ethtool.c
> > > > > >  create mode 100644 drivers/net/virtio/virtnet_ethtool.h
> > > > > >  create mode 100644 drivers/net/virtio/virtnet_virtio.c
> > > > > >  create mode 100644 drivers/net/virtio/virtnet_virtio.h
> > > > > >
> > > > > > --
> > > > > > 2.32.0.3.g01195cf9f
> > > > >
> > > >
> > >
> > > _______________________________________________
> > > Virtualization mailing list
> > > Virtualization@lists.linux-foundation.org
> > > https://lists.linuxfoundation.org/mailman/listinfo/virtualization
>
_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization

      reply	other threads:[~2023-03-31  8:18 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-28  9:28 [PATCH 00/16] virtio-net: split virtio-net.c Xuan Zhuo
2023-03-28  9:28 ` [PATCH 01/16] virtio_net: add a separate directory for virtio-net Xuan Zhuo
2023-03-28  9:28 ` [PATCH 02/16] virtio_net: move struct to header file Xuan Zhuo
     [not found]   ` <20230329211826.0657f947@kernel.org>
2023-03-30  6:01     ` Xuan Zhuo
2023-03-28  9:28 ` [PATCH 03/16] virtio_net: add prefix to the struct inside " Xuan Zhuo
2023-03-28  9:28 ` [PATCH 04/16] virtio_net: separating cpu-related funs Xuan Zhuo
2023-03-28  9:28 ` [PATCH 05/16] virtio_net: separate virtnet_ctrl_set_queues() Xuan Zhuo
2023-03-28  9:28 ` [PATCH 06/16] virtio_net: separate virtnet_ctrl_set_mac_address() Xuan Zhuo
2023-03-28  9:28 ` [PATCH 07/16] virtio_net: remove lock from virtnet_ack_link_announce() Xuan Zhuo
2023-03-28  9:28 ` [PATCH 08/16] virtio_net: separating the APIs of cq Xuan Zhuo
2023-03-28  9:28 ` [PATCH 09/16] virtio_net: introduce virtnet_rq_update_stats() Xuan Zhuo
2023-03-28  9:28 ` [PATCH 10/16] virtio_net: separating the funcs of ethtool Xuan Zhuo
2023-03-28  9:28 ` [PATCH 11/16] virtio_net: introduce virtnet_dev_rx_queue_group() Xuan Zhuo
2023-03-28  9:28 ` [PATCH 12/16] virtio_net: introduce virtnet_get_netdev() Xuan Zhuo
     [not found]   ` <20230329212203.3c3bf199@kernel.org>
2023-03-30  6:01     ` Xuan Zhuo
2023-03-28  9:28 ` [PATCH 13/16] virtio_net: prepare for virtio Xuan Zhuo
2023-03-28  9:28 ` [PATCH 14/16] virtio_net: move virtnet_[en/dis]able_delayed_refill to header file Xuan Zhuo
2023-03-28  9:28 ` [PATCH 15/16] virtio_net: add APIs to register/unregister virtio driver Xuan Zhuo
2023-03-28  9:28 ` [PATCH 16/16] virtio_net: separating the virtio code Xuan Zhuo
     [not found]   ` <20230329211552.27efa412@kernel.org>
2023-03-30  6:00     ` Xuan Zhuo
2023-03-30  6:17 ` [PATCH 00/16] virtio-net: split virtio-net.c Michael S. Tsirkin
2023-03-31  7:21   ` Xuan Zhuo
2023-03-31  7:35     ` Jason Wang
2023-03-31  7:48       ` Xuan Zhuo
2023-03-31  8:00         ` Michael S. Tsirkin
2023-03-31  8:10           ` Xuan Zhuo [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1680250214.4751976-2-xuanzhuo@linux.alibaba.com \
    --to=xuanzhuo@linux.alibaba.com \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=hawk@kernel.org \
    --cc=john.fastabend@gmail.com \
    --cc=kuba@kernel.org \
    --cc=mst@redhat.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=virtualization@lists.linux-foundation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).