DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] Loop back mode of the KNI
@ 2013-12-19 16:36 Daniel Kaminsky
  2013-12-25  0:50 ` Zhang, Helin
  0 siblings, 1 reply; 6+ messages in thread
From: Daniel Kaminsky @ 2013-12-19 16:36 UTC (permalink / raw)
  To: dev

Hi all,

We're working on the KNI and we see a strange behavior which seems like a
bug in the the kernel module.

When running with *lo_mode=lo_mode_fifo *everything works as expected, the
packets looks similar on the ingress and egress.
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.

Thanks,
Daniel

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [dpdk-dev] Loop back mode of the KNI
  2013-12-19 16:36 [dpdk-dev] Loop back mode of the KNI Daniel Kaminsky
@ 2013-12-25  0:50 ` Zhang, Helin
  2013-12-25  6:57   ` Daniel Kaminsky
  0 siblings, 1 reply; 6+ messages in thread
From: Zhang, Helin @ 2013-12-25  0:50 UTC (permalink / raw)
  To: Daniel Kaminsky; +Cc: dev

Hi Daniel

Thanks for your good catch!
Yes. That's a bug, and it will be fixed in later DPDK releases.

Regards,
Helin

-----Original Message-----
From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Daniel Kaminsky
Sent: Friday, December 20, 2013 12:36 AM
To: dev@dpdk.org
Subject: [dpdk-dev] Loop back mode of the KNI

Hi all,

We're working on the KNI and we see a strange behavior which seems like a bug in the the kernel module.

When running with *lo_mode=lo_mode_fifo *everything works as expected, the packets looks similar on the ingress and egress.
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.

Thanks,
Daniel

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [dpdk-dev] Loop back mode of the KNI
  2013-12-25  0:50 ` Zhang, Helin
@ 2013-12-25  6:57   ` Daniel Kaminsky
  2014-01-17 11:19     ` Thomas Monjalon
  0 siblings, 1 reply; 6+ messages in thread
From: Daniel Kaminsky @ 2013-12-25  6:57 UTC (permalink / raw)
  To: Zhang, Helin; +Cc: dev

Thanks Helin,

The "fix" below works for me but I don't think it's complete and correct
for all kernels.

Daniel

Index: src/kernel/fast_kni/kni_net.c
===================================================================
--- 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);
  }



On Wed, Dec 25, 2013 at 2:50 AM, Zhang, Helin <helin.zhang@intel.com> wrote:

> Hi Daniel
>
> Thanks for your good catch!
> Yes. That's a bug, and it will be fixed in later DPDK releases.
>
> Regards,
> Helin
>
> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Daniel Kaminsky
> Sent: Friday, December 20, 2013 12:36 AM
> To: dev@dpdk.org
> Subject: [dpdk-dev] Loop back mode of the KNI
>
> Hi all,
>
> We're working on the KNI and we see a strange behavior which seems like a
> bug in the the kernel module.
>
> When running with *lo_mode=lo_mode_fifo *everything works as expected, the
> packets looks similar on the ingress and egress.
> 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.
>
> Thanks,
> Daniel
>

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [dpdk-dev] Loop back mode of the KNI
  2013-12-25  6:57   ` Daniel Kaminsky
@ 2014-01-17 11:19     ` Thomas Monjalon
  2014-01-17 14:28       ` Zhang, Helin
  0 siblings, 1 reply; 6+ messages in thread
From: Thomas Monjalon @ 2014-01-17 11:19 UTC (permalink / raw)
  To: Daniel Kaminsky, Zhang, Helin; +Cc: dev

> > 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@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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [dpdk-dev] Loop back mode of the KNI
  2014-01-17 11:19     ` Thomas Monjalon
@ 2014-01-17 14:28       ` Zhang, Helin
  2014-01-17 15:35         ` Thomas Monjalon
  0 siblings, 1 reply; 6+ messages in thread
From: Zhang, Helin @ 2014-01-17 14:28 UTC (permalink / raw)
  To: Thomas Monjalon, Daniel Kaminsky; +Cc: dev

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@6wind.com] 
Sent: Friday, January 17, 2014 7:20 PM
To: Daniel Kaminsky; Zhang, Helin
Cc: dev@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@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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [dpdk-dev] Loop back mode of the KNI
  2014-01-17 14:28       ` Zhang, Helin
@ 2014-01-17 15:35         ` Thomas Monjalon
  0 siblings, 0 replies; 6+ messages in thread
From: Thomas Monjalon @ 2014-01-17 15:35 UTC (permalink / raw)
  To: Zhang, Helin; +Cc: dev

17/01/2014 15:28, Zhang, Helin:
> The final fix for that could be like below.
> 
> --- 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;

Thanks for sharing.
Please, could you send a real patch with title, detailed explanation and 
sign-off as suggested in http://dpdk.org/dev#send ?
We should integrate such fix as soon as possible in the current branch in 
order to provide better user experience.

-- 
Thomas

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2014-01-17 15:34 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-12-19 16:36 [dpdk-dev] Loop back mode of the KNI Daniel Kaminsky
2013-12-25  0:50 ` Zhang, Helin
2013-12-25  6:57   ` Daniel Kaminsky
2014-01-17 11:19     ` Thomas Monjalon
2014-01-17 14:28       ` Zhang, Helin
2014-01-17 15:35         ` Thomas Monjalon

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).