aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet/sfc
diff options
context:
space:
mode:
authorBen Hutchings <bhutchings@solarflare.com>2013-01-08 18:43:19 -0500
committerBen Hutchings <bhutchings@solarflare.com>2013-08-29 13:12:14 -0400
commitba8977bdb20d7ae72ec6fddc1c081ca2d56852cb (patch)
tree21b65914a3de92f9e69327ce1f7891fa8f39e0f7 /drivers/net/ethernet/sfc
parent3881d8ab065b23bb07400aa820e737d80fdaced3 (diff)
sfc: Extend struct efx_tx_buffer to allow pushing option descriptors
The TX path firmware for EF10 supports 'option descriptors' to control offloads and various other features. Add a flag and field for these in struct efx_tx_buffer, and don't treat them as DMA descriptors on completion. Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
Diffstat (limited to 'drivers/net/ethernet/sfc')
-rw-r--r--drivers/net/ethernet/sfc/farch.c2
-rw-r--r--drivers/net/ethernet/sfc/net_driver.h7
-rw-r--r--drivers/net/ethernet/sfc/tx.c4
3 files changed, 11 insertions, 2 deletions
diff --git a/drivers/net/ethernet/sfc/farch.c b/drivers/net/ethernet/sfc/farch.c
index 842f92e45517..65073aac3c80 100644
--- a/drivers/net/ethernet/sfc/farch.c
+++ b/drivers/net/ethernet/sfc/farch.c
@@ -325,6 +325,8 @@ void efx_farch_tx_write(struct efx_tx_queue *tx_queue)
325 txd = efx_tx_desc(tx_queue, write_ptr); 325 txd = efx_tx_desc(tx_queue, write_ptr);
326 ++tx_queue->write_count; 326 ++tx_queue->write_count;
327 327
328 EFX_BUG_ON_PARANOID(buffer->flags & EFX_TX_BUF_OPTION);
329
328 /* Create TX descriptor ring entry */ 330 /* Create TX descriptor ring entry */
329 BUILD_BUG_ON(EFX_TX_BUF_CONT != 1); 331 BUILD_BUG_ON(EFX_TX_BUF_CONT != 1);
330 EFX_POPULATE_QWORD_4(*txd, 332 EFX_POPULATE_QWORD_4(*txd,
diff --git a/drivers/net/ethernet/sfc/net_driver.h b/drivers/net/ethernet/sfc/net_driver.h
index c9b6f2dcb539..d1aa5dcec963 100644
--- a/drivers/net/ethernet/sfc/net_driver.h
+++ b/drivers/net/ethernet/sfc/net_driver.h
@@ -135,6 +135,7 @@ struct efx_special_buffer {
135 * freed when descriptor completes 135 * freed when descriptor completes
136 * @heap_buf: When @flags & %EFX_TX_BUF_HEAP, the associated heap buffer to be 136 * @heap_buf: When @flags & %EFX_TX_BUF_HEAP, the associated heap buffer to be
137 * freed when descriptor completes. 137 * freed when descriptor completes.
138 * @option: When @flags & %EFX_TX_BUF_OPTION, a NIC-specific option descriptor.
138 * @dma_addr: DMA address of the fragment. 139 * @dma_addr: DMA address of the fragment.
139 * @flags: Flags for allocation and DMA mapping type 140 * @flags: Flags for allocation and DMA mapping type
140 * @len: Length of this fragment. 141 * @len: Length of this fragment.
@@ -146,7 +147,10 @@ struct efx_tx_buffer {
146 const struct sk_buff *skb; 147 const struct sk_buff *skb;
147 void *heap_buf; 148 void *heap_buf;
148 }; 149 };
149 dma_addr_t dma_addr; 150 union {
151 efx_qword_t option;
152 dma_addr_t dma_addr;
153 };
150 unsigned short flags; 154 unsigned short flags;
151 unsigned short len; 155 unsigned short len;
152 unsigned short unmap_len; 156 unsigned short unmap_len;
@@ -155,6 +159,7 @@ struct efx_tx_buffer {
155#define EFX_TX_BUF_SKB 2 /* buffer is last part of skb */ 159#define EFX_TX_BUF_SKB 2 /* buffer is last part of skb */
156#define EFX_TX_BUF_HEAP 4 /* buffer was allocated with kmalloc() */ 160#define EFX_TX_BUF_HEAP 4 /* buffer was allocated with kmalloc() */
157#define EFX_TX_BUF_MAP_SINGLE 8 /* buffer was mapped with dma_map_single() */ 161#define EFX_TX_BUF_MAP_SINGLE 8 /* buffer was mapped with dma_map_single() */
162#define EFX_TX_BUF_OPTION 0x10 /* empty buffer for option descriptor */
158 163
159/** 164/**
160 * struct efx_tx_queue - An Efx TX queue 165 * struct efx_tx_queue - An Efx TX queue
diff --git a/drivers/net/ethernet/sfc/tx.c b/drivers/net/ethernet/sfc/tx.c
index 85ee647b28ad..82075f9f02e6 100644
--- a/drivers/net/ethernet/sfc/tx.c
+++ b/drivers/net/ethernet/sfc/tx.c
@@ -306,7 +306,9 @@ static void efx_dequeue_buffers(struct efx_tx_queue *tx_queue,
306 306
307 while (read_ptr != stop_index) { 307 while (read_ptr != stop_index) {
308 struct efx_tx_buffer *buffer = &tx_queue->buffer[read_ptr]; 308 struct efx_tx_buffer *buffer = &tx_queue->buffer[read_ptr];
309 if (unlikely(buffer->len == 0)) { 309
310 if (!(buffer->flags & EFX_TX_BUF_OPTION) &&
311 unlikely(buffer->len == 0)) {
310 netif_err(efx, tx_err, efx->net_dev, 312 netif_err(efx, tx_err, efx->net_dev,
311 "TX queue %d spurious TX completion id %x\n", 313 "TX queue %d spurious TX completion id %x\n",
312 tx_queue->queue, read_ptr); 314 tx_queue->queue, read_ptr);