Received: from eggs.gnu.org ([208.118.235.92]:55797) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UgtFv-0005h3-Ib for qemu-devel@nongnu.org; Mon, 27 May 2013 04:58:18 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UgtFr-0005II-SO for qemu-devel@nongnu.org; Mon, 27 May 2013 04:58:15 -0400 Received: from mx1.redhat.com ([209.132.183.28]:14281) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UgtFr-0005I4-K1 for qemu-devel@nongnu.org; Mon, 27 May 2013 04:58:11 -0400 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r4R8wAA3020461 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Mon, 27 May 2013 04:58:10 -0400 Date: Mon, 27 May 2013 16:58:06 +0800 From: Amos Kong Message-ID: <20130527085806.GB6120@t430s.nay.redhat.com> References: <1369377846-18439-1-git-send-email-akong@redhat.com> <519F603A.3080501@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <519F603A.3080501@redhat.com> Subject: Re: [Qemu-devel] [PATCH v4] net: introduce command to query rx-filter information List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Eric Blake Cc: mst@redhat.com, qemu-devel@nongnu.org, stefanha@redhat.com, lcapitulino@redhat.com On Fri, May 24, 2013 at 06:42:34AM -0600, Eric Blake wrote: > On 05/24/2013 12:44 AM, Amos Kong wrote: > > We want to implement mac programming over macvtap through Libvirt. The > > related rx-filter information of the nic contains main mac, rx-mode > > items. > > > > This patch adds a QMP event to notify management of rx-filter change, > > and adds a monitor command for management to query rx-filter > > information. > > > > A flag for each nic is used to avoid events flooding, if management > > doesn't query rx-filter after it receives one event, new events won't > > be emitted to QMP monitor. > > > > There maybe exist an uncontrollable delay, guests normally expect > > rx-filter updates immediately, but it's another separate issue, we > > can investigate it after Libvirt work is done. > > > > Signed-off-by: Amos Kong > > --- > > > +++ b/QMP/qmp-events.txt > > @@ -172,6 +172,25 @@ Data: > > }, > > "timestamp": { "seconds": 1265044230, "microseconds": 450486 } } > > > > +NIC_RX_FILTER_CHANGED > > +----------------- > > + > > +Emitted when rx-filter configuration of nic is changed by the guest. > > +Each nic has a flag to control event emit, the flag is set to false > > +when it emits one event of the nic, the flag is set to true when > > +management queries the rx-filter of the nic. This is used to avoid > > +events flooding. > > + > > +Data: > > + > > +- "name": net client name (json-string) > > Missing documentation on the "path" member. fixed. > > +++ b/include/net/net.h > > @@ -74,6 +76,7 @@ struct NetClientState { > > unsigned receive_disabled : 1; > > NetClientDestructor *destructor; > > unsigned int queue_index; > > + bool rxfilter_notify_enabled:true; > > Very unusual to use 'true' instead of '1' for a bitfield length (valid > C, but I've never seen it done in the wild). Also, the code base has > very few bit fields of type bool (I only found 4: two in > block/raw-posix.c and two in hw/intc/openpic.c); > we generally prefer > 'int' or 'unsigned' bitfields, where bitfields make sense. For that > matter, is this really a struct where we are trying to cram as much > information into space such that a bitfield helps us, or can we just use > plain 'bool' instead of trying to make it a bitfield? > And if a bitfield > is important, then why not group this next to the receive_disabled > bitfield so that the two share the same byte, instead of wasting > alignment for two disjoint bitfields? it's more complex. receive_disabled was used as a 'bool' not bitfield here. I would like to add a new variable to indicate if notification is needed. unsigned rxfilter_notify_enabled:1; > Everything else looked okay to me. -- Amos.