diff options
author | Ben Hutchings <bhutchings@solarflare.com> | 2008-09-01 07:46:43 -0400 |
---|---|---|
committer | Jeff Garzik <jgarzik@redhat.com> | 2008-09-03 09:53:44 -0400 |
commit | cc12dac2e512c2b6185ed91899e09e9910630315 (patch) | |
tree | 4f44217788642343ad4dc0d17001ce8259bb39d8 /drivers/net/sfc | |
parent | ecbd95c17c221913cc3c5776051b2fa8b3b97316 (diff) |
sfc: Reduce the size of struct efx_tx_buffer
Remove unmap_addr since it can be calculated from dma_addr, len and
unmap_len. This saves 4-16 bytes.
Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
Diffstat (limited to 'drivers/net/sfc')
-rw-r--r-- | drivers/net/sfc/net_driver.h | 2 | ||||
-rw-r--r-- | drivers/net/sfc/tx.c | 20 |
2 files changed, 11 insertions, 11 deletions
diff --git a/drivers/net/sfc/net_driver.h b/drivers/net/sfc/net_driver.h index f539e2e0da1b..6369f9253c7b 100644 --- a/drivers/net/sfc/net_driver.h +++ b/drivers/net/sfc/net_driver.h | |||
@@ -130,7 +130,6 @@ struct efx_special_buffer { | |||
130 | * This field is zero when the queue slot is empty. | 130 | * This field is zero when the queue slot is empty. |
131 | * @continuation: True if this fragment is not the end of a packet. | 131 | * @continuation: True if this fragment is not the end of a packet. |
132 | * @unmap_single: True if pci_unmap_single should be used. | 132 | * @unmap_single: True if pci_unmap_single should be used. |
133 | * @unmap_addr: DMA address to unmap | ||
134 | * @unmap_len: Length of this fragment to unmap | 133 | * @unmap_len: Length of this fragment to unmap |
135 | */ | 134 | */ |
136 | struct efx_tx_buffer { | 135 | struct efx_tx_buffer { |
@@ -140,7 +139,6 @@ struct efx_tx_buffer { | |||
140 | unsigned short len; | 139 | unsigned short len; |
141 | unsigned char continuation; | 140 | unsigned char continuation; |
142 | unsigned char unmap_single; | 141 | unsigned char unmap_single; |
143 | dma_addr_t unmap_addr; | ||
144 | unsigned short unmap_len; | 142 | unsigned short unmap_len; |
145 | }; | 143 | }; |
146 | 144 | ||
diff --git a/drivers/net/sfc/tx.c b/drivers/net/sfc/tx.c index 11127757c05d..5f01371baaf9 100644 --- a/drivers/net/sfc/tx.c +++ b/drivers/net/sfc/tx.c | |||
@@ -64,12 +64,14 @@ static inline void efx_dequeue_buffer(struct efx_tx_queue *tx_queue, | |||
64 | { | 64 | { |
65 | if (buffer->unmap_len) { | 65 | if (buffer->unmap_len) { |
66 | struct pci_dev *pci_dev = tx_queue->efx->pci_dev; | 66 | struct pci_dev *pci_dev = tx_queue->efx->pci_dev; |
67 | dma_addr_t unmap_addr = (buffer->dma_addr + buffer->len - | ||
68 | buffer->unmap_len); | ||
67 | if (buffer->unmap_single) | 69 | if (buffer->unmap_single) |
68 | pci_unmap_single(pci_dev, buffer->unmap_addr, | 70 | pci_unmap_single(pci_dev, unmap_addr, buffer->unmap_len, |
69 | buffer->unmap_len, PCI_DMA_TODEVICE); | 71 | PCI_DMA_TODEVICE); |
70 | else | 72 | else |
71 | pci_unmap_page(pci_dev, buffer->unmap_addr, | 73 | pci_unmap_page(pci_dev, unmap_addr, buffer->unmap_len, |
72 | buffer->unmap_len, PCI_DMA_TODEVICE); | 74 | PCI_DMA_TODEVICE); |
73 | buffer->unmap_len = 0; | 75 | buffer->unmap_len = 0; |
74 | buffer->unmap_single = 0; | 76 | buffer->unmap_single = 0; |
75 | } | 77 | } |
@@ -233,7 +235,6 @@ static inline int efx_enqueue_skb(struct efx_tx_queue *tx_queue, | |||
233 | } while (len); | 235 | } while (len); |
234 | 236 | ||
235 | /* Transfer ownership of the unmapping to the final buffer */ | 237 | /* Transfer ownership of the unmapping to the final buffer */ |
236 | buffer->unmap_addr = unmap_addr; | ||
237 | buffer->unmap_single = unmap_single; | 238 | buffer->unmap_single = unmap_single; |
238 | buffer->unmap_len = unmap_len; | 239 | buffer->unmap_len = unmap_len; |
239 | unmap_len = 0; | 240 | unmap_len = 0; |
@@ -805,6 +806,7 @@ static inline void efx_tso_put_header(struct efx_tx_queue *tx_queue, | |||
805 | static void efx_enqueue_unwind(struct efx_tx_queue *tx_queue) | 806 | static void efx_enqueue_unwind(struct efx_tx_queue *tx_queue) |
806 | { | 807 | { |
807 | struct efx_tx_buffer *buffer; | 808 | struct efx_tx_buffer *buffer; |
809 | dma_addr_t unmap_addr; | ||
808 | 810 | ||
809 | /* Work backwards until we hit the original insert pointer value */ | 811 | /* Work backwards until we hit the original insert pointer value */ |
810 | while (tx_queue->insert_count != tx_queue->write_count) { | 812 | while (tx_queue->insert_count != tx_queue->write_count) { |
@@ -816,15 +818,15 @@ static void efx_enqueue_unwind(struct efx_tx_queue *tx_queue) | |||
816 | buffer->len = 0; | 818 | buffer->len = 0; |
817 | buffer->continuation = 1; | 819 | buffer->continuation = 1; |
818 | if (buffer->unmap_len) { | 820 | if (buffer->unmap_len) { |
821 | unmap_addr = (buffer->dma_addr + buffer->len - | ||
822 | buffer->unmap_len); | ||
819 | if (buffer->unmap_single) | 823 | if (buffer->unmap_single) |
820 | pci_unmap_single(tx_queue->efx->pci_dev, | 824 | pci_unmap_single(tx_queue->efx->pci_dev, |
821 | buffer->unmap_addr, | 825 | unmap_addr, buffer->unmap_len, |
822 | buffer->unmap_len, | ||
823 | PCI_DMA_TODEVICE); | 826 | PCI_DMA_TODEVICE); |
824 | else | 827 | else |
825 | pci_unmap_page(tx_queue->efx->pci_dev, | 828 | pci_unmap_page(tx_queue->efx->pci_dev, |
826 | buffer->unmap_addr, | 829 | unmap_addr, buffer->unmap_len, |
827 | buffer->unmap_len, | ||
828 | PCI_DMA_TODEVICE); | 830 | PCI_DMA_TODEVICE); |
829 | buffer->unmap_len = 0; | 831 | buffer->unmap_len = 0; |
830 | } | 832 | } |