+
+ if (timestamp_enable) {
+ pkt_hdr_len += sizeof(struct tx_timestamp);
+
+ if (tx_pkt_split == TX_PKT_SPLIT_RND) {
+ if (tx_pkt_seg_lengths[0] < pkt_hdr_len) {
+ TESTPMD_LOG(ERR,
+ "Time stamp and random segment number are enabled, "
+ "but tx_pkt_seg_lengths[0] %u < %u (needed)\n",
+ tx_pkt_seg_lengths[0], pkt_hdr_len);
+ return -EINVAL;
+ }
+ } else {
+ uint16_t total = 0;
+ uint8_t i;
+
+ for (i = 0; i < tx_pkt_nb_segs; i++) {
+ total += tx_pkt_seg_lengths[i];
+ if (total >= pkt_hdr_len)
+ break;
+ }
+
+ if (total < pkt_hdr_len) {
+ TESTPMD_LOG(ERR,
+ "Not enough Tx segment space for time stamp info, "
+ "total %u < %u (needed)\n",
+ total, pkt_hdr_len);
+ return -EINVAL;
+ }
+ }
+ }
+