aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2013-11-02 01:10:54 -0400
committerDavid S. Miller <davem@davemloft.net>2013-11-02 01:10:54 -0400
commit853b185ac993754723adc31966128353061095b7 (patch)
treea9b875cd2edaabf26ff56896e5f3051d9262fa2c
parent8715fb364f87329ae52a03935942b6f0ee5482fe (diff)
parent2acdb92e85412bf791a3c01f2173695b6e0a3f72 (diff)
Merge branch 'for-davem' of git://git.kernel.org/pub/scm/linux/kernel/git/bwh/sfc-next
Ben Hutchings says: ==================== A single fix by Alexandre Rames for the recent changes to TSO. ==================== Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--drivers/net/ethernet/sfc/net_driver.h3
-rw-r--r--drivers/net/ethernet/sfc/tx.c7
2 files changed, 8 insertions, 2 deletions
diff --git a/drivers/net/ethernet/sfc/net_driver.h b/drivers/net/ethernet/sfc/net_driver.h
index aac22a1e85b8..b14a717ac3e8 100644
--- a/drivers/net/ethernet/sfc/net_driver.h
+++ b/drivers/net/ethernet/sfc/net_driver.h
@@ -141,6 +141,8 @@ struct efx_special_buffer {
141 * @len: Length of this fragment. 141 * @len: Length of this fragment.
142 * This field is zero when the queue slot is empty. 142 * This field is zero when the queue slot is empty.
143 * @unmap_len: Length of this fragment to unmap 143 * @unmap_len: Length of this fragment to unmap
144 * @dma_offset: Offset of @dma_addr from the address of the backing DMA mapping.
145 * Only valid if @unmap_len != 0.
144 */ 146 */
145struct efx_tx_buffer { 147struct efx_tx_buffer {
146 union { 148 union {
@@ -154,6 +156,7 @@ struct efx_tx_buffer {
154 unsigned short flags; 156 unsigned short flags;
155 unsigned short len; 157 unsigned short len;
156 unsigned short unmap_len; 158 unsigned short unmap_len;
159 unsigned short dma_offset;
157}; 160};
158#define EFX_TX_BUF_CONT 1 /* not last descriptor of packet */ 161#define EFX_TX_BUF_CONT 1 /* not last descriptor of packet */
159#define EFX_TX_BUF_SKB 2 /* buffer is last part of skb */ 162#define EFX_TX_BUF_SKB 2 /* buffer is last part of skb */
diff --git a/drivers/net/ethernet/sfc/tx.c b/drivers/net/ethernet/sfc/tx.c
index 282692c48e6b..c49d1fb16965 100644
--- a/drivers/net/ethernet/sfc/tx.c
+++ b/drivers/net/ethernet/sfc/tx.c
@@ -65,8 +65,7 @@ static void efx_dequeue_buffer(struct efx_tx_queue *tx_queue,
65{ 65{
66 if (buffer->unmap_len) { 66 if (buffer->unmap_len) {
67 struct device *dma_dev = &tx_queue->efx->pci_dev->dev; 67 struct device *dma_dev = &tx_queue->efx->pci_dev->dev;
68 dma_addr_t unmap_addr = (buffer->dma_addr + buffer->len - 68 dma_addr_t unmap_addr = buffer->dma_addr - buffer->dma_offset;
69 buffer->unmap_len);
70 if (buffer->flags & EFX_TX_BUF_MAP_SINGLE) 69 if (buffer->flags & EFX_TX_BUF_MAP_SINGLE)
71 dma_unmap_single(dma_dev, unmap_addr, buffer->unmap_len, 70 dma_unmap_single(dma_dev, unmap_addr, buffer->unmap_len,
72 DMA_TO_DEVICE); 71 DMA_TO_DEVICE);
@@ -414,6 +413,7 @@ netdev_tx_t efx_enqueue_skb(struct efx_tx_queue *tx_queue, struct sk_buff *skb)
414 /* Transfer ownership of the unmapping to the final buffer */ 413 /* Transfer ownership of the unmapping to the final buffer */
415 buffer->flags = EFX_TX_BUF_CONT | dma_flags; 414 buffer->flags = EFX_TX_BUF_CONT | dma_flags;
416 buffer->unmap_len = unmap_len; 415 buffer->unmap_len = unmap_len;
416 buffer->dma_offset = buffer->dma_addr - unmap_addr;
417 unmap_len = 0; 417 unmap_len = 0;
418 418
419 /* Get address and size of next fragment */ 419 /* Get address and size of next fragment */
@@ -980,6 +980,7 @@ static int efx_tso_put_header(struct efx_tx_queue *tx_queue,
980 return -ENOMEM; 980 return -ENOMEM;
981 } 981 }
982 buffer->unmap_len = buffer->len; 982 buffer->unmap_len = buffer->len;
983 buffer->dma_offset = 0;
983 buffer->flags |= EFX_TX_BUF_MAP_SINGLE; 984 buffer->flags |= EFX_TX_BUF_MAP_SINGLE;
984 } 985 }
985 986
@@ -1121,6 +1122,7 @@ static void tso_fill_packet_with_fragment(struct efx_tx_queue *tx_queue,
1121 if (st->in_len == 0) { 1122 if (st->in_len == 0) {
1122 /* Transfer ownership of the DMA mapping */ 1123 /* Transfer ownership of the DMA mapping */
1123 buffer->unmap_len = st->unmap_len; 1124 buffer->unmap_len = st->unmap_len;
1125 buffer->dma_offset = buffer->unmap_len - buffer->len;
1124 buffer->flags |= st->dma_flags; 1126 buffer->flags |= st->dma_flags;
1125 st->unmap_len = 0; 1127 st->unmap_len = 0;
1126 } 1128 }
@@ -1219,6 +1221,7 @@ static int tso_start_new_packet(struct efx_tx_queue *tx_queue,
1219 if (is_last) { 1221 if (is_last) {
1220 buffer->flags = EFX_TX_BUF_CONT | EFX_TX_BUF_MAP_SINGLE; 1222 buffer->flags = EFX_TX_BUF_CONT | EFX_TX_BUF_MAP_SINGLE;
1221 buffer->unmap_len = st->header_unmap_len; 1223 buffer->unmap_len = st->header_unmap_len;
1224 buffer->dma_offset = 0;
1222 /* Ensure we only unmap them once in case of a 1225 /* Ensure we only unmap them once in case of a
1223 * later DMA mapping error and rollback 1226 * later DMA mapping error and rollback
1224 */ 1227 */