mirror of
https://github.com/torvalds/linux.git
synced 2026-05-31 02:24:24 +02:00
rtase: Implement the interrupt routine and rtase_poll
1. Implement rtase_interrupt to handle txQ0/rxQ0, txQ4~txQ7 interrupts, and implement rtase_q_interrupt to handle txQ1/rxQ1, txQ2/rxQ2 and txQ3/rxQ3 interrupts. 2. Implement rtase_poll to call ring_handler to process the tx or rx packet of each ring. If the returned value is budget,it means that there is still work of a certain ring that has not yet been completed. Signed-off-by: Justin Lai <justinlai0215@realtek.com> Link: https://patch.msgid.link/20240904032114.247117-5-justinlai0215@realtek.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
parent
5a2a2f1524
commit
2bbba79e34
|
|
@ -571,6 +571,75 @@ static void rtase_hw_start(const struct net_device *dev)
|
|||
rtase_enable_hw_interrupt(tp);
|
||||
}
|
||||
|
||||
/* the interrupt handler does RXQ0 and TXQ0, TXQ4~7 interrutp status
|
||||
*/
|
||||
static irqreturn_t rtase_interrupt(int irq, void *dev_instance)
|
||||
{
|
||||
const struct rtase_private *tp;
|
||||
struct rtase_int_vector *ivec;
|
||||
u32 status;
|
||||
|
||||
ivec = dev_instance;
|
||||
tp = ivec->tp;
|
||||
status = rtase_r32(tp, ivec->isr_addr);
|
||||
|
||||
rtase_w32(tp, ivec->imr_addr, 0x0);
|
||||
rtase_w32(tp, ivec->isr_addr, status & ~RTASE_FOVW);
|
||||
|
||||
if (napi_schedule_prep(&ivec->napi))
|
||||
__napi_schedule(&ivec->napi);
|
||||
|
||||
return IRQ_HANDLED;
|
||||
}
|
||||
|
||||
/* the interrupt handler does RXQ1&TXQ1 or RXQ2&TXQ2 or RXQ3&TXQ3 interrupt
|
||||
* status according to interrupt vector
|
||||
*/
|
||||
static irqreturn_t rtase_q_interrupt(int irq, void *dev_instance)
|
||||
{
|
||||
const struct rtase_private *tp;
|
||||
struct rtase_int_vector *ivec;
|
||||
u16 status;
|
||||
|
||||
ivec = dev_instance;
|
||||
tp = ivec->tp;
|
||||
status = rtase_r16(tp, ivec->isr_addr);
|
||||
|
||||
rtase_w16(tp, ivec->imr_addr, 0x0);
|
||||
rtase_w16(tp, ivec->isr_addr, status);
|
||||
|
||||
if (napi_schedule_prep(&ivec->napi))
|
||||
__napi_schedule(&ivec->napi);
|
||||
|
||||
return IRQ_HANDLED;
|
||||
}
|
||||
|
||||
static int rtase_poll(struct napi_struct *napi, int budget)
|
||||
{
|
||||
const struct rtase_int_vector *ivec;
|
||||
const struct rtase_private *tp;
|
||||
struct rtase_ring *ring;
|
||||
int total_workdone = 0;
|
||||
|
||||
ivec = container_of(napi, struct rtase_int_vector, napi);
|
||||
tp = ivec->tp;
|
||||
|
||||
list_for_each_entry(ring, &ivec->ring_list, ring_entry)
|
||||
total_workdone += ring->ring_handler(ring, budget);
|
||||
|
||||
if (total_workdone >= budget)
|
||||
return budget;
|
||||
|
||||
if (napi_complete_done(napi, total_workdone)) {
|
||||
if (!ivec->index)
|
||||
rtase_w32(tp, ivec->imr_addr, ivec->imr);
|
||||
else
|
||||
rtase_w16(tp, ivec->imr_addr, ivec->imr);
|
||||
}
|
||||
|
||||
return total_workdone;
|
||||
}
|
||||
|
||||
static int rtase_open(struct net_device *dev)
|
||||
{
|
||||
struct rtase_private *tp = netdev_priv(dev);
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user