linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: troy.kisky@boundarydevices.com (Troy Kisky)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH net-next V2 04/16] net: fec: reduce interrupts
Date: Wed, 2 Mar 2016 09:12:27 -0700	[thread overview]
Message-ID: <56D710EB.5000201@boundarydevices.com> (raw)
In-Reply-To: <VI1PR0401MB18558A7D0A57FA8EDBAD5EABFFBC0@VI1PR0401MB1855.eurprd04.prod.outlook.com>

On 3/2/2016 8:13 AM, Fugang Duan wrote:
> From: Troy Kisky <troy.kisky@boundarydevices.com> Sent: Thursday, February 25, 2016 8:37 AM
>> To: netdev at vger.kernel.org; davem at davemloft.net; b38611 at freescale.com
>> Cc: fabio.estevam at freescale.com; l.stach at pengutronix.de; andrew at lunn.ch;
>> tremyfr at gmail.com; linux at arm.linux.org.uk; linux-arm-
>> kernel at lists.infradead.org; laci at boundarydevices.com; shawnguo at kernel.org;
>> johannes at sipsolutions.net; stillcompiling at gmail.com;
>> sergei.shtylyov at cogentembedded.com; arnd at arndb.de; Troy Kisky
>> <troy.kisky@boundarydevices.com>
>> Subject: [PATCH net-next V2 04/16] net: fec: reduce interrupts
>>
>> By clearing the NAPI interrupts in the NAPI routine and not in the interrupt
>> handler, we can reduce the number of interrupts. We also don't need any
>> status variables as the registers are still valid.
>>
>> Also, notice that if budget pkts are received, the next call to fec_enet_rx_napi
>> will now continue to receive the previously pending packets.
>>
>> Signed-off-by: Troy Kisky <troy.kisky@boundarydevices.com>
>> ---
>>  drivers/net/ethernet/freescale/fec.h      |   6 +-
>>  drivers/net/ethernet/freescale/fec_main.c | 127 ++++++++++++----------------
>> --
>>  2 files changed, 50 insertions(+), 83 deletions(-)
>>
>> diff --git a/drivers/net/ethernet/freescale/fec.h
>> b/drivers/net/ethernet/freescale/fec.h
>> index 195122e..001200b 100644
>> --- a/drivers/net/ethernet/freescale/fec.h
>> +++ b/drivers/net/ethernet/freescale/fec.h
>> @@ -505,11 +505,7 @@ struct fec_enet_private {
>>
>>  	unsigned int total_tx_ring_size;
>>  	unsigned int total_rx_ring_size;
>> -
>> -	unsigned long work_tx;
>> -	unsigned long work_rx;
>> -	unsigned long work_ts;
>> -	unsigned long work_mdio;
>> +	uint	events;
>>
>>  	struct	platform_device *pdev;
>>
>> diff --git a/drivers/net/ethernet/freescale/fec_main.c
>> b/drivers/net/ethernet/freescale/fec_main.c
>> index c517194..4a218b9 100644
>> --- a/drivers/net/ethernet/freescale/fec_main.c
>> +++ b/drivers/net/ethernet/freescale/fec_main.c
>> @@ -70,8 +70,6 @@ static void fec_enet_itr_coal_init(struct net_device
>> *ndev);
>>
>>  #define DRIVER_NAME	"fec"
>>
>> -#define FEC_ENET_GET_QUQUE(_x) ((_x == 0) ? 1 : ((_x == 1) ? 2 : 0))
>> -
>>  /* Pause frame feild and FIFO threshold */
>>  #define FEC_ENET_FCE	(1 << 5)
>>  #define FEC_ENET_RSEM_V	0x84
>> @@ -1257,21 +1255,6 @@ static void fec_txq(struct net_device *ndev, struct
>> fec_enet_private *fep,
>>  		writel(0, txq->bd.reg_desc_active);
>>  }
>>
>> -static void
>> -fec_enet_tx(struct net_device *ndev)
>> -{
>> -	struct fec_enet_private *fep = netdev_priv(ndev);
>> -	struct fec_enet_priv_tx_q *txq;
>> -	u16 queue_id;
>> -	/* First process class A queue, then Class B and Best Effort queue */
>> -	for_each_set_bit(queue_id, &fep->work_tx, FEC_ENET_MAX_TX_QS)
>> {
>> -		clear_bit(queue_id, &fep->work_tx);
>> -		txq = fep->tx_queue[FEC_ENET_GET_QUQUE(queue_id)];
>> -		fec_txq(ndev, fep, txq);
>> -	}
>> -	return;
>> -}
>> -
>>  static int
>>  fec_enet_new_rxbdp(struct net_device *ndev, struct bufdesc *bdp, struct
>> sk_buff *skb)  { @@ -1504,92 +1487,80 @@ rx_processing_done:
>>  	return pkt_received;
>>  }
>>
>> -static int
>> -fec_enet_rx(struct net_device *ndev, int budget) -{
>> -	int     pkt_received = 0;
>> -	u16	queue_id;
>> -	struct fec_enet_private *fep = netdev_priv(ndev);
>> -	struct fec_enet_priv_rx_q *rxq;
>> -
>> -	for_each_set_bit(queue_id, &fep->work_rx, FEC_ENET_MAX_RX_QS)
>> {
>> -		clear_bit(queue_id, &fep->work_rx);
>> -		rxq = fep->rx_queue[FEC_ENET_GET_QUQUE(queue_id)];
>> -		pkt_received += fec_rxq(ndev, fep, rxq, budget -
>> pkt_received);
>> -	}
>> -	return pkt_received;
>> -}
>> -
>> -static bool
>> -fec_enet_collect_events(struct fec_enet_private *fep, uint int_events) -{
>> -	if (int_events == 0)
>> -		return false;
>> -
>> -	if (int_events & FEC_ENET_RXF_0)
>> -		fep->work_rx |= (1 << 2);
>> -	if (int_events & FEC_ENET_RXF_1)
>> -		fep->work_rx |= (1 << 0);
>> -	if (int_events & FEC_ENET_RXF_2)
>> -		fep->work_rx |= (1 << 1);
>> -
>> -	if (int_events & FEC_ENET_TXF_0)
>> -		fep->work_tx |= (1 << 2);
>> -	if (int_events & FEC_ENET_TXF_1)
>> -		fep->work_tx |= (1 << 0);
>> -	if (int_events & FEC_ENET_TXF_2)
>> -		fep->work_tx |= (1 << 1);
>> -
>> -	return true;
>> -}
>> -
>>  static irqreturn_t
>>  fec_enet_interrupt(int irq, void *dev_id)  {
>>  	struct net_device *ndev = dev_id;
>>  	struct fec_enet_private *fep = netdev_priv(ndev);
>> -	uint int_events;
>> -	irqreturn_t ret = IRQ_NONE;
>> +	uint eir = readl(fep->hwp + FEC_IEVENT);
>> +	uint int_events = eir & readl(fep->hwp + FEC_IMASK);
>>
>> -	int_events = readl(fep->hwp + FEC_IEVENT);
>> -	writel(int_events, fep->hwp + FEC_IEVENT);
>> -	fec_enet_collect_events(fep, int_events);
>> -
>> -	if ((fep->work_tx || fep->work_rx) && fep->link) {
>> -		ret = IRQ_HANDLED;
>> +	if (!int_events)
>> +		return IRQ_NONE;
>>
>> +	if (int_events & (FEC_ENET_RXF | FEC_ENET_TXF)) {
>>  		if (napi_schedule_prep(&fep->napi)) {
>>  			/* Disable the NAPI interrupts */
>>  			writel(FEC_NAPI_IMASK, fep->hwp + FEC_IMASK);
>>  			__napi_schedule(&fep->napi);
>> +			int_events &= ~(FEC_ENET_RXF | FEC_ENET_TXF);
>> +			if (!int_events)
>> +				return IRQ_HANDLED;
>> +		} else {
>> +			fep->events |= int_events;
>> +			pr_info("%s: couldn't schedule NAPI\n", __func__);
>>  		}
>>  	}
>>
>> -	if (int_events & FEC_ENET_MII) {
>> -		ret = IRQ_HANDLED;
>> +	writel(int_events, fep->hwp + FEC_IEVENT);
>> +	if (int_events & FEC_ENET_MII)
>>  		complete(&fep->mdio_done);
>> -	}
>>
>> -	if (fep->ptp_clock)
>> +	if ((int_events & FEC_ENET_TS_TIMER) && fep->ptp_clock)
>>  		fec_ptp_check_pps_event(fep);
>> -
> This is error in here.  FEC compare timer event is not TS timer.
> 
> 


So when should fec_ptp_check_pps_event be called ? On every interrupt ?

If napi is active, it is going to be delayed for a very long time.
Should it be moved to the napi routine?

  reply	other threads:[~2016-03-02 16:12 UTC|newest]

Thread overview: 53+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-25  0:36 [PATCH net-next V2 00/16] net: fec: cleanup and fixes Troy Kisky
2016-02-25  0:36 ` [PATCH net-next V2 01/16] net: fec: only check queue 0 if RXF_0/TXF_0 interrupt is set Troy Kisky
2016-03-02 14:57   ` Fugang Duan
2016-02-25  0:36 ` [PATCH net-next V2 02/16] net: fec: pass rxq to fec_enet_rx_queue instead of queue_id Troy Kisky
2016-03-01 21:05   ` Zhi Li
2016-03-02 15:01   ` Fugang Duan
2016-02-25  0:36 ` [PATCH net-next V2 03/16] net: fec: pass txq to fec_enet_tx_queue " Troy Kisky
2016-03-01 21:06   ` Zhi Li
2016-03-01 21:51     ` Troy Kisky
2016-03-01 22:26       ` Zhi Li
2016-03-01 22:43         ` Troy Kisky
2016-03-02 15:16   ` Fugang Duan
2016-03-02 16:13     ` Troy Kisky
2016-03-04  7:41       ` Fugang Duan
2016-03-04 16:23         ` Troy Kisky
2016-02-25  0:36 ` [PATCH net-next V2 04/16] net: fec: reduce interrupts Troy Kisky
2016-03-02 15:13   ` Fugang Duan
2016-03-02 16:12     ` Troy Kisky [this message]
2016-03-02 16:44       ` Zhi Li
2016-03-02 16:47       ` Zhi Li
2016-03-02 22:32         ` Troy Kisky
2016-03-02 22:52           ` Zhi Li
2016-03-04  8:58   ` Fugang Duan
2016-02-25  0:36 ` [PATCH net-next V2 05/16] net: fec: split off napi routine with 3 queues Troy Kisky
2016-02-25  0:36 ` [PATCH net-next V2 06/16] net: fec: don't clear all rx queue bits when just one is being checked Troy Kisky
2016-03-04  9:11   ` Fugang Duan
2016-03-04 16:18     ` Troy Kisky
2016-03-04 16:38       ` Russell King - ARM Linux
2016-03-04 17:28         ` Troy Kisky
2016-02-25  0:36 ` [PATCH net-next V2 07/16] net: fec: set cbd_sc without relying on previous value Troy Kisky
2016-03-04  9:29   ` Fugang Duan
2016-03-04 16:08     ` Troy Kisky
2016-03-05 23:55       ` Fugang Duan
2016-02-25  0:36 ` [PATCH net-next V2 08/16] net: fec: eliminate calls to fec_enet_get_prevdesc Troy Kisky
2016-03-04  9:33   ` Fugang Duan
2016-03-04 16:05     ` Troy Kisky
2016-02-25  0:36 ` [PATCH net-next V2 09/16] net: fec: move restart test for efficiency Troy Kisky
2016-02-25  0:36 ` [PATCH net-next V2 10/16] net: fec: clear cbd_sc after transmission to help with debugging Troy Kisky
2016-02-25  0:36 ` [PATCH net-next V2 11/16] net: fec: dump all tx queues in fec_dump Troy Kisky
2016-02-25  0:36 ` [PATCH net-next V2 12/16] net: fec: detect tx int lost Troy Kisky
2016-02-25  0:36 ` [PATCH net-next V2 13/16] net: fec: print more debug info in fec_timeout Troy Kisky
2016-03-04 10:06   ` Fugang Duan
2016-03-04 16:05     ` Troy Kisky
2016-03-04 17:35       ` Joe Perches
2016-03-04 19:06         ` Troy Kisky
2016-02-25  0:36 ` [PATCH net-next V2 14/16] net: fec: create subroutine reset_tx_queue Troy Kisky
2016-02-25  0:36 ` [PATCH net-next V2 15/16] net: fec: call dma_unmap_single on mapped tx buffers at restart Troy Kisky
2016-02-25  0:36 ` [PATCH net-next V2 16/16] net: fec: don't set cbd_bufaddr unless no mapping error Troy Kisky
2016-02-25  2:52 ` [PATCH net-next V2 00/16] net: fec: cleanup and fixes Joshua Clayton
2016-02-25 16:05   ` Troy Kisky
2016-02-25 16:49     ` Joshua Clayton
2016-02-25  8:39 ` Holger Schurig
2016-02-25 15:57   ` Troy Kisky

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=56D710EB.5000201@boundarydevices.com \
    --to=troy.kisky@boundarydevices.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).