Commit c1996fc2 authored by Alan Cox's avatar Alan Cox Committed by Greg Kroah-Hartman

Staging: et131x: tidy up a bit further

Clean up the minor uglies left from the previous work
Signed-off-by: default avatarAlan Cox <alan@linux.intel.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 116badfe
...@@ -94,7 +94,6 @@ ...@@ -94,7 +94,6 @@
#include "et1310_tx.h" #include "et1310_tx.h"
static void et131x_update_tcb_list(struct et131x_adapter *etdev);
static inline void et131x_free_send_packet(struct et131x_adapter *etdev, static inline void et131x_free_send_packet(struct et131x_adapter *etdev,
struct tcb *tcb); struct tcb *tcb);
static int et131x_send_packet(struct sk_buff *skb, static int et131x_send_packet(struct sk_buff *skb,
...@@ -230,15 +229,10 @@ void ConfigTxDmaRegs(struct et131x_adapter *etdev) ...@@ -230,15 +229,10 @@ void ConfigTxDmaRegs(struct et131x_adapter *etdev)
/* Initialise the transmit DMA engine */ /* Initialise the transmit DMA engine */
writel(NUM_DESC_PER_RING_TX - 1, &txdma->pr_num_des.value); writel(NUM_DESC_PER_RING_TX - 1, &txdma->pr_num_des.value);
/* Load the completion writeback physical address /* Load the completion writeback physical address */
* writel((u32)((u64)etdev->tx_ring.pTxStatusPa >> 32),
* NOTE: pci_alloc_consistent(), used above to alloc DMA regions, &txdma->dma_wb_base_hi);
* ALWAYS returns SAC (32-bit) addresses. If DAC (64-bit) addresses writel((u32)etdev->tx_ring.pTxStatusPa, &txdma->dma_wb_base_lo);
* are ever returned, make sure the high part is retrieved here before
* storing the adjusted address.
*/
writel(0, &txdma->dma_wb_base_hi);
writel(etdev->tx_ring.pTxStatusPa, &txdma->dma_wb_base_lo);
memset(etdev->tx_ring.pTxStatusVa, 0, sizeof(TX_STATUS_BLOCK_t)); memset(etdev->tx_ring.pTxStatusVa, 0, sizeof(TX_STATUS_BLOCK_t));
...@@ -279,7 +273,7 @@ void et131x_tx_dma_enable(struct et131x_adapter *etdev) ...@@ -279,7 +273,7 @@ void et131x_tx_dma_enable(struct et131x_adapter *etdev)
void et131x_init_send(struct et131x_adapter *adapter) void et131x_init_send(struct et131x_adapter *adapter)
{ {
struct tcb *tcb; struct tcb *tcb;
u32 count; u32 ct;
struct tx_ring *tx_ring; struct tx_ring *tx_ring;
/* Setup some convenience pointers */ /* Setup some convenience pointers */
...@@ -289,23 +283,22 @@ void et131x_init_send(struct et131x_adapter *adapter) ...@@ -289,23 +283,22 @@ void et131x_init_send(struct et131x_adapter *adapter)
tx_ring->TCBReadyQueueHead = tcb; tx_ring->TCBReadyQueueHead = tcb;
/* Go through and set up each TCB */ /* Go through and set up each TCB */
for (count = 0; count < NUM_TCB; count++) { for (ct = 0; ct < NUM_TCB; ct++) {
memset(tcb, 0, sizeof(struct tcb)); memset(tcb, 0, sizeof(struct tcb));
/* Set the link pointer in HW TCB to the next TCB in the /* Set the link pointer in HW TCB to the next TCB in the
* chain. If this is the last TCB in the chain, also set the * chain. If this is the last TCB in the chain, also set the
* tail pointer. * tail pointer.
*/ */
if (count < NUM_TCB - 1) { if (ct < NUM_TCB - 1)
tcb->Next = tcb + 1; tcb->Next = tcb + 1;
} else { else {
tx_ring->TCBReadyQueueTail = tcb; tx_ring->TCBReadyQueueTail = tcb;
tcb->Next = NULL; tcb->Next = NULL;
} }
tcb++; tcb++;
} }
/* Curr send queue should now be empty */ /* Curr send queue should now be empty */
tx_ring->CurrSendHead = NULL; tx_ring->CurrSendHead = NULL;
tx_ring->CurrSendTail = NULL; tx_ring->CurrSendTail = NULL;
...@@ -332,7 +325,7 @@ int et131x_send_packets(struct sk_buff *skb, struct net_device *netdev) ...@@ -332,7 +325,7 @@ int et131x_send_packets(struct sk_buff *skb, struct net_device *netdev)
*/ */
/* TCB is not available */ /* TCB is not available */
if (MP_TCB_RESOURCES_NOT_AVAILABLE(etdev)) { if (etdev->tx_ring.nBusySend >= NUM_TCB) {
/* NOTE: If there's an error on send, no need to queue the /* NOTE: If there's an error on send, no need to queue the
* packet under Linux; if we just send an error up to the * packet under Linux; if we just send an error up to the
* netif layer, it will resend the skb to us. * netif layer, it will resend the skb to us.
...@@ -342,26 +335,15 @@ int et131x_send_packets(struct sk_buff *skb, struct net_device *netdev) ...@@ -342,26 +335,15 @@ int et131x_send_packets(struct sk_buff *skb, struct net_device *netdev)
/* We need to see if the link is up; if it's not, make the /* We need to see if the link is up; if it's not, make the
* netif layer think we're good and drop the packet * netif layer think we're good and drop the packet
*/ */
/* if ((etdev->Flags & fMP_ADAPTER_FAIL_SEND_MASK) ||
* if( MP_SHOULD_FAIL_SEND( etdev ) || !netif_carrier_ok(netdev)) {
* etdev->DriverNoPhyAccess )
*/
if (MP_SHOULD_FAIL_SEND(etdev) || !netif_carrier_ok(netdev)) {
dev_kfree_skb_any(skb); dev_kfree_skb_any(skb);
skb = NULL; skb = NULL;
etdev->net_stats.tx_dropped++; etdev->net_stats.tx_dropped++;
} else { } else {
status = et131x_send_packet(skb, etdev); status = et131x_send_packet(skb, etdev);
if (status != 0 && status != -ENOMEM) {
if (status == -ENOMEM) {
/* NOTE: If there's an error on send, no need
* to queue the packet under Linux; if we just
* send an error up to the netif layer, it
* will resend the skb to us.
*/
} else if (status != 0) {
/* On any other error, make netif think we're /* On any other error, make netif think we're
* OK and drop the packet * OK and drop the packet
*/ */
...@@ -386,7 +368,7 @@ int et131x_send_packets(struct sk_buff *skb, struct net_device *netdev) ...@@ -386,7 +368,7 @@ int et131x_send_packets(struct sk_buff *skb, struct net_device *netdev)
static int et131x_send_packet(struct sk_buff *skb, static int et131x_send_packet(struct sk_buff *skb,
struct et131x_adapter *etdev) struct et131x_adapter *etdev)
{ {
int status = 0; int status;
struct tcb *tcb = NULL; struct tcb *tcb = NULL;
u16 *shbufva; u16 *shbufva;
unsigned long flags; unsigned long flags;
...@@ -429,8 +411,7 @@ static int et131x_send_packet(struct sk_buff *skb, ...@@ -429,8 +411,7 @@ static int et131x_send_packet(struct sk_buff *skb,
tcb->Next = NULL; tcb->Next = NULL;
/* Call the NIC specific send handler. */ /* Call the NIC specific send handler. */
if (status == 0) status = nic_send_packet(etdev, tcb);
status = nic_send_packet(etdev, tcb);
if (status != 0) { if (status != 0) {
spin_lock_irqsave(&etdev->TCBReadyQLock, flags); spin_lock_irqsave(&etdev->TCBReadyQLock, flags);
...@@ -725,12 +706,11 @@ inline void et131x_free_send_packet(struct et131x_adapter *etdev, ...@@ -725,12 +706,11 @@ inline void et131x_free_send_packet(struct et131x_adapter *etdev,
etdev->Stats.opackets++; etdev->Stats.opackets++;
if (etdev->tx_ring.TCBReadyQueueTail) { if (etdev->tx_ring.TCBReadyQueueTail)
etdev->tx_ring.TCBReadyQueueTail->Next = tcb; etdev->tx_ring.TCBReadyQueueTail->Next = tcb;
} else { else
/* Apparently ready Q is empty. */ /* Apparently ready Q is empty. */
etdev->tx_ring.TCBReadyQueueHead = tcb; etdev->tx_ring.TCBReadyQueueHead = tcb;
}
etdev->tx_ring.TCBReadyQueueTail = tcb; etdev->tx_ring.TCBReadyQueueTail = tcb;
...@@ -747,7 +727,6 @@ inline void et131x_free_send_packet(struct et131x_adapter *etdev, ...@@ -747,7 +727,6 @@ inline void et131x_free_send_packet(struct et131x_adapter *etdev,
void et131x_free_busy_send_packets(struct et131x_adapter *etdev) void et131x_free_busy_send_packets(struct et131x_adapter *etdev)
{ {
struct tcb *tcb; struct tcb *tcb;
struct list_head *entry;
unsigned long flags; unsigned long flags;
u32 freed = 0; u32 freed = 0;
...@@ -793,20 +772,6 @@ void et131x_free_busy_send_packets(struct et131x_adapter *etdev) ...@@ -793,20 +772,6 @@ void et131x_free_busy_send_packets(struct et131x_adapter *etdev)
* Assumption - Send spinlock has been acquired * Assumption - Send spinlock has been acquired
*/ */
void et131x_handle_send_interrupt(struct et131x_adapter *etdev) void et131x_handle_send_interrupt(struct et131x_adapter *etdev)
{
/* Mark as completed any packets which have been sent by the device. */
et131x_update_tcb_list(etdev);
}
/**
* et131x_update_tcb_list - Helper routine for Send Interrupt handler
* @etdev: pointer to our adapter
*
* Re-claims the send resources and completes sends. Can also be called as
* part of the NIC send routine when the "ServiceComplete" indication has
* wrapped.
*/
static void et131x_update_tcb_list(struct et131x_adapter *etdev)
{ {
unsigned long flags; unsigned long flags;
u32 serviced; u32 serviced;
......
...@@ -100,12 +100,6 @@ ...@@ -100,12 +100,6 @@
#define LO_MARK_PERCENT_FOR_PSR 15 #define LO_MARK_PERCENT_FOR_PSR 15
#define LO_MARK_PERCENT_FOR_RX 15 #define LO_MARK_PERCENT_FOR_RX 15
/* Macros specific to the private adapter structure */
#define MP_TCB_RESOURCES_AVAILABLE(_M) ((_M)->tx_ring.nBusySend < NUM_TCB)
#define MP_TCB_RESOURCES_NOT_AVAILABLE(_M) ((_M)->tx_ring.nBusySend >= NUM_TCB)
#define MP_SHOULD_FAIL_SEND(_M) ((_M)->Flags & fMP_ADAPTER_FAIL_SEND_MASK)
/* Counters for error rate monitoring */ /* Counters for error rate monitoring */
typedef struct _MP_ERR_COUNTERS { typedef struct _MP_ERR_COUNTERS {
u32 PktCountTxPackets; u32 PktCountTxPackets;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment