+uint16_t
+virtio_rx_mem_pool_buf_size(struct rte_mempool *mp)
+{
+ return rte_pktmbuf_data_room_size(mp) - RTE_PKTMBUF_HEADROOM;
+}
+
+bool
+virtio_rx_check_scatter(uint16_t max_rx_pkt_len, uint16_t rx_buf_size,
+ bool rx_scatter_enabled, const char **error)
+{
+ if (!rx_scatter_enabled && max_rx_pkt_len > rx_buf_size) {
+ *error = "Rx scatter is disabled and RxQ mbuf pool object size is too small";
+ return false;
+ }
+
+ return true;
+}
+
+static bool
+virtio_check_scatter_on_all_rx_queues(struct rte_eth_dev *dev,
+ uint16_t frame_size)
+{
+ struct virtio_hw *hw = dev->data->dev_private;
+ struct virtnet_rx *rxvq;
+ struct virtqueue *vq;
+ unsigned int qidx;
+ uint16_t buf_size;
+ const char *error;
+
+ if (hw->vqs == NULL)
+ return true;
+
+ for (qidx = 0; (vq = hw->vqs[2 * qidx + VTNET_SQ_RQ_QUEUE_IDX]) != NULL;
+ qidx++) {
+ rxvq = &vq->rxq;
+ if (rxvq->mpool == NULL)
+ continue;
+ buf_size = virtio_rx_mem_pool_buf_size(rxvq->mpool);
+
+ if (!virtio_rx_check_scatter(frame_size, buf_size,
+ hw->rx_ol_scatter, &error)) {
+ PMD_INIT_LOG(ERR, "MTU check for RxQ %u failed: %s",
+ qidx, error);
+ return false;
+ }
+ }
+
+ return true;
+}
+