From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by dpdk.org (Postfix) with ESMTP id A74F8282 for ; Fri, 30 Dec 2016 06:57:22 +0100 (CET) Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga103.fm.intel.com with ESMTP; 29 Dec 2016 21:57:21 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.33,428,1477983600"; d="scan'208";a="44456919" Received: from yliu-dev.sh.intel.com (HELO yliu-dev) ([10.239.67.162]) by orsmga004.jf.intel.com with ESMTP; 29 Dec 2016 21:57:20 -0800 Date: Fri, 30 Dec 2016 13:59:07 +0800 From: Yuanhan Liu To: Jianfeng Tan Cc: dev@dpdk.org, stephen@networkplumber.org Message-ID: <20161230055907.GH21789@yliu-dev.sh.intel.com> References: <1482996643-113253-1-git-send-email-jianfeng.tan@intel.com> <1482996643-113253-5-git-send-email-jianfeng.tan@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1482996643-113253-5-git-send-email-jianfeng.tan@intel.com> User-Agent: Mutt/1.5.23 (2014-03-12) Subject: Re: [dpdk-dev] [PATCH v2 4/9] net/virtio: add Rx queue intr enable/disable functions X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 30 Dec 2016 05:57:23 -0000 On Thu, Dec 29, 2016 at 07:30:38AM +0000, Jianfeng Tan wrote: > /* > * Two types of mbuf to be cleaned: > * 1) mbuf that has been consumed by backend but not used by virtio. > diff --git a/drivers/net/virtio/virtqueue.h b/drivers/net/virtio/virtqueue.h > index f0bb089..62be136 100644 > --- a/drivers/net/virtio/virtqueue.h > +++ b/drivers/net/virtio/virtqueue.h > @@ -274,7 +274,29 @@ vring_desc_init(struct vring_desc *dp, uint16_t n) > /** > * Tell the backend not to interrupt us. > */ > -void virtqueue_disable_intr(struct virtqueue *vq); > +static inline void > +virtqueue_disable_intr(struct virtqueue *vq) > +{ > + /* Set VRING_AVAIL_F_NO_INTERRUPT to hint host > + * not to interrupt when it consumes packets > + * Note: this is only considered a hint to the host > + */ > + vq->vq_ring.avail->flags |= VRING_AVAIL_F_NO_INTERRUPT; > +} > + > +/** > + * Tell the backend to interrupt us. > + */ > +static inline void > +virtqueue_enable_intr(struct virtqueue *vq) > +{ > + /* Unset VRING_AVAIL_F_NO_INTERRUPT to hint host > + * to interrupt when it consumes packets > + * Note: this is only considered a hint to the host > + */ This kind of comment is a bit weird to me; it becomes weird-er when it appears twice. Maybe we could just drop it, as the code already expains it well (disabling interrupt regarding to NO_INTERRUPT). Or, you could combine the two and write one comment before the two functions. --yliu > + vq->vq_ring.avail->flags &= (~VRING_AVAIL_F_NO_INTERRUPT); > +} > + > /** > * Dump virtqueue internal structures, for debug purpose only. > */ > -- > 2.7.4