diff mbox

Fwd: [PATCH v1] validation: classification: fix incorrect ipv4 checksum update

Message ID 54E48D72.1080208@linaro.org
State New
Headers show

Commit Message

Balasubramanian Manoharan Feb. 18, 2015, 1:02 p.m. UTC
Ping


-------- Forwarded Message --------
Subject: 	[PATCH v1] validation: classification: fix incorrect ipv4 
checksum update
Date: 	Fri, 13 Feb 2015 15:31:56 +0800
From: 	bala.manoharan@linaro.org
To: 	lng-odp@lists.linaro.org
CC: 	Balasubramanian Manoharan <bala.manoharan@linaro.org>



From: Balasubramanian Manoharan <bala.manoharan@linaro.org>

Fixes an issue where ipv4 checksum field was not updated after modifying the src
addr of the packet.

Signed-off-by: Balasubramanian Manoharan <bala.manoharan@linaro.org>
---
  test/validation/classification/odp_classification_tests.c | 10 +++++++++-
  1 file changed, 9 insertions(+), 1 deletion(-)

Comments

Mike Holmes Feb. 18, 2015, 1:46 p.m. UTC | #1
Bala does this fix a specific bug in bugzilla ?

Is there a unit test that I can run to see this fixes the issue ?

On 18 February 2015 at 08:02, Balasubramanian Manoharan <
bala.manoharan@linaro.org> wrote:

>  Ping
>
>
> -------- Forwarded Message --------  Subject: [PATCH v1] validation:
> classification: fix incorrect ipv4 checksum update  Date: Fri, 13 Feb
> 2015 15:31:56 +0800  From: bala.manoharan@linaro.org  To:
> lng-odp@lists.linaro.org  CC: Balasubramanian Manoharan
> <bala.manoharan@linaro.org> <bala.manoharan@linaro.org>
>
>
> From: Balasubramanian Manoharan <bala.manoharan@linaro.org> <bala.manoharan@linaro.org>
>
> Fixes an issue where ipv4 checksum field was not updated after modifying the src
> addr of the packet.
>
> Signed-off-by: Balasubramanian Manoharan <bala.manoharan@linaro.org> <bala.manoharan@linaro.org>
> ---
>  test/validation/classification/odp_classification_tests.c | 10 +++++++++-
>  1 file changed, 9 insertions(+), 1 deletion(-)
>
> diff --git a/test/validation/classification/odp_classification_tests.c b/test/validation/classification/odp_classification_tests.c
> index 45822d3..a47ad1f 100644
> --- a/test/validation/classification/odp_classification_tests.c
> +++ b/test/validation/classification/odp_classification_tests.c
> @@ -221,7 +221,7 @@ odp_packet_t create_packet(bool vlan)
>  	seqno = odp_atomic_fetch_inc_u32(&seq);
>  	ip->id = odp_cpu_to_be_16(seqno);
>  	ip->chksum = 0;
> -	odph_ipv4_csum_update(pkt);
> +	ip->chksum = odp_cpu_to_be_16(odph_ipv4_csum_update(pkt));
>  	offset += ODPH_IPV4HDR_LEN;
>
>  	/* udp */
> @@ -403,6 +403,9 @@ void test_cls_pmr_chain(void)
>  	ip = (odph_ipv4hdr_t *)odp_packet_l3_ptr(pkt, NULL);
>  	parse_ipv4_string(CLS_PMR_CHAIN_SADDR, &addr, &mask);
>  	ip->src_addr = odp_cpu_to_be_32(addr);
> +	ip->chksum = 0;
> +	ip->chksum = odp_cpu_to_be_16(odph_ipv4_csum_update(pkt));
> +
>  	udp = (odph_udphdr_t *)odp_packet_l4_ptr(pkt, NULL);
>  	udp->src_port = odp_cpu_to_be_16(CLS_PMR_CHAIN_SPORT);
>
> @@ -418,6 +421,8 @@ void test_cls_pmr_chain(void)
>  	ip = (odph_ipv4hdr_t *)odp_packet_l3_ptr(pkt, NULL);
>  	parse_ipv4_string(CLS_PMR_CHAIN_SADDR, &addr, &mask);
>  	ip->src_addr = odp_cpu_to_be_32(addr);
> +	ip->chksum = 0;
> +	ip->chksum = odp_cpu_to_be_16(odph_ipv4_csum_update(pkt));
>
>  	enqueue_loop_interface(pkt);
>  	pkt = receive_packet(&queue, ODP_TIME_SEC);
> @@ -728,6 +733,9 @@ void test_pktio_pmr_match_set_cos(void)
>  	ip = (odph_ipv4hdr_t *)odp_packet_l3_ptr(pkt, NULL);
>  	parse_ipv4_string(CLS_PMR_SET_SADDR, &addr, &mask);
>  	ip->src_addr = odp_cpu_to_be_32(addr);
> +	ip->chksum = 0;
> +	ip->chksum = odp_cpu_to_be_16(odph_ipv4_csum_update(pkt));
> +
>  	udp = (odph_udphdr_t *)odp_packet_l4_ptr(pkt, NULL);
>  	udp->src_port = odp_cpu_to_be_16(CLS_PMR_SET_SPORT);
>  	enqueue_loop_interface(pkt);
> --
> 2.0.1.472.g6f92e5f
>
>
>
>
>
> _______________________________________________
> lng-odp mailing list
> lng-odp@lists.linaro.org
> http://lists.linaro.org/mailman/listinfo/lng-odp
>
>
Balasubramanian Manoharan Feb. 18, 2015, 2:07 p.m. UTC | #2
On 18/02/15 7:16 pm, Mike Holmes wrote:
> Bala does this fix a specific bug in bugzilla ?
>
> Is there a unit test that I can run to see this fixes the issue ?
This patch fixes the following Bug:
Bug 1231 <https://bugs.linaro.org/show_bug.cgi?id=1231>-Classification 
Validation: Incorrect ipv4 checksum update.

