aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet/sfc/net_driver.h
diff options
context:
space:
mode:
authorBen Hutchings <bhutchings@solarflare.com>2012-05-17 15:52:20 -0400
committerBen Hutchings <bhutchings@solarflare.com>2012-08-24 14:00:26 -0400
commit7668ff9c2ad7d354655e23afa836a92d54d2ea63 (patch)
tree01eaf41af56d406f1783f2bc8f7f70812759a130 /drivers/net/ethernet/sfc/net_driver.h
parent8f4cccbbd92f2ad0ddbbc498ef7cee2a1c3defe9 (diff)
sfc: Refactor struct efx_tx_buffer to use a flags field
Add a flags field to struct efx_tx_buffer, replacing the continuation and map_single booleans. Since a single descriptor cannot be both a TSO header and the last descriptor for an skb, unionise efx_tx_buffer::{skb,tsoh} and add flags for validity of these fields. Clear all flags in free buffers (whereas previously the continuation flag would be set). Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
Diffstat (limited to 'drivers/net/ethernet/sfc/net_driver.h')
-rw-r--r--drivers/net/ethernet/sfc/net_driver.h27
1 files changed, 14 insertions, 13 deletions
diff --git a/drivers/net/ethernet/sfc/net_driver.h b/drivers/net/ethernet/sfc/net_driver.h
index cd9c0a989692..0ac01fa6e63c 100644
--- a/drivers/net/ethernet/sfc/net_driver.h
+++ b/drivers/net/ethernet/sfc/net_driver.h
@@ -91,29 +91,30 @@ struct efx_special_buffer {
91}; 91};
92 92
93/** 93/**
94 * struct efx_tx_buffer - An Efx TX buffer 94 * struct efx_tx_buffer - buffer state for a TX descriptor
95 * @skb: The associated socket buffer. 95 * @skb: When @flags & %EFX_TX_BUF_SKB, the associated socket buffer to be
96 * Set only on the final fragment of a packet; %NULL for all other 96 * freed when descriptor completes
97 * fragments. When this fragment completes, then we can free this 97 * @tsoh: When @flags & %EFX_TX_BUF_TSOH, the associated TSO header structure.
98 * skb.
99 * @tsoh: The associated TSO header structure, or %NULL if this
100 * buffer is not a TSO header.
101 * @dma_addr: DMA address of the fragment. 98 * @dma_addr: DMA address of the fragment.
99 * @flags: Flags for allocation and DMA mapping type
102 * @len: Length of this fragment. 100 * @len: Length of this fragment.
103 * This field is zero when the queue slot is empty. 101 * This field is zero when the queue slot is empty.
104 * @continuation: True if this fragment is not the end of a packet.
105 * @unmap_single: True if dma_unmap_single should be used.
106 * @unmap_len: Length of this fragment to unmap 102 * @unmap_len: Length of this fragment to unmap
107 */ 103 */
108struct efx_tx_buffer { 104struct efx_tx_buffer {
109 const struct sk_buff *skb; 105 union {
110 struct efx_tso_header *tsoh; 106 const struct sk_buff *skb;
107 struct efx_tso_header *tsoh;
108 };
111 dma_addr_t dma_addr; 109 dma_addr_t dma_addr;
110 unsigned short flags;
112 unsigned short len; 111 unsigned short len;
113 bool continuation;
114 bool unmap_single;
115 unsigned short unmap_len; 112 unsigned short unmap_len;
116}; 113};
114#define EFX_TX_BUF_CONT 1 /* not last descriptor of packet */
115#define EFX_TX_BUF_SKB 2 /* buffer is last part of skb */
116#define EFX_TX_BUF_TSOH 4 /* buffer is TSO header */
117#define EFX_TX_BUF_MAP_SINGLE 8 /* buffer was mapped with dma_map_single() */
117 118
118/** 119/**
119 * struct efx_tx_queue - An Efx TX queue 120 * struct efx_tx_queue - An Efx TX queue