diff options
author | Alexander Duyck <alexander.h.duyck@intel.com> | 2010-08-19 09:40:54 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2010-08-19 19:45:28 -0400 |
commit | 84418e3b10b5ba43eb5b85f725e75fd9c9730670 (patch) | |
tree | 49c34a87c4c98ae21818141ebfbf12cf9744a4e4 /drivers/net/ixgbe/ixgbe_main.c | |
parent | 31f05a2d875327ef133ac4b62261c4b875d1d10c (diff) |
ixgbe: rewrite ethtool test to use standard config functions
This change makes it so that the ethtool loopback test uses the standard
ring configuration and allocation functions. As a result the loopback test
will be much more effective at testing core driver functionality.
Signed-off-by: Alexander Duyck <alexander.h.duyck@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ixgbe/ixgbe_main.c')
-rw-r--r-- | drivers/net/ixgbe/ixgbe_main.c | 49 |
1 files changed, 31 insertions, 18 deletions
diff --git a/drivers/net/ixgbe/ixgbe_main.c b/drivers/net/ixgbe/ixgbe_main.c index 85ecf0e39b99..18163e312a39 100644 --- a/drivers/net/ixgbe/ixgbe_main.c +++ b/drivers/net/ixgbe/ixgbe_main.c | |||
@@ -601,9 +601,9 @@ static inline void ixgbe_irq_rearm_queues(struct ixgbe_adapter *adapter, | |||
601 | } | 601 | } |
602 | } | 602 | } |
603 | 603 | ||
604 | static void ixgbe_unmap_and_free_tx_resource(struct ixgbe_adapter *adapter, | 604 | void ixgbe_unmap_and_free_tx_resource(struct ixgbe_adapter *adapter, |
605 | struct ixgbe_tx_buffer | 605 | struct ixgbe_tx_buffer |
606 | *tx_buffer_info) | 606 | *tx_buffer_info) |
607 | { | 607 | { |
608 | if (tx_buffer_info->dma) { | 608 | if (tx_buffer_info->dma) { |
609 | if (tx_buffer_info->mapped_as_page) | 609 | if (tx_buffer_info->mapped_as_page) |
@@ -1032,9 +1032,9 @@ static inline void ixgbe_release_rx_desc(struct ixgbe_hw *hw, | |||
1032 | * ixgbe_alloc_rx_buffers - Replace used receive buffers; packet split | 1032 | * ixgbe_alloc_rx_buffers - Replace used receive buffers; packet split |
1033 | * @adapter: address of board private structure | 1033 | * @adapter: address of board private structure |
1034 | **/ | 1034 | **/ |
1035 | static void ixgbe_alloc_rx_buffers(struct ixgbe_adapter *adapter, | 1035 | void ixgbe_alloc_rx_buffers(struct ixgbe_adapter *adapter, |
1036 | struct ixgbe_ring *rx_ring, | 1036 | struct ixgbe_ring *rx_ring, |
1037 | int cleaned_count) | 1037 | int cleaned_count) |
1038 | { | 1038 | { |
1039 | struct net_device *netdev = adapter->netdev; | 1039 | struct net_device *netdev = adapter->netdev; |
1040 | struct pci_dev *pdev = adapter->pdev; | 1040 | struct pci_dev *pdev = adapter->pdev; |
@@ -1095,6 +1095,7 @@ static void ixgbe_alloc_rx_buffers(struct ixgbe_adapter *adapter, | |||
1095 | rx_desc->read.hdr_addr = cpu_to_le64(bi->dma); | 1095 | rx_desc->read.hdr_addr = cpu_to_le64(bi->dma); |
1096 | } else { | 1096 | } else { |
1097 | rx_desc->read.pkt_addr = cpu_to_le64(bi->dma); | 1097 | rx_desc->read.pkt_addr = cpu_to_le64(bi->dma); |
1098 | rx_desc->read.hdr_addr = 0; | ||
1098 | } | 1099 | } |
1099 | 1100 | ||
1100 | i++; | 1101 | i++; |
@@ -2431,8 +2432,8 @@ static void ixgbe_configure_msi_and_legacy(struct ixgbe_adapter *adapter) | |||
2431 | * | 2432 | * |
2432 | * Configure the Tx descriptor ring after a reset. | 2433 | * Configure the Tx descriptor ring after a reset. |
2433 | **/ | 2434 | **/ |
2434 | static void ixgbe_configure_tx_ring(struct ixgbe_adapter *adapter, | 2435 | void ixgbe_configure_tx_ring(struct ixgbe_adapter *adapter, |
2435 | struct ixgbe_ring *ring) | 2436 | struct ixgbe_ring *ring) |
2436 | { | 2437 | { |
2437 | struct ixgbe_hw *hw = &adapter->hw; | 2438 | struct ixgbe_hw *hw = &adapter->hw; |
2438 | u64 tdba = ring->dma; | 2439 | u64 tdba = ring->dma; |
@@ -2759,8 +2760,8 @@ static void ixgbe_rx_desc_queue_enable(struct ixgbe_adapter *adapter, | |||
2759 | } | 2760 | } |
2760 | } | 2761 | } |
2761 | 2762 | ||
2762 | static void ixgbe_configure_rx_ring(struct ixgbe_adapter *adapter, | 2763 | void ixgbe_configure_rx_ring(struct ixgbe_adapter *adapter, |
2763 | struct ixgbe_ring *ring) | 2764 | struct ixgbe_ring *ring) |
2764 | { | 2765 | { |
2765 | struct ixgbe_hw *hw = &adapter->hw; | 2766 | struct ixgbe_hw *hw = &adapter->hw; |
2766 | u64 rdba = ring->dma; | 2767 | u64 rdba = ring->dma; |
@@ -3671,8 +3672,11 @@ static void ixgbe_clean_rx_ring(struct ixgbe_adapter *adapter, | |||
3671 | unsigned long size; | 3672 | unsigned long size; |
3672 | unsigned int i; | 3673 | unsigned int i; |
3673 | 3674 | ||
3674 | /* Free all the Rx ring sk_buffs */ | 3675 | /* ring already cleared, nothing to do */ |
3676 | if (!rx_ring->rx_buffer_info) | ||
3677 | return; | ||
3675 | 3678 | ||
3679 | /* Free all the Rx ring sk_buffs */ | ||
3676 | for (i = 0; i < rx_ring->count; i++) { | 3680 | for (i = 0; i < rx_ring->count; i++) { |
3677 | struct ixgbe_rx_buffer *rx_buffer_info; | 3681 | struct ixgbe_rx_buffer *rx_buffer_info; |
3678 | 3682 | ||
@@ -3739,8 +3743,11 @@ static void ixgbe_clean_tx_ring(struct ixgbe_adapter *adapter, | |||
3739 | unsigned long size; | 3743 | unsigned long size; |
3740 | unsigned int i; | 3744 | unsigned int i; |
3741 | 3745 | ||
3742 | /* Free all the Tx ring sk_buffs */ | 3746 | /* ring already cleared, nothing to do */ |
3747 | if (!tx_ring->tx_buffer_info) | ||
3748 | return; | ||
3743 | 3749 | ||
3750 | /* Free all the Tx ring sk_buffs */ | ||
3744 | for (i = 0; i < tx_ring->count; i++) { | 3751 | for (i = 0; i < tx_ring->count; i++) { |
3745 | tx_buffer_info = &tx_ring->tx_buffer_info[i]; | 3752 | tx_buffer_info = &tx_ring->tx_buffer_info[i]; |
3746 | ixgbe_unmap_and_free_tx_resource(adapter, tx_buffer_info); | 3753 | ixgbe_unmap_and_free_tx_resource(adapter, tx_buffer_info); |
@@ -6239,11 +6246,10 @@ static u16 ixgbe_select_queue(struct net_device *dev, struct sk_buff *skb) | |||
6239 | return skb_tx_hash(dev, skb); | 6246 | return skb_tx_hash(dev, skb); |
6240 | } | 6247 | } |
6241 | 6248 | ||
6242 | static netdev_tx_t ixgbe_xmit_frame(struct sk_buff *skb, | 6249 | netdev_tx_t ixgbe_xmit_frame_ring(struct sk_buff *skb, struct net_device *netdev, |
6243 | struct net_device *netdev) | 6250 | struct ixgbe_adapter *adapter, |
6251 | struct ixgbe_ring *tx_ring) | ||
6244 | { | 6252 | { |
6245 | struct ixgbe_adapter *adapter = netdev_priv(netdev); | ||
6246 | struct ixgbe_ring *tx_ring; | ||
6247 | struct netdev_queue *txq; | 6253 | struct netdev_queue *txq; |
6248 | unsigned int first; | 6254 | unsigned int first; |
6249 | unsigned int tx_flags = 0; | 6255 | unsigned int tx_flags = 0; |
@@ -6267,8 +6273,6 @@ static netdev_tx_t ixgbe_xmit_frame(struct sk_buff *skb, | |||
6267 | tx_flags |= IXGBE_TX_FLAGS_VLAN; | 6273 | tx_flags |= IXGBE_TX_FLAGS_VLAN; |
6268 | } | 6274 | } |
6269 | 6275 | ||
6270 | tx_ring = adapter->tx_ring[skb->queue_mapping]; | ||
6271 | |||
6272 | #ifdef IXGBE_FCOE | 6276 | #ifdef IXGBE_FCOE |
6273 | /* for FCoE with DCB, we force the priority to what | 6277 | /* for FCoE with DCB, we force the priority to what |
6274 | * was specified by the switch */ | 6278 | * was specified by the switch */ |
@@ -6362,6 +6366,15 @@ static netdev_tx_t ixgbe_xmit_frame(struct sk_buff *skb, | |||
6362 | return NETDEV_TX_OK; | 6366 | return NETDEV_TX_OK; |
6363 | } | 6367 | } |
6364 | 6368 | ||
6369 | static netdev_tx_t ixgbe_xmit_frame(struct sk_buff *skb, struct net_device *netdev) | ||
6370 | { | ||
6371 | struct ixgbe_adapter *adapter = netdev_priv(netdev); | ||
6372 | struct ixgbe_ring *tx_ring; | ||
6373 | |||
6374 | tx_ring = adapter->tx_ring[skb->queue_mapping]; | ||
6375 | return ixgbe_xmit_frame_ring(skb, netdev, adapter, tx_ring); | ||
6376 | } | ||
6377 | |||
6365 | /** | 6378 | /** |
6366 | * ixgbe_set_mac - Change the Ethernet Address of the NIC | 6379 | * ixgbe_set_mac - Change the Ethernet Address of the NIC |
6367 | * @netdev: network interface device structure | 6380 | * @netdev: network interface device structure |