[ovs-dev] 答复: [PATCH V3 2/4] Add GSO support for DPDK data path

William Tu u9012063 at gmail.com
Sun Feb 7 15:45:58 UTC 2021


On Tue, Oct 27, 2020 at 6:02 PM Yi Yang (杨燚)-云服务集团 <yangyi01 at inspur.com> wrote:
>
> -----邮件原件-----
> 发件人: dev [mailto:ovs-dev-bounces at openvswitch.org] 代表 Ilya Maximets
> 发送时间: 2020年10月27日 21:03
> 收件人: yang_y_yi at 163.com; ovs-dev at openvswitch.org
> 抄送: fbl at sysclose.org; i.maximets at ovn.org
> 主题: Re: [ovs-dev] [PATCH V3 2/4] Add GSO support for DPDK data path
>
> On 8/7/20 12:56 PM, yang_y_yi at 163.com wrote:
> > From: Yi Yang <yangyi01 at inspur.com>
> >
> > GSO(Generic Segment Offload) can segment large UDP  and TCP packet to
> > small packets per MTU of destination , especially for the case that
> > physical NIC can't do hardware offload VXLAN TSO and VXLAN UFO, GSO
> > can make sure userspace TSO can still work but not drop.
> >
> > In addition, GSO can help improve UDP performane when UFO is enabled
> > in VM.
> >
> > GSO can support TCP, UDP, VXLAN TCP, VXLAN UDP, it is done in Tx
> > function of physical NIC.
> >
> > Signed-off-by: Yi Yang <yangyi01 at inspur.com>
> > ---
> >  lib/dp-packet.h    |  21 +++-
> >  lib/netdev-dpdk.c  | 358
> > +++++++++++++++++++++++++++++++++++++++++++++++++----
> >  lib/netdev-linux.c |  17 ++-
> >  lib/netdev.c       |  67 +++++++---
> >  4 files changed, 417 insertions(+), 46 deletions(-)

snip

> >
> > @@ -2339,24 +2428,19 @@ netdev_dpdk_prep_hwol_batch(struct netdev_dpdk *dev, struct rte_mbuf **pkts,
> >      return cnt;
> >  }
> >
> > -/* Tries to transmit 'pkts' to txq 'qid' of device 'dev'.  Takes
> > ownership of
> > - * 'pkts', even in case of failure.
> > - *
> > - * Returns the number of packets that weren't transmitted. */  static
> > inline int -netdev_dpdk_eth_tx_burst(struct netdev_dpdk *dev, int qid,
> > -                         struct rte_mbuf **pkts, int cnt)
> > +__netdev_dpdk_eth_tx_burst(struct netdev_dpdk *dev, int qid,
> > +                           struct rte_mbuf **pkts, int cnt)
> >  {
> >      uint32_t nb_tx = 0;
> > -    uint16_t nb_tx_prep = cnt;
> > +    uint32_t nb_tx_prep;
> >
> > -    if (userspace_tso_enabled()) {
> > -        nb_tx_prep = rte_eth_tx_prepare(dev->port_id, qid, pkts, cnt);
> > -        if (nb_tx_prep != cnt) {
> > -            VLOG_WARN_RL(&rl, "%s: Output batch contains invalid packets. "
> > -                         "Only %u/%u are valid: %s", dev->up.name, nb_tx_prep,
> > -                         cnt, rte_strerror(rte_errno));
> > -        }
> > +    nb_tx_prep = rte_eth_tx_prepare(dev->port_id, qid, pkts, cnt);
> > +    if (nb_tx_prep != cnt) {
> > +        VLOG_WARN_RL(&rl, "%s: Output batch contains invalid packets. "
> > +                          "Only %u/%u are valid: %s",
> > +                     dev->up.name, nb_tx_prep,
> > +                     cnt, rte_strerror(rte_errno));
> >      }
> >
> >      while (nb_tx != nb_tx_prep) {
> > @@ -2384,6 +2468,200 @@ netdev_dpdk_eth_tx_burst(struct netdev_dpdk *dev, int qid,
> >      return cnt - nb_tx;
> >  }
> >
> > +static inline void
> > +set_multiseg_udptcp_cksum(struct rte_mbuf *mbuf)
>
> I didn't review the patch, only had a quick glance, but this part bothers me.  OVS doesn't support multi-segment mbufs, so it should not be possible for such mbufs being transmitted by OVS.  So, I do not understand why this function needs to work with such mbufs.
>
> [Yi Yang] Only DPDK driver/Tx function will use it, not OVS, set_multiseg_udptcp_cksum is called in GSO part, it is last step before Tx function, it is a big external mbuf before rte_gso_segment, that isn't a multi-segmented mbuf.
>

Hi Ilya,

Now I understand Yi Yang's point better and I agree with him.
Looks like the patch does the GSO at the DPDK TX function.
It creates multi-seg mbuf after rte_gso_segment(), but will immediately
send out the multi-seg mbuf to DPDK port, without traversing inside other
part of OVS code. I guess this case it should work OK?

William


More information about the dev mailing list