src/dpdk/drivers/net/mlx4/mlx4_rxtx.c
static inline int
mlx4_tx_burst_tso_get_params(struct rte_mbuf *buf,
			     struct txq *txq,
			     struct tso_info *tinfo)
{
	struct mlx4_sq *sq = &txq->msq;
	const uint8_t tunneled = txq->priv->hw_csum_l2tun &&
				 (buf->ol_flags & PKT_TX_TUNNEL_MASK);

	tinfo->tso_header_size = buf->l2_len + buf->l3_len + buf->l4_len;
	if (tunneled)
		tinfo->tso_header_size +=
				buf->outer_l2_len + buf->outer_l3_len;
	if (unlikely(buf->tso_segsz == 0 ||
		     tinfo->tso_header_size == 0 ||
		     tinfo->tso_header_size > MLX4_MAX_TSO_HEADER ||
		     tinfo->tso_header_size > buf->data_len))
		return -EINVAL;
	/*
	 * Calculate the WQE TSO segment size
	 * Note:
	 * 1. An LSO segment must be padded such that the subsequent data
	 *    segment is 16-byte aligned.
	 * 2. The start address of the TSO segment is always 16 Bytes aligned.
	 */
	tinfo->wqe_tso_seg_size = RTE_ALIGN(sizeof(struct mlx4_wqe_lso_seg) +
					    tinfo->tso_header_size,
					    sizeof(struct mlx4_wqe_data_seg));
	tinfo->fence_size = ((sizeof(struct mlx4_wqe_ctrl_seg) +
			     tinfo->wqe_tso_seg_size) >> MLX4_SEG_SHIFT) +
			     buf->nb_segs;
	tinfo->wqe_size =
		RTE_ALIGN((uint32_t)(tinfo->fence_size << MLX4_SEG_SHIFT),
			  MLX4_TXBB_SIZE);
	/* Validate WQE size and WQE space in the send queue. */
	if (sq->remain_size < tinfo->wqe_size ||
	    tinfo->wqe_size > MLX4_MAX_WQE_SIZE)
		return -ENOMEM;
	/* Init pv. */
	tinfo->pv = (struct pv *)txq->bounce_buf;
	tinfo->pv_counter = 0;
	return 0;
}
/**
 * Obtain and calculate TSO information needed for assembling a TSO WQE.
 *
 * @param buf
 *   Pointer to the first packet mbuf.
 * @param txq
 *   Pointer to Tx queue structure.
 * @param tinfo
 *   Pointer to a structure to fill the info with.
 *
 * @return
 *   0 on success, negative value upon error.
 */
Obtain and calculate TSO information needed for assembling a TSO WQE.
@param buf
Pointer to the first packet mbuf.
@param txq
Pointer to Tx queue structure.
@param tinfo
Pointer to a structure to fill the info with.

@return
0 on success, negative value upon error.
Obtain and calculate TSO information needed for assembling a TSO WQE . @param buf Pointer to the first packet mbuf . @param txq Pointer to Tx queue structure . @param tinfo Pointer to a structure to fill the info with . @return 0 on success negative value upon error .
static inline int
mlx4_tx_burst_tso_get_params(struct rte_mbuf *buf,
			     struct txq *txq,
			     struct tso_info *tinfo)
{
	struct mlx4_sq *sq = &txq->msq;
	const uint8_t tunneled = txq->priv->hw_csum_l2tun &&
				 (buf->ol_flags & PKT_TX_TUNNEL_MASK);
	tinfo->tso_header_size = buf->l2_len + buf->l3_len + buf->l4_len;
	if (tunneled)
		tinfo->tso_header_size +=
				buf->outer_l2_len + buf->outer_l3_len;
	if (unlikely(buf->tso_segsz == 0 ||
		     tinfo->tso_header_size == 0 ||
		     tinfo->tso_header_size > MLX4_MAX_TSO_HEADER ||
		     tinfo->tso_header_size > buf->data_len))
		return -EINVAL;
	tinfo->wqe_tso_seg_size = RTE_ALIGN(sizeof(struct mlx4_wqe_lso_seg) +
					    tinfo->tso_header_size,
					    sizeof(struct mlx4_wqe_data_seg));
	tinfo->fence_size = ((sizeof(struct mlx4_wqe_ctrl_seg) +
			     tinfo->wqe_tso_seg_size) >> MLX4_SEG_SHIFT) +
			     buf->nb_segs;
	tinfo->wqe_size =
		RTE_ALIGN((uint32_t)(tinfo->fence_size << MLX4_SEG_SHIFT),
			  MLX4_TXBB_SIZE);
	if (sq->remain_size < tinfo->wqe_size ||
	    tinfo->wqe_size > MLX4_MAX_WQE_SIZE)
		return -ENOMEM;
	tinfo->pv = (struct pv *)txq->bounce_buf;
	tinfo->pv_counter = 0;
	return 0;
}
static inline int mlx4_tx_burst_tso_get_params ( struct rte_mbuf * buf , struct txq * txq , struct tso_info * tinfo ) { struct mlx4_sq * sq = & txq -> msq ; const uint8_t tunneled = txq -> priv -> hw_csum_l2tun && ( buf -> ol_flags & PKT_TX_TUNNEL_MASK ) ; tinfo -> tso_header_size = buf -> l2_len + buf -> l3_len + buf -> l4_len ; if ( tunneled ) tinfo -> tso_header_size += buf -> outer_l2_len + buf -> outer_l3_len ; if ( unlikely ( buf -> tso_segsz == 0 || tinfo -> tso_header_size == 0 || tinfo -> tso_header_size > MLX4_MAX_TSO_HEADER || tinfo -> tso_header_size > buf -> data_len ) ) return - EINVAL ; tinfo -> wqe_tso_seg_size = RTE_ALIGN ( sizeof ( struct mlx4_wqe_lso_seg ) + tinfo -> tso_header_size , sizeof ( struct mlx4_wqe_data_seg ) ) ; tinfo -> fence_size = ( ( sizeof ( struct mlx4_wqe_ctrl_seg ) + tinfo -> wqe_tso_seg_size ) >> MLX4_SEG_SHIFT ) + buf -> nb_segs ; tinfo -> wqe_size = RTE_ALIGN ( ( uint32_t ) ( tinfo -> fence_size << MLX4_SEG_SHIFT ) , MLX4_TXBB_SIZE ) ; if ( sq -> remain_size < tinfo -> wqe_size || tinfo -> wqe_size > MLX4_MAX_WQE_SIZE ) return - ENOMEM ; tinfo -> pv = ( struct pv * ) txq -> bounce_buf ; tinfo -> pv_counter = 0 ; return 0 ; }
Obtain and calculate TSO information needed for assembling a TSO WQE.
Obtain and calculate TSO information needed for assembling a TSO WQE .
/*
	 * Calculate the WQE TSO segment size
	 * Note:
	 * 1. An LSO segment must be padded such that the subsequent data
	 *    segment is 16-byte aligned.
	 * 2. The start address of the TSO segment is always 16 Bytes aligned.
	 */ /* Validate WQE size and WQE space in the send queue. */ /* Init pv. */