[dpdk-dev,RFC,4/5] kni: add support to get gso_size info

Message ID 1493810472-668-4-git-send-email-hemant.agrawal@nxp.com (mailing list archive)
State RFC, archived
Delegated to: Ferruh Yigit
Headers

Checks

Context Check Description
ci/checkpatch warning coding style issues
ci/Intel-compilation success Compilation OK

Commit Message

Hemant Agrawal May 3, 2017, 11:21 a.m. UTC
  Inform userspace about gso size info

Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
---
 lib/librte_eal/linuxapp/eal/include/exec-env/rte_kni_common.h | 3 ++-
 lib/librte_eal/linuxapp/kni/kni_net.c                         | 1 +
 2 files changed, 3 insertions(+), 1 deletion(-)
  

Comments

Alejandro Lucero May 3, 2017, 1:57 p.m. UTC | #1
I guess this is just need this for tso offload. isn't it?

Just asking because I have done some work adding gather and tso offload to
kni and I was wondering if this is duplicated job from my part.

If you are wondering what KNI offload means, since it is not talking to any
hw, the offload is regarding the PMD where KNI is sending packet to. So if
that PMD supports hw offloads, KNI netdev can advertise that to the linux
network stack.



On Wed, May 3, 2017 at 12:21 PM, Hemant Agrawal <hemant.agrawal@nxp.com>
wrote:

> Inform userspace about gso size info
>
> Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
> ---
>  lib/librte_eal/linuxapp/eal/include/exec-env/rte_kni_common.h | 3 ++-
>  lib/librte_eal/linuxapp/kni/kni_net.c                         | 1 +
>  2 files changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/lib/librte_eal/linuxapp/eal/include/exec-env/rte_kni_common.h
> b/lib/librte_eal/linuxapp/eal/include/exec-env/rte_kni_common.h
> index 2cd7d9a..91ebed3 100644
> --- a/lib/librte_eal/linuxapp/eal/include/exec-env/rte_kni_common.h
> +++ b/lib/librte_eal/linuxapp/eal/include/exec-env/rte_kni_common.h
> @@ -125,7 +125,8 @@ struct rte_kni_mbuf {
>         uint16_t nb_segs;       /**< Number of segments. */
>         char pad4[2];
>         uint64_t ol_flags;      /**< Offload features. */
> -       char pad2[4];
> +       uint16_t gso_size;      /**< TCP Segmentation Offload Information.
> */
> +       char pad2[2];
>         uint32_t pkt_len;       /**< Total pkt len: sum of all segment
> data_len. */
>         uint16_t data_len;      /**< Amount of data in segment buffer. */
>
> diff --git a/lib/librte_eal/linuxapp/kni/kni_net.c
> b/lib/librte_eal/linuxapp/kni/kni_net.c
> index e4a3296..c7648d3 100644
> --- a/lib/librte_eal/linuxapp/kni/kni_net.c
> +++ b/lib/librte_eal/linuxapp/kni/kni_net.c
> @@ -252,6 +252,7 @@
>                 }
>                 pkt_kva->pkt_len = len;
>                 pkt_kva->data_len = len;
> +               pkt_kva->gso_size = skb_shinfo(skb)->gso_size; /* passes
> gso_size from Kernel to GPP */
>
>                 /* enqueue mbuf into tx_q */
>                 ret = kni_fifo_put(kni->tx_q, &pkt_va, 1);
> --
> 1.9.1
>
>
  
Ferruh Yigit May 5, 2017, 11:43 a.m. UTC | #2
On 5/3/2017 12:21 PM, Hemant Agrawal wrote:
> Inform userspace about gso size info
> 
> Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
> ---
>  lib/librte_eal/linuxapp/eal/include/exec-env/rte_kni_common.h | 3 ++-
>  lib/librte_eal/linuxapp/kni/kni_net.c                         | 1 +
>  2 files changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/lib/librte_eal/linuxapp/eal/include/exec-env/rte_kni_common.h b/lib/librte_eal/linuxapp/eal/include/exec-env/rte_kni_common.h
> index 2cd7d9a..91ebed3 100644
> --- a/lib/librte_eal/linuxapp/eal/include/exec-env/rte_kni_common.h
> +++ b/lib/librte_eal/linuxapp/eal/include/exec-env/rte_kni_common.h
> @@ -125,7 +125,8 @@ struct rte_kni_mbuf {
>  	uint16_t nb_segs;       /**< Number of segments. */
>  	char pad4[2];
>  	uint64_t ol_flags;      /**< Offload features. */
> -	char pad2[4];
> +	uint16_t gso_size;      /**< TCP Segmentation Offload Information. */
> +	char pad2[2];

rte_kni_mbuf and rte_mbuf should be binary compatible. This is
packet_type field of the mbuf struct.

When DPDK application receives the mbuf, how it will know if this
gso_size or packet_type, unless it knows underlying port is KNI. Is it
possible to use udata64 field for this?

Who will use information and how it will be used, can you please provide
some sort of sample?

Thanks,
ferruh

>  	uint32_t pkt_len;       /**< Total pkt len: sum of all segment data_len. */
>  	uint16_t data_len;      /**< Amount of data in segment buffer. */
>  
> diff --git a/lib/librte_eal/linuxapp/kni/kni_net.c b/lib/librte_eal/linuxapp/kni/kni_net.c
> index e4a3296..c7648d3 100644
> --- a/lib/librte_eal/linuxapp/kni/kni_net.c
> +++ b/lib/librte_eal/linuxapp/kni/kni_net.c
> @@ -252,6 +252,7 @@
>  		}
>  		pkt_kva->pkt_len = len;
>  		pkt_kva->data_len = len;
> +		pkt_kva->gso_size = skb_shinfo(skb)->gso_size; /* passes gso_size from Kernel to GPP */
>  
>  		/* enqueue mbuf into tx_q */
>  		ret = kni_fifo_put(kni->tx_q, &pkt_va, 1);
>
  

Patch

diff --git a/lib/librte_eal/linuxapp/eal/include/exec-env/rte_kni_common.h b/lib/librte_eal/linuxapp/eal/include/exec-env/rte_kni_common.h
index 2cd7d9a..91ebed3 100644
--- a/lib/librte_eal/linuxapp/eal/include/exec-env/rte_kni_common.h
+++ b/lib/librte_eal/linuxapp/eal/include/exec-env/rte_kni_common.h
@@ -125,7 +125,8 @@  struct rte_kni_mbuf {
 	uint16_t nb_segs;       /**< Number of segments. */
 	char pad4[2];
 	uint64_t ol_flags;      /**< Offload features. */
-	char pad2[4];
+	uint16_t gso_size;      /**< TCP Segmentation Offload Information. */
+	char pad2[2];
 	uint32_t pkt_len;       /**< Total pkt len: sum of all segment data_len. */
 	uint16_t data_len;      /**< Amount of data in segment buffer. */
 
diff --git a/lib/librte_eal/linuxapp/kni/kni_net.c b/lib/librte_eal/linuxapp/kni/kni_net.c
index e4a3296..c7648d3 100644
--- a/lib/librte_eal/linuxapp/kni/kni_net.c
+++ b/lib/librte_eal/linuxapp/kni/kni_net.c
@@ -252,6 +252,7 @@ 
 		}
 		pkt_kva->pkt_len = len;
 		pkt_kva->data_len = len;
+		pkt_kva->gso_size = skb_shinfo(skb)->gso_size; /* passes gso_size from Kernel to GPP */
 
 		/* enqueue mbuf into tx_q */
 		ret = kni_fifo_put(kni->tx_q, &pkt_va, 1);