From: "Liu, Jijiang" <jijiang.liu@intel.com>
To: "Ouyang, Changchun" <changchun.ouyang@intel.com>,
"dev@dpdk.org" <dev@dpdk.org>
Subject: Re: [dpdk-dev] [RFC PATCH 4/8] driver/virtio:enqueue TSO offload
Date: Wed, 9 Sep 2015 17:21:06 +0000 [thread overview]
Message-ID: <1ED644BD7E0A5F4091CF203DAFB8E4CC057DAD0D@SHSMSX101.ccr.corp.intel.com> (raw)
In-Reply-To: <F52918179C57134FAEC9EA62FA2F962511D06A18@shsmsx102.ccr.corp.intel.com>
> -----Original Message-----
> From: Ouyang, Changchun
> Sent: Tuesday, September 8, 2015 6:18 PM
> To: Liu, Jijiang; dev@dpdk.org
> Cc: Ouyang, Changchun
> Subject: RE: [dpdk-dev] [RFC PATCH 4/8] driver/virtio:enqueue TSO offload
>
>
>
> > -----Original Message-----
> > From: Liu, Jijiang
> > Sent: Monday, September 7, 2015 2:11 PM
> > To: Ouyang, Changchun; dev@dpdk.org
> > Subject: RE: [dpdk-dev] [RFC PATCH 4/8] driver/virtio:enqueue TSO
> > offload
> >
> >
> >
> > > -----Original Message-----
> > > From: Ouyang, Changchun
> > > Sent: Monday, August 31, 2015 8:29 PM
> > > To: Liu, Jijiang; dev@dpdk.org
> > > Cc: Ouyang, Changchun
> > > Subject: RE: [dpdk-dev] [RFC PATCH 4/8] driver/virtio:enqueue TSO
> > > offload
> > >
> > >
> > >
> > > > -----Original Message-----
> > > > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Jijiang Liu
> > > > Sent: Monday, August 31, 2015 5:42 PM
> > > > To: dev@dpdk.org
> > > > Subject: [dpdk-dev] [RFC PATCH 4/8] driver/virtio:enqueue TSO
> > > > offload
> > > >
> > > > Enqueue TSO4/6 offload.
> > > >
> > > > Signed-off-by: Jijiang Liu <jijiang.liu@intel.com>
> > > > ---
> > > > drivers/net/virtio/virtio_rxtx.c | 23 +++++++++++++++++++++++
> > > > 1 files changed, 23 insertions(+), 0 deletions(-)
> > > >
> > > > diff --git a/drivers/net/virtio/virtio_rxtx.c
> > > > b/drivers/net/virtio/virtio_rxtx.c
> > > > index c5b53bb..4c2d838 100644
> > > > --- a/drivers/net/virtio/virtio_rxtx.c
> > > > +++ b/drivers/net/virtio/virtio_rxtx.c
> > > > @@ -198,6 +198,28 @@ virtqueue_enqueue_recv_refill(struct
> > > > virtqueue *vq, struct rte_mbuf *cookie)
> > > > return 0;
> > > > }
> > > >
> > > > +static void
> > > > +virtqueue_enqueue_offload(struct virtqueue *txvq, struct rte_mbuf
> > *m,
> > > > + uint16_t idx, uint16_t hdr_sz) {
> > > > + struct virtio_net_hdr *hdr = (struct virtio_net_hdr *)(uintptr_t)
> > > > + (txvq->virtio_net_hdr_addr + idx * hdr_sz);
> > > > +
> > > > + if (m->tso_segsz != 0 && m->ol_flags & PKT_TX_TCP_SEG) {
> > > > + if (m->ol_flags & PKT_TX_IPV4) {
> > > > + if (!vtpci_with_feature(txvq->hw,
> > > > VIRTIO_NET_F_HOST_TSO4))
> > > > + return;
> > >
> > > Do we need return error if host can't handle tso for the packet?
> > >
> > > > + hdr->gso_type = VIRTIO_NET_HDR_GSO_TCPV4;
> > > > + } else if (m->ol_flags & PKT_TX_IPV6) {
> > > > + if (!vtpci_with_feature(txvq->hw,
> > > > VIRTIO_NET_F_HOST_TSO6))
> > > > + return;
> > >
> > > Same as above
> > >
> > > > + hdr->gso_type = VIRTIO_NET_HDR_GSO_TCPV6;
> > > > + }
> > >
> > > Do we need else branch for the case of neither tcpv4 nor tcpv6?
> > >
> > > > + hdr->gso_size = m->tso_segsz;
> > > > + hdr->hdr_len = m->l2_len + m->l3_len + m->l4_len;
> > > > + }
> > > > +}
> > > > +
> > > > static int
> > > > virtqueue_enqueue_xmit(struct virtqueue *txvq, struct rte_mbuf
> > > > *cookie) { @@ -221,6 +243,7 @@ virtqueue_enqueue_xmit(struct
> > > > virtqueue *txvq, struct rte_mbuf *cookie)
> > > > dxp->cookie = (void *)cookie;
> > > > dxp->ndescs = needed;
> > > >
> > > > + virtqueue_enqueue_offload(txvq, cookie, idx, head_size);
> > >
> > > If TSO is not enabled in the feature bit, how to resolve here?
> >
> > The TSO enablement check is in the function.
> >
> > If TSO is not enabled, and don't need to fill virtio_net_hdr now.
>
> Here I mean if (m->ol_flags & PKT_TX_TCP_SEG) is true, that is to say, the virtio-
> pmd user expect do tso in vhost or virtio, but the host feature bit doesn't
> support it, then it should handle this case, either handle it in virtio pmd, or return
> error to caller.
> Otherwise the packet with flag tso maybe can't be send out normally.
> Am I right?
Not exactly, if host feature bit doesn't support TSO, and the TSO flag cannot been set in this function,
and then continue processing the packet in host.
Now I think it had better return an error, and don't continue processing this packet.
> >
> > > > start_dp = txvq->vq_ring.desc;
> > > > start_dp[idx].addr =
> > > > txvq->virtio_net_hdr_mem + idx * head_size;
> > > > --
> > > > 1.7.7.6
next prev parent reply other threads:[~2015-09-09 17:21 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-08-31 9:41 [dpdk-dev] [RFC PATCH 0/8] Add vhost TSO capability Jijiang Liu
2015-08-31 9:41 ` [dpdk-dev] [RFC PATCH 1/8] driver/virtio:add vhost TSO support capability Jijiang Liu
2015-08-31 9:41 ` [dpdk-dev] [RFC PATCH 2/8] driver/virtio: add virtual addr for virtio net header Jijiang Liu
2015-08-31 9:41 ` [dpdk-dev] [RFC PATCH 3/8] driver/virtio: record virtual address of " Jijiang Liu
2015-08-31 9:41 ` [dpdk-dev] [RFC PATCH 4/8] driver/virtio:enqueue TSO offload Jijiang Liu
2015-09-01 3:28 ` Ouyang, Changchun
2015-09-07 6:11 ` Liu, Jijiang
2015-09-09 1:17 ` Ouyang, Changchun
2015-09-09 17:21 ` Liu, Jijiang [this message]
2015-09-09 23:03 ` Ouyang, Changchun
2015-08-31 9:41 ` [dpdk-dev] [RFC PATCH 5/8] lib/librte_vhost:dequeue vhost " Jijiang Liu
2015-09-01 3:40 ` Ouyang, Changchun
2015-09-07 6:16 ` Liu, Jijiang
2015-08-31 9:41 ` [dpdk-dev] [RFC PATCH 6/8] lib/librte_vhost:extend supported vhost features Jijiang Liu
2015-08-31 9:41 ` [dpdk-dev] [RFC PATCH 7/8] examples/vhost:support tso in vhost sample Jijiang Liu
2015-08-31 9:41 ` [dpdk-dev] [RFC PATCH 8/8] app/testpmd: modify the mac of csum forwarding Jijiang Liu
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=1ED644BD7E0A5F4091CF203DAFB8E4CC057DAD0D@SHSMSX101.ccr.corp.intel.com \
--to=jijiang.liu@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
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).