[v3,5/5] examples/l3fwd-power: support virtio/vhost

Message ID 20210924102309.231304-6-miao.li@intel.com (mailing list archive)
State Superseded, archived
Delegated to: Maxime Coquelin
Headers
Series Implement rte_power_monitor API in virtio/vhost PMD |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/iol-aarch64-compile-testing success Testing PASS
ci/iol-mellanox-Performance success Performance Testing PASS
ci/iol-intel-Performance fail Performance Testing issues
ci/iol-intel-Functional success Functional Testing PASS
ci/iol-x86_64-compile-testing success Testing PASS
ci/Intel-compilation success Compilation OK
ci/intel-Testing success Testing PASS

Commit Message

Li, Miao Sept. 24, 2021, 10:23 a.m. UTC
  In l3fwd-power, there is default port configuration which requires
RSS and IPV4/UDP/TCP checksum. Once device does not support these,
the l3fwd-power will exit and report an error.
This patch updates the port configuration based on device capabilities
after getting the device information to support devices like virtio
and vhost.

Signed-off-by: Miao Li <miao.li@intel.com>
---
 examples/l3fwd-power/main.c | 5 +++++
 1 file changed, 5 insertions(+)
  

Comments

Chenbo Xia Sept. 29, 2021, 6:53 a.m. UTC | #1
> -----Original Message-----
> From: Li, Miao <miao.li@intel.com>
> Sent: Friday, September 24, 2021 6:23 PM
> To: dev@dpdk.org
> Cc: Xia, Chenbo <chenbo.xia@intel.com>; maxime.coquelin@redhat.com; Li, Miao
> <miao.li@intel.com>
> Subject: [PATCH v3 5/5] examples/l3fwd-power: support virtio/vhost
> 
> In l3fwd-power, there is default port configuration which requires
> RSS and IPV4/UDP/TCP checksum. Once device does not support these,
> the l3fwd-power will exit and report an error.
> This patch updates the port configuration based on device capabilities
> after getting the device information to support devices like virtio
> and vhost.
> 
> Signed-off-by: Miao Li <miao.li@intel.com>
> ---
>  examples/l3fwd-power/main.c | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/examples/l3fwd-power/main.c b/examples/l3fwd-power/main.c
> index aa7b8db44a..14ae87a9d5 100644
> --- a/examples/l3fwd-power/main.c
> +++ b/examples/l3fwd-power/main.c
> @@ -2637,6 +2637,11 @@ main(int argc, char **argv)
>  				local_port_conf.rx_adv_conf.rss_conf.rss_hf);
>  		}
> 
> +		if (local_port_conf.rx_adv_conf.rss_conf.rss_hf == 0)
> +			local_port_conf.rxmode.mq_mode = ETH_MQ_RX_NONE;
> +		local_port_conf.rxmode.offloads &= dev_info.rx_offload_capa;
> +		port_conf.rxmode.offloads = local_port_conf.rxmode.offloads;
> +
>  		ret = rte_eth_dev_configure(portid, nb_rx_queue,
>  					(uint16_t)n_tx_queue, &local_port_conf);
>  		if (ret < 0)
> --
> 2.25.1

Just as David suggested, I think we'd better consider RFC 1812, if HW does not
support RX IP CKSUM offload, check IP CKSUM in is_valid_ipv4_pkt.

Thanks,
Chenbo
  
Li, Miao Oct. 11, 2021, 5:22 a.m. UTC | #2
Hi Chenbo,

> -----Original Message-----
> From: Xia, Chenbo <chenbo.xia@intel.com>
> Sent: Wednesday, September 29, 2021 2:53 PM
> To: Li, Miao <miao.li@intel.com>; dev@dpdk.org
> Cc: maxime.coquelin@redhat.com; david.marchand@redhat.com
> Subject: RE: [PATCH v3 5/5] examples/l3fwd-power: support virtio/vhost
> 
> > -----Original Message-----
> > From: Li, Miao <miao.li@intel.com>
> > Sent: Friday, September 24, 2021 6:23 PM
> > To: dev@dpdk.org
> > Cc: Xia, Chenbo <chenbo.xia@intel.com>; maxime.coquelin@redhat.com; Li,
> Miao
> > <miao.li@intel.com>
> > Subject: [PATCH v3 5/5] examples/l3fwd-power: support virtio/vhost
> >
> > In l3fwd-power, there is default port configuration which requires
> > RSS and IPV4/UDP/TCP checksum. Once device does not support these,
> > the l3fwd-power will exit and report an error.
> > This patch updates the port configuration based on device capabilities
> > after getting the device information to support devices like virtio
> > and vhost.
> >
> > Signed-off-by: Miao Li <miao.li@intel.com>
> > ---
> >  examples/l3fwd-power/main.c | 5 +++++
> >  1 file changed, 5 insertions(+)
> >
> > diff --git a/examples/l3fwd-power/main.c b/examples/l3fwd-power/main.c
> > index aa7b8db44a..14ae87a9d5 100644
> > --- a/examples/l3fwd-power/main.c
> > +++ b/examples/l3fwd-power/main.c
> > @@ -2637,6 +2637,11 @@ main(int argc, char **argv)
> >  				local_port_conf.rx_adv_conf.rss_conf.rss_hf);
> >  		}
> >
> > +		if (local_port_conf.rx_adv_conf.rss_conf.rss_hf == 0)
> > +			local_port_conf.rxmode.mq_mode =
> ETH_MQ_RX_NONE;
> > +		local_port_conf.rxmode.offloads &= dev_info.rx_offload_capa;
> > +		port_conf.rxmode.offloads = local_port_conf.rxmode.offloads;
> > +
> >  		ret = rte_eth_dev_configure(portid, nb_rx_queue,
> >  					(uint16_t)n_tx_queue,
> &local_port_conf);
> >  		if (ret < 0)
> > --
> > 2.25.1
> 
> Just as David suggested, I think we'd better consider RFC 1812, if HW does not
> support RX IP CKSUM offload, check IP CKSUM in is_valid_ipv4_pkt.

I will fix it in the next version.

Thanks,
Miao

> 
> Thanks,
> Chenbo
  

Patch

diff --git a/examples/l3fwd-power/main.c b/examples/l3fwd-power/main.c
index aa7b8db44a..14ae87a9d5 100644
--- a/examples/l3fwd-power/main.c
+++ b/examples/l3fwd-power/main.c
@@ -2637,6 +2637,11 @@  main(int argc, char **argv)
 				local_port_conf.rx_adv_conf.rss_conf.rss_hf);
 		}
 
+		if (local_port_conf.rx_adv_conf.rss_conf.rss_hf == 0)
+			local_port_conf.rxmode.mq_mode = ETH_MQ_RX_NONE;
+		local_port_conf.rxmode.offloads &= dev_info.rx_offload_capa;
+		port_conf.rxmode.offloads = local_port_conf.rxmode.offloads;
+
 		ret = rte_eth_dev_configure(portid, nb_rx_queue,
 					(uint16_t)n_tx_queue, &local_port_conf);
 		if (ret < 0)