>
> On 18 February 2015 at 08:02, Balasubramanian Manoharan 
> <bala.manoharan@linaro.org <mailto:bala.manoharan@linaro.org>> wrote:
>
>     Ping
>
>
>     -------- Forwarded Message --------
>     Subject: 	[PATCH v1] validation: classification: fix incorrect
>     ipv4 checksum update
>     Date: 	Fri, 13 Feb 2015 15:31:56 +0800
>     From: 	bala.manoharan@linaro.org <mailto:bala.manoharan@linaro.org>
>     To: 	lng-odp@lists.linaro.org <mailto:lng-odp@lists.linaro.org>
>     CC: 	Balasubramanian Manoharan <bala.manoharan@linaro.org>
>     <mailto:bala.manoharan@linaro.org>
>
>
>
>     From: Balasubramanian Manoharan<bala.manoharan@linaro.org>  <mailto:bala.manoharan@linaro.org>
>
>     Fixes an issue where ipv4 checksum field was not updated after modifying the src
>     addr of the packet.
>
>     Signed-off-by: Balasubramanian Manoharan<bala.manoharan@linaro.org>  <mailto:bala.manoharan@linaro.org>
>     ---
>       test/validation/classification/odp_classification_tests.c | 10 +++++++++-
>       1 file changed, 9 insertions(+), 1 deletion(-)
>
>     diff --git a/test/validation/classification/odp_classification_tests.c b/test/validation/classification/odp_classification_tests.c
>     index 45822d3..a47ad1f 100644
>     --- a/test/validation/classification/odp_classification_tests.c
>     +++ b/test/validation/classification/odp_classification_tests.c
>     @@ -221,7 +221,7 @@ odp_packet_t create_packet(bool vlan)
>       	seqno = odp_atomic_fetch_inc_u32(&seq);
>       	ip->id = odp_cpu_to_be_16(seqno);
>       	ip->chksum = 0;
>     -	odph_ipv4_csum_update(pkt);
>     +	ip->chksum = odp_cpu_to_be_16(odph_ipv4_csum_update(pkt));
>       	offset += ODPH_IPV4HDR_LEN;
>       
>       	/* udp */
>     @@ -403,6 +403,9 @@ void test_cls_pmr_chain(void)
>       	ip = (odph_ipv4hdr_t *)odp_packet_l3_ptr(pkt, NULL);
>       	parse_ipv4_string(CLS_PMR_CHAIN_SADDR, &addr, &mask);
>       	ip->src_addr = odp_cpu_to_be_32(addr);
>     +	ip->chksum = 0;
>     +	ip->chksum = odp_cpu_to_be_16(odph_ipv4_csum_update(pkt));
>     +
>       	udp = (odph_udphdr_t *)odp_packet_l4_ptr(pkt, NULL);
>       	udp->src_port = odp_cpu_to_be_16(CLS_PMR_CHAIN_SPORT);
>       
>     @@ -418,6 +421,8 @@ void test_cls_pmr_chain(void)
>       	ip = (odph_ipv4hdr_t *)odp_packet_l3_ptr(pkt, NULL);
>       	parse_ipv4_string(CLS_PMR_CHAIN_SADDR, &addr, &mask);
>       	ip->src_addr = odp_cpu_to_be_32(addr);
>     +	ip->chksum = 0;
>     +	ip->chksum = odp_cpu_to_be_16(odph_ipv4_csum_update(pkt));
>       
>       	enqueue_loop_interface(pkt);
>       	pkt = receive_packet(&queue, ODP_TIME_SEC);
>     @@ -728,6 +733,9 @@ void test_pktio_pmr_match_set_cos(void)
>       	ip = (odph_ipv4hdr_t *)odp_packet_l3_ptr(pkt, NULL);
>       	parse_ipv4_string(CLS_PMR_SET_SADDR, &addr, &mask);
>       	ip->src_addr = odp_cpu_to_be_32(addr);
>     +	ip->chksum = 0;
>     +	ip->chksum = odp_cpu_to_be_16(odph_ipv4_csum_update(pkt));
>     +
>       	udp = (odph_udphdr_t *)odp_packet_l4_ptr(pkt, NULL);
>       	udp->src_port = odp_cpu_to_be_16(CLS_PMR_SET_SPORT);
>       	enqueue_loop_interface(pkt);
>     -- 
>     2.0.1.472.g6f92e5f
>
>
>
>
>     _______________________________________________
>     lng-odp mailing list
>     lng-odp@lists.linaro.org <mailto:lng-odp@lists.linaro.org>
>     http://lists.linaro.org/mailman/listinfo/lng-odp
>
>
>
>
> -- 
> *Mike Holmes*
> Linaro  Sr Technical Manager
> LNG - ODP
Mike Holmes Feb. 18, 2015, 2:09 p.m. UTC | #3
Thanks, can you put the URL to the bug in the body of the patch

