aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'drivers')
-rw-r--r--drivers/net/sky2.c19
1 files changed, 7 insertions, 12 deletions
diff --git a/drivers/net/sky2.c b/drivers/net/sky2.c
index 8cc3eea727a8..151d8359a1ea 100644
--- a/drivers/net/sky2.c
+++ b/drivers/net/sky2.c
@@ -893,24 +893,18 @@ static inline struct sky2_rx_le *sky2_next_rx(struct sky2_port *sky2)
893 return le; 893 return le;
894} 894}
895 895
896/* Return high part of DMA address (could be 32 or 64 bit) */
897static inline u32 high32(dma_addr_t a)
898{
899 return sizeof(a) > sizeof(u32) ? (a >> 16) >> 16 : 0;
900}
901
902/* Build description to hardware for one receive segment */ 896/* Build description to hardware for one receive segment */
903static void sky2_rx_add(struct sky2_port *sky2, u8 op, 897static void sky2_rx_add(struct sky2_port *sky2, u8 op,
904 dma_addr_t map, unsigned len) 898 dma_addr_t map, unsigned len)
905{ 899{
906 struct sky2_rx_le *le; 900 struct sky2_rx_le *le;
907 u32 hi = high32(map); 901 u32 hi = upper_32_bits(map);
908 902
909 if (sky2->rx_addr64 != hi) { 903 if (sky2->rx_addr64 != hi) {
910 le = sky2_next_rx(sky2); 904 le = sky2_next_rx(sky2);
911 le->addr = cpu_to_le32(hi); 905 le->addr = cpu_to_le32(hi);
912 le->opcode = OP_ADDR64 | HW_OWNER; 906 le->opcode = OP_ADDR64 | HW_OWNER;
913 sky2->rx_addr64 = high32(map + len); 907 sky2->rx_addr64 = upper_32_bits(map + len);
914 } 908 }
915 909
916 le = sky2_next_rx(sky2); 910 le = sky2_next_rx(sky2);
@@ -1424,14 +1418,15 @@ static int sky2_xmit_frame(struct sk_buff *skb, struct net_device *dev)
1424 1418
1425 len = skb_headlen(skb); 1419 len = skb_headlen(skb);
1426 mapping = pci_map_single(hw->pdev, skb->data, len, PCI_DMA_TODEVICE); 1420 mapping = pci_map_single(hw->pdev, skb->data, len, PCI_DMA_TODEVICE);
1427 addr64 = high32(mapping); 1421 addr64 = upper_32_bits(mapping);
1428 1422
1429 /* Send high bits if changed or crosses boundary */ 1423 /* Send high bits if changed or crosses boundary */
1430 if (addr64 != sky2->tx_addr64 || high32(mapping + len) != sky2->tx_addr64) { 1424 if (addr64 != sky2->tx_addr64 ||
1425 upper_32_bits(mapping + len) != sky2->tx_addr64) {
1431 le = get_tx_le(sky2); 1426 le = get_tx_le(sky2);
1432 le->addr = cpu_to_le32(addr64); 1427 le->addr = cpu_to_le32(addr64);
1433 le->opcode = OP_ADDR64 | HW_OWNER; 1428 le->opcode = OP_ADDR64 | HW_OWNER;
1434 sky2->tx_addr64 = high32(mapping + len); 1429 sky2->tx_addr64 = upper_32_bits(mapping + len);
1435 } 1430 }
1436 1431
1437 /* Check for TCP Segmentation Offload */ 1432 /* Check for TCP Segmentation Offload */
@@ -1511,7 +1506,7 @@ static int sky2_xmit_frame(struct sk_buff *skb, struct net_device *dev)
1511 1506
1512 mapping = pci_map_page(hw->pdev, frag->page, frag->page_offset, 1507 mapping = pci_map_page(hw->pdev, frag->page, frag->page_offset,
1513 frag->size, PCI_DMA_TODEVICE); 1508 frag->size, PCI_DMA_TODEVICE);
1514 addr64 = high32(mapping); 1509 addr64 = upper_32_bits(mapping);
1515 if (addr64 != sky2->tx_addr64) { 1510 if (addr64 != sky2->tx_addr64) {
1516 le = get_tx_le(sky2); 1511 le = get_tx_le(sky2);
1517 le->addr = cpu_to_le32(addr64); 1512 le->addr = cpu_to_le32(addr64);