On Thu, Jan 13, 2022 at 04:23:17PM +0800, Harold Huang wrote:
> From: Harold Huang <[email protected]>
>
> When one flow is output to multiple egress ports, OVS copy the packets
> and send the copy packets to the intermediate ports. The original packets
> is sent to the last port. If the intermediate port is a dpdk port, the copy
> packets should also be prepared for tso offload.
>
> Fixes: 29cf9c1b3b ("userspace: Add TCP Segmentation Offload support")
> Signed-off-by: Harold Huang <[email protected]>
> ---
> lib/netdev-dpdk.c | 13 ++++++-------
> 1 file changed, 6 insertions(+), 7 deletions(-)
>
> diff --git a/lib/netdev-dpdk.c b/lib/netdev-dpdk.c
> index 6782d3e8f..83029405e 100644
> --- a/lib/netdev-dpdk.c
> +++ b/lib/netdev-dpdk.c
> @@ -2737,10 +2737,11 @@ dpdk_pktmbuf_alloc(struct rte_mempool *mp, uint32_t
> data_len)
> }
>
> static struct dp_packet *
> -dpdk_copy_dp_packet_to_mbuf(struct rte_mempool *mp, struct dp_packet
> *pkt_orig)
> +dpdk_copy_dp_packet_to_mbuf(struct netdev_dpdk *dev, struct dp_packet
> *pkt_orig)
> {
> struct rte_mbuf *mbuf_dest;
> struct dp_packet *pkt_dest;
> + struct rte_mempool *mp = dev->dpdk_mp->mp;
> uint32_t pkt_len;
>
> pkt_len = dp_packet_size(pkt_orig);
> @@ -2761,11 +2762,9 @@ dpdk_copy_dp_packet_to_mbuf(struct rte_mempool *mp,
> struct dp_packet *pkt_orig)
> memcpy(&pkt_dest->l2_pad_size, &pkt_orig->l2_pad_size,
> sizeof(struct dp_packet) - offsetof(struct dp_packet,
> l2_pad_size));
>
> - if (mbuf_dest->ol_flags & RTE_MBUF_F_TX_L4_MASK) {
> - mbuf_dest->l2_len = (char *)dp_packet_l3(pkt_dest)
> - - (char *)dp_packet_eth(pkt_dest);
> - mbuf_dest->l3_len = (char *)dp_packet_l4(pkt_dest)
> - - (char *) dp_packet_l3(pkt_dest);
> + if (!netdev_dpdk_prep_hwol_packet(dev, mbuf_dest)) {
> + rte_pktmbuf_free(mbuf_dest);
> + return NULL;
What happens if a packet comes from a non-DPDK port and
goes to a vhost-user port? I think we will get into this:
netdev_dpdk_vhost_send()
\-- (not a DPDK packet)
\-- dpdk_do_tx_copy()
\-- dpdk_copy_dp_packet_to_mbuf()
| \-- netdev_dpdk_prep_hwol_packet() <--
|
\-- __netdev_dpdk_vhost_send()
\-- netdev_dpdk_prep_hwol_batch()
\-- netdev_dpdk_prep_hwol_packet() <--
I think we will prepare the same packet twice.
BTW, this bug should be fixed by the patch here:
https://patchwork.ozlabs.org/project/openvswitch/patch/[email protected]/#2610119
fbl
> }
>
> return pkt_dest;
> @@ -2813,7 +2812,7 @@ dpdk_do_tx_copy(struct netdev *netdev, int qid, struct
> dp_packet_batch *batch)
> continue;
> }
>
> - pkts[txcnt] = dpdk_copy_dp_packet_to_mbuf(dev->dpdk_mp->mp, packet);
> + pkts[txcnt] = dpdk_copy_dp_packet_to_mbuf(dev, packet);
> if (OVS_UNLIKELY(!pkts[txcnt])) {
> dropped = cnt - i;
> break;
> --
> 2.27.0
>
> _______________________________________________
> dev mailing list
> [email protected]
> https://mail.openvswitch.org/mailman/listinfo/ovs-dev
--
fbl
_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev