i40e: Cleanup Tx buffer info layout
authorAlexander Duyck <alexander.h.duyck@intel.com>
Sat, 28 Sep 2013 06:00:17 +0000 (06:00 +0000)
committerJeff Kirsher <jeffrey.t.kirsher@intel.com>
Thu, 10 Oct 2013 04:14:41 +0000 (21:14 -0700)
- drop the mapped_as_page u8 from the Tx buffer info as it was unused
- use the DMA unmap accessors for Tx DMA
- replace checks of DMA with checks of the unmap length to verify if an
  unmap is needed
- update the Tx buffer layout to make it consistent with igb, ixgbe

Signed-off-by: Alexander Duyck <alexander.h.duyck@intel.com>
Signed-off-by: Jesse Brandeburg <jesse.brandeburg@intel.com>
Tested-by: Kavindya Deegala <kavindya.s.deegala@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
drivers/net/ethernet/intel/i40e/i40e_txrx.c
drivers/net/ethernet/intel/i40e/i40e_txrx.h

index 32c9aebcb575446c69a7f3971ceefeff769a670f..3bc3efa6229e81e34410bd0334be72a4782d9478 100644 (file)
@@ -195,20 +195,20 @@ static void i40e_fd_handle_status(struct i40e_ring *rx_ring, u32 qw, u8 prog_id)
 static inline void i40e_unmap_tx_resource(struct i40e_ring *ring,
                                          struct i40e_tx_buffer *tx_buffer)
 {
-       if (tx_buffer->dma) {
+       if (dma_unmap_len(tx_buffer, len)) {
                if (tx_buffer->tx_flags & I40E_TX_FLAGS_MAPPED_AS_PAGE)
                        dma_unmap_page(ring->dev,
-                                      tx_buffer->dma,
-                                      tx_buffer->length,
+                                      dma_unmap_addr(tx_buffer, dma),
+                                      dma_unmap_len(tx_buffer, len),
                                       DMA_TO_DEVICE);
                else
                        dma_unmap_single(ring->dev,
-                                        tx_buffer->dma,
-                                        tx_buffer->length,
+                                        dma_unmap_addr(tx_buffer, dma),
+                                        dma_unmap_len(tx_buffer, len),
                                         DMA_TO_DEVICE);
        }
-       tx_buffer->dma = 0;
        tx_buffer->time_stamp = 0;
+       dma_unmap_len_set(tx_buffer, len, 0);
 }
 
 /**
@@ -1554,9 +1554,9 @@ static void i40e_tx_map(struct i40e_ring *tx_ring, struct sk_buff *skb,
                }
 
                tx_bi = &tx_ring->tx_bi[i];
-               tx_bi->length = buf_offset + size;
+               dma_unmap_len_set(tx_bi, len, buf_offset + size);
+               dma_unmap_addr_set(tx_bi, dma, dma);
                tx_bi->tx_flags = tx_flags;
-               tx_bi->dma = dma;
 
                tx_desc->buffer_addr = cpu_to_le64(dma + buf_offset);
                tx_desc->cmd_type_offset_bsz = build_ctob(td_cmd, td_offset,
index 2fbacaff0445e8c7f6fcefa9d963e6e61dc7f67f..711f5493848974ff8445b10fb5f71b44801add64 100644 (file)
 #define I40E_TX_FLAGS_VLAN_SHIFT       16
 
 struct i40e_tx_buffer {
-       struct sk_buff *skb;
-       dma_addr_t dma;
-       unsigned long time_stamp;
-       u16 length;
-       u32 tx_flags;
        struct i40e_tx_desc *next_to_watch;
+       unsigned long time_stamp;
+       struct sk_buff *skb;
        unsigned int bytecount;
-       u16 gso_segs;
-       u8 mapped_as_page;
+       unsigned short gso_segs;
+       DEFINE_DMA_UNMAP_ADDR(dma);
+       DEFINE_DMA_UNMAP_LEN(len);
+       u32 tx_flags;
 };
 
 struct i40e_rx_buffer {