Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[PATCH v7] api: pktio: lso: promise maximum payload size for custom proto #2157

Merged
merged 2 commits into from
Dec 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion include/odp/api/spec/packet_io_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -792,7 +792,11 @@ typedef enum odp_lso_protocol_t {
/** Protocol not selected. */
ODP_LSO_PROTO_NONE = 0,

/** Custom protocol. LSO performs only custom field updates to the packet headers. */
/** Custom protocol. LSO performs only custom field updates to the packet headers.
*
* All segments except the last one have exactly the maximum number of payload
* bytes as given by the max_payload_len parameter in odp_packet_lso_opt_t.
*/
ODP_LSO_PROTO_CUSTOM,

/** LSO performs IPv4 fragmentation.
Expand Down
7 changes: 4 additions & 3 deletions include/odp/api/spec/packet_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -407,9 +407,10 @@ typedef struct odp_packet_lso_opt_t {
/** Maximum payload length in an LSO segment
*
* Max_payload_len parameter defines the maximum number of payload bytes in each
* created segment. Depending on the implementation, segments with less payload may be
* created. However, this value is used typically to divide packet payload evenly over
* all segments except the last one, which contains the remaining payload bytes.
* created segment. Depending on the implementation and the LSO profile, segments
* with less payload may be created. However, this value is used typically to divide
* packet payload evenly over all segments except the last one, which contains the
* remaining payload bytes.
*/
uint32_t max_payload_len;

Expand Down
3 changes: 3 additions & 0 deletions test/validation/api/pktio/lso.c
Original file line number Diff line number Diff line change
Expand Up @@ -767,6 +767,7 @@ static void lso_test(odp_lso_profile_param_t param, uint32_t max_payload,
uint32_t offset, len, payload_len, payload_sum;
odp_packet_t pkt_out[MAX_NUM_SEG];
uint32_t sent_payload = pkt_len - hdr_len;
const int is_custom_proto = (param.lso_proto == ODP_LSO_PROTO_CUSTOM);

profile = odp_lso_profile_create(pktio_a->hdl, &param);
CU_ASSERT_FATAL(profile != ODP_LSO_PROFILE_INVALID);
Expand Down Expand Up @@ -821,6 +822,8 @@ static void lso_test(odp_lso_profile_param_t param, uint32_t max_payload,
}

CU_ASSERT(payload_len <= max_payload);
if (is_custom_proto && seg_num < num - 1)
CU_ASSERT(payload_len == max_payload);

if (compare_data(seg, hdr_len, test_packet + offset, payload_len) >= 0) {
ODPH_ERR(" Payload compare failed at offset %u\n", offset);
Expand Down