aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/net/mlx4/en_tx.c59
-rw-r--r--drivers/net/mlx4/mlx4_en.h1
2 files changed, 34 insertions, 26 deletions
diff --git a/drivers/net/mlx4/en_tx.c b/drivers/net/mlx4/en_tx.c
index ff4d75205c25..4afd5993e31c 100644
--- a/drivers/net/mlx4/en_tx.c
+++ b/drivers/net/mlx4/en_tx.c
@@ -203,19 +203,21 @@ static u32 mlx4_en_free_tx_desc(struct mlx4_en_priv *priv,
203 203
204 /* Optimize the common case when there are no wraparounds */ 204 /* Optimize the common case when there are no wraparounds */
205 if (likely((void *) tx_desc + tx_info->nr_txbb * TXBB_SIZE <= end)) { 205 if (likely((void *) tx_desc + tx_info->nr_txbb * TXBB_SIZE <= end)) {
206 if (tx_info->linear) { 206 if (!tx_info->inl) {
207 pci_unmap_single(mdev->pdev, 207 if (tx_info->linear) {
208 (dma_addr_t) be64_to_cpu(data->addr), 208 pci_unmap_single(mdev->pdev,
209 (dma_addr_t) be64_to_cpu(data->addr),
209 be32_to_cpu(data->byte_count), 210 be32_to_cpu(data->byte_count),
210 PCI_DMA_TODEVICE); 211 PCI_DMA_TODEVICE);
211 ++data; 212 ++data;
212 } 213 }
213 214
214 for (i = 0; i < frags; i++) { 215 for (i = 0; i < frags; i++) {
215 frag = &skb_shinfo(skb)->frags[i]; 216 frag = &skb_shinfo(skb)->frags[i];
216 pci_unmap_page(mdev->pdev, 217 pci_unmap_page(mdev->pdev,
217 (dma_addr_t) be64_to_cpu(data[i].addr), 218 (dma_addr_t) be64_to_cpu(data[i].addr),
218 frag->size, PCI_DMA_TODEVICE); 219 frag->size, PCI_DMA_TODEVICE);
220 }
219 } 221 }
220 /* Stamp the freed descriptor */ 222 /* Stamp the freed descriptor */
221 for (i = 0; i < tx_info->nr_txbb * TXBB_SIZE; i += STAMP_STRIDE) { 223 for (i = 0; i < tx_info->nr_txbb * TXBB_SIZE; i += STAMP_STRIDE) {
@@ -224,27 +226,29 @@ static u32 mlx4_en_free_tx_desc(struct mlx4_en_priv *priv,
224 } 226 }
225 227
226 } else { 228 } else {
227 if ((void *) data >= end) { 229 if (!tx_info->inl) {
228 data = (struct mlx4_wqe_data_seg *) 230 if ((void *) data >= end) {
229 (ring->buf + ((void *) data - end)); 231 data = (struct mlx4_wqe_data_seg *)
230 } 232 (ring->buf + ((void *) data - end));
233 }
231 234
232 if (tx_info->linear) { 235 if (tx_info->linear) {
233 pci_unmap_single(mdev->pdev, 236 pci_unmap_single(mdev->pdev,
234 (dma_addr_t) be64_to_cpu(data->addr), 237 (dma_addr_t) be64_to_cpu(data->addr),
235 be32_to_cpu(data->byte_count), 238 be32_to_cpu(data->byte_count),
236 PCI_DMA_TODEVICE); 239 PCI_DMA_TODEVICE);
237 ++data; 240 ++data;
238 } 241 }
239 242
240 for (i = 0; i < frags; i++) { 243 for (i = 0; i < frags; i++) {
241 /* Check for wraparound before unmapping */ 244 /* Check for wraparound before unmapping */
242 if ((void *) data >= end) 245 if ((void *) data >= end)
243 data = (struct mlx4_wqe_data_seg *) ring->buf; 246 data = (struct mlx4_wqe_data_seg *) ring->buf;
244 frag = &skb_shinfo(skb)->frags[i]; 247 frag = &skb_shinfo(skb)->frags[i];
245 pci_unmap_page(mdev->pdev, 248 pci_unmap_page(mdev->pdev,
246 (dma_addr_t) be64_to_cpu(data->addr), 249 (dma_addr_t) be64_to_cpu(data->addr),
247 frag->size, PCI_DMA_TODEVICE); 250 frag->size, PCI_DMA_TODEVICE);
251 }
248 } 252 }
249 /* Stamp the freed descriptor */ 253 /* Stamp the freed descriptor */
250 for (i = 0; i < tx_info->nr_txbb * TXBB_SIZE; i += STAMP_STRIDE) { 254 for (i = 0; i < tx_info->nr_txbb * TXBB_SIZE; i += STAMP_STRIDE) {
@@ -790,8 +794,11 @@ int mlx4_en_xmit(struct sk_buff *skb, struct net_device *dev)
790 wmb(); 794 wmb();
791 data->byte_count = cpu_to_be32(skb_headlen(skb) - lso_header_size); 795 data->byte_count = cpu_to_be32(skb_headlen(skb) - lso_header_size);
792 } 796 }
793 } else 797 tx_info->inl = 0;
798 } else {
794 build_inline_wqe(tx_desc, skb, real_size, &vlan_tag, tx_ind, fragptr); 799 build_inline_wqe(tx_desc, skb, real_size, &vlan_tag, tx_ind, fragptr);
800 tx_info->inl = 1;
801 }
795 802
796 ring->prod += nr_txbb; 803 ring->prod += nr_txbb;
797 804
diff --git a/drivers/net/mlx4/mlx4_en.h b/drivers/net/mlx4/mlx4_en.h
index 2e96c7b2180a..08bf321a9e62 100644
--- a/drivers/net/mlx4/mlx4_en.h
+++ b/drivers/net/mlx4/mlx4_en.h
@@ -202,6 +202,7 @@ struct mlx4_en_tx_info {
202 u32 nr_txbb; 202 u32 nr_txbb;
203 u8 linear; 203 u8 linear;
204 u8 data_offset; 204 u8 data_offset;
205 u8 inl;
205}; 206};
206 207
207 208