From: "Xie, Huawei" <huawei.xie@intel.com> To: "Ouyang, Changchun" <changchun.ouyang@intel.com>, "dev@dpdk.org" <dev@dpdk.org> Subject: Re: [dpdk-dev] [PATCH v4] virtio: Fix vring entry number issue Date: Tue, 14 Oct 2014 16:26:25 +0000 Message-ID: <C37D651A908B024F974696C65296B57B0F2BCA95@SHSMSX101.ccr.corp.intel.com> (raw) In-Reply-To: <1413302634-848-1-git-send-email-changchun.ouyang@intel.com> > -----Original Message----- > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Ouyang Changchun > Sent: Tuesday, October 14, 2014 9:04 AM > To: dev@dpdk.org > Subject: [dpdk-dev] [PATCH v4] virtio: Fix vring entry number issue > > Fix one issue in virtio TX: it needs one more vring descriptor to hold the virtio > header when transmitting packets, it is used later to determine whether to free > more entries from used vring. > It fixes failing to transmit any packet with 1 segment in the circumstance of > only > 1 descriptor in the vring free list. > > Signed-off-by: Changchun Ouyang <changchun.ouyang@intel.com> > Reviewed-by: Olivier Matz <olivier.matz@6wind.com> > --- > -V4 change: > Relocate those changelog and annotation here. > > -V3 change: > Resolve compilation issue due to mbuf re-structure. > > -V2 change: > Refine description, 'vring descriptor' is more accurate than 'vring entry'; > Accordingly update test condition (it needs one more descriptor for virtio > header) to > put packets to transmit queue. > > -V1 change: > Fix the vring descriptor issue in virtio TX, it needs one more vring descriptor to > hold the > virtio header. > > lib/librte_pmd_virtio/virtio_rxtx.c | 10 ++++++++-- > 1 file changed, 8 insertions(+), 2 deletions(-) > > diff --git a/lib/librte_pmd_virtio/virtio_rxtx.c > b/lib/librte_pmd_virtio/virtio_rxtx.c > index 0b10108..ac44c65 100644 > --- a/lib/librte_pmd_virtio/virtio_rxtx.c > +++ b/lib/librte_pmd_virtio/virtio_rxtx.c > @@ -699,7 +699,8 @@ virtio_xmit_pkts(void *tx_queue, struct rte_mbuf > **tx_pkts, uint16_t nb_pkts) > num = (uint16_t)(likely(nb_used < VIRTIO_MBUF_BURST_SZ) ? nb_used : > VIRTIO_MBUF_BURST_SZ); > > while (nb_tx < nb_pkts) { > - int need = tx_pkts[nb_tx]->pkt.nb_segs - txvq->vq_free_cnt; > + /* Need one more descriptor for virtio header. */ > + int need = tx_pkts[nb_tx]->nb_segs - txvq->vq_free_cnt + 1; > int deq_cnt = RTE_MIN(need, (int)num); > > num -= (deq_cnt > 0) ? deq_cnt : 0; > @@ -708,7 +709,12 @@ virtio_xmit_pkts(void *tx_queue, struct rte_mbuf > **tx_pkts, uint16_t nb_pkts) > deq_cnt--; > } > > - if (tx_pkts[nb_tx]->pkt.nb_segs <= txvq->vq_free_cnt) { > + need = (int)tx_pkts[nb_tx]->nb_segs - txvq->vq_free_cnt + 1; > + /* > + * Zero or negative value indicates it has enough free > + * decriptors to transmit. > + */ > + if (need <= 0) { Could we put a branch hint to favor the fast path? > txm = tx_pkts[nb_tx]; > /* Enqueue Packet buffers */ > error = virtqueue_enqueue_xmit(txvq, txm); > -- > 1.8.4.2
next prev parent reply other threads:[~2014-10-14 16:20 UTC|newest] Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top 2014-10-11 8:05 [dpdk-dev] [PATCH v2] " Ouyang Changchun 2014-10-14 15:12 ` [dpdk-dev] [PATCH v3] " Ouyang Changchun 2014-10-14 15:28 ` Ouyang, Changchun 2014-10-14 16:03 ` [dpdk-dev] [PATCH v4] " Ouyang Changchun 2014-10-14 16:26 ` Xie, Huawei [this message] 2014-10-15 3:14 ` Ouyang, Changchun 2014-10-15 3:11 ` [dpdk-dev] [PATCH v5] " Ouyang Changchun 2014-10-15 6:34 ` Thomas Monjalon
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=C37D651A908B024F974696C65296B57B0F2BCA95@SHSMSX101.ccr.corp.intel.com \ --to=huawei.xie@intel.com \ --cc=changchun.ouyang@intel.com \ --cc=dev@dpdk.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
DPDK patches and discussions This inbox may be cloned and mirrored by anyone: git clone --mirror https://inbox.dpdk.org/dev/0 dev/git/0.git # If you have public-inbox 1.1+ installed, you may # initialize and index your mirror using the following commands: public-inbox-init -V2 dev dev/ https://inbox.dpdk.org/dev \ dev@dpdk.org public-inbox-index dev Example config snippet for mirrors. Newsgroup available over NNTP: nntp://inbox.dpdk.org/inbox.dpdk.dev AGPL code for this site: git clone https://public-inbox.org/public-inbox.git