Commit 9ded1a51 authored by Raghu Vatsavayi's avatar Raghu Vatsavayi Committed by David S. Miller

liquidio: CN23XX napi support

This patch adds NAPI related support for cn23xx device.
Signed-off-by: default avatarDerek Chickles <derek.chickles@caviumnetworks.com>
Signed-off-by: default avatarSatanand Burla <satananda.burla@caviumnetworks.com>
Signed-off-by: default avatarFelix Manlunas <felix.manlunas@caviumnetworks.com>
Signed-off-by: default avatarRaghu Vatsavayi <raghu.vatsavayi@caviumnetworks.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 9ff1a9ba
...@@ -1001,8 +1001,7 @@ int liquidio_schedule_msix_droq_pkt_handler(struct octeon_droq *droq, u64 ret) ...@@ -1001,8 +1001,7 @@ int liquidio_schedule_msix_droq_pkt_handler(struct octeon_droq *droq, u64 ret)
* \brief Droq packet processor sceduler * \brief Droq packet processor sceduler
* @param oct octeon device * @param oct octeon device
*/ */
static static void liquidio_schedule_droq_pkt_handlers(struct octeon_device *oct)
void liquidio_schedule_droq_pkt_handlers(struct octeon_device *oct)
{ {
struct octeon_device_priv *oct_priv = struct octeon_device_priv *oct_priv =
(struct octeon_device_priv *)oct->priv; (struct octeon_device_priv *)oct->priv;
...@@ -2378,11 +2377,14 @@ static void napi_schedule_wrapper(void *param) ...@@ -2378,11 +2377,14 @@ static void napi_schedule_wrapper(void *param)
*/ */
static void liquidio_napi_drv_callback(void *arg) static void liquidio_napi_drv_callback(void *arg)
{ {
struct octeon_device *oct;
struct octeon_droq *droq = arg; struct octeon_droq *droq = arg;
int this_cpu = smp_processor_id(); int this_cpu = smp_processor_id();
if (droq->cpu_id == this_cpu) { oct = droq->oct_dev;
napi_schedule(&droq->napi);
if (OCTEON_CN23XX_PF(oct) || droq->cpu_id == this_cpu) {
napi_schedule_irqoff(&droq->napi);
} else { } else {
struct call_single_data *csd = &droq->csd; struct call_single_data *csd = &droq->csd;
......
...@@ -1301,17 +1301,36 @@ int lio_get_device_id(void *dev) ...@@ -1301,17 +1301,36 @@ int lio_get_device_id(void *dev)
void lio_enable_irq(struct octeon_droq *droq, struct octeon_instr_queue *iq) void lio_enable_irq(struct octeon_droq *droq, struct octeon_instr_queue *iq)
{ {
u64 instr_cnt;
struct octeon_device *oct = NULL;
/* the whole thing needs to be atomic, ideally */ /* the whole thing needs to be atomic, ideally */
if (droq) { if (droq) {
spin_lock_bh(&droq->lock); spin_lock_bh(&droq->lock);
writel(droq->pkt_count, droq->pkts_sent_reg); writel(droq->pkt_count, droq->pkts_sent_reg);
droq->pkt_count = 0; droq->pkt_count = 0;
spin_unlock_bh(&droq->lock); spin_unlock_bh(&droq->lock);
oct = droq->oct_dev;
} }
if (iq) { if (iq) {
spin_lock_bh(&iq->lock); spin_lock_bh(&iq->lock);
writel(iq->pkt_in_done, iq->inst_cnt_reg); writel(iq->pkt_in_done, iq->inst_cnt_reg);
iq->pkt_in_done = 0; iq->pkt_in_done = 0;
spin_unlock_bh(&iq->lock); spin_unlock_bh(&iq->lock);
oct = iq->oct_dev;
}
/*write resend. Writing RESEND in SLI_PKTX_CNTS should be enough
*to trigger tx interrupts as well, if they are pending.
*/
if (oct && OCTEON_CN23XX_PF(oct)) {
if (droq)
writeq(CN23XX_INTR_RESEND, droq->pkts_sent_reg);
/*we race with firmrware here. read and write the IN_DONE_CNTS*/
else if (iq) {
instr_cnt = readq(iq->inst_cnt_reg);
writeq(((instr_cnt & 0xFFFFFFFF00000000ULL) |
CN23XX_INTR_RESEND),
iq->inst_cnt_reg);
}
} }
} }
...@@ -573,7 +573,7 @@ octeon_droq_dispatch_pkt(struct octeon_device *oct, ...@@ -573,7 +573,7 @@ octeon_droq_dispatch_pkt(struct octeon_device *oct,
(unsigned int)rh->r.opcode, (unsigned int)rh->r.opcode,
(unsigned int)rh->r.subcode); (unsigned int)rh->r.subcode);
droq->stats.dropped_nodispatch++; droq->stats.dropped_nodispatch++;
} /* else (dispatch_fn ... */ }
return cnt; return cnt;
} }
...@@ -887,8 +887,11 @@ octeon_process_droq_poll_cmd(struct octeon_device *oct, u32 q_no, int cmd, ...@@ -887,8 +887,11 @@ octeon_process_droq_poll_cmd(struct octeon_device *oct, u32 q_no, int cmd,
return 0; return 0;
} }
break; break;
case OCTEON_CN23XX_PF_VID: {
lio_enable_irq(oct->droq[q_no], oct->instr_queue[q_no]);
}
break;
} }
return 0; return 0;
} }
......
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