[dpdk-dev,2/3] app/testpmd: enable UDP GSO in the checksum forwarding engine

Message ID 1527579670-91026-3-git-send-email-jiayu.hu@intel.com (mailing list archive)
State Superseded, archived
Delegated to: Thomas Monjalon
Headers

Checks

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

Commit Message

Hu, Jiayu May 29, 2018, 7:41 a.m. UTC
  This patch enables GSO for UDP/IPv4 packets. Oversized UDP/IPv4
packets transmitted over a GSO-enabled port will undergo segmentation.

Signed-off-by: Jiayu Hu <jiayu.hu@intel.com>
---
 app/test-pmd/cmdline.c  | 5 +++--
 app/test-pmd/csumonly.c | 2 ++
 app/test-pmd/testpmd.c  | 2 +-
 3 files changed, 6 insertions(+), 3 deletions(-)
  

Comments

Iremonger, Bernard June 14, 2018, 2:44 p.m. UTC | #1
Hi Jiayu,

> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Jiayu Hu
> Sent: Tuesday, May 29, 2018 8:41 AM
> To: dev@dpdk.org
> Cc: Ananyev, Konstantin <konstantin.ananyev@intel.com>; Hu, Jiayu
> <jiayu.hu@intel.com>
> Subject: [dpdk-dev] [PATCH 2/3] app/testpmd: enable UDP GSO in the
> checksum forwarding engine
> 
> This patch enables GSO for UDP/IPv4 packets. Oversized UDP/IPv4 packets
> transmitted over a GSO-enabled port will undergo segmentation.
> 
> Signed-off-by: Jiayu Hu <jiayu.hu@intel.com>
> ---
>  app/test-pmd/cmdline.c  | 5 +++--
>  app/test-pmd/csumonly.c | 2 ++
>  app/test-pmd/testpmd.c  | 2 +-
>  3 files changed, 6 insertions(+), 3 deletions(-)
> 
> diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c index
> 27e2aa8..4239e91 100644
> --- a/app/test-pmd/cmdline.c
> +++ b/app/test-pmd/cmdline.c
> @@ -4792,8 +4792,9 @@ cmd_gso_show_parsed(void *parsed_result,
>  		if (gso_ports[res->cmd_pid].enable) {
>  			printf("Max GSO'd packet size: %uB\n"
>  					"Supported GSO types: TCP/IPv4, "
> -					"VxLAN with inner TCP/IPv4 packet, "
> -					"GRE with inner TCP/IPv4  packet\n",
> +					"UDP/IPv4, VxLAN with inner "
> +					"TCP/IPv4 packet, GRE with inner "
> +					"TCP/IPv4 packet\n",

This change is giving 3 checkpatch.pl warnings and should be refactored


>  					gso_max_segment_size);
>  		} else
>  			printf("GSO is not enabled on Port %u\n", res-
> >cmd_pid); diff --git a/app/test-pmd/csumonly.c b/app/test-
> pmd/csumonly.c index 0bb88cf..4948292 100644
> --- a/app/test-pmd/csumonly.c
> +++ b/app/test-pmd/csumonly.c
> @@ -411,6 +411,8 @@ process_inner_cksums(void *l3_hdr, const struct
> testpmd_offload_info *info,
>  						info->ethertype);
>  			}
>  		}
> +		if (info->gso_enable)
> +			ol_flags |= PKT_TX_UDP_SEG;
>  	} else if (info->l4_proto == IPPROTO_TCP) {
>  		tcp_hdr = (struct tcp_hdr *)((char *)l3_hdr + info->l3_len);
>  		tcp_hdr->cksum = 0;
> diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c index
> 35cf266..b5766ff 100644
> --- a/app/test-pmd/testpmd.c
> +++ b/app/test-pmd/testpmd.c
> @@ -777,7 +777,7 @@ init_config(void)
>  	init_port_config();
> 
>  	gso_types = DEV_TX_OFFLOAD_TCP_TSO |
> DEV_TX_OFFLOAD_VXLAN_TNL_TSO |
> -		DEV_TX_OFFLOAD_GRE_TNL_TSO;
> +		DEV_TX_OFFLOAD_GRE_TNL_TSO |
> DEV_TX_OFFLOAD_UDP_TSO;
>  	/*
>  	 * Records which Mbuf pool to use by each logical core, if needed.
>  	 */
> --
> 2.7.4

./devtools/check-git-log.sh -1
Headline too long:
        app/testpmd: enable UDP GSO in the checksum forwarding engine

Should the dpdk/doc/guides/testpmd_ap_ug/testpmd_funcs.rst  file be updated?

Regards,

Bernard
  
Hu, Jiayu June 16, 2018, 9:14 a.m. UTC | #2
Hi Bernard,

> -----Original Message-----
> From: Iremonger, Bernard
> Sent: Thursday, June 14, 2018 10:44 PM
> To: Hu, Jiayu <jiayu.hu@intel.com>; dev@dpdk.org
> Cc: Ananyev, Konstantin <konstantin.ananyev@intel.com>; Hu, Jiayu
> <jiayu.hu@intel.com>
> Subject: RE: [dpdk-dev] [PATCH 2/3] app/testpmd: enable UDP GSO in the
> checksum forwarding engine
> 
> Hi Jiayu,
> 
> > -----Original Message-----
> > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Jiayu Hu
> > Sent: Tuesday, May 29, 2018 8:41 AM
> > To: dev@dpdk.org
> > Cc: Ananyev, Konstantin <konstantin.ananyev@intel.com>; Hu, Jiayu
> > <jiayu.hu@intel.com>
> > Subject: [dpdk-dev] [PATCH 2/3] app/testpmd: enable UDP GSO in the
> > checksum forwarding engine
> >
> > This patch enables GSO for UDP/IPv4 packets. Oversized UDP/IPv4
> packets
> > transmitted over a GSO-enabled port will undergo segmentation.
> >
> > Signed-off-by: Jiayu Hu <jiayu.hu@intel.com>
> > ---
> >  app/test-pmd/cmdline.c  | 5 +++--
> >  app/test-pmd/csumonly.c | 2 ++
> >  app/test-pmd/testpmd.c  | 2 +-
> >  3 files changed, 6 insertions(+), 3 deletions(-)
> >
> > diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c index
> > 27e2aa8..4239e91 100644
> > --- a/app/test-pmd/cmdline.c
> > +++ b/app/test-pmd/cmdline.c
> > @@ -4792,8 +4792,9 @@ cmd_gso_show_parsed(void *parsed_result,
> >  		if (gso_ports[res->cmd_pid].enable) {
> >  			printf("Max GSO'd packet size: %uB\n"
> >  					"Supported GSO types: TCP/IPv4, "
> > -					"VxLAN with inner TCP/IPv4 packet,
> "
> > -					"GRE with inner TCP/IPv4
> packet\n",
> > +					"UDP/IPv4, VxLAN with inner "
> > +					"TCP/IPv4 packet, GRE with inner "
> > +					"TCP/IPv4 packet\n",
> 
> This change is giving 3 checkpatch.pl warnings and should be refactored

The file test-pmd/cmdline.c uses the above coding style to split long strings,
so I think I need to keep this style. But when I use it, there are always some warnings.

> 
> 
> >  					gso_max_segment_size);
> >  		} else
> >  			printf("GSO is not enabled on Port %u\n", res-
> > >cmd_pid); diff --git a/app/test-pmd/csumonly.c b/app/test-
> > pmd/csumonly.c index 0bb88cf..4948292 100644
> > --- a/app/test-pmd/csumonly.c
> > +++ b/app/test-pmd/csumonly.c
> > @@ -411,6 +411,8 @@ process_inner_cksums(void *l3_hdr, const struct
> > testpmd_offload_info *info,
> >  						info->ethertype);
> >  			}
> >  		}
> > +		if (info->gso_enable)
> > +			ol_flags |= PKT_TX_UDP_SEG;
> >  	} else if (info->l4_proto == IPPROTO_TCP) {
> >  		tcp_hdr = (struct tcp_hdr *)((char *)l3_hdr + info->l3_len);
> >  		tcp_hdr->cksum = 0;
> > diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c index
> > 35cf266..b5766ff 100644
> > --- a/app/test-pmd/testpmd.c
> > +++ b/app/test-pmd/testpmd.c
> > @@ -777,7 +777,7 @@ init_config(void)
> >  	init_port_config();
> >
> >  	gso_types = DEV_TX_OFFLOAD_TCP_TSO |
> > DEV_TX_OFFLOAD_VXLAN_TNL_TSO |
> > -		DEV_TX_OFFLOAD_GRE_TNL_TSO;
> > +		DEV_TX_OFFLOAD_GRE_TNL_TSO |
> > DEV_TX_OFFLOAD_UDP_TSO;
> >  	/*
> >  	 * Records which Mbuf pool to use by each logical core, if needed.
> >  	 */
> > --
> > 2.7.4
> 
> ./devtools/check-git-log.sh -1
> Headline too long:
>         app/testpmd: enable UDP GSO in the checksum forwarding engine

Will change it in the next version.

> 
> Should the dpdk/doc/guides/testpmd_ap_ug/testpmd_funcs.rst  file be
> updated?

I will add some descriptions about UDP/IPv4 GSO usage guide in it.

Thanks,
Jiayu
> 
> Regards,
> 
> Bernard
>
  

Patch

diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
index 27e2aa8..4239e91 100644
--- a/app/test-pmd/cmdline.c
+++ b/app/test-pmd/cmdline.c
@@ -4792,8 +4792,9 @@  cmd_gso_show_parsed(void *parsed_result,
 		if (gso_ports[res->cmd_pid].enable) {
 			printf("Max GSO'd packet size: %uB\n"
 					"Supported GSO types: TCP/IPv4, "
-					"VxLAN with inner TCP/IPv4 packet, "
-					"GRE with inner TCP/IPv4  packet\n",
+					"UDP/IPv4, VxLAN with inner "
+					"TCP/IPv4 packet, GRE with inner "
+					"TCP/IPv4 packet\n",
 					gso_max_segment_size);
 		} else
 			printf("GSO is not enabled on Port %u\n", res->cmd_pid);
diff --git a/app/test-pmd/csumonly.c b/app/test-pmd/csumonly.c
index 0bb88cf..4948292 100644
--- a/app/test-pmd/csumonly.c
+++ b/app/test-pmd/csumonly.c
@@ -411,6 +411,8 @@  process_inner_cksums(void *l3_hdr, const struct testpmd_offload_info *info,
 						info->ethertype);
 			}
 		}
+		if (info->gso_enable)
+			ol_flags |= PKT_TX_UDP_SEG;
 	} else if (info->l4_proto == IPPROTO_TCP) {
 		tcp_hdr = (struct tcp_hdr *)((char *)l3_hdr + info->l3_len);
 		tcp_hdr->cksum = 0;
diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c
index 35cf266..b5766ff 100644
--- a/app/test-pmd/testpmd.c
+++ b/app/test-pmd/testpmd.c
@@ -777,7 +777,7 @@  init_config(void)
 	init_port_config();
 
 	gso_types = DEV_TX_OFFLOAD_TCP_TSO | DEV_TX_OFFLOAD_VXLAN_TNL_TSO |
-		DEV_TX_OFFLOAD_GRE_TNL_TSO;
+		DEV_TX_OFFLOAD_GRE_TNL_TSO | DEV_TX_OFFLOAD_UDP_TSO;
 	/*
 	 * Records which Mbuf pool to use by each logical core, if needed.
 	 */