diff options
author | David S. Miller <davem@davemloft.net> | 2008-12-16 18:23:54 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-12-16 18:23:54 -0500 |
commit | 354ade9058687fdef8a612c7b298d4c51dae3da7 (patch) | |
tree | 842cf24f53e8451058afa9a58a4ac7e54c7099be /drivers/net/tlan.c | |
parent | 9f690db7ff4cb32493c0b0b13334cc4f5fd49a6b (diff) | |
parent | bb5f133dbc4f04b6388715d364ae5865455166c2 (diff) |
Merge branch 'master' of master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6
Conflicts:
drivers/net/enc28j60.c
Diffstat (limited to 'drivers/net/tlan.c')
-rw-r--r-- | drivers/net/tlan.c | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/drivers/net/tlan.c b/drivers/net/tlan.c index 055d3429851f..369eec744188 100644 --- a/drivers/net/tlan.c +++ b/drivers/net/tlan.c | |||
@@ -1098,6 +1098,7 @@ static int TLan_StartTx( struct sk_buff *skb, struct net_device *dev ) | |||
1098 | dma_addr_t tail_list_phys; | 1098 | dma_addr_t tail_list_phys; |
1099 | u8 *tail_buffer; | 1099 | u8 *tail_buffer; |
1100 | unsigned long flags; | 1100 | unsigned long flags; |
1101 | unsigned int txlen; | ||
1101 | 1102 | ||
1102 | if ( ! priv->phyOnline ) { | 1103 | if ( ! priv->phyOnline ) { |
1103 | TLAN_DBG( TLAN_DEBUG_TX, "TRANSMIT: %s PHY is not ready\n", | 1104 | TLAN_DBG( TLAN_DEBUG_TX, "TRANSMIT: %s PHY is not ready\n", |
@@ -1108,6 +1109,7 @@ static int TLan_StartTx( struct sk_buff *skb, struct net_device *dev ) | |||
1108 | 1109 | ||
1109 | if (skb_padto(skb, TLAN_MIN_FRAME_SIZE)) | 1110 | if (skb_padto(skb, TLAN_MIN_FRAME_SIZE)) |
1110 | return 0; | 1111 | return 0; |
1112 | txlen = max(skb->len, (unsigned int)TLAN_MIN_FRAME_SIZE); | ||
1111 | 1113 | ||
1112 | tail_list = priv->txList + priv->txTail; | 1114 | tail_list = priv->txList + priv->txTail; |
1113 | tail_list_phys = priv->txListDMA + sizeof(TLanList) * priv->txTail; | 1115 | tail_list_phys = priv->txListDMA + sizeof(TLanList) * priv->txTail; |
@@ -1125,16 +1127,16 @@ static int TLan_StartTx( struct sk_buff *skb, struct net_device *dev ) | |||
1125 | 1127 | ||
1126 | if ( bbuf ) { | 1128 | if ( bbuf ) { |
1127 | tail_buffer = priv->txBuffer + ( priv->txTail * TLAN_MAX_FRAME_SIZE ); | 1129 | tail_buffer = priv->txBuffer + ( priv->txTail * TLAN_MAX_FRAME_SIZE ); |
1128 | skb_copy_from_linear_data(skb, tail_buffer, skb->len); | 1130 | skb_copy_from_linear_data(skb, tail_buffer, txlen); |
1129 | } else { | 1131 | } else { |
1130 | tail_list->buffer[0].address = pci_map_single(priv->pciDev, | 1132 | tail_list->buffer[0].address = pci_map_single(priv->pciDev, |
1131 | skb->data, skb->len, | 1133 | skb->data, txlen, |
1132 | PCI_DMA_TODEVICE); | 1134 | PCI_DMA_TODEVICE); |
1133 | TLan_StoreSKB(tail_list, skb); | 1135 | TLan_StoreSKB(tail_list, skb); |
1134 | } | 1136 | } |
1135 | 1137 | ||
1136 | tail_list->frameSize = (u16) skb->len; | 1138 | tail_list->frameSize = (u16) txlen; |
1137 | tail_list->buffer[0].count = TLAN_LAST_BUFFER | (u32) skb->len; | 1139 | tail_list->buffer[0].count = TLAN_LAST_BUFFER | (u32) txlen; |
1138 | tail_list->buffer[1].count = 0; | 1140 | tail_list->buffer[1].count = 0; |
1139 | tail_list->buffer[1].address = 0; | 1141 | tail_list->buffer[1].address = 0; |
1140 | 1142 | ||
@@ -1431,7 +1433,9 @@ static u32 TLan_HandleTxEOF( struct net_device *dev, u16 host_int ) | |||
1431 | if ( ! bbuf ) { | 1433 | if ( ! bbuf ) { |
1432 | struct sk_buff *skb = TLan_GetSKB(head_list); | 1434 | struct sk_buff *skb = TLan_GetSKB(head_list); |
1433 | pci_unmap_single(priv->pciDev, head_list->buffer[0].address, | 1435 | pci_unmap_single(priv->pciDev, head_list->buffer[0].address, |
1434 | skb->len, PCI_DMA_TODEVICE); | 1436 | max(skb->len, |
1437 | (unsigned int)TLAN_MIN_FRAME_SIZE), | ||
1438 | PCI_DMA_TODEVICE); | ||
1435 | dev_kfree_skb_any(skb); | 1439 | dev_kfree_skb_any(skb); |
1436 | head_list->buffer[8].address = 0; | 1440 | head_list->buffer[8].address = 0; |
1437 | head_list->buffer[9].address = 0; | 1441 | head_list->buffer[9].address = 0; |
@@ -2053,9 +2057,12 @@ static void TLan_FreeLists( struct net_device *dev ) | |||
2053 | list = priv->txList + i; | 2057 | list = priv->txList + i; |
2054 | skb = TLan_GetSKB(list); | 2058 | skb = TLan_GetSKB(list); |
2055 | if ( skb ) { | 2059 | if ( skb ) { |
2056 | pci_unmap_single(priv->pciDev, | 2060 | pci_unmap_single( |
2057 | list->buffer[0].address, skb->len, | 2061 | priv->pciDev, |
2058 | PCI_DMA_TODEVICE); | 2062 | list->buffer[0].address, |
2063 | max(skb->len, | ||
2064 | (unsigned int)TLAN_MIN_FRAME_SIZE), | ||
2065 | PCI_DMA_TODEVICE); | ||
2059 | dev_kfree_skb_any( skb ); | 2066 | dev_kfree_skb_any( skb ); |
2060 | list->buffer[8].address = 0; | 2067 | list->buffer[8].address = 0; |
2061 | list->buffer[9].address = 0; | 2068 | list->buffer[9].address = 0; |