aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/via-velocity.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/via-velocity.c')
-rw-r--r--drivers/net/via-velocity.c41
1 files changed, 20 insertions, 21 deletions
diff --git a/drivers/net/via-velocity.c b/drivers/net/via-velocity.c
index bdb19c3d6568..cd4e866321f8 100644
--- a/drivers/net/via-velocity.c
+++ b/drivers/net/via-velocity.c
@@ -1879,13 +1879,12 @@ static void velocity_error(struct velocity_info *vptr, int status)
1879/** 1879/**
1880 * tx_srv - transmit interrupt service 1880 * tx_srv - transmit interrupt service
1881 * @vptr; Velocity 1881 * @vptr; Velocity
1882 * @status:
1883 * 1882 *
1884 * Scan the queues looking for transmitted packets that 1883 * Scan the queues looking for transmitted packets that
1885 * we can complete and clean up. Update any statistics as 1884 * we can complete and clean up. Update any statistics as
1886 * necessary/ 1885 * necessary/
1887 */ 1886 */
1888static int velocity_tx_srv(struct velocity_info *vptr, u32 status) 1887static int velocity_tx_srv(struct velocity_info *vptr)
1889{ 1888{
1890 struct tx_desc *td; 1889 struct tx_desc *td;
1891 int qnum; 1890 int qnum;
@@ -2092,14 +2091,12 @@ static int velocity_receive_frame(struct velocity_info *vptr, int idx)
2092/** 2091/**
2093 * velocity_rx_srv - service RX interrupt 2092 * velocity_rx_srv - service RX interrupt
2094 * @vptr: velocity 2093 * @vptr: velocity
2095 * @status: adapter status (unused)
2096 * 2094 *
2097 * Walk the receive ring of the velocity adapter and remove 2095 * Walk the receive ring of the velocity adapter and remove
2098 * any received packets from the receive queue. Hand the ring 2096 * any received packets from the receive queue. Hand the ring
2099 * slots back to the adapter for reuse. 2097 * slots back to the adapter for reuse.
2100 */ 2098 */
2101static int velocity_rx_srv(struct velocity_info *vptr, int status, 2099static int velocity_rx_srv(struct velocity_info *vptr, int budget_left)
2102 int budget_left)
2103{ 2100{
2104 struct net_device_stats *stats = &vptr->dev->stats; 2101 struct net_device_stats *stats = &vptr->dev->stats;
2105 int rd_curr = vptr->rx.curr; 2102 int rd_curr = vptr->rx.curr;
@@ -2153,32 +2150,24 @@ static int velocity_poll(struct napi_struct *napi, int budget)
2153 struct velocity_info *vptr = container_of(napi, 2150 struct velocity_info *vptr = container_of(napi,
2154 struct velocity_info, napi); 2151 struct velocity_info, napi);
2155 unsigned int rx_done; 2152 unsigned int rx_done;
2156 u32 isr_status; 2153 unsigned long flags;
2157
2158 spin_lock(&vptr->lock);
2159 isr_status = mac_read_isr(vptr->mac_regs);
2160
2161 /* Ack the interrupt */
2162 mac_write_isr(vptr->mac_regs, isr_status);
2163 if (isr_status & (~(ISR_PRXI | ISR_PPRXI | ISR_PTXI | ISR_PPTXI)))
2164 velocity_error(vptr, isr_status);
2165 2154
2155 spin_lock_irqsave(&vptr->lock, flags);
2166 /* 2156 /*
2167 * Do rx and tx twice for performance (taken from the VIA 2157 * Do rx and tx twice for performance (taken from the VIA
2168 * out-of-tree driver). 2158 * out-of-tree driver).
2169 */ 2159 */
2170 rx_done = velocity_rx_srv(vptr, isr_status, budget / 2); 2160 rx_done = velocity_rx_srv(vptr, budget / 2);
2171 velocity_tx_srv(vptr, isr_status); 2161 velocity_tx_srv(vptr);
2172 rx_done += velocity_rx_srv(vptr, isr_status, budget - rx_done); 2162 rx_done += velocity_rx_srv(vptr, budget - rx_done);
2173 velocity_tx_srv(vptr, isr_status); 2163 velocity_tx_srv(vptr);
2174
2175 spin_unlock(&vptr->lock);
2176 2164
2177 /* If budget not fully consumed, exit the polling mode */ 2165 /* If budget not fully consumed, exit the polling mode */
2178 if (rx_done < budget) { 2166 if (rx_done < budget) {
2179 napi_complete(napi); 2167 napi_complete(napi);
2180 mac_enable_int(vptr->mac_regs); 2168 mac_enable_int(vptr->mac_regs);
2181 } 2169 }
2170 spin_unlock_irqrestore(&vptr->lock, flags);
2182 2171
2183 return rx_done; 2172 return rx_done;
2184} 2173}
@@ -2208,10 +2197,17 @@ static irqreturn_t velocity_intr(int irq, void *dev_instance)
2208 return IRQ_NONE; 2197 return IRQ_NONE;
2209 } 2198 }
2210 2199
2200 /* Ack the interrupt */
2201 mac_write_isr(vptr->mac_regs, isr_status);
2202
2211 if (likely(napi_schedule_prep(&vptr->napi))) { 2203 if (likely(napi_schedule_prep(&vptr->napi))) {
2212 mac_disable_int(vptr->mac_regs); 2204 mac_disable_int(vptr->mac_regs);
2213 __napi_schedule(&vptr->napi); 2205 __napi_schedule(&vptr->napi);
2214 } 2206 }
2207
2208 if (isr_status & (~(ISR_PRXI | ISR_PPRXI | ISR_PTXI | ISR_PPTXI)))
2209 velocity_error(vptr, isr_status);
2210
2215 spin_unlock(&vptr->lock); 2211 spin_unlock(&vptr->lock);
2216 2212
2217 return IRQ_HANDLED; 2213 return IRQ_HANDLED;
@@ -3100,7 +3096,7 @@ static int velocity_resume(struct pci_dev *pdev)
3100 velocity_init_registers(vptr, VELOCITY_INIT_WOL); 3096 velocity_init_registers(vptr, VELOCITY_INIT_WOL);
3101 mac_disable_int(vptr->mac_regs); 3097 mac_disable_int(vptr->mac_regs);
3102 3098
3103 velocity_tx_srv(vptr, 0); 3099 velocity_tx_srv(vptr);
3104 3100
3105 for (i = 0; i < vptr->tx.numq; i++) { 3101 for (i = 0; i < vptr->tx.numq; i++) {
3106 if (vptr->tx.used[i]) 3102 if (vptr->tx.used[i])
@@ -3344,6 +3340,7 @@ static int velocity_set_coalesce(struct net_device *dev,
3344{ 3340{
3345 struct velocity_info *vptr = netdev_priv(dev); 3341 struct velocity_info *vptr = netdev_priv(dev);
3346 int max_us = 0x3f * 64; 3342 int max_us = 0x3f * 64;
3343 unsigned long flags;
3347 3344
3348 /* 6 bits of */ 3345 /* 6 bits of */
3349 if (ecmd->tx_coalesce_usecs > max_us) 3346 if (ecmd->tx_coalesce_usecs > max_us)
@@ -3365,6 +3362,7 @@ static int velocity_set_coalesce(struct net_device *dev,
3365 ecmd->tx_coalesce_usecs); 3362 ecmd->tx_coalesce_usecs);
3366 3363
3367 /* Setup the interrupt suppression and queue timers */ 3364 /* Setup the interrupt suppression and queue timers */
3365 spin_lock_irqsave(&vptr->lock, flags);
3368 mac_disable_int(vptr->mac_regs); 3366 mac_disable_int(vptr->mac_regs);
3369 setup_adaptive_interrupts(vptr); 3367 setup_adaptive_interrupts(vptr);
3370 setup_queue_timers(vptr); 3368 setup_queue_timers(vptr);
@@ -3372,6 +3370,7 @@ static int velocity_set_coalesce(struct net_device *dev,
3372 mac_write_int_mask(vptr->int_mask, vptr->mac_regs); 3370 mac_write_int_mask(vptr->int_mask, vptr->mac_regs);
3373 mac_clear_isr(vptr->mac_regs); 3371 mac_clear_isr(vptr->mac_regs);
3374 mac_enable_int(vptr->mac_regs); 3372 mac_enable_int(vptr->mac_regs);
3373 spin_unlock_irqrestore(&vptr->lock, flags);
3375 3374
3376 return 0; 3375 return 0;
3377} 3376}