aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--platform/linux-generic/include/odp_packet_io_internal.h6
-rw-r--r--platform/linux-generic/odp_packet_io.c8
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];