diff options
author | Petri Savolainen <petri.savolainen@nokia.com> | 2021-04-07 15:10:38 +0300 |
---|---|---|
committer | Petri Savolainen <petri.savolainen@nokia.com> | 2021-04-08 14:04:19 +0300 |
commit | 19ec29b30b311558da1de4b1a6f28fc7d061ee2f (patch) | |
tree | 06cc428cb3cb028661bf5280bf0bc1b0a1510161 | |
parent | 16079c05ddc71bc15dc0bd3567a6a3a1f6cf117d (diff) |
linux-gen: pktio: update LSO capabilities
Increase max_segments capability to 64 segments. LSO implementation
does not have a limit, but is limited by number free packets
in the pool. Picked a large enough number that LSO capability
does not limit segmentation of a maximum size IP packet.
Increase max_payload_len capability to be closer to MTU. Subtract
min header size (only Ethernet header) from MTU, instead of the
maximum supported header size.
Signed-off-by: Petri Savolainen <petri.savolainen@nokia.com>
Reviewed-by: Janne Peltonen <janne.peltonen@nokia.com>
-rw-r--r-- | platform/linux-generic/include/odp_packet_io_internal.h | 6 | ||||
-rw-r--r-- | platform/linux-generic/odp_packet_io.c | 8 |
2 files changed, 12 insertions, 2 deletions
diff --git a/platform/linux-generic/include/odp_packet_io_internal.h b/platform/linux-generic/include/odp_packet_io_internal.h index 07b0b4b69..7bbd78ab0 100644 --- a/platform/linux-generic/include/odp_packet_io_internal.h +++ b/platform/linux-generic/include/odp_packet_io_internal.h @@ -39,8 +39,12 @@ extern "C" { #define PKTIO_MAX_QUEUES 64 #define PKTIO_LSO_PROFILES 16 +/* Assume at least Ethernet header per each segment */ +#define PKTIO_LSO_MIN_PAYLOAD_OFFSET 14 #define PKTIO_LSO_MAX_PAYLOAD_OFFSET 128 -#define PKTIO_LSO_MAX_SEGMENTS 8 +/* Allow 64 kB packet to be split into about 1kB segments */ +#define PKTIO_LSO_MAX_SEGMENTS 64 + ODP_STATIC_ASSERT(PKTIO_LSO_PROFILES < UINT8_MAX, "PKTIO_LSO_PROFILES_ERROR"); #define PKTIO_NAME_LEN 256 diff --git a/platform/linux-generic/odp_packet_io.c b/platform/linux-generic/odp_packet_io.c index e9e105350..ff8be0a08 100644 --- a/platform/linux-generic/odp_packet_io.c +++ b/platform/linux-generic/odp_packet_io.c @@ -1812,7 +1812,7 @@ int odp_pktio_capability(odp_pktio_t pktio, odp_pktio_capability_t *capa) capa->lso.max_profiles_per_pktio = PKTIO_LSO_PROFILES; capa->lso.max_packet_segments = PKT_MAX_SEGS; capa->lso.max_segments = PKTIO_LSO_MAX_SEGMENTS; - capa->lso.max_payload_len = mtu - PKTIO_LSO_MAX_PAYLOAD_OFFSET; + capa->lso.max_payload_len = mtu - PKTIO_LSO_MIN_PAYLOAD_OFFSET; capa->lso.max_payload_offset = PKTIO_LSO_MAX_PAYLOAD_OFFSET; capa->lso.max_num_custom = ODP_LSO_MAX_CUSTOM; capa->lso.proto.ipv4 = 1; @@ -2833,6 +2833,12 @@ static int pktout_send_lso(odp_pktout_queue_t queue, odp_packet_t packet, num_pkt++; } + if (num_pkt > PKTIO_LSO_MAX_SEGMENTS) { + ODP_ERR("Too many LSO segments %i. Maximum is %i\n", num_pkt, + PKTIO_LSO_MAX_SEGMENTS); + return -1; + } + /* Alloc packets */ odp_packet_t pkt_out[num_pkt]; |