https://bugs.linaro.org/show_bug.cgi?id=1231



On 18 February 2015 at 09:07, Balasubramanian Manoharan <
bala.manoharan@linaro.org> wrote:

>
> On 18/02/15 7:16 pm, Mike Holmes wrote:
>
> Bala does this fix a specific bug in bugzilla ?
>
>  Is there a unit test that I can run to see this fixes the issue ?
>
> This patch fixes the following Bug:
> Bug 1231 <https://bugs.linaro.org/show_bug.cgi?id=1231> - Classification
> Validation: Incorrect ipv4 checksum update.
>
>
> On 18 February 2015 at 08:02, Balasubramanian Manoharan <
> bala.manoharan@linaro.org> wrote:
>
>>  Ping
>>
>>
>> -------- Forwarded Message --------  Subject: [PATCH v1] validation:
>> classification: fix incorrect ipv4 checksum update  Date: Fri, 13 Feb
>> 2015 15:31:56 +0800  From: bala.manoharan@linaro.org  To:
>> lng-odp@lists.linaro.org  CC: Balasubramanian Manoharan
>> <bala.manoharan@linaro.org> <bala.manoharan@linaro.org>
>>
>>
>> From: Balasubramanian Manoharan <bala.manoharan@linaro.org> <bala.manoharan@linaro.org>
>>
>> Fixes an issue where ipv4 checksum field was not updated after modifying the src
>> addr of the packet.
>>
>> Signed-off-by: Balasubramanian Manoharan <bala.manoharan@linaro.org> <bala.manoharan@linaro.org>
>> ---
>>  test/validation/classification/odp_classification_tests.c | 10 +++++++++-
>>  1 file changed, 9 insertions(+), 1 deletion(-)
>>
>> diff --git a/test/validation/classification/odp_classification_tests.c b/test/validation/classification/odp_classification_tests.c
>> index 45822d3..a47ad1f 100644
>> --- a/test/validation/classification/odp_classification_tests.c
>> +++ b/test/validation/classification/odp_classification_tests.c
>> @@ -221,7 +221,7 @@ odp_packet_t create_packet(bool vlan)
>>  	seqno = odp_atomic_fetch_inc_u32(&seq);
>>  	ip->id = odp_cpu_to_be_16(seqno);
>>  	ip->chksum = 0;
>> -	odph_ipv4_csum_update(pkt);
>> +	ip->chksum = odp_cpu_to_be_16(odph_ipv4_csum_update(pkt));
>>  	offset += ODPH_IPV4HDR_LEN;
>>
>>  	/* udp */
>> @@ -403,6 +403,9 @@ void test_cls_pmr_chain(void)
>>  	ip = (odph_ipv4hdr_t *)odp_packet_l3_ptr(pkt, NULL);
>>  	parse_ipv4_string(CLS_PMR_CHAIN_SADDR, &addr, &mask);
>>  	ip->src_addr = odp_cpu_to_be_32(addr);
>> +	ip->chksum = 0;
>> +	ip->chksum = odp_cpu_to_be_16(odph_ipv4_csum_update(pkt));
>> +
>>  	udp = (odph_udphdr_t *)odp_packet_l4_ptr(pkt, NULL);
>>  	udp->src_port = odp_cpu_to_be_16(CLS_PMR_CHAIN_SPORT);
>>
>> @@ -418,6 +421,8 @@ void test_cls_pmr_chain(void)
>>  	ip = (odph_ipv4hdr_t *)odp_packet_l3_ptr(pkt, NULL);
>>  	parse_ipv4_string(CLS_PMR_CHAIN_SADDR, &addr, &mask);
>>  	ip->src_addr = odp_cpu_to_be_32(addr);
>> +	ip->chksum = 0;
>> +	ip->chksum = odp_cpu_to_be_16(odph_ipv4_csum_update(pkt));
>>
>>  	enqueue_loop_interface(pkt);
>>  	pkt = receive_packet(&queue, ODP_TIME_SEC);
>> @@ -728,6 +733,9 @@ void test_pktio_pmr_match_set_cos(void)
>>  	ip = (odph_ipv4hdr_t *)odp_packet_l3_ptr(pkt, NULL);
>>  	parse_ipv4_string(CLS_PMR_SET_SADDR, &addr, &mask);
>>  	ip->src_addr = odp_cpu_to_be_32(addr);
>> +	ip->chksum = 0;
>> +	ip->chksum = odp_cpu_to_be_16(odph_ipv4_csum_update(pkt));
>> +
>>  	udp = (odph_udphdr_t *)odp_packet_l4_ptr(pkt, NULL);
>>  	udp->src_port = odp_cpu_to_be_16(CLS_PMR_SET_SPORT);
>>  	enqueue_loop_interface(pkt);
>> --
>> 2.0.1.472.g6f92e5f
>>
>>
>>
>>
>>
>> _______________________________________________
>> lng-odp mailing list
>> lng-odp@lists.linaro.org
>> http://lists.linaro.org/mailman/listinfo/lng-odp
>>
>>
>
>
>  --
>  *Mike Holmes*
> Linaro  Sr Technical Manager
> LNG - ODP
>
>
>
Balasubramanian Manoharan Feb. 18, 2015, 2:10 p.m. UTC | #4
On 18/02/15 7:39 pm, Mike Holmes wrote:
> Thanks, can you put the URL to the bug in the body of the patch
>
> https://bugs.linaro.org/show_bug.cgi?id=1231
>
Sure. Will update the same in the next version.
>
>
> On 18 February 2015 at 09:07, Balasubramanian Manoharan 
> <bala.manoharan@linaro.org <mailto:bala.manoharan@linaro.org>> wrote:
>
>
>     On 18/02/15 7:16 pm, Mike Holmes wrote:
>>     Bala does this fix a specific bug in bugzilla ?
>>
>>     Is there a unit test that I can run to see this fixes the issue ?
>     This patch fixes the following Bug:
>     Bug 1231
>     <https://bugs.linaro.org/show_bug.cgi?id=1231>-Classification
>     Validation: Incorrect ipv4 checksum update.
>
>>
>>     On 18 February 2015 at 08:02, Balasubramanian Manoharan
>>     <bala.manoharan@linaro.org <mailto:bala.manoharan@linaro.org>> wrote:
>>
>>         Ping
>>
>>
>>         -------- Forwarded Message --------
>>         Subject: 	[PATCH v1] validation: classification: fix
>>         incorrect ipv4 checksum update
>>         Date: 	Fri, 13 Feb 2015 15:31:56 +0800
>>         From: 	bala.manoharan@linaro.org
>>         <mailto:bala.manoharan@linaro.org>
>>         To: 	lng-odp@lists.linaro.org <mailto:lng-odp@lists.linaro.org>
>>         CC: 	Balasubramanian Manoharan <bala.manoharan@linaro.org>
>>         <mailto:bala.manoharan@linaro.org>
>>
>>
>>
>>         From: Balasubramanian Manoharan<bala.manoharan@linaro.org>  <mailto:bala.manoharan@linaro.org>
>>
>>         Fixes an issue where ipv4 checksum field was not updated after modifying the src
>>         addr of the packet.
>>
>>         Signed-off-by: Balasubramanian Manoharan<bala.manoharan@linaro.org>  <mailto:bala.manoharan@linaro.org>
>>         ---
>>           test/validation/classification/odp_classification_tests.c | 10 +++++++++-
>>           1 file changed, 9 insertions(+), 1 deletion(-)
>>
>>         diff --git a/test/validation/classification/odp_classification_tests.c b/test/validation/classification/odp_classification_tests.c
>>         index 45822d3..a47ad1f 100644
>>         --- a/test/validation/classification/odp_classification_tests.c
>>         +++ b/test/validation/classification/odp_classification_tests.c
>>         @@ -221,7 +221,7 @@ odp_packet_t create_packet(bool vlan)
>>           	seqno = odp_atomic_fetch_inc_u32(&seq);
>>           	ip->id = odp_cpu_to_be_16(seqno);
>>           	ip->chksum = 0;
>>         -	odph_ipv4_csum_update(pkt);
>>         +	ip->chksum = odp_cpu_to_be_16(odph_ipv4_csum_update(pkt));
>>           	offset += ODPH_IPV4HDR_LEN;
>>           
>>           	/* udp */
>>         @@ -403,6 +403,9 @@ void test_cls_pmr_chain(void)
>>           	ip = (odph_ipv4hdr_t *)odp_packet_l3_ptr(pkt, NULL);
>>           	parse_ipv4_string(CLS_PMR_CHAIN_SADDR, &addr, &mask);
>>           	ip->src_addr = odp_cpu_to_be_32(addr);
>>         +	ip->chksum = 0;
>>         +	ip->chksum = odp_cpu_to_be_16(odph_ipv4_csum_update(pkt));
>>         +
>>           	udp = (odph_udphdr_t *)odp_packet_l4_ptr(pkt, NULL);
>>           	udp->src_port = odp_cpu_to_be_16(CLS_PMR_CHAIN_SPORT);
>>           
>>         @@ -418,6 +421,8 @@ void test_cls_pmr_chain(void)
>>           	ip = (odph_ipv4hdr_t *)odp_packet_l3_ptr(pkt, NULL);
>>           	parse_ipv4_string(CLS_PMR_CHAIN_SADDR, &addr, &mask);
>>           	ip->src_addr = odp_cpu_to_be_32(addr);
>>         +	ip->chksum = 0;
>>         +	ip->chksum = odp_cpu_to_be_16(odph_ipv4_csum_update(pkt));
>>           
>>           	enqueue_loop_interface(pkt);
>>           	pkt = receive_packet(&queue, ODP_TIME_SEC);
>>         @@ -728,6 +733,9 @@ void test_pktio_pmr_match_set_cos(void)
>>           	ip = (odph_ipv4hdr_t *)odp_packet_l3_ptr(pkt, NULL);
>>           	parse_ipv4_string(CLS_PMR_SET_SADDR, &addr, &mask);
>>           	ip->src_addr = odp_cpu_to_be_32(addr);
>>         +	ip->chksum = 0;
>>         +	ip->chksum = odp_cpu_to_be_16(odph_ipv4_csum_update(pkt));
>>         +
>>           	udp = (odph_udphdr_t *)odp_packet_l4_ptr(pkt, NULL);
>>           	udp->src_port = odp_cpu_to_be_16(CLS_PMR_SET_SPORT);
>>           	enqueue_loop_interface(pkt);
>>         -- 
>>         2.0.1.472.g6f92e5f
>>
>>
>>
>>
>>         _______________________________________________
>>         lng-odp mailing list
>>         lng-odp@lists.linaro.org <mailto:lng-odp@lists.linaro.org>
>>         http://lists.linaro.org/mailman/listinfo/lng-odp
>>
>>
>>
>>
>>     -- 
>>     *Mike Holmes*
>>     Linaro  Sr Technical Manager
>>     LNG - ODP
>
>
>
>
> -- 
> *Mike Holmes*
> Linaro  Sr Technical Manager
> LNG - ODP
diff mbox

