qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Stefan Hajnoczi <stefanha@redhat.com>
To: Liu Ping Fan <pingfank@linux.vnet.ibm.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>,
	qemu-devel@nongnu.org, Anthony Liguori <anthony@codemonkey.ws>,
	mdroth <mdroth@linux.vnet.ibm.com>
Subject: Re: [Qemu-devel] [RFC PATCH v3 1/5] net: introduce glib function for network
Date: Tue, 9 Apr 2013 16:03:11 +0200	[thread overview]
Message-ID: <20130409140311.GB12456@stefanha-thinkpad.redhat.com> (raw)
In-Reply-To: <1365399368-26967-2-git-send-email-pingfank@linux.vnet.ibm.com>

On Mon, Apr 08, 2013 at 01:36:04PM +0800, Liu Ping Fan wrote:
> Bind each NetClientState with a GSource(ie,NetClientSource). Currently,
> these GSource attached with default context, but in future, after
> resolving the race between handlers and the interface exposed by
> NetClientInfo and other re-entrant issue, we can run NetClientState
> on different threads
> 
> Signed-off-by: Liu Ping Fan <pingfank@linux.vnet.ibm.com>
> ---
>  include/net/net.h |   15 +++++++++++++
>  net/net.c         |   61 +++++++++++++++++++++++++++++++++++++++++++++++++++++
>  2 files changed, 76 insertions(+), 0 deletions(-)
> 
> diff --git a/include/net/net.h b/include/net/net.h
> index cb049a1..cb2451d 100644
> --- a/include/net/net.h
> +++ b/include/net/net.h
> @@ -44,6 +44,7 @@ typedef ssize_t (NetReceiveIOV)(NetClientState *, const struct iovec *, int);
>  typedef void (NetCleanup) (NetClientState *);
>  typedef void (LinkStatusChanged)(NetClientState *);
>  typedef void (NetClientDestructor)(NetClientState *);
> +typedef void (NetClientBindCtx)(NetClientState *, GMainContext *);
>  
>  typedef struct NetClientInfo {
>      NetClientOptionsKind type;
> @@ -55,8 +56,20 @@ typedef struct NetClientInfo {
>      NetCleanup *cleanup;
>      LinkStatusChanged *link_status_changed;
>      NetPoll *poll;
> +    NetClientBindCtx *bind_ctx;
>  } NetClientInfo;
>  
> +typedef bool (*Pollable)(void *opaque);
> +
> +typedef struct NetClientSource {
> +    GSource source;
> +    /* fix me, to expand as array in future */
> +    GPollFD gfd;
> +    Pollable readable;
> +    Pollable writable;
> +    void *opaque;
> +} NetClientSource;

This struct has nothing to do with the net subsystem.  It is a generic
utility for file descriptor read/write monitoring.  It should be in a
separate file (maybe util/fdsource.c?).

NetClient should not know about the GSource at all.  It's an
implementation detail of the NetClient, just like the actual fd is also
an implementation detail that net.h/net.c doesn't know about.

Stefan

  reply	other threads:[~2013-04-09 14:05 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-08  5:36 [Qemu-devel] [RFC PATCH v3 0/5] port network layer onto glib Liu Ping Fan
2013-04-08  5:36 ` [Qemu-devel] [RFC PATCH v3 1/5] net: introduce glib function for network Liu Ping Fan
2013-04-09 14:03   ` Stefan Hajnoczi [this message]
2013-04-08  5:36 ` [Qemu-devel] [RFC PATCH v3 2/5] net: port tap onto glib Liu Ping Fan
2013-04-08  5:36 ` [Qemu-devel] [RFC PATCH v3 3/5] net: resolve race of tap backend and its peer Liu Ping Fan
2013-04-08  5:36 ` [Qemu-devel] [RFC PATCH v3 4/5] net: port vde onto glib Liu Ping Fan
2013-04-08  5:36 ` [Qemu-devel] [RFC PATCH v3 5/5] net: port socket to glib Liu Ping Fan
2013-04-09 15:22 ` [Qemu-devel] [RFC PATCH v3 0/5] port network layer onto glib Stefan Hajnoczi
2013-04-10  7:47   ` liu ping fan
2013-04-10 11:55     ` Stefan Hajnoczi
2013-04-11  9:13       ` liu ping fan
2013-04-11 11:44         ` Stefan Hajnoczi
2013-04-11 12:05           ` liu ping fan
2013-04-12  7:44             ` Stefan Hajnoczi

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=20130409140311.GB12456@stefanha-thinkpad.redhat.com \
    --to=stefanha@redhat.com \
    --cc=anthony@codemonkey.ws \
    --cc=mdroth@linux.vnet.ibm.com \
    --cc=pbonzini@redhat.com \
    --cc=pingfank@linux.vnet.ibm.com \
    --cc=qemu-devel@nongnu.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).