+/**
+ * Adjust the maximum LRO massage size.
+ * LRO massage is contained in the MPRQ strides.
+ * While the LRO massage size cannot be bigger than 65280 according to the
+ * PRM, the strides which contain it may be bigger.
+ * Adjust the maximum LRO massage size to avoid the above option.
+ *
+ * @param dev
+ * Pointer to Ethernet device.
+ * @param strd_n
+ * Number of strides per WQE..
+ * @param strd_sz
+ * The stride size.
+ */
+static void
+mlx5_max_lro_msg_size_adjust(struct rte_eth_dev *dev, uint32_t strd_n,
+ uint32_t strd_sz)
+{
+ struct mlx5_priv *priv = dev->data->dev_private;
+ uint32_t max_buf_len = strd_sz * strd_n;
+
+ if (max_buf_len > (uint64_t)UINT16_MAX)
+ max_buf_len = RTE_ALIGN_FLOOR((uint32_t)UINT16_MAX, strd_sz);
+ max_buf_len /= 256;
+ max_buf_len = RTE_MIN(max_buf_len, (uint32_t)UINT8_MAX);
+ assert(max_buf_len);
+ if (priv->max_lro_msg_size)
+ priv->max_lro_msg_size =
+ RTE_MIN((uint32_t)priv->max_lro_msg_size, max_buf_len);
+ else
+ priv->max_lro_msg_size = max_buf_len;
+}
+