Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 41efea5a authored by Yevgeny Petrilin's avatar Yevgeny Petrilin Committed by David S. Miller
Browse files

mlx4_en: Consider inline packets on completion



Was trying to unmap work queue entries that had inline packets,
so naturally weren't mapped.

Signed-off-by: default avatarYevgeny Petrilin <yevgenyp@mellanox.co.il>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 33a2a2b4
Loading
Loading
Loading
Loading
+33 −26
Original line number Original line Diff line number Diff line
@@ -203,6 +203,7 @@ static u32 mlx4_en_free_tx_desc(struct mlx4_en_priv *priv,


	/* Optimize the common case when there are no wraparounds */
	/* Optimize the common case when there are no wraparounds */
	if (likely((void *) tx_desc + tx_info->nr_txbb * TXBB_SIZE <= end)) {
	if (likely((void *) tx_desc + tx_info->nr_txbb * TXBB_SIZE <= end)) {
		if (!tx_info->inl) {
			if (tx_info->linear) {
			if (tx_info->linear) {
				pci_unmap_single(mdev->pdev,
				pci_unmap_single(mdev->pdev,
					(dma_addr_t) be64_to_cpu(data->addr),
					(dma_addr_t) be64_to_cpu(data->addr),
@@ -217,6 +218,7 @@ static u32 mlx4_en_free_tx_desc(struct mlx4_en_priv *priv,
					(dma_addr_t) be64_to_cpu(data[i].addr),
					(dma_addr_t) be64_to_cpu(data[i].addr),
					frag->size, PCI_DMA_TODEVICE);
					frag->size, PCI_DMA_TODEVICE);
			}
			}
		}
		/* Stamp the freed descriptor */
		/* Stamp the freed descriptor */
		for (i = 0; i < tx_info->nr_txbb * TXBB_SIZE; i += STAMP_STRIDE) {
		for (i = 0; i < tx_info->nr_txbb * TXBB_SIZE; i += STAMP_STRIDE) {
			*ptr = stamp;
			*ptr = stamp;
@@ -224,6 +226,7 @@ static u32 mlx4_en_free_tx_desc(struct mlx4_en_priv *priv,
		}
		}


	} else {
	} else {
		if (!tx_info->inl) {
			if ((void *) data >= end) {
			if ((void *) data >= end) {
				data = (struct mlx4_wqe_data_seg *)
				data = (struct mlx4_wqe_data_seg *)
						(ring->buf + ((void *) data - end));
						(ring->buf + ((void *) data - end));
@@ -246,6 +249,7 @@ static u32 mlx4_en_free_tx_desc(struct mlx4_en_priv *priv,
					(dma_addr_t) be64_to_cpu(data->addr),
					(dma_addr_t) be64_to_cpu(data->addr),
					 frag->size, PCI_DMA_TODEVICE);
					 frag->size, PCI_DMA_TODEVICE);
			}
			}
		}
		/* Stamp the freed descriptor */
		/* Stamp the freed descriptor */
		for (i = 0; i < tx_info->nr_txbb * TXBB_SIZE; i += STAMP_STRIDE) {
		for (i = 0; i < tx_info->nr_txbb * TXBB_SIZE; i += STAMP_STRIDE) {
			*ptr = stamp;
			*ptr = stamp;
@@ -790,8 +794,11 @@ int mlx4_en_xmit(struct sk_buff *skb, struct net_device *dev)
			wmb();
			wmb();
			data->byte_count = cpu_to_be32(skb_headlen(skb) - lso_header_size);
			data->byte_count = cpu_to_be32(skb_headlen(skb) - lso_header_size);
		}
		}
	} else
		tx_info->inl = 0;
	} else {
		build_inline_wqe(tx_desc, skb, real_size, &vlan_tag, tx_ind, fragptr);
		build_inline_wqe(tx_desc, skb, real_size, &vlan_tag, tx_ind, fragptr);
		tx_info->inl = 1;
	}


	ring->prod += nr_txbb;
	ring->prod += nr_txbb;


+1 −0
Original line number Original line Diff line number Diff line
@@ -202,6 +202,7 @@ struct mlx4_en_tx_info {
	u32 nr_txbb;
	u32 nr_txbb;
	u8 linear;
	u8 linear;
	u8 data_offset;
	u8 data_offset;
	u8 inl;
};
};