Patch

diff --git a/test/validation/classification/odp_classification_tests.c b/test/validation/classification/odp_classification_tests.c
index 45822d3..a47ad1f 100644
--- a/test/validation/classification/odp_classification_tests.c
+++ b/test/validation/classification/odp_classification_tests.c
@@ -221,7 +221,7 @@  odp_packet_t create_packet(bool vlan)
  	seqno = odp_atomic_fetch_inc_u32(&seq);
  	ip->id = odp_cpu_to_be_16(seqno);
  	ip->chksum = 0;
-	odph_ipv4_csum_update(pkt);
+	ip->chksum = odp_cpu_to_be_16(odph_ipv4_csum_update(pkt));
  	offset += ODPH_IPV4HDR_LEN;
  
  	/* udp */
@@ -403,6 +403,9 @@  void test_cls_pmr_chain(void)
  	ip = (odph_ipv4hdr_t *)odp_packet_l3_ptr(pkt, NULL);
  	parse_ipv4_string(CLS_PMR_CHAIN_SADDR, &addr, &mask);
  	ip->src_addr = odp_cpu_to_be_32(addr);
+	ip->chksum = 0;
+	ip->chksum = odp_cpu_to_be_16(odph_ipv4_csum_update(pkt));
+
  	udp = (odph_udphdr_t *)odp_packet_l4_ptr(pkt, NULL);
  	udp->src_port = odp_cpu_to_be_16(CLS_PMR_CHAIN_SPORT);
  
