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

Message ID 20211018141638.5916-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-spell-check-testing warning Testing issues
ci/iol-broadcom-Functional success Functional Testing PASS
ci/github-robot: build success github build: passed
ci/iol-broadcom-Performance success Performance Testing PASS
ci/iol-intel-Functional success Functional Testing PASS
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-x86_64-unit-testing success Testing PASS
ci/iol-x86_64-compile-testing success Testing PASS
ci/iol-mellanox-Performance success Performance Testing PASS
ci/iol-aarch64-compile-testing success Testing PASS
ci/Intel-compilation success Compilation OK
ci/intel-Testing success Testing PASS

Commit Message

Li, Miao Oct. 18, 2021, 2:16 p.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 | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)
  

Comments

Chenbo Xia Oct. 19, 2021, 4:39 a.m. UTC | #1
> -----Original Message-----
> From: Li, Miao <miao.li@intel.com>
> Sent: Monday, October 18, 2021 10:17 PM
> To: dev@dpdk.org
> Cc: Xia, Chenbo <chenbo.xia@intel.com>; maxime.coquelin@redhat.com; Li, Miao
> <miao.li@intel.com>
> Subject: [PATCH v7 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 | 15 ++++++++++++++-
>  1 file changed, 14 insertions(+), 1 deletion(-)
> 
> diff --git a/examples/l3fwd-power/main.c b/examples/l3fwd-power/main.c
> index 73a3ab5bc0..5811908283 100644
> --- a/examples/l3fwd-power/main.c
> +++ b/examples/l3fwd-power/main.c
> @@ -505,7 +505,15 @@ is_valid_ipv4_pkt(struct rte_ipv4_hdr *pkt, uint32_t
> link_len)
>  		return -1;
> 
>  	/* 2. The IP checksum must be correct. */
> -	/* this is checked in H/W */
> +	/* if this is not checked in H/W, check it. */
> +	if ((port_conf.rxmode.offloads & DEV_RX_OFFLOAD_IPV4_CKSUM) == 0) {
> +		uint16_t actual_cksum, expected_cksum;
> +		actual_cksum = pkt->hdr_checksum;
> +		pkt->hdr_checksum = 0;
> +		expected_cksum = rte_ipv4_cksum(pkt);
> +		if (actual_cksum != expected_cksum)
> +			return -2;
> +	}
> 
>  	/*
>  	 * 3. The IP version number must be 4. If the version number is not 4
> @@ -2637,6 +2645,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

Reviewed-by: Chenbo Xia <chenbo.xia@intel.com>
  
Ferruh Yigit Oct. 21, 2021, 4:58 p.m. UTC | #2
On 10/18/2021 3:16 PM, Miao Li wrote:
> 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 | 15 ++++++++++++++-

'examples/l3fwd-power' maintainer ack is required.
  
Hunt, David Oct. 22, 2021, 11:50 a.m. UTC | #3
On 19/10/2021 5:39 AM, Xia, Chenbo wrote:
>> -----Original Message-----
>> From: Li, Miao <miao.li@intel.com>
>> Sent: Monday, October 18, 2021 10:17 PM
>> To: dev@dpdk.org
>> Cc: Xia, Chenbo <chenbo.xia@intel.com>; maxime.coquelin@redhat.com; Li, Miao
>> <miao.li@intel.com>
>> Subject: [PATCH v7 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 | 15 ++++++++++++++-
>>   1 file changed, 14 insertions(+), 1 deletion(-)
>>
>> diff --git a/examples/l3fwd-power/main.c b/examples/l3fwd-power/main.c
>> index 73a3ab5bc0..5811908283 100644
>> --- a/examples/l3fwd-power/main.c
>> +++ b/examples/l3fwd-power/main.c
>> @@ -505,7 +505,15 @@ is_valid_ipv4_pkt(struct rte_ipv4_hdr *pkt, uint32_t
>> link_len)
>>   		return -1;
>>
>>   	/* 2. The IP checksum must be correct. */
>> -	/* this is checked in H/W */
>> +	/* if this is not checked in H/W, check it. */
>> +	if ((port_conf.rxmode.offloads & DEV_RX_OFFLOAD_IPV4_CKSUM) == 0) {
>> +		uint16_t actual_cksum, expected_cksum;
>> +		actual_cksum = pkt->hdr_checksum;
>> +		pkt->hdr_checksum = 0;
>> +		expected_cksum = rte_ipv4_cksum(pkt);
>> +		if (actual_cksum != expected_cksum)
>> +			return -2;
>> +	}
>>
>>   	/*
>>   	 * 3. The IP version number must be 4. If the version number is not 4
>> @@ -2637,6 +2645,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
> Reviewed-by: Chenbo Xia <chenbo.xia@intel.com>


LGTM.

Acked-by: David Hunt <david.hunt@intel.com>
  

Patch

diff --git a/examples/l3fwd-power/main.c b/examples/l3fwd-power/main.c
index 73a3ab5bc0..5811908283 100644
--- a/examples/l3fwd-power/main.c
+++ b/examples/l3fwd-power/main.c
@@ -505,7 +505,15 @@  is_valid_ipv4_pkt(struct rte_ipv4_hdr *pkt, uint32_t link_len)
 		return -1;
 
 	/* 2. The IP checksum must be correct. */
-	/* this is checked in H/W */
+	/* if this is not checked in H/W, check it. */
+	if ((port_conf.rxmode.offloads & DEV_RX_OFFLOAD_IPV4_CKSUM) == 0) {
+		uint16_t actual_cksum, expected_cksum;
+		actual_cksum = pkt->hdr_checksum;
+		pkt->hdr_checksum = 0;
+		expected_cksum = rte_ipv4_cksum(pkt);
+		if (actual_cksum != expected_cksum)
+			return -2;
+	}
 
 	/*
 	 * 3. The IP version number must be 4. If the version number is not 4
@@ -2637,6 +2645,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)