Skip to content

[PATCH API-NEXT v4] api: ones complement metadata#242

Closed
psavol wants to merge 3 commits intoOpenDataPlane:api-nextfrom
psavol:next-checksum-metadata
Closed

[PATCH API-NEXT v4] api: ones complement metadata#242
psavol wants to merge 3 commits intoOpenDataPlane:api-nextfrom
psavol:next-checksum-metadata

Conversation

@psavol
Copy link
Collaborator

@psavol psavol commented Oct 20, 2017

Added packet metadata for ones complement sum over IP
payload in a packet. Some NICs calculate the sum
during packet input (at least for IP fragments) and
store the value into the packet descriptor. This offloads
L4 checksum calculation for IP fragments as SW does not
need sum all payload data, but just combine pre-calculated
sums from packet descriptors and remove extra header fields
from the sum.

@muvarov muvarov changed the title api: ones complement metadata [PATCH API-NEXT v1] api: ones complement metadata Oct 20, 2017
@Bill-Fischofer-Linaro
Copy link
Contributor

@psavol please rebase to avoid merge conflict.

@psavol psavol force-pushed the next-checksum-metadata branch from 9785c1d to e8159b4 Compare October 23, 2017 09:59
@muvarov muvarov changed the title [PATCH API-NEXT v1] api: ones complement metadata [PATCH API-NEXT v2] api: ones complement metadata Oct 23, 2017
@psavol psavol force-pushed the next-checksum-metadata branch from e8159b4 to 3732719 Compare October 26, 2017 11:11
@muvarov muvarov changed the title [PATCH API-NEXT v2] api: ones complement metadata [PATCH API-NEXT v3] api: ones complement metadata Oct 26, 2017
@lumag
Copy link

lumag commented Oct 26, 2017

@psavol it would be nice if you can provide an example code, how this API function will fit into packet reassembly example.

@psavol
Copy link
Collaborator Author

psavol commented Oct 27, 2017

From commit log: "This offloads L4 checksum
calculation for IP fragments as SW does not need sum
all payload data, but just combine pre-calculated
sums from packet descriptors and remove extra header fields
from the sum."

odp_packet_t frag[4];

uint32_t chksum = 0;

for (i = 0; i < 4; i++) {
  uint16_t sum;
  odp_packet_data_range_t range;

  sum =odp_packet_ones_comp(frag[i], &range);
  if (range.length == ip_payload_len)
     chksum += sum;
  else {
    // tune the sum according to offset/len, or when length == 0 calculate the sum in SW
   }
}

// fold the chksum, etc...

@muvarov
Copy link
Contributor

muvarov commented Nov 1, 2017

From: "Savolainen, Petri (Nokia - FI/Espoo)" 
 Ping.

> -----Original Message-----
> From: lng-odp [mailto:lng-odp-bounces@lists.linaro.org] On Behalf Of
> Github ODP bot
> Sent: Thursday, October 26, 2017 3:00 PM
> To: lng-odp@lists.linaro.org
> Subject: [lng-odp] [PATCH API-NEXT v3 0/3] api: ones complement metadata
> 
> Added packet metadata for ones complement sum over IP
> payload in a packet. Some NICs calculate the sum
> during packet input (at least for IP fragments) and
> store the value into the packet descriptor. This offloads
> L4 checksum calculation for IP fragments as SW does not
> need sum all payload data, but just combine pre-calculated
> sums from packet descriptors and remove extra header fields
> from the sum.
> 
> ----------------github------------------------
> /** Email created from pull request 242 (psavol:next-checksum-metadata)
>  ** https://github.com/Linaro/odp/pull/242
>  ** Patch: https://github.com/Linaro/odp/pull/242.patch
>  ** Base sha: 63d92eb289261d1534b5b9e1e04291faa5e45d30
>  ** Merge commit sha: 5c16247e4ce2735df80c66f11dd9c9708e8c905f
>  **/
> ----------------/github------------------------
> 
> ----------------checkpatch.pl------------------------
> total: 0 errors, 0 warnings, 0 checks, 26 lines checked
> 
> 
> to_send-p-000.patch has no obvious style problems and is ready for
> submission.
> total: 0 errors, 0 warnings, 0 checks, 14 lines checked
> 
> 
> to_send-p-001.patch has no obvious style problems and is ready for
> submission.
> total: 0 errors, 0 warnings, 0 checks, 55 lines checked
> 
> 
> to_send-p-002.patch has no obvious style problems and is ready for
> submission.
> ----------------/checkpatch.pl------------------------
 

@lumag
Copy link

lumag commented Nov 9, 2017

@muvarov @Bill-Fischofer-Linaro this was approved long ago. Can we get this in?

static bool wait_for_network;

/* Dummy global variable to avoid compiler optimizing out API calls */
uint64_t odp_valid_test_pktio_u64;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please rename it without odp_. And I would move it inside loop and make it volatile then declaring somewhere on the top.

Copy link
Collaborator Author

@psavol psavol Nov 9, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is "static volatile uint64_t test_pktio_dummy_u64" in v4

Petri Savolainen added 3 commits November 9, 2017 12:56
Added packet metadata for ones complement sum over
packet data. Some NICs calculate the sum during packet
input (at least for IP fragments) and store the value
into the packet descriptor. This offloads L4 checksum
calculation for IP fragments as SW does not need sum
all payload data, but just combine pre-calculated
sums from packet descriptors and remove extra header fields
from the sum.

Signed-off-by: Petri Savolainen <petri.savolainen@linaro.org>
Added dummy implementation of ones complement calls. Linux
generic implementation does not calculate the sum for all
incoming packets as it would be wasteful in SW. It's better
to wait until application asks it with odp_chksum_ones_comp16().
Later on, the sum could be stored into the packet header,
if we found a way to get it from the HW.

Signed-off-by: Petri Savolainen <petri.savolainen@linaro.org>
Call ones complement function. Actual validation of
correctness of the sum is to be done, when an implementation
exist which sets the sum on packet input.

Signed-off-by: Petri Savolainen <petri.savolainen@linaro.org>
@psavol psavol force-pushed the next-checksum-metadata branch from 3732719 to 83a39b8 Compare November 9, 2017 11:23
@muvarov muvarov changed the title [PATCH API-NEXT v3] api: ones complement metadata [PATCH API-NEXT v4] api: ones complement metadata Nov 9, 2017
@muvarov
Copy link
Contributor

muvarov commented Nov 10, 2017

Merged.

@muvarov muvarov closed this Nov 10, 2017
@psavol psavol deleted the next-checksum-metadata branch January 16, 2018 08:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants