[dpdk-dev] Loop back mode of the KNI

Zhang, Helin helin.zhang at intel.com
Fri Jan 17 15:28:14 CET 2014


Hi Thomas

The final fix for that could be like below.

diff --git a/lib/librte_eal/linuxapp/kni/kni_net.c b/lib/librte_eal/linuxapp/kni/kni_net.c
index 9a49111..12dbcc0 100644
--- a/lib/librte_eal/linuxapp/kni/kni_net.c
+++ b/lib/librte_eal/linuxapp/kni/kni_net.c
@@ -311,7 +311,6 @@ kni_net_rx_lo_fifo_skb(struct kni_dev *kni)
                        skb_reserve(skb, 2);
                        memcpy(skb_put(skb, len), data_kva, len);
                        skb->dev = dev;
-                       skb->protocol = eth_type_trans(skb, dev);
                        skb->ip_summed = CHECKSUM_UNNECESSARY;
                        dev_kfree_skb(skb);
                }
@@ -327,7 +326,6 @@ kni_net_rx_lo_fifo_skb(struct kni_dev *kni)
                        skb_reserve(skb, 2);
                        memcpy(skb_put(skb, len), data_kva, len);
                        skb->dev = dev;
-                       skb->protocol = eth_type_trans(skb, dev);
                        skb->ip_summed = CHECKSUM_UNNECESSARY;

                        kni->stats.rx_bytes += len;

Regards,
Helin

-----Original Message-----
From: Thomas Monjalon [mailto:thomas.monjalon at 6wind.com] 
Sent: Friday, January 17, 2014 7:20 PM
To: Daniel Kaminsky; Zhang, Helin
Cc: dev at dpdk.org
Subject: Re: [dpdk-dev] Loop back mode of the KNI

> > From: Daniel Kaminsky
[...]
> > > But when running with *lo_mode=lo_mode_fifo_skb *the packets on 
> > > the egress doesn't include the first 14 bytes (the ethernet 
> > > header) although the packets size doesn't change.

> On Wed, Dec 25, 2013 at 2:50 AM, Zhang, Helin <helin.zhang at intel.com> wrote:
[...]
> > Yes. That's a bug, and it will be fixed in later DPDK releases.

25/12/2013 07:57, Daniel Kaminsky:
[...]
> The "fix" below works for me but I don't think it's complete and 
> correct for all kernels.
> 
> --- src/kernel/fast_kni/kni_net.c
> +++ src/kernel/fast_kni/kni_net.c
> @@ -353,6 +353,12 @@
>   kni->stats.rx_bytes += len;
>   kni->stats.rx_packets++;
> 
> +                        /* adjust the skb */
> +                        if (likely(skb_mac_header_was_set(skb))) {
> +                            skb->len += ETH_HLEN;
> +                            skb->data -= ETH_HLEN;
> +                        }
> +
>   /* call tx interface */
>   kni_net_tx(skb, dev);
>   }

Thanks Daniel.
Please Helin, could you share the complete patch in case Daniel's one is not sufficient ?

--
Thomas


More information about the dev mailing list