@@ -418,6 +421,8 @@  void test_cls_pmr_chain(void)
  	ip = (odph_ipv4hdr_t *)odp_packet_l3_ptr(pkt, NULL);
  	parse_ipv4_string(CLS_PMR_CHAIN_SADDR, &addr, &mask);
  	ip->src_addr = odp_cpu_to_be_32(addr);
+	ip->chksum = 0;
+	ip->chksum = odp_cpu_to_be_16(odph_ipv4_csum_update(pkt));
  
  	enqueue_loop_interface(pkt);
  	pkt = receive_packet(&queue, ODP_TIME_SEC);
@@ -728,6 +733,9 @@  void test_pktio_pmr_match_set_cos(void)
  	ip = (odph_ipv4hdr_t *)odp_packet_l3_ptr(pkt, NULL);
  	parse_ipv4_string(CLS_PMR_SET_SADDR, &addr, &mask);
  	ip->src_addr = odp_cpu_to_be_32(addr);
+	ip->chksum = 0;
+	ip->chksum = odp_cpu_to_be_16(odph_ipv4_csum_update(pkt));
+
  	udp = (odph_udphdr_t *)odp_packet_l4_ptr(pkt, NULL);
  	udp->src_port = odp_cpu_to_be_16(CLS_PMR_SET_SPORT);
  	enqueue_loop_interface(pkt);